11 |
|
tracks_ (cfg.getParameter<edm::InputTag> ("tracks")), |
12 |
|
genjets_ (cfg.getParameter<edm::InputTag> ("genjets")), |
13 |
|
mcparticles_ (cfg.getParameter<edm::InputTag> ("mcparticles")), |
14 |
+ |
stops_ (cfg.getParameter<edm::InputTag> ("stops")), |
15 |
|
primaryvertexs_ (cfg.getParameter<edm::InputTag> ("primaryvertexs")), |
16 |
|
bxlumis_ (cfg.getParameter<edm::InputTag> ("bxlumis")), |
17 |
|
photons_ (cfg.getParameter<edm::InputTag> ("photons")), |
29 |
|
histogramSets_ (cfg.getParameter<vector<edm::ParameterSet> >("histogramSets")), |
30 |
|
plotAllObjectsInPassingEvents_ (cfg.getParameter<bool> ("plotAllObjectsInPassingEvents")), |
31 |
|
doPileupReweighting_ (cfg.getParameter<bool> ("doPileupReweighting")), |
32 |
< |
printEventInfo_ (cfg.getParameter<bool> ("printEventInfo")) |
32 |
> |
printEventInfo_ (cfg.getParameter<bool> ("printEventInfo")), |
33 |
> |
useTrackCaloRhoCorr_ (cfg.getParameter<bool> ("useTrackCaloRhoCorr")), |
34 |
> |
stopCTau_ (cfg.getParameter<vector<double> > ("stopCTau")) |
35 |
> |
|
36 |
|
{ |
37 |
|
|
38 |
|
TH1::SetDefaultSumw2 (); |
43 |
|
// muonSFWeight_ = new MuonSFWeight (muonSFFile_, muonSF_); |
44 |
|
// electronSFWeight_ = new ElectronSFWeight ("53X", electronSFID_); |
45 |
|
} |
46 |
+ |
#ifdef DISPLACED_SUSY |
47 |
+ |
if (datasetType_ == "signalMC") |
48 |
+ |
cTauWeight_ = new CTauWeight (stopCTau_.at (0), stopCTau_.at (1), stops_); |
49 |
+ |
#endif |
50 |
|
|
51 |
|
|
52 |
|
// Construct Cutflow Objects. These store the results of cut decisions and |
57 |
|
//always get vertex collection so we can assign the primary vertex in the event |
58 |
|
objectsToGet.push_back("primaryvertexs"); |
59 |
|
|
60 |
< |
//always make the plot of number of primary verticex (to check pile-up reweighting) |
60 |
> |
//always make the plot of number of primary vertices (to check pile-up reweighting) |
61 |
|
objectsToPlot.push_back("primaryvertexs"); |
62 |
|
|
63 |
|
//always get the MC particles to do GEN-matching |
71 |
|
|
72 |
|
string tempInputCollection = histogramSets_.at(currentHistogramSet).getParameter<string> ("inputCollection"); |
73 |
|
if(tempInputCollection == "muon-electron pairs") tempInputCollection = "electron-muon pairs"; |
74 |
+ |
if(tempInputCollection == "jet-electron pairs") tempInputCollection = "electron-jet pairs"; |
75 |
+ |
if(tempInputCollection == "jet-muon pairs") tempInputCollection = "muon-jet pairs"; |
76 |
+ |
if(tempInputCollection == "event-track pairs") tempInputCollection = "track-event pairs"; |
77 |
+ |
if(tempInputCollection == "secondary muon-muon pairs") tempInputCollection = "muon-secondary muon pairs"; |
78 |
+ |
if(tempInputCollection == "secondary electron-electron pairs") tempInputCollection = "electron-secondary electron pairs"; |
79 |
|
if(tempInputCollection.find("pairs")==std::string::npos){ //just a single object |
80 |
< |
objectsToGet.push_back(tempInputCollection); |
80 |
> |
if(tempInputCollection.find("secondary")!=std::string::npos){//secondary object |
81 |
> |
int spaceIndex = tempInputCollection.find(" "); |
82 |
> |
int secondWordLength = tempInputCollection.size() - spaceIndex; |
83 |
> |
objectsToGet.push_back(tempInputCollection.substr(spaceIndex+1,secondWordLength)); |
84 |
> |
} |
85 |
> |
else{ |
86 |
> |
objectsToGet.push_back(tempInputCollection); |
87 |
> |
} |
88 |
|
objectsToPlot.push_back(tempInputCollection); |
89 |
|
objectsToCut.push_back(tempInputCollection); |
90 |
|
} |
91 |
< |
else{//pair of objects, need to add them both to the things to objectsToGet |
92 |
< |
int dashIndex = tempInputCollection.find("-"); |
93 |
< |
int spaceIndex = tempInputCollection.find(" "); |
94 |
< |
int secondWordLength = spaceIndex - dashIndex; |
95 |
< |
objectsToGet.push_back(tempInputCollection); |
76 |
< |
objectsToGet.push_back(tempInputCollection.substr(0,dashIndex)+"s"); |
77 |
< |
objectsToGet.push_back(tempInputCollection.substr(dashIndex+1,secondWordLength-1)+"s"); |
78 |
< |
objectsToPlot.push_back(tempInputCollection); |
79 |
< |
objectsToPlot.push_back(tempInputCollection.substr(0,dashIndex)+"s"); |
80 |
< |
objectsToPlot.push_back(tempInputCollection.substr(dashIndex+1,secondWordLength-1)+"s"); |
91 |
> |
else{//pair of objects, need to add the pair and the individual objects to the lists of things to Get/Plot/Cut |
92 |
> |
string obj1; |
93 |
> |
string obj2; |
94 |
> |
getTwoObjs(tempInputCollection, obj1, obj2); |
95 |
> |
string obj2ToGet = getObjToGet(obj2); |
96 |
|
objectsToCut.push_back(tempInputCollection); |
97 |
< |
objectsToCut.push_back(tempInputCollection.substr(0,dashIndex)+"s"); |
98 |
< |
objectsToCut.push_back(tempInputCollection.substr(dashIndex+1,secondWordLength-1)+"s"); |
97 |
> |
objectsToCut.push_back(obj1); |
98 |
> |
objectsToCut.push_back(obj2); |
99 |
> |
objectsToPlot.push_back(tempInputCollection); |
100 |
> |
objectsToPlot.push_back(obj1); |
101 |
> |
objectsToPlot.push_back(obj2); |
102 |
> |
objectsToGet.push_back(tempInputCollection); |
103 |
> |
objectsToGet.push_back(obj1); |
104 |
> |
objectsToGet.push_back(obj2ToGet); |
105 |
|
|
106 |
< |
} |
106 |
> |
} |
107 |
|
|
108 |
|
vector<edm::ParameterSet> histogramList_ (histogramSets_.at(currentHistogramSet).getParameter<vector<edm::ParameterSet> >("histograms")); |
109 |
|
|
130 |
|
for(uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){ |
131 |
|
|
132 |
|
string currentObject = objectsToPlot.at(currentObjectIndex); |
133 |
< |
if(currentObject != "muons" && currentObject != "electrons" && currentObject != "taus" && currentObject != "tracks" && currentObject != "photons" && currentObject != "superclusters") continue; |
133 |
> |
if(currentObject != "muons" && currentObject != "secondary muons" && currentObject != "secondary electrons" && currentObject != "electrons" && currentObject != "taus" && currentObject != "tracks" && currentObject != "photons" && currentObject != "superclusters") continue; |
134 |
|
|
135 |
|
histogram tempIdHisto; |
136 |
|
histogram tempMomIdHisto; |
137 |
|
histogram tempGmaIdHisto; |
138 |
|
histogram tempIdVsMomIdHisto; |
139 |
+ |
histogram tempIdVsGmaIdHisto; |
140 |
|
|
141 |
|
tempIdHisto.inputCollection = currentObject; |
142 |
|
tempMomIdHisto.inputCollection = currentObject; |
143 |
|
tempGmaIdHisto.inputCollection = currentObject; |
144 |
|
tempIdVsMomIdHisto.inputCollection = currentObject; |
145 |
+ |
tempIdVsGmaIdHisto.inputCollection = currentObject; |
146 |
+ |
|
147 |
+ |
if(currentObject == "secondary muons") currentObject = "secondaryMuons"; |
148 |
+ |
if(currentObject == "secondary electrons") currentObject = "secondaryElectrons"; |
149 |
|
|
150 |
|
currentObject = currentObject.substr(0, currentObject.size()-1); |
151 |
|
tempIdHisto.name = currentObject+"GenMatchId"; |
152 |
|
tempMomIdHisto.name = currentObject+"GenMatchMotherId"; |
153 |
|
tempGmaIdHisto.name = currentObject+"GenMatchGrandmotherId"; |
154 |
|
tempIdVsMomIdHisto.name = currentObject+"GenMatchIdVsMotherId"; |
155 |
+ |
tempIdVsGmaIdHisto.name = currentObject+"GenMatchIdVsGrandmotherId"; |
156 |
|
|
157 |
|
currentObject.at(0) = toupper(currentObject.at(0)); |
158 |
|
tempIdHisto.title = currentObject+" Gen-matched Particle"; |
159 |
|
tempMomIdHisto.title = currentObject+" Gen-matched Particle's Mother"; |
160 |
|
tempGmaIdHisto.title = currentObject+" Gen-matched Particle's Grandmother"; |
161 |
|
tempIdVsMomIdHisto.title = currentObject+" Gen-matched Particle's Mother vs. Particle;Particle;Mother"; |
162 |
+ |
tempIdVsGmaIdHisto.title = currentObject+" Gen-matched Particle's Grandmother vs. Particle;Particle;Grandmother"; |
163 |
+ |
|
164 |
|
|
165 |
|
int maxNum = 24; |
166 |
|
vector<double> binVector; |
180 |
|
tempIdVsMomIdHisto.bins = binVector; |
181 |
|
tempIdVsMomIdHisto.inputVariables.push_back("genMatchedId"); |
182 |
|
tempIdVsMomIdHisto.inputVariables.push_back("genMatchedMotherIdReverse"); |
183 |
+ |
tempIdVsGmaIdHisto.bins = binVector; |
184 |
+ |
tempIdVsGmaIdHisto.inputVariables.push_back("genMatchedId"); |
185 |
+ |
tempIdVsGmaIdHisto.inputVariables.push_back("genMatchedGrandmotherIdReverse"); |
186 |
|
|
187 |
|
histograms.push_back(tempIdHisto); |
188 |
|
histograms.push_back(tempMomIdHisto); |
189 |
|
histograms.push_back(tempGmaIdHisto); |
190 |
|
histograms.push_back(tempIdVsMomIdHisto); |
191 |
+ |
histograms.push_back(tempIdVsGmaIdHisto); |
192 |
|
} |
193 |
|
|
194 |
|
|
254 |
|
|
255 |
|
if(currentHistogram.name.find("GenMatch")==std::string::npos) continue; |
256 |
|
|
257 |
< |
// bin particle type |
258 |
< |
// --- ------------- |
259 |
< |
// 0 unmatched |
260 |
< |
// 1 u |
261 |
< |
// 2 d |
262 |
< |
// 3 s |
263 |
< |
// 4 c |
264 |
< |
// 5 b |
265 |
< |
// 6 t |
266 |
< |
// 7 e |
267 |
< |
// 8 mu |
268 |
< |
// 9 tau |
269 |
< |
// 10 nu |
270 |
< |
// 11 g |
271 |
< |
// 12 gamma |
272 |
< |
// 13 Z |
273 |
< |
// 14 W |
274 |
< |
// 15 light meson |
275 |
< |
// 16 K meson |
276 |
< |
// 17 D meson |
277 |
< |
// 18 B meson |
278 |
< |
// 19 light baryon |
279 |
< |
// 20 strange baryon |
280 |
< |
// 21 charm baryon |
281 |
< |
// 22 bottom baryon |
282 |
< |
// 23 other |
257 |
> |
// bin particle type |
258 |
> |
// --- ------------- |
259 |
> |
// 0 unmatched |
260 |
> |
// 1 u |
261 |
> |
// 2 d |
262 |
> |
// 3 s |
263 |
> |
// 4 c |
264 |
> |
// 5 b |
265 |
> |
// 6 t |
266 |
> |
// 7 e |
267 |
> |
// 8 mu |
268 |
> |
// 9 tau |
269 |
> |
// 10 nu |
270 |
> |
// 11 g |
271 |
> |
// 12 gamma |
272 |
> |
// 13 Z |
273 |
> |
// 14 W |
274 |
> |
// 15 light meson |
275 |
> |
// 16 K meson |
276 |
> |
// 17 D meson |
277 |
> |
// 18 B meson |
278 |
> |
// 19 light baryon |
279 |
> |
// 20 strange baryon |
280 |
> |
// 21 charm baryon |
281 |
> |
// 22 bottom baryon |
282 |
> |
// 23 other |
283 |
|
|
284 |
|
vector<TString> labelArray; |
285 |
|
labelArray.push_back("unmatched"); |
308 |
|
labelArray.push_back("other"); |
309 |
|
|
310 |
|
for(int bin = 0; bin !=currentHistogram.bins.at(0); bin++){ |
311 |
< |
if(currentHistogram.name.find("GenMatchIdVsMotherId")==std::string::npos) { |
311 |
> |
if(currentHistogram.name.find("GenMatchIdVsMotherId")==std::string::npos && currentHistogram.name.find("GenMatchIdVsGrandmotherId")==std::string::npos) { |
312 |
|
oneDHists_.at(currentChannel)[currentHistogram.name]->GetXaxis()->SetBinLabel(bin+1,labelArray.at(bin)); |
313 |
|
} |
314 |
|
else { |
316 |
|
twoDHists_.at(currentChannel)[currentHistogram.name]->GetXaxis()->SetBinLabel(bin+1,labelArray.at(bin)); |
317 |
|
} |
318 |
|
} |
319 |
< |
if(currentHistogram.name.find("GenMatchIdVsMotherId")!=std::string::npos) { |
319 |
> |
if(currentHistogram.name.find("GenMatchIdVsMotherId")!=std::string::npos || currentHistogram.name.find("GenMatchIdVsGrandmotherId")!=std::string::npos) { |
320 |
|
twoDHists_.at(currentChannel)[currentHistogram.name]->GetXaxis()->CenterTitle(); |
321 |
|
twoDHists_.at(currentChannel)[currentHistogram.name]->GetYaxis()->CenterTitle(); |
322 |
|
} |
323 |
|
|
324 |
|
} |
325 |
|
|
326 |
< |
//book a histogram for the number of each object type to be plotted |
327 |
< |
|
326 |
> |
// Book a histogram for the number of each object type to be plotted. |
327 |
> |
// Name of objectToPlot here must match the name specified in OSUAnalysis::analyze(). |
328 |
|
for (uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){ |
329 |
|
string currentObject = objectsToPlot.at(currentObjectIndex); |
330 |
|
int maxNum = 10; |
331 |
|
if(currentObject == "mcparticles") maxNum = 50; |
332 |
|
else if(currentObject == "primaryvertexs") maxNum = 50; |
300 |
– |
else if(currentObject == "muon-muon pairs") currentObject = "dimuonPairs"; |
301 |
– |
else if(currentObject == "electron-electron pairs") currentObject = "dielectronPairs"; |
302 |
– |
else if(currentObject == "electron-muon pairs") currentObject = "electronMuonPairs"; |
333 |
|
|
334 |
< |
currentObject.at(0) = toupper(currentObject.at(0)); |
334 |
> |
if(currentObject == "muon-muon pairs") currentObject = "dimuonPairs"; |
335 |
> |
else if(currentObject == "electron-electron pairs") currentObject = "dielectronPairs"; |
336 |
> |
else if(currentObject == "electron-muon pairs") currentObject = "electronMuonPairs"; |
337 |
> |
else if(currentObject == "electron-jet pairs") currentObject = "electronJetPairs"; |
338 |
> |
else if(currentObject == "muon-jet pairs") currentObject = "muonJetPairs"; |
339 |
> |
else if(currentObject == "track-event pairs") currentObject = "trackEventPairs"; |
340 |
> |
else if(currentObject == "electron-track pairs") currentObject = "electronTrackPairs"; |
341 |
> |
else if(currentObject == "muon-track pairs") currentObject = "muonTrackPairs"; |
342 |
> |
else if(currentObject == "muon-tau pairs") currentObject = "muonTauPairs"; |
343 |
> |
else if(currentObject == "tau-tau pairs") currentObject = "ditauPairs"; |
344 |
> |
else if(currentObject == "tau-track pairs") currentObject = "tauTrackPairs"; |
345 |
> |
else if(currentObject == "muon-secondary muon pairs") currentObject = "muonSecondaryMuonPairs"; |
346 |
> |
else if(currentObject == "secondary muons") currentObject = "secondaryMuons"; |
347 |
> |
else if(currentObject == "electron-secondary electron pairs") currentObject = "electronSecondaryElectronPairs"; |
348 |
> |
else if(currentObject == "secondary electrons") currentObject = "secondaryElectrons"; |
349 |
> |
|
350 |
> |
currentObject.at(0) = toupper(currentObject.at(0)); |
351 |
|
string histoName = "num" + currentObject; |
352 |
|
|
353 |
|
if(histoName == "numPrimaryvertexs"){ |
371 |
|
cut tempCut; |
372 |
|
//store input collection for cut |
373 |
|
string tempInputCollection = cuts_.at(currentCut).getParameter<string> ("inputCollection"); |
374 |
+ |
if(tempInputCollection == "muon-electron pairs") tempInputCollection = "electron-muon pairs"; |
375 |
+ |
if(tempInputCollection == "jet-electron pairs") tempInputCollection = "electron-jet pairs"; |
376 |
+ |
if(tempInputCollection == "jet-muon pairs") tempInputCollection = "muon-jet pairs"; |
377 |
+ |
if(tempInputCollection == "event-track pairs") tempInputCollection = "track-event pairs"; |
378 |
+ |
if(tempInputCollection == "secondary muon-muon pairs") tempInputCollection = "muon-secondary muon pairs"; |
379 |
+ |
if(tempInputCollection == "secondary electron-electron pairs") tempInputCollection = "electron-secondary electron pairs"; |
380 |
|
tempCut.inputCollection = tempInputCollection; |
381 |
|
if(tempInputCollection.find("pairs")==std::string::npos){ //just a single object |
382 |
< |
objectsToGet.push_back(tempInputCollection); |
383 |
< |
objectsToCut.push_back(tempInputCollection); |
382 |
> |
if(tempInputCollection.find("secondary")!=std::string::npos){//secondary object |
383 |
> |
int spaceIndex = tempInputCollection.find(" "); |
384 |
> |
int secondWordLength = tempInputCollection.size() - spaceIndex; |
385 |
> |
objectsToGet.push_back(tempInputCollection.substr(spaceIndex+1,secondWordLength)); |
386 |
> |
} |
387 |
> |
else{ |
388 |
> |
objectsToGet.push_back(tempInputCollection); |
389 |
> |
} |
390 |
> |
objectsToCut.push_back(tempInputCollection); |
391 |
|
} |
392 |
< |
else{//pair of objects, need to add them both to the things to objectsToGet |
393 |
< |
int dashIndex = tempInputCollection.find("-"); |
394 |
< |
int spaceIndex = tempInputCollection.find(" "); |
395 |
< |
int secondWordLength = spaceIndex - dashIndex; |
396 |
< |
objectsToGet.push_back(tempInputCollection); |
338 |
< |
objectsToGet.push_back(tempInputCollection.substr(0,dashIndex)+"s"); |
339 |
< |
objectsToGet.push_back(tempInputCollection.substr(dashIndex+1,secondWordLength-1)+"s"); |
392 |
> |
else{//pair of objects, need to add them both to objectsToGet |
393 |
> |
string obj1; |
394 |
> |
string obj2; |
395 |
> |
getTwoObjs(tempInputCollection, obj1, obj2); |
396 |
> |
string obj2ToGet = getObjToGet(obj2); |
397 |
|
objectsToCut.push_back(tempInputCollection); |
398 |
< |
objectsToCut.push_back(tempInputCollection.substr(0,dashIndex)+"s"); |
399 |
< |
objectsToCut.push_back(tempInputCollection.substr(dashIndex+1,secondWordLength-1)+"s"); |
398 |
> |
objectsToCut.push_back(obj1); |
399 |
> |
objectsToCut.push_back(obj2); |
400 |
> |
objectsToGet.push_back(tempInputCollection); |
401 |
> |
objectsToGet.push_back(obj1); |
402 |
> |
objectsToGet.push_back(obj2ToGet); |
403 |
|
|
404 |
|
} |
405 |
|
|
456 |
|
} |
457 |
|
tempCut.name = tempCutName; |
458 |
|
|
399 |
– |
|
459 |
|
tempChannel.cuts.push_back(tempCut); |
460 |
|
|
461 |
|
|
403 |
– |
|
462 |
|
}//end loop over cuts |
463 |
|
|
464 |
|
channels.push_back(tempChannel); |
534 |
|
if (std::find(objectsToGet.begin(), objectsToGet.end(), "superclusters") != objectsToGet.end()) |
535 |
|
event.getByLabel (superclusters_, superclusters); |
536 |
|
|
537 |
+ |
if (datasetType_ == "signalMC"){ |
538 |
+ |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "stops") != objectsToGet.end()) |
539 |
+ |
event.getByLabel (stops_, stops); |
540 |
+ |
} |
541 |
+ |
|
542 |
+ |
|
543 |
+ |
if (useTrackCaloRhoCorr_) { |
544 |
+ |
// Used only for pile-up correction of by-hand calculation of isolation energy. |
545 |
+ |
// This rho collection is not available in all BEANs. |
546 |
+ |
// For description of rho values for different jet reconstruction algorithms, see |
547 |
+ |
// https://twiki.cern.ch/twiki/bin/view/CMS/JetAlgorithms#Algorithms |
548 |
+ |
event.getByLabel ("kt6CaloJets","rho", rhokt6CaloJetsHandle_); |
549 |
+ |
} |
550 |
+ |
|
551 |
+ |
|
552 |
|
//get pile-up event weight |
553 |
|
double scaleFactor = 1.00; |
554 |
|
if(doPileupReweighting_ && datasetType_ != "data") |
555 |
|
scaleFactor = puWeight_->at (events->at (0).numTruePV); |
556 |
|
|
557 |
+ |
cTauScaleFactor_ = 1.0; |
558 |
+ |
#ifdef DISPLACED_SUSY |
559 |
+ |
if (datasetType_ == "signalMC") |
560 |
+ |
cTauScaleFactor_ = cTauWeight_->at (event); |
561 |
+ |
#endif |
562 |
+ |
scaleFactor *= cTauScaleFactor_; |
563 |
|
|
564 |
|
//loop over all channels |
565 |
|
|
598 |
|
|
599 |
|
|
600 |
|
if(currentObject == "jets") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,jets.product(),"jets"); |
601 |
+ |
|
602 |
|
else if(currentObject == "muons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),"muons"); |
603 |
+ |
|
604 |
+ |
else if(currentObject == "secondary muons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),"secondary muons"); |
605 |
+ |
else if(currentObject == "secondary electrons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),"secondary electrons"); |
606 |
|
else if(currentObject == "electrons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),"electrons"); |
607 |
|
else if(currentObject == "events") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,events.product(),"events"); |
608 |
|
else if(currentObject == "taus") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,taus.product(),"taus"); |
615 |
|
else if(currentObject == "photons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,photons.product(),"photons"); |
616 |
|
else if(currentObject == "superclusters") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,superclusters.product(),"superclusters"); |
617 |
|
|
618 |
+ |
else if(currentObject == "stops" && datasetType_ == "signalMC") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,stops.product(),"stops"); |
619 |
+ |
|
620 |
|
|
621 |
|
else if(currentObject == "muon-muon pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),muons.product(), \ |
622 |
|
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
623 |
|
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
624 |
|
"muon-muon pairs"); |
625 |
+ |
|
626 |
+ |
else if(currentObject == "muon-secondary muon pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),muons.product(), \ |
627 |
+ |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
628 |
+ |
cumulativeFlags.at("secondary muons").at(flagsForPairCutsIndex), \ |
629 |
+ |
"muon-secondary muon pairs"); |
630 |
+ |
|
631 |
+ |
else if(currentObject == "electron-secondary electron pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),electrons.product(), \ |
632 |
+ |
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \ |
633 |
+ |
cumulativeFlags.at("secondary electrons").at(flagsForPairCutsIndex), \ |
634 |
+ |
"electron-secondary electron pairs"); |
635 |
+ |
|
636 |
|
else if(currentObject == "electron-electron pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),electrons.product(), \ |
637 |
|
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \ |
638 |
|
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \ |
641 |
|
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \ |
642 |
|
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
643 |
|
"electron-muon pairs"); |
644 |
< |
|
645 |
< |
|
644 |
> |
else if(currentObject == "electron-jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),jets.product(), \ |
645 |
> |
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \ |
646 |
> |
cumulativeFlags.at("jets").at(flagsForPairCutsIndex), \ |
647 |
> |
"electron-jet pairs"); |
648 |
> |
else if(currentObject == "muon-jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),jets.product(), \ |
649 |
> |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
650 |
> |
cumulativeFlags.at("jets").at(flagsForPairCutsIndex), \ |
651 |
> |
"muon-jet pairs"); |
652 |
> |
else if(currentObject == "track-event pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,tracks.product(),events.product(), |
653 |
> |
cumulativeFlags.at("tracks").at(flagsForPairCutsIndex), |
654 |
> |
cumulativeFlags.at("events").at(flagsForPairCutsIndex), |
655 |
> |
"track-event pairs"); |
656 |
> |
else if(currentObject == "electron-track pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),tracks.product(), |
657 |
> |
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), |
658 |
> |
cumulativeFlags.at("tracks").at(flagsForPairCutsIndex), |
659 |
> |
"electron-track pairs"); |
660 |
> |
else if(currentObject == "muon-track pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),tracks.product(), |
661 |
> |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), |
662 |
> |
cumulativeFlags.at("tracks").at(flagsForPairCutsIndex), |
663 |
> |
"muon-track pairs"); |
664 |
> |
else if(currentObject == "muon-tau pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),taus.product(), |
665 |
> |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), |
666 |
> |
cumulativeFlags.at("taus").at(flagsForPairCutsIndex), |
667 |
> |
"muon-tau pairs"); |
668 |
> |
else if(currentObject == "tau-tau pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,taus.product(),taus.product(), |
669 |
> |
cumulativeFlags.at("taus").at(flagsForPairCutsIndex), |
670 |
> |
cumulativeFlags.at("taus").at(flagsForPairCutsIndex), |
671 |
> |
"tau-tau pairs"); |
672 |
> |
else if(currentObject == "tau-track pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,taus .product(),tracks.product(), |
673 |
> |
cumulativeFlags.at("taus").at(flagsForPairCutsIndex), |
674 |
> |
cumulativeFlags.at("tracks").at(flagsForPairCutsIndex), |
675 |
> |
"tau-track pairs"); |
676 |
> |
|
677 |
> |
|
678 |
|
} |
679 |
|
|
680 |
|
|
690 |
|
eventPassedAllCuts = eventPassedAllCuts && triggerDecision; |
691 |
|
|
692 |
|
|
565 |
– |
|
693 |
|
for(uint currentCutIndex = 0; currentCutIndex != currentChannel.cuts.size(); currentCutIndex++){ |
694 |
|
|
695 |
|
//loop over all objects and count how many passed the cumulative selection up to this point |
697 |
|
int numberPassing = 0; |
698 |
|
|
699 |
|
for (uint object = 0; object != cumulativeFlags.at(currentCut.inputCollection).at(currentCutIndex).size() ; object++){ |
700 |
< |
if(cumulativeFlags.at(currentCut.inputCollection).at(currentCutIndex).at(object)) numberPassing++; |
700 |
> |
if(cumulativeFlags.at(currentCut.inputCollection).at(currentCutIndex).at(object)) numberPassing++; |
701 |
|
} |
575 |
– |
|
702 |
|
bool cutDecision = evaluateComparison(numberPassing,currentCut.eventComparativeOperator,currentCut.numberRequired); |
703 |
|
cutFlows_.at(currentChannelIndex)->at (currentCut.name) = cutDecision; |
578 |
– |
|
704 |
|
eventPassedAllCuts = eventPassedAllCuts && cutDecision; |
705 |
|
|
706 |
|
} |
707 |
|
|
708 |
+ |
// if(datasetType_ != "data") { |
709 |
+ |
// scaleFactor *= muonSFWeight_->at (chosenMuon ()->eta); |
710 |
+ |
// scaleFactor *= electronSFWeight_->at (chosenElectron ()->eta, chosenElectron ()->pt); |
711 |
+ |
// } |
712 |
+ |
|
713 |
|
cutFlows_.at(currentChannelIndex)->fillCutFlow(scaleFactor); |
714 |
|
|
715 |
|
|
726 |
|
} |
727 |
|
|
728 |
|
|
599 |
– |
// if(datasetType_ != "data") { |
600 |
– |
// scaleFactor *= muonSFWeight_->at (chosenMuon ()->eta); |
601 |
– |
// scaleFactor *= electronSFWeight_->at (chosenElectron ()->eta, chosenElectron ()->pt); |
602 |
– |
// } |
603 |
– |
|
729 |
|
//filling histograms |
730 |
|
for (uint histogramIndex = 0; histogramIndex != histograms.size(); histogramIndex++){ |
731 |
|
histogram currentHistogram = histograms.at(histogramIndex); |
734 |
|
TH1D* histo; |
735 |
|
histo = oneDHists_.at(currentChannelIndex).at(currentHistogram.name); |
736 |
|
|
612 |
– |
|
613 |
– |
|
737 |
|
if(currentHistogram.inputCollection == "jets") fill1DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("jets").back(),scaleFactor); |
738 |
< |
else if(currentHistogram.inputCollection == "muons") fill1DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("muons").back(),scaleFactor); |
738 |
> |
else if(currentHistogram.inputCollection == "muons") fill1DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("muons").back(),scaleFactor); |
739 |
> |
else if(currentHistogram.inputCollection == "secondary muons") fill1DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("secondary muons").back(),scaleFactor); |
740 |
> |
else if(currentHistogram.inputCollection == "secondary electrons") fill1DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("secondary electrons").back(),scaleFactor); |
741 |
|
else if(currentHistogram.inputCollection == "muon-muon pairs") fill1DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
742 |
|
cumulativeFlags.at("muons").back(),cumulativeFlags.at("muons").back(), \ |
743 |
|
cumulativeFlags.at("muon-muon pairs").back(),scaleFactor); |
744 |
+ |
else if(currentHistogram.inputCollection == "muon-secondary muon pairs") fill1DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
745 |
+ |
cumulativeFlags.at("muons").back(),cumulativeFlags.at("secondary muons").back(), \ |
746 |
+ |
cumulativeFlags.at("muon-secondary muon pairs").back(),scaleFactor); |
747 |
|
else if(currentHistogram.inputCollection == "electrons") fill1DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("electrons").back(),scaleFactor); |
748 |
|
else if(currentHistogram.inputCollection == "electron-electron pairs") fill1DHistogram(histo,currentHistogram,electrons.product(),electrons.product(),\ |
749 |
|
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("electrons").back(),\ |
750 |
|
cumulativeFlags.at("electron-electron pairs").back(),scaleFactor); |
751 |
+ |
else if(currentHistogram.inputCollection == "electron-secondary electron pairs") fill1DHistogram(histo,currentHistogram,electrons.product(),electrons.product(), \ |
752 |
+ |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("secondary electrons").back(), \ |
753 |
+ |
cumulativeFlags.at("electron-secondary electron pairs").back(),scaleFactor); |
754 |
|
else if(currentHistogram.inputCollection == "electron-muon pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),muons.product(), \ |
755 |
< |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("muons").back(), |
756 |
< |
cumulativeFlags.at("electron-muon pairs").back(),scaleFactor); |
755 |
> |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("muons").back(), |
756 |
> |
cumulativeFlags.at("electron-muon pairs").back(),scaleFactor); |
757 |
> |
else if(currentHistogram.inputCollection == "electron-jet pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),jets.product(), \ |
758 |
> |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("jets").back(), |
759 |
> |
cumulativeFlags.at("electron-jet pairs").back(),scaleFactor); |
760 |
> |
else if(currentHistogram.inputCollection == "muon-jet pairs") fill1DHistogram(histo,currentHistogram, muons.product(),jets.product(), \ |
761 |
> |
cumulativeFlags.at("muons").back(),cumulativeFlags.at("jets").back(), |
762 |
> |
cumulativeFlags.at("muon-jet pairs").back(),scaleFactor); |
763 |
> |
else if(currentHistogram.inputCollection == "electron-track pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),tracks.product(), |
764 |
> |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("tracks").back(), |
765 |
> |
cumulativeFlags.at("electron-track pairs").back(),scaleFactor); |
766 |
> |
else if(currentHistogram.inputCollection == "muon-track pairs") fill1DHistogram(histo,currentHistogram, muons.product(),tracks.product(), |
767 |
> |
cumulativeFlags.at("muons").back(),cumulativeFlags.at("tracks").back(), |
768 |
> |
cumulativeFlags.at("muon-track pairs").back(),scaleFactor); |
769 |
> |
else if(currentHistogram.inputCollection == "muon-tau pairs") fill1DHistogram(histo,currentHistogram, muons.product(),taus.product(), |
770 |
> |
cumulativeFlags.at("muons").back(),cumulativeFlags.at("taus").back(), |
771 |
> |
cumulativeFlags.at("muon-tau pairs").back(),scaleFactor); |
772 |
> |
else if(currentHistogram.inputCollection == "tau-tau pairs") fill1DHistogram(histo,currentHistogram, taus.product(),taus.product(), |
773 |
> |
cumulativeFlags.at("taus").back(),cumulativeFlags.at("taus").back(), |
774 |
> |
cumulativeFlags.at("tau-tau pairs").back(),scaleFactor); |
775 |
> |
else if(currentHistogram.inputCollection == "tau-track pairs") fill1DHistogram(histo,currentHistogram, taus.product(),tracks.product(), |
776 |
> |
cumulativeFlags.at("taus").back(),cumulativeFlags.at("tracks").back(), |
777 |
> |
cumulativeFlags.at("tau-track pairs").back(),scaleFactor); |
778 |
> |
|
779 |
|
else if(currentHistogram.inputCollection == "events") fill1DHistogram(histo,currentHistogram,events.product(),cumulativeFlags.at("events").back(),scaleFactor); |
780 |
|
else if(currentHistogram.inputCollection == "taus") fill1DHistogram(histo,currentHistogram,taus.product(),cumulativeFlags.at("taus").back(),scaleFactor); |
781 |
|
else if(currentHistogram.inputCollection == "mets") fill1DHistogram(histo,currentHistogram,mets.product(),cumulativeFlags.at("mets").back(),scaleFactor); |
786 |
|
else if(currentHistogram.inputCollection == "bxlumis") fill1DHistogram(histo,currentHistogram,bxlumis.product(),cumulativeFlags.at("bxlumis").back(),scaleFactor); |
787 |
|
else if(currentHistogram.inputCollection == "photons") fill1DHistogram(histo,currentHistogram,photons.product(),cumulativeFlags.at("photons").back(),scaleFactor); |
788 |
|
else if(currentHistogram.inputCollection == "superclusters") fill1DHistogram(histo,currentHistogram,superclusters.product(),cumulativeFlags.at("superclusters").back(),scaleFactor); |
789 |
+ |
else if(currentHistogram.inputCollection == "stops" && datasetType_ == "signalMC") fill1DHistogram(histo,currentHistogram,stops.product(),cumulativeFlags.at("stops").back(),scaleFactor); |
790 |
+ |
|
791 |
|
} |
792 |
|
else if(currentHistogram.inputVariables.size() == 2){ |
793 |
|
TH2D* histo; |
794 |
|
histo = twoDHists_.at(currentChannelIndex).at(currentHistogram.name); |
795 |
|
|
641 |
– |
|
642 |
– |
|
796 |
|
if(currentHistogram.inputCollection == "jets") fill2DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("jets").back(),scaleFactor); |
797 |
|
else if(currentHistogram.inputCollection == "muons") fill2DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("muons").back(),scaleFactor); |
798 |
+ |
else if(currentHistogram.inputCollection == "secondary muons") fill2DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("secondary muons").back(),scaleFactor); |
799 |
|
else if(currentHistogram.inputCollection == "muon-muon pairs") fill2DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
800 |
|
cumulativeFlags.at("muons").back(),cumulativeFlags.at("muons").back(), \ |
801 |
|
cumulativeFlags.at("muon-muon pairs").back(),scaleFactor); |
802 |
+ |
else if(currentHistogram.inputCollection == "muon-secondary muon pairs") fill2DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
803 |
+ |
cumulativeFlags.at("muons").back(),cumulativeFlags.at("secondary muons").back(), \ |
804 |
+ |
cumulativeFlags.at("muon-secondary muon pairs").back(),scaleFactor); |
805 |
|
else if(currentHistogram.inputCollection == "electrons") fill2DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("electrons").back(),scaleFactor); |
806 |
+ |
else if(currentHistogram.inputCollection == "secondary electrons") fill2DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("secondary electrons").back(),scaleFactor); |
807 |
|
else if(currentHistogram.inputCollection == "electron-electron pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),electrons.product(), \ |
808 |
|
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("electrons").back(), \ |
809 |
|
cumulativeFlags.at("electron-electron pairs").back(),scaleFactor); |
810 |
+ |
else if(currentHistogram.inputCollection == "electron-secondary electron pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),electrons.product(), \ |
811 |
+ |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("secondary electrons").back(), \ |
812 |
+ |
cumulativeFlags.at("electron-secondary electron pairs").back(),scaleFactor); |
813 |
|
else if(currentHistogram.inputCollection == "electron-muon pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),muons.product(), \ |
814 |
< |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("muons").back(), \ |
815 |
< |
cumulativeFlags.at("electron-muon pairs").back(),scaleFactor); |
816 |
< |
else if(currentHistogram.inputCollection == "events") fill2DHistogram(histo,currentHistogram,events.product(),cumulativeFlags.at("events").back(),scaleFactor); |
814 |
> |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("muons").back(), \ |
815 |
> |
cumulativeFlags.at("electron-muon pairs").back(),scaleFactor); |
816 |
> |
else if(currentHistogram.inputCollection == "electron-jet pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),jets.product(), \ |
817 |
> |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("jets").back(), \ |
818 |
> |
cumulativeFlags.at("electron-jet pairs").back(),scaleFactor); |
819 |
> |
else if(currentHistogram.inputCollection == "muon-jet pairs") fill2DHistogram(histo,currentHistogram,muons.product(),jets.product(), \ |
820 |
> |
cumulativeFlags.at("muons").back(),cumulativeFlags.at("jets").back(), \ |
821 |
> |
cumulativeFlags.at("muon-jet pairs").back(),scaleFactor); |
822 |
> |
else if(currentHistogram.inputCollection == "electron-track pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),tracks.product(), |
823 |
> |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("tracks").back(), |
824 |
> |
cumulativeFlags.at("electron-track pairs").back(),scaleFactor); |
825 |
> |
else if(currentHistogram.inputCollection == "muon-track pairs") fill2DHistogram(histo,currentHistogram,muons.product(),tracks.product(), |
826 |
> |
cumulativeFlags.at("muons").back(),cumulativeFlags.at("tracks").back(), |
827 |
> |
cumulativeFlags.at("muon-track pairs").back(),scaleFactor); |
828 |
> |
else if(currentHistogram.inputCollection == "muon-tau pairs") fill2DHistogram(histo,currentHistogram,muons.product(),taus.product(), |
829 |
> |
cumulativeFlags.at("muons").back(),cumulativeFlags.at("taus").back(), |
830 |
> |
cumulativeFlags.at("muon-tau pairs").back(),scaleFactor); |
831 |
> |
else if(currentHistogram.inputCollection == "tau-tau pairs") fill2DHistogram(histo,currentHistogram,taus.product(),taus.product(), |
832 |
> |
cumulativeFlags.at("taus").back(),cumulativeFlags.at("taus").back(), |
833 |
> |
cumulativeFlags.at("tau-tau pairs").back(),scaleFactor); |
834 |
> |
else if(currentHistogram.inputCollection == "tau-track pairs") fill2DHistogram(histo,currentHistogram,taus.product(),tracks.product(), |
835 |
> |
cumulativeFlags.at("taus").back(),cumulativeFlags.at("tracks").back(), |
836 |
> |
cumulativeFlags.at("tau-track pairs").back(),scaleFactor); |
837 |
> |
else if(currentHistogram.inputCollection == "events") fill2DHistogram(histo,currentHistogram,events.product(),cumulativeFlags.at("events").back(),scaleFactor); |
838 |
|
else if(currentHistogram.inputCollection == "taus") fill2DHistogram(histo,currentHistogram,taus.product(),cumulativeFlags.at("taus").back(),scaleFactor); |
839 |
|
else if(currentHistogram.inputCollection == "mets") fill2DHistogram(histo,currentHistogram,mets.product(),cumulativeFlags.at("mets").back(),scaleFactor); |
840 |
|
else if(currentHistogram.inputCollection == "tracks") fill2DHistogram(histo,currentHistogram,tracks.product(),cumulativeFlags.at("tracks").back(),scaleFactor); |
841 |
+ |
else if(currentHistogram.inputCollection == "track-event pairs") fill2DHistogram(histo,currentHistogram,tracks.product(),events.product(), |
842 |
+ |
cumulativeFlags.at("tracks").back(),cumulativeFlags.at("events").back(), |
843 |
+ |
cumulativeFlags.at("track-event pairs").back(),scaleFactor); |
844 |
|
else if(currentHistogram.inputCollection == "genjets") fill2DHistogram(histo,currentHistogram,genjets.product(),cumulativeFlags.at("genjets").back(),scaleFactor); |
845 |
|
else if(currentHistogram.inputCollection == "mcparticles") fill2DHistogram(histo,currentHistogram,mcparticles.product(),cumulativeFlags.at("mcparticles").back(),scaleFactor); |
846 |
|
else if(currentHistogram.inputCollection == "primaryvertexs") fill2DHistogram(histo,currentHistogram,primaryvertexs.product(),cumulativeFlags.at("primaryvertexs").back(),scaleFactor); |
847 |
|
else if(currentHistogram.inputCollection == "bxlumis") fill2DHistogram(histo,currentHistogram,bxlumis.product(),cumulativeFlags.at("bxlumis").back(),scaleFactor); |
848 |
|
else if(currentHistogram.inputCollection == "photons") fill2DHistogram(histo,currentHistogram,photons.product(),cumulativeFlags.at("photons").back(),scaleFactor); |
849 |
|
else if(currentHistogram.inputCollection == "superclusters") fill2DHistogram(histo,currentHistogram,superclusters.product(),cumulativeFlags.at("superclusters").back(),scaleFactor); |
850 |
+ |
else if(currentHistogram.inputCollection == "stops" && datasetType_ == "signalMC") fill2DHistogram(histo,currentHistogram,stops.product(),cumulativeFlags.at("stops").back(),scaleFactor); |
851 |
+ |
|
852 |
|
} |
853 |
|
} |
854 |
|
|
855 |
+ |
|
856 |
+ |
|
857 |
|
//fills histograms with the sizes of collections |
858 |
|
for (uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){ |
859 |
+ |
|
860 |
|
string currentObject = objectsToPlot.at(currentObjectIndex); |
861 |
|
|
862 |
< |
string objectToPlot = ""; |
862 |
> |
string objectToPlot = ""; |
863 |
|
|
864 |
< |
if(currentObject == "muon-muon pairs") objectToPlot = "dimuonPairs"; |
865 |
< |
else if(currentObject == "electron-electron pairs") objectToPlot = "dielectronPairs"; |
866 |
< |
else if(currentObject == "electron-muon pairs") objectToPlot = "electronMuonPairs"; |
864 |
> |
// Name of objectToPlot here must match the name specified in OSUAnalysis::OSUAnalysis(). |
865 |
> |
if(currentObject == "muon-muon pairs") objectToPlot = "dimuonPairs"; |
866 |
> |
else if(currentObject == "electron-electron pairs") objectToPlot = "dielectronPairs"; |
867 |
> |
else if(currentObject == "electron-muon pairs") objectToPlot = "electronMuonPairs"; |
868 |
> |
else if(currentObject == "electron-jet pairs") objectToPlot = "electronJetPairs"; |
869 |
> |
else if(currentObject == "muon-jet pairs") objectToPlot = "muonJetPairs"; |
870 |
> |
else if(currentObject == "electron-track pairs") objectToPlot = "electronTrackPairs"; |
871 |
> |
else if(currentObject == "muon-track pairs") objectToPlot = "muonTrackPairs"; |
872 |
> |
else if(currentObject == "muon-tau pairs") objectToPlot = "muonTauPairs"; |
873 |
> |
else if(currentObject == "tau-tau pairs") objectToPlot = "ditauPairs"; |
874 |
> |
else if(currentObject == "tau-track pairs") objectToPlot = "tauTrackPairs"; |
875 |
> |
else if(currentObject == "track-event pairs") objectToPlot = "trackEventPairs"; |
876 |
> |
else if(currentObject == "muon-secondary muon pairs") objectToPlot = "muonSecondaryMuonPairs"; |
877 |
> |
else if(currentObject == "secondary muons") objectToPlot = "secondaryMuons"; |
878 |
> |
else if(currentObject == "electron-secondary electron pairs") objectToPlot = "electronSecondaryElectronPairs"; |
879 |
> |
else if(currentObject == "secondary electrons") objectToPlot = "secondaryElectrons"; |
880 |
|
else objectToPlot = currentObject; |
881 |
+ |
|
882 |
|
string tempCurrentObject = objectToPlot; |
883 |
< |
tempCurrentObject.at(0) = toupper(tempCurrentObject.at(0)); |
883 |
> |
tempCurrentObject.at(0) = toupper(tempCurrentObject.at(0)); |
884 |
|
string histoName = "num" + tempCurrentObject; |
885 |
|
|
682 |
– |
|
683 |
– |
|
684 |
– |
|
886 |
|
//set position of primary vertex in event, in order to calculate quantities relative to it |
887 |
|
if(std::find(objectsToCut.begin(), objectsToCut.end(), currentObject) != objectsToCut.end()) { |
888 |
|
vector<bool> lastCutFlags = cumulativeFlags.at(currentObject).back(); |
889 |
< |
int numToPlot = 0; |
889 |
> |
int numToPlot = 0; |
890 |
|
for (uint currentFlag = 0; currentFlag != lastCutFlags.size(); currentFlag++){ |
891 |
|
if(lastCutFlags.at(currentFlag)) numToPlot++; |
892 |
|
} |
894 |
|
oneDHists_.at(currentChannelIndex).at(histoName+"BeforePileupCorrection")->Fill(primaryvertexs->size()); |
895 |
|
oneDHists_.at(currentChannelIndex).at(histoName+"AfterPileupCorrection")->Fill(primaryvertexs->size(),scaleFactor); |
896 |
|
} |
897 |
< |
else |
897 |
> |
else { |
898 |
|
oneDHists_.at(currentChannelIndex).at(histoName)->Fill(numToPlot,scaleFactor); |
899 |
+ |
} |
900 |
|
} |
901 |
|
else if(objectToPlot == "jets") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(jets->size(),scaleFactor); |
902 |
|
else if(objectToPlot == "muons") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(muons->size(),scaleFactor); |
903 |
+ |
else if(objectToPlot == "secondaryMuons") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(muons->size(),scaleFactor); |
904 |
|
else if(objectToPlot == "dimuonPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(muons->size()*(muons->size()-1)/2,scaleFactor); |
905 |
+ |
else if(objectToPlot == "muonSecondaryMuonPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(muons->size()*(muons->size()-1)/2,scaleFactor); |
906 |
|
else if(objectToPlot == "electrons") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size(),scaleFactor); |
907 |
+ |
else if(objectToPlot == "secondaryElectrons") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size(),scaleFactor); |
908 |
|
else if(objectToPlot == "dielectronPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size()*(electrons->size()-1)/2,scaleFactor); |
909 |
+ |
else if(objectToPlot == "electronSecondaryElectronPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size()*(electrons->size()-1)/2,scaleFactor); |
910 |
|
else if(objectToPlot == "electronMuonPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size()*muons->size(),scaleFactor); |
911 |
+ |
else if(objectToPlot == "electronJetPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size()*jets->size(),scaleFactor); |
912 |
+ |
else if(objectToPlot == "muonJetPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(muons->size()*jets->size(),scaleFactor); |
913 |
+ |
else if(objectToPlot == "electronTrackPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size()*tracks->size(),scaleFactor); |
914 |
|
else if(objectToPlot == "events") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(events->size(),scaleFactor); |
915 |
|
else if(objectToPlot == "taus") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(taus->size(),scaleFactor); |
916 |
|
else if(objectToPlot == "mets") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(mets->size(),scaleFactor); |
920 |
|
else if(objectToPlot == "bxlumis") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(bxlumis->size(),scaleFactor); |
921 |
|
else if(objectToPlot == "photons") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(photons->size(),scaleFactor); |
922 |
|
else if(objectToPlot == "superclusters") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(superclusters->size(),scaleFactor); |
923 |
+ |
else if(objectToPlot == "stops" && datasetType_ == "signalMC") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(stops->size(),scaleFactor); |
924 |
|
else if(objectToPlot == "primaryvertexs"){ |
925 |
|
oneDHists_.at(currentChannelIndex).at(histoName+"BeforePileupCorrection")->Fill(primaryvertexs->size()); |
926 |
|
oneDHists_.at(currentChannelIndex).at(histoName+"AfterPileupCorrection")->Fill(primaryvertexs->size(),scaleFactor); |
927 |
< |
} |
718 |
< |
|
719 |
< |
} |
720 |
< |
|
721 |
< |
|
927 |
> |
} |
928 |
|
|
929 |
+ |
} // end for (uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){ |
930 |
|
|
931 |
|
} //end loop over channel |
932 |
|
|
933 |
|
masterCutFlow_->fillCutFlow(scaleFactor); |
934 |
|
|
935 |
+ |
} // end void OSUAnalysis::analyze (const edm::Event &event, const edm::EventSetup &setup) |
936 |
|
|
937 |
|
|
730 |
– |
} |
731 |
– |
|
938 |
|
|
939 |
|
bool |
940 |
|
OSUAnalysis::evaluateComparison (double testValue, string comparison, double cutValue){ |
981 |
|
|
982 |
|
} |
983 |
|
|
984 |
+ |
|
985 |
+ |
void OSUAnalysis::getTwoObjs(string tempInputCollection, string& obj1, string& obj2) { |
986 |
+ |
// Set two object strings from the tempInputCollection string, |
987 |
+ |
// For example, if tempInputCollection is "electron-muon pairs", |
988 |
+ |
// then obj1 = "electrons" and obj2 = "muons". |
989 |
+ |
// Note that the objects have an "s" appended. |
990 |
+ |
|
991 |
+ |
int dashIndex = tempInputCollection.find("-"); |
992 |
+ |
int spaceIndex = tempInputCollection.find_last_of(" "); |
993 |
+ |
int secondWordLength = spaceIndex - dashIndex; |
994 |
+ |
obj1 = tempInputCollection.substr(0,dashIndex) + "s"; |
995 |
+ |
obj2 = tempInputCollection.substr(dashIndex+1,secondWordLength-1)+"s"; |
996 |
+ |
|
997 |
+ |
} |
998 |
+ |
|
999 |
+ |
|
1000 |
+ |
string OSUAnalysis::getObjToGet(string obj) { |
1001 |
+ |
// Return the string corresponding to the object to get for the given obj string. |
1002 |
+ |
// Right now this only handles the case in which obj contains "secondary", |
1003 |
+ |
// e.g, "secondary muons". |
1004 |
+ |
// Note that "s" is NOT appended. |
1005 |
+ |
|
1006 |
+ |
if (obj.find("secondary")==std::string::npos) return obj; // "secondary" is not found |
1007 |
+ |
int firstSpaceIndex = obj.find_first_of(" "); |
1008 |
+ |
return obj.substr(firstSpaceIndex+1,obj.length()-1); |
1009 |
+ |
|
1010 |
+ |
} |
1011 |
+ |
|
1012 |
+ |
|
1013 |
+ |
//!jet valueLookup |
1014 |
|
double |
1015 |
|
OSUAnalysis::valueLookup (const BNjet* object, string variable, string function){ |
1016 |
|
|
1140 |
|
} |
1141 |
|
|
1142 |
|
|
1143 |
< |
|
1143 |
> |
//!muon valueLookup |
1144 |
|
double |
1145 |
|
OSUAnalysis::valueLookup (const BNmuon* object, string variable, string function){ |
1146 |
|
|
1307 |
|
if (met) |
1308 |
|
{ |
1309 |
|
TLorentzVector p1 (object->px, object->py, object->pz, object->energy), |
1310 |
< |
p2 (met->px, met->py, 0.0, met->pt); |
1310 |
> |
p2 (met->px, met->py, 0.0, met->pt); |
1311 |
|
|
1312 |
|
value = (p1 + p2).Mt (); |
1313 |
|
} |
1427 |
|
value = object->isGlobalMuon > 0 \ |
1428 |
|
&& object->isPFMuon > 0 \ |
1429 |
|
&& object->normalizedChi2 < 10 \ |
1430 |
< |
&& object->numberOfValidMuonHits > 0 \ |
1430 |
> |
&& object->numberOfValidMuonHits > 0 \ |
1431 |
|
&& object->numberOfMatchedStations > 1 \ |
1432 |
|
&& fabs(object->correctedD0Vertex) < 0.2 \ |
1433 |
|
&& fabs(object->correctedDZ) < 0.5 \ |
1437 |
|
else if(variable == "tightIDdisplaced"){ |
1438 |
|
value = object->isGlobalMuon > 0 \ |
1439 |
|
&& object->normalizedChi2 < 10 \ |
1440 |
< |
&& object->numberOfValidMuonHits > 0 \ |
1440 |
> |
&& object->numberOfValidMuonHits > 0 \ |
1441 |
|
&& object->numberOfMatchedStations > 1 \ |
1442 |
|
&& object->numberOfValidPixelHits > 0 \ |
1443 |
|
&& object->numberOfLayersWithMeasurement > 5; |
1464 |
|
else if(variable == "genMatchedMotherIdReverse"){ |
1465 |
|
int index = getGenMatchedParticleIndex(object); |
1466 |
|
if(index == -1) value = 23; |
1467 |
< |
else value = 23 -getPdgIdBinValue(mcparticles->at(index).motherId); |
1467 |
> |
else value = 23 - getPdgIdBinValue(mcparticles->at(index).motherId); |
1468 |
|
} |
1469 |
|
else if(variable == "genMatchedGrandmotherId"){ |
1470 |
|
int index = getGenMatchedParticleIndex(object); |
1476 |
|
} |
1477 |
|
else value = getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
1478 |
|
} |
1479 |
+ |
else if(variable == "genMatchedGrandmotherIdReverse"){ |
1480 |
+ |
int index = getGenMatchedParticleIndex(object); |
1481 |
+ |
if(index == -1) value = 23; |
1482 |
+ |
else if(fabs(mcparticles->at(index).motherId) == 15){ |
1483 |
+ |
int motherIndex = findTauMotherIndex(&mcparticles->at(index)); |
1484 |
+ |
if(motherIndex == -1) value = 23; |
1485 |
+ |
else value = 23 - getPdgIdBinValue(mcparticles->at(motherIndex).motherId); |
1486 |
+ |
} |
1487 |
+ |
else value = 23 - getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
1488 |
+ |
} |
1489 |
|
|
1490 |
|
|
1491 |
|
|
1496 |
|
return value; |
1497 |
|
} |
1498 |
|
|
1499 |
< |
|
1499 |
> |
//!electron valueLookup |
1500 |
|
double |
1501 |
|
OSUAnalysis::valueLookup (const BNelectron* object, string variable, string function){ |
1502 |
|
|
1668 |
|
if (met) |
1669 |
|
{ |
1670 |
|
TLorentzVector p1 (object->px, object->py, object->pz, object->energy), |
1671 |
< |
p2 (met->px, met->py, 0.0, met->pt); |
1671 |
> |
p2 (met->px, met->py, 0.0, met->pt); |
1672 |
|
|
1673 |
|
value = (p1 + p2).Mt (); |
1674 |
|
} |
1869 |
|
} |
1870 |
|
else value = getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
1871 |
|
} |
1872 |
+ |
else if(variable == "genMatchedGrandmotherIdReverse"){ |
1873 |
+ |
int index = getGenMatchedParticleIndex(object); |
1874 |
+ |
if(index == -1) value = 23; |
1875 |
+ |
else if(fabs(mcparticles->at(index).motherId) == 15){ |
1876 |
+ |
int motherIndex = findTauMotherIndex(&mcparticles->at(index)); |
1877 |
+ |
if(motherIndex == -1) value = 23; |
1878 |
+ |
else value = 23 - getPdgIdBinValue(mcparticles->at(motherIndex).motherId); |
1879 |
+ |
} |
1880 |
+ |
else value = 23 - getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
1881 |
+ |
} |
1882 |
|
|
1883 |
|
|
1884 |
|
|
1889 |
|
return value; |
1890 |
|
} |
1891 |
|
|
1892 |
< |
|
1892 |
> |
//!event valueLookup |
1893 |
|
double |
1894 |
|
OSUAnalysis::valueLookup (const BNevent* object, string variable, string function){ |
1895 |
|
|
1968 |
|
else if(variable == "muonScaleFactor"){ |
1969 |
|
if(datasetType_ != "data") |
1970 |
|
// value = muonSFWeight_->at (chosenMuon ()->eta); |
1971 |
< |
value = 1.0; |
1971 |
> |
value = 1.0; |
1972 |
|
else |
1973 |
|
value = 1.0; |
1974 |
|
} |
1975 |
|
else if(variable == "electronScaleFactor"){ |
1976 |
|
if(datasetType_ != "data") |
1977 |
|
// value = electronSFWeight_->at (chosenElectron ()->eta, chosenElectron ()->pt); |
1978 |
< |
value = 1.0; |
1978 |
> |
value = 1.0; |
1979 |
|
else |
1980 |
|
value = 1.0; |
1981 |
|
} |
1982 |
+ |
else if(variable == "cTauScaleFactor") |
1983 |
+ |
value = cTauScaleFactor_; |
1984 |
|
|
1985 |
|
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
1986 |
|
|
1989 |
|
return value; |
1990 |
|
} |
1991 |
|
|
1992 |
+ |
//!tau valueLookup |
1993 |
|
double |
1994 |
|
OSUAnalysis::valueLookup (const BNtau* object, string variable, string function){ |
1995 |
|
|
2070 |
|
} |
2071 |
|
else value = getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
2072 |
|
} |
2073 |
+ |
else if(variable == "genMatchedGrandmotherIdReverse"){ |
2074 |
+ |
int index = getGenMatchedParticleIndex(object); |
2075 |
+ |
if(index == -1) value = 23; |
2076 |
+ |
else if(fabs(mcparticles->at(index).motherId) == 15){ |
2077 |
+ |
int motherIndex = findTauMotherIndex(&mcparticles->at(index)); |
2078 |
+ |
if(motherIndex == -1) value = 23; |
2079 |
+ |
else value = 23 - getPdgIdBinValue(mcparticles->at(motherIndex).motherId); |
2080 |
+ |
} |
2081 |
+ |
else value = 23 - getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
2082 |
+ |
} |
2083 |
|
|
2084 |
|
|
2085 |
|
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2089 |
|
return value; |
2090 |
|
} |
2091 |
|
|
2092 |
+ |
//!met valueLookup |
2093 |
|
double |
2094 |
|
OSUAnalysis::valueLookup (const BNmet* object, string variable, string function){ |
2095 |
|
|
2162 |
|
return value; |
2163 |
|
} |
2164 |
|
|
2165 |
+ |
//!track valueLookup |
2166 |
|
double |
2167 |
|
OSUAnalysis::valueLookup (const BNtrack* object, string variable, string function){ |
2168 |
|
|
2169 |
|
double value = 0.0; |
2170 |
|
double pMag = sqrt(object->pt * object->pt + |
2171 |
< |
object->pz * object->pz); |
2172 |
< |
|
2171 |
> |
object->pz * object->pz); |
2172 |
> |
|
2173 |
|
if(variable == "pt") value = object->pt; |
2174 |
|
else if(variable == "px") value = object->px; |
2175 |
|
else if(variable == "py") value = object->py; |
2205 |
|
//user defined variables |
2206 |
|
else if(variable == "d0wrtBS") value = (object->vx-events->at(0).BSx)*object->py/object->pt - (object->vy-events->at(0).BSy)*object->px/object->pt; |
2207 |
|
else if(variable == "dZwrtBS") value = object->dZ - events->at(0).BSz; |
2208 |
< |
else if(variable == "caloTotDeltaRp5") value =(object->caloHadDeltaRp5 + object->caloEMDeltaRp5); |
2209 |
< |
else if(variable == "caloTotDeltaRp5ByP") value =( (object->caloHadDeltaRp5 + object->caloEMDeltaRp5)/pMag); |
2210 |
< |
|
2211 |
< |
|
2212 |
< |
|
2213 |
< |
|
2214 |
< |
|
2215 |
< |
else if(variable == "isIso") value = getTrkIsIso(object, tracks.product()); |
2216 |
< |
else if(variable == "isMatchedDeadEcal") value = getTrkIsMatchedDeadEcal(object); |
2217 |
< |
else if(variable == "ptErrorByPt") value = (object->ptError/object->pt); |
2218 |
< |
else if(variable == "ptError") value = object->ptError; |
2219 |
< |
else if(variable == "ptRes") value = getTrkPtRes(object); |
2220 |
< |
|
2208 |
> |
else if(variable == "caloTotDeltaRp5") value = (object->caloHadDeltaRp5 + object->caloEMDeltaRp5); |
2209 |
> |
else if(variable == "caloTotDeltaRp5ByP") value = ((object->caloHadDeltaRp5 + object->caloEMDeltaRp5)/pMag); |
2210 |
> |
else if(variable == "caloTotDeltaRp5RhoCorr") value = getTrkCaloTotRhoCorr(object); |
2211 |
> |
else if(variable == "caloTotDeltaRp5ByPRhoCorr") value = getTrkCaloTotRhoCorr(object) / pMag; |
2212 |
> |
else if(variable == "isIso") value = getTrkIsIso(object, tracks.product()); |
2213 |
> |
else if(variable == "isMatchedDeadEcal") value = getTrkIsMatchedDeadEcal(object); |
2214 |
> |
else if(variable == "ptErrorByPt") value = (object->ptError/object->pt); |
2215 |
> |
else if(variable == "ptError") value = object->ptError; |
2216 |
> |
else if(variable == "ptRes") value = getTrkPtRes(object); |
2217 |
> |
else if (variable == "d0wrtPV"){ |
2218 |
> |
double vx = object->vx - chosenVertex ()->x, |
2219 |
> |
vy = object->vy - chosenVertex ()->y, |
2220 |
> |
px = object->px, |
2221 |
> |
py = object->py, |
2222 |
> |
pt = object->pt; |
2223 |
> |
value = (-vx * py + vy * px) / pt; |
2224 |
> |
} |
2225 |
> |
else if (variable == "dZwrtPV"){ |
2226 |
> |
double vx = object->vx - chosenVertex ()->x, |
2227 |
> |
vy = object->vy - chosenVertex ()->y, |
2228 |
> |
vz = object->vz - chosenVertex ()->z, |
2229 |
> |
px = object->px, |
2230 |
> |
py = object->py, |
2231 |
> |
pz = object->pz, |
2232 |
> |
pt = object->pt; |
2233 |
> |
value = vz - (vx * px + vy * py)/pt * (pz/pt); |
2234 |
> |
} |
2235 |
|
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
2236 |
|
|
2237 |
|
else if(variable == "genMatchedPdgId"){ |
2266 |
|
} |
2267 |
|
else value = getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
2268 |
|
} |
2269 |
+ |
else if(variable == "genMatchedGrandmotherIdReverse"){ |
2270 |
+ |
int index = getGenMatchedParticleIndex(object); |
2271 |
+ |
if(index == -1) value = 23; |
2272 |
+ |
else if(fabs(mcparticles->at(index).motherId) == 15){ |
2273 |
+ |
int motherIndex = findTauMotherIndex(&mcparticles->at(index)); |
2274 |
+ |
if(motherIndex == -1) value = 23; |
2275 |
+ |
else value = 23 - getPdgIdBinValue(mcparticles->at(motherIndex).motherId); |
2276 |
+ |
} |
2277 |
+ |
else value = 23 - getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
2278 |
+ |
} |
2279 |
|
|
2280 |
|
|
2281 |
|
|
2286 |
|
return value; |
2287 |
|
} |
2288 |
|
|
2289 |
+ |
//!genjet valueLookup |
2290 |
|
double |
2291 |
|
OSUAnalysis::valueLookup (const BNgenjet* object, string variable, string function){ |
2292 |
|
|
2315 |
|
return value; |
2316 |
|
} |
2317 |
|
|
2318 |
+ |
//!mcparticle valueLookup |
2319 |
|
double |
2320 |
|
OSUAnalysis::valueLookup (const BNmcparticle* object, string variable, string function){ |
2321 |
|
|
2449 |
|
return value; |
2450 |
|
} |
2451 |
|
|
2452 |
+ |
//!primaryvertex valueLookup |
2453 |
|
double |
2454 |
|
OSUAnalysis::valueLookup (const BNprimaryvertex* object, string variable, string function){ |
2455 |
|
|
2477 |
|
return value; |
2478 |
|
} |
2479 |
|
|
2480 |
+ |
//!bxlumi valueLookup |
2481 |
|
double |
2482 |
|
OSUAnalysis::valueLookup (const BNbxlumi* object, string variable, string function){ |
2483 |
|
|
2495 |
|
return value; |
2496 |
|
} |
2497 |
|
|
2498 |
+ |
//!photon valueLookup |
2499 |
|
double |
2500 |
|
OSUAnalysis::valueLookup (const BNphoton* object, string variable, string function){ |
2501 |
|
|
2609 |
|
} |
2610 |
|
else value = getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
2611 |
|
} |
2612 |
+ |
else if(variable == "genMatchedGrandmotherIdReverse"){ |
2613 |
+ |
int index = getGenMatchedParticleIndex(object); |
2614 |
+ |
if(index == -1) value = 23; |
2615 |
+ |
else if(fabs(mcparticles->at(index).motherId) == 15){ |
2616 |
+ |
int motherIndex = findTauMotherIndex(&mcparticles->at(index)); |
2617 |
+ |
if(motherIndex == -1) value = 23; |
2618 |
+ |
else value = 23 - getPdgIdBinValue(mcparticles->at(motherIndex).motherId); |
2619 |
+ |
} |
2620 |
+ |
else value = 23 - getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
2621 |
+ |
} |
2622 |
|
|
2623 |
|
|
2624 |
|
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2628 |
|
return value; |
2629 |
|
} |
2630 |
|
|
2631 |
+ |
//!supercluster valueLookup |
2632 |
|
double |
2633 |
|
OSUAnalysis::valueLookup (const BNsupercluster* object, string variable, string function){ |
2634 |
|
|
2651 |
|
return value; |
2652 |
|
} |
2653 |
|
|
2654 |
< |
|
2654 |
> |
//!muon-muon pair valueLookup |
2655 |
|
double |
2656 |
|
OSUAnalysis::valueLookup (const BNmuon* object1, const BNmuon* object2, string variable, string function){ |
2657 |
|
|
2658 |
|
double value = 0.0; |
2659 |
|
|
2660 |
|
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
2661 |
+ |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
2662 |
|
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
2663 |
|
else if(variable == "invMass"){ |
2664 |
|
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
2668 |
|
else if(variable == "pt"){ |
2669 |
|
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
2670 |
|
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
2671 |
< |
value = (fourVector1 + fourVector2).Et(); |
2671 |
> |
value = (fourVector1 + fourVector2).Pt(); |
2672 |
|
} |
2673 |
|
else if(variable == "threeDAngle") |
2674 |
|
{ |
2700 |
|
else if(variable == "muon2CorrectedD0Vertex"){ |
2701 |
|
value = object2->correctedD0Vertex; |
2702 |
|
} |
2703 |
< |
else if(variable == "muon1timeAtIpInOut"){ |
2703 |
> |
else if(variable == "muon1timeAtIpInOut"){ |
2704 |
|
value = object1->timeAtIpInOut; |
2705 |
|
} |
2706 |
< |
else if(variable == "muon2timeAtIpInOut"){ |
2706 |
> |
else if(variable == "muon2timeAtIpInOut"){ |
2707 |
|
value = object2->timeAtIpInOut; |
2708 |
|
} |
2709 |
< |
else if(variable == "muon1correctedD0") |
2710 |
< |
{ |
2711 |
< |
value = object1->correctedD0; |
2712 |
< |
} |
2713 |
< |
else if(variable == "muon2correctedD0") |
2714 |
< |
{ |
2715 |
< |
value = object2->correctedD0; |
2716 |
< |
} |
2709 |
> |
else if(variable == "muon1correctedD0") |
2710 |
> |
{ |
2711 |
> |
value = object1->correctedD0; |
2712 |
> |
} |
2713 |
> |
else if(variable == "muon2correctedD0") |
2714 |
> |
{ |
2715 |
> |
value = object2->correctedD0; |
2716 |
> |
} |
2717 |
|
|
2718 |
|
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2719 |
|
|
2722 |
|
return value; |
2723 |
|
} |
2724 |
|
|
2725 |
+ |
//!electron-electron pair valueLookup |
2726 |
|
double |
2727 |
|
OSUAnalysis::valueLookup (const BNelectron* object1, const BNelectron* object2, string variable, string function){ |
2728 |
|
|
2729 |
|
double value = 0.0; |
2730 |
|
|
2731 |
|
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
2732 |
+ |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
2733 |
|
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
2734 |
|
else if(variable == "invMass"){ |
2735 |
|
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
2739 |
|
else if(variable == "pt"){ |
2740 |
|
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
2741 |
|
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
2742 |
< |
value = (fourVector1 + fourVector2).Et(); |
2742 |
> |
value = (fourVector1 + fourVector2).Pt(); |
2743 |
|
} |
2744 |
|
else if(variable == "threeDAngle") |
2745 |
|
{ |
2778 |
|
return value; |
2779 |
|
} |
2780 |
|
|
2781 |
+ |
//!electron-muon pair valueLookup |
2782 |
|
double |
2783 |
|
OSUAnalysis::valueLookup (const BNelectron* object1, const BNmuon* object2, string variable, string function){ |
2784 |
|
|
2785 |
|
double value = 0.0; |
2786 |
|
|
2787 |
|
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
2788 |
+ |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
2789 |
|
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
2790 |
|
else if(variable == "invMass"){ |
2791 |
|
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
2795 |
|
else if(variable == "pt"){ |
2796 |
|
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
2797 |
|
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
2798 |
< |
value = (fourVector1 + fourVector2).Et(); |
2798 |
> |
value = (fourVector1 + fourVector2).Pt(); |
2799 |
|
} |
2800 |
|
else if(variable == "threeDAngle") |
2801 |
|
{ |
2832 |
|
else if(variable == "muonDetIso"){ |
2833 |
|
value = (object2->trackIsoDR03) / object2->pt; |
2834 |
|
} |
2835 |
+ |
else if(variable == "electronRelPFrhoIso"){ |
2836 |
+ |
value = ( object1->chargedHadronIsoDR03 + max(0.0, object1->neutralHadronIsoDR03 + object1->photonIsoDR03 - object1->AEffDr03*object1->rhoPrime) ) / object1->pt; |
2837 |
+ |
} |
2838 |
+ |
else if(variable == "muonRelPFdBetaIso"){ |
2839 |
+ |
value = (object2->pfIsoR04SumChargedHadronPt + max(0.0, object2->pfIsoR04SumNeutralHadronEt + object2->pfIsoR04SumPhotonEt - 0.5*object2->pfIsoR04SumPUPt)) / object2->pt; |
2840 |
+ |
} |
2841 |
|
|
2842 |
+ |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2843 |
+ |
|
2844 |
+ |
value = applyFunction(function, value); |
2845 |
+ |
|
2846 |
+ |
return value; |
2847 |
+ |
} |
2848 |
+ |
|
2849 |
+ |
//!electron-jet pair valueLookup |
2850 |
+ |
double |
2851 |
+ |
OSUAnalysis::valueLookup (const BNelectron* object1, const BNjet* object2, string variable, string function){ |
2852 |
+ |
|
2853 |
+ |
double value = 0.0; |
2854 |
+ |
|
2855 |
+ |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
2856 |
+ |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
2857 |
+ |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
2858 |
+ |
else if(variable == "invMass"){ |
2859 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
2860 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
2861 |
+ |
value = (fourVector1 + fourVector2).M(); |
2862 |
+ |
} |
2863 |
+ |
else if(variable == "pt"){ |
2864 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
2865 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
2866 |
+ |
value = (fourVector1 + fourVector2).Pt(); |
2867 |
+ |
} |
2868 |
+ |
else if(variable == "threeDAngle") |
2869 |
+ |
{ |
2870 |
+ |
TVector3 threeVector1(object1->px, object1->py, object1->pz); |
2871 |
+ |
TVector3 threeVector2(object2->px, object2->py, object2->pz); |
2872 |
+ |
value = (threeVector1.Angle(threeVector2)); |
2873 |
+ |
} |
2874 |
+ |
else if(variable == "chargeProduct"){ |
2875 |
+ |
value = object1->charge*object2->charge; |
2876 |
+ |
} |
2877 |
+ |
|
2878 |
+ |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2879 |
+ |
|
2880 |
+ |
value = applyFunction(function, value); |
2881 |
+ |
|
2882 |
+ |
return value; |
2883 |
+ |
} |
2884 |
+ |
|
2885 |
+ |
//!muon-jet pair valueLookup |
2886 |
+ |
double |
2887 |
+ |
OSUAnalysis::valueLookup (const BNmuon* object1, const BNjet* object2, string variable, string function){ |
2888 |
+ |
|
2889 |
+ |
double value = 0.0; |
2890 |
+ |
|
2891 |
+ |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
2892 |
+ |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
2893 |
+ |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
2894 |
+ |
else if(variable == "invMass"){ |
2895 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
2896 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
2897 |
+ |
value = (fourVector1 + fourVector2).M(); |
2898 |
+ |
} |
2899 |
+ |
else if(variable == "pt"){ |
2900 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
2901 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
2902 |
+ |
value = (fourVector1 + fourVector2).Pt(); |
2903 |
+ |
} |
2904 |
+ |
else if(variable == "threeDAngle") |
2905 |
+ |
{ |
2906 |
+ |
TVector3 threeVector1(object1->px, object1->py, object1->pz); |
2907 |
+ |
TVector3 threeVector2(object2->px, object2->py, object2->pz); |
2908 |
+ |
value = (threeVector1.Angle(threeVector2)); |
2909 |
+ |
} |
2910 |
+ |
else if(variable == "chargeProduct"){ |
2911 |
+ |
value = object1->charge*object2->charge; |
2912 |
+ |
} |
2913 |
|
|
2914 |
|
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2915 |
|
|
2918 |
|
return value; |
2919 |
|
} |
2920 |
|
|
2921 |
+ |
//!electron-track pair valueLookup |
2922 |
+ |
double |
2923 |
+ |
OSUAnalysis::valueLookup (const BNelectron* object1, const BNtrack* object2, string variable, string function){ |
2924 |
+ |
double electronMass = 0.000511; |
2925 |
+ |
double value = 0.0; |
2926 |
+ |
TLorentzVector fourVector1(0, 0, 0, 0); |
2927 |
+ |
TLorentzVector fourVector2(0, 0, 0, 0); |
2928 |
+ |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
2929 |
+ |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
2930 |
+ |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
2931 |
+ |
else if(variable == "invMass"){ |
2932 |
+ |
fourVector1.SetPtEtaPhiM(object1->pt, object1->eta, object1->phi, electronMass); |
2933 |
+ |
fourVector2.SetPtEtaPhiM(object2->pt, object2->eta, object2->phi, electronMass ); |
2934 |
+ |
|
2935 |
+ |
value = (fourVector1 + fourVector2).M(); |
2936 |
+ |
} |
2937 |
+ |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2938 |
+ |
value = applyFunction(function, value); |
2939 |
+ |
return value; |
2940 |
+ |
} |
2941 |
+ |
|
2942 |
+ |
|
2943 |
+ |
//!muon-track pair valueLookup |
2944 |
+ |
double |
2945 |
+ |
OSUAnalysis::valueLookup (const BNmuon* object1, const BNtrack* object2, string variable, string function){ |
2946 |
+ |
double pionMass = 0.140; |
2947 |
+ |
double muonMass = 0.106; |
2948 |
+ |
double value = 0.0; |
2949 |
+ |
TLorentzVector fourVector1(0, 0, 0, 0); |
2950 |
+ |
TLorentzVector fourVector2(0, 0, 0, 0); |
2951 |
+ |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
2952 |
+ |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
2953 |
+ |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
2954 |
+ |
else if(variable == "invMass"){ |
2955 |
+ |
fourVector1.SetPtEtaPhiM(object1->pt, object1->eta, object1->phi, muonMass); |
2956 |
+ |
fourVector2.SetPtEtaPhiM(object2->pt, object2->eta, object2->phi, pionMass ); |
2957 |
+ |
|
2958 |
+ |
value = (fourVector1 + fourVector2).M(); |
2959 |
+ |
} |
2960 |
+ |
|
2961 |
+ |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2962 |
+ |
value = applyFunction(function, value); |
2963 |
+ |
return value; |
2964 |
+ |
} |
2965 |
+ |
|
2966 |
+ |
//!tau-tau pair valueLookup |
2967 |
+ |
double |
2968 |
+ |
OSUAnalysis::valueLookup (const BNtau* object1, const BNtau* object2, string variable, string function){ |
2969 |
+ |
double value = 0.0; |
2970 |
+ |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
2971 |
+ |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
2972 |
+ |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
2973 |
+ |
else if(variable == "invMass"){ |
2974 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
2975 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
2976 |
+ |
value = (fourVector1 + fourVector2).M(); |
2977 |
+ |
} |
2978 |
+ |
|
2979 |
+ |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2980 |
+ |
value = applyFunction(function, value); |
2981 |
+ |
return value; |
2982 |
+ |
} |
2983 |
+ |
|
2984 |
+ |
//!muon-tau pair valueLookup |
2985 |
+ |
double |
2986 |
+ |
OSUAnalysis::valueLookup (const BNmuon* object1, const BNtau* object2, string variable, string function){ |
2987 |
+ |
double value = 0.0; |
2988 |
+ |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
2989 |
+ |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
2990 |
+ |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
2991 |
+ |
else if(variable == "invMass"){ |
2992 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
2993 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
2994 |
+ |
value = (fourVector1 + fourVector2).M(); |
2995 |
+ |
} |
2996 |
+ |
|
2997 |
+ |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2998 |
+ |
value = applyFunction(function, value); |
2999 |
+ |
return value; |
3000 |
+ |
} |
3001 |
+ |
|
3002 |
+ |
//!tau-track pair valueLookup |
3003 |
+ |
double |
3004 |
+ |
OSUAnalysis::valueLookup (const BNtau* object1, const BNtrack* object2, string variable, string function){ |
3005 |
+ |
double value = 0.0; |
3006 |
+ |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
3007 |
+ |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3008 |
+ |
|
3009 |
+ |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3010 |
+ |
value = applyFunction(function, value); |
3011 |
+ |
return value; |
3012 |
+ |
} |
3013 |
+ |
|
3014 |
+ |
|
3015 |
+ |
//!track-event pair valueLookup |
3016 |
+ |
double |
3017 |
+ |
OSUAnalysis::valueLookup (const BNtrack* object1, const BNevent* object2, string variable, string function){ |
3018 |
+ |
|
3019 |
+ |
double value = 0.0; |
3020 |
+ |
double pMag = sqrt(object1->pt * object1->pt + |
3021 |
+ |
object1->pz * object1->pz); |
3022 |
+ |
|
3023 |
+ |
if (variable == "numPV") value = object2->numPV; |
3024 |
+ |
else if (variable == "caloTotDeltaRp5") value = (object1->caloHadDeltaRp5 + object1->caloEMDeltaRp5); |
3025 |
+ |
else if (variable == "caloTotDeltaRp5ByP") value = ((object1->caloHadDeltaRp5 + object1->caloEMDeltaRp5)/pMag); |
3026 |
+ |
else if (variable == "caloTotDeltaRp5_RhoCorr") value = getTrkCaloTotRhoCorr(object1); |
3027 |
+ |
else if (variable == "caloTotDeltaRp5ByP_RhoCorr") value = getTrkCaloTotRhoCorr(object1) / pMag; |
3028 |
+ |
|
3029 |
+ |
else { std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999; } |
3030 |
+ |
|
3031 |
+ |
value = applyFunction(function, value); |
3032 |
+ |
|
3033 |
+ |
return value; |
3034 |
+ |
|
3035 |
+ |
} |
3036 |
+ |
|
3037 |
+ |
//!stop valueLookup |
3038 |
+ |
double |
3039 |
+ |
OSUAnalysis::valueLookup (const BNstop* object, string variable, string function){ |
3040 |
+ |
|
3041 |
+ |
|
3042 |
+ |
double value = 0.0; |
3043 |
+ |
|
3044 |
+ |
if(variable == "ctau") value = object->ctau; |
3045 |
+ |
|
3046 |
+ |
else if (variable == "d0"){ |
3047 |
+ |
double vx = object->vx - chosenVertex ()->x, |
3048 |
+ |
vy = object->vy - chosenVertex ()->y, |
3049 |
+ |
px = object->px, |
3050 |
+ |
py = object->py, |
3051 |
+ |
pt = object->pt; |
3052 |
+ |
value = (-vx * py + vy * px) / pt; |
3053 |
+ |
} |
3054 |
+ |
|
3055 |
+ |
else if (variable == "dz"){ |
3056 |
+ |
double vx = object->vx - chosenVertex ()->x, |
3057 |
+ |
vy = object->vy - chosenVertex ()->y, |
3058 |
+ |
vz = object->vz - chosenVertex ()->z, |
3059 |
+ |
px = object->px, |
3060 |
+ |
py = object->py, |
3061 |
+ |
pz = object->pz, |
3062 |
+ |
pt = object->pt; |
3063 |
+ |
value = vz - (vx * px + vy * py)/pt * (pz/pt); |
3064 |
+ |
} |
3065 |
+ |
|
3066 |
+ |
else if (variable == "minD0"){ |
3067 |
+ |
double minD0=999; |
3068 |
+ |
for(BNprimaryvertexCollection::const_iterator vertex = primaryvertexs->begin (); vertex != primaryvertexs->end (); vertex++){ |
3069 |
+ |
double vx = object->vx - vertex->x, |
3070 |
+ |
vy = object->vy - vertex->y, |
3071 |
+ |
px = object->px, |
3072 |
+ |
py = object->py, |
3073 |
+ |
pt = object->pt; |
3074 |
+ |
value = (-vx * py + vy * px) / pt; |
3075 |
+ |
if(abs(value) < abs(minD0)) minD0 = value; |
3076 |
+ |
} |
3077 |
+ |
value = minD0; |
3078 |
+ |
} |
3079 |
+ |
else if (variable == "minDz"){ |
3080 |
+ |
double minDz=999; |
3081 |
+ |
for(BNprimaryvertexCollection::const_iterator vertex = primaryvertexs->begin (); vertex != primaryvertexs->end (); vertex++){ |
3082 |
+ |
double vx = object->vx - vertex->x, |
3083 |
+ |
vy = object->vy - vertex->y, |
3084 |
+ |
vz = object->vz - vertex->z, |
3085 |
+ |
px = object->px, |
3086 |
+ |
py = object->py, |
3087 |
+ |
pz = object->pz, |
3088 |
+ |
pt = object->pt; |
3089 |
+ |
value = vz - (vx * px + vy * py)/pt * (pz/pt); |
3090 |
+ |
if(abs(value) < abs(minDz)) minDz = value; |
3091 |
+ |
} |
3092 |
+ |
value = minDz; |
3093 |
+ |
} |
3094 |
+ |
else if(variable == "distToVertex"){ |
3095 |
+ |
value = sqrt((object->vx-chosenVertex()->x)*(object->vx-chosenVertex()->x) + \ |
3096 |
+ |
(object->vy-chosenVertex()->y)*(object->vy-chosenVertex()->y) + \ |
3097 |
+ |
(object->vz-chosenVertex()->z)*(object->vz-chosenVertex()->z)); |
3098 |
+ |
} |
3099 |
+ |
else if (variable == "minDistToVertex"){ |
3100 |
+ |
double minDistToVertex=999; |
3101 |
+ |
for(BNprimaryvertexCollection::const_iterator vertex = primaryvertexs->begin (); vertex != primaryvertexs->end (); vertex++){ |
3102 |
+ |
value = sqrt((object->vx-vertex->x)*(object->vx-vertex->x) + \ |
3103 |
+ |
(object->vy-vertex->y)*(object->vy-vertex->y) + \ |
3104 |
+ |
(object->vz-vertex->z)*(object->vz-vertex->z)); |
3105 |
+ |
|
3106 |
+ |
if(abs(value) < abs(minDistToVertex)) minDistToVertex = value; |
3107 |
+ |
} |
3108 |
+ |
value = minDistToVertex; |
3109 |
+ |
} |
3110 |
+ |
else if (variable == "distToVertexDifference"){ |
3111 |
+ |
double minDistToVertex=999; |
3112 |
+ |
for(BNprimaryvertexCollection::const_iterator vertex = primaryvertexs->begin (); vertex != primaryvertexs->end (); vertex++){ |
3113 |
+ |
value = sqrt((object->vx-vertex->x)*(object->vx-vertex->x) + \ |
3114 |
+ |
(object->vy-vertex->y)*(object->vy-vertex->y) + \ |
3115 |
+ |
(object->vz-vertex->z)*(object->vz-vertex->z)); |
3116 |
+ |
|
3117 |
+ |
if(abs(value) < abs(minDistToVertex)) minDistToVertex = value; |
3118 |
+ |
} |
3119 |
+ |
double distToChosenVertex = sqrt((object->vx-chosenVertex()->x)*(object->vx-chosenVertex()->x) + \ |
3120 |
+ |
(object->vy-chosenVertex()->y)*(object->vy-chosenVertex()->y) + \ |
3121 |
+ |
(object->vz-chosenVertex()->z)*(object->vz-chosenVertex()->z)); |
3122 |
+ |
|
3123 |
+ |
value = distToChosenVertex - minDistToVertex; |
3124 |
+ |
} |
3125 |
+ |
|
3126 |
+ |
else if (variable == "closestVertexRank"){ |
3127 |
+ |
double minDistToVertex=999; |
3128 |
+ |
int vertex_rank = 0; |
3129 |
+ |
for(BNprimaryvertexCollection::const_iterator vertex = primaryvertexs->begin (); vertex != primaryvertexs->end (); vertex++){ |
3130 |
+ |
vertex_rank++; |
3131 |
+ |
int dist = sqrt((object->vx-vertex->x)*(object->vx-vertex->x) + \ |
3132 |
+ |
(object->vy-vertex->y)*(object->vy-vertex->y) + \ |
3133 |
+ |
(object->vz-vertex->z)*(object->vz-vertex->z)); |
3134 |
+ |
|
3135 |
+ |
if(abs(dist) < abs(minDistToVertex)){ |
3136 |
+ |
value = vertex_rank; |
3137 |
+ |
minDistToVertex = dist; |
3138 |
+ |
} |
3139 |
+ |
} |
3140 |
+ |
} |
3141 |
+ |
|
3142 |
+ |
|
3143 |
+ |
|
3144 |
+ |
|
3145 |
+ |
else { std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999; } |
3146 |
+ |
|
3147 |
+ |
value = applyFunction(function, value); |
3148 |
+ |
|
3149 |
+ |
return value; |
3150 |
+ |
|
3151 |
+ |
} |
3152 |
+ |
|
3153 |
+ |
|
3154 |
+ |
|
3155 |
|
|
3156 |
|
// Calculate the number of tracks in cone of DeltaR<0.5 around track1. |
3157 |
|
// Return true iff no other tracks are found in this cone. |
3198 |
|
|
3199 |
|
} |
3200 |
|
|
3201 |
+ |
double |
3202 |
+ |
OSUAnalysis::getTrkCaloTotRhoCorr(const BNtrack* track) { |
3203 |
+ |
// Return the pile-up (rho) corrected isolation energy, i.e., the total calorimeter energy around the candidate track. |
3204 |
+ |
if (!useTrackCaloRhoCorr_) return -99; |
3205 |
+ |
// if (!rhokt6CaloJetsHandle_) { |
3206 |
+ |
// cout << "ERROR [getTrkCaloTotRhoCorr]: The collection rhokt6CaloJetsHandle is not available!" << endl; |
3207 |
+ |
// return -99; |
3208 |
+ |
// } |
3209 |
+ |
double radDeltaRCone = 0.5; |
3210 |
+ |
double rhoCorr_kt6CaloJets = *rhokt6CaloJetsHandle_ * TMath::Pi() * pow(radDeltaRCone, 2); // Define effective area as pi*r^2, where r is radius of DeltaR cone. |
3211 |
+ |
double rawCaloTot = track->caloHadDeltaRp5 + track->caloEMDeltaRp5; |
3212 |
+ |
double caloTotRhoCorrCalo = TMath::Max(0., rawCaloTot - rhoCorr_kt6CaloJets); |
3213 |
+ |
return caloTotRhoCorrCalo; |
3214 |
+ |
|
3215 |
+ |
} |
3216 |
+ |
|
3217 |
+ |
|
3218 |
+ |
|
3219 |
+ |
|
3220 |
|
//creates a map of the dead Ecal channels in the barrel and endcap |
3221 |
|
//to see how the map of dead Ecal channels is created look at function getChannelStatusMaps() here: |
3222 |
|
//http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/UserCode/jbrinson/DisappTrk/OSUT3Analysis/AnaTools/src/OSUAnalysis.cc?revision=1.88&view=markup |
3267 |
|
for(BNmcparticleCollection::const_iterator mcparticle = mcparticles->begin (); mcparticle != mcparticles->end (); mcparticle++){ |
3268 |
|
double deltaRtemp = deltaR(mcparticle->eta, mcparticle->phi, object->eta, object->phi); |
3269 |
|
if (deltaRtemp < genDeltaRLowest) genDeltaRLowest = deltaRtemp; |
3270 |
< |
} |
3270 |
> |
} |
3271 |
|
return genDeltaRLowest; |
3272 |
|
} |
3273 |
|
|
3289 |
|
|
3290 |
|
template <class InputCollection> |
3291 |
|
void OSUAnalysis::setObjectFlags(cut ¤tCut, uint currentCutIndex, flagMap &individualFlags, flagMap &cumulativeFlags, InputCollection inputCollection, string inputType){ |
3292 |
< |
|
3292 |
> |
|
3293 |
> |
if (currentCut.inputCollection.find("pair")!=std::string::npos) { |
3294 |
> |
string obj1, obj2; |
3295 |
> |
getTwoObjs(currentCut.inputCollection, obj1, obj2); |
3296 |
> |
if (inputType==obj1 || |
3297 |
> |
inputType==obj2) { |
3298 |
> |
// Do not add a cut to individualFlags or cumulativeFlags, if the cut is on a paired collection, |
3299 |
> |
// and the inputType is a member of the pair. |
3300 |
> |
// The cut will instead be applied when the setObjectFlags() is called for the paired collection. |
3301 |
> |
// For example, if currentCut.inputCollection==electron-muon pairs, |
3302 |
> |
// then the flags should not be set here when inputType==muons or inputType==electrons. |
3303 |
> |
return; |
3304 |
> |
} |
3305 |
> |
} |
3306 |
|
|
3307 |
|
for (uint object = 0; object != inputCollection->size(); object++){ |
3308 |
|
|
2650 |
– |
|
3309 |
|
bool decision = true;//object passes if this cut doesn't cut on that type of object |
3310 |
|
|
2653 |
– |
|
3311 |
|
if(currentCut.inputCollection == inputType){ |
3312 |
|
|
3313 |
|
vector<bool> subcutDecisions; |
3314 |
|
for( int subcutIndex = 0; subcutIndex != currentCut.numSubcuts; subcutIndex++){ |
3315 |
|
double value = valueLookup(&inputCollection->at(object), currentCut.variables.at(subcutIndex), currentCut.functions.at(subcutIndex)); |
3316 |
|
subcutDecisions.push_back(evaluateComparison(value,currentCut.comparativeOperators.at(subcutIndex),currentCut.cutValues.at(subcutIndex))); |
3317 |
+ |
|
3318 |
|
} |
3319 |
|
if(currentCut.numSubcuts == 1) decision = subcutDecisions.at(0); |
3320 |
|
else{ |
3328 |
|
decision = tempDecision; |
3329 |
|
} |
3330 |
|
} |
2673 |
– |
individualFlags.at(inputType).at(currentCutIndex).push_back(decision); |
3331 |
|
|
3332 |
+ |
individualFlags.at(inputType).at(currentCutIndex).push_back(decision); |
3333 |
|
|
3334 |
|
//set flags for objects that pass each cut AND all the previous cuts |
3335 |
|
bool previousCumulativeFlag = true; |
3339 |
|
} |
3340 |
|
cumulativeFlags.at(inputType).at(currentCutIndex).push_back(previousCumulativeFlag && decision); |
3341 |
|
|
2684 |
– |
|
3342 |
|
} |
3343 |
|
|
3344 |
|
} |
3352 |
|
bool sameObjects = false; |
3353 |
|
if(typeid(InputCollection1).name() == typeid(InputCollection2).name()) sameObjects = true; |
3354 |
|
|
3355 |
< |
|
3355 |
> |
// Get the strings for the two objects that make up the pair. |
3356 |
> |
string obj1Type, obj2Type; |
3357 |
> |
getTwoObjs(inputType, obj1Type, obj2Type); |
3358 |
> |
bool isTwoTypesOfObject = true; |
3359 |
> |
if (obj1Type==obj2Type) isTwoTypesOfObject = false; |
3360 |
> |
|
3361 |
> |
// Initialize the flags for individual objects to all be false, if the cut is on the pair. |
3362 |
> |
// Set them to true later, if any paired object passes (in which case both of its constituents should pass). |
3363 |
> |
if (currentCut.inputCollection == inputType) { |
3364 |
> |
for (uint object1 = 0; object1 != inputCollection1->size(); object1++) { |
3365 |
> |
individualFlags.at(obj1Type).at(currentCutIndex).push_back(false); |
3366 |
> |
cumulativeFlags.at(obj1Type).at(currentCutIndex).push_back(false); |
3367 |
> |
} |
3368 |
> |
if (isTwoTypesOfObject) { // Only initialize the second object if it is different from the first. |
3369 |
> |
for (uint object2 = 0; object2 != inputCollection2->size(); object2++) { |
3370 |
> |
individualFlags.at(obj2Type).at(currentCutIndex).push_back(false); |
3371 |
> |
cumulativeFlags.at(obj2Type).at(currentCutIndex).push_back(false); |
3372 |
> |
} |
3373 |
> |
} |
3374 |
> |
} |
3375 |
> |
|
3376 |
|
int counter = 0; |
3377 |
+ |
|
3378 |
|
for (uint object1 = 0; object1 != inputCollection1->size(); object1++){ |
3379 |
|
for (uint object2 = 0; object2 != inputCollection2->size(); object2++){ |
3380 |
|
|
3403 |
|
decision = tempDecision; |
3404 |
|
} |
3405 |
|
} |
3406 |
< |
individualFlags.at(inputType).at(currentCutIndex).push_back(decision); |
3406 |
> |
// if (decision) isPassObj1.at(object1) = true; |
3407 |
> |
// if (decision) isPassObj2.at(object2) = true; |
3408 |
> |
individualFlags.at(inputType).at(currentCutIndex).push_back(decision); |
3409 |
> |
if (decision && currentCut.inputCollection == inputType) { // only set the flags for the individual objects if the pair object is being cut on |
3410 |
> |
individualFlags.at(obj1Type).at(currentCutIndex).at(object1) = true; |
3411 |
> |
individualFlags.at(obj2Type).at(currentCutIndex).at(object2) = true; |
3412 |
> |
} |
3413 |
|
|
3414 |
|
//set flags for objects that pass each cut AND all the previous cuts |
3415 |
|
bool previousCumulativeFlag = true; |
3424 |
|
else if(flags2.size() == 0) currentCumulativeFlag = previousCumulativeFlag && decision && flags1.at(object1); |
3425 |
|
else currentCumulativeFlag = previousCumulativeFlag && decision && flags1.at(object1) && flags2.at(object2); |
3426 |
|
cumulativeFlags.at(inputType).at(currentCutIndex).push_back(currentCumulativeFlag); |
3427 |
< |
|
3427 |
> |
if (currentCumulativeFlag && currentCut.inputCollection == inputType) { // only set the flags for the individual objects if the pair object is being cut on |
3428 |
> |
cumulativeFlags.at(obj1Type).at(currentCutIndex).at(object1) = true && getPreviousCumulativeFlags(currentCutIndex, individualFlags, obj1Type, object1); |
3429 |
> |
cumulativeFlags.at(obj2Type).at(currentCutIndex).at(object2) = true && getPreviousCumulativeFlags(currentCutIndex, individualFlags, obj2Type, object2); |
3430 |
> |
} |
3431 |
|
counter++; |
2745 |
– |
} |
2746 |
– |
|
2747 |
– |
} |
3432 |
|
|
3433 |
+ |
} // end for (uint object2 = 0; object2 != inputCollection2->size(); object2++){ |
3434 |
+ |
} // end for (uint object1 = 0; object1 != inputCollection1->size(); object1++){ |
3435 |
|
|
3436 |
|
} |
3437 |
|
|
3438 |
|
|
3439 |
+ |
bool OSUAnalysis::getPreviousCumulativeFlags(uint currentCutIndex, flagMap &individualFlags, string obj1Type, uint object1) { |
3440 |
+ |
// Return true iff for the collection obj1Type, the element with index object1 has individal flags set to true for |
3441 |
+ |
// all cuts up to currentCutIndex |
3442 |
+ |
bool previousCumulativeFlag = true; |
3443 |
+ |
for (uint previousCutIndex = 0; previousCutIndex < currentCutIndex; previousCutIndex++) { |
3444 |
+ |
if (previousCumulativeFlag && individualFlags.at(obj1Type).at(previousCutIndex).at(object1)) previousCumulativeFlag = true; |
3445 |
+ |
else { |
3446 |
+ |
previousCumulativeFlag = false; break; |
3447 |
+ |
} |
3448 |
+ |
} |
3449 |
+ |
return previousCumulativeFlag; |
3450 |
+ |
} |
3451 |
+ |
|
3452 |
+ |
|
3453 |
|
template <class InputCollection> |
3454 |
|
void OSUAnalysis::fill1DHistogram(TH1* histo, histogram parameters, InputCollection inputCollection,vector<bool> flags, double scaleFactor){ |
3455 |
|
|
3486 |
|
bool sameObjects = false; |
3487 |
|
if(typeid(InputCollection1).name() == typeid(InputCollection2).name()) sameObjects = true; |
3488 |
|
|
3489 |
< |
int pairCounter = 0; |
3489 |
> |
int pairCounter = -1; |
3490 |
|
for (uint object1 = 0; object1 != inputCollection1->size(); object1++){ |
3491 |
|
for (uint object2 = 0; object2 != inputCollection2->size(); object2++){ |
3492 |
|
|
3493 |
|
if(sameObjects && object1 >= object2) continue;//account for duplicate pairs if both collections are the same |
3494 |
|
|
3495 |
+ |
pairCounter++; |
3496 |
|
//only take objects which have passed all cuts and pairs which have passed all cuts |
3497 |
|
if(!plotAllObjectsInPassingEvents_ && !flags1.at(object1)) continue; |
3498 |
|
if(!plotAllObjectsInPassingEvents_ && !flags2.at(object2)) continue; |
3513 |
|
double value = valueLookup(&inputCollection1->at(object1), &inputCollection2->at(object2), inputVariable, function); |
3514 |
|
histo->Fill(value,scaleFactor); |
3515 |
|
|
2815 |
– |
pairCounter++; |
3516 |
|
} |
3517 |
|
} |
3518 |
|
|
3565 |
|
bool sameObjects = false; |
3566 |
|
if(typeid(InputCollection1).name() == typeid(InputCollection2).name()) sameObjects = true; |
3567 |
|
|
3568 |
< |
int pairCounter = 0; |
3568 |
> |
int pairCounter = -1; |
3569 |
|
for (uint object1 = 0; object1 != inputCollection1->size(); object1++){ |
3570 |
|
for (uint object2 = 0; object2 != inputCollection2->size(); object2++){ |
3571 |
|
|
3572 |
|
if(sameObjects && object1 >= object2) continue;//account for duplicate pairs if both collections are the same |
3573 |
|
|
3574 |
+ |
pairCounter++; |
3575 |
+ |
|
3576 |
|
//only take objects which have passed all cuts and pairs which have passed all cuts |
3577 |
|
if(!plotAllObjectsInPassingEvents_ && !flags1.at(object1)) continue; |
3578 |
|
if(!plotAllObjectsInPassingEvents_ && !flags2.at(object2)) continue; |
3607 |
|
|
3608 |
|
histo->Fill(valueX,valueY,scaleFactor); |
3609 |
|
|
2908 |
– |
pairCounter++; |
2909 |
– |
|
3610 |
|
} |
3611 |
|
} |
3612 |
|
|
3623 |
|
|
3624 |
|
double currentDeltaR = deltaR(object->eta,object->phi,mcparticle->eta,mcparticle->phi); |
3625 |
|
if(currentDeltaR > 0.05) continue; |
3626 |
< |
// cout << std::setprecision(3) << std::setw(20) |
3627 |
< |
// << "\tcurrentParticle: eta = " << mcparticles->at(mcparticle - mcparticles->begin()).eta |
3628 |
< |
// << std::setw(20) |
3629 |
< |
// << "\tphi = " << mcparticles->at(mcparticle - mcparticles->begin()).phi |
3630 |
< |
// << std::setw(20) |
3631 |
< |
// << "\tdeltaR = " << currentDeltaR |
3632 |
< |
// << std::setprecision(1) |
3633 |
< |
// << std::setw(20) |
3634 |
< |
// << "\tid = " << mcparticles->at(mcparticle - mcparticles->begin()).id |
3635 |
< |
// << std::setw(20) |
3636 |
< |
// << "\tmotherId = " << mcparticles->at(mcparticle - mcparticles->begin()).motherId |
3637 |
< |
// << std::setw(20) |
3638 |
< |
// << "\tstatus = " << mcparticles->at(mcparticle - mcparticles->begin()).status<< endl; |
3626 |
> |
// cout << std::setprecision(3) << std::setw(20) |
3627 |
> |
// << "\tcurrentParticle: eta = " << mcparticles->at(mcparticle - mcparticles->begin()).eta |
3628 |
> |
// << std::setw(20) |
3629 |
> |
// << "\tphi = " << mcparticles->at(mcparticle - mcparticles->begin()).phi |
3630 |
> |
// << std::setw(20) |
3631 |
> |
// << "\tdeltaR = " << currentDeltaR |
3632 |
> |
// << std::setprecision(1) |
3633 |
> |
// << std::setw(20) |
3634 |
> |
// << "\tid = " << mcparticles->at(mcparticle - mcparticles->begin()).id |
3635 |
> |
// << std::setw(20) |
3636 |
> |
// << "\tmotherId = " << mcparticles->at(mcparticle - mcparticles->begin()).motherId |
3637 |
> |
// << std::setw(20) |
3638 |
> |
// << "\tstatus = " << mcparticles->at(mcparticle - mcparticles->begin()).status<< endl; |
3639 |
|
if(currentDeltaR < bestMatchDeltaR && mcparticles->at(mcparticle - mcparticles->begin()).id != mcparticles->at(mcparticle - mcparticles->begin()).motherId){ |
3640 |
|
bestMatchIndex = mcparticle - mcparticles->begin(); |
3641 |
|
bestMatchDeltaR = currentDeltaR; |
3642 |
|
} |
3643 |
|
|
3644 |
|
} |
3645 |
< |
// if(bestMatchDeltaR != 999) cout << "bestMatch: deltaR = " << bestMatchDeltaR << " id = " << mcparticles->at(bestMatchIndex).id << " motherId = " << mcparticles->at(bestMatchIndex).motherId << endl; |
3646 |
< |
// else cout << "no match found..." << endl; |
3645 |
> |
// if(bestMatchDeltaR != 999) cout << "bestMatch: deltaR = " << bestMatchDeltaR << " id = " << mcparticles->at(bestMatchIndex).id << " motherId = " << mcparticles->at(bestMatchIndex).motherId << endl; |
3646 |
> |
// else cout << "no match found..." << endl; |
3647 |
|
return bestMatchIndex; |
3648 |
|
|
3649 |
|
} |
3734 |
|
const BNprimaryvertex *chosenVertex = 0; |
3735 |
|
if(std::find(objectsToCut.begin(), objectsToCut.end(), "primaryvertexs") != objectsToCut.end()) { |
3736 |
|
vector<bool> vertexFlags = cumulativeFlags.at("primaryvertexs").back().size() ? cumulativeFlags.at("primaryvertexs").back() : |
3737 |
< |
cumulativeFlags.at("primaryvertexs").at(cumulativeFlags.at("primaryvertexs").size() - 2); |
3737 |
> |
cumulativeFlags.at("primaryvertexs").at(cumulativeFlags.at("primaryvertexs").size() - 2); |
3738 |
|
for (uint vertexIndex = 0; vertexIndex != vertexFlags.size(); vertexIndex++){ |
3739 |
|
if(!vertexFlags.at(vertexIndex)) continue; |
3740 |
|
chosenVertex = & primaryvertexs->at(vertexIndex); |
3754 |
|
const BNmet *chosenMET = 0; |
3755 |
|
if(std::find(objectsToCut.begin(), objectsToCut.end(), "mets") != objectsToCut.end()) { |
3756 |
|
vector<bool> metFlags = cumulativeFlags.at("mets").back().size() ? cumulativeFlags.at("mets").back() : |
3757 |
< |
cumulativeFlags.at("mets").at(cumulativeFlags.at("mets").size() - 2); |
3757 |
> |
cumulativeFlags.at("mets").at(cumulativeFlags.at("mets").size() - 2); |
3758 |
|
for (uint metIndex = 0; metIndex != metFlags.size(); metIndex++){ |
3759 |
|
if(!metFlags.at(metIndex)) continue; |
3760 |
|
chosenMET = & mets->at(metIndex); |
3774 |
|
const BNelectron *chosenElectron = 0; |
3775 |
|
if(std::find(objectsToCut.begin(), objectsToCut.end(), "electrons") != objectsToCut.end()) { |
3776 |
|
vector<bool> electronFlags = cumulativeFlags.at("electrons").back().size() ? cumulativeFlags.at("electrons").back() : |
3777 |
< |
cumulativeFlags.at("electrons").at(cumulativeFlags.at("electrons").size() - 2); |
3777 |
> |
cumulativeFlags.at("electrons").at(cumulativeFlags.at("electrons").size() - 2); |
3778 |
|
for (uint electronIndex = 0; electronIndex != electronFlags.size(); electronIndex++){ |
3779 |
|
if(!electronFlags.at(electronIndex)) continue; |
3780 |
|
chosenElectron = & electrons->at(electronIndex); |
3794 |
|
const BNmuon *chosenMuon = 0; |
3795 |
|
if(std::find(objectsToCut.begin(), objectsToCut.end(), "muons") != objectsToCut.end()) { |
3796 |
|
vector<bool> muonFlags = cumulativeFlags.at("muons").back().size() ? cumulativeFlags.at("muons").back() : |
3797 |
< |
cumulativeFlags.at("muons").at(cumulativeFlags.at("muons").size() - 2); |
3797 |
> |
cumulativeFlags.at("muons").at(cumulativeFlags.at("muons").size() - 2); |
3798 |
|
for (uint muonIndex = 0; muonIndex != muonFlags.size(); muonIndex++){ |
3799 |
|
if(!muonFlags.at(muonIndex)) continue; |
3800 |
|
chosenMuon = & muons->at(muonIndex); |