ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/OSUT3Analysis/AnaTools/plugins/OSUAnalysis.cc
Revision: 1.4
Committed: Tue Jan 29 15:29:06 2013 UTC (12 years, 3 months ago) by lantonel
Content type: text/plain
Branch: MAIN
Changes since 1.3: +11 -0 lines
Log Message:
fix bug which wasn't applying trigger to plotting

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