ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/OSUT3Analysis/AnaTools/plugins/OSUAnalysis.cc
Revision: 1.24
Committed: Mon Mar 4 23:25:13 2013 UTC (12 years, 2 months ago) by lantonel
Content type: text/plain
Branch: MAIN
Changes since 1.23: +9 -2 lines
Log Message:
did I say 12? I meant 14

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