28 |
|
datasetType_ (cfg.getParameter<string> ("datasetType")), |
29 |
|
channels_ (cfg.getParameter<vector<edm::ParameterSet> >("channels")), |
30 |
|
histogramSets_ (cfg.getParameter<vector<edm::ParameterSet> >("histogramSets")), |
31 |
+ |
useEDMFormat_ (cfg.getParameter<bool>("useEDMFormat")), |
32 |
+ |
treeBranchSets_ (cfg.getParameter<vector<edm::ParameterSet> >("treeBranchSets")), |
33 |
|
plotAllObjectsInPassingEvents_ (cfg.getParameter<bool> ("plotAllObjectsInPassingEvents")), |
34 |
|
doPileupReweighting_ (cfg.getParameter<bool> ("doPileupReweighting")), |
35 |
|
applyLeptonSF_ (cfg.getParameter<bool> ("applyLeptonSF")), |
36 |
< |
printEventInfo_ (cfg.getParameter<bool> ("printEventInfo")), |
36 |
> |
applyBtagSF_ (cfg.getParameter<bool> ("applyBtagSF")), |
37 |
> |
minBtag_ (cfg.getParameter<int> ("minBtag")), |
38 |
> |
maxBtag_ (cfg.getParameter<int> ("maxBtag")), |
39 |
> |
printEventInfo_ (cfg.getParameter<bool> ("printEventInfo")), |
40 |
> |
printAllTriggers_ (cfg.getParameter<bool> ("printAllTriggers")), |
41 |
|
useTrackCaloRhoCorr_ (cfg.getParameter<bool> ("useTrackCaloRhoCorr")), |
42 |
|
stopCTau_ (cfg.getParameter<vector<double> > ("stopCTau")), |
43 |
|
GetPlotsAfterEachCut_ (cfg.getParameter<bool> ("GetPlotsAfterEachCut")) |
44 |
< |
{ |
44 |
> |
{ |
45 |
|
|
46 |
|
TH1::SetDefaultSumw2 (); |
47 |
|
|
52 |
|
muonSFWeight_ = new MuonSFWeight (muonSFFile_, muonSF_); |
53 |
|
electronSFWeight_ = new ElectronSFWeight ("53X", electronSFID_); |
54 |
|
} |
55 |
+ |
if (applyBtagSF_){ |
56 |
+ |
bTagSFWeight_ = new BtagSFWeight; |
57 |
+ |
} |
58 |
|
} |
59 |
|
if (datasetType_ == "signalMC" && regex_match (dataset_, regex ("stop.*to.*_.*mm.*"))) |
60 |
|
stopCTauWeight_ = new StopCTauWeight (stopCTau_.at (0), stopCTau_.at (1), stops_); |
66 |
|
|
67 |
|
//always get vertex collection so we can assign the primary vertex in the event |
68 |
|
objectsToGet.push_back("primaryvertexs"); |
60 |
– |
|
61 |
– |
//always make the plot of number of primary vertices (to check pile-up reweighting) |
69 |
|
objectsToPlot.push_back("primaryvertexs"); |
70 |
+ |
objectsToCut.push_back("primaryvertexs"); |
71 |
+ |
|
72 |
|
|
73 |
|
//always get the MC particles to do GEN-matching |
74 |
|
objectsToGet.push_back("mcparticles"); |
76 |
|
//always get the event collection to do pile-up reweighting |
77 |
|
objectsToGet.push_back("events"); |
78 |
|
|
79 |
+ |
|
80 |
+ |
// Parse the tree variable definitions. |
81 |
+ |
for (uint iBranchSet = 0; !useEDMFormat_ && iBranchSet<treeBranchSets_.size(); iBranchSet++) { |
82 |
+ |
string tempInputCollection = treeBranchSets_.at(iBranchSet).getParameter<string> ("inputCollection"); |
83 |
+ |
if(tempInputCollection.find("pairs")!=string::npos) { cout << "Warning: tree filling is not configured for pairs of objects, so will not work for collection: " << tempInputCollection << endl; } |
84 |
+ |
objectsToGet.push_back(tempInputCollection); |
85 |
+ |
objectsToCut.push_back(tempInputCollection); |
86 |
+ |
|
87 |
+ |
vector<string> branchList(treeBranchSets_.at(iBranchSet).getParameter<vector<string> >("branches")); |
88 |
+ |
|
89 |
+ |
for (uint iBranch = 0; iBranch<branchList.size(); iBranch++) { |
90 |
+ |
BranchSpecs br; |
91 |
+ |
br.inputCollection = tempInputCollection; |
92 |
+ |
br.inputVariable = branchList.at(iBranch); |
93 |
+ |
TString newName = TString(br.inputCollection) + "_" + TString(br.inputVariable); |
94 |
+ |
br.name = string(newName.Data()); |
95 |
+ |
treeBranches_.push_back(br); |
96 |
+ |
} |
97 |
+ |
|
98 |
+ |
} // end for (uint iBranchSet = 0; iBranchSet<treeBranchSets_.size(); iBranchSet++) |
99 |
+ |
|
100 |
+ |
|
101 |
|
//parse the histogram definitions |
102 |
|
for(uint currentHistogramSet = 0; currentHistogramSet != histogramSets_.size(); currentHistogramSet++){ |
103 |
|
|
104 |
|
string tempInputCollection = histogramSets_.at(currentHistogramSet).getParameter<string> ("inputCollection"); |
105 |
|
if(tempInputCollection == "muon-electron pairs") tempInputCollection = "electron-muon pairs"; |
106 |
+ |
if(tempInputCollection == "photon-muon pairs") tempInputCollection = "muon-photon pairs"; |
107 |
+ |
if(tempInputCollection == "photon-electron pairs") tempInputCollection = "electron-photon pairs"; |
108 |
|
if(tempInputCollection == "jet-electron pairs") tempInputCollection = "electron-jet pairs"; |
109 |
+ |
if(tempInputCollection == "jet-photon pairs") tempInputCollection = "photon-jet pairs"; |
110 |
|
if(tempInputCollection == "jet-muon pairs") tempInputCollection = "muon-jet pairs"; |
111 |
|
if(tempInputCollection == "event-track pairs") tempInputCollection = "track-event pairs"; |
112 |
|
if(tempInputCollection == "secondary muon-muon pairs") tempInputCollection = "muon-secondary muon pairs"; |
113 |
+ |
if(tempInputCollection == "secondary jet-muon pairs") tempInputCollection = "muon-secondary jet pairs"; |
114 |
+ |
if(tempInputCollection == "secondary jet-electron pairs") tempInputCollection = "electron-secondary jet pairs"; |
115 |
+ |
if(tempInputCollection == "secondary jet-photon pairs") tempInputCollection = "photon-secondary jet pairs"; |
116 |
+ |
if(tempInputCollection == "secondary jet-jet pairs") tempInputCollection = "jet-secondary jet pairs"; |
117 |
|
if(tempInputCollection == "secondary electron-electron pairs") tempInputCollection = "electron-secondary electron pairs"; |
118 |
|
if(tempInputCollection == "trigobj-electron pairs") tempInputCollection = "electron-trigobj pairs"; |
119 |
|
if(tempInputCollection == "trigobj-muon pairs") tempInputCollection = "muon-trigobj pairs"; |
128 |
|
} |
129 |
|
objectsToPlot.push_back(tempInputCollection); |
130 |
|
objectsToCut.push_back(tempInputCollection); |
131 |
< |
} |
94 |
< |
else{//pair of objects, need to add the pair and the individual objects to the lists of things to Get/Plot/Cut |
131 |
> |
} else { //pair of objects, need to add the pair and the individual objects to the lists of things to Get/Plot/Cut |
132 |
|
string obj1; |
133 |
|
string obj2; |
134 |
|
getTwoObjs(tempInputCollection, obj1, obj2); |
142 |
|
objectsToGet.push_back(tempInputCollection); |
143 |
|
objectsToGet.push_back(obj1); |
144 |
|
objectsToGet.push_back(obj2ToGet); |
145 |
+ |
} // end else |
146 |
+ |
|
147 |
|
|
109 |
– |
} |
148 |
|
|
149 |
|
vector<edm::ParameterSet> histogramList_ (histogramSets_.at(currentHistogramSet).getParameter<vector<edm::ParameterSet> >("histograms")); |
150 |
|
|
165 |
|
histograms.push_back(tempHistogram); |
166 |
|
|
167 |
|
} |
168 |
< |
} |
168 |
> |
} // for(uint currentHistogramSet = 0; currentHistogramSet != histogramSets_.size(); currentHistogramSet++) |
169 |
> |
|
170 |
|
//make unique vector of objects we need to plot (so we can book a histogram with the number of each object) |
171 |
|
sort( objectsToPlot.begin(), objectsToPlot.end() ); |
172 |
|
objectsToPlot.erase( unique( objectsToPlot.begin(), objectsToPlot.end() ), objectsToPlot.end() ); |
251 |
|
//set triggers for this channel |
252 |
|
vector<string> triggerNames; |
253 |
|
triggerNames.clear(); |
254 |
+ |
vector<string> triggerToVetoNames; |
255 |
+ |
triggerToVetoNames.clear(); |
256 |
+ |
|
257 |
|
tempChannel.triggers.clear(); |
258 |
+ |
tempChannel.triggersToVeto.clear(); |
259 |
|
if(channels_.at(currentChannel).exists("triggers")){ |
260 |
|
triggerNames = channels_.at(currentChannel).getParameter<vector<string> >("triggers"); |
261 |
|
for(uint trigger = 0; trigger!= triggerNames.size(); trigger++) |
262 |
|
tempChannel.triggers.push_back(triggerNames.at(trigger)); |
263 |
|
objectsToGet.push_back("triggers"); |
264 |
|
} |
265 |
< |
|
265 |
> |
if(channels_.at(currentChannel).exists("triggersToVeto")){ |
266 |
> |
triggerToVetoNames = channels_.at(currentChannel).getParameter<vector<string> >("triggersToVeto"); |
267 |
> |
for(uint trigger = 0; trigger!= triggerToVetoNames.size(); trigger++) |
268 |
> |
tempChannel.triggersToVeto.push_back(triggerToVetoNames.at(trigger)); |
269 |
> |
objectsToGet.push_back("triggers"); |
270 |
> |
} |
271 |
|
|
272 |
|
|
273 |
|
|
274 |
|
//create cutFlow for this channel |
275 |
|
cutFlows_.push_back (new CutFlow (fs_, channelName)); |
276 |
|
vector<TFileDirectory> directories; //vector of directories in the output file. |
277 |
+ |
vector<TFileDirectory> treeDirectories; //vector of directories for trees in the output file. |
278 |
|
vector<string> subSubDirNames;//subdirectories in each channel. |
279 |
|
//get list of cuts for this channel |
280 |
|
vector<edm::ParameterSet> cuts_ (channels_.at(currentChannel).getParameter<vector<edm::ParameterSet> >("cuts")); |
286 |
|
//store input collection for cut |
287 |
|
string tempInputCollection = cuts_.at(currentCut).getParameter<string> ("inputCollection"); |
288 |
|
if(tempInputCollection == "muon-electron pairs") tempInputCollection = "electron-muon pairs"; |
289 |
+ |
if(tempInputCollection == "photon-electron pairs") tempInputCollection = "electron-photon pairs"; |
290 |
+ |
if(tempInputCollection == "photon-muon pairs") tempInputCollection = "muon-photon pairs"; |
291 |
|
if(tempInputCollection == "jet-electron pairs") tempInputCollection = "electron-jet pairs"; |
292 |
|
if(tempInputCollection == "jet-muon pairs") tempInputCollection = "muon-jet pairs"; |
293 |
+ |
if(tempInputCollection == "jet-photon pairs") tempInputCollection = "photon-jet pairs"; |
294 |
|
if(tempInputCollection == "event-track pairs") tempInputCollection = "track-event pairs"; |
295 |
|
if(tempInputCollection == "secondary muon-muon pairs") tempInputCollection = "muon-secondary muon pairs"; |
296 |
+ |
if(tempInputCollection == "secondary jet-jet pairs") tempInputCollection = "jet-secondary jet pairs"; |
297 |
+ |
if(tempInputCollection == "secondary jet-muon pairs") tempInputCollection = "muon-secondary jet pairs"; |
298 |
+ |
if(tempInputCollection == "secondary jet-photon pairs") tempInputCollection = "photon-secondary jet pairs"; |
299 |
+ |
if(tempInputCollection == "secondary jet-electron pairs") tempInputCollection = "electron-secondary jet pairs"; |
300 |
|
if(tempInputCollection == "secondary electron-electron pairs") tempInputCollection = "electron-secondary electron pairs"; |
301 |
|
if(tempInputCollection == "trigobj-electron pairs") tempInputCollection = "electron-trigobj pairs"; |
302 |
|
if(tempInputCollection == "trigobj-muon pairs") tempInputCollection = "muon-trigobj pairs"; |
366 |
|
tempCut.numberRequired = numberRequiredInt;// number of objects required to pass the cut |
367 |
|
tempCut.eventComparativeOperator = numberRequiredVector.at(0);// comparison to make |
368 |
|
|
369 |
< |
//Set up vectors to store the directories and subDIrectories for each channel. |
369 |
> |
//Set up vectors to store the directories and subDirectories for each channel. |
370 |
|
string subSubDirName; |
371 |
|
string tempCutName; |
372 |
|
if(cuts_.at(currentCut).exists("alias")){ |
373 |
|
tempCutName = cuts_.at(currentCut).getParameter<string> ("alias"); |
374 |
< |
subSubDirName = "After " + cuts_.at(currentCut).getParameter<string> ("alias") + " Cut Applied"; |
374 |
> |
subSubDirName = "After " + tempCutName + " Cut Applied"; |
375 |
|
} |
376 |
|
else{ |
377 |
|
//construct string for cutflow table |
382 |
|
subSubDirName = "After " + numberRequiredString + " " + collectionString + " with " + cutString + " Cut Applied"; |
383 |
|
} |
384 |
|
|
385 |
+ |
tempCut.isVeto = false; |
386 |
+ |
if(cuts_.at(currentCut).exists("isVeto")){ |
387 |
+ |
bool isVeto = cuts_.at(currentCut).getParameter<bool> ("isVeto"); |
388 |
+ |
if (isVeto == true) tempCut.isVeto = true; |
389 |
+ |
} |
390 |
|
subSubDirNames.push_back(subSubDirName); |
391 |
|
tempCut.name = tempCutName; |
392 |
|
|
401 |
|
TFileDirectory subDir = fs_->mkdir( channelName ); |
402 |
|
//loop over the cuts to set up subdirectory for each cut if GetPlotsAfterEachCut_ is true. |
403 |
|
if(GetPlotsAfterEachCut_){ |
404 |
< |
for( uint currentDir=0; currentDir != subSubDirNames.size(); currentDir++){ |
405 |
< |
TFileDirectory subSubDir = subDir.mkdir( subSubDirNames[currentDir] ); |
406 |
< |
directories.push_back(subSubDir); |
407 |
< |
map<string, TH1D*> oneDhistoMap; |
408 |
< |
oneDHistsTmp.push_back(oneDhistoMap); |
409 |
< |
map<string, TH2D*> twoDhistoMap; |
410 |
< |
twoDHistsTmp.push_back(twoDhistoMap); |
404 |
> |
for( uint currentDir=0; currentDir != subSubDirNames.size(); currentDir++){ |
405 |
> |
TFileDirectory subSubDir = subDir.mkdir( subSubDirNames[currentDir] ); |
406 |
> |
directories.push_back(subSubDir); |
407 |
> |
map<string, TH1D*> oneDhistoMap; |
408 |
> |
oneDHistsTmp.push_back(oneDhistoMap); |
409 |
> |
map<string, TH2D*> twoDhistoMap; |
410 |
> |
twoDHistsTmp.push_back(twoDhistoMap); |
411 |
|
} |
412 |
+ |
treeDirectories.push_back(subDir); |
413 |
|
oneDHists_.push_back(oneDHistsTmp); |
414 |
|
twoDHists_.push_back(twoDHistsTmp); |
415 |
|
} |
416 |
< |
//only set up directories with names of the channels if GetPlotsAfterEachCut_ is false. |
417 |
< |
else{ |
416 |
> |
//only set up directories with names of the channels if GetPlotsAfterEachCut_ is false. |
417 |
> |
else{ |
418 |
|
map<string, TH1D*> oneDhistoMap; |
419 |
|
oneDHistsTmp.push_back(oneDhistoMap); |
420 |
|
map<string, TH2D*> twoDhistoMap; |
422 |
|
oneDHists_.push_back(oneDHistsTmp); |
423 |
|
twoDHists_.push_back(twoDHistsTmp); |
424 |
|
directories.push_back(subDir); |
425 |
< |
} |
425 |
> |
treeDirectories.push_back(subDir); |
426 |
> |
|
427 |
> |
} |
428 |
> |
|
429 |
> |
for(uint currentDir = 0; !useEDMFormat_ && currentDir != treeDirectories.size(); currentDir++){ |
430 |
> |
TTree* newTree = treeDirectories.at(currentDir).make<TTree> (TString("BNTree_"+channelLabel), TString("BNTree_"+channelLabel)); |
431 |
> |
BNTrees_.push_back(newTree); |
432 |
> |
for (uint iBranch = 0; iBranch < treeBranches_.size(); iBranch++){ |
433 |
> |
BranchSpecs currentVar = treeBranches_.at(iBranch); |
434 |
> |
vector<float> newVec; |
435 |
> |
BNTreeBranchVals_[currentVar.name] = newVec; |
436 |
> |
BNTrees_.back()->Branch(TString(currentVar.name), &BNTreeBranchVals_.at(currentVar.name)); |
437 |
> |
} // end for (uint iBranch = 0; iBranch < treeBranches_.size(); iBranch++) |
438 |
> |
} |
439 |
> |
|
440 |
|
//book all histograms included in the configuration |
441 |
|
for(uint currentDir = 0; currentDir != directories.size(); currentDir++){//loop over all the directories. |
442 |
< |
for(uint currentHistogramIndex = 0; currentHistogramIndex != histograms.size(); currentHistogramIndex++){ |
443 |
< |
histogram currentHistogram = histograms.at(currentHistogramIndex); |
444 |
< |
int numBinsElements = currentHistogram.bins.size(); |
445 |
< |
int numInputVariables = currentHistogram.inputVariables.size(); |
446 |
< |
int numBinEdgesX = currentHistogram.variableBinsX.size(); |
447 |
< |
int numBinEdgesY = currentHistogram.variableBinsY.size(); |
448 |
< |
|
449 |
< |
if(numBinsElements == 1){ |
450 |
< |
if(numBinEdgesX > 1){ |
451 |
< |
if(numBinEdgesY > 1) |
452 |
< |
numBinsElements = 6; |
442 |
> |
|
443 |
> |
for(uint currentHistogramIndex = 0; currentHistogramIndex != histograms.size(); currentHistogramIndex++){ |
444 |
> |
|
445 |
> |
histogram currentHistogram = histograms.at(currentHistogramIndex); |
446 |
> |
int numBinsElements = currentHistogram.bins.size(); |
447 |
> |
int numInputVariables = currentHistogram.inputVariables.size(); |
448 |
> |
int numBinEdgesX = currentHistogram.variableBinsX.size(); |
449 |
> |
int numBinEdgesY = currentHistogram.variableBinsY.size(); |
450 |
> |
|
451 |
> |
if(numBinsElements == 1){ |
452 |
> |
if(numBinEdgesX > 1){ |
453 |
> |
if(numBinEdgesY > 1) |
454 |
> |
numBinsElements = 6; |
455 |
> |
else |
456 |
> |
numBinsElements = 3; |
457 |
> |
} |
458 |
> |
} |
459 |
> |
if(numBinsElements != 3 && numBinsElements !=6){ |
460 |
> |
cout << "Error: Didn't find correct number of bin specifications for histogram named '" << currentHistogram.name << "'\n"; |
461 |
> |
exit(0); |
462 |
> |
} |
463 |
> |
else if((numBinsElements == 3 && numInputVariables !=1) || (numBinsElements == 6 && numInputVariables!=2)){ |
464 |
> |
cout << "Error: Didn't find correct number of input variables for histogram named '" << currentHistogram.name << "'\n"; |
465 |
> |
exit(0); |
466 |
> |
} |
467 |
> |
else if(numBinsElements == 3){ |
468 |
> |
if (currentHistogram.bins.size () == 3) |
469 |
> |
oneDHists_.at(currentChannel).at(currentDir)[currentHistogram.name] = directories.at(currentDir).make<TH1D> (TString(currentHistogram.name),channelLabel+" channel: "+currentHistogram.title, currentHistogram.bins.at(0), currentHistogram.bins.at(1), currentHistogram.bins.at(2)); |
470 |
|
else |
471 |
< |
numBinsElements = 3; |
471 |
> |
{ |
472 |
> |
oneDHists_.at(currentChannel).at(currentDir)[currentHistogram.name] = directories.at(currentDir).make<TH1D> (TString(currentHistogram.name),channelLabel+" channel: "+currentHistogram.title, numBinEdgesX - 1, currentHistogram.variableBinsX.data ()); |
473 |
> |
} |
474 |
|
} |
475 |
< |
} |
476 |
< |
if(numBinsElements != 3 && numBinsElements !=6){ |
477 |
< |
cout << "Error: Didn't find correct number of bin specifications for histogram named '" << currentHistogram.name << "'\n"; |
478 |
< |
exit(0); |
479 |
< |
} |
480 |
< |
else if((numBinsElements == 3 && numInputVariables !=1) || (numBinsElements == 6 && numInputVariables!=2)){ |
481 |
< |
cout << "Error: Didn't find correct number of input variables for histogram named '" << currentHistogram.name << "'\n"; |
482 |
< |
exit(0); |
483 |
< |
} |
484 |
< |
else if(numBinsElements == 3){ |
485 |
< |
if (currentHistogram.bins.size () == 3) |
486 |
< |
oneDHists_.at(currentChannel).at(currentDir)[currentHistogram.name] = directories.at(currentDir).make<TH1D> (TString(currentHistogram.name),channelLabel+" channel: "+currentHistogram.title, currentHistogram.bins.at(0), currentHistogram.bins.at(1), currentHistogram.bins.at(2)); |
487 |
< |
else |
488 |
< |
{ |
489 |
< |
oneDHists_.at(currentChannel).at(currentDir)[currentHistogram.name] = directories.at(currentDir).make<TH1D> (TString(currentHistogram.name),channelLabel+" channel: "+currentHistogram.title, numBinEdgesX - 1, currentHistogram.variableBinsX.data ()); |
475 |
> |
else if(numBinsElements == 6){ |
476 |
> |
if (currentHistogram.bins.size () == 6) |
477 |
> |
twoDHists_.at(currentChannel).at(currentDir)[currentHistogram.name] = directories.at(currentDir).make<TH2D> (TString(currentHistogram.name),channelLabel+" channel: "+currentHistogram.title, currentHistogram.bins.at(0), currentHistogram.bins.at(1), currentHistogram.bins.at(2),currentHistogram.bins.at(3),currentHistogram.bins.at(4),currentHistogram.bins.at(5)); |
478 |
> |
else |
479 |
> |
twoDHists_.at(currentChannel).at(currentDir)[currentHistogram.name] = directories.at(currentDir).make<TH2D> (TString(currentHistogram.name),channelLabel+" channel: "+currentHistogram.title, numBinEdgesX - 1, currentHistogram.variableBinsX.data (), numBinEdgesY - 1, currentHistogram.variableBinsY.data ()); |
480 |
> |
} |
481 |
> |
|
482 |
> |
|
483 |
> |
if(currentHistogram.name.find("GenMatch")==string::npos) continue; |
484 |
> |
|
485 |
> |
// bin particle type |
486 |
> |
// --- ------------- |
487 |
> |
// 0 unmatched |
488 |
> |
// 1 u |
489 |
> |
// 2 d |
490 |
> |
// 3 s |
491 |
> |
// 4 c |
492 |
> |
// 5 b |
493 |
> |
// 6 t |
494 |
> |
// 7 e |
495 |
> |
// 8 mu |
496 |
> |
// 9 tau |
497 |
> |
// 10 nu |
498 |
> |
// 11 g |
499 |
> |
// 12 gamma |
500 |
> |
// 13 Z |
501 |
> |
// 14 W |
502 |
> |
// 15 light meson |
503 |
> |
// 16 K meson |
504 |
> |
// 17 D meson |
505 |
> |
// 18 B meson |
506 |
> |
// 19 light baryon |
507 |
> |
// 20 strange baryon |
508 |
> |
// 21 charm baryon |
509 |
> |
// 22 bottom baryon |
510 |
> |
// 23 QCD string |
511 |
> |
// 24 other |
512 |
> |
|
513 |
> |
vector<TString> labelArray; |
514 |
> |
labelArray.push_back("unmatched"); |
515 |
> |
labelArray.push_back("u"); |
516 |
> |
labelArray.push_back("d"); |
517 |
> |
labelArray.push_back("s"); |
518 |
> |
labelArray.push_back("c"); |
519 |
> |
labelArray.push_back("b"); |
520 |
> |
labelArray.push_back("t"); |
521 |
> |
labelArray.push_back("e"); |
522 |
> |
labelArray.push_back("#mu"); |
523 |
> |
labelArray.push_back("#tau"); |
524 |
> |
labelArray.push_back("#nu"); |
525 |
> |
labelArray.push_back("g"); |
526 |
> |
labelArray.push_back("#gamma"); |
527 |
> |
labelArray.push_back("Z"); |
528 |
> |
labelArray.push_back("W"); |
529 |
> |
labelArray.push_back("light meson"); |
530 |
> |
labelArray.push_back("K meson"); |
531 |
> |
labelArray.push_back("D meson"); |
532 |
> |
labelArray.push_back("B meson"); |
533 |
> |
labelArray.push_back("light baryon"); |
534 |
> |
labelArray.push_back("strange baryon"); |
535 |
> |
labelArray.push_back("charm baryon"); |
536 |
> |
labelArray.push_back("bottom baryon"); |
537 |
> |
labelArray.push_back("QCD string"); |
538 |
> |
labelArray.push_back("other"); |
539 |
> |
|
540 |
> |
for(int bin = 0; bin !=currentHistogram.bins.at(0); bin++){ |
541 |
> |
if(currentHistogram.name.find("GenMatchIdVsMotherId")==string::npos && currentHistogram.name.find("GenMatchIdVsGrandmotherId")==string::npos) { |
542 |
> |
oneDHists_.at(currentChannel).at(currentDir)[currentHistogram.name]->GetXaxis()->SetBinLabel(bin+1,labelArray.at(bin)); |
543 |
|
} |
544 |
< |
} |
545 |
< |
else if(numBinsElements == 6){ |
546 |
< |
if (currentHistogram.bins.size () == 6) |
547 |
< |
twoDHists_.at(currentChannel).at(currentDir)[currentHistogram.name] = directories.at(currentDir).make<TH2D> (TString(currentHistogram.name),channelLabel+" channel: "+currentHistogram.title, currentHistogram.bins.at(0), currentHistogram.bins.at(1), currentHistogram.bins.at(2),currentHistogram.bins.at(3),currentHistogram.bins.at(4),currentHistogram.bins.at(5)); |
548 |
< |
else |
549 |
< |
twoDHists_.at(currentChannel).at(currentDir)[currentHistogram.name] = directories.at(currentDir).make<TH2D> (TString(currentHistogram.name),channelLabel+" channel: "+currentHistogram.title, numBinEdgesX - 1, currentHistogram.variableBinsX.data (), numBinEdgesY - 1, currentHistogram.variableBinsY.data ()); |
550 |
< |
} |
544 |
> |
else { |
545 |
> |
twoDHists_.at(currentChannel).at(currentDir)[currentHistogram.name]->GetYaxis()->SetBinLabel(bin+1,labelArray.at(currentHistogram.bins.at(0)-bin-1)); |
546 |
> |
twoDHists_.at(currentChannel).at(currentDir)[currentHistogram.name]->GetXaxis()->SetBinLabel(bin+1,labelArray.at(bin)); |
547 |
> |
} |
548 |
> |
} |
549 |
> |
if(currentHistogram.name.find("GenMatchIdVsMotherId")!=string::npos || currentHistogram.name.find("GenMatchIdVsGrandmotherId")!=string::npos) { |
550 |
> |
twoDHists_.at(currentChannel).at(currentDir)[currentHistogram.name]->GetXaxis()->CenterTitle(); |
551 |
> |
twoDHists_.at(currentChannel).at(currentDir)[currentHistogram.name]->GetYaxis()->CenterTitle(); |
552 |
> |
} |
553 |
|
|
554 |
+ |
} // end for(uint currentHistogramIndex = 0; currentHistogramIndex != histograms.size(); currentHistogramIndex++) |
555 |
|
|
405 |
– |
if(currentHistogram.name.find("GenMatch")==string::npos) continue; |
556 |
|
|
557 |
< |
// bin particle type |
558 |
< |
// --- ------------- |
559 |
< |
// 0 unmatched |
560 |
< |
// 1 u |
561 |
< |
// 2 d |
562 |
< |
// 3 s |
563 |
< |
// 4 c |
564 |
< |
// 5 b |
565 |
< |
// 6 t |
566 |
< |
// 7 e |
567 |
< |
// 8 mu |
568 |
< |
// 9 tau |
569 |
< |
// 10 nu |
570 |
< |
// 11 g |
571 |
< |
// 12 gamma |
572 |
< |
// 13 Z |
573 |
< |
// 14 W |
574 |
< |
// 15 light meson |
575 |
< |
// 16 K meson |
576 |
< |
// 17 D meson |
577 |
< |
// 18 B meson |
578 |
< |
// 19 light baryon |
579 |
< |
// 20 strange baryon |
580 |
< |
// 21 charm baryon |
581 |
< |
// 22 bottom baryon |
582 |
< |
// 23 QCD string |
583 |
< |
// 24 other |
584 |
< |
|
585 |
< |
vector<TString> labelArray; |
586 |
< |
labelArray.push_back("unmatched"); |
587 |
< |
labelArray.push_back("u"); |
588 |
< |
labelArray.push_back("d"); |
589 |
< |
labelArray.push_back("s"); |
590 |
< |
labelArray.push_back("c"); |
591 |
< |
labelArray.push_back("b"); |
592 |
< |
labelArray.push_back("t"); |
593 |
< |
labelArray.push_back("e"); |
594 |
< |
labelArray.push_back("#mu"); |
595 |
< |
labelArray.push_back("#tau"); |
596 |
< |
labelArray.push_back("#nu"); |
597 |
< |
labelArray.push_back("g"); |
598 |
< |
labelArray.push_back("#gamma"); |
599 |
< |
labelArray.push_back("Z"); |
600 |
< |
labelArray.push_back("W"); |
601 |
< |
labelArray.push_back("light meson"); |
602 |
< |
labelArray.push_back("K meson"); |
453 |
< |
labelArray.push_back("D meson"); |
454 |
< |
labelArray.push_back("B meson"); |
455 |
< |
labelArray.push_back("light baryon"); |
456 |
< |
labelArray.push_back("strange baryon"); |
457 |
< |
labelArray.push_back("charm baryon"); |
458 |
< |
labelArray.push_back("bottom baryon"); |
459 |
< |
labelArray.push_back("QCD string"); |
460 |
< |
labelArray.push_back("other"); |
461 |
< |
|
462 |
< |
for(int bin = 0; bin !=currentHistogram.bins.at(0); bin++){ |
463 |
< |
if(currentHistogram.name.find("GenMatchIdVsMotherId")==string::npos && currentHistogram.name.find("GenMatchIdVsGrandmotherId")==string::npos) { |
464 |
< |
oneDHists_.at(currentChannel).at(currentDir)[currentHistogram.name]->GetXaxis()->SetBinLabel(bin+1,labelArray.at(bin)); |
465 |
< |
} |
466 |
< |
else { |
467 |
< |
twoDHists_.at(currentChannel).at(currentDir)[currentHistogram.name]->GetYaxis()->SetBinLabel(bin+1,labelArray.at(currentHistogram.bins.at(0)-bin-1)); |
468 |
< |
twoDHists_.at(currentChannel).at(currentDir)[currentHistogram.name]->GetXaxis()->SetBinLabel(bin+1,labelArray.at(bin)); |
469 |
< |
} |
470 |
< |
} |
471 |
< |
if(currentHistogram.name.find("GenMatchIdVsMotherId")!=string::npos || currentHistogram.name.find("GenMatchIdVsGrandmotherId")!=string::npos) { |
472 |
< |
twoDHists_.at(currentChannel).at(currentDir)[currentHistogram.name]->GetXaxis()->CenterTitle(); |
473 |
< |
twoDHists_.at(currentChannel).at(currentDir)[currentHistogram.name]->GetYaxis()->CenterTitle(); |
474 |
< |
} |
475 |
< |
|
476 |
< |
} |
477 |
< |
|
478 |
< |
// Book a histogram for the number of each object type to be plotted. |
479 |
< |
// Name of objectToPlot here must match the name specified in OSUAnalysis::analyze(). |
480 |
< |
for (uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){ |
481 |
< |
string currentObject = objectsToPlot.at(currentObjectIndex); |
482 |
< |
int maxNum = 10; |
483 |
< |
if(currentObject == "mcparticles") maxNum = 50; |
484 |
< |
else if(currentObject == "primaryvertexs") maxNum = 50; |
485 |
< |
|
486 |
< |
if(currentObject == "muon-muon pairs") currentObject = "dimuonPairs"; |
487 |
< |
else if(currentObject == "electron-electron pairs") currentObject = "dielectronPairs"; |
488 |
< |
else if(currentObject == "electron-muon pairs") currentObject = "electronMuonPairs"; |
489 |
< |
else if(currentObject == "secondary jets") currentObject = "secondaryJets"; |
490 |
< |
else if(currentObject == "jet-jet pairs") currentObject = "dijetPairs"; |
491 |
< |
else if(currentObject == "electron-jet pairs") currentObject = "electronJetPairs"; |
492 |
< |
else if(currentObject == "muon-jet pairs") currentObject = "muonJetPairs"; |
493 |
< |
else if(currentObject == "track-event pairs") currentObject = "trackEventPairs"; |
494 |
< |
else if(currentObject == "electron-track pairs") currentObject = "electronTrackPairs"; |
495 |
< |
else if(currentObject == "muon-track pairs") currentObject = "muonTrackPairs"; |
496 |
< |
else if(currentObject == "muon-tau pairs") currentObject = "muonTauPairs"; |
497 |
< |
else if(currentObject == "tau-tau pairs") currentObject = "ditauPairs"; |
498 |
< |
else if(currentObject == "tau-track pairs") currentObject = "tauTrackPairs"; |
499 |
< |
else if(currentObject == "muon-secondary muon pairs") currentObject = "muonSecondaryMuonPairs"; |
500 |
< |
else if(currentObject == "secondary muons") currentObject = "secondaryMuons"; |
501 |
< |
else if(currentObject == "electron-secondary electron pairs") currentObject = "electronSecondaryElectronPairs"; |
502 |
< |
else if(currentObject == "secondary electrons") currentObject = "secondaryElectrons"; |
503 |
< |
else if(currentObject == "electron-trigobj pairs") currentObject = "electronTrigobjPairs"; |
504 |
< |
else if(currentObject == "muon-trigobj pairs") currentObject = "muonTrigobjPairs"; |
505 |
< |
|
506 |
< |
currentObject.at(0) = toupper(currentObject.at(0)); |
507 |
< |
string histoName = "num" + currentObject; |
508 |
< |
|
509 |
< |
if(histoName == "numPrimaryvertexs"){ |
510 |
< |
string newHistoName = histoName + "BeforePileupCorrection"; |
511 |
< |
oneDHists_.at(currentChannel).at(currentDir)[newHistoName] = directories.at(currentDir).make<TH1D> (TString(newHistoName),channelLabel+" channel: Number of Selected "+currentObject+" Before Pileup Correction; # "+currentObject, maxNum, 0, maxNum); |
512 |
< |
newHistoName = histoName + "AfterPileupCorrection"; |
513 |
< |
oneDHists_.at(currentChannel).at(currentDir)[newHistoName] = directories.at(currentDir).make<TH1D> (TString(newHistoName),channelLabel+" channel: Number of Selected "+currentObject+ " After Pileup Correction; # "+currentObject, maxNum, 0, maxNum); |
557 |
> |
// Book a histogram for the number of each object type to be plotted. |
558 |
> |
// Name of objectToPlot here must match the name specified in OSUAnalysis::analyze(). |
559 |
> |
for (uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){ |
560 |
> |
string currentObject = objectsToPlot.at(currentObjectIndex); |
561 |
> |
int maxNum = 10; |
562 |
> |
if(currentObject == "mcparticles") maxNum = 50; |
563 |
> |
else if(currentObject == "primaryvertexs") maxNum = 50; |
564 |
> |
|
565 |
> |
if(currentObject == "muon-muon pairs") currentObject = "dimuonPairs"; |
566 |
> |
else if(currentObject == "electron-electron pairs") currentObject = "dielectronPairs"; |
567 |
> |
else if(currentObject == "electron-muon pairs") currentObject = "electronMuonPairs"; |
568 |
> |
else if(currentObject == "electron-photon pairs") currentObject = "electronPhotonPairs"; |
569 |
> |
else if(currentObject == "muon-photon pairs") currentObject = "muonPhotonPairs"; |
570 |
> |
else if(currentObject == "secondary jets") currentObject = "secondaryJets"; |
571 |
> |
else if(currentObject == "jet-jet pairs") currentObject = "dijetPairs"; |
572 |
> |
else if(currentObject == "jet-secondary jet pairs") currentObject = "jetSecondaryJetPairs"; |
573 |
> |
else if(currentObject == "electron-jet pairs") currentObject = "electronJetPairs"; |
574 |
> |
else if(currentObject == "muon-jet pairs") currentObject = "muonJetPairs"; |
575 |
> |
else if(currentObject == "photon-jet pairs") currentObject = "photonJetPairs"; |
576 |
> |
else if(currentObject == "muon-secondary jet pairs") currentObject = "muonSecondaryJetPairs"; |
577 |
> |
else if(currentObject == "photon-secondary jet pairs") currentObject = "photonSecondaryJetPairs"; |
578 |
> |
else if(currentObject == "electron-secondary jet pairs") currentObject = "electronSecondaryJetPairs"; |
579 |
> |
else if(currentObject == "track-event pairs") currentObject = "trackEventPairs"; |
580 |
> |
else if(currentObject == "electron-track pairs") currentObject = "electronTrackPairs"; |
581 |
> |
else if(currentObject == "muon-track pairs") currentObject = "muonTrackPairs"; |
582 |
> |
else if(currentObject == "muon-tau pairs") currentObject = "muonTauPairs"; |
583 |
> |
else if(currentObject == "tau-tau pairs") currentObject = "ditauPairs"; |
584 |
> |
else if(currentObject == "tau-track pairs") currentObject = "tauTrackPairs"; |
585 |
> |
else if(currentObject == "muon-secondary muon pairs") currentObject = "muonSecondaryMuonPairs"; |
586 |
> |
else if(currentObject == "secondary muons") currentObject = "secondaryMuons"; |
587 |
> |
else if(currentObject == "electron-secondary electron pairs") currentObject = "electronSecondaryElectronPairs"; |
588 |
> |
else if(currentObject == "secondary electrons") currentObject = "secondaryElectrons"; |
589 |
> |
else if(currentObject == "electron-trigobj pairs") currentObject = "electronTrigobjPairs"; |
590 |
> |
else if(currentObject == "muon-trigobj pairs") currentObject = "muonTrigobjPairs"; |
591 |
> |
|
592 |
> |
currentObject.at(0) = toupper(currentObject.at(0)); |
593 |
> |
string histoName = "num" + currentObject; |
594 |
> |
|
595 |
> |
if(histoName == "numPrimaryvertexs"){ |
596 |
> |
string newHistoName = histoName + "BeforePileupCorrection"; |
597 |
> |
oneDHists_.at(currentChannel).at(currentDir)[newHistoName] = directories.at(currentDir).make<TH1D> (TString(newHistoName),channelLabel+" channel: Number of Selected "+currentObject+" Before Pileup Correction; # "+currentObject, maxNum, 0, maxNum); |
598 |
> |
newHistoName = histoName + "AfterPileupCorrection"; |
599 |
> |
oneDHists_.at(currentChannel).at(currentDir)[newHistoName] = directories.at(currentDir).make<TH1D> (TString(newHistoName),channelLabel+" channel: Number of Selected "+currentObject+ " After Pileup Correction; # "+currentObject, maxNum, 0, maxNum); |
600 |
> |
} |
601 |
> |
else |
602 |
> |
oneDHists_.at(currentChannel).at(currentDir)[histoName] = directories.at(currentDir).make<TH1D> (TString(histoName),channelLabel+" channel: Number of Selected "+currentObject+"; # "+currentObject, maxNum, 0, maxNum); |
603 |
|
} |
604 |
< |
else |
516 |
< |
oneDHists_.at(currentChannel).at(currentDir)[histoName] = directories.at(currentDir).make<TH1D> (TString(histoName),channelLabel+" channel: Number of Selected "+currentObject+"; # "+currentObject, maxNum, 0, maxNum); |
517 |
< |
} |
518 |
< |
}//end of loop over directories |
604 |
> |
}//end of loop over directories |
605 |
|
channels.push_back(tempChannel); |
606 |
|
tempChannel.cuts.clear(); |
607 |
|
}//end loop over channels |
614 |
|
sort( objectsToCut.begin(), objectsToCut.end() ); |
615 |
|
objectsToCut.erase( unique( objectsToCut.begin(), objectsToCut.end() ), objectsToCut.end() ); |
616 |
|
|
617 |
+ |
produces<map<string, bool> > ("channelDecisions"); |
618 |
+ |
|
619 |
+ |
} // end constructor OSUAnalysis::OSUAnalysis() |
620 |
|
|
532 |
– |
} |
621 |
|
|
622 |
|
OSUAnalysis::~OSUAnalysis () |
623 |
|
{ |
624 |
+ |
|
625 |
|
// Destroying the CutFlow objects causes the cut flow numbers and time |
626 |
|
// information to be printed to standard output. |
627 |
|
for(uint currentChannel = 0; currentChannel != channels_.size(); currentChannel++){ |
630 |
|
} |
631 |
|
|
632 |
|
void |
633 |
< |
OSUAnalysis::analyze (const edm::Event &event, const edm::EventSetup &setup) |
633 |
> |
OSUAnalysis::produce (edm::Event &event, const edm::EventSetup &setup) |
634 |
|
{ |
635 |
< |
|
635 |
> |
//cout << "**********************\n\n\n"; |
636 |
|
// Retrieve necessary collections from the event. |
637 |
|
|
638 |
|
if (find(objectsToGet.begin(), objectsToGet.end(), "triggers") != objectsToGet.end()) |
697 |
|
|
698 |
|
//get pile-up event weight |
699 |
|
if (doPileupReweighting_ && datasetType_ != "data") { |
700 |
< |
if (events->at(0).numTruePV < 0) cout << "WARNING[OSUAnalysis::analyze]: Event has numTruePV<0. This will give an incorrect pile-up weight." << endl; |
701 |
< |
else |
702 |
< |
masterScaleFactor *= puWeight_->at (events->at (0).numTruePV); |
700 |
> |
//for "data" datasets, the numTruePV is always set to -1 |
701 |
> |
if (events->at(0).numTruePV < 0) cout << "WARNING[OSUAnalysis::analyze]: Event has numTruePV<0. Turning off pile-up reweighting." << endl; |
702 |
> |
else masterScaleFactor *= puWeight_->at (events->at (0).numTruePV); |
703 |
|
} |
704 |
|
|
705 |
|
stopCTauScaleFactor_ = 1.0; |
709 |
|
|
710 |
|
//loop over all channels |
711 |
|
|
712 |
+ |
auto_ptr<map<string, bool> > channelDecisions (new map<string, bool>); |
713 |
|
for(uint currentChannelIndex = 0; currentChannelIndex != channels.size(); currentChannelIndex++){ |
714 |
|
channel currentChannel = channels.at(currentChannelIndex); |
715 |
|
|
717 |
|
counterMap passingCounter; |
718 |
|
cumulativeFlags.clear (); |
719 |
|
|
720 |
+ |
for (map<string, vector<float>>::iterator iter = BNTreeBranchVals_.begin(); |
721 |
+ |
iter != BNTreeBranchVals_.end(); iter++) { |
722 |
+ |
iter->second.clear(); // clear array |
723 |
+ |
} |
724 |
+ |
|
725 |
|
bool triggerDecision = true; |
726 |
< |
if(currentChannel.triggers.size() != 0){ //triggers specified |
727 |
< |
triggerDecision = evaluateTriggers(currentChannel.triggers,triggers.product()); |
726 |
> |
if(currentChannel.triggers.size() != 0 || currentChannel.triggersToVeto.size() != 0){ //triggers specified |
727 |
> |
triggerDecision = evaluateTriggers(currentChannel.triggers, currentChannel.triggersToVeto, triggers.product()); |
728 |
|
cutFlows_.at(currentChannelIndex)->at ("trigger") = triggerDecision; |
729 |
|
} |
730 |
|
|
735 |
|
string currentObject = objectsToCut.at(currentObjectIndex); |
736 |
|
|
737 |
|
//initialize maps to get ready to set cuts |
738 |
< |
individualFlags[currentObject].push_back (vector<bool> ()); |
739 |
< |
cumulativeFlags[currentObject].push_back (vector<bool> ()); |
738 |
> |
individualFlags[currentObject].push_back (vector<pair<bool,bool> > ()); |
739 |
> |
cumulativeFlags[currentObject].push_back (vector<pair<bool,bool> > ()); |
740 |
|
|
741 |
|
} |
742 |
|
for(uint currentObjectIndex = 0; currentObjectIndex != objectsToCut.size(); currentObjectIndex++){ |
771 |
|
"muon-muon pairs"); |
772 |
|
|
773 |
|
else if(currentObject == "muon-secondary muon pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),muons.product(), \ |
774 |
< |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
775 |
< |
cumulativeFlags.at("secondary muons").at(flagsForPairCutsIndex), \ |
776 |
< |
"muon-secondary muon pairs"); |
774 |
> |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
775 |
> |
cumulativeFlags.at("secondary muons").at(flagsForPairCutsIndex), \ |
776 |
> |
"muon-secondary muon pairs"); |
777 |
> |
|
778 |
> |
else if(currentObject == "muon-secondary jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),jets.product(), \ |
779 |
> |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
780 |
> |
cumulativeFlags.at("secondary jets").at(flagsForPairCutsIndex), \ |
781 |
> |
"muon-secondary jet pairs"); |
782 |
> |
else if(currentObject == "photon-secondary jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,photons.product(),jets.product(), \ |
783 |
> |
cumulativeFlags.at("photons").at(flagsForPairCutsIndex), \ |
784 |
> |
cumulativeFlags.at("secondary jets").at(flagsForPairCutsIndex), \ |
785 |
> |
"photon-secondary jet pairs"); |
786 |
> |
|
787 |
> |
else if(currentObject == "electron-secondary jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),jets.product(), \ |
788 |
> |
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \ |
789 |
> |
cumulativeFlags.at("secondary jets").at(flagsForPairCutsIndex), \ |
790 |
> |
"electron-secondary jet pairs"); |
791 |
|
|
792 |
|
else if(currentObject == "electron-secondary electron pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),electrons.product(), \ |
793 |
< |
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \ |
794 |
< |
cumulativeFlags.at("secondary electrons").at(flagsForPairCutsIndex), \ |
795 |
< |
"electron-secondary electron pairs"); |
793 |
> |
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \ |
794 |
> |
cumulativeFlags.at("secondary electrons").at(flagsForPairCutsIndex), \ |
795 |
> |
"electron-secondary electron pairs"); |
796 |
|
|
797 |
|
else if(currentObject == "electron-electron pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),electrons.product(), \ |
798 |
|
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \ |
803 |
|
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
804 |
|
"electron-muon pairs"); |
805 |
|
else if(currentObject == "jet-jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,jets.product(),jets.product(), \ |
806 |
< |
cumulativeFlags.at("jets").at(flagsForPairCutsIndex), \ |
807 |
< |
cumulativeFlags.at("jets").at(flagsForPairCutsIndex), \ |
808 |
< |
"jet-jet pairs"); |
806 |
> |
cumulativeFlags.at("jets").at(flagsForPairCutsIndex), \ |
807 |
> |
cumulativeFlags.at("jets").at(flagsForPairCutsIndex), \ |
808 |
> |
"jet-jet pairs"); |
809 |
> |
else if(currentObject == "jet-secondary jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,jets.product(),jets.product(), \ |
810 |
> |
cumulativeFlags.at("jets").at(flagsForPairCutsIndex), \ |
811 |
> |
cumulativeFlags.at("secondary jets").at(flagsForPairCutsIndex),\ |
812 |
> |
"jet-secondary jet pairs"); |
813 |
|
else if(currentObject == "electron-jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),jets.product(), \ |
814 |
< |
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \ |
815 |
< |
cumulativeFlags.at("jets").at(flagsForPairCutsIndex), \ |
816 |
< |
"electron-jet pairs"); |
814 |
> |
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \ |
815 |
> |
cumulativeFlags.at("jets").at(flagsForPairCutsIndex), \ |
816 |
> |
"electron-jet pairs"); |
817 |
> |
else if(currentObject == "electron-photon pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),photons.product(), \ |
818 |
> |
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \ |
819 |
> |
cumulativeFlags.at("photons").at(flagsForPairCutsIndex), \ |
820 |
> |
"electron-photon pairs"); |
821 |
> |
else if(currentObject == "photon-jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,photons.product(),jets.product(), \ |
822 |
> |
cumulativeFlags.at("photons").at(flagsForPairCutsIndex), \ |
823 |
> |
cumulativeFlags.at("jets").at(flagsForPairCutsIndex), \ |
824 |
> |
"photon-jet pairs"); |
825 |
|
else if(currentObject == "muon-jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),jets.product(), \ |
826 |
< |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
827 |
< |
cumulativeFlags.at("jets").at(flagsForPairCutsIndex), \ |
828 |
< |
"muon-jet pairs"); |
826 |
> |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
827 |
> |
cumulativeFlags.at("jets").at(flagsForPairCutsIndex), \ |
828 |
> |
"muon-jet pairs"); |
829 |
> |
else if(currentObject == "muon-photon pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),photons.product(), \ |
830 |
> |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
831 |
> |
cumulativeFlags.at("photons").at(flagsForPairCutsIndex), \ |
832 |
> |
"muon-photon pairs"); |
833 |
|
else if(currentObject == "track-event pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,tracks.product(),events.product(), |
834 |
|
cumulativeFlags.at("tracks").at(flagsForPairCutsIndex), |
835 |
|
cumulativeFlags.at("events").at(flagsForPairCutsIndex), |
851 |
|
cumulativeFlags.at("taus").at(flagsForPairCutsIndex), |
852 |
|
"tau-tau pairs"); |
853 |
|
else if(currentObject == "tau-track pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,taus .product(),tracks.product(), |
854 |
< |
cumulativeFlags.at("taus").at(flagsForPairCutsIndex), |
855 |
< |
cumulativeFlags.at("tracks").at(flagsForPairCutsIndex), |
856 |
< |
"tau-track pairs"); |
854 |
> |
cumulativeFlags.at("taus").at(flagsForPairCutsIndex), |
855 |
> |
cumulativeFlags.at("tracks").at(flagsForPairCutsIndex), |
856 |
> |
"tau-track pairs"); |
857 |
|
else if(currentObject == "electron-trigobj pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),trigobjs.product(), |
858 |
|
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), |
859 |
|
cumulativeFlags.at("trigobjs").at(flagsForPairCutsIndex), |
871 |
|
}//end loop over all cuts |
872 |
|
//use cumulative flags to apply cuts at event level |
873 |
|
|
749 |
– |
bool eventPassedAllCuts = true; |
874 |
|
//a vector to store cumulative cut descisions after each cut. |
875 |
|
vector<bool> eventPassedPreviousCuts; |
876 |
+ |
bool eventPassedAllCuts = true; |
877 |
|
//apply trigger (true if none were specified) |
878 |
|
eventPassedAllCuts = eventPassedAllCuts && triggerDecision; |
879 |
|
|
755 |
– |
|
880 |
|
for(uint currentCutIndex = 0; currentCutIndex != currentChannel.cuts.size(); currentCutIndex++){ |
881 |
|
|
882 |
|
//loop over all objects and count how many passed the cumulative selection up to this point |
884 |
|
int numberPassing = 0; |
885 |
|
|
886 |
|
for (uint object = 0; object != cumulativeFlags.at(currentCut.inputCollection).at(currentCutIndex).size() ; object++){ |
887 |
< |
if(cumulativeFlags.at(currentCut.inputCollection).at(currentCutIndex).at(object)) numberPassing++; |
887 |
> |
if(cumulativeFlags.at(currentCut.inputCollection).at(currentCutIndex).at(object).first) numberPassing++; |
888 |
|
} |
889 |
|
bool cutDecision = evaluateComparison(numberPassing,currentCut.eventComparativeOperator,currentCut.numberRequired); |
890 |
|
cutFlows_.at(currentChannelIndex)->at (currentCut.name) = cutDecision; |
893 |
|
} |
894 |
|
double scaleFactor = masterScaleFactor; |
895 |
|
|
896 |
< |
muonScaleFactor_ = electronScaleFactor_ = 1.0; |
896 |
> |
muonScaleFactor_ = electronScaleFactor_ = bTagScaleFactor_ = 1.0; |
897 |
|
if(applyLeptonSF_ && datasetType_ != "data"){ |
898 |
|
if(cumulativeFlags.find ("muons") != cumulativeFlags.end ()){ |
899 |
< |
vector<bool> muonFlags; |
899 |
> |
flagPair muonFlags; |
900 |
|
for (int i = cumulativeFlags.at("muons").size() - 1; i >= 0; i--){ |
901 |
|
if (cumulativeFlags.at("muons").at(i).size()){ |
902 |
|
muonFlags = cumulativeFlags.at("muons").at(i); |
904 |
|
} |
905 |
|
} |
906 |
|
for (uint muonIndex = 0; muonIndex != muonFlags.size(); muonIndex++){ |
907 |
< |
if(!muonFlags.at(muonIndex)) continue; |
907 |
> |
if(!muonFlags.at(muonIndex).second) continue; |
908 |
|
muonScaleFactor_ *= muonSFWeight_->at (muons->at(muonIndex).eta); |
909 |
|
} |
910 |
|
} |
911 |
|
if(cumulativeFlags.find ("electrons") != cumulativeFlags.end ()){ |
912 |
< |
vector<bool> electronFlags; |
912 |
> |
flagPair electronFlags; |
913 |
|
for (int i = cumulativeFlags.at("electrons").size() - 1; i >= 0; i--){ |
914 |
|
if (cumulativeFlags.at("electrons").at(i).size()){ |
915 |
|
electronFlags = cumulativeFlags.at("electrons").at(i); |
917 |
|
} |
918 |
|
} |
919 |
|
for (uint electronIndex = 0; electronIndex != electronFlags.size(); electronIndex++){ |
920 |
< |
if(!electronFlags.at(electronIndex)) continue; |
920 |
> |
if(!electronFlags.at(electronIndex).second) continue; |
921 |
|
electronScaleFactor_ *= electronSFWeight_->at (electrons->at(electronIndex).eta, electrons->at(electronIndex).pt); |
922 |
|
} |
923 |
|
} |
924 |
|
} |
925 |
+ |
if(applyBtagSF_ && datasetType_ != "data"){ |
926 |
+ |
if(cumulativeFlags.find ("jets") != cumulativeFlags.end ()){ |
927 |
+ |
flagPair jetFlags; |
928 |
+ |
vector<double> jetSFs; |
929 |
+ |
for (int i = cumulativeFlags.at("jets").size() - 1; i >= 0; i--){ |
930 |
+ |
if (cumulativeFlags.at("jets").at(i).size()){ |
931 |
+ |
jetFlags = cumulativeFlags.at("jets").at(i); |
932 |
+ |
break; |
933 |
+ |
} |
934 |
+ |
} |
935 |
+ |
for (uint jetIndex = 0; jetIndex != jetFlags.size(); jetIndex++){ |
936 |
+ |
if(!jetFlags.at(jetIndex).second) continue; |
937 |
+ |
double jetSFTmp = bTagSFWeight_->sflookup(jets->at(jetIndex).btagCombinedSecVertex, jets->at(jetIndex).pt, jets->at(jetIndex).flavour); |
938 |
+ |
jetSFs.push_back(jetSFTmp); |
939 |
+ |
} |
940 |
+ |
bTagScaleFactor_ *= bTagSFWeight_->weight( jetSFs, minBtag_, maxBtag_ ); |
941 |
+ |
} |
942 |
+ |
} |
943 |
|
scaleFactor *= muonScaleFactor_; |
944 |
|
scaleFactor *= electronScaleFactor_; |
945 |
< |
|
945 |
> |
scaleFactor *= bTagScaleFactor_; |
946 |
|
cutFlows_.at(currentChannelIndex)->fillCutFlow(scaleFactor); |
805 |
– |
if(!(GetPlotsAfterEachCut_ || eventPassedAllCuts)) continue; |
947 |
|
|
948 |
|
if (printEventInfo_) { |
949 |
|
// Write information about event to screen, for testing purposes. |
953 |
|
<< " event=" << events->at(0).evt |
954 |
|
<< endl; |
955 |
|
} |
956 |
+ |
|
957 |
+ |
|
958 |
|
//filling histograms |
959 |
|
for(uint currentCut = 0; currentCut != oneDHists_.at(currentChannelIndex).size(); currentCut++){//loop over all the directories in each channel. |
960 |
< |
uint currentDir; |
961 |
< |
if(!GetPlotsAfterEachCut_){ currentDir = currentChannel.cuts.size() - oneDHists_.at(currentChannelIndex).size();}//if GetPlotsAfterEachCut_ is true, set currentDir point to the lat cut. |
962 |
< |
else{ |
963 |
< |
currentDir = currentCut; |
964 |
< |
} |
965 |
< |
if(eventPassedPreviousCuts.at(currentDir)){ |
960 |
> |
uint currentDir; |
961 |
> |
if (!GetPlotsAfterEachCut_) { currentDir = currentChannel.cuts.size() - oneDHists_.at(currentChannelIndex).size(); } //if GetPlotsAfterEachCut_ is false, set currentDir point to the last cut. |
962 |
> |
else{ |
963 |
> |
currentDir = currentCut; |
964 |
> |
} |
965 |
> |
|
966 |
> |
|
967 |
> |
if(eventPassedPreviousCuts.at(currentDir)){ |
968 |
> |
|
969 |
|
for (uint histogramIndex = 0; histogramIndex != histograms.size(); histogramIndex++){ |
970 |
|
histogram currentHistogram = histograms.at(histogramIndex); |
971 |
|
|
972 |
< |
if(currentHistogram.inputVariables.size() == 1){ |
973 |
< |
TH1D* histo; |
974 |
< |
histo = oneDHists_.at(currentChannelIndex).at(currentCut).at(currentHistogram.name); |
975 |
< |
if (currentHistogram.inputCollection == "jets") fill1DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("jets").at(currentDir),scaleFactor); |
976 |
< |
else if(currentHistogram.inputCollection == "secondary jets") fill1DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("secondary jets").at(currentDir),scaleFactor); |
977 |
< |
else if(currentHistogram.inputCollection == "muons") fill1DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("muons").at(currentDir),scaleFactor); |
978 |
< |
else if(currentHistogram.inputCollection == "secondary muons") fill1DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("secondary muons").at(currentDir),scaleFactor); |
979 |
< |
else if(currentHistogram.inputCollection == "secondary electrons") fill1DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("secondary electrons").at(currentDir),scaleFactor); |
980 |
< |
else if(currentHistogram.inputCollection == "muon-muon pairs") fill1DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
981 |
< |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("muons").at(currentDir), \ |
982 |
< |
cumulativeFlags.at("muon-muon pairs").at(currentDir),scaleFactor); |
983 |
< |
else if(currentHistogram.inputCollection == "muon-secondary muon pairs") fill1DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
984 |
< |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("secondary muons").at(currentDir), \ |
985 |
< |
cumulativeFlags.at("muon-secondary muon pairs").at(currentDir),scaleFactor); |
986 |
< |
else if(currentHistogram.inputCollection == "electrons") fill1DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("electrons").at(currentDir),scaleFactor); |
987 |
< |
else if(currentHistogram.inputCollection == "electron-electron pairs") fill1DHistogram(histo,currentHistogram,electrons.product(),electrons.product(),\ |
988 |
< |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("electrons").at(currentDir),\ |
989 |
< |
cumulativeFlags.at("electron-electron pairs").at(currentDir),scaleFactor); |
990 |
< |
else if(currentHistogram.inputCollection == "jet-jet pairs") fill1DHistogram(histo,currentHistogram,jets.product(),jets.product(),\ |
991 |
< |
cumulativeFlags.at("jets").at(currentDir),cumulativeFlags.at("jets").at(currentDir),\ |
992 |
< |
cumulativeFlags.at("jet-jet pairs").at(currentDir),scaleFactor); |
993 |
< |
else if(currentHistogram.inputCollection == "electron-secondary electron pairs") fill1DHistogram(histo,currentHistogram,electrons.product(),electrons.product(), \ |
994 |
< |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("secondary electrons").at(currentDir), \ |
995 |
< |
cumulativeFlags.at("electron-secondary electron pairs").at(currentDir),scaleFactor); |
996 |
< |
else if(currentHistogram.inputCollection == "electron-muon pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),muons.product(), \ |
997 |
< |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("muons").at(currentDir), |
998 |
< |
cumulativeFlags.at("electron-muon pairs").at(currentDir),scaleFactor); |
999 |
< |
else if(currentHistogram.inputCollection == "electron-jet pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),jets.product(), \ |
1000 |
< |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("jets").at(currentDir), |
1001 |
< |
cumulativeFlags.at("electron-jet pairs").at(currentDir),scaleFactor); |
1002 |
< |
else if(currentHistogram.inputCollection == "muon-jet pairs") fill1DHistogram(histo,currentHistogram, muons.product(),jets.product(), \ |
1003 |
< |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("jets").at(currentDir), |
1004 |
< |
cumulativeFlags.at("muon-jet pairs").at(currentDir),scaleFactor); |
1005 |
< |
else if(currentHistogram.inputCollection == "electron-track pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),tracks.product(), |
1006 |
< |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("tracks").at(currentDir), |
1007 |
< |
cumulativeFlags.at("electron-track pairs").at(currentDir),scaleFactor); |
1008 |
< |
else if(currentHistogram.inputCollection == "muon-track pairs") fill1DHistogram(histo,currentHistogram, muons.product(),tracks.product(), |
1009 |
< |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("tracks").at(currentDir), |
1010 |
< |
cumulativeFlags.at("muon-track pairs").at(currentDir),scaleFactor); |
1011 |
< |
else if(currentHistogram.inputCollection == "muon-tau pairs") fill1DHistogram(histo,currentHistogram, muons.product(),taus.product(), |
1012 |
< |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("taus").at(currentDir), |
1013 |
< |
cumulativeFlags.at("muon-tau pairs").at(currentDir),scaleFactor); |
1014 |
< |
else if(currentHistogram.inputCollection == "tau-tau pairs") fill1DHistogram(histo,currentHistogram, taus.product(),taus.product(), |
1015 |
< |
cumulativeFlags.at("taus").at(currentDir),cumulativeFlags.at("taus").at(currentDir), |
1016 |
< |
cumulativeFlags.at("tau-tau pairs").at(currentDir),scaleFactor); |
1017 |
< |
else if(currentHistogram.inputCollection == "tau-track pairs") fill1DHistogram(histo,currentHistogram, taus.product(),tracks.product(), |
1018 |
< |
cumulativeFlags.at("taus").at(currentDir),cumulativeFlags.at("tracks").at(currentDir), |
1019 |
< |
cumulativeFlags.at("tau-track pairs").at(currentDir),scaleFactor); |
1020 |
< |
else if(currentHistogram.inputCollection == "electron-trigobj pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),trigobjs.product(), |
1021 |
< |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("trigobjs").at(currentDir), |
1022 |
< |
cumulativeFlags.at("electron-trigobj pairs").at(currentDir),scaleFactor); |
1023 |
< |
else if(currentHistogram.inputCollection == "muon-trigobj pairs") fill1DHistogram(histo,currentHistogram, muons.product(),trigobjs.product(), |
1024 |
< |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("trigobjs").at(currentDir), |
1025 |
< |
cumulativeFlags.at("muon-trigobj pairs").at(currentDir),scaleFactor); |
1026 |
< |
|
1027 |
< |
else if(currentHistogram.inputCollection == "events") fill1DHistogram(histo,currentHistogram,events.product(),cumulativeFlags.at("events").at(currentDir),scaleFactor); |
1028 |
< |
else if(currentHistogram.inputCollection == "taus") fill1DHistogram(histo,currentHistogram,taus.product(),cumulativeFlags.at("taus").at(currentDir),scaleFactor); |
1029 |
< |
else if(currentHistogram.inputCollection == "mets") fill1DHistogram(histo,currentHistogram,mets.product(),cumulativeFlags.at("mets").at(currentDir),scaleFactor); |
1030 |
< |
else if(currentHistogram.inputCollection == "tracks") fill1DHistogram(histo,currentHistogram,tracks.product(),cumulativeFlags.at("tracks").at(currentDir),scaleFactor); |
1031 |
< |
else if(currentHistogram.inputCollection == "genjets") fill1DHistogram(histo,currentHistogram,genjets.product(),cumulativeFlags.at("genjets").at(currentDir),scaleFactor); |
1032 |
< |
else if(currentHistogram.inputCollection == "mcparticles") fill1DHistogram(histo,currentHistogram,mcparticles.product(),cumulativeFlags.at("mcparticles").at(currentDir),scaleFactor); |
1033 |
< |
else if(currentHistogram.inputCollection == "primaryvertexs") fill1DHistogram(histo,currentHistogram,primaryvertexs.product(),cumulativeFlags.at("primaryvertexs").at(currentDir),scaleFactor); |
1034 |
< |
else if(currentHistogram.inputCollection == "bxlumis") fill1DHistogram(histo,currentHistogram,bxlumis.product(),cumulativeFlags.at("bxlumis").at(currentDir),scaleFactor); |
1035 |
< |
else if(currentHistogram.inputCollection == "photons") fill1DHistogram(histo,currentHistogram,photons.product(),cumulativeFlags.at("photons").at(currentDir),scaleFactor); |
1036 |
< |
else if(currentHistogram.inputCollection == "superclusters") fill1DHistogram(histo,currentHistogram,superclusters.product(),cumulativeFlags.at("superclusters").at(currentDir),scaleFactor); |
1037 |
< |
else if(currentHistogram.inputCollection == "trigobjs") fill1DHistogram(histo,currentHistogram,trigobjs.product(),cumulativeFlags.at("trigobjs").at(currentDir),scaleFactor); |
1038 |
< |
else if(currentHistogram.inputCollection == "stops" && datasetType_ == "signalMC") fill1DHistogram(histo,currentHistogram,stops.product(),cumulativeFlags.at("stops").at(currentDir),scaleFactor); |
1039 |
< |
} |
1040 |
< |
else if(currentHistogram.inputVariables.size() == 2){ |
1041 |
< |
TH2D* histo; |
1042 |
< |
histo = twoDHists_.at(currentChannelIndex).at(currentCut).at(currentHistogram.name); |
1043 |
< |
if (currentHistogram.inputCollection == "jets") fill2DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("jets").at(currentDir),scaleFactor); |
1044 |
< |
else if(currentHistogram.inputCollection == "secondary jets") fill2DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("secondary jets").at(currentDir),scaleFactor); |
1045 |
< |
else if(currentHistogram.inputCollection == "muons") fill2DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("muons").at(currentDir),scaleFactor); |
1046 |
< |
else if(currentHistogram.inputCollection == "secondary muons") fill2DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("secondary muons").at(currentDir),scaleFactor); |
1047 |
< |
else if(currentHistogram.inputCollection == "muon-muon pairs") fill2DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
1048 |
< |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("muons").at(currentDir), \ |
1049 |
< |
cumulativeFlags.at("muon-muon pairs").at(currentDir),scaleFactor); |
1050 |
< |
else if(currentHistogram.inputCollection == "muon-secondary muon pairs") fill2DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
1051 |
< |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("secondary muons").at(currentDir), \ |
1052 |
< |
cumulativeFlags.at("muon-secondary muon pairs").at(currentDir),scaleFactor); |
1053 |
< |
else if(currentHistogram.inputCollection == "electrons") fill2DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("electrons").at(currentDir),scaleFactor); |
1054 |
< |
else if(currentHistogram.inputCollection == "secondary electrons") fill2DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("secondary electrons").at(currentDir),scaleFactor); |
1055 |
< |
else if(currentHistogram.inputCollection == "electron-electron pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),electrons.product(), \ |
1056 |
< |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("electrons").at(currentDir), \ |
1057 |
< |
cumulativeFlags.at("electron-electron pairs").at(currentDir),scaleFactor); |
1058 |
< |
else if(currentHistogram.inputCollection == "jet-jet pairs") fill2DHistogram(histo,currentHistogram,jets.product(),jets.product(), \ |
1059 |
< |
cumulativeFlags.at("jets").at(currentDir),cumulativeFlags.at("jets").at(currentDir), \ |
1060 |
< |
cumulativeFlags.at("jet-jet pairs").at(currentDir),scaleFactor); |
1061 |
< |
else if(currentHistogram.inputCollection == "electron-secondary electron pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),electrons.product(), \ |
1062 |
< |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("secondary electrons").at(currentDir), \ |
1063 |
< |
cumulativeFlags.at("electron-secondary electron pairs").at(currentDir),scaleFactor); |
1064 |
< |
else if(currentHistogram.inputCollection == "electron-muon pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),muons.product(), \ |
1065 |
< |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("muons").at(currentDir), \ |
1066 |
< |
cumulativeFlags.at("electron-muon pairs").at(currentDir),scaleFactor); |
1067 |
< |
else if(currentHistogram.inputCollection == "electron-jet pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),jets.product(), \ |
1068 |
< |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("jets").at(currentDir), \ |
1069 |
< |
cumulativeFlags.at("electron-jet pairs").at(currentDir),scaleFactor); |
1070 |
< |
else if(currentHistogram.inputCollection == "muon-jet pairs") fill2DHistogram(histo,currentHistogram,muons.product(),jets.product(), \ |
1071 |
< |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("jets").at(currentDir), \ |
1072 |
< |
cumulativeFlags.at("muon-jet pairs").at(currentDir),scaleFactor); |
1073 |
< |
else if(currentHistogram.inputCollection == "electron-track pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),tracks.product(), |
1074 |
< |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("tracks").at(currentDir), |
1075 |
< |
cumulativeFlags.at("electron-track pairs").at(currentDir),scaleFactor); |
1076 |
< |
else if(currentHistogram.inputCollection == "muon-track pairs") fill2DHistogram(histo,currentHistogram,muons.product(),tracks.product(), |
1077 |
< |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("tracks").at(currentDir), |
1078 |
< |
cumulativeFlags.at("muon-track pairs").at(currentDir),scaleFactor); |
1079 |
< |
else if(currentHistogram.inputCollection == "muon-tau pairs") fill2DHistogram(histo,currentHistogram,muons.product(),taus.product(), |
1080 |
< |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("taus").at(currentDir), |
1081 |
< |
cumulativeFlags.at("muon-tau pairs").at(currentDir),scaleFactor); |
1082 |
< |
else if(currentHistogram.inputCollection == "tau-tau pairs") fill2DHistogram(histo,currentHistogram,taus.product(),taus.product(), |
1083 |
< |
cumulativeFlags.at("taus").at(currentDir),cumulativeFlags.at("taus").at(currentDir), |
1084 |
< |
cumulativeFlags.at("tau-tau pairs").at(currentDir),scaleFactor); |
1085 |
< |
else if(currentHistogram.inputCollection == "tau-track pairs") fill2DHistogram(histo,currentHistogram,taus.product(),tracks.product(), |
1086 |
< |
cumulativeFlags.at("taus").at(currentDir),cumulativeFlags.at("tracks").at(currentDir), |
1087 |
< |
cumulativeFlags.at("tau-track pairs").at(currentDir),scaleFactor); |
1088 |
< |
else if(currentHistogram.inputCollection == "electron-trigobj pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),trigobjs.product(), |
1089 |
< |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("trigobjs").at(currentDir), |
1090 |
< |
cumulativeFlags.at("electron-trigobj pairs").at(currentDir),scaleFactor); |
1091 |
< |
else if(currentHistogram.inputCollection == "muon-trigobj pairs") fill2DHistogram(histo,currentHistogram,muons.product(),trigobjs.product(), |
1092 |
< |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("trigobjs").at(currentDir), |
1093 |
< |
cumulativeFlags.at("muon-trigobj pairs").at(currentDir),scaleFactor); |
1094 |
< |
else if(currentHistogram.inputCollection == "events") fill2DHistogram(histo,currentHistogram,events.product(),cumulativeFlags.at("events").at(currentDir),scaleFactor); |
1095 |
< |
else if(currentHistogram.inputCollection == "taus") fill2DHistogram(histo,currentHistogram,taus.product(),cumulativeFlags.at("taus").at(currentDir),scaleFactor); |
1096 |
< |
else if(currentHistogram.inputCollection == "mets") fill2DHistogram(histo,currentHistogram,mets.product(),cumulativeFlags.at("mets").at(currentDir),scaleFactor); |
1097 |
< |
else if(currentHistogram.inputCollection == "tracks") fill2DHistogram(histo,currentHistogram,tracks.product(),cumulativeFlags.at("tracks").at(currentDir),scaleFactor); |
1098 |
< |
else if(currentHistogram.inputCollection == "track-event pairs") fill2DHistogram(histo,currentHistogram,tracks.product(),events.product(), |
1099 |
< |
cumulativeFlags.at("tracks").at(currentDir),cumulativeFlags.at("events").at(currentDir), |
1100 |
< |
cumulativeFlags.at("track-event pairs").at(currentDir),scaleFactor); |
1101 |
< |
else if(currentHistogram.inputCollection == "genjets") fill2DHistogram(histo,currentHistogram,genjets.product(),cumulativeFlags.at("genjets").at(currentDir),scaleFactor); |
1102 |
< |
else if(currentHistogram.inputCollection == "mcparticles") fill2DHistogram(histo,currentHistogram,mcparticles.product(),cumulativeFlags.at("mcparticles").at(currentDir),scaleFactor); |
1103 |
< |
else if(currentHistogram.inputCollection == "primaryvertexs") fill2DHistogram(histo,currentHistogram,primaryvertexs.product(),cumulativeFlags.at("primaryvertexs").at(currentDir),scaleFactor); |
1104 |
< |
else if(currentHistogram.inputCollection == "bxlumis") fill2DHistogram(histo,currentHistogram,bxlumis.product(),cumulativeFlags.at("bxlumis").at(currentDir),scaleFactor); |
1105 |
< |
else if(currentHistogram.inputCollection == "photons") fill2DHistogram(histo,currentHistogram,photons.product(),cumulativeFlags.at("photons").at(currentDir),scaleFactor); |
1106 |
< |
else if(currentHistogram.inputCollection == "superclusters") fill2DHistogram(histo,currentHistogram,superclusters.product(),cumulativeFlags.at("superclusters").at(currentDir),scaleFactor); |
1107 |
< |
else if(currentHistogram.inputCollection == "trigobjs") fill2DHistogram(histo,currentHistogram,trigobjs.product(),cumulativeFlags.at("trigobjs").at(currentDir),scaleFactor); |
1108 |
< |
else if(currentHistogram.inputCollection == "stops" && datasetType_ == "signalMC") fill2DHistogram(histo,currentHistogram,stops.product(),cumulativeFlags.at("stops").at(currentDir),scaleFactor); |
1109 |
< |
} |
1110 |
< |
} |
972 |
> |
if (cumulativeFlags.count(currentHistogram.inputCollection) == 0) cout << "Error: no flags found for collection: " << currentHistogram.inputCollection << ", will cause a seg fault" << endl; |
973 |
> |
|
974 |
> |
if(currentHistogram.inputVariables.size() == 1){ |
975 |
> |
TH1D* histo; |
976 |
> |
histo = oneDHists_.at(currentChannelIndex).at(currentCut).at(currentHistogram.name); |
977 |
> |
if (currentHistogram.inputCollection == "jets") fill1DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("jets").at(currentDir),scaleFactor); |
978 |
> |
else if(currentHistogram.inputCollection == "secondary jets") fill1DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("secondary jets").at(currentDir),scaleFactor); |
979 |
> |
else if(currentHistogram.inputCollection == "muons") fill1DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("muons").at(currentDir),scaleFactor); |
980 |
> |
else if(currentHistogram.inputCollection == "secondary muons") fill1DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("secondary muons").at(currentDir),scaleFactor); |
981 |
> |
else if(currentHistogram.inputCollection == "secondary electrons") fill1DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("secondary electrons").at(currentDir),scaleFactor); |
982 |
> |
else if(currentHistogram.inputCollection == "muon-muon pairs") fill1DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
983 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("muons").at(currentDir), \ |
984 |
> |
cumulativeFlags.at("muon-muon pairs").at(currentDir),scaleFactor); |
985 |
> |
else if(currentHistogram.inputCollection == "muon-secondary muon pairs") fill1DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
986 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("secondary muons").at(currentDir), \ |
987 |
> |
cumulativeFlags.at("muon-secondary muon pairs").at(currentDir),scaleFactor); |
988 |
> |
else if(currentHistogram.inputCollection == "muon-secondary jet pairs") fill1DHistogram(histo,currentHistogram,muons.product(),jets.product(), \ |
989 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("secondary jets").at(currentDir), \ |
990 |
> |
cumulativeFlags.at("muon-secondary jet pairs").at(currentDir),scaleFactor); |
991 |
> |
else if(currentHistogram.inputCollection == "photon-secondary jet pairs") fill1DHistogram(histo,currentHistogram,photons.product(),jets.product(), \ |
992 |
> |
cumulativeFlags.at("photons").at(currentDir),cumulativeFlags.at("secondary jets").at(currentDir), \ |
993 |
> |
cumulativeFlags.at("photon-secondary jet pairs").at(currentDir),scaleFactor); |
994 |
> |
else if(currentHistogram.inputCollection == "electron-secondary jet pairs") fill1DHistogram(histo,currentHistogram,electrons.product(),jets.product(), \ |
995 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("secondary jets").at(currentDir), \ |
996 |
> |
cumulativeFlags.at("electron-secondary jet pairs").at(currentDir),scaleFactor); |
997 |
> |
|
998 |
> |
else if(currentHistogram.inputCollection == "electrons") fill1DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("electrons").at(currentDir),scaleFactor); |
999 |
> |
else if(currentHistogram.inputCollection == "electron-electron pairs") fill1DHistogram(histo,currentHistogram,electrons.product(),electrons.product(),\ |
1000 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("electrons").at(currentDir),\ |
1001 |
> |
cumulativeFlags.at("electron-electron pairs").at(currentDir),scaleFactor); |
1002 |
> |
else if(currentHistogram.inputCollection == "jet-jet pairs") fill1DHistogram(histo,currentHistogram,jets.product(),jets.product(),\ |
1003 |
> |
cumulativeFlags.at("jets").at(currentDir),cumulativeFlags.at("jets").at(currentDir),\ |
1004 |
> |
cumulativeFlags.at("jet-jet pairs").at(currentDir),scaleFactor); |
1005 |
> |
else if(currentHistogram.inputCollection == "jet-secondary jet pairs") fill1DHistogram(histo,currentHistogram,jets.product(),jets.product(), \ |
1006 |
> |
cumulativeFlags.at("jets").at(currentDir),cumulativeFlags.at("secondary jets").at(currentDir), \ |
1007 |
> |
cumulativeFlags.at("jet-secondary jet pairs").at(currentDir),scaleFactor); |
1008 |
> |
|
1009 |
> |
else if(currentHistogram.inputCollection == "electron-secondary electron pairs") fill1DHistogram(histo,currentHistogram,electrons.product(),electrons.product(), \ |
1010 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("secondary electrons").at(currentDir), \ |
1011 |
> |
cumulativeFlags.at("electron-secondary electron pairs").at(currentDir),scaleFactor); |
1012 |
> |
else if(currentHistogram.inputCollection == "electron-muon pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),muons.product(), \ |
1013 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("muons").at(currentDir), |
1014 |
> |
cumulativeFlags.at("electron-muon pairs").at(currentDir),scaleFactor); |
1015 |
> |
else if(currentHistogram.inputCollection == "electron-jet pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),jets.product(), \ |
1016 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("jets").at(currentDir), |
1017 |
> |
cumulativeFlags.at("electron-jet pairs").at(currentDir),scaleFactor); |
1018 |
> |
else if(currentHistogram.inputCollection == "photon-jet pairs") fill1DHistogram(histo,currentHistogram, photons.product(),jets.product(), \ |
1019 |
> |
cumulativeFlags.at("photons").at(currentDir),cumulativeFlags.at("jets").at(currentDir), |
1020 |
> |
cumulativeFlags.at("photon-jet pairs").at(currentDir),scaleFactor); |
1021 |
> |
else if(currentHistogram.inputCollection == "muon-jet pairs") fill1DHistogram(histo,currentHistogram, muons.product(),jets.product(), \ |
1022 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("jets").at(currentDir), |
1023 |
> |
cumulativeFlags.at("muon-jet pairs").at(currentDir),scaleFactor); |
1024 |
> |
else if(currentHistogram.inputCollection == "muon-photon pairs") fill1DHistogram(histo,currentHistogram, muons.product(),photons.product(), \ |
1025 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("photons").at(currentDir), |
1026 |
> |
cumulativeFlags.at("muon-photon pairs").at(currentDir),scaleFactor); |
1027 |
> |
else if(currentHistogram.inputCollection == "electron-photon pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),photons.product(), \ |
1028 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("photons").at(currentDir), |
1029 |
> |
cumulativeFlags.at("electron-photon pairs").at(currentDir),scaleFactor); |
1030 |
> |
else if(currentHistogram.inputCollection == "electron-track pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),tracks.product(), |
1031 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("tracks").at(currentDir), |
1032 |
> |
cumulativeFlags.at("electron-track pairs").at(currentDir),scaleFactor); |
1033 |
> |
else if(currentHistogram.inputCollection == "muon-track pairs") fill1DHistogram(histo,currentHistogram, muons.product(),tracks.product(), |
1034 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("tracks").at(currentDir), |
1035 |
> |
cumulativeFlags.at("muon-track pairs").at(currentDir),scaleFactor); |
1036 |
> |
else if(currentHistogram.inputCollection == "muon-tau pairs") fill1DHistogram(histo,currentHistogram, muons.product(),taus.product(), |
1037 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("taus").at(currentDir), |
1038 |
> |
cumulativeFlags.at("muon-tau pairs").at(currentDir),scaleFactor); |
1039 |
> |
else if(currentHistogram.inputCollection == "tau-tau pairs") fill1DHistogram(histo,currentHistogram, taus.product(),taus.product(), |
1040 |
> |
cumulativeFlags.at("taus").at(currentDir),cumulativeFlags.at("taus").at(currentDir), |
1041 |
> |
cumulativeFlags.at("tau-tau pairs").at(currentDir),scaleFactor); |
1042 |
> |
else if(currentHistogram.inputCollection == "tau-track pairs") fill1DHistogram(histo,currentHistogram, taus.product(),tracks.product(), |
1043 |
> |
cumulativeFlags.at("taus").at(currentDir),cumulativeFlags.at("tracks").at(currentDir), |
1044 |
> |
cumulativeFlags.at("tau-track pairs").at(currentDir),scaleFactor); |
1045 |
> |
else if(currentHistogram.inputCollection == "electron-trigobj pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),trigobjs.product(), |
1046 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("trigobjs").at(currentDir), |
1047 |
> |
cumulativeFlags.at("electron-trigobj pairs").at(currentDir),scaleFactor); |
1048 |
> |
else if(currentHistogram.inputCollection == "muon-trigobj pairs") fill1DHistogram(histo,currentHistogram, muons.product(),trigobjs.product(), |
1049 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("trigobjs").at(currentDir), |
1050 |
> |
cumulativeFlags.at("muon-trigobj pairs").at(currentDir),scaleFactor); |
1051 |
> |
|
1052 |
> |
else if(currentHistogram.inputCollection == "events") fill1DHistogram(histo,currentHistogram,events.product(),cumulativeFlags.at("events").at(currentDir),scaleFactor); |
1053 |
> |
else if(currentHistogram.inputCollection == "taus") fill1DHistogram(histo,currentHistogram,taus.product(),cumulativeFlags.at("taus").at(currentDir),scaleFactor); |
1054 |
> |
else if(currentHistogram.inputCollection == "mets") fill1DHistogram(histo,currentHistogram,mets.product(),cumulativeFlags.at("mets").at(currentDir),scaleFactor); |
1055 |
> |
else if(currentHistogram.inputCollection == "tracks") fill1DHistogram(histo,currentHistogram,tracks.product(),cumulativeFlags.at("tracks").at(currentDir),scaleFactor); |
1056 |
> |
else if(currentHistogram.inputCollection == "genjets") fill1DHistogram(histo,currentHistogram,genjets.product(),cumulativeFlags.at("genjets").at(currentDir),scaleFactor); |
1057 |
> |
else if(currentHistogram.inputCollection == "mcparticles") fill1DHistogram(histo,currentHistogram,mcparticles.product(),cumulativeFlags.at("mcparticles").at(currentDir),scaleFactor); |
1058 |
> |
else if(currentHistogram.inputCollection == "primaryvertexs") fill1DHistogram(histo,currentHistogram,primaryvertexs.product(),cumulativeFlags.at("primaryvertexs").at(currentDir),scaleFactor); |
1059 |
> |
else if(currentHistogram.inputCollection == "bxlumis") fill1DHistogram(histo,currentHistogram,bxlumis.product(),cumulativeFlags.at("bxlumis").at(currentDir),scaleFactor); |
1060 |
> |
else if(currentHistogram.inputCollection == "photons") fill1DHistogram(histo,currentHistogram,photons.product(),cumulativeFlags.at("photons").at(currentDir),scaleFactor); |
1061 |
> |
else if(currentHistogram.inputCollection == "superclusters") fill1DHistogram(histo,currentHistogram,superclusters.product(),cumulativeFlags.at("superclusters").at(currentDir),scaleFactor); |
1062 |
> |
else if(currentHistogram.inputCollection == "trigobjs") fill1DHistogram(histo,currentHistogram,trigobjs.product(),cumulativeFlags.at("trigobjs").at(currentDir),scaleFactor); |
1063 |
> |
else if(currentHistogram.inputCollection == "stops" && datasetType_ == "signalMC") fill1DHistogram(histo,currentHistogram,stops.product(),cumulativeFlags.at("stops").at(currentDir),scaleFactor); |
1064 |
> |
} |
1065 |
> |
else if(currentHistogram.inputVariables.size() == 2){ |
1066 |
> |
TH2D* histo; |
1067 |
> |
histo = twoDHists_.at(currentChannelIndex).at(currentCut).at(currentHistogram.name); |
1068 |
> |
if (currentHistogram.inputCollection == "jets") fill2DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("jets").at(currentDir),scaleFactor); |
1069 |
> |
else if(currentHistogram.inputCollection == "secondary jets") fill2DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("secondary jets").at(currentDir),scaleFactor); |
1070 |
> |
else if(currentHistogram.inputCollection == "muons") fill2DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("muons").at(currentDir),scaleFactor); |
1071 |
> |
else if(currentHistogram.inputCollection == "secondary muons") fill2DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("secondary muons").at(currentDir),scaleFactor); |
1072 |
> |
else if(currentHistogram.inputCollection == "muon-muon pairs") fill2DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
1073 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("muons").at(currentDir), \ |
1074 |
> |
cumulativeFlags.at("muon-muon pairs").at(currentDir),scaleFactor); |
1075 |
> |
else if(currentHistogram.inputCollection == "muon-secondary muon pairs") fill2DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
1076 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("secondary muons").at(currentDir), \ |
1077 |
> |
cumulativeFlags.at("muon-secondary muon pairs").at(currentDir),scaleFactor); |
1078 |
> |
else if(currentHistogram.inputCollection == "muon-secondary jet pairs") fill2DHistogram(histo,currentHistogram,muons.product(),jets.product(), \ |
1079 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("secondary jets").at(currentDir), \ |
1080 |
> |
cumulativeFlags.at("muon-secondary jet pairs").at(currentDir),scaleFactor); |
1081 |
> |
else if(currentHistogram.inputCollection == "electron-secondary jet pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),jets.product(), \ |
1082 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("secondary jets").at(currentDir), \ |
1083 |
> |
cumulativeFlags.at("electron-secondary jet pairs").at(currentDir),scaleFactor); |
1084 |
> |
else if(currentHistogram.inputCollection == "photon-secondary jet pairs") fill2DHistogram(histo,currentHistogram,photons.product(),jets.product(), \ |
1085 |
> |
cumulativeFlags.at("photons").at(currentDir),cumulativeFlags.at("secondary jets").at(currentDir), \ |
1086 |
> |
cumulativeFlags.at("photon-secondary jet pairs").at(currentDir),scaleFactor); |
1087 |
> |
else if(currentHistogram.inputCollection == "electrons") fill2DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("electrons").at(currentDir),scaleFactor); |
1088 |
> |
else if(currentHistogram.inputCollection == "secondary electrons") fill2DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("secondary electrons").at(currentDir),scaleFactor); |
1089 |
> |
else if(currentHistogram.inputCollection == "electron-electron pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),electrons.product(), \ |
1090 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("electrons").at(currentDir), \ |
1091 |
> |
cumulativeFlags.at("electron-electron pairs").at(currentDir),scaleFactor); |
1092 |
> |
else if(currentHistogram.inputCollection == "jet-jet pairs") fill2DHistogram(histo,currentHistogram,jets.product(),jets.product(), \ |
1093 |
> |
cumulativeFlags.at("jets").at(currentDir),cumulativeFlags.at("jets").at(currentDir), \ |
1094 |
> |
cumulativeFlags.at("jet-jet pairs").at(currentDir),scaleFactor); |
1095 |
> |
else if(currentHistogram.inputCollection == "electron-secondary electron pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),electrons.product(), \ |
1096 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("secondary electrons").at(currentDir), \ |
1097 |
> |
cumulativeFlags.at("electron-secondary electron pairs").at(currentDir),scaleFactor); |
1098 |
> |
else if(currentHistogram.inputCollection == "electron-muon pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),muons.product(), \ |
1099 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("muons").at(currentDir), \ |
1100 |
> |
cumulativeFlags.at("electron-muon pairs").at(currentDir),scaleFactor); |
1101 |
> |
else if(currentHistogram.inputCollection == "electron-jet pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),jets.product(), \ |
1102 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("jets").at(currentDir), \ |
1103 |
> |
cumulativeFlags.at("electron-jet pairs").at(currentDir),scaleFactor); |
1104 |
> |
else if(currentHistogram.inputCollection == "electron-photon pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),photons.product(), \ |
1105 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("photons").at(currentDir), \ |
1106 |
> |
cumulativeFlags.at("electron-photon pairs").at(currentDir),scaleFactor); |
1107 |
> |
else if(currentHistogram.inputCollection == "muon-jet pairs") fill2DHistogram(histo,currentHistogram,muons.product(),jets.product(), \ |
1108 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("jets").at(currentDir), \ |
1109 |
> |
cumulativeFlags.at("muon-jet pairs").at(currentDir),scaleFactor); |
1110 |
> |
else if(currentHistogram.inputCollection == "photon-jet pairs") fill2DHistogram(histo,currentHistogram,photons.product(),jets.product(), \ |
1111 |
> |
cumulativeFlags.at("photons").at(currentDir),cumulativeFlags.at("jets").at(currentDir), \ |
1112 |
> |
cumulativeFlags.at("photon-jet pairs").at(currentDir),scaleFactor); |
1113 |
> |
else if(currentHistogram.inputCollection == "muon-photon pairs") fill2DHistogram(histo,currentHistogram,muons.product(),photons.product(), \ |
1114 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("photons").at(currentDir), \ |
1115 |
> |
cumulativeFlags.at("muon-photon pairs").at(currentDir),scaleFactor); |
1116 |
> |
else if(currentHistogram.inputCollection == "electron-track pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),tracks.product(), |
1117 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("tracks").at(currentDir), |
1118 |
> |
cumulativeFlags.at("electron-track pairs").at(currentDir),scaleFactor); |
1119 |
> |
else if(currentHistogram.inputCollection == "muon-track pairs") fill2DHistogram(histo,currentHistogram,muons.product(),tracks.product(), |
1120 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("tracks").at(currentDir), |
1121 |
> |
cumulativeFlags.at("muon-track pairs").at(currentDir),scaleFactor); |
1122 |
> |
else if(currentHistogram.inputCollection == "muon-tau pairs") fill2DHistogram(histo,currentHistogram,muons.product(),taus.product(), |
1123 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("taus").at(currentDir), |
1124 |
> |
cumulativeFlags.at("muon-tau pairs").at(currentDir),scaleFactor); |
1125 |
> |
else if(currentHistogram.inputCollection == "tau-tau pairs") fill2DHistogram(histo,currentHistogram,taus.product(),taus.product(), |
1126 |
> |
cumulativeFlags.at("taus").at(currentDir),cumulativeFlags.at("taus").at(currentDir), |
1127 |
> |
cumulativeFlags.at("tau-tau pairs").at(currentDir),scaleFactor); |
1128 |
> |
else if(currentHistogram.inputCollection == "tau-track pairs") fill2DHistogram(histo,currentHistogram,taus.product(),tracks.product(), |
1129 |
> |
cumulativeFlags.at("taus").at(currentDir),cumulativeFlags.at("tracks").at(currentDir), |
1130 |
> |
cumulativeFlags.at("tau-track pairs").at(currentDir),scaleFactor); |
1131 |
> |
else if(currentHistogram.inputCollection == "electron-trigobj pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),trigobjs.product(), |
1132 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("trigobjs").at(currentDir), |
1133 |
> |
cumulativeFlags.at("electron-trigobj pairs").at(currentDir),scaleFactor); |
1134 |
> |
else if(currentHistogram.inputCollection == "muon-trigobj pairs") fill2DHistogram(histo,currentHistogram,muons.product(),trigobjs.product(), |
1135 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("trigobjs").at(currentDir), |
1136 |
> |
cumulativeFlags.at("muon-trigobj pairs").at(currentDir),scaleFactor); |
1137 |
> |
else if(currentHistogram.inputCollection == "events") fill2DHistogram(histo,currentHistogram,events.product(),cumulativeFlags.at("events").at(currentDir),scaleFactor); |
1138 |
> |
else if(currentHistogram.inputCollection == "taus") fill2DHistogram(histo,currentHistogram,taus.product(),cumulativeFlags.at("taus").at(currentDir),scaleFactor); |
1139 |
> |
else if(currentHistogram.inputCollection == "mets") fill2DHistogram(histo,currentHistogram,mets.product(),cumulativeFlags.at("mets").at(currentDir),scaleFactor); |
1140 |
> |
else if(currentHistogram.inputCollection == "tracks") fill2DHistogram(histo,currentHistogram,tracks.product(),cumulativeFlags.at("tracks").at(currentDir),scaleFactor); |
1141 |
> |
else if(currentHistogram.inputCollection == "track-event pairs") fill2DHistogram(histo,currentHistogram,tracks.product(),events.product(), |
1142 |
> |
cumulativeFlags.at("tracks").at(currentDir),cumulativeFlags.at("events").at(currentDir), |
1143 |
> |
cumulativeFlags.at("track-event pairs").at(currentDir),scaleFactor); |
1144 |
> |
else if(currentHistogram.inputCollection == "genjets") fill2DHistogram(histo,currentHistogram,genjets.product(),cumulativeFlags.at("genjets").at(currentDir),scaleFactor); |
1145 |
> |
else if(currentHistogram.inputCollection == "mcparticles") fill2DHistogram(histo,currentHistogram,mcparticles.product(),cumulativeFlags.at("mcparticles").at(currentDir),scaleFactor); |
1146 |
> |
else if(currentHistogram.inputCollection == "primaryvertexs") fill2DHistogram(histo,currentHistogram,primaryvertexs.product(),cumulativeFlags.at("primaryvertexs").at(currentDir),scaleFactor); |
1147 |
> |
else if(currentHistogram.inputCollection == "bxlumis") fill2DHistogram(histo,currentHistogram,bxlumis.product(),cumulativeFlags.at("bxlumis").at(currentDir),scaleFactor); |
1148 |
> |
else if(currentHistogram.inputCollection == "photons") fill2DHistogram(histo,currentHistogram,photons.product(),cumulativeFlags.at("photons").at(currentDir),scaleFactor); |
1149 |
> |
else if(currentHistogram.inputCollection == "superclusters") fill2DHistogram(histo,currentHistogram,superclusters.product(),cumulativeFlags.at("superclusters").at(currentDir),scaleFactor); |
1150 |
> |
else if(currentHistogram.inputCollection == "trigobjs") fill2DHistogram(histo,currentHistogram,trigobjs.product(),cumulativeFlags.at("trigobjs").at(currentDir),scaleFactor); |
1151 |
> |
else if(currentHistogram.inputCollection == "stops" && datasetType_ == "signalMC") fill2DHistogram(histo,currentHistogram,stops.product(),cumulativeFlags.at("stops").at(currentDir),scaleFactor); |
1152 |
> |
} |
1153 |
> |
|
1154 |
> |
} |
1155 |
|
|
1156 |
|
|
1157 |
+ |
//fills histograms with the sizes of collections |
1158 |
+ |
for (uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){ |
1159 |
|
|
1160 |
< |
//fills histograms with the sizes of collections |
1161 |
< |
for (uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){ |
970 |
< |
|
971 |
< |
string currentObject = objectsToPlot.at(currentObjectIndex); |
972 |
< |
string objectToPlot = ""; |
973 |
< |
|
974 |
< |
// Name of objectToPlot here must match the name specified in OSUAnalysis::OSUAnalysis(). |
975 |
< |
if(currentObject == "muon-muon pairs") objectToPlot = "dimuonPairs"; |
976 |
< |
else if(currentObject == "electron-electron pairs") objectToPlot = "dielectronPairs"; |
977 |
< |
else if(currentObject == "electron-muon pairs") objectToPlot = "electronMuonPairs"; |
978 |
< |
else if(currentObject == "electron-jet pairs") objectToPlot = "electronJetPairs"; |
979 |
< |
else if(currentObject == "muon-jet pairs") objectToPlot = "muonJetPairs"; |
980 |
< |
else if(currentObject == "jet-jet pairs") objectToPlot = "dijetPairs"; |
981 |
< |
else if(currentObject == "secondary jets") objectToPlot = "secondaryJets"; |
982 |
< |
else if(currentObject == "electron-track pairs") objectToPlot = "electronTrackPairs"; |
983 |
< |
else if(currentObject == "muon-track pairs") objectToPlot = "muonTrackPairs"; |
984 |
< |
else if(currentObject == "muon-tau pairs") objectToPlot = "muonTauPairs"; |
985 |
< |
else if(currentObject == "tau-tau pairs") objectToPlot = "ditauPairs"; |
986 |
< |
else if(currentObject == "tau-track pairs") objectToPlot = "tauTrackPairs"; |
987 |
< |
else if(currentObject == "track-event pairs") objectToPlot = "trackEventPairs"; |
988 |
< |
else if(currentObject == "muon-secondary muon pairs") objectToPlot = "muonSecondaryMuonPairs"; |
989 |
< |
else if(currentObject == "secondary muons") objectToPlot = "secondaryMuons"; |
990 |
< |
else if(currentObject == "electron-secondary electron pairs") objectToPlot = "electronSecondaryElectronPairs"; |
991 |
< |
else if(currentObject == "secondary electrons") objectToPlot = "secondaryElectrons"; |
992 |
< |
else if(currentObject == "electron-trigobj pairs") objectToPlot = "electronTrigobjPairs"; |
993 |
< |
else if(currentObject == "muon-trigobj pairs") objectToPlot = "muonTrigobjPairs"; |
994 |
< |
else objectToPlot = currentObject; |
995 |
< |
|
996 |
< |
string tempCurrentObject = objectToPlot; |
997 |
< |
tempCurrentObject.at(0) = toupper(tempCurrentObject.at(0)); |
998 |
< |
string histoName = "num" + tempCurrentObject; |
999 |
< |
|
1000 |
< |
//set position of primary vertex in event, in order to calculate quantities relative to it |
1001 |
< |
if(find(objectsToCut.begin(), objectsToCut.end(), currentObject) != objectsToCut.end()) { |
1002 |
< |
vector<bool> lastCutFlags = cumulativeFlags.at(currentObject).at(currentDir); |
1003 |
< |
int numToPlot = 0; |
1004 |
< |
for (uint currentFlag = 0; currentFlag != lastCutFlags.size(); currentFlag++){ |
1005 |
< |
if(lastCutFlags.at(currentFlag)) numToPlot++; |
1006 |
< |
} |
1007 |
< |
if(objectToPlot == "primaryvertexs"){ |
1008 |
< |
oneDHists_.at(currentChannelIndex).at(currentCut).at(histoName+"BeforePileupCorrection")->Fill(primaryvertexs->size()); |
1009 |
< |
oneDHists_.at(currentChannelIndex).at(currentCut).at(histoName+"AfterPileupCorrection")->Fill(primaryvertexs->size(),scaleFactor); |
1010 |
< |
} |
1011 |
< |
else { |
1012 |
< |
oneDHists_.at(currentChannelIndex).at(currentCut).at(histoName)->Fill(numToPlot,scaleFactor); |
1013 |
< |
} |
1014 |
< |
} |
1015 |
< |
else if(objectToPlot == "jets") oneDHists_.at(currentChannelIndex).at(currentCut).at(histoName)->Fill(jets->size(),scaleFactor); |
1016 |
< |
else if(objectToPlot == "secondaryJets") oneDHists_.at(currentChannelIndex).at(currentCut).at(histoName)->Fill(jets->size(),scaleFactor); |
1017 |
< |
else if(objectToPlot == "muons") oneDHists_.at(currentChannelIndex).at(currentCut).at(histoName)->Fill(muons->size(),scaleFactor); |
1018 |
< |
else if(objectToPlot == "secondaryMuons") oneDHists_.at(currentChannelIndex).at(currentCut).at(histoName)->Fill(muons->size(),scaleFactor); |
1019 |
< |
else if(objectToPlot == "dimuonPairs") oneDHists_.at(currentChannelIndex).at(currentCut).at(histoName)->Fill(muons->size()*(muons->size()-1)/2,scaleFactor); |
1020 |
< |
else if(objectToPlot == "muonSecondaryMuonPairs") oneDHists_.at(currentChannelIndex).at(currentCut).at(histoName)->Fill(muons->size()*(muons->size()-1)/2,scaleFactor); |
1021 |
< |
else if(objectToPlot == "electrons") oneDHists_.at(currentChannelIndex).at(currentCut).at(histoName)->Fill(electrons->size(),scaleFactor); |
1022 |
< |
else if(objectToPlot == "secondaryElectrons") oneDHists_.at(currentChannelIndex).at(currentCut).at(histoName)->Fill(electrons->size(),scaleFactor); |
1023 |
< |
else if(objectToPlot == "dielectronPairs") oneDHists_.at(currentChannelIndex).at(currentCut).at(histoName)->Fill(electrons->size()*(electrons->size()-1)/2,scaleFactor); |
1024 |
< |
else if(objectToPlot == "electronSecondaryElectronPairs") oneDHists_.at(currentChannelIndex).at(currentCut).at(histoName)->Fill(electrons->size()*(electrons->size()-1)/2,scaleFactor); |
1025 |
< |
else if(objectToPlot == "electronMuonPairs") oneDHists_.at(currentChannelIndex).at(currentCut).at(histoName)->Fill(electrons->size()*muons->size(),scaleFactor); |
1026 |
< |
else if(objectToPlot == "electronJetPairs") oneDHists_.at(currentChannelIndex).at(currentCut).at(histoName)->Fill(electrons->size()*jets->size(),scaleFactor); |
1027 |
< |
else if(objectToPlot == "muonJetPairs") oneDHists_.at(currentChannelIndex).at(currentCut).at(histoName)->Fill(muons->size()*jets->size(),scaleFactor); |
1028 |
< |
else if(objectToPlot == "electronTrackPairs") oneDHists_.at(currentChannelIndex).at(currentCut).at(histoName)->Fill(electrons->size()*tracks->size(),scaleFactor); |
1029 |
< |
else if(objectToPlot == "electronTrigobjPairs") oneDHists_.at(currentChannelIndex).at(currentCut).at(histoName)->Fill(electrons->size()*trigobjs->size(),scaleFactor); |
1030 |
< |
else if(objectToPlot == "muonTrigobjPairs") oneDHists_.at(currentChannelIndex).at(currentCut).at(histoName)->Fill(muons->size()*trigobjs->size(),scaleFactor); |
1031 |
< |
else if(objectToPlot == "events") oneDHists_.at(currentChannelIndex).at(currentCut).at(histoName)->Fill(events->size(),scaleFactor); |
1032 |
< |
else if(objectToPlot == "taus") oneDHists_.at(currentChannelIndex).at(currentCut).at(histoName)->Fill(taus->size(),scaleFactor); |
1033 |
< |
else if(objectToPlot == "mets") oneDHists_.at(currentChannelIndex).at(currentCut).at(histoName)->Fill(mets->size(),scaleFactor); |
1034 |
< |
else if(objectToPlot == "tracks") oneDHists_.at(currentChannelIndex).at(currentCut).at(histoName)->Fill(tracks->size(),scaleFactor); |
1035 |
< |
else if(objectToPlot == "genjets") oneDHists_.at(currentChannelIndex).at(currentCut).at(histoName)->Fill(genjets->size(),scaleFactor); |
1036 |
< |
else if(objectToPlot == "mcparticles") oneDHists_.at(currentChannelIndex).at(currentCut).at(histoName)->Fill(mcparticles->size(),scaleFactor); |
1037 |
< |
else if(objectToPlot == "bxlumis") oneDHists_.at(currentChannelIndex).at(currentCut).at(histoName)->Fill(bxlumis->size(),scaleFactor); |
1038 |
< |
else if(objectToPlot == "photons") oneDHists_.at(currentChannelIndex).at(currentCut).at(histoName)->Fill(photons->size(),scaleFactor); |
1039 |
< |
else if(objectToPlot == "superclusters") oneDHists_.at(currentChannelIndex).at(currentCut).at(histoName)->Fill(superclusters->size(),scaleFactor); |
1040 |
< |
else if(objectToPlot == "trigobjs") oneDHists_.at(currentChannelIndex).at(currentCut).at(histoName)->Fill(trigobjs->size(),scaleFactor); |
1041 |
< |
else if(objectToPlot == "primaryvertexs"){ |
1042 |
< |
oneDHists_.at(currentChannelIndex).at(currentCut).at(histoName+"BeforePileupCorrection")->Fill(primaryvertexs->size()); |
1043 |
< |
oneDHists_.at(currentChannelIndex).at(currentCut).at(histoName+"AfterPileupCorrection")->Fill(primaryvertexs->size(),scaleFactor); |
1044 |
< |
} |
1045 |
< |
if(objectToPlot == "stops" && datasetType_ == "signalMC") oneDHists_.at(currentChannelIndex).at(currentCut).at(histoName)->Fill(stops->size(),scaleFactor); |
1160 |
> |
string currentObject = objectsToPlot.at(currentObjectIndex); |
1161 |
> |
string objectToPlot = ""; |
1162 |
|
|
1163 |
< |
} // end for (uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++) |
1163 |
> |
// Name of objectToPlot here must match the name specified in OSUAnalysis::OSUAnalysis(). |
1164 |
> |
if(currentObject == "muon-muon pairs") objectToPlot = "dimuonPairs"; |
1165 |
> |
else if(currentObject == "electron-electron pairs") objectToPlot = "dielectronPairs"; |
1166 |
> |
else if(currentObject == "electron-muon pairs") objectToPlot = "electronMuonPairs"; |
1167 |
> |
else if(currentObject == "electron-photon pairs") objectToPlot = "electronPhotonPairs"; |
1168 |
> |
else if(currentObject == "electron-jet pairs") objectToPlot = "electronJetPairs"; |
1169 |
> |
else if(currentObject == "muon-jet pairs") objectToPlot = "muonJetPairs"; |
1170 |
> |
else if(currentObject == "muon-photon pairs") objectToPlot = "muonPhotonPairs"; |
1171 |
> |
else if(currentObject == "photon-jet pairs") objectToPlot = "photonJetPairs"; |
1172 |
> |
else if(currentObject == "jet-jet pairs") objectToPlot = "dijetPairs"; |
1173 |
> |
else if(currentObject == "jet-secondary jet pairs") objectToPlot = "jetSecondaryJetPairs"; |
1174 |
> |
else if(currentObject == "secondary jets") objectToPlot = "secondaryJets"; |
1175 |
> |
else if(currentObject == "electron-track pairs") objectToPlot = "electronTrackPairs"; |
1176 |
> |
else if(currentObject == "muon-track pairs") objectToPlot = "muonTrackPairs"; |
1177 |
> |
else if(currentObject == "muon-tau pairs") objectToPlot = "muonTauPairs"; |
1178 |
> |
else if(currentObject == "tau-tau pairs") objectToPlot = "ditauPairs"; |
1179 |
> |
else if(currentObject == "tau-track pairs") objectToPlot = "tauTrackPairs"; |
1180 |
> |
else if(currentObject == "track-event pairs") objectToPlot = "trackEventPairs"; |
1181 |
> |
else if(currentObject == "muon-secondary muon pairs") objectToPlot = "muonSecondaryMuonPairs"; |
1182 |
> |
else if(currentObject == "secondary muons") objectToPlot = "secondaryMuons"; |
1183 |
> |
else if(currentObject == "muon-secondary jet pairs") objectToPlot = "muonSecondaryJetPairs"; |
1184 |
> |
else if(currentObject == "electron-secondary jet pairs") objectToPlot = "electronSecondaryJetPairs"; |
1185 |
> |
else if(currentObject == "photon-secondary jet pairs") objectToPlot = "photonSecondaryJetPairs"; |
1186 |
> |
else if(currentObject == "electron-secondary electron pairs") objectToPlot = "electronSecondaryElectronPairs"; |
1187 |
> |
else if(currentObject == "secondary electrons") objectToPlot = "secondaryElectrons"; |
1188 |
> |
else if(currentObject == "electron-trigobj pairs") objectToPlot = "electronTrigobjPairs"; |
1189 |
> |
else if(currentObject == "muon-trigobj pairs") objectToPlot = "muonTrigobjPairs"; |
1190 |
> |
else objectToPlot = currentObject; |
1191 |
> |
|
1192 |
> |
string tempCurrentObject = objectToPlot; |
1193 |
> |
tempCurrentObject.at(0) = toupper(tempCurrentObject.at(0)); |
1194 |
> |
string histoName = "num" + tempCurrentObject; |
1195 |
> |
|
1196 |
> |
|
1197 |
> |
if(find(objectsToCut.begin(), objectsToCut.end(), currentObject) != objectsToCut.end()) { |
1198 |
> |
flagPair lastCutFlags = cumulativeFlags.at(currentObject).at(currentDir); |
1199 |
> |
int numToPlot = 0; |
1200 |
> |
for (uint currentFlag = 0; currentFlag != lastCutFlags.size(); currentFlag++){ |
1201 |
> |
if(lastCutFlags.at(currentFlag).second) numToPlot++; |
1202 |
> |
} |
1203 |
> |
|
1204 |
> |
if(objectToPlot == "primaryvertexs"){ |
1205 |
> |
oneDHists_.at(currentChannelIndex).at(currentCut).at(histoName+"BeforePileupCorrection")->Fill(primaryvertexs->size()); |
1206 |
> |
oneDHists_.at(currentChannelIndex).at(currentCut).at(histoName+"AfterPileupCorrection")->Fill(primaryvertexs->size(),scaleFactor); |
1207 |
> |
} |
1208 |
> |
else { |
1209 |
> |
oneDHists_.at(currentChannelIndex).at(currentCut).at(histoName)->Fill(numToPlot,scaleFactor); |
1210 |
> |
} |
1211 |
> |
} |
1212 |
> |
} // end for (uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++) |
1213 |
> |
|
1214 |
> |
|
1215 |
> |
} // end if(eventPassedPreviousCuts.at(currentDir)) |
1216 |
> |
} // end loop over cuts |
1217 |
> |
|
1218 |
> |
if (!useEDMFormat_ && eventPassedAllCuts){ |
1219 |
> |
// Assign BNTree variables |
1220 |
> |
for (uint iBranch = 0; iBranch != treeBranches_.size(); iBranch++) { |
1221 |
> |
BranchSpecs brSpecs = treeBranches_.at(iBranch); |
1222 |
> |
string coll = brSpecs.inputCollection; |
1223 |
> |
if (cumulativeFlags.count(coll) == 0) cout << "Error: no flags found for collection: " << coll << ", will cause a seg fault" << endl; |
1224 |
> |
|
1225 |
> |
if (coll == "jets") assignTreeBranch(brSpecs,jets.product(), cumulativeFlags.at(coll).back()); |
1226 |
> |
else if(coll == "secondary jets") assignTreeBranch(brSpecs,jets.product(), cumulativeFlags.at(coll).back()); |
1227 |
> |
else if(coll == "muons") assignTreeBranch(brSpecs,muons.product(), cumulativeFlags.at(coll).back()); |
1228 |
> |
else if(coll == "secondary muons") assignTreeBranch(brSpecs,muons.product(), cumulativeFlags.at(coll).back()); |
1229 |
> |
else if(coll == "electrons") assignTreeBranch(brSpecs,electrons.product(), cumulativeFlags.at(coll).back()); |
1230 |
> |
else if(coll == "secondary electrons") assignTreeBranch(brSpecs,electrons.product(), cumulativeFlags.at(coll).back()); |
1231 |
> |
else if(coll == "events") assignTreeBranch(brSpecs,events.product(), cumulativeFlags.at(coll).back()); |
1232 |
> |
else if(coll == "taus") assignTreeBranch(brSpecs,taus.product(), cumulativeFlags.at(coll).back()); |
1233 |
> |
else if(coll == "mets") assignTreeBranch(brSpecs,mets.product(), cumulativeFlags.at(coll).back()); |
1234 |
> |
else if(coll == "tracks") assignTreeBranch(brSpecs,tracks.product(), cumulativeFlags.at(coll).back()); |
1235 |
> |
else if(coll == "genjets") assignTreeBranch(brSpecs,genjets.product(), cumulativeFlags.at(coll).back()); |
1236 |
> |
else if(coll == "mcparticles") assignTreeBranch(brSpecs,mcparticles.product(), cumulativeFlags.at(coll).back()); |
1237 |
> |
else if(coll == "primaryvertexs") assignTreeBranch(brSpecs,primaryvertexs.product(),cumulativeFlags.at(coll).back()); |
1238 |
> |
else if(coll == "bxlumis") assignTreeBranch(brSpecs,bxlumis.product(), cumulativeFlags.at(coll).back()); |
1239 |
> |
else if(coll == "photons") assignTreeBranch(brSpecs,photons.product(), cumulativeFlags.at(coll).back()); |
1240 |
> |
else if(coll == "superclusters") assignTreeBranch(brSpecs,superclusters.product(), cumulativeFlags.at(coll).back()); |
1241 |
> |
else if(coll == "trigobjs") assignTreeBranch(brSpecs,trigobjs.product(), cumulativeFlags.at(coll).back()); |
1242 |
> |
else if(coll == "stops" |
1243 |
> |
&& datasetType_ == "signalMC") assignTreeBranch(brSpecs,stops.product(), cumulativeFlags.at(coll).back()); |
1244 |
> |
} // end loop over branches |
1245 |
> |
|
1246 |
> |
if (!BNTrees_.at(currentChannelIndex)) { cout << "ERROR: Undefined BNTree. Will likely seg fault." << endl; } |
1247 |
> |
BNTrees_.at(currentChannelIndex)->Fill(); // only fill if event has passed cuts |
1248 |
|
} |
1249 |
< |
} |
1250 |
< |
} //end loop over channel |
1249 |
> |
|
1250 |
> |
(*channelDecisions)[currentChannel.name] = eventPassedAllCuts; |
1251 |
> |
|
1252 |
> |
} // end loop over channel |
1253 |
|
|
1254 |
|
masterCutFlow_->fillCutFlow(masterScaleFactor); |
1255 |
|
|
1256 |
+ |
event.put (channelDecisions, "channelDecisions"); |
1257 |
+ |
|
1258 |
|
} // end void OSUAnalysis::analyze (const edm::Event &event, const edm::EventSetup &setup) |
1259 |
|
|
1260 |
|
|
1290 |
|
} |
1291 |
|
|
1292 |
|
bool |
1293 |
< |
OSUAnalysis::evaluateTriggers (vector<string> triggersToTest, const BNtriggerCollection* triggerCollection){ |
1293 |
> |
OSUAnalysis::evaluateTriggers (vector<string> triggersToTest, vector<string> triggersToVeto, const BNtriggerCollection* triggerCollection){ |
1294 |
|
|
1295 |
+ |
//initialize to false until a chosen trigger is passed |
1296 |
|
bool triggerDecision = false; |
1297 |
|
|
1298 |
< |
for (BNtriggerCollection::const_iterator trigger = triggerCollection->begin (); trigger != triggerCollection->end (); trigger++) |
1299 |
< |
{ |
1300 |
< |
if(trigger->pass != 1) continue; |
1301 |
< |
for(uint triggerName = 0; triggerName != triggersToTest.size(); triggerName++) |
1302 |
< |
{ |
1303 |
< |
if(trigger->name.find(triggersToTest.at(triggerName))!=string::npos){ |
1304 |
< |
triggerDecision = true; |
1305 |
< |
} |
1306 |
< |
} |
1298 |
> |
if (printAllTriggers_) cout << "Printing list of all available triggers (which this event may or may not pass):" << endl; |
1299 |
> |
//loop over all triggers defined in the event |
1300 |
> |
for (BNtriggerCollection::const_iterator trigger = triggerCollection->begin (); trigger != triggerCollection->end (); trigger++){ |
1301 |
> |
|
1302 |
> |
if (printAllTriggers_) cout << " " << trigger->name << endl; |
1303 |
> |
|
1304 |
> |
//we're only interested in triggers that actually passed |
1305 |
> |
if(trigger->pass != 1) continue; |
1306 |
> |
|
1307 |
> |
//if the event passes one of the veto triggers, exit and return false |
1308 |
> |
for(uint triggerName = 0; triggerName != triggersToVeto.size(); triggerName++){ |
1309 |
> |
if(trigger->name.find(triggersToVeto.at(triggerName))!=string::npos) return false; |
1310 |
> |
} |
1311 |
> |
//if the event passes one of the chosen triggers, set triggerDecision to true |
1312 |
> |
for(uint triggerName = 0; triggerName != triggersToTest.size(); triggerName++){ |
1313 |
> |
if(trigger->name.find(triggersToTest.at(triggerName))!=string::npos) triggerDecision = true; |
1314 |
|
} |
1315 |
< |
return triggerDecision; |
1315 |
> |
} |
1316 |
> |
|
1317 |
> |
printAllTriggers_ = false; // only print triggers once, not every event |
1318 |
|
|
1319 |
+ |
//if none of the veto triggers fired: |
1320 |
+ |
//return the OR of all the chosen triggers |
1321 |
+ |
if (triggersToTest.size() != 0) return triggerDecision; |
1322 |
+ |
//or if no triggers were defined return true |
1323 |
+ |
else return true; |
1324 |
|
} |
1325 |
|
|
1326 |
+ |
|
1327 |
|
vector<string> |
1328 |
|
OSUAnalysis::splitString (string inputString){ |
1329 |
|
|
1485 |
|
else if(variable == "puJetId_loose_simple") value = object->puJetId_loose_simple; |
1486 |
|
else if(variable == "puJetId_loose_cutbased") value = object->puJetId_loose_cutbased; |
1487 |
|
|
1488 |
+ |
//user defined variable |
1489 |
+ |
else if(variable == "disappTrkLeadingJetID") { |
1490 |
+ |
value = object->pt > 110 |
1491 |
+ |
&& fabs(object->eta) < 2.4 |
1492 |
+ |
&& object->chargedHadronEnergyFraction > 0.2 |
1493 |
+ |
&& object->neutralHadronEnergyFraction < 0.7 |
1494 |
+ |
&& object->chargedEmEnergyFraction < 0.5 |
1495 |
+ |
&& object->neutralEmEnergyFraction < 0.7; |
1496 |
+ |
} |
1497 |
+ |
|
1498 |
+ |
else if(variable == "disappTrkSubLeadingJetID") { |
1499 |
+ |
value = object->pt > 30 |
1500 |
+ |
&& fabs(object->eta) < 4.5 |
1501 |
+ |
&& object->neutralHadronEnergyFraction < 0.7 |
1502 |
+ |
&& object->chargedEmEnergyFraction < 0.5; |
1503 |
+ |
} |
1504 |
+ |
|
1505 |
|
|
1506 |
|
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
1507 |
|
|
1668 |
|
else if(variable == "time_ndof") value = object->time_ndof; |
1669 |
|
|
1670 |
|
//user-defined variables |
1671 |
+ |
else if(variable == "looseID") { |
1672 |
+ |
value = object->pt > 10 |
1673 |
+ |
&& object->isGlobalMuon > 0 |
1674 |
+ |
&& object->isTrackerMuon > 0; |
1675 |
+ |
} |
1676 |
|
else if(variable == "correctedD0VertexErr") value = hypot (object->tkD0err, hypot (chosenVertex ()->xError, chosenVertex ()->yError)); |
1677 |
|
else if(variable == "correctedD0VertexSig") value = object->correctedD0Vertex / hypot (object->tkD0err, hypot (chosenVertex ()->xError, chosenVertex ()->yError)); |
1678 |
|
else if(variable == "detIso") value = (object->trackIsoDR03) / object->pt; |
1800 |
|
value = object->isGlobalMuon > 0 \ |
1801 |
|
&& object->isPFMuon > 0 \ |
1802 |
|
&& object->normalizedChi2 < 10 \ |
1803 |
< |
&& object->numberOfValidMuonHits > 0 \ |
1803 |
> |
&& object->numberOfValidMuonHits > 0 \ |
1804 |
|
&& object->numberOfMatchedStations > 1 \ |
1805 |
|
&& fabs(object->correctedD0Vertex) < 0.2 \ |
1806 |
|
&& fabs(object->correctedDZ) < 0.5 \ |
1811 |
|
value = object->isGlobalMuon > 0 \ |
1812 |
|
&& object->isPFMuon > 0 \ |
1813 |
|
&& object->normalizedChi2 < 10 \ |
1814 |
< |
&& object->numberOfValidMuonHits > 0 \ |
1814 |
> |
&& object->numberOfValidMuonHits > 0 \ |
1815 |
|
&& object->numberOfMatchedStations > 1 \ |
1816 |
|
&& object->numberOfValidPixelHits > 0 \ |
1817 |
|
&& object->numberOfLayersWithMeasurement > 5; |
1866 |
|
d0Error = hypot (object->tkD0err, hypot (chosenVertex ()->xError, chosenVertex ()->yError)); |
1867 |
|
dzError = hypot (object->tkDZerr, chosenVertex ()->zError); |
1868 |
|
value = fabs (object->correctedD0Vertex) > 0.2 || fabs (object->correctedDZ) > 0.5 |
1869 |
< |
|| fabs (object->correctedD0Vertex / d0Error) > 99.0 |
1870 |
< |
|| fabs (object->correctedDZ / dzError) > 99.0; |
1869 |
> |
|| fabs (object->correctedD0Vertex / d0Error) > 99.0 |
1870 |
> |
|| fabs (object->correctedDZ / dzError) > 99.0; |
1871 |
|
value = (object->isStandAloneMuon && !object->isTrackerMuon && !object->isGlobalMuon) || !value; |
1872 |
|
} |
1873 |
|
|
2143 |
|
} |
2144 |
|
} |
2145 |
|
|
2146 |
+ |
else if(variable == "looseID"){ |
2147 |
+ |
value = object->pt > 10 |
2148 |
+ |
&& object->mvaNonTrigV0 > 0; |
2149 |
+ |
} |
2150 |
|
else if(variable == "correctedD0VertexInEBPositiveCharge"){ |
2151 |
|
if(fabs(object->eta) < 0.8 && object->charge > 0) value = object->correctedD0Vertex; |
2152 |
|
else value = -999; |
2270 |
|
d0Error = hypot (object->tkD0err, hypot (chosenVertex ()->xError, chosenVertex ()->yError)); |
2271 |
|
dzError = hypot (object->tkDZerr, chosenVertex ()->zError); |
2272 |
|
value = fabs (object->correctedD0Vertex) > 0.2 || fabs (object->correctedDZ) > 0.5 |
2273 |
< |
|| fabs (object->correctedD0Vertex / d0Error) > 99.0 |
2274 |
< |
|| fabs (object->correctedDZ / dzError) > 99.0; |
2273 |
> |
|| fabs (object->correctedD0Vertex / d0Error) > 99.0 |
2274 |
> |
|| fabs (object->correctedDZ / dzError) > 99.0; |
2275 |
|
value = !value; |
2276 |
|
} |
2277 |
|
|
2363 |
|
else if(variable == "muonScaleFactor") value = muonScaleFactor_; |
2364 |
|
else if(variable == "electronScaleFactor") value = electronScaleFactor_; |
2365 |
|
else if(variable == "stopCTauScaleFactor") value = stopCTauScaleFactor_; |
2366 |
< |
|
2366 |
> |
else if(variable == "bTagScaleFactor") value = bTagScaleFactor_; |
2367 |
|
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2368 |
|
|
2369 |
|
value = applyFunction(function, value); |
2417 |
|
else if(variable == "HPSdecayModeFinding") value = object->HPSdecayModeFinding; |
2418 |
|
else if(variable == "leadingTrackValid") value = object->leadingTrackValid; |
2419 |
|
|
2420 |
< |
|
2420 |
> |
else if (variable == "looseHadronicID") { |
2421 |
> |
value = object->pt > 10 |
2422 |
> |
&& object->eta < 2.3 |
2423 |
> |
&& object->HPSbyLooseCombinedIsolationDeltaBetaCorr > 0 |
2424 |
> |
&& object->HPSdecayModeFinding > 0 |
2425 |
> |
&& object->HPSagainstElectronLoose > 0 |
2426 |
> |
&& object->HPSagainstMuonTight > 0; |
2427 |
> |
} |
2428 |
|
|
2429 |
|
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
2430 |
|
|
2622 |
|
pt = object->pt; |
2623 |
|
value = vz - (vx * px + vy * py)/pt * (pz/pt); |
2624 |
|
} |
2625 |
+ |
|
2626 |
+ |
|
2627 |
|
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
2628 |
|
|
2629 |
|
else if(variable == "genMatchedPdgId"){ |
3148 |
|
return value; |
3149 |
|
} |
3150 |
|
|
3151 |
+ |
//!muon-photon pair valueLookup |
3152 |
+ |
double |
3153 |
+ |
OSUAnalysis::valueLookup (const BNmuon* object1, const BNphoton* object2, string variable, string function, string &stringValue){ |
3154 |
+ |
|
3155 |
+ |
double value = 0.0; |
3156 |
+ |
|
3157 |
+ |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
3158 |
+ |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
3159 |
+ |
else if(variable == "photonEta") value = object2->eta; |
3160 |
+ |
else if(variable == "muonEta") value = object1->eta; |
3161 |
+ |
else if(variable == "photonPhi") value = object2->phi; |
3162 |
+ |
else if(variable == "muonPhi") value = object1->phi; |
3163 |
+ |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3164 |
+ |
else if(variable == "photonGenMotherId") value = object2->genMotherId; |
3165 |
+ |
else if(variable == "muonRelPFdBetaIso") value = (object1->pfIsoR04SumChargedHadronPt + max(0.0, object1->pfIsoR04SumNeutralHadronEt + object1->pfIsoR04SumPhotonEt - 0.5*object1->pfIsoR04SumPUPt)) / object1->pt; |
3166 |
+ |
else if(variable == "invMass"){ |
3167 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
3168 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
3169 |
+ |
value = (fourVector1 + fourVector2).M(); |
3170 |
+ |
} |
3171 |
+ |
else if(variable == "pt"){ |
3172 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
3173 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
3174 |
+ |
value = (fourVector1 + fourVector2).Pt(); |
3175 |
+ |
} |
3176 |
+ |
else if(variable == "threeDAngle") |
3177 |
+ |
{ |
3178 |
+ |
TVector3 threeVector1(object1->px, object1->py, object1->pz); |
3179 |
+ |
TVector3 threeVector2(object2->px, object2->py, object2->pz); |
3180 |
+ |
value = (threeVector1.Angle(threeVector2)); |
3181 |
+ |
} |
3182 |
+ |
else if(variable == "alpha") |
3183 |
+ |
{ |
3184 |
+ |
static const double pi = 3.1415926535897932384626433832795028841971693993751058; |
3185 |
+ |
TVector3 threeVector1(object1->px, object1->py, object1->pz); |
3186 |
+ |
TVector3 threeVector2(object2->px, object2->py, object2->pz); |
3187 |
+ |
value = (pi-threeVector1.Angle(threeVector2)); |
3188 |
+ |
} |
3189 |
+ |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3190 |
+ |
|
3191 |
+ |
value = applyFunction(function, value); |
3192 |
+ |
|
3193 |
+ |
return value; |
3194 |
+ |
} |
3195 |
+ |
|
3196 |
+ |
//!electron-photon pair valueLookup |
3197 |
+ |
double |
3198 |
+ |
OSUAnalysis::valueLookup (const BNelectron* object1, const BNphoton* object2, string variable, string function, string &stringValue){ |
3199 |
+ |
|
3200 |
+ |
double value = 0.0; |
3201 |
+ |
|
3202 |
+ |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
3203 |
+ |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
3204 |
+ |
else if(variable == "photonEta") value = object2->eta; |
3205 |
+ |
else if(variable == "electronEta") value = object1->eta; |
3206 |
+ |
else if(variable == "photonPhi") value = object2->phi; |
3207 |
+ |
else if(variable == "electronPhi") value = object1->phi; |
3208 |
+ |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3209 |
+ |
else if(variable == "photonGenMotherId") value = object2->genMotherId; |
3210 |
+ |
else if(variable == "electronRelPFrhoIso") value = ( object1->chargedHadronIsoDR03 + max(0.0, object1->neutralHadronIsoDR03 + object1->photonIsoDR03 - object1->AEffDr03*object1->rhoPrime) ) / object1->pt; |
3211 |
+ |
else if(variable == "invMass"){ |
3212 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
3213 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
3214 |
+ |
value = (fourVector1 + fourVector2).M(); |
3215 |
+ |
} |
3216 |
+ |
else if(variable == "pt"){ |
3217 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
3218 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
3219 |
+ |
value = (fourVector1 + fourVector2).Pt(); |
3220 |
+ |
} |
3221 |
+ |
else if(variable == "threeDAngle") |
3222 |
+ |
{ |
3223 |
+ |
TVector3 threeVector1(object1->px, object1->py, object1->pz); |
3224 |
+ |
TVector3 threeVector2(object2->px, object2->py, object2->pz); |
3225 |
+ |
value = (threeVector1.Angle(threeVector2)); |
3226 |
+ |
} |
3227 |
+ |
else if(variable == "alpha") |
3228 |
+ |
{ |
3229 |
+ |
static const double pi = 3.1415926535897932384626433832795028841971693993751058; |
3230 |
+ |
TVector3 threeVector1(object1->px, object1->py, object1->pz); |
3231 |
+ |
TVector3 threeVector2(object2->px, object2->py, object2->pz); |
3232 |
+ |
value = (pi-threeVector1.Angle(threeVector2)); |
3233 |
+ |
} |
3234 |
+ |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3235 |
+ |
|
3236 |
+ |
value = applyFunction(function, value); |
3237 |
+ |
|
3238 |
+ |
return value; |
3239 |
+ |
} |
3240 |
+ |
|
3241 |
|
//!electron-electron pair valueLookup |
3242 |
|
double |
3243 |
|
OSUAnalysis::valueLookup (const BNelectron* object1, const BNelectron* object2, string variable, string function, string &stringValue){ |
3367 |
|
|
3368 |
|
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
3369 |
|
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
3370 |
+ |
else if(variable == "jetEta") value = object2->eta; |
3371 |
+ |
else if(variable == "jetPhi") value = object2->phi; |
3372 |
+ |
else if(variable == "electronEta") value = object1->eta; |
3373 |
+ |
else if(variable == "electronPhi") value = object1->phi; |
3374 |
|
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3375 |
|
else if(variable == "invMass"){ |
3376 |
|
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
3398 |
|
return value; |
3399 |
|
} |
3400 |
|
|
3401 |
+ |
//!photon-jet pair valueLookup |
3402 |
+ |
double |
3403 |
+ |
OSUAnalysis::valueLookup (const BNphoton* object1, const BNjet* object2, string variable, string function, string &stringValue){ |
3404 |
+ |
|
3405 |
+ |
double value = 0.0; |
3406 |
+ |
|
3407 |
+ |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
3408 |
+ |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
3409 |
+ |
else if(variable == "jetEta") value = object2->eta; |
3410 |
+ |
else if(variable == "jetPhi") value = object2->phi; |
3411 |
+ |
else if(variable == "photonEta") value = object1->eta; |
3412 |
+ |
else if(variable == "photonPhi") value = object1->phi; |
3413 |
+ |
else if(variable == "photonGenMotherId") value = object1->genMotherId; |
3414 |
+ |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3415 |
+ |
else if(variable == "invMass"){ |
3416 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
3417 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
3418 |
+ |
value = (fourVector1 + fourVector2).M(); |
3419 |
+ |
} |
3420 |
+ |
else if(variable == "pt"){ |
3421 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
3422 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
3423 |
+ |
value = (fourVector1 + fourVector2).Pt(); |
3424 |
+ |
} |
3425 |
+ |
else if(variable == "threeDAngle") |
3426 |
+ |
{ |
3427 |
+ |
TVector3 threeVector1(object1->px, object1->py, object1->pz); |
3428 |
+ |
TVector3 threeVector2(object2->px, object2->py, object2->pz); |
3429 |
+ |
value = (threeVector1.Angle(threeVector2)); |
3430 |
+ |
} |
3431 |
+ |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3432 |
+ |
value = applyFunction(function, value); |
3433 |
+ |
|
3434 |
+ |
return value; |
3435 |
+ |
} |
3436 |
+ |
|
3437 |
|
//!muon-jet pair valueLookup |
3438 |
|
double |
3439 |
|
OSUAnalysis::valueLookup (const BNmuon* object1, const BNjet* object2, string variable, string function, string &stringValue){ |
3441 |
|
double value = 0.0; |
3442 |
|
|
3443 |
|
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
3444 |
+ |
else if(variable == "jetEta") value = object2->eta; |
3445 |
+ |
else if(variable == "jetPhi") value = object2->phi; |
3446 |
+ |
else if(variable == "muonEta") value = object1->eta; |
3447 |
+ |
else if(variable == "muonPhi") value = object1->phi; |
3448 |
|
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
3449 |
|
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3450 |
|
else if(variable == "invMass"){ |
3472 |
|
|
3473 |
|
return value; |
3474 |
|
} |
3086 |
– |
|
3475 |
|
//!jet-jet pair valueLookup |
3476 |
|
double |
3477 |
|
OSUAnalysis::valueLookup (const BNjet* object1, const BNjet* object2, string variable, string function, string &stringValue){ |
3774 |
|
for(BNprimaryvertexCollection::const_iterator vertex = primaryvertexs->begin (); vertex != primaryvertexs->end (); vertex++){ |
3775 |
|
vertex_rank++; |
3776 |
|
int dist = sqrt((object->vx-vertex->x)*(object->vx-vertex->x) + \ |
3777 |
< |
(object->vy-vertex->y)*(object->vy-vertex->y) + \ |
3778 |
< |
(object->vz-vertex->z)*(object->vz-vertex->z)); |
3777 |
> |
(object->vy-vertex->y)*(object->vy-vertex->y) + \ |
3778 |
> |
(object->vz-vertex->z)*(object->vz-vertex->z)); |
3779 |
|
|
3780 |
|
if(abs(dist) < abs(minDistToVertex)){ |
3781 |
|
value = vertex_rank; |
3939 |
|
string obj1, obj2; |
3940 |
|
getTwoObjs(currentCut.inputCollection, obj1, obj2); |
3941 |
|
if (inputType==obj1 || |
3942 |
< |
inputType==obj2) { |
3942 |
> |
inputType==obj2) { |
3943 |
|
// Do not add a cut to individualFlags or cumulativeFlags, if the cut is on a paired collection, |
3944 |
|
// and the inputType is a member of the pair. |
3945 |
|
// The cut will instead be applied when the setObjectFlags() is called for the paired collection. |
3951 |
|
|
3952 |
|
for (uint object = 0; object != inputCollection->size(); object++){ |
3953 |
|
|
3954 |
< |
bool decision = true;//object passes if this cut doesn't cut on that type of object |
3954 |
> |
bool cutDecision = true;//object passes if this cut doesn't cut on that type of object |
3955 |
> |
bool plotDecision = true; |
3956 |
|
|
3957 |
|
if(currentCut.inputCollection == inputType){ |
3958 |
|
|
3964 |
|
else subcutDecisions.push_back(evaluateComparison(stringValue,currentCut.comparativeOperators.at(subcutIndex),currentCut.cutStringValues.at(subcutIndex))); |
3965 |
|
|
3966 |
|
} |
3967 |
< |
if(currentCut.numSubcuts == 1) decision = subcutDecisions.at(0); |
3967 |
> |
if(currentCut.numSubcuts == 1) cutDecision = subcutDecisions.at(0); |
3968 |
|
else{ |
3969 |
|
bool tempDecision = true; |
3970 |
|
for( int subcutIndex = 0;subcutIndex != currentCut.numSubcuts-1; subcutIndex++){ |
3973 |
|
else if(currentCut.logicalOperators.at(subcutIndex) == "|"|| currentCut.logicalOperators.at(subcutIndex) == "||") |
3974 |
|
tempDecision = subcutDecisions.at(subcutIndex) || subcutDecisions.at(subcutIndex+1); |
3975 |
|
} |
3976 |
< |
decision = tempDecision; |
3976 |
> |
cutDecision = tempDecision; |
3977 |
|
} |
3978 |
+ |
//invert the cut for plotting if this cut is a veto |
3979 |
+ |
if(currentCut.isVeto) plotDecision = !cutDecision; |
3980 |
+ |
else plotDecision = cutDecision; |
3981 |
|
} |
3982 |
|
|
3983 |
< |
individualFlags.at(inputType).at(currentCutIndex).push_back(decision); |
3983 |
> |
//if(cutDecision != plotDecision && currentCut.variables.at(0) == "pt") cout << "---------------\n" << cutDecision << " " << plotDecision << endl; |
3984 |
> |
individualFlags.at(inputType).at(currentCutIndex).push_back(make_pair(cutDecision,plotDecision)); |
3985 |
|
|
3986 |
< |
//set flags for objects that pass each cut AND all the previous cuts |
3987 |
< |
bool previousCumulativeFlag = true; |
3986 |
> |
//set flags for objects that pass this cut AND all the previous cuts |
3987 |
> |
bool previousCumulativeCutFlag = true; |
3988 |
|
for(uint previousCutIndex = 0; previousCutIndex != currentCutIndex; previousCutIndex++){ |
3989 |
< |
if(previousCumulativeFlag && individualFlags.at(inputType).at(previousCutIndex).at(object)) previousCumulativeFlag = true; |
3990 |
< |
else{ previousCumulativeFlag = false; break;} |
3989 |
> |
if(previousCumulativeCutFlag && individualFlags.at(inputType).at(previousCutIndex).at(object).first) previousCumulativeCutFlag = true; |
3990 |
> |
else{ previousCumulativeCutFlag = false; break;} |
3991 |
|
} |
3992 |
< |
cumulativeFlags.at(inputType).at(currentCutIndex).push_back(previousCumulativeFlag && decision); |
3992 |
> |
previousCumulativeCutFlag = previousCumulativeCutFlag && cutDecision; |
3993 |
> |
bool previousCumulativePlotFlag = true; |
3994 |
> |
for(uint previousCutIndex = 0; previousCutIndex != currentCutIndex; previousCutIndex++){ |
3995 |
> |
if(previousCumulativePlotFlag && individualFlags.at(inputType).at(previousCutIndex).at(object).second) previousCumulativePlotFlag = true; |
3996 |
> |
else{ previousCumulativePlotFlag = false; break;} |
3997 |
> |
} |
3998 |
> |
previousCumulativePlotFlag = previousCumulativePlotFlag && plotDecision; |
3999 |
> |
|
4000 |
> |
//if(inputType == "muons") cout << previousCumulativeCutFlag << " " << previousCumulativePlotFlag << " " << currentCut.variables.at(0) << "\n---------------\n\n"; |
4001 |
> |
cumulativeFlags.at(inputType).at(currentCutIndex).push_back(make_pair(previousCumulativeCutFlag,previousCumulativePlotFlag)); |
4002 |
|
|
4003 |
|
} |
4004 |
|
|
4007 |
|
|
4008 |
|
template <class InputCollection1, class InputCollection2> |
4009 |
|
void OSUAnalysis::setObjectFlags(cut ¤tCut, uint currentCutIndex, flagMap &individualFlags, flagMap &cumulativeFlags, \ |
4010 |
< |
InputCollection1 inputCollection1, InputCollection2 inputCollection2, vector<bool> flags1, vector<bool> flags2, string inputType){ |
4010 |
> |
InputCollection1 inputCollection1, InputCollection2 inputCollection2, flagPair flags1, flagPair flags2, string inputType){ |
4011 |
|
|
4012 |
|
|
4013 |
|
bool sameObjects = false; |
4023 |
|
// Set them to true later, if any paired object passes (in which case both of its constituents should pass). |
4024 |
|
if (currentCut.inputCollection == inputType) { |
4025 |
|
for (uint object1 = 0; object1 != inputCollection1->size(); object1++) { |
4026 |
< |
individualFlags.at(obj1Type).at(currentCutIndex).push_back(false); |
4027 |
< |
cumulativeFlags.at(obj1Type).at(currentCutIndex).push_back(false); |
4026 |
> |
individualFlags.at(obj1Type).at(currentCutIndex).push_back(make_pair(false,false)); |
4027 |
> |
cumulativeFlags.at(obj1Type).at(currentCutIndex).push_back(make_pair(false,false)); |
4028 |
|
} |
4029 |
|
if (isTwoTypesOfObject) { // Only initialize the second object if it is different from the first. |
4030 |
|
for (uint object2 = 0; object2 != inputCollection2->size(); object2++) { |
4031 |
< |
individualFlags.at(obj2Type).at(currentCutIndex).push_back(false); |
4032 |
< |
cumulativeFlags.at(obj2Type).at(currentCutIndex).push_back(false); |
4031 |
> |
individualFlags.at(obj2Type).at(currentCutIndex).push_back(make_pair(false,false)); |
4032 |
> |
cumulativeFlags.at(obj2Type).at(currentCutIndex).push_back(make_pair(false,false)); |
4033 |
|
} |
4034 |
|
} |
4035 |
|
} |
4042 |
|
if(sameObjects && object1 >= object2) continue;//account for duplicate pairs if both collections are the same |
4043 |
|
|
4044 |
|
|
4045 |
< |
bool decision = true;//object passes if this cut doesn't cut on that type of object |
4045 |
> |
bool cutDecision = true;//object passes if this cut doesn't cut on that type of object |
4046 |
> |
bool plotDecision = true; |
4047 |
|
|
4048 |
|
if(currentCut.inputCollection == inputType){ |
4049 |
|
|
4055 |
|
else subcutDecisions.push_back(evaluateComparison(stringValue,currentCut.comparativeOperators.at(subcutIndex),currentCut.cutStringValues.at(subcutIndex))); |
4056 |
|
} |
4057 |
|
|
4058 |
< |
if(currentCut.numSubcuts == 1) decision = subcutDecisions.at(0); |
4058 |
> |
if(currentCut.numSubcuts == 1) cutDecision = subcutDecisions.at(0); |
4059 |
|
else{ |
4060 |
|
bool tempDecision = subcutDecisions.at(0); |
4061 |
|
for( int subcutIndex = 1; subcutIndex < currentCut.numSubcuts; subcutIndex++){ |
4064 |
|
else if(currentCut.logicalOperators.at(subcutIndex-1) == "|"|| currentCut.logicalOperators.at(subcutIndex-1) == "||") |
4065 |
|
tempDecision = tempDecision || subcutDecisions.at(subcutIndex); |
4066 |
|
} |
4067 |
< |
decision = tempDecision; |
4067 |
> |
cutDecision = tempDecision; |
4068 |
|
} |
4069 |
+ |
//invert the cut for plotting if this cut is a veto |
4070 |
+ |
if(currentCut.isVeto) plotDecision = !cutDecision; |
4071 |
+ |
else plotDecision = cutDecision; |
4072 |
+ |
} |
4073 |
+ |
individualFlags.at(inputType).at(currentCutIndex).push_back(make_pair(cutDecision,plotDecision)); |
4074 |
+ |
if (cutDecision && currentCut.inputCollection == inputType) { // only set the flags for the individual objects if the pair object is being cut on |
4075 |
+ |
individualFlags.at(obj1Type).at(currentCutIndex).at(object1).first = true; |
4076 |
+ |
individualFlags.at(obj2Type).at(currentCutIndex).at(object2).first = true; |
4077 |
+ |
} |
4078 |
+ |
if (plotDecision && currentCut.inputCollection == inputType) { // only set the flags for the individual objects if the pair object is being cut on |
4079 |
+ |
individualFlags.at(obj1Type).at(currentCutIndex).at(object1).second = true; |
4080 |
+ |
individualFlags.at(obj2Type).at(currentCutIndex).at(object2).second = true; |
4081 |
|
} |
4082 |
< |
// if (decision) isPassObj1.at(object1) = true; |
4083 |
< |
// if (decision) isPassObj2.at(object2) = true; |
4084 |
< |
individualFlags.at(inputType).at(currentCutIndex).push_back(decision); |
4085 |
< |
if (decision && currentCut.inputCollection == inputType) { // only set the flags for the individual objects if the pair object is being cut on |
4086 |
< |
individualFlags.at(obj1Type).at(currentCutIndex).at(object1) = true; |
4087 |
< |
individualFlags.at(obj2Type).at(currentCutIndex).at(object2) = true; |
4082 |
> |
|
4083 |
> |
//set flags for objects that pass this cut AND all the previous cuts |
4084 |
> |
bool previousCumulativeCutFlag = true; |
4085 |
> |
for(uint previousCutIndex = 0; previousCutIndex != currentCutIndex; previousCutIndex++){ |
4086 |
> |
if(previousCumulativeCutFlag && individualFlags.at(inputType).at(previousCutIndex).at(counter).first) previousCumulativeCutFlag = true; |
4087 |
> |
else{ previousCumulativeCutFlag = false; break;} |
4088 |
|
} |
4089 |
+ |
previousCumulativeCutFlag = previousCumulativeCutFlag && cutDecision; |
4090 |
|
|
4091 |
< |
//set flags for objects that pass each cut AND all the previous cuts |
3676 |
< |
bool previousCumulativeFlag = true; |
4091 |
> |
bool previousCumulativePlotFlag = true; |
4092 |
|
for(uint previousCutIndex = 0; previousCutIndex != currentCutIndex; previousCutIndex++){ |
4093 |
< |
if(previousCumulativeFlag && individualFlags.at(inputType).at(previousCutIndex).at(counter)) previousCumulativeFlag = true; |
4094 |
< |
else{ previousCumulativeFlag = false; break;} |
4093 |
> |
if(previousCumulativePlotFlag && individualFlags.at(inputType).at(previousCutIndex).at(counter).second) previousCumulativePlotFlag = true; |
4094 |
> |
else{ previousCumulativePlotFlag = false; break;} |
4095 |
|
} |
4096 |
+ |
previousCumulativePlotFlag = previousCumulativePlotFlag && plotDecision; |
4097 |
+ |
|
4098 |
|
//apply flags for the components of the composite object as well |
4099 |
< |
bool currentCumulativeFlag = true; |
4100 |
< |
if(flags1.size() == 0 && flags2.size() == 0) currentCumulativeFlag = previousCumulativeFlag && decision; |
4101 |
< |
else if(flags1.size() == 0) currentCumulativeFlag = previousCumulativeFlag && decision && flags2.at(object2); |
4102 |
< |
else if(flags2.size() == 0) currentCumulativeFlag = previousCumulativeFlag && decision && flags1.at(object1); |
4103 |
< |
else currentCumulativeFlag = previousCumulativeFlag && decision && flags1.at(object1) && flags2.at(object2); |
4104 |
< |
cumulativeFlags.at(inputType).at(currentCutIndex).push_back(currentCumulativeFlag); |
4105 |
< |
if (currentCumulativeFlag && currentCut.inputCollection == inputType) { // only set the flags for the individual objects if the pair object is being cut on |
4106 |
< |
cumulativeFlags.at(obj1Type).at(currentCutIndex).at(object1) = true && getPreviousCumulativeFlags(currentCutIndex, individualFlags, obj1Type, object1); |
4107 |
< |
cumulativeFlags.at(obj2Type).at(currentCutIndex).at(object2) = true && getPreviousCumulativeFlags(currentCutIndex, individualFlags, obj2Type, object2); |
4099 |
> |
bool currentCumulativeCutFlag = true; |
4100 |
> |
bool currentCumulativePlotFlag = true; |
4101 |
> |
|
4102 |
> |
if(flags1.size() == 0 && flags2.size() == 0) currentCumulativeCutFlag = previousCumulativeCutFlag; |
4103 |
> |
else if(flags1.size() == 0) currentCumulativeCutFlag = previousCumulativeCutFlag && flags2.at(object2).first; |
4104 |
> |
else if(flags2.size() == 0) currentCumulativeCutFlag = previousCumulativeCutFlag && flags1.at(object1).first; |
4105 |
> |
else currentCumulativeCutFlag = previousCumulativeCutFlag && flags1.at(object1).first && flags2.at(object2).first; |
4106 |
> |
|
4107 |
> |
if(flags1.size() == 0 && flags2.size() == 0) currentCumulativePlotFlag = previousCumulativePlotFlag; |
4108 |
> |
else if(flags1.size() == 0) currentCumulativePlotFlag = previousCumulativePlotFlag && flags2.at(object2).second; |
4109 |
> |
else if(flags2.size() == 0) currentCumulativePlotFlag = previousCumulativePlotFlag && flags1.at(object1).second; |
4110 |
> |
else currentCumulativePlotFlag = previousCumulativePlotFlag && flags1.at(object1).first && flags2.at(object2).second; |
4111 |
> |
|
4112 |
> |
cumulativeFlags.at(inputType).at(currentCutIndex).push_back(make_pair(currentCumulativeCutFlag,currentCumulativePlotFlag)); |
4113 |
> |
|
4114 |
> |
if (currentCumulativeCutFlag && currentCut.inputCollection == inputType) { // only set the flags for the individual objects if the pair object is being cut on |
4115 |
> |
cumulativeFlags.at(obj1Type).at(currentCutIndex).at(object1).first = true && getPreviousCumulativeFlags(currentCutIndex, individualFlags, obj1Type, object1, "cut"); |
4116 |
> |
cumulativeFlags.at(obj2Type).at(currentCutIndex).at(object2).first = true && getPreviousCumulativeFlags(currentCutIndex, individualFlags, obj2Type, object2, "cut"); |
4117 |
> |
} |
4118 |
> |
|
4119 |
> |
if (currentCumulativePlotFlag && currentCut.inputCollection == inputType) { // only set the flags for the individual objects if the pair object is being cut on |
4120 |
> |
cumulativeFlags.at(obj1Type).at(currentCutIndex).at(object1).second = true && getPreviousCumulativeFlags(currentCutIndex, individualFlags, obj1Type, object1, "plot"); |
4121 |
> |
cumulativeFlags.at(obj2Type).at(currentCutIndex).at(object2).second = true && getPreviousCumulativeFlags(currentCutIndex, individualFlags, obj2Type, object2, "plot"); |
4122 |
|
} |
4123 |
+ |
|
4124 |
|
counter++; |
4125 |
|
|
4126 |
|
} // end for (uint object2 = 0; object2 != inputCollection2->size(); object2++) |
4129 |
|
} |
4130 |
|
|
4131 |
|
|
4132 |
< |
bool OSUAnalysis::getPreviousCumulativeFlags(uint currentCutIndex, flagMap &individualFlags, string obj1Type, uint object1) { |
4132 |
> |
bool OSUAnalysis::getPreviousCumulativeFlags(uint currentCutIndex, flagMap &individualFlags, string obj1Type, uint object1, string flagType) { |
4133 |
|
// Return true iff for the collection obj1Type, the element with index object1 has individal flags set to true for |
4134 |
|
// all cuts up to currentCutIndex |
4135 |
|
bool previousCumulativeFlag = true; |
4136 |
|
for (uint previousCutIndex = 0; previousCutIndex < currentCutIndex; previousCutIndex++) { |
4137 |
< |
if (previousCumulativeFlag && individualFlags.at(obj1Type).at(previousCutIndex).at(object1)) previousCumulativeFlag = true; |
4137 |
> |
bool tempFlag = false; |
4138 |
> |
if(flagType == "cut") tempFlag = individualFlags.at(obj1Type).at(previousCutIndex).at(object1).first; |
4139 |
> |
else if(flagType == "plot") tempFlag = individualFlags.at(obj1Type).at(previousCutIndex).at(object1).second; |
4140 |
> |
|
4141 |
> |
if (previousCumulativeFlag && tempFlag) previousCumulativeFlag = true; |
4142 |
|
else { |
4143 |
|
previousCumulativeFlag = false; break; |
4144 |
|
} |
4147 |
|
} |
4148 |
|
|
4149 |
|
|
4150 |
+ |
|
4151 |
+ |
|
4152 |
|
template <class InputCollection> |
4153 |
< |
void OSUAnalysis::fill1DHistogram(TH1* histo, histogram parameters, InputCollection inputCollection,vector<bool> flags, double scaleFactor){ |
4153 |
> |
void OSUAnalysis::assignTreeBranch(BranchSpecs parameters, InputCollection inputCollection, flagPair flags){ |
4154 |
> |
// This function is similar to fill1DHistogram(), but instead of filling a histogram it assigns a value to a variable for the BNTree |
4155 |
> |
|
4156 |
> |
if (BNTreeBranchVals_.count(parameters.name)==0) cout << "Error[assignTreeBranch]: trying to assign value to " << parameters.name << " that does not have a branch set up. Will likely seg fault." << endl; |
4157 |
> |
for (uint object = 0; object != inputCollection->size(); object++) { |
4158 |
> |
|
4159 |
> |
if (!plotAllObjectsInPassingEvents_ && !flags.at(object).second) continue; |
4160 |
> |
|
4161 |
> |
string inputVariable = parameters.inputVariable; |
4162 |
> |
string function = ""; |
4163 |
> |
string stringValue = ""; |
4164 |
> |
double value = valueLookup(&inputCollection->at(object), inputVariable, function, stringValue); |
4165 |
> |
BNTreeBranchVals_.at(parameters.name).push_back(value); |
4166 |
> |
|
4167 |
> |
} |
4168 |
> |
} |
4169 |
> |
|
4170 |
> |
|
4171 |
> |
template <class InputCollection> |
4172 |
> |
void OSUAnalysis::fill1DHistogram(TH1* histo, histogram parameters, InputCollection inputCollection, flagPair flags, double scaleFactor){ |
4173 |
> |
|
4174 |
|
|
4175 |
|
for (uint object = 0; object != inputCollection->size(); object++){ |
4176 |
|
|
4177 |
< |
if(!plotAllObjectsInPassingEvents_ && !flags.at(object)) continue; |
4177 |
> |
//cout << "flags.at(object).second: " << flags.at(object).second << endl; |
4178 |
> |
|
4179 |
> |
if(!plotAllObjectsInPassingEvents_ && !flags.at(object).second) continue; |
4180 |
|
|
4181 |
|
string currentString = parameters.inputVariables.at(0); |
4182 |
|
string inputVariable = ""; |
4193 |
|
string stringValue = ""; |
4194 |
|
double value = valueLookup(&inputCollection->at(object), inputVariable, function, stringValue); |
4195 |
|
histo->Fill(value,scaleFactor); |
4196 |
+ |
|
4197 |
|
if (printEventInfo_) { |
4198 |
|
// Write information about event to screen, for testing purposes. |
4199 |
|
cout << " Info for event: value for histogram " << histo->GetName() << ": " << value << endl; |
4203 |
|
} |
4204 |
|
|
4205 |
|
template <class InputCollection1, class InputCollection2> |
4206 |
< |
void OSUAnalysis::fill1DHistogram(TH1* histo, histogram parameters, InputCollection1 inputCollection1, InputCollection2 inputCollection2, vector<bool> flags1, vector<bool> flags2, vector<bool> pairFlags, double scaleFactor){ |
4206 |
> |
void OSUAnalysis::fill1DHistogram(TH1* histo, histogram parameters, InputCollection1 inputCollection1, InputCollection2 inputCollection2, flagPair flags1, flagPair flags2, flagPair pairFlags, double scaleFactor){ |
4207 |
|
|
4208 |
|
bool sameObjects = false; |
4209 |
|
if(typeid(InputCollection1).name() == typeid(InputCollection2).name()) sameObjects = true; |
4216 |
|
|
4217 |
|
pairCounter++; |
4218 |
|
//only take objects which have passed all cuts and pairs which have passed all cuts |
4219 |
< |
if(!plotAllObjectsInPassingEvents_ && !flags1.at(object1)) continue; |
4220 |
< |
if(!plotAllObjectsInPassingEvents_ && !flags2.at(object2)) continue; |
4221 |
< |
if(!plotAllObjectsInPassingEvents_ && !pairFlags.at(pairCounter)) continue; |
4219 |
> |
if(!plotAllObjectsInPassingEvents_ && !flags1.at(object1).second) continue; |
4220 |
> |
if(!plotAllObjectsInPassingEvents_ && !flags2.at(object2).second) continue; |
4221 |
> |
if(!plotAllObjectsInPassingEvents_ && !pairFlags.at(pairCounter).second) continue; |
4222 |
|
|
4223 |
|
string currentString = parameters.inputVariables.at(0); |
4224 |
|
string inputVariable = ""; |
4243 |
|
|
4244 |
|
|
4245 |
|
template <class InputCollection> |
4246 |
< |
void OSUAnalysis::fill2DHistogram(TH2* histo, histogram parameters, InputCollection inputCollection,vector<bool> flags, double scaleFactor){ |
4246 |
> |
void OSUAnalysis::fill2DHistogram(TH2* histo, histogram parameters, InputCollection inputCollection, flagPair flags, double scaleFactor){ |
4247 |
|
|
4248 |
|
for (uint object = 0; object != inputCollection->size(); object++){ |
4249 |
|
|
4250 |
< |
if(!plotAllObjectsInPassingEvents_ && !flags.at(object)) continue; |
4250 |
> |
if(!plotAllObjectsInPassingEvents_ && !flags.at(object).second) continue; |
4251 |
|
|
4252 |
|
string stringValue = ""; |
4253 |
|
string currentString = parameters.inputVariables.at(0); |
4284 |
|
} |
4285 |
|
|
4286 |
|
template <class InputCollection1, class InputCollection2> |
4287 |
< |
void OSUAnalysis::fill2DHistogram(TH2* histo, histogram parameters, InputCollection1 inputCollection1, InputCollection2 inputCollection2, vector<bool> flags1, vector<bool> flags2, vector<bool> pairFlags, double scaleFactor){ |
4287 |
> |
void OSUAnalysis::fill2DHistogram(TH2* histo, histogram parameters, InputCollection1 inputCollection1, InputCollection2 inputCollection2, flagPair flags1, flagPair flags2, flagPair pairFlags, double scaleFactor){ |
4288 |
|
|
4289 |
|
bool sameObjects = false; |
4290 |
|
if(typeid(InputCollection1).name() == typeid(InputCollection2).name()) sameObjects = true; |
4298 |
|
pairCounter++; |
4299 |
|
|
4300 |
|
//only take objects which have passed all cuts and pairs which have passed all cuts |
4301 |
< |
if(!plotAllObjectsInPassingEvents_ && !flags1.at(object1)) continue; |
4302 |
< |
if(!plotAllObjectsInPassingEvents_ && !flags2.at(object2)) continue; |
4303 |
< |
if(!plotAllObjectsInPassingEvents_ && !pairFlags.at(pairCounter)) continue; |
4301 |
> |
if(!plotAllObjectsInPassingEvents_ && !flags1.at(object1).second) continue; |
4302 |
> |
if(!plotAllObjectsInPassingEvents_ && !flags2.at(object2).second) continue; |
4303 |
> |
if(!plotAllObjectsInPassingEvents_ && !pairFlags.at(pairCounter).second) continue; |
4304 |
|
|
4305 |
|
string stringValue = ""; |
4306 |
|
string currentString = parameters.inputVariables.at(0); |
4460 |
|
{ |
4461 |
|
const BNprimaryvertex *chosenVertex = 0; |
4462 |
|
if(cumulativeFlags.find ("primaryvertexs") != cumulativeFlags.end ()){ |
4463 |
< |
vector<bool> vertexFlags; |
4463 |
> |
flagPair vertexFlags; |
4464 |
|
for (int i = cumulativeFlags.at("primaryvertexs").size() - 1; i >= 0; i--){ |
4465 |
|
if (cumulativeFlags.at("primaryvertexs").at(i).size()){ |
4466 |
|
vertexFlags = cumulativeFlags.at("primaryvertexs").at(i); |
4468 |
|
} |
4469 |
|
} |
4470 |
|
for (uint vertexIndex = 0; vertexIndex != vertexFlags.size(); vertexIndex++){ |
4471 |
< |
if(!vertexFlags.at(vertexIndex)) continue; |
4471 |
> |
if(!vertexFlags.at(vertexIndex).first) continue; |
4472 |
|
chosenVertex = & primaryvertexs->at(vertexIndex); |
4473 |
|
break; |
4474 |
|
} |
4484 |
|
{ |
4485 |
|
const BNmet *chosenMET = 0; |
4486 |
|
if(cumulativeFlags.find ("mets") != cumulativeFlags.end ()){ |
4487 |
< |
vector<bool> metFlags; |
4487 |
> |
flagPair metFlags; |
4488 |
|
for (int i = cumulativeFlags.at("mets").size() - 1; i >= 0; i--){ |
4489 |
|
if (cumulativeFlags.at("mets").at(i).size()){ |
4490 |
|
metFlags = cumulativeFlags.at("mets").at(i); |
4492 |
|
} |
4493 |
|
} |
4494 |
|
for (uint metIndex = 0; metIndex != metFlags.size(); metIndex++){ |
4495 |
< |
if(!metFlags.at(metIndex)) continue; |
4495 |
> |
if(!metFlags.at(metIndex).first) continue; |
4496 |
|
chosenMET = & mets->at(metIndex); |
4497 |
|
break; |
4498 |
|
} |
4508 |
|
{ |
4509 |
|
const BNelectron *chosenElectron = 0; |
4510 |
|
if(cumulativeFlags.find ("electrons") != cumulativeFlags.end ()){ |
4511 |
< |
vector<bool> electronFlags; |
4511 |
> |
flagPair electronFlags; |
4512 |
|
for (int i = cumulativeFlags.at("electrons").size() - 1; i >= 0; i--){ |
4513 |
|
if (cumulativeFlags.at("electrons").at(i).size()){ |
4514 |
|
electronFlags = cumulativeFlags.at("electrons").at(i); |
4516 |
|
} |
4517 |
|
} |
4518 |
|
for (uint electronIndex = 0; electronIndex != electronFlags.size(); electronIndex++){ |
4519 |
< |
if(!electronFlags.at(electronIndex)) continue; |
4519 |
> |
if(!electronFlags.at(electronIndex).first) continue; |
4520 |
|
chosenElectron = & electrons->at(electronIndex); |
4521 |
|
break; |
4522 |
|
} |
4527 |
|
return chosenElectron; |
4528 |
|
} |
4529 |
|
|
4530 |
+ |
|
4531 |
|
const BNmuon * |
4532 |
|
OSUAnalysis::chosenMuon () |
4533 |
|
{ |
4534 |
|
const BNmuon *chosenMuon = 0; |
4535 |
|
if(cumulativeFlags.find ("muons") != cumulativeFlags.end ()){ |
4536 |
< |
vector<bool> muonFlags; |
4536 |
> |
flagPair muonFlags; |
4537 |
|
for (int i = cumulativeFlags.at("muons").size() - 1; i >= 0; i--){ |
4538 |
|
if (cumulativeFlags.at("muons").at(i).size()){ |
4539 |
|
muonFlags = cumulativeFlags.at("muons").at(i); |
4541 |
|
} |
4542 |
|
} |
4543 |
|
for (uint muonIndex = 0; muonIndex != muonFlags.size(); muonIndex++){ |
4544 |
< |
if(!muonFlags.at(muonIndex)) continue; |
4544 |
> |
if(!muonFlags.at(muonIndex).first) continue; |
4545 |
|
chosenMuon = & muons->at(muonIndex); |
4546 |
|
break; |
4547 |
|
} |