ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/OSUT3Analysis/AnaTools/plugins/OSUAnalysis.cc
Revision: 1.6
Committed: Wed Jan 30 16:28:22 2013 UTC (12 years, 3 months ago) by lantonel
Content type: text/plain
Branch: MAIN
Changes since 1.5: +24 -1 lines
Log Message:
added abs function

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 bool triggerDecision = true;
249 if(currentChannel.triggers.size() != 0){ //triggers specified
250 triggerDecision = evaluateTriggers(currentChannel.triggers,triggers.product());
251 cutFlows_.at(currentChannelIndex)->at ("trigger") = triggerDecision;
252 }
253
254 //loop over all cuts
255 for(uint currentCutIndex = 0; currentCutIndex != currentChannel.cuts.size(); currentCutIndex++){
256 cut currentCut = currentChannel.cuts.at(currentCutIndex);
257
258 for(uint currentObjectIndex = 0; currentObjectIndex != allNecessaryObjects.size(); currentObjectIndex++){
259
260 string currentObject = allNecessaryObjects.at(currentObjectIndex);
261 individualFlags[currentObject].push_back (vector<bool> ());
262 cumulativeFlags[currentObject].push_back (vector<bool> ());
263
264 if(currentObject == "jets") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,jets.product(),"jets");
265 else if(currentObject == "muons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),"muons");
266 else if(currentObject == "electrons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),"electrons");
267 else if(currentObject == "events") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,events.product(),"events");
268 else if(currentObject == "taus") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,taus.product(),"taus");
269 else if(currentObject == "mets") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,mets.product(),"mets");
270 else if(currentObject == "tracks") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,tracks.product(),"tracks");
271 else if(currentObject == "genjets") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,genjets.product(),"genjets");
272 else if(currentObject == "mcparticles") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,mcparticles.product(),"mcparticles");
273 else if(currentObject == "primaryvertexs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,primaryvertexs.product(),"primaryvertexs");
274 else if(currentObject == "bxlumis") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,bxlumis.product(),"bxlumis");
275 else if(currentObject == "photons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,photons.product(),"photons");
276 else if(currentObject == "superclusters") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,superclusters.product(),"superclusters");
277
278
279 }
280
281
282
283 }//end loop over all cuts
284
285
286
287
288 //use cumulative flags to apply cuts at event level
289
290 bool eventPassedAllCuts = true;
291
292 //apply trigger (true if none were specified)
293 eventPassedAllCuts = eventPassedAllCuts && triggerDecision;
294
295
296 for(uint currentCutIndex = 0; currentCutIndex != currentChannel.cuts.size(); currentCutIndex++){
297
298 //loop over all objects and count how many passed the cumulative selection up to this point
299 cut currentCut = currentChannel.cuts.at(currentCutIndex);
300 int numberPassing = 0;
301
302 for (uint object = 0; object != cumulativeFlags[currentCut.inputCollection].at(currentCutIndex).size() ; object++)
303 if(cumulativeFlags[currentCut.inputCollection].at(currentCutIndex).at(object)) numberPassing++;
304
305
306 bool cutDecision = evaluateComparison(numberPassing,currentCut.eventComparativeOperator,currentCut.numberRequired);
307 cutFlows_.at(currentChannelIndex)->at (currentCut.name) = cutDecision;
308
309 eventPassedAllCuts = eventPassedAllCuts && cutDecision;
310
311 }
312
313 cutFlows_.at(currentChannelIndex)->fillCutFlow();
314
315
316
317 if(!eventPassedAllCuts)continue;
318
319
320
321 vector<bool> electronFlags = cumulativeFlags["electrons"].back();
322 int electronCounter = 0;
323
324 for (uint electronIndex = 0; electronIndex != electronFlags.size(); electronIndex++){
325 if(!electronFlags.at(electronIndex)) continue;
326
327
328 electronCounter++;
329 oneDHists_.at(currentChannelIndex)["electronPt"]->Fill (electrons->at(electronIndex).pt);
330 oneDHists_.at(currentChannelIndex)["electronEta"]->Fill (electrons->at(electronIndex).eta);
331 oneDHists_.at(currentChannelIndex)["electronD0"]->Fill (electrons->at(electronIndex).correctedD0Vertex);
332 oneDHists_.at(currentChannelIndex)["electronAbsD0"]->Fill (fabs(electrons->at(electronIndex).correctedD0Vertex));
333 oneDHists_.at(currentChannelIndex)["electronD0Sig"]->Fill (electrons->at(electronIndex).correctedD0Vertex / electrons->at(electronIndex).tkD0err);
334 oneDHists_.at(currentChannelIndex)["electronAbsD0Sig"]->Fill (fabs(electrons->at(electronIndex).correctedD0Vertex) / electrons->at(electronIndex).tkD0err);
335 oneDHists_.at(currentChannelIndex)["electronIso"]->Fill (((electrons->at(electronIndex).trackIso + electrons->at(electronIndex).caloIso) / electrons->at(electronIndex).pt));
336 oneDHists_.at(currentChannelIndex)["electronFbrem"]->Fill (electrons->at(electronIndex).fbrem);
337 oneDHists_.at(currentChannelIndex)["electronMVATrig"]->Fill (electrons->at(electronIndex).mvaTrigV0);
338 oneDHists_.at(currentChannelIndex)["electronMVANonTrig"]->Fill (electrons->at(electronIndex).mvaNonTrigV0);
339
340 }
341 oneDHists_.at(currentChannelIndex)["numElectrons"]->Fill (electronCounter);
342
343
344 vector<bool> muonFlags = cumulativeFlags["muons"].back();
345 int muonCounter = 0;
346
347
348 for (uint muonIndex = 0; muonIndex != muonFlags.size(); muonIndex++){
349 if(!muonFlags.at(muonIndex)) continue;
350 muonCounter++;
351
352 oneDHists_.at(currentChannelIndex)["muonPt"]->Fill (muons->at(muonIndex).pt);
353 oneDHists_.at(currentChannelIndex)["muonEta"]->Fill (muons->at(muonIndex).eta);
354 oneDHists_.at(currentChannelIndex)["muonD0"]->Fill (muons->at(muonIndex).correctedD0Vertex);
355 oneDHists_.at(currentChannelIndex)["muonAbsD0"]->Fill (fabs(muons->at(muonIndex).correctedD0Vertex));
356 oneDHists_.at(currentChannelIndex)["muonD0Sig"]->Fill (muons->at(muonIndex).correctedD0Vertex / muons->at(muonIndex).tkD0err);
357 oneDHists_.at(currentChannelIndex)["muonAbsD0Sig"]->Fill (fabs(muons->at(muonIndex).correctedD0Vertex) / muons->at(muonIndex).tkD0err);
358 oneDHists_.at(currentChannelIndex)["muonIso"]->Fill (((muons->at(muonIndex).trackIso + muons->at(muonIndex).caloIso) / muons->at(muonIndex).pt));
359 }
360 oneDHists_.at(currentChannelIndex)["numMuons"]->Fill (muonCounter);
361
362
363
364
365
366 } //end loop over channel
367
368 masterCutFlow_->fillCutFlow();
369
370
371 }
372
373
374 bool
375 OSUAnalysis::evaluateComparison (double testValue, string comparison, double cutValue){
376
377
378 if(comparison == ">") return testValue > cutValue;
379 else if(comparison == ">=") return testValue >= cutValue;
380 else if(comparison == "<") return testValue < cutValue;
381 else if(comparison == "<=") return testValue <= cutValue;
382 else {std::cout << "WARNING: invalid comparison operator '" << comparison << "'\n"; return false;}
383
384 }
385
386 bool
387 OSUAnalysis::evaluateTriggers (vector<string> triggersToTest, const BNtriggerCollection* triggerCollection){
388
389 bool triggerDecision = false;
390
391 for (BNtriggerCollection::const_iterator trigger = triggerCollection->begin (); trigger != triggerCollection->end (); trigger++)
392 {
393 if(trigger->pass != 1) continue;
394 for(uint triggerName = 0; triggerName != triggersToTest.size(); triggerName++)
395 {
396 if(trigger->name.find(triggersToTest.at(triggerName))!=std::string::npos){
397 triggerDecision = true;
398 }
399 }
400 }
401 return triggerDecision;
402
403 }
404
405 std::vector<std::string>
406 OSUAnalysis::splitString (string inputString){
407
408 std::stringstream stringStream(inputString);
409 std::istream_iterator<std::string> begin(stringStream);
410 std::istream_iterator<std::string> end;
411 std::vector<std::string> stringVector(begin, end);
412 return stringVector;
413
414 }
415
416 double
417 OSUAnalysis::valueLookup (const BNjet* object, string variable, string function){
418
419 double value = 0.0;
420 if(variable == "energy") value = object->energy;
421 else if(variable == "et") value = object->et;
422 else if(variable == "pt") value = object->pt;
423 else if(variable == "px") value = object->px;
424 else if(variable == "py") value = object->py;
425 else if(variable == "pz") value = object->pz;
426 else if(variable == "phi") value = object->phi;
427 else if(variable == "eta") value = object->eta;
428 else if(variable == "theta") value = object->theta;
429 else if(variable == "Upt") value = object->Upt;
430 else if(variable == "Uenergy") value = object->Uenergy;
431 else if(variable == "L2pt") value = object->L2pt;
432 else if(variable == "L2L3pt") value = object->L2L3pt;
433 else if(variable == "L2L3respt") value = object->L2L3respt;
434 else if(variable == "respt") value = object->respt;
435 else if(variable == "EMfrac") value = object->EMfrac;
436 else if(variable == "Hadfrac") value = object->Hadfrac;
437 else if(variable == "charge") value = object->charge;
438 else if(variable == "mass") value = object->mass;
439 else if(variable == "area") value = object->area;
440 else if(variable == "fHPD") value = object->fHPD;
441 else if(variable == "approximatefHPD") value = object->approximatefHPD;
442 else if(variable == "genPartonET") value = object->genPartonET;
443 else if(variable == "genPartonPT") value = object->genPartonPT;
444 else if(variable == "genPartonEta") value = object->genPartonEta;
445 else if(variable == "genPartonPhi") value = object->genPartonPhi;
446 else if(variable == "genJetET") value = object->genJetET;
447 else if(variable == "genJetPT") value = object->genJetPT;
448 else if(variable == "genJetEta") value = object->genJetEta;
449 else if(variable == "genJetPhi") value = object->genJetPhi;
450 else if(variable == "btagTChighPur") value = object->btagTChighPur;
451 else if(variable == "btagTChighEff") value = object->btagTChighEff;
452 else if(variable == "btagJetProb") value = object->btagJetProb;
453 else if(variable == "btagJetBProb") value = object->btagJetBProb;
454 else if(variable == "btagSoftEle") value = object->btagSoftEle;
455 else if(variable == "btagSoftMuon") value = object->btagSoftMuon;
456 else if(variable == "btagSoftMuonNoIP") value = object->btagSoftMuonNoIP;
457 else if(variable == "btagSecVertex") value = object->btagSecVertex;
458 else if(variable == "btagSecVertexHighEff") value = object->btagSecVertexHighEff;
459 else if(variable == "btagSecVertexHighPur") value = object->btagSecVertexHighPur;
460 else if(variable == "btagCombinedSecVertex") value = object->btagCombinedSecVertex;
461 else if(variable == "btagCombinedSecVertexMVA") value = object->btagCombinedSecVertexMVA;
462 else if(variable == "btagSoftMuonByPt") value = object->btagSoftMuonByPt;
463 else if(variable == "btagSoftMuonByIP3") value = object->btagSoftMuonByIP3;
464 else if(variable == "btagSoftElectronByPt") value = object->btagSoftElectronByPt;
465 else if(variable == "btagSoftElectronByIP3") value = object->btagSoftElectronByIP3;
466 else if(variable == "n90Hits") value = object->n90Hits;
467 else if(variable == "hitsInN90") value = object->hitsInN90;
468 else if(variable == "chargedHadronEnergyFraction") value = object->chargedHadronEnergyFraction;
469 else if(variable == "neutralHadronEnergyFraction") value = object->neutralHadronEnergyFraction;
470 else if(variable == "chargedEmEnergyFraction") value = object->chargedEmEnergyFraction;
471 else if(variable == "neutralEmEnergyFraction") value = object->neutralEmEnergyFraction;
472 else if(variable == "fLong") value = object->fLong;
473 else if(variable == "fShort") value = object->fShort;
474 else if(variable == "etaetaMoment") value = object->etaetaMoment;
475 else if(variable == "phiphiMoment") value = object->phiphiMoment;
476 else if(variable == "JESunc") value = object->JESunc;
477 else if(variable == "JECuncUp") value = object->JECuncUp;
478 else if(variable == "JECuncDown") value = object->JECuncDown;
479 else if(variable == "puJetMVA_full") value = object->puJetMVA_full;
480 else if(variable == "puJetMVA_simple") value = object->puJetMVA_simple;
481 else if(variable == "puJetMVA_cutbased") value = object->puJetMVA_cutbased;
482 else if(variable == "dZ") value = object->dZ;
483 else if(variable == "dR2Mean") value = object->dR2Mean;
484 else if(variable == "dRMean") value = object->dRMean;
485 else if(variable == "frac01") value = object->frac01;
486 else if(variable == "frac02") value = object->frac02;
487 else if(variable == "frac03") value = object->frac03;
488 else if(variable == "frac04") value = object->frac04;
489 else if(variable == "frac05") value = object->frac05;
490 else if(variable == "frac06") value = object->frac06;
491 else if(variable == "frac07") value = object->frac07;
492 else if(variable == "beta") value = object->beta;
493 else if(variable == "betaStar") value = object->betaStar;
494 else if(variable == "betaClassic") value = object->betaClassic;
495 else if(variable == "betaStarClassic") value = object->betaStarClassic;
496 else if(variable == "ptD") value = object->ptD;
497 else if(variable == "nvtx") value = object->nvtx;
498 else if(variable == "d0") value = object->d0;
499 else if(variable == "leadCandPt") value = object->leadCandPt;
500 else if(variable == "leadCandVx") value = object->leadCandVx;
501 else if(variable == "leadCandVy") value = object->leadCandVy;
502 else if(variable == "leadCandVz") value = object->leadCandVz;
503 else if(variable == "leadCandDistFromPV") value = object->leadCandDistFromPV;
504 else if(variable == "flavour") value = object->flavour;
505 else if(variable == "Nconst") value = object->Nconst;
506 else if(variable == "jetIDMinimal") value = object->jetIDMinimal;
507 else if(variable == "jetIDLooseAOD") value = object->jetIDLooseAOD;
508 else if(variable == "jetIDLoose") value = object->jetIDLoose;
509 else if(variable == "jetIDTight") value = object->jetIDTight;
510 else if(variable == "genPartonId") value = object->genPartonId;
511 else if(variable == "genPartonMotherId") value = object->genPartonMotherId;
512 else if(variable == "genPartonMother0Id") value = object->genPartonMother0Id;
513 else if(variable == "genPartonMother1Id") value = object->genPartonMother1Id;
514 else if(variable == "genPartonGrandMotherId") value = object->genPartonGrandMotherId;
515 else if(variable == "genPartonGrandMother00Id") value = object->genPartonGrandMother00Id;
516 else if(variable == "genPartonGrandMother01Id") value = object->genPartonGrandMother01Id;
517 else if(variable == "genPartonGrandMother10Id") value = object->genPartonGrandMother10Id;
518 else if(variable == "genPartonGrandMother11Id") value = object->genPartonGrandMother11Id;
519 else if(variable == "chargedMultiplicity") value = object->chargedMultiplicity;
520 else if(variable == "neutralMultiplicity") value = object->neutralMultiplicity;
521 else if(variable == "nconstituents") value = object->nconstituents;
522 else if(variable == "nHit") value = object->nHit;
523 else if(variable == "puJetId_full") value = object->puJetId_full;
524 else if(variable == "puJetId_simple") value = object->puJetId_simple;
525 else if(variable == "puJetId_cutbased") value = object->puJetId_cutbased;
526 else if(variable == "puJetId_tight_full") value = object->puJetId_tight_full;
527 else if(variable == "puJetId_tight_simple") value = object->puJetId_tight_simple;
528 else if(variable == "puJetId_tight_cutbased") value = object->puJetId_tight_cutbased;
529 else if(variable == "puJetId_medium_full") value = object->puJetId_medium_full;
530 else if(variable == "puJetId_medium_simple") value = object->puJetId_medium_simple;
531 else if(variable == "puJetId_medium_cutbased") value = object->puJetId_medium_cutbased;
532 else if(variable == "puJetId_loose_full") value = object->puJetId_loose_full;
533 else if(variable == "puJetId_loose_simple") value = object->puJetId_loose_simple;
534 else if(variable == "puJetId_loose_cutbased") value = object->puJetId_loose_cutbased;
535
536
537 else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
538
539 value = applyFunction(function, value);
540
541 return value;
542 }
543
544
545
546 double
547 OSUAnalysis::valueLookup (const BNmuon* object, string variable, string function){
548
549 double value = 0.0;
550 if(variable == "energy") value = object->energy;
551 else if(variable == "et") value = object->et;
552 else if(variable == "pt") value = object->pt;
553 else if(variable == "px") value = object->px;
554 else if(variable == "py") value = object->py;
555 else if(variable == "pz") value = object->pz;
556 else if(variable == "phi") value = object->phi;
557 else if(variable == "eta") value = object->eta;
558 else if(variable == "theta") value = object->theta;
559 else if(variable == "trackIso") value = object->trackIso;
560 else if(variable == "ecalIso") value = object->ecalIso;
561 else if(variable == "hcalIso") value = object->hcalIso;
562 else if(variable == "caloIso") value = object->caloIso;
563 else if(variable == "trackIsoDR03") value = object->trackIsoDR03;
564 else if(variable == "ecalIsoDR03") value = object->ecalIsoDR03;
565 else if(variable == "hcalIsoDR03") value = object->hcalIsoDR03;
566 else if(variable == "caloIsoDR03") value = object->caloIsoDR03;
567 else if(variable == "trackVetoIsoDR03") value = object->trackVetoIsoDR03;
568 else if(variable == "ecalVetoIsoDR03") value = object->ecalVetoIsoDR03;
569 else if(variable == "hcalVetoIsoDR03") value = object->hcalVetoIsoDR03;
570 else if(variable == "caloVetoIsoDR03") value = object->caloVetoIsoDR03;
571 else if(variable == "trackIsoDR05") value = object->trackIsoDR05;
572 else if(variable == "ecalIsoDR05") value = object->ecalIsoDR05;
573 else if(variable == "hcalIsoDR05") value = object->hcalIsoDR05;
574 else if(variable == "caloIsoDR05") value = object->caloIsoDR05;
575 else if(variable == "trackVetoIsoDR05") value = object->trackVetoIsoDR05;
576 else if(variable == "ecalVetoIsoDR05") value = object->ecalVetoIsoDR05;
577 else if(variable == "hcalVetoIsoDR05") value = object->hcalVetoIsoDR05;
578 else if(variable == "caloVetoIsoDR05") value = object->caloVetoIsoDR05;
579 else if(variable == "hcalE") value = object->hcalE;
580 else if(variable == "ecalE") value = object->ecalE;
581 else if(variable == "genET") value = object->genET;
582 else if(variable == "genPT") value = object->genPT;
583 else if(variable == "genPhi") value = object->genPhi;
584 else if(variable == "genEta") value = object->genEta;
585 else if(variable == "genMotherET") value = object->genMotherET;
586 else if(variable == "genMotherPT") value = object->genMotherPT;
587 else if(variable == "genMotherPhi") value = object->genMotherPhi;
588 else if(variable == "genMotherEta") value = object->genMotherEta;
589 else if(variable == "vx") value = object->vx;
590 else if(variable == "vy") value = object->vy;
591 else if(variable == "vz") value = object->vz;
592 else if(variable == "tkNormChi2") value = object->tkNormChi2;
593 else if(variable == "tkPT") value = object->tkPT;
594 else if(variable == "tkEta") value = object->tkEta;
595 else if(variable == "tkPhi") value = object->tkPhi;
596 else if(variable == "tkDZ") value = object->tkDZ;
597 else if(variable == "tkD0") value = object->tkD0;
598 else if(variable == "tkD0bs") value = object->tkD0bs;
599 else if(variable == "tkD0err") value = object->tkD0err;
600 else if(variable == "samNormChi2") value = object->samNormChi2;
601 else if(variable == "samPT") value = object->samPT;
602 else if(variable == "samEta") value = object->samEta;
603 else if(variable == "samPhi") value = object->samPhi;
604 else if(variable == "samDZ") value = object->samDZ;
605 else if(variable == "samD0") value = object->samD0;
606 else if(variable == "samD0bs") value = object->samD0bs;
607 else if(variable == "samD0err") value = object->samD0err;
608 else if(variable == "comNormChi2") value = object->comNormChi2;
609 else if(variable == "comPT") value = object->comPT;
610 else if(variable == "comEta") value = object->comEta;
611 else if(variable == "comPhi") value = object->comPhi;
612 else if(variable == "comDZ") value = object->comDZ;
613 else if(variable == "comD0") value = object->comD0;
614 else if(variable == "comD0bs") value = object->comD0bs;
615 else if(variable == "comD0err") value = object->comD0err;
616 else if(variable == "isolationR03emVetoEt") value = object->isolationR03emVetoEt;
617 else if(variable == "isolationR03hadVetoEt") value = object->isolationR03hadVetoEt;
618 else if(variable == "normalizedChi2") value = object->normalizedChi2;
619 else if(variable == "dVzPVz") value = object->dVzPVz;
620 else if(variable == "dB") value = object->dB;
621 else if(variable == "ptErr") value = object->ptErr;
622 else if(variable == "innerTrackNormChi2") value = object->innerTrackNormChi2;
623 else if(variable == "correctedD0") value = object->correctedD0;
624 else if(variable == "correctedD0Vertex") value = object->correctedD0Vertex;
625 else if(variable == "correctedDZ") value = object->correctedDZ;
626 else if(variable == "particleIso") value = object->particleIso;
627 else if(variable == "chargedHadronIso") value = object->chargedHadronIso;
628 else if(variable == "neutralHadronIso") value = object->neutralHadronIso;
629 else if(variable == "photonIso") value = object->photonIso;
630 else if(variable == "puChargedHadronIso") value = object->puChargedHadronIso;
631 else if(variable == "chargedHadronIsoDR03") value = object->chargedHadronIsoDR03;
632 else if(variable == "neutralHadronIsoDR03") value = object->neutralHadronIsoDR03;
633 else if(variable == "photonIsoDR03") value = object->photonIsoDR03;
634 else if(variable == "puChargedHadronIsoDR03") value = object->puChargedHadronIsoDR03;
635 else if(variable == "chargedHadronIsoDR04") value = object->chargedHadronIsoDR04;
636 else if(variable == "neutralHadronIsoDR04") value = object->neutralHadronIsoDR04;
637 else if(variable == "photonIsoDR04") value = object->photonIsoDR04;
638 else if(variable == "puChargedHadronIsoDR04") value = object->puChargedHadronIsoDR04;
639 else if(variable == "rhoPrime") value = object->rhoPrime;
640 else if(variable == "AEffDr03") value = object->AEffDr03;
641 else if(variable == "AEffDr04") value = object->AEffDr04;
642 else if(variable == "pfIsoR03SumChargedHadronPt") value = object->pfIsoR03SumChargedHadronPt;
643 else if(variable == "pfIsoR03SumNeutralHadronEt") value = object->pfIsoR03SumNeutralHadronEt;
644 else if(variable == "pfIsoR03SumPhotonEt") value = object->pfIsoR03SumPhotonEt;
645 else if(variable == "pfIsoR03SumPUPt") value = object->pfIsoR03SumPUPt;
646 else if(variable == "pfIsoR04SumChargedHadronPt") value = object->pfIsoR04SumChargedHadronPt;
647 else if(variable == "pfIsoR04SumNeutralHadronEt") value = object->pfIsoR04SumNeutralHadronEt;
648 else if(variable == "pfIsoR04SumPhotonEt") value = object->pfIsoR04SumPhotonEt;
649 else if(variable == "pfIsoR04SumPUPt") value = object->pfIsoR04SumPUPt;
650 else if(variable == "IP") value = object->IP;
651 else if(variable == "IPError") value = object->IPError;
652 else if(variable == "timeAtIpInOut") value = object->timeAtIpInOut;
653 else if(variable == "timeAtIpInOutErr") value = object->timeAtIpInOutErr;
654 else if(variable == "timeAtIpOutIn") value = object->timeAtIpOutIn;
655 else if(variable == "timeAtIpOutInErr") value = object->timeAtIpOutInErr;
656 else if(variable == "ecal_time") value = object->ecal_time;
657 else if(variable == "hcal_time") value = object->hcal_time;
658 else if(variable == "ecal_timeError") value = object->ecal_timeError;
659 else if(variable == "hcal_timeError") value = object->hcal_timeError;
660 else if(variable == "energy_ecal") value = object->energy_ecal;
661 else if(variable == "energy_hcal") value = object->energy_hcal;
662 else if(variable == "e3x3_ecal") value = object->e3x3_ecal;
663 else if(variable == "e3x3_hcal") value = object->e3x3_hcal;
664 else if(variable == "energyMax_ecal") value = object->energyMax_ecal;
665 else if(variable == "energyMax_hcal") value = object->energyMax_hcal;
666 else if(variable == "charge") value = object->charge;
667 else if(variable == "IDGMPTight") value = object->IDGMPTight;
668 else if(variable == "tkNumValidHits") value = object->tkNumValidHits;
669 else if(variable == "tkCharge") value = object->tkCharge;
670 else if(variable == "samNumValidHits") value = object->samNumValidHits;
671 else if(variable == "samCharge") value = object->samCharge;
672 else if(variable == "comNumValidHits") value = object->comNumValidHits;
673 else if(variable == "comCharge") value = object->comCharge;
674 else if(variable == "genId") value = object->genId;
675 else if(variable == "genCharge") value = object->genCharge;
676 else if(variable == "genNumberOfMothers") value = object->genNumberOfMothers;
677 else if(variable == "genMotherId") value = object->genMotherId;
678 else if(variable == "genMotherCharge") value = object->genMotherCharge;
679 else if(variable == "genMother0Id") value = object->genMother0Id;
680 else if(variable == "genMother1Id") value = object->genMother1Id;
681 else if(variable == "genGrandMother00Id") value = object->genGrandMother00Id;
682 else if(variable == "genGrandMother01Id") value = object->genGrandMother01Id;
683 else if(variable == "genGrandMother10Id") value = object->genGrandMother10Id;
684 else if(variable == "genGrandMother11Id") value = object->genGrandMother11Id;
685 else if(variable == "isPFMuon") value = object->isPFMuon;
686 else if(variable == "isGoodMuon_1StationTight") value = object->isGoodMuon_1StationTight;
687 else if(variable == "isGlobalMuon") value = object->isGlobalMuon;
688 else if(variable == "isTrackerMuon") value = object->isTrackerMuon;
689 else if(variable == "isStandAloneMuon") value = object->isStandAloneMuon;
690 else if(variable == "isGlobalMuonPromptTight") value = object->isGlobalMuonPromptTight;
691 else if(variable == "numberOfValidMuonHits") value = object->numberOfValidMuonHits;
692 else if(variable == "numberOfValidTrackerHits") value = object->numberOfValidTrackerHits;
693 else if(variable == "numberOfLayersWithMeasurement") value = object->numberOfLayersWithMeasurement;
694 else if(variable == "pixelLayersWithMeasurement") value = object->pixelLayersWithMeasurement;
695 else if(variable == "numberOfMatches") value = object->numberOfMatches;
696 else if(variable == "numberOfValidTrackerHitsInnerTrack") value = object->numberOfValidTrackerHitsInnerTrack;
697 else if(variable == "numberOfValidPixelHits") value = object->numberOfValidPixelHits;
698 else if(variable == "numberOfMatchedStations") value = object->numberOfMatchedStations;
699 else if(variable == "time_ndof") value = object->time_ndof;
700
701 else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
702
703 value = applyFunction(function, value);
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 value = applyFunction(function, value);
874
875 return value;
876 }
877
878
879 double
880 OSUAnalysis::valueLookup (const BNevent* object, string variable, string function){
881
882 double value = 0.0;
883
884 if(variable == "weight") value = object->weight;
885 else if(variable == "pthat") value = object->pthat;
886 else if(variable == "qScale") value = object->qScale;
887 else if(variable == "alphaQCD") value = object->alphaQCD;
888 else if(variable == "alphaQED") value = object->alphaQED;
889 else if(variable == "scalePDF") value = object->scalePDF;
890 else if(variable == "x1") value = object->x1;
891 else if(variable == "x2") value = object->x2;
892 else if(variable == "xPDF1") value = object->xPDF1;
893 else if(variable == "xPDF2") value = object->xPDF2;
894 else if(variable == "BSx") value = object->BSx;
895 else if(variable == "BSy") value = object->BSy;
896 else if(variable == "BSz") value = object->BSz;
897 else if(variable == "PVx") value = object->PVx;
898 else if(variable == "PVy") value = object->PVy;
899 else if(variable == "PVz") value = object->PVz;
900 else if(variable == "bField") value = object->bField;
901 else if(variable == "instLumi") value = object->instLumi;
902 else if(variable == "bxLumi") value = object->bxLumi;
903 else if(variable == "FilterOutScrapingFraction") value = object->FilterOutScrapingFraction;
904 else if(variable == "sumNVtx") value = object->sumNVtx;
905 else if(variable == "sumTrueNVtx") value = object->sumTrueNVtx;
906 else if(variable == "nm1_true") value = object->nm1_true;
907 else if(variable == "n0_true") value = object->n0_true;
908 else if(variable == "np1_true") value = object->np1_true;
909 else if(variable == "numTruePV") value = object->numTruePV;
910 else if(variable == "Q2ScaleUpWgt") value = object->Q2ScaleUpWgt;
911 else if(variable == "Q2ScaleDownWgt") value = object->Q2ScaleDownWgt;
912 else if(variable == "rho_kt6PFJets") value = object->rho_kt6PFJets;
913 else if(variable == "rho_kt6PFJetsCentralChargedPileUp") value = object->rho_kt6PFJetsCentralChargedPileUp;
914 else if(variable == "rho_kt6PFJetsCentralNeutral") value = object->rho_kt6PFJetsCentralNeutral;
915 else if(variable == "rho_kt6PFJetsCentralNeutralTight") value = object->rho_kt6PFJetsCentralNeutralTight;
916 else if(variable == "run") value = object->run;
917 else if(variable == "lumi") value = object->lumi;
918 else if(variable == "sample") value = object->sample;
919 else if(variable == "numPV") value = object->numPV;
920 else if(variable == "W0decay") value = object->W0decay;
921 else if(variable == "W1decay") value = object->W1decay;
922 else if(variable == "Z0decay") value = object->Z0decay;
923 else if(variable == "Z1decay") value = object->Z1decay;
924 else if(variable == "H0decay") value = object->H0decay;
925 else if(variable == "H1decay") value = object->H1decay;
926 else if(variable == "hcalnoiseLoose") value = object->hcalnoiseLoose;
927 else if(variable == "hcalnoiseTight") value = object->hcalnoiseTight;
928 else if(variable == "GoodVertex") value = object->GoodVertex;
929 else if(variable == "FilterOutScraping") value = object->FilterOutScraping;
930 else if(variable == "HBHENoiseFilter") value = object->HBHENoiseFilter;
931 else if(variable == "CSCLooseHaloId") value = object->CSCLooseHaloId;
932 else if(variable == "CSCTightHaloId") value = object->CSCTightHaloId;
933 else if(variable == "EcalLooseHaloId") value = object->EcalLooseHaloId;
934 else if(variable == "EcalTightHaloId") value = object->EcalTightHaloId;
935 else if(variable == "HcalLooseHaloId") value = object->HcalLooseHaloId;
936 else if(variable == "HcalTightHaloId") value = object->HcalTightHaloId;
937 else if(variable == "GlobalLooseHaloId") value = object->GlobalLooseHaloId;
938 else if(variable == "GlobalTightHaloId") value = object->GlobalTightHaloId;
939 else if(variable == "LooseId") value = object->LooseId;
940 else if(variable == "TightId") value = object->TightId;
941 else if(variable == "numGenPV") value = object->numGenPV;
942 else if(variable == "nm1") value = object->nm1;
943 else if(variable == "n0") value = object->n0;
944 else if(variable == "np1") value = object->np1;
945 else if(variable == "id1") value = object->id1;
946 else if(variable == "id2") value = object->id2;
947 else if(variable == "evt") value = object->evt;
948
949 else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
950
951 value = applyFunction(function, value);
952
953 return value;
954 }
955
956 double
957 OSUAnalysis::valueLookup (const BNtau* object, string variable, string function){
958
959 double value = 0.0;
960
961 if(variable == "px") value = object->px;
962 else if(variable == "py") value = object->py;
963 else if(variable == "pz") value = object->pz;
964 else if(variable == "energy") value = object->energy;
965 else if(variable == "et") value = object->et;
966 else if(variable == "pt") value = object->pt;
967 else if(variable == "eta") value = object->eta;
968 else if(variable == "phi") value = object->phi;
969 else if(variable == "emFraction") value = object->emFraction;
970 else if(variable == "leadingTrackPt") value = object->leadingTrackPt;
971 else if(variable == "leadingTrackIpVtdxy") value = object->leadingTrackIpVtdxy;
972 else if(variable == "leadingTrackIpVtdz") value = object->leadingTrackIpVtdz;
973 else if(variable == "leadingTrackIpVtdxyError") value = object->leadingTrackIpVtdxyError;
974 else if(variable == "leadingTrackIpVtdzError") value = object->leadingTrackIpVtdzError;
975 else if(variable == "leadingTrackVx") value = object->leadingTrackVx;
976 else if(variable == "leadingTrackVy") value = object->leadingTrackVy;
977 else if(variable == "leadingTrackVz") value = object->leadingTrackVz;
978 else if(variable == "leadingTrackValidHits") value = object->leadingTrackValidHits;
979 else if(variable == "leadingTrackNormChiSqrd") value = object->leadingTrackNormChiSqrd;
980 else if(variable == "numProngs") value = object->numProngs;
981 else if(variable == "numSignalGammas") value = object->numSignalGammas;
982 else if(variable == "numSignalNeutrals") value = object->numSignalNeutrals;
983 else if(variable == "numSignalPiZeros") value = object->numSignalPiZeros;
984 else if(variable == "decayMode") value = object->decayMode;
985 else if(variable == "charge") value = object->charge;
986 else if(variable == "inTheCracks") value = object->inTheCracks;
987 else if(variable == "HPSagainstElectronLoose") value = object->HPSagainstElectronLoose;
988 else if(variable == "HPSagainstElectronMVA") value = object->HPSagainstElectronMVA;
989 else if(variable == "HPSagainstElectronMedium") value = object->HPSagainstElectronMedium;
990 else if(variable == "HPSagainstElectronTight") value = object->HPSagainstElectronTight;
991 else if(variable == "HPSagainstMuonLoose") value = object->HPSagainstMuonLoose;
992 else if(variable == "HPSagainstMuonMedium") value = object->HPSagainstMuonMedium;
993 else if(variable == "HPSagainstMuonTight") value = object->HPSagainstMuonTight;
994 else if(variable == "HPSbyLooseCombinedIsolationDeltaBetaCorr") value = object->HPSbyLooseCombinedIsolationDeltaBetaCorr;
995 else if(variable == "HPSbyMediumCombinedIsolationDeltaBetaCorr") value = object->HPSbyMediumCombinedIsolationDeltaBetaCorr;
996 else if(variable == "HPSbyTightCombinedIsolationDeltaBetaCorr") value = object->HPSbyTightCombinedIsolationDeltaBetaCorr;
997 else if(variable == "HPSbyVLooseCombinedIsolationDeltaBetaCorr") value = object->HPSbyVLooseCombinedIsolationDeltaBetaCorr;
998 else if(variable == "HPSdecayModeFinding") value = object->HPSdecayModeFinding;
999 else if(variable == "leadingTrackValid") value = object->leadingTrackValid;
1000
1001
1002 else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
1003
1004 value = applyFunction(function, value);
1005
1006 return value;
1007 }
1008
1009 double
1010 OSUAnalysis::valueLookup (const BNmet* object, string variable, string function){
1011
1012 double value = 0.0;
1013
1014 if(variable == "et") value = object->et;
1015 else if(variable == "pt") value = object->pt;
1016 else if(variable == "px") value = object->px;
1017 else if(variable == "py") value = object->py;
1018 else if(variable == "phi") value = object->phi;
1019 else if(variable == "Upt") value = object->Upt;
1020 else if(variable == "Uphi") value = object->Uphi;
1021 else if(variable == "NeutralEMFraction") value = object->NeutralEMFraction;
1022 else if(variable == "NeutralHadEtFraction") value = object->NeutralHadEtFraction;
1023 else if(variable == "ChargedEMEtFraction") value = object->ChargedEMEtFraction;
1024 else if(variable == "ChargedHadEtFraction") value = object->ChargedHadEtFraction;
1025 else if(variable == "MuonEtFraction") value = object->MuonEtFraction;
1026 else if(variable == "Type6EtFraction") value = object->Type6EtFraction;
1027 else if(variable == "Type7EtFraction") value = object->Type7EtFraction;
1028 else if(variable == "genPT") value = object->genPT;
1029 else if(variable == "genPhi") value = object->genPhi;
1030 else if(variable == "muonCorEx") value = object->muonCorEx;
1031 else if(variable == "muonCorEy") value = object->muonCorEy;
1032 else if(variable == "jet20CorEx") value = object->jet20CorEx;
1033 else if(variable == "jet20CorEy") value = object->jet20CorEy;
1034 else if(variable == "jet1CorEx") value = object->jet1CorEx;
1035 else if(variable == "jet1CorEy") value = object->jet1CorEy;
1036 else if(variable == "sumET") value = object->sumET;
1037 else if(variable == "corSumET") value = object->corSumET;
1038 else if(variable == "mEtSig") value = object->mEtSig;
1039 else if(variable == "metSignificance") value = object->metSignificance;
1040 else if(variable == "significance") value = object->significance;
1041 else if(variable == "sigmaX2") value = object->sigmaX2;
1042 else if(variable == "sigmaY2") value = object->sigmaY2;
1043 else if(variable == "sigmaXY") value = object->sigmaXY;
1044 else if(variable == "sigmaYX") value = object->sigmaYX;
1045 else if(variable == "maxEtInEmTowers") value = object->maxEtInEmTowers;
1046 else if(variable == "emEtFraction") value = object->emEtFraction;
1047 else if(variable == "emEtInEB") value = object->emEtInEB;
1048 else if(variable == "emEtInEE") value = object->emEtInEE;
1049 else if(variable == "emEtInHF") value = object->emEtInHF;
1050 else if(variable == "maxEtInHadTowers") value = object->maxEtInHadTowers;
1051 else if(variable == "hadEtFraction") value = object->hadEtFraction;
1052 else if(variable == "hadEtInHB") value = object->hadEtInHB;
1053 else if(variable == "hadEtInHE") value = object->hadEtInHE;
1054 else if(variable == "hadEtInHF") value = object->hadEtInHF;
1055 else if(variable == "hadEtInHO") value = object->hadEtInHO;
1056 else if(variable == "UDeltaPx") value = object->UDeltaPx;
1057 else if(variable == "UDeltaPy") value = object->UDeltaPy;
1058 else if(variable == "UDeltaP") value = object->UDeltaP;
1059 else if(variable == "Uscale") value = object->Uscale;
1060 else if(variable == "type2corPx") value = object->type2corPx;
1061 else if(variable == "type2corPy") value = object->type2corPy;
1062 else if(variable == "T2pt") value = object->T2pt;
1063 else if(variable == "T2px") value = object->T2px;
1064 else if(variable == "T2py") value = object->T2py;
1065 else if(variable == "T2phi") value = object->T2phi;
1066 else if(variable == "T2sumET") value = object->T2sumET;
1067 else if(variable == "pfT1jet1pt") value = object->pfT1jet1pt;
1068 else if(variable == "pfT1jet1phi") value = object->pfT1jet1phi;
1069 else if(variable == "pfT1jet6pt") value = object->pfT1jet6pt;
1070 else if(variable == "pfT1jet6phi") value = object->pfT1jet6phi;
1071 else if(variable == "pfT1jet10pt") value = object->pfT1jet10pt;
1072 else if(variable == "pfT1jet10phi") value = object->pfT1jet10phi;
1073
1074 else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
1075
1076 value = applyFunction(function, value);
1077
1078 return value;
1079 }
1080
1081 double
1082 OSUAnalysis::valueLookup (const BNtrack* object, string variable, string function){
1083
1084 double value = 0.0;
1085
1086 if(variable == "pt") value = object->pt;
1087 else if(variable == "px") value = object->px;
1088 else if(variable == "py") value = object->py;
1089 else if(variable == "pz") value = object->pz;
1090 else if(variable == "phi") value = object->phi;
1091 else if(variable == "eta") value = object->eta;
1092 else if(variable == "theta") value = object->theta;
1093 else if(variable == "normChi2") value = object->normChi2;
1094 else if(variable == "dZ") value = object->dZ;
1095 else if(variable == "d0") value = object->d0;
1096 else if(variable == "d0err") value = object->d0err;
1097 else if(variable == "vx") value = object->vx;
1098 else if(variable == "vy") value = object->vy;
1099 else if(variable == "vz") value = object->vz;
1100 else if(variable == "charge") value = object->charge;
1101 else if(variable == "numValidHits") value = object->numValidHits;
1102 else if(variable == "isHighPurity") value = object->isHighPurity;
1103
1104
1105 else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
1106
1107 value = applyFunction(function, value);
1108
1109 return value;
1110 }
1111
1112 double
1113 OSUAnalysis::valueLookup (const BNgenjet* object, string variable, string function){
1114
1115 double value = 0.0;
1116
1117 if(variable == "pt") value = object->pt;
1118 else if(variable == "eta") value = object->eta;
1119 else if(variable == "phi") value = object->phi;
1120 else if(variable == "px") value = object->px;
1121 else if(variable == "py") value = object->py;
1122 else if(variable == "pz") value = object->pz;
1123 else if(variable == "et") value = object->et;
1124 else if(variable == "energy") value = object->energy;
1125 else if(variable == "mass") value = object->mass;
1126 else if(variable == "emEnergy") value = object->emEnergy;
1127 else if(variable == "hadEnergy") value = object->hadEnergy;
1128 else if(variable == "invisibleEnergy") value = object->invisibleEnergy;
1129 else if(variable == "auxiliaryEnergy") value = object->auxiliaryEnergy;
1130 else if(variable == "charge") value = object->charge;
1131
1132
1133 else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
1134
1135 value = applyFunction(function, value);
1136
1137 return value;
1138 }
1139
1140 double
1141 OSUAnalysis::valueLookup (const BNmcparticle* object, string variable, string function){
1142
1143 double value = 0.0;
1144
1145 if(variable == "energy") value = object->energy;
1146 else if(variable == "et") value = object->et;
1147 else if(variable == "pt") value = object->pt;
1148 else if(variable == "px") value = object->px;
1149 else if(variable == "py") value = object->py;
1150 else if(variable == "pz") value = object->pz;
1151 else if(variable == "phi") value = object->phi;
1152 else if(variable == "eta") value = object->eta;
1153 else if(variable == "theta") value = object->theta;
1154 else if(variable == "mass") value = object->mass;
1155 else if(variable == "vx") value = object->vx;
1156 else if(variable == "vy") value = object->vy;
1157 else if(variable == "vz") value = object->vz;
1158 else if(variable == "motherET") value = object->motherET;
1159 else if(variable == "motherPT") value = object->motherPT;
1160 else if(variable == "motherPhi") value = object->motherPhi;
1161 else if(variable == "motherEta") value = object->motherEta;
1162 else if(variable == "mother0ET") value = object->mother0ET;
1163 else if(variable == "mother0PT") value = object->mother0PT;
1164 else if(variable == "mother0Phi") value = object->mother0Phi;
1165 else if(variable == "mother0Eta") value = object->mother0Eta;
1166 else if(variable == "mother1ET") value = object->mother1ET;
1167 else if(variable == "mother1PT") value = object->mother1PT;
1168 else if(variable == "mother1Phi") value = object->mother1Phi;
1169 else if(variable == "mother1Eta") value = object->mother1Eta;
1170 else if(variable == "daughter0ET") value = object->daughter0ET;
1171 else if(variable == "daughter0PT") value = object->daughter0PT;
1172 else if(variable == "daughter0Phi") value = object->daughter0Phi;
1173 else if(variable == "daughter0Eta") value = object->daughter0Eta;
1174 else if(variable == "daughter1ET") value = object->daughter1ET;
1175 else if(variable == "daughter1PT") value = object->daughter1PT;
1176 else if(variable == "daughter1Phi") value = object->daughter1Phi;
1177 else if(variable == "daughter1Eta") value = object->daughter1Eta;
1178 else if(variable == "grandMotherET") value = object->grandMotherET;
1179 else if(variable == "grandMotherPT") value = object->grandMotherPT;
1180 else if(variable == "grandMotherPhi") value = object->grandMotherPhi;
1181 else if(variable == "grandMotherEta") value = object->grandMotherEta;
1182 else if(variable == "grandMother00ET") value = object->grandMother00ET;
1183 else if(variable == "grandMother00PT") value = object->grandMother00PT;
1184 else if(variable == "grandMother00Phi") value = object->grandMother00Phi;
1185 else if(variable == "grandMother00Eta") value = object->grandMother00Eta;
1186 else if(variable == "grandMother01ET") value = object->grandMother01ET;
1187 else if(variable == "grandMother01PT") value = object->grandMother01PT;
1188 else if(variable == "grandMother01Phi") value = object->grandMother01Phi;
1189 else if(variable == "grandMother01Eta") value = object->grandMother01Eta;
1190 else if(variable == "grandMother10ET") value = object->grandMother10ET;
1191 else if(variable == "grandMother10PT") value = object->grandMother10PT;
1192 else if(variable == "grandMother10Phi") value = object->grandMother10Phi;
1193 else if(variable == "grandMother10Eta") value = object->grandMother10Eta;
1194 else if(variable == "grandMother11ET") value = object->grandMother11ET;
1195 else if(variable == "grandMother11PT") value = object->grandMother11PT;
1196 else if(variable == "grandMother11Phi") value = object->grandMother11Phi;
1197 else if(variable == "grandMother11Eta") value = object->grandMother11Eta;
1198 else if(variable == "charge") value = object->charge;
1199 else if(variable == "id") value = object->id;
1200 else if(variable == "status") value = object->status;
1201 else if(variable == "motherId") value = object->motherId;
1202 else if(variable == "motherCharge") value = object->motherCharge;
1203 else if(variable == "mother0Id") value = object->mother0Id;
1204 else if(variable == "mother0Status") value = object->mother0Status;
1205 else if(variable == "mother0Charge") value = object->mother0Charge;
1206 else if(variable == "mother1Id") value = object->mother1Id;
1207 else if(variable == "mother1Status") value = object->mother1Status;
1208 else if(variable == "mother1Charge") value = object->mother1Charge;
1209 else if(variable == "daughter0Id") value = object->daughter0Id;
1210 else if(variable == "daughter0Status") value = object->daughter0Status;
1211 else if(variable == "daughter0Charge") value = object->daughter0Charge;
1212 else if(variable == "daughter1Id") value = object->daughter1Id;
1213 else if(variable == "daughter1Status") value = object->daughter1Status;
1214 else if(variable == "daughter1Charge") value = object->daughter1Charge;
1215 else if(variable == "grandMotherId") value = object->grandMotherId;
1216 else if(variable == "grandMotherCharge") value = object->grandMotherCharge;
1217 else if(variable == "grandMother00Id") value = object->grandMother00Id;
1218 else if(variable == "grandMother00Status") value = object->grandMother00Status;
1219 else if(variable == "grandMother00Charge") value = object->grandMother00Charge;
1220 else if(variable == "grandMother01Id") value = object->grandMother01Id;
1221 else if(variable == "grandMother01Status") value = object->grandMother01Status;
1222 else if(variable == "grandMother01Charge") value = object->grandMother01Charge;
1223 else if(variable == "grandMother10Id") value = object->grandMother10Id;
1224 else if(variable == "grandMother10Status") value = object->grandMother10Status;
1225 else if(variable == "grandMother10Charge") value = object->grandMother10Charge;
1226 else if(variable == "grandMother11Id") value = object->grandMother11Id;
1227 else if(variable == "grandMother11Status") value = object->grandMother11Status;
1228 else if(variable == "grandMother11Charge") value = object->grandMother11Charge;
1229
1230 else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
1231
1232 value = applyFunction(function, value);
1233
1234 return value;
1235 }
1236
1237 double
1238 OSUAnalysis::valueLookup (const BNprimaryvertex* object, string variable, string function){
1239
1240 double value = 0.0;
1241
1242 if(variable == "x") value = object->x;
1243 else if(variable == "xError") value = object->xError;
1244 else if(variable == "y") value = object->y;
1245 else if(variable == "yError") value = object->yError;
1246 else if(variable == "z") value = object->z;
1247 else if(variable == "zError") value = object->zError;
1248 else if(variable == "rho") value = object->rho;
1249 else if(variable == "normalizedChi2") value = object->normalizedChi2;
1250 else if(variable == "ndof") value = object->ndof;
1251 else if(variable == "isFake") value = object->isFake;
1252 else if(variable == "isValid") value = object->isValid;
1253 else if(variable == "tracksSize") value = object->tracksSize;
1254 else if(variable == "isGood") value = object->isGood;
1255
1256
1257 else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
1258
1259 value = applyFunction(function, value);
1260
1261 return value;
1262 }
1263
1264 double
1265 OSUAnalysis::valueLookup (const BNbxlumi* object, string variable, string function){
1266
1267 double value = 0.0;
1268
1269 if(variable == "bx_B1_now") value = object->bx_B1_now;
1270 else if(variable == "bx_B2_now") value = object->bx_B2_now;
1271 else if(variable == "bx_LUMI_now") value = object->bx_LUMI_now;
1272
1273
1274 else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
1275
1276 value = applyFunction(function, value);
1277
1278 return value;
1279 }
1280
1281 double
1282 OSUAnalysis::valueLookup (const BNphoton* object, string variable, string function){
1283
1284 double value = 0.0;
1285
1286 if(variable == "energy") value = object->energy;
1287 else if(variable == "et") value = object->et;
1288 else if(variable == "pt") value = object->pt;
1289 else if(variable == "px") value = object->px;
1290 else if(variable == "py") value = object->py;
1291 else if(variable == "pz") value = object->pz;
1292 else if(variable == "phi") value = object->phi;
1293 else if(variable == "eta") value = object->eta;
1294 else if(variable == "theta") value = object->theta;
1295 else if(variable == "trackIso") value = object->trackIso;
1296 else if(variable == "ecalIso") value = object->ecalIso;
1297 else if(variable == "hcalIso") value = object->hcalIso;
1298 else if(variable == "caloIso") value = object->caloIso;
1299 else if(variable == "trackIsoHollowConeDR03") value = object->trackIsoHollowConeDR03;
1300 else if(variable == "trackIsoSolidConeDR03") value = object->trackIsoSolidConeDR03;
1301 else if(variable == "ecalIsoDR03") value = object->ecalIsoDR03;
1302 else if(variable == "hcalIsoDR03") value = object->hcalIsoDR03;
1303 else if(variable == "caloIsoDR03") value = object->caloIsoDR03;
1304 else if(variable == "trackIsoHollowConeDR04") value = object->trackIsoHollowConeDR04;
1305 else if(variable == "trackIsoSolidConeDR04") value = object->trackIsoSolidConeDR04;
1306 else if(variable == "ecalIsoDR04") value = object->ecalIsoDR04;
1307 else if(variable == "hcalIsoDR04") value = object->hcalIsoDR04;
1308 else if(variable == "caloIsoDR04") value = object->caloIsoDR04;
1309 else if(variable == "hadOverEm") value = object->hadOverEm;
1310 else if(variable == "sigmaEtaEta") value = object->sigmaEtaEta;
1311 else if(variable == "sigmaIetaIeta") value = object->sigmaIetaIeta;
1312 else if(variable == "r9") value = object->r9;
1313 else if(variable == "scEnergy") value = object->scEnergy;
1314 else if(variable == "scRawEnergy") value = object->scRawEnergy;
1315 else if(variable == "scSeedEnergy") value = object->scSeedEnergy;
1316 else if(variable == "scEta") value = object->scEta;
1317 else if(variable == "scPhi") value = object->scPhi;
1318 else if(variable == "scZ") value = object->scZ;
1319 else if(variable == "genET") value = object->genET;
1320 else if(variable == "genPT") value = object->genPT;
1321 else if(variable == "genPhi") value = object->genPhi;
1322 else if(variable == "genEta") value = object->genEta;
1323 else if(variable == "genMotherET") value = object->genMotherET;
1324 else if(variable == "genMotherPT") value = object->genMotherPT;
1325 else if(variable == "genMotherPhi") value = object->genMotherPhi;
1326 else if(variable == "genMotherEta") value = object->genMotherEta;
1327 else if(variable == "eMax") value = object->eMax;
1328 else if(variable == "eLeft") value = object->eLeft;
1329 else if(variable == "eRight") value = object->eRight;
1330 else if(variable == "eTop") value = object->eTop;
1331 else if(variable == "eBottom") value = object->eBottom;
1332 else if(variable == "e3x3") value = object->e3x3;
1333 else if(variable == "swissCross") value = object->swissCross;
1334 else if(variable == "seedEnergy") value = object->seedEnergy;
1335 else if(variable == "seedTime") value = object->seedTime;
1336 else if(variable == "swissCrossNoI85") value = object->swissCrossNoI85;
1337 else if(variable == "swissCrossI85") value = object->swissCrossI85;
1338 else if(variable == "E2overE9NoI85") value = object->E2overE9NoI85;
1339 else if(variable == "E2overE9I85") value = object->E2overE9I85;
1340 else if(variable == "IDTight") value = object->IDTight;
1341 else if(variable == "IDLoose") value = object->IDLoose;
1342 else if(variable == "IDLooseEM") value = object->IDLooseEM;
1343 else if(variable == "genId") value = object->genId;
1344 else if(variable == "genCharge") value = object->genCharge;
1345 else if(variable == "genMotherId") value = object->genMotherId;
1346 else if(variable == "genMotherCharge") value = object->genMotherCharge;
1347 else if(variable == "isEB") value = object->isEB;
1348 else if(variable == "isEE") value = object->isEE;
1349 else if(variable == "isGap") value = object->isGap;
1350 else if(variable == "isEBEEGap") value = object->isEBEEGap;
1351 else if(variable == "isEBGap") value = object->isEBGap;
1352 else if(variable == "isEEGap") value = object->isEEGap;
1353 else if(variable == "hasPixelSeed") value = object->hasPixelSeed;
1354 else if(variable == "seedRecoFlag") value = object->seedRecoFlag;
1355
1356
1357 else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
1358
1359 value = applyFunction(function, value);
1360
1361 return value;
1362 }
1363
1364 double
1365 OSUAnalysis::valueLookup (const BNsupercluster* object, string variable, string function){
1366
1367 double value = 0.0;
1368
1369 if(variable == "energy") value = object->energy;
1370 else if(variable == "et") value = object->et;
1371 else if(variable == "ex") value = object->ex;
1372 else if(variable == "ey") value = object->ey;
1373 else if(variable == "ez") value = object->ez;
1374 else if(variable == "phi") value = object->phi;
1375 else if(variable == "eta") value = object->eta;
1376 else if(variable == "theta") value = object->theta;
1377
1378
1379 else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
1380
1381 value = applyFunction(function, value);
1382
1383 return value;
1384 }
1385
1386
1387 double
1388 OSUAnalysis::applyFunction(string function, double value){
1389
1390 if(function == "abs") value = abs(value);
1391
1392
1393 return value;
1394
1395 }
1396
1397
1398 template <class InputCollection>
1399 void OSUAnalysis::setObjectFlags(cut &currentCut, uint currentCutIndex, flagMap &individualFlags, flagMap &cumulativeFlags, InputCollection inputCollection, string inputType){
1400
1401
1402 for (uint object = 0; object != inputCollection->size(); object++){
1403
1404 bool decision = true;//object passes if this cut doesn't cut on that type of object
1405
1406 if(currentCut.inputCollection == inputType){
1407
1408 double value = valueLookup(&inputCollection->at(object), currentCut.variable, currentCut.function);
1409
1410 decision = evaluateComparison(value,currentCut.comparativeOperator,currentCut.cutValue);
1411 }
1412 individualFlags[inputType].at(currentCutIndex).push_back(decision);
1413
1414
1415 //set flags for objects that pass each cut AND all the previous cuts
1416 bool previousCumulativeFlag = true;
1417 for(uint previousCutIndex = 0; previousCutIndex != currentCutIndex; previousCutIndex++){
1418 if(previousCumulativeFlag && individualFlags[inputType].at(previousCutIndex).at(object)) previousCumulativeFlag = true;
1419 else{ previousCumulativeFlag = false; break;}
1420 }
1421 cumulativeFlags[inputType].at(currentCutIndex).push_back(previousCumulativeFlag && decision);
1422
1423 }
1424
1425 }
1426
1427
1428
1429
1430
1431 DEFINE_FWK_MODULE(OSUAnalysis);
1432
1433