18 |
|
triggers_ (cfg.getParameter<edm::InputTag> ("triggers")), |
19 |
|
puFile_ (cfg.getParameter<std::string> ("puFile")), |
20 |
|
deadEcalFile_ (cfg.getParameter<std::string> ("deadEcalFile")), |
21 |
< |
|
22 |
< |
muonSFFile_ (cfg.getParameter<std::string> ("muonSFFile")), |
21 |
> |
muonSFFile_ (cfg.getParameter<std::string> ("muonSFFile")), |
22 |
|
dataPU_ (cfg.getParameter<std::string> ("dataPU")), |
23 |
|
electronSFID_ (cfg.getParameter<std::string> ("electronSFID")), |
24 |
|
muonSF_ (cfg.getParameter<std::string> ("muonSF")), |
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 |
+ |
|
46 |
|
// Construct Cutflow Objects. These store the results of cut decisions and |
47 |
|
// handle filling cut flow histograms. |
48 |
|
masterCutFlow_ = new CutFlow (fs_); |
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); |
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); |
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"; |
305 |
> |
else if(currentObject == "electron-muon pairs") currentObject = "electronMuonPairs"; |
306 |
> |
else if(currentObject == "track-event pairs") currentObject = "trackEventPairs"; |
307 |
|
|
308 |
|
currentObject.at(0) = toupper(currentObject.at(0)); |
309 |
|
string histoName = "num" + currentObject; |
321 |
|
|
322 |
|
|
323 |
|
|
298 |
– |
|
324 |
|
//get list of cuts for this channel |
325 |
|
vector<edm::ParameterSet> cuts_ (channels_.at(currentChannel).getParameter<vector<edm::ParameterSet> >("cuts")); |
326 |
|
|
480 |
|
if (std::find(objectsToGet.begin(), objectsToGet.end(), "superclusters") != objectsToGet.end()) |
481 |
|
event.getByLabel (superclusters_, superclusters); |
482 |
|
|
483 |
+ |
if (useTrackCaloRhoCorr_) { |
484 |
+ |
// Used only for pile-up correction of by-hand calculation of isolation energy. |
485 |
+ |
// This rho collection is not available in all BEANs. |
486 |
+ |
// For description of rho values for different jet reconstruction algorithms, see |
487 |
+ |
// https://twiki.cern.ch/twiki/bin/view/CMS/JetAlgorithms#Algorithms |
488 |
+ |
event.getByLabel ("kt6CaloJets","rho", rhokt6CaloJetsHandle_); |
489 |
+ |
} |
490 |
+ |
|
491 |
+ |
|
492 |
|
//get pile-up event weight |
493 |
|
double scaleFactor = 1.00; |
494 |
|
if(doPileupReweighting_ && datasetType_ != "data") |
558 |
|
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \ |
559 |
|
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
560 |
|
"electron-muon pairs"); |
561 |
< |
|
561 |
> |
else if(currentObject == "track-event pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,tracks.product(),events.product(), |
562 |
> |
cumulativeFlags.at("tracks").at(flagsForPairCutsIndex), |
563 |
> |
cumulativeFlags.at("events").at(flagsForPairCutsIndex), |
564 |
> |
"track-event pairs"); |
565 |
> |
|
566 |
|
|
567 |
|
} |
568 |
|
|
603 |
|
|
604 |
|
if(!eventPassedAllCuts)continue; |
605 |
|
|
606 |
+ |
if (printEventInfo_) { |
607 |
+ |
// Write information about event to screen, for testing purposes. |
608 |
+ |
cout << "Event passed all cuts in channel " << currentChannel.name |
609 |
+ |
<< ": run=" << events->at(0).run |
610 |
+ |
<< " lumi=" << events->at(0).lumi |
611 |
+ |
<< " event=" << events->at(0).evt |
612 |
+ |
<< endl; |
613 |
+ |
} |
614 |
|
|
615 |
< |
//if(datasetType_ != "data") { |
616 |
< |
// scaleFactor *= muonSFWeight_->at (chosenMuon ()->eta); |
617 |
< |
// scaleFactor *= electronSFWeight_->at (chosenElectron ()->eta, chosenElectron ()->pt); |
618 |
< |
//} |
615 |
> |
|
616 |
> |
// if(datasetType_ != "data") { |
617 |
> |
// scaleFactor *= muonSFWeight_->at (chosenMuon ()->eta); |
618 |
> |
// scaleFactor *= electronSFWeight_->at (chosenElectron ()->eta, chosenElectron ()->pt); |
619 |
> |
// } |
620 |
|
|
621 |
|
//filling histograms |
622 |
|
for (uint histogramIndex = 0; histogramIndex != histograms.size(); histogramIndex++){ |
673 |
|
else if(currentHistogram.inputCollection == "taus") fill2DHistogram(histo,currentHistogram,taus.product(),cumulativeFlags.at("taus").back(),scaleFactor); |
674 |
|
else if(currentHistogram.inputCollection == "mets") fill2DHistogram(histo,currentHistogram,mets.product(),cumulativeFlags.at("mets").back(),scaleFactor); |
675 |
|
else if(currentHistogram.inputCollection == "tracks") fill2DHistogram(histo,currentHistogram,tracks.product(),cumulativeFlags.at("tracks").back(),scaleFactor); |
676 |
+ |
else if(currentHistogram.inputCollection == "track-event pairs") fill2DHistogram(histo,currentHistogram,tracks.product(),events.product(), |
677 |
+ |
cumulativeFlags.at("tracks").back(),cumulativeFlags.at("events").back(), |
678 |
+ |
cumulativeFlags.at("track-event pairs").back(),scaleFactor); |
679 |
|
else if(currentHistogram.inputCollection == "genjets") fill2DHistogram(histo,currentHistogram,genjets.product(),cumulativeFlags.at("genjets").back(),scaleFactor); |
680 |
|
else if(currentHistogram.inputCollection == "mcparticles") fill2DHistogram(histo,currentHistogram,mcparticles.product(),cumulativeFlags.at("mcparticles").back(),scaleFactor); |
681 |
|
else if(currentHistogram.inputCollection == "primaryvertexs") fill2DHistogram(histo,currentHistogram,primaryvertexs.product(),cumulativeFlags.at("primaryvertexs").back(),scaleFactor); |
687 |
|
|
688 |
|
//fills histograms with the sizes of collections |
689 |
|
for (uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){ |
690 |
+ |
|
691 |
|
string currentObject = objectsToPlot.at(currentObjectIndex); |
692 |
|
|
693 |
< |
string objectToPlot = ""; |
693 |
> |
string objectToPlot = ""; |
694 |
|
|
695 |
+ |
// Name of objectToPlot here must match the name specified in OSUAnalysis::OSUAnalysis(). |
696 |
|
if(currentObject == "muon-muon pairs") objectToPlot = "dimuonPairs"; |
697 |
|
else if(currentObject == "electron-electron pairs") objectToPlot = "dielectronPairs"; |
698 |
< |
else if(currentObject == "electron-muon pairs") objectToPlot = "electronMuonPairs"; |
698 |
> |
else if(currentObject == "electron-muon pairs") objectToPlot = "electronMuonPairs"; |
699 |
> |
else if(currentObject == "track-event pairs") objectToPlot = "trackEventPairs"; |
700 |
|
else objectToPlot = currentObject; |
701 |
|
string tempCurrentObject = objectToPlot; |
702 |
< |
tempCurrentObject.at(0) = toupper(tempCurrentObject.at(0)); |
702 |
> |
tempCurrentObject.at(0) = toupper(tempCurrentObject.at(0)); // Capitalize the first letter. |
703 |
|
string histoName = "num" + tempCurrentObject; |
704 |
|
|
705 |
|
|
653 |
– |
|
654 |
– |
|
706 |
|
//set position of primary vertex in event, in order to calculate quantities relative to it |
707 |
|
if(std::find(objectsToCut.begin(), objectsToCut.end(), currentObject) != objectsToCut.end()) { |
708 |
|
vector<bool> lastCutFlags = cumulativeFlags.at(currentObject).back(); |
714 |
|
oneDHists_.at(currentChannelIndex).at(histoName+"BeforePileupCorrection")->Fill(primaryvertexs->size()); |
715 |
|
oneDHists_.at(currentChannelIndex).at(histoName+"AfterPileupCorrection")->Fill(primaryvertexs->size(),scaleFactor); |
716 |
|
} |
717 |
< |
else |
717 |
> |
else { |
718 |
|
oneDHists_.at(currentChannelIndex).at(histoName)->Fill(numToPlot,scaleFactor); |
719 |
+ |
} |
720 |
|
} |
721 |
|
else if(objectToPlot == "jets") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(jets->size(),scaleFactor); |
722 |
|
else if(objectToPlot == "muons") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(muons->size(),scaleFactor); |
736 |
|
else if(objectToPlot == "primaryvertexs"){ |
737 |
|
oneDHists_.at(currentChannelIndex).at(histoName+"BeforePileupCorrection")->Fill(primaryvertexs->size()); |
738 |
|
oneDHists_.at(currentChannelIndex).at(histoName+"AfterPileupCorrection")->Fill(primaryvertexs->size(),scaleFactor); |
739 |
< |
} |
688 |
< |
|
689 |
< |
} |
690 |
< |
|
691 |
< |
|
739 |
> |
} |
740 |
|
|
741 |
+ |
} // end for (uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){ |
742 |
|
|
743 |
|
} //end loop over channel |
744 |
|
|
745 |
|
masterCutFlow_->fillCutFlow(scaleFactor); |
746 |
|
|
747 |
+ |
} // end void OSUAnalysis::analyze (const edm::Event &event, const edm::EventSetup &setup) |
748 |
|
|
749 |
|
|
700 |
– |
} |
701 |
– |
|
750 |
|
|
751 |
|
bool |
752 |
|
OSUAnalysis::evaluateComparison (double testValue, string comparison, double cutValue){ |
1225 |
|
&& object->numberOfLayersWithMeasurement > 5; |
1226 |
|
} |
1227 |
|
|
1228 |
+ |
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
1229 |
|
|
1230 |
+ |
else if(variable == "genMatchedPdgId"){ |
1231 |
+ |
int index = getGenMatchedParticleIndex(object); |
1232 |
+ |
if(index == -1) value = 0; |
1233 |
+ |
else value = mcparticles->at(index).id; |
1234 |
+ |
} |
1235 |
|
|
1236 |
|
else if(variable == "genMatchedId"){ |
1237 |
|
int index = getGenMatchedParticleIndex(object); |
1243 |
|
if(index == -1) value = 0; |
1244 |
|
else value = getPdgIdBinValue(mcparticles->at(index).motherId); |
1245 |
|
} |
1246 |
+ |
else if(variable == "genMatchedMotherIdReverse"){ |
1247 |
+ |
int index = getGenMatchedParticleIndex(object); |
1248 |
+ |
if(index == -1) value = 23; |
1249 |
+ |
else value = 23 -getPdgIdBinValue(mcparticles->at(index).motherId); |
1250 |
+ |
} |
1251 |
|
else if(variable == "genMatchedGrandmotherId"){ |
1252 |
|
int index = getGenMatchedParticleIndex(object); |
1253 |
|
if(index == -1) value = 0; |
1606 |
|
} |
1607 |
|
} |
1608 |
|
|
1609 |
+ |
|
1610 |
+ |
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
1611 |
+ |
|
1612 |
+ |
else if(variable == "genMatchedPdgId"){ |
1613 |
+ |
int index = getGenMatchedParticleIndex(object); |
1614 |
+ |
if(index == -1) value = 0; |
1615 |
+ |
else value = mcparticles->at(index).id; |
1616 |
+ |
} |
1617 |
+ |
|
1618 |
+ |
|
1619 |
|
else if(variable == "genMatchedId"){ |
1620 |
|
int index = getGenMatchedParticleIndex(object); |
1621 |
|
if(index == -1) value = 0; |
1626 |
|
if(index == -1) value = 0; |
1627 |
|
else value = getPdgIdBinValue(mcparticles->at(index).motherId); |
1628 |
|
} |
1629 |
+ |
else if(variable == "genMatchedMotherIdReverse"){ |
1630 |
+ |
int index = getGenMatchedParticleIndex(object); |
1631 |
+ |
if(index == -1) value = 23; |
1632 |
+ |
else value = 23 -getPdgIdBinValue(mcparticles->at(index).motherId); |
1633 |
+ |
} |
1634 |
|
else if(variable == "genMatchedGrandmotherId"){ |
1635 |
|
int index = getGenMatchedParticleIndex(object); |
1636 |
|
if(index == -1) value = 0; |
1729 |
|
} |
1730 |
|
else if(variable == "muonScaleFactor"){ |
1731 |
|
if(datasetType_ != "data") |
1732 |
< |
value = muonSFWeight_->at (chosenMuon ()->eta); |
1732 |
> |
// value = muonSFWeight_->at (chosenMuon ()->eta); |
1733 |
> |
value = 1.0; |
1734 |
|
else |
1735 |
|
value = 1.0; |
1736 |
|
} |
1737 |
|
else if(variable == "electronScaleFactor"){ |
1738 |
|
if(datasetType_ != "data") |
1739 |
< |
value = electronSFWeight_->at (chosenElectron ()->eta, chosenElectron ()->pt); |
1739 |
> |
// value = electronSFWeight_->at (chosenElectron ()->eta, chosenElectron ()->pt); |
1740 |
> |
value = 1.0; |
1741 |
|
else |
1742 |
|
value = 1.0; |
1743 |
|
} |
1795 |
|
else if(variable == "leadingTrackValid") value = object->leadingTrackValid; |
1796 |
|
|
1797 |
|
|
1798 |
+ |
|
1799 |
+ |
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
1800 |
+ |
|
1801 |
+ |
else if(variable == "genMatchedPdgId"){ |
1802 |
+ |
int index = getGenMatchedParticleIndex(object); |
1803 |
+ |
if(index == -1) value = 0; |
1804 |
+ |
else value = mcparticles->at(index).id; |
1805 |
+ |
} |
1806 |
+ |
|
1807 |
|
else if(variable == "genMatchedId"){ |
1808 |
|
int index = getGenMatchedParticleIndex(object); |
1809 |
|
if(index == -1) value = 0; |
1814 |
|
if(index == -1) value = 0; |
1815 |
|
else value = getPdgIdBinValue(mcparticles->at(index).motherId); |
1816 |
|
} |
1817 |
+ |
else if(variable == "genMatchedMotherIdReverse"){ |
1818 |
+ |
int index = getGenMatchedParticleIndex(object); |
1819 |
+ |
if(index == -1) value = 23; |
1820 |
+ |
else value = 23 -getPdgIdBinValue(mcparticles->at(index).motherId); |
1821 |
+ |
} |
1822 |
|
else if(variable == "genMatchedGrandmotherId"){ |
1823 |
|
int index = getGenMatchedParticleIndex(object); |
1824 |
|
if(index == -1) value = 0; |
1915 |
|
|
1916 |
|
double value = 0.0; |
1917 |
|
double pMag = sqrt(object->pt * object->pt + |
1918 |
< |
object->pz * object->pz); |
1919 |
< |
|
1918 |
> |
object->pz * object->pz); |
1919 |
> |
|
1920 |
|
if(variable == "pt") value = object->pt; |
1921 |
|
else if(variable == "px") value = object->px; |
1922 |
|
else if(variable == "py") value = object->py; |
1952 |
|
//user defined variables |
1953 |
|
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; |
1954 |
|
else if(variable == "dZwrtBS") value = object->dZ - events->at(0).BSz; |
1955 |
< |
else if(variable == "caloTotDeltaRp5") value =(object->caloHadDeltaRp5 + object->caloEMDeltaRp5); |
1956 |
< |
else if(variable == "caloTotDeltaRp5ByP") value =( (object->caloHadDeltaRp5 + object->caloEMDeltaRp5)/pMag); |
1957 |
< |
|
1958 |
< |
|
1959 |
< |
|
1960 |
< |
|
1961 |
< |
|
1962 |
< |
else if(variable == "isIso") value = getTrkIsIso(object, tracks.product()); |
1963 |
< |
else if(variable == "isMatchedDeadEcal") value = getTrkIsMatchedDeadEcal(object); |
1874 |
< |
else if(variable == "ptErrorByPt") value = (object->ptError/object->pt); |
1875 |
< |
else if(variable == "ptError") value = object->ptError; |
1876 |
< |
else if(variable == "ptRes") value = getTrkPtRes(object); |
1955 |
> |
else if(variable == "caloTotDeltaRp5") value = (object->caloHadDeltaRp5 + object->caloEMDeltaRp5); |
1956 |
> |
else if(variable == "caloTotDeltaRp5ByP") value = ((object->caloHadDeltaRp5 + object->caloEMDeltaRp5)/pMag); |
1957 |
> |
else if(variable == "caloTotDeltaRp5_RhoCorr") value = getTrkCaloTotRhoCorr(object); |
1958 |
> |
else if(variable == "caloTotDeltaRp5ByP_RhoCorr") value = getTrkCaloTotRhoCorr(object) / pMag; |
1959 |
> |
else if(variable == "isIso") value = getTrkIsIso(object, tracks.product()); |
1960 |
> |
else if(variable == "isMatchedDeadEcal") value = getTrkIsMatchedDeadEcal(object); |
1961 |
> |
else if(variable == "ptErrorByPt") value = (object->ptError/object->pt); |
1962 |
> |
else if(variable == "ptError") value = object->ptError; |
1963 |
> |
else if(variable == "ptRes") value = getTrkPtRes(object); |
1964 |
|
|
1965 |
|
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
1966 |
|
|
1967 |
< |
else if(variable == "genId"){ |
1967 |
> |
else if(variable == "genMatchedPdgId"){ |
1968 |
|
int index = getGenMatchedParticleIndex(object); |
1969 |
|
if(index == -1) value = 0; |
1970 |
|
else value = mcparticles->at(index).id; |
1981 |
|
if(index == -1) value = 0; |
1982 |
|
else value = getPdgIdBinValue(mcparticles->at(index).motherId); |
1983 |
|
} |
1984 |
+ |
else if(variable == "genMatchedMotherIdReverse"){ |
1985 |
+ |
int index = getGenMatchedParticleIndex(object); |
1986 |
+ |
if(index == -1) value = 23; |
1987 |
+ |
else value = 23 -getPdgIdBinValue(mcparticles->at(index).motherId); |
1988 |
+ |
} |
1989 |
|
else if(variable == "genMatchedGrandmotherId"){ |
1990 |
|
int index = getGenMatchedParticleIndex(object); |
1991 |
|
if(index == -1) value = 0; |
2289 |
|
|
2290 |
|
|
2291 |
|
|
2292 |
+ |
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
2293 |
+ |
|
2294 |
+ |
else if(variable == "genMatchedPdgId"){ |
2295 |
+ |
int index = getGenMatchedParticleIndex(object); |
2296 |
+ |
if(index == -1) value = 0; |
2297 |
+ |
else value = mcparticles->at(index).id; |
2298 |
+ |
} |
2299 |
|
|
2300 |
|
|
2301 |
|
|
2309 |
|
if(index == -1) value = 0; |
2310 |
|
else value = getPdgIdBinValue(mcparticles->at(index).motherId); |
2311 |
|
} |
2312 |
+ |
else if(variable == "genMatchedMotherIdReverse"){ |
2313 |
+ |
int index = getGenMatchedParticleIndex(object); |
2314 |
+ |
if(index == -1) value = 23; |
2315 |
+ |
else value = 23 -getPdgIdBinValue(mcparticles->at(index).motherId); |
2316 |
+ |
} |
2317 |
|
else if(variable == "genMatchedGrandmotherId"){ |
2318 |
|
int index = getGenMatchedParticleIndex(object); |
2319 |
|
if(index == -1) value = 0; |
2368 |
|
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
2369 |
|
value = (fourVector1 + fourVector2).M(); |
2370 |
|
} |
2371 |
+ |
else if(variable == "pt"){ |
2372 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
2373 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
2374 |
+ |
value = (fourVector1 + fourVector2).Pt(); |
2375 |
+ |
} |
2376 |
|
else if(variable == "threeDAngle") |
2377 |
|
{ |
2378 |
|
TVector3 threeVector1(object1->px, object1->py, object1->pz); |
2413 |
|
{ |
2414 |
|
value = object1->correctedD0; |
2415 |
|
} |
2416 |
< |
else if(variable == "muon1correctedD0Vertex") |
2416 |
> |
else if(variable == "muon2correctedD0") |
2417 |
|
{ |
2418 |
< |
value = object1->correctedD0Vertex; |
2418 |
> |
value = object2->correctedD0; |
2419 |
|
} |
2420 |
+ |
|
2421 |
|
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2422 |
|
|
2423 |
|
value = applyFunction(function, value); |
2437 |
|
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
2438 |
|
value = (fourVector1 + fourVector2).M(); |
2439 |
|
} |
2440 |
+ |
else if(variable == "pt"){ |
2441 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
2442 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
2443 |
+ |
value = (fourVector1 + fourVector2).Pt(); |
2444 |
+ |
} |
2445 |
|
else if(variable == "threeDAngle") |
2446 |
|
{ |
2447 |
|
TVector3 threeVector1(object1->px, object1->py, object1->pz); |
2465 |
|
else if(variable == "electron2CorrectedD0Vertex"){ |
2466 |
|
value = object2->correctedD0Vertex; |
2467 |
|
} |
2468 |
+ |
else if(variable == "electron1CorrectedD0"){ |
2469 |
+ |
value = object1->correctedD0; |
2470 |
+ |
} |
2471 |
+ |
else if(variable == "electron2CorrectedD0"){ |
2472 |
+ |
value = object2->correctedD0; |
2473 |
+ |
} |
2474 |
|
|
2475 |
|
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2476 |
|
|
2491 |
|
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
2492 |
|
value = (fourVector1 + fourVector2).M(); |
2493 |
|
} |
2494 |
+ |
else if(variable == "pt"){ |
2495 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
2496 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
2497 |
+ |
value = (fourVector1 + fourVector2).Pt(); |
2498 |
+ |
} |
2499 |
|
else if(variable == "threeDAngle") |
2500 |
|
{ |
2501 |
|
TVector3 threeVector1(object1->px, object1->py, object1->pz); |
2531 |
|
else if(variable == "muonDetIso"){ |
2532 |
|
value = (object2->trackIsoDR03) / object2->pt; |
2533 |
|
} |
2408 |
– |
else if(variable == "chargeProduct"){ |
2409 |
– |
value = object1->charge * object2->charge; |
2410 |
– |
} |
2534 |
|
|
2535 |
|
|
2536 |
|
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2541 |
|
} |
2542 |
|
|
2543 |
|
|
2544 |
+ |
|
2545 |
+ |
|
2546 |
+ |
double |
2547 |
+ |
OSUAnalysis::valueLookup (const BNtrack* object1, const BNevent* object2, string variable, string function){ |
2548 |
+ |
|
2549 |
+ |
double value = 0.0; |
2550 |
+ |
double pMag = sqrt(object1->pt * object1->pt + |
2551 |
+ |
object1->pz * object1->pz); |
2552 |
+ |
|
2553 |
+ |
if (variable == "numPV") value = object2->numPV; |
2554 |
+ |
else if (variable == "caloTotDeltaRp5") value = (object1->caloHadDeltaRp5 + object1->caloEMDeltaRp5); |
2555 |
+ |
else if (variable == "caloTotDeltaRp5ByP") value = ((object1->caloHadDeltaRp5 + object1->caloEMDeltaRp5)/pMag); |
2556 |
+ |
else if (variable == "caloTotDeltaRp5_RhoCorr") value = getTrkCaloTotRhoCorr(object1); |
2557 |
+ |
else if (variable == "caloTotDeltaRp5ByP_RhoCorr") value = getTrkCaloTotRhoCorr(object1) / pMag; |
2558 |
+ |
|
2559 |
+ |
else { std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999; } |
2560 |
+ |
|
2561 |
+ |
value = applyFunction(function, value); |
2562 |
+ |
|
2563 |
+ |
return value; |
2564 |
+ |
|
2565 |
+ |
} |
2566 |
+ |
|
2567 |
|
// Calculate the number of tracks in cone of DeltaR<0.5 around track1. |
2568 |
|
// Return true iff no other tracks are found in this cone. |
2569 |
|
int |
2609 |
|
|
2610 |
|
} |
2611 |
|
|
2612 |
+ |
double |
2613 |
+ |
OSUAnalysis::getTrkCaloTotRhoCorr(const BNtrack* track) { |
2614 |
+ |
// Return the pile-up (rho) corrected isolation energy, i.e., the total calorimeter energy around the candidate track. |
2615 |
+ |
if (!useTrackCaloRhoCorr_) return -99; |
2616 |
+ |
// if (!rhokt6CaloJetsHandle_) { |
2617 |
+ |
// cout << "ERROR [getTrkCaloTotRhoCorr]: The collection rhokt6CaloJetsHandle is not available!" << endl; |
2618 |
+ |
// return -99; |
2619 |
+ |
// } |
2620 |
+ |
double radDeltaRCone = 0.5; |
2621 |
+ |
double rhoCorr_kt6CaloJets = *rhokt6CaloJetsHandle_ * TMath::Pi() * pow(radDeltaRCone, 2); // Define effective area as pi*r^2, where r is radius of DeltaR cone. |
2622 |
+ |
double rawCaloTot = track->caloHadDeltaRp5 + track->caloEMDeltaRp5; |
2623 |
+ |
double caloTotRhoCorrCalo = TMath::Max(0., rawCaloTot - rhoCorr_kt6CaloJets); |
2624 |
+ |
return caloTotRhoCorrCalo; |
2625 |
+ |
|
2626 |
+ |
} |
2627 |
+ |
|
2628 |
+ |
|
2629 |
+ |
|
2630 |
+ |
|
2631 |
|
//creates a map of the dead Ecal channels in the barrel and endcap |
2632 |
|
//to see how the map of dead Ecal channels is created look at function getChannelStatusMaps() here: |
2633 |
|
//http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/UserCode/jbrinson/DisappTrk/OSUT3Analysis/AnaTools/src/OSUAnalysis.cc?revision=1.88&view=markup |
2671 |
|
return value; |
2672 |
|
} |
2673 |
|
|
2674 |
+ |
// Returns the smallest DeltaR between the object and any generated true particle in the event. |
2675 |
|
template <class InputObject> |
2676 |
|
double OSUAnalysis::getGenDeltaRLowest(InputObject object){ |
2677 |
|
double genDeltaRLowest = 999.; |
2678 |
|
for(BNmcparticleCollection::const_iterator mcparticle = mcparticles->begin (); mcparticle != mcparticles->end (); mcparticle++){ |
2679 |
|
double deltaRtemp = deltaR(mcparticle->eta, mcparticle->phi, object->eta, object->phi); |
2514 |
– |
cout << "deltaRtemp = " << deltaRtemp << endl; |
2680 |
|
if (deltaRtemp < genDeltaRLowest) genDeltaRLowest = deltaRtemp; |
2681 |
|
} |
2682 |
|
return genDeltaRLowest; |
2829 |
|
double value = valueLookup(&inputCollection->at(object), inputVariable, function); |
2830 |
|
histo->Fill(value,scaleFactor); |
2831 |
|
|
2832 |
+ |
if (printEventInfo_) { |
2833 |
+ |
// Write information about event to screen, for testing purposes. |
2834 |
+ |
cout << " Info for event: value for histogram " << histo->GetName() << ": " << value << endl; |
2835 |
+ |
} |
2836 |
+ |
|
2837 |
|
} |
2668 |
– |
|
2838 |
|
} |
2839 |
|
|
2840 |
|
template <class InputCollection1, class InputCollection2> |