27 |
|
channels_ (cfg.getParameter<vector<edm::ParameterSet> >("channels")), |
28 |
|
histogramSets_ (cfg.getParameter<vector<edm::ParameterSet> >("histogramSets")), |
29 |
|
plotAllObjectsInPassingEvents_ (cfg.getParameter<bool> ("plotAllObjectsInPassingEvents")), |
30 |
< |
doPileupReweighting_ (cfg.getParameter<bool> ("doPileupReweighting")) |
30 |
> |
doPileupReweighting_ (cfg.getParameter<bool> ("doPileupReweighting")), |
31 |
> |
printEventInfo_ (cfg.getParameter<bool> ("printEventInfo")), |
32 |
> |
useTrackCaloRhoCorr_ (cfg.getParameter<bool> ("useTrackCaloRhoCorr")) |
33 |
> |
|
34 |
|
{ |
35 |
|
|
36 |
|
TH1::SetDefaultSumw2 (); |
38 |
|
//create pile-up reweighting object, if necessary |
39 |
|
if(datasetType_ != "data") { |
40 |
|
if(doPileupReweighting_) puWeight_ = new PUWeight (puFile_, dataPU_, dataset_); |
41 |
< |
muonSFWeight_ = new MuonSFWeight (muonSFFile_, muonSF_); |
42 |
< |
electronSFWeight_ = new ElectronSFWeight ("53X", electronSFID_); |
41 |
> |
// muonSFWeight_ = new MuonSFWeight (muonSFFile_, muonSF_); |
42 |
> |
// electronSFWeight_ = new ElectronSFWeight ("53X", electronSFID_); |
43 |
|
} |
44 |
|
|
45 |
|
|
65 |
|
|
66 |
|
string tempInputCollection = histogramSets_.at(currentHistogramSet).getParameter<string> ("inputCollection"); |
67 |
|
if(tempInputCollection == "muon-electron pairs") tempInputCollection = "electron-muon pairs"; |
68 |
+ |
if(tempInputCollection == "event-track pairs") tempInputCollection = "track-event pairs"; |
69 |
|
if(tempInputCollection.find("pairs")==std::string::npos){ //just a single object |
70 |
|
objectsToGet.push_back(tempInputCollection); |
71 |
|
objectsToPlot.push_back(tempInputCollection); |
85 |
|
objectsToCut.push_back(tempInputCollection.substr(0,dashIndex)+"s"); |
86 |
|
objectsToCut.push_back(tempInputCollection.substr(dashIndex+1,secondWordLength-1)+"s"); |
87 |
|
|
88 |
< |
} |
88 |
> |
} |
89 |
|
|
90 |
|
vector<edm::ParameterSet> histogramList_ (histogramSets_.at(currentHistogramSet).getParameter<vector<edm::ParameterSet> >("histograms")); |
91 |
|
|
117 |
|
histogram tempIdHisto; |
118 |
|
histogram tempMomIdHisto; |
119 |
|
histogram tempGmaIdHisto; |
120 |
+ |
histogram tempIdVsMomIdHisto; |
121 |
|
|
122 |
|
tempIdHisto.inputCollection = currentObject; |
123 |
|
tempMomIdHisto.inputCollection = currentObject; |
124 |
|
tempGmaIdHisto.inputCollection = currentObject; |
125 |
+ |
tempIdVsMomIdHisto.inputCollection = currentObject; |
126 |
|
|
127 |
|
currentObject = currentObject.substr(0, currentObject.size()-1); |
128 |
|
tempIdHisto.name = currentObject+"GenMatchId"; |
129 |
|
tempMomIdHisto.name = currentObject+"GenMatchMotherId"; |
130 |
|
tempGmaIdHisto.name = currentObject+"GenMatchGrandmotherId"; |
131 |
+ |
tempIdVsMomIdHisto.name = currentObject+"GenMatchIdVsMotherId"; |
132 |
|
|
133 |
|
currentObject.at(0) = toupper(currentObject.at(0)); |
134 |
|
tempIdHisto.title = currentObject+" Gen-matched Particle"; |
135 |
|
tempMomIdHisto.title = currentObject+" Gen-matched Particle's Mother"; |
136 |
|
tempGmaIdHisto.title = currentObject+" Gen-matched Particle's Grandmother"; |
137 |
+ |
tempIdVsMomIdHisto.title = currentObject+" Gen-matched Particle's Mother vs. Particle;Particle;Mother"; |
138 |
|
|
139 |
|
int maxNum = 24; |
140 |
|
vector<double> binVector; |
148 |
|
tempMomIdHisto.inputVariables.push_back("genMatchedMotherId"); |
149 |
|
tempGmaIdHisto.bins = binVector; |
150 |
|
tempGmaIdHisto.inputVariables.push_back("genMatchedGrandmotherId"); |
151 |
+ |
binVector.push_back(maxNum); |
152 |
+ |
binVector.push_back(0); |
153 |
+ |
binVector.push_back(maxNum); |
154 |
+ |
tempIdVsMomIdHisto.bins = binVector; |
155 |
+ |
tempIdVsMomIdHisto.inputVariables.push_back("genMatchedId"); |
156 |
+ |
tempIdVsMomIdHisto.inputVariables.push_back("genMatchedMotherIdReverse"); |
157 |
|
|
158 |
|
histograms.push_back(tempIdHisto); |
159 |
|
histograms.push_back(tempMomIdHisto); |
160 |
|
histograms.push_back(tempGmaIdHisto); |
161 |
< |
|
161 |
> |
histograms.push_back(tempIdVsMomIdHisto); |
162 |
|
} |
163 |
|
|
164 |
|
|
151 |
– |
|
165 |
|
channel tempChannel; |
166 |
|
//loop over all channels (event selections) |
167 |
|
for(uint currentChannel = 0; currentChannel != channels_.size(); currentChannel++){ |
198 |
|
twoDHists_.push_back(twoDhistoMap); |
199 |
|
|
200 |
|
|
201 |
+ |
|
202 |
|
//book all histograms included in the configuration |
203 |
|
for(uint currentHistogramIndex = 0; currentHistogramIndex != histograms.size(); currentHistogramIndex++){ |
204 |
|
histogram currentHistogram = histograms.at(currentHistogramIndex); |
224 |
|
|
225 |
|
if(currentHistogram.name.find("GenMatch")==std::string::npos) continue; |
226 |
|
|
227 |
< |
// bin particle type |
228 |
< |
// --- ------------- |
229 |
< |
// 0 unmatched |
230 |
< |
// 1 u |
231 |
< |
// 2 d |
232 |
< |
// 3 s |
233 |
< |
// 4 c |
234 |
< |
// 5 b |
235 |
< |
// 6 t |
236 |
< |
// 7 e |
237 |
< |
// 8 mu |
238 |
< |
// 9 tau |
239 |
< |
// 10 nu |
240 |
< |
// 11 g |
241 |
< |
// 12 gamma |
242 |
< |
// 13 Z |
243 |
< |
// 14 W |
244 |
< |
// 15 light meson |
245 |
< |
// 16 K meson |
246 |
< |
// 17 D meson |
247 |
< |
// 18 B meson |
248 |
< |
// 19 light baryon |
249 |
< |
// 20 strange baryon |
250 |
< |
// 21 charm baryon |
251 |
< |
// 22 bottom baryon |
252 |
< |
// 23 other |
227 |
> |
// bin particle type |
228 |
> |
// --- ------------- |
229 |
> |
// 0 unmatched |
230 |
> |
// 1 u |
231 |
> |
// 2 d |
232 |
> |
// 3 s |
233 |
> |
// 4 c |
234 |
> |
// 5 b |
235 |
> |
// 6 t |
236 |
> |
// 7 e |
237 |
> |
// 8 mu |
238 |
> |
// 9 tau |
239 |
> |
// 10 nu |
240 |
> |
// 11 g |
241 |
> |
// 12 gamma |
242 |
> |
// 13 Z |
243 |
> |
// 14 W |
244 |
> |
// 15 light meson |
245 |
> |
// 16 K meson |
246 |
> |
// 17 D meson |
247 |
> |
// 18 B meson |
248 |
> |
// 19 light baryon |
249 |
> |
// 20 strange baryon |
250 |
> |
// 21 charm baryon |
251 |
> |
// 22 bottom baryon |
252 |
> |
// 23 other |
253 |
|
|
254 |
|
vector<TString> labelArray; |
255 |
|
labelArray.push_back("unmatched"); |
278 |
|
labelArray.push_back("other"); |
279 |
|
|
280 |
|
for(int bin = 0; bin !=currentHistogram.bins.at(0); bin++){ |
281 |
< |
oneDHists_.at(currentChannel)[currentHistogram.name]->GetXaxis()->SetBinLabel(bin+1,labelArray.at(bin)); |
281 |
> |
if(currentHistogram.name.find("GenMatchIdVsMotherId")==std::string::npos) { |
282 |
> |
oneDHists_.at(currentChannel)[currentHistogram.name]->GetXaxis()->SetBinLabel(bin+1,labelArray.at(bin)); |
283 |
> |
} |
284 |
> |
else { |
285 |
> |
twoDHists_.at(currentChannel)[currentHistogram.name]->GetYaxis()->SetBinLabel(bin+1,labelArray.at(currentHistogram.bins.at(0)-bin-1)); |
286 |
> |
twoDHists_.at(currentChannel)[currentHistogram.name]->GetXaxis()->SetBinLabel(bin+1,labelArray.at(bin)); |
287 |
> |
} |
288 |
> |
} |
289 |
> |
if(currentHistogram.name.find("GenMatchIdVsMotherId")!=std::string::npos) { |
290 |
> |
twoDHists_.at(currentChannel)[currentHistogram.name]->GetXaxis()->CenterTitle(); |
291 |
> |
twoDHists_.at(currentChannel)[currentHistogram.name]->GetYaxis()->CenterTitle(); |
292 |
|
} |
269 |
– |
} |
293 |
|
|
294 |
< |
//book a histogram for the number of each object type to be plotted |
294 |
> |
} |
295 |
|
|
296 |
+ |
// Book a histogram for the number of each object type to be plotted. |
297 |
+ |
// Name of objectToPlot here must match the name specified in OSUAnalysis::analyze(). |
298 |
|
for (uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){ |
299 |
|
string currentObject = objectsToPlot.at(currentObjectIndex); |
300 |
|
int maxNum = 10; |
302 |
|
else if(currentObject == "primaryvertexs") maxNum = 50; |
303 |
|
else if(currentObject == "muon-muon pairs") currentObject = "dimuonPairs"; |
304 |
|
else if(currentObject == "electron-electron pairs") currentObject = "dielectronPairs"; |
305 |
< |
else if(currentObject == "electron-muon pairs") currentObject = "electronMuonPairs"; |
306 |
< |
|
307 |
< |
currentObject.at(0) = toupper(currentObject.at(0)); |
305 |
> |
else if(currentObject == "electron-muon pairs") currentObject = "electronMuonPairs"; |
306 |
> |
else if(currentObject == "track-event pairs") currentObject = "trackEventPairs"; |
307 |
> |
else if(currentObject == "electron-track pairs") currentObject = "electronTrackPairs"; |
308 |
> |
else if(currentObject == "muon-track pairs") currentObject = "muonTrackPairs"; |
309 |
> |
else if(currentObject == "muon-tau pairs") currentObject = "muonTauPairs"; |
310 |
> |
else if(currentObject == "tau-tau pairs") currentObject = "ditauPairs"; |
311 |
> |
currentObject.at(0) = toupper(currentObject.at(0)); |
312 |
|
string histoName = "num" + currentObject; |
313 |
|
|
314 |
|
if(histoName == "numPrimaryvertexs"){ |
324 |
|
|
325 |
|
|
326 |
|
|
298 |
– |
|
327 |
|
//get list of cuts for this channel |
328 |
|
vector<edm::ParameterSet> cuts_ (channels_.at(currentChannel).getParameter<vector<edm::ParameterSet> >("cuts")); |
329 |
|
|
483 |
|
if (std::find(objectsToGet.begin(), objectsToGet.end(), "superclusters") != objectsToGet.end()) |
484 |
|
event.getByLabel (superclusters_, superclusters); |
485 |
|
|
486 |
+ |
if (useTrackCaloRhoCorr_) { |
487 |
+ |
// Used only for pile-up correction of by-hand calculation of isolation energy. |
488 |
+ |
// This rho collection is not available in all BEANs. |
489 |
+ |
// For description of rho values for different jet reconstruction algorithms, see |
490 |
+ |
// https://twiki.cern.ch/twiki/bin/view/CMS/JetAlgorithms#Algorithms |
491 |
+ |
event.getByLabel ("kt6CaloJets","rho", rhokt6CaloJetsHandle_); |
492 |
+ |
} |
493 |
+ |
|
494 |
+ |
|
495 |
|
//get pile-up event weight |
496 |
|
double scaleFactor = 1.00; |
497 |
|
if(doPileupReweighting_ && datasetType_ != "data") |
561 |
|
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \ |
562 |
|
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
563 |
|
"electron-muon pairs"); |
564 |
< |
|
565 |
< |
|
564 |
> |
else if(currentObject == "track-event pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,tracks.product(),events.product(), |
565 |
> |
cumulativeFlags.at("tracks").at(flagsForPairCutsIndex), |
566 |
> |
cumulativeFlags.at("events").at(flagsForPairCutsIndex), |
567 |
> |
"track-event pairs"); |
568 |
> |
else if(currentObject == "electron-track pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),tracks.product(), |
569 |
> |
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), |
570 |
> |
cumulativeFlags.at("tracks").at(flagsForPairCutsIndex), |
571 |
> |
"electron-track pairs"); |
572 |
> |
else if(currentObject == "muon-track pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),tracks.product(), |
573 |
> |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), |
574 |
> |
cumulativeFlags.at("tracks").at(flagsForPairCutsIndex), |
575 |
> |
"muon-track pairs"); |
576 |
> |
else if(currentObject == "muon-tau pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),taus.product(), |
577 |
> |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), |
578 |
> |
cumulativeFlags.at("taus").at(flagsForPairCutsIndex), |
579 |
> |
"muon-tau pairs"); |
580 |
> |
else if(currentObject == "tau-tau pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,taus .product(),taus.product(), |
581 |
> |
cumulativeFlags.at("taus").at(flagsForPairCutsIndex), |
582 |
> |
cumulativeFlags.at("taus").at(flagsForPairCutsIndex), |
583 |
> |
"tau-tau pairs"); |
584 |
> |
|
585 |
> |
|
586 |
|
} |
587 |
|
|
588 |
|
|
606 |
|
int numberPassing = 0; |
607 |
|
|
608 |
|
for (uint object = 0; object != cumulativeFlags.at(currentCut.inputCollection).at(currentCutIndex).size() ; object++){ |
609 |
< |
if(cumulativeFlags.at(currentCut.inputCollection).at(currentCutIndex).at(object)) numberPassing++; |
609 |
> |
if(cumulativeFlags.at(currentCut.inputCollection).at(currentCutIndex).at(object)) numberPassing++; |
610 |
|
} |
611 |
|
|
612 |
|
bool cutDecision = evaluateComparison(numberPassing,currentCut.eventComparativeOperator,currentCut.numberRequired); |
622 |
|
|
623 |
|
if(!eventPassedAllCuts)continue; |
624 |
|
|
625 |
+ |
if (printEventInfo_) { |
626 |
+ |
// Write information about event to screen, for testing purposes. |
627 |
+ |
cout << "Event passed all cuts in channel " << currentChannel.name |
628 |
+ |
<< ": run=" << events->at(0).run |
629 |
+ |
<< " lumi=" << events->at(0).lumi |
630 |
+ |
<< " event=" << events->at(0).evt |
631 |
+ |
<< endl; |
632 |
+ |
} |
633 |
+ |
|
634 |
|
|
635 |
< |
//if(datasetType_ != "data") { |
636 |
< |
// scaleFactor *= muonSFWeight_->at (chosenMuon ()->eta); |
637 |
< |
// scaleFactor *= electronSFWeight_->at (chosenElectron ()->eta, chosenElectron ()->pt); |
638 |
< |
//} |
635 |
> |
// if(datasetType_ != "data") { |
636 |
> |
// scaleFactor *= muonSFWeight_->at (chosenMuon ()->eta); |
637 |
> |
// scaleFactor *= electronSFWeight_->at (chosenElectron ()->eta, chosenElectron ()->pt); |
638 |
> |
// } |
639 |
|
|
640 |
|
//filling histograms |
641 |
|
for (uint histogramIndex = 0; histogramIndex != histograms.size(); histogramIndex++){ |
648 |
|
|
649 |
|
|
650 |
|
if(currentHistogram.inputCollection == "jets") fill1DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("jets").back(),scaleFactor); |
651 |
< |
else if(currentHistogram.inputCollection == "muons") fill1DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("muons").back(),scaleFactor); |
651 |
> |
else if(currentHistogram.inputCollection == "muons") fill1DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("muons").back(),scaleFactor); |
652 |
|
else if(currentHistogram.inputCollection == "muon-muon pairs") fill1DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
653 |
|
cumulativeFlags.at("muons").back(),cumulativeFlags.at("muons").back(), \ |
654 |
|
cumulativeFlags.at("muon-muon pairs").back(),scaleFactor); |
657 |
|
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("electrons").back(),\ |
658 |
|
cumulativeFlags.at("electron-electron pairs").back(),scaleFactor); |
659 |
|
else if(currentHistogram.inputCollection == "electron-muon pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),muons.product(), \ |
660 |
< |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("muons").back(), |
661 |
< |
cumulativeFlags.at("electron-muon pairs").back(),scaleFactor); |
660 |
> |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("muons").back(), |
661 |
> |
cumulativeFlags.at("electron-muon pairs").back(),scaleFactor); |
662 |
> |
else if(currentHistogram.inputCollection == "electron-track pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),tracks.product(), |
663 |
> |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("tracks").back(), |
664 |
> |
cumulativeFlags.at("electron-track pairs").back(),scaleFactor); |
665 |
> |
else if(currentHistogram.inputCollection == "muon-track pairs") fill1DHistogram(histo,currentHistogram, muons.product(),tracks.product(), |
666 |
> |
cumulativeFlags.at("muons").back(),cumulativeFlags.at("tracks").back(), |
667 |
> |
cumulativeFlags.at("muon-track pairs").back(),scaleFactor); |
668 |
> |
else if(currentHistogram.inputCollection == "muon-tau pairs") fill1DHistogram(histo,currentHistogram, muons.product(),taus.product(), |
669 |
> |
cumulativeFlags.at("muons").back(),cumulativeFlags.at("taus").back(), |
670 |
> |
cumulativeFlags.at("muon-tau pairs").back(),scaleFactor); |
671 |
> |
else if(currentHistogram.inputCollection == "tau-tau pairs") fill1DHistogram(histo,currentHistogram, taus.product(),taus.product(), |
672 |
> |
cumulativeFlags.at("taus").back(),cumulativeFlags.at("taus").back(), |
673 |
> |
cumulativeFlags.at("tau-tau pairs").back(),scaleFactor); |
674 |
|
else if(currentHistogram.inputCollection == "events") fill1DHistogram(histo,currentHistogram,events.product(),cumulativeFlags.at("events").back(),scaleFactor); |
675 |
|
else if(currentHistogram.inputCollection == "taus") fill1DHistogram(histo,currentHistogram,taus.product(),cumulativeFlags.at("taus").back(),scaleFactor); |
676 |
|
else if(currentHistogram.inputCollection == "mets") fill1DHistogram(histo,currentHistogram,mets.product(),cumulativeFlags.at("mets").back(),scaleFactor); |
698 |
|
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("electrons").back(), \ |
699 |
|
cumulativeFlags.at("electron-electron pairs").back(),scaleFactor); |
700 |
|
else if(currentHistogram.inputCollection == "electron-muon pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),muons.product(), \ |
701 |
< |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("muons").back(), \ |
702 |
< |
cumulativeFlags.at("electron-muon pairs").back(),scaleFactor); |
703 |
< |
else if(currentHistogram.inputCollection == "events") fill2DHistogram(histo,currentHistogram,events.product(),cumulativeFlags.at("events").back(),scaleFactor); |
701 |
> |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("muons").back(), \ |
702 |
> |
cumulativeFlags.at("electron-muon pairs").back(),scaleFactor); |
703 |
> |
else if(currentHistogram.inputCollection == "electron-track pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),tracks.product(), |
704 |
> |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("tracks").back(), |
705 |
> |
cumulativeFlags.at("electron-track pairs").back(),scaleFactor); |
706 |
> |
else if(currentHistogram.inputCollection == "muon-track pairs") fill2DHistogram(histo,currentHistogram,muons.product(),tracks.product(), |
707 |
> |
cumulativeFlags.at("muons").back(),cumulativeFlags.at("tracks").back(), |
708 |
> |
cumulativeFlags.at("muon-track pairs").back(),scaleFactor); |
709 |
> |
else if(currentHistogram.inputCollection == "muon-tau pairs") fill2DHistogram(histo,currentHistogram,muons.product(),taus.product(), |
710 |
> |
cumulativeFlags.at("muons").back(),cumulativeFlags.at("taus").back(), |
711 |
> |
cumulativeFlags.at("muon-tau pairs").back(),scaleFactor); |
712 |
> |
else if(currentHistogram.inputCollection == "tau-tau pairs") fill2DHistogram(histo,currentHistogram,taus.product(),taus.product(), |
713 |
> |
cumulativeFlags.at("taus").back(),cumulativeFlags.at("taus").back(), |
714 |
> |
cumulativeFlags.at("tau-tau pairs").back(),scaleFactor); |
715 |
> |
else if(currentHistogram.inputCollection == "events") fill2DHistogram(histo,currentHistogram,events.product(),cumulativeFlags.at("events").back(),scaleFactor); |
716 |
|
else if(currentHistogram.inputCollection == "taus") fill2DHistogram(histo,currentHistogram,taus.product(),cumulativeFlags.at("taus").back(),scaleFactor); |
717 |
|
else if(currentHistogram.inputCollection == "mets") fill2DHistogram(histo,currentHistogram,mets.product(),cumulativeFlags.at("mets").back(),scaleFactor); |
718 |
|
else if(currentHistogram.inputCollection == "tracks") fill2DHistogram(histo,currentHistogram,tracks.product(),cumulativeFlags.at("tracks").back(),scaleFactor); |
719 |
+ |
else if(currentHistogram.inputCollection == "track-event pairs") fill2DHistogram(histo,currentHistogram,tracks.product(),events.product(), |
720 |
+ |
cumulativeFlags.at("tracks").back(),cumulativeFlags.at("events").back(), |
721 |
+ |
cumulativeFlags.at("track-event pairs").back(),scaleFactor); |
722 |
|
else if(currentHistogram.inputCollection == "genjets") fill2DHistogram(histo,currentHistogram,genjets.product(),cumulativeFlags.at("genjets").back(),scaleFactor); |
723 |
|
else if(currentHistogram.inputCollection == "mcparticles") fill2DHistogram(histo,currentHistogram,mcparticles.product(),cumulativeFlags.at("mcparticles").back(),scaleFactor); |
724 |
|
else if(currentHistogram.inputCollection == "primaryvertexs") fill2DHistogram(histo,currentHistogram,primaryvertexs.product(),cumulativeFlags.at("primaryvertexs").back(),scaleFactor); |
730 |
|
|
731 |
|
//fills histograms with the sizes of collections |
732 |
|
for (uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){ |
733 |
+ |
|
734 |
|
string currentObject = objectsToPlot.at(currentObjectIndex); |
735 |
|
|
736 |
< |
string objectToPlot = ""; |
736 |
> |
string objectToPlot = ""; |
737 |
|
|
738 |
+ |
// Name of objectToPlot here must match the name specified in OSUAnalysis::OSUAnalysis(). |
739 |
|
if(currentObject == "muon-muon pairs") objectToPlot = "dimuonPairs"; |
740 |
|
else if(currentObject == "electron-electron pairs") objectToPlot = "dielectronPairs"; |
741 |
< |
else if(currentObject == "electron-muon pairs") objectToPlot = "electronMuonPairs"; |
741 |
> |
else if(currentObject == "electron-muon pairs") objectToPlot = "electronMuonPairs"; |
742 |
> |
else if(currentObject == "electron-track pairs") objectToPlot = "electronTrackPairs"; |
743 |
> |
else if(currentObject == "muon-track pairs") objectToPlot = "muonTrackPairs"; |
744 |
> |
else if(currentObject == "muon-tau pairs") objectToPlot = "muonTauPairs"; |
745 |
> |
else if(currentObject == "tau-tau pairs") objectToPlot = "ditauPairs"; |
746 |
> |
else if(currentObject == "track-event pairs") objectToPlot = "trackEventPairs"; |
747 |
|
else objectToPlot = currentObject; |
748 |
|
string tempCurrentObject = objectToPlot; |
749 |
< |
tempCurrentObject.at(0) = toupper(tempCurrentObject.at(0)); |
749 |
> |
tempCurrentObject.at(0) = toupper(tempCurrentObject.at(0)); |
750 |
|
string histoName = "num" + tempCurrentObject; |
751 |
|
|
752 |
|
|
653 |
– |
|
654 |
– |
|
753 |
|
//set position of primary vertex in event, in order to calculate quantities relative to it |
754 |
|
if(std::find(objectsToCut.begin(), objectsToCut.end(), currentObject) != objectsToCut.end()) { |
755 |
|
vector<bool> lastCutFlags = cumulativeFlags.at(currentObject).back(); |
761 |
|
oneDHists_.at(currentChannelIndex).at(histoName+"BeforePileupCorrection")->Fill(primaryvertexs->size()); |
762 |
|
oneDHists_.at(currentChannelIndex).at(histoName+"AfterPileupCorrection")->Fill(primaryvertexs->size(),scaleFactor); |
763 |
|
} |
764 |
< |
else |
764 |
> |
else { |
765 |
|
oneDHists_.at(currentChannelIndex).at(histoName)->Fill(numToPlot,scaleFactor); |
766 |
+ |
} |
767 |
|
} |
768 |
|
else if(objectToPlot == "jets") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(jets->size(),scaleFactor); |
769 |
|
else if(objectToPlot == "muons") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(muons->size(),scaleFactor); |
771 |
|
else if(objectToPlot == "electrons") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size(),scaleFactor); |
772 |
|
else if(objectToPlot == "dielectronPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size()*(electrons->size()-1)/2,scaleFactor); |
773 |
|
else if(objectToPlot == "electronMuonPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size()*muons->size(),scaleFactor); |
774 |
+ |
else if(objectToPlot == "electronTrackPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size()*tracks->size(),scaleFactor); |
775 |
|
else if(objectToPlot == "events") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(events->size(),scaleFactor); |
776 |
|
else if(objectToPlot == "taus") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(taus->size(),scaleFactor); |
777 |
|
else if(objectToPlot == "mets") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(mets->size(),scaleFactor); |
784 |
|
else if(objectToPlot == "primaryvertexs"){ |
785 |
|
oneDHists_.at(currentChannelIndex).at(histoName+"BeforePileupCorrection")->Fill(primaryvertexs->size()); |
786 |
|
oneDHists_.at(currentChannelIndex).at(histoName+"AfterPileupCorrection")->Fill(primaryvertexs->size(),scaleFactor); |
787 |
< |
} |
688 |
< |
|
689 |
< |
} |
690 |
< |
|
691 |
< |
|
787 |
> |
} |
788 |
|
|
789 |
+ |
} // end for (uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){ |
790 |
|
|
791 |
|
} //end loop over channel |
792 |
|
|
793 |
|
masterCutFlow_->fillCutFlow(scaleFactor); |
794 |
|
|
795 |
+ |
} // end void OSUAnalysis::analyze (const edm::Event &event, const edm::EventSetup &setup) |
796 |
|
|
797 |
|
|
700 |
– |
} |
701 |
– |
|
798 |
|
|
799 |
|
bool |
800 |
|
OSUAnalysis::evaluateComparison (double testValue, string comparison, double cutValue){ |
1137 |
|
if (met) |
1138 |
|
{ |
1139 |
|
TLorentzVector p1 (object->px, object->py, object->pz, object->energy), |
1140 |
< |
p2 (met->px, met->py, 0.0, met->pt); |
1140 |
> |
p2 (met->px, met->py, 0.0, met->pt); |
1141 |
|
|
1142 |
|
value = (p1 + p2).Mt (); |
1143 |
|
} |
1257 |
|
value = object->isGlobalMuon > 0 \ |
1258 |
|
&& object->isPFMuon > 0 \ |
1259 |
|
&& object->normalizedChi2 < 10 \ |
1260 |
< |
&& object->numberOfValidMuonHits > 0 \ |
1260 |
> |
&& object->numberOfValidMuonHits > 0 \ |
1261 |
|
&& object->numberOfMatchedStations > 1 \ |
1262 |
|
&& fabs(object->correctedD0Vertex) < 0.2 \ |
1263 |
|
&& fabs(object->correctedDZ) < 0.5 \ |
1267 |
|
else if(variable == "tightIDdisplaced"){ |
1268 |
|
value = object->isGlobalMuon > 0 \ |
1269 |
|
&& object->normalizedChi2 < 10 \ |
1270 |
< |
&& object->numberOfValidMuonHits > 0 \ |
1270 |
> |
&& object->numberOfValidMuonHits > 0 \ |
1271 |
|
&& object->numberOfMatchedStations > 1 \ |
1272 |
|
&& object->numberOfValidPixelHits > 0 \ |
1273 |
|
&& object->numberOfLayersWithMeasurement > 5; |
1274 |
|
} |
1275 |
|
|
1276 |
+ |
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
1277 |
|
|
1278 |
+ |
else if(variable == "genMatchedPdgId"){ |
1279 |
+ |
int index = getGenMatchedParticleIndex(object); |
1280 |
+ |
if(index == -1) value = 0; |
1281 |
+ |
else value = mcparticles->at(index).id; |
1282 |
+ |
} |
1283 |
|
|
1284 |
|
else if(variable == "genMatchedId"){ |
1285 |
|
int index = getGenMatchedParticleIndex(object); |
1291 |
|
if(index == -1) value = 0; |
1292 |
|
else value = getPdgIdBinValue(mcparticles->at(index).motherId); |
1293 |
|
} |
1294 |
+ |
else if(variable == "genMatchedMotherIdReverse"){ |
1295 |
+ |
int index = getGenMatchedParticleIndex(object); |
1296 |
+ |
if(index == -1) value = 23; |
1297 |
+ |
else value = 23 -getPdgIdBinValue(mcparticles->at(index).motherId); |
1298 |
+ |
} |
1299 |
|
else if(variable == "genMatchedGrandmotherId"){ |
1300 |
|
int index = getGenMatchedParticleIndex(object); |
1301 |
|
if(index == -1) value = 0; |
1488 |
|
if (met) |
1489 |
|
{ |
1490 |
|
TLorentzVector p1 (object->px, object->py, object->pz, object->energy), |
1491 |
< |
p2 (met->px, met->py, 0.0, met->pt); |
1491 |
> |
p2 (met->px, met->py, 0.0, met->pt); |
1492 |
|
|
1493 |
|
value = (p1 + p2).Mt (); |
1494 |
|
} |
1654 |
|
} |
1655 |
|
} |
1656 |
|
|
1657 |
+ |
|
1658 |
+ |
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
1659 |
+ |
|
1660 |
+ |
else if(variable == "genMatchedPdgId"){ |
1661 |
+ |
int index = getGenMatchedParticleIndex(object); |
1662 |
+ |
if(index == -1) value = 0; |
1663 |
+ |
else value = mcparticles->at(index).id; |
1664 |
+ |
} |
1665 |
+ |
|
1666 |
+ |
|
1667 |
|
else if(variable == "genMatchedId"){ |
1668 |
|
int index = getGenMatchedParticleIndex(object); |
1669 |
|
if(index == -1) value = 0; |
1674 |
|
if(index == -1) value = 0; |
1675 |
|
else value = getPdgIdBinValue(mcparticles->at(index).motherId); |
1676 |
|
} |
1677 |
+ |
else if(variable == "genMatchedMotherIdReverse"){ |
1678 |
+ |
int index = getGenMatchedParticleIndex(object); |
1679 |
+ |
if(index == -1) value = 23; |
1680 |
+ |
else value = 23 -getPdgIdBinValue(mcparticles->at(index).motherId); |
1681 |
+ |
} |
1682 |
|
else if(variable == "genMatchedGrandmotherId"){ |
1683 |
|
int index = getGenMatchedParticleIndex(object); |
1684 |
|
if(index == -1) value = 0; |
1777 |
|
} |
1778 |
|
else if(variable == "muonScaleFactor"){ |
1779 |
|
if(datasetType_ != "data") |
1780 |
< |
value = muonSFWeight_->at (chosenMuon ()->eta); |
1780 |
> |
// value = muonSFWeight_->at (chosenMuon ()->eta); |
1781 |
> |
value = 1.0; |
1782 |
|
else |
1783 |
|
value = 1.0; |
1784 |
|
} |
1785 |
|
else if(variable == "electronScaleFactor"){ |
1786 |
|
if(datasetType_ != "data") |
1787 |
< |
value = electronSFWeight_->at (chosenElectron ()->eta, chosenElectron ()->pt); |
1787 |
> |
// value = electronSFWeight_->at (chosenElectron ()->eta, chosenElectron ()->pt); |
1788 |
> |
value = 1.0; |
1789 |
|
else |
1790 |
|
value = 1.0; |
1791 |
|
} |
1843 |
|
else if(variable == "leadingTrackValid") value = object->leadingTrackValid; |
1844 |
|
|
1845 |
|
|
1846 |
+ |
|
1847 |
+ |
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
1848 |
+ |
|
1849 |
+ |
else if(variable == "genMatchedPdgId"){ |
1850 |
+ |
int index = getGenMatchedParticleIndex(object); |
1851 |
+ |
if(index == -1) value = 0; |
1852 |
+ |
else value = mcparticles->at(index).id; |
1853 |
+ |
} |
1854 |
+ |
|
1855 |
|
else if(variable == "genMatchedId"){ |
1856 |
|
int index = getGenMatchedParticleIndex(object); |
1857 |
|
if(index == -1) value = 0; |
1862 |
|
if(index == -1) value = 0; |
1863 |
|
else value = getPdgIdBinValue(mcparticles->at(index).motherId); |
1864 |
|
} |
1865 |
+ |
else if(variable == "genMatchedMotherIdReverse"){ |
1866 |
+ |
int index = getGenMatchedParticleIndex(object); |
1867 |
+ |
if(index == -1) value = 23; |
1868 |
+ |
else value = 23 -getPdgIdBinValue(mcparticles->at(index).motherId); |
1869 |
+ |
} |
1870 |
|
else if(variable == "genMatchedGrandmotherId"){ |
1871 |
|
int index = getGenMatchedParticleIndex(object); |
1872 |
|
if(index == -1) value = 0; |
1963 |
|
|
1964 |
|
double value = 0.0; |
1965 |
|
double pMag = sqrt(object->pt * object->pt + |
1966 |
< |
object->pz * object->pz); |
1967 |
< |
|
1966 |
> |
object->pz * object->pz); |
1967 |
> |
|
1968 |
|
if(variable == "pt") value = object->pt; |
1969 |
|
else if(variable == "px") value = object->px; |
1970 |
|
else if(variable == "py") value = object->py; |
2000 |
|
//user defined variables |
2001 |
|
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; |
2002 |
|
else if(variable == "dZwrtBS") value = object->dZ - events->at(0).BSz; |
2003 |
< |
else if(variable == "caloTotDeltaRp5") value =(object->caloHadDeltaRp5 + object->caloEMDeltaRp5); |
2004 |
< |
else if(variable == "caloTotDeltaRp5ByP") value =( (object->caloHadDeltaRp5 + object->caloEMDeltaRp5)/pMag); |
2005 |
< |
|
2006 |
< |
|
2007 |
< |
|
2008 |
< |
|
2009 |
< |
|
2010 |
< |
else if(variable == "isIso") value = getTrkIsIso(object, tracks.product()); |
2011 |
< |
else if(variable == "isMatchedDeadEcal") value = getTrkIsMatchedDeadEcal(object); |
2012 |
< |
else if(variable == "ptErrorByPt") value = (object->ptError/object->pt); |
2013 |
< |
else if(variable == "ptError") value = object->ptError; |
2014 |
< |
else if(variable == "ptRes") value = getTrkPtRes(object); |
2015 |
< |
|
2003 |
> |
else if(variable == "caloTotDeltaRp5") value = (object->caloHadDeltaRp5 + object->caloEMDeltaRp5); |
2004 |
> |
else if(variable == "caloTotDeltaRp5ByP") value = ((object->caloHadDeltaRp5 + object->caloEMDeltaRp5)/pMag); |
2005 |
> |
else if(variable == "caloTotDeltaRp5_RhoCorr") value = getTrkCaloTotRhoCorr(object); |
2006 |
> |
else if(variable == "caloTotDeltaRp5ByP_RhoCorr") value = getTrkCaloTotRhoCorr(object) / pMag; |
2007 |
> |
else if(variable == "isIso") value = getTrkIsIso(object, tracks.product()); |
2008 |
> |
else if(variable == "isMatchedDeadEcal") value = getTrkIsMatchedDeadEcal(object); |
2009 |
> |
else if(variable == "ptErrorByPt") value = (object->ptError/object->pt); |
2010 |
> |
else if(variable == "ptError") value = object->ptError; |
2011 |
> |
else if(variable == "ptRes") value = getTrkPtRes(object); |
2012 |
> |
else if (variable == "d0wrtPV"){ |
2013 |
> |
double vx = object->vx - chosenVertex ()->x, |
2014 |
> |
vy = object->vy - chosenVertex ()->y, |
2015 |
> |
px = object->px, |
2016 |
> |
py = object->py, |
2017 |
> |
pt = object->pt; |
2018 |
> |
value = (-vx * py + vy * px) / pt; |
2019 |
> |
} |
2020 |
> |
else if (variable == "dZwrtPV"){ |
2021 |
> |
double vx = object->vx - chosenVertex ()->x, |
2022 |
> |
vy = object->vy - chosenVertex ()->y, |
2023 |
> |
vz = object->vz - chosenVertex ()->z, |
2024 |
> |
px = object->px, |
2025 |
> |
py = object->py, |
2026 |
> |
pz = object->pz, |
2027 |
> |
pt = object->pt; |
2028 |
> |
value = vz - (vx * px + vy * py)/pt * (pz/pt); |
2029 |
> |
} |
2030 |
|
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
2031 |
|
|
2032 |
< |
else if(variable == "genId"){ |
2032 |
> |
else if(variable == "genMatchedPdgId"){ |
2033 |
|
int index = getGenMatchedParticleIndex(object); |
2034 |
|
if(index == -1) value = 0; |
2035 |
|
else value = mcparticles->at(index).id; |
2046 |
|
if(index == -1) value = 0; |
2047 |
|
else value = getPdgIdBinValue(mcparticles->at(index).motherId); |
2048 |
|
} |
2049 |
+ |
else if(variable == "genMatchedMotherIdReverse"){ |
2050 |
+ |
int index = getGenMatchedParticleIndex(object); |
2051 |
+ |
if(index == -1) value = 23; |
2052 |
+ |
else value = 23 -getPdgIdBinValue(mcparticles->at(index).motherId); |
2053 |
+ |
} |
2054 |
|
else if(variable == "genMatchedGrandmotherId"){ |
2055 |
|
int index = getGenMatchedParticleIndex(object); |
2056 |
|
if(index == -1) value = 0; |
2354 |
|
|
2355 |
|
|
2356 |
|
|
2357 |
+ |
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
2358 |
+ |
|
2359 |
+ |
else if(variable == "genMatchedPdgId"){ |
2360 |
+ |
int index = getGenMatchedParticleIndex(object); |
2361 |
+ |
if(index == -1) value = 0; |
2362 |
+ |
else value = mcparticles->at(index).id; |
2363 |
+ |
} |
2364 |
|
|
2365 |
|
|
2366 |
|
|
2374 |
|
if(index == -1) value = 0; |
2375 |
|
else value = getPdgIdBinValue(mcparticles->at(index).motherId); |
2376 |
|
} |
2377 |
+ |
else if(variable == "genMatchedMotherIdReverse"){ |
2378 |
+ |
int index = getGenMatchedParticleIndex(object); |
2379 |
+ |
if(index == -1) value = 23; |
2380 |
+ |
else value = 23 -getPdgIdBinValue(mcparticles->at(index).motherId); |
2381 |
+ |
} |
2382 |
|
else if(variable == "genMatchedGrandmotherId"){ |
2383 |
|
int index = getGenMatchedParticleIndex(object); |
2384 |
|
if(index == -1) value = 0; |
2433 |
|
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
2434 |
|
value = (fourVector1 + fourVector2).M(); |
2435 |
|
} |
2436 |
+ |
else if(variable == "pt"){ |
2437 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
2438 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
2439 |
+ |
value = (fourVector1 + fourVector2).Pt(); |
2440 |
+ |
} |
2441 |
|
else if(variable == "threeDAngle") |
2442 |
|
{ |
2443 |
|
TVector3 threeVector1(object1->px, object1->py, object1->pz); |
2468 |
|
else if(variable == "muon2CorrectedD0Vertex"){ |
2469 |
|
value = object2->correctedD0Vertex; |
2470 |
|
} |
2471 |
< |
else if(variable == "muon1timeAtIpInOut"){ |
2471 |
> |
else if(variable == "muon1timeAtIpInOut"){ |
2472 |
|
value = object1->timeAtIpInOut; |
2473 |
|
} |
2474 |
< |
else if(variable == "muon2timeAtIpInOut"){ |
2474 |
> |
else if(variable == "muon2timeAtIpInOut"){ |
2475 |
|
value = object2->timeAtIpInOut; |
2476 |
|
} |
2477 |
< |
else if(variable == "muon1correctedD0") |
2478 |
< |
{ |
2479 |
< |
value = object1->correctedD0; |
2480 |
< |
} |
2481 |
< |
else if(variable == "muon1correctedD0Vertex") |
2482 |
< |
{ |
2483 |
< |
value = object1->correctedD0Vertex; |
2484 |
< |
} |
2477 |
> |
else if(variable == "muon1correctedD0") |
2478 |
> |
{ |
2479 |
> |
value = object1->correctedD0; |
2480 |
> |
} |
2481 |
> |
else if(variable == "muon2correctedD0") |
2482 |
> |
{ |
2483 |
> |
value = object2->correctedD0; |
2484 |
> |
} |
2485 |
> |
|
2486 |
|
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2487 |
|
|
2488 |
|
value = applyFunction(function, value); |
2502 |
|
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
2503 |
|
value = (fourVector1 + fourVector2).M(); |
2504 |
|
} |
2505 |
+ |
else if(variable == "pt"){ |
2506 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
2507 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
2508 |
+ |
value = (fourVector1 + fourVector2).Pt(); |
2509 |
+ |
} |
2510 |
|
else if(variable == "threeDAngle") |
2511 |
|
{ |
2512 |
|
TVector3 threeVector1(object1->px, object1->py, object1->pz); |
2530 |
|
else if(variable == "electron2CorrectedD0Vertex"){ |
2531 |
|
value = object2->correctedD0Vertex; |
2532 |
|
} |
2533 |
+ |
else if(variable == "electron1CorrectedD0"){ |
2534 |
+ |
value = object1->correctedD0; |
2535 |
+ |
} |
2536 |
+ |
else if(variable == "electron2CorrectedD0"){ |
2537 |
+ |
value = object2->correctedD0; |
2538 |
+ |
} |
2539 |
|
|
2540 |
|
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2541 |
|
|
2556 |
|
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
2557 |
|
value = (fourVector1 + fourVector2).M(); |
2558 |
|
} |
2559 |
+ |
else if(variable == "pt"){ |
2560 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
2561 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
2562 |
+ |
value = (fourVector1 + fourVector2).Pt(); |
2563 |
+ |
} |
2564 |
|
else if(variable == "threeDAngle") |
2565 |
|
{ |
2566 |
|
TVector3 threeVector1(object1->px, object1->py, object1->pz); |
2596 |
|
else if(variable == "muonDetIso"){ |
2597 |
|
value = (object2->trackIsoDR03) / object2->pt; |
2598 |
|
} |
2408 |
– |
else if(variable == "chargeProduct"){ |
2409 |
– |
value = object1->charge * object2->charge; |
2410 |
– |
} |
2599 |
|
|
2600 |
|
|
2601 |
|
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2606 |
|
} |
2607 |
|
|
2608 |
|
|
2609 |
+ |
double |
2610 |
+ |
OSUAnalysis::valueLookup (const BNelectron* object1, const BNtrack* object2, string variable, string function){ |
2611 |
+ |
double electronMass = 0.000511; |
2612 |
+ |
double value = 0.0; |
2613 |
+ |
TLorentzVector fourVector1(0, 0, 0, 0); |
2614 |
+ |
TLorentzVector fourVector2(0, 0, 0, 0); |
2615 |
+ |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
2616 |
+ |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
2617 |
+ |
else if(variable == "invMass"){ |
2618 |
+ |
fourVector1.SetPtEtaPhiM(object1->pt, object1->eta, object1->phi, electronMass); |
2619 |
+ |
fourVector2.SetPtEtaPhiM(object2->pt, object2->eta, object2->phi, electronMass ); |
2620 |
+ |
|
2621 |
+ |
value = (fourVector1 + fourVector2).M(); |
2622 |
+ |
} |
2623 |
+ |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2624 |
+ |
value = applyFunction(function, value); |
2625 |
+ |
return value; |
2626 |
+ |
} |
2627 |
+ |
|
2628 |
+ |
|
2629 |
+ |
|
2630 |
+ |
double |
2631 |
+ |
OSUAnalysis::valueLookup (const BNmuon* object1, const BNtrack* object2, string variable, string function){ |
2632 |
+ |
double pionMass = 0.140; |
2633 |
+ |
double muonMass = 0.106; |
2634 |
+ |
double value = 0.0; |
2635 |
+ |
TLorentzVector fourVector1(0, 0, 0, 0); |
2636 |
+ |
TLorentzVector fourVector2(0, 0, 0, 0); |
2637 |
+ |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
2638 |
+ |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
2639 |
+ |
else if(variable == "invMass"){ |
2640 |
+ |
fourVector1.SetPtEtaPhiM(object1->pt, object1->eta, object1->phi, muonMass); |
2641 |
+ |
fourVector2.SetPtEtaPhiM(object2->pt, object2->eta, object2->phi, pionMass ); |
2642 |
+ |
|
2643 |
+ |
value = (fourVector1 + fourVector2).M(); |
2644 |
+ |
} |
2645 |
+ |
|
2646 |
+ |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2647 |
+ |
value = applyFunction(function, value); |
2648 |
+ |
return value; |
2649 |
+ |
} |
2650 |
+ |
|
2651 |
+ |
|
2652 |
+ |
double |
2653 |
+ |
OSUAnalysis::valueLookup (const BNtau* object1, const BNtau* object2, string variable, string function){ |
2654 |
+ |
double value = 0.0; |
2655 |
+ |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
2656 |
+ |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
2657 |
+ |
else if(variable == "invMass"){ |
2658 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
2659 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
2660 |
+ |
value = (fourVector1 + fourVector2).M(); |
2661 |
+ |
} |
2662 |
+ |
|
2663 |
+ |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2664 |
+ |
value = applyFunction(function, value); |
2665 |
+ |
return value; |
2666 |
+ |
} |
2667 |
+ |
|
2668 |
+ |
|
2669 |
+ |
double |
2670 |
+ |
OSUAnalysis::valueLookup (const BNmuon* object1, const BNtau* object2, string variable, string function){ |
2671 |
+ |
double value = 0.0; |
2672 |
+ |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
2673 |
+ |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
2674 |
+ |
else if(variable == "invMass"){ |
2675 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
2676 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
2677 |
+ |
value = (fourVector1 + fourVector2).M(); |
2678 |
+ |
} |
2679 |
+ |
|
2680 |
+ |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2681 |
+ |
value = applyFunction(function, value); |
2682 |
+ |
return value; |
2683 |
+ |
} |
2684 |
+ |
|
2685 |
+ |
|
2686 |
+ |
double |
2687 |
+ |
OSUAnalysis::valueLookup (const BNtrack* object1, const BNevent* object2, string variable, string function){ |
2688 |
+ |
|
2689 |
+ |
double value = 0.0; |
2690 |
+ |
double pMag = sqrt(object1->pt * object1->pt + |
2691 |
+ |
object1->pz * object1->pz); |
2692 |
+ |
|
2693 |
+ |
if (variable == "numPV") value = object2->numPV; |
2694 |
+ |
else if (variable == "caloTotDeltaRp5") value = (object1->caloHadDeltaRp5 + object1->caloEMDeltaRp5); |
2695 |
+ |
else if (variable == "caloTotDeltaRp5ByP") value = ((object1->caloHadDeltaRp5 + object1->caloEMDeltaRp5)/pMag); |
2696 |
+ |
else if (variable == "caloTotDeltaRp5_RhoCorr") value = getTrkCaloTotRhoCorr(object1); |
2697 |
+ |
else if (variable == "caloTotDeltaRp5ByP_RhoCorr") value = getTrkCaloTotRhoCorr(object1) / pMag; |
2698 |
+ |
|
2699 |
+ |
else { std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999; } |
2700 |
+ |
|
2701 |
+ |
value = applyFunction(function, value); |
2702 |
+ |
|
2703 |
+ |
return value; |
2704 |
+ |
|
2705 |
+ |
} |
2706 |
+ |
|
2707 |
|
// Calculate the number of tracks in cone of DeltaR<0.5 around track1. |
2708 |
|
// Return true iff no other tracks are found in this cone. |
2709 |
|
int |
2749 |
|
|
2750 |
|
} |
2751 |
|
|
2752 |
+ |
double |
2753 |
+ |
OSUAnalysis::getTrkCaloTotRhoCorr(const BNtrack* track) { |
2754 |
+ |
// Return the pile-up (rho) corrected isolation energy, i.e., the total calorimeter energy around the candidate track. |
2755 |
+ |
if (!useTrackCaloRhoCorr_) return -99; |
2756 |
+ |
// if (!rhokt6CaloJetsHandle_) { |
2757 |
+ |
// cout << "ERROR [getTrkCaloTotRhoCorr]: The collection rhokt6CaloJetsHandle is not available!" << endl; |
2758 |
+ |
// return -99; |
2759 |
+ |
// } |
2760 |
+ |
double radDeltaRCone = 0.5; |
2761 |
+ |
double rhoCorr_kt6CaloJets = *rhokt6CaloJetsHandle_ * TMath::Pi() * pow(radDeltaRCone, 2); // Define effective area as pi*r^2, where r is radius of DeltaR cone. |
2762 |
+ |
double rawCaloTot = track->caloHadDeltaRp5 + track->caloEMDeltaRp5; |
2763 |
+ |
double caloTotRhoCorrCalo = TMath::Max(0., rawCaloTot - rhoCorr_kt6CaloJets); |
2764 |
+ |
return caloTotRhoCorrCalo; |
2765 |
+ |
|
2766 |
+ |
} |
2767 |
+ |
|
2768 |
+ |
|
2769 |
+ |
|
2770 |
+ |
|
2771 |
|
//creates a map of the dead Ecal channels in the barrel and endcap |
2772 |
|
//to see how the map of dead Ecal channels is created look at function getChannelStatusMaps() here: |
2773 |
|
//http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/UserCode/jbrinson/DisappTrk/OSUT3Analysis/AnaTools/src/OSUAnalysis.cc?revision=1.88&view=markup |
2818 |
|
for(BNmcparticleCollection::const_iterator mcparticle = mcparticles->begin (); mcparticle != mcparticles->end (); mcparticle++){ |
2819 |
|
double deltaRtemp = deltaR(mcparticle->eta, mcparticle->phi, object->eta, object->phi); |
2820 |
|
if (deltaRtemp < genDeltaRLowest) genDeltaRLowest = deltaRtemp; |
2821 |
< |
} |
2821 |
> |
} |
2822 |
|
return genDeltaRLowest; |
2823 |
|
} |
2824 |
|
|
2969 |
|
double value = valueLookup(&inputCollection->at(object), inputVariable, function); |
2970 |
|
histo->Fill(value,scaleFactor); |
2971 |
|
|
2972 |
+ |
if (printEventInfo_) { |
2973 |
+ |
// Write information about event to screen, for testing purposes. |
2974 |
+ |
cout << " Info for event: value for histogram " << histo->GetName() << ": " << value << endl; |
2975 |
+ |
} |
2976 |
+ |
|
2977 |
|
} |
2668 |
– |
|
2978 |
|
} |
2979 |
|
|
2980 |
|
template <class InputCollection1, class InputCollection2> |
3120 |
|
|
3121 |
|
double currentDeltaR = deltaR(object->eta,object->phi,mcparticle->eta,mcparticle->phi); |
3122 |
|
if(currentDeltaR > 0.05) continue; |
3123 |
< |
// cout << std::setprecision(3) << std::setw(20) |
3124 |
< |
// << "\tcurrentParticle: eta = " << mcparticles->at(mcparticle - mcparticles->begin()).eta |
3125 |
< |
// << std::setw(20) |
3126 |
< |
// << "\tphi = " << mcparticles->at(mcparticle - mcparticles->begin()).phi |
3127 |
< |
// << std::setw(20) |
3128 |
< |
// << "\tdeltaR = " << currentDeltaR |
3129 |
< |
// << std::setprecision(1) |
3130 |
< |
// << std::setw(20) |
3131 |
< |
// << "\tid = " << mcparticles->at(mcparticle - mcparticles->begin()).id |
3132 |
< |
// << std::setw(20) |
3133 |
< |
// << "\tmotherId = " << mcparticles->at(mcparticle - mcparticles->begin()).motherId |
3134 |
< |
// << std::setw(20) |
3135 |
< |
// << "\tstatus = " << mcparticles->at(mcparticle - mcparticles->begin()).status<< endl; |
3123 |
> |
// cout << std::setprecision(3) << std::setw(20) |
3124 |
> |
// << "\tcurrentParticle: eta = " << mcparticles->at(mcparticle - mcparticles->begin()).eta |
3125 |
> |
// << std::setw(20) |
3126 |
> |
// << "\tphi = " << mcparticles->at(mcparticle - mcparticles->begin()).phi |
3127 |
> |
// << std::setw(20) |
3128 |
> |
// << "\tdeltaR = " << currentDeltaR |
3129 |
> |
// << std::setprecision(1) |
3130 |
> |
// << std::setw(20) |
3131 |
> |
// << "\tid = " << mcparticles->at(mcparticle - mcparticles->begin()).id |
3132 |
> |
// << std::setw(20) |
3133 |
> |
// << "\tmotherId = " << mcparticles->at(mcparticle - mcparticles->begin()).motherId |
3134 |
> |
// << std::setw(20) |
3135 |
> |
// << "\tstatus = " << mcparticles->at(mcparticle - mcparticles->begin()).status<< endl; |
3136 |
|
if(currentDeltaR < bestMatchDeltaR && mcparticles->at(mcparticle - mcparticles->begin()).id != mcparticles->at(mcparticle - mcparticles->begin()).motherId){ |
3137 |
|
bestMatchIndex = mcparticle - mcparticles->begin(); |
3138 |
|
bestMatchDeltaR = currentDeltaR; |
3139 |
|
} |
3140 |
|
|
3141 |
|
} |
3142 |
< |
// if(bestMatchDeltaR != 999) cout << "bestMatch: deltaR = " << bestMatchDeltaR << " id = " << mcparticles->at(bestMatchIndex).id << " motherId = " << mcparticles->at(bestMatchIndex).motherId << endl; |
3143 |
< |
// else cout << "no match found..." << endl; |
3142 |
> |
// if(bestMatchDeltaR != 999) cout << "bestMatch: deltaR = " << bestMatchDeltaR << " id = " << mcparticles->at(bestMatchIndex).id << " motherId = " << mcparticles->at(bestMatchIndex).motherId << endl; |
3143 |
> |
// else cout << "no match found..." << endl; |
3144 |
|
return bestMatchIndex; |
3145 |
|
|
3146 |
|
} |
3231 |
|
const BNprimaryvertex *chosenVertex = 0; |
3232 |
|
if(std::find(objectsToCut.begin(), objectsToCut.end(), "primaryvertexs") != objectsToCut.end()) { |
3233 |
|
vector<bool> vertexFlags = cumulativeFlags.at("primaryvertexs").back().size() ? cumulativeFlags.at("primaryvertexs").back() : |
3234 |
< |
cumulativeFlags.at("primaryvertexs").at(cumulativeFlags.at("primaryvertexs").size() - 2); |
3234 |
> |
cumulativeFlags.at("primaryvertexs").at(cumulativeFlags.at("primaryvertexs").size() - 2); |
3235 |
|
for (uint vertexIndex = 0; vertexIndex != vertexFlags.size(); vertexIndex++){ |
3236 |
|
if(!vertexFlags.at(vertexIndex)) continue; |
3237 |
|
chosenVertex = & primaryvertexs->at(vertexIndex); |
3251 |
|
const BNmet *chosenMET = 0; |
3252 |
|
if(std::find(objectsToCut.begin(), objectsToCut.end(), "mets") != objectsToCut.end()) { |
3253 |
|
vector<bool> metFlags = cumulativeFlags.at("mets").back().size() ? cumulativeFlags.at("mets").back() : |
3254 |
< |
cumulativeFlags.at("mets").at(cumulativeFlags.at("mets").size() - 2); |
3254 |
> |
cumulativeFlags.at("mets").at(cumulativeFlags.at("mets").size() - 2); |
3255 |
|
for (uint metIndex = 0; metIndex != metFlags.size(); metIndex++){ |
3256 |
|
if(!metFlags.at(metIndex)) continue; |
3257 |
|
chosenMET = & mets->at(metIndex); |
3271 |
|
const BNelectron *chosenElectron = 0; |
3272 |
|
if(std::find(objectsToCut.begin(), objectsToCut.end(), "electrons") != objectsToCut.end()) { |
3273 |
|
vector<bool> electronFlags = cumulativeFlags.at("electrons").back().size() ? cumulativeFlags.at("electrons").back() : |
3274 |
< |
cumulativeFlags.at("electrons").at(cumulativeFlags.at("electrons").size() - 2); |
3274 |
> |
cumulativeFlags.at("electrons").at(cumulativeFlags.at("electrons").size() - 2); |
3275 |
|
for (uint electronIndex = 0; electronIndex != electronFlags.size(); electronIndex++){ |
3276 |
|
if(!electronFlags.at(electronIndex)) continue; |
3277 |
|
chosenElectron = & electrons->at(electronIndex); |
3291 |
|
const BNmuon *chosenMuon = 0; |
3292 |
|
if(std::find(objectsToCut.begin(), objectsToCut.end(), "muons") != objectsToCut.end()) { |
3293 |
|
vector<bool> muonFlags = cumulativeFlags.at("muons").back().size() ? cumulativeFlags.at("muons").back() : |
3294 |
< |
cumulativeFlags.at("muons").at(cumulativeFlags.at("muons").size() - 2); |
3294 |
> |
cumulativeFlags.at("muons").at(cumulativeFlags.at("muons").size() - 2); |
3295 |
|
for (uint muonIndex = 0; muonIndex != muonFlags.size(); muonIndex++){ |
3296 |
|
if(!muonFlags.at(muonIndex)) continue; |
3297 |
|
chosenMuon = & muons->at(muonIndex); |