91 |
|
vector<vector<unsigned> > zzcutvec; |
92 |
|
map<unsigned,float> evtrhoMap; |
93 |
|
vector<string> cutstrs; |
94 |
< |
bool passes_HLT_MC; |
94 |
> |
bool passes_HLT_MC,passes_HLT; |
95 |
|
vector<bool> PFnoPUflag;; |
96 |
|
|
97 |
|
// |
166 |
|
//-------------------------------------------------------------------------------------------------------------- |
167 |
|
TChain * chain = new TChain("Events"); |
168 |
|
TChain * hltchain = new TChain("HLT"); |
169 |
+ |
TChain * runchain = new TChain(Names::gkRunTreeName); |
170 |
|
|
171 |
|
string fname; |
172 |
|
unsigned total_unskimmed=0; |
180 |
|
total_unskimmed += entrymap[string(fname.c_str())]; |
181 |
|
chain->AddFile(fname.c_str()); |
182 |
|
hltchain->AddFile(fname.c_str()); |
183 |
+ |
runchain->AddFile(fname.c_str()); |
184 |
|
} |
185 |
|
} else { |
186 |
|
cout << "adding inputfile : " << ctrl.inputfile.c_str() << endl; |
190 |
|
total_unskimmed += unsk_ents; |
191 |
|
chain->AddFile(ctrl.inputfile.c_str()); |
192 |
|
hltchain->AddFile(ctrl.inputfile.c_str()); |
193 |
+ |
runchain->AddFile(ctrl.inputfile.c_str()); |
194 |
|
} |
195 |
|
// // write the total number of unskimmed events that went into making this output file to a text file |
196 |
< |
// writeEntries(ctrl,total_unskimmed); |
196 |
> |
writeEntries(ctrl,total_unskimmed); |
197 |
|
|
198 |
|
const char * ofname; |
199 |
|
if( strcmp( ctrl.outputfile.c_str(), "") ) { |
252 |
|
// initMuonIDMVA(); |
253 |
|
initElectronIDMVAV1(); |
254 |
|
initTrigger(); |
255 |
+ |
TrigInfo ti; |
256 |
+ |
initAnalysisTriggers(ti); |
257 |
|
|
258 |
|
// |
259 |
|
// Setup tree I/O |
263 |
|
string currentFile(""); |
264 |
|
|
265 |
|
UInt_t fNMaxTriggers = 1024; |
266 |
< |
mithep::EventHeader *info = new mithep::EventHeader(); |
266 |
> |
mithep::EventHeader *info = new mithep::EventHeader(); |
267 |
|
mithep::Array<mithep::PFMet> *metArr = new mithep::Array<mithep::PFMet>(); |
268 |
|
mithep::Array<mithep::Electron> *electronArr = new mithep::Array<mithep::Electron>(); |
269 |
|
mithep::Array<mithep::Muon> *muonArr = new mithep::Array<mithep::Muon>(); |
284 |
|
std::vector<std::string> *hltLab = new vector<string>(); |
285 |
|
TriggerObjectsTable *fTrigObjs = new TriggerObjectsTable(hltTable,fNMaxTriggers); |
286 |
|
|
287 |
+ |
RunInfo *runInfo = new RunInfo(); |
288 |
|
|
289 |
|
TString fElectronName(Names::gkElectronBrn); |
290 |
|
TString fMuonName(Names::gkMuonBrn); |
334 |
|
hltchain->SetBranchAddress(fTriggerTableName, &hltTableStrings); |
335 |
|
hltchain->SetBranchAddress(fTriggerLabelName, &hltLabelStrings); |
336 |
|
|
337 |
+ |
runchain->SetBranchAddress(Names::gkRunInfoBrn, &runInfo); |
338 |
+ |
|
339 |
|
mithep::Vertex vtx; // best primary vertex in the event |
340 |
|
|
341 |
|
// ginfo = NULL; |
356 |
|
// |
357 |
|
// Loop !!!!!!!!! |
358 |
|
//-------------------------------------------------------------------------------------------------------------- |
359 |
+ |
int lastHltEntry=-2; |
360 |
|
for(UInt_t ientry=0; ientry<imax; ientry++) |
361 |
|
{ |
362 |
|
chain->GetEntry(ientry); |
369 |
|
<< "\tEvt: " << info->EvtNum() |
370 |
|
<< "\tLumi: " << info->LumiSec() |
371 |
|
<< endl; |
372 |
+ |
cerr << "Run: " << info->RunNum() |
373 |
+ |
<< "\tEvt: " << info->EvtNum() |
374 |
+ |
<< "\tLumi: " << info->LumiSec() |
375 |
+ |
<< endl; |
376 |
|
cout << "-----------------------------------------------------------------" << endl; |
377 |
|
} |
378 |
|
|
379 |
< |
|
379 |
> |
runchain->GetEvent(info->RunEntry()); |
380 |
> |
hltchain->GetEntry(runInfo->HltEntry()); |
381 |
> |
hltTable->Clear(); |
382 |
> |
fillTriggerNames(hltTable, hltTableStrings ); |
383 |
> |
if(ctrl.debug && (lastHltEntry != runInfo->HltEntry())) hltTable->Print(); |
384 |
> |
lastHltEntry = runInfo->HltEntry(); |
385 |
> |
fillTriggerBits( hltTable, trigMask, triggerBits ); |
386 |
> |
setHLTObjectRelations( hltObjArr, hltRelsArr, hltTableStrings, hltLabelStrings, fTrigObjs ); |
387 |
> |
// printTriggerObjs( hltTable, fTrigObjs); |
388 |
> |
|
389 |
|
string fname = string(chain->GetFile()->GetEndpointUrl()->GetFile()); |
390 |
|
if(ctrl.debug) cout << "era is " << ctrl.era << endl; |
391 |
|
if( ctrl.era == 0 ) { |
402 |
|
assert(pfnopu_size == pfArr->GetEntries()); |
403 |
|
|
404 |
|
// |
405 |
+ |
// trigger |
406 |
+ |
// |
407 |
+ |
if( string(chain->GetFile()->GetEndpointUrl()->GetFile()) != currentFile ) { |
408 |
+ |
currentFile = string(chain->GetFile()->GetEndpointUrl()->GetFile()); |
409 |
+ |
} |
410 |
+ |
if( ctrl.debug ) cout << "file is : " << currentFile << endl; |
411 |
+ |
|
412 |
+ |
// |
413 |
|
// data/MC |
414 |
|
// |
415 |
|
if(ctrl.mc) { |
441 |
|
} |
442 |
|
} |
443 |
|
|
444 |
< |
// |
415 |
< |
// trigger |
416 |
< |
// |
417 |
< |
if( string(chain->GetFile()->GetEndpointUrl()->GetFile()) != currentFile ) { |
418 |
< |
currentFile = string(chain->GetFile()->GetEndpointUrl()->GetFile()); |
419 |
< |
hltchain->SetBranchAddress(fTriggerTableName, &hltTableStrings); |
420 |
< |
hltchain->SetBranchAddress(fTriggerLabelName, &hltLabelStrings); |
421 |
< |
hltchain->GetEntry(0); |
422 |
< |
hltTable->Clear(); |
423 |
< |
fillTriggerNames(hltTable, hltTableStrings ); |
424 |
< |
hltTable->Print(); |
425 |
< |
} |
426 |
< |
if( ctrl.debug ) cout << "file is : " << currentFile << endl; |
427 |
< |
fillTriggerBits( hltTable, trigMask, triggerBits ); |
444 |
> |
// trigger |
445 |
|
passes_HLT_MC = true; // passed to apply as extern global, just for sync |
446 |
|
if( !passHLTMC(triggerBits, info->RunNum(), info->EvtNum(), k2012_MC ) ) { |
447 |
|
passes_HLT_MC = false; |
448 |
|
} |
449 |
|
|
433 |
– |
setHLTObjectRelations( hltObjArr, hltRelsArr, hltTableStrings, hltLabelStrings, fTrigObjs ); |
434 |
– |
|
450 |
|
} else { |
451 |
|
// |
452 |
|
// JSON |
459 |
|
} |
460 |
|
} |
461 |
|
|
447 |
– |
// |
462 |
|
// trigger |
463 |
< |
// |
464 |
< |
if( string(chain->GetFile()->GetEndpointUrl()->GetFile()) != currentFile ) { |
465 |
< |
currentFile = string(chain->GetFile()->GetEndpointUrl()->GetFile()); |
452 |
< |
hltchain->SetBranchAddress(fTriggerTableName, &hltTableStrings); |
453 |
< |
hltchain->SetBranchAddress(fTriggerLabelName, &hltLabelStrings); |
454 |
< |
hltchain->GetEntry(0); |
455 |
< |
hltTable->Clear(); |
456 |
< |
fillTriggerNames(hltTable, hltTableStrings ); |
463 |
> |
passes_HLT = true; |
464 |
> |
if( !passHLT(ctrl, triggerBits,ti,info->RunNum()) ) { |
465 |
> |
passes_HLT = false; |
466 |
|
} |
467 |
|
|
459 |
– |
setHLTObjectRelations( hltObjArr, hltRelsArr, hltTableStrings, hltLabelStrings, fTrigObjs ); |
460 |
– |
|
461 |
– |
if( ctrl.debug ) cout << "file is : " << currentFile << endl; |
462 |
– |
/* |
463 |
– |
fillTriggerBits( hltTable, trigMask, triggerBits ); |
464 |
– |
if( !passHLT(triggerBits, info->RunNum(), info->EvtNum() ) ) { |
465 |
– |
if( ctrl.debug ) cout << "\tfails trigger ... " << endl; |
466 |
– |
continue; |
467 |
– |
} |
468 |
– |
*/ |
468 |
|
} |
469 |
|
|
470 |
|
// |
552 |
|
if(ctrl.debug) |
553 |
|
cout << "failing with some other code : " << ret4l.status.selectionBits << endl; |
554 |
|
} |
555 |
< |
} |
555 |
> |
if(ctrl.debug) |
556 |
> |
cout << "passes HLT: " << passes_HLT << endl; |
557 |
> |
} |
558 |
|
|
559 |
|
|
560 |
|
foTree.getFile()->cd(); |