ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/OSUT3Analysis/AnaTools/plugins/OSUAnalysis.cc
Revision: 1.23
Committed: Mon Mar 4 22:38:39 2013 UTC (12 years, 2 months ago) by lantonel
Content type: text/plain
Branch: MAIN
Changes since 1.22: +149 -86 lines
Log Message:
take into account the object flags when filling the histograms with number of objects per events.  Also, I fixed a pretty subtle bug that was causing cuts on pairs of objects not to take into account the flags of the 2 objects that make the pair.  It only took me 12 hours to fix it!

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.15 puFile_ (cfg.getParameter<std::string> ("puFile")),
20     dataPU_ (cfg.getParameter<std::string> ("dataPU")),
21     dataset_ (cfg.getParameter<std::string> ("dataset")),
22     datasetType_ (cfg.getParameter<std::string> ("datasetType")),
23 lantonel 1.9 channels_ (cfg.getParameter<vector<edm::ParameterSet> >("channels")),
24 lantonel 1.14 histogramSets_ (cfg.getParameter<vector<edm::ParameterSet> >("histogramSets")),
25 lantonel 1.15 plotAllObjectsInPassingEvents_ (cfg.getParameter<bool> ("plotAllObjectsInPassingEvents"))
26 lantonel 1.1
27     {
28 lantonel 1.9
29 lantonel 1.1 TH1::SetDefaultSumw2 ();
30 lantonel 1.15
31     //create pile-up reweighting object, if necessary
32     if(datasetType_ != "data") puWeight_ = new PUWeight (puFile_, dataPU_, dataset_);
33 lantonel 1.1
34     // Construct Cutflow Objects. These store the results of cut decisions and
35     // handle filling cut flow histograms.
36     masterCutFlow_ = new CutFlow (fs_);
37     std::vector<TFileDirectory> directories;
38    
39 lantonel 1.9 //always get vertex collection so we can assign the primary vertex in the event
40 lantonel 1.23 objectsToGet.push_back("primaryvertexs");
41 lantonel 1.14 //always make the plot of number of primary verticex (to check pile-up reweighting)
42     objectsToPlot.push_back("primaryvertexs");
43 lantonel 1.23 //always make flags for the vertices to pick the best good one
44     // objectsToCut.push_back("primaryvertexs");
45 lantonel 1.9
46 lantonel 1.19 //always get the MC particles to do GEN-matching
47 lantonel 1.23 objectsToGet.push_back("mcparticles");
48 lantonel 1.19
49 lantonel 1.15 //always get the event collection to do pile-up reweighting
50 lantonel 1.23 objectsToGet.push_back("events");
51 lantonel 1.15
52 lantonel 1.9 //parse the histogram definitions
53     for(uint currentHistogramSet = 0; currentHistogramSet != histogramSets_.size(); currentHistogramSet++){
54    
55 lantonel 1.17 string tempInputCollection = histogramSets_.at(currentHistogramSet).getParameter<string> ("inputCollection");
56     if(tempInputCollection == "muon-electron pairs") tempInputCollection = "electron-muon pairs";
57     if(tempInputCollection.find("pairs")==std::string::npos){ //just a single object
58 lantonel 1.23 objectsToGet.push_back(tempInputCollection);
59 lantonel 1.17 objectsToPlot.push_back(tempInputCollection);
60     }
61 lantonel 1.23 else{//pair of objects, need to add them both to the things to objectsToGet
62 lantonel 1.17 int dashIndex = tempInputCollection.find("-");
63     int spaceIndex = tempInputCollection.find(" ");
64     int secondWordLength = spaceIndex - dashIndex;
65 lantonel 1.23 objectsToGet.push_back(tempInputCollection);
66     objectsToGet.push_back(tempInputCollection.substr(0,dashIndex)+"s");
67     objectsToGet.push_back(tempInputCollection.substr(dashIndex+1,secondWordLength-1)+"s");
68 lantonel 1.17 objectsToPlot.push_back(tempInputCollection);
69     objectsToPlot.push_back(tempInputCollection.substr(0,dashIndex)+"s");
70     objectsToPlot.push_back(tempInputCollection.substr(dashIndex+1,secondWordLength-1)+"s");
71 lantonel 1.23 objectsToCut.push_back(tempInputCollection);
72     objectsToCut.push_back(tempInputCollection.substr(0,dashIndex)+"s");
73     objectsToCut.push_back(tempInputCollection.substr(dashIndex+1,secondWordLength-1)+"s");
74    
75 lantonel 1.17 }
76    
77 lantonel 1.9 vector<edm::ParameterSet> histogramList_ (histogramSets_.at(currentHistogramSet).getParameter<vector<edm::ParameterSet> >("histograms"));
78    
79     for(uint currentHistogram = 0; currentHistogram != histogramList_.size(); currentHistogram++){
80    
81     histogram tempHistogram;
82     tempHistogram.inputCollection = tempInputCollection;
83     tempHistogram.name = histogramList_.at(currentHistogram).getParameter<string>("name");
84     tempHistogram.title = histogramList_.at(currentHistogram).getParameter<string>("title");
85     tempHistogram.bins = histogramList_.at(currentHistogram).getParameter<vector<double> >("bins");
86 lantonel 1.10 tempHistogram.inputVariables = histogramList_.at(currentHistogram).getParameter<vector<string> >("inputVariables");
87 lantonel 1.9
88     histograms.push_back(tempHistogram);
89    
90     }
91     }
92 lantonel 1.19 //make unique vector of objects we need to plot (so we can book a histogram with the number of each object)
93 lantonel 1.15 sort( objectsToPlot.begin(), objectsToPlot.end() );
94     objectsToPlot.erase( unique( objectsToPlot.begin(), objectsToPlot.end() ), objectsToPlot.end() );
95 lantonel 1.9
96    
97 lantonel 1.1
98 lantonel 1.22 //add histograms with the gen-matched id, mother id, and grandmother id
99     for(uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){
100    
101     string currentObject = objectsToPlot.at(currentObjectIndex);
102     if(currentObject != "muons" && currentObject != "electrons" && currentObject != "taus" && currentObject != "tracks" && currentObject != "photons" && currentObject != "superclusters") continue;
103    
104     histogram tempIdHisto;
105     histogram tempMomIdHisto;
106     histogram tempGmaIdHisto;
107    
108     tempIdHisto.inputCollection = currentObject;
109     tempMomIdHisto.inputCollection = currentObject;
110     tempGmaIdHisto.inputCollection = currentObject;
111    
112     currentObject = currentObject.substr(0, currentObject.size()-1);
113     tempIdHisto.name = currentObject+"GenMatchId";
114     tempMomIdHisto.name = currentObject+"GenMatchMotherId";
115     tempGmaIdHisto.name = currentObject+"GenMatchGrandmotherId";
116    
117     currentObject.at(0) = toupper(currentObject.at(0));
118     tempIdHisto.title = currentObject+" Gen-matched Particle";
119     tempMomIdHisto.title = currentObject+" Gen-matched Particle's Mother";
120     tempGmaIdHisto.title = currentObject+" Gen-matched Particle's Grandmother";
121    
122     int maxNum = 24;
123     vector<double> binVector;
124     binVector.push_back(maxNum);
125     binVector.push_back(0);
126     binVector.push_back(maxNum);
127    
128     tempIdHisto.bins = binVector;
129     tempIdHisto.inputVariables.push_back("genMatchedId");
130     tempMomIdHisto.bins = binVector;
131     tempMomIdHisto.inputVariables.push_back("genMatchedMotherId");
132     tempGmaIdHisto.bins = binVector;
133     tempGmaIdHisto.inputVariables.push_back("genMatchedGrandmotherId");
134    
135     histograms.push_back(tempIdHisto);
136     histograms.push_back(tempMomIdHisto);
137     histograms.push_back(tempGmaIdHisto);
138    
139     }
140    
141    
142 lantonel 1.14
143 lantonel 1.1 channel tempChannel;
144     //loop over all channels (event selections)
145     for(uint currentChannel = 0; currentChannel != channels_.size(); currentChannel++){
146 ahart 1.8
147 lantonel 1.1 //get name of channel
148     string channelName (channels_.at(currentChannel).getParameter<string>("name"));
149     tempChannel.name = channelName;
150     TString channelLabel = channelName;
151    
152 lantonel 1.3 //set triggers for this channel
153     vector<string> triggerNames;
154     triggerNames.clear();
155     tempChannel.triggers.clear();
156     if(channels_.at(currentChannel).exists("triggers")){
157     triggerNames = channels_.at(currentChannel).getParameter<vector<string> >("triggers");
158     for(uint trigger = 0; trigger!= triggerNames.size(); trigger++)
159 ahart 1.8 tempChannel.triggers.push_back(triggerNames.at(trigger));
160 lantonel 1.23 objectsToGet.push_back("triggers");
161 lantonel 1.3 }
162    
163 lantonel 1.1
164 lantonel 1.9
165 lantonel 1.14
166 lantonel 1.1 //create cutFlow for this channel
167     cutFlows_.push_back (new CutFlow (fs_, channelName));
168    
169     //book a directory in the output file with the name of the channel
170     TFileDirectory subDir = fs_->mkdir( channelName );
171     directories.push_back(subDir);
172 lantonel 1.10
173     std::map<std::string, TH1D*> oneDhistoMap;
174     oneDHists_.push_back(oneDhistoMap);
175     std::map<std::string, TH2D*> twoDhistoMap;
176     twoDHists_.push_back(twoDhistoMap);
177 lantonel 1.1
178 lantonel 1.14
179 lantonel 1.9 //book all histograms included in the configuration
180     for(uint currentHistogramIndex = 0; currentHistogramIndex != histograms.size(); currentHistogramIndex++){
181     histogram currentHistogram = histograms.at(currentHistogramIndex);
182 lantonel 1.10 int numBinsElements = currentHistogram.bins.size();
183     int numInputVariables = currentHistogram.inputVariables.size();
184 lantonel 1.14
185 lantonel 1.10 if(numBinsElements != 3 && numBinsElements !=6) {
186     std::cout << "Error: Didn't find correct number of bin specifications for histogram named '" << currentHistogram.name << "'\n";
187     exit(0);
188     }
189     else if((numBinsElements == 3 && numInputVariables !=1) || (numBinsElements == 6 && numInputVariables!=2)){
190     std::cout << "Error: Didn't find correct number of input variables for histogram named '" << currentHistogram.name << "'\n";
191     exit(0);
192     }
193 lantonel 1.14 else if(numBinsElements == 3){
194 lantonel 1.10 oneDHists_.at(currentChannel)[currentHistogram.name] = directories.at(currentChannel).make<TH1D> (TString(currentHistogram.name),channelLabel+" channel: "+currentHistogram.title, currentHistogram.bins.at(0), currentHistogram.bins.at(1), currentHistogram.bins.at(2));
195 lantonel 1.14 }
196     else if(numBinsElements == 6){
197 lantonel 1.10 twoDHists_.at(currentChannel)[currentHistogram.name] = directories.at(currentChannel).make<TH2D> (TString(currentHistogram.name),channelLabel+" channel: "+currentHistogram.title, currentHistogram.bins.at(0), currentHistogram.bins.at(1), currentHistogram.bins.at(2),currentHistogram.bins.at(3),currentHistogram.bins.at(4),currentHistogram.bins.at(5));
198    
199 lantonel 1.14 }
200    
201 lantonel 1.10
202 lantonel 1.22 if(currentHistogram.name.find("GenMatch")==std::string::npos) continue;
203    
204     // bin particle type
205     // --- -------------
206     // 0 unmatched
207     // 1 u
208     // 2 d
209     // 3 s
210     // 4 c
211     // 5 b
212     // 6 t
213     // 7 e
214     // 8 mu
215     // 9 tau
216     // 10 nu
217     // 11 g
218     // 12 gamma
219     // 13 Z
220     // 14 W
221     // 15 light meson
222     // 16 K meson
223     // 17 D meson
224     // 18 B meson
225     // 19 light baryon
226     // 20 strange baryon
227     // 21 charm baryon
228     // 22 bottom baryon
229     // 23 other
230    
231     vector<TString> labelArray;
232     labelArray.push_back("unmatched");
233     labelArray.push_back("u");
234     labelArray.push_back("d");
235     labelArray.push_back("s");
236     labelArray.push_back("c");
237     labelArray.push_back("b");
238     labelArray.push_back("t");
239     labelArray.push_back("e");
240     labelArray.push_back("#mu");
241     labelArray.push_back("#tau");
242     labelArray.push_back("#nu");
243     labelArray.push_back("g");
244     labelArray.push_back("#gamma");
245     labelArray.push_back("Z");
246     labelArray.push_back("W");
247     labelArray.push_back("light meson");
248     labelArray.push_back("K meson");
249     labelArray.push_back("D meson");
250     labelArray.push_back("B meson");
251     labelArray.push_back("light baryon");
252     labelArray.push_back("strange baryon");
253     labelArray.push_back("charm baryon");
254     labelArray.push_back("bottom baryon");
255     labelArray.push_back("other");
256    
257     for(int bin = 0; bin !=currentHistogram.bins.at(0); bin++){
258     oneDHists_.at(currentChannel)[currentHistogram.name]->GetXaxis()->SetBinLabel(bin+1,labelArray.at(bin));
259     }
260 lantonel 1.9 }
261     //book a histogram for the number of each object type to be plotted
262     for (uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){
263     string currentObject = objectsToPlot.at(currentObjectIndex);
264     int maxNum = 10;
265     if(currentObject == "mcparticles") maxNum = 50;
266 lantonel 1.15 else if(currentObject == "primaryvertexs") maxNum = 50;
267 lantonel 1.17 else if(currentObject == "muon-muon pairs") currentObject = "dimuonPairs";
268     else if(currentObject == "electron-electron pairs") currentObject = "dielectronPairs";
269     else if(currentObject == "electron-muon pairs") currentObject = "electronMuonPairs";
270    
271 lantonel 1.14 currentObject.at(0) = toupper(currentObject.at(0));
272 lantonel 1.9 string histoName = "num" + currentObject;
273 lantonel 1.17
274 lantonel 1.16 if(histoName == "numPrimaryvertexs"){
275     string newHistoName = histoName + "BeforePileupCorrection";
276     oneDHists_.at(currentChannel)[newHistoName] = directories.at(currentChannel).make<TH1D> (TString(newHistoName),channelLabel+" channel: Number of Selected "+currentObject+" Before Pileup Correction; # "+currentObject, maxNum, 0, maxNum);
277     newHistoName = histoName + "AfterPileupCorrection";
278     oneDHists_.at(currentChannel)[newHistoName] = directories.at(currentChannel).make<TH1D> (TString(newHistoName),channelLabel+" channel: Number of Selected "+currentObject+ " After Pileup Correction; # "+currentObject, maxNum, 0, maxNum);
279     }
280     else
281     oneDHists_.at(currentChannel)[histoName] = directories.at(currentChannel).make<TH1D> (TString(histoName),channelLabel+" channel: Number of Selected "+currentObject+"; # "+currentObject, maxNum, 0, maxNum);
282 lantonel 1.9 }
283 lantonel 1.1
284    
285 lantonel 1.22
286    
287    
288 lantonel 1.1 //get list of cuts for this channel
289     vector<edm::ParameterSet> cuts_ (channels_.at(currentChannel).getParameter<vector<edm::ParameterSet> >("cuts"));
290    
291     //loop over and parse all cuts
292     for(uint currentCut = 0; currentCut != cuts_.size(); currentCut++){
293 lantonel 1.17 cut tempCut;
294     //store input collection for cut
295     string tempInputCollection = cuts_.at(currentCut).getParameter<string> ("inputCollection");
296     tempCut.inputCollection = tempInputCollection;
297     if(tempInputCollection.find("pairs")==std::string::npos){ //just a single object
298 lantonel 1.23 objectsToGet.push_back(tempInputCollection);
299     objectsToCut.push_back(tempInputCollection);
300 lantonel 1.17 }
301 lantonel 1.23 else{//pair of objects, need to add them both to the things to objectsToGet
302 lantonel 1.17 int dashIndex = tempInputCollection.find("-");
303     int spaceIndex = tempInputCollection.find(" ");
304     int secondWordLength = spaceIndex - dashIndex;
305 lantonel 1.23 objectsToGet.push_back(tempInputCollection);
306     objectsToGet.push_back(tempInputCollection.substr(0,dashIndex)+"s");
307     objectsToGet.push_back(tempInputCollection.substr(dashIndex+1,secondWordLength-1)+"s");
308     objectsToCut.push_back(tempInputCollection);
309     objectsToCut.push_back(tempInputCollection.substr(0,dashIndex)+"s");
310     objectsToCut.push_back(tempInputCollection.substr(dashIndex+1,secondWordLength-1)+"s");
311 lantonel 1.17
312     }
313    
314 lantonel 1.1
315    
316     //split cut string into parts and store them
317     string cutString = cuts_.at(currentCut).getParameter<string> ("cutString");
318     std::vector<string> cutStringVector = splitString(cutString);
319 lantonel 1.17 if(cutStringVector.size()!=3 && cutStringVector.size() % 4 !=3){
320     std::cout << "Error: Didn't find the expected number elements in the following cut string: '" << cutString << "'\n";
321 lantonel 1.10 exit(0);
322     }
323 lantonel 1.17 tempCut.numSubcuts = (cutStringVector.size()+1)/4;
324     for(int subcutIndex = 0; subcutIndex != tempCut.numSubcuts; subcutIndex++){//loop over all the pieces of the cut combined using &,|
325     int indexOffset = 4 * subcutIndex;
326     string currentVariableString = cutStringVector.at(indexOffset);
327     if(currentVariableString.find("(")==std::string::npos){
328     tempCut.functions.push_back("");//no function was specified
329     tempCut.variables.push_back(currentVariableString);// variable to cut on
330     }
331     else{
332     tempCut.functions.push_back(currentVariableString.substr(0,currentVariableString.find("(")));//function comes before the "("
333     string tempVariable = currentVariableString.substr(currentVariableString.find("(")+1);//get rest of string
334     tempCut.variables.push_back(tempVariable.substr(0,tempVariable.size()-1));//remove trailing ")"
335     }
336     tempCut.comparativeOperators.push_back(cutStringVector.at(indexOffset+1));// comparison to make
337     tempCut.cutValues.push_back(atof(cutStringVector.at(indexOffset+2).c_str()));// threshold value to pass cut
338     if(subcutIndex != 0) tempCut.logicalOperators.push_back(cutStringVector.at(indexOffset-1)); // logical comparison (and, or)
339     }
340 lantonel 1.1
341     //get number of objects required to pass cut for event to pass
342     string numberRequiredString = cuts_.at(currentCut).getParameter<string> ("numberRequired");
343     std::vector<string> numberRequiredVector = splitString(numberRequiredString);
344 lantonel 1.10 if(numberRequiredVector.size()!=2){
345     std::cout << "Error: Didn't find two elements in the following number requirement string: '" << numberRequiredString << "'\n";
346     exit(0);
347     }
348 lantonel 1.1
349 ahart 1.8 int numberRequiredInt = atoi(numberRequiredVector.at(1).c_str());
350 lantonel 1.1 tempCut.numberRequired = numberRequiredInt;// number of objects required to pass the cut
351     tempCut.eventComparativeOperator = numberRequiredVector.at(0);// comparison to make
352 ahart 1.8
353 lantonel 1.17
354 lantonel 1.1 string tempCutName;
355     if(cuts_.at(currentCut).exists("alias")){
356 ahart 1.8 tempCutName = cuts_.at(currentCut).getParameter<string> ("alias");
357 lantonel 1.1 }
358     else{
359 ahart 1.8 //construct string for cutflow table
360     bool plural = numberRequiredInt != 1;
361 lantonel 1.17 string collectionString = plural ? tempInputCollection : tempInputCollection.substr(0, tempInputCollection.size()-1);
362 ahart 1.8 string cutName = numberRequiredString + " " + collectionString + " with " + cutString;
363     tempCutName = cutName;
364 lantonel 1.1 }
365     tempCut.name = tempCutName;
366    
367    
368     tempChannel.cuts.push_back(tempCut);
369    
370    
371 lantonel 1.9
372 lantonel 1.1 }//end loop over cuts
373    
374     channels.push_back(tempChannel);
375     tempChannel.cuts.clear();
376    
377     }//end loop over channels
378    
379 lantonel 1.9
380 lantonel 1.23 //make unique vector of objects we need to get from the event
381     sort( objectsToGet.begin(), objectsToGet.end() );
382     objectsToGet.erase( unique( objectsToGet.begin(), objectsToGet.end() ), objectsToGet.end() );
383     //make unique vector of objects we need to cut on
384     sort( objectsToCut.begin(), objectsToCut.end() );
385     objectsToCut.erase( unique( objectsToCut.begin(), objectsToCut.end() ), objectsToCut.end() );
386 lantonel 1.1
387    
388     }
389    
390     OSUAnalysis::~OSUAnalysis ()
391     {
392     // Destroying the CutFlow objects causes the cut flow numbers and time
393     // information to be printed to standard output.
394     for(uint currentChannel = 0; currentChannel != channels_.size(); currentChannel++){
395     delete cutFlows_.at(currentChannel);
396     }
397     }
398    
399     void
400     OSUAnalysis::analyze (const edm::Event &event, const edm::EventSetup &setup)
401     {
402 lantonel 1.2
403 lantonel 1.1 // Retrieve necessary collections from the event.
404 lantonel 1.22
405 lantonel 1.23 if (std::find(objectsToGet.begin(), objectsToGet.end(), "triggers") != objectsToGet.end())
406 lantonel 1.3 event.getByLabel (triggers_, triggers);
407    
408 lantonel 1.23 if (std::find(objectsToGet.begin(), objectsToGet.end(), "jets") != objectsToGet.end())
409 lantonel 1.1 event.getByLabel (jets_, jets);
410    
411 lantonel 1.23 if (std::find(objectsToGet.begin(), objectsToGet.end(), "muons") != objectsToGet.end())
412 lantonel 1.1 event.getByLabel (muons_, muons);
413    
414 lantonel 1.23 if (std::find(objectsToGet.begin(), objectsToGet.end(), "electrons") != objectsToGet.end())
415 lantonel 1.1 event.getByLabel (electrons_, electrons);
416    
417 lantonel 1.23 if (std::find(objectsToGet.begin(), objectsToGet.end(), "events") != objectsToGet.end())
418 lantonel 1.1 event.getByLabel (events_, events);
419    
420 lantonel 1.23 if (std::find(objectsToGet.begin(), objectsToGet.end(), "taus") != objectsToGet.end())
421 lantonel 1.1 event.getByLabel (taus_, taus);
422    
423 lantonel 1.23 if (std::find(objectsToGet.begin(), objectsToGet.end(), "mets") != objectsToGet.end())
424 lantonel 1.1 event.getByLabel (mets_, mets);
425    
426 lantonel 1.23 if (std::find(objectsToGet.begin(), objectsToGet.end(), "tracks") != objectsToGet.end())
427 lantonel 1.1 event.getByLabel (tracks_, tracks);
428    
429 lantonel 1.23 if (std::find(objectsToGet.begin(), objectsToGet.end(), "genjets") != objectsToGet.end())
430 lantonel 1.1 event.getByLabel (genjets_, genjets);
431    
432 lantonel 1.23 if (std::find(objectsToGet.begin(), objectsToGet.end(), "mcparticles") != objectsToGet.end())
433 lantonel 1.1 event.getByLabel (mcparticles_, mcparticles);
434    
435 lantonel 1.23 if (std::find(objectsToGet.begin(), objectsToGet.end(), "primaryvertexs") != objectsToGet.end())
436 lantonel 1.1 event.getByLabel (primaryvertexs_, primaryvertexs);
437    
438 lantonel 1.23 if (std::find(objectsToGet.begin(), objectsToGet.end(), "bxlumis") != objectsToGet.end())
439 lantonel 1.1 event.getByLabel (bxlumis_, bxlumis);
440    
441 lantonel 1.23 if (std::find(objectsToGet.begin(), objectsToGet.end(), "photons") != objectsToGet.end())
442 lantonel 1.1 event.getByLabel (photons_, photons);
443    
444 lantonel 1.23 if (std::find(objectsToGet.begin(), objectsToGet.end(), "superclusters") != objectsToGet.end())
445 lantonel 1.1 event.getByLabel (superclusters_, superclusters);
446    
447    
448 lantonel 1.15 //get pile-up event weight
449 lantonel 1.22 double puScaleFactor = 1.00;
450 lantonel 1.15 if(datasetType_ != "data")
451     puScaleFactor = puWeight_->at (events->at (0).numTruePV);
452 lantonel 1.14
453 lantonel 1.1 //loop over all channels
454    
455     for(uint currentChannelIndex = 0; currentChannelIndex != channels.size(); currentChannelIndex++){
456     channel currentChannel = channels.at(currentChannelIndex);
457 ahart 1.8
458     flagMap individualFlags;
459     flagMap cumulativeFlags;
460     counterMap passingCounter;
461 lantonel 1.1
462 lantonel 1.5 bool triggerDecision = true;
463 lantonel 1.3 if(currentChannel.triggers.size() != 0){ //triggers specified
464 lantonel 1.5 triggerDecision = evaluateTriggers(currentChannel.triggers,triggers.product());
465 lantonel 1.3 cutFlows_.at(currentChannelIndex)->at ("trigger") = triggerDecision;
466     }
467 lantonel 1.1
468     //loop over all cuts
469 lantonel 1.23
470    
471 lantonel 1.1 for(uint currentCutIndex = 0; currentCutIndex != currentChannel.cuts.size(); currentCutIndex++){
472     cut currentCut = currentChannel.cuts.at(currentCutIndex);
473    
474 lantonel 1.23 for(uint currentObjectIndex = 0; currentObjectIndex != objectsToCut.size(); currentObjectIndex++){
475     string currentObject = objectsToCut.at(currentObjectIndex);
476 lantonel 1.1
477 lantonel 1.23 //initialize maps to get ready to set cuts
478 ahart 1.8 individualFlags[currentObject].push_back (vector<bool> ());
479     cumulativeFlags[currentObject].push_back (vector<bool> ());
480    
481 lantonel 1.23 }
482     for(uint currentObjectIndex = 0; currentObjectIndex != objectsToCut.size(); currentObjectIndex++){
483     string currentObject = objectsToCut.at(currentObjectIndex);
484    
485     int flagsForPairCutsIndex = max(int(currentCutIndex-1),0);
486 lantonel 1.14
487 ahart 1.8 if(currentObject == "jets") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,jets.product(),"jets");
488     else if(currentObject == "muons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),"muons");
489     else if(currentObject == "electrons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),"electrons");
490     else if(currentObject == "events") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,events.product(),"events");
491     else if(currentObject == "taus") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,taus.product(),"taus");
492     else if(currentObject == "mets") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,mets.product(),"mets");
493     else if(currentObject == "tracks") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,tracks.product(),"tracks");
494     else if(currentObject == "genjets") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,genjets.product(),"genjets");
495     else if(currentObject == "mcparticles") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,mcparticles.product(),"mcparticles");
496     else if(currentObject == "primaryvertexs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,primaryvertexs.product(),"primaryvertexs");
497     else if(currentObject == "bxlumis") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,bxlumis.product(),"bxlumis");
498     else if(currentObject == "photons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,photons.product(),"photons");
499     else if(currentObject == "superclusters") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,superclusters.product(),"superclusters");
500 lantonel 1.1
501 lantonel 1.23
502     else if(currentObject == "muon-muon pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),muons.product(), \
503     cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \
504     cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \
505     "muon-muon pairs");
506     else if(currentObject == "electron-electron pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),electrons.product(), \
507     cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \
508     cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \
509     "electron-electron pairs");
510     else if(currentObject == "electron-muon pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),muons.product(), \
511     cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \
512     cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \
513     "electron-muon pairs");
514 lantonel 1.14
515 lantonel 1.1 }
516    
517    
518    
519     }//end loop over all cuts
520 ahart 1.8
521 lantonel 1.1
522     //use cumulative flags to apply cuts at event level
523    
524     bool eventPassedAllCuts = true;
525    
526 lantonel 1.5 //apply trigger (true if none were specified)
527     eventPassedAllCuts = eventPassedAllCuts && triggerDecision;
528 lantonel 1.4
529    
530 lantonel 1.1 for(uint currentCutIndex = 0; currentCutIndex != currentChannel.cuts.size(); currentCutIndex++){
531    
532     //loop over all objects and count how many passed the cumulative selection up to this point
533     cut currentCut = currentChannel.cuts.at(currentCutIndex);
534     int numberPassing = 0;
535 lantonel 1.3
536 lantonel 1.17 for (uint object = 0; object != cumulativeFlags.at(currentCut.inputCollection).at(currentCutIndex).size() ; object++){
537 lantonel 1.14 if(cumulativeFlags.at(currentCut.inputCollection).at(currentCutIndex).at(object)) numberPassing++;
538 lantonel 1.17 }
539 lantonel 1.1
540     bool cutDecision = evaluateComparison(numberPassing,currentCut.eventComparativeOperator,currentCut.numberRequired);
541     cutFlows_.at(currentChannelIndex)->at (currentCut.name) = cutDecision;
542    
543     eventPassedAllCuts = eventPassedAllCuts && cutDecision;
544    
545     }
546    
547 lantonel 1.15 cutFlows_.at(currentChannelIndex)->fillCutFlow(puScaleFactor);
548 ahart 1.8
549 lantonel 1.1
550 lantonel 1.17
551 lantonel 1.1 if(!eventPassedAllCuts)continue;
552    
553    
554 lantonel 1.23
555 lantonel 1.14
556 lantonel 1.9 //set position of primary vertex in event, in order to calculate quantities relative to it
557 lantonel 1.23 if(std::find(objectsToCut.begin(), objectsToCut.end(), "primaryvertexs") != objectsToCut.end()) {
558     vector<bool> vertexFlags = cumulativeFlags.at("primaryvertexs").back();
559     for (uint vertexIndex = 0; vertexIndex != vertexFlags.size(); vertexIndex++){
560     if(!vertexFlags.at(vertexIndex)) continue;
561     chosenPrimaryVertex = & primaryvertexs->at(vertexIndex);
562     break;
563     }
564     }
565     else {
566     chosenPrimaryVertex = & primaryvertexs->at(0);
567 ahart 1.8 }
568    
569 lantonel 1.23
570 lantonel 1.9 //filling histograms
571     for (uint histogramIndex = 0; histogramIndex != histograms.size(); histogramIndex++){
572     histogram currentHistogram = histograms.at(histogramIndex);
573    
574 lantonel 1.10 if(currentHistogram.inputVariables.size() == 1){
575     TH1D* histo;
576     histo = oneDHists_.at(currentChannelIndex).at(currentHistogram.name);
577 lantonel 1.23
578 lantonel 1.15 if(currentHistogram.inputCollection == "jets") fill1DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("jets").back(),puScaleFactor);
579 lantonel 1.22 else if(currentHistogram.inputCollection == "muons") fill1DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("muons").back(),puScaleFactor);
580 lantonel 1.17 else if(currentHistogram.inputCollection == "muon-muon pairs") fill1DHistogram(histo,currentHistogram,muons.product(),muons.product(),\
581     cumulativeFlags.at("muons").back(),cumulativeFlags.at("muons").back(),\
582     cumulativeFlags.at("muon-muon pairs").back(),puScaleFactor);
583 lantonel 1.15 else if(currentHistogram.inputCollection == "electrons") fill1DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("electrons").back(),puScaleFactor);
584 lantonel 1.17 else if(currentHistogram.inputCollection == "electron-electron pairs") fill1DHistogram(histo,currentHistogram,electrons.product(),electrons.product(),\
585     cumulativeFlags.at("electrons").back(),cumulativeFlags.at("electrons").back(),\
586     cumulativeFlags.at("electron-electron pairs").back(),puScaleFactor);
587     else if(currentHistogram.inputCollection == "electron-muon pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),muons.product(), \
588     cumulativeFlags.at("electrons").back(),cumulativeFlags.at("muons").back(),
589     cumulativeFlags.at("electron-muon pairs").back(),puScaleFactor);
590 lantonel 1.15 else if(currentHistogram.inputCollection == "events") fill1DHistogram(histo,currentHistogram,events.product(),cumulativeFlags.at("events").back(),puScaleFactor);
591     else if(currentHistogram.inputCollection == "taus") fill1DHistogram(histo,currentHistogram,taus.product(),cumulativeFlags.at("taus").back(),puScaleFactor);
592     else if(currentHistogram.inputCollection == "mets") fill1DHistogram(histo,currentHistogram,mets.product(),cumulativeFlags.at("mets").back(),puScaleFactor);
593     else if(currentHistogram.inputCollection == "tracks") fill1DHistogram(histo,currentHistogram,tracks.product(),cumulativeFlags.at("tracks").back(),puScaleFactor);
594     else if(currentHistogram.inputCollection == "genjets") fill1DHistogram(histo,currentHistogram,genjets.product(),cumulativeFlags.at("genjets").back(),puScaleFactor);
595     else if(currentHistogram.inputCollection == "mcparticles") fill1DHistogram(histo,currentHistogram,mcparticles.product(),cumulativeFlags.at("mcparticles").back(),puScaleFactor);
596     else if(currentHistogram.inputCollection == "primaryvertexs") fill1DHistogram(histo,currentHistogram,primaryvertexs.product(),cumulativeFlags.at("primaryvertexs").back(),puScaleFactor);
597     else if(currentHistogram.inputCollection == "bxlumis") fill1DHistogram(histo,currentHistogram,bxlumis.product(),cumulativeFlags.at("bxlumis").back(),puScaleFactor);
598     else if(currentHistogram.inputCollection == "photons") fill1DHistogram(histo,currentHistogram,photons.product(),cumulativeFlags.at("photons").back(),puScaleFactor);
599     else if(currentHistogram.inputCollection == "superclusters") fill1DHistogram(histo,currentHistogram,superclusters.product(),cumulativeFlags.at("superclusters").back(),puScaleFactor);
600 lantonel 1.10 }
601     else if(currentHistogram.inputVariables.size() == 2){
602     TH2D* histo;
603     histo = twoDHists_.at(currentChannelIndex).at(currentHistogram.name);
604 lantonel 1.15 if(currentHistogram.inputCollection == "jets") fill2DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("jets").back(),puScaleFactor);
605     else if(currentHistogram.inputCollection == "muons") fill2DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("muons").back(),puScaleFactor);
606 lantonel 1.17 else if(currentHistogram.inputCollection == "muon-muon pairs") fill2DHistogram(histo,currentHistogram,muons.product(),muons.product(), \
607     cumulativeFlags.at("muons").back(),cumulativeFlags.at("muons").back(), \
608     cumulativeFlags.at("muon-muon pairs").back(),puScaleFactor);
609 lantonel 1.15 else if(currentHistogram.inputCollection == "electrons") fill2DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("electrons").back(),puScaleFactor);
610 lantonel 1.17 else if(currentHistogram.inputCollection == "electron-electron pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),electrons.product(), \
611     cumulativeFlags.at("electrons").back(),cumulativeFlags.at("electrons").back(), \
612     cumulativeFlags.at("electron-electron pairs").back(),puScaleFactor);
613     else if(currentHistogram.inputCollection == "electron-muon pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),muons.product(), \
614     cumulativeFlags.at("electrons").back(),cumulativeFlags.at("muons").back(), \
615     cumulativeFlags.at("electron-muon pairs").back(),puScaleFactor);
616 lantonel 1.15 else if(currentHistogram.inputCollection == "events") fill2DHistogram(histo,currentHistogram,events.product(),cumulativeFlags.at("events").back(),puScaleFactor);
617     else if(currentHistogram.inputCollection == "taus") fill2DHistogram(histo,currentHistogram,taus.product(),cumulativeFlags.at("taus").back(),puScaleFactor);
618     else if(currentHistogram.inputCollection == "mets") fill2DHistogram(histo,currentHistogram,mets.product(),cumulativeFlags.at("mets").back(),puScaleFactor);
619     else if(currentHistogram.inputCollection == "tracks") fill2DHistogram(histo,currentHistogram,tracks.product(),cumulativeFlags.at("tracks").back(),puScaleFactor);
620     else if(currentHistogram.inputCollection == "genjets") fill2DHistogram(histo,currentHistogram,genjets.product(),cumulativeFlags.at("genjets").back(),puScaleFactor);
621     else if(currentHistogram.inputCollection == "mcparticles") fill2DHistogram(histo,currentHistogram,mcparticles.product(),cumulativeFlags.at("mcparticles").back(),puScaleFactor);
622     else if(currentHistogram.inputCollection == "primaryvertexs") fill2DHistogram(histo,currentHistogram,primaryvertexs.product(),cumulativeFlags.at("primaryvertexs").back(),puScaleFactor);
623     else if(currentHistogram.inputCollection == "bxlumis") fill2DHistogram(histo,currentHistogram,bxlumis.product(),cumulativeFlags.at("bxlumis").back(),puScaleFactor);
624     else if(currentHistogram.inputCollection == "photons") fill2DHistogram(histo,currentHistogram,photons.product(),cumulativeFlags.at("photons").back(),puScaleFactor);
625     else if(currentHistogram.inputCollection == "superclusters") fill2DHistogram(histo,currentHistogram,superclusters.product(),cumulativeFlags.at("superclusters").back(),puScaleFactor);
626 lantonel 1.10 }
627     }
628 lantonel 1.4
629 lantonel 1.9 //fills histograms with the sizes of collections
630     for (uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){
631     string currentObject = objectsToPlot.at(currentObjectIndex);
632 lantonel 1.17
633 lantonel 1.23 string objectToPlot = "";
634    
635     if(currentObject == "muon-muon pairs") objectToPlot = "dimuonPairs";
636     else if(currentObject == "electron-electron pairs") objectToPlot = "dielectronPairs";
637     else if(currentObject == "electron-muon pairs") objectToPlot = "electronMuonPairs";
638     else objectToPlot = currentObject;
639     string tempCurrentObject = objectToPlot;
640 lantonel 1.14 tempCurrentObject.at(0) = toupper(tempCurrentObject.at(0));
641 lantonel 1.9 string histoName = "num" + tempCurrentObject;
642    
643 lantonel 1.17
644 lantonel 1.23
645    
646     //set position of primary vertex in event, in order to calculate quantities relative to it
647     if(std::find(objectsToCut.begin(), objectsToCut.end(), currentObject) != objectsToCut.end()) {
648     vector<bool> lastCutFlags = cumulativeFlags.at(currentObject).back();
649     int numToPlot = 0;
650     for (uint currentFlag = 0; currentFlag != lastCutFlags.size(); currentFlag++){
651     if(lastCutFlags.at(currentFlag)) numToPlot++;
652     }
653     if(objectToPlot == "primaryvertexs"){
654     oneDHists_.at(currentChannelIndex).at(histoName+"BeforePileupCorrection")->Fill(primaryvertexs->size());
655     oneDHists_.at(currentChannelIndex).at(histoName+"AfterPileupCorrection")->Fill(primaryvertexs->size(),puScaleFactor);
656     }
657     else
658     oneDHists_.at(currentChannelIndex).at(histoName)->Fill(numToPlot,puScaleFactor);
659     }
660     else if(objectToPlot == "jets") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(jets->size(),puScaleFactor);
661     else if(objectToPlot == "muons") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(muons->size(),puScaleFactor);
662     else if(objectToPlot == "dimuonPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(muons->size()*(muons->size()-1)/2,puScaleFactor);
663     else if(objectToPlot == "electrons") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size(),puScaleFactor);
664     else if(objectToPlot == "dielectronPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size()*(electrons->size()-1)/2,puScaleFactor);
665     else if(objectToPlot == "electronMuonPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size()*muons->size(),puScaleFactor);
666     else if(objectToPlot == "events") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(events->size(),puScaleFactor);
667     else if(objectToPlot == "taus") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(taus->size(),puScaleFactor);
668     else if(objectToPlot == "mets") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(mets->size(),puScaleFactor);
669     else if(objectToPlot == "tracks") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(tracks->size(),puScaleFactor);
670     else if(objectToPlot == "genjets") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(genjets->size(),puScaleFactor);
671     else if(objectToPlot == "mcparticles") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(mcparticles->size(),puScaleFactor);
672     else if(objectToPlot == "bxlumis") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(bxlumis->size(),puScaleFactor);
673     else if(objectToPlot == "photons") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(photons->size(),puScaleFactor);
674     else if(objectToPlot == "superclusters") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(superclusters->size(),puScaleFactor);
675     else if(objectToPlot == "primaryvertexs"){
676 lantonel 1.16 oneDHists_.at(currentChannelIndex).at(histoName+"BeforePileupCorrection")->Fill(primaryvertexs->size());
677     oneDHists_.at(currentChannelIndex).at(histoName+"AfterPileupCorrection")->Fill(primaryvertexs->size(),puScaleFactor);
678     }
679 ahart 1.8
680 lantonel 1.1 }
681 lantonel 1.22
682    
683    
684    
685 lantonel 1.1 } //end loop over channel
686    
687 lantonel 1.15 masterCutFlow_->fillCutFlow(puScaleFactor);
688 lantonel 1.1
689    
690 lantonel 1.14
691 lantonel 1.1 }
692    
693    
694 ahart 1.8 bool
695 lantonel 1.1 OSUAnalysis::evaluateComparison (double testValue, string comparison, double cutValue){
696    
697 lantonel 1.3
698 lantonel 1.1 if(comparison == ">") return testValue > cutValue;
699     else if(comparison == ">=") return testValue >= cutValue;
700     else if(comparison == "<") return testValue < cutValue;
701     else if(comparison == "<=") return testValue <= cutValue;
702 ahart 1.8 else if(comparison == "==") return testValue == cutValue;
703 lantonel 1.17 else if(comparison == "=") return testValue == cutValue;
704 ahart 1.8 else if(comparison == "!=") return testValue != cutValue;
705 lantonel 1.1 else {std::cout << "WARNING: invalid comparison operator '" << comparison << "'\n"; return false;}
706    
707     }
708    
709 lantonel 1.3 bool
710     OSUAnalysis::evaluateTriggers (vector<string> triggersToTest, const BNtriggerCollection* triggerCollection){
711    
712     bool triggerDecision = false;
713    
714     for (BNtriggerCollection::const_iterator trigger = triggerCollection->begin (); trigger != triggerCollection->end (); trigger++)
715     {
716     if(trigger->pass != 1) continue;
717     for(uint triggerName = 0; triggerName != triggersToTest.size(); triggerName++)
718     {
719     if(trigger->name.find(triggersToTest.at(triggerName))!=std::string::npos){
720 ahart 1.8 triggerDecision = true;
721 lantonel 1.3 }
722     }
723     }
724     return triggerDecision;
725    
726     }
727    
728 lantonel 1.1 std::vector<std::string>
729     OSUAnalysis::splitString (string inputString){
730    
731     std::stringstream stringStream(inputString);
732     std::istream_iterator<std::string> begin(stringStream);
733     std::istream_iterator<std::string> end;
734     std::vector<std::string> stringVector(begin, end);
735     return stringVector;
736    
737     }
738    
739     double
740 lantonel 1.3 OSUAnalysis::valueLookup (const BNjet* object, string variable, string function){
741 lantonel 1.1
742     double value = 0.0;
743     if(variable == "energy") value = object->energy;
744     else if(variable == "et") value = object->et;
745     else if(variable == "pt") value = object->pt;
746     else if(variable == "px") value = object->px;
747     else if(variable == "py") value = object->py;
748     else if(variable == "pz") value = object->pz;
749     else if(variable == "phi") value = object->phi;
750     else if(variable == "eta") value = object->eta;
751     else if(variable == "theta") value = object->theta;
752     else if(variable == "Upt") value = object->Upt;
753     else if(variable == "Uenergy") value = object->Uenergy;
754     else if(variable == "L2pt") value = object->L2pt;
755     else if(variable == "L2L3pt") value = object->L2L3pt;
756     else if(variable == "L2L3respt") value = object->L2L3respt;
757     else if(variable == "respt") value = object->respt;
758     else if(variable == "EMfrac") value = object->EMfrac;
759     else if(variable == "Hadfrac") value = object->Hadfrac;
760     else if(variable == "charge") value = object->charge;
761     else if(variable == "mass") value = object->mass;
762     else if(variable == "area") value = object->area;
763     else if(variable == "fHPD") value = object->fHPD;
764     else if(variable == "approximatefHPD") value = object->approximatefHPD;
765     else if(variable == "genPartonET") value = object->genPartonET;
766     else if(variable == "genPartonPT") value = object->genPartonPT;
767     else if(variable == "genPartonEta") value = object->genPartonEta;
768     else if(variable == "genPartonPhi") value = object->genPartonPhi;
769     else if(variable == "genJetET") value = object->genJetET;
770     else if(variable == "genJetPT") value = object->genJetPT;
771     else if(variable == "genJetEta") value = object->genJetEta;
772     else if(variable == "genJetPhi") value = object->genJetPhi;
773     else if(variable == "btagTChighPur") value = object->btagTChighPur;
774     else if(variable == "btagTChighEff") value = object->btagTChighEff;
775     else if(variable == "btagJetProb") value = object->btagJetProb;
776     else if(variable == "btagJetBProb") value = object->btagJetBProb;
777     else if(variable == "btagSoftEle") value = object->btagSoftEle;
778     else if(variable == "btagSoftMuon") value = object->btagSoftMuon;
779     else if(variable == "btagSoftMuonNoIP") value = object->btagSoftMuonNoIP;
780     else if(variable == "btagSecVertex") value = object->btagSecVertex;
781     else if(variable == "btagSecVertexHighEff") value = object->btagSecVertexHighEff;
782     else if(variable == "btagSecVertexHighPur") value = object->btagSecVertexHighPur;
783     else if(variable == "btagCombinedSecVertex") value = object->btagCombinedSecVertex;
784     else if(variable == "btagCombinedSecVertexMVA") value = object->btagCombinedSecVertexMVA;
785     else if(variable == "btagSoftMuonByPt") value = object->btagSoftMuonByPt;
786     else if(variable == "btagSoftMuonByIP3") value = object->btagSoftMuonByIP3;
787     else if(variable == "btagSoftElectronByPt") value = object->btagSoftElectronByPt;
788     else if(variable == "btagSoftElectronByIP3") value = object->btagSoftElectronByIP3;
789     else if(variable == "n90Hits") value = object->n90Hits;
790     else if(variable == "hitsInN90") value = object->hitsInN90;
791     else if(variable == "chargedHadronEnergyFraction") value = object->chargedHadronEnergyFraction;
792     else if(variable == "neutralHadronEnergyFraction") value = object->neutralHadronEnergyFraction;
793     else if(variable == "chargedEmEnergyFraction") value = object->chargedEmEnergyFraction;
794     else if(variable == "neutralEmEnergyFraction") value = object->neutralEmEnergyFraction;
795     else if(variable == "fLong") value = object->fLong;
796     else if(variable == "fShort") value = object->fShort;
797     else if(variable == "etaetaMoment") value = object->etaetaMoment;
798     else if(variable == "phiphiMoment") value = object->phiphiMoment;
799     else if(variable == "JESunc") value = object->JESunc;
800     else if(variable == "JECuncUp") value = object->JECuncUp;
801     else if(variable == "JECuncDown") value = object->JECuncDown;
802     else if(variable == "puJetMVA_full") value = object->puJetMVA_full;
803     else if(variable == "puJetMVA_simple") value = object->puJetMVA_simple;
804     else if(variable == "puJetMVA_cutbased") value = object->puJetMVA_cutbased;
805     else if(variable == "dZ") value = object->dZ;
806     else if(variable == "dR2Mean") value = object->dR2Mean;
807     else if(variable == "dRMean") value = object->dRMean;
808     else if(variable == "frac01") value = object->frac01;
809     else if(variable == "frac02") value = object->frac02;
810     else if(variable == "frac03") value = object->frac03;
811     else if(variable == "frac04") value = object->frac04;
812     else if(variable == "frac05") value = object->frac05;
813     else if(variable == "frac06") value = object->frac06;
814     else if(variable == "frac07") value = object->frac07;
815     else if(variable == "beta") value = object->beta;
816     else if(variable == "betaStar") value = object->betaStar;
817     else if(variable == "betaClassic") value = object->betaClassic;
818     else if(variable == "betaStarClassic") value = object->betaStarClassic;
819     else if(variable == "ptD") value = object->ptD;
820     else if(variable == "nvtx") value = object->nvtx;
821     else if(variable == "d0") value = object->d0;
822     else if(variable == "leadCandPt") value = object->leadCandPt;
823     else if(variable == "leadCandVx") value = object->leadCandVx;
824     else if(variable == "leadCandVy") value = object->leadCandVy;
825     else if(variable == "leadCandVz") value = object->leadCandVz;
826     else if(variable == "leadCandDistFromPV") value = object->leadCandDistFromPV;
827     else if(variable == "flavour") value = object->flavour;
828     else if(variable == "Nconst") value = object->Nconst;
829     else if(variable == "jetIDMinimal") value = object->jetIDMinimal;
830     else if(variable == "jetIDLooseAOD") value = object->jetIDLooseAOD;
831     else if(variable == "jetIDLoose") value = object->jetIDLoose;
832     else if(variable == "jetIDTight") value = object->jetIDTight;
833     else if(variable == "genPartonId") value = object->genPartonId;
834     else if(variable == "genPartonMotherId") value = object->genPartonMotherId;
835     else if(variable == "genPartonMother0Id") value = object->genPartonMother0Id;
836     else if(variable == "genPartonMother1Id") value = object->genPartonMother1Id;
837     else if(variable == "genPartonGrandMotherId") value = object->genPartonGrandMotherId;
838     else if(variable == "genPartonGrandMother00Id") value = object->genPartonGrandMother00Id;
839     else if(variable == "genPartonGrandMother01Id") value = object->genPartonGrandMother01Id;
840     else if(variable == "genPartonGrandMother10Id") value = object->genPartonGrandMother10Id;
841     else if(variable == "genPartonGrandMother11Id") value = object->genPartonGrandMother11Id;
842     else if(variable == "chargedMultiplicity") value = object->chargedMultiplicity;
843     else if(variable == "neutralMultiplicity") value = object->neutralMultiplicity;
844     else if(variable == "nconstituents") value = object->nconstituents;
845     else if(variable == "nHit") value = object->nHit;
846     else if(variable == "puJetId_full") value = object->puJetId_full;
847     else if(variable == "puJetId_simple") value = object->puJetId_simple;
848     else if(variable == "puJetId_cutbased") value = object->puJetId_cutbased;
849     else if(variable == "puJetId_tight_full") value = object->puJetId_tight_full;
850     else if(variable == "puJetId_tight_simple") value = object->puJetId_tight_simple;
851     else if(variable == "puJetId_tight_cutbased") value = object->puJetId_tight_cutbased;
852     else if(variable == "puJetId_medium_full") value = object->puJetId_medium_full;
853     else if(variable == "puJetId_medium_simple") value = object->puJetId_medium_simple;
854     else if(variable == "puJetId_medium_cutbased") value = object->puJetId_medium_cutbased;
855     else if(variable == "puJetId_loose_full") value = object->puJetId_loose_full;
856     else if(variable == "puJetId_loose_simple") value = object->puJetId_loose_simple;
857     else if(variable == "puJetId_loose_cutbased") value = object->puJetId_loose_cutbased;
858 ahart 1.8
859    
860 lantonel 1.1 else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
861 ahart 1.8
862 lantonel 1.6 value = applyFunction(function, value);
863 lantonel 1.1
864     return value;
865     }
866    
867    
868    
869     double
870 lantonel 1.3 OSUAnalysis::valueLookup (const BNmuon* object, string variable, string function){
871 lantonel 1.1
872     double value = 0.0;
873     if(variable == "energy") value = object->energy;
874     else if(variable == "et") value = object->et;
875     else if(variable == "pt") value = object->pt;
876     else if(variable == "px") value = object->px;
877     else if(variable == "py") value = object->py;
878     else if(variable == "pz") value = object->pz;
879     else if(variable == "phi") value = object->phi;
880     else if(variable == "eta") value = object->eta;
881     else if(variable == "theta") value = object->theta;
882     else if(variable == "trackIso") value = object->trackIso;
883     else if(variable == "ecalIso") value = object->ecalIso;
884     else if(variable == "hcalIso") value = object->hcalIso;
885     else if(variable == "caloIso") value = object->caloIso;
886 lantonel 1.22 else if(variable == "trackIsDR03") value = object->trackIsoDR03;
887 lantonel 1.1 else if(variable == "ecalIsoDR03") value = object->ecalIsoDR03;
888     else if(variable == "hcalIsoDR03") value = object->hcalIsoDR03;
889     else if(variable == "caloIsoDR03") value = object->caloIsoDR03;
890     else if(variable == "trackVetoIsoDR03") value = object->trackVetoIsoDR03;
891     else if(variable == "ecalVetoIsoDR03") value = object->ecalVetoIsoDR03;
892     else if(variable == "hcalVetoIsoDR03") value = object->hcalVetoIsoDR03;
893     else if(variable == "caloVetoIsoDR03") value = object->caloVetoIsoDR03;
894     else if(variable == "trackIsoDR05") value = object->trackIsoDR05;
895     else if(variable == "ecalIsoDR05") value = object->ecalIsoDR05;
896     else if(variable == "hcalIsoDR05") value = object->hcalIsoDR05;
897     else if(variable == "caloIsoDR05") value = object->caloIsoDR05;
898     else if(variable == "trackVetoIsoDR05") value = object->trackVetoIsoDR05;
899     else if(variable == "ecalVetoIsoDR05") value = object->ecalVetoIsoDR05;
900     else if(variable == "hcalVetoIsoDR05") value = object->hcalVetoIsoDR05;
901     else if(variable == "caloVetoIsoDR05") value = object->caloVetoIsoDR05;
902     else if(variable == "hcalE") value = object->hcalE;
903     else if(variable == "ecalE") value = object->ecalE;
904     else if(variable == "genET") value = object->genET;
905     else if(variable == "genPT") value = object->genPT;
906     else if(variable == "genPhi") value = object->genPhi;
907     else if(variable == "genEta") value = object->genEta;
908     else if(variable == "genMotherET") value = object->genMotherET;
909     else if(variable == "genMotherPT") value = object->genMotherPT;
910     else if(variable == "genMotherPhi") value = object->genMotherPhi;
911     else if(variable == "genMotherEta") value = object->genMotherEta;
912     else if(variable == "vx") value = object->vx;
913     else if(variable == "vy") value = object->vy;
914     else if(variable == "vz") value = object->vz;
915     else if(variable == "tkNormChi2") value = object->tkNormChi2;
916     else if(variable == "tkPT") value = object->tkPT;
917     else if(variable == "tkEta") value = object->tkEta;
918     else if(variable == "tkPhi") value = object->tkPhi;
919     else if(variable == "tkDZ") value = object->tkDZ;
920     else if(variable == "tkD0") value = object->tkD0;
921     else if(variable == "tkD0bs") value = object->tkD0bs;
922     else if(variable == "tkD0err") value = object->tkD0err;
923     else if(variable == "samNormChi2") value = object->samNormChi2;
924     else if(variable == "samPT") value = object->samPT;
925     else if(variable == "samEta") value = object->samEta;
926     else if(variable == "samPhi") value = object->samPhi;
927     else if(variable == "samDZ") value = object->samDZ;
928     else if(variable == "samD0") value = object->samD0;
929     else if(variable == "samD0bs") value = object->samD0bs;
930     else if(variable == "samD0err") value = object->samD0err;
931     else if(variable == "comNormChi2") value = object->comNormChi2;
932     else if(variable == "comPT") value = object->comPT;
933     else if(variable == "comEta") value = object->comEta;
934     else if(variable == "comPhi") value = object->comPhi;
935     else if(variable == "comDZ") value = object->comDZ;
936     else if(variable == "comD0") value = object->comD0;
937     else if(variable == "comD0bs") value = object->comD0bs;
938     else if(variable == "comD0err") value = object->comD0err;
939     else if(variable == "isolationR03emVetoEt") value = object->isolationR03emVetoEt;
940     else if(variable == "isolationR03hadVetoEt") value = object->isolationR03hadVetoEt;
941     else if(variable == "normalizedChi2") value = object->normalizedChi2;
942     else if(variable == "dVzPVz") value = object->dVzPVz;
943     else if(variable == "dB") value = object->dB;
944     else if(variable == "ptErr") value = object->ptErr;
945     else if(variable == "innerTrackNormChi2") value = object->innerTrackNormChi2;
946     else if(variable == "correctedD0") value = object->correctedD0;
947     else if(variable == "correctedD0Vertex") value = object->correctedD0Vertex;
948     else if(variable == "correctedDZ") value = object->correctedDZ;
949     else if(variable == "particleIso") value = object->particleIso;
950     else if(variable == "chargedHadronIso") value = object->chargedHadronIso;
951     else if(variable == "neutralHadronIso") value = object->neutralHadronIso;
952     else if(variable == "photonIso") value = object->photonIso;
953     else if(variable == "puChargedHadronIso") value = object->puChargedHadronIso;
954     else if(variable == "chargedHadronIsoDR03") value = object->chargedHadronIsoDR03;
955     else if(variable == "neutralHadronIsoDR03") value = object->neutralHadronIsoDR03;
956     else if(variable == "photonIsoDR03") value = object->photonIsoDR03;
957     else if(variable == "puChargedHadronIsoDR03") value = object->puChargedHadronIsoDR03;
958     else if(variable == "chargedHadronIsoDR04") value = object->chargedHadronIsoDR04;
959     else if(variable == "neutralHadronIsoDR04") value = object->neutralHadronIsoDR04;
960     else if(variable == "photonIsoDR04") value = object->photonIsoDR04;
961     else if(variable == "puChargedHadronIsoDR04") value = object->puChargedHadronIsoDR04;
962     else if(variable == "rhoPrime") value = object->rhoPrime;
963     else if(variable == "AEffDr03") value = object->AEffDr03;
964     else if(variable == "AEffDr04") value = object->AEffDr04;
965     else if(variable == "pfIsoR03SumChargedHadronPt") value = object->pfIsoR03SumChargedHadronPt;
966     else if(variable == "pfIsoR03SumNeutralHadronEt") value = object->pfIsoR03SumNeutralHadronEt;
967     else if(variable == "pfIsoR03SumPhotonEt") value = object->pfIsoR03SumPhotonEt;
968     else if(variable == "pfIsoR03SumPUPt") value = object->pfIsoR03SumPUPt;
969     else if(variable == "pfIsoR04SumChargedHadronPt") value = object->pfIsoR04SumChargedHadronPt;
970     else if(variable == "pfIsoR04SumNeutralHadronEt") value = object->pfIsoR04SumNeutralHadronEt;
971     else if(variable == "pfIsoR04SumPhotonEt") value = object->pfIsoR04SumPhotonEt;
972     else if(variable == "pfIsoR04SumPUPt") value = object->pfIsoR04SumPUPt;
973     else if(variable == "IP") value = object->IP;
974     else if(variable == "IPError") value = object->IPError;
975     else if(variable == "timeAtIpInOut") value = object->timeAtIpInOut;
976     else if(variable == "timeAtIpInOutErr") value = object->timeAtIpInOutErr;
977     else if(variable == "timeAtIpOutIn") value = object->timeAtIpOutIn;
978     else if(variable == "timeAtIpOutInErr") value = object->timeAtIpOutInErr;
979     else if(variable == "ecal_time") value = object->ecal_time;
980     else if(variable == "hcal_time") value = object->hcal_time;
981     else if(variable == "ecal_timeError") value = object->ecal_timeError;
982     else if(variable == "hcal_timeError") value = object->hcal_timeError;
983     else if(variable == "energy_ecal") value = object->energy_ecal;
984     else if(variable == "energy_hcal") value = object->energy_hcal;
985     else if(variable == "e3x3_ecal") value = object->e3x3_ecal;
986     else if(variable == "e3x3_hcal") value = object->e3x3_hcal;
987     else if(variable == "energyMax_ecal") value = object->energyMax_ecal;
988     else if(variable == "energyMax_hcal") value = object->energyMax_hcal;
989     else if(variable == "charge") value = object->charge;
990     else if(variable == "IDGMPTight") value = object->IDGMPTight;
991     else if(variable == "tkNumValidHits") value = object->tkNumValidHits;
992     else if(variable == "tkCharge") value = object->tkCharge;
993     else if(variable == "samNumValidHits") value = object->samNumValidHits;
994     else if(variable == "samCharge") value = object->samCharge;
995     else if(variable == "comNumValidHits") value = object->comNumValidHits;
996     else if(variable == "comCharge") value = object->comCharge;
997     else if(variable == "genId") value = object->genId;
998     else if(variable == "genCharge") value = object->genCharge;
999     else if(variable == "genNumberOfMothers") value = object->genNumberOfMothers;
1000     else if(variable == "genMotherId") value = object->genMotherId;
1001     else if(variable == "genMotherCharge") value = object->genMotherCharge;
1002     else if(variable == "genMother0Id") value = object->genMother0Id;
1003     else if(variable == "genMother1Id") value = object->genMother1Id;
1004     else if(variable == "genGrandMother00Id") value = object->genGrandMother00Id;
1005     else if(variable == "genGrandMother01Id") value = object->genGrandMother01Id;
1006     else if(variable == "genGrandMother10Id") value = object->genGrandMother10Id;
1007     else if(variable == "genGrandMother11Id") value = object->genGrandMother11Id;
1008     else if(variable == "isPFMuon") value = object->isPFMuon;
1009     else if(variable == "isGoodMuon_1StationTight") value = object->isGoodMuon_1StationTight;
1010     else if(variable == "isGlobalMuon") value = object->isGlobalMuon;
1011     else if(variable == "isTrackerMuon") value = object->isTrackerMuon;
1012     else if(variable == "isStandAloneMuon") value = object->isStandAloneMuon;
1013     else if(variable == "isGlobalMuonPromptTight") value = object->isGlobalMuonPromptTight;
1014     else if(variable == "numberOfValidMuonHits") value = object->numberOfValidMuonHits;
1015     else if(variable == "numberOfValidTrackerHits") value = object->numberOfValidTrackerHits;
1016     else if(variable == "numberOfLayersWithMeasurement") value = object->numberOfLayersWithMeasurement;
1017     else if(variable == "pixelLayersWithMeasurement") value = object->pixelLayersWithMeasurement;
1018     else if(variable == "numberOfMatches") value = object->numberOfMatches;
1019     else if(variable == "numberOfValidTrackerHitsInnerTrack") value = object->numberOfValidTrackerHitsInnerTrack;
1020     else if(variable == "numberOfValidPixelHits") value = object->numberOfValidPixelHits;
1021     else if(variable == "numberOfMatchedStations") value = object->numberOfMatchedStations;
1022     else if(variable == "time_ndof") value = object->time_ndof;
1023    
1024 lantonel 1.9 //user-defined variables
1025 lantonel 1.22 else if(variable == "correctedD0VertexErr") value = hypot (object->tkD0err, hypot (chosenPrimaryVertex->xError, chosenPrimaryVertex->yError));
1026     else if(variable == "correctedD0VertexSig") value = object->correctedD0Vertex / hypot (object->tkD0err, hypot (chosenPrimaryVertex->xError, chosenPrimaryVertex->yError));
1027 lantonel 1.19 else if(variable == "detIso") value = (object->trackIsoDR03) / object->pt;
1028 lantonel 1.9 else if(variable == "relPFdBetaIso") value = (object->pfIsoR04SumChargedHadronPt + max(0.0, object->pfIsoR04SumNeutralHadronEt + object->pfIsoR04SumPhotonEt - 0.5*object->pfIsoR04SumPUPt)) / object->pt;
1029     else if(variable == "relPFrhoIso") value = ( object->chargedHadronIso + max(0.0, object->neutralHadronIso + object->photonIso - object->AEffDr03*object->rhoPrime) ) / object->pt;
1030 lantonel 1.10 else if(variable == "tightID") {
1031 lantonel 1.11 value = object->isGlobalMuon > 0 \
1032     && object->isPFMuon > 0 \
1033     && object->normalizedChi2 < 10 \
1034     && object->numberOfValidMuonHits > 0 \
1035     && object->numberOfMatchedStations > 1 \
1036     && fabs(object->correctedD0Vertex) < 0.2 \
1037     && fabs(object->correctedDZ) < 0.5 \
1038 lantonel 1.19 && object->numberOfValidPixelHits > 0 \
1039 lantonel 1.11 && object->numberOfLayersWithMeasurement > 5;
1040 lantonel 1.10 }
1041     else if(variable == "tightIDdisplaced"){
1042 lantonel 1.11 value = object->isGlobalMuon > 0 \
1043     && object->normalizedChi2 < 10 \
1044     && object->numberOfValidMuonHits > 0 \
1045     && object->numberOfMatchedStations > 1 \
1046     && object->numberOfValidPixelHits > 0 \
1047     && object->numberOfLayersWithMeasurement > 5;
1048 lantonel 1.10 }
1049 lantonel 1.9
1050 lantonel 1.22 else if(variable == "genMatchedId"){
1051     int index = getGenMatchedParticleIndex(object);
1052     if(index == -1) value = 0;
1053     else value = getPdgIdBinValue(mcparticles->at(index).id);
1054     }
1055     else if(variable == "genMatchedMotherId"){
1056     int index = getGenMatchedParticleIndex(object);
1057     if(index == -1) value = 0;
1058     else value = getPdgIdBinValue(mcparticles->at(index).motherId);
1059     }
1060     else if(variable == "genMatchedGrandmotherId"){
1061     int index = getGenMatchedParticleIndex(object);
1062     if(index == -1) value = 0;
1063     else if(fabs(mcparticles->at(index).motherId) == 15){
1064     int motherIndex = findTauMotherIndex(&mcparticles->at(index));
1065     if(motherIndex == -1) value = 0;
1066     else value = getPdgIdBinValue(mcparticles->at(motherIndex).motherId);
1067     }
1068     else value = getPdgIdBinValue(mcparticles->at(index).grandMotherId);
1069     }
1070 lantonel 1.19
1071    
1072    
1073 lantonel 1.1 else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
1074 ahart 1.8
1075 lantonel 1.6 value = applyFunction(function, value);
1076 lantonel 1.1
1077     return value;
1078     }
1079    
1080    
1081     double
1082 lantonel 1.3 OSUAnalysis::valueLookup (const BNelectron* object, string variable, string function){
1083 lantonel 1.1
1084     double value = 0.0;
1085     if(variable == "energy") value = object->energy;
1086     else if(variable == "et") value = object->et;
1087     else if(variable == "gsfEt") value = object->gsfEt;
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 == "pIn") value = object->pIn;
1096     else if(variable == "pOut") value = object->pOut;
1097     else if(variable == "EscOverPin") value = object->EscOverPin;
1098     else if(variable == "EseedOverPout") value = object->EseedOverPout;
1099     else if(variable == "hadOverEm") value = object->hadOverEm;
1100     else if(variable == "trackIso") value = object->trackIso;
1101     else if(variable == "ecalIso") value = object->ecalIso;
1102     else if(variable == "hcalIso") value = object->hcalIso;
1103     else if(variable == "caloIso") value = object->caloIso;
1104     else if(variable == "trackIsoDR03") value = object->trackIsoDR03;
1105     else if(variable == "ecalIsoDR03") value = object->ecalIsoDR03;
1106     else if(variable == "hcalIsoDR03") value = object->hcalIsoDR03;
1107     else if(variable == "hcalIsoDR03depth1") value = object->hcalIsoDR03depth1;
1108     else if(variable == "hcalIsoDR03depth2") value = object->hcalIsoDR03depth2;
1109     else if(variable == "caloIsoDR03") value = object->caloIsoDR03;
1110     else if(variable == "trackIsoDR04") value = object->trackIsoDR04;
1111     else if(variable == "ecalIsoDR04") value = object->ecalIsoDR04;
1112     else if(variable == "hcalIsoDR04") value = object->hcalIsoDR04;
1113     else if(variable == "hcalIsoDR04depth1") value = object->hcalIsoDR04depth1;
1114     else if(variable == "hcalIsoDR04depth2") value = object->hcalIsoDR04depth2;
1115     else if(variable == "caloIsoDR04") value = object->caloIsoDR04;
1116     else if(variable == "fbrem") value = object->fbrem;
1117     else if(variable == "absInvEMinusInvPin") value = object->absInvEMinusInvPin;
1118     else if(variable == "delPhiIn") value = object->delPhiIn;
1119     else if(variable == "delEtaIn") value = object->delEtaIn;
1120     else if(variable == "genET") value = object->genET;
1121     else if(variable == "genPT") value = object->genPT;
1122     else if(variable == "genPhi") value = object->genPhi;
1123     else if(variable == "genEta") value = object->genEta;
1124     else if(variable == "genMotherET") value = object->genMotherET;
1125     else if(variable == "genMotherPT") value = object->genMotherPT;
1126     else if(variable == "genMotherPhi") value = object->genMotherPhi;
1127     else if(variable == "genMotherEta") value = object->genMotherEta;
1128     else if(variable == "vx") value = object->vx;
1129     else if(variable == "vy") value = object->vy;
1130     else if(variable == "vz") value = object->vz;
1131     else if(variable == "scEnergy") value = object->scEnergy;
1132     else if(variable == "scRawEnergy") value = object->scRawEnergy;
1133     else if(variable == "scSigmaEtaEta") value = object->scSigmaEtaEta;
1134     else if(variable == "scSigmaIEtaIEta") value = object->scSigmaIEtaIEta;
1135     else if(variable == "scE1x5") value = object->scE1x5;
1136     else if(variable == "scE2x5Max") value = object->scE2x5Max;
1137     else if(variable == "scE5x5") value = object->scE5x5;
1138     else if(variable == "scEt") value = object->scEt;
1139     else if(variable == "scEta") value = object->scEta;
1140     else if(variable == "scPhi") value = object->scPhi;
1141     else if(variable == "scZ") value = object->scZ;
1142     else if(variable == "tkNormChi2") value = object->tkNormChi2;
1143     else if(variable == "tkPT") value = object->tkPT;
1144     else if(variable == "tkEta") value = object->tkEta;
1145     else if(variable == "tkPhi") value = object->tkPhi;
1146     else if(variable == "tkDZ") value = object->tkDZ;
1147     else if(variable == "tkD0") value = object->tkD0;
1148     else if(variable == "tkD0bs") value = object->tkD0bs;
1149     else if(variable == "tkD0err") value = object->tkD0err;
1150     else if(variable == "mva") value = object->mva;
1151     else if(variable == "mvaTrigV0") value = object->mvaTrigV0;
1152     else if(variable == "mvaNonTrigV0") value = object->mvaNonTrigV0;
1153     else if(variable == "dist") value = object->dist;
1154     else if(variable == "dcot") value = object->dcot;
1155     else if(variable == "convradius") value = object->convradius;
1156     else if(variable == "convPointX") value = object->convPointX;
1157     else if(variable == "convPointY") value = object->convPointY;
1158     else if(variable == "convPointZ") value = object->convPointZ;
1159     else if(variable == "eMax") value = object->eMax;
1160     else if(variable == "eLeft") value = object->eLeft;
1161     else if(variable == "eRight") value = object->eRight;
1162     else if(variable == "eTop") value = object->eTop;
1163     else if(variable == "eBottom") value = object->eBottom;
1164     else if(variable == "e3x3") value = object->e3x3;
1165     else if(variable == "swissCross") value = object->swissCross;
1166     else if(variable == "seedEnergy") value = object->seedEnergy;
1167     else if(variable == "seedTime") value = object->seedTime;
1168     else if(variable == "swissCrossNoI85") value = object->swissCrossNoI85;
1169     else if(variable == "swissCrossI85") value = object->swissCrossI85;
1170     else if(variable == "E2overE9NoI85") value = object->E2overE9NoI85;
1171     else if(variable == "E2overE9I85") value = object->E2overE9I85;
1172     else if(variable == "correctedD0") value = object->correctedD0;
1173     else if(variable == "correctedD0Vertex") value = object->correctedD0Vertex;
1174     else if(variable == "correctedDZ") value = object->correctedDZ;
1175     else if(variable == "particleIso") value = object->particleIso;
1176     else if(variable == "chargedHadronIso") value = object->chargedHadronIso;
1177     else if(variable == "neutralHadronIso") value = object->neutralHadronIso;
1178     else if(variable == "photonIso") value = object->photonIso;
1179     else if(variable == "puChargedHadronIso") value = object->puChargedHadronIso;
1180     else if(variable == "chargedHadronIsoDR03") value = object->chargedHadronIsoDR03;
1181     else if(variable == "neutralHadronIsoDR03") value = object->neutralHadronIsoDR03;
1182     else if(variable == "photonIsoDR03") value = object->photonIsoDR03;
1183     else if(variable == "puChargedHadronIsoDR03") value = object->puChargedHadronIsoDR03;
1184     else if(variable == "chargedHadronIsoDR04") value = object->chargedHadronIsoDR04;
1185     else if(variable == "neutralHadronIsoDR04") value = object->neutralHadronIsoDR04;
1186     else if(variable == "photonIsoDR04") value = object->photonIsoDR04;
1187     else if(variable == "puChargedHadronIsoDR04") value = object->puChargedHadronIsoDR04;
1188     else if(variable == "rhoPrime") value = object->rhoPrime;
1189     else if(variable == "AEffDr03") value = object->AEffDr03;
1190     else if(variable == "AEffDr04") value = object->AEffDr04;
1191     else if(variable == "IP") value = object->IP;
1192     else if(variable == "IPError") value = object->IPError;
1193     else if(variable == "charge") value = object->charge;
1194     else if(variable == "classification") value = object->classification;
1195     else if(variable == "genId") value = object->genId;
1196     else if(variable == "genCharge") value = object->genCharge;
1197     else if(variable == "genNumberOfMothers") value = object->genNumberOfMothers;
1198     else if(variable == "genMotherId") value = object->genMotherId;
1199     else if(variable == "genMotherCharge") value = object->genMotherCharge;
1200     else if(variable == "genMother0Id") value = object->genMother0Id;
1201     else if(variable == "genMother1Id") value = object->genMother1Id;
1202     else if(variable == "genGrandMother00Id") value = object->genGrandMother00Id;
1203     else if(variable == "genGrandMother01Id") value = object->genGrandMother01Id;
1204     else if(variable == "genGrandMother10Id") value = object->genGrandMother10Id;
1205     else if(variable == "genGrandMother11Id") value = object->genGrandMother11Id;
1206     else if(variable == "numClusters") value = object->numClusters;
1207     else if(variable == "tkNumValidHits") value = object->tkNumValidHits;
1208     else if(variable == "tkCharge") value = object->tkCharge;
1209     else if(variable == "gsfCharge") value = object->gsfCharge;
1210     else if(variable == "isEB") value = object->isEB;
1211     else if(variable == "isEE") value = object->isEE;
1212     else if(variable == "isGap") value = object->isGap;
1213     else if(variable == "isEBEEGap") value = object->isEBEEGap;
1214     else if(variable == "isEBGap") value = object->isEBGap;
1215     else if(variable == "isEEGap") value = object->isEEGap;
1216     else if(variable == "isEcalDriven") value = object->isEcalDriven;
1217     else if(variable == "isTrackerDriven") value = object->isTrackerDriven;
1218     else if(variable == "numberOfLostHits") value = object->numberOfLostHits;
1219     else if(variable == "numberOfExpectedInnerHits") value = object->numberOfExpectedInnerHits;
1220     else if(variable == "numberOfValidPixelHits") value = object->numberOfValidPixelHits;
1221     else if(variable == "numberOfValidPixelBarrelHits") value = object->numberOfValidPixelBarrelHits;
1222     else if(variable == "numberOfValidPixelEndcapHits") value = object->numberOfValidPixelEndcapHits;
1223     else if(variable == "isHEEP") value = object->isHEEP;
1224     else if(variable == "isHEEPnoEt") value = object->isHEEPnoEt;
1225     else if(variable == "seedRecoFlag") value = object->seedRecoFlag;
1226     else if(variable == "eidRobustHighEnergy") value = object->eidRobustHighEnergy;
1227     else if(variable == "eidRobustLoose") value = object->eidRobustLoose;
1228     else if(variable == "eidRobustTight") value = object->eidRobustTight;
1229     else if(variable == "eidLoose") value = object->eidLoose;
1230     else if(variable == "eidTight") value = object->eidTight;
1231     else if(variable == "eidVeryLooseMC") value = object->eidVeryLooseMC;
1232     else if(variable == "eidLooseMC") value = object->eidLooseMC;
1233     else if(variable == "eidMediumMC") value = object->eidMediumMC;
1234     else if(variable == "eidTightMC") value = object->eidTightMC;
1235     else if(variable == "eidSuperTightMC") value = object->eidSuperTightMC;
1236     else if(variable == "eidHyperTight1MC") value = object->eidHyperTight1MC;
1237     else if(variable == "eidHyperTight2MC") value = object->eidHyperTight2MC;
1238     else if(variable == "eidHyperTight3MC") value = object->eidHyperTight3MC;
1239     else if(variable == "eidHyperTight4MC") value = object->eidHyperTight4MC;
1240     else if(variable == "passConvVeto") value = object->passConvVeto;
1241    
1242 lantonel 1.9 //user-defined variables
1243 lantonel 1.22 else if(variable == "correctedD0VertexErr") value = hypot (object->tkD0err, hypot (chosenPrimaryVertex->xError, chosenPrimaryVertex->yError));
1244     else if(variable == "correctedD0VertexSig") value = object->correctedD0Vertex / hypot (object->tkD0err, hypot (chosenPrimaryVertex->xError, chosenPrimaryVertex->yError));
1245 lantonel 1.13 else if(variable == "detIso") value = (object->trackIso) / object->pt;
1246 lantonel 1.10 else if(variable == "relPFrhoIso") value = ( object->chargedHadronIsoDR03 + max(0.0, object->neutralHadronIsoDR03 + object->photonIsoDR03 - object->AEffDr03*object->rhoPrime) ) / object->pt;
1247 lantonel 1.19 else if(variable == "correctedD0VertexInEB"){
1248     if(fabs(object->eta) < 0.8) value = object->correctedD0Vertex;
1249     else value = -999;
1250     }
1251     else if(variable == "correctedD0VertexOutEB"){
1252     if(object->isEB && fabs(object->eta) > 0.8) value = object->correctedD0Vertex;
1253     else value = -999;
1254     }
1255     else if(variable == "correctedD0VertexEE"){
1256     if(object->isEE) value = object->correctedD0Vertex;
1257     else value = -999;
1258     }
1259    
1260     else if(variable == "correctedD0BeamspotInEB"){
1261     if(fabs(object->eta) < 0.8) value = object->correctedD0;
1262     else value = -999;
1263     }
1264     else if(variable == "correctedD0BeamspotOutEB"){
1265     if(object->isEB && fabs(object->eta) > 0.8) value = object->correctedD0;
1266     else value = -999;
1267     }
1268     else if(variable == "correctedD0BeamspotEE"){
1269     if(object->isEE) value = object->correctedD0;
1270     else value = -999;
1271     }
1272 lantonel 1.9
1273 lantonel 1.19 else if(variable == "correctedD0OriginInEB"){
1274     if(fabs(object->eta) < 0.8) value = object->tkD0;
1275     else value = -999;
1276     }
1277     else if(variable == "correctedD0OriginOutEB"){
1278     if(object->isEB && fabs(object->eta) > 0.8) value = object->tkD0;
1279     else value = -999;
1280     }
1281     else if(variable == "correctedD0OriginEE"){
1282     if(object->isEE) value = object->tkD0;
1283     else value = -999;
1284     }
1285    
1286     else if(variable == "tightIDdisplaced"){
1287     if (object->isEB)
1288     {
1289     value = fabs(object->delEtaIn) < 0.004 \
1290     && fabs (object->delPhiIn) < 0.03 \
1291     && object->scSigmaIEtaIEta < 0.01 \
1292     && object->hadOverEm < 0.12 \
1293     && object->absInvEMinusInvPin < 0.05;
1294     }
1295     else
1296     {
1297     value = fabs (object->delEtaIn) < 0.005 \
1298     && fabs (object->delPhiIn) < 0.02 \
1299     && object->scSigmaIEtaIEta < 0.03 \
1300     && object->hadOverEm < 0.10 \
1301     && object->absInvEMinusInvPin < 0.05;
1302     }
1303     }
1304 lantonel 1.1
1305 lantonel 1.22 else if(variable == "genMatchedId"){
1306     int index = getGenMatchedParticleIndex(object);
1307     if(index == -1) value = 0;
1308     else value = getPdgIdBinValue(mcparticles->at(index).id);
1309     }
1310     else if(variable == "genMatchedMotherId"){
1311     int index = getGenMatchedParticleIndex(object);
1312     if(index == -1) value = 0;
1313     else value = getPdgIdBinValue(mcparticles->at(index).motherId);
1314     }
1315     else if(variable == "genMatchedGrandmotherId"){
1316     int index = getGenMatchedParticleIndex(object);
1317     if(index == -1) value = 0;
1318     else if(fabs(mcparticles->at(index).motherId) == 15){
1319     int motherIndex = findTauMotherIndex(&mcparticles->at(index));
1320     if(motherIndex == -1) value = 0;
1321     else value = getPdgIdBinValue(mcparticles->at(motherIndex).motherId);
1322     }
1323     else value = getPdgIdBinValue(mcparticles->at(index).grandMotherId);
1324     }
1325    
1326    
1327    
1328 lantonel 1.1 else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
1329 ahart 1.8
1330 lantonel 1.6 value = applyFunction(function, value);
1331 lantonel 1.1
1332     return value;
1333     }
1334    
1335    
1336     double
1337 lantonel 1.3 OSUAnalysis::valueLookup (const BNevent* object, string variable, string function){
1338 lantonel 1.1
1339     double value = 0.0;
1340    
1341     if(variable == "weight") value = object->weight;
1342     else if(variable == "pthat") value = object->pthat;
1343     else if(variable == "qScale") value = object->qScale;
1344     else if(variable == "alphaQCD") value = object->alphaQCD;
1345     else if(variable == "alphaQED") value = object->alphaQED;
1346     else if(variable == "scalePDF") value = object->scalePDF;
1347     else if(variable == "x1") value = object->x1;
1348     else if(variable == "x2") value = object->x2;
1349     else if(variable == "xPDF1") value = object->xPDF1;
1350     else if(variable == "xPDF2") value = object->xPDF2;
1351     else if(variable == "BSx") value = object->BSx;
1352     else if(variable == "BSy") value = object->BSy;
1353     else if(variable == "BSz") value = object->BSz;
1354     else if(variable == "PVx") value = object->PVx;
1355     else if(variable == "PVy") value = object->PVy;
1356     else if(variable == "PVz") value = object->PVz;
1357     else if(variable == "bField") value = object->bField;
1358     else if(variable == "instLumi") value = object->instLumi;
1359     else if(variable == "bxLumi") value = object->bxLumi;
1360     else if(variable == "FilterOutScrapingFraction") value = object->FilterOutScrapingFraction;
1361     else if(variable == "sumNVtx") value = object->sumNVtx;
1362     else if(variable == "sumTrueNVtx") value = object->sumTrueNVtx;
1363     else if(variable == "nm1_true") value = object->nm1_true;
1364     else if(variable == "n0_true") value = object->n0_true;
1365     else if(variable == "np1_true") value = object->np1_true;
1366     else if(variable == "numTruePV") value = object->numTruePV;
1367     else if(variable == "Q2ScaleUpWgt") value = object->Q2ScaleUpWgt;
1368     else if(variable == "Q2ScaleDownWgt") value = object->Q2ScaleDownWgt;
1369     else if(variable == "rho_kt6PFJets") value = object->rho_kt6PFJets;
1370     else if(variable == "rho_kt6PFJetsCentralChargedPileUp") value = object->rho_kt6PFJetsCentralChargedPileUp;
1371     else if(variable == "rho_kt6PFJetsCentralNeutral") value = object->rho_kt6PFJetsCentralNeutral;
1372     else if(variable == "rho_kt6PFJetsCentralNeutralTight") value = object->rho_kt6PFJetsCentralNeutralTight;
1373     else if(variable == "run") value = object->run;
1374     else if(variable == "lumi") value = object->lumi;
1375     else if(variable == "sample") value = object->sample;
1376     else if(variable == "numPV") value = object->numPV;
1377     else if(variable == "W0decay") value = object->W0decay;
1378     else if(variable == "W1decay") value = object->W1decay;
1379     else if(variable == "Z0decay") value = object->Z0decay;
1380     else if(variable == "Z1decay") value = object->Z1decay;
1381     else if(variable == "H0decay") value = object->H0decay;
1382     else if(variable == "H1decay") value = object->H1decay;
1383     else if(variable == "hcalnoiseLoose") value = object->hcalnoiseLoose;
1384     else if(variable == "hcalnoiseTight") value = object->hcalnoiseTight;
1385     else if(variable == "GoodVertex") value = object->GoodVertex;
1386     else if(variable == "FilterOutScraping") value = object->FilterOutScraping;
1387     else if(variable == "HBHENoiseFilter") value = object->HBHENoiseFilter;
1388     else if(variable == "CSCLooseHaloId") value = object->CSCLooseHaloId;
1389     else if(variable == "CSCTightHaloId") value = object->CSCTightHaloId;
1390     else if(variable == "EcalLooseHaloId") value = object->EcalLooseHaloId;
1391     else if(variable == "EcalTightHaloId") value = object->EcalTightHaloId;
1392     else if(variable == "HcalLooseHaloId") value = object->HcalLooseHaloId;
1393     else if(variable == "HcalTightHaloId") value = object->HcalTightHaloId;
1394     else if(variable == "GlobalLooseHaloId") value = object->GlobalLooseHaloId;
1395     else if(variable == "GlobalTightHaloId") value = object->GlobalTightHaloId;
1396     else if(variable == "LooseId") value = object->LooseId;
1397     else if(variable == "TightId") value = object->TightId;
1398     else if(variable == "numGenPV") value = object->numGenPV;
1399     else if(variable == "nm1") value = object->nm1;
1400     else if(variable == "n0") value = object->n0;
1401     else if(variable == "np1") value = object->np1;
1402     else if(variable == "id1") value = object->id1;
1403     else if(variable == "id2") value = object->id2;
1404     else if(variable == "evt") value = object->evt;
1405    
1406     else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
1407 ahart 1.8
1408 lantonel 1.6 value = applyFunction(function, value);
1409 lantonel 1.1
1410     return value;
1411     }
1412    
1413     double
1414 lantonel 1.3 OSUAnalysis::valueLookup (const BNtau* object, string variable, string function){
1415 lantonel 1.1
1416     double value = 0.0;
1417    
1418     if(variable == "px") value = object->px;
1419     else if(variable == "py") value = object->py;
1420     else if(variable == "pz") value = object->pz;
1421     else if(variable == "energy") value = object->energy;
1422     else if(variable == "et") value = object->et;
1423     else if(variable == "pt") value = object->pt;
1424     else if(variable == "eta") value = object->eta;
1425     else if(variable == "phi") value = object->phi;
1426     else if(variable == "emFraction") value = object->emFraction;
1427     else if(variable == "leadingTrackPt") value = object->leadingTrackPt;
1428     else if(variable == "leadingTrackIpVtdxy") value = object->leadingTrackIpVtdxy;
1429     else if(variable == "leadingTrackIpVtdz") value = object->leadingTrackIpVtdz;
1430     else if(variable == "leadingTrackIpVtdxyError") value = object->leadingTrackIpVtdxyError;
1431     else if(variable == "leadingTrackIpVtdzError") value = object->leadingTrackIpVtdzError;
1432     else if(variable == "leadingTrackVx") value = object->leadingTrackVx;
1433     else if(variable == "leadingTrackVy") value = object->leadingTrackVy;
1434     else if(variable == "leadingTrackVz") value = object->leadingTrackVz;
1435     else if(variable == "leadingTrackValidHits") value = object->leadingTrackValidHits;
1436     else if(variable == "leadingTrackNormChiSqrd") value = object->leadingTrackNormChiSqrd;
1437     else if(variable == "numProngs") value = object->numProngs;
1438     else if(variable == "numSignalGammas") value = object->numSignalGammas;
1439     else if(variable == "numSignalNeutrals") value = object->numSignalNeutrals;
1440     else if(variable == "numSignalPiZeros") value = object->numSignalPiZeros;
1441     else if(variable == "decayMode") value = object->decayMode;
1442     else if(variable == "charge") value = object->charge;
1443     else if(variable == "inTheCracks") value = object->inTheCracks;
1444     else if(variable == "HPSagainstElectronLoose") value = object->HPSagainstElectronLoose;
1445     else if(variable == "HPSagainstElectronMVA") value = object->HPSagainstElectronMVA;
1446     else if(variable == "HPSagainstElectronMedium") value = object->HPSagainstElectronMedium;
1447     else if(variable == "HPSagainstElectronTight") value = object->HPSagainstElectronTight;
1448     else if(variable == "HPSagainstMuonLoose") value = object->HPSagainstMuonLoose;
1449     else if(variable == "HPSagainstMuonMedium") value = object->HPSagainstMuonMedium;
1450     else if(variable == "HPSagainstMuonTight") value = object->HPSagainstMuonTight;
1451     else if(variable == "HPSbyLooseCombinedIsolationDeltaBetaCorr") value = object->HPSbyLooseCombinedIsolationDeltaBetaCorr;
1452     else if(variable == "HPSbyMediumCombinedIsolationDeltaBetaCorr") value = object->HPSbyMediumCombinedIsolationDeltaBetaCorr;
1453     else if(variable == "HPSbyTightCombinedIsolationDeltaBetaCorr") value = object->HPSbyTightCombinedIsolationDeltaBetaCorr;
1454     else if(variable == "HPSbyVLooseCombinedIsolationDeltaBetaCorr") value = object->HPSbyVLooseCombinedIsolationDeltaBetaCorr;
1455     else if(variable == "HPSdecayModeFinding") value = object->HPSdecayModeFinding;
1456     else if(variable == "leadingTrackValid") value = object->leadingTrackValid;
1457    
1458    
1459 lantonel 1.22 else if(variable == "genMatchedId"){
1460     int index = getGenMatchedParticleIndex(object);
1461     if(index == -1) value = 0;
1462     else value = getPdgIdBinValue(mcparticles->at(index).id);
1463     }
1464     else if(variable == "genMatchedMotherId"){
1465     int index = getGenMatchedParticleIndex(object);
1466     if(index == -1) value = 0;
1467     else value = getPdgIdBinValue(mcparticles->at(index).motherId);
1468     }
1469     else if(variable == "genMatchedGrandmotherId"){
1470     int index = getGenMatchedParticleIndex(object);
1471     if(index == -1) value = 0;
1472     else if(fabs(mcparticles->at(index).motherId) == 15){
1473     int motherIndex = findTauMotherIndex(&mcparticles->at(index));
1474     if(motherIndex == -1) value = 0;
1475     else value = getPdgIdBinValue(mcparticles->at(motherIndex).motherId);
1476     }
1477     else value = getPdgIdBinValue(mcparticles->at(index).grandMotherId);
1478     }
1479    
1480    
1481 lantonel 1.1 else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
1482 ahart 1.8
1483 lantonel 1.6 value = applyFunction(function, value);
1484 lantonel 1.1
1485     return value;
1486     }
1487    
1488     double
1489 lantonel 1.3 OSUAnalysis::valueLookup (const BNmet* object, string variable, string function){
1490 lantonel 1.1
1491     double value = 0.0;
1492    
1493     if(variable == "et") value = object->et;
1494     else if(variable == "pt") value = object->pt;
1495     else if(variable == "px") value = object->px;
1496     else if(variable == "py") value = object->py;
1497     else if(variable == "phi") value = object->phi;
1498     else if(variable == "Upt") value = object->Upt;
1499     else if(variable == "Uphi") value = object->Uphi;
1500     else if(variable == "NeutralEMFraction") value = object->NeutralEMFraction;
1501     else if(variable == "NeutralHadEtFraction") value = object->NeutralHadEtFraction;
1502     else if(variable == "ChargedEMEtFraction") value = object->ChargedEMEtFraction;
1503     else if(variable == "ChargedHadEtFraction") value = object->ChargedHadEtFraction;
1504     else if(variable == "MuonEtFraction") value = object->MuonEtFraction;
1505     else if(variable == "Type6EtFraction") value = object->Type6EtFraction;
1506     else if(variable == "Type7EtFraction") value = object->Type7EtFraction;
1507     else if(variable == "genPT") value = object->genPT;
1508     else if(variable == "genPhi") value = object->genPhi;
1509     else if(variable == "muonCorEx") value = object->muonCorEx;
1510     else if(variable == "muonCorEy") value = object->muonCorEy;
1511     else if(variable == "jet20CorEx") value = object->jet20CorEx;
1512     else if(variable == "jet20CorEy") value = object->jet20CorEy;
1513     else if(variable == "jet1CorEx") value = object->jet1CorEx;
1514     else if(variable == "jet1CorEy") value = object->jet1CorEy;
1515     else if(variable == "sumET") value = object->sumET;
1516     else if(variable == "corSumET") value = object->corSumET;
1517     else if(variable == "mEtSig") value = object->mEtSig;
1518     else if(variable == "metSignificance") value = object->metSignificance;
1519     else if(variable == "significance") value = object->significance;
1520     else if(variable == "sigmaX2") value = object->sigmaX2;
1521     else if(variable == "sigmaY2") value = object->sigmaY2;
1522     else if(variable == "sigmaXY") value = object->sigmaXY;
1523     else if(variable == "sigmaYX") value = object->sigmaYX;
1524     else if(variable == "maxEtInEmTowers") value = object->maxEtInEmTowers;
1525     else if(variable == "emEtFraction") value = object->emEtFraction;
1526     else if(variable == "emEtInEB") value = object->emEtInEB;
1527     else if(variable == "emEtInEE") value = object->emEtInEE;
1528     else if(variable == "emEtInHF") value = object->emEtInHF;
1529     else if(variable == "maxEtInHadTowers") value = object->maxEtInHadTowers;
1530     else if(variable == "hadEtFraction") value = object->hadEtFraction;
1531     else if(variable == "hadEtInHB") value = object->hadEtInHB;
1532     else if(variable == "hadEtInHE") value = object->hadEtInHE;
1533     else if(variable == "hadEtInHF") value = object->hadEtInHF;
1534     else if(variable == "hadEtInHO") value = object->hadEtInHO;
1535     else if(variable == "UDeltaPx") value = object->UDeltaPx;
1536     else if(variable == "UDeltaPy") value = object->UDeltaPy;
1537     else if(variable == "UDeltaP") value = object->UDeltaP;
1538     else if(variable == "Uscale") value = object->Uscale;
1539     else if(variable == "type2corPx") value = object->type2corPx;
1540     else if(variable == "type2corPy") value = object->type2corPy;
1541     else if(variable == "T2pt") value = object->T2pt;
1542     else if(variable == "T2px") value = object->T2px;
1543     else if(variable == "T2py") value = object->T2py;
1544     else if(variable == "T2phi") value = object->T2phi;
1545     else if(variable == "T2sumET") value = object->T2sumET;
1546     else if(variable == "pfT1jet1pt") value = object->pfT1jet1pt;
1547     else if(variable == "pfT1jet1phi") value = object->pfT1jet1phi;
1548     else if(variable == "pfT1jet6pt") value = object->pfT1jet6pt;
1549     else if(variable == "pfT1jet6phi") value = object->pfT1jet6phi;
1550     else if(variable == "pfT1jet10pt") value = object->pfT1jet10pt;
1551     else if(variable == "pfT1jet10phi") value = object->pfT1jet10phi;
1552    
1553     else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
1554 ahart 1.8
1555 lantonel 1.6 value = applyFunction(function, value);
1556 lantonel 1.1
1557     return value;
1558     }
1559    
1560     double
1561 lantonel 1.3 OSUAnalysis::valueLookup (const BNtrack* object, string variable, string function){
1562 lantonel 1.1
1563     double value = 0.0;
1564    
1565     if(variable == "pt") value = object->pt;
1566     else if(variable == "px") value = object->px;
1567     else if(variable == "py") value = object->py;
1568     else if(variable == "pz") value = object->pz;
1569     else if(variable == "phi") value = object->phi;
1570     else if(variable == "eta") value = object->eta;
1571     else if(variable == "theta") value = object->theta;
1572     else if(variable == "normChi2") value = object->normChi2;
1573     else if(variable == "dZ") value = object->dZ;
1574     else if(variable == "d0") value = object->d0;
1575     else if(variable == "d0err") value = object->d0err;
1576     else if(variable == "vx") value = object->vx;
1577     else if(variable == "vy") value = object->vy;
1578     else if(variable == "vz") value = object->vz;
1579     else if(variable == "charge") value = object->charge;
1580     else if(variable == "numValidHits") value = object->numValidHits;
1581     else if(variable == "isHighPurity") value = object->isHighPurity;
1582    
1583    
1584 lantonel 1.22 else if(variable == "genMatchedId"){
1585     int index = getGenMatchedParticleIndex(object);
1586     if(index == -1) value = 0;
1587     else value = getPdgIdBinValue(mcparticles->at(index).id);
1588     }
1589     else if(variable == "genMatchedMotherId"){
1590     int index = getGenMatchedParticleIndex(object);
1591     if(index == -1) value = 0;
1592     else value = getPdgIdBinValue(mcparticles->at(index).motherId);
1593     }
1594     else if(variable == "genMatchedGrandmotherId"){
1595     int index = getGenMatchedParticleIndex(object);
1596     if(index == -1) value = 0;
1597     else if(fabs(mcparticles->at(index).motherId) == 15){
1598     int motherIndex = findTauMotherIndex(&mcparticles->at(index));
1599     if(motherIndex == -1) value = 0;
1600     else value = getPdgIdBinValue(mcparticles->at(motherIndex).motherId);
1601     }
1602     else value = getPdgIdBinValue(mcparticles->at(index).grandMotherId);
1603     }
1604    
1605    
1606    
1607 lantonel 1.1 else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
1608 ahart 1.8
1609 lantonel 1.6 value = applyFunction(function, value);
1610 lantonel 1.1
1611     return value;
1612     }
1613    
1614     double
1615 lantonel 1.3 OSUAnalysis::valueLookup (const BNgenjet* object, string variable, string function){
1616 lantonel 1.1
1617     double value = 0.0;
1618    
1619     if(variable == "pt") value = object->pt;
1620     else if(variable == "eta") value = object->eta;
1621     else if(variable == "phi") value = object->phi;
1622     else if(variable == "px") value = object->px;
1623     else if(variable == "py") value = object->py;
1624     else if(variable == "pz") value = object->pz;
1625     else if(variable == "et") value = object->et;
1626     else if(variable == "energy") value = object->energy;
1627     else if(variable == "mass") value = object->mass;
1628     else if(variable == "emEnergy") value = object->emEnergy;
1629     else if(variable == "hadEnergy") value = object->hadEnergy;
1630     else if(variable == "invisibleEnergy") value = object->invisibleEnergy;
1631     else if(variable == "auxiliaryEnergy") value = object->auxiliaryEnergy;
1632     else if(variable == "charge") value = object->charge;
1633    
1634    
1635     else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
1636 ahart 1.8
1637 lantonel 1.6 value = applyFunction(function, value);
1638 lantonel 1.1
1639     return value;
1640     }
1641    
1642     double
1643 lantonel 1.3 OSUAnalysis::valueLookup (const BNmcparticle* object, string variable, string function){
1644 lantonel 1.1
1645     double value = 0.0;
1646    
1647     if(variable == "energy") value = object->energy;
1648     else if(variable == "et") value = object->et;
1649     else if(variable == "pt") value = object->pt;
1650     else if(variable == "px") value = object->px;
1651     else if(variable == "py") value = object->py;
1652     else if(variable == "pz") value = object->pz;
1653     else if(variable == "phi") value = object->phi;
1654     else if(variable == "eta") value = object->eta;
1655     else if(variable == "theta") value = object->theta;
1656     else if(variable == "mass") value = object->mass;
1657     else if(variable == "vx") value = object->vx;
1658     else if(variable == "vy") value = object->vy;
1659     else if(variable == "vz") value = object->vz;
1660     else if(variable == "motherET") value = object->motherET;
1661     else if(variable == "motherPT") value = object->motherPT;
1662     else if(variable == "motherPhi") value = object->motherPhi;
1663     else if(variable == "motherEta") value = object->motherEta;
1664     else if(variable == "mother0ET") value = object->mother0ET;
1665     else if(variable == "mother0PT") value = object->mother0PT;
1666     else if(variable == "mother0Phi") value = object->mother0Phi;
1667     else if(variable == "mother0Eta") value = object->mother0Eta;
1668     else if(variable == "mother1ET") value = object->mother1ET;
1669     else if(variable == "mother1PT") value = object->mother1PT;
1670     else if(variable == "mother1Phi") value = object->mother1Phi;
1671     else if(variable == "mother1Eta") value = object->mother1Eta;
1672     else if(variable == "daughter0ET") value = object->daughter0ET;
1673     else if(variable == "daughter0PT") value = object->daughter0PT;
1674     else if(variable == "daughter0Phi") value = object->daughter0Phi;
1675     else if(variable == "daughter0Eta") value = object->daughter0Eta;
1676     else if(variable == "daughter1ET") value = object->daughter1ET;
1677     else if(variable == "daughter1PT") value = object->daughter1PT;
1678     else if(variable == "daughter1Phi") value = object->daughter1Phi;
1679     else if(variable == "daughter1Eta") value = object->daughter1Eta;
1680     else if(variable == "grandMotherET") value = object->grandMotherET;
1681     else if(variable == "grandMotherPT") value = object->grandMotherPT;
1682     else if(variable == "grandMotherPhi") value = object->grandMotherPhi;
1683     else if(variable == "grandMotherEta") value = object->grandMotherEta;
1684     else if(variable == "grandMother00ET") value = object->grandMother00ET;
1685     else if(variable == "grandMother00PT") value = object->grandMother00PT;
1686     else if(variable == "grandMother00Phi") value = object->grandMother00Phi;
1687     else if(variable == "grandMother00Eta") value = object->grandMother00Eta;
1688     else if(variable == "grandMother01ET") value = object->grandMother01ET;
1689     else if(variable == "grandMother01PT") value = object->grandMother01PT;
1690     else if(variable == "grandMother01Phi") value = object->grandMother01Phi;
1691     else if(variable == "grandMother01Eta") value = object->grandMother01Eta;
1692     else if(variable == "grandMother10ET") value = object->grandMother10ET;
1693     else if(variable == "grandMother10PT") value = object->grandMother10PT;
1694     else if(variable == "grandMother10Phi") value = object->grandMother10Phi;
1695     else if(variable == "grandMother10Eta") value = object->grandMother10Eta;
1696     else if(variable == "grandMother11ET") value = object->grandMother11ET;
1697     else if(variable == "grandMother11PT") value = object->grandMother11PT;
1698     else if(variable == "grandMother11Phi") value = object->grandMother11Phi;
1699     else if(variable == "grandMother11Eta") value = object->grandMother11Eta;
1700     else if(variable == "charge") value = object->charge;
1701     else if(variable == "id") value = object->id;
1702     else if(variable == "status") value = object->status;
1703     else if(variable == "motherId") value = object->motherId;
1704     else if(variable == "motherCharge") value = object->motherCharge;
1705     else if(variable == "mother0Id") value = object->mother0Id;
1706     else if(variable == "mother0Status") value = object->mother0Status;
1707     else if(variable == "mother0Charge") value = object->mother0Charge;
1708     else if(variable == "mother1Id") value = object->mother1Id;
1709     else if(variable == "mother1Status") value = object->mother1Status;
1710     else if(variable == "mother1Charge") value = object->mother1Charge;
1711     else if(variable == "daughter0Id") value = object->daughter0Id;
1712     else if(variable == "daughter0Status") value = object->daughter0Status;
1713     else if(variable == "daughter0Charge") value = object->daughter0Charge;
1714     else if(variable == "daughter1Id") value = object->daughter1Id;
1715     else if(variable == "daughter1Status") value = object->daughter1Status;
1716     else if(variable == "daughter1Charge") value = object->daughter1Charge;
1717     else if(variable == "grandMotherId") value = object->grandMotherId;
1718     else if(variable == "grandMotherCharge") value = object->grandMotherCharge;
1719     else if(variable == "grandMother00Id") value = object->grandMother00Id;
1720     else if(variable == "grandMother00Status") value = object->grandMother00Status;
1721     else if(variable == "grandMother00Charge") value = object->grandMother00Charge;
1722     else if(variable == "grandMother01Id") value = object->grandMother01Id;
1723     else if(variable == "grandMother01Status") value = object->grandMother01Status;
1724     else if(variable == "grandMother01Charge") value = object->grandMother01Charge;
1725     else if(variable == "grandMother10Id") value = object->grandMother10Id;
1726     else if(variable == "grandMother10Status") value = object->grandMother10Status;
1727     else if(variable == "grandMother10Charge") value = object->grandMother10Charge;
1728     else if(variable == "grandMother11Id") value = object->grandMother11Id;
1729     else if(variable == "grandMother11Status") value = object->grandMother11Status;
1730     else if(variable == "grandMother11Charge") value = object->grandMother11Charge;
1731    
1732 lantonel 1.9 //user-defined variables
1733     else if (variable == "d0"){
1734 lantonel 1.22 double vx = object->vx - chosenPrimaryVertex->x,
1735     vy = object->vy - chosenPrimaryVertex->y,
1736 lantonel 1.9 px = object->px,
1737     py = object->py,
1738     pt = object->pt;
1739     value = (-vx * py + vy * px) / pt;
1740     }
1741     else if (variable == "dz"){
1742 lantonel 1.22 double vx = object->vx - chosenPrimaryVertex->x,
1743     vy = object->vy - chosenPrimaryVertex->y,
1744     vz = object->vz - chosenPrimaryVertex->z,
1745 lantonel 1.9 px = object->px,
1746     py = object->py,
1747     pz = object->pz,
1748     pt = object->pt;
1749     value = vz - (vx * px + vy * py)/pt * (pz/pt);
1750     }
1751 lantonel 1.19 else if(variable == "v0"){
1752     value = sqrt(object->vx*object->vx + object->vy*object->vy);
1753     }
1754     else if(variable == "deltaV0"){
1755 lantonel 1.22 value = sqrt((object->vx-chosenPrimaryVertex->x)*(object->vx-chosenPrimaryVertex->x) + (object->vy-chosenPrimaryVertex->y)*(object->vy-chosenPrimaryVertex->y));
1756 lantonel 1.19 }
1757     else if (variable == "deltaVx"){
1758 lantonel 1.22 value = object->vx - chosenPrimaryVertex->x;
1759 lantonel 1.19 }
1760     else if (variable == "deltaVy"){
1761 lantonel 1.22 value = object->vy - chosenPrimaryVertex->y;
1762 lantonel 1.19 }
1763     else if (variable == "deltaVz"){
1764 lantonel 1.22 value = object->vz - chosenPrimaryVertex->z;
1765 lantonel 1.19 }
1766 lantonel 1.9
1767    
1768 lantonel 1.1 else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
1769 ahart 1.8
1770 lantonel 1.6 value = applyFunction(function, value);
1771 lantonel 1.1
1772     return value;
1773     }
1774    
1775     double
1776 lantonel 1.3 OSUAnalysis::valueLookup (const BNprimaryvertex* object, string variable, string function){
1777 lantonel 1.1
1778     double value = 0.0;
1779    
1780     if(variable == "x") value = object->x;
1781     else if(variable == "xError") value = object->xError;
1782     else if(variable == "y") value = object->y;
1783     else if(variable == "yError") value = object->yError;
1784     else if(variable == "z") value = object->z;
1785     else if(variable == "zError") value = object->zError;
1786     else if(variable == "rho") value = object->rho;
1787     else if(variable == "normalizedChi2") value = object->normalizedChi2;
1788     else if(variable == "ndof") value = object->ndof;
1789     else if(variable == "isFake") value = object->isFake;
1790     else if(variable == "isValid") value = object->isValid;
1791     else if(variable == "tracksSize") value = object->tracksSize;
1792     else if(variable == "isGood") value = object->isGood;
1793    
1794    
1795     else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
1796 ahart 1.8
1797 lantonel 1.6 value = applyFunction(function, value);
1798 lantonel 1.1
1799     return value;
1800     }
1801    
1802     double
1803 lantonel 1.3 OSUAnalysis::valueLookup (const BNbxlumi* object, string variable, string function){
1804 lantonel 1.1
1805     double value = 0.0;
1806    
1807     if(variable == "bx_B1_now") value = object->bx_B1_now;
1808     else if(variable == "bx_B2_now") value = object->bx_B2_now;
1809     else if(variable == "bx_LUMI_now") value = object->bx_LUMI_now;
1810    
1811    
1812     else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
1813 ahart 1.8
1814 lantonel 1.6 value = applyFunction(function, value);
1815 lantonel 1.1
1816     return value;
1817     }
1818    
1819     double
1820 lantonel 1.3 OSUAnalysis::valueLookup (const BNphoton* object, string variable, string function){
1821 lantonel 1.1
1822     double value = 0.0;
1823    
1824     if(variable == "energy") value = object->energy;
1825     else if(variable == "et") value = object->et;
1826     else if(variable == "pt") value = object->pt;
1827     else if(variable == "px") value = object->px;
1828     else if(variable == "py") value = object->py;
1829     else if(variable == "pz") value = object->pz;
1830     else if(variable == "phi") value = object->phi;
1831     else if(variable == "eta") value = object->eta;
1832     else if(variable == "theta") value = object->theta;
1833     else if(variable == "trackIso") value = object->trackIso;
1834     else if(variable == "ecalIso") value = object->ecalIso;
1835     else if(variable == "hcalIso") value = object->hcalIso;
1836     else if(variable == "caloIso") value = object->caloIso;
1837     else if(variable == "trackIsoHollowConeDR03") value = object->trackIsoHollowConeDR03;
1838     else if(variable == "trackIsoSolidConeDR03") value = object->trackIsoSolidConeDR03;
1839     else if(variable == "ecalIsoDR03") value = object->ecalIsoDR03;
1840     else if(variable == "hcalIsoDR03") value = object->hcalIsoDR03;
1841     else if(variable == "caloIsoDR03") value = object->caloIsoDR03;
1842     else if(variable == "trackIsoHollowConeDR04") value = object->trackIsoHollowConeDR04;
1843     else if(variable == "trackIsoSolidConeDR04") value = object->trackIsoSolidConeDR04;
1844     else if(variable == "ecalIsoDR04") value = object->ecalIsoDR04;
1845     else if(variable == "hcalIsoDR04") value = object->hcalIsoDR04;
1846     else if(variable == "caloIsoDR04") value = object->caloIsoDR04;
1847     else if(variable == "hadOverEm") value = object->hadOverEm;
1848     else if(variable == "sigmaEtaEta") value = object->sigmaEtaEta;
1849     else if(variable == "sigmaIetaIeta") value = object->sigmaIetaIeta;
1850     else if(variable == "r9") value = object->r9;
1851     else if(variable == "scEnergy") value = object->scEnergy;
1852     else if(variable == "scRawEnergy") value = object->scRawEnergy;
1853     else if(variable == "scSeedEnergy") value = object->scSeedEnergy;
1854     else if(variable == "scEta") value = object->scEta;
1855     else if(variable == "scPhi") value = object->scPhi;
1856     else if(variable == "scZ") value = object->scZ;
1857     else if(variable == "genET") value = object->genET;
1858     else if(variable == "genPT") value = object->genPT;
1859     else if(variable == "genPhi") value = object->genPhi;
1860     else if(variable == "genEta") value = object->genEta;
1861     else if(variable == "genMotherET") value = object->genMotherET;
1862     else if(variable == "genMotherPT") value = object->genMotherPT;
1863     else if(variable == "genMotherPhi") value = object->genMotherPhi;
1864     else if(variable == "genMotherEta") value = object->genMotherEta;
1865     else if(variable == "eMax") value = object->eMax;
1866     else if(variable == "eLeft") value = object->eLeft;
1867     else if(variable == "eRight") value = object->eRight;
1868     else if(variable == "eTop") value = object->eTop;
1869     else if(variable == "eBottom") value = object->eBottom;
1870     else if(variable == "e3x3") value = object->e3x3;
1871     else if(variable == "swissCross") value = object->swissCross;
1872     else if(variable == "seedEnergy") value = object->seedEnergy;
1873     else if(variable == "seedTime") value = object->seedTime;
1874     else if(variable == "swissCrossNoI85") value = object->swissCrossNoI85;
1875     else if(variable == "swissCrossI85") value = object->swissCrossI85;
1876     else if(variable == "E2overE9NoI85") value = object->E2overE9NoI85;
1877     else if(variable == "E2overE9I85") value = object->E2overE9I85;
1878     else if(variable == "IDTight") value = object->IDTight;
1879     else if(variable == "IDLoose") value = object->IDLoose;
1880     else if(variable == "IDLooseEM") value = object->IDLooseEM;
1881     else if(variable == "genId") value = object->genId;
1882     else if(variable == "genCharge") value = object->genCharge;
1883     else if(variable == "genMotherId") value = object->genMotherId;
1884     else if(variable == "genMotherCharge") value = object->genMotherCharge;
1885     else if(variable == "isEB") value = object->isEB;
1886     else if(variable == "isEE") value = object->isEE;
1887     else if(variable == "isGap") value = object->isGap;
1888     else if(variable == "isEBEEGap") value = object->isEBEEGap;
1889     else if(variable == "isEBGap") value = object->isEBGap;
1890     else if(variable == "isEEGap") value = object->isEEGap;
1891     else if(variable == "hasPixelSeed") value = object->hasPixelSeed;
1892     else if(variable == "seedRecoFlag") value = object->seedRecoFlag;
1893    
1894    
1895 lantonel 1.22 else if(variable == "genMatchedId"){
1896     int index = getGenMatchedParticleIndex(object);
1897     if(index == -1) value = 0;
1898     else value = getPdgIdBinValue(mcparticles->at(index).id);
1899     }
1900     else if(variable == "genMatchedMotherId"){
1901     int index = getGenMatchedParticleIndex(object);
1902     if(index == -1) value = 0;
1903     else value = getPdgIdBinValue(mcparticles->at(index).motherId);
1904     }
1905     else if(variable == "genMatchedGrandmotherId"){
1906     int index = getGenMatchedParticleIndex(object);
1907     if(index == -1) value = 0;
1908     else if(fabs(mcparticles->at(index).motherId) == 15){
1909     int motherIndex = findTauMotherIndex(&mcparticles->at(index));
1910     if(motherIndex == -1) value = 0;
1911     else value = getPdgIdBinValue(mcparticles->at(motherIndex).motherId);
1912     }
1913     else value = getPdgIdBinValue(mcparticles->at(index).grandMotherId);
1914     }
1915    
1916    
1917 lantonel 1.1 else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
1918 ahart 1.8
1919 lantonel 1.6 value = applyFunction(function, value);
1920 lantonel 1.1
1921     return value;
1922     }
1923    
1924     double
1925 lantonel 1.3 OSUAnalysis::valueLookup (const BNsupercluster* object, string variable, string function){
1926 lantonel 1.1
1927     double value = 0.0;
1928    
1929     if(variable == "energy") value = object->energy;
1930     else if(variable == "et") value = object->et;
1931     else if(variable == "ex") value = object->ex;
1932     else if(variable == "ey") value = object->ey;
1933     else if(variable == "ez") value = object->ez;
1934     else if(variable == "phi") value = object->phi;
1935     else if(variable == "eta") value = object->eta;
1936     else if(variable == "theta") value = object->theta;
1937    
1938    
1939     else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
1940 ahart 1.8
1941 lantonel 1.6 value = applyFunction(function, value);
1942 lantonel 1.1
1943     return value;
1944     }
1945    
1946    
1947 lantonel 1.6 double
1948 lantonel 1.17 OSUAnalysis::valueLookup (const BNmuon* object1, const BNmuon* object2, string variable, string function){
1949    
1950     double value = 0.0;
1951    
1952 lantonel 1.23 if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi));
1953     else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi);
1954 lantonel 1.17 else if(variable == "invMass"){
1955     TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy);
1956     TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy);
1957 qpython 1.20
1958     value = (fourVector1 + fourVector2).M();}
1959     else if(variable == "threeDAngle")
1960     {
1961     TVector3 threeVector1(object1->px, object1->py, object1->pz);
1962     TVector3 threeVector2(object2->px, object2->py, object2->pz);
1963     value = (threeVector1.Angle(threeVector2));
1964     }
1965    
1966    
1967    
1968 lantonel 1.18 else if(variable == "deltaCorrectedD0Vertex") value = object1->correctedD0Vertex - object2->correctedD0Vertex;
1969     else if(variable == "deltaAbsCorrectedD0Vertex") value = fabs(object1->correctedD0Vertex) - fabs(object2->correctedD0Vertex);
1970 lantonel 1.19 else if(variable == "d0Sign"){
1971     double d0Sign = (object1->correctedD0Vertex*object2->correctedD0Vertex)/fabs(object1->correctedD0Vertex*object2->correctedD0Vertex);
1972     if(d0Sign < 0) value = -0.5;
1973     else if (d0Sign > 0) value = 0.5;
1974     else value = -999;
1975     }
1976     else if(variable == "muon1CorrectedD0Vertex"){
1977     value = object1->correctedD0Vertex;
1978     }
1979     else if(variable == "muon2CorrectedD0Vertex"){
1980     value = object2->correctedD0Vertex;
1981     }
1982     else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
1983    
1984 lantonel 1.17
1985    
1986 qpython 1.20
1987    
1988    
1989    
1990    
1991 lantonel 1.17 value = applyFunction(function, value);
1992    
1993     return value;
1994     }
1995    
1996     double
1997     OSUAnalysis::valueLookup (const BNelectron* object1, const BNelectron* object2, string variable, string function){
1998    
1999     double value = 0.0;
2000    
2001 lantonel 1.23 if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi));
2002     else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi);
2003 lantonel 1.17 else if(variable == "invMass"){
2004     TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy);
2005     TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy);
2006 qpython 1.20
2007     value = (fourVector1 + fourVector2).M();}
2008     else if(variable == "threeDAngle")
2009     {
2010     TVector3 threeVector1(object1->px, object1->py, object1->pz);
2011     TVector3 threeVector2(object2->px, object2->py, object2->pz);
2012     value = (threeVector1.Angle(threeVector2));
2013     }
2014    
2015    
2016    
2017    
2018 lantonel 1.18 else if(variable == "deltaCorrectedD0Vertex") value = object1->correctedD0Vertex - object2->correctedD0Vertex;
2019     else if(variable == "deltaAbsCorrectedD0Vertex") value = fabs(object1->correctedD0Vertex) - fabs(object2->correctedD0Vertex);
2020 qpython 1.20
2021 lantonel 1.22 else if(variable == "d0Sign") value = object1->correctedD0Vertex*object2->correctedD0Vertex/fabs(object1->correctedD0Vertex*object2->correctedD0Vertex);
2022 qpython 1.20
2023    
2024    
2025 lantonel 1.19 else if(variable == "d0Sign"){
2026     double d0Sign = (object1->correctedD0Vertex*object2->correctedD0Vertex)/fabs(object1->correctedD0Vertex*object2->correctedD0Vertex);
2027     if(d0Sign < 0) value = -0.5;
2028     else if (d0Sign > 0) value = 0.5;
2029     else value = -999;
2030     }
2031     else if(variable == "electron1CorrectedD0Vertex"){
2032     value = object1->correctedD0Vertex;
2033     }
2034     else if(variable == "electron2CorrectedD0Vertex"){
2035     value = object2->correctedD0Vertex;
2036     }
2037 qpython 1.20
2038 lantonel 1.17 else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
2039    
2040     value = applyFunction(function, value);
2041    
2042     return value;
2043     }
2044    
2045     double
2046     OSUAnalysis::valueLookup (const BNelectron* object1, const BNmuon* object2, string variable, string function){
2047    
2048     double value = 0.0;
2049    
2050 lantonel 1.23 if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi));
2051     else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi);
2052 lantonel 1.17 else if(variable == "invMass"){
2053     TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy);
2054     TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy);
2055 qpython 1.20
2056     value = (fourVector1 + fourVector2).M();}
2057     else if(variable == "threeDAngle")
2058     {
2059     TVector3 threeVector1(object1->px, object1->py, object1->pz);
2060     TVector3 threeVector2(object2->px, object2->py, object2->pz);
2061     value = (threeVector1.Angle(threeVector2));
2062     }
2063 lantonel 1.22
2064 qpython 1.20
2065 lantonel 1.18 else if(variable == "deltaCorrectedD0Vertex") value = object1->correctedD0Vertex - object2->correctedD0Vertex;
2066     else if(variable == "deltaAbsCorrectedD0Vertex") value = fabs(object1->correctedD0Vertex) - fabs(object2->correctedD0Vertex);
2067 lantonel 1.19 else if(variable == "d0Sign"){
2068     double d0Sign = (object1->correctedD0Vertex*object2->correctedD0Vertex)/fabs(object1->correctedD0Vertex*object2->correctedD0Vertex);
2069     if(d0Sign < 0) value = -0.5;
2070     else if (d0Sign > 0) value = 0.5;
2071     else value = -999;
2072     }
2073     else if(variable == "electronCorrectedD0Vertex"){
2074     value = object1->correctedD0Vertex;
2075     }
2076     else if(variable == "muonCorrectedD0Vertex"){
2077     value = object2->correctedD0Vertex;
2078     }
2079 lantonel 1.22 else if(variable == "electronCorrectedD0"){
2080     value = object1->correctedD0;
2081     }
2082     else if(variable == "muonCorrectedD0"){
2083     value = object2->correctedD0;
2084     }
2085 lantonel 1.17
2086 qpython 1.20
2087 lantonel 1.17 else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
2088    
2089     value = applyFunction(function, value);
2090    
2091     return value;
2092     }
2093    
2094    
2095     double
2096 lantonel 1.6 OSUAnalysis::applyFunction(string function, double value){
2097    
2098 lantonel 1.9 if(function == "abs") value = fabs(value);
2099 lantonel 1.19 else if(function == "fabs") value = fabs(value);
2100    
2101 lantonel 1.6
2102 lantonel 1.19 else if(function == "") value = value;
2103     else{std::cout << "WARNING: invalid function '" << function << "'\n";}
2104 lantonel 1.6
2105     return value;
2106    
2107     }
2108    
2109    
2110 ahart 1.8 template <class InputCollection>
2111 lantonel 1.1 void OSUAnalysis::setObjectFlags(cut &currentCut, uint currentCutIndex, flagMap &individualFlags, flagMap &cumulativeFlags, InputCollection inputCollection, string inputType){
2112    
2113 lantonel 1.23
2114 lantonel 1.1 for (uint object = 0; object != inputCollection->size(); object++){
2115 ahart 1.8
2116 lantonel 1.23
2117 lantonel 1.1 bool decision = true;//object passes if this cut doesn't cut on that type of object
2118 ahart 1.8
2119 lantonel 1.23
2120 ahart 1.8 if(currentCut.inputCollection == inputType){
2121    
2122 lantonel 1.17 vector<bool> subcutDecisions;
2123     for( int subcutIndex = 0; subcutIndex != currentCut.numSubcuts; subcutIndex++){
2124     double value = valueLookup(&inputCollection->at(object), currentCut.variables.at(subcutIndex), currentCut.functions.at(subcutIndex));
2125     subcutDecisions.push_back(evaluateComparison(value,currentCut.comparativeOperators.at(subcutIndex),currentCut.cutValues.at(subcutIndex)));
2126     }
2127     if(currentCut.numSubcuts == 1) decision = subcutDecisions.at(0);
2128     else{
2129     bool tempDecision = true;
2130     for( int subcutIndex = 0;subcutIndex != currentCut.numSubcuts-1; subcutIndex++){
2131     if(currentCut.logicalOperators.at(subcutIndex) == "&" || currentCut.logicalOperators.at(subcutIndex) == "&&")
2132     tempDecision = subcutDecisions.at(subcutIndex) && subcutDecisions.at(subcutIndex+1);
2133     else if(currentCut.logicalOperators.at(subcutIndex) == "|"|| currentCut.logicalOperators.at(subcutIndex) == "||")
2134     tempDecision = subcutDecisions.at(subcutIndex) || subcutDecisions.at(subcutIndex+1);
2135     }
2136     decision = tempDecision;
2137     }
2138 lantonel 1.1 }
2139 lantonel 1.14 individualFlags.at(inputType).at(currentCutIndex).push_back(decision);
2140 ahart 1.8
2141 lantonel 1.23
2142 lantonel 1.1 //set flags for objects that pass each cut AND all the previous cuts
2143     bool previousCumulativeFlag = true;
2144     for(uint previousCutIndex = 0; previousCutIndex != currentCutIndex; previousCutIndex++){
2145 lantonel 1.14 if(previousCumulativeFlag && individualFlags.at(inputType).at(previousCutIndex).at(object)) previousCumulativeFlag = true;
2146 lantonel 1.1 else{ previousCumulativeFlag = false; break;}
2147     }
2148 lantonel 1.14 cumulativeFlags.at(inputType).at(currentCutIndex).push_back(previousCumulativeFlag && decision);
2149 ahart 1.8
2150 lantonel 1.23
2151 lantonel 1.1 }
2152 ahart 1.8
2153 lantonel 1.1 }
2154    
2155    
2156 lantonel 1.17 template <class InputCollection1, class InputCollection2>
2157     void OSUAnalysis::setObjectFlags(cut &currentCut, uint currentCutIndex, flagMap &individualFlags, flagMap &cumulativeFlags, \
2158 lantonel 1.23 InputCollection1 inputCollection1, InputCollection2 inputCollection2, vector<bool> flags1, vector<bool> flags2, string inputType){
2159 lantonel 1.17
2160    
2161     bool sameObjects = false;
2162     if(typeid(InputCollection1).name() == typeid(InputCollection2).name()) sameObjects = true;
2163    
2164 lantonel 1.23
2165 lantonel 1.17 int counter = 0;
2166     for (uint object1 = 0; object1 != inputCollection1->size(); object1++){
2167     for (uint object2 = 0; object2 != inputCollection2->size(); object2++){
2168    
2169     if(sameObjects && object1 >= object2) continue;//account for duplicate pairs if both collections are the same
2170    
2171    
2172     bool decision = true;//object passes if this cut doesn't cut on that type of object
2173    
2174     if(currentCut.inputCollection == inputType){
2175    
2176     vector<bool> subcutDecisions;
2177     for( int subcutIndex = 0; subcutIndex != currentCut.numSubcuts; subcutIndex++){
2178     double value = valueLookup(&inputCollection1->at(object1), &inputCollection2->at(object2), currentCut.variables.at(subcutIndex), currentCut.functions.at(subcutIndex));
2179     subcutDecisions.push_back(evaluateComparison(value,currentCut.comparativeOperators.at(subcutIndex),currentCut.cutValues.at(subcutIndex)));
2180     }
2181    
2182     if(currentCut.numSubcuts == 1) decision = subcutDecisions.at(0);
2183     else{
2184     bool tempDecision = true;
2185     for( int subcutIndex = 0;subcutIndex != currentCut.numSubcuts-1; subcutIndex++){
2186     if(currentCut.logicalOperators.at(subcutIndex) == "&" || currentCut.logicalOperators.at(subcutIndex) == "&&")
2187     tempDecision = subcutDecisions.at(subcutIndex) && subcutDecisions.at(subcutIndex+1);
2188     else if(currentCut.logicalOperators.at(subcutIndex) == "|"|| currentCut.logicalOperators.at(subcutIndex) == "||")
2189     tempDecision = subcutDecisions.at(subcutIndex) || subcutDecisions.at(subcutIndex+1);
2190     }
2191     decision = tempDecision;
2192     }
2193     }
2194     individualFlags.at(inputType).at(currentCutIndex).push_back(decision);
2195    
2196     //set flags for objects that pass each cut AND all the previous cuts
2197     bool previousCumulativeFlag = true;
2198     for(uint previousCutIndex = 0; previousCutIndex != currentCutIndex; previousCutIndex++){
2199     if(previousCumulativeFlag && individualFlags.at(inputType).at(previousCutIndex).at(counter)) previousCumulativeFlag = true;
2200     else{ previousCumulativeFlag = false; break;}
2201     }
2202 lantonel 1.23 //apply flags for the components of the composite object as well
2203     bool currentCumulativeFlag = true;
2204     if(flags1.size() == 0 && flags2.size() == 0) currentCumulativeFlag = previousCumulativeFlag && decision;
2205     else if(flags1.size() == 0) currentCumulativeFlag = previousCumulativeFlag && decision && flags2.at(object2);
2206     else if(flags2.size() == 0) currentCumulativeFlag = previousCumulativeFlag && decision && flags1.at(object1);
2207     else currentCumulativeFlag = previousCumulativeFlag && decision && flags1.at(object1) && flags2.at(object2);
2208     cumulativeFlags.at(inputType).at(currentCutIndex).push_back(currentCumulativeFlag);
2209 lantonel 1.17
2210     counter++;
2211     }
2212    
2213     }
2214    
2215    
2216     }
2217    
2218    
2219 lantonel 1.9 template <class InputCollection>
2220 lantonel 1.15 void OSUAnalysis::fill1DHistogram(TH1* histo, histogram parameters, InputCollection inputCollection,vector<bool> flags, double puScaleFactor){
2221 lantonel 1.14
2222     for (uint object = 0; object != inputCollection->size(); object++){
2223 lantonel 1.10
2224 lantonel 1.15 if(!plotAllObjectsInPassingEvents_ && !flags.at(object)) continue;
2225    
2226 lantonel 1.17 string currentString = parameters.inputVariables.at(0);
2227     string inputVariable = "";
2228     string function = "";
2229     if(currentString.find("(")==std::string::npos){
2230     inputVariable = currentString;// variable to cut on
2231     }
2232     else{
2233     function = currentString.substr(0,currentString.find("("));//function comes before the "("
2234     inputVariable = currentString.substr(currentString.find("(")+1);//get rest of string
2235     inputVariable = inputVariable.substr(0,inputVariable.size()-1);//remove trailing ")"
2236     }
2237    
2238     double value = valueLookup(&inputCollection->at(object), inputVariable, function);
2239 lantonel 1.15 histo->Fill(value,puScaleFactor);
2240    
2241     }
2242 lantonel 1.9
2243 lantonel 1.15 }
2244    
2245 lantonel 1.17 template <class InputCollection1, class InputCollection2>
2246     void OSUAnalysis::fill1DHistogram(TH1* histo, histogram parameters, InputCollection1 inputCollection1, InputCollection2 inputCollection2, vector<bool> flags1, vector<bool> flags2, vector<bool> pairFlags, double puScaleFactor){
2247    
2248     bool sameObjects = false;
2249     if(typeid(InputCollection1).name() == typeid(InputCollection2).name()) sameObjects = true;
2250    
2251 lantonel 1.23 int pairCounter = 0;
2252 lantonel 1.17 for (uint object1 = 0; object1 != inputCollection1->size(); object1++){
2253     for (uint object2 = 0; object2 != inputCollection2->size(); object2++){
2254    
2255     if(sameObjects && object1 >= object2) continue;//account for duplicate pairs if both collections are the same
2256    
2257     //only take objects which have passed all cuts and pairs which have passed all cuts
2258     if(!plotAllObjectsInPassingEvents_ && !flags1.at(object1)) continue;
2259     if(!plotAllObjectsInPassingEvents_ && !flags2.at(object2)) continue;
2260 lantonel 1.23 if(!plotAllObjectsInPassingEvents_ && !pairFlags.at(pairCounter)) continue;
2261 lantonel 1.17
2262     string currentString = parameters.inputVariables.at(0);
2263     string inputVariable = "";
2264     string function = "";
2265     if(currentString.find("(")==std::string::npos){
2266     inputVariable = currentString;// variable to cut on
2267     }
2268     else{
2269     function = currentString.substr(0,currentString.find("("));//function comes before the "("
2270     inputVariable = currentString.substr(currentString.find("(")+1);//get rest of string
2271     inputVariable = inputVariable.substr(0,inputVariable.size()-1);//remove trailing ")"
2272     }
2273    
2274     double value = valueLookup(&inputCollection1->at(object1), &inputCollection2->at(object2), inputVariable, function);
2275     histo->Fill(value,puScaleFactor);
2276    
2277 lantonel 1.23 pairCounter++;
2278 lantonel 1.17 }
2279     }
2280    
2281     }
2282    
2283    
2284 lantonel 1.15 template <class InputCollection>
2285     void OSUAnalysis::fill2DHistogram(TH2* histo, histogram parameters, InputCollection inputCollection,vector<bool> flags, double puScaleFactor){
2286    
2287     for (uint object = 0; object != inputCollection->size(); object++){
2288    
2289     if(!plotAllObjectsInPassingEvents_ && !flags.at(object)) continue;
2290    
2291 lantonel 1.17 string currentString = parameters.inputVariables.at(0);
2292     string inputVariable = "";
2293     string function = "";
2294     if(currentString.find("(")==std::string::npos){
2295     inputVariable = currentString;// variable to cut on
2296     }
2297     else{
2298     function = currentString.substr(0,currentString.find("("));//function comes before the "("
2299     inputVariable = currentString.substr(currentString.find("(")+1);//get rest of string
2300     inputVariable = inputVariable.substr(0,inputVariable.size()-1);//remove trailing ")"
2301     }
2302     double valueX = valueLookup(&inputCollection->at(object), inputVariable, function);
2303    
2304     currentString = parameters.inputVariables.at(1);
2305     inputVariable = "";
2306     function = "";
2307     if(currentString.find("(")==std::string::npos){
2308     inputVariable = currentString;// variable to cut on
2309     }
2310     else{
2311     function = currentString.substr(0,currentString.find("("));//function comes before the "("
2312     inputVariable = currentString.substr(currentString.find("(")+1);//get rest of string
2313     inputVariable = inputVariable.substr(0,inputVariable.size()-1);//remove trailing ")"
2314     }
2315    
2316     double valueY = valueLookup(&inputCollection->at(object), inputVariable, function);
2317    
2318 lantonel 1.15 histo->Fill(valueX,valueY,puScaleFactor);
2319 lantonel 1.14
2320 lantonel 1.9 }
2321    
2322     }
2323    
2324 lantonel 1.17 template <class InputCollection1, class InputCollection2>
2325     void OSUAnalysis::fill2DHistogram(TH2* histo, histogram parameters, InputCollection1 inputCollection1, InputCollection2 inputCollection2, vector<bool> flags1, vector<bool> flags2, vector<bool> pairFlags, double puScaleFactor){
2326    
2327     bool sameObjects = false;
2328     if(typeid(InputCollection1).name() == typeid(InputCollection2).name()) sameObjects = true;
2329    
2330 lantonel 1.23 int pairCounter = 0;
2331 lantonel 1.17 for (uint object1 = 0; object1 != inputCollection1->size(); object1++){
2332     for (uint object2 = 0; object2 != inputCollection2->size(); object2++){
2333    
2334     if(sameObjects && object1 >= object2) continue;//account for duplicate pairs if both collections are the same
2335    
2336     //only take objects which have passed all cuts and pairs which have passed all cuts
2337     if(!plotAllObjectsInPassingEvents_ && !flags1.at(object1)) continue;
2338     if(!plotAllObjectsInPassingEvents_ && !flags2.at(object2)) continue;
2339 lantonel 1.23 if(!plotAllObjectsInPassingEvents_ && !pairFlags.at(pairCounter)) continue;
2340 lantonel 1.17
2341     string currentString = parameters.inputVariables.at(0);
2342     string inputVariable = "";
2343     string function = "";
2344     if(currentString.find("(")==std::string::npos){
2345     inputVariable = currentString;// variable to cut on
2346     }
2347     else{
2348     function = currentString.substr(0,currentString.find("("));//function comes before the "("
2349     inputVariable = currentString.substr(currentString.find("(")+1);//get rest of string
2350     inputVariable = inputVariable.substr(0,inputVariable.size()-1);//remove trailing ")"
2351     }
2352     double valueX = valueLookup(&inputCollection1->at(object1), &inputCollection2->at(object2), inputVariable, function);
2353    
2354     currentString = parameters.inputVariables.at(1);
2355     inputVariable = "";
2356     function = "";
2357     if(currentString.find("(")==std::string::npos){
2358     inputVariable = currentString;// variable to cut on
2359     }
2360     else{
2361     function = currentString.substr(0,currentString.find("("));//function comes before the "("
2362     inputVariable = currentString.substr(currentString.find("(")+1);//get rest of string
2363     inputVariable = inputVariable.substr(0,inputVariable.size()-1);//remove trailing ")"
2364     }
2365     double valueY = valueLookup(&inputCollection1->at(object1), &inputCollection2->at(object2), inputVariable, function);
2366    
2367    
2368     histo->Fill(valueX,valueY,puScaleFactor);
2369    
2370 lantonel 1.23 pairCounter++;
2371 lantonel 1.17 }
2372     }
2373    
2374     }
2375 lantonel 1.1
2376    
2377 lantonel 1.22 template <class InputObject>
2378     int OSUAnalysis::getGenMatchedParticleIndex(InputObject object){
2379 lantonel 1.23
2380 lantonel 1.22 int bestMatchIndex = -1;
2381     double bestMatchDeltaR = 999;
2382 lantonel 1.23
2383 lantonel 1.22 for(BNmcparticleCollection::const_iterator mcparticle = mcparticles->begin (); mcparticle != mcparticles->end (); mcparticle++){
2384    
2385     double currentDeltaR = deltaR(object->eta,object->phi,mcparticle->eta,mcparticle->phi);
2386     if(currentDeltaR > 0.05) continue;
2387    
2388     if(currentDeltaR < bestMatchDeltaR && mcparticles->at(mcparticle - mcparticles->begin()).id != mcparticles->at(mcparticle - mcparticles->begin()).motherId){
2389     bestMatchIndex = mcparticle - mcparticles->begin();
2390     bestMatchDeltaR = currentDeltaR;
2391     }
2392    
2393     }
2394 lantonel 1.23
2395 lantonel 1.22 return bestMatchIndex;
2396    
2397     }
2398    
2399    
2400     int OSUAnalysis::findTauMotherIndex(const BNmcparticle* tau){
2401    
2402     int bestMatchIndex = -1;
2403     double bestMatchDeltaR = 999;
2404    
2405     for(BNmcparticleCollection::const_iterator mcparticle = mcparticles->begin (); mcparticle != mcparticles->end (); mcparticle++){
2406    
2407     if(fabs(mcparticle->id) != 15 || mcparticle->status !=3) continue;
2408    
2409     double currentDeltaR = deltaR(tau->eta,tau->phi,mcparticle->eta,mcparticle->phi);
2410     if(currentDeltaR > 0.05) continue;
2411    
2412     if(currentDeltaR < bestMatchDeltaR && mcparticles->at(mcparticle - mcparticles->begin()).id != mcparticles->at(mcparticle - mcparticles->begin()).motherId){
2413     bestMatchIndex = mcparticle - mcparticles->begin();
2414     bestMatchDeltaR = currentDeltaR;
2415     }
2416    
2417     }
2418 lantonel 1.23
2419 lantonel 1.22 return bestMatchIndex;
2420     }
2421    
2422    
2423     // bin particle type
2424     // --- -------------
2425     // 0 unmatched
2426     // 1 u
2427     // 2 d
2428     // 3 s
2429     // 4 c
2430     // 5 b
2431     // 6 t
2432     // 7 e
2433     // 8 mu
2434     // 9 tau
2435     // 10 nu
2436     // 11 g
2437     // 12 gamma
2438     // 13 Z
2439     // 14 W
2440     // 15 light meson
2441     // 16 K meson
2442     // 17 D meson
2443     // 18 B meson
2444     // 19 light baryon
2445     // 20 strange baryon
2446     // 21 charm baryon
2447     // 22 bottom baryon
2448     // 23 other
2449    
2450     int OSUAnalysis::getPdgIdBinValue(int pdgId){
2451    
2452     int binValue = -999;
2453     int absPdgId = fabs(pdgId);
2454     if(pdgId == -1) binValue = 0;
2455     else if(absPdgId <= 6 ) binValue = absPdgId;
2456     else if(absPdgId == 11 ) binValue = 7;
2457     else if(absPdgId == 13 ) binValue = 8;
2458     else if(absPdgId == 15 ) binValue = 9;
2459     else if(absPdgId == 12 || absPdgId == 14 || absPdgId == 16 ) binValue = 10;
2460     else if(absPdgId == 21 ) binValue = 11;
2461     else if(absPdgId == 22 ) binValue = 12;
2462     else if(absPdgId == 23 ) binValue = 13;
2463     else if(absPdgId == 24 ) binValue = 14;
2464     else if(absPdgId > 100 && absPdgId < 300 && absPdgId != 130 ) binValue = 15;
2465     else if( absPdgId == 130 || (absPdgId > 300 && absPdgId < 400) ) binValue = 16;
2466     else if(absPdgId > 400 && absPdgId < 500 ) binValue = 17;
2467     else if(absPdgId > 500 && absPdgId < 600 ) binValue = 18;
2468     else if(absPdgId > 1000 && absPdgId < 3000 ) binValue = 19;
2469     else if(absPdgId > 3000 && absPdgId < 4000 ) binValue = 20;
2470     else if(absPdgId > 4000 && absPdgId < 5000 ) binValue = 21;
2471     else if(absPdgId > 5000 && absPdgId < 6000 ) binValue = 22;
2472 lantonel 1.19
2473 lantonel 1.22 else binValue = 23;
2474    
2475     return binValue;
2476    
2477     }
2478 lantonel 1.19
2479 lantonel 1.1
2480     DEFINE_FWK_MODULE(OSUAnalysis);
2481    
2482