ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/OSUT3Analysis/AnaTools/plugins/OSUAnalysis.cc
Revision: 1.14
Committed: Wed Feb 13 10:05:35 2013 UTC (12 years, 2 months ago) by lantonel
Content type: text/plain
Branch: MAIN
Changes since 1.13: +74 -56 lines
Log Message:
added plotAllObjectsInPassingEvents parameter

File Contents

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