29 |
|
histogramSets_ (cfg.getParameter<vector<edm::ParameterSet> >("histogramSets")), |
30 |
|
plotAllObjectsInPassingEvents_ (cfg.getParameter<bool> ("plotAllObjectsInPassingEvents")), |
31 |
|
doPileupReweighting_ (cfg.getParameter<bool> ("doPileupReweighting")), |
32 |
+ |
applyLeptonSF_ (cfg.getParameter<bool> ("applyLeptonSF")), |
33 |
|
printEventInfo_ (cfg.getParameter<bool> ("printEventInfo")), |
34 |
|
useTrackCaloRhoCorr_ (cfg.getParameter<bool> ("useTrackCaloRhoCorr")), |
35 |
|
stopCTau_ (cfg.getParameter<vector<double> > ("stopCTau")) |
41 |
|
//create pile-up reweighting object, if necessary |
42 |
|
if(datasetType_ != "data") { |
43 |
|
if(doPileupReweighting_) puWeight_ = new PUWeight (puFile_, dataPU_, dataset_); |
44 |
< |
// muonSFWeight_ = new MuonSFWeight (muonSFFile_, muonSF_); |
45 |
< |
// electronSFWeight_ = new ElectronSFWeight ("53X", electronSFID_); |
44 |
> |
if (applyLeptonSF_){ |
45 |
> |
muonSFWeight_ = new MuonSFWeight (muonSFFile_, muonSF_); |
46 |
> |
electronSFWeight_ = new ElectronSFWeight ("53X", electronSFID_); |
47 |
> |
} |
48 |
|
} |
49 |
< |
#ifdef DISPLACED_SUSY |
50 |
< |
if (datasetType_ == "signalMC") |
48 |
< |
cTauWeight_ = new CTauWeight (stopCTau_.at (0), stopCTau_.at (1), stops_); |
49 |
< |
#endif |
49 |
> |
if (datasetType_ == "signalMC" && regex_match (dataset_, regex ("stop.*to.*_.*mm.*"))) |
50 |
> |
stopCTauWeight_ = new StopCTauWeight (stopCTau_.at (0), stopCTau_.at (1), stops_); |
51 |
|
|
52 |
|
|
53 |
|
// Construct Cutflow Objects. These store the results of cut decisions and |
72 |
|
|
73 |
|
string tempInputCollection = histogramSets_.at(currentHistogramSet).getParameter<string> ("inputCollection"); |
74 |
|
if(tempInputCollection == "muon-electron pairs") tempInputCollection = "electron-muon pairs"; |
75 |
+ |
if(tempInputCollection == "jet-electron pairs") tempInputCollection = "electron-jet pairs"; |
76 |
+ |
if(tempInputCollection == "jet-muon pairs") tempInputCollection = "muon-jet pairs"; |
77 |
|
if(tempInputCollection == "event-track pairs") tempInputCollection = "track-event pairs"; |
78 |
|
if(tempInputCollection == "secondary muon-muon pairs") tempInputCollection = "muon-secondary muon pairs"; |
79 |
+ |
if(tempInputCollection == "secondary electron-electron pairs") tempInputCollection = "electron-secondary electron pairs"; |
80 |
|
if(tempInputCollection.find("pairs")==std::string::npos){ //just a single object |
81 |
|
if(tempInputCollection.find("secondary")!=std::string::npos){//secondary object |
82 |
|
int spaceIndex = tempInputCollection.find(" "); |
131 |
|
for(uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){ |
132 |
|
|
133 |
|
string currentObject = objectsToPlot.at(currentObjectIndex); |
134 |
< |
if(currentObject != "muons" && currentObject != "secondary muons" && currentObject != "electrons" && currentObject != "taus" && currentObject != "tracks" && currentObject != "photons" && currentObject != "superclusters") continue; |
134 |
> |
if(currentObject != "muons" && currentObject != "secondary muons" && currentObject != "secondary electrons" && currentObject != "electrons" && currentObject != "taus" && currentObject != "tracks" && currentObject != "photons" && currentObject != "superclusters") continue; |
135 |
|
|
136 |
|
histogram tempIdHisto; |
137 |
|
histogram tempMomIdHisto; |
138 |
|
histogram tempGmaIdHisto; |
139 |
|
histogram tempIdVsMomIdHisto; |
140 |
+ |
histogram tempIdVsGmaIdHisto; |
141 |
|
|
142 |
|
tempIdHisto.inputCollection = currentObject; |
143 |
|
tempMomIdHisto.inputCollection = currentObject; |
144 |
|
tempGmaIdHisto.inputCollection = currentObject; |
145 |
|
tempIdVsMomIdHisto.inputCollection = currentObject; |
146 |
+ |
tempIdVsGmaIdHisto.inputCollection = currentObject; |
147 |
|
|
148 |
|
if(currentObject == "secondary muons") currentObject = "secondaryMuons"; |
149 |
+ |
if(currentObject == "secondary electrons") currentObject = "secondaryElectrons"; |
150 |
|
|
151 |
|
currentObject = currentObject.substr(0, currentObject.size()-1); |
152 |
|
tempIdHisto.name = currentObject+"GenMatchId"; |
153 |
|
tempMomIdHisto.name = currentObject+"GenMatchMotherId"; |
154 |
|
tempGmaIdHisto.name = currentObject+"GenMatchGrandmotherId"; |
155 |
|
tempIdVsMomIdHisto.name = currentObject+"GenMatchIdVsMotherId"; |
156 |
+ |
tempIdVsGmaIdHisto.name = currentObject+"GenMatchIdVsGrandmotherId"; |
157 |
|
|
158 |
|
currentObject.at(0) = toupper(currentObject.at(0)); |
159 |
|
tempIdHisto.title = currentObject+" Gen-matched Particle"; |
160 |
|
tempMomIdHisto.title = currentObject+" Gen-matched Particle's Mother"; |
161 |
|
tempGmaIdHisto.title = currentObject+" Gen-matched Particle's Grandmother"; |
162 |
|
tempIdVsMomIdHisto.title = currentObject+" Gen-matched Particle's Mother vs. Particle;Particle;Mother"; |
163 |
+ |
tempIdVsGmaIdHisto.title = currentObject+" Gen-matched Particle's Grandmother vs. Particle;Particle;Grandmother"; |
164 |
+ |
|
165 |
|
|
166 |
|
int maxNum = 24; |
167 |
|
vector<double> binVector; |
181 |
|
tempIdVsMomIdHisto.bins = binVector; |
182 |
|
tempIdVsMomIdHisto.inputVariables.push_back("genMatchedId"); |
183 |
|
tempIdVsMomIdHisto.inputVariables.push_back("genMatchedMotherIdReverse"); |
184 |
+ |
tempIdVsGmaIdHisto.bins = binVector; |
185 |
+ |
tempIdVsGmaIdHisto.inputVariables.push_back("genMatchedId"); |
186 |
+ |
tempIdVsGmaIdHisto.inputVariables.push_back("genMatchedGrandmotherIdReverse"); |
187 |
|
|
188 |
|
histograms.push_back(tempIdHisto); |
189 |
|
histograms.push_back(tempMomIdHisto); |
190 |
|
histograms.push_back(tempGmaIdHisto); |
191 |
|
histograms.push_back(tempIdVsMomIdHisto); |
192 |
+ |
histograms.push_back(tempIdVsGmaIdHisto); |
193 |
|
} |
194 |
|
|
195 |
|
|
309 |
|
labelArray.push_back("other"); |
310 |
|
|
311 |
|
for(int bin = 0; bin !=currentHistogram.bins.at(0); bin++){ |
312 |
< |
if(currentHistogram.name.find("GenMatchIdVsMotherId")==std::string::npos) { |
312 |
> |
if(currentHistogram.name.find("GenMatchIdVsMotherId")==std::string::npos && currentHistogram.name.find("GenMatchIdVsGrandmotherId")==std::string::npos) { |
313 |
|
oneDHists_.at(currentChannel)[currentHistogram.name]->GetXaxis()->SetBinLabel(bin+1,labelArray.at(bin)); |
314 |
|
} |
315 |
|
else { |
317 |
|
twoDHists_.at(currentChannel)[currentHistogram.name]->GetXaxis()->SetBinLabel(bin+1,labelArray.at(bin)); |
318 |
|
} |
319 |
|
} |
320 |
< |
if(currentHistogram.name.find("GenMatchIdVsMotherId")!=std::string::npos) { |
320 |
> |
if(currentHistogram.name.find("GenMatchIdVsMotherId")!=std::string::npos || currentHistogram.name.find("GenMatchIdVsGrandmotherId")!=std::string::npos) { |
321 |
|
twoDHists_.at(currentChannel)[currentHistogram.name]->GetXaxis()->CenterTitle(); |
322 |
|
twoDHists_.at(currentChannel)[currentHistogram.name]->GetYaxis()->CenterTitle(); |
323 |
|
} |
335 |
|
if(currentObject == "muon-muon pairs") currentObject = "dimuonPairs"; |
336 |
|
else if(currentObject == "electron-electron pairs") currentObject = "dielectronPairs"; |
337 |
|
else if(currentObject == "electron-muon pairs") currentObject = "electronMuonPairs"; |
338 |
+ |
else if(currentObject == "jet-jet pairs") currentObject = "dijetPairs"; |
339 |
+ |
else if(currentObject == "electron-jet pairs") currentObject = "electronJetPairs"; |
340 |
+ |
else if(currentObject == "muon-jet pairs") currentObject = "muonJetPairs"; |
341 |
|
else if(currentObject == "track-event pairs") currentObject = "trackEventPairs"; |
342 |
|
else if(currentObject == "electron-track pairs") currentObject = "electronTrackPairs"; |
343 |
|
else if(currentObject == "muon-track pairs") currentObject = "muonTrackPairs"; |
346 |
|
else if(currentObject == "tau-track pairs") currentObject = "tauTrackPairs"; |
347 |
|
else if(currentObject == "muon-secondary muon pairs") currentObject = "muonSecondaryMuonPairs"; |
348 |
|
else if(currentObject == "secondary muons") currentObject = "secondaryMuons"; |
349 |
+ |
else if(currentObject == "electron-secondary electron pairs") currentObject = "electronSecondaryElectronPairs"; |
350 |
+ |
else if(currentObject == "secondary electrons") currentObject = "secondaryElectrons"; |
351 |
|
|
352 |
|
currentObject.at(0) = toupper(currentObject.at(0)); |
353 |
|
string histoName = "num" + currentObject; |
374 |
|
//store input collection for cut |
375 |
|
string tempInputCollection = cuts_.at(currentCut).getParameter<string> ("inputCollection"); |
376 |
|
if(tempInputCollection == "muon-electron pairs") tempInputCollection = "electron-muon pairs"; |
377 |
+ |
if(tempInputCollection == "jet-electron pairs") tempInputCollection = "electron-jet pairs"; |
378 |
+ |
if(tempInputCollection == "jet-muon pairs") tempInputCollection = "muon-jet pairs"; |
379 |
|
if(tempInputCollection == "event-track pairs") tempInputCollection = "track-event pairs"; |
380 |
|
if(tempInputCollection == "secondary muon-muon pairs") tempInputCollection = "muon-secondary muon pairs"; |
381 |
+ |
if(tempInputCollection == "secondary electron-electron pairs") tempInputCollection = "electron-secondary electron pairs"; |
382 |
|
tempCut.inputCollection = tempInputCollection; |
383 |
|
if(tempInputCollection.find("pairs")==std::string::npos){ //just a single object |
384 |
|
if(tempInputCollection.find("secondary")!=std::string::npos){//secondary object |
536 |
|
if (std::find(objectsToGet.begin(), objectsToGet.end(), "superclusters") != objectsToGet.end()) |
537 |
|
event.getByLabel (superclusters_, superclusters); |
538 |
|
|
539 |
+ |
if (datasetType_ == "signalMC"){ |
540 |
+ |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "stops") != objectsToGet.end()) |
541 |
+ |
event.getByLabel (stops_, stops); |
542 |
+ |
} |
543 |
+ |
|
544 |
|
if (useTrackCaloRhoCorr_) { |
545 |
|
// Used only for pile-up correction of by-hand calculation of isolation energy. |
546 |
|
// This rho collection is not available in all BEANs. |
549 |
|
event.getByLabel ("kt6CaloJets","rho", rhokt6CaloJetsHandle_); |
550 |
|
} |
551 |
|
|
552 |
< |
|
526 |
< |
//get pile-up event weight |
527 |
< |
double scaleFactor = 1.00; |
528 |
< |
if(doPileupReweighting_ && datasetType_ != "data") |
529 |
< |
scaleFactor = puWeight_->at (events->at (0).numTruePV); |
530 |
< |
|
531 |
< |
cTauScaleFactor_ = 1.0; |
532 |
< |
#ifdef DISPLACED_SUSY |
533 |
< |
if (datasetType_ == "signalMC") |
534 |
< |
cTauScaleFactor_ = cTauWeight_->at (event); |
535 |
< |
#endif |
536 |
< |
scaleFactor *= cTauScaleFactor_; |
552 |
> |
double scaleFactor = 1.0; |
553 |
|
|
554 |
|
//loop over all channels |
555 |
|
|
568 |
|
|
569 |
|
//loop over all cuts |
570 |
|
|
555 |
– |
|
556 |
– |
|
571 |
|
for(uint currentCutIndex = 0; currentCutIndex != currentChannel.cuts.size(); currentCutIndex++){ |
572 |
|
cut currentCut = currentChannel.cuts.at(currentCutIndex); |
573 |
|
|
590 |
|
else if(currentObject == "muons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),"muons"); |
591 |
|
|
592 |
|
else if(currentObject == "secondary muons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),"secondary muons"); |
593 |
+ |
else if(currentObject == "secondary electrons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),"secondary electrons"); |
594 |
|
else if(currentObject == "electrons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),"electrons"); |
595 |
|
else if(currentObject == "events") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,events.product(),"events"); |
596 |
|
else if(currentObject == "taus") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,taus.product(),"taus"); |
604 |
|
else if(currentObject == "superclusters") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,superclusters.product(),"superclusters"); |
605 |
|
|
606 |
|
|
607 |
+ |
|
608 |
|
else if(currentObject == "muon-muon pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),muons.product(), \ |
609 |
|
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
610 |
|
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
615 |
|
cumulativeFlags.at("secondary muons").at(flagsForPairCutsIndex), \ |
616 |
|
"muon-secondary muon pairs"); |
617 |
|
|
618 |
+ |
else if(currentObject == "electron-secondary electron pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),electrons.product(), \ |
619 |
+ |
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \ |
620 |
+ |
cumulativeFlags.at("secondary electrons").at(flagsForPairCutsIndex), \ |
621 |
+ |
"electron-secondary electron pairs"); |
622 |
+ |
|
623 |
|
else if(currentObject == "electron-electron pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),electrons.product(), \ |
624 |
|
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \ |
625 |
|
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \ |
628 |
|
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \ |
629 |
|
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
630 |
|
"electron-muon pairs"); |
631 |
+ |
else if(currentObject == "jet-jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,jets.product(),jets.product(), \ |
632 |
+ |
cumulativeFlags.at("jets").at(flagsForPairCutsIndex), \ |
633 |
+ |
cumulativeFlags.at("jets").at(flagsForPairCutsIndex), \ |
634 |
+ |
"jet-jet pairs"); |
635 |
+ |
else if(currentObject == "electron-jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),jets.product(), \ |
636 |
+ |
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \ |
637 |
+ |
cumulativeFlags.at("jets").at(flagsForPairCutsIndex), \ |
638 |
+ |
"electron-jet pairs"); |
639 |
+ |
else if(currentObject == "muon-jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),jets.product(), \ |
640 |
+ |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
641 |
+ |
cumulativeFlags.at("jets").at(flagsForPairCutsIndex), \ |
642 |
+ |
"muon-jet pairs"); |
643 |
|
else if(currentObject == "track-event pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,tracks.product(),events.product(), |
644 |
|
cumulativeFlags.at("tracks").at(flagsForPairCutsIndex), |
645 |
|
cumulativeFlags.at("events").at(flagsForPairCutsIndex), |
664 |
|
cumulativeFlags.at("taus").at(flagsForPairCutsIndex), |
665 |
|
cumulativeFlags.at("tracks").at(flagsForPairCutsIndex), |
666 |
|
"tau-track pairs"); |
667 |
< |
|
668 |
< |
|
667 |
> |
|
668 |
> |
if(currentObject == "stops" && datasetType_ == "signalMC") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,stops.product(),"stops"); |
669 |
|
} |
670 |
|
|
671 |
|
|
696 |
|
|
697 |
|
} |
698 |
|
|
699 |
< |
// if(datasetType_ != "data") { |
700 |
< |
// scaleFactor *= muonSFWeight_->at (chosenMuon ()->eta); |
701 |
< |
// scaleFactor *= electronSFWeight_->at (chosenElectron ()->eta, chosenElectron ()->pt); |
702 |
< |
// } |
703 |
< |
|
704 |
< |
cutFlows_.at(currentChannelIndex)->fillCutFlow(scaleFactor); |
699 |
> |
//get pile-up event weight |
700 |
> |
if (datasetType_ != "data"){ |
701 |
> |
if(doPileupReweighting_) scaleFactor *= puWeight_->at (events->at (0).numTruePV); |
702 |
> |
if(applyLeptonSF_){ |
703 |
> |
if (chosenMuon ()) scaleFactor *= muonSFWeight_->at (chosenMuon ()->eta); |
704 |
> |
if (chosenElectron ()) scaleFactor *= electronSFWeight_->at (chosenElectron ()->eta, chosenElectron ()->pt); |
705 |
> |
} |
706 |
> |
} |
707 |
|
|
708 |
+ |
stopCTauScaleFactor_ = 1.0; |
709 |
+ |
if (datasetType_ == "signalMC" && regex_match (dataset_, regex ("stop.*to.*_.*mm.*"))) |
710 |
+ |
stopCTauScaleFactor_ = stopCTauWeight_->at (event); |
711 |
+ |
scaleFactor *= stopCTauScaleFactor_; |
712 |
|
|
713 |
+ |
cutFlows_.at(currentChannelIndex)->fillCutFlow(scaleFactor); |
714 |
|
|
715 |
|
if(!eventPassedAllCuts)continue; |
716 |
|
|
723 |
|
<< endl; |
724 |
|
} |
725 |
|
|
686 |
– |
|
726 |
|
//filling histograms |
727 |
|
for (uint histogramIndex = 0; histogramIndex != histograms.size(); histogramIndex++){ |
728 |
|
histogram currentHistogram = histograms.at(histogramIndex); |
734 |
|
if(currentHistogram.inputCollection == "jets") fill1DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("jets").back(),scaleFactor); |
735 |
|
else if(currentHistogram.inputCollection == "muons") fill1DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("muons").back(),scaleFactor); |
736 |
|
else if(currentHistogram.inputCollection == "secondary muons") fill1DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("secondary muons").back(),scaleFactor); |
737 |
+ |
else if(currentHistogram.inputCollection == "secondary electrons") fill1DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("secondary electrons").back(),scaleFactor); |
738 |
|
else if(currentHistogram.inputCollection == "muon-muon pairs") fill1DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
739 |
|
cumulativeFlags.at("muons").back(),cumulativeFlags.at("muons").back(), \ |
740 |
|
cumulativeFlags.at("muon-muon pairs").back(),scaleFactor); |
745 |
|
else if(currentHistogram.inputCollection == "electron-electron pairs") fill1DHistogram(histo,currentHistogram,electrons.product(),electrons.product(),\ |
746 |
|
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("electrons").back(),\ |
747 |
|
cumulativeFlags.at("electron-electron pairs").back(),scaleFactor); |
748 |
+ |
else if(currentHistogram.inputCollection == "jet-jet pairs") fill1DHistogram(histo,currentHistogram,jets.product(),jets.product(),\ |
749 |
+ |
cumulativeFlags.at("jets").back(),cumulativeFlags.at("jets").back(),\ |
750 |
+ |
cumulativeFlags.at("jet-jet pairs").back(),scaleFactor); |
751 |
+ |
else if(currentHistogram.inputCollection == "electron-secondary electron pairs") fill1DHistogram(histo,currentHistogram,electrons.product(),electrons.product(), \ |
752 |
+ |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("secondary electrons").back(), \ |
753 |
+ |
cumulativeFlags.at("electron-secondary electron pairs").back(),scaleFactor); |
754 |
|
else if(currentHistogram.inputCollection == "electron-muon pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),muons.product(), \ |
755 |
|
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("muons").back(), |
756 |
|
cumulativeFlags.at("electron-muon pairs").back(),scaleFactor); |
757 |
+ |
else if(currentHistogram.inputCollection == "electron-jet pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),jets.product(), \ |
758 |
+ |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("jets").back(), |
759 |
+ |
cumulativeFlags.at("electron-jet pairs").back(),scaleFactor); |
760 |
+ |
else if(currentHistogram.inputCollection == "muon-jet pairs") fill1DHistogram(histo,currentHistogram, muons.product(),jets.product(), \ |
761 |
+ |
cumulativeFlags.at("muons").back(),cumulativeFlags.at("jets").back(), |
762 |
+ |
cumulativeFlags.at("muon-jet pairs").back(),scaleFactor); |
763 |
|
else if(currentHistogram.inputCollection == "electron-track pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),tracks.product(), |
764 |
|
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("tracks").back(), |
765 |
|
cumulativeFlags.at("electron-track pairs").back(),scaleFactor); |
786 |
|
else if(currentHistogram.inputCollection == "bxlumis") fill1DHistogram(histo,currentHistogram,bxlumis.product(),cumulativeFlags.at("bxlumis").back(),scaleFactor); |
787 |
|
else if(currentHistogram.inputCollection == "photons") fill1DHistogram(histo,currentHistogram,photons.product(),cumulativeFlags.at("photons").back(),scaleFactor); |
788 |
|
else if(currentHistogram.inputCollection == "superclusters") fill1DHistogram(histo,currentHistogram,superclusters.product(),cumulativeFlags.at("superclusters").back(),scaleFactor); |
789 |
+ |
|
790 |
+ |
if(currentHistogram.inputCollection == "stops" && datasetType_ == "signalMC") fill1DHistogram(histo,currentHistogram,stops.product(),cumulativeFlags.at("stops").back(),scaleFactor); |
791 |
|
} |
792 |
|
else if(currentHistogram.inputVariables.size() == 2){ |
793 |
|
TH2D* histo; |
799 |
|
else if(currentHistogram.inputCollection == "muon-muon pairs") fill2DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
800 |
|
cumulativeFlags.at("muons").back(),cumulativeFlags.at("muons").back(), \ |
801 |
|
cumulativeFlags.at("muon-muon pairs").back(),scaleFactor); |
802 |
< |
else if(currentHistogram.inputCollection == "muon-muon pairs") fill2DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
802 |
> |
else if(currentHistogram.inputCollection == "muon-secondary muon pairs") fill2DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
803 |
|
cumulativeFlags.at("muons").back(),cumulativeFlags.at("secondary muons").back(), \ |
804 |
|
cumulativeFlags.at("muon-secondary muon pairs").back(),scaleFactor); |
805 |
|
else if(currentHistogram.inputCollection == "electrons") fill2DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("electrons").back(),scaleFactor); |
806 |
+ |
else if(currentHistogram.inputCollection == "secondary electrons") fill2DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("secondary electrons").back(),scaleFactor); |
807 |
|
else if(currentHistogram.inputCollection == "electron-electron pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),electrons.product(), \ |
808 |
|
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("electrons").back(), \ |
809 |
|
cumulativeFlags.at("electron-electron pairs").back(),scaleFactor); |
810 |
+ |
else if(currentHistogram.inputCollection == "jet-jet pairs") fill2DHistogram(histo,currentHistogram,jets.product(),jets.product(), \ |
811 |
+ |
cumulativeFlags.at("jets").back(),cumulativeFlags.at("jets").back(), \ |
812 |
+ |
cumulativeFlags.at("jet-jet pairs").back(),scaleFactor); |
813 |
+ |
else if(currentHistogram.inputCollection == "electron-secondary electron pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),electrons.product(), \ |
814 |
+ |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("secondary electrons").back(), \ |
815 |
+ |
cumulativeFlags.at("electron-secondary electron pairs").back(),scaleFactor); |
816 |
|
else if(currentHistogram.inputCollection == "electron-muon pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),muons.product(), \ |
817 |
|
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("muons").back(), \ |
818 |
|
cumulativeFlags.at("electron-muon pairs").back(),scaleFactor); |
819 |
+ |
else if(currentHistogram.inputCollection == "electron-jet pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),jets.product(), \ |
820 |
+ |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("jets").back(), \ |
821 |
+ |
cumulativeFlags.at("electron-jet pairs").back(),scaleFactor); |
822 |
+ |
else if(currentHistogram.inputCollection == "muon-jet pairs") fill2DHistogram(histo,currentHistogram,muons.product(),jets.product(), \ |
823 |
+ |
cumulativeFlags.at("muons").back(),cumulativeFlags.at("jets").back(), \ |
824 |
+ |
cumulativeFlags.at("muon-jet pairs").back(),scaleFactor); |
825 |
|
else if(currentHistogram.inputCollection == "electron-track pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),tracks.product(), |
826 |
|
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("tracks").back(), |
827 |
|
cumulativeFlags.at("electron-track pairs").back(),scaleFactor); |
850 |
|
else if(currentHistogram.inputCollection == "bxlumis") fill2DHistogram(histo,currentHistogram,bxlumis.product(),cumulativeFlags.at("bxlumis").back(),scaleFactor); |
851 |
|
else if(currentHistogram.inputCollection == "photons") fill2DHistogram(histo,currentHistogram,photons.product(),cumulativeFlags.at("photons").back(),scaleFactor); |
852 |
|
else if(currentHistogram.inputCollection == "superclusters") fill2DHistogram(histo,currentHistogram,superclusters.product(),cumulativeFlags.at("superclusters").back(),scaleFactor); |
853 |
+ |
else if(currentHistogram.inputCollection == "stops" && datasetType_ == "signalMC") fill2DHistogram(histo,currentHistogram,stops.product(),cumulativeFlags.at("stops").back(),scaleFactor); |
854 |
|
} |
855 |
|
} |
856 |
|
|
864 |
|
string objectToPlot = ""; |
865 |
|
|
866 |
|
// Name of objectToPlot here must match the name specified in OSUAnalysis::OSUAnalysis(). |
867 |
< |
if(currentObject == "muon-muon pairs") objectToPlot = "dimuonPairs"; |
868 |
< |
else if(currentObject == "electron-electron pairs") objectToPlot = "dielectronPairs"; |
869 |
< |
else if(currentObject == "electron-muon pairs") objectToPlot = "electronMuonPairs"; |
870 |
< |
else if(currentObject == "electron-track pairs") objectToPlot = "electronTrackPairs"; |
871 |
< |
else if(currentObject == "muon-track pairs") objectToPlot = "muonTrackPairs"; |
872 |
< |
else if(currentObject == "muon-tau pairs") objectToPlot = "muonTauPairs"; |
873 |
< |
else if(currentObject == "tau-tau pairs") objectToPlot = "ditauPairs"; |
874 |
< |
else if(currentObject == "tau-track pairs") objectToPlot = "tauTrackPairs"; |
875 |
< |
else if(currentObject == "track-event pairs") objectToPlot = "trackEventPairs"; |
876 |
< |
else if(currentObject == "muon-secondary muon pairs") objectToPlot = "muonSecondaryMuonPairs"; |
877 |
< |
else if(currentObject == "secondary muons") objectToPlot = "secondaryMuons"; |
867 |
> |
if(currentObject == "muon-muon pairs") objectToPlot = "dimuonPairs"; |
868 |
> |
else if(currentObject == "electron-electron pairs") objectToPlot = "dielectronPairs"; |
869 |
> |
else if(currentObject == "electron-muon pairs") objectToPlot = "electronMuonPairs"; |
870 |
> |
else if(currentObject == "electron-jet pairs") objectToPlot = "electronJetPairs"; |
871 |
> |
else if(currentObject == "muon-jet pairs") objectToPlot = "muonJetPairs"; |
872 |
> |
else if(currentObject == "jet-jet pairs") objectToPlot = "dijetPairs"; |
873 |
> |
else if(currentObject == "electron-track pairs") objectToPlot = "electronTrackPairs"; |
874 |
> |
else if(currentObject == "muon-track pairs") objectToPlot = "muonTrackPairs"; |
875 |
> |
else if(currentObject == "muon-tau pairs") objectToPlot = "muonTauPairs"; |
876 |
> |
else if(currentObject == "tau-tau pairs") objectToPlot = "ditauPairs"; |
877 |
> |
else if(currentObject == "tau-track pairs") objectToPlot = "tauTrackPairs"; |
878 |
> |
else if(currentObject == "track-event pairs") objectToPlot = "trackEventPairs"; |
879 |
> |
else if(currentObject == "muon-secondary muon pairs") objectToPlot = "muonSecondaryMuonPairs"; |
880 |
> |
else if(currentObject == "secondary muons") objectToPlot = "secondaryMuons"; |
881 |
> |
else if(currentObject == "electron-secondary electron pairs") objectToPlot = "electronSecondaryElectronPairs"; |
882 |
> |
else if(currentObject == "secondary electrons") objectToPlot = "secondaryElectrons"; |
883 |
|
else objectToPlot = currentObject; |
884 |
|
|
885 |
|
string tempCurrentObject = objectToPlot; |
907 |
|
else if(objectToPlot == "dimuonPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(muons->size()*(muons->size()-1)/2,scaleFactor); |
908 |
|
else if(objectToPlot == "muonSecondaryMuonPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(muons->size()*(muons->size()-1)/2,scaleFactor); |
909 |
|
else if(objectToPlot == "electrons") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size(),scaleFactor); |
910 |
+ |
else if(objectToPlot == "secondaryElectrons") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size(),scaleFactor); |
911 |
|
else if(objectToPlot == "dielectronPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size()*(electrons->size()-1)/2,scaleFactor); |
912 |
+ |
else if(objectToPlot == "electronSecondaryElectronPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size()*(electrons->size()-1)/2,scaleFactor); |
913 |
|
else if(objectToPlot == "electronMuonPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size()*muons->size(),scaleFactor); |
914 |
+ |
else if(objectToPlot == "electronJetPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size()*jets->size(),scaleFactor); |
915 |
+ |
else if(objectToPlot == "muonJetPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(muons->size()*jets->size(),scaleFactor); |
916 |
|
else if(objectToPlot == "electronTrackPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size()*tracks->size(),scaleFactor); |
917 |
|
else if(objectToPlot == "events") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(events->size(),scaleFactor); |
918 |
|
else if(objectToPlot == "taus") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(taus->size(),scaleFactor); |
927 |
|
oneDHists_.at(currentChannelIndex).at(histoName+"BeforePileupCorrection")->Fill(primaryvertexs->size()); |
928 |
|
oneDHists_.at(currentChannelIndex).at(histoName+"AfterPileupCorrection")->Fill(primaryvertexs->size(),scaleFactor); |
929 |
|
} |
930 |
+ |
if(objectToPlot == "stops" && datasetType_ == "signalMC") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(stops->size(),scaleFactor); |
931 |
|
|
932 |
< |
} // end for (uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){ |
932 |
> |
} // end for (uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++) |
933 |
|
|
934 |
|
} //end loop over channel |
935 |
|
|
1013 |
|
} |
1014 |
|
|
1015 |
|
|
1016 |
< |
|
1016 |
> |
//!jet valueLookup |
1017 |
|
double |
1018 |
|
OSUAnalysis::valueLookup (const BNjet* object, string variable, string function){ |
1019 |
|
|
1143 |
|
} |
1144 |
|
|
1145 |
|
|
1146 |
< |
|
1146 |
> |
//!muon valueLookup |
1147 |
|
double |
1148 |
|
OSUAnalysis::valueLookup (const BNmuon* object, string variable, string function){ |
1149 |
|
|
1467 |
|
else if(variable == "genMatchedMotherIdReverse"){ |
1468 |
|
int index = getGenMatchedParticleIndex(object); |
1469 |
|
if(index == -1) value = 23; |
1470 |
< |
else value = 23 -getPdgIdBinValue(mcparticles->at(index).motherId); |
1470 |
> |
else value = 23 - getPdgIdBinValue(mcparticles->at(index).motherId); |
1471 |
|
} |
1472 |
|
else if(variable == "genMatchedGrandmotherId"){ |
1473 |
|
int index = getGenMatchedParticleIndex(object); |
1479 |
|
} |
1480 |
|
else value = getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
1481 |
|
} |
1482 |
+ |
else if(variable == "genMatchedGrandmotherIdReverse"){ |
1483 |
+ |
int index = getGenMatchedParticleIndex(object); |
1484 |
+ |
if(index == -1) value = 23; |
1485 |
+ |
else if(fabs(mcparticles->at(index).motherId) == 15){ |
1486 |
+ |
int motherIndex = findTauMotherIndex(&mcparticles->at(index)); |
1487 |
+ |
if(motherIndex == -1) value = 23; |
1488 |
+ |
else value = 23 - getPdgIdBinValue(mcparticles->at(motherIndex).motherId); |
1489 |
+ |
} |
1490 |
+ |
else value = 23 - getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
1491 |
+ |
} |
1492 |
|
|
1493 |
|
|
1494 |
|
|
1499 |
|
return value; |
1500 |
|
} |
1501 |
|
|
1502 |
< |
|
1502 |
> |
//!electron valueLookup |
1503 |
|
double |
1504 |
|
OSUAnalysis::valueLookup (const BNelectron* object, string variable, string function){ |
1505 |
|
|
1872 |
|
} |
1873 |
|
else value = getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
1874 |
|
} |
1875 |
+ |
else if(variable == "genMatchedGrandmotherIdReverse"){ |
1876 |
+ |
int index = getGenMatchedParticleIndex(object); |
1877 |
+ |
if(index == -1) value = 23; |
1878 |
+ |
else if(fabs(mcparticles->at(index).motherId) == 15){ |
1879 |
+ |
int motherIndex = findTauMotherIndex(&mcparticles->at(index)); |
1880 |
+ |
if(motherIndex == -1) value = 23; |
1881 |
+ |
else value = 23 - getPdgIdBinValue(mcparticles->at(motherIndex).motherId); |
1882 |
+ |
} |
1883 |
+ |
else value = 23 - getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
1884 |
+ |
} |
1885 |
|
|
1886 |
|
|
1887 |
|
|
1892 |
|
return value; |
1893 |
|
} |
1894 |
|
|
1895 |
< |
|
1895 |
> |
//!event valueLookup |
1896 |
|
double |
1897 |
|
OSUAnalysis::valueLookup (const BNevent* object, string variable, string function){ |
1898 |
|
|
1970 |
|
} |
1971 |
|
else if(variable == "muonScaleFactor"){ |
1972 |
|
if(datasetType_ != "data") |
1973 |
< |
// value = muonSFWeight_->at (chosenMuon ()->eta); |
1876 |
< |
value = 1.0; |
1973 |
> |
value = muonSFWeight_->at (chosenMuon ()->eta); |
1974 |
|
else |
1975 |
|
value = 1.0; |
1976 |
|
} |
1977 |
|
else if(variable == "electronScaleFactor"){ |
1978 |
|
if(datasetType_ != "data") |
1979 |
< |
// value = electronSFWeight_->at (chosenElectron ()->eta, chosenElectron ()->pt); |
1883 |
< |
value = 1.0; |
1979 |
> |
value = electronSFWeight_->at (chosenElectron ()->eta, chosenElectron ()->pt); |
1980 |
|
else |
1981 |
|
value = 1.0; |
1982 |
|
} |
1983 |
< |
else if(variable == "cTauScaleFactor") |
1984 |
< |
value = cTauScaleFactor_; |
1983 |
> |
else if(variable == "stopCTauScaleFactor") |
1984 |
> |
value = stopCTauScaleFactor_; |
1985 |
|
|
1986 |
|
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
1987 |
|
|
1990 |
|
return value; |
1991 |
|
} |
1992 |
|
|
1993 |
+ |
//!tau valueLookup |
1994 |
|
double |
1995 |
|
OSUAnalysis::valueLookup (const BNtau* object, string variable, string function){ |
1996 |
|
|
2071 |
|
} |
2072 |
|
else value = getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
2073 |
|
} |
2074 |
+ |
else if(variable == "genMatchedGrandmotherIdReverse"){ |
2075 |
+ |
int index = getGenMatchedParticleIndex(object); |
2076 |
+ |
if(index == -1) value = 23; |
2077 |
+ |
else if(fabs(mcparticles->at(index).motherId) == 15){ |
2078 |
+ |
int motherIndex = findTauMotherIndex(&mcparticles->at(index)); |
2079 |
+ |
if(motherIndex == -1) value = 23; |
2080 |
+ |
else value = 23 - getPdgIdBinValue(mcparticles->at(motherIndex).motherId); |
2081 |
+ |
} |
2082 |
+ |
else value = 23 - getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
2083 |
+ |
} |
2084 |
|
|
2085 |
|
|
2086 |
|
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2090 |
|
return value; |
2091 |
|
} |
2092 |
|
|
2093 |
+ |
//!met valueLookup |
2094 |
|
double |
2095 |
|
OSUAnalysis::valueLookup (const BNmet* object, string variable, string function){ |
2096 |
|
|
2163 |
|
return value; |
2164 |
|
} |
2165 |
|
|
2166 |
+ |
//!track valueLookup |
2167 |
|
double |
2168 |
|
OSUAnalysis::valueLookup (const BNtrack* object, string variable, string function){ |
2169 |
|
|
2191 |
|
|
2192 |
|
|
2193 |
|
//additional BNs info for disappTrks |
2085 |
– |
else if(variable == "isGoodPtResolution") value = object->isGoodPtResolution; |
2194 |
|
else if(variable == "caloEMDeltaRp3") value = object->caloEMDeltaRp3; |
2195 |
|
else if(variable == "caloHadDeltaRp3") value = object->caloHadDeltaRp3; |
2196 |
|
else if(variable == "caloEMDeltaRp4") value = object->caloEMDeltaRp4; |
2266 |
|
} |
2267 |
|
else value = getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
2268 |
|
} |
2269 |
+ |
else if(variable == "genMatchedGrandmotherIdReverse"){ |
2270 |
+ |
int index = getGenMatchedParticleIndex(object); |
2271 |
+ |
if(index == -1) value = 23; |
2272 |
+ |
else if(fabs(mcparticles->at(index).motherId) == 15){ |
2273 |
+ |
int motherIndex = findTauMotherIndex(&mcparticles->at(index)); |
2274 |
+ |
if(motherIndex == -1) value = 23; |
2275 |
+ |
else value = 23 - getPdgIdBinValue(mcparticles->at(motherIndex).motherId); |
2276 |
+ |
} |
2277 |
+ |
else value = 23 - getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
2278 |
+ |
} |
2279 |
|
|
2280 |
|
|
2281 |
|
|
2286 |
|
return value; |
2287 |
|
} |
2288 |
|
|
2289 |
+ |
//!genjet valueLookup |
2290 |
|
double |
2291 |
|
OSUAnalysis::valueLookup (const BNgenjet* object, string variable, string function){ |
2292 |
|
|
2315 |
|
return value; |
2316 |
|
} |
2317 |
|
|
2318 |
+ |
//!mcparticle valueLookup |
2319 |
|
double |
2320 |
|
OSUAnalysis::valueLookup (const BNmcparticle* object, string variable, string function){ |
2321 |
|
|
2449 |
|
return value; |
2450 |
|
} |
2451 |
|
|
2452 |
+ |
//!primaryvertex valueLookup |
2453 |
|
double |
2454 |
|
OSUAnalysis::valueLookup (const BNprimaryvertex* object, string variable, string function){ |
2455 |
|
|
2477 |
|
return value; |
2478 |
|
} |
2479 |
|
|
2480 |
+ |
//!bxlumi valueLookup |
2481 |
|
double |
2482 |
|
OSUAnalysis::valueLookup (const BNbxlumi* object, string variable, string function){ |
2483 |
|
|
2495 |
|
return value; |
2496 |
|
} |
2497 |
|
|
2498 |
+ |
//!photon valueLookup |
2499 |
|
double |
2500 |
|
OSUAnalysis::valueLookup (const BNphoton* object, string variable, string function){ |
2501 |
|
|
2609 |
|
} |
2610 |
|
else value = getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
2611 |
|
} |
2612 |
+ |
else if(variable == "genMatchedGrandmotherIdReverse"){ |
2613 |
+ |
int index = getGenMatchedParticleIndex(object); |
2614 |
+ |
if(index == -1) value = 23; |
2615 |
+ |
else if(fabs(mcparticles->at(index).motherId) == 15){ |
2616 |
+ |
int motherIndex = findTauMotherIndex(&mcparticles->at(index)); |
2617 |
+ |
if(motherIndex == -1) value = 23; |
2618 |
+ |
else value = 23 - getPdgIdBinValue(mcparticles->at(motherIndex).motherId); |
2619 |
+ |
} |
2620 |
+ |
else value = 23 - getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
2621 |
+ |
} |
2622 |
|
|
2623 |
|
|
2624 |
|
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2628 |
|
return value; |
2629 |
|
} |
2630 |
|
|
2631 |
+ |
//!supercluster valueLookup |
2632 |
|
double |
2633 |
|
OSUAnalysis::valueLookup (const BNsupercluster* object, string variable, string function){ |
2634 |
|
|
2651 |
|
return value; |
2652 |
|
} |
2653 |
|
|
2654 |
< |
|
2654 |
> |
//!muon-muon pair valueLookup |
2655 |
|
double |
2656 |
|
OSUAnalysis::valueLookup (const BNmuon* object1, const BNmuon* object2, string variable, string function){ |
2657 |
|
|
2722 |
|
return value; |
2723 |
|
} |
2724 |
|
|
2725 |
+ |
//!electron-electron pair valueLookup |
2726 |
|
double |
2727 |
|
OSUAnalysis::valueLookup (const BNelectron* object1, const BNelectron* object2, string variable, string function){ |
2728 |
|
|
2777 |
|
|
2778 |
|
return value; |
2779 |
|
} |
2780 |
< |
|
2780 |
> |
//!electron-muon pair valueLookup |
2781 |
|
double |
2782 |
|
OSUAnalysis::valueLookup (const BNelectron* object1, const BNmuon* object2, string variable, string function){ |
2783 |
|
|
2845 |
|
return value; |
2846 |
|
} |
2847 |
|
|
2848 |
+ |
//!electron-jet pair valueLookup |
2849 |
+ |
double |
2850 |
+ |
OSUAnalysis::valueLookup (const BNelectron* object1, const BNjet* object2, string variable, string function){ |
2851 |
+ |
|
2852 |
+ |
double value = 0.0; |
2853 |
+ |
|
2854 |
+ |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
2855 |
+ |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
2856 |
+ |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
2857 |
+ |
else if(variable == "invMass"){ |
2858 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
2859 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
2860 |
+ |
value = (fourVector1 + fourVector2).M(); |
2861 |
+ |
} |
2862 |
+ |
else if(variable == "pt"){ |
2863 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
2864 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
2865 |
+ |
value = (fourVector1 + fourVector2).Pt(); |
2866 |
+ |
} |
2867 |
+ |
else if(variable == "threeDAngle") |
2868 |
+ |
{ |
2869 |
+ |
TVector3 threeVector1(object1->px, object1->py, object1->pz); |
2870 |
+ |
TVector3 threeVector2(object2->px, object2->py, object2->pz); |
2871 |
+ |
value = (threeVector1.Angle(threeVector2)); |
2872 |
+ |
} |
2873 |
+ |
else if(variable == "chargeProduct"){ |
2874 |
+ |
value = object1->charge*object2->charge; |
2875 |
+ |
} |
2876 |
+ |
|
2877 |
+ |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2878 |
+ |
|
2879 |
+ |
value = applyFunction(function, value); |
2880 |
+ |
|
2881 |
+ |
return value; |
2882 |
+ |
} |
2883 |
+ |
|
2884 |
+ |
//!muon-jet pair valueLookup |
2885 |
+ |
double |
2886 |
+ |
OSUAnalysis::valueLookup (const BNmuon* object1, const BNjet* object2, string variable, string function){ |
2887 |
+ |
|
2888 |
+ |
double value = 0.0; |
2889 |
+ |
|
2890 |
+ |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
2891 |
+ |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
2892 |
+ |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
2893 |
+ |
else if(variable == "invMass"){ |
2894 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
2895 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
2896 |
+ |
value = (fourVector1 + fourVector2).M(); |
2897 |
+ |
} |
2898 |
+ |
else if(variable == "pt"){ |
2899 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
2900 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
2901 |
+ |
value = (fourVector1 + fourVector2).Pt(); |
2902 |
+ |
} |
2903 |
+ |
else if(variable == "threeDAngle") |
2904 |
+ |
{ |
2905 |
+ |
TVector3 threeVector1(object1->px, object1->py, object1->pz); |
2906 |
+ |
TVector3 threeVector2(object2->px, object2->py, object2->pz); |
2907 |
+ |
value = (threeVector1.Angle(threeVector2)); |
2908 |
+ |
} |
2909 |
+ |
else if(variable == "chargeProduct"){ |
2910 |
+ |
value = object1->charge*object2->charge; |
2911 |
+ |
} |
2912 |
+ |
|
2913 |
+ |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2914 |
+ |
|
2915 |
+ |
value = applyFunction(function, value); |
2916 |
+ |
|
2917 |
+ |
return value; |
2918 |
+ |
} |
2919 |
+ |
|
2920 |
+ |
//!jet-jet pair valueLookup |
2921 |
+ |
double |
2922 |
+ |
OSUAnalysis::valueLookup (const BNjet* object1, const BNjet* object2, string variable, string function){ |
2923 |
+ |
|
2924 |
+ |
double value = 0.0; |
2925 |
|
|
2926 |
+ |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
2927 |
+ |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
2928 |
+ |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
2929 |
+ |
else if(variable == "invMass"){ |
2930 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
2931 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
2932 |
+ |
value = (fourVector1 + fourVector2).M(); |
2933 |
+ |
} |
2934 |
+ |
else if(variable == "pt"){ |
2935 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
2936 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
2937 |
+ |
value = (fourVector1 + fourVector2).Pt(); |
2938 |
+ |
} |
2939 |
+ |
else if(variable == "threeDAngle") |
2940 |
+ |
{ |
2941 |
+ |
TVector3 threeVector1(object1->px, object1->py, object1->pz); |
2942 |
+ |
TVector3 threeVector2(object2->px, object2->py, object2->pz); |
2943 |
+ |
value = (threeVector1.Angle(threeVector2)); |
2944 |
+ |
} |
2945 |
+ |
else if(variable == "chargeProduct"){ |
2946 |
+ |
value = object1->charge*object2->charge; |
2947 |
+ |
} |
2948 |
+ |
|
2949 |
+ |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2950 |
+ |
|
2951 |
+ |
value = applyFunction(function, value); |
2952 |
+ |
|
2953 |
+ |
return value; |
2954 |
+ |
} |
2955 |
+ |
//!electron-track pair valueLookup |
2956 |
|
double |
2957 |
|
OSUAnalysis::valueLookup (const BNelectron* object1, const BNtrack* object2, string variable, string function){ |
2958 |
|
double electronMass = 0.000511; |
2974 |
|
} |
2975 |
|
|
2976 |
|
|
2977 |
< |
|
2977 |
> |
//!muon-track pair valueLookup |
2978 |
|
double |
2979 |
|
OSUAnalysis::valueLookup (const BNmuon* object1, const BNtrack* object2, string variable, string function){ |
2980 |
|
double pionMass = 0.140; |
2997 |
|
return value; |
2998 |
|
} |
2999 |
|
|
3000 |
< |
|
3000 |
> |
//!tau-tau pair valueLookup |
3001 |
|
double |
3002 |
|
OSUAnalysis::valueLookup (const BNtau* object1, const BNtau* object2, string variable, string function){ |
3003 |
|
double value = 0.0; |
3015 |
|
return value; |
3016 |
|
} |
3017 |
|
|
3018 |
< |
|
3018 |
> |
//!muon-tau pair valueLookup |
3019 |
|
double |
3020 |
|
OSUAnalysis::valueLookup (const BNmuon* object1, const BNtau* object2, string variable, string function){ |
3021 |
|
double value = 0.0; |
3033 |
|
return value; |
3034 |
|
} |
3035 |
|
|
3036 |
+ |
//!tau-track pair valueLookup |
3037 |
|
double |
3038 |
|
OSUAnalysis::valueLookup (const BNtau* object1, const BNtrack* object2, string variable, string function){ |
3039 |
|
double value = 0.0; |
3046 |
|
} |
3047 |
|
|
3048 |
|
|
3049 |
< |
|
3049 |
> |
//!track-event pair valueLookup |
3050 |
|
double |
3051 |
|
OSUAnalysis::valueLookup (const BNtrack* object1, const BNevent* object2, string variable, string function){ |
3052 |
|
|
3066 |
|
|
3067 |
|
return value; |
3068 |
|
|
3069 |
+ |
} |
3070 |
+ |
|
3071 |
+ |
//!stop valueLookup |
3072 |
+ |
double |
3073 |
+ |
OSUAnalysis::valueLookup (const BNstop* object, string variable, string function){ |
3074 |
+ |
|
3075 |
+ |
|
3076 |
+ |
double value = 0.0; |
3077 |
+ |
|
3078 |
+ |
if(variable == "ctau") value = object->ctau; |
3079 |
+ |
|
3080 |
+ |
else if (variable == "d0"){ |
3081 |
+ |
double vx = object->vx - chosenVertex ()->x, |
3082 |
+ |
vy = object->vy - chosenVertex ()->y, |
3083 |
+ |
px = object->px, |
3084 |
+ |
py = object->py, |
3085 |
+ |
pt = object->pt; |
3086 |
+ |
value = (-vx * py + vy * px) / pt; |
3087 |
+ |
} |
3088 |
+ |
|
3089 |
+ |
else if (variable == "dz"){ |
3090 |
+ |
double vx = object->vx - chosenVertex ()->x, |
3091 |
+ |
vy = object->vy - chosenVertex ()->y, |
3092 |
+ |
vz = object->vz - chosenVertex ()->z, |
3093 |
+ |
px = object->px, |
3094 |
+ |
py = object->py, |
3095 |
+ |
pz = object->pz, |
3096 |
+ |
pt = object->pt; |
3097 |
+ |
value = vz - (vx * px + vy * py)/pt * (pz/pt); |
3098 |
+ |
} |
3099 |
+ |
|
3100 |
+ |
else if (variable == "minD0"){ |
3101 |
+ |
double minD0=999; |
3102 |
+ |
for(BNprimaryvertexCollection::const_iterator vertex = primaryvertexs->begin (); vertex != primaryvertexs->end (); vertex++){ |
3103 |
+ |
double vx = object->vx - vertex->x, |
3104 |
+ |
vy = object->vy - vertex->y, |
3105 |
+ |
px = object->px, |
3106 |
+ |
py = object->py, |
3107 |
+ |
pt = object->pt; |
3108 |
+ |
value = (-vx * py + vy * px) / pt; |
3109 |
+ |
if(abs(value) < abs(minD0)) minD0 = value; |
3110 |
+ |
} |
3111 |
+ |
value = minD0; |
3112 |
+ |
} |
3113 |
+ |
else if (variable == "minDz"){ |
3114 |
+ |
double minDz=999; |
3115 |
+ |
for(BNprimaryvertexCollection::const_iterator vertex = primaryvertexs->begin (); vertex != primaryvertexs->end (); vertex++){ |
3116 |
+ |
double vx = object->vx - vertex->x, |
3117 |
+ |
vy = object->vy - vertex->y, |
3118 |
+ |
vz = object->vz - vertex->z, |
3119 |
+ |
px = object->px, |
3120 |
+ |
py = object->py, |
3121 |
+ |
pz = object->pz, |
3122 |
+ |
pt = object->pt; |
3123 |
+ |
value = vz - (vx * px + vy * py)/pt * (pz/pt); |
3124 |
+ |
if(abs(value) < abs(minDz)) minDz = value; |
3125 |
+ |
} |
3126 |
+ |
value = minDz; |
3127 |
+ |
} |
3128 |
+ |
else if(variable == "distToVertex"){ |
3129 |
+ |
value = sqrt((object->vx-chosenVertex()->x)*(object->vx-chosenVertex()->x) + \ |
3130 |
+ |
(object->vy-chosenVertex()->y)*(object->vy-chosenVertex()->y) + \ |
3131 |
+ |
(object->vz-chosenVertex()->z)*(object->vz-chosenVertex()->z)); |
3132 |
+ |
} |
3133 |
+ |
else if (variable == "minDistToVertex"){ |
3134 |
+ |
double minDistToVertex=999; |
3135 |
+ |
for(BNprimaryvertexCollection::const_iterator vertex = primaryvertexs->begin (); vertex != primaryvertexs->end (); vertex++){ |
3136 |
+ |
value = sqrt((object->vx-vertex->x)*(object->vx-vertex->x) + \ |
3137 |
+ |
(object->vy-vertex->y)*(object->vy-vertex->y) + \ |
3138 |
+ |
(object->vz-vertex->z)*(object->vz-vertex->z)); |
3139 |
+ |
|
3140 |
+ |
if(abs(value) < abs(minDistToVertex)) minDistToVertex = value; |
3141 |
+ |
} |
3142 |
+ |
value = minDistToVertex; |
3143 |
+ |
} |
3144 |
+ |
else if (variable == "distToVertexDifference"){ |
3145 |
+ |
double minDistToVertex=999; |
3146 |
+ |
for(BNprimaryvertexCollection::const_iterator vertex = primaryvertexs->begin (); vertex != primaryvertexs->end (); vertex++){ |
3147 |
+ |
value = sqrt((object->vx-vertex->x)*(object->vx-vertex->x) + \ |
3148 |
+ |
(object->vy-vertex->y)*(object->vy-vertex->y) + \ |
3149 |
+ |
(object->vz-vertex->z)*(object->vz-vertex->z)); |
3150 |
+ |
|
3151 |
+ |
if(abs(value) < abs(minDistToVertex)) minDistToVertex = value; |
3152 |
+ |
} |
3153 |
+ |
double distToChosenVertex = sqrt((object->vx-chosenVertex()->x)*(object->vx-chosenVertex()->x) + \ |
3154 |
+ |
(object->vy-chosenVertex()->y)*(object->vy-chosenVertex()->y) + \ |
3155 |
+ |
(object->vz-chosenVertex()->z)*(object->vz-chosenVertex()->z)); |
3156 |
+ |
|
3157 |
+ |
value = distToChosenVertex - minDistToVertex; |
3158 |
+ |
} |
3159 |
+ |
|
3160 |
+ |
else if (variable == "closestVertexRank"){ |
3161 |
+ |
double minDistToVertex=999; |
3162 |
+ |
int vertex_rank = 0; |
3163 |
+ |
for(BNprimaryvertexCollection::const_iterator vertex = primaryvertexs->begin (); vertex != primaryvertexs->end (); vertex++){ |
3164 |
+ |
vertex_rank++; |
3165 |
+ |
int dist = sqrt((object->vx-vertex->x)*(object->vx-vertex->x) + \ |
3166 |
+ |
(object->vy-vertex->y)*(object->vy-vertex->y) + \ |
3167 |
+ |
(object->vz-vertex->z)*(object->vz-vertex->z)); |
3168 |
+ |
|
3169 |
+ |
if(abs(dist) < abs(minDistToVertex)){ |
3170 |
+ |
value = vertex_rank; |
3171 |
+ |
minDistToVertex = dist; |
3172 |
+ |
} |
3173 |
+ |
} |
3174 |
+ |
} |
3175 |
+ |
|
3176 |
+ |
|
3177 |
+ |
|
3178 |
+ |
|
3179 |
+ |
else { std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999; } |
3180 |
+ |
|
3181 |
+ |
value = applyFunction(function, value); |
3182 |
+ |
|
3183 |
+ |
return value; |
3184 |
+ |
|
3185 |
|
} |
3186 |
|
|
3187 |
+ |
|
3188 |
+ |
|
3189 |
+ |
|
3190 |
|
// Calculate the number of tracks in cone of DeltaR<0.5 around track1. |
3191 |
|
// Return true iff no other tracks are found in this cone. |
3192 |
|
int |
3464 |
|
} |
3465 |
|
counter++; |
3466 |
|
|
3467 |
< |
} // end for (uint object2 = 0; object2 != inputCollection2->size(); object2++){ |
3468 |
< |
} // end for (uint object1 = 0; object1 != inputCollection1->size(); object1++){ |
3467 |
> |
} // end for (uint object2 = 0; object2 != inputCollection2->size(); object2++) |
3468 |
> |
} // end for (uint object1 = 0; object1 != inputCollection1->size(); object1++) |
3469 |
|
|
3470 |
|
} |
3471 |
|
|
3767 |
|
{ |
3768 |
|
const BNprimaryvertex *chosenVertex = 0; |
3769 |
|
if(std::find(objectsToCut.begin(), objectsToCut.end(), "primaryvertexs") != objectsToCut.end()) { |
3770 |
< |
vector<bool> vertexFlags = cumulativeFlags.at("primaryvertexs").back().size() ? cumulativeFlags.at("primaryvertexs").back() : |
3771 |
< |
cumulativeFlags.at("primaryvertexs").at(cumulativeFlags.at("primaryvertexs").size() - 2); |
3770 |
> |
vector<bool> vertexFlags; |
3771 |
> |
for (int i = cumulativeFlags.at("primaryvertexs").size() - 1; i >= 0; i--){ |
3772 |
> |
if (cumulativeFlags.at("primaryvertexs").at(i).size()){ |
3773 |
> |
vertexFlags = cumulativeFlags.at("primaryvertexs").at(i); |
3774 |
> |
break; |
3775 |
> |
} |
3776 |
> |
} |
3777 |
|
for (uint vertexIndex = 0; vertexIndex != vertexFlags.size(); vertexIndex++){ |
3778 |
|
if(!vertexFlags.at(vertexIndex)) continue; |
3779 |
|
chosenVertex = & primaryvertexs->at(vertexIndex); |
3792 |
|
{ |
3793 |
|
const BNmet *chosenMET = 0; |
3794 |
|
if(std::find(objectsToCut.begin(), objectsToCut.end(), "mets") != objectsToCut.end()) { |
3795 |
< |
vector<bool> metFlags = cumulativeFlags.at("mets").back().size() ? cumulativeFlags.at("mets").back() : |
3796 |
< |
cumulativeFlags.at("mets").at(cumulativeFlags.at("mets").size() - 2); |
3795 |
> |
vector<bool> metFlags; |
3796 |
> |
for (int i = cumulativeFlags.at("mets").size() - 1; i >= 0; i--){ |
3797 |
> |
if (cumulativeFlags.at("mets").at(i).size()){ |
3798 |
> |
metFlags = cumulativeFlags.at("mets").at(i); |
3799 |
> |
break; |
3800 |
> |
} |
3801 |
> |
} |
3802 |
|
for (uint metIndex = 0; metIndex != metFlags.size(); metIndex++){ |
3803 |
|
if(!metFlags.at(metIndex)) continue; |
3804 |
|
chosenMET = & mets->at(metIndex); |
3817 |
|
{ |
3818 |
|
const BNelectron *chosenElectron = 0; |
3819 |
|
if(std::find(objectsToCut.begin(), objectsToCut.end(), "electrons") != objectsToCut.end()) { |
3820 |
< |
vector<bool> electronFlags = cumulativeFlags.at("electrons").back().size() ? cumulativeFlags.at("electrons").back() : |
3821 |
< |
cumulativeFlags.at("electrons").at(cumulativeFlags.at("electrons").size() - 2); |
3820 |
> |
vector<bool> electronFlags; |
3821 |
> |
for (int i = cumulativeFlags.at("electrons").size() - 1; i >= 0; i--){ |
3822 |
> |
if (cumulativeFlags.at("electrons").at(i).size()){ |
3823 |
> |
electronFlags = cumulativeFlags.at("electrons").at(i); |
3824 |
> |
break; |
3825 |
> |
} |
3826 |
> |
} |
3827 |
|
for (uint electronIndex = 0; electronIndex != electronFlags.size(); electronIndex++){ |
3828 |
|
if(!electronFlags.at(electronIndex)) continue; |
3829 |
|
chosenElectron = & electrons->at(electronIndex); |
3842 |
|
{ |
3843 |
|
const BNmuon *chosenMuon = 0; |
3844 |
|
if(std::find(objectsToCut.begin(), objectsToCut.end(), "muons") != objectsToCut.end()) { |
3845 |
< |
vector<bool> muonFlags = cumulativeFlags.at("muons").back().size() ? cumulativeFlags.at("muons").back() : |
3846 |
< |
cumulativeFlags.at("muons").at(cumulativeFlags.at("muons").size() - 2); |
3845 |
> |
vector<bool> muonFlags; |
3846 |
> |
for (int i = cumulativeFlags.at("muons").size() - 1; i >= 0; i--){ |
3847 |
> |
if (cumulativeFlags.at("muons").at(i).size()){ |
3848 |
> |
muonFlags = cumulativeFlags.at("muons").at(i); |
3849 |
> |
break; |
3850 |
> |
} |
3851 |
> |
} |
3852 |
|
for (uint muonIndex = 0; muonIndex != muonFlags.size(); muonIndex++){ |
3853 |
|
if(!muonFlags.at(muonIndex)) continue; |
3854 |
|
chosenMuon = & muons->at(muonIndex); |
3862 |
|
return chosenMuon; |
3863 |
|
} |
3864 |
|
|
3483 |
– |
|
3865 |
|
DEFINE_FWK_MODULE(OSUAnalysis); |