11 |
|
tracks_ (cfg.getParameter<edm::InputTag> ("tracks")), |
12 |
|
genjets_ (cfg.getParameter<edm::InputTag> ("genjets")), |
13 |
|
mcparticles_ (cfg.getParameter<edm::InputTag> ("mcparticles")), |
14 |
+ |
stops_ (cfg.getParameter<edm::InputTag> ("stops")), |
15 |
|
primaryvertexs_ (cfg.getParameter<edm::InputTag> ("primaryvertexs")), |
16 |
|
bxlumis_ (cfg.getParameter<edm::InputTag> ("bxlumis")), |
17 |
|
photons_ (cfg.getParameter<edm::InputTag> ("photons")), |
18 |
|
superclusters_ (cfg.getParameter<edm::InputTag> ("superclusters")), |
19 |
|
triggers_ (cfg.getParameter<edm::InputTag> ("triggers")), |
20 |
+ |
trigobjs_ (cfg.getParameter<edm::InputTag> ("trigobjs")), |
21 |
+ |
puFile_ (cfg.getParameter<string> ("puFile")), |
22 |
+ |
deadEcalFile_ (cfg.getParameter<string> ("deadEcalFile")), |
23 |
+ |
muonSFFile_ (cfg.getParameter<string> ("muonSFFile")), |
24 |
+ |
dataPU_ (cfg.getParameter<string> ("dataPU")), |
25 |
+ |
electronSFID_ (cfg.getParameter<string> ("electronSFID")), |
26 |
+ |
muonSF_ (cfg.getParameter<string> ("muonSF")), |
27 |
+ |
dataset_ (cfg.getParameter<string> ("dataset")), |
28 |
+ |
datasetType_ (cfg.getParameter<string> ("datasetType")), |
29 |
+ |
channels_ (cfg.getParameter<vector<edm::ParameterSet> >("channels")), |
30 |
+ |
histogramSets_ (cfg.getParameter<vector<edm::ParameterSet> >("histogramSets")), |
31 |
+ |
useEDMFormat_ (cfg.getParameter<bool>("useEDMFormat")), |
32 |
+ |
treeBranchSets_ (cfg.getParameter<vector<edm::ParameterSet> >("treeBranchSets")), |
33 |
+ |
plotAllObjectsInPassingEvents_ (cfg.getParameter<bool> ("plotAllObjectsInPassingEvents")), |
34 |
+ |
doPileupReweighting_ (cfg.getParameter<bool> ("doPileupReweighting")), |
35 |
+ |
applyLeptonSF_ (cfg.getParameter<bool> ("applyLeptonSF")), |
36 |
+ |
applyBtagSF_ (cfg.getParameter<bool> ("applyBtagSF")), |
37 |
+ |
minBtag_ (cfg.getParameter<int> ("minBtag")), |
38 |
+ |
maxBtag_ (cfg.getParameter<int> ("maxBtag")), |
39 |
+ |
printEventInfo_ (cfg.getParameter<bool> ("printEventInfo")), |
40 |
+ |
printAllTriggers_ (cfg.getParameter<bool> ("printAllTriggers")), |
41 |
+ |
useTrackCaloRhoCorr_ (cfg.getParameter<bool> ("useTrackCaloRhoCorr")), |
42 |
+ |
stopCTau_ (cfg.getParameter<vector<double> > ("stopCTau")), |
43 |
+ |
GetPlotsAfterEachCut_ (cfg.getParameter<bool> ("GetPlotsAfterEachCut")) |
44 |
+ |
{ |
45 |
|
|
46 |
+ |
TH1::SetDefaultSumw2 (); |
47 |
|
|
48 |
< |
channels_ (cfg.getParameter<vector<edm::ParameterSet> >("channels")) |
48 |
> |
//create pile-up reweighting object, if necessary |
49 |
> |
if(datasetType_ != "data") { |
50 |
> |
if(doPileupReweighting_) puWeight_ = new PUWeight (puFile_, dataPU_, dataset_); |
51 |
> |
if (applyLeptonSF_){ |
52 |
> |
muonSFWeight_ = new MuonSFWeight (muonSFFile_, muonSF_); |
53 |
> |
electronSFWeight_ = new ElectronSFWeight ("53X", electronSFID_); |
54 |
> |
} |
55 |
> |
if (applyBtagSF_){ |
56 |
> |
bTagSFWeight_ = new BtagSFWeight; |
57 |
> |
} |
58 |
> |
} |
59 |
> |
if (datasetType_ == "signalMC" && regex_match (dataset_, regex ("stop.*to.*_.*mm.*"))) |
60 |
> |
stopCTauWeight_ = new StopCTauWeight (stopCTau_.at (0), stopCTau_.at (1), stops_); |
61 |
|
|
23 |
– |
{ |
24 |
– |
TH1::SetDefaultSumw2 (); |
62 |
|
|
63 |
|
// Construct Cutflow Objects. These store the results of cut decisions and |
64 |
|
// handle filling cut flow histograms. |
65 |
|
masterCutFlow_ = new CutFlow (fs_); |
66 |
< |
std::vector<TFileDirectory> directories; |
66 |
> |
|
67 |
> |
//always get vertex collection so we can assign the primary vertex in the event |
68 |
> |
objectsToGet.push_back("primaryvertexs"); |
69 |
> |
objectsToPlot.push_back("primaryvertexs"); |
70 |
> |
objectsToCut.push_back("primaryvertexs"); |
71 |
> |
|
72 |
> |
|
73 |
> |
//always get the MC particles to do GEN-matching |
74 |
> |
objectsToGet.push_back("mcparticles"); |
75 |
> |
|
76 |
> |
//always get the event collection to do pile-up reweighting |
77 |
> |
objectsToGet.push_back("events"); |
78 |
> |
|
79 |
> |
|
80 |
> |
// Parse the tree variable definitions. |
81 |
> |
for (uint iBranchSet = 0; !useEDMFormat_ && iBranchSet<treeBranchSets_.size(); iBranchSet++) { |
82 |
> |
string tempInputCollection = treeBranchSets_.at(iBranchSet).getParameter<string> ("inputCollection"); |
83 |
> |
if(tempInputCollection.find("pairs")!=string::npos) { cout << "Warning: tree filling is not configured for pairs of objects, so will not work for collection: " << tempInputCollection << endl; } |
84 |
> |
objectsToGet.push_back(tempInputCollection); |
85 |
> |
objectsToCut.push_back(tempInputCollection); |
86 |
> |
|
87 |
> |
vector<string> branchList(treeBranchSets_.at(iBranchSet).getParameter<vector<string> >("branches")); |
88 |
> |
|
89 |
> |
for (uint iBranch = 0; iBranch<branchList.size(); iBranch++) { |
90 |
> |
BranchSpecs br; |
91 |
> |
br.inputCollection = tempInputCollection; |
92 |
> |
br.inputVariable = branchList.at(iBranch); |
93 |
> |
TString newName = TString(br.inputCollection) + "_" + TString(br.inputVariable); |
94 |
> |
br.name = string(newName.Data()); |
95 |
> |
treeBranches_.push_back(br); |
96 |
> |
} |
97 |
> |
|
98 |
> |
} // end for (uint iBranchSet = 0; iBranchSet<treeBranchSets_.size(); iBranchSet++) |
99 |
> |
|
100 |
> |
|
101 |
> |
//parse the histogram definitions |
102 |
> |
for(uint currentHistogramSet = 0; currentHistogramSet != histogramSets_.size(); currentHistogramSet++){ |
103 |
> |
|
104 |
> |
string tempInputCollection = histogramSets_.at(currentHistogramSet).getParameter<string> ("inputCollection"); |
105 |
> |
if(tempInputCollection == "muon-electron pairs") tempInputCollection = "electron-muon pairs"; |
106 |
> |
if(tempInputCollection == "photon-muon pairs") tempInputCollection = "muon-photon pairs"; |
107 |
> |
if(tempInputCollection == "photon-electron pairs") tempInputCollection = "electron-photon pairs"; |
108 |
> |
if(tempInputCollection == "jet-electron pairs") tempInputCollection = "electron-jet pairs"; |
109 |
> |
if(tempInputCollection == "jet-photon pairs") tempInputCollection = "photon-jet pairs"; |
110 |
> |
if(tempInputCollection == "jet-muon pairs") tempInputCollection = "muon-jet pairs"; |
111 |
> |
if(tempInputCollection == "event-track pairs") tempInputCollection = "track-event pairs"; |
112 |
> |
if(tempInputCollection == "secondary muon-muon pairs") tempInputCollection = "muon-secondary muon pairs"; |
113 |
> |
if(tempInputCollection == "secondary jet-muon pairs") tempInputCollection = "muon-secondary jet pairs"; |
114 |
> |
if(tempInputCollection == "secondary jet-electron pairs") tempInputCollection = "electron-secondary jet pairs"; |
115 |
> |
if(tempInputCollection == "secondary jet-photon pairs") tempInputCollection = "photon-secondary jet pairs"; |
116 |
> |
if(tempInputCollection == "secondary jet-jet pairs") tempInputCollection = "jet-secondary jet pairs"; |
117 |
> |
if(tempInputCollection == "secondary electron-electron pairs") tempInputCollection = "electron-secondary electron pairs"; |
118 |
> |
if(tempInputCollection == "trigobj-electron pairs") tempInputCollection = "electron-trigobj pairs"; |
119 |
> |
if(tempInputCollection == "trigobj-muon pairs") tempInputCollection = "muon-trigobj pairs"; |
120 |
> |
if(tempInputCollection.find("pairs")==string::npos){ //just a single object |
121 |
> |
if(tempInputCollection.find("secondary")!=string::npos){//secondary object |
122 |
> |
int spaceIndex = tempInputCollection.find(" "); |
123 |
> |
int secondWordLength = tempInputCollection.size() - spaceIndex; |
124 |
> |
objectsToGet.push_back(tempInputCollection.substr(spaceIndex+1,secondWordLength)); |
125 |
> |
} |
126 |
> |
else{ |
127 |
> |
objectsToGet.push_back(tempInputCollection); |
128 |
> |
} |
129 |
> |
objectsToPlot.push_back(tempInputCollection); |
130 |
> |
objectsToCut.push_back(tempInputCollection); |
131 |
> |
} else { //pair of objects, need to add the pair and the individual objects to the lists of things to Get/Plot/Cut |
132 |
> |
string obj1; |
133 |
> |
string obj2; |
134 |
> |
getTwoObjs(tempInputCollection, obj1, obj2); |
135 |
> |
string obj2ToGet = getObjToGet(obj2); |
136 |
> |
objectsToCut.push_back(tempInputCollection); |
137 |
> |
objectsToCut.push_back(obj1); |
138 |
> |
objectsToCut.push_back(obj2); |
139 |
> |
objectsToPlot.push_back(tempInputCollection); |
140 |
> |
objectsToPlot.push_back(obj1); |
141 |
> |
objectsToPlot.push_back(obj2); |
142 |
> |
objectsToGet.push_back(tempInputCollection); |
143 |
> |
objectsToGet.push_back(obj1); |
144 |
> |
objectsToGet.push_back(obj2ToGet); |
145 |
> |
} // end else |
146 |
> |
|
147 |
> |
|
148 |
> |
|
149 |
> |
vector<edm::ParameterSet> histogramList_ (histogramSets_.at(currentHistogramSet).getParameter<vector<edm::ParameterSet> >("histograms")); |
150 |
> |
|
151 |
> |
for(uint currentHistogram = 0; currentHistogram != histogramList_.size(); currentHistogram++){ |
152 |
> |
|
153 |
> |
vector<double> defaultValue; |
154 |
> |
defaultValue.push_back (-1.0); |
155 |
> |
|
156 |
> |
histogram tempHistogram; |
157 |
> |
tempHistogram.inputCollection = tempInputCollection; |
158 |
> |
tempHistogram.name = histogramList_.at(currentHistogram).getParameter<string>("name"); |
159 |
> |
tempHistogram.title = histogramList_.at(currentHistogram).getParameter<string>("title"); |
160 |
> |
tempHistogram.bins = histogramList_.at(currentHistogram).getUntrackedParameter<vector<double> >("bins", defaultValue); |
161 |
> |
tempHistogram.variableBinsX = histogramList_.at(currentHistogram).getUntrackedParameter<vector<double> >("variableBinsX", defaultValue); |
162 |
> |
tempHistogram.variableBinsY = histogramList_.at(currentHistogram).getUntrackedParameter<vector<double> >("variableBinsY", defaultValue); |
163 |
> |
tempHistogram.inputVariables = histogramList_.at(currentHistogram).getParameter<vector<string> >("inputVariables"); |
164 |
> |
|
165 |
> |
histograms.push_back(tempHistogram); |
166 |
> |
|
167 |
> |
} |
168 |
> |
} // for(uint currentHistogramSet = 0; currentHistogramSet != histogramSets_.size(); currentHistogramSet++) |
169 |
> |
|
170 |
> |
//make unique vector of objects we need to plot (so we can book a histogram with the number of each object) |
171 |
> |
sort( objectsToPlot.begin(), objectsToPlot.end() ); |
172 |
> |
objectsToPlot.erase( unique( objectsToPlot.begin(), objectsToPlot.end() ), objectsToPlot.end() ); |
173 |
> |
|
174 |
> |
|
175 |
> |
|
176 |
> |
//add histograms with the gen-matched id, mother id, and grandmother id |
177 |
> |
for(uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){ |
178 |
> |
|
179 |
> |
string currentObject = objectsToPlot.at(currentObjectIndex); |
180 |
> |
if(currentObject != "muons" && currentObject != "secondary muons" && currentObject != "secondary electrons" && currentObject != "electrons" && currentObject != "taus" && currentObject != "tracks" && currentObject != "photons" && currentObject != "superclusters") continue; |
181 |
> |
|
182 |
> |
histogram tempIdHisto; |
183 |
> |
histogram tempMomIdHisto; |
184 |
> |
histogram tempGmaIdHisto; |
185 |
> |
histogram tempIdVsMomIdHisto; |
186 |
> |
histogram tempIdVsGmaIdHisto; |
187 |
> |
|
188 |
> |
tempIdHisto.inputCollection = currentObject; |
189 |
> |
tempMomIdHisto.inputCollection = currentObject; |
190 |
> |
tempGmaIdHisto.inputCollection = currentObject; |
191 |
> |
tempIdVsMomIdHisto.inputCollection = currentObject; |
192 |
> |
tempIdVsGmaIdHisto.inputCollection = currentObject; |
193 |
> |
|
194 |
> |
if(currentObject == "secondary muons") currentObject = "secondaryMuons"; |
195 |
> |
if(currentObject == "secondary electrons") currentObject = "secondaryElectrons"; |
196 |
> |
|
197 |
> |
currentObject = currentObject.substr(0, currentObject.size()-1); |
198 |
> |
tempIdHisto.name = currentObject+"GenMatchId"; |
199 |
> |
tempMomIdHisto.name = currentObject+"GenMatchMotherId"; |
200 |
> |
tempGmaIdHisto.name = currentObject+"GenMatchGrandmotherId"; |
201 |
> |
tempIdVsMomIdHisto.name = currentObject+"GenMatchIdVsMotherId"; |
202 |
> |
tempIdVsGmaIdHisto.name = currentObject+"GenMatchIdVsGrandmotherId"; |
203 |
> |
|
204 |
> |
currentObject.at(0) = toupper(currentObject.at(0)); |
205 |
> |
tempIdHisto.title = currentObject+" Gen-matched Particle"; |
206 |
> |
tempMomIdHisto.title = currentObject+" Gen-matched Particle's Mother"; |
207 |
> |
tempGmaIdHisto.title = currentObject+" Gen-matched Particle's Grandmother"; |
208 |
> |
tempIdVsMomIdHisto.title = currentObject+" Gen-matched Particle's Mother vs. Particle;Particle;Mother"; |
209 |
> |
tempIdVsGmaIdHisto.title = currentObject+" Gen-matched Particle's Grandmother vs. Particle;Particle;Grandmother"; |
210 |
> |
|
211 |
> |
|
212 |
> |
int maxNum = 25; |
213 |
> |
vector<double> binVector; |
214 |
> |
binVector.push_back(maxNum); |
215 |
> |
binVector.push_back(0); |
216 |
> |
binVector.push_back(maxNum); |
217 |
> |
|
218 |
> |
tempIdHisto.bins = binVector; |
219 |
> |
tempIdHisto.inputVariables.push_back("genMatchedId"); |
220 |
> |
tempMomIdHisto.bins = binVector; |
221 |
> |
tempMomIdHisto.inputVariables.push_back("genMatchedMotherId"); |
222 |
> |
tempGmaIdHisto.bins = binVector; |
223 |
> |
tempGmaIdHisto.inputVariables.push_back("genMatchedGrandmotherId"); |
224 |
> |
binVector.push_back(maxNum); |
225 |
> |
binVector.push_back(0); |
226 |
> |
binVector.push_back(maxNum); |
227 |
> |
tempIdVsMomIdHisto.bins = binVector; |
228 |
> |
tempIdVsMomIdHisto.inputVariables.push_back("genMatchedId"); |
229 |
> |
tempIdVsMomIdHisto.inputVariables.push_back("genMatchedMotherIdReverse"); |
230 |
> |
tempIdVsGmaIdHisto.bins = binVector; |
231 |
> |
tempIdVsGmaIdHisto.inputVariables.push_back("genMatchedId"); |
232 |
> |
tempIdVsGmaIdHisto.inputVariables.push_back("genMatchedGrandmotherIdReverse"); |
233 |
> |
|
234 |
> |
histograms.push_back(tempIdHisto); |
235 |
> |
histograms.push_back(tempMomIdHisto); |
236 |
> |
histograms.push_back(tempGmaIdHisto); |
237 |
> |
histograms.push_back(tempIdVsMomIdHisto); |
238 |
> |
histograms.push_back(tempIdVsGmaIdHisto); |
239 |
> |
} |
240 |
|
|
241 |
|
|
242 |
|
channel tempChannel; |
243 |
|
//loop over all channels (event selections) |
244 |
|
for(uint currentChannel = 0; currentChannel != channels_.size(); currentChannel++){ |
245 |
< |
|
245 |
> |
|
246 |
|
//get name of channel |
247 |
|
string channelName (channels_.at(currentChannel).getParameter<string>("name")); |
248 |
|
tempChannel.name = channelName; |
251 |
|
//set triggers for this channel |
252 |
|
vector<string> triggerNames; |
253 |
|
triggerNames.clear(); |
254 |
+ |
vector<string> triggerToVetoNames; |
255 |
+ |
triggerToVetoNames.clear(); |
256 |
+ |
|
257 |
|
tempChannel.triggers.clear(); |
258 |
+ |
tempChannel.triggersToVeto.clear(); |
259 |
|
if(channels_.at(currentChannel).exists("triggers")){ |
260 |
|
triggerNames = channels_.at(currentChannel).getParameter<vector<string> >("triggers"); |
261 |
|
for(uint trigger = 0; trigger!= triggerNames.size(); trigger++) |
262 |
< |
tempChannel.triggers.push_back(triggerNames.at(trigger)); |
263 |
< |
allNecessaryObjects.push_back("triggers"); |
262 |
> |
tempChannel.triggers.push_back(triggerNames.at(trigger)); |
263 |
> |
objectsToGet.push_back("triggers"); |
264 |
> |
} |
265 |
> |
if(channels_.at(currentChannel).exists("triggersToVeto")){ |
266 |
> |
triggerToVetoNames = channels_.at(currentChannel).getParameter<vector<string> >("triggersToVeto"); |
267 |
> |
for(uint trigger = 0; trigger!= triggerToVetoNames.size(); trigger++) |
268 |
> |
tempChannel.triggersToVeto.push_back(triggerToVetoNames.at(trigger)); |
269 |
> |
objectsToGet.push_back("triggers"); |
270 |
|
} |
271 |
|
|
272 |
|
|
273 |
+ |
|
274 |
|
//create cutFlow for this channel |
275 |
|
cutFlows_.push_back (new CutFlow (fs_, channelName)); |
276 |
< |
|
277 |
< |
//book a directory in the output file with the name of the channel |
278 |
< |
TFileDirectory subDir = fs_->mkdir( channelName ); |
58 |
< |
directories.push_back(subDir); |
59 |
< |
std::map<std::string, TH1D*> histoMap; |
60 |
< |
oneDHists_.push_back(histoMap); |
61 |
< |
|
62 |
< |
|
63 |
< |
//muon histograms |
64 |
< |
allNecessaryObjects.push_back("muons"); |
65 |
< |
oneDHists_.at(currentChannel)["muonPt"] = directories.at(currentChannel).make<TH1D> ("muonPt",channelLabel+" channel: Muon Transverse Momentum; p_{T} [GeV]", 100, 0, 500); |
66 |
< |
oneDHists_.at(currentChannel)["muonEta"] = directories.at(currentChannel).make<TH1D> ("muonEta",channelLabel+" channel: Muon Eta; #eta", 100, -5, 5); |
67 |
< |
oneDHists_.at(currentChannel)["muonD0"] = directories.at(currentChannel).make<TH1D> ("muonD0",channelLabel+" channel: Muon d_{0}; d_{0} [cm] ", 1000, -1, 1); |
68 |
< |
oneDHists_.at(currentChannel)["muonAbsD0"] = directories.at(currentChannel).make<TH1D> ("muonAbsD0",channelLabel+" channel: Muon d_{0}; |d_{0}| [cm] ", 1000, 0, 1); |
69 |
< |
oneDHists_.at(currentChannel)["muonD0Sig"] = directories.at(currentChannel).make<TH1D> ("muonD0Sig",channelLabel+" channel: Muon d_{0} Significance; d_{0} / #sigma_{d_{0}} ", 1000, -10.0, 10.0); |
70 |
< |
oneDHists_.at(currentChannel)["muonAbsD0Sig"] = directories.at(currentChannel).make<TH1D> ("muonAbsD0Sig",channelLabel+" channel: Muon d_{0} Significance; |d_{0}| / #sigma_{d_{0}} ", 1000, 0, 10.0); |
71 |
< |
oneDHists_.at(currentChannel)["muonIso"] = directories.at(currentChannel).make<TH1D> ("muonIso",channelLabel+" channel: Muon Combined Relative Isolation; rel. iso. ", 1000, 0, 1); |
72 |
< |
oneDHists_.at(currentChannel)["numMuons"] = directories.at(currentChannel).make<TH1D> ("numMuons",channelLabel+" channel: Number of Selected Muons; # muons", 10, 0, 10); |
73 |
< |
|
74 |
< |
|
75 |
< |
//electron histograms |
76 |
< |
allNecessaryObjects.push_back("electrons"); |
77 |
< |
oneDHists_.at(currentChannel)["electronPt"] = directories.at(currentChannel).make<TH1D> ("electronPt",channelLabel+" channel: Electron Transverse Momentum; p_{T} [GeV]", 100, 0, 500); |
78 |
< |
oneDHists_.at(currentChannel)["electronEta"] = directories.at(currentChannel).make<TH1D> ("electronEta",channelLabel+" channel: Electron Eta; #eta", 50, -5, 5); |
79 |
< |
oneDHists_.at(currentChannel)["electronD0"] = directories.at(currentChannel).make<TH1D> ("electronD0",channelLabel+" channel: Electron d_{0}; d_{0} [cm] ", 1000, -1, 1); |
80 |
< |
oneDHists_.at(currentChannel)["electronAbsD0"] = directories.at(currentChannel).make<TH1D> ("electronAbsD0",channelLabel+" channel: Electron d_{0}; |d_{0}| [cm] ", 1000, 0, 1); |
81 |
< |
oneDHists_.at(currentChannel)["electronD0Sig"] = directories.at(currentChannel).make<TH1D> ("electronD0Sig",channelLabel+" channel: Electron d_{0} Significance; d_{0} / #sigma_{d_{0}} ", 1000, -10.0, 10.0); |
82 |
< |
oneDHists_.at(currentChannel)["electronAbsD0Sig"] = directories.at(currentChannel).make<TH1D> ("electronAbsD0Sig",channelLabel+" channel: Electron d_{0} Significance; |d_{0}| / #sigma_{d_{0}} ", 1000, 0, 10.0); |
83 |
< |
oneDHists_.at(currentChannel)["electronIso"] = directories.at(currentChannel).make<TH1D> ("electronIso",channelLabel+" channel: Electron Combined Relative Isolation; rel. iso. ", 1000, 0, 1); |
84 |
< |
oneDHists_.at(currentChannel)["electronFbrem"] = directories.at(currentChannel).make<TH1D> ("electronFbrem",channelLabel+" channel: Electron Brem. Energy Fraction; fbrem", 1000, 0, 2); |
85 |
< |
oneDHists_.at(currentChannel)["electronMVATrig"] = directories.at(currentChannel).make<TH1D> ("electronMVATrig",channelLabel+" channel: Electron ID MVA Output", 100, -1, 1); |
86 |
< |
oneDHists_.at(currentChannel)["electronMVANonTrig"] = directories.at(currentChannel).make<TH1D> ("electronMVANonTrig",channelLabel+" channel: Electron ID MVA Output", 100, -1, 1); |
87 |
< |
oneDHists_.at(currentChannel)["numElectrons"] = directories.at(currentChannel).make<TH1D> ("numElectrons",channelLabel+" channel: Number of Selected Electrons; # electrons", 10, 0, 10); |
88 |
< |
|
89 |
< |
|
90 |
< |
|
276 |
> |
vector<TFileDirectory> directories; //vector of directories in the output file. |
277 |
> |
vector<TFileDirectory> treeDirectories; //vector of directories for trees in the output file. |
278 |
> |
vector<string> subSubDirNames;//subdirectories in each channel. |
279 |
|
//get list of cuts for this channel |
280 |
|
vector<edm::ParameterSet> cuts_ (channels_.at(currentChannel).getParameter<vector<edm::ParameterSet> >("cuts")); |
281 |
|
|
94 |
– |
vector<string> tempInputCollections; |
95 |
– |
|
282 |
|
|
283 |
|
//loop over and parse all cuts |
284 |
|
for(uint currentCut = 0; currentCut != cuts_.size(); currentCut++){ |
99 |
– |
|
285 |
|
cut tempCut; |
286 |
< |
//store input collection for cut |
287 |
< |
string inputCollection = cuts_.at(currentCut).getParameter<string> ("inputCollection"); |
288 |
< |
tempCut.inputCollection = inputCollection; |
289 |
< |
|
290 |
< |
tempInputCollections.push_back(inputCollection); |
291 |
< |
allNecessaryObjects.push_back(inputCollection); |
286 |
> |
//store input collection for cut |
287 |
> |
string tempInputCollection = cuts_.at(currentCut).getParameter<string> ("inputCollection"); |
288 |
> |
if(tempInputCollection == "muon-electron pairs") tempInputCollection = "electron-muon pairs"; |
289 |
> |
if(tempInputCollection == "photon-electron pairs") tempInputCollection = "electron-photon pairs"; |
290 |
> |
if(tempInputCollection == "photon-muon pairs") tempInputCollection = "muon-photon pairs"; |
291 |
> |
if(tempInputCollection == "jet-electron pairs") tempInputCollection = "electron-jet pairs"; |
292 |
> |
if(tempInputCollection == "jet-muon pairs") tempInputCollection = "muon-jet pairs"; |
293 |
> |
if(tempInputCollection == "jet-photon pairs") tempInputCollection = "photon-jet pairs"; |
294 |
> |
if(tempInputCollection == "event-track pairs") tempInputCollection = "track-event pairs"; |
295 |
> |
if(tempInputCollection == "secondary muon-muon pairs") tempInputCollection = "muon-secondary muon pairs"; |
296 |
> |
if(tempInputCollection == "secondary jet-jet pairs") tempInputCollection = "jet-secondary jet pairs"; |
297 |
> |
if(tempInputCollection == "secondary jet-muon pairs") tempInputCollection = "muon-secondary jet pairs"; |
298 |
> |
if(tempInputCollection == "secondary jet-photon pairs") tempInputCollection = "photon-secondary jet pairs"; |
299 |
> |
if(tempInputCollection == "secondary jet-electron pairs") tempInputCollection = "electron-secondary jet pairs"; |
300 |
> |
if(tempInputCollection == "secondary electron-electron pairs") tempInputCollection = "electron-secondary electron pairs"; |
301 |
> |
if(tempInputCollection == "trigobj-electron pairs") tempInputCollection = "electron-trigobj pairs"; |
302 |
> |
if(tempInputCollection == "trigobj-muon pairs") tempInputCollection = "muon-trigobj pairs"; |
303 |
> |
tempCut.inputCollection = tempInputCollection; |
304 |
> |
if(tempInputCollection.find("pairs")==string::npos){ //just a single object |
305 |
> |
if(tempInputCollection.find("secondary")!=string::npos){//secondary object |
306 |
> |
int spaceIndex = tempInputCollection.find(" "); |
307 |
> |
int secondWordLength = tempInputCollection.size() - spaceIndex; |
308 |
> |
objectsToGet.push_back(tempInputCollection.substr(spaceIndex+1,secondWordLength)); |
309 |
> |
} |
310 |
> |
else{ |
311 |
> |
objectsToGet.push_back(tempInputCollection); |
312 |
> |
} |
313 |
> |
objectsToCut.push_back(tempInputCollection); |
314 |
> |
} |
315 |
> |
else{//pair of objects, need to add them both to objectsToGet |
316 |
> |
string obj1; |
317 |
> |
string obj2; |
318 |
> |
getTwoObjs(tempInputCollection, obj1, obj2); |
319 |
> |
string obj2ToGet = getObjToGet(obj2); |
320 |
> |
objectsToCut.push_back(tempInputCollection); |
321 |
> |
objectsToCut.push_back(obj1); |
322 |
> |
objectsToCut.push_back(obj2); |
323 |
> |
objectsToGet.push_back(tempInputCollection); |
324 |
> |
objectsToGet.push_back(obj1); |
325 |
> |
objectsToGet.push_back(obj2ToGet); |
326 |
> |
|
327 |
> |
} |
328 |
> |
|
329 |
> |
|
330 |
|
|
331 |
|
//split cut string into parts and store them |
332 |
|
string cutString = cuts_.at(currentCut).getParameter<string> ("cutString"); |
333 |
< |
std::vector<string> cutStringVector = splitString(cutString); |
334 |
< |
tempCut.variable = cutStringVector.at(0);// variable to cut on |
335 |
< |
tempCut.comparativeOperator = cutStringVector.at(1);// comparison to make |
336 |
< |
tempCut.cutValue = atof(cutStringVector.at(2).c_str());// threshold value to pass cut |
333 |
> |
vector<string> cutStringVector = splitString(cutString); |
334 |
> |
if(cutStringVector.size()!=3 && cutStringVector.size() % 4 !=3){ |
335 |
> |
cout << "Error: Didn't find the expected number elements in the following cut string: '" << cutString << "'\n"; |
336 |
> |
exit(0); |
337 |
> |
} |
338 |
> |
tempCut.numSubcuts = (cutStringVector.size()+1)/4; |
339 |
> |
for(int subcutIndex = 0; subcutIndex != tempCut.numSubcuts; subcutIndex++){//loop over all the pieces of the cut combined using &,| |
340 |
> |
int indexOffset = 4 * subcutIndex; |
341 |
> |
string currentVariableString = cutStringVector.at(indexOffset); |
342 |
> |
if(currentVariableString.find("(")==string::npos){ |
343 |
> |
tempCut.functions.push_back("");//no function was specified |
344 |
> |
tempCut.variables.push_back(currentVariableString);// variable to cut on |
345 |
> |
} |
346 |
> |
else{ |
347 |
> |
tempCut.functions.push_back(currentVariableString.substr(0,currentVariableString.find("(")));//function comes before the "(" |
348 |
> |
string tempVariable = currentVariableString.substr(currentVariableString.find("(")+1);//get rest of string |
349 |
> |
tempCut.variables.push_back(tempVariable.substr(0,tempVariable.size()-1));//remove trailing ")" |
350 |
> |
} |
351 |
> |
tempCut.comparativeOperators.push_back(cutStringVector.at(indexOffset+1));// comparison to make |
352 |
> |
tempCut.cutValues.push_back(atof(cutStringVector.at(indexOffset+2).c_str()));// threshold value to pass cut |
353 |
> |
tempCut.cutStringValues.push_back(cutStringVector.at(indexOffset+2));// string value to pass cut |
354 |
> |
if(subcutIndex != 0) tempCut.logicalOperators.push_back(cutStringVector.at(indexOffset-1)); // logical comparison (and, or) |
355 |
> |
} |
356 |
|
|
357 |
|
//get number of objects required to pass cut for event to pass |
358 |
|
string numberRequiredString = cuts_.at(currentCut).getParameter<string> ("numberRequired"); |
359 |
< |
std::vector<string> numberRequiredVector = splitString(numberRequiredString); |
360 |
< |
|
361 |
< |
// determine number required if comparison contains "=" |
362 |
< |
int numberRequiredInt = atoi(numberRequiredVector.at(1).c_str()); |
363 |
< |
if(numberRequiredVector.at(0) == ">") numberRequiredInt++; |
122 |
< |
else if(numberRequiredVector.at(0) == "<") numberRequiredInt--; |
359 |
> |
vector<string> numberRequiredVector = splitString(numberRequiredString); |
360 |
> |
if(numberRequiredVector.size()!=2){ |
361 |
> |
cout << "Error: Didn't find two elements in the following number requirement string: '" << numberRequiredString << "'\n"; |
362 |
> |
exit(0); |
363 |
> |
} |
364 |
|
|
365 |
+ |
int numberRequiredInt = atoi(numberRequiredVector.at(1).c_str()); |
366 |
|
tempCut.numberRequired = numberRequiredInt;// number of objects required to pass the cut |
367 |
|
tempCut.eventComparativeOperator = numberRequiredVector.at(0);// comparison to make |
368 |
< |
|
369 |
< |
if(cuts_.at(currentCut).exists("function")){ |
370 |
< |
tempCut.function = cuts_.at(currentCut).getParameter<string> ("function"); |
129 |
< |
} |
130 |
< |
else tempCut.function = ""; |
368 |
> |
|
369 |
> |
//Set up vectors to store the directories and subDirectories for each channel. |
370 |
> |
string subSubDirName; |
371 |
|
string tempCutName; |
372 |
|
if(cuts_.at(currentCut).exists("alias")){ |
373 |
< |
tempCutName = cuts_.at(currentCut).getParameter<string> ("alias"); |
373 |
> |
tempCutName = cuts_.at(currentCut).getParameter<string> ("alias"); |
374 |
> |
subSubDirName = "After " + tempCutName + " Cut Applied"; |
375 |
|
} |
376 |
|
else{ |
377 |
< |
//construct string for cutflow table |
378 |
< |
bool plural = numberRequiredInt != 1; |
379 |
< |
string collectionString = plural ? inputCollection : inputCollection.substr(0, inputCollection.size()-1); |
380 |
< |
string cutName = numberRequiredString + " " + collectionString + " with " + cutString; |
381 |
< |
tempCutName = cutName; |
377 |
> |
//construct string for cutflow table |
378 |
> |
bool plural = numberRequiredInt != 1; |
379 |
> |
string collectionString = plural ? tempInputCollection : tempInputCollection.substr(0, tempInputCollection.size()-1); |
380 |
> |
string cutName = numberRequiredString + " " + collectionString + " with " + cutString; |
381 |
> |
tempCutName = cutName; |
382 |
> |
subSubDirName = "After " + numberRequiredString + " " + collectionString + " with " + cutString + " Cut Applied"; |
383 |
|
} |
142 |
– |
tempCut.name = tempCutName; |
384 |
|
|
385 |
+ |
tempCut.isVeto = false; |
386 |
+ |
if(cuts_.at(currentCut).exists("isVeto")){ |
387 |
+ |
bool isVeto = cuts_.at(currentCut).getParameter<bool> ("isVeto"); |
388 |
+ |
if (isVeto == true) tempCut.isVeto = true; |
389 |
+ |
} |
390 |
+ |
subSubDirNames.push_back(subSubDirName); |
391 |
+ |
tempCut.name = tempCutName; |
392 |
|
|
393 |
|
tempChannel.cuts.push_back(tempCut); |
394 |
|
|
395 |
|
|
396 |
|
}//end loop over cuts |
397 |
|
|
398 |
< |
//make unique vector of all objects that this channel cuts on (so we know to set flags for those) |
399 |
< |
sort( tempInputCollections.begin(), tempInputCollections.end() ); |
400 |
< |
tempInputCollections.erase( unique( tempInputCollections.begin(), tempInputCollections.end() ), tempInputCollections.end() ); |
401 |
< |
tempChannel.inputCollections = tempInputCollections; |
398 |
> |
vector<map<string, TH1D*>> oneDHistsTmp; |
399 |
> |
vector<map<string, TH2D*>> twoDHistsTmp; |
400 |
> |
//book a directory in the output file with the name of the channel |
401 |
> |
TFileDirectory subDir = fs_->mkdir( channelName ); |
402 |
> |
//loop over the cuts to set up subdirectory for each cut if GetPlotsAfterEachCut_ is true. |
403 |
> |
if(GetPlotsAfterEachCut_){ |
404 |
> |
for( uint currentDir=0; currentDir != subSubDirNames.size(); currentDir++){ |
405 |
> |
TFileDirectory subSubDir = subDir.mkdir( subSubDirNames[currentDir] ); |
406 |
> |
directories.push_back(subSubDir); |
407 |
> |
map<string, TH1D*> oneDhistoMap; |
408 |
> |
oneDHistsTmp.push_back(oneDhistoMap); |
409 |
> |
map<string, TH2D*> twoDhistoMap; |
410 |
> |
twoDHistsTmp.push_back(twoDhistoMap); |
411 |
> |
} |
412 |
> |
treeDirectories.push_back(subDir); |
413 |
> |
oneDHists_.push_back(oneDHistsTmp); |
414 |
> |
twoDHists_.push_back(twoDHistsTmp); |
415 |
> |
} |
416 |
> |
//only set up directories with names of the channels if GetPlotsAfterEachCut_ is false. |
417 |
> |
else{ |
418 |
> |
map<string, TH1D*> oneDhistoMap; |
419 |
> |
oneDHistsTmp.push_back(oneDhistoMap); |
420 |
> |
map<string, TH2D*> twoDhistoMap; |
421 |
> |
twoDHistsTmp.push_back(twoDhistoMap); |
422 |
> |
oneDHists_.push_back(oneDHistsTmp); |
423 |
> |
twoDHists_.push_back(twoDHistsTmp); |
424 |
> |
directories.push_back(subDir); |
425 |
> |
treeDirectories.push_back(subDir); |
426 |
> |
|
427 |
> |
} |
428 |
> |
|
429 |
> |
for(uint currentDir = 0; !useEDMFormat_ && currentDir != treeDirectories.size(); currentDir++){ |
430 |
> |
TTree* newTree = treeDirectories.at(currentDir).make<TTree> (TString("BNTree_"+channelLabel), TString("BNTree_"+channelLabel)); |
431 |
> |
BNTrees_.push_back(newTree); |
432 |
> |
for (uint iBranch = 0; iBranch < treeBranches_.size(); iBranch++){ |
433 |
> |
BranchSpecs currentVar = treeBranches_.at(iBranch); |
434 |
> |
vector<float> newVec; |
435 |
> |
BNTreeBranchVals_[currentVar.name] = newVec; |
436 |
> |
BNTrees_.back()->Branch(TString(currentVar.name), &BNTreeBranchVals_.at(currentVar.name)); |
437 |
> |
} // end for (uint iBranch = 0; iBranch < treeBranches_.size(); iBranch++) |
438 |
> |
} |
439 |
> |
|
440 |
> |
//book all histograms included in the configuration |
441 |
> |
for(uint currentDir = 0; currentDir != directories.size(); currentDir++){//loop over all the directories. |
442 |
> |
|
443 |
> |
for(uint currentHistogramIndex = 0; currentHistogramIndex != histograms.size(); currentHistogramIndex++){ |
444 |
> |
|
445 |
> |
histogram currentHistogram = histograms.at(currentHistogramIndex); |
446 |
> |
int numBinsElements = currentHistogram.bins.size(); |
447 |
> |
int numInputVariables = currentHistogram.inputVariables.size(); |
448 |
> |
int numBinEdgesX = currentHistogram.variableBinsX.size(); |
449 |
> |
int numBinEdgesY = currentHistogram.variableBinsY.size(); |
450 |
> |
|
451 |
> |
if(numBinsElements == 1){ |
452 |
> |
if(numBinEdgesX > 1){ |
453 |
> |
if(numBinEdgesY > 1) |
454 |
> |
numBinsElements = 6; |
455 |
> |
else |
456 |
> |
numBinsElements = 3; |
457 |
> |
} |
458 |
> |
} |
459 |
> |
if(numBinsElements != 3 && numBinsElements !=6){ |
460 |
> |
cout << "Error: Didn't find correct number of bin specifications for histogram named '" << currentHistogram.name << "'\n"; |
461 |
> |
exit(0); |
462 |
> |
} |
463 |
> |
else if((numBinsElements == 3 && numInputVariables !=1) || (numBinsElements == 6 && numInputVariables!=2)){ |
464 |
> |
cout << "Error: Didn't find correct number of input variables for histogram named '" << currentHistogram.name << "'\n"; |
465 |
> |
exit(0); |
466 |
> |
} |
467 |
> |
else if(numBinsElements == 3){ |
468 |
> |
if (currentHistogram.bins.size () == 3) |
469 |
> |
oneDHists_.at(currentChannel).at(currentDir)[currentHistogram.name] = directories.at(currentDir).make<TH1D> (TString(currentHistogram.name),channelLabel+" channel: "+currentHistogram.title, currentHistogram.bins.at(0), currentHistogram.bins.at(1), currentHistogram.bins.at(2)); |
470 |
> |
else |
471 |
> |
{ |
472 |
> |
oneDHists_.at(currentChannel).at(currentDir)[currentHistogram.name] = directories.at(currentDir).make<TH1D> (TString(currentHistogram.name),channelLabel+" channel: "+currentHistogram.title, numBinEdgesX - 1, currentHistogram.variableBinsX.data ()); |
473 |
> |
} |
474 |
> |
} |
475 |
> |
else if(numBinsElements == 6){ |
476 |
> |
if (currentHistogram.bins.size () == 6) |
477 |
> |
twoDHists_.at(currentChannel).at(currentDir)[currentHistogram.name] = directories.at(currentDir).make<TH2D> (TString(currentHistogram.name),channelLabel+" channel: "+currentHistogram.title, currentHistogram.bins.at(0), currentHistogram.bins.at(1), currentHistogram.bins.at(2),currentHistogram.bins.at(3),currentHistogram.bins.at(4),currentHistogram.bins.at(5)); |
478 |
> |
else |
479 |
> |
twoDHists_.at(currentChannel).at(currentDir)[currentHistogram.name] = directories.at(currentDir).make<TH2D> (TString(currentHistogram.name),channelLabel+" channel: "+currentHistogram.title, numBinEdgesX - 1, currentHistogram.variableBinsX.data (), numBinEdgesY - 1, currentHistogram.variableBinsY.data ()); |
480 |
> |
} |
481 |
|
|
482 |
+ |
|
483 |
+ |
if(currentHistogram.name.find("GenMatch")==string::npos) continue; |
484 |
+ |
|
485 |
+ |
// bin particle type |
486 |
+ |
// --- ------------- |
487 |
+ |
// 0 unmatched |
488 |
+ |
// 1 u |
489 |
+ |
// 2 d |
490 |
+ |
// 3 s |
491 |
+ |
// 4 c |
492 |
+ |
// 5 b |
493 |
+ |
// 6 t |
494 |
+ |
// 7 e |
495 |
+ |
// 8 mu |
496 |
+ |
// 9 tau |
497 |
+ |
// 10 nu |
498 |
+ |
// 11 g |
499 |
+ |
// 12 gamma |
500 |
+ |
// 13 Z |
501 |
+ |
// 14 W |
502 |
+ |
// 15 light meson |
503 |
+ |
// 16 K meson |
504 |
+ |
// 17 D meson |
505 |
+ |
// 18 B meson |
506 |
+ |
// 19 light baryon |
507 |
+ |
// 20 strange baryon |
508 |
+ |
// 21 charm baryon |
509 |
+ |
// 22 bottom baryon |
510 |
+ |
// 23 QCD string |
511 |
+ |
// 24 other |
512 |
+ |
|
513 |
+ |
vector<TString> labelArray; |
514 |
+ |
labelArray.push_back("unmatched"); |
515 |
+ |
labelArray.push_back("u"); |
516 |
+ |
labelArray.push_back("d"); |
517 |
+ |
labelArray.push_back("s"); |
518 |
+ |
labelArray.push_back("c"); |
519 |
+ |
labelArray.push_back("b"); |
520 |
+ |
labelArray.push_back("t"); |
521 |
+ |
labelArray.push_back("e"); |
522 |
+ |
labelArray.push_back("#mu"); |
523 |
+ |
labelArray.push_back("#tau"); |
524 |
+ |
labelArray.push_back("#nu"); |
525 |
+ |
labelArray.push_back("g"); |
526 |
+ |
labelArray.push_back("#gamma"); |
527 |
+ |
labelArray.push_back("Z"); |
528 |
+ |
labelArray.push_back("W"); |
529 |
+ |
labelArray.push_back("light meson"); |
530 |
+ |
labelArray.push_back("K meson"); |
531 |
+ |
labelArray.push_back("D meson"); |
532 |
+ |
labelArray.push_back("B meson"); |
533 |
+ |
labelArray.push_back("light baryon"); |
534 |
+ |
labelArray.push_back("strange baryon"); |
535 |
+ |
labelArray.push_back("charm baryon"); |
536 |
+ |
labelArray.push_back("bottom baryon"); |
537 |
+ |
labelArray.push_back("QCD string"); |
538 |
+ |
labelArray.push_back("other"); |
539 |
+ |
|
540 |
+ |
for(int bin = 0; bin !=currentHistogram.bins.at(0); bin++){ |
541 |
+ |
if(currentHistogram.name.find("GenMatchIdVsMotherId")==string::npos && currentHistogram.name.find("GenMatchIdVsGrandmotherId")==string::npos) { |
542 |
+ |
oneDHists_.at(currentChannel).at(currentDir)[currentHistogram.name]->GetXaxis()->SetBinLabel(bin+1,labelArray.at(bin)); |
543 |
+ |
} |
544 |
+ |
else { |
545 |
+ |
twoDHists_.at(currentChannel).at(currentDir)[currentHistogram.name]->GetYaxis()->SetBinLabel(bin+1,labelArray.at(currentHistogram.bins.at(0)-bin-1)); |
546 |
+ |
twoDHists_.at(currentChannel).at(currentDir)[currentHistogram.name]->GetXaxis()->SetBinLabel(bin+1,labelArray.at(bin)); |
547 |
+ |
} |
548 |
+ |
} |
549 |
+ |
if(currentHistogram.name.find("GenMatchIdVsMotherId")!=string::npos || currentHistogram.name.find("GenMatchIdVsGrandmotherId")!=string::npos) { |
550 |
+ |
twoDHists_.at(currentChannel).at(currentDir)[currentHistogram.name]->GetXaxis()->CenterTitle(); |
551 |
+ |
twoDHists_.at(currentChannel).at(currentDir)[currentHistogram.name]->GetYaxis()->CenterTitle(); |
552 |
+ |
} |
553 |
+ |
|
554 |
+ |
} // end for(uint currentHistogramIndex = 0; currentHistogramIndex != histograms.size(); currentHistogramIndex++) |
555 |
+ |
|
556 |
+ |
|
557 |
+ |
// Book a histogram for the number of each object type to be plotted. |
558 |
+ |
// Name of objectToPlot here must match the name specified in OSUAnalysis::analyze(). |
559 |
+ |
for (uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){ |
560 |
+ |
string currentObject = objectsToPlot.at(currentObjectIndex); |
561 |
+ |
int maxNum = 10; |
562 |
+ |
if(currentObject == "mcparticles") maxNum = 50; |
563 |
+ |
else if(currentObject == "primaryvertexs") maxNum = 50; |
564 |
+ |
|
565 |
+ |
if(currentObject == "muon-muon pairs") currentObject = "dimuonPairs"; |
566 |
+ |
else if(currentObject == "electron-electron pairs") currentObject = "dielectronPairs"; |
567 |
+ |
else if(currentObject == "electron-muon pairs") currentObject = "electronMuonPairs"; |
568 |
+ |
else if(currentObject == "electron-photon pairs") currentObject = "electronPhotonPairs"; |
569 |
+ |
else if(currentObject == "muon-photon pairs") currentObject = "muonPhotonPairs"; |
570 |
+ |
else if(currentObject == "secondary jets") currentObject = "secondaryJets"; |
571 |
+ |
else if(currentObject == "jet-jet pairs") currentObject = "dijetPairs"; |
572 |
+ |
else if(currentObject == "jet-secondary jet pairs") currentObject = "jetSecondaryJetPairs"; |
573 |
+ |
else if(currentObject == "electron-jet pairs") currentObject = "electronJetPairs"; |
574 |
+ |
else if(currentObject == "muon-jet pairs") currentObject = "muonJetPairs"; |
575 |
+ |
else if(currentObject == "photon-jet pairs") currentObject = "photonJetPairs"; |
576 |
+ |
else if(currentObject == "muon-secondary jet pairs") currentObject = "muonSecondaryJetPairs"; |
577 |
+ |
else if(currentObject == "photon-secondary jet pairs") currentObject = "photonSecondaryJetPairs"; |
578 |
+ |
else if(currentObject == "electron-secondary jet pairs") currentObject = "electronSecondaryJetPairs"; |
579 |
+ |
else if(currentObject == "track-event pairs") currentObject = "trackEventPairs"; |
580 |
+ |
else if(currentObject == "electron-track pairs") currentObject = "electronTrackPairs"; |
581 |
+ |
else if(currentObject == "muon-track pairs") currentObject = "muonTrackPairs"; |
582 |
+ |
else if(currentObject == "muon-tau pairs") currentObject = "muonTauPairs"; |
583 |
+ |
else if(currentObject == "tau-tau pairs") currentObject = "ditauPairs"; |
584 |
+ |
else if(currentObject == "tau-track pairs") currentObject = "tauTrackPairs"; |
585 |
+ |
else if(currentObject == "muon-secondary muon pairs") currentObject = "muonSecondaryMuonPairs"; |
586 |
+ |
else if(currentObject == "secondary muons") currentObject = "secondaryMuons"; |
587 |
+ |
else if(currentObject == "electron-secondary electron pairs") currentObject = "electronSecondaryElectronPairs"; |
588 |
+ |
else if(currentObject == "secondary electrons") currentObject = "secondaryElectrons"; |
589 |
+ |
else if(currentObject == "electron-trigobj pairs") currentObject = "electronTrigobjPairs"; |
590 |
+ |
else if(currentObject == "muon-trigobj pairs") currentObject = "muonTrigobjPairs"; |
591 |
+ |
|
592 |
+ |
currentObject.at(0) = toupper(currentObject.at(0)); |
593 |
+ |
string histoName = "num" + currentObject; |
594 |
+ |
|
595 |
+ |
if(histoName == "numPrimaryvertexs"){ |
596 |
+ |
string newHistoName = histoName + "BeforePileupCorrection"; |
597 |
+ |
oneDHists_.at(currentChannel).at(currentDir)[newHistoName] = directories.at(currentDir).make<TH1D> (TString(newHistoName),channelLabel+" channel: Number of Selected "+currentObject+" Before Pileup Correction; # "+currentObject, maxNum, 0, maxNum); |
598 |
+ |
newHistoName = histoName + "AfterPileupCorrection"; |
599 |
+ |
oneDHists_.at(currentChannel).at(currentDir)[newHistoName] = directories.at(currentDir).make<TH1D> (TString(newHistoName),channelLabel+" channel: Number of Selected "+currentObject+ " After Pileup Correction; # "+currentObject, maxNum, 0, maxNum); |
600 |
+ |
} |
601 |
+ |
else |
602 |
+ |
oneDHists_.at(currentChannel).at(currentDir)[histoName] = directories.at(currentDir).make<TH1D> (TString(histoName),channelLabel+" channel: Number of Selected "+currentObject+"; # "+currentObject, maxNum, 0, maxNum); |
603 |
+ |
} |
604 |
+ |
}//end of loop over directories |
605 |
|
channels.push_back(tempChannel); |
606 |
|
tempChannel.cuts.clear(); |
157 |
– |
|
607 |
|
}//end loop over channels |
608 |
|
|
160 |
– |
//make unique vector of objects we need to cut on (so we make sure to get them from the event) |
161 |
– |
sort( allNecessaryObjects.begin(), allNecessaryObjects.end() ); |
162 |
– |
allNecessaryObjects.erase( unique( allNecessaryObjects.begin(), allNecessaryObjects.end() ), allNecessaryObjects.end() ); |
609 |
|
|
610 |
+ |
//make unique vector of objects we need to get from the event |
611 |
+ |
sort( objectsToGet.begin(), objectsToGet.end() ); |
612 |
+ |
objectsToGet.erase( unique( objectsToGet.begin(), objectsToGet.end() ), objectsToGet.end() ); |
613 |
+ |
//make unique vector of objects we need to cut on |
614 |
+ |
sort( objectsToCut.begin(), objectsToCut.end() ); |
615 |
+ |
objectsToCut.erase( unique( objectsToCut.begin(), objectsToCut.end() ), objectsToCut.end() ); |
616 |
+ |
|
617 |
+ |
produces<map<string, bool> > ("channelDecisions"); |
618 |
+ |
|
619 |
+ |
} // end constructor OSUAnalysis::OSUAnalysis() |
620 |
|
|
165 |
– |
} |
621 |
|
|
622 |
|
OSUAnalysis::~OSUAnalysis () |
623 |
|
{ |
624 |
+ |
|
625 |
|
// Destroying the CutFlow objects causes the cut flow numbers and time |
626 |
|
// information to be printed to standard output. |
627 |
|
for(uint currentChannel = 0; currentChannel != channels_.size(); currentChannel++){ |
630 |
|
} |
631 |
|
|
632 |
|
void |
633 |
< |
OSUAnalysis::analyze (const edm::Event &event, const edm::EventSetup &setup) |
633 |
> |
OSUAnalysis::produce (edm::Event &event, const edm::EventSetup &setup) |
634 |
|
{ |
635 |
< |
|
180 |
< |
|
635 |
> |
//cout << "**********************\n\n\n"; |
636 |
|
// Retrieve necessary collections from the event. |
637 |
< |
edm::Handle<BNtriggerCollection> triggers; |
638 |
< |
if (std::find(allNecessaryObjects.begin(), allNecessaryObjects.end(), "triggers") != allNecessaryObjects.end()) |
637 |
> |
|
638 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "triggers") != objectsToGet.end()) |
639 |
|
event.getByLabel (triggers_, triggers); |
640 |
|
|
641 |
< |
edm::Handle<BNjetCollection> jets; |
642 |
< |
if (std::find(allNecessaryObjects.begin(), allNecessaryObjects.end(), "jets") != allNecessaryObjects.end()) |
641 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "trigobjs") != objectsToGet.end()) |
642 |
> |
event.getByLabel (trigobjs_, trigobjs); |
643 |
> |
|
644 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "jets") != objectsToGet.end()) |
645 |
|
event.getByLabel (jets_, jets); |
646 |
|
|
647 |
< |
edm::Handle<BNmuonCollection> muons; |
191 |
< |
if (std::find(allNecessaryObjects.begin(), allNecessaryObjects.end(), "muons") != allNecessaryObjects.end()) |
647 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "muons") != objectsToGet.end()) |
648 |
|
event.getByLabel (muons_, muons); |
649 |
|
|
650 |
< |
edm::Handle<BNelectronCollection> electrons; |
195 |
< |
if (std::find(allNecessaryObjects.begin(), allNecessaryObjects.end(), "electrons") != allNecessaryObjects.end()) |
650 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "electrons") != objectsToGet.end()) |
651 |
|
event.getByLabel (electrons_, electrons); |
652 |
|
|
653 |
< |
edm::Handle<BNeventCollection> events; |
199 |
< |
if (std::find(allNecessaryObjects.begin(), allNecessaryObjects.end(), "events") != allNecessaryObjects.end()) |
653 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "events") != objectsToGet.end()) |
654 |
|
event.getByLabel (events_, events); |
655 |
|
|
656 |
< |
edm::Handle<BNtauCollection> taus; |
203 |
< |
if (std::find(allNecessaryObjects.begin(), allNecessaryObjects.end(), "taus") != allNecessaryObjects.end()) |
656 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "taus") != objectsToGet.end()) |
657 |
|
event.getByLabel (taus_, taus); |
658 |
|
|
659 |
< |
edm::Handle<BNmetCollection> mets; |
207 |
< |
if (std::find(allNecessaryObjects.begin(), allNecessaryObjects.end(), "mets") != allNecessaryObjects.end()) |
659 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "mets") != objectsToGet.end()) |
660 |
|
event.getByLabel (mets_, mets); |
661 |
|
|
662 |
< |
edm::Handle<BNtrackCollection> tracks; |
211 |
< |
if (std::find(allNecessaryObjects.begin(), allNecessaryObjects.end(), "tracks") != allNecessaryObjects.end()) |
662 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "tracks") != objectsToGet.end()) |
663 |
|
event.getByLabel (tracks_, tracks); |
664 |
|
|
665 |
< |
edm::Handle<BNgenjetCollection> genjets; |
215 |
< |
if (std::find(allNecessaryObjects.begin(), allNecessaryObjects.end(), "genjets") != allNecessaryObjects.end()) |
665 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "genjets") != objectsToGet.end()) |
666 |
|
event.getByLabel (genjets_, genjets); |
667 |
|
|
668 |
< |
edm::Handle<BNmcparticleCollection> mcparticles; |
219 |
< |
if (std::find(allNecessaryObjects.begin(), allNecessaryObjects.end(), "mcparticles") != allNecessaryObjects.end()) |
668 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "mcparticles") != objectsToGet.end()) |
669 |
|
event.getByLabel (mcparticles_, mcparticles); |
670 |
|
|
671 |
< |
edm::Handle<BNprimaryvertexCollection> primaryvertexs; |
223 |
< |
if (std::find(allNecessaryObjects.begin(), allNecessaryObjects.end(), "primaryvertexs") != allNecessaryObjects.end()) |
671 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "primaryvertexs") != objectsToGet.end()) |
672 |
|
event.getByLabel (primaryvertexs_, primaryvertexs); |
673 |
|
|
674 |
< |
edm::Handle<BNbxlumiCollection> bxlumis; |
227 |
< |
if (std::find(allNecessaryObjects.begin(), allNecessaryObjects.end(), "bxlumis") != allNecessaryObjects.end()) |
674 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "bxlumis") != objectsToGet.end()) |
675 |
|
event.getByLabel (bxlumis_, bxlumis); |
676 |
|
|
677 |
< |
edm::Handle<BNphotonCollection> photons; |
231 |
< |
if (std::find(allNecessaryObjects.begin(), allNecessaryObjects.end(), "photons") != allNecessaryObjects.end()) |
677 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "photons") != objectsToGet.end()) |
678 |
|
event.getByLabel (photons_, photons); |
679 |
|
|
680 |
< |
edm::Handle<BNsuperclusterCollection> superclusters; |
235 |
< |
if (std::find(allNecessaryObjects.begin(), allNecessaryObjects.end(), "superclusters") != allNecessaryObjects.end()) |
680 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "superclusters") != objectsToGet.end()) |
681 |
|
event.getByLabel (superclusters_, superclusters); |
682 |
|
|
683 |
+ |
if (datasetType_ == "signalMC"){ |
684 |
+ |
if (find(objectsToGet.begin(), objectsToGet.end(), "stops") != objectsToGet.end()) |
685 |
+ |
event.getByLabel (stops_, stops); |
686 |
+ |
} |
687 |
+ |
|
688 |
+ |
if (useTrackCaloRhoCorr_) { |
689 |
+ |
// Used only for pile-up correction of by-hand calculation of isolation energy. |
690 |
+ |
// This rho collection is not available in all BEANs. |
691 |
+ |
// For description of rho values for different jet reconstruction algorithms, see |
692 |
+ |
// https://twiki.cern.ch/twiki/bin/view/CMS/JetAlgorithms#Algorithms |
693 |
+ |
event.getByLabel ("kt6CaloJets","rho", rhokt6CaloJetsHandle_); |
694 |
+ |
} |
695 |
+ |
|
696 |
+ |
double masterScaleFactor = 1.0; |
697 |
+ |
|
698 |
+ |
//get pile-up event weight |
699 |
+ |
if (doPileupReweighting_ && datasetType_ != "data") { |
700 |
+ |
//for "data" datasets, the numTruePV is always set to -1 |
701 |
+ |
if (events->at(0).numTruePV < 0) cout << "WARNING[OSUAnalysis::analyze]: Event has numTruePV<0. Turning off pile-up reweighting." << endl; |
702 |
+ |
else masterScaleFactor *= puWeight_->at (events->at (0).numTruePV); |
703 |
+ |
} |
704 |
+ |
|
705 |
+ |
stopCTauScaleFactor_ = 1.0; |
706 |
+ |
if (datasetType_ == "signalMC" && regex_match (dataset_, regex ("stop.*to.*_.*mm.*"))) |
707 |
+ |
stopCTauScaleFactor_ = stopCTauWeight_->at (event); |
708 |
+ |
masterScaleFactor *= stopCTauScaleFactor_; |
709 |
|
|
710 |
|
//loop over all channels |
711 |
|
|
712 |
+ |
auto_ptr<map<string, bool> > channelDecisions (new map<string, bool>); |
713 |
|
for(uint currentChannelIndex = 0; currentChannelIndex != channels.size(); currentChannelIndex++){ |
714 |
|
channel currentChannel = channels.at(currentChannelIndex); |
715 |
< |
|
716 |
< |
flagMap individualFlags; |
717 |
< |
flagMap cumulativeFlags; |
718 |
< |
counterMap passingCounter; |
715 |
> |
|
716 |
> |
flagMap individualFlags; |
717 |
> |
counterMap passingCounter; |
718 |
> |
cumulativeFlags.clear (); |
719 |
> |
|
720 |
> |
for (map<string, vector<float>>::iterator iter = BNTreeBranchVals_.begin(); |
721 |
> |
iter != BNTreeBranchVals_.end(); iter++) { |
722 |
> |
iter->second.clear(); // clear array |
723 |
> |
} |
724 |
|
|
725 |
|
bool triggerDecision = true; |
726 |
< |
if(currentChannel.triggers.size() != 0){ //triggers specified |
727 |
< |
triggerDecision = evaluateTriggers(currentChannel.triggers,triggers.product()); |
726 |
> |
if(currentChannel.triggers.size() != 0 || currentChannel.triggersToVeto.size() != 0){ //triggers specified |
727 |
> |
triggerDecision = evaluateTriggers(currentChannel.triggers, currentChannel.triggersToVeto, triggers.product()); |
728 |
|
cutFlows_.at(currentChannelIndex)->at ("trigger") = triggerDecision; |
729 |
|
} |
730 |
|
|
731 |
|
//loop over all cuts |
732 |
|
for(uint currentCutIndex = 0; currentCutIndex != currentChannel.cuts.size(); currentCutIndex++){ |
733 |
|
cut currentCut = currentChannel.cuts.at(currentCutIndex); |
734 |
+ |
for(uint currentObjectIndex = 0; currentObjectIndex != objectsToCut.size(); currentObjectIndex++){ |
735 |
+ |
string currentObject = objectsToCut.at(currentObjectIndex); |
736 |
|
|
737 |
< |
for(uint currentObjectIndex = 0; currentObjectIndex != allNecessaryObjects.size(); currentObjectIndex++){ |
738 |
< |
|
739 |
< |
string currentObject = allNecessaryObjects.at(currentObjectIndex); |
261 |
< |
individualFlags[currentObject].push_back (vector<bool> ()); |
262 |
< |
cumulativeFlags[currentObject].push_back (vector<bool> ()); |
263 |
< |
|
264 |
< |
if(currentObject == "jets") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,jets.product(),"jets"); |
265 |
< |
else if(currentObject == "muons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),"muons"); |
266 |
< |
else if(currentObject == "electrons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),"electrons"); |
267 |
< |
else if(currentObject == "events") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,events.product(),"events"); |
268 |
< |
else if(currentObject == "taus") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,taus.product(),"taus"); |
269 |
< |
else if(currentObject == "mets") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,mets.product(),"mets"); |
270 |
< |
else if(currentObject == "tracks") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,tracks.product(),"tracks"); |
271 |
< |
else if(currentObject == "genjets") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,genjets.product(),"genjets"); |
272 |
< |
else if(currentObject == "mcparticles") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,mcparticles.product(),"mcparticles"); |
273 |
< |
else if(currentObject == "primaryvertexs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,primaryvertexs.product(),"primaryvertexs"); |
274 |
< |
else if(currentObject == "bxlumis") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,bxlumis.product(),"bxlumis"); |
275 |
< |
else if(currentObject == "photons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,photons.product(),"photons"); |
276 |
< |
else if(currentObject == "superclusters") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,superclusters.product(),"superclusters"); |
277 |
< |
|
737 |
> |
//initialize maps to get ready to set cuts |
738 |
> |
individualFlags[currentObject].push_back (vector<pair<bool,bool> > ()); |
739 |
> |
cumulativeFlags[currentObject].push_back (vector<pair<bool,bool> > ()); |
740 |
|
|
741 |
|
} |
742 |
+ |
for(uint currentObjectIndex = 0; currentObjectIndex != objectsToCut.size(); currentObjectIndex++){ |
743 |
+ |
string currentObject = objectsToCut.at(currentObjectIndex); |
744 |
|
|
745 |
+ |
int flagsForPairCutsIndex = max(int(currentCutIndex-1),0); |
746 |
|
|
747 |
|
|
748 |
< |
}//end loop over all cuts |
749 |
< |
|
748 |
> |
if (currentObject == "jets") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,jets.product(),"jets"); |
749 |
> |
else if(currentObject == "secondary jets") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,jets.product(),"secondary jets"); |
750 |
> |
else if(currentObject == "muons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),"muons"); |
751 |
> |
else if(currentObject == "secondary muons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),"secondary muons"); |
752 |
> |
else if(currentObject == "secondary electrons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),"secondary electrons"); |
753 |
> |
else if(currentObject == "electrons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),"electrons"); |
754 |
> |
else if(currentObject == "events") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,events.product(),"events"); |
755 |
> |
else if(currentObject == "taus") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,taus.product(),"taus"); |
756 |
> |
else if(currentObject == "mets") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,mets.product(),"mets"); |
757 |
> |
else if(currentObject == "tracks") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,tracks.product(),"tracks"); |
758 |
> |
else if(currentObject == "genjets") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,genjets.product(),"genjets"); |
759 |
> |
else if(currentObject == "mcparticles") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,mcparticles.product(),"mcparticles"); |
760 |
> |
else if(currentObject == "primaryvertexs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,primaryvertexs.product(),"primaryvertexs"); |
761 |
> |
else if(currentObject == "bxlumis") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,bxlumis.product(),"bxlumis"); |
762 |
> |
else if(currentObject == "photons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,photons.product(),"photons"); |
763 |
> |
else if(currentObject == "superclusters") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,superclusters.product(),"superclusters"); |
764 |
> |
else if(currentObject == "trigobjs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,trigobjs.product(),"trigobjs"); |
765 |
> |
|
766 |
> |
|
767 |
> |
|
768 |
> |
else if(currentObject == "muon-muon pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),muons.product(), \ |
769 |
> |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
770 |
> |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
771 |
> |
"muon-muon pairs"); |
772 |
> |
|
773 |
> |
else if(currentObject == "muon-secondary muon pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),muons.product(), \ |
774 |
> |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
775 |
> |
cumulativeFlags.at("secondary muons").at(flagsForPairCutsIndex), \ |
776 |
> |
"muon-secondary muon pairs"); |
777 |
> |
|
778 |
> |
else if(currentObject == "muon-secondary jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),jets.product(), \ |
779 |
> |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
780 |
> |
cumulativeFlags.at("secondary jets").at(flagsForPairCutsIndex), \ |
781 |
> |
"muon-secondary jet pairs"); |
782 |
> |
else if(currentObject == "photon-secondary jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,photons.product(),jets.product(), \ |
783 |
> |
cumulativeFlags.at("photons").at(flagsForPairCutsIndex), \ |
784 |
> |
cumulativeFlags.at("secondary jets").at(flagsForPairCutsIndex), \ |
785 |
> |
"photon-secondary jet pairs"); |
786 |
> |
|
787 |
> |
else if(currentObject == "electron-secondary jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),jets.product(), \ |
788 |
> |
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \ |
789 |
> |
cumulativeFlags.at("secondary jets").at(flagsForPairCutsIndex), \ |
790 |
> |
"electron-secondary jet pairs"); |
791 |
> |
|
792 |
> |
else if(currentObject == "electron-secondary electron pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),electrons.product(), \ |
793 |
> |
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \ |
794 |
> |
cumulativeFlags.at("secondary electrons").at(flagsForPairCutsIndex), \ |
795 |
> |
"electron-secondary electron pairs"); |
796 |
> |
|
797 |
> |
else if(currentObject == "electron-electron pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),electrons.product(), \ |
798 |
> |
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \ |
799 |
> |
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \ |
800 |
> |
"electron-electron pairs"); |
801 |
> |
else if(currentObject == "electron-muon pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),muons.product(), \ |
802 |
> |
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \ |
803 |
> |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
804 |
> |
"electron-muon pairs"); |
805 |
> |
else if(currentObject == "jet-jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,jets.product(),jets.product(), \ |
806 |
> |
cumulativeFlags.at("jets").at(flagsForPairCutsIndex), \ |
807 |
> |
cumulativeFlags.at("jets").at(flagsForPairCutsIndex), \ |
808 |
> |
"jet-jet pairs"); |
809 |
> |
else if(currentObject == "jet-secondary jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,jets.product(),jets.product(), \ |
810 |
> |
cumulativeFlags.at("jets").at(flagsForPairCutsIndex), \ |
811 |
> |
cumulativeFlags.at("secondary jets").at(flagsForPairCutsIndex),\ |
812 |
> |
"jet-secondary jet pairs"); |
813 |
> |
else if(currentObject == "electron-jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),jets.product(), \ |
814 |
> |
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \ |
815 |
> |
cumulativeFlags.at("jets").at(flagsForPairCutsIndex), \ |
816 |
> |
"electron-jet pairs"); |
817 |
> |
else if(currentObject == "electron-photon pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),photons.product(), \ |
818 |
> |
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \ |
819 |
> |
cumulativeFlags.at("photons").at(flagsForPairCutsIndex), \ |
820 |
> |
"electron-photon pairs"); |
821 |
> |
else if(currentObject == "photon-jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,photons.product(),jets.product(), \ |
822 |
> |
cumulativeFlags.at("photons").at(flagsForPairCutsIndex), \ |
823 |
> |
cumulativeFlags.at("jets").at(flagsForPairCutsIndex), \ |
824 |
> |
"photon-jet pairs"); |
825 |
> |
else if(currentObject == "muon-jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),jets.product(), \ |
826 |
> |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
827 |
> |
cumulativeFlags.at("jets").at(flagsForPairCutsIndex), \ |
828 |
> |
"muon-jet pairs"); |
829 |
> |
else if(currentObject == "muon-photon pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),photons.product(), \ |
830 |
> |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
831 |
> |
cumulativeFlags.at("photons").at(flagsForPairCutsIndex), \ |
832 |
> |
"muon-photon pairs"); |
833 |
> |
else if(currentObject == "track-event pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,tracks.product(),events.product(), |
834 |
> |
cumulativeFlags.at("tracks").at(flagsForPairCutsIndex), |
835 |
> |
cumulativeFlags.at("events").at(flagsForPairCutsIndex), |
836 |
> |
"track-event pairs"); |
837 |
> |
else if(currentObject == "electron-track pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),tracks.product(), |
838 |
> |
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), |
839 |
> |
cumulativeFlags.at("tracks").at(flagsForPairCutsIndex), |
840 |
> |
"electron-track pairs"); |
841 |
> |
else if(currentObject == "muon-track pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),tracks.product(), |
842 |
> |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), |
843 |
> |
cumulativeFlags.at("tracks").at(flagsForPairCutsIndex), |
844 |
> |
"muon-track pairs"); |
845 |
> |
else if(currentObject == "muon-tau pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),taus.product(), |
846 |
> |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), |
847 |
> |
cumulativeFlags.at("taus").at(flagsForPairCutsIndex), |
848 |
> |
"muon-tau pairs"); |
849 |
> |
else if(currentObject == "tau-tau pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,taus.product(),taus.product(), |
850 |
> |
cumulativeFlags.at("taus").at(flagsForPairCutsIndex), |
851 |
> |
cumulativeFlags.at("taus").at(flagsForPairCutsIndex), |
852 |
> |
"tau-tau pairs"); |
853 |
> |
else if(currentObject == "tau-track pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,taus .product(),tracks.product(), |
854 |
> |
cumulativeFlags.at("taus").at(flagsForPairCutsIndex), |
855 |
> |
cumulativeFlags.at("tracks").at(flagsForPairCutsIndex), |
856 |
> |
"tau-track pairs"); |
857 |
> |
else if(currentObject == "electron-trigobj pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),trigobjs.product(), |
858 |
> |
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), |
859 |
> |
cumulativeFlags.at("trigobjs").at(flagsForPairCutsIndex), |
860 |
> |
"electron-trigobj pairs"); |
861 |
> |
else if(currentObject == "muon-trigobj pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),trigobjs.product(), |
862 |
> |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), |
863 |
> |
cumulativeFlags.at("trigobjs").at(flagsForPairCutsIndex), |
864 |
> |
"muon-trigobj pairs"); |
865 |
> |
|
866 |
> |
if(currentObject == "stops" && datasetType_ == "signalMC") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,stops.product(),"stops"); |
867 |
> |
} |
868 |
|
|
869 |
|
|
870 |
|
|
871 |
+ |
}//end loop over all cuts |
872 |
|
//use cumulative flags to apply cuts at event level |
873 |
|
|
874 |
+ |
//a vector to store cumulative cut descisions after each cut. |
875 |
+ |
vector<bool> eventPassedPreviousCuts; |
876 |
|
bool eventPassedAllCuts = true; |
291 |
– |
|
877 |
|
//apply trigger (true if none were specified) |
878 |
|
eventPassedAllCuts = eventPassedAllCuts && triggerDecision; |
879 |
|
|
295 |
– |
|
880 |
|
for(uint currentCutIndex = 0; currentCutIndex != currentChannel.cuts.size(); currentCutIndex++){ |
881 |
|
|
882 |
|
//loop over all objects and count how many passed the cumulative selection up to this point |
883 |
|
cut currentCut = currentChannel.cuts.at(currentCutIndex); |
884 |
|
int numberPassing = 0; |
885 |
|
|
886 |
< |
for (uint object = 0; object != cumulativeFlags[currentCut.inputCollection].at(currentCutIndex).size() ; object++) |
887 |
< |
if(cumulativeFlags[currentCut.inputCollection].at(currentCutIndex).at(object)) numberPassing++; |
888 |
< |
|
305 |
< |
|
886 |
> |
for (uint object = 0; object != cumulativeFlags.at(currentCut.inputCollection).at(currentCutIndex).size() ; object++){ |
887 |
> |
if(cumulativeFlags.at(currentCut.inputCollection).at(currentCutIndex).at(object).first) numberPassing++; |
888 |
> |
} |
889 |
|
bool cutDecision = evaluateComparison(numberPassing,currentCut.eventComparativeOperator,currentCut.numberRequired); |
890 |
|
cutFlows_.at(currentChannelIndex)->at (currentCut.name) = cutDecision; |
308 |
– |
|
891 |
|
eventPassedAllCuts = eventPassedAllCuts && cutDecision; |
892 |
+ |
eventPassedPreviousCuts.push_back(eventPassedAllCuts); |
893 |
+ |
} |
894 |
+ |
double scaleFactor = masterScaleFactor; |
895 |
|
|
896 |
+ |
muonScaleFactor_ = electronScaleFactor_ = bTagScaleFactor_ = 1.0; |
897 |
+ |
if(applyLeptonSF_ && datasetType_ != "data"){ |
898 |
+ |
if(cumulativeFlags.find ("muons") != cumulativeFlags.end ()){ |
899 |
+ |
flagPair muonFlags; |
900 |
+ |
for (int i = cumulativeFlags.at("muons").size() - 1; i >= 0; i--){ |
901 |
+ |
if (cumulativeFlags.at("muons").at(i).size()){ |
902 |
+ |
muonFlags = cumulativeFlags.at("muons").at(i); |
903 |
+ |
break; |
904 |
+ |
} |
905 |
+ |
} |
906 |
+ |
for (uint muonIndex = 0; muonIndex != muonFlags.size(); muonIndex++){ |
907 |
+ |
if(!muonFlags.at(muonIndex).second) continue; |
908 |
+ |
muonScaleFactor_ *= muonSFWeight_->at (muons->at(muonIndex).eta); |
909 |
+ |
} |
910 |
+ |
} |
911 |
+ |
if(cumulativeFlags.find ("electrons") != cumulativeFlags.end ()){ |
912 |
+ |
flagPair electronFlags; |
913 |
+ |
for (int i = cumulativeFlags.at("electrons").size() - 1; i >= 0; i--){ |
914 |
+ |
if (cumulativeFlags.at("electrons").at(i).size()){ |
915 |
+ |
electronFlags = cumulativeFlags.at("electrons").at(i); |
916 |
+ |
break; |
917 |
+ |
} |
918 |
+ |
} |
919 |
+ |
for (uint electronIndex = 0; electronIndex != electronFlags.size(); electronIndex++){ |
920 |
+ |
if(!electronFlags.at(electronIndex).second) continue; |
921 |
+ |
electronScaleFactor_ *= electronSFWeight_->at (electrons->at(electronIndex).eta, electrons->at(electronIndex).pt); |
922 |
+ |
} |
923 |
+ |
} |
924 |
+ |
} |
925 |
+ |
if(applyBtagSF_ && datasetType_ != "data"){ |
926 |
+ |
if(cumulativeFlags.find ("jets") != cumulativeFlags.end ()){ |
927 |
+ |
flagPair jetFlags; |
928 |
+ |
vector<double> jetSFs; |
929 |
+ |
for (int i = cumulativeFlags.at("jets").size() - 1; i >= 0; i--){ |
930 |
+ |
if (cumulativeFlags.at("jets").at(i).size()){ |
931 |
+ |
jetFlags = cumulativeFlags.at("jets").at(i); |
932 |
+ |
break; |
933 |
+ |
} |
934 |
+ |
} |
935 |
+ |
for (uint jetIndex = 0; jetIndex != jetFlags.size(); jetIndex++){ |
936 |
+ |
if(!jetFlags.at(jetIndex).second) continue; |
937 |
+ |
double jetSFTmp = bTagSFWeight_->sflookup(jets->at(jetIndex).btagCombinedSecVertex, jets->at(jetIndex).pt, jets->at(jetIndex).flavour); |
938 |
+ |
jetSFs.push_back(jetSFTmp); |
939 |
+ |
} |
940 |
+ |
bTagScaleFactor_ *= bTagSFWeight_->weight( jetSFs, minBtag_, maxBtag_ ); |
941 |
+ |
} |
942 |
+ |
} |
943 |
+ |
scaleFactor *= muonScaleFactor_; |
944 |
+ |
scaleFactor *= electronScaleFactor_; |
945 |
+ |
scaleFactor *= bTagScaleFactor_; |
946 |
+ |
cutFlows_.at(currentChannelIndex)->fillCutFlow(scaleFactor); |
947 |
+ |
|
948 |
+ |
if (printEventInfo_) { |
949 |
+ |
// Write information about event to screen, for testing purposes. |
950 |
+ |
cout << "Event passed all cuts in channel " << currentChannel.name |
951 |
+ |
<< ": run=" << events->at(0).run |
952 |
+ |
<< " lumi=" << events->at(0).lumi |
953 |
+ |
<< " event=" << events->at(0).evt |
954 |
+ |
<< endl; |
955 |
|
} |
956 |
|
|
313 |
– |
cutFlows_.at(currentChannelIndex)->fillCutFlow(); |
314 |
– |
|
957 |
|
|
958 |
+ |
//filling histograms |
959 |
+ |
for(uint currentCut = 0; currentCut != oneDHists_.at(currentChannelIndex).size(); currentCut++){//loop over all the directories in each channel. |
960 |
+ |
uint currentDir; |
961 |
+ |
if (!GetPlotsAfterEachCut_) { currentDir = currentChannel.cuts.size() - oneDHists_.at(currentChannelIndex).size(); } //if GetPlotsAfterEachCut_ is false, set currentDir point to the last cut. |
962 |
+ |
else{ |
963 |
+ |
currentDir = currentCut; |
964 |
+ |
} |
965 |
|
|
317 |
– |
if(!eventPassedAllCuts)continue; |
966 |
|
|
967 |
+ |
if(eventPassedPreviousCuts.at(currentDir)){ |
968 |
|
|
969 |
+ |
for (uint histogramIndex = 0; histogramIndex != histograms.size(); histogramIndex++){ |
970 |
+ |
histogram currentHistogram = histograms.at(histogramIndex); |
971 |
|
|
972 |
< |
vector<bool> electronFlags = cumulativeFlags["electrons"].back(); |
322 |
< |
int electronCounter = 0; |
972 |
> |
if (cumulativeFlags.count(currentHistogram.inputCollection) == 0) cout << "Error: no flags found for collection: " << currentHistogram.inputCollection << ", will cause a seg fault" << endl; |
973 |
|
|
974 |
< |
for (uint electronIndex = 0; electronIndex != electronFlags.size(); electronIndex++){ |
975 |
< |
if(!electronFlags.at(electronIndex)) continue; |
974 |
> |
if(currentHistogram.inputVariables.size() == 1){ |
975 |
> |
TH1D* histo; |
976 |
> |
histo = oneDHists_.at(currentChannelIndex).at(currentCut).at(currentHistogram.name); |
977 |
> |
if (currentHistogram.inputCollection == "jets") fill1DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("jets").at(currentDir),scaleFactor); |
978 |
> |
else if(currentHistogram.inputCollection == "secondary jets") fill1DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("secondary jets").at(currentDir),scaleFactor); |
979 |
> |
else if(currentHistogram.inputCollection == "muons") fill1DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("muons").at(currentDir),scaleFactor); |
980 |
> |
else if(currentHistogram.inputCollection == "secondary muons") fill1DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("secondary muons").at(currentDir),scaleFactor); |
981 |
> |
else if(currentHistogram.inputCollection == "secondary electrons") fill1DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("secondary electrons").at(currentDir),scaleFactor); |
982 |
> |
else if(currentHistogram.inputCollection == "muon-muon pairs") fill1DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
983 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("muons").at(currentDir), \ |
984 |
> |
cumulativeFlags.at("muon-muon pairs").at(currentDir),scaleFactor); |
985 |
> |
else if(currentHistogram.inputCollection == "muon-secondary muon pairs") fill1DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
986 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("secondary muons").at(currentDir), \ |
987 |
> |
cumulativeFlags.at("muon-secondary muon pairs").at(currentDir),scaleFactor); |
988 |
> |
else if(currentHistogram.inputCollection == "muon-secondary jet pairs") fill1DHistogram(histo,currentHistogram,muons.product(),jets.product(), \ |
989 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("secondary jets").at(currentDir), \ |
990 |
> |
cumulativeFlags.at("muon-secondary jet pairs").at(currentDir),scaleFactor); |
991 |
> |
else if(currentHistogram.inputCollection == "photon-secondary jet pairs") fill1DHistogram(histo,currentHistogram,photons.product(),jets.product(), \ |
992 |
> |
cumulativeFlags.at("photons").at(currentDir),cumulativeFlags.at("secondary jets").at(currentDir), \ |
993 |
> |
cumulativeFlags.at("photon-secondary jet pairs").at(currentDir),scaleFactor); |
994 |
> |
else if(currentHistogram.inputCollection == "electron-secondary jet pairs") fill1DHistogram(histo,currentHistogram,electrons.product(),jets.product(), \ |
995 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("secondary jets").at(currentDir), \ |
996 |
> |
cumulativeFlags.at("electron-secondary jet pairs").at(currentDir),scaleFactor); |
997 |
> |
|
998 |
> |
else if(currentHistogram.inputCollection == "electrons") fill1DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("electrons").at(currentDir),scaleFactor); |
999 |
> |
else if(currentHistogram.inputCollection == "electron-electron pairs") fill1DHistogram(histo,currentHistogram,electrons.product(),electrons.product(),\ |
1000 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("electrons").at(currentDir),\ |
1001 |
> |
cumulativeFlags.at("electron-electron pairs").at(currentDir),scaleFactor); |
1002 |
> |
else if(currentHistogram.inputCollection == "jet-jet pairs") fill1DHistogram(histo,currentHistogram,jets.product(),jets.product(),\ |
1003 |
> |
cumulativeFlags.at("jets").at(currentDir),cumulativeFlags.at("jets").at(currentDir),\ |
1004 |
> |
cumulativeFlags.at("jet-jet pairs").at(currentDir),scaleFactor); |
1005 |
> |
else if(currentHistogram.inputCollection == "jet-secondary jet pairs") fill1DHistogram(histo,currentHistogram,jets.product(),jets.product(), \ |
1006 |
> |
cumulativeFlags.at("jets").at(currentDir),cumulativeFlags.at("secondary jets").at(currentDir), \ |
1007 |
> |
cumulativeFlags.at("jet-secondary jet pairs").at(currentDir),scaleFactor); |
1008 |
> |
|
1009 |
> |
else if(currentHistogram.inputCollection == "electron-secondary electron pairs") fill1DHistogram(histo,currentHistogram,electrons.product(),electrons.product(), \ |
1010 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("secondary electrons").at(currentDir), \ |
1011 |
> |
cumulativeFlags.at("electron-secondary electron pairs").at(currentDir),scaleFactor); |
1012 |
> |
else if(currentHistogram.inputCollection == "electron-muon pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),muons.product(), \ |
1013 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("muons").at(currentDir), |
1014 |
> |
cumulativeFlags.at("electron-muon pairs").at(currentDir),scaleFactor); |
1015 |
> |
else if(currentHistogram.inputCollection == "electron-jet pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),jets.product(), \ |
1016 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("jets").at(currentDir), |
1017 |
> |
cumulativeFlags.at("electron-jet pairs").at(currentDir),scaleFactor); |
1018 |
> |
else if(currentHistogram.inputCollection == "photon-jet pairs") fill1DHistogram(histo,currentHistogram, photons.product(),jets.product(), \ |
1019 |
> |
cumulativeFlags.at("photons").at(currentDir),cumulativeFlags.at("jets").at(currentDir), |
1020 |
> |
cumulativeFlags.at("photon-jet pairs").at(currentDir),scaleFactor); |
1021 |
> |
else if(currentHistogram.inputCollection == "muon-jet pairs") fill1DHistogram(histo,currentHistogram, muons.product(),jets.product(), \ |
1022 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("jets").at(currentDir), |
1023 |
> |
cumulativeFlags.at("muon-jet pairs").at(currentDir),scaleFactor); |
1024 |
> |
else if(currentHistogram.inputCollection == "muon-photon pairs") fill1DHistogram(histo,currentHistogram, muons.product(),photons.product(), \ |
1025 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("photons").at(currentDir), |
1026 |
> |
cumulativeFlags.at("muon-photon pairs").at(currentDir),scaleFactor); |
1027 |
> |
else if(currentHistogram.inputCollection == "electron-photon pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),photons.product(), \ |
1028 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("photons").at(currentDir), |
1029 |
> |
cumulativeFlags.at("electron-photon pairs").at(currentDir),scaleFactor); |
1030 |
> |
else if(currentHistogram.inputCollection == "electron-track pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),tracks.product(), |
1031 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("tracks").at(currentDir), |
1032 |
> |
cumulativeFlags.at("electron-track pairs").at(currentDir),scaleFactor); |
1033 |
> |
else if(currentHistogram.inputCollection == "muon-track pairs") fill1DHistogram(histo,currentHistogram, muons.product(),tracks.product(), |
1034 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("tracks").at(currentDir), |
1035 |
> |
cumulativeFlags.at("muon-track pairs").at(currentDir),scaleFactor); |
1036 |
> |
else if(currentHistogram.inputCollection == "muon-tau pairs") fill1DHistogram(histo,currentHistogram, muons.product(),taus.product(), |
1037 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("taus").at(currentDir), |
1038 |
> |
cumulativeFlags.at("muon-tau pairs").at(currentDir),scaleFactor); |
1039 |
> |
else if(currentHistogram.inputCollection == "tau-tau pairs") fill1DHistogram(histo,currentHistogram, taus.product(),taus.product(), |
1040 |
> |
cumulativeFlags.at("taus").at(currentDir),cumulativeFlags.at("taus").at(currentDir), |
1041 |
> |
cumulativeFlags.at("tau-tau pairs").at(currentDir),scaleFactor); |
1042 |
> |
else if(currentHistogram.inputCollection == "tau-track pairs") fill1DHistogram(histo,currentHistogram, taus.product(),tracks.product(), |
1043 |
> |
cumulativeFlags.at("taus").at(currentDir),cumulativeFlags.at("tracks").at(currentDir), |
1044 |
> |
cumulativeFlags.at("tau-track pairs").at(currentDir),scaleFactor); |
1045 |
> |
else if(currentHistogram.inputCollection == "electron-trigobj pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),trigobjs.product(), |
1046 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("trigobjs").at(currentDir), |
1047 |
> |
cumulativeFlags.at("electron-trigobj pairs").at(currentDir),scaleFactor); |
1048 |
> |
else if(currentHistogram.inputCollection == "muon-trigobj pairs") fill1DHistogram(histo,currentHistogram, muons.product(),trigobjs.product(), |
1049 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("trigobjs").at(currentDir), |
1050 |
> |
cumulativeFlags.at("muon-trigobj pairs").at(currentDir),scaleFactor); |
1051 |
> |
|
1052 |
> |
else if(currentHistogram.inputCollection == "events") fill1DHistogram(histo,currentHistogram,events.product(),cumulativeFlags.at("events").at(currentDir),scaleFactor); |
1053 |
> |
else if(currentHistogram.inputCollection == "taus") fill1DHistogram(histo,currentHistogram,taus.product(),cumulativeFlags.at("taus").at(currentDir),scaleFactor); |
1054 |
> |
else if(currentHistogram.inputCollection == "mets") fill1DHistogram(histo,currentHistogram,mets.product(),cumulativeFlags.at("mets").at(currentDir),scaleFactor); |
1055 |
> |
else if(currentHistogram.inputCollection == "tracks") fill1DHistogram(histo,currentHistogram,tracks.product(),cumulativeFlags.at("tracks").at(currentDir),scaleFactor); |
1056 |
> |
else if(currentHistogram.inputCollection == "genjets") fill1DHistogram(histo,currentHistogram,genjets.product(),cumulativeFlags.at("genjets").at(currentDir),scaleFactor); |
1057 |
> |
else if(currentHistogram.inputCollection == "mcparticles") fill1DHistogram(histo,currentHistogram,mcparticles.product(),cumulativeFlags.at("mcparticles").at(currentDir),scaleFactor); |
1058 |
> |
else if(currentHistogram.inputCollection == "primaryvertexs") fill1DHistogram(histo,currentHistogram,primaryvertexs.product(),cumulativeFlags.at("primaryvertexs").at(currentDir),scaleFactor); |
1059 |
> |
else if(currentHistogram.inputCollection == "bxlumis") fill1DHistogram(histo,currentHistogram,bxlumis.product(),cumulativeFlags.at("bxlumis").at(currentDir),scaleFactor); |
1060 |
> |
else if(currentHistogram.inputCollection == "photons") fill1DHistogram(histo,currentHistogram,photons.product(),cumulativeFlags.at("photons").at(currentDir),scaleFactor); |
1061 |
> |
else if(currentHistogram.inputCollection == "superclusters") fill1DHistogram(histo,currentHistogram,superclusters.product(),cumulativeFlags.at("superclusters").at(currentDir),scaleFactor); |
1062 |
> |
else if(currentHistogram.inputCollection == "trigobjs") fill1DHistogram(histo,currentHistogram,trigobjs.product(),cumulativeFlags.at("trigobjs").at(currentDir),scaleFactor); |
1063 |
> |
else if(currentHistogram.inputCollection == "stops" && datasetType_ == "signalMC") fill1DHistogram(histo,currentHistogram,stops.product(),cumulativeFlags.at("stops").at(currentDir),scaleFactor); |
1064 |
> |
} |
1065 |
> |
else if(currentHistogram.inputVariables.size() == 2){ |
1066 |
> |
TH2D* histo; |
1067 |
> |
histo = twoDHists_.at(currentChannelIndex).at(currentCut).at(currentHistogram.name); |
1068 |
> |
if (currentHistogram.inputCollection == "jets") fill2DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("jets").at(currentDir),scaleFactor); |
1069 |
> |
else if(currentHistogram.inputCollection == "secondary jets") fill2DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("secondary jets").at(currentDir),scaleFactor); |
1070 |
> |
else if(currentHistogram.inputCollection == "muons") fill2DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("muons").at(currentDir),scaleFactor); |
1071 |
> |
else if(currentHistogram.inputCollection == "secondary muons") fill2DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("secondary muons").at(currentDir),scaleFactor); |
1072 |
> |
else if(currentHistogram.inputCollection == "muon-muon pairs") fill2DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
1073 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("muons").at(currentDir), \ |
1074 |
> |
cumulativeFlags.at("muon-muon pairs").at(currentDir),scaleFactor); |
1075 |
> |
else if(currentHistogram.inputCollection == "muon-secondary muon pairs") fill2DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
1076 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("secondary muons").at(currentDir), \ |
1077 |
> |
cumulativeFlags.at("muon-secondary muon pairs").at(currentDir),scaleFactor); |
1078 |
> |
else if(currentHistogram.inputCollection == "muon-secondary jet pairs") fill2DHistogram(histo,currentHistogram,muons.product(),jets.product(), \ |
1079 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("secondary jets").at(currentDir), \ |
1080 |
> |
cumulativeFlags.at("muon-secondary jet pairs").at(currentDir),scaleFactor); |
1081 |
> |
else if(currentHistogram.inputCollection == "electron-secondary jet pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),jets.product(), \ |
1082 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("secondary jets").at(currentDir), \ |
1083 |
> |
cumulativeFlags.at("electron-secondary jet pairs").at(currentDir),scaleFactor); |
1084 |
> |
else if(currentHistogram.inputCollection == "photon-secondary jet pairs") fill2DHistogram(histo,currentHistogram,photons.product(),jets.product(), \ |
1085 |
> |
cumulativeFlags.at("photons").at(currentDir),cumulativeFlags.at("secondary jets").at(currentDir), \ |
1086 |
> |
cumulativeFlags.at("photon-secondary jet pairs").at(currentDir),scaleFactor); |
1087 |
> |
else if(currentHistogram.inputCollection == "electrons") fill2DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("electrons").at(currentDir),scaleFactor); |
1088 |
> |
else if(currentHistogram.inputCollection == "secondary electrons") fill2DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("secondary electrons").at(currentDir),scaleFactor); |
1089 |
> |
else if(currentHistogram.inputCollection == "electron-electron pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),electrons.product(), \ |
1090 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("electrons").at(currentDir), \ |
1091 |
> |
cumulativeFlags.at("electron-electron pairs").at(currentDir),scaleFactor); |
1092 |
> |
else if(currentHistogram.inputCollection == "jet-jet pairs") fill2DHistogram(histo,currentHistogram,jets.product(),jets.product(), \ |
1093 |
> |
cumulativeFlags.at("jets").at(currentDir),cumulativeFlags.at("jets").at(currentDir), \ |
1094 |
> |
cumulativeFlags.at("jet-jet pairs").at(currentDir),scaleFactor); |
1095 |
> |
else if(currentHistogram.inputCollection == "electron-secondary electron pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),electrons.product(), \ |
1096 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("secondary electrons").at(currentDir), \ |
1097 |
> |
cumulativeFlags.at("electron-secondary electron pairs").at(currentDir),scaleFactor); |
1098 |
> |
else if(currentHistogram.inputCollection == "electron-muon pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),muons.product(), \ |
1099 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("muons").at(currentDir), \ |
1100 |
> |
cumulativeFlags.at("electron-muon pairs").at(currentDir),scaleFactor); |
1101 |
> |
else if(currentHistogram.inputCollection == "electron-jet pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),jets.product(), \ |
1102 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("jets").at(currentDir), \ |
1103 |
> |
cumulativeFlags.at("electron-jet pairs").at(currentDir),scaleFactor); |
1104 |
> |
else if(currentHistogram.inputCollection == "electron-photon pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),photons.product(), \ |
1105 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("photons").at(currentDir), \ |
1106 |
> |
cumulativeFlags.at("electron-photon pairs").at(currentDir),scaleFactor); |
1107 |
> |
else if(currentHistogram.inputCollection == "muon-jet pairs") fill2DHistogram(histo,currentHistogram,muons.product(),jets.product(), \ |
1108 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("jets").at(currentDir), \ |
1109 |
> |
cumulativeFlags.at("muon-jet pairs").at(currentDir),scaleFactor); |
1110 |
> |
else if(currentHistogram.inputCollection == "photon-jet pairs") fill2DHistogram(histo,currentHistogram,photons.product(),jets.product(), \ |
1111 |
> |
cumulativeFlags.at("photons").at(currentDir),cumulativeFlags.at("jets").at(currentDir), \ |
1112 |
> |
cumulativeFlags.at("photon-jet pairs").at(currentDir),scaleFactor); |
1113 |
> |
else if(currentHistogram.inputCollection == "muon-photon pairs") fill2DHistogram(histo,currentHistogram,muons.product(),photons.product(), \ |
1114 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("photons").at(currentDir), \ |
1115 |
> |
cumulativeFlags.at("muon-photon pairs").at(currentDir),scaleFactor); |
1116 |
> |
else if(currentHistogram.inputCollection == "electron-track pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),tracks.product(), |
1117 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("tracks").at(currentDir), |
1118 |
> |
cumulativeFlags.at("electron-track pairs").at(currentDir),scaleFactor); |
1119 |
> |
else if(currentHistogram.inputCollection == "muon-track pairs") fill2DHistogram(histo,currentHistogram,muons.product(),tracks.product(), |
1120 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("tracks").at(currentDir), |
1121 |
> |
cumulativeFlags.at("muon-track pairs").at(currentDir),scaleFactor); |
1122 |
> |
else if(currentHistogram.inputCollection == "muon-tau pairs") fill2DHistogram(histo,currentHistogram,muons.product(),taus.product(), |
1123 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("taus").at(currentDir), |
1124 |
> |
cumulativeFlags.at("muon-tau pairs").at(currentDir),scaleFactor); |
1125 |
> |
else if(currentHistogram.inputCollection == "tau-tau pairs") fill2DHistogram(histo,currentHistogram,taus.product(),taus.product(), |
1126 |
> |
cumulativeFlags.at("taus").at(currentDir),cumulativeFlags.at("taus").at(currentDir), |
1127 |
> |
cumulativeFlags.at("tau-tau pairs").at(currentDir),scaleFactor); |
1128 |
> |
else if(currentHistogram.inputCollection == "tau-track pairs") fill2DHistogram(histo,currentHistogram,taus.product(),tracks.product(), |
1129 |
> |
cumulativeFlags.at("taus").at(currentDir),cumulativeFlags.at("tracks").at(currentDir), |
1130 |
> |
cumulativeFlags.at("tau-track pairs").at(currentDir),scaleFactor); |
1131 |
> |
else if(currentHistogram.inputCollection == "electron-trigobj pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),trigobjs.product(), |
1132 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("trigobjs").at(currentDir), |
1133 |
> |
cumulativeFlags.at("electron-trigobj pairs").at(currentDir),scaleFactor); |
1134 |
> |
else if(currentHistogram.inputCollection == "muon-trigobj pairs") fill2DHistogram(histo,currentHistogram,muons.product(),trigobjs.product(), |
1135 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("trigobjs").at(currentDir), |
1136 |
> |
cumulativeFlags.at("muon-trigobj pairs").at(currentDir),scaleFactor); |
1137 |
> |
else if(currentHistogram.inputCollection == "events") fill2DHistogram(histo,currentHistogram,events.product(),cumulativeFlags.at("events").at(currentDir),scaleFactor); |
1138 |
> |
else if(currentHistogram.inputCollection == "taus") fill2DHistogram(histo,currentHistogram,taus.product(),cumulativeFlags.at("taus").at(currentDir),scaleFactor); |
1139 |
> |
else if(currentHistogram.inputCollection == "mets") fill2DHistogram(histo,currentHistogram,mets.product(),cumulativeFlags.at("mets").at(currentDir),scaleFactor); |
1140 |
> |
else if(currentHistogram.inputCollection == "tracks") fill2DHistogram(histo,currentHistogram,tracks.product(),cumulativeFlags.at("tracks").at(currentDir),scaleFactor); |
1141 |
> |
else if(currentHistogram.inputCollection == "track-event pairs") fill2DHistogram(histo,currentHistogram,tracks.product(),events.product(), |
1142 |
> |
cumulativeFlags.at("tracks").at(currentDir),cumulativeFlags.at("events").at(currentDir), |
1143 |
> |
cumulativeFlags.at("track-event pairs").at(currentDir),scaleFactor); |
1144 |
> |
else if(currentHistogram.inputCollection == "genjets") fill2DHistogram(histo,currentHistogram,genjets.product(),cumulativeFlags.at("genjets").at(currentDir),scaleFactor); |
1145 |
> |
else if(currentHistogram.inputCollection == "mcparticles") fill2DHistogram(histo,currentHistogram,mcparticles.product(),cumulativeFlags.at("mcparticles").at(currentDir),scaleFactor); |
1146 |
> |
else if(currentHistogram.inputCollection == "primaryvertexs") fill2DHistogram(histo,currentHistogram,primaryvertexs.product(),cumulativeFlags.at("primaryvertexs").at(currentDir),scaleFactor); |
1147 |
> |
else if(currentHistogram.inputCollection == "bxlumis") fill2DHistogram(histo,currentHistogram,bxlumis.product(),cumulativeFlags.at("bxlumis").at(currentDir),scaleFactor); |
1148 |
> |
else if(currentHistogram.inputCollection == "photons") fill2DHistogram(histo,currentHistogram,photons.product(),cumulativeFlags.at("photons").at(currentDir),scaleFactor); |
1149 |
> |
else if(currentHistogram.inputCollection == "superclusters") fill2DHistogram(histo,currentHistogram,superclusters.product(),cumulativeFlags.at("superclusters").at(currentDir),scaleFactor); |
1150 |
> |
else if(currentHistogram.inputCollection == "trigobjs") fill2DHistogram(histo,currentHistogram,trigobjs.product(),cumulativeFlags.at("trigobjs").at(currentDir),scaleFactor); |
1151 |
> |
else if(currentHistogram.inputCollection == "stops" && datasetType_ == "signalMC") fill2DHistogram(histo,currentHistogram,stops.product(),cumulativeFlags.at("stops").at(currentDir),scaleFactor); |
1152 |
> |
} |
1153 |
|
|
1154 |
+ |
} |
1155 |
|
|
328 |
– |
electronCounter++; |
329 |
– |
oneDHists_.at(currentChannelIndex)["electronPt"]->Fill (electrons->at(electronIndex).pt); |
330 |
– |
oneDHists_.at(currentChannelIndex)["electronEta"]->Fill (electrons->at(electronIndex).eta); |
331 |
– |
oneDHists_.at(currentChannelIndex)["electronD0"]->Fill (electrons->at(electronIndex).correctedD0Vertex); |
332 |
– |
oneDHists_.at(currentChannelIndex)["electronAbsD0"]->Fill (fabs(electrons->at(electronIndex).correctedD0Vertex)); |
333 |
– |
oneDHists_.at(currentChannelIndex)["electronD0Sig"]->Fill (electrons->at(electronIndex).correctedD0Vertex / electrons->at(electronIndex).tkD0err); |
334 |
– |
oneDHists_.at(currentChannelIndex)["electronAbsD0Sig"]->Fill (fabs(electrons->at(electronIndex).correctedD0Vertex) / electrons->at(electronIndex).tkD0err); |
335 |
– |
oneDHists_.at(currentChannelIndex)["electronIso"]->Fill (((electrons->at(electronIndex).trackIso + electrons->at(electronIndex).caloIso) / electrons->at(electronIndex).pt)); |
336 |
– |
oneDHists_.at(currentChannelIndex)["electronFbrem"]->Fill (electrons->at(electronIndex).fbrem); |
337 |
– |
oneDHists_.at(currentChannelIndex)["electronMVATrig"]->Fill (electrons->at(electronIndex).mvaTrigV0); |
338 |
– |
oneDHists_.at(currentChannelIndex)["electronMVANonTrig"]->Fill (electrons->at(electronIndex).mvaNonTrigV0); |
339 |
– |
|
340 |
– |
} |
341 |
– |
oneDHists_.at(currentChannelIndex)["numElectrons"]->Fill (electronCounter); |
342 |
– |
|
343 |
– |
|
344 |
– |
vector<bool> muonFlags = cumulativeFlags["muons"].back(); |
345 |
– |
int muonCounter = 0; |
1156 |
|
|
1157 |
+ |
//fills histograms with the sizes of collections |
1158 |
+ |
for (uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){ |
1159 |
|
|
1160 |
< |
for (uint muonIndex = 0; muonIndex != muonFlags.size(); muonIndex++){ |
1161 |
< |
if(!muonFlags.at(muonIndex)) continue; |
1162 |
< |
muonCounter++; |
1160 |
> |
string currentObject = objectsToPlot.at(currentObjectIndex); |
1161 |
> |
string objectToPlot = ""; |
1162 |
> |
|
1163 |
> |
// Name of objectToPlot here must match the name specified in OSUAnalysis::OSUAnalysis(). |
1164 |
> |
if(currentObject == "muon-muon pairs") objectToPlot = "dimuonPairs"; |
1165 |
> |
else if(currentObject == "electron-electron pairs") objectToPlot = "dielectronPairs"; |
1166 |
> |
else if(currentObject == "electron-muon pairs") objectToPlot = "electronMuonPairs"; |
1167 |
> |
else if(currentObject == "electron-photon pairs") objectToPlot = "electronPhotonPairs"; |
1168 |
> |
else if(currentObject == "electron-jet pairs") objectToPlot = "electronJetPairs"; |
1169 |
> |
else if(currentObject == "muon-jet pairs") objectToPlot = "muonJetPairs"; |
1170 |
> |
else if(currentObject == "muon-photon pairs") objectToPlot = "muonPhotonPairs"; |
1171 |
> |
else if(currentObject == "photon-jet pairs") objectToPlot = "photonJetPairs"; |
1172 |
> |
else if(currentObject == "jet-jet pairs") objectToPlot = "dijetPairs"; |
1173 |
> |
else if(currentObject == "jet-secondary jet pairs") objectToPlot = "jetSecondaryJetPairs"; |
1174 |
> |
else if(currentObject == "secondary jets") objectToPlot = "secondaryJets"; |
1175 |
> |
else if(currentObject == "electron-track pairs") objectToPlot = "electronTrackPairs"; |
1176 |
> |
else if(currentObject == "muon-track pairs") objectToPlot = "muonTrackPairs"; |
1177 |
> |
else if(currentObject == "muon-tau pairs") objectToPlot = "muonTauPairs"; |
1178 |
> |
else if(currentObject == "tau-tau pairs") objectToPlot = "ditauPairs"; |
1179 |
> |
else if(currentObject == "tau-track pairs") objectToPlot = "tauTrackPairs"; |
1180 |
> |
else if(currentObject == "track-event pairs") objectToPlot = "trackEventPairs"; |
1181 |
> |
else if(currentObject == "muon-secondary muon pairs") objectToPlot = "muonSecondaryMuonPairs"; |
1182 |
> |
else if(currentObject == "secondary muons") objectToPlot = "secondaryMuons"; |
1183 |
> |
else if(currentObject == "muon-secondary jet pairs") objectToPlot = "muonSecondaryJetPairs"; |
1184 |
> |
else if(currentObject == "electron-secondary jet pairs") objectToPlot = "electronSecondaryJetPairs"; |
1185 |
> |
else if(currentObject == "photon-secondary jet pairs") objectToPlot = "photonSecondaryJetPairs"; |
1186 |
> |
else if(currentObject == "electron-secondary electron pairs") objectToPlot = "electronSecondaryElectronPairs"; |
1187 |
> |
else if(currentObject == "secondary electrons") objectToPlot = "secondaryElectrons"; |
1188 |
> |
else if(currentObject == "electron-trigobj pairs") objectToPlot = "electronTrigobjPairs"; |
1189 |
> |
else if(currentObject == "muon-trigobj pairs") objectToPlot = "muonTrigobjPairs"; |
1190 |
> |
else objectToPlot = currentObject; |
1191 |
> |
|
1192 |
> |
string tempCurrentObject = objectToPlot; |
1193 |
> |
tempCurrentObject.at(0) = toupper(tempCurrentObject.at(0)); |
1194 |
> |
string histoName = "num" + tempCurrentObject; |
1195 |
> |
|
1196 |
> |
|
1197 |
> |
if(find(objectsToCut.begin(), objectsToCut.end(), currentObject) != objectsToCut.end()) { |
1198 |
> |
flagPair lastCutFlags = cumulativeFlags.at(currentObject).at(currentDir); |
1199 |
> |
int numToPlot = 0; |
1200 |
> |
for (uint currentFlag = 0; currentFlag != lastCutFlags.size(); currentFlag++){ |
1201 |
> |
if(lastCutFlags.at(currentFlag).second) numToPlot++; |
1202 |
> |
} |
1203 |
> |
|
1204 |
> |
if(objectToPlot == "primaryvertexs"){ |
1205 |
> |
oneDHists_.at(currentChannelIndex).at(currentCut).at(histoName+"BeforePileupCorrection")->Fill(primaryvertexs->size()); |
1206 |
> |
oneDHists_.at(currentChannelIndex).at(currentCut).at(histoName+"AfterPileupCorrection")->Fill(primaryvertexs->size(),scaleFactor); |
1207 |
> |
} |
1208 |
> |
else { |
1209 |
> |
oneDHists_.at(currentChannelIndex).at(currentCut).at(histoName)->Fill(numToPlot,scaleFactor); |
1210 |
> |
} |
1211 |
> |
} |
1212 |
> |
} // end for (uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++) |
1213 |
|
|
352 |
– |
oneDHists_.at(currentChannelIndex)["muonPt"]->Fill (muons->at(muonIndex).pt); |
353 |
– |
oneDHists_.at(currentChannelIndex)["muonEta"]->Fill (muons->at(muonIndex).eta); |
354 |
– |
oneDHists_.at(currentChannelIndex)["muonD0"]->Fill (muons->at(muonIndex).correctedD0Vertex); |
355 |
– |
oneDHists_.at(currentChannelIndex)["muonAbsD0"]->Fill (fabs(muons->at(muonIndex).correctedD0Vertex)); |
356 |
– |
oneDHists_.at(currentChannelIndex)["muonD0Sig"]->Fill (muons->at(muonIndex).correctedD0Vertex / muons->at(muonIndex).tkD0err); |
357 |
– |
oneDHists_.at(currentChannelIndex)["muonAbsD0Sig"]->Fill (fabs(muons->at(muonIndex).correctedD0Vertex) / muons->at(muonIndex).tkD0err); |
358 |
– |
oneDHists_.at(currentChannelIndex)["muonIso"]->Fill (((muons->at(muonIndex).trackIso + muons->at(muonIndex).caloIso) / muons->at(muonIndex).pt)); |
359 |
– |
} |
360 |
– |
oneDHists_.at(currentChannelIndex)["numMuons"]->Fill (muonCounter); |
1214 |
|
|
1215 |
+ |
} // end if(eventPassedPreviousCuts.at(currentDir)) |
1216 |
+ |
} // end loop over cuts |
1217 |
|
|
1218 |
+ |
if (!useEDMFormat_ && eventPassedAllCuts){ |
1219 |
+ |
// Assign BNTree variables |
1220 |
+ |
for (uint iBranch = 0; iBranch != treeBranches_.size(); iBranch++) { |
1221 |
+ |
BranchSpecs brSpecs = treeBranches_.at(iBranch); |
1222 |
+ |
string coll = brSpecs.inputCollection; |
1223 |
+ |
if (cumulativeFlags.count(coll) == 0) cout << "Error: no flags found for collection: " << coll << ", will cause a seg fault" << endl; |
1224 |
+ |
|
1225 |
+ |
if (coll == "jets") assignTreeBranch(brSpecs,jets.product(), cumulativeFlags.at(coll).back()); |
1226 |
+ |
else if(coll == "secondary jets") assignTreeBranch(brSpecs,jets.product(), cumulativeFlags.at(coll).back()); |
1227 |
+ |
else if(coll == "muons") assignTreeBranch(brSpecs,muons.product(), cumulativeFlags.at(coll).back()); |
1228 |
+ |
else if(coll == "secondary muons") assignTreeBranch(brSpecs,muons.product(), cumulativeFlags.at(coll).back()); |
1229 |
+ |
else if(coll == "electrons") assignTreeBranch(brSpecs,electrons.product(), cumulativeFlags.at(coll).back()); |
1230 |
+ |
else if(coll == "secondary electrons") assignTreeBranch(brSpecs,electrons.product(), cumulativeFlags.at(coll).back()); |
1231 |
+ |
else if(coll == "events") assignTreeBranch(brSpecs,events.product(), cumulativeFlags.at(coll).back()); |
1232 |
+ |
else if(coll == "taus") assignTreeBranch(brSpecs,taus.product(), cumulativeFlags.at(coll).back()); |
1233 |
+ |
else if(coll == "mets") assignTreeBranch(brSpecs,mets.product(), cumulativeFlags.at(coll).back()); |
1234 |
+ |
else if(coll == "tracks") assignTreeBranch(brSpecs,tracks.product(), cumulativeFlags.at(coll).back()); |
1235 |
+ |
else if(coll == "genjets") assignTreeBranch(brSpecs,genjets.product(), cumulativeFlags.at(coll).back()); |
1236 |
+ |
else if(coll == "mcparticles") assignTreeBranch(brSpecs,mcparticles.product(), cumulativeFlags.at(coll).back()); |
1237 |
+ |
else if(coll == "primaryvertexs") assignTreeBranch(brSpecs,primaryvertexs.product(),cumulativeFlags.at(coll).back()); |
1238 |
+ |
else if(coll == "bxlumis") assignTreeBranch(brSpecs,bxlumis.product(), cumulativeFlags.at(coll).back()); |
1239 |
+ |
else if(coll == "photons") assignTreeBranch(brSpecs,photons.product(), cumulativeFlags.at(coll).back()); |
1240 |
+ |
else if(coll == "superclusters") assignTreeBranch(brSpecs,superclusters.product(), cumulativeFlags.at(coll).back()); |
1241 |
+ |
else if(coll == "trigobjs") assignTreeBranch(brSpecs,trigobjs.product(), cumulativeFlags.at(coll).back()); |
1242 |
+ |
else if(coll == "stops" |
1243 |
+ |
&& datasetType_ == "signalMC") assignTreeBranch(brSpecs,stops.product(), cumulativeFlags.at(coll).back()); |
1244 |
+ |
} // end loop over branches |
1245 |
|
|
1246 |
+ |
if (!BNTrees_.at(currentChannelIndex)) { cout << "ERROR: Undefined BNTree. Will likely seg fault." << endl; } |
1247 |
+ |
BNTrees_.at(currentChannelIndex)->Fill(); // only fill if event has passed cuts |
1248 |
+ |
} |
1249 |
|
|
1250 |
+ |
(*channelDecisions)[currentChannel.name] = eventPassedAllCuts; |
1251 |
|
|
1252 |
< |
} //end loop over channel |
1252 |
> |
} // end loop over channel |
1253 |
|
|
1254 |
< |
masterCutFlow_->fillCutFlow(); |
1254 |
> |
masterCutFlow_->fillCutFlow(masterScaleFactor); |
1255 |
|
|
1256 |
+ |
event.put (channelDecisions, "channelDecisions"); |
1257 |
|
|
1258 |
< |
} |
1258 |
> |
} // end void OSUAnalysis::analyze (const edm::Event &event, const edm::EventSetup &setup) |
1259 |
|
|
1260 |
|
|
1261 |
< |
bool |
1261 |
> |
|
1262 |
> |
bool |
1263 |
|
OSUAnalysis::evaluateComparison (double testValue, string comparison, double cutValue){ |
1264 |
|
|
1265 |
|
|
1267 |
|
else if(comparison == ">=") return testValue >= cutValue; |
1268 |
|
else if(comparison == "<") return testValue < cutValue; |
1269 |
|
else if(comparison == "<=") return testValue <= cutValue; |
1270 |
< |
else {std::cout << "WARNING: invalid comparison operator '" << comparison << "'\n"; return false;} |
1270 |
> |
else if(comparison == "==") return testValue == cutValue; |
1271 |
> |
else if(comparison == "=") return testValue == cutValue; |
1272 |
> |
else if(comparison == "!=") return testValue != cutValue; |
1273 |
> |
else {cout << "WARNING: invalid comparison operator '" << comparison << "'\n"; return false;} |
1274 |
|
|
1275 |
|
} |
1276 |
|
|
1277 |
|
bool |
1278 |
< |
OSUAnalysis::evaluateTriggers (vector<string> triggersToTest, const BNtriggerCollection* triggerCollection){ |
1278 |
> |
OSUAnalysis::evaluateComparison (string testValue, string comparison, string cutValue){ |
1279 |
> |
|
1280 |
|
|
1281 |
+ |
if(comparison == ">") return testValue > cutValue; |
1282 |
+ |
else if(comparison == ">=") return testValue >= cutValue; |
1283 |
+ |
else if(comparison == "<") return testValue < cutValue; |
1284 |
+ |
else if(comparison == "<=") return testValue <= cutValue; |
1285 |
+ |
else if(comparison == "==") return testValue == cutValue; |
1286 |
+ |
else if(comparison == "=") return testValue == cutValue; |
1287 |
+ |
else if(comparison == "!=") return testValue != cutValue; |
1288 |
+ |
else {cout << "WARNING: invalid comparison operator '" << comparison << "'\n"; return false;} |
1289 |
+ |
|
1290 |
+ |
} |
1291 |
+ |
|
1292 |
+ |
bool |
1293 |
+ |
OSUAnalysis::evaluateTriggers (vector<string> triggersToTest, vector<string> triggersToVeto, const BNtriggerCollection* triggerCollection){ |
1294 |
+ |
|
1295 |
+ |
//initialize to false until a chosen trigger is passed |
1296 |
|
bool triggerDecision = false; |
1297 |
|
|
1298 |
< |
for (BNtriggerCollection::const_iterator trigger = triggerCollection->begin (); trigger != triggerCollection->end (); trigger++) |
1299 |
< |
{ |
1300 |
< |
if(trigger->pass != 1) continue; |
1301 |
< |
for(uint triggerName = 0; triggerName != triggersToTest.size(); triggerName++) |
1302 |
< |
{ |
1303 |
< |
if(trigger->name.find(triggersToTest.at(triggerName))!=std::string::npos){ |
1304 |
< |
triggerDecision = true; |
1305 |
< |
} |
1306 |
< |
} |
1298 |
> |
if (printAllTriggers_) cout << "Printing list of all available triggers (which this event may or may not pass):" << endl; |
1299 |
> |
//loop over all triggers defined in the event |
1300 |
> |
for (BNtriggerCollection::const_iterator trigger = triggerCollection->begin (); trigger != triggerCollection->end (); trigger++){ |
1301 |
> |
|
1302 |
> |
if (printAllTriggers_) cout << " " << trigger->name << endl; |
1303 |
> |
|
1304 |
> |
//we're only interested in triggers that actually passed |
1305 |
> |
if(trigger->pass != 1) continue; |
1306 |
> |
|
1307 |
> |
//if the event passes one of the veto triggers, exit and return false |
1308 |
> |
for(uint triggerName = 0; triggerName != triggersToVeto.size(); triggerName++){ |
1309 |
> |
if(trigger->name.find(triggersToVeto.at(triggerName))!=string::npos) return false; |
1310 |
> |
} |
1311 |
> |
//if the event passes one of the chosen triggers, set triggerDecision to true |
1312 |
> |
for(uint triggerName = 0; triggerName != triggersToTest.size(); triggerName++){ |
1313 |
> |
if(trigger->name.find(triggersToTest.at(triggerName))!=string::npos) triggerDecision = true; |
1314 |
|
} |
1315 |
< |
return triggerDecision; |
1315 |
> |
} |
1316 |
|
|
1317 |
+ |
printAllTriggers_ = false; // only print triggers once, not every event |
1318 |
+ |
|
1319 |
+ |
//if none of the veto triggers fired: |
1320 |
+ |
//return the OR of all the chosen triggers |
1321 |
+ |
if (triggersToTest.size() != 0) return triggerDecision; |
1322 |
+ |
//or if no triggers were defined return true |
1323 |
+ |
else return true; |
1324 |
|
} |
1325 |
|
|
1326 |
< |
std::vector<std::string> |
1326 |
> |
|
1327 |
> |
vector<string> |
1328 |
|
OSUAnalysis::splitString (string inputString){ |
1329 |
|
|
1330 |
< |
std::stringstream stringStream(inputString); |
1331 |
< |
std::istream_iterator<std::string> begin(stringStream); |
1332 |
< |
std::istream_iterator<std::string> end; |
1333 |
< |
std::vector<std::string> stringVector(begin, end); |
1330 |
> |
stringstream stringStream(inputString); |
1331 |
> |
istream_iterator<string> begin(stringStream); |
1332 |
> |
istream_iterator<string> end; |
1333 |
> |
vector<string> stringVector(begin, end); |
1334 |
|
return stringVector; |
1335 |
|
|
1336 |
|
} |
1337 |
|
|
1338 |
+ |
|
1339 |
+ |
void OSUAnalysis::getTwoObjs(string tempInputCollection, string& obj1, string& obj2) { |
1340 |
+ |
// Set two object strings from the tempInputCollection string, |
1341 |
+ |
// For example, if tempInputCollection is "electron-muon pairs", |
1342 |
+ |
// then obj1 = "electrons" and obj2 = "muons". |
1343 |
+ |
// Note that the objects have an "s" appended. |
1344 |
+ |
|
1345 |
+ |
int dashIndex = tempInputCollection.find("-"); |
1346 |
+ |
int spaceIndex = tempInputCollection.find_last_of(" "); |
1347 |
+ |
int secondWordLength = spaceIndex - dashIndex; |
1348 |
+ |
obj1 = tempInputCollection.substr(0,dashIndex) + "s"; |
1349 |
+ |
obj2 = tempInputCollection.substr(dashIndex+1,secondWordLength-1)+"s"; |
1350 |
+ |
|
1351 |
+ |
} |
1352 |
+ |
|
1353 |
+ |
|
1354 |
+ |
string OSUAnalysis::getObjToGet(string obj) { |
1355 |
+ |
// Return the string corresponding to the object to get for the given obj string. |
1356 |
+ |
// Right now this only handles the case in which obj contains "secondary", |
1357 |
+ |
// e.g, "secondary muons". |
1358 |
+ |
// Note that "s" is NOT appended. |
1359 |
+ |
|
1360 |
+ |
if (obj.find("secondary")==string::npos) return obj; // "secondary" is not found |
1361 |
+ |
int firstSpaceIndex = obj.find_first_of(" "); |
1362 |
+ |
return obj.substr(firstSpaceIndex+1,obj.length()-1); |
1363 |
+ |
|
1364 |
+ |
} |
1365 |
+ |
|
1366 |
+ |
|
1367 |
+ |
//!jet valueLookup |
1368 |
|
double |
1369 |
< |
OSUAnalysis::valueLookup (const BNjet* object, string variable, string function){ |
1369 |
> |
OSUAnalysis::valueLookup (const BNjet* object, string variable, string function, string &stringValue){ |
1370 |
|
|
1371 |
|
double value = 0.0; |
1372 |
|
if(variable == "energy") value = object->energy; |
1484 |
|
else if(variable == "puJetId_loose_full") value = object->puJetId_loose_full; |
1485 |
|
else if(variable == "puJetId_loose_simple") value = object->puJetId_loose_simple; |
1486 |
|
else if(variable == "puJetId_loose_cutbased") value = object->puJetId_loose_cutbased; |
1487 |
< |
|
1488 |
< |
|
1489 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
1490 |
< |
|
1491 |
< |
if(function == "abs") value = abs(value); |
1487 |
> |
|
1488 |
> |
//user defined variable |
1489 |
> |
else if(variable == "disappTrkLeadingJetID") { |
1490 |
> |
value = object->pt > 110 |
1491 |
> |
&& fabs(object->eta) < 2.4 |
1492 |
> |
&& object->chargedHadronEnergyFraction > 0.2 |
1493 |
> |
&& object->neutralHadronEnergyFraction < 0.7 |
1494 |
> |
&& object->chargedEmEnergyFraction < 0.5 |
1495 |
> |
&& object->neutralEmEnergyFraction < 0.7; |
1496 |
> |
} |
1497 |
> |
|
1498 |
> |
else if(variable == "disappTrkSubLeadingJetID") { |
1499 |
> |
value = object->pt > 30 |
1500 |
> |
&& fabs(object->eta) < 4.5 |
1501 |
> |
&& object->neutralHadronEnergyFraction < 0.7 |
1502 |
> |
&& object->chargedEmEnergyFraction < 0.5; |
1503 |
> |
} |
1504 |
> |
|
1505 |
> |
|
1506 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
1507 |
> |
|
1508 |
> |
value = applyFunction(function, value); |
1509 |
|
|
1510 |
|
return value; |
1511 |
|
} |
1512 |
|
|
1513 |
|
|
1514 |
< |
|
1514 |
> |
//!muon valueLookup |
1515 |
|
double |
1516 |
< |
OSUAnalysis::valueLookup (const BNmuon* object, string variable, string function){ |
1516 |
> |
OSUAnalysis::valueLookup (const BNmuon* object, string variable, string function, string &stringValue){ |
1517 |
|
|
1518 |
|
double value = 0.0; |
1519 |
|
if(variable == "energy") value = object->energy; |
1529 |
|
else if(variable == "ecalIso") value = object->ecalIso; |
1530 |
|
else if(variable == "hcalIso") value = object->hcalIso; |
1531 |
|
else if(variable == "caloIso") value = object->caloIso; |
1532 |
< |
else if(variable == "trackIsoDR03") value = object->trackIsoDR03; |
1532 |
> |
else if(variable == "trackIsDR03") value = object->trackIsoDR03; |
1533 |
|
else if(variable == "ecalIsoDR03") value = object->ecalIsoDR03; |
1534 |
|
else if(variable == "hcalIsoDR03") value = object->hcalIsoDR03; |
1535 |
|
else if(variable == "caloIsoDR03") value = object->caloIsoDR03; |
1667 |
|
else if(variable == "numberOfMatchedStations") value = object->numberOfMatchedStations; |
1668 |
|
else if(variable == "time_ndof") value = object->time_ndof; |
1669 |
|
|
1670 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
1671 |
< |
|
1670 |
> |
//user-defined variables |
1671 |
> |
else if(variable == "looseID") { |
1672 |
> |
value = object->pt > 10 |
1673 |
> |
&& object->isGlobalMuon > 0 |
1674 |
> |
&& object->isTrackerMuon > 0; |
1675 |
> |
} |
1676 |
> |
else if(variable == "correctedD0VertexErr") value = hypot (object->tkD0err, hypot (chosenVertex ()->xError, chosenVertex ()->yError)); |
1677 |
> |
else if(variable == "correctedD0VertexSig") value = object->correctedD0Vertex / hypot (object->tkD0err, hypot (chosenVertex ()->xError, chosenVertex ()->yError)); |
1678 |
> |
else if(variable == "detIso") value = (object->trackIsoDR03) / object->pt; |
1679 |
> |
else if(variable == "relPFdBetaIso") value = (object->pfIsoR04SumChargedHadronPt + max(0.0, object->pfIsoR04SumNeutralHadronEt + object->pfIsoR04SumPhotonEt - 0.5*object->pfIsoR04SumPUPt)) / object->pt; |
1680 |
> |
else if(variable == "relPFrhoIso") value = ( object->chargedHadronIso + max(0.0, object->neutralHadronIso + object->photonIso - object->AEffDr03*object->rhoPrime) ) / object->pt; |
1681 |
> |
else if(variable == "metMT") { |
1682 |
> |
if (const BNmet *met = chosenMET ()) |
1683 |
> |
{ |
1684 |
> |
double dPhi = deltaPhi (object->phi, met->phi); |
1685 |
> |
value = sqrt (2 * object->pt * met->pt * (1 - cos (dPhi))); |
1686 |
> |
} |
1687 |
> |
else |
1688 |
> |
value = -999; |
1689 |
> |
} |
1690 |
> |
|
1691 |
> |
|
1692 |
> |
|
1693 |
> |
else if(variable == "correctedD0VertexInEBPlus"){ |
1694 |
> |
if(fabs(object->eta) < 0.8 && object->eta > 0) value = object->correctedD0Vertex; |
1695 |
> |
else value = -999; |
1696 |
> |
} |
1697 |
> |
else if(variable == "correctedD0VertexOutEBPlus"){ |
1698 |
> |
if(fabs(object->eta) < 1.479 && fabs(object->eta) > 0.8 && object->eta > 0) value = object->correctedD0Vertex; |
1699 |
> |
else value = -999; |
1700 |
> |
} |
1701 |
> |
else if(variable == "correctedD0VertexEEPlus"){ |
1702 |
> |
if(fabs(object->eta) > 1.479 && object->eta > 0) value = object->correctedD0Vertex; |
1703 |
> |
else value = -999; |
1704 |
> |
} |
1705 |
> |
|
1706 |
> |
else if(variable == "correctedD0BeamspotInEBPlus"){ |
1707 |
> |
if(fabs(object->eta) < 0.8 && object->eta > 0) value = object->correctedD0; |
1708 |
> |
else value = -999; |
1709 |
> |
} |
1710 |
> |
else if(variable == "correctedD0BeamspotOutEBPlus"){ |
1711 |
> |
if(fabs(object->eta) < 1.479 && fabs(object->eta) > 0.8 && object->eta > 0) value = object->correctedD0; |
1712 |
> |
else value = -999; |
1713 |
> |
} |
1714 |
> |
else if(variable == "correctedD0BeamspotEEPlus"){ |
1715 |
> |
if(fabs(object->eta) > 1.479 && object->eta > 0) value = object->correctedD0; |
1716 |
> |
else value = -999; |
1717 |
> |
} |
1718 |
> |
|
1719 |
> |
else if(variable == "correctedD0VertexInEBMinus"){ |
1720 |
> |
if(fabs(object->eta) < 0.8 && object->eta < 0) value = object->correctedD0Vertex; |
1721 |
> |
else value = -999; |
1722 |
> |
} |
1723 |
> |
else if(variable == "correctedD0VertexOutEBMinus"){ |
1724 |
> |
if(fabs(object->eta) < 1.479 && fabs(object->eta) > 0.8 && object->eta < 0) value = object->correctedD0Vertex; |
1725 |
> |
else value = -999; |
1726 |
> |
} |
1727 |
> |
else if(variable == "correctedD0VertexEEMinus"){ |
1728 |
> |
if(fabs(object->eta) > 1.479 && object->eta < 0) value = object->correctedD0Vertex; |
1729 |
> |
else value = -999; |
1730 |
> |
} |
1731 |
> |
|
1732 |
> |
else if(variable == "correctedD0BeamspotInEBMinus"){ |
1733 |
> |
if(fabs(object->eta) < 0.8 && object->eta < 0) value = object->correctedD0; |
1734 |
> |
else value = -999; |
1735 |
> |
} |
1736 |
> |
else if(variable == "correctedD0BeamspotOutEBMinus"){ |
1737 |
> |
if(fabs(object->eta) < 1.479 && fabs(object->eta) > 0.8 && object->eta < 0) value = object->correctedD0; |
1738 |
> |
else value = -999; |
1739 |
> |
} |
1740 |
> |
else if(variable == "correctedD0BeamspotEEMinus"){ |
1741 |
> |
if(fabs(object->eta) > 1.479 && object->eta < 0) value = object->correctedD0; |
1742 |
> |
else value = -999; |
1743 |
> |
} |
1744 |
> |
|
1745 |
> |
|
1746 |
> |
else if(variable == "correctedD0VertexInEBPositiveCharge"){ |
1747 |
> |
if(fabs(object->eta) < 0.8 && object->charge > 0) value = object->correctedD0Vertex; |
1748 |
> |
else value = -999; |
1749 |
> |
} |
1750 |
> |
else if(variable == "correctedD0VertexOutEBPositiveCharge"){ |
1751 |
> |
if(fabs(object->eta) < 1.479 && fabs(object->eta) > 0.8 && object->charge > 0) value = object->correctedD0Vertex; |
1752 |
> |
else value = -999; |
1753 |
> |
} |
1754 |
> |
else if(variable == "correctedD0VertexEEPositiveCharge"){ |
1755 |
> |
if(fabs(object->eta) > 1.479 && object->charge > 0) value = object->correctedD0Vertex; |
1756 |
> |
else value = -999; |
1757 |
> |
} |
1758 |
> |
|
1759 |
> |
else if(variable == "correctedD0BeamspotInEBPositiveCharge"){ |
1760 |
> |
if(fabs(object->eta) < 0.8 && object->charge > 0) value = object->correctedD0; |
1761 |
> |
else value = -999; |
1762 |
> |
} |
1763 |
> |
else if(variable == "correctedD0BeamspotOutEBPositiveCharge"){ |
1764 |
> |
if(fabs(object->eta) < 1.479 && fabs(object->eta) > 0.8 && object->charge > 0) value = object->correctedD0; |
1765 |
> |
else value = -999; |
1766 |
> |
} |
1767 |
> |
else if(variable == "correctedD0BeamspotEEPositiveCharge"){ |
1768 |
> |
if(fabs(object->eta) > 1.479 && object->charge > 0) value = object->correctedD0; |
1769 |
> |
else value = -999; |
1770 |
> |
} |
1771 |
> |
|
1772 |
> |
else if(variable == "correctedD0VertexInEBNegativeCharge"){ |
1773 |
> |
if(fabs(object->eta) < 0.8 && object->charge < 0) value = object->correctedD0Vertex; |
1774 |
> |
else value = -999; |
1775 |
> |
} |
1776 |
> |
else if(variable == "correctedD0VertexOutEBNegativeCharge"){ |
1777 |
> |
if(fabs(object->eta) < 1.479 && fabs(object->eta) > 0.8 && object->charge < 0) value = object->correctedD0Vertex; |
1778 |
> |
else value = -999; |
1779 |
> |
} |
1780 |
> |
else if(variable == "correctedD0VertexEENegativeCharge"){ |
1781 |
> |
if(fabs(object->eta) > 1.479 && object->charge < 0) value = object->correctedD0Vertex; |
1782 |
> |
else value = -999; |
1783 |
> |
} |
1784 |
> |
|
1785 |
> |
else if(variable == "correctedD0BeamspotInEBNegativeCharge"){ |
1786 |
> |
if(fabs(object->eta) < 0.8 && object->charge < 0) value = object->correctedD0; |
1787 |
> |
else value = -999; |
1788 |
> |
} |
1789 |
> |
else if(variable == "correctedD0BeamspotOutEBNegativeCharge"){ |
1790 |
> |
if(fabs(object->eta) < 1.479 && fabs(object->eta) > 0.8 && object->charge < 0) value = object->correctedD0; |
1791 |
> |
else value = -999; |
1792 |
> |
} |
1793 |
> |
else if(variable == "correctedD0BeamspotEENegativeCharge"){ |
1794 |
> |
if(fabs(object->eta) > 1.479 && object->charge < 0) value = object->correctedD0; |
1795 |
> |
else value = -999; |
1796 |
> |
} |
1797 |
> |
|
1798 |
> |
|
1799 |
> |
else if(variable == "tightID") { |
1800 |
> |
value = object->isGlobalMuon > 0 \ |
1801 |
> |
&& object->isPFMuon > 0 \ |
1802 |
> |
&& object->normalizedChi2 < 10 \ |
1803 |
> |
&& object->numberOfValidMuonHits > 0 \ |
1804 |
> |
&& object->numberOfMatchedStations > 1 \ |
1805 |
> |
&& fabs(object->correctedD0Vertex) < 0.2 \ |
1806 |
> |
&& fabs(object->correctedDZ) < 0.5 \ |
1807 |
> |
&& object->numberOfValidPixelHits > 0 \ |
1808 |
> |
&& object->numberOfLayersWithMeasurement > 5; |
1809 |
> |
} |
1810 |
> |
else if(variable == "tightIDdisplaced"){ |
1811 |
> |
value = object->isGlobalMuon > 0 \ |
1812 |
> |
&& object->isPFMuon > 0 \ |
1813 |
> |
&& object->normalizedChi2 < 10 \ |
1814 |
> |
&& object->numberOfValidMuonHits > 0 \ |
1815 |
> |
&& object->numberOfMatchedStations > 1 \ |
1816 |
> |
&& object->numberOfValidPixelHits > 0 \ |
1817 |
> |
&& object->numberOfLayersWithMeasurement > 5; |
1818 |
> |
} |
1819 |
> |
|
1820 |
> |
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
1821 |
> |
|
1822 |
> |
else if(variable == "genMatchedPdgId"){ |
1823 |
> |
int index = getGenMatchedParticleIndex(object); |
1824 |
> |
if(index == -1) value = 0; |
1825 |
> |
else value = mcparticles->at(index).id; |
1826 |
> |
} |
1827 |
> |
|
1828 |
> |
else if(variable == "genMatchedId"){ |
1829 |
> |
int index = getGenMatchedParticleIndex(object); |
1830 |
> |
if(index == -1) value = 0; |
1831 |
> |
else value = getPdgIdBinValue(mcparticles->at(index).id); |
1832 |
> |
} |
1833 |
> |
else if(variable == "genMatchedMotherId"){ |
1834 |
> |
int index = getGenMatchedParticleIndex(object); |
1835 |
> |
if(index == -1) value = 0; |
1836 |
> |
else value = getPdgIdBinValue(mcparticles->at(index).motherId); |
1837 |
> |
} |
1838 |
> |
else if(variable == "genMatchedMotherIdReverse"){ |
1839 |
> |
int index = getGenMatchedParticleIndex(object); |
1840 |
> |
if(index == -1) value = 24; |
1841 |
> |
else value = 24 - getPdgIdBinValue(mcparticles->at(index).motherId); |
1842 |
> |
} |
1843 |
> |
else if(variable == "genMatchedGrandmotherId"){ |
1844 |
> |
int index = getGenMatchedParticleIndex(object); |
1845 |
> |
if(index == -1) value = 0; |
1846 |
> |
else if(fabs(mcparticles->at(index).motherId) == 15){ |
1847 |
> |
int motherIndex = findTauMotherIndex(&mcparticles->at(index)); |
1848 |
> |
if(motherIndex == -1) value = 0; |
1849 |
> |
else value = getPdgIdBinValue(mcparticles->at(motherIndex).motherId); |
1850 |
> |
} |
1851 |
> |
else value = getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
1852 |
> |
} |
1853 |
> |
else if(variable == "genMatchedGrandmotherIdReverse"){ |
1854 |
> |
int index = getGenMatchedParticleIndex(object); |
1855 |
> |
if(index == -1) value = 24; |
1856 |
> |
else if(fabs(mcparticles->at(index).motherId) == 15){ |
1857 |
> |
int motherIndex = findTauMotherIndex(&mcparticles->at(index)); |
1858 |
> |
if(motherIndex == -1) value = 24; |
1859 |
> |
else value = 24 - getPdgIdBinValue(mcparticles->at(motherIndex).motherId); |
1860 |
> |
} |
1861 |
> |
else value = 24 - getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
1862 |
> |
} |
1863 |
> |
else if(variable == "pfMuonsFromVertex"){ |
1864 |
> |
double d0Error, dzError; |
1865 |
> |
|
1866 |
> |
d0Error = hypot (object->tkD0err, hypot (chosenVertex ()->xError, chosenVertex ()->yError)); |
1867 |
> |
dzError = hypot (object->tkDZerr, chosenVertex ()->zError); |
1868 |
> |
value = fabs (object->correctedD0Vertex) > 0.2 || fabs (object->correctedDZ) > 0.5 |
1869 |
> |
|| fabs (object->correctedD0Vertex / d0Error) > 99.0 |
1870 |
> |
|| fabs (object->correctedDZ / dzError) > 99.0; |
1871 |
> |
value = (object->isStandAloneMuon && !object->isTrackerMuon && !object->isGlobalMuon) || !value; |
1872 |
> |
} |
1873 |
> |
|
1874 |
> |
|
1875 |
> |
|
1876 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
1877 |
> |
|
1878 |
> |
value = applyFunction(function, value); |
1879 |
|
|
1880 |
|
return value; |
1881 |
|
} |
1882 |
|
|
1883 |
< |
|
1883 |
> |
//!electron valueLookup |
1884 |
|
double |
1885 |
< |
OSUAnalysis::valueLookup (const BNelectron* object, string variable, string function){ |
1885 |
> |
OSUAnalysis::valueLookup (const BNelectron* object, string variable, string function, string &stringValue){ |
1886 |
|
|
1887 |
|
double value = 0.0; |
1888 |
|
if(variable == "energy") value = object->energy; |
2042 |
|
else if(variable == "eidHyperTight4MC") value = object->eidHyperTight4MC; |
2043 |
|
else if(variable == "passConvVeto") value = object->passConvVeto; |
2044 |
|
|
2045 |
+ |
//user-defined variables |
2046 |
+ |
else if(variable == "correctedD0VertexErr") value = hypot (object->tkD0err, hypot (chosenVertex ()->xError, chosenVertex ()->yError)); |
2047 |
+ |
else if(variable == "correctedD0VertexSig") value = object->correctedD0Vertex / hypot (object->tkD0err, hypot (chosenVertex ()->xError, chosenVertex ()->yError)); |
2048 |
+ |
else if(variable == "detIso") value = (object->trackIso) / object->pt; |
2049 |
+ |
else if(variable == "relPFrhoIso") value = ( object->chargedHadronIsoDR03 + max(0.0, object->neutralHadronIsoDR03 + object->photonIsoDR03 - object->AEffDr03*object->rhoPrime) ) / object->pt; |
2050 |
+ |
else if(variable == "metMT") { |
2051 |
+ |
if (const BNmet *met = chosenMET ()) |
2052 |
+ |
{ |
2053 |
+ |
double dPhi = deltaPhi (object->phi, met->phi); |
2054 |
+ |
value = sqrt (2 * object->pt * met->pt * (1 - cos (dPhi))); |
2055 |
+ |
} |
2056 |
+ |
else |
2057 |
+ |
value = -999; |
2058 |
+ |
} |
2059 |
|
|
2060 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2061 |
< |
|
2060 |
> |
else if(variable == "correctedD0VertexEEPositiveChargeLowPt"){ |
2061 |
> |
if(fabs(object->eta) > 1.479 && object->charge > 0 && object->pt > 45) value = object->correctedD0Vertex; |
2062 |
> |
else value = -999; |
2063 |
> |
} |
2064 |
> |
else if(variable == "correctedD0VertexEEPositiveChargeHighPt"){ |
2065 |
> |
if(fabs(object->eta) > 1.479 && object->charge > 0 && object->pt < 45) value = object->correctedD0Vertex; |
2066 |
> |
else value = -999; |
2067 |
> |
} |
2068 |
> |
|
2069 |
> |
else if(variable == "correctedD0VertexInEBPlus"){ |
2070 |
> |
if(fabs(object->eta) < 0.8 && object->eta > 0) value = object->correctedD0Vertex; |
2071 |
> |
else value = -999; |
2072 |
> |
} |
2073 |
> |
else if(variable == "correctedD0VertexOutEBPlus"){ |
2074 |
> |
if(object->isEB && fabs(object->eta) > 0.8 && object->eta > 0) value = object->correctedD0Vertex; |
2075 |
> |
else value = -999; |
2076 |
> |
} |
2077 |
> |
else if(variable == "correctedD0VertexEEPlus"){ |
2078 |
> |
if(object->isEE && object->eta > 0) value = object->correctedD0Vertex; |
2079 |
> |
else value = -999; |
2080 |
> |
} |
2081 |
> |
|
2082 |
> |
else if(variable == "correctedD0BeamspotInEBPlus"){ |
2083 |
> |
if(fabs(object->eta) < 0.8 && object->eta > 0) value = object->correctedD0; |
2084 |
> |
else value = -999; |
2085 |
> |
} |
2086 |
> |
else if(variable == "correctedD0BeamspotOutEBPlus"){ |
2087 |
> |
if(object->isEB && fabs(object->eta) > 0.8 && object->eta > 0) value = object->correctedD0; |
2088 |
> |
else value = -999; |
2089 |
> |
} |
2090 |
> |
else if(variable == "correctedD0BeamspotEEPlus"){ |
2091 |
> |
if(object->isEE && object->eta > 0) value = object->correctedD0; |
2092 |
> |
else value = -999; |
2093 |
> |
} |
2094 |
> |
|
2095 |
> |
else if(variable == "correctedD0VertexInEBMinus"){ |
2096 |
> |
if(fabs(object->eta) < 0.8 && object->eta < 0) value = object->correctedD0Vertex; |
2097 |
> |
else value = -999; |
2098 |
> |
} |
2099 |
> |
else if(variable == "correctedD0VertexOutEBMinus"){ |
2100 |
> |
if(object->isEB && fabs(object->eta) > 0.8 && object->eta < 0) value = object->correctedD0Vertex; |
2101 |
> |
else value = -999; |
2102 |
> |
} |
2103 |
> |
else if(variable == "correctedD0VertexEEMinus"){ |
2104 |
> |
if(object->isEE && object->eta < 0) value = object->correctedD0Vertex; |
2105 |
> |
else value = -999; |
2106 |
> |
} |
2107 |
> |
|
2108 |
> |
else if(variable == "correctedD0BeamspotInEBMinus"){ |
2109 |
> |
if(fabs(object->eta) < 0.8 && object->eta < 0) value = object->correctedD0; |
2110 |
> |
else value = -999; |
2111 |
> |
} |
2112 |
> |
else if(variable == "correctedD0BeamspotOutEBMinus"){ |
2113 |
> |
if(object->isEB && fabs(object->eta) > 0.8 && object->eta < 0) value = object->correctedD0; |
2114 |
> |
else value = -999; |
2115 |
> |
} |
2116 |
> |
else if(variable == "correctedD0BeamspotEEMinus"){ |
2117 |
> |
if(object->isEE && object->eta < 0) value = object->correctedD0; |
2118 |
> |
else value = -999; |
2119 |
> |
} |
2120 |
> |
|
2121 |
> |
else if(variable == "tightID"){ |
2122 |
> |
if (object->isEB) |
2123 |
> |
{ |
2124 |
> |
value = fabs(object->delEtaIn) < 0.004 \ |
2125 |
> |
&& fabs (object->delPhiIn) < 0.03 \ |
2126 |
> |
&& object->scSigmaIEtaIEta < 0.01 \ |
2127 |
> |
&& object->hadOverEm < 0.12 \ |
2128 |
> |
&& fabs (object->correctedD0Vertex) < 0.02 \ |
2129 |
> |
&& fabs (object->correctedDZ) < 0.1 \ |
2130 |
> |
&& object->absInvEMinusInvPin < 0.05 \ |
2131 |
> |
&& object->passConvVeto; |
2132 |
> |
} |
2133 |
> |
else |
2134 |
> |
{ |
2135 |
> |
value = fabs(object->delEtaIn) < 0.005 \ |
2136 |
> |
&& fabs (object->delPhiIn) < 0.02 \ |
2137 |
> |
&& object->scSigmaIEtaIEta < 0.03 \ |
2138 |
> |
&& object->hadOverEm < 0.10 \ |
2139 |
> |
&& fabs (object->correctedD0Vertex) < 0.02 \ |
2140 |
> |
&& fabs (object->correctedDZ) < 0.1 \ |
2141 |
> |
&& object->absInvEMinusInvPin < 0.05 \ |
2142 |
> |
&& object->passConvVeto; |
2143 |
> |
} |
2144 |
> |
} |
2145 |
> |
|
2146 |
> |
else if(variable == "looseID"){ |
2147 |
> |
value = object->pt > 10 |
2148 |
> |
&& object->mvaNonTrigV0 > 0; |
2149 |
> |
} |
2150 |
> |
else if(variable == "correctedD0VertexInEBPositiveCharge"){ |
2151 |
> |
if(fabs(object->eta) < 0.8 && object->charge > 0) value = object->correctedD0Vertex; |
2152 |
> |
else value = -999; |
2153 |
> |
} |
2154 |
> |
else if(variable == "correctedD0VertexOutEBPositiveCharge"){ |
2155 |
> |
if(object->isEB && fabs(object->eta) > 0.8 && object->charge > 0) value = object->correctedD0Vertex; |
2156 |
> |
else value = -999; |
2157 |
> |
} |
2158 |
> |
else if(variable == "correctedD0VertexEEPositiveCharge"){ |
2159 |
> |
if(object->isEE && object->charge > 0) value = object->correctedD0Vertex; |
2160 |
> |
else value = -999; |
2161 |
> |
} |
2162 |
> |
|
2163 |
> |
else if(variable == "correctedD0BeamspotInEBPositiveCharge"){ |
2164 |
> |
if(fabs(object->eta) < 0.8 && object->charge > 0) value = object->correctedD0; |
2165 |
> |
else value = -999; |
2166 |
> |
} |
2167 |
> |
else if(variable == "correctedD0BeamspotOutEBPositiveCharge"){ |
2168 |
> |
if(object->isEB && fabs(object->eta) > 0.8 && object->charge > 0) value = object->correctedD0; |
2169 |
> |
else value = -999; |
2170 |
> |
} |
2171 |
> |
else if(variable == "correctedD0BeamspotEEPositiveCharge"){ |
2172 |
> |
if(object->isEE && object->charge > 0) value = object->correctedD0; |
2173 |
> |
else value = -999; |
2174 |
> |
} |
2175 |
> |
|
2176 |
> |
else if(variable == "correctedD0VertexInEBNegativeCharge"){ |
2177 |
> |
if(fabs(object->eta) < 0.8 && object->charge < 0) value = object->correctedD0Vertex; |
2178 |
> |
else value = -999; |
2179 |
> |
} |
2180 |
> |
else if(variable == "correctedD0VertexOutEBNegativeCharge"){ |
2181 |
> |
if(object->isEB && fabs(object->eta) > 0.8 && object->charge < 0) value = object->correctedD0Vertex; |
2182 |
> |
else value = -999; |
2183 |
> |
} |
2184 |
> |
else if(variable == "correctedD0VertexEENegativeCharge"){ |
2185 |
> |
if(object->isEE && object->charge < 0) value = object->correctedD0Vertex; |
2186 |
> |
else value = -999; |
2187 |
> |
} |
2188 |
> |
|
2189 |
> |
else if(variable == "correctedD0BeamspotInEBNegativeCharge"){ |
2190 |
> |
if(fabs(object->eta) < 0.8 && object->charge < 0) value = object->correctedD0; |
2191 |
> |
else value = -999; |
2192 |
> |
} |
2193 |
> |
else if(variable == "correctedD0BeamspotOutEBNegativeCharge"){ |
2194 |
> |
if(object->isEB && fabs(object->eta) > 0.8 && object->charge < 0) value = object->correctedD0; |
2195 |
> |
else value = -999; |
2196 |
> |
} |
2197 |
> |
else if(variable == "correctedD0BeamspotEENegativeCharge"){ |
2198 |
> |
if(object->isEE && object->charge < 0) value = object->correctedD0; |
2199 |
> |
else value = -999; |
2200 |
> |
} |
2201 |
> |
|
2202 |
> |
|
2203 |
> |
else if(variable == "tightIDdisplaced"){ |
2204 |
> |
if (object->isEB) |
2205 |
> |
{ |
2206 |
> |
value = fabs(object->delEtaIn) < 0.004 \ |
2207 |
> |
&& fabs (object->delPhiIn) < 0.03 \ |
2208 |
> |
&& object->scSigmaIEtaIEta < 0.01 \ |
2209 |
> |
&& object->hadOverEm < 0.12 \ |
2210 |
> |
&& object->absInvEMinusInvPin < 0.05; |
2211 |
> |
} |
2212 |
> |
else |
2213 |
> |
{ |
2214 |
> |
value = fabs (object->delEtaIn) < 0.005 \ |
2215 |
> |
&& fabs (object->delPhiIn) < 0.02 \ |
2216 |
> |
&& object->scSigmaIEtaIEta < 0.03 \ |
2217 |
> |
&& object->hadOverEm < 0.10 \ |
2218 |
> |
&& object->absInvEMinusInvPin < 0.05; |
2219 |
> |
} |
2220 |
> |
} |
2221 |
> |
|
2222 |
> |
|
2223 |
> |
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
2224 |
> |
|
2225 |
> |
else if(variable == "genMatchedPdgId"){ |
2226 |
> |
int index = getGenMatchedParticleIndex(object); |
2227 |
> |
if(index == -1) value = 0; |
2228 |
> |
else value = mcparticles->at(index).id; |
2229 |
> |
} |
2230 |
> |
|
2231 |
> |
|
2232 |
> |
else if(variable == "genMatchedId"){ |
2233 |
> |
int index = getGenMatchedParticleIndex(object); |
2234 |
> |
if(index == -1) value = 0; |
2235 |
> |
else value = getPdgIdBinValue(mcparticles->at(index).id); |
2236 |
> |
} |
2237 |
> |
else if(variable == "genMatchedMotherId"){ |
2238 |
> |
int index = getGenMatchedParticleIndex(object); |
2239 |
> |
if(index == -1) value = 0; |
2240 |
> |
else value = getPdgIdBinValue(mcparticles->at(index).motherId); |
2241 |
> |
} |
2242 |
> |
else if(variable == "genMatchedMotherIdReverse"){ |
2243 |
> |
int index = getGenMatchedParticleIndex(object); |
2244 |
> |
if(index == -1) value = 24; |
2245 |
> |
else value = 24 -getPdgIdBinValue(mcparticles->at(index).motherId); |
2246 |
> |
} |
2247 |
> |
else if(variable == "genMatchedGrandmotherId"){ |
2248 |
> |
int index = getGenMatchedParticleIndex(object); |
2249 |
> |
if(index == -1) value = 0; |
2250 |
> |
else if(fabs(mcparticles->at(index).motherId) == 15){ |
2251 |
> |
int motherIndex = findTauMotherIndex(&mcparticles->at(index)); |
2252 |
> |
if(motherIndex == -1) value = 0; |
2253 |
> |
else value = getPdgIdBinValue(mcparticles->at(motherIndex).motherId); |
2254 |
> |
} |
2255 |
> |
else value = getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
2256 |
> |
} |
2257 |
> |
else if(variable == "genMatchedGrandmotherIdReverse"){ |
2258 |
> |
int index = getGenMatchedParticleIndex(object); |
2259 |
> |
if(index == -1) value = 24; |
2260 |
> |
else if(fabs(mcparticles->at(index).motherId) == 15){ |
2261 |
> |
int motherIndex = findTauMotherIndex(&mcparticles->at(index)); |
2262 |
> |
if(motherIndex == -1) value = 24; |
2263 |
> |
else value = 24 - getPdgIdBinValue(mcparticles->at(motherIndex).motherId); |
2264 |
> |
} |
2265 |
> |
else value = 24 - getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
2266 |
> |
} |
2267 |
> |
else if(variable == "pfElectronsFromVertex"){ |
2268 |
> |
double d0Error, dzError; |
2269 |
> |
|
2270 |
> |
d0Error = hypot (object->tkD0err, hypot (chosenVertex ()->xError, chosenVertex ()->yError)); |
2271 |
> |
dzError = hypot (object->tkDZerr, chosenVertex ()->zError); |
2272 |
> |
value = fabs (object->correctedD0Vertex) > 0.2 || fabs (object->correctedDZ) > 0.5 |
2273 |
> |
|| fabs (object->correctedD0Vertex / d0Error) > 99.0 |
2274 |
> |
|| fabs (object->correctedDZ / dzError) > 99.0; |
2275 |
> |
value = !value; |
2276 |
> |
} |
2277 |
> |
|
2278 |
> |
|
2279 |
> |
|
2280 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2281 |
> |
|
2282 |
> |
value = applyFunction(function, value); |
2283 |
|
|
2284 |
|
return value; |
2285 |
|
} |
2286 |
|
|
2287 |
< |
|
2287 |
> |
//!event valueLookup |
2288 |
|
double |
2289 |
< |
OSUAnalysis::valueLookup (const BNevent* object, string variable, string function){ |
2289 |
> |
OSUAnalysis::valueLookup (const BNevent* object, string variable, string function, string &stringValue){ |
2290 |
|
|
2291 |
|
double value = 0.0; |
2292 |
|
|
2354 |
|
else if(variable == "id1") value = object->id1; |
2355 |
|
else if(variable == "id2") value = object->id2; |
2356 |
|
else if(variable == "evt") value = object->evt; |
2357 |
+ |
else if(variable == "puScaleFactor"){ |
2358 |
+ |
if(doPileupReweighting_ && datasetType_ != "data") |
2359 |
+ |
value = puWeight_->at (events->at (0).numTruePV); |
2360 |
+ |
else |
2361 |
+ |
value = 1.0; |
2362 |
+ |
} |
2363 |
+ |
else if(variable == "muonScaleFactor") value = muonScaleFactor_; |
2364 |
+ |
else if(variable == "electronScaleFactor") value = electronScaleFactor_; |
2365 |
+ |
else if(variable == "stopCTauScaleFactor") value = stopCTauScaleFactor_; |
2366 |
+ |
else if(variable == "bTagScaleFactor") value = bTagScaleFactor_; |
2367 |
+ |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2368 |
|
|
2369 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
948 |
< |
|
2369 |
> |
value = applyFunction(function, value); |
2370 |
|
|
2371 |
|
return value; |
2372 |
|
} |
2373 |
|
|
2374 |
+ |
//!tau valueLookup |
2375 |
|
double |
2376 |
< |
OSUAnalysis::valueLookup (const BNtau* object, string variable, string function){ |
2376 |
> |
OSUAnalysis::valueLookup (const BNtau* object, string variable, string function, string &stringValue){ |
2377 |
|
|
2378 |
|
double value = 0.0; |
2379 |
|
|
2417 |
|
else if(variable == "HPSdecayModeFinding") value = object->HPSdecayModeFinding; |
2418 |
|
else if(variable == "leadingTrackValid") value = object->leadingTrackValid; |
2419 |
|
|
2420 |
+ |
else if (variable == "looseHadronicID") { |
2421 |
+ |
value = object->pt > 10 |
2422 |
+ |
&& object->eta < 2.3 |
2423 |
+ |
&& object->HPSbyLooseCombinedIsolationDeltaBetaCorr > 0 |
2424 |
+ |
&& object->HPSdecayModeFinding > 0 |
2425 |
+ |
&& object->HPSagainstElectronLoose > 0 |
2426 |
+ |
&& object->HPSagainstMuonTight > 0; |
2427 |
+ |
} |
2428 |
|
|
2429 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2430 |
< |
|
2429 |
> |
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
2430 |
> |
|
2431 |
> |
else if(variable == "genMatchedPdgId"){ |
2432 |
> |
int index = getGenMatchedParticleIndex(object); |
2433 |
> |
if(index == -1) value = 0; |
2434 |
> |
else value = mcparticles->at(index).id; |
2435 |
> |
} |
2436 |
> |
|
2437 |
> |
else if(variable == "genMatchedId"){ |
2438 |
> |
int index = getGenMatchedParticleIndex(object); |
2439 |
> |
if(index == -1) value = 0; |
2440 |
> |
else value = getPdgIdBinValue(mcparticles->at(index).id); |
2441 |
> |
} |
2442 |
> |
else if(variable == "genMatchedMotherId"){ |
2443 |
> |
int index = getGenMatchedParticleIndex(object); |
2444 |
> |
if(index == -1) value = 0; |
2445 |
> |
else value = getPdgIdBinValue(mcparticles->at(index).motherId); |
2446 |
> |
} |
2447 |
> |
else if(variable == "genMatchedMotherIdReverse"){ |
2448 |
> |
int index = getGenMatchedParticleIndex(object); |
2449 |
> |
if(index == -1) value = 24; |
2450 |
> |
else value = 24 -getPdgIdBinValue(mcparticles->at(index).motherId); |
2451 |
> |
} |
2452 |
> |
else if(variable == "genMatchedGrandmotherId"){ |
2453 |
> |
int index = getGenMatchedParticleIndex(object); |
2454 |
> |
if(index == -1) value = 0; |
2455 |
> |
else if(fabs(mcparticles->at(index).motherId) == 15){ |
2456 |
> |
int motherIndex = findTauMotherIndex(&mcparticles->at(index)); |
2457 |
> |
if(motherIndex == -1) value = 0; |
2458 |
> |
else value = getPdgIdBinValue(mcparticles->at(motherIndex).motherId); |
2459 |
> |
} |
2460 |
> |
else value = getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
2461 |
> |
} |
2462 |
> |
else if(variable == "genMatchedGrandmotherIdReverse"){ |
2463 |
> |
int index = getGenMatchedParticleIndex(object); |
2464 |
> |
if(index == -1) value = 24; |
2465 |
> |
else if(fabs(mcparticles->at(index).motherId) == 15){ |
2466 |
> |
int motherIndex = findTauMotherIndex(&mcparticles->at(index)); |
2467 |
> |
if(motherIndex == -1) value = 24; |
2468 |
> |
else value = 24 - getPdgIdBinValue(mcparticles->at(motherIndex).motherId); |
2469 |
> |
} |
2470 |
> |
else value = 24 - getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
2471 |
> |
} |
2472 |
> |
|
2473 |
> |
|
2474 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2475 |
> |
|
2476 |
> |
value = applyFunction(function, value); |
2477 |
|
|
2478 |
|
return value; |
2479 |
|
} |
2480 |
|
|
2481 |
+ |
//!met valueLookup |
2482 |
|
double |
2483 |
< |
OSUAnalysis::valueLookup (const BNmet* object, string variable, string function){ |
2483 |
> |
OSUAnalysis::valueLookup (const BNmet* object, string variable, string function, string &stringValue){ |
2484 |
|
|
2485 |
|
double value = 0.0; |
2486 |
|
|
2544 |
|
else if(variable == "pfT1jet10pt") value = object->pfT1jet10pt; |
2545 |
|
else if(variable == "pfT1jet10phi") value = object->pfT1jet10phi; |
2546 |
|
|
2547 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2548 |
< |
|
2547 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2548 |
> |
|
2549 |
> |
value = applyFunction(function, value); |
2550 |
|
|
2551 |
|
return value; |
2552 |
|
} |
2553 |
|
|
2554 |
+ |
//!track valueLookup |
2555 |
|
double |
2556 |
< |
OSUAnalysis::valueLookup (const BNtrack* object, string variable, string function){ |
2556 |
> |
OSUAnalysis::valueLookup (const BNtrack* object, string variable, string function, string &stringValue){ |
2557 |
|
|
2558 |
|
double value = 0.0; |
2559 |
+ |
double pMag = sqrt(object->pt * object->pt + |
2560 |
+ |
object->pz * object->pz); |
2561 |
|
|
2562 |
|
if(variable == "pt") value = object->pt; |
2563 |
|
else if(variable == "px") value = object->px; |
2578 |
|
else if(variable == "isHighPurity") value = object->isHighPurity; |
2579 |
|
|
2580 |
|
|
2581 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2582 |
< |
|
2581 |
> |
//additional BNs info for disappTrks |
2582 |
> |
else if(variable == "caloEMDeltaRp3") value = object->caloEMDeltaRp3; |
2583 |
> |
else if(variable == "caloHadDeltaRp3") value = object->caloHadDeltaRp3; |
2584 |
> |
else if(variable == "caloEMDeltaRp4") value = object->caloEMDeltaRp4; |
2585 |
> |
else if(variable == "caloHadDeltaRp4") value = object->caloHadDeltaRp4; |
2586 |
> |
else if(variable == "caloEMDeltaRp5") value = object->caloEMDeltaRp5; |
2587 |
> |
else if(variable == "caloHadDeltaRp5") value = object->caloHadDeltaRp5; |
2588 |
> |
else if(variable == "nTracksRp5") value = object->nTracksRp5; |
2589 |
> |
else if(variable == "nHitsMissingOuter") value = object->nHitsMissingOuter; |
2590 |
> |
else if(variable == "nHitsMissingInner") value = object->nHitsMissingInner; |
2591 |
> |
else if(variable == "nHitsMissingMiddle") value = object->nHitsMissingMiddle; |
2592 |
> |
else if(variable == "depTrkRp5") value = object->depTrkRp5; |
2593 |
> |
|
2594 |
> |
//user defined variables |
2595 |
> |
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; |
2596 |
> |
else if(variable == "dZwrtBS") value = object->dZ - events->at(0).BSz; |
2597 |
> |
else if(variable == "depTrkRp5MinusPt") value = (object->depTrkRp5 - object->pt); |
2598 |
> |
else if(variable == "caloTotDeltaRp5") value = (object->caloHadDeltaRp5 + object->caloEMDeltaRp5); |
2599 |
> |
else if(variable == "caloTotDeltaRp5ByP") value = ((object->caloHadDeltaRp5 + object->caloEMDeltaRp5)/pMag); |
2600 |
> |
else if(variable == "caloTotDeltaRp5RhoCorr") value = getTrkCaloTotRhoCorr(object); |
2601 |
> |
else if(variable == "caloTotDeltaRp5ByPRhoCorr") value = getTrkCaloTotRhoCorr(object) / pMag; |
2602 |
> |
else if(variable == "isIso") value = getTrkIsIso(object, tracks.product()); |
2603 |
> |
else if(variable == "isMatchedDeadEcal") value = getTrkIsMatchedDeadEcal(object); |
2604 |
> |
else if(variable == "ptErrorByPt") value = (object->ptError/object->pt); |
2605 |
> |
else if(variable == "ptError") value = object->ptError; |
2606 |
> |
else if(variable == "ptRes") value = getTrkPtRes(object); |
2607 |
> |
else if (variable == "d0wrtPV"){ |
2608 |
> |
double vx = object->vx - chosenVertex ()->x, |
2609 |
> |
vy = object->vy - chosenVertex ()->y, |
2610 |
> |
px = object->px, |
2611 |
> |
py = object->py, |
2612 |
> |
pt = object->pt; |
2613 |
> |
value = (-vx * py + vy * px) / pt; |
2614 |
> |
} |
2615 |
> |
else if (variable == "dZwrtPV"){ |
2616 |
> |
double vx = object->vx - chosenVertex ()->x, |
2617 |
> |
vy = object->vy - chosenVertex ()->y, |
2618 |
> |
vz = object->vz - chosenVertex ()->z, |
2619 |
> |
px = object->px, |
2620 |
> |
py = object->py, |
2621 |
> |
pz = object->pz, |
2622 |
> |
pt = object->pt; |
2623 |
> |
value = vz - (vx * px + vy * py)/pt * (pz/pt); |
2624 |
> |
} |
2625 |
> |
|
2626 |
> |
|
2627 |
> |
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
2628 |
> |
|
2629 |
> |
else if(variable == "genMatchedPdgId"){ |
2630 |
> |
int index = getGenMatchedParticleIndex(object); |
2631 |
> |
if(index == -1) value = 0; |
2632 |
> |
else value = mcparticles->at(index).id; |
2633 |
> |
} |
2634 |
> |
|
2635 |
> |
|
2636 |
> |
else if(variable == "genMatchedId"){ |
2637 |
> |
int index = getGenMatchedParticleIndex(object); |
2638 |
> |
if(index == -1) value = 0; |
2639 |
> |
else value = getPdgIdBinValue(mcparticles->at(index).id); |
2640 |
> |
} |
2641 |
> |
else if(variable == "genMatchedMotherId"){ |
2642 |
> |
int index = getGenMatchedParticleIndex(object); |
2643 |
> |
if(index == -1) value = 0; |
2644 |
> |
else value = getPdgIdBinValue(mcparticles->at(index).motherId); |
2645 |
> |
} |
2646 |
> |
else if(variable == "genMatchedMotherIdReverse"){ |
2647 |
> |
int index = getGenMatchedParticleIndex(object); |
2648 |
> |
if(index == -1) value = 24; |
2649 |
> |
else value = 24 -getPdgIdBinValue(mcparticles->at(index).motherId); |
2650 |
> |
} |
2651 |
> |
else if(variable == "genMatchedGrandmotherId"){ |
2652 |
> |
int index = getGenMatchedParticleIndex(object); |
2653 |
> |
if(index == -1) value = 0; |
2654 |
> |
else if(fabs(mcparticles->at(index).motherId) == 15){ |
2655 |
> |
int motherIndex = findTauMotherIndex(&mcparticles->at(index)); |
2656 |
> |
if(motherIndex == -1) value = 0; |
2657 |
> |
else value = getPdgIdBinValue(mcparticles->at(motherIndex).motherId); |
2658 |
> |
} |
2659 |
> |
else value = getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
2660 |
> |
} |
2661 |
> |
else if(variable == "genMatchedGrandmotherIdReverse"){ |
2662 |
> |
int index = getGenMatchedParticleIndex(object); |
2663 |
> |
if(index == -1) value = 24; |
2664 |
> |
else if(fabs(mcparticles->at(index).motherId) == 15){ |
2665 |
> |
int motherIndex = findTauMotherIndex(&mcparticles->at(index)); |
2666 |
> |
if(motherIndex == -1) value = 24; |
2667 |
> |
else value = 24 - getPdgIdBinValue(mcparticles->at(motherIndex).motherId); |
2668 |
> |
} |
2669 |
> |
else value = 24 - getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
2670 |
> |
} |
2671 |
> |
|
2672 |
> |
|
2673 |
> |
|
2674 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2675 |
> |
|
2676 |
> |
value = applyFunction(function, value); |
2677 |
|
|
2678 |
|
return value; |
2679 |
|
} |
2680 |
|
|
2681 |
+ |
//!genjet valueLookup |
2682 |
|
double |
2683 |
< |
OSUAnalysis::valueLookup (const BNgenjet* object, string variable, string function){ |
2683 |
> |
OSUAnalysis::valueLookup (const BNgenjet* object, string variable, string function, string &stringValue){ |
2684 |
|
|
2685 |
|
double value = 0.0; |
2686 |
|
|
2700 |
|
else if(variable == "charge") value = object->charge; |
2701 |
|
|
2702 |
|
|
2703 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2704 |
< |
|
2703 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2704 |
> |
|
2705 |
> |
value = applyFunction(function, value); |
2706 |
|
|
2707 |
|
return value; |
2708 |
|
} |
2709 |
|
|
2710 |
+ |
//!mcparticle valueLookup |
2711 |
|
double |
2712 |
< |
OSUAnalysis::valueLookup (const BNmcparticle* object, string variable, string function){ |
2712 |
> |
OSUAnalysis::valueLookup (const BNmcparticle* object, string variable, string function, string &stringValue){ |
2713 |
|
|
2714 |
|
double value = 0.0; |
2715 |
|
|
2798 |
|
else if(variable == "grandMother11Status") value = object->grandMother11Status; |
2799 |
|
else if(variable == "grandMother11Charge") value = object->grandMother11Charge; |
2800 |
|
|
2801 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2802 |
< |
|
2801 |
> |
//user-defined variables |
2802 |
> |
else if (variable == "d0"){ |
2803 |
> |
double vx = object->vx - chosenVertex ()->x, |
2804 |
> |
vy = object->vy - chosenVertex ()->y, |
2805 |
> |
px = object->px, |
2806 |
> |
py = object->py, |
2807 |
> |
pt = object->pt; |
2808 |
> |
value = (-vx * py + vy * px) / pt; |
2809 |
> |
} |
2810 |
> |
else if (variable == "dz"){ |
2811 |
> |
double vx = object->vx - chosenVertex ()->x, |
2812 |
> |
vy = object->vy - chosenVertex ()->y, |
2813 |
> |
vz = object->vz - chosenVertex ()->z, |
2814 |
> |
px = object->px, |
2815 |
> |
py = object->py, |
2816 |
> |
pz = object->pz, |
2817 |
> |
pt = object->pt; |
2818 |
> |
value = vz - (vx * px + vy * py)/pt * (pz/pt); |
2819 |
> |
} |
2820 |
> |
else if(variable == "v0"){ |
2821 |
> |
value = sqrt(object->vx*object->vx + object->vy*object->vy); |
2822 |
> |
} |
2823 |
> |
else if(variable == "deltaV0"){ |
2824 |
> |
value = sqrt((object->vx-chosenVertex ()->x)*(object->vx-chosenVertex ()->x) + (object->vy-chosenVertex ()->y)*(object->vy-chosenVertex ()->y)); |
2825 |
> |
} |
2826 |
> |
else if (variable == "deltaVx"){ |
2827 |
> |
value = object->vx - chosenVertex ()->x; |
2828 |
> |
} |
2829 |
> |
else if (variable == "deltaVy"){ |
2830 |
> |
value = object->vy - chosenVertex ()->y; |
2831 |
> |
} |
2832 |
> |
else if (variable == "deltaVz"){ |
2833 |
> |
value = object->vz - chosenVertex ()->z; |
2834 |
> |
} |
2835 |
> |
|
2836 |
> |
|
2837 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2838 |
> |
|
2839 |
> |
value = applyFunction(function, value); |
2840 |
|
|
2841 |
|
return value; |
2842 |
|
} |
2843 |
|
|
2844 |
+ |
//!primaryvertex valueLookup |
2845 |
|
double |
2846 |
< |
OSUAnalysis::valueLookup (const BNprimaryvertex* object, string variable, string function){ |
2846 |
> |
OSUAnalysis::valueLookup (const BNprimaryvertex* object, string variable, string function, string &stringValue){ |
2847 |
|
|
2848 |
|
double value = 0.0; |
2849 |
|
|
2862 |
|
else if(variable == "isGood") value = object->isGood; |
2863 |
|
|
2864 |
|
|
2865 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2866 |
< |
|
2865 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2866 |
> |
|
2867 |
> |
value = applyFunction(function, value); |
2868 |
|
|
2869 |
|
return value; |
2870 |
|
} |
2871 |
|
|
2872 |
+ |
//!bxlumi valueLookup |
2873 |
|
double |
2874 |
< |
OSUAnalysis::valueLookup (const BNbxlumi* object, string variable, string function){ |
2874 |
> |
OSUAnalysis::valueLookup (const BNbxlumi* object, string variable, string function, string &stringValue){ |
2875 |
|
|
2876 |
|
double value = 0.0; |
2877 |
|
|
2880 |
|
else if(variable == "bx_LUMI_now") value = object->bx_LUMI_now; |
2881 |
|
|
2882 |
|
|
2883 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2884 |
< |
|
2883 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2884 |
> |
|
2885 |
> |
value = applyFunction(function, value); |
2886 |
|
|
2887 |
|
return value; |
2888 |
|
} |
2889 |
|
|
2890 |
+ |
//!photon valueLookup |
2891 |
|
double |
2892 |
< |
OSUAnalysis::valueLookup (const BNphoton* object, string variable, string function){ |
2892 |
> |
OSUAnalysis::valueLookup (const BNphoton* object, string variable, string function, string &stringValue){ |
2893 |
|
|
2894 |
|
double value = 0.0; |
2895 |
|
|
2964 |
|
else if(variable == "seedRecoFlag") value = object->seedRecoFlag; |
2965 |
|
|
2966 |
|
|
2967 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2968 |
< |
|
2967 |
> |
|
2968 |
> |
|
2969 |
> |
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
2970 |
> |
|
2971 |
> |
else if(variable == "genMatchedPdgId"){ |
2972 |
> |
int index = getGenMatchedParticleIndex(object); |
2973 |
> |
if(index == -1) value = 0; |
2974 |
> |
else value = mcparticles->at(index).id; |
2975 |
> |
} |
2976 |
> |
|
2977 |
> |
|
2978 |
> |
|
2979 |
> |
else if(variable == "genMatchedId"){ |
2980 |
> |
int index = getGenMatchedParticleIndex(object); |
2981 |
> |
if(index == -1) value = 0; |
2982 |
> |
else value = getPdgIdBinValue(mcparticles->at(index).id); |
2983 |
> |
} |
2984 |
> |
else if(variable == "genMatchedMotherId"){ |
2985 |
> |
int index = getGenMatchedParticleIndex(object); |
2986 |
> |
if(index == -1) value = 0; |
2987 |
> |
else value = getPdgIdBinValue(mcparticles->at(index).motherId); |
2988 |
> |
} |
2989 |
> |
else if(variable == "genMatchedMotherIdReverse"){ |
2990 |
> |
int index = getGenMatchedParticleIndex(object); |
2991 |
> |
if(index == -1) value = 24; |
2992 |
> |
else value = 24 -getPdgIdBinValue(mcparticles->at(index).motherId); |
2993 |
> |
} |
2994 |
> |
else if(variable == "genMatchedGrandmotherId"){ |
2995 |
> |
int index = getGenMatchedParticleIndex(object); |
2996 |
> |
if(index == -1) value = 0; |
2997 |
> |
else if(fabs(mcparticles->at(index).motherId) == 15){ |
2998 |
> |
int motherIndex = findTauMotherIndex(&mcparticles->at(index)); |
2999 |
> |
if(motherIndex == -1) value = 0; |
3000 |
> |
else value = getPdgIdBinValue(mcparticles->at(motherIndex).motherId); |
3001 |
> |
} |
3002 |
> |
else value = getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
3003 |
> |
} |
3004 |
> |
else if(variable == "genMatchedGrandmotherIdReverse"){ |
3005 |
> |
int index = getGenMatchedParticleIndex(object); |
3006 |
> |
if(index == -1) value = 24; |
3007 |
> |
else if(fabs(mcparticles->at(index).motherId) == 15){ |
3008 |
> |
int motherIndex = findTauMotherIndex(&mcparticles->at(index)); |
3009 |
> |
if(motherIndex == -1) value = 24; |
3010 |
> |
else value = 24 - getPdgIdBinValue(mcparticles->at(motherIndex).motherId); |
3011 |
> |
} |
3012 |
> |
else value = 24 - getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
3013 |
> |
} |
3014 |
> |
|
3015 |
> |
|
3016 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3017 |
> |
|
3018 |
> |
value = applyFunction(function, value); |
3019 |
|
|
3020 |
|
return value; |
3021 |
|
} |
3022 |
|
|
3023 |
+ |
//!supercluster valueLookup |
3024 |
|
double |
3025 |
< |
OSUAnalysis::valueLookup (const BNsupercluster* object, string variable, string function){ |
3025 |
> |
OSUAnalysis::valueLookup (const BNsupercluster* object, string variable, string function, string &stringValue){ |
3026 |
|
|
3027 |
|
double value = 0.0; |
3028 |
|
|
3036 |
|
else if(variable == "theta") value = object->theta; |
3037 |
|
|
3038 |
|
|
3039 |
+ |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3040 |
+ |
|
3041 |
+ |
value = applyFunction(function, value); |
3042 |
+ |
|
3043 |
+ |
return value; |
3044 |
+ |
} |
3045 |
+ |
|
3046 |
+ |
//!trigobj valueLookup |
3047 |
+ |
double |
3048 |
+ |
OSUAnalysis::valueLookup (const BNtrigobj* object, string variable, string function, string &stringValue){ |
3049 |
+ |
|
3050 |
+ |
double value = 0.0; |
3051 |
+ |
|
3052 |
+ |
if(variable == "pt") value = object->pt; |
3053 |
+ |
else if(variable == "eta") value = object->eta; |
3054 |
+ |
else if(variable == "phi") value = object->phi; |
3055 |
+ |
else if(variable == "px") value = object->px; |
3056 |
+ |
else if(variable == "py") value = object->py; |
3057 |
+ |
else if(variable == "pz") value = object->pz; |
3058 |
+ |
else if(variable == "et") value = object->et; |
3059 |
+ |
else if(variable == "energy") value = object->energy; |
3060 |
+ |
else if(variable == "etTotal") value = object->etTotal; |
3061 |
+ |
else if(variable == "id") value = object->id; |
3062 |
+ |
else if(variable == "charge") value = object->charge; |
3063 |
+ |
else if(variable == "isIsolated") value = object->isIsolated; |
3064 |
+ |
else if(variable == "isMip") value = object->isMip; |
3065 |
+ |
else if(variable == "isForward") value = object->isForward; |
3066 |
+ |
else if(variable == "isRPC") value = object->isRPC; |
3067 |
+ |
else if(variable == "bx") value = object->bx; |
3068 |
+ |
else if(variable == "filter") { |
3069 |
+ |
if ((stringValue = object->filter) == "") |
3070 |
+ |
stringValue = "none"; // stringValue should only be empty if value is filled |
3071 |
+ |
} |
3072 |
+ |
|
3073 |
+ |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3074 |
+ |
|
3075 |
+ |
value = applyFunction(function, value); |
3076 |
+ |
|
3077 |
+ |
return value; |
3078 |
+ |
} |
3079 |
+ |
|
3080 |
+ |
//!muon-muon pair valueLookup |
3081 |
+ |
double |
3082 |
+ |
OSUAnalysis::valueLookup (const BNmuon* object1, const BNmuon* object2, string variable, string function, string &stringValue){ |
3083 |
+ |
|
3084 |
+ |
double value = 0.0; |
3085 |
+ |
|
3086 |
+ |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
3087 |
+ |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
3088 |
+ |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3089 |
+ |
else if(variable == "invMass"){ |
3090 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
3091 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
3092 |
+ |
value = (fourVector1 + fourVector2).M(); |
3093 |
+ |
} |
3094 |
+ |
else if(variable == "pt"){ |
3095 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
3096 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
3097 |
+ |
value = (fourVector1 + fourVector2).Pt(); |
3098 |
+ |
} |
3099 |
+ |
else if(variable == "threeDAngle") |
3100 |
+ |
{ |
3101 |
+ |
TVector3 threeVector1(object1->px, object1->py, object1->pz); |
3102 |
+ |
TVector3 threeVector2(object2->px, object2->py, object2->pz); |
3103 |
+ |
value = (threeVector1.Angle(threeVector2)); |
3104 |
+ |
} |
3105 |
+ |
else if(variable == "alpha") |
3106 |
+ |
{ |
3107 |
+ |
static const double pi = 3.1415926535897932384626433832795028841971693993751058; |
3108 |
+ |
TVector3 threeVector1(object1->px, object1->py, object1->pz); |
3109 |
+ |
TVector3 threeVector2(object2->px, object2->py, object2->pz); |
3110 |
+ |
value = (pi-threeVector1.Angle(threeVector2)); |
3111 |
+ |
} |
3112 |
+ |
else if(variable == "deltaCorrectedD0Vertex") value = object1->correctedD0Vertex - object2->correctedD0Vertex; |
3113 |
+ |
else if(variable == "deltaAbsCorrectedD0Vertex") value = fabs(object1->correctedD0Vertex) - fabs(object2->correctedD0Vertex); |
3114 |
+ |
else if(variable == "d0Sign"){ |
3115 |
+ |
double d0Sign = (object1->correctedD0Vertex*object2->correctedD0Vertex)/fabs(object1->correctedD0Vertex*object2->correctedD0Vertex); |
3116 |
+ |
if(d0Sign < 0) value = -0.5; |
3117 |
+ |
else if (d0Sign > 0) value = 0.5; |
3118 |
+ |
else value = -999; |
3119 |
+ |
} |
3120 |
+ |
else if(variable == "chargeProduct"){ |
3121 |
+ |
value = object1->charge*object2->charge; |
3122 |
+ |
} |
3123 |
+ |
else if(variable == "muon1CorrectedD0Vertex"){ |
3124 |
+ |
value = object1->correctedD0Vertex; |
3125 |
+ |
} |
3126 |
+ |
else if(variable == "muon2CorrectedD0Vertex"){ |
3127 |
+ |
value = object2->correctedD0Vertex; |
3128 |
+ |
} |
3129 |
+ |
else if(variable == "muon1timeAtIpInOut"){ |
3130 |
+ |
value = object1->timeAtIpInOut; |
3131 |
+ |
} |
3132 |
+ |
else if(variable == "muon2timeAtIpInOut"){ |
3133 |
+ |
value = object2->timeAtIpInOut; |
3134 |
+ |
} |
3135 |
+ |
else if(variable == "muon1correctedD0") |
3136 |
+ |
{ |
3137 |
+ |
value = object1->correctedD0; |
3138 |
+ |
} |
3139 |
+ |
else if(variable == "muon2correctedD0") |
3140 |
+ |
{ |
3141 |
+ |
value = object2->correctedD0; |
3142 |
+ |
} |
3143 |
+ |
|
3144 |
+ |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3145 |
+ |
|
3146 |
+ |
value = applyFunction(function, value); |
3147 |
+ |
|
3148 |
+ |
return value; |
3149 |
+ |
} |
3150 |
+ |
|
3151 |
+ |
//!muon-photon pair valueLookup |
3152 |
+ |
double |
3153 |
+ |
OSUAnalysis::valueLookup (const BNmuon* object1, const BNphoton* object2, string variable, string function, string &stringValue){ |
3154 |
+ |
|
3155 |
+ |
double value = 0.0; |
3156 |
+ |
|
3157 |
+ |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
3158 |
+ |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
3159 |
+ |
else if(variable == "photonEta") value = object2->eta; |
3160 |
+ |
else if(variable == "muonEta") value = object1->eta; |
3161 |
+ |
else if(variable == "photonPhi") value = object2->phi; |
3162 |
+ |
else if(variable == "muonPhi") value = object1->phi; |
3163 |
+ |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3164 |
+ |
else if(variable == "photonGenMotherId") value = object2->genMotherId; |
3165 |
+ |
else if(variable == "muonRelPFdBetaIso") value = (object1->pfIsoR04SumChargedHadronPt + max(0.0, object1->pfIsoR04SumNeutralHadronEt + object1->pfIsoR04SumPhotonEt - 0.5*object1->pfIsoR04SumPUPt)) / object1->pt; |
3166 |
+ |
else if(variable == "invMass"){ |
3167 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
3168 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
3169 |
+ |
value = (fourVector1 + fourVector2).M(); |
3170 |
+ |
} |
3171 |
+ |
else if(variable == "pt"){ |
3172 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
3173 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
3174 |
+ |
value = (fourVector1 + fourVector2).Pt(); |
3175 |
+ |
} |
3176 |
+ |
else if(variable == "threeDAngle") |
3177 |
+ |
{ |
3178 |
+ |
TVector3 threeVector1(object1->px, object1->py, object1->pz); |
3179 |
+ |
TVector3 threeVector2(object2->px, object2->py, object2->pz); |
3180 |
+ |
value = (threeVector1.Angle(threeVector2)); |
3181 |
+ |
} |
3182 |
+ |
else if(variable == "alpha") |
3183 |
+ |
{ |
3184 |
+ |
static const double pi = 3.1415926535897932384626433832795028841971693993751058; |
3185 |
+ |
TVector3 threeVector1(object1->px, object1->py, object1->pz); |
3186 |
+ |
TVector3 threeVector2(object2->px, object2->py, object2->pz); |
3187 |
+ |
value = (pi-threeVector1.Angle(threeVector2)); |
3188 |
+ |
} |
3189 |
+ |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3190 |
+ |
|
3191 |
+ |
value = applyFunction(function, value); |
3192 |
+ |
|
3193 |
+ |
return value; |
3194 |
+ |
} |
3195 |
+ |
|
3196 |
+ |
//!electron-photon pair valueLookup |
3197 |
+ |
double |
3198 |
+ |
OSUAnalysis::valueLookup (const BNelectron* object1, const BNphoton* object2, string variable, string function, string &stringValue){ |
3199 |
+ |
|
3200 |
+ |
double value = 0.0; |
3201 |
+ |
|
3202 |
+ |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
3203 |
+ |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
3204 |
+ |
else if(variable == "photonEta") value = object2->eta; |
3205 |
+ |
else if(variable == "electronEta") value = object1->eta; |
3206 |
+ |
else if(variable == "photonPhi") value = object2->phi; |
3207 |
+ |
else if(variable == "electronPhi") value = object1->phi; |
3208 |
+ |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3209 |
+ |
else if(variable == "photonGenMotherId") value = object2->genMotherId; |
3210 |
+ |
else if(variable == "electronRelPFrhoIso") value = ( object1->chargedHadronIsoDR03 + max(0.0, object1->neutralHadronIsoDR03 + object1->photonIsoDR03 - object1->AEffDr03*object1->rhoPrime) ) / object1->pt; |
3211 |
+ |
else if(variable == "invMass"){ |
3212 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
3213 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
3214 |
+ |
value = (fourVector1 + fourVector2).M(); |
3215 |
+ |
} |
3216 |
+ |
else if(variable == "pt"){ |
3217 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
3218 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
3219 |
+ |
value = (fourVector1 + fourVector2).Pt(); |
3220 |
+ |
} |
3221 |
+ |
else if(variable == "threeDAngle") |
3222 |
+ |
{ |
3223 |
+ |
TVector3 threeVector1(object1->px, object1->py, object1->pz); |
3224 |
+ |
TVector3 threeVector2(object2->px, object2->py, object2->pz); |
3225 |
+ |
value = (threeVector1.Angle(threeVector2)); |
3226 |
+ |
} |
3227 |
+ |
else if(variable == "alpha") |
3228 |
+ |
{ |
3229 |
+ |
static const double pi = 3.1415926535897932384626433832795028841971693993751058; |
3230 |
+ |
TVector3 threeVector1(object1->px, object1->py, object1->pz); |
3231 |
+ |
TVector3 threeVector2(object2->px, object2->py, object2->pz); |
3232 |
+ |
value = (pi-threeVector1.Angle(threeVector2)); |
3233 |
+ |
} |
3234 |
+ |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3235 |
+ |
|
3236 |
+ |
value = applyFunction(function, value); |
3237 |
+ |
|
3238 |
+ |
return value; |
3239 |
+ |
} |
3240 |
+ |
|
3241 |
+ |
//!electron-electron pair valueLookup |
3242 |
+ |
double |
3243 |
+ |
OSUAnalysis::valueLookup (const BNelectron* object1, const BNelectron* object2, string variable, string function, string &stringValue){ |
3244 |
+ |
|
3245 |
+ |
double value = 0.0; |
3246 |
+ |
|
3247 |
+ |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
3248 |
+ |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
3249 |
+ |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3250 |
+ |
else if(variable == "invMass"){ |
3251 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
3252 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
3253 |
+ |
value = (fourVector1 + fourVector2).M(); |
3254 |
+ |
} |
3255 |
+ |
else if(variable == "pt"){ |
3256 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
3257 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
3258 |
+ |
value = (fourVector1 + fourVector2).Pt(); |
3259 |
+ |
} |
3260 |
+ |
else if(variable == "threeDAngle") |
3261 |
+ |
{ |
3262 |
+ |
TVector3 threeVector1(object1->px, object1->py, object1->pz); |
3263 |
+ |
TVector3 threeVector2(object2->px, object2->py, object2->pz); |
3264 |
+ |
value = (threeVector1.Angle(threeVector2)); |
3265 |
+ |
} |
3266 |
+ |
else if(variable == "deltaCorrectedD0Vertex") value = object1->correctedD0Vertex - object2->correctedD0Vertex; |
3267 |
+ |
else if(variable == "deltaAbsCorrectedD0Vertex") value = fabs(object1->correctedD0Vertex) - fabs(object2->correctedD0Vertex); |
3268 |
+ |
else if(variable == "d0Sign"){ |
3269 |
+ |
double d0Sign = (object1->correctedD0Vertex*object2->correctedD0Vertex)/fabs(object1->correctedD0Vertex*object2->correctedD0Vertex); |
3270 |
+ |
if(d0Sign < 0) value = -0.5; |
3271 |
+ |
else if (d0Sign > 0) value = 0.5; |
3272 |
+ |
else value = -999; |
3273 |
+ |
} |
3274 |
+ |
else if(variable == "chargeProduct"){ |
3275 |
+ |
value = object1->charge*object2->charge; |
3276 |
+ |
} |
3277 |
+ |
else if(variable == "electron1CorrectedD0Vertex"){ |
3278 |
+ |
value = object1->correctedD0Vertex; |
3279 |
+ |
} |
3280 |
+ |
else if(variable == "electron2CorrectedD0Vertex"){ |
3281 |
+ |
value = object2->correctedD0Vertex; |
3282 |
+ |
} |
3283 |
+ |
else if(variable == "electron1CorrectedD0"){ |
3284 |
+ |
value = object1->correctedD0; |
3285 |
+ |
} |
3286 |
+ |
else if(variable == "electron2CorrectedD0"){ |
3287 |
+ |
value = object2->correctedD0; |
3288 |
+ |
} |
3289 |
+ |
|
3290 |
+ |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3291 |
+ |
|
3292 |
+ |
value = applyFunction(function, value); |
3293 |
+ |
|
3294 |
+ |
return value; |
3295 |
+ |
} |
3296 |
+ |
//!electron-muon pair valueLookup |
3297 |
+ |
double |
3298 |
+ |
OSUAnalysis::valueLookup (const BNelectron* object1, const BNmuon* object2, string variable, string function, string &stringValue){ |
3299 |
+ |
|
3300 |
+ |
double value = 0.0; |
3301 |
+ |
|
3302 |
+ |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
3303 |
+ |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
3304 |
+ |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3305 |
+ |
else if(variable == "invMass"){ |
3306 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
3307 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
3308 |
+ |
value = (fourVector1 + fourVector2).M(); |
3309 |
+ |
} |
3310 |
+ |
else if(variable == "pt"){ |
3311 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
3312 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
3313 |
+ |
value = (fourVector1 + fourVector2).Pt(); |
3314 |
+ |
} |
3315 |
+ |
else if(variable == "threeDAngle") |
3316 |
+ |
{ |
3317 |
+ |
TVector3 threeVector1(object1->px, object1->py, object1->pz); |
3318 |
+ |
TVector3 threeVector2(object2->px, object2->py, object2->pz); |
3319 |
+ |
value = (threeVector1.Angle(threeVector2)); |
3320 |
+ |
} |
3321 |
+ |
else if(variable == "deltaCorrectedD0Vertex") value = object1->correctedD0Vertex - object2->correctedD0Vertex; |
3322 |
+ |
else if(variable == "deltaAbsCorrectedD0Vertex") value = fabs(object1->correctedD0Vertex) - fabs(object2->correctedD0Vertex); |
3323 |
+ |
else if(variable == "d0Sign"){ |
3324 |
+ |
double d0Sign = (object1->correctedD0Vertex*object2->correctedD0Vertex)/fabs(object1->correctedD0Vertex*object2->correctedD0Vertex); |
3325 |
+ |
if(d0Sign < 0) value = -0.5; |
3326 |
+ |
else if (d0Sign > 0) value = 0.5; |
3327 |
+ |
else value = -999; |
3328 |
+ |
} |
3329 |
+ |
else if(variable == "chargeProduct"){ |
3330 |
+ |
value = object1->charge*object2->charge; |
3331 |
+ |
} |
3332 |
+ |
else if(variable == "electronCorrectedD0Vertex"){ |
3333 |
+ |
value = object1->correctedD0Vertex; |
3334 |
+ |
} |
3335 |
+ |
else if(variable == "muonCorrectedD0Vertex"){ |
3336 |
+ |
value = object2->correctedD0Vertex; |
3337 |
+ |
} |
3338 |
+ |
else if(variable == "electronCorrectedD0"){ |
3339 |
+ |
value = object1->correctedD0; |
3340 |
+ |
} |
3341 |
+ |
else if(variable == "muonCorrectedD0"){ |
3342 |
+ |
value = object2->correctedD0; |
3343 |
+ |
} |
3344 |
+ |
else if(variable == "electronDetIso"){ |
3345 |
+ |
value = (object1->trackIso) / object1->pt; |
3346 |
+ |
} |
3347 |
+ |
else if(variable == "muonDetIso"){ |
3348 |
+ |
value = (object2->trackIsoDR03) / object2->pt; |
3349 |
+ |
} |
3350 |
+ |
else if(variable == "electronRelPFrhoIso"){ |
3351 |
+ |
value = ( object1->chargedHadronIsoDR03 + max(0.0, object1->neutralHadronIsoDR03 + object1->photonIsoDR03 - object1->AEffDr03*object1->rhoPrime) ) / object1->pt; |
3352 |
+ |
} |
3353 |
+ |
else if(variable == "muonRelPFdBetaIso"){ |
3354 |
+ |
value = (object2->pfIsoR04SumChargedHadronPt + max(0.0, object2->pfIsoR04SumNeutralHadronEt + object2->pfIsoR04SumPhotonEt - 0.5*object2->pfIsoR04SumPUPt)) / object2->pt; |
3355 |
+ |
} |
3356 |
+ |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3357 |
+ |
value = applyFunction(function, value); |
3358 |
+ |
|
3359 |
+ |
return value; |
3360 |
+ |
} |
3361 |
+ |
|
3362 |
+ |
//!electron-jet pair valueLookup |
3363 |
+ |
double |
3364 |
+ |
OSUAnalysis::valueLookup (const BNelectron* object1, const BNjet* object2, string variable, string function, string &stringValue){ |
3365 |
+ |
|
3366 |
+ |
double value = 0.0; |
3367 |
+ |
|
3368 |
+ |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
3369 |
+ |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
3370 |
+ |
else if(variable == "jetEta") value = object2->eta; |
3371 |
+ |
else if(variable == "jetPhi") value = object2->phi; |
3372 |
+ |
else if(variable == "electronEta") value = object1->eta; |
3373 |
+ |
else if(variable == "electronPhi") value = object1->phi; |
3374 |
+ |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3375 |
+ |
else if(variable == "invMass"){ |
3376 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
3377 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
3378 |
+ |
value = (fourVector1 + fourVector2).M(); |
3379 |
+ |
} |
3380 |
+ |
else if(variable == "pt"){ |
3381 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
3382 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
3383 |
+ |
value = (fourVector1 + fourVector2).Pt(); |
3384 |
+ |
} |
3385 |
+ |
else if(variable == "threeDAngle") |
3386 |
+ |
{ |
3387 |
+ |
TVector3 threeVector1(object1->px, object1->py, object1->pz); |
3388 |
+ |
TVector3 threeVector2(object2->px, object2->py, object2->pz); |
3389 |
+ |
value = (threeVector1.Angle(threeVector2)); |
3390 |
+ |
} |
3391 |
+ |
else if(variable == "chargeProduct"){ |
3392 |
+ |
value = object1->charge*object2->charge; |
3393 |
+ |
} |
3394 |
+ |
|
3395 |
+ |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3396 |
+ |
value = applyFunction(function, value); |
3397 |
+ |
|
3398 |
+ |
return value; |
3399 |
+ |
} |
3400 |
+ |
|
3401 |
+ |
//!photon-jet pair valueLookup |
3402 |
+ |
double |
3403 |
+ |
OSUAnalysis::valueLookup (const BNphoton* object1, const BNjet* object2, string variable, string function, string &stringValue){ |
3404 |
+ |
|
3405 |
+ |
double value = 0.0; |
3406 |
+ |
|
3407 |
+ |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
3408 |
+ |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
3409 |
+ |
else if(variable == "jetEta") value = object2->eta; |
3410 |
+ |
else if(variable == "jetPhi") value = object2->phi; |
3411 |
+ |
else if(variable == "photonEta") value = object1->eta; |
3412 |
+ |
else if(variable == "photonPhi") value = object1->phi; |
3413 |
+ |
else if(variable == "photonGenMotherId") value = object1->genMotherId; |
3414 |
+ |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3415 |
+ |
else if(variable == "invMass"){ |
3416 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
3417 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
3418 |
+ |
value = (fourVector1 + fourVector2).M(); |
3419 |
+ |
} |
3420 |
+ |
else if(variable == "pt"){ |
3421 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
3422 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
3423 |
+ |
value = (fourVector1 + fourVector2).Pt(); |
3424 |
+ |
} |
3425 |
+ |
else if(variable == "threeDAngle") |
3426 |
+ |
{ |
3427 |
+ |
TVector3 threeVector1(object1->px, object1->py, object1->pz); |
3428 |
+ |
TVector3 threeVector2(object2->px, object2->py, object2->pz); |
3429 |
+ |
value = (threeVector1.Angle(threeVector2)); |
3430 |
+ |
} |
3431 |
+ |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3432 |
+ |
value = applyFunction(function, value); |
3433 |
+ |
|
3434 |
+ |
return value; |
3435 |
+ |
} |
3436 |
+ |
|
3437 |
+ |
//!muon-jet pair valueLookup |
3438 |
+ |
double |
3439 |
+ |
OSUAnalysis::valueLookup (const BNmuon* object1, const BNjet* object2, string variable, string function, string &stringValue){ |
3440 |
+ |
|
3441 |
+ |
double value = 0.0; |
3442 |
+ |
|
3443 |
+ |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
3444 |
+ |
else if(variable == "jetEta") value = object2->eta; |
3445 |
+ |
else if(variable == "jetPhi") value = object2->phi; |
3446 |
+ |
else if(variable == "muonEta") value = object1->eta; |
3447 |
+ |
else if(variable == "muonPhi") value = object1->phi; |
3448 |
+ |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
3449 |
+ |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3450 |
+ |
else if(variable == "invMass"){ |
3451 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
3452 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
3453 |
+ |
value = (fourVector1 + fourVector2).M(); |
3454 |
+ |
} |
3455 |
+ |
else if(variable == "pt"){ |
3456 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
3457 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
3458 |
+ |
value = (fourVector1 + fourVector2).Pt(); |
3459 |
+ |
} |
3460 |
+ |
else if(variable == "threeDAngle") |
3461 |
+ |
{ |
3462 |
+ |
TVector3 threeVector1(object1->px, object1->py, object1->pz); |
3463 |
+ |
TVector3 threeVector2(object2->px, object2->py, object2->pz); |
3464 |
+ |
value = (threeVector1.Angle(threeVector2)); |
3465 |
+ |
} |
3466 |
+ |
else if(variable == "chargeProduct"){ |
3467 |
+ |
value = object1->charge*object2->charge; |
3468 |
+ |
} |
3469 |
+ |
|
3470 |
+ |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3471 |
+ |
value = applyFunction(function, value); |
3472 |
+ |
|
3473 |
+ |
return value; |
3474 |
+ |
} |
3475 |
+ |
//!jet-jet pair valueLookup |
3476 |
+ |
double |
3477 |
+ |
OSUAnalysis::valueLookup (const BNjet* object1, const BNjet* object2, string variable, string function, string &stringValue){ |
3478 |
+ |
|
3479 |
+ |
double value = 0.0; |
3480 |
+ |
|
3481 |
+ |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
3482 |
+ |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
3483 |
+ |
else if(variable == "absDeltaPt") value = fabs(object1->pt - object2->pt); |
3484 |
+ |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3485 |
+ |
else if(variable == "invMass"){ |
3486 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
3487 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
3488 |
+ |
value = (fourVector1 + fourVector2).M(); |
3489 |
+ |
} |
3490 |
+ |
else if(variable == "pt"){ |
3491 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
3492 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
3493 |
+ |
value = (fourVector1 + fourVector2).Pt(); |
3494 |
+ |
} |
3495 |
+ |
else if(variable == "threeDAngle") |
3496 |
+ |
{ |
3497 |
+ |
TVector3 threeVector1(object1->px, object1->py, object1->pz); |
3498 |
+ |
TVector3 threeVector2(object2->px, object2->py, object2->pz); |
3499 |
+ |
value = (threeVector1.Angle(threeVector2)); |
3500 |
+ |
} |
3501 |
+ |
else if(variable == "chargeProduct"){ |
3502 |
+ |
value = object1->charge*object2->charge; |
3503 |
+ |
} |
3504 |
+ |
|
3505 |
+ |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3506 |
+ |
value = applyFunction(function, value); |
3507 |
+ |
|
3508 |
+ |
return value; |
3509 |
+ |
} |
3510 |
+ |
//!electron-track pair valueLookup |
3511 |
+ |
double |
3512 |
+ |
OSUAnalysis::valueLookup (const BNelectron* object1, const BNtrack* object2, string variable, string function, string &stringValue){ |
3513 |
+ |
double electronMass = 0.000511; |
3514 |
+ |
double value = 0.0; |
3515 |
+ |
TLorentzVector fourVector1(0, 0, 0, 0); |
3516 |
+ |
TLorentzVector fourVector2(0, 0, 0, 0); |
3517 |
+ |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
3518 |
+ |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
3519 |
+ |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3520 |
+ |
else if(variable == "invMass"){ |
3521 |
+ |
fourVector1.SetPtEtaPhiM(object1->pt, object1->eta, object1->phi, electronMass); |
3522 |
+ |
fourVector2.SetPtEtaPhiM(object2->pt, object2->eta, object2->phi, electronMass ); |
3523 |
+ |
|
3524 |
+ |
value = (fourVector1 + fourVector2).M(); |
3525 |
+ |
} |
3526 |
+ |
else if(variable == "chargeProduct"){ |
3527 |
+ |
value = object1->charge*object2->charge; |
3528 |
+ |
} |
3529 |
+ |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3530 |
+ |
value = applyFunction(function, value); |
3531 |
+ |
return value; |
3532 |
+ |
|
3533 |
+ |
} |
3534 |
+ |
|
3535 |
+ |
|
3536 |
+ |
//!muon-track pair valueLookup |
3537 |
+ |
double |
3538 |
+ |
OSUAnalysis::valueLookup (const BNmuon* object1, const BNtrack* object2, string variable, string function, string &stringValue){ |
3539 |
+ |
double pionMass = 0.140; |
3540 |
+ |
double muonMass = 0.106; |
3541 |
+ |
double value = 0.0; |
3542 |
+ |
TLorentzVector fourVector1(0, 0, 0, 0); |
3543 |
+ |
TLorentzVector fourVector2(0, 0, 0, 0); |
3544 |
+ |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
3545 |
+ |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
3546 |
+ |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3547 |
+ |
else if(variable == "invMass"){ |
3548 |
+ |
fourVector1.SetPtEtaPhiM(object1->pt, object1->eta, object1->phi, muonMass); |
3549 |
+ |
fourVector2.SetPtEtaPhiM(object2->pt, object2->eta, object2->phi, pionMass ); |
3550 |
+ |
|
3551 |
+ |
value = (fourVector1 + fourVector2).M(); |
3552 |
+ |
} |
3553 |
+ |
else if(variable == "chargeProduct"){ |
3554 |
+ |
value = object1->charge*object2->charge; |
3555 |
+ |
} |
3556 |
+ |
|
3557 |
|
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3558 |
< |
|
3558 |
> |
value = applyFunction(function, value); |
3559 |
> |
return value; |
3560 |
> |
} |
3561 |
> |
|
3562 |
> |
//!tau-tau pair valueLookup |
3563 |
> |
double |
3564 |
> |
OSUAnalysis::valueLookup (const BNtau* object1, const BNtau* object2, string variable, string function, string &stringValue){ |
3565 |
> |
double value = 0.0; |
3566 |
> |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
3567 |
> |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
3568 |
> |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3569 |
> |
else if(variable == "invMass"){ |
3570 |
> |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
3571 |
> |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
3572 |
> |
value = (fourVector1 + fourVector2).M(); |
3573 |
> |
} |
3574 |
> |
|
3575 |
> |
else if(variable == "chargeProduct"){ |
3576 |
> |
value = object1->charge*object2->charge; |
3577 |
> |
} |
3578 |
|
|
3579 |
+ |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3580 |
+ |
value = applyFunction(function, value); |
3581 |
+ |
return value; |
3582 |
+ |
} |
3583 |
+ |
|
3584 |
+ |
//!muon-tau pair valueLookup |
3585 |
+ |
double |
3586 |
+ |
OSUAnalysis::valueLookup (const BNmuon* object1, const BNtau* object2, string variable, string function, string &stringValue){ |
3587 |
+ |
double value = 0.0; |
3588 |
+ |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
3589 |
+ |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
3590 |
+ |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3591 |
+ |
else if(variable == "invMass"){ |
3592 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
3593 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
3594 |
+ |
value = (fourVector1 + fourVector2).M(); |
3595 |
+ |
} |
3596 |
+ |
|
3597 |
+ |
else if(variable == "chargeProduct"){ |
3598 |
+ |
value = object1->charge*object2->charge; |
3599 |
+ |
} |
3600 |
+ |
|
3601 |
+ |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3602 |
+ |
value = applyFunction(function, value); |
3603 |
|
return value; |
3604 |
|
} |
3605 |
|
|
3606 |
+ |
//!tau-track pair valueLookup |
3607 |
+ |
double |
3608 |
+ |
OSUAnalysis::valueLookup (const BNtau* object1, const BNtrack* object2, string variable, string function, string &stringValue){ |
3609 |
+ |
double value = 0.0; |
3610 |
+ |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
3611 |
+ |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3612 |
+ |
else if(variable == "chargeProduct"){ |
3613 |
+ |
value = object1->charge*object2->charge; |
3614 |
+ |
} |
3615 |
+ |
|
3616 |
+ |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3617 |
+ |
value = applyFunction(function, value); |
3618 |
+ |
return value; |
3619 |
+ |
} |
3620 |
+ |
|
3621 |
+ |
|
3622 |
+ |
//!track-event pair valueLookup |
3623 |
+ |
double |
3624 |
+ |
OSUAnalysis::valueLookup (const BNtrack* object1, const BNevent* object2, string variable, string function, string &stringValue){ |
3625 |
+ |
|
3626 |
+ |
double value = 0.0; |
3627 |
+ |
double pMag = sqrt(object1->pt * object1->pt + |
3628 |
+ |
object1->pz * object1->pz); |
3629 |
+ |
|
3630 |
+ |
if (variable == "numPV") value = object2->numPV; |
3631 |
+ |
else if (variable == "caloTotDeltaRp5") value = (object1->caloHadDeltaRp5 + object1->caloEMDeltaRp5); |
3632 |
+ |
else if (variable == "caloTotDeltaRp5ByP") value = ((object1->caloHadDeltaRp5 + object1->caloEMDeltaRp5)/pMag); |
3633 |
+ |
else if (variable == "caloTotDeltaRp5_RhoCorr") value = getTrkCaloTotRhoCorr(object1); |
3634 |
+ |
else if (variable == "caloTotDeltaRp5ByP_RhoCorr") value = getTrkCaloTotRhoCorr(object1) / pMag; |
3635 |
+ |
|
3636 |
+ |
else { cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999; } |
3637 |
+ |
|
3638 |
+ |
value = applyFunction(function, value); |
3639 |
+ |
|
3640 |
+ |
return value; |
3641 |
+ |
|
3642 |
+ |
} |
3643 |
+ |
|
3644 |
+ |
//!electron-trigobj pair valueLookup |
3645 |
+ |
double |
3646 |
+ |
OSUAnalysis::valueLookup (const BNelectron* object1, const BNtrigobj* object2, string variable, string function, string &stringValue){ |
3647 |
+ |
|
3648 |
+ |
double value = 0.0; |
3649 |
+ |
|
3650 |
+ |
if (variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3651 |
+ |
else if (variable == "match"){ |
3652 |
+ |
if (deltaR(object1->eta,object1->phi,object2->eta,object2->phi) < 0.2 && abs(object2->id) == 11) |
3653 |
+ |
stringValue = object2->filter; |
3654 |
+ |
else |
3655 |
+ |
stringValue = "none"; |
3656 |
+ |
} |
3657 |
+ |
|
3658 |
+ |
else { cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999; } |
3659 |
+ |
|
3660 |
+ |
value = applyFunction(function, value); |
3661 |
+ |
|
3662 |
+ |
return value; |
3663 |
+ |
|
3664 |
+ |
} |
3665 |
|
|
3666 |
< |
template <class InputCollection> |
3666 |
> |
//!muon-trigobj pair valueLookup |
3667 |
> |
double |
3668 |
> |
OSUAnalysis::valueLookup (const BNmuon* object1, const BNtrigobj* object2, string variable, string function, string &stringValue){ |
3669 |
> |
|
3670 |
> |
double value = 0.0; |
3671 |
> |
|
3672 |
> |
if (variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3673 |
> |
|
3674 |
> |
else { cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999; } |
3675 |
> |
|
3676 |
> |
value = applyFunction(function, value); |
3677 |
> |
|
3678 |
> |
return value; |
3679 |
> |
|
3680 |
> |
} |
3681 |
> |
|
3682 |
> |
//!stop valueLookup |
3683 |
> |
double |
3684 |
> |
OSUAnalysis::valueLookup (const BNstop* object, string variable, string function, string &stringValue){ |
3685 |
> |
|
3686 |
> |
|
3687 |
> |
double value = 0.0; |
3688 |
> |
|
3689 |
> |
if(variable == "ctau") value = object->ctau; |
3690 |
> |
|
3691 |
> |
else if (variable == "d0"){ |
3692 |
> |
double vx = object->vx - chosenVertex ()->x, |
3693 |
> |
vy = object->vy - chosenVertex ()->y, |
3694 |
> |
px = object->px, |
3695 |
> |
py = object->py, |
3696 |
> |
pt = object->pt; |
3697 |
> |
value = (-vx * py + vy * px) / pt; |
3698 |
> |
} |
3699 |
> |
|
3700 |
> |
else if (variable == "dz"){ |
3701 |
> |
double vx = object->vx - chosenVertex ()->x, |
3702 |
> |
vy = object->vy - chosenVertex ()->y, |
3703 |
> |
vz = object->vz - chosenVertex ()->z, |
3704 |
> |
px = object->px, |
3705 |
> |
py = object->py, |
3706 |
> |
pz = object->pz, |
3707 |
> |
pt = object->pt; |
3708 |
> |
value = vz - (vx * px + vy * py)/pt * (pz/pt); |
3709 |
> |
} |
3710 |
> |
|
3711 |
> |
else if (variable == "minD0"){ |
3712 |
> |
double minD0=999; |
3713 |
> |
for(BNprimaryvertexCollection::const_iterator vertex = primaryvertexs->begin (); vertex != primaryvertexs->end (); vertex++){ |
3714 |
> |
double vx = object->vx - vertex->x, |
3715 |
> |
vy = object->vy - vertex->y, |
3716 |
> |
px = object->px, |
3717 |
> |
py = object->py, |
3718 |
> |
pt = object->pt; |
3719 |
> |
value = (-vx * py + vy * px) / pt; |
3720 |
> |
if(abs(value) < abs(minD0)) minD0 = value; |
3721 |
> |
} |
3722 |
> |
value = minD0; |
3723 |
> |
} |
3724 |
> |
else if (variable == "minDz"){ |
3725 |
> |
double minDz=999; |
3726 |
> |
for(BNprimaryvertexCollection::const_iterator vertex = primaryvertexs->begin (); vertex != primaryvertexs->end (); vertex++){ |
3727 |
> |
double vx = object->vx - vertex->x, |
3728 |
> |
vy = object->vy - vertex->y, |
3729 |
> |
vz = object->vz - vertex->z, |
3730 |
> |
px = object->px, |
3731 |
> |
py = object->py, |
3732 |
> |
pz = object->pz, |
3733 |
> |
pt = object->pt; |
3734 |
> |
value = vz - (vx * px + vy * py)/pt * (pz/pt); |
3735 |
> |
if(abs(value) < abs(minDz)) minDz = value; |
3736 |
> |
} |
3737 |
> |
value = minDz; |
3738 |
> |
} |
3739 |
> |
else if(variable == "distToVertex"){ |
3740 |
> |
value = sqrt((object->vx-chosenVertex()->x)*(object->vx-chosenVertex()->x) + \ |
3741 |
> |
(object->vy-chosenVertex()->y)*(object->vy-chosenVertex()->y) + \ |
3742 |
> |
(object->vz-chosenVertex()->z)*(object->vz-chosenVertex()->z)); |
3743 |
> |
} |
3744 |
> |
else if (variable == "minDistToVertex"){ |
3745 |
> |
double minDistToVertex=999; |
3746 |
> |
for(BNprimaryvertexCollection::const_iterator vertex = primaryvertexs->begin (); vertex != primaryvertexs->end (); vertex++){ |
3747 |
> |
value = sqrt((object->vx-vertex->x)*(object->vx-vertex->x) + \ |
3748 |
> |
(object->vy-vertex->y)*(object->vy-vertex->y) + \ |
3749 |
> |
(object->vz-vertex->z)*(object->vz-vertex->z)); |
3750 |
> |
|
3751 |
> |
if(abs(value) < abs(minDistToVertex)) minDistToVertex = value; |
3752 |
> |
} |
3753 |
> |
value = minDistToVertex; |
3754 |
> |
} |
3755 |
> |
else if (variable == "distToVertexDifference"){ |
3756 |
> |
double minDistToVertex=999; |
3757 |
> |
for(BNprimaryvertexCollection::const_iterator vertex = primaryvertexs->begin (); vertex != primaryvertexs->end (); vertex++){ |
3758 |
> |
value = sqrt((object->vx-vertex->x)*(object->vx-vertex->x) + \ |
3759 |
> |
(object->vy-vertex->y)*(object->vy-vertex->y) + \ |
3760 |
> |
(object->vz-vertex->z)*(object->vz-vertex->z)); |
3761 |
> |
|
3762 |
> |
if(abs(value) < abs(minDistToVertex)) minDistToVertex = value; |
3763 |
> |
} |
3764 |
> |
double distToChosenVertex = sqrt((object->vx-chosenVertex()->x)*(object->vx-chosenVertex()->x) + \ |
3765 |
> |
(object->vy-chosenVertex()->y)*(object->vy-chosenVertex()->y) + \ |
3766 |
> |
(object->vz-chosenVertex()->z)*(object->vz-chosenVertex()->z)); |
3767 |
> |
|
3768 |
> |
value = distToChosenVertex - minDistToVertex; |
3769 |
> |
} |
3770 |
> |
|
3771 |
> |
else if (variable == "closestVertexRank"){ |
3772 |
> |
double minDistToVertex=999; |
3773 |
> |
int vertex_rank = 0; |
3774 |
> |
for(BNprimaryvertexCollection::const_iterator vertex = primaryvertexs->begin (); vertex != primaryvertexs->end (); vertex++){ |
3775 |
> |
vertex_rank++; |
3776 |
> |
int dist = sqrt((object->vx-vertex->x)*(object->vx-vertex->x) + \ |
3777 |
> |
(object->vy-vertex->y)*(object->vy-vertex->y) + \ |
3778 |
> |
(object->vz-vertex->z)*(object->vz-vertex->z)); |
3779 |
> |
|
3780 |
> |
if(abs(dist) < abs(minDistToVertex)){ |
3781 |
> |
value = vertex_rank; |
3782 |
> |
minDistToVertex = dist; |
3783 |
> |
} |
3784 |
> |
} |
3785 |
> |
} |
3786 |
> |
|
3787 |
> |
|
3788 |
> |
|
3789 |
> |
|
3790 |
> |
else { cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999; } |
3791 |
> |
|
3792 |
> |
value = applyFunction(function, value); |
3793 |
> |
|
3794 |
> |
return value; |
3795 |
> |
|
3796 |
> |
} |
3797 |
> |
|
3798 |
> |
|
3799 |
> |
|
3800 |
> |
|
3801 |
> |
// Calculate the number of tracks in cone of DeltaR<0.5 around track1. |
3802 |
> |
// Return true iff no other tracks are found in this cone. |
3803 |
> |
int |
3804 |
> |
OSUAnalysis::getTrkIsIso (const BNtrack* track1, const BNtrackCollection* trackColl){ |
3805 |
> |
for(BNtrackCollection::const_iterator track2 = trackColl->begin(); track2 !=trackColl->end(); track2++){ |
3806 |
> |
if(track1->eta == track2->eta && track1->phi == track2->phi) continue; // Do not compare the track to itself. |
3807 |
> |
double deltaRtrk = deltaR(track1->eta, track1->phi, track2->eta, track2->phi); |
3808 |
> |
if(deltaRtrk < 0.5) return 0; |
3809 |
> |
} |
3810 |
> |
return 1; |
3811 |
> |
|
3812 |
> |
} |
3813 |
> |
|
3814 |
> |
|
3815 |
> |
double |
3816 |
> |
OSUAnalysis::getTrkPtRes (const BNtrack* track1){ |
3817 |
> |
|
3818 |
> |
double ptTrue = getTrkPtTrue(track1, mcparticles.product()); |
3819 |
> |
double PtRes = (track1->pt - ptTrue) / ptTrue; |
3820 |
> |
|
3821 |
> |
return PtRes; |
3822 |
> |
|
3823 |
> |
} |
3824 |
> |
|
3825 |
> |
|
3826 |
> |
double |
3827 |
> |
OSUAnalysis::getTrkPtTrue (const BNtrack* track1, const BNmcparticleCollection* genPartColl){ |
3828 |
> |
double value = -99; |
3829 |
> |
double genDeltaRLowest = 999; |
3830 |
> |
|
3831 |
> |
for (BNmcparticleCollection::const_iterator genPart = genPartColl->begin(); genPart !=genPartColl->end(); genPart++){ |
3832 |
> |
double genDeltaRtemp = deltaR(genPart->eta, genPart->phi,track1->eta, track1->phi); |
3833 |
> |
if (genDeltaRtemp < genDeltaRLowest) { |
3834 |
> |
genDeltaRLowest = genDeltaRtemp; |
3835 |
> |
if (genDeltaRLowest < 0.05) { // Only consider it truth-matched if DeltaR<0.15. |
3836 |
> |
double ptTrue = genPart->pt; |
3837 |
> |
value = ptTrue; |
3838 |
> |
} |
3839 |
> |
} |
3840 |
> |
} |
3841 |
> |
|
3842 |
> |
return value; |
3843 |
> |
|
3844 |
> |
} |
3845 |
> |
|
3846 |
> |
double |
3847 |
> |
OSUAnalysis::getTrkCaloTotRhoCorr(const BNtrack* track) { |
3848 |
> |
// Return the pile-up (rho) corrected isolation energy, i.e., the total calorimeter energy around the candidate track. |
3849 |
> |
if (!useTrackCaloRhoCorr_) return -99; |
3850 |
> |
// if (!rhokt6CaloJetsHandle_) { |
3851 |
> |
// cout << "ERROR [getTrkCaloTotRhoCorr]: The collection rhokt6CaloJetsHandle is not available!" << endl; |
3852 |
> |
// return -99; |
3853 |
> |
// } |
3854 |
> |
double radDeltaRCone = 0.5; |
3855 |
> |
double rhoCorr_kt6CaloJets = *rhokt6CaloJetsHandle_ * TMath::Pi() * pow(radDeltaRCone, 2); // Define effective area as pi*r^2, where r is radius of DeltaR cone. |
3856 |
> |
double rawCaloTot = track->caloHadDeltaRp5 + track->caloEMDeltaRp5; |
3857 |
> |
double caloTotRhoCorrCalo = TMath::Max(0., rawCaloTot - rhoCorr_kt6CaloJets); |
3858 |
> |
return caloTotRhoCorrCalo; |
3859 |
> |
|
3860 |
> |
} |
3861 |
> |
|
3862 |
> |
|
3863 |
> |
|
3864 |
> |
|
3865 |
> |
//creates a map of the dead Ecal channels in the barrel and endcap |
3866 |
> |
//to see how the map of dead Ecal channels is created look at function getChannelStatusMaps() here: |
3867 |
> |
//http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/UserCode/jbrinson/DisappTrk/OSUT3Analysis/AnaTools/src/OSUAnalysis.cc?revision=1.88&view=markup |
3868 |
> |
void |
3869 |
> |
OSUAnalysis::WriteDeadEcal (){ |
3870 |
> |
double etaEcal, phiEcal; |
3871 |
> |
ifstream DeadEcalFile(deadEcalFile_); |
3872 |
> |
if(!DeadEcalFile) { |
3873 |
> |
cout << "Error: DeadEcalFile has not been found." << endl; |
3874 |
> |
return; |
3875 |
> |
} |
3876 |
> |
if(DeadEcalVec.size()!= 0){ |
3877 |
> |
cout << "Error: DeadEcalVec has a nonzero size" << endl; |
3878 |
> |
return; |
3879 |
> |
} |
3880 |
> |
while(!DeadEcalFile.eof()) |
3881 |
> |
{ |
3882 |
> |
DeadEcalFile >> etaEcal >> phiEcal; |
3883 |
> |
DeadEcal newChan; |
3884 |
> |
newChan.etaEcal = etaEcal; |
3885 |
> |
newChan.phiEcal = phiEcal; |
3886 |
> |
DeadEcalVec.push_back(newChan); |
3887 |
> |
} |
3888 |
> |
if(DeadEcalVec.size() == 0) cout << "Warning: No dead Ecal channels have been found." << endl; |
3889 |
> |
} |
3890 |
> |
|
3891 |
> |
//if a track is found within dR<0.05 of a dead Ecal channel value = 1, otherwise value = 0 |
3892 |
> |
int |
3893 |
> |
OSUAnalysis::getTrkIsMatchedDeadEcal (const BNtrack* track1){ |
3894 |
> |
double deltaRLowest = 999; |
3895 |
> |
int value = 0; |
3896 |
> |
if (DeadEcalVec.size() == 0) WriteDeadEcal(); |
3897 |
> |
for(vector<DeadEcal>::const_iterator ecal = DeadEcalVec.begin(); ecal != DeadEcalVec.end(); ++ecal){ |
3898 |
> |
double eta = ecal->etaEcal; |
3899 |
> |
double phi = ecal->phiEcal; |
3900 |
> |
double deltaRtemp = deltaR(eta, phi, track1->eta, track1->phi); |
3901 |
> |
if(deltaRtemp < deltaRLowest) deltaRLowest = deltaRtemp; |
3902 |
> |
} |
3903 |
> |
if (deltaRLowest<0.05) {value = 1;} |
3904 |
> |
else {value = 0;} |
3905 |
> |
return value; |
3906 |
> |
} |
3907 |
> |
|
3908 |
> |
// Returns the smallest DeltaR between the object and any generated true particle in the event. |
3909 |
> |
template <class InputObject> |
3910 |
> |
double OSUAnalysis::getGenDeltaRLowest(InputObject object){ |
3911 |
> |
double genDeltaRLowest = 999.; |
3912 |
> |
for(BNmcparticleCollection::const_iterator mcparticle = mcparticles->begin (); mcparticle != mcparticles->end (); mcparticle++){ |
3913 |
> |
double deltaRtemp = deltaR(mcparticle->eta, mcparticle->phi, object->eta, object->phi); |
3914 |
> |
if (deltaRtemp < genDeltaRLowest) genDeltaRLowest = deltaRtemp; |
3915 |
> |
} |
3916 |
> |
return genDeltaRLowest; |
3917 |
> |
} |
3918 |
> |
|
3919 |
> |
double |
3920 |
> |
OSUAnalysis::applyFunction(string function, double value){ |
3921 |
> |
|
3922 |
> |
if(function == "abs") value = fabs(value); |
3923 |
> |
else if(function == "fabs") value = fabs(value); |
3924 |
> |
else if(function == "log10") value = log10(value); |
3925 |
> |
else if(function == "log") value = log10(value); |
3926 |
> |
|
3927 |
> |
else if(function == "") value = value; |
3928 |
> |
else{cout << "WARNING: invalid function '" << function << "'\n";} |
3929 |
> |
|
3930 |
> |
return value; |
3931 |
> |
|
3932 |
> |
} |
3933 |
> |
|
3934 |
> |
|
3935 |
> |
template <class InputCollection> |
3936 |
|
void OSUAnalysis::setObjectFlags(cut ¤tCut, uint currentCutIndex, flagMap &individualFlags, flagMap &cumulativeFlags, InputCollection inputCollection, string inputType){ |
3937 |
|
|
3938 |
+ |
if (currentCut.inputCollection.find("pair")!=string::npos) { |
3939 |
+ |
string obj1, obj2; |
3940 |
+ |
getTwoObjs(currentCut.inputCollection, obj1, obj2); |
3941 |
+ |
if (inputType==obj1 || |
3942 |
+ |
inputType==obj2) { |
3943 |
+ |
// Do not add a cut to individualFlags or cumulativeFlags, if the cut is on a paired collection, |
3944 |
+ |
// and the inputType is a member of the pair. |
3945 |
+ |
// The cut will instead be applied when the setObjectFlags() is called for the paired collection. |
3946 |
+ |
// For example, if currentCut.inputCollection==electron-muon pairs, |
3947 |
+ |
// then the flags should not be set here when inputType==muons or inputType==electrons. |
3948 |
+ |
return; |
3949 |
+ |
} |
3950 |
+ |
} |
3951 |
|
|
3952 |
|
for (uint object = 0; object != inputCollection->size(); object++){ |
1380 |
– |
|
1381 |
– |
bool decision = true;//object passes if this cut doesn't cut on that type of object |
1382 |
– |
|
1383 |
– |
if(currentCut.inputCollection == inputType){ |
1384 |
– |
|
1385 |
– |
double value = valueLookup(&inputCollection->at(object), currentCut.variable, currentCut.function); |
3953 |
|
|
3954 |
< |
decision = evaluateComparison(value,currentCut.comparativeOperator,currentCut.cutValue); |
3954 |
> |
bool cutDecision = true;//object passes if this cut doesn't cut on that type of object |
3955 |
> |
bool plotDecision = true; |
3956 |
> |
|
3957 |
> |
if(currentCut.inputCollection == inputType){ |
3958 |
> |
|
3959 |
> |
vector<bool> subcutDecisions; |
3960 |
> |
for( int subcutIndex = 0; subcutIndex != currentCut.numSubcuts; subcutIndex++){ |
3961 |
> |
string stringValue = ""; |
3962 |
> |
double value = valueLookup(&inputCollection->at(object), currentCut.variables.at(subcutIndex), currentCut.functions.at(subcutIndex), stringValue); |
3963 |
> |
if (stringValue == "") subcutDecisions.push_back(evaluateComparison(value,currentCut.comparativeOperators.at(subcutIndex),currentCut.cutValues.at(subcutIndex))); |
3964 |
> |
else subcutDecisions.push_back(evaluateComparison(stringValue,currentCut.comparativeOperators.at(subcutIndex),currentCut.cutStringValues.at(subcutIndex))); |
3965 |
> |
|
3966 |
> |
} |
3967 |
> |
if(currentCut.numSubcuts == 1) cutDecision = subcutDecisions.at(0); |
3968 |
> |
else{ |
3969 |
> |
bool tempDecision = true; |
3970 |
> |
for( int subcutIndex = 0;subcutIndex != currentCut.numSubcuts-1; subcutIndex++){ |
3971 |
> |
if(currentCut.logicalOperators.at(subcutIndex) == "&" || currentCut.logicalOperators.at(subcutIndex) == "&&") |
3972 |
> |
tempDecision = subcutDecisions.at(subcutIndex) && subcutDecisions.at(subcutIndex+1); |
3973 |
> |
else if(currentCut.logicalOperators.at(subcutIndex) == "|"|| currentCut.logicalOperators.at(subcutIndex) == "||") |
3974 |
> |
tempDecision = subcutDecisions.at(subcutIndex) || subcutDecisions.at(subcutIndex+1); |
3975 |
> |
} |
3976 |
> |
cutDecision = tempDecision; |
3977 |
> |
} |
3978 |
> |
//invert the cut for plotting if this cut is a veto |
3979 |
> |
if(currentCut.isVeto) plotDecision = !cutDecision; |
3980 |
> |
else plotDecision = cutDecision; |
3981 |
|
} |
1389 |
– |
individualFlags[inputType].at(currentCutIndex).push_back(decision); |
1390 |
– |
|
3982 |
|
|
3983 |
< |
//set flags for objects that pass each cut AND all the previous cuts |
3984 |
< |
bool previousCumulativeFlag = true; |
3983 |
> |
//if(cutDecision != plotDecision && currentCut.variables.at(0) == "pt") cout << "---------------\n" << cutDecision << " " << plotDecision << endl; |
3984 |
> |
individualFlags.at(inputType).at(currentCutIndex).push_back(make_pair(cutDecision,plotDecision)); |
3985 |
> |
|
3986 |
> |
//set flags for objects that pass this cut AND all the previous cuts |
3987 |
> |
bool previousCumulativeCutFlag = true; |
3988 |
|
for(uint previousCutIndex = 0; previousCutIndex != currentCutIndex; previousCutIndex++){ |
3989 |
< |
if(previousCumulativeFlag && individualFlags[inputType].at(previousCutIndex).at(object)) previousCumulativeFlag = true; |
3990 |
< |
else{ previousCumulativeFlag = false; break;} |
3989 |
> |
if(previousCumulativeCutFlag && individualFlags.at(inputType).at(previousCutIndex).at(object).first) previousCumulativeCutFlag = true; |
3990 |
> |
else{ previousCumulativeCutFlag = false; break;} |
3991 |
|
} |
3992 |
< |
cumulativeFlags[inputType].at(currentCutIndex).push_back(previousCumulativeFlag && decision); |
3993 |
< |
|
3992 |
> |
previousCumulativeCutFlag = previousCumulativeCutFlag && cutDecision; |
3993 |
> |
bool previousCumulativePlotFlag = true; |
3994 |
> |
for(uint previousCutIndex = 0; previousCutIndex != currentCutIndex; previousCutIndex++){ |
3995 |
> |
if(previousCumulativePlotFlag && individualFlags.at(inputType).at(previousCutIndex).at(object).second) previousCumulativePlotFlag = true; |
3996 |
> |
else{ previousCumulativePlotFlag = false; break;} |
3997 |
> |
} |
3998 |
> |
previousCumulativePlotFlag = previousCumulativePlotFlag && plotDecision; |
3999 |
> |
|
4000 |
> |
//if(inputType == "muons") cout << previousCumulativeCutFlag << " " << previousCumulativePlotFlag << " " << currentCut.variables.at(0) << "\n---------------\n\n"; |
4001 |
> |
cumulativeFlags.at(inputType).at(currentCutIndex).push_back(make_pair(previousCumulativeCutFlag,previousCumulativePlotFlag)); |
4002 |
> |
|
4003 |
|
} |
4004 |
< |
|
4004 |
> |
|
4005 |
|
} |
4006 |
|
|
4007 |
|
|
4008 |
+ |
template <class InputCollection1, class InputCollection2> |
4009 |
+ |
void OSUAnalysis::setObjectFlags(cut ¤tCut, uint currentCutIndex, flagMap &individualFlags, flagMap &cumulativeFlags, \ |
4010 |
+ |
InputCollection1 inputCollection1, InputCollection2 inputCollection2, flagPair flags1, flagPair flags2, string inputType){ |
4011 |
+ |
|
4012 |
+ |
|
4013 |
+ |
bool sameObjects = false; |
4014 |
+ |
if(typeid(InputCollection1).name() == typeid(InputCollection2).name()) sameObjects = true; |
4015 |
+ |
|
4016 |
+ |
// Get the strings for the two objects that make up the pair. |
4017 |
+ |
string obj1Type, obj2Type; |
4018 |
+ |
getTwoObjs(inputType, obj1Type, obj2Type); |
4019 |
+ |
bool isTwoTypesOfObject = true; |
4020 |
+ |
if (obj1Type==obj2Type) isTwoTypesOfObject = false; |
4021 |
+ |
|
4022 |
+ |
// Initialize the flags for individual objects to all be false, if the cut is on the pair. |
4023 |
+ |
// Set them to true later, if any paired object passes (in which case both of its constituents should pass). |
4024 |
+ |
if (currentCut.inputCollection == inputType) { |
4025 |
+ |
for (uint object1 = 0; object1 != inputCollection1->size(); object1++) { |
4026 |
+ |
individualFlags.at(obj1Type).at(currentCutIndex).push_back(make_pair(false,false)); |
4027 |
+ |
cumulativeFlags.at(obj1Type).at(currentCutIndex).push_back(make_pair(false,false)); |
4028 |
+ |
} |
4029 |
+ |
if (isTwoTypesOfObject) { // Only initialize the second object if it is different from the first. |
4030 |
+ |
for (uint object2 = 0; object2 != inputCollection2->size(); object2++) { |
4031 |
+ |
individualFlags.at(obj2Type).at(currentCutIndex).push_back(make_pair(false,false)); |
4032 |
+ |
cumulativeFlags.at(obj2Type).at(currentCutIndex).push_back(make_pair(false,false)); |
4033 |
+ |
} |
4034 |
+ |
} |
4035 |
+ |
} |
4036 |
+ |
|
4037 |
+ |
int counter = 0; |
4038 |
+ |
|
4039 |
+ |
for (uint object1 = 0; object1 != inputCollection1->size(); object1++){ |
4040 |
+ |
for (uint object2 = 0; object2 != inputCollection2->size(); object2++){ |
4041 |
|
|
4042 |
+ |
if(sameObjects && object1 >= object2) continue;//account for duplicate pairs if both collections are the same |
4043 |
|
|
4044 |
|
|
4045 |
< |
DEFINE_FWK_MODULE(OSUAnalysis); |
4045 |
> |
bool cutDecision = true;//object passes if this cut doesn't cut on that type of object |
4046 |
> |
bool plotDecision = true; |
4047 |
> |
|
4048 |
> |
if(currentCut.inputCollection == inputType){ |
4049 |
> |
|
4050 |
> |
vector<bool> subcutDecisions; |
4051 |
> |
for( int subcutIndex = 0; subcutIndex != currentCut.numSubcuts; subcutIndex++){ |
4052 |
> |
string stringValue = ""; |
4053 |
> |
double value = valueLookup(&inputCollection1->at(object1), &inputCollection2->at(object2), currentCut.variables.at(subcutIndex), currentCut.functions.at(subcutIndex), stringValue); |
4054 |
> |
if (stringValue == "") subcutDecisions.push_back(evaluateComparison(value,currentCut.comparativeOperators.at(subcutIndex),currentCut.cutValues.at(subcutIndex))); |
4055 |
> |
else subcutDecisions.push_back(evaluateComparison(stringValue,currentCut.comparativeOperators.at(subcutIndex),currentCut.cutStringValues.at(subcutIndex))); |
4056 |
> |
} |
4057 |
> |
|
4058 |
> |
if(currentCut.numSubcuts == 1) cutDecision = subcutDecisions.at(0); |
4059 |
> |
else{ |
4060 |
> |
bool tempDecision = subcutDecisions.at(0); |
4061 |
> |
for( int subcutIndex = 1; subcutIndex < currentCut.numSubcuts; subcutIndex++){ |
4062 |
> |
if(currentCut.logicalOperators.at(subcutIndex-1) == "&" || currentCut.logicalOperators.at(subcutIndex-1) == "&&") |
4063 |
> |
tempDecision = tempDecision && subcutDecisions.at(subcutIndex); |
4064 |
> |
else if(currentCut.logicalOperators.at(subcutIndex-1) == "|"|| currentCut.logicalOperators.at(subcutIndex-1) == "||") |
4065 |
> |
tempDecision = tempDecision || subcutDecisions.at(subcutIndex); |
4066 |
> |
} |
4067 |
> |
cutDecision = tempDecision; |
4068 |
> |
} |
4069 |
> |
//invert the cut for plotting if this cut is a veto |
4070 |
> |
if(currentCut.isVeto) plotDecision = !cutDecision; |
4071 |
> |
else plotDecision = cutDecision; |
4072 |
> |
} |
4073 |
> |
individualFlags.at(inputType).at(currentCutIndex).push_back(make_pair(cutDecision,plotDecision)); |
4074 |
> |
if (cutDecision && currentCut.inputCollection == inputType) { // only set the flags for the individual objects if the pair object is being cut on |
4075 |
> |
individualFlags.at(obj1Type).at(currentCutIndex).at(object1).first = true; |
4076 |
> |
individualFlags.at(obj2Type).at(currentCutIndex).at(object2).first = true; |
4077 |
> |
} |
4078 |
> |
if (plotDecision && currentCut.inputCollection == inputType) { // only set the flags for the individual objects if the pair object is being cut on |
4079 |
> |
individualFlags.at(obj1Type).at(currentCutIndex).at(object1).second = true; |
4080 |
> |
individualFlags.at(obj2Type).at(currentCutIndex).at(object2).second = true; |
4081 |
> |
} |
4082 |
> |
|
4083 |
> |
//set flags for objects that pass this cut AND all the previous cuts |
4084 |
> |
bool previousCumulativeCutFlag = true; |
4085 |
> |
for(uint previousCutIndex = 0; previousCutIndex != currentCutIndex; previousCutIndex++){ |
4086 |
> |
if(previousCumulativeCutFlag && individualFlags.at(inputType).at(previousCutIndex).at(counter).first) previousCumulativeCutFlag = true; |
4087 |
> |
else{ previousCumulativeCutFlag = false; break;} |
4088 |
> |
} |
4089 |
> |
previousCumulativeCutFlag = previousCumulativeCutFlag && cutDecision; |
4090 |
> |
|
4091 |
> |
bool previousCumulativePlotFlag = true; |
4092 |
> |
for(uint previousCutIndex = 0; previousCutIndex != currentCutIndex; previousCutIndex++){ |
4093 |
> |
if(previousCumulativePlotFlag && individualFlags.at(inputType).at(previousCutIndex).at(counter).second) previousCumulativePlotFlag = true; |
4094 |
> |
else{ previousCumulativePlotFlag = false; break;} |
4095 |
> |
} |
4096 |
> |
previousCumulativePlotFlag = previousCumulativePlotFlag && plotDecision; |
4097 |
> |
|
4098 |
> |
//apply flags for the components of the composite object as well |
4099 |
> |
bool currentCumulativeCutFlag = true; |
4100 |
> |
bool currentCumulativePlotFlag = true; |
4101 |
> |
|
4102 |
> |
if(flags1.size() == 0 && flags2.size() == 0) currentCumulativeCutFlag = previousCumulativeCutFlag; |
4103 |
> |
else if(flags1.size() == 0) currentCumulativeCutFlag = previousCumulativeCutFlag && flags2.at(object2).first; |
4104 |
> |
else if(flags2.size() == 0) currentCumulativeCutFlag = previousCumulativeCutFlag && flags1.at(object1).first; |
4105 |
> |
else currentCumulativeCutFlag = previousCumulativeCutFlag && flags1.at(object1).first && flags2.at(object2).first; |
4106 |
> |
|
4107 |
> |
if(flags1.size() == 0 && flags2.size() == 0) currentCumulativePlotFlag = previousCumulativePlotFlag; |
4108 |
> |
else if(flags1.size() == 0) currentCumulativePlotFlag = previousCumulativePlotFlag && flags2.at(object2).second; |
4109 |
> |
else if(flags2.size() == 0) currentCumulativePlotFlag = previousCumulativePlotFlag && flags1.at(object1).second; |
4110 |
> |
else currentCumulativePlotFlag = previousCumulativePlotFlag && flags1.at(object1).first && flags2.at(object2).second; |
4111 |
> |
|
4112 |
> |
cumulativeFlags.at(inputType).at(currentCutIndex).push_back(make_pair(currentCumulativeCutFlag,currentCumulativePlotFlag)); |
4113 |
> |
|
4114 |
> |
if (currentCumulativeCutFlag && currentCut.inputCollection == inputType) { // only set the flags for the individual objects if the pair object is being cut on |
4115 |
> |
cumulativeFlags.at(obj1Type).at(currentCutIndex).at(object1).first = true && getPreviousCumulativeFlags(currentCutIndex, individualFlags, obj1Type, object1, "cut"); |
4116 |
> |
cumulativeFlags.at(obj2Type).at(currentCutIndex).at(object2).first = true && getPreviousCumulativeFlags(currentCutIndex, individualFlags, obj2Type, object2, "cut"); |
4117 |
> |
} |
4118 |
> |
|
4119 |
> |
if (currentCumulativePlotFlag && currentCut.inputCollection == inputType) { // only set the flags for the individual objects if the pair object is being cut on |
4120 |
> |
cumulativeFlags.at(obj1Type).at(currentCutIndex).at(object1).second = true && getPreviousCumulativeFlags(currentCutIndex, individualFlags, obj1Type, object1, "plot"); |
4121 |
> |
cumulativeFlags.at(obj2Type).at(currentCutIndex).at(object2).second = true && getPreviousCumulativeFlags(currentCutIndex, individualFlags, obj2Type, object2, "plot"); |
4122 |
> |
} |
4123 |
|
|
4124 |
+ |
counter++; |
4125 |
|
|
4126 |
+ |
} // end for (uint object2 = 0; object2 != inputCollection2->size(); object2++) |
4127 |
+ |
} // end for (uint object1 = 0; object1 != inputCollection1->size(); object1++) |
4128 |
+ |
|
4129 |
+ |
} |
4130 |
+ |
|
4131 |
+ |
|
4132 |
+ |
bool OSUAnalysis::getPreviousCumulativeFlags(uint currentCutIndex, flagMap &individualFlags, string obj1Type, uint object1, string flagType) { |
4133 |
+ |
// Return true iff for the collection obj1Type, the element with index object1 has individal flags set to true for |
4134 |
+ |
// all cuts up to currentCutIndex |
4135 |
+ |
bool previousCumulativeFlag = true; |
4136 |
+ |
for (uint previousCutIndex = 0; previousCutIndex < currentCutIndex; previousCutIndex++) { |
4137 |
+ |
bool tempFlag = false; |
4138 |
+ |
if(flagType == "cut") tempFlag = individualFlags.at(obj1Type).at(previousCutIndex).at(object1).first; |
4139 |
+ |
else if(flagType == "plot") tempFlag = individualFlags.at(obj1Type).at(previousCutIndex).at(object1).second; |
4140 |
+ |
|
4141 |
+ |
if (previousCumulativeFlag && tempFlag) previousCumulativeFlag = true; |
4142 |
+ |
else { |
4143 |
+ |
previousCumulativeFlag = false; break; |
4144 |
+ |
} |
4145 |
+ |
} |
4146 |
+ |
return previousCumulativeFlag; |
4147 |
+ |
} |
4148 |
+ |
|
4149 |
+ |
|
4150 |
+ |
|
4151 |
+ |
|
4152 |
+ |
template <class InputCollection> |
4153 |
+ |
void OSUAnalysis::assignTreeBranch(BranchSpecs parameters, InputCollection inputCollection, flagPair flags){ |
4154 |
+ |
// This function is similar to fill1DHistogram(), but instead of filling a histogram it assigns a value to a variable for the BNTree |
4155 |
+ |
|
4156 |
+ |
if (BNTreeBranchVals_.count(parameters.name)==0) cout << "Error[assignTreeBranch]: trying to assign value to " << parameters.name << " that does not have a branch set up. Will likely seg fault." << endl; |
4157 |
+ |
for (uint object = 0; object != inputCollection->size(); object++) { |
4158 |
+ |
|
4159 |
+ |
if (!plotAllObjectsInPassingEvents_ && !flags.at(object).second) continue; |
4160 |
+ |
|
4161 |
+ |
string inputVariable = parameters.inputVariable; |
4162 |
+ |
string function = ""; |
4163 |
+ |
string stringValue = ""; |
4164 |
+ |
double value = valueLookup(&inputCollection->at(object), inputVariable, function, stringValue); |
4165 |
+ |
BNTreeBranchVals_.at(parameters.name).push_back(value); |
4166 |
+ |
|
4167 |
+ |
} |
4168 |
+ |
} |
4169 |
+ |
|
4170 |
+ |
|
4171 |
+ |
template <class InputCollection> |
4172 |
+ |
void OSUAnalysis::fill1DHistogram(TH1* histo, histogram parameters, InputCollection inputCollection, flagPair flags, double scaleFactor){ |
4173 |
+ |
|
4174 |
+ |
|
4175 |
+ |
for (uint object = 0; object != inputCollection->size(); object++){ |
4176 |
+ |
|
4177 |
+ |
//cout << "flags.at(object).second: " << flags.at(object).second << endl; |
4178 |
+ |
|
4179 |
+ |
if(!plotAllObjectsInPassingEvents_ && !flags.at(object).second) continue; |
4180 |
+ |
|
4181 |
+ |
string currentString = parameters.inputVariables.at(0); |
4182 |
+ |
string inputVariable = ""; |
4183 |
+ |
string function = ""; |
4184 |
+ |
if(currentString.find("(")==string::npos){ |
4185 |
+ |
inputVariable = currentString;// variable to cut on |
4186 |
+ |
} |
4187 |
+ |
else{ |
4188 |
+ |
function = currentString.substr(0,currentString.find("("));//function comes before the "(" |
4189 |
+ |
inputVariable = currentString.substr(currentString.find("(")+1);//get rest of string |
4190 |
+ |
inputVariable = inputVariable.substr(0,inputVariable.size()-1);//remove trailing ")" |
4191 |
+ |
} |
4192 |
+ |
|
4193 |
+ |
string stringValue = ""; |
4194 |
+ |
double value = valueLookup(&inputCollection->at(object), inputVariable, function, stringValue); |
4195 |
+ |
histo->Fill(value,scaleFactor); |
4196 |
+ |
|
4197 |
+ |
if (printEventInfo_) { |
4198 |
+ |
// Write information about event to screen, for testing purposes. |
4199 |
+ |
cout << " Info for event: value for histogram " << histo->GetName() << ": " << value << endl; |
4200 |
+ |
} |
4201 |
+ |
|
4202 |
+ |
} |
4203 |
+ |
} |
4204 |
+ |
|
4205 |
+ |
template <class InputCollection1, class InputCollection2> |
4206 |
+ |
void OSUAnalysis::fill1DHistogram(TH1* histo, histogram parameters, InputCollection1 inputCollection1, InputCollection2 inputCollection2, flagPair flags1, flagPair flags2, flagPair pairFlags, double scaleFactor){ |
4207 |
+ |
|
4208 |
+ |
bool sameObjects = false; |
4209 |
+ |
if(typeid(InputCollection1).name() == typeid(InputCollection2).name()) sameObjects = true; |
4210 |
+ |
|
4211 |
+ |
int pairCounter = -1; |
4212 |
+ |
for (uint object1 = 0; object1 != inputCollection1->size(); object1++){ |
4213 |
+ |
for (uint object2 = 0; object2 != inputCollection2->size(); object2++){ |
4214 |
+ |
|
4215 |
+ |
if(sameObjects && object1 >= object2) continue;//account for duplicate pairs if both collections are the same |
4216 |
+ |
|
4217 |
+ |
pairCounter++; |
4218 |
+ |
//only take objects which have passed all cuts and pairs which have passed all cuts |
4219 |
+ |
if(!plotAllObjectsInPassingEvents_ && !flags1.at(object1).second) continue; |
4220 |
+ |
if(!plotAllObjectsInPassingEvents_ && !flags2.at(object2).second) continue; |
4221 |
+ |
if(!plotAllObjectsInPassingEvents_ && !pairFlags.at(pairCounter).second) continue; |
4222 |
+ |
|
4223 |
+ |
string currentString = parameters.inputVariables.at(0); |
4224 |
+ |
string inputVariable = ""; |
4225 |
+ |
string function = ""; |
4226 |
+ |
if(currentString.find("(")==string::npos){ |
4227 |
+ |
inputVariable = currentString;// variable to cut on |
4228 |
+ |
} |
4229 |
+ |
else{ |
4230 |
+ |
function = currentString.substr(0,currentString.find("("));//function comes before the "(" |
4231 |
+ |
inputVariable = currentString.substr(currentString.find("(")+1);//get rest of string |
4232 |
+ |
inputVariable = inputVariable.substr(0,inputVariable.size()-1);//remove trailing ")" |
4233 |
+ |
} |
4234 |
+ |
|
4235 |
+ |
string stringValue = ""; |
4236 |
+ |
double value = valueLookup(&inputCollection1->at(object1), &inputCollection2->at(object2), inputVariable, function, stringValue); |
4237 |
+ |
histo->Fill(value,scaleFactor); |
4238 |
+ |
|
4239 |
+ |
} |
4240 |
+ |
} |
4241 |
+ |
|
4242 |
+ |
} |
4243 |
+ |
|
4244 |
+ |
|
4245 |
+ |
template <class InputCollection> |
4246 |
+ |
void OSUAnalysis::fill2DHistogram(TH2* histo, histogram parameters, InputCollection inputCollection, flagPair flags, double scaleFactor){ |
4247 |
+ |
|
4248 |
+ |
for (uint object = 0; object != inputCollection->size(); object++){ |
4249 |
+ |
|
4250 |
+ |
if(!plotAllObjectsInPassingEvents_ && !flags.at(object).second) continue; |
4251 |
+ |
|
4252 |
+ |
string stringValue = ""; |
4253 |
+ |
string currentString = parameters.inputVariables.at(0); |
4254 |
+ |
string inputVariable = ""; |
4255 |
+ |
string function = ""; |
4256 |
+ |
if(currentString.find("(")==string::npos){ |
4257 |
+ |
inputVariable = currentString;// variable to cut on |
4258 |
+ |
} |
4259 |
+ |
else{ |
4260 |
+ |
function = currentString.substr(0,currentString.find("("));//function comes before the "(" |
4261 |
+ |
inputVariable = currentString.substr(currentString.find("(")+1);//get rest of string |
4262 |
+ |
inputVariable = inputVariable.substr(0,inputVariable.size()-1);//remove trailing ")" |
4263 |
+ |
} |
4264 |
+ |
double valueX = valueLookup(&inputCollection->at(object), inputVariable, function, stringValue); |
4265 |
+ |
|
4266 |
+ |
currentString = parameters.inputVariables.at(1); |
4267 |
+ |
inputVariable = ""; |
4268 |
+ |
function = ""; |
4269 |
+ |
if(currentString.find("(")==string::npos){ |
4270 |
+ |
inputVariable = currentString;// variable to cut on |
4271 |
+ |
} |
4272 |
+ |
else{ |
4273 |
+ |
function = currentString.substr(0,currentString.find("("));//function comes before the "(" |
4274 |
+ |
inputVariable = currentString.substr(currentString.find("(")+1);//get rest of string |
4275 |
+ |
inputVariable = inputVariable.substr(0,inputVariable.size()-1);//remove trailing ")" |
4276 |
+ |
} |
4277 |
+ |
|
4278 |
+ |
double valueY = valueLookup(&inputCollection->at(object), inputVariable, function, stringValue); |
4279 |
+ |
|
4280 |
+ |
histo->Fill(valueX,valueY,scaleFactor); |
4281 |
+ |
|
4282 |
+ |
} |
4283 |
+ |
|
4284 |
+ |
} |
4285 |
+ |
|
4286 |
+ |
template <class InputCollection1, class InputCollection2> |
4287 |
+ |
void OSUAnalysis::fill2DHistogram(TH2* histo, histogram parameters, InputCollection1 inputCollection1, InputCollection2 inputCollection2, flagPair flags1, flagPair flags2, flagPair pairFlags, double scaleFactor){ |
4288 |
+ |
|
4289 |
+ |
bool sameObjects = false; |
4290 |
+ |
if(typeid(InputCollection1).name() == typeid(InputCollection2).name()) sameObjects = true; |
4291 |
+ |
|
4292 |
+ |
int pairCounter = -1; |
4293 |
+ |
for (uint object1 = 0; object1 != inputCollection1->size(); object1++){ |
4294 |
+ |
for (uint object2 = 0; object2 != inputCollection2->size(); object2++){ |
4295 |
+ |
|
4296 |
+ |
if(sameObjects && object1 >= object2) continue;//account for duplicate pairs if both collections are the same |
4297 |
+ |
|
4298 |
+ |
pairCounter++; |
4299 |
+ |
|
4300 |
+ |
//only take objects which have passed all cuts and pairs which have passed all cuts |
4301 |
+ |
if(!plotAllObjectsInPassingEvents_ && !flags1.at(object1).second) continue; |
4302 |
+ |
if(!plotAllObjectsInPassingEvents_ && !flags2.at(object2).second) continue; |
4303 |
+ |
if(!plotAllObjectsInPassingEvents_ && !pairFlags.at(pairCounter).second) continue; |
4304 |
+ |
|
4305 |
+ |
string stringValue = ""; |
4306 |
+ |
string currentString = parameters.inputVariables.at(0); |
4307 |
+ |
string inputVariable = ""; |
4308 |
+ |
string function = ""; |
4309 |
+ |
if(currentString.find("(")==string::npos){ |
4310 |
+ |
inputVariable = currentString;// variable to cut on |
4311 |
+ |
} |
4312 |
+ |
else{ |
4313 |
+ |
function = currentString.substr(0,currentString.find("("));//function comes before the "(" |
4314 |
+ |
inputVariable = currentString.substr(currentString.find("(")+1);//get rest of string |
4315 |
+ |
inputVariable = inputVariable.substr(0,inputVariable.size()-1);//remove trailing ")" |
4316 |
+ |
} |
4317 |
+ |
double valueX = valueLookup(&inputCollection1->at(object1), &inputCollection2->at(object2), inputVariable, function, stringValue); |
4318 |
+ |
|
4319 |
+ |
currentString = parameters.inputVariables.at(1); |
4320 |
+ |
inputVariable = ""; |
4321 |
+ |
function = ""; |
4322 |
+ |
if(currentString.find("(")==string::npos){ |
4323 |
+ |
inputVariable = currentString;// variable to cut on |
4324 |
+ |
} |
4325 |
+ |
else{ |
4326 |
+ |
function = currentString.substr(0,currentString.find("("));//function comes before the "(" |
4327 |
+ |
inputVariable = currentString.substr(currentString.find("(")+1);//get rest of string |
4328 |
+ |
inputVariable = inputVariable.substr(0,inputVariable.size()-1);//remove trailing ")" |
4329 |
+ |
} |
4330 |
+ |
double valueY = valueLookup(&inputCollection1->at(object1), &inputCollection2->at(object2), inputVariable, function, stringValue); |
4331 |
+ |
|
4332 |
+ |
|
4333 |
+ |
histo->Fill(valueX,valueY,scaleFactor); |
4334 |
+ |
|
4335 |
+ |
} |
4336 |
+ |
} |
4337 |
+ |
|
4338 |
+ |
} |
4339 |
+ |
|
4340 |
+ |
|
4341 |
+ |
template <class InputObject> |
4342 |
+ |
int OSUAnalysis::getGenMatchedParticleIndex(InputObject object){ |
4343 |
+ |
|
4344 |
+ |
int bestMatchIndex = -1; |
4345 |
+ |
double bestMatchDeltaR = 999; |
4346 |
+ |
|
4347 |
+ |
for(BNmcparticleCollection::const_iterator mcparticle = mcparticles->begin (); mcparticle != mcparticles->end (); mcparticle++){ |
4348 |
+ |
|
4349 |
+ |
double currentDeltaR = deltaR(object->eta,object->phi,mcparticle->eta,mcparticle->phi); |
4350 |
+ |
if(currentDeltaR > 0.05) continue; |
4351 |
+ |
// cout << setprecision(3) << setw(20) |
4352 |
+ |
// << "\tcurrentParticle: eta = " << mcparticles->at(mcparticle - mcparticles->begin()).eta |
4353 |
+ |
// << setw(20) |
4354 |
+ |
// << "\tphi = " << mcparticles->at(mcparticle - mcparticles->begin()).phi |
4355 |
+ |
// << setw(20) |
4356 |
+ |
// << "\tdeltaR = " << currentDeltaR |
4357 |
+ |
// << setprecision(1) |
4358 |
+ |
// << setw(20) |
4359 |
+ |
// << "\tid = " << mcparticles->at(mcparticle - mcparticles->begin()).id |
4360 |
+ |
// << setw(20) |
4361 |
+ |
// << "\tmotherId = " << mcparticles->at(mcparticle - mcparticles->begin()).motherId |
4362 |
+ |
// << setw(20) |
4363 |
+ |
// << "\tstatus = " << mcparticles->at(mcparticle - mcparticles->begin()).status<< endl; |
4364 |
+ |
if(currentDeltaR < bestMatchDeltaR && mcparticles->at(mcparticle - mcparticles->begin()).id != mcparticles->at(mcparticle - mcparticles->begin()).motherId){ |
4365 |
+ |
bestMatchIndex = mcparticle - mcparticles->begin(); |
4366 |
+ |
bestMatchDeltaR = currentDeltaR; |
4367 |
+ |
} |
4368 |
+ |
|
4369 |
+ |
} |
4370 |
+ |
// if(bestMatchDeltaR != 999) cout << "bestMatch: deltaR = " << bestMatchDeltaR << " id = " << mcparticles->at(bestMatchIndex).id << " motherId = " << mcparticles->at(bestMatchIndex).motherId << endl; |
4371 |
+ |
// else cout << "no match found..." << endl; |
4372 |
+ |
return bestMatchIndex; |
4373 |
+ |
|
4374 |
+ |
} |
4375 |
+ |
|
4376 |
+ |
|
4377 |
+ |
int OSUAnalysis::findTauMotherIndex(const BNmcparticle* tau){ |
4378 |
+ |
|
4379 |
+ |
int bestMatchIndex = -1; |
4380 |
+ |
double bestMatchDeltaR = 999; |
4381 |
+ |
|
4382 |
+ |
for(BNmcparticleCollection::const_iterator mcparticle = mcparticles->begin (); mcparticle != mcparticles->end (); mcparticle++){ |
4383 |
+ |
|
4384 |
+ |
if(fabs(mcparticle->id) != 15 || mcparticle->status !=3) continue; |
4385 |
+ |
|
4386 |
+ |
double currentDeltaR = deltaR(tau->eta,tau->phi,mcparticle->eta,mcparticle->phi); |
4387 |
+ |
if(currentDeltaR > 0.05) continue; |
4388 |
+ |
|
4389 |
+ |
if(currentDeltaR < bestMatchDeltaR && mcparticles->at(mcparticle - mcparticles->begin()).id != mcparticles->at(mcparticle - mcparticles->begin()).motherId){ |
4390 |
+ |
bestMatchIndex = mcparticle - mcparticles->begin(); |
4391 |
+ |
bestMatchDeltaR = currentDeltaR; |
4392 |
+ |
} |
4393 |
+ |
|
4394 |
+ |
} |
4395 |
+ |
|
4396 |
+ |
return bestMatchIndex; |
4397 |
+ |
} |
4398 |
+ |
|
4399 |
+ |
|
4400 |
+ |
// bin particle type |
4401 |
+ |
// --- ------------- |
4402 |
+ |
// 0 unmatched |
4403 |
+ |
// 1 u |
4404 |
+ |
// 2 d |
4405 |
+ |
// 3 s |
4406 |
+ |
// 4 c |
4407 |
+ |
// 5 b |
4408 |
+ |
// 6 t |
4409 |
+ |
// 7 e |
4410 |
+ |
// 8 mu |
4411 |
+ |
// 9 tau |
4412 |
+ |
// 10 nu |
4413 |
+ |
// 11 g |
4414 |
+ |
// 12 gamma |
4415 |
+ |
// 13 Z |
4416 |
+ |
// 14 W |
4417 |
+ |
// 15 light meson |
4418 |
+ |
// 16 K meson |
4419 |
+ |
// 17 D meson |
4420 |
+ |
// 18 B meson |
4421 |
+ |
// 19 light baryon |
4422 |
+ |
// 20 strange baryon |
4423 |
+ |
// 21 charm baryon |
4424 |
+ |
// 22 bottom baryon |
4425 |
+ |
// 23 QCD string |
4426 |
+ |
// 24 other |
4427 |
+ |
|
4428 |
+ |
int OSUAnalysis::getPdgIdBinValue(int pdgId){ |
4429 |
+ |
|
4430 |
+ |
int binValue = -999; |
4431 |
+ |
int absPdgId = fabs(pdgId); |
4432 |
+ |
if(pdgId == -1) binValue = 0; |
4433 |
+ |
else if(absPdgId <= 6 ) binValue = absPdgId; |
4434 |
+ |
else if(absPdgId == 11 ) binValue = 7; |
4435 |
+ |
else if(absPdgId == 13 ) binValue = 8; |
4436 |
+ |
else if(absPdgId == 15 ) binValue = 9; |
4437 |
+ |
else if(absPdgId == 12 || absPdgId == 14 || absPdgId == 16 ) binValue = 10; |
4438 |
+ |
else if(absPdgId == 21 ) binValue = 11; |
4439 |
+ |
else if(absPdgId == 22 ) binValue = 12; |
4440 |
+ |
else if(absPdgId == 23 ) binValue = 13; |
4441 |
+ |
else if(absPdgId == 24 ) binValue = 14; |
4442 |
+ |
else if(absPdgId > 100 && absPdgId < 300 && absPdgId != 130 ) binValue = 15; |
4443 |
+ |
else if( absPdgId == 130 || (absPdgId > 300 && absPdgId < 400) ) binValue = 16; |
4444 |
+ |
else if(absPdgId > 400 && absPdgId < 500 ) binValue = 17; |
4445 |
+ |
else if(absPdgId > 500 && absPdgId < 600 ) binValue = 18; |
4446 |
+ |
else if(absPdgId > 1000 && absPdgId < 3000 ) binValue = 19; |
4447 |
+ |
else if(absPdgId > 3000 && absPdgId < 4000 ) binValue = 20; |
4448 |
+ |
else if(absPdgId > 4000 && absPdgId < 5000 ) binValue = 21; |
4449 |
+ |
else if(absPdgId > 5000 && absPdgId < 6000 ) binValue = 22; |
4450 |
+ |
else if(absPdgId == 92 ) binValue = 23; |
4451 |
+ |
|
4452 |
+ |
else binValue = 24; |
4453 |
+ |
|
4454 |
+ |
return binValue; |
4455 |
+ |
|
4456 |
+ |
} |
4457 |
+ |
|
4458 |
+ |
const BNprimaryvertex * |
4459 |
+ |
OSUAnalysis::chosenVertex () |
4460 |
+ |
{ |
4461 |
+ |
const BNprimaryvertex *chosenVertex = 0; |
4462 |
+ |
if(cumulativeFlags.find ("primaryvertexs") != cumulativeFlags.end ()){ |
4463 |
+ |
flagPair vertexFlags; |
4464 |
+ |
for (int i = cumulativeFlags.at("primaryvertexs").size() - 1; i >= 0; i--){ |
4465 |
+ |
if (cumulativeFlags.at("primaryvertexs").at(i).size()){ |
4466 |
+ |
vertexFlags = cumulativeFlags.at("primaryvertexs").at(i); |
4467 |
+ |
break; |
4468 |
+ |
} |
4469 |
+ |
} |
4470 |
+ |
for (uint vertexIndex = 0; vertexIndex != vertexFlags.size(); vertexIndex++){ |
4471 |
+ |
if(!vertexFlags.at(vertexIndex).first) continue; |
4472 |
+ |
chosenVertex = & primaryvertexs->at(vertexIndex); |
4473 |
+ |
break; |
4474 |
+ |
} |
4475 |
+ |
} |
4476 |
+ |
else if (find (objectsToGet.begin (), objectsToGet.end (), "primaryvertexs") != objectsToGet.end ()) |
4477 |
+ |
chosenVertex = & primaryvertexs->at (0); |
4478 |
+ |
|
4479 |
+ |
return chosenVertex; |
4480 |
+ |
} |
4481 |
+ |
|
4482 |
+ |
const BNmet * |
4483 |
+ |
OSUAnalysis::chosenMET () |
4484 |
+ |
{ |
4485 |
+ |
const BNmet *chosenMET = 0; |
4486 |
+ |
if(cumulativeFlags.find ("mets") != cumulativeFlags.end ()){ |
4487 |
+ |
flagPair metFlags; |
4488 |
+ |
for (int i = cumulativeFlags.at("mets").size() - 1; i >= 0; i--){ |
4489 |
+ |
if (cumulativeFlags.at("mets").at(i).size()){ |
4490 |
+ |
metFlags = cumulativeFlags.at("mets").at(i); |
4491 |
+ |
break; |
4492 |
+ |
} |
4493 |
+ |
} |
4494 |
+ |
for (uint metIndex = 0; metIndex != metFlags.size(); metIndex++){ |
4495 |
+ |
if(!metFlags.at(metIndex).first) continue; |
4496 |
+ |
chosenMET = & mets->at(metIndex); |
4497 |
+ |
break; |
4498 |
+ |
} |
4499 |
+ |
} |
4500 |
+ |
else if (find (objectsToGet.begin (), objectsToGet.end (), "mets") != objectsToGet.end ()) |
4501 |
+ |
chosenMET = & mets->at (0); |
4502 |
+ |
|
4503 |
+ |
return chosenMET; |
4504 |
+ |
} |
4505 |
+ |
|
4506 |
+ |
const BNelectron * |
4507 |
+ |
OSUAnalysis::chosenElectron () |
4508 |
+ |
{ |
4509 |
+ |
const BNelectron *chosenElectron = 0; |
4510 |
+ |
if(cumulativeFlags.find ("electrons") != cumulativeFlags.end ()){ |
4511 |
+ |
flagPair electronFlags; |
4512 |
+ |
for (int i = cumulativeFlags.at("electrons").size() - 1; i >= 0; i--){ |
4513 |
+ |
if (cumulativeFlags.at("electrons").at(i).size()){ |
4514 |
+ |
electronFlags = cumulativeFlags.at("electrons").at(i); |
4515 |
+ |
break; |
4516 |
+ |
} |
4517 |
+ |
} |
4518 |
+ |
for (uint electronIndex = 0; electronIndex != electronFlags.size(); electronIndex++){ |
4519 |
+ |
if(!electronFlags.at(electronIndex).first) continue; |
4520 |
+ |
chosenElectron = & electrons->at(electronIndex); |
4521 |
+ |
break; |
4522 |
+ |
} |
4523 |
+ |
} |
4524 |
+ |
else if (find (objectsToGet.begin (), objectsToGet.end (), "electrons") != objectsToGet.end ()) |
4525 |
+ |
chosenElectron = & electrons->at (0); |
4526 |
+ |
|
4527 |
+ |
return chosenElectron; |
4528 |
+ |
} |
4529 |
+ |
|
4530 |
+ |
|
4531 |
+ |
const BNmuon * |
4532 |
+ |
OSUAnalysis::chosenMuon () |
4533 |
+ |
{ |
4534 |
+ |
const BNmuon *chosenMuon = 0; |
4535 |
+ |
if(cumulativeFlags.find ("muons") != cumulativeFlags.end ()){ |
4536 |
+ |
flagPair muonFlags; |
4537 |
+ |
for (int i = cumulativeFlags.at("muons").size() - 1; i >= 0; i--){ |
4538 |
+ |
if (cumulativeFlags.at("muons").at(i).size()){ |
4539 |
+ |
muonFlags = cumulativeFlags.at("muons").at(i); |
4540 |
+ |
break; |
4541 |
+ |
} |
4542 |
+ |
} |
4543 |
+ |
for (uint muonIndex = 0; muonIndex != muonFlags.size(); muonIndex++){ |
4544 |
+ |
if(!muonFlags.at(muonIndex).first) continue; |
4545 |
+ |
chosenMuon = & muons->at(muonIndex); |
4546 |
+ |
break; |
4547 |
+ |
} |
4548 |
+ |
} |
4549 |
+ |
else if (find (objectsToGet.begin (), objectsToGet.end (), "muons") != objectsToGet.end ()) |
4550 |
+ |
chosenMuon = & muons->at (0); |
4551 |
+ |
|
4552 |
+ |
return chosenMuon; |
4553 |
+ |
} |
4554 |
+ |
|
4555 |
+ |
DEFINE_FWK_MODULE(OSUAnalysis); |