1 |
mangano |
1.1 |
#include "DataFormats/FWLite/interface/Handle.h"
|
2 |
|
|
#include "DataFormats/FWLite/interface/ChainEvent.h"
|
3 |
|
|
#if !defined(__CINT__) && !defined(__MAKECINT__)
|
4 |
|
|
//Headers for the data items
|
5 |
|
|
|
6 |
|
|
#include <DataFormats/Common/interface/TriggerResults.h>
|
7 |
|
|
#include <FWCore/Common/interface/TriggerNames.h>
|
8 |
|
|
|
9 |
|
|
|
10 |
|
|
#endif
|
11 |
|
|
|
12 |
|
|
#include <iostream>
|
13 |
|
|
#include <string>
|
14 |
|
|
#include <fstream>
|
15 |
|
|
|
16 |
|
|
#include "TDirectory.h"
|
17 |
|
|
#include "TPad.h"
|
18 |
|
|
|
19 |
|
|
void listSkimmedEvent(const string name = "10.04.2010") {
|
20 |
|
|
const char* process = "Skim";
|
21 |
|
|
string fname ="merged_"+name+".root";
|
22 |
|
|
|
23 |
|
|
using namespace std;
|
24 |
|
|
vector<string> fileNames;
|
25 |
|
|
fileNames.push_back(fname);
|
26 |
|
|
fwlite::ChainEvent ev(fileNames);
|
27 |
|
|
|
28 |
|
|
fwlite::Handle<edm::TriggerResults> hTriggerResults;
|
29 |
|
|
|
30 |
|
|
int iEvent = 0;
|
31 |
|
|
vector<string> skimNames;
|
32 |
|
|
vector<ofstream*> fstreams;
|
33 |
|
|
for (ev.toBegin(); ! ev.atEnd(); ++ev) {
|
34 |
|
|
++iEvent;
|
35 |
|
|
hTriggerResults.getByLabel(ev,"TriggerResults","",process);
|
36 |
|
|
edm::TriggerNames const& triggerNames = ev.triggerNames(*hTriggerResults);
|
37 |
|
|
|
38 |
|
|
/* ==================================
|
39 |
|
|
* Here I open all the skim log files
|
40 |
|
|
* ================================== */
|
41 |
|
|
if(iEvent==1){
|
42 |
|
|
cout << "list of Skim Path names" << endl;
|
43 |
|
|
cout << "=======================" << endl;
|
44 |
|
|
|
45 |
|
|
for (unsigned i = 0; i < triggerNames.size(); ++i) {
|
46 |
|
|
cout << triggerNames.triggerName(i) << endl;
|
47 |
|
|
skimNames.push_back(triggerNames.triggerName(i));
|
48 |
|
|
ofstream* tmp = new ofstream; fstreams.push_back(tmp);
|
49 |
|
|
string streamName = name+"_"+skimNames[i];
|
50 |
|
|
fstreams[i]->open(streamName.c_str());
|
51 |
|
|
}
|
52 |
|
|
}
|
53 |
|
|
|
54 |
|
|
|
55 |
|
|
/* ========================================================
|
56 |
|
|
* Here I dump the skim path information into the log files
|
57 |
|
|
* ======================================================== */
|
58 |
|
|
//std::cout << "\n\n\n === EVENT " << iEvent << "====" << std::endl;
|
59 |
|
|
for (unsigned i = 0; i < triggerNames.size(); ++i) {
|
60 |
|
|
if(hTriggerResults->accept(i)) {
|
61 |
|
|
//cout << "passing " << triggerNames.triggerName(i) << " at "
|
62 |
|
|
|
63 |
|
|
time_t t(ev.time().value() >> 32);
|
64 |
|
|
std::string time( asctime( gmtime(&t) ) );
|
65 |
|
|
size_t pos = time.find('\n');
|
66 |
|
|
if ( pos != std::string::npos ) time = time.substr(0,pos);
|
67 |
|
|
|
68 |
|
|
*(fstreams[i])
|
69 |
|
|
<< ev.eventAuxiliary().run() << "\t"
|
70 |
|
|
<< ev.eventAuxiliary().luminosityBlock() << "\t"
|
71 |
|
|
<< ev.eventAuxiliary().event() << "\t\t"
|
72 |
|
|
<< time << endl;
|
73 |
|
|
}
|
74 |
|
|
}
|
75 |
|
|
//if (iEvent >= 10) break;
|
76 |
|
|
}
|
77 |
|
|
|
78 |
|
|
/* ==================================
|
79 |
|
|
* Here I close all the skim log files
|
80 |
|
|
* ================================== */
|
81 |
|
|
for (unsigned i = 0; i < fstreams.size(); ++i) {
|
82 |
|
|
fstreams[i]->close();
|
83 |
|
|
delete fstreams[i];
|
84 |
|
|
}
|
85 |
|
|
|
86 |
|
|
|
87 |
|
|
}
|
88 |
|
|
|