ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/OSUT3Analysis/AnaTools/plugins/OSUAnalysis.cc
Revision: 1.1
Committed: Mon Jan 21 10:39:34 2013 UTC (12 years, 3 months ago) by lantonel
Content type: text/plain
Branch: MAIN
Log Message:
\m\o\v\e\d\ \f\r\o\m\ \s\r\c

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