16 |
|
photons_ (cfg.getParameter<edm::InputTag> ("photons")), |
17 |
|
superclusters_ (cfg.getParameter<edm::InputTag> ("superclusters")), |
18 |
|
triggers_ (cfg.getParameter<edm::InputTag> ("triggers")), |
19 |
< |
|
20 |
< |
|
19 |
> |
puFile_ (cfg.getParameter<std::string> ("puFile")), |
20 |
> |
dataPU_ (cfg.getParameter<std::string> ("dataPU")), |
21 |
> |
dataset_ (cfg.getParameter<std::string> ("dataset")), |
22 |
> |
datasetType_ (cfg.getParameter<std::string> ("datasetType")), |
23 |
|
channels_ (cfg.getParameter<vector<edm::ParameterSet> >("channels")), |
24 |
< |
|
25 |
< |
histogramSets_ (cfg.getParameter<vector<edm::ParameterSet> >("histogramSets")) |
24 |
> |
histogramSets_ (cfg.getParameter<vector<edm::ParameterSet> >("histogramSets")), |
25 |
> |
plotAllObjectsInPassingEvents_ (cfg.getParameter<bool> ("plotAllObjectsInPassingEvents")) |
26 |
|
|
27 |
|
{ |
28 |
|
|
27 |
– |
|
29 |
|
TH1::SetDefaultSumw2 (); |
30 |
< |
TH2::SetDefaultSumw2 (); |
30 |
> |
|
31 |
> |
//create pile-up reweighting object, if necessary |
32 |
> |
if(datasetType_ != "data") puWeight_ = new PUWeight (puFile_, dataPU_, dataset_); |
33 |
|
|
34 |
|
// Construct Cutflow Objects. These store the results of cut decisions and |
35 |
|
// handle filling cut flow histograms. |
38 |
|
|
39 |
|
//always get vertex collection so we can assign the primary vertex in the event |
40 |
|
allNecessaryObjects.push_back("primaryvertexs"); |
41 |
+ |
//always make the plot of number of primary verticex (to check pile-up reweighting) |
42 |
+ |
objectsToPlot.push_back("primaryvertexs"); |
43 |
|
|
44 |
+ |
//always get the event collection to do pile-up reweighting |
45 |
+ |
allNecessaryObjects.push_back("events"); |
46 |
|
|
47 |
|
//parse the histogram definitions |
48 |
|
for(uint currentHistogramSet = 0; currentHistogramSet != histogramSets_.size(); currentHistogramSet++){ |
69 |
|
|
70 |
|
} |
71 |
|
} |
72 |
+ |
//make unique vector of objects we need to plot (so we can book a histogram with the number of each object |
73 |
+ |
sort( objectsToPlot.begin(), objectsToPlot.end() ); |
74 |
+ |
objectsToPlot.erase( unique( objectsToPlot.begin(), objectsToPlot.end() ), objectsToPlot.end() ); |
75 |
+ |
|
76 |
|
|
77 |
|
|
78 |
|
|
98 |
|
|
99 |
|
|
100 |
|
|
101 |
+ |
|
102 |
|
//create cutFlow for this channel |
103 |
|
cutFlows_.push_back (new CutFlow (fs_, channelName)); |
104 |
|
|
111 |
|
std::map<std::string, TH2D*> twoDhistoMap; |
112 |
|
twoDHists_.push_back(twoDhistoMap); |
113 |
|
|
114 |
+ |
|
115 |
|
//book all histograms included in the configuration |
116 |
|
for(uint currentHistogramIndex = 0; currentHistogramIndex != histograms.size(); currentHistogramIndex++){ |
117 |
|
histogram currentHistogram = histograms.at(currentHistogramIndex); |
118 |
|
int numBinsElements = currentHistogram.bins.size(); |
119 |
|
int numInputVariables = currentHistogram.inputVariables.size(); |
120 |
+ |
|
121 |
+ |
|
122 |
+ |
|
123 |
|
if(numBinsElements != 3 && numBinsElements !=6) { |
124 |
|
std::cout << "Error: Didn't find correct number of bin specifications for histogram named '" << currentHistogram.name << "'\n"; |
125 |
|
exit(0); |
128 |
|
std::cout << "Error: Didn't find correct number of input variables for histogram named '" << currentHistogram.name << "'\n"; |
129 |
|
exit(0); |
130 |
|
} |
131 |
< |
else if(numBinsElements == 3) |
131 |
> |
else if(numBinsElements == 3){ |
132 |
|
oneDHists_.at(currentChannel)[currentHistogram.name] = directories.at(currentChannel).make<TH1D> (TString(currentHistogram.name),channelLabel+" channel: "+currentHistogram.title, currentHistogram.bins.at(0), currentHistogram.bins.at(1), currentHistogram.bins.at(2)); |
133 |
< |
else if(numBinsElements == 6) |
133 |
> |
} |
134 |
> |
else if(numBinsElements == 6){ |
135 |
|
twoDHists_.at(currentChannel)[currentHistogram.name] = directories.at(currentChannel).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)); |
136 |
|
|
137 |
+ |
} |
138 |
+ |
|
139 |
|
|
140 |
|
} |
141 |
|
//book a histogram for the number of each object type to be plotted |
143 |
|
string currentObject = objectsToPlot.at(currentObjectIndex); |
144 |
|
int maxNum = 10; |
145 |
|
if(currentObject == "mcparticles") maxNum = 50; |
146 |
< |
currentObject[0] = toupper(currentObject[0]); |
146 |
> |
else if(currentObject == "primaryvertexs") maxNum = 50; |
147 |
> |
currentObject.at(0) = toupper(currentObject.at(0)); |
148 |
|
string histoName = "num" + currentObject; |
149 |
< |
oneDHists_.at(currentChannel)[histoName] = directories.at(currentChannel).make<TH1D> (TString(histoName),channelLabel+" channel: Number of Selected "+currentObject+"; # "+currentObject, maxNum, 0, maxNum); |
149 |
> |
if(histoName == "numPrimaryvertexs"){ |
150 |
> |
string newHistoName = histoName + "BeforePileupCorrection"; |
151 |
> |
oneDHists_.at(currentChannel)[newHistoName] = directories.at(currentChannel).make<TH1D> (TString(newHistoName),channelLabel+" channel: Number of Selected "+currentObject+" Before Pileup Correction; # "+currentObject, maxNum, 0, maxNum); |
152 |
> |
newHistoName = histoName + "AfterPileupCorrection"; |
153 |
> |
oneDHists_.at(currentChannel)[newHistoName] = directories.at(currentChannel).make<TH1D> (TString(newHistoName),channelLabel+" channel: Number of Selected "+currentObject+ " After Pileup Correction; # "+currentObject, maxNum, 0, maxNum); |
154 |
> |
} |
155 |
> |
else |
156 |
> |
oneDHists_.at(currentChannel)[histoName] = directories.at(currentChannel).make<TH1D> (TString(histoName),channelLabel+" channel: Number of Selected "+currentObject+"; # "+currentObject, maxNum, 0, maxNum); |
157 |
|
} |
158 |
|
|
159 |
|
|
228 |
|
}//end loop over channels |
229 |
|
|
230 |
|
|
204 |
– |
|
205 |
– |
|
231 |
|
//make unique vector of objects we need to cut on (so we make sure to get them from the event) |
232 |
|
sort( allNecessaryObjects.begin(), allNecessaryObjects.end() ); |
233 |
|
allNecessaryObjects.erase( unique( allNecessaryObjects.begin(), allNecessaryObjects.end() ), allNecessaryObjects.end() ); |
307 |
|
event.getByLabel (superclusters_, superclusters); |
308 |
|
|
309 |
|
|
310 |
+ |
//get pile-up event weight |
311 |
+ |
double puScaleFactor = 0; |
312 |
+ |
if(datasetType_ != "data") |
313 |
+ |
puScaleFactor = puWeight_->at (events->at (0).numTruePV); |
314 |
+ |
else |
315 |
+ |
puScaleFactor = 1.00; |
316 |
+ |
|
317 |
+ |
|
318 |
|
//loop over all channels |
319 |
|
|
320 |
|
for(uint currentChannelIndex = 0; currentChannelIndex != channels.size(); currentChannelIndex++){ |
340 |
|
individualFlags[currentObject].push_back (vector<bool> ()); |
341 |
|
cumulativeFlags[currentObject].push_back (vector<bool> ()); |
342 |
|
|
343 |
+ |
|
344 |
|
if(currentObject == "jets") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,jets.product(),"jets"); |
345 |
|
else if(currentObject == "muons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),"muons"); |
346 |
|
else if(currentObject == "electrons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),"electrons"); |
356 |
|
else if(currentObject == "superclusters") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,superclusters.product(),"superclusters"); |
357 |
|
|
358 |
|
|
359 |
+ |
|
360 |
|
} |
361 |
|
|
362 |
|
|
380 |
|
cut currentCut = currentChannel.cuts.at(currentCutIndex); |
381 |
|
int numberPassing = 0; |
382 |
|
|
383 |
< |
for (uint object = 0; object != cumulativeFlags[currentCut.inputCollection].at(currentCutIndex).size() ; object++) |
384 |
< |
if(cumulativeFlags[currentCut.inputCollection].at(currentCutIndex).at(object)) numberPassing++; |
383 |
> |
for (uint object = 0; object != cumulativeFlags.at(currentCut.inputCollection).at(currentCutIndex).size() ; object++) |
384 |
> |
if(cumulativeFlags.at(currentCut.inputCollection).at(currentCutIndex).at(object)) numberPassing++; |
385 |
|
|
386 |
|
|
387 |
|
bool cutDecision = evaluateComparison(numberPassing,currentCut.eventComparativeOperator,currentCut.numberRequired); |
391 |
|
|
392 |
|
} |
393 |
|
|
394 |
< |
cutFlows_.at(currentChannelIndex)->fillCutFlow(); |
394 |
> |
cutFlows_.at(currentChannelIndex)->fillCutFlow(puScaleFactor); |
395 |
|
|
396 |
|
|
397 |
|
if(!eventPassedAllCuts)continue; |
398 |
|
|
399 |
|
|
400 |
+ |
|
401 |
+ |
|
402 |
|
//set position of primary vertex in event, in order to calculate quantities relative to it |
403 |
|
primaryVertex_ = 0; |
404 |
< |
vector<bool> vertexFlags = cumulativeFlags["primaryvertexs"].back(); |
404 |
> |
vector<bool> vertexFlags = cumulativeFlags.at("primaryvertexs").back(); |
405 |
|
for (uint vertexIndex = 0; vertexIndex != vertexFlags.size(); vertexIndex++){ |
406 |
|
if(!vertexFlags.at(vertexIndex)) continue; |
407 |
|
primaryVertex_ = new BNprimaryvertex (primaryvertexs->at (vertexIndex)); |
417 |
|
if(currentHistogram.inputVariables.size() == 1){ |
418 |
|
TH1D* histo; |
419 |
|
histo = oneDHists_.at(currentChannelIndex).at(currentHistogram.name); |
420 |
< |
if(currentHistogram.inputCollection == "jets") fillHistogram(histo,currentHistogram,jets.product()); |
421 |
< |
else if(currentHistogram.inputCollection == "muons") fillHistogram(histo,currentHistogram,muons.product()); |
422 |
< |
else if(currentHistogram.inputCollection == "electrons") fillHistogram(histo,currentHistogram,electrons.product()); |
423 |
< |
else if(currentHistogram.inputCollection == "events") fillHistogram(histo,currentHistogram,events.product()); |
424 |
< |
else if(currentHistogram.inputCollection == "taus") fillHistogram(histo,currentHistogram,taus.product()); |
425 |
< |
else if(currentHistogram.inputCollection == "mets") fillHistogram(histo,currentHistogram,mets.product()); |
426 |
< |
else if(currentHistogram.inputCollection == "tracks") fillHistogram(histo,currentHistogram,tracks.product()); |
427 |
< |
else if(currentHistogram.inputCollection == "genjets") fillHistogram(histo,currentHistogram,genjets.product()); |
428 |
< |
else if(currentHistogram.inputCollection == "mcparticles") fillHistogram(histo,currentHistogram,mcparticles.product()); |
429 |
< |
else if(currentHistogram.inputCollection == "primaryvertexs") fillHistogram(histo,currentHistogram,primaryvertexs.product()); |
430 |
< |
else if(currentHistogram.inputCollection == "bxlumis") fillHistogram(histo,currentHistogram,bxlumis.product()); |
431 |
< |
else if(currentHistogram.inputCollection == "photons") fillHistogram(histo,currentHistogram,photons.product()); |
432 |
< |
else if(currentHistogram.inputCollection == "superclusters") fillHistogram(histo,currentHistogram,superclusters.product()); |
420 |
> |
if(currentHistogram.inputCollection == "jets") fill1DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("jets").back(),puScaleFactor); |
421 |
> |
else if(currentHistogram.inputCollection == "muons") fill1DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("muons").back(),puScaleFactor); |
422 |
> |
else if(currentHistogram.inputCollection == "electrons") fill1DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("electrons").back(),puScaleFactor); |
423 |
> |
else if(currentHistogram.inputCollection == "events") fill1DHistogram(histo,currentHistogram,events.product(),cumulativeFlags.at("events").back(),puScaleFactor); |
424 |
> |
else if(currentHistogram.inputCollection == "taus") fill1DHistogram(histo,currentHistogram,taus.product(),cumulativeFlags.at("taus").back(),puScaleFactor); |
425 |
> |
else if(currentHistogram.inputCollection == "mets") fill1DHistogram(histo,currentHistogram,mets.product(),cumulativeFlags.at("mets").back(),puScaleFactor); |
426 |
> |
else if(currentHistogram.inputCollection == "tracks") fill1DHistogram(histo,currentHistogram,tracks.product(),cumulativeFlags.at("tracks").back(),puScaleFactor); |
427 |
> |
else if(currentHistogram.inputCollection == "genjets") fill1DHistogram(histo,currentHistogram,genjets.product(),cumulativeFlags.at("genjets").back(),puScaleFactor); |
428 |
> |
else if(currentHistogram.inputCollection == "mcparticles") fill1DHistogram(histo,currentHistogram,mcparticles.product(),cumulativeFlags.at("mcparticles").back(),puScaleFactor); |
429 |
> |
else if(currentHistogram.inputCollection == "primaryvertexs") fill1DHistogram(histo,currentHistogram,primaryvertexs.product(),cumulativeFlags.at("primaryvertexs").back(),puScaleFactor); |
430 |
> |
else if(currentHistogram.inputCollection == "bxlumis") fill1DHistogram(histo,currentHistogram,bxlumis.product(),cumulativeFlags.at("bxlumis").back(),puScaleFactor); |
431 |
> |
else if(currentHistogram.inputCollection == "photons") fill1DHistogram(histo,currentHistogram,photons.product(),cumulativeFlags.at("photons").back(),puScaleFactor); |
432 |
> |
else if(currentHistogram.inputCollection == "superclusters") fill1DHistogram(histo,currentHistogram,superclusters.product(),cumulativeFlags.at("superclusters").back(),puScaleFactor); |
433 |
|
} |
434 |
|
else if(currentHistogram.inputVariables.size() == 2){ |
435 |
|
TH2D* histo; |
436 |
|
histo = twoDHists_.at(currentChannelIndex).at(currentHistogram.name); |
437 |
< |
if(currentHistogram.inputCollection == "jets") fillHistogram(histo,currentHistogram,jets.product()); |
438 |
< |
else if(currentHistogram.inputCollection == "muons") fillHistogram(histo,currentHistogram,muons.product()); |
439 |
< |
else if(currentHistogram.inputCollection == "electrons") fillHistogram(histo,currentHistogram,electrons.product()); |
440 |
< |
else if(currentHistogram.inputCollection == "events") fillHistogram(histo,currentHistogram,events.product()); |
441 |
< |
else if(currentHistogram.inputCollection == "taus") fillHistogram(histo,currentHistogram,taus.product()); |
442 |
< |
else if(currentHistogram.inputCollection == "mets") fillHistogram(histo,currentHistogram,mets.product()); |
443 |
< |
else if(currentHistogram.inputCollection == "tracks") fillHistogram(histo,currentHistogram,tracks.product()); |
444 |
< |
else if(currentHistogram.inputCollection == "genjets") fillHistogram(histo,currentHistogram,genjets.product()); |
445 |
< |
else if(currentHistogram.inputCollection == "mcparticles") fillHistogram(histo,currentHistogram,mcparticles.product()); |
446 |
< |
else if(currentHistogram.inputCollection == "primaryvertexs") fillHistogram(histo,currentHistogram,primaryvertexs.product()); |
447 |
< |
else if(currentHistogram.inputCollection == "bxlumis") fillHistogram(histo,currentHistogram,bxlumis.product()); |
448 |
< |
else if(currentHistogram.inputCollection == "photons") fillHistogram(histo,currentHistogram,photons.product()); |
449 |
< |
else if(currentHistogram.inputCollection == "superclusters") fillHistogram(histo,currentHistogram,superclusters.product()); |
437 |
> |
if(currentHistogram.inputCollection == "jets") fill2DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("jets").back(),puScaleFactor); |
438 |
> |
else if(currentHistogram.inputCollection == "muons") fill2DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("muons").back(),puScaleFactor); |
439 |
> |
else if(currentHistogram.inputCollection == "electrons") fill2DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("electrons").back(),puScaleFactor); |
440 |
> |
else if(currentHistogram.inputCollection == "events") fill2DHistogram(histo,currentHistogram,events.product(),cumulativeFlags.at("events").back(),puScaleFactor); |
441 |
> |
else if(currentHistogram.inputCollection == "taus") fill2DHistogram(histo,currentHistogram,taus.product(),cumulativeFlags.at("taus").back(),puScaleFactor); |
442 |
> |
else if(currentHistogram.inputCollection == "mets") fill2DHistogram(histo,currentHistogram,mets.product(),cumulativeFlags.at("mets").back(),puScaleFactor); |
443 |
> |
else if(currentHistogram.inputCollection == "tracks") fill2DHistogram(histo,currentHistogram,tracks.product(),cumulativeFlags.at("tracks").back(),puScaleFactor); |
444 |
> |
else if(currentHistogram.inputCollection == "genjets") fill2DHistogram(histo,currentHistogram,genjets.product(),cumulativeFlags.at("genjets").back(),puScaleFactor); |
445 |
> |
else if(currentHistogram.inputCollection == "mcparticles") fill2DHistogram(histo,currentHistogram,mcparticles.product(),cumulativeFlags.at("mcparticles").back(),puScaleFactor); |
446 |
> |
else if(currentHistogram.inputCollection == "primaryvertexs") fill2DHistogram(histo,currentHistogram,primaryvertexs.product(),cumulativeFlags.at("primaryvertexs").back(),puScaleFactor); |
447 |
> |
else if(currentHistogram.inputCollection == "bxlumis") fill2DHistogram(histo,currentHistogram,bxlumis.product(),cumulativeFlags.at("bxlumis").back(),puScaleFactor); |
448 |
> |
else if(currentHistogram.inputCollection == "photons") fill2DHistogram(histo,currentHistogram,photons.product(),cumulativeFlags.at("photons").back(),puScaleFactor); |
449 |
> |
else if(currentHistogram.inputCollection == "superclusters") fill2DHistogram(histo,currentHistogram,superclusters.product(),cumulativeFlags.at("superclusters").back(),puScaleFactor); |
450 |
|
} |
451 |
|
} |
452 |
|
|
455 |
|
for (uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){ |
456 |
|
string currentObject = objectsToPlot.at(currentObjectIndex); |
457 |
|
string tempCurrentObject = currentObject; |
458 |
< |
tempCurrentObject[0] = toupper(tempCurrentObject[0]); |
458 |
> |
tempCurrentObject.at(0) = toupper(tempCurrentObject.at(0)); |
459 |
|
string histoName = "num" + tempCurrentObject; |
460 |
|
|
461 |
< |
if(currentObject == "jets") oneDHists_.at(currentChannelIndex)[histoName]->Fill(jets->size()); |
462 |
< |
else if(currentObject == "muons") oneDHists_.at(currentChannelIndex)[histoName]->Fill(muons->size()); |
463 |
< |
else if(currentObject == "electrons") oneDHists_.at(currentChannelIndex)[histoName]->Fill(electrons->size()); |
464 |
< |
else if(currentObject == "events") oneDHists_.at(currentChannelIndex)[histoName]->Fill(events->size()); |
465 |
< |
else if(currentObject == "taus") oneDHists_.at(currentChannelIndex)[histoName]->Fill(taus->size()); |
466 |
< |
else if(currentObject == "mets") oneDHists_.at(currentChannelIndex)[histoName]->Fill(mets->size()); |
467 |
< |
else if(currentObject == "tracks") oneDHists_.at(currentChannelIndex)[histoName]->Fill(tracks->size()); |
468 |
< |
else if(currentObject == "genjets") oneDHists_.at(currentChannelIndex)[histoName]->Fill(genjets->size()); |
469 |
< |
else if(currentObject == "mcparticles") oneDHists_.at(currentChannelIndex)[histoName]->Fill(mcparticles->size()); |
470 |
< |
else if(currentObject == "primaryvertexs") oneDHists_.at(currentChannelIndex)[histoName]->Fill(primaryvertexs->size()); |
471 |
< |
else if(currentObject == "bxlumis") oneDHists_.at(currentChannelIndex)[histoName]->Fill(bxlumis->size()); |
472 |
< |
else if(currentObject == "photons") oneDHists_.at(currentChannelIndex)[histoName]->Fill(photons->size()); |
473 |
< |
else if(currentObject == "superclusters") oneDHists_.at(currentChannelIndex)[histoName]->Fill(superclusters->size()); |
461 |
> |
if(currentObject == "jets") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(jets->size(),puScaleFactor); |
462 |
> |
else if(currentObject == "muons") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(muons->size(),puScaleFactor); |
463 |
> |
else if(currentObject == "electrons") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size(),puScaleFactor); |
464 |
> |
else if(currentObject == "events") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(events->size(),puScaleFactor); |
465 |
> |
else if(currentObject == "taus") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(taus->size(),puScaleFactor); |
466 |
> |
else if(currentObject == "mets") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(mets->size(),puScaleFactor); |
467 |
> |
else if(currentObject == "tracks") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(tracks->size(),puScaleFactor); |
468 |
> |
else if(currentObject == "genjets") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(genjets->size(),puScaleFactor); |
469 |
> |
else if(currentObject == "mcparticles") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(mcparticles->size(),puScaleFactor); |
470 |
> |
else if(currentObject == "primaryvertexs"){ |
471 |
> |
oneDHists_.at(currentChannelIndex).at(histoName+"BeforePileupCorrection")->Fill(primaryvertexs->size()); |
472 |
> |
oneDHists_.at(currentChannelIndex).at(histoName+"AfterPileupCorrection")->Fill(primaryvertexs->size(),puScaleFactor); |
473 |
> |
} |
474 |
> |
else if(currentObject == "bxlumis") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(bxlumis->size(),puScaleFactor); |
475 |
> |
else if(currentObject == "photons") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(photons->size(),puScaleFactor); |
476 |
> |
else if(currentObject == "superclusters") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(superclusters->size(),puScaleFactor); |
477 |
|
|
478 |
|
} |
479 |
|
} //end loop over channel |
480 |
|
|
481 |
< |
masterCutFlow_->fillCutFlow(); |
481 |
> |
masterCutFlow_->fillCutFlow(puScaleFactor); |
482 |
> |
|
483 |
|
|
484 |
|
|
485 |
|
} |
817 |
|
//user-defined variables |
818 |
|
else if(variable == "correctedD0VertexErr") value = hypot (object->tkD0err, hypot (primaryVertex_->xError, primaryVertex_->yError)); |
819 |
|
else if(variable == "correctedD0VertexSig") value = object->correctedD0Vertex / hypot (object->tkD0err, hypot (primaryVertex_->xError, primaryVertex_->yError)); |
820 |
< |
else if(variable == "detIso") value = (object->trackIso + object->caloIso) / object->pt; |
820 |
> |
else if(variable == "detIso") value = (object->trackIso) / object->pt; |
821 |
|
else if(variable == "relPFdBetaIso") value = (object->pfIsoR04SumChargedHadronPt + max(0.0, object->pfIsoR04SumNeutralHadronEt + object->pfIsoR04SumPhotonEt - 0.5*object->pfIsoR04SumPUPt)) / object->pt; |
822 |
|
else if(variable == "relPFrhoIso") value = ( object->chargedHadronIso + max(0.0, object->neutralHadronIso + object->photonIso - object->AEffDr03*object->rhoPrime) ) / object->pt; |
823 |
|
else if(variable == "tightID") { |
1015 |
|
//user-defined variables |
1016 |
|
else if(variable == "correctedD0VertexErr") value = hypot (object->tkD0err, hypot (primaryVertex_->xError, primaryVertex_->yError)); |
1017 |
|
else if(variable == "correctedD0VertexSig") value = object->correctedD0Vertex / hypot (object->tkD0err, hypot (primaryVertex_->xError, primaryVertex_->yError)); |
1018 |
< |
else if(variable == "detIso") value = (object->trackIso + object->caloIso) / object->pt; |
1018 |
> |
else if(variable == "detIso") value = (object->trackIso) / object->pt; |
1019 |
|
else if(variable == "relPFrhoIso") value = ( object->chargedHadronIsoDR03 + max(0.0, object->neutralHadronIsoDR03 + object->photonIsoDR03 - object->AEffDr03*object->rhoPrime) ) / object->pt; |
1020 |
|
|
1021 |
|
|
1582 |
|
|
1583 |
|
decision = evaluateComparison(value,currentCut.comparativeOperator,currentCut.cutValue); |
1584 |
|
} |
1585 |
< |
individualFlags[inputType].at(currentCutIndex).push_back(decision); |
1585 |
> |
individualFlags.at(inputType).at(currentCutIndex).push_back(decision); |
1586 |
|
|
1587 |
|
|
1588 |
|
//set flags for objects that pass each cut AND all the previous cuts |
1589 |
|
bool previousCumulativeFlag = true; |
1590 |
|
for(uint previousCutIndex = 0; previousCutIndex != currentCutIndex; previousCutIndex++){ |
1591 |
< |
if(previousCumulativeFlag && individualFlags[inputType].at(previousCutIndex).at(object)) previousCumulativeFlag = true; |
1591 |
> |
if(previousCumulativeFlag && individualFlags.at(inputType).at(previousCutIndex).at(object)) previousCumulativeFlag = true; |
1592 |
|
else{ previousCumulativeFlag = false; break;} |
1593 |
|
} |
1594 |
< |
cumulativeFlags[inputType].at(currentCutIndex).push_back(previousCumulativeFlag && decision); |
1594 |
> |
cumulativeFlags.at(inputType).at(currentCutIndex).push_back(previousCumulativeFlag && decision); |
1595 |
|
|
1596 |
|
} |
1597 |
|
|
1599 |
|
|
1600 |
|
|
1601 |
|
template <class InputCollection> |
1602 |
< |
void OSUAnalysis::fillHistogram(TH1* histo, histogram parameters, InputCollection inputCollection){ |
1602 |
> |
void OSUAnalysis::fill1DHistogram(TH1* histo, histogram parameters, InputCollection inputCollection,vector<bool> flags, double puScaleFactor){ |
1603 |
> |
|
1604 |
> |
for (uint object = 0; object != inputCollection->size(); object++){ |
1605 |
> |
|
1606 |
> |
if(!plotAllObjectsInPassingEvents_ && !flags.at(object)) continue; |
1607 |
> |
|
1608 |
> |
double value = valueLookup(&inputCollection->at(object), parameters.inputVariables.at(0), parameters.function); |
1609 |
> |
histo->Fill(value,puScaleFactor); |
1610 |
|
|
1611 |
+ |
} |
1612 |
+ |
|
1613 |
+ |
} |
1614 |
+ |
|
1615 |
+ |
template <class InputCollection> |
1616 |
+ |
void OSUAnalysis::fill2DHistogram(TH2* histo, histogram parameters, InputCollection inputCollection,vector<bool> flags, double puScaleFactor){ |
1617 |
|
|
1618 |
|
for (uint object = 0; object != inputCollection->size(); object++){ |
1619 |
< |
if(parameters.inputVariables.size() == 1){ |
1620 |
< |
double value = valueLookup(&inputCollection->at(object), parameters.inputVariables.at(0), parameters.function); |
1621 |
< |
histo->Fill(value); |
1622 |
< |
} |
1623 |
< |
else if(parameters.inputVariables.size() == 2){ |
1624 |
< |
double valueX = valueLookup(&inputCollection->at(object), parameters.inputVariables.at(0), parameters.function); |
1625 |
< |
double valueY = valueLookup(&inputCollection->at(object), parameters.inputVariables.at(1), parameters.function); |
1572 |
< |
histo->Fill(valueX,valueY); |
1573 |
< |
} |
1619 |
> |
|
1620 |
> |
if(!plotAllObjectsInPassingEvents_ && !flags.at(object)) continue; |
1621 |
> |
|
1622 |
> |
double valueX = valueLookup(&inputCollection->at(object), parameters.inputVariables.at(0), parameters.function); |
1623 |
> |
double valueY = valueLookup(&inputCollection->at(object), parameters.inputVariables.at(1), parameters.function); |
1624 |
> |
histo->Fill(valueX,valueY,puScaleFactor); |
1625 |
> |
|
1626 |
|
} |
1627 |
|
|
1628 |
|
} |