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")), |
28 |
|
channels_ (cfg.getParameter<vector<edm::ParameterSet> >("channels")), |
29 |
|
histogramSets_ (cfg.getParameter<vector<edm::ParameterSet> >("histogramSets")), |
30 |
|
plotAllObjectsInPassingEvents_ (cfg.getParameter<bool> ("plotAllObjectsInPassingEvents")), |
31 |
< |
doPileupReweighting_ (cfg.getParameter<bool> ("doPileupReweighting")) |
31 |
> |
doPileupReweighting_ (cfg.getParameter<bool> ("doPileupReweighting")), |
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 (); |
40 |
|
//create pile-up reweighting object, if necessary |
41 |
|
if(datasetType_ != "data") { |
42 |
|
if(doPileupReweighting_) puWeight_ = new PUWeight (puFile_, dataPU_, dataset_); |
43 |
< |
muonSFWeight_ = new MuonSFWeight (muonSFFile_, muonSF_); |
44 |
< |
electronSFWeight_ = new ElectronSFWeight ("53X", electronSFID_); |
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 |
53 |
|
// handle filling cut flow histograms. |
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 == "event-track pairs") tempInputCollection = "track-event pairs"; |
75 |
+ |
if(tempInputCollection == "secondary muon-muon pairs") tempInputCollection = "muon-secondary muon pairs"; |
76 |
|
if(tempInputCollection.find("pairs")==std::string::npos){ //just a single object |
77 |
< |
objectsToGet.push_back(tempInputCollection); |
77 |
> |
if(tempInputCollection.find("secondary")!=std::string::npos){//secondary object |
78 |
> |
int spaceIndex = tempInputCollection.find(" "); |
79 |
> |
int secondWordLength = tempInputCollection.size() - spaceIndex; |
80 |
> |
objectsToGet.push_back(tempInputCollection.substr(spaceIndex+1,secondWordLength)); |
81 |
> |
} |
82 |
> |
else{ |
83 |
> |
objectsToGet.push_back(tempInputCollection); |
84 |
> |
} |
85 |
|
objectsToPlot.push_back(tempInputCollection); |
86 |
|
objectsToCut.push_back(tempInputCollection); |
87 |
|
} |
88 |
< |
else{//pair of objects, need to add them both to the things to objectsToGet |
88 |
> |
else{//pair of objects, need to add the pair and the individual objects to the lists of things to Get/Plot/Cut |
89 |
|
int dashIndex = tempInputCollection.find("-"); |
90 |
< |
int spaceIndex = tempInputCollection.find(" "); |
90 |
> |
int spaceIndex = tempInputCollection.find_last_of(" "); |
91 |
|
int secondWordLength = spaceIndex - dashIndex; |
92 |
|
objectsToGet.push_back(tempInputCollection); |
93 |
|
objectsToGet.push_back(tempInputCollection.substr(0,dashIndex)+"s"); |
94 |
< |
objectsToGet.push_back(tempInputCollection.substr(dashIndex+1,secondWordLength-1)+"s"); |
94 |
> |
if(tempInputCollection.find("secondary")!=std::string::npos){//secondary object |
95 |
> |
int firstSpaceIndex = tempInputCollection.find_first_of(" "); |
96 |
> |
int splitWordLength = spaceIndex - firstSpaceIndex; |
97 |
> |
objectsToGet.push_back(tempInputCollection.substr(firstSpaceIndex,splitWordLength-1)+"s"); |
98 |
> |
} |
99 |
> |
else{ |
100 |
> |
objectsToGet.push_back(tempInputCollection.substr(dashIndex+1,secondWordLength-1)+"s"); |
101 |
> |
} |
102 |
|
objectsToPlot.push_back(tempInputCollection); |
103 |
|
objectsToPlot.push_back(tempInputCollection.substr(0,dashIndex)+"s"); |
104 |
|
objectsToPlot.push_back(tempInputCollection.substr(dashIndex+1,secondWordLength-1)+"s"); |
106 |
|
objectsToCut.push_back(tempInputCollection.substr(0,dashIndex)+"s"); |
107 |
|
objectsToCut.push_back(tempInputCollection.substr(dashIndex+1,secondWordLength-1)+"s"); |
108 |
|
|
109 |
< |
} |
109 |
> |
} |
110 |
|
|
111 |
|
vector<edm::ParameterSet> histogramList_ (histogramSets_.at(currentHistogramSet).getParameter<vector<edm::ParameterSet> >("histograms")); |
112 |
|
|
133 |
|
for(uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){ |
134 |
|
|
135 |
|
string currentObject = objectsToPlot.at(currentObjectIndex); |
136 |
< |
if(currentObject != "muons" && currentObject != "electrons" && currentObject != "taus" && currentObject != "tracks" && currentObject != "photons" && currentObject != "superclusters") continue; |
136 |
> |
if(currentObject != "muons" && currentObject != "secondary muons" && currentObject != "electrons" && currentObject != "taus" && currentObject != "tracks" && currentObject != "photons" && currentObject != "superclusters") continue; |
137 |
|
|
138 |
|
histogram tempIdHisto; |
139 |
|
histogram tempMomIdHisto; |
140 |
|
histogram tempGmaIdHisto; |
141 |
+ |
histogram tempIdVsMomIdHisto; |
142 |
|
|
143 |
|
tempIdHisto.inputCollection = currentObject; |
144 |
|
tempMomIdHisto.inputCollection = currentObject; |
145 |
|
tempGmaIdHisto.inputCollection = currentObject; |
146 |
+ |
tempIdVsMomIdHisto.inputCollection = currentObject; |
147 |
+ |
|
148 |
+ |
if(currentObject == "secondary muons") currentObject = "secondaryMuons"; |
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 |
|
|
156 |
|
currentObject.at(0) = toupper(currentObject.at(0)); |
157 |
|
tempIdHisto.title = currentObject+" Gen-matched Particle"; |
158 |
|
tempMomIdHisto.title = currentObject+" Gen-matched Particle's Mother"; |
159 |
|
tempGmaIdHisto.title = currentObject+" Gen-matched Particle's Grandmother"; |
160 |
+ |
tempIdVsMomIdHisto.title = currentObject+" Gen-matched Particle's Mother vs. Particle;Particle;Mother"; |
161 |
|
|
162 |
|
int maxNum = 24; |
163 |
|
vector<double> binVector; |
171 |
|
tempMomIdHisto.inputVariables.push_back("genMatchedMotherId"); |
172 |
|
tempGmaIdHisto.bins = binVector; |
173 |
|
tempGmaIdHisto.inputVariables.push_back("genMatchedGrandmotherId"); |
174 |
+ |
binVector.push_back(maxNum); |
175 |
+ |
binVector.push_back(0); |
176 |
+ |
binVector.push_back(maxNum); |
177 |
+ |
tempIdVsMomIdHisto.bins = binVector; |
178 |
+ |
tempIdVsMomIdHisto.inputVariables.push_back("genMatchedId"); |
179 |
+ |
tempIdVsMomIdHisto.inputVariables.push_back("genMatchedMotherIdReverse"); |
180 |
|
|
181 |
|
histograms.push_back(tempIdHisto); |
182 |
|
histograms.push_back(tempMomIdHisto); |
183 |
|
histograms.push_back(tempGmaIdHisto); |
184 |
< |
|
184 |
> |
histograms.push_back(tempIdVsMomIdHisto); |
185 |
|
} |
186 |
|
|
187 |
|
|
150 |
– |
|
188 |
|
channel tempChannel; |
189 |
|
//loop over all channels (event selections) |
190 |
|
for(uint currentChannel = 0; currentChannel != channels_.size(); currentChannel++){ |
221 |
|
twoDHists_.push_back(twoDhistoMap); |
222 |
|
|
223 |
|
|
224 |
+ |
|
225 |
|
//book all histograms included in the configuration |
226 |
|
for(uint currentHistogramIndex = 0; currentHistogramIndex != histograms.size(); currentHistogramIndex++){ |
227 |
|
histogram currentHistogram = histograms.at(currentHistogramIndex); |
247 |
|
|
248 |
|
if(currentHistogram.name.find("GenMatch")==std::string::npos) continue; |
249 |
|
|
250 |
< |
// bin particle type |
251 |
< |
// --- ------------- |
252 |
< |
// 0 unmatched |
253 |
< |
// 1 u |
254 |
< |
// 2 d |
255 |
< |
// 3 s |
256 |
< |
// 4 c |
257 |
< |
// 5 b |
258 |
< |
// 6 t |
259 |
< |
// 7 e |
260 |
< |
// 8 mu |
261 |
< |
// 9 tau |
262 |
< |
// 10 nu |
263 |
< |
// 11 g |
264 |
< |
// 12 gamma |
265 |
< |
// 13 Z |
266 |
< |
// 14 W |
267 |
< |
// 15 light meson |
268 |
< |
// 16 K meson |
269 |
< |
// 17 D meson |
270 |
< |
// 18 B meson |
271 |
< |
// 19 light baryon |
272 |
< |
// 20 strange baryon |
273 |
< |
// 21 charm baryon |
274 |
< |
// 22 bottom baryon |
275 |
< |
// 23 other |
250 |
> |
// bin particle type |
251 |
> |
// --- ------------- |
252 |
> |
// 0 unmatched |
253 |
> |
// 1 u |
254 |
> |
// 2 d |
255 |
> |
// 3 s |
256 |
> |
// 4 c |
257 |
> |
// 5 b |
258 |
> |
// 6 t |
259 |
> |
// 7 e |
260 |
> |
// 8 mu |
261 |
> |
// 9 tau |
262 |
> |
// 10 nu |
263 |
> |
// 11 g |
264 |
> |
// 12 gamma |
265 |
> |
// 13 Z |
266 |
> |
// 14 W |
267 |
> |
// 15 light meson |
268 |
> |
// 16 K meson |
269 |
> |
// 17 D meson |
270 |
> |
// 18 B meson |
271 |
> |
// 19 light baryon |
272 |
> |
// 20 strange baryon |
273 |
> |
// 21 charm baryon |
274 |
> |
// 22 bottom baryon |
275 |
> |
// 23 other |
276 |
|
|
277 |
|
vector<TString> labelArray; |
278 |
|
labelArray.push_back("unmatched"); |
301 |
|
labelArray.push_back("other"); |
302 |
|
|
303 |
|
for(int bin = 0; bin !=currentHistogram.bins.at(0); bin++){ |
304 |
< |
oneDHists_.at(currentChannel)[currentHistogram.name]->GetXaxis()->SetBinLabel(bin+1,labelArray.at(bin)); |
304 |
> |
if(currentHistogram.name.find("GenMatchIdVsMotherId")==std::string::npos) { |
305 |
> |
oneDHists_.at(currentChannel)[currentHistogram.name]->GetXaxis()->SetBinLabel(bin+1,labelArray.at(bin)); |
306 |
> |
} |
307 |
> |
else { |
308 |
> |
twoDHists_.at(currentChannel)[currentHistogram.name]->GetYaxis()->SetBinLabel(bin+1,labelArray.at(currentHistogram.bins.at(0)-bin-1)); |
309 |
> |
twoDHists_.at(currentChannel)[currentHistogram.name]->GetXaxis()->SetBinLabel(bin+1,labelArray.at(bin)); |
310 |
> |
} |
311 |
> |
} |
312 |
> |
if(currentHistogram.name.find("GenMatchIdVsMotherId")!=std::string::npos) { |
313 |
> |
twoDHists_.at(currentChannel)[currentHistogram.name]->GetXaxis()->CenterTitle(); |
314 |
> |
twoDHists_.at(currentChannel)[currentHistogram.name]->GetYaxis()->CenterTitle(); |
315 |
|
} |
268 |
– |
} |
316 |
|
|
317 |
< |
//book a histogram for the number of each object type to be plotted |
317 |
> |
} |
318 |
|
|
319 |
+ |
// Book a histogram for the number of each object type to be plotted. |
320 |
+ |
// Name of objectToPlot here must match the name specified in OSUAnalysis::analyze(). |
321 |
|
for (uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){ |
322 |
|
string currentObject = objectsToPlot.at(currentObjectIndex); |
323 |
|
int maxNum = 10; |
324 |
|
if(currentObject == "mcparticles") maxNum = 50; |
325 |
|
else if(currentObject == "primaryvertexs") maxNum = 50; |
277 |
– |
else if(currentObject == "muon-muon pairs") currentObject = "dimuonPairs"; |
278 |
– |
else if(currentObject == "electron-electron pairs") currentObject = "dielectronPairs"; |
279 |
– |
else if(currentObject == "electron-muon pairs") currentObject = "electronMuonPairs"; |
326 |
|
|
327 |
< |
currentObject.at(0) = toupper(currentObject.at(0)); |
327 |
> |
if(currentObject == "muon-muon pairs") currentObject = "dimuonPairs"; |
328 |
> |
else if(currentObject == "electron-electron pairs") currentObject = "dielectronPairs"; |
329 |
> |
else if(currentObject == "electron-muon pairs") currentObject = "electronMuonPairs"; |
330 |
> |
else if(currentObject == "track-event pairs") currentObject = "trackEventPairs"; |
331 |
> |
else if(currentObject == "electron-track pairs") currentObject = "electronTrackPairs"; |
332 |
> |
else if(currentObject == "muon-track pairs") currentObject = "muonTrackPairs"; |
333 |
> |
else if(currentObject == "muon-tau pairs") currentObject = "muonTauPairs"; |
334 |
> |
else if(currentObject == "tau-tau pairs") currentObject = "ditauPairs"; |
335 |
> |
else if(currentObject == "tau-track pairs") currentObject = "tauTrackPairs"; |
336 |
> |
else if(currentObject == "muon-secondary muon pairs") currentObject = "muonSecondaryMuonPairs"; |
337 |
> |
else if(currentObject == "secondary muons") currentObject = "secondaryMuons"; |
338 |
> |
|
339 |
> |
currentObject.at(0) = toupper(currentObject.at(0)); |
340 |
|
string histoName = "num" + currentObject; |
341 |
|
|
342 |
|
if(histoName == "numPrimaryvertexs"){ |
352 |
|
|
353 |
|
|
354 |
|
|
297 |
– |
|
355 |
|
//get list of cuts for this channel |
356 |
|
vector<edm::ParameterSet> cuts_ (channels_.at(currentChannel).getParameter<vector<edm::ParameterSet> >("cuts")); |
357 |
|
|
362 |
|
string tempInputCollection = cuts_.at(currentCut).getParameter<string> ("inputCollection"); |
363 |
|
tempCut.inputCollection = tempInputCollection; |
364 |
|
if(tempInputCollection.find("pairs")==std::string::npos){ //just a single object |
365 |
< |
objectsToGet.push_back(tempInputCollection); |
366 |
< |
objectsToCut.push_back(tempInputCollection); |
365 |
> |
if(tempInputCollection.find("secondary")!=std::string::npos){//secondary object |
366 |
> |
int spaceIndex = tempInputCollection.find(" "); |
367 |
> |
int secondWordLength = tempInputCollection.size() - spaceIndex; |
368 |
> |
objectsToGet.push_back(tempInputCollection.substr(spaceIndex+1,secondWordLength)); |
369 |
> |
} |
370 |
> |
else{ |
371 |
> |
objectsToGet.push_back(tempInputCollection); |
372 |
> |
} |
373 |
> |
objectsToCut.push_back(tempInputCollection); |
374 |
|
} |
375 |
|
else{//pair of objects, need to add them both to the things to objectsToGet |
376 |
|
int dashIndex = tempInputCollection.find("-"); |
377 |
< |
int spaceIndex = tempInputCollection.find(" "); |
377 |
> |
int spaceIndex = tempInputCollection.find_last_of(" "); |
378 |
|
int secondWordLength = spaceIndex - dashIndex; |
379 |
|
objectsToGet.push_back(tempInputCollection); |
380 |
|
objectsToGet.push_back(tempInputCollection.substr(0,dashIndex)+"s"); |
381 |
< |
objectsToGet.push_back(tempInputCollection.substr(dashIndex+1,secondWordLength-1)+"s"); |
381 |
> |
if(tempInputCollection.find("secondary")!=std::string::npos){//secondary object |
382 |
> |
int firstSpaceIndex = tempInputCollection.find_first_of(" "); |
383 |
> |
int splitWordLength = spaceIndex - firstSpaceIndex; |
384 |
> |
objectsToGet.push_back(tempInputCollection.substr(firstSpaceIndex+1,splitWordLength-1)+"s"); |
385 |
> |
} |
386 |
> |
else{ |
387 |
> |
objectsToGet.push_back(tempInputCollection.substr(dashIndex+1,secondWordLength-1)+"s"); |
388 |
> |
} |
389 |
|
objectsToCut.push_back(tempInputCollection); |
390 |
|
objectsToCut.push_back(tempInputCollection.substr(0,dashIndex)+"s"); |
391 |
|
objectsToCut.push_back(tempInputCollection.substr(dashIndex+1,secondWordLength-1)+"s"); |
445 |
|
} |
446 |
|
tempCut.name = tempCutName; |
447 |
|
|
377 |
– |
|
448 |
|
tempChannel.cuts.push_back(tempCut); |
449 |
|
|
450 |
|
|
381 |
– |
|
451 |
|
}//end loop over cuts |
452 |
|
|
453 |
|
channels.push_back(tempChannel); |
523 |
|
if (std::find(objectsToGet.begin(), objectsToGet.end(), "superclusters") != objectsToGet.end()) |
524 |
|
event.getByLabel (superclusters_, superclusters); |
525 |
|
|
526 |
+ |
if (useTrackCaloRhoCorr_) { |
527 |
+ |
// Used only for pile-up correction of by-hand calculation of isolation energy. |
528 |
+ |
// This rho collection is not available in all BEANs. |
529 |
+ |
// For description of rho values for different jet reconstruction algorithms, see |
530 |
+ |
// https://twiki.cern.ch/twiki/bin/view/CMS/JetAlgorithms#Algorithms |
531 |
+ |
event.getByLabel ("kt6CaloJets","rho", rhokt6CaloJetsHandle_); |
532 |
+ |
} |
533 |
+ |
|
534 |
+ |
|
535 |
|
//get pile-up event weight |
536 |
|
double scaleFactor = 1.00; |
537 |
|
if(doPileupReweighting_ && datasetType_ != "data") |
538 |
|
scaleFactor = puWeight_->at (events->at (0).numTruePV); |
539 |
|
|
540 |
+ |
cTauScaleFactor_ = 1.0; |
541 |
+ |
#ifdef DISPLACED_SUSY |
542 |
+ |
if (datasetType_ == "signalMC") |
543 |
+ |
cTauScaleFactor_ = cTauWeight_->at (event); |
544 |
+ |
#endif |
545 |
+ |
scaleFactor *= cTauScaleFactor_; |
546 |
|
|
547 |
|
//loop over all channels |
548 |
|
|
581 |
|
|
582 |
|
|
583 |
|
if(currentObject == "jets") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,jets.product(),"jets"); |
584 |
+ |
|
585 |
|
else if(currentObject == "muons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),"muons"); |
586 |
+ |
|
587 |
+ |
else if(currentObject == "secondary muons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),"secondary muons"); |
588 |
|
else if(currentObject == "electrons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),"electrons"); |
589 |
|
else if(currentObject == "events") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,events.product(),"events"); |
590 |
|
else if(currentObject == "taus") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,taus.product(),"taus"); |
602 |
|
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
603 |
|
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
604 |
|
"muon-muon pairs"); |
605 |
+ |
|
606 |
+ |
else if(currentObject == "muon-secondary muon pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),muons.product(), \ |
607 |
+ |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
608 |
+ |
cumulativeFlags.at("secondary muons").at(flagsForPairCutsIndex), \ |
609 |
+ |
"muon-secondary muon pairs"); |
610 |
+ |
|
611 |
|
else if(currentObject == "electron-electron pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),electrons.product(), \ |
612 |
|
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \ |
613 |
|
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \ |
616 |
|
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \ |
617 |
|
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
618 |
|
"electron-muon pairs"); |
619 |
< |
|
620 |
< |
|
619 |
> |
else if(currentObject == "track-event pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,tracks.product(),events.product(), |
620 |
> |
cumulativeFlags.at("tracks").at(flagsForPairCutsIndex), |
621 |
> |
cumulativeFlags.at("events").at(flagsForPairCutsIndex), |
622 |
> |
"track-event pairs"); |
623 |
> |
else if(currentObject == "electron-track pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),tracks.product(), |
624 |
> |
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), |
625 |
> |
cumulativeFlags.at("tracks").at(flagsForPairCutsIndex), |
626 |
> |
"electron-track pairs"); |
627 |
> |
else if(currentObject == "muon-track pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),tracks.product(), |
628 |
> |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), |
629 |
> |
cumulativeFlags.at("tracks").at(flagsForPairCutsIndex), |
630 |
> |
"muon-track pairs"); |
631 |
> |
else if(currentObject == "muon-tau pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),taus.product(), |
632 |
> |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), |
633 |
> |
cumulativeFlags.at("taus").at(flagsForPairCutsIndex), |
634 |
> |
"muon-tau pairs"); |
635 |
> |
else if(currentObject == "tau-tau pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,taus.product(),taus.product(), |
636 |
> |
cumulativeFlags.at("taus").at(flagsForPairCutsIndex), |
637 |
> |
cumulativeFlags.at("taus").at(flagsForPairCutsIndex), |
638 |
> |
"tau-tau pairs"); |
639 |
> |
else if(currentObject == "tau-track pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,taus .product(),tracks.product(), |
640 |
> |
cumulativeFlags.at("taus").at(flagsForPairCutsIndex), |
641 |
> |
cumulativeFlags.at("tracks").at(flagsForPairCutsIndex), |
642 |
> |
"tau-track pairs"); |
643 |
> |
|
644 |
> |
|
645 |
|
} |
646 |
|
|
647 |
|
|
657 |
|
eventPassedAllCuts = eventPassedAllCuts && triggerDecision; |
658 |
|
|
659 |
|
|
543 |
– |
|
660 |
|
for(uint currentCutIndex = 0; currentCutIndex != currentChannel.cuts.size(); currentCutIndex++){ |
661 |
|
|
662 |
|
//loop over all objects and count how many passed the cumulative selection up to this point |
664 |
|
int numberPassing = 0; |
665 |
|
|
666 |
|
for (uint object = 0; object != cumulativeFlags.at(currentCut.inputCollection).at(currentCutIndex).size() ; object++){ |
667 |
< |
if(cumulativeFlags.at(currentCut.inputCollection).at(currentCutIndex).at(object)) numberPassing++; |
667 |
> |
if(cumulativeFlags.at(currentCut.inputCollection).at(currentCutIndex).at(object)) numberPassing++; |
668 |
|
} |
553 |
– |
|
669 |
|
bool cutDecision = evaluateComparison(numberPassing,currentCut.eventComparativeOperator,currentCut.numberRequired); |
670 |
|
cutFlows_.at(currentChannelIndex)->at (currentCut.name) = cutDecision; |
556 |
– |
|
671 |
|
eventPassedAllCuts = eventPassedAllCuts && cutDecision; |
558 |
– |
|
672 |
|
} |
673 |
|
|
674 |
+ |
// if(datasetType_ != "data") { |
675 |
+ |
// scaleFactor *= muonSFWeight_->at (chosenMuon ()->eta); |
676 |
+ |
// scaleFactor *= electronSFWeight_->at (chosenElectron ()->eta, chosenElectron ()->pt); |
677 |
+ |
// } |
678 |
+ |
|
679 |
|
cutFlows_.at(currentChannelIndex)->fillCutFlow(scaleFactor); |
680 |
|
|
681 |
|
|
682 |
|
|
683 |
|
if(!eventPassedAllCuts)continue; |
684 |
|
|
685 |
+ |
if (printEventInfo_) { |
686 |
+ |
// Write information about event to screen, for testing purposes. |
687 |
+ |
cout << "Event passed all cuts in channel " << currentChannel.name |
688 |
+ |
<< ": run=" << events->at(0).run |
689 |
+ |
<< " lumi=" << events->at(0).lumi |
690 |
+ |
<< " event=" << events->at(0).evt |
691 |
+ |
<< endl; |
692 |
+ |
} |
693 |
|
|
568 |
– |
//if(datasetType_ != "data") { |
569 |
– |
// scaleFactor *= muonSFWeight_->at (chosenMuon ()->eta); |
570 |
– |
// scaleFactor *= electronSFWeight_->at (chosenElectron ()->eta, chosenElectron ()->pt); |
571 |
– |
//} |
694 |
|
|
695 |
|
//filling histograms |
696 |
|
for (uint histogramIndex = 0; histogramIndex != histograms.size(); histogramIndex++){ |
700 |
|
TH1D* histo; |
701 |
|
histo = oneDHists_.at(currentChannelIndex).at(currentHistogram.name); |
702 |
|
|
581 |
– |
|
582 |
– |
|
703 |
|
if(currentHistogram.inputCollection == "jets") fill1DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("jets").back(),scaleFactor); |
704 |
< |
else if(currentHistogram.inputCollection == "muons") fill1DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("muons").back(),scaleFactor); |
704 |
> |
else if(currentHistogram.inputCollection == "muons") fill1DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("muons").back(),scaleFactor); |
705 |
> |
else if(currentHistogram.inputCollection == "secondary muons") fill1DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("secondary muons").back(),scaleFactor); |
706 |
|
else if(currentHistogram.inputCollection == "muon-muon pairs") fill1DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
707 |
|
cumulativeFlags.at("muons").back(),cumulativeFlags.at("muons").back(), \ |
708 |
|
cumulativeFlags.at("muon-muon pairs").back(),scaleFactor); |
709 |
+ |
else if(currentHistogram.inputCollection == "muon-secondary muon pairs") fill1DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
710 |
+ |
cumulativeFlags.at("muons").back(),cumulativeFlags.at("secondary muons").back(), \ |
711 |
+ |
cumulativeFlags.at("muon-secondary muon pairs").back(),scaleFactor); |
712 |
|
else if(currentHistogram.inputCollection == "electrons") fill1DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("electrons").back(),scaleFactor); |
713 |
|
else if(currentHistogram.inputCollection == "electron-electron pairs") fill1DHistogram(histo,currentHistogram,electrons.product(),electrons.product(),\ |
714 |
|
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("electrons").back(),\ |
715 |
|
cumulativeFlags.at("electron-electron pairs").back(),scaleFactor); |
716 |
|
else if(currentHistogram.inputCollection == "electron-muon pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),muons.product(), \ |
717 |
< |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("muons").back(), |
718 |
< |
cumulativeFlags.at("electron-muon pairs").back(),scaleFactor); |
717 |
> |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("muons").back(), |
718 |
> |
cumulativeFlags.at("electron-muon pairs").back(),scaleFactor); |
719 |
> |
else if(currentHistogram.inputCollection == "electron-track pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),tracks.product(), |
720 |
> |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("tracks").back(), |
721 |
> |
cumulativeFlags.at("electron-track pairs").back(),scaleFactor); |
722 |
> |
else if(currentHistogram.inputCollection == "muon-track pairs") fill1DHistogram(histo,currentHistogram, muons.product(),tracks.product(), |
723 |
> |
cumulativeFlags.at("muons").back(),cumulativeFlags.at("tracks").back(), |
724 |
> |
cumulativeFlags.at("muon-track pairs").back(),scaleFactor); |
725 |
> |
else if(currentHistogram.inputCollection == "muon-tau pairs") fill1DHistogram(histo,currentHistogram, muons.product(),taus.product(), |
726 |
> |
cumulativeFlags.at("muons").back(),cumulativeFlags.at("taus").back(), |
727 |
> |
cumulativeFlags.at("muon-tau pairs").back(),scaleFactor); |
728 |
> |
else if(currentHistogram.inputCollection == "tau-tau pairs") fill1DHistogram(histo,currentHistogram, taus.product(),taus.product(), |
729 |
> |
cumulativeFlags.at("taus").back(),cumulativeFlags.at("taus").back(), |
730 |
> |
cumulativeFlags.at("tau-tau pairs").back(),scaleFactor); |
731 |
> |
else if(currentHistogram.inputCollection == "tau-track pairs") fill1DHistogram(histo,currentHistogram, taus.product(),tracks.product(), |
732 |
> |
cumulativeFlags.at("taus").back(),cumulativeFlags.at("tracks").back(), |
733 |
> |
cumulativeFlags.at("tau-track pairs").back(),scaleFactor); |
734 |
> |
|
735 |
|
else if(currentHistogram.inputCollection == "events") fill1DHistogram(histo,currentHistogram,events.product(),cumulativeFlags.at("events").back(),scaleFactor); |
736 |
|
else if(currentHistogram.inputCollection == "taus") fill1DHistogram(histo,currentHistogram,taus.product(),cumulativeFlags.at("taus").back(),scaleFactor); |
737 |
|
else if(currentHistogram.inputCollection == "mets") fill1DHistogram(histo,currentHistogram,mets.product(),cumulativeFlags.at("mets").back(),scaleFactor); |
747 |
|
TH2D* histo; |
748 |
|
histo = twoDHists_.at(currentChannelIndex).at(currentHistogram.name); |
749 |
|
|
610 |
– |
|
611 |
– |
|
750 |
|
if(currentHistogram.inputCollection == "jets") fill2DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("jets").back(),scaleFactor); |
751 |
|
else if(currentHistogram.inputCollection == "muons") fill2DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("muons").back(),scaleFactor); |
752 |
+ |
else if(currentHistogram.inputCollection == "secondary muons") fill2DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("secondary muons").back(),scaleFactor); |
753 |
|
else if(currentHistogram.inputCollection == "muon-muon pairs") fill2DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
754 |
|
cumulativeFlags.at("muons").back(),cumulativeFlags.at("muons").back(), \ |
755 |
|
cumulativeFlags.at("muon-muon pairs").back(),scaleFactor); |
756 |
+ |
else if(currentHistogram.inputCollection == "muon-muon pairs") fill2DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
757 |
+ |
cumulativeFlags.at("muons").back(),cumulativeFlags.at("secondary muons").back(), \ |
758 |
+ |
cumulativeFlags.at("muon-secondary muon pairs").back(),scaleFactor); |
759 |
|
else if(currentHistogram.inputCollection == "electrons") fill2DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("electrons").back(),scaleFactor); |
760 |
|
else if(currentHistogram.inputCollection == "electron-electron pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),electrons.product(), \ |
761 |
|
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("electrons").back(), \ |
762 |
|
cumulativeFlags.at("electron-electron pairs").back(),scaleFactor); |
763 |
|
else if(currentHistogram.inputCollection == "electron-muon pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),muons.product(), \ |
764 |
< |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("muons").back(), \ |
765 |
< |
cumulativeFlags.at("electron-muon pairs").back(),scaleFactor); |
766 |
< |
else if(currentHistogram.inputCollection == "events") fill2DHistogram(histo,currentHistogram,events.product(),cumulativeFlags.at("events").back(),scaleFactor); |
764 |
> |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("muons").back(), \ |
765 |
> |
cumulativeFlags.at("electron-muon pairs").back(),scaleFactor); |
766 |
> |
else if(currentHistogram.inputCollection == "electron-track pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),tracks.product(), |
767 |
> |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("tracks").back(), |
768 |
> |
cumulativeFlags.at("electron-track pairs").back(),scaleFactor); |
769 |
> |
else if(currentHistogram.inputCollection == "muon-track pairs") fill2DHistogram(histo,currentHistogram,muons.product(),tracks.product(), |
770 |
> |
cumulativeFlags.at("muons").back(),cumulativeFlags.at("tracks").back(), |
771 |
> |
cumulativeFlags.at("muon-track pairs").back(),scaleFactor); |
772 |
> |
else if(currentHistogram.inputCollection == "muon-tau pairs") fill2DHistogram(histo,currentHistogram,muons.product(),taus.product(), |
773 |
> |
cumulativeFlags.at("muons").back(),cumulativeFlags.at("taus").back(), |
774 |
> |
cumulativeFlags.at("muon-tau pairs").back(),scaleFactor); |
775 |
> |
else if(currentHistogram.inputCollection == "tau-tau pairs") fill2DHistogram(histo,currentHistogram,taus.product(),taus.product(), |
776 |
> |
cumulativeFlags.at("taus").back(),cumulativeFlags.at("taus").back(), |
777 |
> |
cumulativeFlags.at("tau-tau pairs").back(),scaleFactor); |
778 |
> |
else if(currentHistogram.inputCollection == "tau-track pairs") fill2DHistogram(histo,currentHistogram,taus.product(),tracks.product(), |
779 |
> |
cumulativeFlags.at("taus").back(),cumulativeFlags.at("tracks").back(), |
780 |
> |
cumulativeFlags.at("tau-track pairs").back(),scaleFactor); |
781 |
> |
else if(currentHistogram.inputCollection == "events") fill2DHistogram(histo,currentHistogram,events.product(),cumulativeFlags.at("events").back(),scaleFactor); |
782 |
|
else if(currentHistogram.inputCollection == "taus") fill2DHistogram(histo,currentHistogram,taus.product(),cumulativeFlags.at("taus").back(),scaleFactor); |
783 |
|
else if(currentHistogram.inputCollection == "mets") fill2DHistogram(histo,currentHistogram,mets.product(),cumulativeFlags.at("mets").back(),scaleFactor); |
784 |
|
else if(currentHistogram.inputCollection == "tracks") fill2DHistogram(histo,currentHistogram,tracks.product(),cumulativeFlags.at("tracks").back(),scaleFactor); |
785 |
+ |
else if(currentHistogram.inputCollection == "track-event pairs") fill2DHistogram(histo,currentHistogram,tracks.product(),events.product(), |
786 |
+ |
cumulativeFlags.at("tracks").back(),cumulativeFlags.at("events").back(), |
787 |
+ |
cumulativeFlags.at("track-event pairs").back(),scaleFactor); |
788 |
|
else if(currentHistogram.inputCollection == "genjets") fill2DHistogram(histo,currentHistogram,genjets.product(),cumulativeFlags.at("genjets").back(),scaleFactor); |
789 |
|
else if(currentHistogram.inputCollection == "mcparticles") fill2DHistogram(histo,currentHistogram,mcparticles.product(),cumulativeFlags.at("mcparticles").back(),scaleFactor); |
790 |
|
else if(currentHistogram.inputCollection == "primaryvertexs") fill2DHistogram(histo,currentHistogram,primaryvertexs.product(),cumulativeFlags.at("primaryvertexs").back(),scaleFactor); |
794 |
|
} |
795 |
|
} |
796 |
|
|
797 |
+ |
|
798 |
+ |
|
799 |
|
//fills histograms with the sizes of collections |
800 |
|
for (uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){ |
801 |
+ |
|
802 |
|
string currentObject = objectsToPlot.at(currentObjectIndex); |
803 |
|
|
804 |
< |
string objectToPlot = ""; |
804 |
> |
string objectToPlot = ""; |
805 |
|
|
806 |
+ |
// Name of objectToPlot here must match the name specified in OSUAnalysis::OSUAnalysis(). |
807 |
|
if(currentObject == "muon-muon pairs") objectToPlot = "dimuonPairs"; |
808 |
|
else if(currentObject == "electron-electron pairs") objectToPlot = "dielectronPairs"; |
809 |
< |
else if(currentObject == "electron-muon pairs") objectToPlot = "electronMuonPairs"; |
809 |
> |
else if(currentObject == "electron-muon pairs") objectToPlot = "electronMuonPairs"; |
810 |
> |
else if(currentObject == "electron-track pairs") objectToPlot = "electronTrackPairs"; |
811 |
> |
else if(currentObject == "muon-track pairs") objectToPlot = "muonTrackPairs"; |
812 |
> |
else if(currentObject == "muon-tau pairs") objectToPlot = "muonTauPairs"; |
813 |
> |
else if(currentObject == "tau-tau pairs") objectToPlot = "ditauPairs"; |
814 |
> |
else if(currentObject == "tau-track pairs") objectToPlot = "tauTrackPairs"; |
815 |
> |
else if(currentObject == "track-event pairs") objectToPlot = "trackEventPairs"; |
816 |
> |
else if(currentObject == "muon-secondary muon pairs") objectToPlot = "muonSecondaryMuonPairs"; |
817 |
> |
else if(currentObject == "secondary muons") objectToPlot = "secondaryMuons"; |
818 |
|
else objectToPlot = currentObject; |
819 |
+ |
|
820 |
|
string tempCurrentObject = objectToPlot; |
821 |
< |
tempCurrentObject.at(0) = toupper(tempCurrentObject.at(0)); |
821 |
> |
tempCurrentObject.at(0) = toupper(tempCurrentObject.at(0)); |
822 |
|
string histoName = "num" + tempCurrentObject; |
823 |
|
|
651 |
– |
|
652 |
– |
|
653 |
– |
|
824 |
|
//set position of primary vertex in event, in order to calculate quantities relative to it |
825 |
|
if(std::find(objectsToCut.begin(), objectsToCut.end(), currentObject) != objectsToCut.end()) { |
826 |
|
vector<bool> lastCutFlags = cumulativeFlags.at(currentObject).back(); |
827 |
< |
int numToPlot = 0; |
827 |
> |
int numToPlot = 0; |
828 |
|
for (uint currentFlag = 0; currentFlag != lastCutFlags.size(); currentFlag++){ |
829 |
|
if(lastCutFlags.at(currentFlag)) numToPlot++; |
830 |
|
} |
832 |
|
oneDHists_.at(currentChannelIndex).at(histoName+"BeforePileupCorrection")->Fill(primaryvertexs->size()); |
833 |
|
oneDHists_.at(currentChannelIndex).at(histoName+"AfterPileupCorrection")->Fill(primaryvertexs->size(),scaleFactor); |
834 |
|
} |
835 |
< |
else |
835 |
> |
else { |
836 |
|
oneDHists_.at(currentChannelIndex).at(histoName)->Fill(numToPlot,scaleFactor); |
837 |
+ |
} |
838 |
|
} |
839 |
|
else if(objectToPlot == "jets") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(jets->size(),scaleFactor); |
840 |
|
else if(objectToPlot == "muons") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(muons->size(),scaleFactor); |
841 |
+ |
else if(objectToPlot == "secondaryMuons") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(muons->size(),scaleFactor); |
842 |
|
else if(objectToPlot == "dimuonPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(muons->size()*(muons->size()-1)/2,scaleFactor); |
843 |
+ |
else if(objectToPlot == "muonSecondaryMuonPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(muons->size()*(muons->size()-1)/2,scaleFactor); |
844 |
|
else if(objectToPlot == "electrons") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size(),scaleFactor); |
845 |
|
else if(objectToPlot == "dielectronPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size()*(electrons->size()-1)/2,scaleFactor); |
846 |
|
else if(objectToPlot == "electronMuonPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size()*muons->size(),scaleFactor); |
847 |
+ |
else if(objectToPlot == "electronTrackPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size()*tracks->size(),scaleFactor); |
848 |
|
else if(objectToPlot == "events") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(events->size(),scaleFactor); |
849 |
|
else if(objectToPlot == "taus") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(taus->size(),scaleFactor); |
850 |
|
else if(objectToPlot == "mets") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(mets->size(),scaleFactor); |
857 |
|
else if(objectToPlot == "primaryvertexs"){ |
858 |
|
oneDHists_.at(currentChannelIndex).at(histoName+"BeforePileupCorrection")->Fill(primaryvertexs->size()); |
859 |
|
oneDHists_.at(currentChannelIndex).at(histoName+"AfterPileupCorrection")->Fill(primaryvertexs->size(),scaleFactor); |
860 |
< |
} |
687 |
< |
|
688 |
< |
} |
689 |
< |
|
690 |
< |
|
860 |
> |
} |
861 |
|
|
862 |
+ |
} // end for (uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){ |
863 |
|
|
864 |
|
} //end loop over channel |
865 |
|
|
866 |
|
masterCutFlow_->fillCutFlow(scaleFactor); |
867 |
|
|
868 |
+ |
} // end void OSUAnalysis::analyze (const edm::Event &event, const edm::EventSetup &setup) |
869 |
|
|
870 |
|
|
699 |
– |
} |
700 |
– |
|
871 |
|
|
872 |
|
bool |
873 |
|
OSUAnalysis::evaluateComparison (double testValue, string comparison, double cutValue){ |
1210 |
|
if (met) |
1211 |
|
{ |
1212 |
|
TLorentzVector p1 (object->px, object->py, object->pz, object->energy), |
1213 |
< |
p2 (met->px, met->py, 0.0, met->pt); |
1213 |
> |
p2 (met->px, met->py, 0.0, met->pt); |
1214 |
|
|
1215 |
|
value = (p1 + p2).Mt (); |
1216 |
|
} |
1330 |
|
value = object->isGlobalMuon > 0 \ |
1331 |
|
&& object->isPFMuon > 0 \ |
1332 |
|
&& object->normalizedChi2 < 10 \ |
1333 |
< |
&& object->numberOfValidMuonHits > 0 \ |
1333 |
> |
&& object->numberOfValidMuonHits > 0 \ |
1334 |
|
&& object->numberOfMatchedStations > 1 \ |
1335 |
|
&& fabs(object->correctedD0Vertex) < 0.2 \ |
1336 |
|
&& fabs(object->correctedDZ) < 0.5 \ |
1340 |
|
else if(variable == "tightIDdisplaced"){ |
1341 |
|
value = object->isGlobalMuon > 0 \ |
1342 |
|
&& object->normalizedChi2 < 10 \ |
1343 |
< |
&& object->numberOfValidMuonHits > 0 \ |
1343 |
> |
&& object->numberOfValidMuonHits > 0 \ |
1344 |
|
&& object->numberOfMatchedStations > 1 \ |
1345 |
|
&& object->numberOfValidPixelHits > 0 \ |
1346 |
|
&& object->numberOfLayersWithMeasurement > 5; |
1347 |
|
} |
1348 |
|
|
1349 |
+ |
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
1350 |
|
|
1351 |
+ |
else if(variable == "genMatchedPdgId"){ |
1352 |
+ |
int index = getGenMatchedParticleIndex(object); |
1353 |
+ |
if(index == -1) value = 0; |
1354 |
+ |
else value = mcparticles->at(index).id; |
1355 |
+ |
} |
1356 |
|
|
1357 |
|
else if(variable == "genMatchedId"){ |
1358 |
|
int index = getGenMatchedParticleIndex(object); |
1364 |
|
if(index == -1) value = 0; |
1365 |
|
else value = getPdgIdBinValue(mcparticles->at(index).motherId); |
1366 |
|
} |
1367 |
+ |
else if(variable == "genMatchedMotherIdReverse"){ |
1368 |
+ |
int index = getGenMatchedParticleIndex(object); |
1369 |
+ |
if(index == -1) value = 23; |
1370 |
+ |
else value = 23 -getPdgIdBinValue(mcparticles->at(index).motherId); |
1371 |
+ |
} |
1372 |
|
else if(variable == "genMatchedGrandmotherId"){ |
1373 |
|
int index = getGenMatchedParticleIndex(object); |
1374 |
|
if(index == -1) value = 0; |
1561 |
|
if (met) |
1562 |
|
{ |
1563 |
|
TLorentzVector p1 (object->px, object->py, object->pz, object->energy), |
1564 |
< |
p2 (met->px, met->py, 0.0, met->pt); |
1564 |
> |
p2 (met->px, met->py, 0.0, met->pt); |
1565 |
|
|
1566 |
|
value = (p1 + p2).Mt (); |
1567 |
|
} |
1727 |
|
} |
1728 |
|
} |
1729 |
|
|
1730 |
+ |
|
1731 |
+ |
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
1732 |
+ |
|
1733 |
+ |
else if(variable == "genMatchedPdgId"){ |
1734 |
+ |
int index = getGenMatchedParticleIndex(object); |
1735 |
+ |
if(index == -1) value = 0; |
1736 |
+ |
else value = mcparticles->at(index).id; |
1737 |
+ |
} |
1738 |
+ |
|
1739 |
+ |
|
1740 |
|
else if(variable == "genMatchedId"){ |
1741 |
|
int index = getGenMatchedParticleIndex(object); |
1742 |
|
if(index == -1) value = 0; |
1747 |
|
if(index == -1) value = 0; |
1748 |
|
else value = getPdgIdBinValue(mcparticles->at(index).motherId); |
1749 |
|
} |
1750 |
+ |
else if(variable == "genMatchedMotherIdReverse"){ |
1751 |
+ |
int index = getGenMatchedParticleIndex(object); |
1752 |
+ |
if(index == -1) value = 23; |
1753 |
+ |
else value = 23 -getPdgIdBinValue(mcparticles->at(index).motherId); |
1754 |
+ |
} |
1755 |
|
else if(variable == "genMatchedGrandmotherId"){ |
1756 |
|
int index = getGenMatchedParticleIndex(object); |
1757 |
|
if(index == -1) value = 0; |
1850 |
|
} |
1851 |
|
else if(variable == "muonScaleFactor"){ |
1852 |
|
if(datasetType_ != "data") |
1853 |
< |
value = muonSFWeight_->at (chosenMuon ()->eta); |
1853 |
> |
// value = muonSFWeight_->at (chosenMuon ()->eta); |
1854 |
> |
value = 1.0; |
1855 |
|
else |
1856 |
|
value = 1.0; |
1857 |
|
} |
1858 |
|
else if(variable == "electronScaleFactor"){ |
1859 |
|
if(datasetType_ != "data") |
1860 |
< |
value = electronSFWeight_->at (chosenElectron ()->eta, chosenElectron ()->pt); |
1860 |
> |
// value = electronSFWeight_->at (chosenElectron ()->eta, chosenElectron ()->pt); |
1861 |
> |
value = 1.0; |
1862 |
|
else |
1863 |
|
value = 1.0; |
1864 |
|
} |
1865 |
+ |
else if(variable == "cTauScaleFactor") |
1866 |
+ |
value = cTauScaleFactor_; |
1867 |
|
|
1868 |
|
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
1869 |
|
|
1918 |
|
else if(variable == "leadingTrackValid") value = object->leadingTrackValid; |
1919 |
|
|
1920 |
|
|
1921 |
+ |
|
1922 |
+ |
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
1923 |
+ |
|
1924 |
+ |
else if(variable == "genMatchedPdgId"){ |
1925 |
+ |
int index = getGenMatchedParticleIndex(object); |
1926 |
+ |
if(index == -1) value = 0; |
1927 |
+ |
else value = mcparticles->at(index).id; |
1928 |
+ |
} |
1929 |
+ |
|
1930 |
|
else if(variable == "genMatchedId"){ |
1931 |
|
int index = getGenMatchedParticleIndex(object); |
1932 |
|
if(index == -1) value = 0; |
1937 |
|
if(index == -1) value = 0; |
1938 |
|
else value = getPdgIdBinValue(mcparticles->at(index).motherId); |
1939 |
|
} |
1940 |
+ |
else if(variable == "genMatchedMotherIdReverse"){ |
1941 |
+ |
int index = getGenMatchedParticleIndex(object); |
1942 |
+ |
if(index == -1) value = 23; |
1943 |
+ |
else value = 23 -getPdgIdBinValue(mcparticles->at(index).motherId); |
1944 |
+ |
} |
1945 |
|
else if(variable == "genMatchedGrandmotherId"){ |
1946 |
|
int index = getGenMatchedParticleIndex(object); |
1947 |
|
if(index == -1) value = 0; |
2038 |
|
|
2039 |
|
double value = 0.0; |
2040 |
|
double pMag = sqrt(object->pt * object->pt + |
2041 |
< |
object->pz * object->pz); |
2042 |
< |
|
2041 |
> |
object->pz * object->pz); |
2042 |
> |
|
2043 |
|
if(variable == "pt") value = object->pt; |
2044 |
|
else if(variable == "px") value = object->px; |
2045 |
|
else if(variable == "py") value = object->py; |
2070 |
|
else if(variable == "nHitsMissingOuter") value = object->nHitsMissingOuter; |
2071 |
|
else if(variable == "nHitsMissingInner") value = object->nHitsMissingInner; |
2072 |
|
else if(variable == "nHitsMissingMiddle") value = object->nHitsMissingMiddle; |
2073 |
+ |
|
2074 |
+ |
|
2075 |
|
//user defined variables |
2076 |
|
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; |
2077 |
|
else if(variable == "dZwrtBS") value = object->dZ - events->at(0).BSz; |
2078 |
< |
else if(variable == "caloTotDeltaRp5") value =(object->caloHadDeltaRp5 + object->caloEMDeltaRp5); |
2079 |
< |
else if(variable == "caloTotDeltaRp5ByP") value =( (object->caloHadDeltaRp5 + object->caloEMDeltaRp5)/pMag); |
2080 |
< |
else if(variable == "isIso") value = getTrkIsIso(object, tracks.product()); |
2081 |
< |
else if(variable == "isMatchedDeadEcal") value = getTrkIsMatchedDeadEcal(object); |
2082 |
< |
else if(variable == "ptErrorByPt") value = (object->ptError/object->pt); |
2083 |
< |
else if(variable == "ptError") value = object->ptError; |
2084 |
< |
else if(variable == "ptRes") value = getTrkPtRes(object); |
2078 |
> |
else if(variable == "caloTotDeltaRp5") value = (object->caloHadDeltaRp5 + object->caloEMDeltaRp5); |
2079 |
> |
else if(variable == "caloTotDeltaRp5ByP") value = ((object->caloHadDeltaRp5 + object->caloEMDeltaRp5)/pMag); |
2080 |
> |
else if(variable == "caloTotDeltaRp5RhoCorr") value = getTrkCaloTotRhoCorr(object); |
2081 |
> |
else if(variable == "caloTotDeltaRp5ByPRhoCorr") value = getTrkCaloTotRhoCorr(object) / pMag; |
2082 |
> |
else if(variable == "isIso") value = getTrkIsIso(object, tracks.product()); |
2083 |
> |
else if(variable == "isMatchedDeadEcal") value = getTrkIsMatchedDeadEcal(object); |
2084 |
> |
else if(variable == "ptErrorByPt") value = (object->ptError/object->pt); |
2085 |
> |
else if(variable == "ptError") value = object->ptError; |
2086 |
> |
else if(variable == "ptRes") value = getTrkPtRes(object); |
2087 |
> |
else if (variable == "d0wrtPV"){ |
2088 |
> |
double vx = object->vx - chosenVertex ()->x, |
2089 |
> |
vy = object->vy - chosenVertex ()->y, |
2090 |
> |
px = object->px, |
2091 |
> |
py = object->py, |
2092 |
> |
pt = object->pt; |
2093 |
> |
value = (-vx * py + vy * px) / pt; |
2094 |
> |
} |
2095 |
> |
else if (variable == "dZwrtPV"){ |
2096 |
> |
double vx = object->vx - chosenVertex ()->x, |
2097 |
> |
vy = object->vy - chosenVertex ()->y, |
2098 |
> |
vz = object->vz - chosenVertex ()->z, |
2099 |
> |
px = object->px, |
2100 |
> |
py = object->py, |
2101 |
> |
pz = object->pz, |
2102 |
> |
pt = object->pt; |
2103 |
> |
value = vz - (vx * px + vy * py)/pt * (pz/pt); |
2104 |
> |
} |
2105 |
> |
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
2106 |
> |
|
2107 |
> |
else if(variable == "genMatchedPdgId"){ |
2108 |
> |
int index = getGenMatchedParticleIndex(object); |
2109 |
> |
if(index == -1) value = 0; |
2110 |
> |
else value = mcparticles->at(index).id; |
2111 |
> |
} |
2112 |
|
|
2113 |
|
|
2114 |
|
else if(variable == "genMatchedId"){ |
2121 |
|
if(index == -1) value = 0; |
2122 |
|
else value = getPdgIdBinValue(mcparticles->at(index).motherId); |
2123 |
|
} |
2124 |
+ |
else if(variable == "genMatchedMotherIdReverse"){ |
2125 |
+ |
int index = getGenMatchedParticleIndex(object); |
2126 |
+ |
if(index == -1) value = 23; |
2127 |
+ |
else value = 23 -getPdgIdBinValue(mcparticles->at(index).motherId); |
2128 |
+ |
} |
2129 |
|
else if(variable == "genMatchedGrandmotherId"){ |
2130 |
|
int index = getGenMatchedParticleIndex(object); |
2131 |
|
if(index == -1) value = 0; |
2427 |
|
else if(variable == "seedRecoFlag") value = object->seedRecoFlag; |
2428 |
|
|
2429 |
|
|
2430 |
+ |
|
2431 |
+ |
|
2432 |
+ |
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
2433 |
+ |
|
2434 |
+ |
else if(variable == "genMatchedPdgId"){ |
2435 |
+ |
int index = getGenMatchedParticleIndex(object); |
2436 |
+ |
if(index == -1) value = 0; |
2437 |
+ |
else value = mcparticles->at(index).id; |
2438 |
+ |
} |
2439 |
+ |
|
2440 |
+ |
|
2441 |
+ |
|
2442 |
|
else if(variable == "genMatchedId"){ |
2443 |
|
int index = getGenMatchedParticleIndex(object); |
2444 |
|
if(index == -1) value = 0; |
2449 |
|
if(index == -1) value = 0; |
2450 |
|
else value = getPdgIdBinValue(mcparticles->at(index).motherId); |
2451 |
|
} |
2452 |
+ |
else if(variable == "genMatchedMotherIdReverse"){ |
2453 |
+ |
int index = getGenMatchedParticleIndex(object); |
2454 |
+ |
if(index == -1) value = 23; |
2455 |
+ |
else value = 23 -getPdgIdBinValue(mcparticles->at(index).motherId); |
2456 |
+ |
} |
2457 |
|
else if(variable == "genMatchedGrandmotherId"){ |
2458 |
|
int index = getGenMatchedParticleIndex(object); |
2459 |
|
if(index == -1) value = 0; |
2502 |
|
double value = 0.0; |
2503 |
|
|
2504 |
|
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
2505 |
+ |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
2506 |
|
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
2507 |
|
else if(variable == "invMass"){ |
2508 |
|
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
2509 |
|
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
2510 |
|
value = (fourVector1 + fourVector2).M(); |
2511 |
|
} |
2512 |
+ |
else if(variable == "pt"){ |
2513 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
2514 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
2515 |
+ |
value = (fourVector1 + fourVector2).Pt(); |
2516 |
+ |
} |
2517 |
|
else if(variable == "threeDAngle") |
2518 |
|
{ |
2519 |
|
TVector3 threeVector1(object1->px, object1->py, object1->pz); |
2544 |
|
else if(variable == "muon2CorrectedD0Vertex"){ |
2545 |
|
value = object2->correctedD0Vertex; |
2546 |
|
} |
2547 |
< |
else if(variable == "muon1timeAtIpInOut"){ |
2547 |
> |
else if(variable == "muon1timeAtIpInOut"){ |
2548 |
|
value = object1->timeAtIpInOut; |
2549 |
|
} |
2550 |
< |
else if(variable == "muon2timeAtIpInOut"){ |
2550 |
> |
else if(variable == "muon2timeAtIpInOut"){ |
2551 |
|
value = object2->timeAtIpInOut; |
2552 |
|
} |
2553 |
+ |
else if(variable == "muon1correctedD0") |
2554 |
+ |
{ |
2555 |
+ |
value = object1->correctedD0; |
2556 |
+ |
} |
2557 |
+ |
else if(variable == "muon2correctedD0") |
2558 |
+ |
{ |
2559 |
+ |
value = object2->correctedD0; |
2560 |
+ |
} |
2561 |
+ |
|
2562 |
|
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2563 |
|
|
2564 |
|
value = applyFunction(function, value); |
2572 |
|
double value = 0.0; |
2573 |
|
|
2574 |
|
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
2575 |
+ |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
2576 |
|
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
2577 |
|
else if(variable == "invMass"){ |
2578 |
|
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
2579 |
|
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
2580 |
|
value = (fourVector1 + fourVector2).M(); |
2581 |
|
} |
2582 |
+ |
else if(variable == "pt"){ |
2583 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
2584 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
2585 |
+ |
value = (fourVector1 + fourVector2).Pt(); |
2586 |
+ |
} |
2587 |
|
else if(variable == "threeDAngle") |
2588 |
|
{ |
2589 |
|
TVector3 threeVector1(object1->px, object1->py, object1->pz); |
2607 |
|
else if(variable == "electron2CorrectedD0Vertex"){ |
2608 |
|
value = object2->correctedD0Vertex; |
2609 |
|
} |
2610 |
+ |
else if(variable == "electron1CorrectedD0"){ |
2611 |
+ |
value = object1->correctedD0; |
2612 |
+ |
} |
2613 |
+ |
else if(variable == "electron2CorrectedD0"){ |
2614 |
+ |
value = object2->correctedD0; |
2615 |
+ |
} |
2616 |
|
|
2617 |
|
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2618 |
|
|
2627 |
|
double value = 0.0; |
2628 |
|
|
2629 |
|
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
2630 |
+ |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
2631 |
|
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
2632 |
|
else if(variable == "invMass"){ |
2633 |
|
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
2634 |
|
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
2635 |
|
value = (fourVector1 + fourVector2).M(); |
2636 |
|
} |
2637 |
+ |
else if(variable == "pt"){ |
2638 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
2639 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
2640 |
+ |
value = (fourVector1 + fourVector2).Pt(); |
2641 |
+ |
} |
2642 |
|
else if(variable == "threeDAngle") |
2643 |
|
{ |
2644 |
|
TVector3 threeVector1(object1->px, object1->py, object1->pz); |
2674 |
|
else if(variable == "muonDetIso"){ |
2675 |
|
value = (object2->trackIsoDR03) / object2->pt; |
2676 |
|
} |
2677 |
< |
else if(variable == "chargeProduct"){ |
2678 |
< |
value = object1->charge * object2->charge; |
2677 |
> |
else if(variable == "electronRelPFrhoIso"){ |
2678 |
> |
value = ( object1->chargedHadronIsoDR03 + max(0.0, object1->neutralHadronIsoDR03 + object1->photonIsoDR03 - object1->AEffDr03*object1->rhoPrime) ) / object1->pt; |
2679 |
|
} |
2680 |
+ |
else if(variable == "muonRelPFdBetaIso"){ |
2681 |
+ |
value = (object2->pfIsoR04SumChargedHadronPt + max(0.0, object2->pfIsoR04SumNeutralHadronEt + object2->pfIsoR04SumPhotonEt - 0.5*object2->pfIsoR04SumPUPt)) / object2->pt; |
2682 |
+ |
} |
2683 |
+ |
|
2684 |
+ |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2685 |
+ |
|
2686 |
+ |
value = applyFunction(function, value); |
2687 |
|
|
2688 |
+ |
return value; |
2689 |
+ |
} |
2690 |
+ |
|
2691 |
+ |
|
2692 |
+ |
double |
2693 |
+ |
OSUAnalysis::valueLookup (const BNelectron* object1, const BNtrack* object2, string variable, string function){ |
2694 |
+ |
double electronMass = 0.000511; |
2695 |
+ |
double value = 0.0; |
2696 |
+ |
TLorentzVector fourVector1(0, 0, 0, 0); |
2697 |
+ |
TLorentzVector fourVector2(0, 0, 0, 0); |
2698 |
+ |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
2699 |
+ |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
2700 |
+ |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
2701 |
+ |
else if(variable == "invMass"){ |
2702 |
+ |
fourVector1.SetPtEtaPhiM(object1->pt, object1->eta, object1->phi, electronMass); |
2703 |
+ |
fourVector2.SetPtEtaPhiM(object2->pt, object2->eta, object2->phi, electronMass ); |
2704 |
+ |
|
2705 |
+ |
value = (fourVector1 + fourVector2).M(); |
2706 |
+ |
} |
2707 |
+ |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2708 |
+ |
value = applyFunction(function, value); |
2709 |
+ |
return value; |
2710 |
+ |
} |
2711 |
+ |
|
2712 |
+ |
|
2713 |
+ |
|
2714 |
+ |
double |
2715 |
+ |
OSUAnalysis::valueLookup (const BNmuon* object1, const BNtrack* object2, string variable, string function){ |
2716 |
+ |
double pionMass = 0.140; |
2717 |
+ |
double muonMass = 0.106; |
2718 |
+ |
double value = 0.0; |
2719 |
+ |
TLorentzVector fourVector1(0, 0, 0, 0); |
2720 |
+ |
TLorentzVector fourVector2(0, 0, 0, 0); |
2721 |
+ |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
2722 |
+ |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
2723 |
+ |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
2724 |
+ |
else if(variable == "invMass"){ |
2725 |
+ |
fourVector1.SetPtEtaPhiM(object1->pt, object1->eta, object1->phi, muonMass); |
2726 |
+ |
fourVector2.SetPtEtaPhiM(object2->pt, object2->eta, object2->phi, pionMass ); |
2727 |
+ |
|
2728 |
+ |
value = (fourVector1 + fourVector2).M(); |
2729 |
+ |
} |
2730 |
|
|
2731 |
|
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2732 |
+ |
value = applyFunction(function, value); |
2733 |
+ |
return value; |
2734 |
+ |
} |
2735 |
+ |
|
2736 |
|
|
2737 |
+ |
double |
2738 |
+ |
OSUAnalysis::valueLookup (const BNtau* object1, const BNtau* object2, string variable, string function){ |
2739 |
+ |
double value = 0.0; |
2740 |
+ |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
2741 |
+ |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
2742 |
+ |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
2743 |
+ |
else if(variable == "invMass"){ |
2744 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
2745 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
2746 |
+ |
value = (fourVector1 + fourVector2).M(); |
2747 |
+ |
} |
2748 |
+ |
|
2749 |
+ |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2750 |
|
value = applyFunction(function, value); |
2751 |
+ |
return value; |
2752 |
+ |
} |
2753 |
+ |
|
2754 |
+ |
|
2755 |
+ |
double |
2756 |
+ |
OSUAnalysis::valueLookup (const BNmuon* object1, const BNtau* object2, string variable, string function){ |
2757 |
+ |
double value = 0.0; |
2758 |
+ |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
2759 |
+ |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
2760 |
+ |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
2761 |
+ |
else if(variable == "invMass"){ |
2762 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
2763 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
2764 |
+ |
value = (fourVector1 + fourVector2).M(); |
2765 |
+ |
} |
2766 |
|
|
2767 |
+ |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2768 |
+ |
value = applyFunction(function, value); |
2769 |
|
return value; |
2770 |
|
} |
2771 |
|
|
2772 |
+ |
double |
2773 |
+ |
OSUAnalysis::valueLookup (const BNtau* object1, const BNtrack* object2, string variable, string function){ |
2774 |
+ |
double value = 0.0; |
2775 |
+ |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
2776 |
+ |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
2777 |
+ |
|
2778 |
+ |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2779 |
+ |
value = applyFunction(function, value); |
2780 |
+ |
return value; |
2781 |
+ |
} |
2782 |
+ |
|
2783 |
+ |
|
2784 |
+ |
|
2785 |
+ |
double |
2786 |
+ |
OSUAnalysis::valueLookup (const BNtrack* object1, const BNevent* object2, string variable, string function){ |
2787 |
+ |
|
2788 |
+ |
double value = 0.0; |
2789 |
+ |
double pMag = sqrt(object1->pt * object1->pt + |
2790 |
+ |
object1->pz * object1->pz); |
2791 |
+ |
|
2792 |
+ |
if (variable == "numPV") value = object2->numPV; |
2793 |
+ |
else if (variable == "caloTotDeltaRp5") value = (object1->caloHadDeltaRp5 + object1->caloEMDeltaRp5); |
2794 |
+ |
else if (variable == "caloTotDeltaRp5ByP") value = ((object1->caloHadDeltaRp5 + object1->caloEMDeltaRp5)/pMag); |
2795 |
+ |
else if (variable == "caloTotDeltaRp5_RhoCorr") value = getTrkCaloTotRhoCorr(object1); |
2796 |
+ |
else if (variable == "caloTotDeltaRp5ByP_RhoCorr") value = getTrkCaloTotRhoCorr(object1) / pMag; |
2797 |
+ |
|
2798 |
+ |
else { std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999; } |
2799 |
+ |
|
2800 |
+ |
value = applyFunction(function, value); |
2801 |
+ |
|
2802 |
+ |
return value; |
2803 |
+ |
|
2804 |
+ |
} |
2805 |
|
|
2806 |
|
// Calculate the number of tracks in cone of DeltaR<0.5 around track1. |
2807 |
|
// Return true iff no other tracks are found in this cone. |
2848 |
|
|
2849 |
|
} |
2850 |
|
|
2851 |
+ |
double |
2852 |
+ |
OSUAnalysis::getTrkCaloTotRhoCorr(const BNtrack* track) { |
2853 |
+ |
// Return the pile-up (rho) corrected isolation energy, i.e., the total calorimeter energy around the candidate track. |
2854 |
+ |
if (!useTrackCaloRhoCorr_) return -99; |
2855 |
+ |
// if (!rhokt6CaloJetsHandle_) { |
2856 |
+ |
// cout << "ERROR [getTrkCaloTotRhoCorr]: The collection rhokt6CaloJetsHandle is not available!" << endl; |
2857 |
+ |
// return -99; |
2858 |
+ |
// } |
2859 |
+ |
double radDeltaRCone = 0.5; |
2860 |
+ |
double rhoCorr_kt6CaloJets = *rhokt6CaloJetsHandle_ * TMath::Pi() * pow(radDeltaRCone, 2); // Define effective area as pi*r^2, where r is radius of DeltaR cone. |
2861 |
+ |
double rawCaloTot = track->caloHadDeltaRp5 + track->caloEMDeltaRp5; |
2862 |
+ |
double caloTotRhoCorrCalo = TMath::Max(0., rawCaloTot - rhoCorr_kt6CaloJets); |
2863 |
+ |
return caloTotRhoCorrCalo; |
2864 |
+ |
|
2865 |
+ |
} |
2866 |
+ |
|
2867 |
+ |
|
2868 |
+ |
|
2869 |
+ |
|
2870 |
|
//creates a map of the dead Ecal channels in the barrel and endcap |
2871 |
|
//to see how the map of dead Ecal channels is created look at function getChannelStatusMaps() here: |
2872 |
|
//http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/UserCode/jbrinson/DisappTrk/OSUT3Analysis/AnaTools/src/OSUAnalysis.cc?revision=1.88&view=markup |
2910 |
|
return value; |
2911 |
|
} |
2912 |
|
|
2913 |
< |
|
2914 |
< |
|
2913 |
> |
// Returns the smallest DeltaR between the object and any generated true particle in the event. |
2914 |
> |
template <class InputObject> |
2915 |
> |
double OSUAnalysis::getGenDeltaRLowest(InputObject object){ |
2916 |
> |
double genDeltaRLowest = 999.; |
2917 |
> |
for(BNmcparticleCollection::const_iterator mcparticle = mcparticles->begin (); mcparticle != mcparticles->end (); mcparticle++){ |
2918 |
> |
double deltaRtemp = deltaR(mcparticle->eta, mcparticle->phi, object->eta, object->phi); |
2919 |
> |
if (deltaRtemp < genDeltaRLowest) genDeltaRLowest = deltaRtemp; |
2920 |
> |
} |
2921 |
> |
return genDeltaRLowest; |
2922 |
> |
} |
2923 |
|
|
2924 |
|
double |
2925 |
|
OSUAnalysis::applyFunction(string function, double value){ |
2939 |
|
|
2940 |
|
template <class InputCollection> |
2941 |
|
void OSUAnalysis::setObjectFlags(cut ¤tCut, uint currentCutIndex, flagMap &individualFlags, flagMap &cumulativeFlags, InputCollection inputCollection, string inputType){ |
2942 |
< |
|
2502 |
< |
|
2942 |
> |
|
2943 |
|
for (uint object = 0; object != inputCollection->size(); object++){ |
2944 |
|
|
2945 |
|
|
2946 |
|
bool decision = true;//object passes if this cut doesn't cut on that type of object |
2947 |
|
|
2508 |
– |
|
2948 |
|
if(currentCut.inputCollection == inputType){ |
2949 |
|
|
2950 |
|
vector<bool> subcutDecisions; |
3066 |
|
double value = valueLookup(&inputCollection->at(object), inputVariable, function); |
3067 |
|
histo->Fill(value,scaleFactor); |
3068 |
|
|
3069 |
+ |
if (printEventInfo_) { |
3070 |
+ |
// Write information about event to screen, for testing purposes. |
3071 |
+ |
cout << " Info for event: value for histogram " << histo->GetName() << ": " << value << endl; |
3072 |
+ |
} |
3073 |
+ |
|
3074 |
|
} |
2631 |
– |
|
3075 |
|
} |
3076 |
|
|
3077 |
|
template <class InputCollection1, class InputCollection2> |
3080 |
|
bool sameObjects = false; |
3081 |
|
if(typeid(InputCollection1).name() == typeid(InputCollection2).name()) sameObjects = true; |
3082 |
|
|
3083 |
< |
int pairCounter = 0; |
3083 |
> |
int pairCounter = -1; |
3084 |
|
for (uint object1 = 0; object1 != inputCollection1->size(); object1++){ |
3085 |
|
for (uint object2 = 0; object2 != inputCollection2->size(); object2++){ |
3086 |
|
|
3087 |
|
if(sameObjects && object1 >= object2) continue;//account for duplicate pairs if both collections are the same |
3088 |
|
|
3089 |
+ |
pairCounter++; |
3090 |
|
//only take objects which have passed all cuts and pairs which have passed all cuts |
3091 |
|
if(!plotAllObjectsInPassingEvents_ && !flags1.at(object1)) continue; |
3092 |
|
if(!plotAllObjectsInPassingEvents_ && !flags2.at(object2)) continue; |
3107 |
|
double value = valueLookup(&inputCollection1->at(object1), &inputCollection2->at(object2), inputVariable, function); |
3108 |
|
histo->Fill(value,scaleFactor); |
3109 |
|
|
3110 |
< |
pairCounter++; |
3110 |
> |
|
3111 |
|
} |
3112 |
|
} |
3113 |
|
|
3160 |
|
bool sameObjects = false; |
3161 |
|
if(typeid(InputCollection1).name() == typeid(InputCollection2).name()) sameObjects = true; |
3162 |
|
|
3163 |
< |
int pairCounter = 0; |
3163 |
> |
int pairCounter = -1; |
3164 |
|
for (uint object1 = 0; object1 != inputCollection1->size(); object1++){ |
3165 |
|
for (uint object2 = 0; object2 != inputCollection2->size(); object2++){ |
3166 |
|
|
3167 |
|
if(sameObjects && object1 >= object2) continue;//account for duplicate pairs if both collections are the same |
3168 |
|
|
3169 |
+ |
pairCounter++; |
3170 |
+ |
|
3171 |
|
//only take objects which have passed all cuts and pairs which have passed all cuts |
3172 |
|
if(!plotAllObjectsInPassingEvents_ && !flags1.at(object1)) continue; |
3173 |
|
if(!plotAllObjectsInPassingEvents_ && !flags2.at(object2)) continue; |
3202 |
|
|
3203 |
|
histo->Fill(valueX,valueY,scaleFactor); |
3204 |
|
|
2759 |
– |
pairCounter++; |
2760 |
– |
|
3205 |
|
} |
3206 |
|
} |
3207 |
|
|
3218 |
|
|
3219 |
|
double currentDeltaR = deltaR(object->eta,object->phi,mcparticle->eta,mcparticle->phi); |
3220 |
|
if(currentDeltaR > 0.05) continue; |
3221 |
< |
// cout << std::setprecision(3) << std::setw(20) |
3222 |
< |
// << "\tcurrentParticle: eta = " << mcparticles->at(mcparticle - mcparticles->begin()).eta |
3223 |
< |
// << std::setw(20) |
3224 |
< |
// << "\tphi = " << mcparticles->at(mcparticle - mcparticles->begin()).phi |
3225 |
< |
// << std::setw(20) |
3226 |
< |
// << "\tdeltaR = " << currentDeltaR |
3227 |
< |
// << std::setprecision(1) |
3228 |
< |
// << std::setw(20) |
3229 |
< |
// << "\tid = " << mcparticles->at(mcparticle - mcparticles->begin()).id |
3230 |
< |
// << std::setw(20) |
3231 |
< |
// << "\tmotherId = " << mcparticles->at(mcparticle - mcparticles->begin()).motherId |
3232 |
< |
// << std::setw(20) |
3233 |
< |
// << "\tstatus = " << mcparticles->at(mcparticle - mcparticles->begin()).status<< endl; |
3221 |
> |
// cout << std::setprecision(3) << std::setw(20) |
3222 |
> |
// << "\tcurrentParticle: eta = " << mcparticles->at(mcparticle - mcparticles->begin()).eta |
3223 |
> |
// << std::setw(20) |
3224 |
> |
// << "\tphi = " << mcparticles->at(mcparticle - mcparticles->begin()).phi |
3225 |
> |
// << std::setw(20) |
3226 |
> |
// << "\tdeltaR = " << currentDeltaR |
3227 |
> |
// << std::setprecision(1) |
3228 |
> |
// << std::setw(20) |
3229 |
> |
// << "\tid = " << mcparticles->at(mcparticle - mcparticles->begin()).id |
3230 |
> |
// << std::setw(20) |
3231 |
> |
// << "\tmotherId = " << mcparticles->at(mcparticle - mcparticles->begin()).motherId |
3232 |
> |
// << std::setw(20) |
3233 |
> |
// << "\tstatus = " << mcparticles->at(mcparticle - mcparticles->begin()).status<< endl; |
3234 |
|
if(currentDeltaR < bestMatchDeltaR && mcparticles->at(mcparticle - mcparticles->begin()).id != mcparticles->at(mcparticle - mcparticles->begin()).motherId){ |
3235 |
|
bestMatchIndex = mcparticle - mcparticles->begin(); |
3236 |
|
bestMatchDeltaR = currentDeltaR; |
3237 |
|
} |
3238 |
|
|
3239 |
|
} |
3240 |
< |
// if(bestMatchDeltaR != 999) cout << "bestMatch: deltaR = " << bestMatchDeltaR << " id = " << mcparticles->at(bestMatchIndex).id << " motherId = " << mcparticles->at(bestMatchIndex).motherId << endl; |
3241 |
< |
// else cout << "no match found..." << endl; |
3240 |
> |
// if(bestMatchDeltaR != 999) cout << "bestMatch: deltaR = " << bestMatchDeltaR << " id = " << mcparticles->at(bestMatchIndex).id << " motherId = " << mcparticles->at(bestMatchIndex).motherId << endl; |
3241 |
> |
// else cout << "no match found..." << endl; |
3242 |
|
return bestMatchIndex; |
3243 |
|
|
3244 |
|
} |
3329 |
|
const BNprimaryvertex *chosenVertex = 0; |
3330 |
|
if(std::find(objectsToCut.begin(), objectsToCut.end(), "primaryvertexs") != objectsToCut.end()) { |
3331 |
|
vector<bool> vertexFlags = cumulativeFlags.at("primaryvertexs").back().size() ? cumulativeFlags.at("primaryvertexs").back() : |
3332 |
< |
cumulativeFlags.at("primaryvertexs").at(cumulativeFlags.at("primaryvertexs").size() - 2); |
3332 |
> |
cumulativeFlags.at("primaryvertexs").at(cumulativeFlags.at("primaryvertexs").size() - 2); |
3333 |
|
for (uint vertexIndex = 0; vertexIndex != vertexFlags.size(); vertexIndex++){ |
3334 |
|
if(!vertexFlags.at(vertexIndex)) continue; |
3335 |
|
chosenVertex = & primaryvertexs->at(vertexIndex); |
3349 |
|
const BNmet *chosenMET = 0; |
3350 |
|
if(std::find(objectsToCut.begin(), objectsToCut.end(), "mets") != objectsToCut.end()) { |
3351 |
|
vector<bool> metFlags = cumulativeFlags.at("mets").back().size() ? cumulativeFlags.at("mets").back() : |
3352 |
< |
cumulativeFlags.at("mets").at(cumulativeFlags.at("mets").size() - 2); |
3352 |
> |
cumulativeFlags.at("mets").at(cumulativeFlags.at("mets").size() - 2); |
3353 |
|
for (uint metIndex = 0; metIndex != metFlags.size(); metIndex++){ |
3354 |
|
if(!metFlags.at(metIndex)) continue; |
3355 |
|
chosenMET = & mets->at(metIndex); |
3369 |
|
const BNelectron *chosenElectron = 0; |
3370 |
|
if(std::find(objectsToCut.begin(), objectsToCut.end(), "electrons") != objectsToCut.end()) { |
3371 |
|
vector<bool> electronFlags = cumulativeFlags.at("electrons").back().size() ? cumulativeFlags.at("electrons").back() : |
3372 |
< |
cumulativeFlags.at("electrons").at(cumulativeFlags.at("electrons").size() - 2); |
3372 |
> |
cumulativeFlags.at("electrons").at(cumulativeFlags.at("electrons").size() - 2); |
3373 |
|
for (uint electronIndex = 0; electronIndex != electronFlags.size(); electronIndex++){ |
3374 |
|
if(!electronFlags.at(electronIndex)) continue; |
3375 |
|
chosenElectron = & electrons->at(electronIndex); |
3389 |
|
const BNmuon *chosenMuon = 0; |
3390 |
|
if(std::find(objectsToCut.begin(), objectsToCut.end(), "muons") != objectsToCut.end()) { |
3391 |
|
vector<bool> muonFlags = cumulativeFlags.at("muons").back().size() ? cumulativeFlags.at("muons").back() : |
3392 |
< |
cumulativeFlags.at("muons").at(cumulativeFlags.at("muons").size() - 2); |
3392 |
> |
cumulativeFlags.at("muons").at(cumulativeFlags.at("muons").size() - 2); |
3393 |
|
for (uint muonIndex = 0; muonIndex != muonFlags.size(); muonIndex++){ |
3394 |
|
if(!muonFlags.at(muonIndex)) continue; |
3395 |
|
chosenMuon = & muons->at(muonIndex); |