ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/OSUT3Analysis/AnaTools/plugins/OSUAnalysis.cc
Revision: 1.3
Committed: Mon Jan 28 13:30:45 2013 UTC (12 years, 3 months ago) by lantonel
Content type: text/plain
Branch: MAIN
Changes since 1.2: +68 -28 lines
Log Message:
added trigger cut and abs function

File Contents

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