ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/OSUT3Analysis/AnaTools/plugins/OSUAnalysis.cc
Revision: 1.8
Committed: Wed Jan 30 22:29:59 2013 UTC (12 years, 3 months ago) by ahart
Content type: text/plain
Branch: MAIN
Changes since 1.7: +124 -80 lines
Log Message:
Added dz histograms, d0 and dz histograms for mcparticles, and code for getting the position of the first primary vertex, which is used in the calculation of d0 and dz for mcparticles. Also added equality and inequality comparisons.

File Contents

# Content
1 #include "OSUT3Analysis/AnaTools/plugins/OSUAnalysis.h"
2
3 OSUAnalysis::OSUAnalysis (const edm::ParameterSet &cfg) :
4 // Retrieve parameters from the configuration file.
5 jets_ (cfg.getParameter<edm::InputTag> ("jets")),
6 muons_ (cfg.getParameter<edm::InputTag> ("muons")),
7 electrons_ (cfg.getParameter<edm::InputTag> ("electrons")),
8 events_ (cfg.getParameter<edm::InputTag> ("events")),
9 taus_ (cfg.getParameter<edm::InputTag> ("taus")),
10 mets_ (cfg.getParameter<edm::InputTag> ("mets")),
11 tracks_ (cfg.getParameter<edm::InputTag> ("tracks")),
12 genjets_ (cfg.getParameter<edm::InputTag> ("genjets")),
13 mcparticles_ (cfg.getParameter<edm::InputTag> ("mcparticles")),
14 primaryvertexs_ (cfg.getParameter<edm::InputTag> ("primaryvertexs")),
15 bxlumis_ (cfg.getParameter<edm::InputTag> ("bxlumis")),
16 photons_ (cfg.getParameter<edm::InputTag> ("photons")),
17 superclusters_ (cfg.getParameter<edm::InputTag> ("superclusters")),
18 triggers_ (cfg.getParameter<edm::InputTag> ("triggers")),
19
20
21 channels_ (cfg.getParameter<vector<edm::ParameterSet> >("channels"))
22
23 {
24 TH1::SetDefaultSumw2 ();
25
26 // Construct Cutflow Objects. These store the results of cut decisions and
27 // handle filling cut flow histograms.
28 masterCutFlow_ = new CutFlow (fs_);
29 std::vector<TFileDirectory> directories;
30
31
32 channel tempChannel;
33 //loop over all channels (event selections)
34 for(uint currentChannel = 0; currentChannel != channels_.size(); currentChannel++){
35
36 //get name of channel
37 string channelName (channels_.at(currentChannel).getParameter<string>("name"));
38 tempChannel.name = channelName;
39 TString channelLabel = channelName;
40
41 //set triggers for this channel
42 vector<string> triggerNames;
43 triggerNames.clear();
44 tempChannel.triggers.clear();
45 if(channels_.at(currentChannel).exists("triggers")){
46 triggerNames = channels_.at(currentChannel).getParameter<vector<string> >("triggers");
47 for(uint trigger = 0; trigger!= triggerNames.size(); trigger++)
48 tempChannel.triggers.push_back(triggerNames.at(trigger));
49 allNecessaryObjects.push_back("triggers");
50 }
51
52
53 //create cutFlow for this channel
54 cutFlows_.push_back (new CutFlow (fs_, channelName));
55
56 //book a directory in the output file with the name of the channel
57 TFileDirectory subDir = fs_->mkdir( channelName );
58 directories.push_back(subDir);
59 std::map<std::string, TH1D*> histoMap;
60 oneDHists_.push_back(histoMap);
61
62 //gen histograms
63 oneDHists_.at(currentChannel)["genD0"] = directories.at(currentChannel).make<TH1D> ("genD0",channelLabel+" channel: Gen d_{0}; d_{0} [cm] ", 1000, -1, 1);
64 oneDHists_.at(currentChannel)["genAbsD0"] = directories.at(currentChannel).make<TH1D> ("genAbsD0",channelLabel+" channel: Gen d_{0}; |d_{0}| [cm] ", 1000, 0, 1);
65 oneDHists_.at(currentChannel)["genDZ"] = directories.at(currentChannel).make<TH1D> ("genDZ",channelLabel+" channel: Gen d_{z}; d_{z} [cm] ", 1000, -10, 10);
66 oneDHists_.at(currentChannel)["genAbsDZ"] = directories.at(currentChannel).make<TH1D> ("genAbsDZ",channelLabel+" channel: Gen d_{z}; |d_{z}| [cm] ", 1000, 0, 10);
67
68 //muon histograms
69 allNecessaryObjects.push_back("muons");
70 oneDHists_.at(currentChannel)["muonPt"] = directories.at(currentChannel).make<TH1D> ("muonPt",channelLabel+" channel: Muon Transverse Momentum; p_{T} [GeV]", 100, 0, 500);
71 oneDHists_.at(currentChannel)["muonEta"] = directories.at(currentChannel).make<TH1D> ("muonEta",channelLabel+" channel: Muon Eta; #eta", 100, -5, 5);
72 oneDHists_.at(currentChannel)["muonD0"] = directories.at(currentChannel).make<TH1D> ("muonD0",channelLabel+" channel: Muon d_{0}; d_{0} [cm] ", 1000, -1, 1);
73 oneDHists_.at(currentChannel)["muonDz"] = directories.at(currentChannel).make<TH1D> ("muonDz",channelLabel+" channel: Muon d_{z}; d_{z} [cm] ", 1000, -20, 20);
74 oneDHists_.at(currentChannel)["muonAbsD0"] = directories.at(currentChannel).make<TH1D> ("muonAbsD0",channelLabel+" channel: Muon d_{0}; |d_{0}| [cm] ", 1000, 0, 1);
75 oneDHists_.at(currentChannel)["muonDZ"] = directories.at(currentChannel).make<TH1D> ("muonDZ",channelLabel+" channel: Muon d_{z}; d_{z} [cm] ", 1000, -10, 10);
76 oneDHists_.at(currentChannel)["muonAbsDZ"] = directories.at(currentChannel).make<TH1D> ("muonAbsDZ",channelLabel+" channel: Muon d_{z}; |d_{z}| [cm] ", 1000, 0, 10);
77 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);
78 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);
79 oneDHists_.at(currentChannel)["muonIso"] = directories.at(currentChannel).make<TH1D> ("muonIso",channelLabel+" channel: Muon Combined Relative Isolation; rel. iso. ", 1000, 0, 1);
80 oneDHists_.at(currentChannel)["numMuons"] = directories.at(currentChannel).make<TH1D> ("numMuons",channelLabel+" channel: Number of Selected Muons; # muons", 10, 0, 10);
81
82
83 //electron histograms
84 allNecessaryObjects.push_back("electrons");
85 oneDHists_.at(currentChannel)["electronPt"] = directories.at(currentChannel).make<TH1D> ("electronPt",channelLabel+" channel: Electron Transverse Momentum; p_{T} [GeV]", 100, 0, 500);
86 oneDHists_.at(currentChannel)["electronEta"] = directories.at(currentChannel).make<TH1D> ("electronEta",channelLabel+" channel: Electron Eta; #eta", 50, -5, 5);
87 oneDHists_.at(currentChannel)["electronD0"] = directories.at(currentChannel).make<TH1D> ("electronD0",channelLabel+" channel: Electron d_{0}; d_{0} [cm] ", 1000, -1, 1);
88 oneDHists_.at(currentChannel)["electronDz"] = directories.at(currentChannel).make<TH1D> ("electronDz",channelLabel+" channel: Electron d_{z}; d_{z} [cm] ", 1000, -20, 20);
89 oneDHists_.at(currentChannel)["electronAbsD0"] = directories.at(currentChannel).make<TH1D> ("electronAbsD0",channelLabel+" channel: Electron d_{0}; |d_{0}| [cm] ", 1000, 0, 1);
90 oneDHists_.at(currentChannel)["electronDZ"] = directories.at(currentChannel).make<TH1D> ("electronDZ",channelLabel+" channel: Electron d_{z}; d_{z} [cm] ", 1000, -10, 10);
91 oneDHists_.at(currentChannel)["electronAbsDZ"] = directories.at(currentChannel).make<TH1D> ("electronAbsDZ",channelLabel+" channel: Electron d_{z}; |d_{z}| [cm] ", 1000, 0, 10);
92 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);
93 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);
94 oneDHists_.at(currentChannel)["electronIso"] = directories.at(currentChannel).make<TH1D> ("electronIso",channelLabel+" channel: Electron Combined Relative Isolation; rel. iso. ", 1000, 0, 1);
95 oneDHists_.at(currentChannel)["electronFbrem"] = directories.at(currentChannel).make<TH1D> ("electronFbrem",channelLabel+" channel: Electron Brem. Energy Fraction; fbrem", 1000, 0, 2);
96 oneDHists_.at(currentChannel)["electronMVATrig"] = directories.at(currentChannel).make<TH1D> ("electronMVATrig",channelLabel+" channel: Electron ID MVA Output", 100, -1, 1);
97 oneDHists_.at(currentChannel)["electronMVANonTrig"] = directories.at(currentChannel).make<TH1D> ("electronMVANonTrig",channelLabel+" channel: Electron ID MVA Output", 100, -1, 1);
98 oneDHists_.at(currentChannel)["numElectrons"] = directories.at(currentChannel).make<TH1D> ("numElectrons",channelLabel+" channel: Number of Selected Electrons; # electrons", 10, 0, 10);
99
100
101
102 //get list of cuts for this channel
103 vector<edm::ParameterSet> cuts_ (channels_.at(currentChannel).getParameter<vector<edm::ParameterSet> >("cuts"));
104
105 vector<string> tempInputCollections;
106
107
108 //loop over and parse all cuts
109 for(uint currentCut = 0; currentCut != cuts_.size(); currentCut++){
110
111 cut tempCut;
112 //store input collection for cut
113 string inputCollection = cuts_.at(currentCut).getParameter<string> ("inputCollection");
114 tempCut.inputCollection = inputCollection;
115
116 tempInputCollections.push_back(inputCollection);
117 allNecessaryObjects.push_back(inputCollection);
118
119 //split cut string into parts and store them
120 string cutString = cuts_.at(currentCut).getParameter<string> ("cutString");
121 std::vector<string> cutStringVector = splitString(cutString);
122 tempCut.variable = cutStringVector.at(0);// variable to cut on
123 tempCut.comparativeOperator = cutStringVector.at(1);// comparison to make
124 tempCut.cutValue = atof(cutStringVector.at(2).c_str());// threshold value to pass cut
125
126 //get number of objects required to pass cut for event to pass
127 string numberRequiredString = cuts_.at(currentCut).getParameter<string> ("numberRequired");
128 std::vector<string> numberRequiredVector = splitString(numberRequiredString);
129
130 // determine number required if comparison contains "="
131 int numberRequiredInt = atoi(numberRequiredVector.at(1).c_str());
132 if(numberRequiredVector.at(0) == ">") numberRequiredInt++;
133 else if(numberRequiredVector.at(0) == "<") numberRequiredInt--;
134
135 tempCut.numberRequired = numberRequiredInt;// number of objects required to pass the cut
136 tempCut.eventComparativeOperator = numberRequiredVector.at(0);// comparison to make
137
138 if(cuts_.at(currentCut).exists("function")){
139 tempCut.function = cuts_.at(currentCut).getParameter<string> ("function");
140 }
141 else tempCut.function = "";
142 string tempCutName;
143 if(cuts_.at(currentCut).exists("alias")){
144 tempCutName = cuts_.at(currentCut).getParameter<string> ("alias");
145 }
146 else{
147 //construct string for cutflow table
148 bool plural = numberRequiredInt != 1;
149 string collectionString = plural ? inputCollection : inputCollection.substr(0, inputCollection.size()-1);
150 string cutName = numberRequiredString + " " + collectionString + " with " + cutString;
151 tempCutName = cutName;
152 }
153 tempCut.name = tempCutName;
154
155
156 tempChannel.cuts.push_back(tempCut);
157
158
159 }//end loop over cuts
160
161 //make unique vector of all objects that this channel cuts on (so we know to set flags for those)
162 sort( tempInputCollections.begin(), tempInputCollections.end() );
163 tempInputCollections.erase( unique( tempInputCollections.begin(), tempInputCollections.end() ), tempInputCollections.end() );
164 tempChannel.inputCollections = tempInputCollections;
165
166 channels.push_back(tempChannel);
167 tempChannel.cuts.clear();
168
169 }//end loop over channels
170
171 //make unique vector of objects we need to cut on (so we make sure to get them from the event)
172 sort( allNecessaryObjects.begin(), allNecessaryObjects.end() );
173 allNecessaryObjects.erase( unique( allNecessaryObjects.begin(), allNecessaryObjects.end() ), allNecessaryObjects.end() );
174
175
176 }
177
178 OSUAnalysis::~OSUAnalysis ()
179 {
180 // Destroying the CutFlow objects causes the cut flow numbers and time
181 // information to be printed to standard output.
182 for(uint currentChannel = 0; currentChannel != channels_.size(); currentChannel++){
183 delete cutFlows_.at(currentChannel);
184 }
185 }
186
187 void
188 OSUAnalysis::analyze (const edm::Event &event, const edm::EventSetup &setup)
189 {
190
191
192 // Retrieve necessary collections from the event.
193 edm::Handle<BNtriggerCollection> triggers;
194 if (std::find(allNecessaryObjects.begin(), allNecessaryObjects.end(), "triggers") != allNecessaryObjects.end())
195 event.getByLabel (triggers_, triggers);
196
197 edm::Handle<BNjetCollection> jets;
198 if (std::find(allNecessaryObjects.begin(), allNecessaryObjects.end(), "jets") != allNecessaryObjects.end())
199 event.getByLabel (jets_, jets);
200
201 edm::Handle<BNmuonCollection> muons;
202 if (std::find(allNecessaryObjects.begin(), allNecessaryObjects.end(), "muons") != allNecessaryObjects.end())
203 event.getByLabel (muons_, muons);
204
205 edm::Handle<BNelectronCollection> electrons;
206 if (std::find(allNecessaryObjects.begin(), allNecessaryObjects.end(), "electrons") != allNecessaryObjects.end())
207 event.getByLabel (electrons_, electrons);
208
209 edm::Handle<BNeventCollection> events;
210 if (std::find(allNecessaryObjects.begin(), allNecessaryObjects.end(), "events") != allNecessaryObjects.end())
211 event.getByLabel (events_, events);
212
213 edm::Handle<BNtauCollection> taus;
214 if (std::find(allNecessaryObjects.begin(), allNecessaryObjects.end(), "taus") != allNecessaryObjects.end())
215 event.getByLabel (taus_, taus);
216
217 edm::Handle<BNmetCollection> mets;
218 if (std::find(allNecessaryObjects.begin(), allNecessaryObjects.end(), "mets") != allNecessaryObjects.end())
219 event.getByLabel (mets_, mets);
220
221 edm::Handle<BNtrackCollection> tracks;
222 if (std::find(allNecessaryObjects.begin(), allNecessaryObjects.end(), "tracks") != allNecessaryObjects.end())
223 event.getByLabel (tracks_, tracks);
224
225 edm::Handle<BNgenjetCollection> genjets;
226 if (std::find(allNecessaryObjects.begin(), allNecessaryObjects.end(), "genjets") != allNecessaryObjects.end())
227 event.getByLabel (genjets_, genjets);
228
229 edm::Handle<BNmcparticleCollection> mcparticles;
230 if (std::find(allNecessaryObjects.begin(), allNecessaryObjects.end(), "mcparticles") != allNecessaryObjects.end())
231 event.getByLabel (mcparticles_, mcparticles);
232
233 edm::Handle<BNprimaryvertexCollection> primaryvertexs;
234 if (std::find(allNecessaryObjects.begin(), allNecessaryObjects.end(), "primaryvertexs") != allNecessaryObjects.end())
235 event.getByLabel (primaryvertexs_, primaryvertexs);
236
237 edm::Handle<BNbxlumiCollection> bxlumis;
238 if (std::find(allNecessaryObjects.begin(), allNecessaryObjects.end(), "bxlumis") != allNecessaryObjects.end())
239 event.getByLabel (bxlumis_, bxlumis);
240
241 edm::Handle<BNphotonCollection> photons;
242 if (std::find(allNecessaryObjects.begin(), allNecessaryObjects.end(), "photons") != allNecessaryObjects.end())
243 event.getByLabel (photons_, photons);
244
245 edm::Handle<BNsuperclusterCollection> superclusters;
246 if (std::find(allNecessaryObjects.begin(), allNecessaryObjects.end(), "superclusters") != allNecessaryObjects.end())
247 event.getByLabel (superclusters_, superclusters);
248
249
250 //loop over all channels
251
252 for(uint currentChannelIndex = 0; currentChannelIndex != channels.size(); currentChannelIndex++){
253 channel currentChannel = channels.at(currentChannelIndex);
254
255 flagMap individualFlags;
256 flagMap cumulativeFlags;
257 counterMap passingCounter;
258
259 bool triggerDecision = true;
260 if(currentChannel.triggers.size() != 0){ //triggers specified
261 triggerDecision = evaluateTriggers(currentChannel.triggers,triggers.product());
262 cutFlows_.at(currentChannelIndex)->at ("trigger") = triggerDecision;
263 }
264
265 //loop over all cuts
266 for(uint currentCutIndex = 0; currentCutIndex != currentChannel.cuts.size(); currentCutIndex++){
267 cut currentCut = currentChannel.cuts.at(currentCutIndex);
268
269 for(uint currentObjectIndex = 0; currentObjectIndex != allNecessaryObjects.size(); currentObjectIndex++){
270
271 string currentObject = allNecessaryObjects.at(currentObjectIndex);
272 individualFlags[currentObject].push_back (vector<bool> ());
273 cumulativeFlags[currentObject].push_back (vector<bool> ());
274
275 if(currentObject == "jets") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,jets.product(),"jets");
276 else if(currentObject == "muons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),"muons");
277 else if(currentObject == "electrons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),"electrons");
278 else if(currentObject == "events") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,events.product(),"events");
279 else if(currentObject == "taus") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,taus.product(),"taus");
280 else if(currentObject == "mets") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,mets.product(),"mets");
281 else if(currentObject == "tracks") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,tracks.product(),"tracks");
282 else if(currentObject == "genjets") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,genjets.product(),"genjets");
283 else if(currentObject == "mcparticles") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,mcparticles.product(),"mcparticles");
284 else if(currentObject == "primaryvertexs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,primaryvertexs.product(),"primaryvertexs");
285 else if(currentObject == "bxlumis") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,bxlumis.product(),"bxlumis");
286 else if(currentObject == "photons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,photons.product(),"photons");
287 else if(currentObject == "superclusters") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,superclusters.product(),"superclusters");
288
289
290 }
291
292
293
294 }//end loop over all cuts
295
296
297
298
299 //use cumulative flags to apply cuts at event level
300
301 bool eventPassedAllCuts = true;
302
303 //apply trigger (true if none were specified)
304 eventPassedAllCuts = eventPassedAllCuts && triggerDecision;
305
306
307 for(uint currentCutIndex = 0; currentCutIndex != currentChannel.cuts.size(); currentCutIndex++){
308
309 //loop over all objects and count how many passed the cumulative selection up to this point
310 cut currentCut = currentChannel.cuts.at(currentCutIndex);
311 int numberPassing = 0;
312
313 for (uint object = 0; object != cumulativeFlags[currentCut.inputCollection].at(currentCutIndex).size() ; object++)
314 if(cumulativeFlags[currentCut.inputCollection].at(currentCutIndex).at(object)) numberPassing++;
315
316
317 bool cutDecision = evaluateComparison(numberPassing,currentCut.eventComparativeOperator,currentCut.numberRequired);
318 cutFlows_.at(currentChannelIndex)->at (currentCut.name) = cutDecision;
319
320 eventPassedAllCuts = eventPassedAllCuts && cutDecision;
321
322 }
323
324 cutFlows_.at(currentChannelIndex)->fillCutFlow();
325
326
327
328 if(!eventPassedAllCuts)continue;
329
330
331 TVector3 vertexPosition;
332 vector<bool> vertexFlags = cumulativeFlags["primaryvertexs"].back();
333
334 for (uint vertexIndex = 0; vertexIndex != vertexFlags.size(); vertexIndex++){
335 if(!vertexFlags.at(vertexIndex)) continue;
336
337 vertexPosition.SetXYZ (primaryvertexs->at(vertexIndex).x,primaryvertexs->at(vertexIndex).y,primaryvertexs->at(vertexIndex).z);
338 break;
339 }
340
341 vector<bool> mcparticleFlags = cumulativeFlags["mcparticles"].back();
342
343 for (uint mcparticleIndex = 0; mcparticleIndex != mcparticleFlags.size(); mcparticleIndex++){
344 if(!mcparticleFlags.at(mcparticleIndex)) continue;
345
346 double vx = mcparticles->at(mcparticleIndex).vx - vertexPosition.X (),
347 vy = mcparticles->at(mcparticleIndex).vy - vertexPosition.Y (),
348 vz = mcparticles->at(mcparticleIndex).vz - vertexPosition.Z (),
349 px = mcparticles->at(mcparticleIndex).px,
350 py = mcparticles->at(mcparticleIndex).py,
351 pt = mcparticles->at(mcparticleIndex).pt,
352 d0;
353
354 d0 = (-vx * py + vy * px) / pt;
355 oneDHists_.at(currentChannelIndex)["genD0"]->Fill (d0);
356 oneDHists_.at(currentChannelIndex)["genAbsD0"]->Fill (fabs (d0));
357 oneDHists_.at(currentChannelIndex)["genDZ"]->Fill (vz);
358 oneDHists_.at(currentChannelIndex)["genAbsDZ"]->Fill (fabs (vz));
359 }
360
361 vector<bool> electronFlags = cumulativeFlags["electrons"].back();
362 int electronCounter = 0;
363
364 for (uint electronIndex = 0; electronIndex != electronFlags.size(); electronIndex++){
365 if(!electronFlags.at(electronIndex)) continue;
366
367
368 electronCounter++;
369 oneDHists_.at(currentChannelIndex)["electronPt"]->Fill (electrons->at(electronIndex).pt);
370 oneDHists_.at(currentChannelIndex)["electronEta"]->Fill (electrons->at(electronIndex).eta);
371 oneDHists_.at(currentChannelIndex)["electronD0"]->Fill (electrons->at(electronIndex).correctedD0Vertex);
372 oneDHists_.at(currentChannelIndex)["electronDz"]->Fill (electrons->at(electronIndex).correctedDZ);
373 oneDHists_.at(currentChannelIndex)["electronAbsD0"]->Fill (fabs(electrons->at(electronIndex).correctedD0Vertex));
374 oneDHists_.at(currentChannelIndex)["electronDZ"]->Fill (electrons->at(electronIndex).correctedDZ);
375 oneDHists_.at(currentChannelIndex)["electronAbsDZ"]->Fill (fabs(electrons->at(electronIndex).correctedDZ));
376 oneDHists_.at(currentChannelIndex)["electronD0Sig"]->Fill (electrons->at(electronIndex).correctedD0Vertex / electrons->at(electronIndex).tkD0err);
377 oneDHists_.at(currentChannelIndex)["electronAbsD0Sig"]->Fill (fabs(electrons->at(electronIndex).correctedD0Vertex) / electrons->at(electronIndex).tkD0err);
378 oneDHists_.at(currentChannelIndex)["electronIso"]->Fill (electrons->at(electronIndex).puChargedHadronIso / electrons->at(electronIndex).pt);
379 oneDHists_.at(currentChannelIndex)["electronFbrem"]->Fill (electrons->at(electronIndex).fbrem);
380 oneDHists_.at(currentChannelIndex)["electronMVATrig"]->Fill (electrons->at(electronIndex).mvaTrigV0);
381 oneDHists_.at(currentChannelIndex)["electronMVANonTrig"]->Fill (electrons->at(electronIndex).mvaNonTrigV0);
382
383 }
384 oneDHists_.at(currentChannelIndex)["numElectrons"]->Fill (electronCounter);
385
386
387 vector<bool> muonFlags = cumulativeFlags["muons"].back();
388 int muonCounter = 0;
389
390
391 for (uint muonIndex = 0; muonIndex != muonFlags.size(); muonIndex++){
392 if(!muonFlags.at(muonIndex)) continue;
393 muonCounter++;
394
395 oneDHists_.at(currentChannelIndex)["muonPt"]->Fill (muons->at(muonIndex).pt);
396 oneDHists_.at(currentChannelIndex)["muonEta"]->Fill (muons->at(muonIndex).eta);
397 oneDHists_.at(currentChannelIndex)["muonD0"]->Fill (muons->at(muonIndex).correctedD0Vertex);
398 oneDHists_.at(currentChannelIndex)["muonDz"]->Fill (muons->at(muonIndex).correctedDZ);
399 oneDHists_.at(currentChannelIndex)["muonAbsD0"]->Fill (fabs(muons->at(muonIndex).correctedD0Vertex));
400 oneDHists_.at(currentChannelIndex)["muonDZ"]->Fill (muons->at(muonIndex).correctedDZ);
401 oneDHists_.at(currentChannelIndex)["muonAbsDZ"]->Fill (fabs(muons->at(muonIndex).correctedDZ));
402 oneDHists_.at(currentChannelIndex)["muonD0Sig"]->Fill (muons->at(muonIndex).correctedD0Vertex / muons->at(muonIndex).tkD0err);
403 oneDHists_.at(currentChannelIndex)["muonAbsD0Sig"]->Fill (fabs(muons->at(muonIndex).correctedD0Vertex) / muons->at(muonIndex).tkD0err);
404 oneDHists_.at(currentChannelIndex)["muonIso"]->Fill (muons->at(muonIndex).puChargedHadronIso / muons->at(muonIndex).pt);
405 }
406 oneDHists_.at(currentChannelIndex)["numMuons"]->Fill (muonCounter);
407
408
409
410
411
412 } //end loop over channel
413
414 masterCutFlow_->fillCutFlow();
415
416
417 }
418
419
420 bool
421 OSUAnalysis::evaluateComparison (double testValue, string comparison, double cutValue){
422
423
424 if(comparison == ">") return testValue > cutValue;
425 else if(comparison == ">=") return testValue >= cutValue;
426 else if(comparison == "<") return testValue < cutValue;
427 else if(comparison == "<=") return testValue <= cutValue;
428 else if(comparison == "==") return testValue == cutValue;
429 else if(comparison == "!=") return testValue != cutValue;
430 else {std::cout << "WARNING: invalid comparison operator '" << comparison << "'\n"; return false;}
431
432 }
433
434 bool
435 OSUAnalysis::evaluateTriggers (vector<string> triggersToTest, const BNtriggerCollection* triggerCollection){
436
437 bool triggerDecision = false;
438
439 for (BNtriggerCollection::const_iterator trigger = triggerCollection->begin (); trigger != triggerCollection->end (); trigger++)
440 {
441 if(trigger->pass != 1) continue;
442 for(uint triggerName = 0; triggerName != triggersToTest.size(); triggerName++)
443 {
444 if(trigger->name.find(triggersToTest.at(triggerName))!=std::string::npos){
445 triggerDecision = true;
446 }
447 }
448 }
449 return triggerDecision;
450
451 }
452
453 std::vector<std::string>
454 OSUAnalysis::splitString (string inputString){
455
456 std::stringstream stringStream(inputString);
457 std::istream_iterator<std::string> begin(stringStream);
458 std::istream_iterator<std::string> end;
459 std::vector<std::string> stringVector(begin, end);
460 return stringVector;
461
462 }
463
464 double
465 OSUAnalysis::valueLookup (const BNjet* object, string variable, string function){
466
467 double value = 0.0;
468 if(variable == "energy") value = object->energy;
469 else if(variable == "et") value = object->et;
470 else if(variable == "pt") value = object->pt;
471 else if(variable == "px") value = object->px;
472 else if(variable == "py") value = object->py;
473 else if(variable == "pz") value = object->pz;
474 else if(variable == "phi") value = object->phi;
475 else if(variable == "eta") value = object->eta;
476 else if(variable == "theta") value = object->theta;
477 else if(variable == "Upt") value = object->Upt;
478 else if(variable == "Uenergy") value = object->Uenergy;
479 else if(variable == "L2pt") value = object->L2pt;
480 else if(variable == "L2L3pt") value = object->L2L3pt;
481 else if(variable == "L2L3respt") value = object->L2L3respt;
482 else if(variable == "respt") value = object->respt;
483 else if(variable == "EMfrac") value = object->EMfrac;
484 else if(variable == "Hadfrac") value = object->Hadfrac;
485 else if(variable == "charge") value = object->charge;
486 else if(variable == "mass") value = object->mass;
487 else if(variable == "area") value = object->area;
488 else if(variable == "fHPD") value = object->fHPD;
489 else if(variable == "approximatefHPD") value = object->approximatefHPD;
490 else if(variable == "genPartonET") value = object->genPartonET;
491 else if(variable == "genPartonPT") value = object->genPartonPT;
492 else if(variable == "genPartonEta") value = object->genPartonEta;
493 else if(variable == "genPartonPhi") value = object->genPartonPhi;
494 else if(variable == "genJetET") value = object->genJetET;
495 else if(variable == "genJetPT") value = object->genJetPT;
496 else if(variable == "genJetEta") value = object->genJetEta;
497 else if(variable == "genJetPhi") value = object->genJetPhi;
498 else if(variable == "btagTChighPur") value = object->btagTChighPur;
499 else if(variable == "btagTChighEff") value = object->btagTChighEff;
500 else if(variable == "btagJetProb") value = object->btagJetProb;
501 else if(variable == "btagJetBProb") value = object->btagJetBProb;
502 else if(variable == "btagSoftEle") value = object->btagSoftEle;
503 else if(variable == "btagSoftMuon") value = object->btagSoftMuon;
504 else if(variable == "btagSoftMuonNoIP") value = object->btagSoftMuonNoIP;
505 else if(variable == "btagSecVertex") value = object->btagSecVertex;
506 else if(variable == "btagSecVertexHighEff") value = object->btagSecVertexHighEff;
507 else if(variable == "btagSecVertexHighPur") value = object->btagSecVertexHighPur;
508 else if(variable == "btagCombinedSecVertex") value = object->btagCombinedSecVertex;
509 else if(variable == "btagCombinedSecVertexMVA") value = object->btagCombinedSecVertexMVA;
510 else if(variable == "btagSoftMuonByPt") value = object->btagSoftMuonByPt;
511 else if(variable == "btagSoftMuonByIP3") value = object->btagSoftMuonByIP3;
512 else if(variable == "btagSoftElectronByPt") value = object->btagSoftElectronByPt;
513 else if(variable == "btagSoftElectronByIP3") value = object->btagSoftElectronByIP3;
514 else if(variable == "n90Hits") value = object->n90Hits;
515 else if(variable == "hitsInN90") value = object->hitsInN90;
516 else if(variable == "chargedHadronEnergyFraction") value = object->chargedHadronEnergyFraction;
517 else if(variable == "neutralHadronEnergyFraction") value = object->neutralHadronEnergyFraction;
518 else if(variable == "chargedEmEnergyFraction") value = object->chargedEmEnergyFraction;
519 else if(variable == "neutralEmEnergyFraction") value = object->neutralEmEnergyFraction;
520 else if(variable == "fLong") value = object->fLong;
521 else if(variable == "fShort") value = object->fShort;
522 else if(variable == "etaetaMoment") value = object->etaetaMoment;
523 else if(variable == "phiphiMoment") value = object->phiphiMoment;
524 else if(variable == "JESunc") value = object->JESunc;
525 else if(variable == "JECuncUp") value = object->JECuncUp;
526 else if(variable == "JECuncDown") value = object->JECuncDown;
527 else if(variable == "puJetMVA_full") value = object->puJetMVA_full;
528 else if(variable == "puJetMVA_simple") value = object->puJetMVA_simple;
529 else if(variable == "puJetMVA_cutbased") value = object->puJetMVA_cutbased;
530 else if(variable == "dZ") value = object->dZ;
531 else if(variable == "dR2Mean") value = object->dR2Mean;
532 else if(variable == "dRMean") value = object->dRMean;
533 else if(variable == "frac01") value = object->frac01;
534 else if(variable == "frac02") value = object->frac02;
535 else if(variable == "frac03") value = object->frac03;
536 else if(variable == "frac04") value = object->frac04;
537 else if(variable == "frac05") value = object->frac05;
538 else if(variable == "frac06") value = object->frac06;
539 else if(variable == "frac07") value = object->frac07;
540 else if(variable == "beta") value = object->beta;
541 else if(variable == "betaStar") value = object->betaStar;
542 else if(variable == "betaClassic") value = object->betaClassic;
543 else if(variable == "betaStarClassic") value = object->betaStarClassic;
544 else if(variable == "ptD") value = object->ptD;
545 else if(variable == "nvtx") value = object->nvtx;
546 else if(variable == "d0") value = object->d0;
547 else if(variable == "leadCandPt") value = object->leadCandPt;
548 else if(variable == "leadCandVx") value = object->leadCandVx;
549 else if(variable == "leadCandVy") value = object->leadCandVy;
550 else if(variable == "leadCandVz") value = object->leadCandVz;
551 else if(variable == "leadCandDistFromPV") value = object->leadCandDistFromPV;
552 else if(variable == "flavour") value = object->flavour;
553 else if(variable == "Nconst") value = object->Nconst;
554 else if(variable == "jetIDMinimal") value = object->jetIDMinimal;
555 else if(variable == "jetIDLooseAOD") value = object->jetIDLooseAOD;
556 else if(variable == "jetIDLoose") value = object->jetIDLoose;
557 else if(variable == "jetIDTight") value = object->jetIDTight;
558 else if(variable == "genPartonId") value = object->genPartonId;
559 else if(variable == "genPartonMotherId") value = object->genPartonMotherId;
560 else if(variable == "genPartonMother0Id") value = object->genPartonMother0Id;
561 else if(variable == "genPartonMother1Id") value = object->genPartonMother1Id;
562 else if(variable == "genPartonGrandMotherId") value = object->genPartonGrandMotherId;
563 else if(variable == "genPartonGrandMother00Id") value = object->genPartonGrandMother00Id;
564 else if(variable == "genPartonGrandMother01Id") value = object->genPartonGrandMother01Id;
565 else if(variable == "genPartonGrandMother10Id") value = object->genPartonGrandMother10Id;
566 else if(variable == "genPartonGrandMother11Id") value = object->genPartonGrandMother11Id;
567 else if(variable == "chargedMultiplicity") value = object->chargedMultiplicity;
568 else if(variable == "neutralMultiplicity") value = object->neutralMultiplicity;
569 else if(variable == "nconstituents") value = object->nconstituents;
570 else if(variable == "nHit") value = object->nHit;
571 else if(variable == "puJetId_full") value = object->puJetId_full;
572 else if(variable == "puJetId_simple") value = object->puJetId_simple;
573 else if(variable == "puJetId_cutbased") value = object->puJetId_cutbased;
574 else if(variable == "puJetId_tight_full") value = object->puJetId_tight_full;
575 else if(variable == "puJetId_tight_simple") value = object->puJetId_tight_simple;
576 else if(variable == "puJetId_tight_cutbased") value = object->puJetId_tight_cutbased;
577 else if(variable == "puJetId_medium_full") value = object->puJetId_medium_full;
578 else if(variable == "puJetId_medium_simple") value = object->puJetId_medium_simple;
579 else if(variable == "puJetId_medium_cutbased") value = object->puJetId_medium_cutbased;
580 else if(variable == "puJetId_loose_full") value = object->puJetId_loose_full;
581 else if(variable == "puJetId_loose_simple") value = object->puJetId_loose_simple;
582 else if(variable == "puJetId_loose_cutbased") value = object->puJetId_loose_cutbased;
583
584
585 else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
586
587 value = applyFunction(function, value);
588
589 return value;
590 }
591
592
593
594 double
595 OSUAnalysis::valueLookup (const BNmuon* object, string variable, string function){
596
597 double value = 0.0;
598 if(variable == "energy") value = object->energy;
599 else if(variable == "et") value = object->et;
600 else if(variable == "pt") value = object->pt;
601 else if(variable == "px") value = object->px;
602 else if(variable == "py") value = object->py;
603 else if(variable == "pz") value = object->pz;
604 else if(variable == "phi") value = object->phi;
605 else if(variable == "eta") value = object->eta;
606 else if(variable == "theta") value = object->theta;
607 else if(variable == "trackIso") value = object->trackIso;
608 else if(variable == "ecalIso") value = object->ecalIso;
609 else if(variable == "hcalIso") value = object->hcalIso;
610 else if(variable == "caloIso") value = object->caloIso;
611 else if(variable == "trackIsoDR03") value = object->trackIsoDR03;
612 else if(variable == "ecalIsoDR03") value = object->ecalIsoDR03;
613 else if(variable == "hcalIsoDR03") value = object->hcalIsoDR03;
614 else if(variable == "caloIsoDR03") value = object->caloIsoDR03;
615 else if(variable == "trackVetoIsoDR03") value = object->trackVetoIsoDR03;
616 else if(variable == "ecalVetoIsoDR03") value = object->ecalVetoIsoDR03;
617 else if(variable == "hcalVetoIsoDR03") value = object->hcalVetoIsoDR03;
618 else if(variable == "caloVetoIsoDR03") value = object->caloVetoIsoDR03;
619 else if(variable == "trackIsoDR05") value = object->trackIsoDR05;
620 else if(variable == "ecalIsoDR05") value = object->ecalIsoDR05;
621 else if(variable == "hcalIsoDR05") value = object->hcalIsoDR05;
622 else if(variable == "caloIsoDR05") value = object->caloIsoDR05;
623 else if(variable == "trackVetoIsoDR05") value = object->trackVetoIsoDR05;
624 else if(variable == "ecalVetoIsoDR05") value = object->ecalVetoIsoDR05;
625 else if(variable == "hcalVetoIsoDR05") value = object->hcalVetoIsoDR05;
626 else if(variable == "caloVetoIsoDR05") value = object->caloVetoIsoDR05;
627 else if(variable == "hcalE") value = object->hcalE;
628 else if(variable == "ecalE") value = object->ecalE;
629 else if(variable == "genET") value = object->genET;
630 else if(variable == "genPT") value = object->genPT;
631 else if(variable == "genPhi") value = object->genPhi;
632 else if(variable == "genEta") value = object->genEta;
633 else if(variable == "genMotherET") value = object->genMotherET;
634 else if(variable == "genMotherPT") value = object->genMotherPT;
635 else if(variable == "genMotherPhi") value = object->genMotherPhi;
636 else if(variable == "genMotherEta") value = object->genMotherEta;
637 else if(variable == "vx") value = object->vx;
638 else if(variable == "vy") value = object->vy;
639 else if(variable == "vz") value = object->vz;
640 else if(variable == "tkNormChi2") value = object->tkNormChi2;
641 else if(variable == "tkPT") value = object->tkPT;
642 else if(variable == "tkEta") value = object->tkEta;
643 else if(variable == "tkPhi") value = object->tkPhi;
644 else if(variable == "tkDZ") value = object->tkDZ;
645 else if(variable == "tkD0") value = object->tkD0;
646 else if(variable == "tkD0bs") value = object->tkD0bs;
647 else if(variable == "tkD0err") value = object->tkD0err;
648 else if(variable == "samNormChi2") value = object->samNormChi2;
649 else if(variable == "samPT") value = object->samPT;
650 else if(variable == "samEta") value = object->samEta;
651 else if(variable == "samPhi") value = object->samPhi;
652 else if(variable == "samDZ") value = object->samDZ;
653 else if(variable == "samD0") value = object->samD0;
654 else if(variable == "samD0bs") value = object->samD0bs;
655 else if(variable == "samD0err") value = object->samD0err;
656 else if(variable == "comNormChi2") value = object->comNormChi2;
657 else if(variable == "comPT") value = object->comPT;
658 else if(variable == "comEta") value = object->comEta;
659 else if(variable == "comPhi") value = object->comPhi;
660 else if(variable == "comDZ") value = object->comDZ;
661 else if(variable == "comD0") value = object->comD0;
662 else if(variable == "comD0bs") value = object->comD0bs;
663 else if(variable == "comD0err") value = object->comD0err;
664 else if(variable == "isolationR03emVetoEt") value = object->isolationR03emVetoEt;
665 else if(variable == "isolationR03hadVetoEt") value = object->isolationR03hadVetoEt;
666 else if(variable == "normalizedChi2") value = object->normalizedChi2;
667 else if(variable == "dVzPVz") value = object->dVzPVz;
668 else if(variable == "dB") value = object->dB;
669 else if(variable == "ptErr") value = object->ptErr;
670 else if(variable == "innerTrackNormChi2") value = object->innerTrackNormChi2;
671 else if(variable == "correctedD0") value = object->correctedD0;
672 else if(variable == "correctedD0Vertex") value = object->correctedD0Vertex;
673 else if(variable == "correctedDZ") value = object->correctedDZ;
674 else if(variable == "particleIso") value = object->particleIso;
675 else if(variable == "chargedHadronIso") value = object->chargedHadronIso;
676 else if(variable == "neutralHadronIso") value = object->neutralHadronIso;
677 else if(variable == "photonIso") value = object->photonIso;
678 else if(variable == "puChargedHadronIso") value = object->puChargedHadronIso;
679 else if(variable == "chargedHadronIsoDR03") value = object->chargedHadronIsoDR03;
680 else if(variable == "neutralHadronIsoDR03") value = object->neutralHadronIsoDR03;
681 else if(variable == "photonIsoDR03") value = object->photonIsoDR03;
682 else if(variable == "puChargedHadronIsoDR03") value = object->puChargedHadronIsoDR03;
683 else if(variable == "chargedHadronIsoDR04") value = object->chargedHadronIsoDR04;
684 else if(variable == "neutralHadronIsoDR04") value = object->neutralHadronIsoDR04;
685 else if(variable == "photonIsoDR04") value = object->photonIsoDR04;
686 else if(variable == "puChargedHadronIsoDR04") value = object->puChargedHadronIsoDR04;
687 else if(variable == "rhoPrime") value = object->rhoPrime;
688 else if(variable == "AEffDr03") value = object->AEffDr03;
689 else if(variable == "AEffDr04") value = object->AEffDr04;
690 else if(variable == "pfIsoR03SumChargedHadronPt") value = object->pfIsoR03SumChargedHadronPt;
691 else if(variable == "pfIsoR03SumNeutralHadronEt") value = object->pfIsoR03SumNeutralHadronEt;
692 else if(variable == "pfIsoR03SumPhotonEt") value = object->pfIsoR03SumPhotonEt;
693 else if(variable == "pfIsoR03SumPUPt") value = object->pfIsoR03SumPUPt;
694 else if(variable == "pfIsoR04SumChargedHadronPt") value = object->pfIsoR04SumChargedHadronPt;
695 else if(variable == "pfIsoR04SumNeutralHadronEt") value = object->pfIsoR04SumNeutralHadronEt;
696 else if(variable == "pfIsoR04SumPhotonEt") value = object->pfIsoR04SumPhotonEt;
697 else if(variable == "pfIsoR04SumPUPt") value = object->pfIsoR04SumPUPt;
698 else if(variable == "IP") value = object->IP;
699 else if(variable == "IPError") value = object->IPError;
700 else if(variable == "timeAtIpInOut") value = object->timeAtIpInOut;
701 else if(variable == "timeAtIpInOutErr") value = object->timeAtIpInOutErr;
702 else if(variable == "timeAtIpOutIn") value = object->timeAtIpOutIn;
703 else if(variable == "timeAtIpOutInErr") value = object->timeAtIpOutInErr;
704 else if(variable == "ecal_time") value = object->ecal_time;
705 else if(variable == "hcal_time") value = object->hcal_time;
706 else if(variable == "ecal_timeError") value = object->ecal_timeError;
707 else if(variable == "hcal_timeError") value = object->hcal_timeError;
708 else if(variable == "energy_ecal") value = object->energy_ecal;
709 else if(variable == "energy_hcal") value = object->energy_hcal;
710 else if(variable == "e3x3_ecal") value = object->e3x3_ecal;
711 else if(variable == "e3x3_hcal") value = object->e3x3_hcal;
712 else if(variable == "energyMax_ecal") value = object->energyMax_ecal;
713 else if(variable == "energyMax_hcal") value = object->energyMax_hcal;
714 else if(variable == "charge") value = object->charge;
715 else if(variable == "IDGMPTight") value = object->IDGMPTight;
716 else if(variable == "tkNumValidHits") value = object->tkNumValidHits;
717 else if(variable == "tkCharge") value = object->tkCharge;
718 else if(variable == "samNumValidHits") value = object->samNumValidHits;
719 else if(variable == "samCharge") value = object->samCharge;
720 else if(variable == "comNumValidHits") value = object->comNumValidHits;
721 else if(variable == "comCharge") value = object->comCharge;
722 else if(variable == "genId") value = object->genId;
723 else if(variable == "genCharge") value = object->genCharge;
724 else if(variable == "genNumberOfMothers") value = object->genNumberOfMothers;
725 else if(variable == "genMotherId") value = object->genMotherId;
726 else if(variable == "genMotherCharge") value = object->genMotherCharge;
727 else if(variable == "genMother0Id") value = object->genMother0Id;
728 else if(variable == "genMother1Id") value = object->genMother1Id;
729 else if(variable == "genGrandMother00Id") value = object->genGrandMother00Id;
730 else if(variable == "genGrandMother01Id") value = object->genGrandMother01Id;
731 else if(variable == "genGrandMother10Id") value = object->genGrandMother10Id;
732 else if(variable == "genGrandMother11Id") value = object->genGrandMother11Id;
733 else if(variable == "isPFMuon") value = object->isPFMuon;
734 else if(variable == "isGoodMuon_1StationTight") value = object->isGoodMuon_1StationTight;
735 else if(variable == "isGlobalMuon") value = object->isGlobalMuon;
736 else if(variable == "isTrackerMuon") value = object->isTrackerMuon;
737 else if(variable == "isStandAloneMuon") value = object->isStandAloneMuon;
738 else if(variable == "isGlobalMuonPromptTight") value = object->isGlobalMuonPromptTight;
739 else if(variable == "numberOfValidMuonHits") value = object->numberOfValidMuonHits;
740 else if(variable == "numberOfValidTrackerHits") value = object->numberOfValidTrackerHits;
741 else if(variable == "numberOfLayersWithMeasurement") value = object->numberOfLayersWithMeasurement;
742 else if(variable == "pixelLayersWithMeasurement") value = object->pixelLayersWithMeasurement;
743 else if(variable == "numberOfMatches") value = object->numberOfMatches;
744 else if(variable == "numberOfValidTrackerHitsInnerTrack") value = object->numberOfValidTrackerHitsInnerTrack;
745 else if(variable == "numberOfValidPixelHits") value = object->numberOfValidPixelHits;
746 else if(variable == "numberOfMatchedStations") value = object->numberOfMatchedStations;
747 else if(variable == "time_ndof") value = object->time_ndof;
748
749 else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
750
751 value = applyFunction(function, value);
752
753 return value;
754 }
755
756
757 double
758 OSUAnalysis::valueLookup (const BNelectron* object, string variable, string function){
759
760 double value = 0.0;
761 if(variable == "energy") value = object->energy;
762 else if(variable == "et") value = object->et;
763 else if(variable == "gsfEt") value = object->gsfEt;
764 else if(variable == "pt") value = object->pt;
765 else if(variable == "px") value = object->px;
766 else if(variable == "py") value = object->py;
767 else if(variable == "pz") value = object->pz;
768 else if(variable == "phi") value = object->phi;
769 else if(variable == "eta") value = object->eta;
770 else if(variable == "theta") value = object->theta;
771 else if(variable == "pIn") value = object->pIn;
772 else if(variable == "pOut") value = object->pOut;
773 else if(variable == "EscOverPin") value = object->EscOverPin;
774 else if(variable == "EseedOverPout") value = object->EseedOverPout;
775 else if(variable == "hadOverEm") value = object->hadOverEm;
776 else if(variable == "trackIso") value = object->trackIso;
777 else if(variable == "ecalIso") value = object->ecalIso;
778 else if(variable == "hcalIso") value = object->hcalIso;
779 else if(variable == "caloIso") value = object->caloIso;
780 else if(variable == "trackIsoDR03") value = object->trackIsoDR03;
781 else if(variable == "ecalIsoDR03") value = object->ecalIsoDR03;
782 else if(variable == "hcalIsoDR03") value = object->hcalIsoDR03;
783 else if(variable == "hcalIsoDR03depth1") value = object->hcalIsoDR03depth1;
784 else if(variable == "hcalIsoDR03depth2") value = object->hcalIsoDR03depth2;
785 else if(variable == "caloIsoDR03") value = object->caloIsoDR03;
786 else if(variable == "trackIsoDR04") value = object->trackIsoDR04;
787 else if(variable == "ecalIsoDR04") value = object->ecalIsoDR04;
788 else if(variable == "hcalIsoDR04") value = object->hcalIsoDR04;
789 else if(variable == "hcalIsoDR04depth1") value = object->hcalIsoDR04depth1;
790 else if(variable == "hcalIsoDR04depth2") value = object->hcalIsoDR04depth2;
791 else if(variable == "caloIsoDR04") value = object->caloIsoDR04;
792 else if(variable == "fbrem") value = object->fbrem;
793 else if(variable == "absInvEMinusInvPin") value = object->absInvEMinusInvPin;
794 else if(variable == "delPhiIn") value = object->delPhiIn;
795 else if(variable == "delEtaIn") value = object->delEtaIn;
796 else if(variable == "genET") value = object->genET;
797 else if(variable == "genPT") value = object->genPT;
798 else if(variable == "genPhi") value = object->genPhi;
799 else if(variable == "genEta") value = object->genEta;
800 else if(variable == "genMotherET") value = object->genMotherET;
801 else if(variable == "genMotherPT") value = object->genMotherPT;
802 else if(variable == "genMotherPhi") value = object->genMotherPhi;
803 else if(variable == "genMotherEta") value = object->genMotherEta;
804 else if(variable == "vx") value = object->vx;
805 else if(variable == "vy") value = object->vy;
806 else if(variable == "vz") value = object->vz;
807 else if(variable == "scEnergy") value = object->scEnergy;
808 else if(variable == "scRawEnergy") value = object->scRawEnergy;
809 else if(variable == "scSigmaEtaEta") value = object->scSigmaEtaEta;
810 else if(variable == "scSigmaIEtaIEta") value = object->scSigmaIEtaIEta;
811 else if(variable == "scE1x5") value = object->scE1x5;
812 else if(variable == "scE2x5Max") value = object->scE2x5Max;
813 else if(variable == "scE5x5") value = object->scE5x5;
814 else if(variable == "scEt") value = object->scEt;
815 else if(variable == "scEta") value = object->scEta;
816 else if(variable == "scPhi") value = object->scPhi;
817 else if(variable == "scZ") value = object->scZ;
818 else if(variable == "tkNormChi2") value = object->tkNormChi2;
819 else if(variable == "tkPT") value = object->tkPT;
820 else if(variable == "tkEta") value = object->tkEta;
821 else if(variable == "tkPhi") value = object->tkPhi;
822 else if(variable == "tkDZ") value = object->tkDZ;
823 else if(variable == "tkD0") value = object->tkD0;
824 else if(variable == "tkD0bs") value = object->tkD0bs;
825 else if(variable == "tkD0err") value = object->tkD0err;
826 else if(variable == "mva") value = object->mva;
827 else if(variable == "mvaTrigV0") value = object->mvaTrigV0;
828 else if(variable == "mvaNonTrigV0") value = object->mvaNonTrigV0;
829 else if(variable == "dist") value = object->dist;
830 else if(variable == "dcot") value = object->dcot;
831 else if(variable == "convradius") value = object->convradius;
832 else if(variable == "convPointX") value = object->convPointX;
833 else if(variable == "convPointY") value = object->convPointY;
834 else if(variable == "convPointZ") value = object->convPointZ;
835 else if(variable == "eMax") value = object->eMax;
836 else if(variable == "eLeft") value = object->eLeft;
837 else if(variable == "eRight") value = object->eRight;
838 else if(variable == "eTop") value = object->eTop;
839 else if(variable == "eBottom") value = object->eBottom;
840 else if(variable == "e3x3") value = object->e3x3;
841 else if(variable == "swissCross") value = object->swissCross;
842 else if(variable == "seedEnergy") value = object->seedEnergy;
843 else if(variable == "seedTime") value = object->seedTime;
844 else if(variable == "swissCrossNoI85") value = object->swissCrossNoI85;
845 else if(variable == "swissCrossI85") value = object->swissCrossI85;
846 else if(variable == "E2overE9NoI85") value = object->E2overE9NoI85;
847 else if(variable == "E2overE9I85") value = object->E2overE9I85;
848 else if(variable == "correctedD0") value = object->correctedD0;
849 else if(variable == "correctedD0Vertex") value = object->correctedD0Vertex;
850 else if(variable == "correctedDZ") value = object->correctedDZ;
851 else if(variable == "particleIso") value = object->particleIso;
852 else if(variable == "chargedHadronIso") value = object->chargedHadronIso;
853 else if(variable == "neutralHadronIso") value = object->neutralHadronIso;
854 else if(variable == "photonIso") value = object->photonIso;
855 else if(variable == "puChargedHadronIso") value = object->puChargedHadronIso;
856 else if(variable == "chargedHadronIsoDR03") value = object->chargedHadronIsoDR03;
857 else if(variable == "neutralHadronIsoDR03") value = object->neutralHadronIsoDR03;
858 else if(variable == "photonIsoDR03") value = object->photonIsoDR03;
859 else if(variable == "puChargedHadronIsoDR03") value = object->puChargedHadronIsoDR03;
860 else if(variable == "chargedHadronIsoDR04") value = object->chargedHadronIsoDR04;
861 else if(variable == "neutralHadronIsoDR04") value = object->neutralHadronIsoDR04;
862 else if(variable == "photonIsoDR04") value = object->photonIsoDR04;
863 else if(variable == "puChargedHadronIsoDR04") value = object->puChargedHadronIsoDR04;
864 else if(variable == "rhoPrime") value = object->rhoPrime;
865 else if(variable == "AEffDr03") value = object->AEffDr03;
866 else if(variable == "AEffDr04") value = object->AEffDr04;
867 else if(variable == "IP") value = object->IP;
868 else if(variable == "IPError") value = object->IPError;
869 else if(variable == "charge") value = object->charge;
870 else if(variable == "classification") value = object->classification;
871 else if(variable == "genId") value = object->genId;
872 else if(variable == "genCharge") value = object->genCharge;
873 else if(variable == "genNumberOfMothers") value = object->genNumberOfMothers;
874 else if(variable == "genMotherId") value = object->genMotherId;
875 else if(variable == "genMotherCharge") value = object->genMotherCharge;
876 else if(variable == "genMother0Id") value = object->genMother0Id;
877 else if(variable == "genMother1Id") value = object->genMother1Id;
878 else if(variable == "genGrandMother00Id") value = object->genGrandMother00Id;
879 else if(variable == "genGrandMother01Id") value = object->genGrandMother01Id;
880 else if(variable == "genGrandMother10Id") value = object->genGrandMother10Id;
881 else if(variable == "genGrandMother11Id") value = object->genGrandMother11Id;
882 else if(variable == "numClusters") value = object->numClusters;
883 else if(variable == "tkNumValidHits") value = object->tkNumValidHits;
884 else if(variable == "tkCharge") value = object->tkCharge;
885 else if(variable == "gsfCharge") value = object->gsfCharge;
886 else if(variable == "isEB") value = object->isEB;
887 else if(variable == "isEE") value = object->isEE;
888 else if(variable == "isGap") value = object->isGap;
889 else if(variable == "isEBEEGap") value = object->isEBEEGap;
890 else if(variable == "isEBGap") value = object->isEBGap;
891 else if(variable == "isEEGap") value = object->isEEGap;
892 else if(variable == "isEcalDriven") value = object->isEcalDriven;
893 else if(variable == "isTrackerDriven") value = object->isTrackerDriven;
894 else if(variable == "numberOfLostHits") value = object->numberOfLostHits;
895 else if(variable == "numberOfExpectedInnerHits") value = object->numberOfExpectedInnerHits;
896 else if(variable == "numberOfValidPixelHits") value = object->numberOfValidPixelHits;
897 else if(variable == "numberOfValidPixelBarrelHits") value = object->numberOfValidPixelBarrelHits;
898 else if(variable == "numberOfValidPixelEndcapHits") value = object->numberOfValidPixelEndcapHits;
899 else if(variable == "isHEEP") value = object->isHEEP;
900 else if(variable == "isHEEPnoEt") value = object->isHEEPnoEt;
901 else if(variable == "seedRecoFlag") value = object->seedRecoFlag;
902 else if(variable == "eidRobustHighEnergy") value = object->eidRobustHighEnergy;
903 else if(variable == "eidRobustLoose") value = object->eidRobustLoose;
904 else if(variable == "eidRobustTight") value = object->eidRobustTight;
905 else if(variable == "eidLoose") value = object->eidLoose;
906 else if(variable == "eidTight") value = object->eidTight;
907 else if(variable == "eidVeryLooseMC") value = object->eidVeryLooseMC;
908 else if(variable == "eidLooseMC") value = object->eidLooseMC;
909 else if(variable == "eidMediumMC") value = object->eidMediumMC;
910 else if(variable == "eidTightMC") value = object->eidTightMC;
911 else if(variable == "eidSuperTightMC") value = object->eidSuperTightMC;
912 else if(variable == "eidHyperTight1MC") value = object->eidHyperTight1MC;
913 else if(variable == "eidHyperTight2MC") value = object->eidHyperTight2MC;
914 else if(variable == "eidHyperTight3MC") value = object->eidHyperTight3MC;
915 else if(variable == "eidHyperTight4MC") value = object->eidHyperTight4MC;
916 else if(variable == "passConvVeto") value = object->passConvVeto;
917
918
919 else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
920
921 value = applyFunction(function, value);
922
923 return value;
924 }
925
926
927 double
928 OSUAnalysis::valueLookup (const BNevent* object, string variable, string function){
929
930 double value = 0.0;
931
932 if(variable == "weight") value = object->weight;
933 else if(variable == "pthat") value = object->pthat;
934 else if(variable == "qScale") value = object->qScale;
935 else if(variable == "alphaQCD") value = object->alphaQCD;
936 else if(variable == "alphaQED") value = object->alphaQED;
937 else if(variable == "scalePDF") value = object->scalePDF;
938 else if(variable == "x1") value = object->x1;
939 else if(variable == "x2") value = object->x2;
940 else if(variable == "xPDF1") value = object->xPDF1;
941 else if(variable == "xPDF2") value = object->xPDF2;
942 else if(variable == "BSx") value = object->BSx;
943 else if(variable == "BSy") value = object->BSy;
944 else if(variable == "BSz") value = object->BSz;
945 else if(variable == "PVx") value = object->PVx;
946 else if(variable == "PVy") value = object->PVy;
947 else if(variable == "PVz") value = object->PVz;
948 else if(variable == "bField") value = object->bField;
949 else if(variable == "instLumi") value = object->instLumi;
950 else if(variable == "bxLumi") value = object->bxLumi;
951 else if(variable == "FilterOutScrapingFraction") value = object->FilterOutScrapingFraction;
952 else if(variable == "sumNVtx") value = object->sumNVtx;
953 else if(variable == "sumTrueNVtx") value = object->sumTrueNVtx;
954 else if(variable == "nm1_true") value = object->nm1_true;
955 else if(variable == "n0_true") value = object->n0_true;
956 else if(variable == "np1_true") value = object->np1_true;
957 else if(variable == "numTruePV") value = object->numTruePV;
958 else if(variable == "Q2ScaleUpWgt") value = object->Q2ScaleUpWgt;
959 else if(variable == "Q2ScaleDownWgt") value = object->Q2ScaleDownWgt;
960 else if(variable == "rho_kt6PFJets") value = object->rho_kt6PFJets;
961 else if(variable == "rho_kt6PFJetsCentralChargedPileUp") value = object->rho_kt6PFJetsCentralChargedPileUp;
962 else if(variable == "rho_kt6PFJetsCentralNeutral") value = object->rho_kt6PFJetsCentralNeutral;
963 else if(variable == "rho_kt6PFJetsCentralNeutralTight") value = object->rho_kt6PFJetsCentralNeutralTight;
964 else if(variable == "run") value = object->run;
965 else if(variable == "lumi") value = object->lumi;
966 else if(variable == "sample") value = object->sample;
967 else if(variable == "numPV") value = object->numPV;
968 else if(variable == "W0decay") value = object->W0decay;
969 else if(variable == "W1decay") value = object->W1decay;
970 else if(variable == "Z0decay") value = object->Z0decay;
971 else if(variable == "Z1decay") value = object->Z1decay;
972 else if(variable == "H0decay") value = object->H0decay;
973 else if(variable == "H1decay") value = object->H1decay;
974 else if(variable == "hcalnoiseLoose") value = object->hcalnoiseLoose;
975 else if(variable == "hcalnoiseTight") value = object->hcalnoiseTight;
976 else if(variable == "GoodVertex") value = object->GoodVertex;
977 else if(variable == "FilterOutScraping") value = object->FilterOutScraping;
978 else if(variable == "HBHENoiseFilter") value = object->HBHENoiseFilter;
979 else if(variable == "CSCLooseHaloId") value = object->CSCLooseHaloId;
980 else if(variable == "CSCTightHaloId") value = object->CSCTightHaloId;
981 else if(variable == "EcalLooseHaloId") value = object->EcalLooseHaloId;
982 else if(variable == "EcalTightHaloId") value = object->EcalTightHaloId;
983 else if(variable == "HcalLooseHaloId") value = object->HcalLooseHaloId;
984 else if(variable == "HcalTightHaloId") value = object->HcalTightHaloId;
985 else if(variable == "GlobalLooseHaloId") value = object->GlobalLooseHaloId;
986 else if(variable == "GlobalTightHaloId") value = object->GlobalTightHaloId;
987 else if(variable == "LooseId") value = object->LooseId;
988 else if(variable == "TightId") value = object->TightId;
989 else if(variable == "numGenPV") value = object->numGenPV;
990 else if(variable == "nm1") value = object->nm1;
991 else if(variable == "n0") value = object->n0;
992 else if(variable == "np1") value = object->np1;
993 else if(variable == "id1") value = object->id1;
994 else if(variable == "id2") value = object->id2;
995 else if(variable == "evt") value = object->evt;
996
997 else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
998
999 value = applyFunction(function, value);
1000
1001 return value;
1002 }
1003
1004 double
1005 OSUAnalysis::valueLookup (const BNtau* object, string variable, string function){
1006
1007 double value = 0.0;
1008
1009 if(variable == "px") value = object->px;
1010 else if(variable == "py") value = object->py;
1011 else if(variable == "pz") value = object->pz;
1012 else if(variable == "energy") value = object->energy;
1013 else if(variable == "et") value = object->et;
1014 else if(variable == "pt") value = object->pt;
1015 else if(variable == "eta") value = object->eta;
1016 else if(variable == "phi") value = object->phi;
1017 else if(variable == "emFraction") value = object->emFraction;
1018 else if(variable == "leadingTrackPt") value = object->leadingTrackPt;
1019 else if(variable == "leadingTrackIpVtdxy") value = object->leadingTrackIpVtdxy;
1020 else if(variable == "leadingTrackIpVtdz") value = object->leadingTrackIpVtdz;
1021 else if(variable == "leadingTrackIpVtdxyError") value = object->leadingTrackIpVtdxyError;
1022 else if(variable == "leadingTrackIpVtdzError") value = object->leadingTrackIpVtdzError;
1023 else if(variable == "leadingTrackVx") value = object->leadingTrackVx;
1024 else if(variable == "leadingTrackVy") value = object->leadingTrackVy;
1025 else if(variable == "leadingTrackVz") value = object->leadingTrackVz;
1026 else if(variable == "leadingTrackValidHits") value = object->leadingTrackValidHits;
1027 else if(variable == "leadingTrackNormChiSqrd") value = object->leadingTrackNormChiSqrd;
1028 else if(variable == "numProngs") value = object->numProngs;
1029 else if(variable == "numSignalGammas") value = object->numSignalGammas;
1030 else if(variable == "numSignalNeutrals") value = object->numSignalNeutrals;
1031 else if(variable == "numSignalPiZeros") value = object->numSignalPiZeros;
1032 else if(variable == "decayMode") value = object->decayMode;
1033 else if(variable == "charge") value = object->charge;
1034 else if(variable == "inTheCracks") value = object->inTheCracks;
1035 else if(variable == "HPSagainstElectronLoose") value = object->HPSagainstElectronLoose;
1036 else if(variable == "HPSagainstElectronMVA") value = object->HPSagainstElectronMVA;
1037 else if(variable == "HPSagainstElectronMedium") value = object->HPSagainstElectronMedium;
1038 else if(variable == "HPSagainstElectronTight") value = object->HPSagainstElectronTight;
1039 else if(variable == "HPSagainstMuonLoose") value = object->HPSagainstMuonLoose;
1040 else if(variable == "HPSagainstMuonMedium") value = object->HPSagainstMuonMedium;
1041 else if(variable == "HPSagainstMuonTight") value = object->HPSagainstMuonTight;
1042 else if(variable == "HPSbyLooseCombinedIsolationDeltaBetaCorr") value = object->HPSbyLooseCombinedIsolationDeltaBetaCorr;
1043 else if(variable == "HPSbyMediumCombinedIsolationDeltaBetaCorr") value = object->HPSbyMediumCombinedIsolationDeltaBetaCorr;
1044 else if(variable == "HPSbyTightCombinedIsolationDeltaBetaCorr") value = object->HPSbyTightCombinedIsolationDeltaBetaCorr;
1045 else if(variable == "HPSbyVLooseCombinedIsolationDeltaBetaCorr") value = object->HPSbyVLooseCombinedIsolationDeltaBetaCorr;
1046 else if(variable == "HPSdecayModeFinding") value = object->HPSdecayModeFinding;
1047 else if(variable == "leadingTrackValid") value = object->leadingTrackValid;
1048
1049
1050 else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
1051
1052 value = applyFunction(function, value);
1053
1054 return value;
1055 }
1056
1057 double
1058 OSUAnalysis::valueLookup (const BNmet* object, string variable, string function){
1059
1060 double value = 0.0;
1061
1062 if(variable == "et") value = object->et;
1063 else if(variable == "pt") value = object->pt;
1064 else if(variable == "px") value = object->px;
1065 else if(variable == "py") value = object->py;
1066 else if(variable == "phi") value = object->phi;
1067 else if(variable == "Upt") value = object->Upt;
1068 else if(variable == "Uphi") value = object->Uphi;
1069 else if(variable == "NeutralEMFraction") value = object->NeutralEMFraction;
1070 else if(variable == "NeutralHadEtFraction") value = object->NeutralHadEtFraction;
1071 else if(variable == "ChargedEMEtFraction") value = object->ChargedEMEtFraction;
1072 else if(variable == "ChargedHadEtFraction") value = object->ChargedHadEtFraction;
1073 else if(variable == "MuonEtFraction") value = object->MuonEtFraction;
1074 else if(variable == "Type6EtFraction") value = object->Type6EtFraction;
1075 else if(variable == "Type7EtFraction") value = object->Type7EtFraction;
1076 else if(variable == "genPT") value = object->genPT;
1077 else if(variable == "genPhi") value = object->genPhi;
1078 else if(variable == "muonCorEx") value = object->muonCorEx;
1079 else if(variable == "muonCorEy") value = object->muonCorEy;
1080 else if(variable == "jet20CorEx") value = object->jet20CorEx;
1081 else if(variable == "jet20CorEy") value = object->jet20CorEy;
1082 else if(variable == "jet1CorEx") value = object->jet1CorEx;
1083 else if(variable == "jet1CorEy") value = object->jet1CorEy;
1084 else if(variable == "sumET") value = object->sumET;
1085 else if(variable == "corSumET") value = object->corSumET;
1086 else if(variable == "mEtSig") value = object->mEtSig;
1087 else if(variable == "metSignificance") value = object->metSignificance;
1088 else if(variable == "significance") value = object->significance;
1089 else if(variable == "sigmaX2") value = object->sigmaX2;
1090 else if(variable == "sigmaY2") value = object->sigmaY2;
1091 else if(variable == "sigmaXY") value = object->sigmaXY;
1092 else if(variable == "sigmaYX") value = object->sigmaYX;
1093 else if(variable == "maxEtInEmTowers") value = object->maxEtInEmTowers;
1094 else if(variable == "emEtFraction") value = object->emEtFraction;
1095 else if(variable == "emEtInEB") value = object->emEtInEB;
1096 else if(variable == "emEtInEE") value = object->emEtInEE;
1097 else if(variable == "emEtInHF") value = object->emEtInHF;
1098 else if(variable == "maxEtInHadTowers") value = object->maxEtInHadTowers;
1099 else if(variable == "hadEtFraction") value = object->hadEtFraction;
1100 else if(variable == "hadEtInHB") value = object->hadEtInHB;
1101 else if(variable == "hadEtInHE") value = object->hadEtInHE;
1102 else if(variable == "hadEtInHF") value = object->hadEtInHF;
1103 else if(variable == "hadEtInHO") value = object->hadEtInHO;
1104 else if(variable == "UDeltaPx") value = object->UDeltaPx;
1105 else if(variable == "UDeltaPy") value = object->UDeltaPy;
1106 else if(variable == "UDeltaP") value = object->UDeltaP;
1107 else if(variable == "Uscale") value = object->Uscale;
1108 else if(variable == "type2corPx") value = object->type2corPx;
1109 else if(variable == "type2corPy") value = object->type2corPy;
1110 else if(variable == "T2pt") value = object->T2pt;
1111 else if(variable == "T2px") value = object->T2px;
1112 else if(variable == "T2py") value = object->T2py;
1113 else if(variable == "T2phi") value = object->T2phi;
1114 else if(variable == "T2sumET") value = object->T2sumET;
1115 else if(variable == "pfT1jet1pt") value = object->pfT1jet1pt;
1116 else if(variable == "pfT1jet1phi") value = object->pfT1jet1phi;
1117 else if(variable == "pfT1jet6pt") value = object->pfT1jet6pt;
1118 else if(variable == "pfT1jet6phi") value = object->pfT1jet6phi;
1119 else if(variable == "pfT1jet10pt") value = object->pfT1jet10pt;
1120 else if(variable == "pfT1jet10phi") value = object->pfT1jet10phi;
1121
1122 else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
1123
1124 value = applyFunction(function, value);
1125
1126 return value;
1127 }
1128
1129 double
1130 OSUAnalysis::valueLookup (const BNtrack* object, string variable, string function){
1131
1132 double value = 0.0;
1133
1134 if(variable == "pt") value = object->pt;
1135 else if(variable == "px") value = object->px;
1136 else if(variable == "py") value = object->py;
1137 else if(variable == "pz") value = object->pz;
1138 else if(variable == "phi") value = object->phi;
1139 else if(variable == "eta") value = object->eta;
1140 else if(variable == "theta") value = object->theta;
1141 else if(variable == "normChi2") value = object->normChi2;
1142 else if(variable == "dZ") value = object->dZ;
1143 else if(variable == "d0") value = object->d0;
1144 else if(variable == "d0err") value = object->d0err;
1145 else if(variable == "vx") value = object->vx;
1146 else if(variable == "vy") value = object->vy;
1147 else if(variable == "vz") value = object->vz;
1148 else if(variable == "charge") value = object->charge;
1149 else if(variable == "numValidHits") value = object->numValidHits;
1150 else if(variable == "isHighPurity") value = object->isHighPurity;
1151
1152
1153 else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
1154
1155 value = applyFunction(function, value);
1156
1157 return value;
1158 }
1159
1160 double
1161 OSUAnalysis::valueLookup (const BNgenjet* object, string variable, string function){
1162
1163 double value = 0.0;
1164
1165 if(variable == "pt") value = object->pt;
1166 else if(variable == "eta") value = object->eta;
1167 else if(variable == "phi") value = object->phi;
1168 else if(variable == "px") value = object->px;
1169 else if(variable == "py") value = object->py;
1170 else if(variable == "pz") value = object->pz;
1171 else if(variable == "et") value = object->et;
1172 else if(variable == "energy") value = object->energy;
1173 else if(variable == "mass") value = object->mass;
1174 else if(variable == "emEnergy") value = object->emEnergy;
1175 else if(variable == "hadEnergy") value = object->hadEnergy;
1176 else if(variable == "invisibleEnergy") value = object->invisibleEnergy;
1177 else if(variable == "auxiliaryEnergy") value = object->auxiliaryEnergy;
1178 else if(variable == "charge") value = object->charge;
1179
1180
1181 else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
1182
1183 value = applyFunction(function, value);
1184
1185 return value;
1186 }
1187
1188 double
1189 OSUAnalysis::valueLookup (const BNmcparticle* object, string variable, string function){
1190
1191 double value = 0.0;
1192
1193 if(variable == "energy") value = object->energy;
1194 else if(variable == "et") value = object->et;
1195 else if(variable == "pt") value = object->pt;
1196 else if(variable == "px") value = object->px;
1197 else if(variable == "py") value = object->py;
1198 else if(variable == "pz") value = object->pz;
1199 else if(variable == "phi") value = object->phi;
1200 else if(variable == "eta") value = object->eta;
1201 else if(variable == "theta") value = object->theta;
1202 else if(variable == "mass") value = object->mass;
1203 else if(variable == "vx") value = object->vx;
1204 else if(variable == "vy") value = object->vy;
1205 else if(variable == "vz") value = object->vz;
1206 else if(variable == "motherET") value = object->motherET;
1207 else if(variable == "motherPT") value = object->motherPT;
1208 else if(variable == "motherPhi") value = object->motherPhi;
1209 else if(variable == "motherEta") value = object->motherEta;
1210 else if(variable == "mother0ET") value = object->mother0ET;
1211 else if(variable == "mother0PT") value = object->mother0PT;
1212 else if(variable == "mother0Phi") value = object->mother0Phi;
1213 else if(variable == "mother0Eta") value = object->mother0Eta;
1214 else if(variable == "mother1ET") value = object->mother1ET;
1215 else if(variable == "mother1PT") value = object->mother1PT;
1216 else if(variable == "mother1Phi") value = object->mother1Phi;
1217 else if(variable == "mother1Eta") value = object->mother1Eta;
1218 else if(variable == "daughter0ET") value = object->daughter0ET;
1219 else if(variable == "daughter0PT") value = object->daughter0PT;
1220 else if(variable == "daughter0Phi") value = object->daughter0Phi;
1221 else if(variable == "daughter0Eta") value = object->daughter0Eta;
1222 else if(variable == "daughter1ET") value = object->daughter1ET;
1223 else if(variable == "daughter1PT") value = object->daughter1PT;
1224 else if(variable == "daughter1Phi") value = object->daughter1Phi;
1225 else if(variable == "daughter1Eta") value = object->daughter1Eta;
1226 else if(variable == "grandMotherET") value = object->grandMotherET;
1227 else if(variable == "grandMotherPT") value = object->grandMotherPT;
1228 else if(variable == "grandMotherPhi") value = object->grandMotherPhi;
1229 else if(variable == "grandMotherEta") value = object->grandMotherEta;
1230 else if(variable == "grandMother00ET") value = object->grandMother00ET;
1231 else if(variable == "grandMother00PT") value = object->grandMother00PT;
1232 else if(variable == "grandMother00Phi") value = object->grandMother00Phi;
1233 else if(variable == "grandMother00Eta") value = object->grandMother00Eta;
1234 else if(variable == "grandMother01ET") value = object->grandMother01ET;
1235 else if(variable == "grandMother01PT") value = object->grandMother01PT;
1236 else if(variable == "grandMother01Phi") value = object->grandMother01Phi;
1237 else if(variable == "grandMother01Eta") value = object->grandMother01Eta;
1238 else if(variable == "grandMother10ET") value = object->grandMother10ET;
1239 else if(variable == "grandMother10PT") value = object->grandMother10PT;
1240 else if(variable == "grandMother10Phi") value = object->grandMother10Phi;
1241 else if(variable == "grandMother10Eta") value = object->grandMother10Eta;
1242 else if(variable == "grandMother11ET") value = object->grandMother11ET;
1243 else if(variable == "grandMother11PT") value = object->grandMother11PT;
1244 else if(variable == "grandMother11Phi") value = object->grandMother11Phi;
1245 else if(variable == "grandMother11Eta") value = object->grandMother11Eta;
1246 else if(variable == "charge") value = object->charge;
1247 else if(variable == "id") value = object->id;
1248 else if(variable == "status") value = object->status;
1249 else if(variable == "motherId") value = object->motherId;
1250 else if(variable == "motherCharge") value = object->motherCharge;
1251 else if(variable == "mother0Id") value = object->mother0Id;
1252 else if(variable == "mother0Status") value = object->mother0Status;
1253 else if(variable == "mother0Charge") value = object->mother0Charge;
1254 else if(variable == "mother1Id") value = object->mother1Id;
1255 else if(variable == "mother1Status") value = object->mother1Status;
1256 else if(variable == "mother1Charge") value = object->mother1Charge;
1257 else if(variable == "daughter0Id") value = object->daughter0Id;
1258 else if(variable == "daughter0Status") value = object->daughter0Status;
1259 else if(variable == "daughter0Charge") value = object->daughter0Charge;
1260 else if(variable == "daughter1Id") value = object->daughter1Id;
1261 else if(variable == "daughter1Status") value = object->daughter1Status;
1262 else if(variable == "daughter1Charge") value = object->daughter1Charge;
1263 else if(variable == "grandMotherId") value = object->grandMotherId;
1264 else if(variable == "grandMotherCharge") value = object->grandMotherCharge;
1265 else if(variable == "grandMother00Id") value = object->grandMother00Id;
1266 else if(variable == "grandMother00Status") value = object->grandMother00Status;
1267 else if(variable == "grandMother00Charge") value = object->grandMother00Charge;
1268 else if(variable == "grandMother01Id") value = object->grandMother01Id;
1269 else if(variable == "grandMother01Status") value = object->grandMother01Status;
1270 else if(variable == "grandMother01Charge") value = object->grandMother01Charge;
1271 else if(variable == "grandMother10Id") value = object->grandMother10Id;
1272 else if(variable == "grandMother10Status") value = object->grandMother10Status;
1273 else if(variable == "grandMother10Charge") value = object->grandMother10Charge;
1274 else if(variable == "grandMother11Id") value = object->grandMother11Id;
1275 else if(variable == "grandMother11Status") value = object->grandMother11Status;
1276 else if(variable == "grandMother11Charge") value = object->grandMother11Charge;
1277
1278 else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
1279
1280 value = applyFunction(function, value);
1281
1282 return value;
1283 }
1284
1285 double
1286 OSUAnalysis::valueLookup (const BNprimaryvertex* object, string variable, string function){
1287
1288 double value = 0.0;
1289
1290 if(variable == "x") value = object->x;
1291 else if(variable == "xError") value = object->xError;
1292 else if(variable == "y") value = object->y;
1293 else if(variable == "yError") value = object->yError;
1294 else if(variable == "z") value = object->z;
1295 else if(variable == "zError") value = object->zError;
1296 else if(variable == "rho") value = object->rho;
1297 else if(variable == "normalizedChi2") value = object->normalizedChi2;
1298 else if(variable == "ndof") value = object->ndof;
1299 else if(variable == "isFake") value = object->isFake;
1300 else if(variable == "isValid") value = object->isValid;
1301 else if(variable == "tracksSize") value = object->tracksSize;
1302 else if(variable == "isGood") value = object->isGood;
1303
1304
1305 else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
1306
1307 value = applyFunction(function, value);
1308
1309 return value;
1310 }
1311
1312 double
1313 OSUAnalysis::valueLookup (const BNbxlumi* object, string variable, string function){
1314
1315 double value = 0.0;
1316
1317 if(variable == "bx_B1_now") value = object->bx_B1_now;
1318 else if(variable == "bx_B2_now") value = object->bx_B2_now;
1319 else if(variable == "bx_LUMI_now") value = object->bx_LUMI_now;
1320
1321
1322 else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
1323
1324 value = applyFunction(function, value);
1325
1326 return value;
1327 }
1328
1329 double
1330 OSUAnalysis::valueLookup (const BNphoton* object, string variable, string function){
1331
1332 double value = 0.0;
1333
1334 if(variable == "energy") value = object->energy;
1335 else if(variable == "et") value = object->et;
1336 else if(variable == "pt") value = object->pt;
1337 else if(variable == "px") value = object->px;
1338 else if(variable == "py") value = object->py;
1339 else if(variable == "pz") value = object->pz;
1340 else if(variable == "phi") value = object->phi;
1341 else if(variable == "eta") value = object->eta;
1342 else if(variable == "theta") value = object->theta;
1343 else if(variable == "trackIso") value = object->trackIso;
1344 else if(variable == "ecalIso") value = object->ecalIso;
1345 else if(variable == "hcalIso") value = object->hcalIso;
1346 else if(variable == "caloIso") value = object->caloIso;
1347 else if(variable == "trackIsoHollowConeDR03") value = object->trackIsoHollowConeDR03;
1348 else if(variable == "trackIsoSolidConeDR03") value = object->trackIsoSolidConeDR03;
1349 else if(variable == "ecalIsoDR03") value = object->ecalIsoDR03;
1350 else if(variable == "hcalIsoDR03") value = object->hcalIsoDR03;
1351 else if(variable == "caloIsoDR03") value = object->caloIsoDR03;
1352 else if(variable == "trackIsoHollowConeDR04") value = object->trackIsoHollowConeDR04;
1353 else if(variable == "trackIsoSolidConeDR04") value = object->trackIsoSolidConeDR04;
1354 else if(variable == "ecalIsoDR04") value = object->ecalIsoDR04;
1355 else if(variable == "hcalIsoDR04") value = object->hcalIsoDR04;
1356 else if(variable == "caloIsoDR04") value = object->caloIsoDR04;
1357 else if(variable == "hadOverEm") value = object->hadOverEm;
1358 else if(variable == "sigmaEtaEta") value = object->sigmaEtaEta;
1359 else if(variable == "sigmaIetaIeta") value = object->sigmaIetaIeta;
1360 else if(variable == "r9") value = object->r9;
1361 else if(variable == "scEnergy") value = object->scEnergy;
1362 else if(variable == "scRawEnergy") value = object->scRawEnergy;
1363 else if(variable == "scSeedEnergy") value = object->scSeedEnergy;
1364 else if(variable == "scEta") value = object->scEta;
1365 else if(variable == "scPhi") value = object->scPhi;
1366 else if(variable == "scZ") value = object->scZ;
1367 else if(variable == "genET") value = object->genET;
1368 else if(variable == "genPT") value = object->genPT;
1369 else if(variable == "genPhi") value = object->genPhi;
1370 else if(variable == "genEta") value = object->genEta;
1371 else if(variable == "genMotherET") value = object->genMotherET;
1372 else if(variable == "genMotherPT") value = object->genMotherPT;
1373 else if(variable == "genMotherPhi") value = object->genMotherPhi;
1374 else if(variable == "genMotherEta") value = object->genMotherEta;
1375 else if(variable == "eMax") value = object->eMax;
1376 else if(variable == "eLeft") value = object->eLeft;
1377 else if(variable == "eRight") value = object->eRight;
1378 else if(variable == "eTop") value = object->eTop;
1379 else if(variable == "eBottom") value = object->eBottom;
1380 else if(variable == "e3x3") value = object->e3x3;
1381 else if(variable == "swissCross") value = object->swissCross;
1382 else if(variable == "seedEnergy") value = object->seedEnergy;
1383 else if(variable == "seedTime") value = object->seedTime;
1384 else if(variable == "swissCrossNoI85") value = object->swissCrossNoI85;
1385 else if(variable == "swissCrossI85") value = object->swissCrossI85;
1386 else if(variable == "E2overE9NoI85") value = object->E2overE9NoI85;
1387 else if(variable == "E2overE9I85") value = object->E2overE9I85;
1388 else if(variable == "IDTight") value = object->IDTight;
1389 else if(variable == "IDLoose") value = object->IDLoose;
1390 else if(variable == "IDLooseEM") value = object->IDLooseEM;
1391 else if(variable == "genId") value = object->genId;
1392 else if(variable == "genCharge") value = object->genCharge;
1393 else if(variable == "genMotherId") value = object->genMotherId;
1394 else if(variable == "genMotherCharge") value = object->genMotherCharge;
1395 else if(variable == "isEB") value = object->isEB;
1396 else if(variable == "isEE") value = object->isEE;
1397 else if(variable == "isGap") value = object->isGap;
1398 else if(variable == "isEBEEGap") value = object->isEBEEGap;
1399 else if(variable == "isEBGap") value = object->isEBGap;
1400 else if(variable == "isEEGap") value = object->isEEGap;
1401 else if(variable == "hasPixelSeed") value = object->hasPixelSeed;
1402 else if(variable == "seedRecoFlag") value = object->seedRecoFlag;
1403
1404
1405 else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
1406
1407 value = applyFunction(function, value);
1408
1409 return value;
1410 }
1411
1412 double
1413 OSUAnalysis::valueLookup (const BNsupercluster* object, string variable, string function){
1414
1415 double value = 0.0;
1416
1417 if(variable == "energy") value = object->energy;
1418 else if(variable == "et") value = object->et;
1419 else if(variable == "ex") value = object->ex;
1420 else if(variable == "ey") value = object->ey;
1421 else if(variable == "ez") value = object->ez;
1422 else if(variable == "phi") value = object->phi;
1423 else if(variable == "eta") value = object->eta;
1424 else if(variable == "theta") value = object->theta;
1425
1426
1427 else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
1428
1429 value = applyFunction(function, value);
1430
1431 return value;
1432 }
1433
1434
1435 double
1436 OSUAnalysis::applyFunction(string function, double value){
1437
1438 if(function == "abs") value = abs(value);
1439
1440
1441 return value;
1442
1443 }
1444
1445
1446 template <class InputCollection>
1447 void OSUAnalysis::setObjectFlags(cut &currentCut, uint currentCutIndex, flagMap &individualFlags, flagMap &cumulativeFlags, InputCollection inputCollection, string inputType){
1448
1449
1450 for (uint object = 0; object != inputCollection->size(); object++){
1451
1452 bool decision = true;//object passes if this cut doesn't cut on that type of object
1453
1454 if(currentCut.inputCollection == inputType){
1455
1456 double value = valueLookup(&inputCollection->at(object), currentCut.variable, currentCut.function);
1457
1458 decision = evaluateComparison(value,currentCut.comparativeOperator,currentCut.cutValue);
1459 }
1460 individualFlags[inputType].at(currentCutIndex).push_back(decision);
1461
1462
1463 //set flags for objects that pass each cut AND all the previous cuts
1464 bool previousCumulativeFlag = true;
1465 for(uint previousCutIndex = 0; previousCutIndex != currentCutIndex; previousCutIndex++){
1466 if(previousCumulativeFlag && individualFlags[inputType].at(previousCutIndex).at(object)) previousCumulativeFlag = true;
1467 else{ previousCumulativeFlag = false; break;}
1468 }
1469 cumulativeFlags[inputType].at(currentCutIndex).push_back(previousCumulativeFlag && decision);
1470
1471 }
1472
1473 }
1474
1475
1476
1477
1478
1479 DEFINE_FWK_MODULE(OSUAnalysis);
1480
1481