11 |
|
tracks_ (cfg.getParameter<edm::InputTag> ("tracks")), |
12 |
|
genjets_ (cfg.getParameter<edm::InputTag> ("genjets")), |
13 |
|
mcparticles_ (cfg.getParameter<edm::InputTag> ("mcparticles")), |
14 |
+ |
stops_ (cfg.getParameter<edm::InputTag> ("stops")), |
15 |
|
primaryvertexs_ (cfg.getParameter<edm::InputTag> ("primaryvertexs")), |
16 |
|
bxlumis_ (cfg.getParameter<edm::InputTag> ("bxlumis")), |
17 |
|
photons_ (cfg.getParameter<edm::InputTag> ("photons")), |
18 |
|
superclusters_ (cfg.getParameter<edm::InputTag> ("superclusters")), |
19 |
|
triggers_ (cfg.getParameter<edm::InputTag> ("triggers")), |
20 |
< |
puFile_ (cfg.getParameter<std::string> ("puFile")), |
21 |
< |
deadEcalFile_ (cfg.getParameter<std::string> ("deadEcalFile")), |
22 |
< |
muonSFFile_ (cfg.getParameter<std::string> ("muonSFFile")), |
23 |
< |
dataPU_ (cfg.getParameter<std::string> ("dataPU")), |
24 |
< |
electronSFID_ (cfg.getParameter<std::string> ("electronSFID")), |
25 |
< |
muonSF_ (cfg.getParameter<std::string> ("muonSF")), |
26 |
< |
dataset_ (cfg.getParameter<std::string> ("dataset")), |
27 |
< |
datasetType_ (cfg.getParameter<std::string> ("datasetType")), |
20 |
> |
trigobjs_ (cfg.getParameter<edm::InputTag> ("trigobjs")), |
21 |
> |
puFile_ (cfg.getParameter<string> ("puFile")), |
22 |
> |
deadEcalFile_ (cfg.getParameter<string> ("deadEcalFile")), |
23 |
> |
muonSFFile_ (cfg.getParameter<string> ("muonSFFile")), |
24 |
> |
dataPU_ (cfg.getParameter<string> ("dataPU")), |
25 |
> |
electronSFID_ (cfg.getParameter<string> ("electronSFID")), |
26 |
> |
muonSF_ (cfg.getParameter<string> ("muonSF")), |
27 |
> |
dataset_ (cfg.getParameter<string> ("dataset")), |
28 |
> |
datasetType_ (cfg.getParameter<string> ("datasetType")), |
29 |
|
channels_ (cfg.getParameter<vector<edm::ParameterSet> >("channels")), |
30 |
|
histogramSets_ (cfg.getParameter<vector<edm::ParameterSet> >("histogramSets")), |
31 |
|
plotAllObjectsInPassingEvents_ (cfg.getParameter<bool> ("plotAllObjectsInPassingEvents")), |
32 |
|
doPileupReweighting_ (cfg.getParameter<bool> ("doPileupReweighting")), |
33 |
< |
printEventInfo_ (cfg.getParameter<bool> ("printEventInfo")) |
33 |
> |
applyLeptonSF_ (cfg.getParameter<bool> ("applyLeptonSF")), |
34 |
> |
printEventInfo_ (cfg.getParameter<bool> ("printEventInfo")), |
35 |
> |
useTrackCaloRhoCorr_ (cfg.getParameter<bool> ("useTrackCaloRhoCorr")), |
36 |
> |
stopCTau_ (cfg.getParameter<vector<double> > ("stopCTau")), |
37 |
> |
GetPlotsAfterEachCut_ (cfg.getParameter<bool> ("GetPlotsAfterEachCut")) |
38 |
|
{ |
39 |
|
|
40 |
|
TH1::SetDefaultSumw2 (); |
42 |
|
//create pile-up reweighting object, if necessary |
43 |
|
if(datasetType_ != "data") { |
44 |
|
if(doPileupReweighting_) puWeight_ = new PUWeight (puFile_, dataPU_, dataset_); |
45 |
< |
// muonSFWeight_ = new MuonSFWeight (muonSFFile_, muonSF_); |
46 |
< |
// electronSFWeight_ = new ElectronSFWeight ("53X", electronSFID_); |
45 |
> |
if (applyLeptonSF_){ |
46 |
> |
muonSFWeight_ = new MuonSFWeight (muonSFFile_, muonSF_); |
47 |
> |
electronSFWeight_ = new ElectronSFWeight ("53X", electronSFID_); |
48 |
> |
} |
49 |
|
} |
50 |
+ |
if (datasetType_ == "signalMC" && regex_match (dataset_, regex ("stop.*to.*_.*mm.*"))) |
51 |
+ |
stopCTauWeight_ = new StopCTauWeight (stopCTau_.at (0), stopCTau_.at (1), stops_); |
52 |
|
|
53 |
|
|
54 |
|
// Construct Cutflow Objects. These store the results of cut decisions and |
55 |
|
// handle filling cut flow histograms. |
56 |
|
masterCutFlow_ = new CutFlow (fs_); |
47 |
– |
std::vector<TFileDirectory> directories; |
57 |
|
|
58 |
|
//always get vertex collection so we can assign the primary vertex in the event |
59 |
|
objectsToGet.push_back("primaryvertexs"); |
51 |
– |
|
52 |
– |
//always make the plot of number of primary verticex (to check pile-up reweighting) |
60 |
|
objectsToPlot.push_back("primaryvertexs"); |
61 |
+ |
objectsToCut.push_back("primaryvertexs"); |
62 |
+ |
|
63 |
|
|
64 |
|
//always get the MC particles to do GEN-matching |
65 |
|
objectsToGet.push_back("mcparticles"); |
72 |
|
|
73 |
|
string tempInputCollection = histogramSets_.at(currentHistogramSet).getParameter<string> ("inputCollection"); |
74 |
|
if(tempInputCollection == "muon-electron pairs") tempInputCollection = "electron-muon pairs"; |
75 |
< |
if(tempInputCollection.find("pairs")==std::string::npos){ //just a single object |
76 |
< |
objectsToGet.push_back(tempInputCollection); |
75 |
> |
if(tempInputCollection == "jet-electron pairs") tempInputCollection = "electron-jet pairs"; |
76 |
> |
if(tempInputCollection == "jet-muon pairs") tempInputCollection = "muon-jet pairs"; |
77 |
> |
if(tempInputCollection == "event-track pairs") tempInputCollection = "track-event pairs"; |
78 |
> |
if(tempInputCollection == "secondary muon-muon pairs") tempInputCollection = "muon-secondary muon pairs"; |
79 |
> |
if(tempInputCollection == "secondary electron-electron pairs") tempInputCollection = "electron-secondary electron pairs"; |
80 |
> |
if(tempInputCollection == "trigobj-electron pairs") tempInputCollection = "electron-trigobj pairs"; |
81 |
> |
if(tempInputCollection == "trigobj-muon pairs") tempInputCollection = "muon-trigobj pairs"; |
82 |
> |
if(tempInputCollection.find("pairs")==string::npos){ //just a single object |
83 |
> |
if(tempInputCollection.find("secondary")!=string::npos){//secondary object |
84 |
> |
int spaceIndex = tempInputCollection.find(" "); |
85 |
> |
int secondWordLength = tempInputCollection.size() - spaceIndex; |
86 |
> |
objectsToGet.push_back(tempInputCollection.substr(spaceIndex+1,secondWordLength)); |
87 |
> |
} |
88 |
> |
else{ |
89 |
> |
objectsToGet.push_back(tempInputCollection); |
90 |
> |
} |
91 |
|
objectsToPlot.push_back(tempInputCollection); |
92 |
|
objectsToCut.push_back(tempInputCollection); |
93 |
|
} |
94 |
< |
else{//pair of objects, need to add them both to the things to objectsToGet |
95 |
< |
int dashIndex = tempInputCollection.find("-"); |
96 |
< |
int spaceIndex = tempInputCollection.find(" "); |
97 |
< |
int secondWordLength = spaceIndex - dashIndex; |
98 |
< |
objectsToGet.push_back(tempInputCollection); |
76 |
< |
objectsToGet.push_back(tempInputCollection.substr(0,dashIndex)+"s"); |
77 |
< |
objectsToGet.push_back(tempInputCollection.substr(dashIndex+1,secondWordLength-1)+"s"); |
78 |
< |
objectsToPlot.push_back(tempInputCollection); |
79 |
< |
objectsToPlot.push_back(tempInputCollection.substr(0,dashIndex)+"s"); |
80 |
< |
objectsToPlot.push_back(tempInputCollection.substr(dashIndex+1,secondWordLength-1)+"s"); |
94 |
> |
else{//pair of objects, need to add the pair and the individual objects to the lists of things to Get/Plot/Cut |
95 |
> |
string obj1; |
96 |
> |
string obj2; |
97 |
> |
getTwoObjs(tempInputCollection, obj1, obj2); |
98 |
> |
string obj2ToGet = getObjToGet(obj2); |
99 |
|
objectsToCut.push_back(tempInputCollection); |
100 |
< |
objectsToCut.push_back(tempInputCollection.substr(0,dashIndex)+"s"); |
101 |
< |
objectsToCut.push_back(tempInputCollection.substr(dashIndex+1,secondWordLength-1)+"s"); |
100 |
> |
objectsToCut.push_back(obj1); |
101 |
> |
objectsToCut.push_back(obj2); |
102 |
> |
objectsToPlot.push_back(tempInputCollection); |
103 |
> |
objectsToPlot.push_back(obj1); |
104 |
> |
objectsToPlot.push_back(obj2); |
105 |
> |
objectsToGet.push_back(tempInputCollection); |
106 |
> |
objectsToGet.push_back(obj1); |
107 |
> |
objectsToGet.push_back(obj2ToGet); |
108 |
> |
|
109 |
> |
} |
110 |
|
|
85 |
– |
} |
111 |
|
|
112 |
|
vector<edm::ParameterSet> histogramList_ (histogramSets_.at(currentHistogramSet).getParameter<vector<edm::ParameterSet> >("histograms")); |
113 |
|
|
114 |
|
for(uint currentHistogram = 0; currentHistogram != histogramList_.size(); currentHistogram++){ |
115 |
|
|
116 |
+ |
vector<double> defaultValue; |
117 |
+ |
defaultValue.push_back (-1.0); |
118 |
+ |
|
119 |
|
histogram tempHistogram; |
120 |
|
tempHistogram.inputCollection = tempInputCollection; |
121 |
|
tempHistogram.name = histogramList_.at(currentHistogram).getParameter<string>("name"); |
122 |
|
tempHistogram.title = histogramList_.at(currentHistogram).getParameter<string>("title"); |
123 |
< |
tempHistogram.bins = histogramList_.at(currentHistogram).getParameter<vector<double> >("bins"); |
123 |
> |
tempHistogram.bins = histogramList_.at(currentHistogram).getUntrackedParameter<vector<double> >("bins", defaultValue); |
124 |
> |
tempHistogram.variableBinsX = histogramList_.at(currentHistogram).getUntrackedParameter<vector<double> >("variableBinsX", defaultValue); |
125 |
> |
tempHistogram.variableBinsY = histogramList_.at(currentHistogram).getUntrackedParameter<vector<double> >("variableBinsY", defaultValue); |
126 |
|
tempHistogram.inputVariables = histogramList_.at(currentHistogram).getParameter<vector<string> >("inputVariables"); |
127 |
|
|
128 |
|
histograms.push_back(tempHistogram); |
139 |
|
for(uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){ |
140 |
|
|
141 |
|
string currentObject = objectsToPlot.at(currentObjectIndex); |
142 |
< |
if(currentObject != "muons" && currentObject != "electrons" && currentObject != "taus" && currentObject != "tracks" && currentObject != "photons" && currentObject != "superclusters") continue; |
142 |
> |
if(currentObject != "muons" && currentObject != "secondary muons" && currentObject != "secondary electrons" && currentObject != "electrons" && currentObject != "taus" && currentObject != "tracks" && currentObject != "photons" && currentObject != "superclusters") continue; |
143 |
|
|
144 |
|
histogram tempIdHisto; |
145 |
|
histogram tempMomIdHisto; |
146 |
|
histogram tempGmaIdHisto; |
147 |
|
histogram tempIdVsMomIdHisto; |
148 |
+ |
histogram tempIdVsGmaIdHisto; |
149 |
|
|
150 |
|
tempIdHisto.inputCollection = currentObject; |
151 |
|
tempMomIdHisto.inputCollection = currentObject; |
152 |
|
tempGmaIdHisto.inputCollection = currentObject; |
153 |
|
tempIdVsMomIdHisto.inputCollection = currentObject; |
154 |
+ |
tempIdVsGmaIdHisto.inputCollection = currentObject; |
155 |
+ |
|
156 |
+ |
if(currentObject == "secondary muons") currentObject = "secondaryMuons"; |
157 |
+ |
if(currentObject == "secondary electrons") currentObject = "secondaryElectrons"; |
158 |
|
|
159 |
|
currentObject = currentObject.substr(0, currentObject.size()-1); |
160 |
|
tempIdHisto.name = currentObject+"GenMatchId"; |
161 |
|
tempMomIdHisto.name = currentObject+"GenMatchMotherId"; |
162 |
|
tempGmaIdHisto.name = currentObject+"GenMatchGrandmotherId"; |
163 |
|
tempIdVsMomIdHisto.name = currentObject+"GenMatchIdVsMotherId"; |
164 |
+ |
tempIdVsGmaIdHisto.name = currentObject+"GenMatchIdVsGrandmotherId"; |
165 |
|
|
166 |
|
currentObject.at(0) = toupper(currentObject.at(0)); |
167 |
|
tempIdHisto.title = currentObject+" Gen-matched Particle"; |
168 |
|
tempMomIdHisto.title = currentObject+" Gen-matched Particle's Mother"; |
169 |
|
tempGmaIdHisto.title = currentObject+" Gen-matched Particle's Grandmother"; |
170 |
|
tempIdVsMomIdHisto.title = currentObject+" Gen-matched Particle's Mother vs. Particle;Particle;Mother"; |
171 |
+ |
tempIdVsGmaIdHisto.title = currentObject+" Gen-matched Particle's Grandmother vs. Particle;Particle;Grandmother"; |
172 |
|
|
173 |
< |
int maxNum = 24; |
173 |
> |
|
174 |
> |
int maxNum = 25; |
175 |
|
vector<double> binVector; |
176 |
|
binVector.push_back(maxNum); |
177 |
|
binVector.push_back(0); |
189 |
|
tempIdVsMomIdHisto.bins = binVector; |
190 |
|
tempIdVsMomIdHisto.inputVariables.push_back("genMatchedId"); |
191 |
|
tempIdVsMomIdHisto.inputVariables.push_back("genMatchedMotherIdReverse"); |
192 |
+ |
tempIdVsGmaIdHisto.bins = binVector; |
193 |
+ |
tempIdVsGmaIdHisto.inputVariables.push_back("genMatchedId"); |
194 |
+ |
tempIdVsGmaIdHisto.inputVariables.push_back("genMatchedGrandmotherIdReverse"); |
195 |
|
|
196 |
|
histograms.push_back(tempIdHisto); |
197 |
|
histograms.push_back(tempMomIdHisto); |
198 |
|
histograms.push_back(tempGmaIdHisto); |
199 |
|
histograms.push_back(tempIdVsMomIdHisto); |
200 |
+ |
histograms.push_back(tempIdVsGmaIdHisto); |
201 |
|
} |
202 |
|
|
203 |
|
|
213 |
|
//set triggers for this channel |
214 |
|
vector<string> triggerNames; |
215 |
|
triggerNames.clear(); |
216 |
+ |
vector<string> triggerToVetoNames; |
217 |
+ |
triggerToVetoNames.clear(); |
218 |
+ |
|
219 |
|
tempChannel.triggers.clear(); |
220 |
+ |
tempChannel.triggersToVeto.clear(); |
221 |
|
if(channels_.at(currentChannel).exists("triggers")){ |
222 |
|
triggerNames = channels_.at(currentChannel).getParameter<vector<string> >("triggers"); |
223 |
|
for(uint trigger = 0; trigger!= triggerNames.size(); trigger++) |
224 |
|
tempChannel.triggers.push_back(triggerNames.at(trigger)); |
225 |
|
objectsToGet.push_back("triggers"); |
226 |
|
} |
227 |
< |
|
227 |
> |
if(channels_.at(currentChannel).exists("triggersToVeto")){ |
228 |
> |
triggerToVetoNames = channels_.at(currentChannel).getParameter<vector<string> >("triggersToVeto"); |
229 |
> |
for(uint trigger = 0; trigger!= triggerToVetoNames.size(); trigger++) |
230 |
> |
tempChannel.triggersToVeto.push_back(triggerToVetoNames.at(trigger)); |
231 |
> |
objectsToGet.push_back("triggers"); |
232 |
> |
} |
233 |
|
|
234 |
|
|
235 |
|
|
236 |
|
//create cutFlow for this channel |
237 |
|
cutFlows_.push_back (new CutFlow (fs_, channelName)); |
238 |
+ |
vector<TFileDirectory> directories; //vector of directories in the output file. |
239 |
+ |
vector<string> subSubDirNames;//subdirectories in each channel. |
240 |
+ |
//get list of cuts for this channel |
241 |
+ |
vector<edm::ParameterSet> cuts_ (channels_.at(currentChannel).getParameter<vector<edm::ParameterSet> >("cuts")); |
242 |
|
|
188 |
– |
//book a directory in the output file with the name of the channel |
189 |
– |
TFileDirectory subDir = fs_->mkdir( channelName ); |
190 |
– |
directories.push_back(subDir); |
243 |
|
|
244 |
< |
std::map<std::string, TH1D*> oneDhistoMap; |
245 |
< |
oneDHists_.push_back(oneDhistoMap); |
246 |
< |
std::map<std::string, TH2D*> twoDhistoMap; |
247 |
< |
twoDHists_.push_back(twoDhistoMap); |
244 |
> |
//loop over and parse all cuts |
245 |
> |
for(uint currentCut = 0; currentCut != cuts_.size(); currentCut++){ |
246 |
> |
cut tempCut; |
247 |
> |
//store input collection for cut |
248 |
> |
string tempInputCollection = cuts_.at(currentCut).getParameter<string> ("inputCollection"); |
249 |
> |
if(tempInputCollection == "muon-electron pairs") tempInputCollection = "electron-muon pairs"; |
250 |
> |
if(tempInputCollection == "jet-electron pairs") tempInputCollection = "electron-jet pairs"; |
251 |
> |
if(tempInputCollection == "jet-muon pairs") tempInputCollection = "muon-jet pairs"; |
252 |
> |
if(tempInputCollection == "event-track pairs") tempInputCollection = "track-event pairs"; |
253 |
> |
if(tempInputCollection == "secondary muon-muon pairs") tempInputCollection = "muon-secondary muon pairs"; |
254 |
> |
if(tempInputCollection == "secondary electron-electron pairs") tempInputCollection = "electron-secondary electron pairs"; |
255 |
> |
if(tempInputCollection == "trigobj-electron pairs") tempInputCollection = "electron-trigobj pairs"; |
256 |
> |
if(tempInputCollection == "trigobj-muon pairs") tempInputCollection = "muon-trigobj pairs"; |
257 |
> |
tempCut.inputCollection = tempInputCollection; |
258 |
> |
if(tempInputCollection.find("pairs")==string::npos){ //just a single object |
259 |
> |
if(tempInputCollection.find("secondary")!=string::npos){//secondary object |
260 |
> |
int spaceIndex = tempInputCollection.find(" "); |
261 |
> |
int secondWordLength = tempInputCollection.size() - spaceIndex; |
262 |
> |
objectsToGet.push_back(tempInputCollection.substr(spaceIndex+1,secondWordLength)); |
263 |
> |
} |
264 |
> |
else{ |
265 |
> |
objectsToGet.push_back(tempInputCollection); |
266 |
> |
} |
267 |
> |
objectsToCut.push_back(tempInputCollection); |
268 |
> |
} |
269 |
> |
else{//pair of objects, need to add them both to objectsToGet |
270 |
> |
string obj1; |
271 |
> |
string obj2; |
272 |
> |
getTwoObjs(tempInputCollection, obj1, obj2); |
273 |
> |
string obj2ToGet = getObjToGet(obj2); |
274 |
> |
objectsToCut.push_back(tempInputCollection); |
275 |
> |
objectsToCut.push_back(obj1); |
276 |
> |
objectsToCut.push_back(obj2); |
277 |
> |
objectsToGet.push_back(tempInputCollection); |
278 |
> |
objectsToGet.push_back(obj1); |
279 |
> |
objectsToGet.push_back(obj2ToGet); |
280 |
> |
|
281 |
> |
} |
282 |
> |
|
283 |
> |
|
284 |
> |
|
285 |
> |
//split cut string into parts and store them |
286 |
> |
string cutString = cuts_.at(currentCut).getParameter<string> ("cutString"); |
287 |
> |
vector<string> cutStringVector = splitString(cutString); |
288 |
> |
if(cutStringVector.size()!=3 && cutStringVector.size() % 4 !=3){ |
289 |
> |
cout << "Error: Didn't find the expected number elements in the following cut string: '" << cutString << "'\n"; |
290 |
> |
exit(0); |
291 |
> |
} |
292 |
> |
tempCut.numSubcuts = (cutStringVector.size()+1)/4; |
293 |
> |
for(int subcutIndex = 0; subcutIndex != tempCut.numSubcuts; subcutIndex++){//loop over all the pieces of the cut combined using &,| |
294 |
> |
int indexOffset = 4 * subcutIndex; |
295 |
> |
string currentVariableString = cutStringVector.at(indexOffset); |
296 |
> |
if(currentVariableString.find("(")==string::npos){ |
297 |
> |
tempCut.functions.push_back("");//no function was specified |
298 |
> |
tempCut.variables.push_back(currentVariableString);// variable to cut on |
299 |
> |
} |
300 |
> |
else{ |
301 |
> |
tempCut.functions.push_back(currentVariableString.substr(0,currentVariableString.find("(")));//function comes before the "(" |
302 |
> |
string tempVariable = currentVariableString.substr(currentVariableString.find("(")+1);//get rest of string |
303 |
> |
tempCut.variables.push_back(tempVariable.substr(0,tempVariable.size()-1));//remove trailing ")" |
304 |
> |
} |
305 |
> |
tempCut.comparativeOperators.push_back(cutStringVector.at(indexOffset+1));// comparison to make |
306 |
> |
tempCut.cutValues.push_back(atof(cutStringVector.at(indexOffset+2).c_str()));// threshold value to pass cut |
307 |
> |
tempCut.cutStringValues.push_back(cutStringVector.at(indexOffset+2));// string value to pass cut |
308 |
> |
if(subcutIndex != 0) tempCut.logicalOperators.push_back(cutStringVector.at(indexOffset-1)); // logical comparison (and, or) |
309 |
> |
} |
310 |
> |
|
311 |
> |
//get number of objects required to pass cut for event to pass |
312 |
> |
string numberRequiredString = cuts_.at(currentCut).getParameter<string> ("numberRequired"); |
313 |
> |
vector<string> numberRequiredVector = splitString(numberRequiredString); |
314 |
> |
if(numberRequiredVector.size()!=2){ |
315 |
> |
cout << "Error: Didn't find two elements in the following number requirement string: '" << numberRequiredString << "'\n"; |
316 |
> |
exit(0); |
317 |
> |
} |
318 |
> |
|
319 |
> |
int numberRequiredInt = atoi(numberRequiredVector.at(1).c_str()); |
320 |
> |
tempCut.numberRequired = numberRequiredInt;// number of objects required to pass the cut |
321 |
> |
tempCut.eventComparativeOperator = numberRequiredVector.at(0);// comparison to make |
322 |
|
|
323 |
+ |
//Set up vectors to store the directories and subDIrectories for each channel. |
324 |
+ |
string subSubDirName; |
325 |
+ |
string tempCutName; |
326 |
+ |
if(cuts_.at(currentCut).exists("alias")){ |
327 |
+ |
tempCutName = cuts_.at(currentCut).getParameter<string> ("alias"); |
328 |
+ |
subSubDirName = "After " + cuts_.at(currentCut).getParameter<string> ("alias") + " Cut Applied"; |
329 |
+ |
} |
330 |
+ |
else{ |
331 |
+ |
//construct string for cutflow table |
332 |
+ |
bool plural = numberRequiredInt != 1; |
333 |
+ |
string collectionString = plural ? tempInputCollection : tempInputCollection.substr(0, tempInputCollection.size()-1); |
334 |
+ |
string cutName = numberRequiredString + " " + collectionString + " with " + cutString; |
335 |
+ |
tempCutName = cutName; |
336 |
+ |
subSubDirName = "After " + numberRequiredString + " " + collectionString + " with " + cutString + " Cut Applied"; |
337 |
+ |
} |
338 |
|
|
339 |
+ |
subSubDirNames.push_back(subSubDirName); |
340 |
+ |
tempCut.name = tempCutName; |
341 |
+ |
|
342 |
+ |
tempChannel.cuts.push_back(tempCut); |
343 |
|
|
344 |
+ |
|
345 |
+ |
}//end loop over cuts |
346 |
+ |
|
347 |
+ |
vector<map<string, TH1D*>> oneDHistsTmp; |
348 |
+ |
vector<map<string, TH2D*>> twoDHistsTmp; |
349 |
+ |
//book a directory in the output file with the name of the channel |
350 |
+ |
TFileDirectory subDir = fs_->mkdir( channelName ); |
351 |
+ |
//loop over the cuts to set up subdirectory for each cut if GetPlotsAfterEachCut_ is true. |
352 |
+ |
if(GetPlotsAfterEachCut_){ |
353 |
+ |
for( uint currentDir=0; currentDir != subSubDirNames.size(); currentDir++){ |
354 |
+ |
TFileDirectory subSubDir = subDir.mkdir( subSubDirNames[currentDir] ); |
355 |
+ |
directories.push_back(subSubDir); |
356 |
+ |
map<string, TH1D*> oneDhistoMap; |
357 |
+ |
oneDHistsTmp.push_back(oneDhistoMap); |
358 |
+ |
map<string, TH2D*> twoDhistoMap; |
359 |
+ |
twoDHistsTmp.push_back(twoDhistoMap); |
360 |
+ |
} |
361 |
+ |
oneDHists_.push_back(oneDHistsTmp); |
362 |
+ |
twoDHists_.push_back(twoDHistsTmp); |
363 |
+ |
} |
364 |
+ |
//only set up directories with names of the channels if GetPlotsAfterEachCut_ is false. |
365 |
+ |
else{ |
366 |
+ |
map<string, TH1D*> oneDhistoMap; |
367 |
+ |
oneDHistsTmp.push_back(oneDhistoMap); |
368 |
+ |
map<string, TH2D*> twoDhistoMap; |
369 |
+ |
twoDHistsTmp.push_back(twoDhistoMap); |
370 |
+ |
oneDHists_.push_back(oneDHistsTmp); |
371 |
+ |
twoDHists_.push_back(twoDHistsTmp); |
372 |
+ |
directories.push_back(subDir); |
373 |
+ |
} |
374 |
|
//book all histograms included in the configuration |
375 |
+ |
for(uint currentDir = 0; currentDir != directories.size(); currentDir++){//loop over all the directories. |
376 |
|
for(uint currentHistogramIndex = 0; currentHistogramIndex != histograms.size(); currentHistogramIndex++){ |
377 |
|
histogram currentHistogram = histograms.at(currentHistogramIndex); |
378 |
|
int numBinsElements = currentHistogram.bins.size(); |
379 |
|
int numInputVariables = currentHistogram.inputVariables.size(); |
380 |
+ |
int numBinEdgesX = currentHistogram.variableBinsX.size(); |
381 |
+ |
int numBinEdgesY = currentHistogram.variableBinsY.size(); |
382 |
|
|
383 |
< |
if(numBinsElements != 3 && numBinsElements !=6) { |
384 |
< |
std::cout << "Error: Didn't find correct number of bin specifications for histogram named '" << currentHistogram.name << "'\n"; |
383 |
> |
if(numBinsElements == 1){ |
384 |
> |
if(numBinEdgesX > 1){ |
385 |
> |
if(numBinEdgesY > 1) |
386 |
> |
numBinsElements = 6; |
387 |
> |
else |
388 |
> |
numBinsElements = 3; |
389 |
> |
} |
390 |
> |
} |
391 |
> |
if(numBinsElements != 3 && numBinsElements !=6){ |
392 |
> |
cout << "Error: Didn't find correct number of bin specifications for histogram named '" << currentHistogram.name << "'\n"; |
393 |
|
exit(0); |
394 |
|
} |
395 |
|
else if((numBinsElements == 3 && numInputVariables !=1) || (numBinsElements == 6 && numInputVariables!=2)){ |
396 |
< |
std::cout << "Error: Didn't find correct number of input variables for histogram named '" << currentHistogram.name << "'\n"; |
396 |
> |
cout << "Error: Didn't find correct number of input variables for histogram named '" << currentHistogram.name << "'\n"; |
397 |
|
exit(0); |
398 |
|
} |
399 |
|
else if(numBinsElements == 3){ |
400 |
< |
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)); |
400 |
> |
if (currentHistogram.bins.size () == 3) |
401 |
> |
oneDHists_.at(currentChannel).at(currentDir)[currentHistogram.name] = directories.at(currentDir).make<TH1D> (TString(currentHistogram.name),channelLabel+" channel: "+currentHistogram.title, currentHistogram.bins.at(0), currentHistogram.bins.at(1), currentHistogram.bins.at(2)); |
402 |
> |
else |
403 |
> |
{ |
404 |
> |
oneDHists_.at(currentChannel).at(currentDir)[currentHistogram.name] = directories.at(currentDir).make<TH1D> (TString(currentHistogram.name),channelLabel+" channel: "+currentHistogram.title, numBinEdgesX - 1, currentHistogram.variableBinsX.data ()); |
405 |
> |
} |
406 |
|
} |
407 |
|
else if(numBinsElements == 6){ |
408 |
< |
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)); |
409 |
< |
|
408 |
> |
if (currentHistogram.bins.size () == 6) |
409 |
> |
twoDHists_.at(currentChannel).at(currentDir)[currentHistogram.name] = directories.at(currentDir).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)); |
410 |
> |
else |
411 |
> |
twoDHists_.at(currentChannel).at(currentDir)[currentHistogram.name] = directories.at(currentDir).make<TH2D> (TString(currentHistogram.name),channelLabel+" channel: "+currentHistogram.title, numBinEdgesX - 1, currentHistogram.variableBinsX.data (), numBinEdgesY - 1, currentHistogram.variableBinsY.data ()); |
412 |
|
} |
413 |
|
|
414 |
|
|
415 |
< |
if(currentHistogram.name.find("GenMatch")==std::string::npos) continue; |
415 |
> |
if(currentHistogram.name.find("GenMatch")==string::npos) continue; |
416 |
|
|
417 |
< |
// bin particle type |
418 |
< |
// --- ------------- |
419 |
< |
// 0 unmatched |
420 |
< |
// 1 u |
421 |
< |
// 2 d |
422 |
< |
// 3 s |
423 |
< |
// 4 c |
424 |
< |
// 5 b |
425 |
< |
// 6 t |
426 |
< |
// 7 e |
427 |
< |
// 8 mu |
428 |
< |
// 9 tau |
429 |
< |
// 10 nu |
430 |
< |
// 11 g |
431 |
< |
// 12 gamma |
432 |
< |
// 13 Z |
433 |
< |
// 14 W |
434 |
< |
// 15 light meson |
435 |
< |
// 16 K meson |
436 |
< |
// 17 D meson |
437 |
< |
// 18 B meson |
438 |
< |
// 19 light baryon |
439 |
< |
// 20 strange baryon |
440 |
< |
// 21 charm baryon |
441 |
< |
// 22 bottom baryon |
442 |
< |
// 23 other |
417 |
> |
// bin particle type |
418 |
> |
// --- ------------- |
419 |
> |
// 0 unmatched |
420 |
> |
// 1 u |
421 |
> |
// 2 d |
422 |
> |
// 3 s |
423 |
> |
// 4 c |
424 |
> |
// 5 b |
425 |
> |
// 6 t |
426 |
> |
// 7 e |
427 |
> |
// 8 mu |
428 |
> |
// 9 tau |
429 |
> |
// 10 nu |
430 |
> |
// 11 g |
431 |
> |
// 12 gamma |
432 |
> |
// 13 Z |
433 |
> |
// 14 W |
434 |
> |
// 15 light meson |
435 |
> |
// 16 K meson |
436 |
> |
// 17 D meson |
437 |
> |
// 18 B meson |
438 |
> |
// 19 light baryon |
439 |
> |
// 20 strange baryon |
440 |
> |
// 21 charm baryon |
441 |
> |
// 22 bottom baryon |
442 |
> |
// 23 QCD string |
443 |
> |
// 24 other |
444 |
|
|
445 |
|
vector<TString> labelArray; |
446 |
|
labelArray.push_back("unmatched"); |
466 |
|
labelArray.push_back("strange baryon"); |
467 |
|
labelArray.push_back("charm baryon"); |
468 |
|
labelArray.push_back("bottom baryon"); |
469 |
+ |
labelArray.push_back("QCD string"); |
470 |
|
labelArray.push_back("other"); |
471 |
|
|
472 |
|
for(int bin = 0; bin !=currentHistogram.bins.at(0); bin++){ |
473 |
< |
if(currentHistogram.name.find("GenMatchIdVsMotherId")==std::string::npos) { |
474 |
< |
oneDHists_.at(currentChannel)[currentHistogram.name]->GetXaxis()->SetBinLabel(bin+1,labelArray.at(bin)); |
475 |
< |
} |
476 |
< |
else { |
477 |
< |
twoDHists_.at(currentChannel)[currentHistogram.name]->GetYaxis()->SetBinLabel(bin+1,labelArray.at(currentHistogram.bins.at(0)-bin-1)); |
478 |
< |
twoDHists_.at(currentChannel)[currentHistogram.name]->GetXaxis()->SetBinLabel(bin+1,labelArray.at(bin)); |
479 |
< |
} |
473 |
> |
if(currentHistogram.name.find("GenMatchIdVsMotherId")==string::npos && currentHistogram.name.find("GenMatchIdVsGrandmotherId")==string::npos) { |
474 |
> |
oneDHists_.at(currentChannel).at(currentDir)[currentHistogram.name]->GetXaxis()->SetBinLabel(bin+1,labelArray.at(bin)); |
475 |
> |
} |
476 |
> |
else { |
477 |
> |
twoDHists_.at(currentChannel).at(currentDir)[currentHistogram.name]->GetYaxis()->SetBinLabel(bin+1,labelArray.at(currentHistogram.bins.at(0)-bin-1)); |
478 |
> |
twoDHists_.at(currentChannel).at(currentDir)[currentHistogram.name]->GetXaxis()->SetBinLabel(bin+1,labelArray.at(bin)); |
479 |
> |
} |
480 |
|
} |
481 |
< |
if(currentHistogram.name.find("GenMatchIdVsMotherId")!=std::string::npos) { |
482 |
< |
twoDHists_.at(currentChannel)[currentHistogram.name]->GetXaxis()->CenterTitle(); |
483 |
< |
twoDHists_.at(currentChannel)[currentHistogram.name]->GetYaxis()->CenterTitle(); |
481 |
> |
if(currentHistogram.name.find("GenMatchIdVsMotherId")!=string::npos || currentHistogram.name.find("GenMatchIdVsGrandmotherId")!=string::npos) { |
482 |
> |
twoDHists_.at(currentChannel).at(currentDir)[currentHistogram.name]->GetXaxis()->CenterTitle(); |
483 |
> |
twoDHists_.at(currentChannel).at(currentDir)[currentHistogram.name]->GetYaxis()->CenterTitle(); |
484 |
|
} |
485 |
|
|
486 |
|
} |
487 |
|
|
488 |
< |
//book a histogram for the number of each object type to be plotted |
489 |
< |
|
488 |
> |
// Book a histogram for the number of each object type to be plotted. |
489 |
> |
// Name of objectToPlot here must match the name specified in OSUAnalysis::analyze(). |
490 |
|
for (uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){ |
491 |
|
string currentObject = objectsToPlot.at(currentObjectIndex); |
492 |
|
int maxNum = 10; |
493 |
|
if(currentObject == "mcparticles") maxNum = 50; |
494 |
|
else if(currentObject == "primaryvertexs") maxNum = 50; |
495 |
< |
else if(currentObject == "muon-muon pairs") currentObject = "dimuonPairs"; |
496 |
< |
else if(currentObject == "electron-electron pairs") currentObject = "dielectronPairs"; |
497 |
< |
else if(currentObject == "electron-muon pairs") currentObject = "electronMuonPairs"; |
495 |
> |
|
496 |
> |
if(currentObject == "muon-muon pairs") currentObject = "dimuonPairs"; |
497 |
> |
else if(currentObject == "electron-electron pairs") currentObject = "dielectronPairs"; |
498 |
> |
else if(currentObject == "electron-muon pairs") currentObject = "electronMuonPairs"; |
499 |
> |
else if(currentObject == "secondary jets") currentObject = "secondaryJets"; |
500 |
> |
else if(currentObject == "jet-jet pairs") currentObject = "dijetPairs"; |
501 |
> |
else if(currentObject == "electron-jet pairs") currentObject = "electronJetPairs"; |
502 |
> |
else if(currentObject == "muon-jet pairs") currentObject = "muonJetPairs"; |
503 |
> |
else if(currentObject == "track-event pairs") currentObject = "trackEventPairs"; |
504 |
> |
else if(currentObject == "electron-track pairs") currentObject = "electronTrackPairs"; |
505 |
> |
else if(currentObject == "muon-track pairs") currentObject = "muonTrackPairs"; |
506 |
> |
else if(currentObject == "muon-tau pairs") currentObject = "muonTauPairs"; |
507 |
> |
else if(currentObject == "tau-tau pairs") currentObject = "ditauPairs"; |
508 |
> |
else if(currentObject == "tau-track pairs") currentObject = "tauTrackPairs"; |
509 |
> |
else if(currentObject == "muon-secondary muon pairs") currentObject = "muonSecondaryMuonPairs"; |
510 |
> |
else if(currentObject == "secondary muons") currentObject = "secondaryMuons"; |
511 |
> |
else if(currentObject == "electron-secondary electron pairs") currentObject = "electronSecondaryElectronPairs"; |
512 |
> |
else if(currentObject == "secondary electrons") currentObject = "secondaryElectrons"; |
513 |
> |
else if(currentObject == "electron-trigobj pairs") currentObject = "electronTrigobjPairs"; |
514 |
> |
else if(currentObject == "muon-trigobj pairs") currentObject = "muonTrigobjPairs"; |
515 |
|
|
516 |
|
currentObject.at(0) = toupper(currentObject.at(0)); |
517 |
|
string histoName = "num" + currentObject; |
518 |
|
|
519 |
|
if(histoName == "numPrimaryvertexs"){ |
520 |
|
string newHistoName = histoName + "BeforePileupCorrection"; |
521 |
< |
oneDHists_.at(currentChannel)[newHistoName] = directories.at(currentChannel).make<TH1D> (TString(newHistoName),channelLabel+" channel: Number of Selected "+currentObject+" Before Pileup Correction; # "+currentObject, maxNum, 0, maxNum); |
521 |
> |
oneDHists_.at(currentChannel).at(currentDir)[newHistoName] = directories.at(currentDir).make<TH1D> (TString(newHistoName),channelLabel+" channel: Number of Selected "+currentObject+" Before Pileup Correction; # "+currentObject, maxNum, 0, maxNum); |
522 |
|
newHistoName = histoName + "AfterPileupCorrection"; |
523 |
< |
oneDHists_.at(currentChannel)[newHistoName] = directories.at(currentChannel).make<TH1D> (TString(newHistoName),channelLabel+" channel: Number of Selected "+currentObject+ " After Pileup Correction; # "+currentObject, maxNum, 0, maxNum); |
523 |
> |
oneDHists_.at(currentChannel).at(currentDir)[newHistoName] = directories.at(currentDir).make<TH1D> (TString(newHistoName),channelLabel+" channel: Number of Selected "+currentObject+ " After Pileup Correction; # "+currentObject, maxNum, 0, maxNum); |
524 |
|
} |
525 |
|
else |
526 |
< |
oneDHists_.at(currentChannel)[histoName] = directories.at(currentChannel).make<TH1D> (TString(histoName),channelLabel+" channel: Number of Selected "+currentObject+"; # "+currentObject, maxNum, 0, maxNum); |
526 |
> |
oneDHists_.at(currentChannel).at(currentDir)[histoName] = directories.at(currentDir).make<TH1D> (TString(histoName),channelLabel+" channel: Number of Selected "+currentObject+"; # "+currentObject, maxNum, 0, maxNum); |
527 |
|
} |
528 |
< |
|
317 |
< |
|
318 |
< |
|
319 |
< |
|
320 |
< |
//get list of cuts for this channel |
321 |
< |
vector<edm::ParameterSet> cuts_ (channels_.at(currentChannel).getParameter<vector<edm::ParameterSet> >("cuts")); |
322 |
< |
|
323 |
< |
//loop over and parse all cuts |
324 |
< |
for(uint currentCut = 0; currentCut != cuts_.size(); currentCut++){ |
325 |
< |
cut tempCut; |
326 |
< |
//store input collection for cut |
327 |
< |
string tempInputCollection = cuts_.at(currentCut).getParameter<string> ("inputCollection"); |
328 |
< |
tempCut.inputCollection = tempInputCollection; |
329 |
< |
if(tempInputCollection.find("pairs")==std::string::npos){ //just a single object |
330 |
< |
objectsToGet.push_back(tempInputCollection); |
331 |
< |
objectsToCut.push_back(tempInputCollection); |
332 |
< |
} |
333 |
< |
else{//pair of objects, need to add them both to the things to objectsToGet |
334 |
< |
int dashIndex = tempInputCollection.find("-"); |
335 |
< |
int spaceIndex = tempInputCollection.find(" "); |
336 |
< |
int secondWordLength = spaceIndex - dashIndex; |
337 |
< |
objectsToGet.push_back(tempInputCollection); |
338 |
< |
objectsToGet.push_back(tempInputCollection.substr(0,dashIndex)+"s"); |
339 |
< |
objectsToGet.push_back(tempInputCollection.substr(dashIndex+1,secondWordLength-1)+"s"); |
340 |
< |
objectsToCut.push_back(tempInputCollection); |
341 |
< |
objectsToCut.push_back(tempInputCollection.substr(0,dashIndex)+"s"); |
342 |
< |
objectsToCut.push_back(tempInputCollection.substr(dashIndex+1,secondWordLength-1)+"s"); |
343 |
< |
|
344 |
< |
} |
345 |
< |
|
346 |
< |
|
347 |
< |
|
348 |
< |
//split cut string into parts and store them |
349 |
< |
string cutString = cuts_.at(currentCut).getParameter<string> ("cutString"); |
350 |
< |
std::vector<string> cutStringVector = splitString(cutString); |
351 |
< |
if(cutStringVector.size()!=3 && cutStringVector.size() % 4 !=3){ |
352 |
< |
std::cout << "Error: Didn't find the expected number elements in the following cut string: '" << cutString << "'\n"; |
353 |
< |
exit(0); |
354 |
< |
} |
355 |
< |
tempCut.numSubcuts = (cutStringVector.size()+1)/4; |
356 |
< |
for(int subcutIndex = 0; subcutIndex != tempCut.numSubcuts; subcutIndex++){//loop over all the pieces of the cut combined using &,| |
357 |
< |
int indexOffset = 4 * subcutIndex; |
358 |
< |
string currentVariableString = cutStringVector.at(indexOffset); |
359 |
< |
if(currentVariableString.find("(")==std::string::npos){ |
360 |
< |
tempCut.functions.push_back("");//no function was specified |
361 |
< |
tempCut.variables.push_back(currentVariableString);// variable to cut on |
362 |
< |
} |
363 |
< |
else{ |
364 |
< |
tempCut.functions.push_back(currentVariableString.substr(0,currentVariableString.find("(")));//function comes before the "(" |
365 |
< |
string tempVariable = currentVariableString.substr(currentVariableString.find("(")+1);//get rest of string |
366 |
< |
tempCut.variables.push_back(tempVariable.substr(0,tempVariable.size()-1));//remove trailing ")" |
367 |
< |
} |
368 |
< |
tempCut.comparativeOperators.push_back(cutStringVector.at(indexOffset+1));// comparison to make |
369 |
< |
tempCut.cutValues.push_back(atof(cutStringVector.at(indexOffset+2).c_str()));// threshold value to pass cut |
370 |
< |
if(subcutIndex != 0) tempCut.logicalOperators.push_back(cutStringVector.at(indexOffset-1)); // logical comparison (and, or) |
371 |
< |
} |
372 |
< |
|
373 |
< |
//get number of objects required to pass cut for event to pass |
374 |
< |
string numberRequiredString = cuts_.at(currentCut).getParameter<string> ("numberRequired"); |
375 |
< |
std::vector<string> numberRequiredVector = splitString(numberRequiredString); |
376 |
< |
if(numberRequiredVector.size()!=2){ |
377 |
< |
std::cout << "Error: Didn't find two elements in the following number requirement string: '" << numberRequiredString << "'\n"; |
378 |
< |
exit(0); |
379 |
< |
} |
380 |
< |
|
381 |
< |
int numberRequiredInt = atoi(numberRequiredVector.at(1).c_str()); |
382 |
< |
tempCut.numberRequired = numberRequiredInt;// number of objects required to pass the cut |
383 |
< |
tempCut.eventComparativeOperator = numberRequiredVector.at(0);// comparison to make |
384 |
< |
|
385 |
< |
|
386 |
< |
string tempCutName; |
387 |
< |
if(cuts_.at(currentCut).exists("alias")){ |
388 |
< |
tempCutName = cuts_.at(currentCut).getParameter<string> ("alias"); |
389 |
< |
} |
390 |
< |
else{ |
391 |
< |
//construct string for cutflow table |
392 |
< |
bool plural = numberRequiredInt != 1; |
393 |
< |
string collectionString = plural ? tempInputCollection : tempInputCollection.substr(0, tempInputCollection.size()-1); |
394 |
< |
string cutName = numberRequiredString + " " + collectionString + " with " + cutString; |
395 |
< |
tempCutName = cutName; |
396 |
< |
} |
397 |
< |
tempCut.name = tempCutName; |
398 |
< |
|
399 |
< |
|
400 |
< |
tempChannel.cuts.push_back(tempCut); |
401 |
< |
|
402 |
< |
|
403 |
< |
|
404 |
< |
}//end loop over cuts |
405 |
< |
|
528 |
> |
}//end of loop over directories |
529 |
|
channels.push_back(tempChannel); |
530 |
|
tempChannel.cuts.clear(); |
408 |
– |
|
531 |
|
}//end loop over channels |
532 |
|
|
533 |
|
|
556 |
|
|
557 |
|
// Retrieve necessary collections from the event. |
558 |
|
|
559 |
< |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "triggers") != objectsToGet.end()) |
559 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "triggers") != objectsToGet.end()) |
560 |
|
event.getByLabel (triggers_, triggers); |
561 |
|
|
562 |
< |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "jets") != objectsToGet.end()) |
562 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "trigobjs") != objectsToGet.end()) |
563 |
> |
event.getByLabel (trigobjs_, trigobjs); |
564 |
> |
|
565 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "jets") != objectsToGet.end()) |
566 |
|
event.getByLabel (jets_, jets); |
567 |
|
|
568 |
< |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "muons") != objectsToGet.end()) |
568 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "muons") != objectsToGet.end()) |
569 |
|
event.getByLabel (muons_, muons); |
570 |
|
|
571 |
< |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "electrons") != objectsToGet.end()) |
571 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "electrons") != objectsToGet.end()) |
572 |
|
event.getByLabel (electrons_, electrons); |
573 |
|
|
574 |
< |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "events") != objectsToGet.end()) |
574 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "events") != objectsToGet.end()) |
575 |
|
event.getByLabel (events_, events); |
576 |
|
|
577 |
< |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "taus") != objectsToGet.end()) |
577 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "taus") != objectsToGet.end()) |
578 |
|
event.getByLabel (taus_, taus); |
579 |
|
|
580 |
< |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "mets") != objectsToGet.end()) |
580 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "mets") != objectsToGet.end()) |
581 |
|
event.getByLabel (mets_, mets); |
582 |
|
|
583 |
< |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "tracks") != objectsToGet.end()) |
583 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "tracks") != objectsToGet.end()) |
584 |
|
event.getByLabel (tracks_, tracks); |
585 |
|
|
586 |
< |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "genjets") != objectsToGet.end()) |
586 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "genjets") != objectsToGet.end()) |
587 |
|
event.getByLabel (genjets_, genjets); |
588 |
|
|
589 |
< |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "mcparticles") != objectsToGet.end()) |
589 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "mcparticles") != objectsToGet.end()) |
590 |
|
event.getByLabel (mcparticles_, mcparticles); |
591 |
|
|
592 |
< |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "primaryvertexs") != objectsToGet.end()) |
592 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "primaryvertexs") != objectsToGet.end()) |
593 |
|
event.getByLabel (primaryvertexs_, primaryvertexs); |
594 |
|
|
595 |
< |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "bxlumis") != objectsToGet.end()) |
595 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "bxlumis") != objectsToGet.end()) |
596 |
|
event.getByLabel (bxlumis_, bxlumis); |
597 |
|
|
598 |
< |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "photons") != objectsToGet.end()) |
598 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "photons") != objectsToGet.end()) |
599 |
|
event.getByLabel (photons_, photons); |
600 |
|
|
601 |
< |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "superclusters") != objectsToGet.end()) |
601 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "superclusters") != objectsToGet.end()) |
602 |
|
event.getByLabel (superclusters_, superclusters); |
603 |
|
|
604 |
+ |
if (datasetType_ == "signalMC"){ |
605 |
+ |
if (find(objectsToGet.begin(), objectsToGet.end(), "stops") != objectsToGet.end()) |
606 |
+ |
event.getByLabel (stops_, stops); |
607 |
+ |
} |
608 |
+ |
|
609 |
+ |
if (useTrackCaloRhoCorr_) { |
610 |
+ |
// Used only for pile-up correction of by-hand calculation of isolation energy. |
611 |
+ |
// This rho collection is not available in all BEANs. |
612 |
+ |
// For description of rho values for different jet reconstruction algorithms, see |
613 |
+ |
// https://twiki.cern.ch/twiki/bin/view/CMS/JetAlgorithms#Algorithms |
614 |
+ |
event.getByLabel ("kt6CaloJets","rho", rhokt6CaloJetsHandle_); |
615 |
+ |
} |
616 |
+ |
|
617 |
+ |
double masterScaleFactor = 1.0; |
618 |
+ |
|
619 |
|
//get pile-up event weight |
620 |
< |
double scaleFactor = 1.00; |
621 |
< |
if(doPileupReweighting_ && datasetType_ != "data") |
622 |
< |
scaleFactor = puWeight_->at (events->at (0).numTruePV); |
620 |
> |
if (doPileupReweighting_ && datasetType_ != "data") { |
621 |
> |
//for "data" datasets, the numTruePV is always set to -1 |
622 |
> |
if (events->at(0).numTruePV < 0) cout << "WARNING[OSUAnalysis::analyze]: Event has numTruePV<0. Turning off pile-up reweighting." << endl; |
623 |
> |
else masterScaleFactor *= puWeight_->at (events->at (0).numTruePV); |
624 |
> |
} |
625 |
|
|
626 |
+ |
stopCTauScaleFactor_ = 1.0; |
627 |
+ |
if (datasetType_ == "signalMC" && regex_match (dataset_, regex ("stop.*to.*_.*mm.*"))) |
628 |
+ |
stopCTauScaleFactor_ = stopCTauWeight_->at (event); |
629 |
+ |
masterScaleFactor *= stopCTauScaleFactor_; |
630 |
|
|
631 |
|
//loop over all channels |
632 |
|
|
638 |
|
cumulativeFlags.clear (); |
639 |
|
|
640 |
|
bool triggerDecision = true; |
641 |
< |
if(currentChannel.triggers.size() != 0){ //triggers specified |
642 |
< |
triggerDecision = evaluateTriggers(currentChannel.triggers,triggers.product()); |
641 |
> |
if(currentChannel.triggers.size() != 0 || currentChannel.triggersToVeto.size() != 0){ //triggers specified |
642 |
> |
triggerDecision = evaluateTriggers(currentChannel.triggers, currentChannel.triggersToVeto, triggers.product()); |
643 |
|
cutFlows_.at(currentChannelIndex)->at ("trigger") = triggerDecision; |
644 |
|
} |
645 |
|
|
646 |
|
//loop over all cuts |
501 |
– |
|
502 |
– |
|
503 |
– |
|
647 |
|
for(uint currentCutIndex = 0; currentCutIndex != currentChannel.cuts.size(); currentCutIndex++){ |
648 |
|
cut currentCut = currentChannel.cuts.at(currentCutIndex); |
506 |
– |
|
649 |
|
for(uint currentObjectIndex = 0; currentObjectIndex != objectsToCut.size(); currentObjectIndex++){ |
650 |
|
string currentObject = objectsToCut.at(currentObjectIndex); |
651 |
|
|
660 |
|
int flagsForPairCutsIndex = max(int(currentCutIndex-1),0); |
661 |
|
|
662 |
|
|
663 |
< |
if(currentObject == "jets") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,jets.product(),"jets"); |
664 |
< |
else if(currentObject == "muons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),"muons"); |
663 |
> |
if (currentObject == "jets") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,jets.product(),"jets"); |
664 |
> |
else if(currentObject == "secondary jets") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,jets.product(),"secondary jets"); |
665 |
> |
else if(currentObject == "muons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),"muons"); |
666 |
> |
else if(currentObject == "secondary muons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),"secondary muons"); |
667 |
> |
else if(currentObject == "secondary electrons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),"secondary electrons"); |
668 |
|
else if(currentObject == "electrons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),"electrons"); |
669 |
|
else if(currentObject == "events") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,events.product(),"events"); |
670 |
|
else if(currentObject == "taus") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,taus.product(),"taus"); |
676 |
|
else if(currentObject == "bxlumis") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,bxlumis.product(),"bxlumis"); |
677 |
|
else if(currentObject == "photons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,photons.product(),"photons"); |
678 |
|
else if(currentObject == "superclusters") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,superclusters.product(),"superclusters"); |
679 |
+ |
else if(currentObject == "trigobjs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,trigobjs.product(),"trigobjs"); |
680 |
+ |
|
681 |
|
|
682 |
|
|
683 |
|
else if(currentObject == "muon-muon pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),muons.product(), \ |
684 |
|
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
685 |
|
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
686 |
|
"muon-muon pairs"); |
687 |
+ |
|
688 |
+ |
else if(currentObject == "muon-secondary muon pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),muons.product(), \ |
689 |
+ |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
690 |
+ |
cumulativeFlags.at("secondary muons").at(flagsForPairCutsIndex), \ |
691 |
+ |
"muon-secondary muon pairs"); |
692 |
+ |
|
693 |
+ |
else if(currentObject == "electron-secondary electron pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),electrons.product(), \ |
694 |
+ |
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \ |
695 |
+ |
cumulativeFlags.at("secondary electrons").at(flagsForPairCutsIndex), \ |
696 |
+ |
"electron-secondary electron pairs"); |
697 |
+ |
|
698 |
|
else if(currentObject == "electron-electron pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),electrons.product(), \ |
699 |
|
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \ |
700 |
|
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \ |
703 |
|
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \ |
704 |
|
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
705 |
|
"electron-muon pairs"); |
706 |
+ |
else if(currentObject == "jet-jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,jets.product(),jets.product(), \ |
707 |
+ |
cumulativeFlags.at("jets").at(flagsForPairCutsIndex), \ |
708 |
+ |
cumulativeFlags.at("jets").at(flagsForPairCutsIndex), \ |
709 |
+ |
"jet-jet pairs"); |
710 |
+ |
else if(currentObject == "electron-jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),jets.product(), \ |
711 |
+ |
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \ |
712 |
+ |
cumulativeFlags.at("jets").at(flagsForPairCutsIndex), \ |
713 |
+ |
"electron-jet pairs"); |
714 |
+ |
else if(currentObject == "muon-jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),jets.product(), \ |
715 |
+ |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
716 |
+ |
cumulativeFlags.at("jets").at(flagsForPairCutsIndex), \ |
717 |
+ |
"muon-jet pairs"); |
718 |
+ |
else if(currentObject == "track-event pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,tracks.product(),events.product(), |
719 |
+ |
cumulativeFlags.at("tracks").at(flagsForPairCutsIndex), |
720 |
+ |
cumulativeFlags.at("events").at(flagsForPairCutsIndex), |
721 |
+ |
"track-event pairs"); |
722 |
+ |
else if(currentObject == "electron-track pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),tracks.product(), |
723 |
+ |
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), |
724 |
+ |
cumulativeFlags.at("tracks").at(flagsForPairCutsIndex), |
725 |
+ |
"electron-track pairs"); |
726 |
+ |
else if(currentObject == "muon-track pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),tracks.product(), |
727 |
+ |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), |
728 |
+ |
cumulativeFlags.at("tracks").at(flagsForPairCutsIndex), |
729 |
+ |
"muon-track pairs"); |
730 |
+ |
else if(currentObject == "muon-tau pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),taus.product(), |
731 |
+ |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), |
732 |
+ |
cumulativeFlags.at("taus").at(flagsForPairCutsIndex), |
733 |
+ |
"muon-tau pairs"); |
734 |
+ |
else if(currentObject == "tau-tau pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,taus.product(),taus.product(), |
735 |
+ |
cumulativeFlags.at("taus").at(flagsForPairCutsIndex), |
736 |
+ |
cumulativeFlags.at("taus").at(flagsForPairCutsIndex), |
737 |
+ |
"tau-tau pairs"); |
738 |
+ |
else if(currentObject == "tau-track pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,taus .product(),tracks.product(), |
739 |
+ |
cumulativeFlags.at("taus").at(flagsForPairCutsIndex), |
740 |
+ |
cumulativeFlags.at("tracks").at(flagsForPairCutsIndex), |
741 |
+ |
"tau-track pairs"); |
742 |
+ |
else if(currentObject == "electron-trigobj pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),trigobjs.product(), |
743 |
+ |
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), |
744 |
+ |
cumulativeFlags.at("trigobjs").at(flagsForPairCutsIndex), |
745 |
+ |
"electron-trigobj pairs"); |
746 |
+ |
else if(currentObject == "muon-trigobj pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),trigobjs.product(), |
747 |
+ |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), |
748 |
+ |
cumulativeFlags.at("trigobjs").at(flagsForPairCutsIndex), |
749 |
+ |
"muon-trigobj pairs"); |
750 |
|
|
751 |
< |
|
751 |
> |
if(currentObject == "stops" && datasetType_ == "signalMC") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,stops.product(),"stops"); |
752 |
|
} |
753 |
|
|
754 |
|
|
755 |
|
|
756 |
|
}//end loop over all cuts |
555 |
– |
|
556 |
– |
|
757 |
|
//use cumulative flags to apply cuts at event level |
758 |
|
|
759 |
|
bool eventPassedAllCuts = true; |
760 |
< |
|
760 |
> |
//a vector to store cumulative cut descisions after each cut. |
761 |
> |
vector<bool> eventPassedPreviousCuts; |
762 |
|
//apply trigger (true if none were specified) |
763 |
|
eventPassedAllCuts = eventPassedAllCuts && triggerDecision; |
764 |
|
|
765 |
|
|
565 |
– |
|
766 |
|
for(uint currentCutIndex = 0; currentCutIndex != currentChannel.cuts.size(); currentCutIndex++){ |
767 |
|
|
768 |
|
//loop over all objects and count how many passed the cumulative selection up to this point |
770 |
|
int numberPassing = 0; |
771 |
|
|
772 |
|
for (uint object = 0; object != cumulativeFlags.at(currentCut.inputCollection).at(currentCutIndex).size() ; object++){ |
773 |
< |
if(cumulativeFlags.at(currentCut.inputCollection).at(currentCutIndex).at(object)) numberPassing++; |
773 |
> |
if(cumulativeFlags.at(currentCut.inputCollection).at(currentCutIndex).at(object)) numberPassing++; |
774 |
|
} |
575 |
– |
|
775 |
|
bool cutDecision = evaluateComparison(numberPassing,currentCut.eventComparativeOperator,currentCut.numberRequired); |
776 |
|
cutFlows_.at(currentChannelIndex)->at (currentCut.name) = cutDecision; |
578 |
– |
|
777 |
|
eventPassedAllCuts = eventPassedAllCuts && cutDecision; |
778 |
+ |
eventPassedPreviousCuts.push_back(eventPassedAllCuts); |
779 |
+ |
} |
780 |
+ |
double scaleFactor = masterScaleFactor; |
781 |
|
|
782 |
+ |
muonScaleFactor_ = electronScaleFactor_ = 1.0; |
783 |
+ |
if(applyLeptonSF_ && datasetType_ != "data"){ |
784 |
+ |
if(cumulativeFlags.find ("muons") != cumulativeFlags.end ()){ |
785 |
+ |
vector<bool> muonFlags; |
786 |
+ |
for (int i = cumulativeFlags.at("muons").size() - 1; i >= 0; i--){ |
787 |
+ |
if (cumulativeFlags.at("muons").at(i).size()){ |
788 |
+ |
muonFlags = cumulativeFlags.at("muons").at(i); |
789 |
+ |
break; |
790 |
+ |
} |
791 |
+ |
} |
792 |
+ |
for (uint muonIndex = 0; muonIndex != muonFlags.size(); muonIndex++){ |
793 |
+ |
if(!muonFlags.at(muonIndex)) continue; |
794 |
+ |
muonScaleFactor_ *= muonSFWeight_->at (muons->at(muonIndex).eta); |
795 |
+ |
} |
796 |
+ |
} |
797 |
+ |
if(cumulativeFlags.find ("electrons") != cumulativeFlags.end ()){ |
798 |
+ |
vector<bool> electronFlags; |
799 |
+ |
for (int i = cumulativeFlags.at("electrons").size() - 1; i >= 0; i--){ |
800 |
+ |
if (cumulativeFlags.at("electrons").at(i).size()){ |
801 |
+ |
electronFlags = cumulativeFlags.at("electrons").at(i); |
802 |
+ |
break; |
803 |
+ |
} |
804 |
+ |
} |
805 |
+ |
for (uint electronIndex = 0; electronIndex != electronFlags.size(); electronIndex++){ |
806 |
+ |
if(!electronFlags.at(electronIndex)) continue; |
807 |
+ |
electronScaleFactor_ *= electronSFWeight_->at (electrons->at(electronIndex).eta, electrons->at(electronIndex).pt); |
808 |
+ |
} |
809 |
+ |
} |
810 |
|
} |
811 |
+ |
scaleFactor *= muonScaleFactor_; |
812 |
+ |
scaleFactor *= electronScaleFactor_; |
813 |
|
|
814 |
|
cutFlows_.at(currentChannelIndex)->fillCutFlow(scaleFactor); |
815 |
|
|
816 |
|
|
586 |
– |
|
587 |
– |
if(!eventPassedAllCuts)continue; |
588 |
– |
|
817 |
|
if (printEventInfo_) { |
818 |
< |
// Write information about event to screen, for testing purposes. |
819 |
< |
cout << "Event passed all cuts in channel " << currentChannel.name |
820 |
< |
<< ": run=" << events->at(0).run |
821 |
< |
<< " lumi=" << events->at(0).lumi |
822 |
< |
<< " event=" << events->at(0).evt |
823 |
< |
<< endl; |
818 |
> |
// Write information about event to screen, for testing purposes. |
819 |
> |
cout << "Event passed all cuts in channel " << currentChannel.name |
820 |
> |
<< ": run=" << events->at(0).run |
821 |
> |
<< " lumi=" << events->at(0).lumi |
822 |
> |
<< " event=" << events->at(0).evt |
823 |
> |
<< endl; |
824 |
|
} |
825 |
|
|
826 |
|
|
599 |
– |
// if(datasetType_ != "data") { |
600 |
– |
// scaleFactor *= muonSFWeight_->at (chosenMuon ()->eta); |
601 |
– |
// scaleFactor *= electronSFWeight_->at (chosenElectron ()->eta, chosenElectron ()->pt); |
602 |
– |
// } |
827 |
|
|
828 |
|
//filling histograms |
829 |
< |
for (uint histogramIndex = 0; histogramIndex != histograms.size(); histogramIndex++){ |
606 |
< |
histogram currentHistogram = histograms.at(histogramIndex); |
829 |
> |
for(uint currentCut = 0; currentCut != oneDHists_.at(currentChannelIndex).size(); currentCut++){//loop over all the directories in each channel. |
830 |
|
|
831 |
< |
if(currentHistogram.inputVariables.size() == 1){ |
832 |
< |
TH1D* histo; |
833 |
< |
histo = oneDHists_.at(currentChannelIndex).at(currentHistogram.name); |
834 |
< |
|
835 |
< |
|
836 |
< |
|
837 |
< |
if(currentHistogram.inputCollection == "jets") fill1DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("jets").back(),scaleFactor); |
838 |
< |
else if(currentHistogram.inputCollection == "muons") fill1DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("muons").back(),scaleFactor); |
839 |
< |
else if(currentHistogram.inputCollection == "muon-muon pairs") fill1DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
840 |
< |
cumulativeFlags.at("muons").back(),cumulativeFlags.at("muons").back(), \ |
841 |
< |
cumulativeFlags.at("muon-muon pairs").back(),scaleFactor); |
842 |
< |
else if(currentHistogram.inputCollection == "electrons") fill1DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("electrons").back(),scaleFactor); |
843 |
< |
else if(currentHistogram.inputCollection == "electron-electron pairs") fill1DHistogram(histo,currentHistogram,electrons.product(),electrons.product(),\ |
844 |
< |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("electrons").back(),\ |
845 |
< |
cumulativeFlags.at("electron-electron pairs").back(),scaleFactor); |
846 |
< |
else if(currentHistogram.inputCollection == "electron-muon pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),muons.product(), \ |
847 |
< |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("muons").back(), |
848 |
< |
cumulativeFlags.at("electron-muon pairs").back(),scaleFactor); |
849 |
< |
else if(currentHistogram.inputCollection == "events") fill1DHistogram(histo,currentHistogram,events.product(),cumulativeFlags.at("events").back(),scaleFactor); |
850 |
< |
else if(currentHistogram.inputCollection == "taus") fill1DHistogram(histo,currentHistogram,taus.product(),cumulativeFlags.at("taus").back(),scaleFactor); |
851 |
< |
else if(currentHistogram.inputCollection == "mets") fill1DHistogram(histo,currentHistogram,mets.product(),cumulativeFlags.at("mets").back(),scaleFactor); |
852 |
< |
else if(currentHistogram.inputCollection == "tracks") fill1DHistogram(histo,currentHistogram,tracks.product(),cumulativeFlags.at("tracks").back(),scaleFactor); |
853 |
< |
else if(currentHistogram.inputCollection == "genjets") fill1DHistogram(histo,currentHistogram,genjets.product(),cumulativeFlags.at("genjets").back(),scaleFactor); |
854 |
< |
else if(currentHistogram.inputCollection == "mcparticles") fill1DHistogram(histo,currentHistogram,mcparticles.product(),cumulativeFlags.at("mcparticles").back(),scaleFactor); |
855 |
< |
else if(currentHistogram.inputCollection == "primaryvertexs") fill1DHistogram(histo,currentHistogram,primaryvertexs.product(),cumulativeFlags.at("primaryvertexs").back(),scaleFactor); |
856 |
< |
else if(currentHistogram.inputCollection == "bxlumis") fill1DHistogram(histo,currentHistogram,bxlumis.product(),cumulativeFlags.at("bxlumis").back(),scaleFactor); |
857 |
< |
else if(currentHistogram.inputCollection == "photons") fill1DHistogram(histo,currentHistogram,photons.product(),cumulativeFlags.at("photons").back(),scaleFactor); |
858 |
< |
else if(currentHistogram.inputCollection == "superclusters") fill1DHistogram(histo,currentHistogram,superclusters.product(),cumulativeFlags.at("superclusters").back(),scaleFactor); |
859 |
< |
} |
860 |
< |
else if(currentHistogram.inputVariables.size() == 2){ |
861 |
< |
TH2D* histo; |
862 |
< |
histo = twoDHists_.at(currentChannelIndex).at(currentHistogram.name); |
863 |
< |
|
864 |
< |
|
865 |
< |
|
866 |
< |
if(currentHistogram.inputCollection == "jets") fill2DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("jets").back(),scaleFactor); |
867 |
< |
else if(currentHistogram.inputCollection == "muons") fill2DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("muons").back(),scaleFactor); |
868 |
< |
else if(currentHistogram.inputCollection == "muon-muon pairs") fill2DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
869 |
< |
cumulativeFlags.at("muons").back(),cumulativeFlags.at("muons").back(), \ |
870 |
< |
cumulativeFlags.at("muon-muon pairs").back(),scaleFactor); |
871 |
< |
else if(currentHistogram.inputCollection == "electrons") fill2DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("electrons").back(),scaleFactor); |
872 |
< |
else if(currentHistogram.inputCollection == "electron-electron pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),electrons.product(), \ |
873 |
< |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("electrons").back(), \ |
874 |
< |
cumulativeFlags.at("electron-electron pairs").back(),scaleFactor); |
875 |
< |
else if(currentHistogram.inputCollection == "electron-muon pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),muons.product(), \ |
876 |
< |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("muons").back(), \ |
877 |
< |
cumulativeFlags.at("electron-muon pairs").back(),scaleFactor); |
878 |
< |
else if(currentHistogram.inputCollection == "events") fill2DHistogram(histo,currentHistogram,events.product(),cumulativeFlags.at("events").back(),scaleFactor); |
879 |
< |
else if(currentHistogram.inputCollection == "taus") fill2DHistogram(histo,currentHistogram,taus.product(),cumulativeFlags.at("taus").back(),scaleFactor); |
880 |
< |
else if(currentHistogram.inputCollection == "mets") fill2DHistogram(histo,currentHistogram,mets.product(),cumulativeFlags.at("mets").back(),scaleFactor); |
881 |
< |
else if(currentHistogram.inputCollection == "tracks") fill2DHistogram(histo,currentHistogram,tracks.product(),cumulativeFlags.at("tracks").back(),scaleFactor); |
882 |
< |
else if(currentHistogram.inputCollection == "genjets") fill2DHistogram(histo,currentHistogram,genjets.product(),cumulativeFlags.at("genjets").back(),scaleFactor); |
883 |
< |
else if(currentHistogram.inputCollection == "mcparticles") fill2DHistogram(histo,currentHistogram,mcparticles.product(),cumulativeFlags.at("mcparticles").back(),scaleFactor); |
884 |
< |
else if(currentHistogram.inputCollection == "primaryvertexs") fill2DHistogram(histo,currentHistogram,primaryvertexs.product(),cumulativeFlags.at("primaryvertexs").back(),scaleFactor); |
885 |
< |
else if(currentHistogram.inputCollection == "bxlumis") fill2DHistogram(histo,currentHistogram,bxlumis.product(),cumulativeFlags.at("bxlumis").back(),scaleFactor); |
886 |
< |
else if(currentHistogram.inputCollection == "photons") fill2DHistogram(histo,currentHistogram,photons.product(),cumulativeFlags.at("photons").back(),scaleFactor); |
887 |
< |
else if(currentHistogram.inputCollection == "superclusters") fill2DHistogram(histo,currentHistogram,superclusters.product(),cumulativeFlags.at("superclusters").back(),scaleFactor); |
831 |
> |
uint currentDir; |
832 |
> |
if(!GetPlotsAfterEachCut_){ currentDir = currentChannel.cuts.size() - oneDHists_.at(currentChannelIndex).size();}//if GetPlotsAfterEachCut_ is true, set currentDir point to the last cut. |
833 |
> |
else currentDir = currentCut; |
834 |
> |
|
835 |
> |
if(!eventPassedPreviousCuts.at(currentDir)) continue; |
836 |
> |
|
837 |
> |
|
838 |
> |
for (uint histogramIndex = 0; histogramIndex != histograms.size(); histogramIndex++){ |
839 |
> |
histogram currentHistogram = histograms.at(histogramIndex); |
840 |
> |
|
841 |
> |
if(currentHistogram.inputVariables.size() == 1){ |
842 |
> |
TH1D* histo; |
843 |
> |
histo = oneDHists_.at(currentChannelIndex).at(currentCut).at(currentHistogram.name); |
844 |
> |
|
845 |
> |
if (currentHistogram.inputCollection == "jets") fill1DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("jets").at(currentDir),scaleFactor); |
846 |
> |
else if(currentHistogram.inputCollection == "secondary jets") fill1DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("secondary jets").at(currentDir),scaleFactor); |
847 |
> |
else if(currentHistogram.inputCollection == "muons") fill1DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("muons").at(currentDir),scaleFactor); |
848 |
> |
else if(currentHistogram.inputCollection == "secondary muons") fill1DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("secondary muons").at(currentDir),scaleFactor); |
849 |
> |
else if(currentHistogram.inputCollection == "secondary electrons") fill1DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("secondary electrons").at(currentDir),scaleFactor); |
850 |
> |
else if(currentHistogram.inputCollection == "muon-muon pairs") fill1DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
851 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("muons").at(currentDir), \ |
852 |
> |
cumulativeFlags.at("muon-muon pairs").at(currentDir),scaleFactor); |
853 |
> |
else if(currentHistogram.inputCollection == "muon-secondary muon pairs") fill1DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
854 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("secondary muons").at(currentDir), \ |
855 |
> |
cumulativeFlags.at("muon-secondary muon pairs").at(currentDir),scaleFactor); |
856 |
> |
else if(currentHistogram.inputCollection == "electrons") fill1DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("electrons").at(currentDir),scaleFactor); |
857 |
> |
else if(currentHistogram.inputCollection == "electron-electron pairs") fill1DHistogram(histo,currentHistogram,electrons.product(),electrons.product(), \ |
858 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("electrons").at(currentDir), \ |
859 |
> |
cumulativeFlags.at("electron-electron pairs").at(currentDir),scaleFactor); |
860 |
> |
else if(currentHistogram.inputCollection == "jet-jet pairs") fill1DHistogram(histo,currentHistogram,jets.product(),jets.product(), \ |
861 |
> |
cumulativeFlags.at("jets").at(currentDir),cumulativeFlags.at("jets").at(currentDir), \ |
862 |
> |
cumulativeFlags.at("jet-jet pairs").at(currentDir),scaleFactor); |
863 |
> |
else if(currentHistogram.inputCollection == "electron-secondary electron pairs") fill1DHistogram(histo,currentHistogram,electrons.product(),electrons.product(), \ |
864 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("secondary electrons").at(currentDir), \ |
865 |
> |
cumulativeFlags.at("electron-secondary electron pairs").at(currentDir),scaleFactor); |
866 |
> |
else if(currentHistogram.inputCollection == "electron-muon pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),muons.product(), \ |
867 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("muons").at(currentDir), |
868 |
> |
cumulativeFlags.at("electron-muon pairs").at(currentDir),scaleFactor); |
869 |
> |
else if(currentHistogram.inputCollection == "electron-jet pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),jets.product(), \ |
870 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("jets").at(currentDir), |
871 |
> |
cumulativeFlags.at("electron-jet pairs").at(currentDir),scaleFactor); |
872 |
> |
else if(currentHistogram.inputCollection == "muon-jet pairs") fill1DHistogram(histo,currentHistogram, muons.product(),jets.product(), \ |
873 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("jets").at(currentDir), |
874 |
> |
cumulativeFlags.at("muon-jet pairs").at(currentDir),scaleFactor); |
875 |
> |
else if(currentHistogram.inputCollection == "electron-track pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),tracks.product(), |
876 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("tracks").at(currentDir), |
877 |
> |
cumulativeFlags.at("electron-track pairs").at(currentDir),scaleFactor); |
878 |
> |
else if(currentHistogram.inputCollection == "muon-track pairs") fill1DHistogram(histo,currentHistogram, muons.product(),tracks.product(), |
879 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("tracks").at(currentDir), |
880 |
> |
cumulativeFlags.at("muon-track pairs").at(currentDir),scaleFactor); |
881 |
> |
else if(currentHistogram.inputCollection == "muon-tau pairs") fill1DHistogram(histo,currentHistogram, muons.product(),taus.product(), |
882 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("taus").at(currentDir), |
883 |
> |
cumulativeFlags.at("muon-tau pairs").at(currentDir),scaleFactor); |
884 |
> |
else if(currentHistogram.inputCollection == "tau-tau pairs") fill1DHistogram(histo,currentHistogram, taus.product(),taus.product(), |
885 |
> |
cumulativeFlags.at("taus").at(currentDir),cumulativeFlags.at("taus").at(currentDir), |
886 |
> |
cumulativeFlags.at("tau-tau pairs").at(currentDir),scaleFactor); |
887 |
> |
else if(currentHistogram.inputCollection == "tau-track pairs") fill1DHistogram(histo,currentHistogram, taus.product(),tracks.product(), |
888 |
> |
cumulativeFlags.at("taus").at(currentDir),cumulativeFlags.at("tracks").at(currentDir), |
889 |
> |
cumulativeFlags.at("tau-track pairs").at(currentDir),scaleFactor); |
890 |
> |
else if(currentHistogram.inputCollection == "electron-trigobj pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),trigobjs.product(), |
891 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("trigobjs").at(currentDir), |
892 |
> |
cumulativeFlags.at("electron-trigobj pairs").at(currentDir),scaleFactor); |
893 |
> |
else if(currentHistogram.inputCollection == "muon-trigobj pairs") fill1DHistogram(histo,currentHistogram, muons.product(),trigobjs.product(), |
894 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("trigobjs").at(currentDir), |
895 |
> |
cumulativeFlags.at("muon-trigobj pairs").at(currentDir),scaleFactor); |
896 |
> |
|
897 |
> |
else if(currentHistogram.inputCollection == "events") fill1DHistogram(histo,currentHistogram,events.product(),cumulativeFlags.at("events").at(currentDir),scaleFactor); |
898 |
> |
else if(currentHistogram.inputCollection == "taus") fill1DHistogram(histo,currentHistogram,taus.product(),cumulativeFlags.at("taus").at(currentDir),scaleFactor); |
899 |
> |
else if(currentHistogram.inputCollection == "mets") fill1DHistogram(histo,currentHistogram,mets.product(),cumulativeFlags.at("mets").at(currentDir),scaleFactor); |
900 |
> |
else if(currentHistogram.inputCollection == "tracks") fill1DHistogram(histo,currentHistogram,tracks.product(),cumulativeFlags.at("tracks").at(currentDir),scaleFactor); |
901 |
> |
else if(currentHistogram.inputCollection == "genjets") fill1DHistogram(histo,currentHistogram,genjets.product(),cumulativeFlags.at("genjets").at(currentDir),scaleFactor); |
902 |
> |
else if(currentHistogram.inputCollection == "mcparticles") fill1DHistogram(histo,currentHistogram,mcparticles.product(),cumulativeFlags.at("mcparticles").at(currentDir),scaleFactor); |
903 |
> |
else if(currentHistogram.inputCollection == "primaryvertexs") fill1DHistogram(histo,currentHistogram,primaryvertexs.product(),cumulativeFlags.at("primaryvertexs").at(currentDir),scaleFactor); |
904 |
> |
else if(currentHistogram.inputCollection == "bxlumis") fill1DHistogram(histo,currentHistogram,bxlumis.product(),cumulativeFlags.at("bxlumis").at(currentDir),scaleFactor); |
905 |
> |
else if(currentHistogram.inputCollection == "photons") fill1DHistogram(histo,currentHistogram,photons.product(),cumulativeFlags.at("photons").at(currentDir),scaleFactor); |
906 |
> |
else if(currentHistogram.inputCollection == "superclusters") fill1DHistogram(histo,currentHistogram,superclusters.product(),cumulativeFlags.at("superclusters").at(currentDir),scaleFactor); |
907 |
> |
else if(currentHistogram.inputCollection == "trigobjs") fill1DHistogram(histo,currentHistogram,trigobjs.product(),cumulativeFlags.at("trigobjs").at(currentDir),scaleFactor); |
908 |
> |
else if(currentHistogram.inputCollection == "stops" && datasetType_ == "signalMC") fill1DHistogram(histo,currentHistogram,stops.product(),cumulativeFlags.at("stops").at(currentDir),scaleFactor); |
909 |
> |
} |
910 |
> |
else if(currentHistogram.inputVariables.size() == 2){ |
911 |
> |
TH2D* histo; |
912 |
> |
histo = twoDHists_.at(currentChannelIndex).at(currentCut).at(currentHistogram.name); |
913 |
> |
|
914 |
> |
if (currentHistogram.inputCollection == "jets") fill2DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("jets").at(currentDir),scaleFactor); |
915 |
> |
else if(currentHistogram.inputCollection == "secondary jets") fill2DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("secondary jets").at(currentDir),scaleFactor); |
916 |
> |
else if(currentHistogram.inputCollection == "muons") fill2DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("muons").at(currentDir),scaleFactor); |
917 |
> |
else if(currentHistogram.inputCollection == "secondary muons") fill2DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("secondary muons").at(currentDir),scaleFactor); |
918 |
> |
else if(currentHistogram.inputCollection == "muon-muon pairs") fill2DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
919 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("muons").at(currentDir), \ |
920 |
> |
cumulativeFlags.at("muon-muon pairs").at(currentDir),scaleFactor); |
921 |
> |
else if(currentHistogram.inputCollection == "muon-secondary muon pairs") fill2DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
922 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("secondary muons").at(currentDir), \ |
923 |
> |
cumulativeFlags.at("muon-secondary muon pairs").at(currentDir),scaleFactor); |
924 |
> |
else if(currentHistogram.inputCollection == "electrons") fill2DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("electrons").at(currentDir),scaleFactor); |
925 |
> |
else if(currentHistogram.inputCollection == "secondary electrons") fill2DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("secondary electrons").at(currentDir),scaleFactor); |
926 |
> |
else if(currentHistogram.inputCollection == "electron-electron pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),electrons.product(), \ |
927 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("electrons").at(currentDir), \ |
928 |
> |
cumulativeFlags.at("electron-electron pairs").at(currentDir),scaleFactor); |
929 |
> |
else if(currentHistogram.inputCollection == "jet-jet pairs") fill2DHistogram(histo,currentHistogram,jets.product(),jets.product(), \ |
930 |
> |
cumulativeFlags.at("jets").at(currentDir),cumulativeFlags.at("jets").at(currentDir), \ |
931 |
> |
cumulativeFlags.at("jet-jet pairs").at(currentDir),scaleFactor); |
932 |
> |
else if(currentHistogram.inputCollection == "electron-secondary electron pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),electrons.product(), \ |
933 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("secondary electrons").at(currentDir), \ |
934 |
> |
cumulativeFlags.at("electron-secondary electron pairs").at(currentDir),scaleFactor); |
935 |
> |
else if(currentHistogram.inputCollection == "electron-muon pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),muons.product(), \ |
936 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("muons").at(currentDir), \ |
937 |
> |
cumulativeFlags.at("electron-muon pairs").at(currentDir),scaleFactor); |
938 |
> |
else if(currentHistogram.inputCollection == "electron-jet pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),jets.product(), \ |
939 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("jets").at(currentDir), \ |
940 |
> |
cumulativeFlags.at("electron-jet pairs").at(currentDir),scaleFactor); |
941 |
> |
else if(currentHistogram.inputCollection == "muon-jet pairs") fill2DHistogram(histo,currentHistogram,muons.product(),jets.product(), \ |
942 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("jets").at(currentDir), \ |
943 |
> |
cumulativeFlags.at("muon-jet pairs").at(currentDir),scaleFactor); |
944 |
> |
else if(currentHistogram.inputCollection == "electron-track pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),tracks.product(), |
945 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("tracks").at(currentDir), |
946 |
> |
cumulativeFlags.at("electron-track pairs").at(currentDir),scaleFactor); |
947 |
> |
else if(currentHistogram.inputCollection == "muon-track pairs") fill2DHistogram(histo,currentHistogram,muons.product(),tracks.product(), |
948 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("tracks").at(currentDir), |
949 |
> |
cumulativeFlags.at("muon-track pairs").at(currentDir),scaleFactor); |
950 |
> |
else if(currentHistogram.inputCollection == "muon-tau pairs") fill2DHistogram(histo,currentHistogram,muons.product(),taus.product(), |
951 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("taus").at(currentDir), |
952 |
> |
cumulativeFlags.at("muon-tau pairs").at(currentDir),scaleFactor); |
953 |
> |
else if(currentHistogram.inputCollection == "tau-tau pairs") fill2DHistogram(histo,currentHistogram,taus.product(),taus.product(), |
954 |
> |
cumulativeFlags.at("taus").at(currentDir),cumulativeFlags.at("taus").at(currentDir), |
955 |
> |
cumulativeFlags.at("tau-tau pairs").at(currentDir),scaleFactor); |
956 |
> |
else if(currentHistogram.inputCollection == "tau-track pairs") fill2DHistogram(histo,currentHistogram,taus.product(),tracks.product(), |
957 |
> |
cumulativeFlags.at("taus").at(currentDir),cumulativeFlags.at("tracks").at(currentDir), |
958 |
> |
cumulativeFlags.at("tau-track pairs").at(currentDir),scaleFactor); |
959 |
> |
else if(currentHistogram.inputCollection == "electron-trigobj pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),trigobjs.product(), |
960 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("trigobjs").at(currentDir), |
961 |
> |
cumulativeFlags.at("electron-trigobj pairs").at(currentDir),scaleFactor); |
962 |
> |
else if(currentHistogram.inputCollection == "muon-trigobj pairs") fill2DHistogram(histo,currentHistogram,muons.product(),trigobjs.product(), |
963 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("trigobjs").at(currentDir), |
964 |
> |
cumulativeFlags.at("muon-trigobj pairs").at(currentDir),scaleFactor); |
965 |
> |
else if(currentHistogram.inputCollection == "events") fill2DHistogram(histo,currentHistogram,events.product(),cumulativeFlags.at("events").at(currentDir),scaleFactor); |
966 |
> |
else if(currentHistogram.inputCollection == "taus") fill2DHistogram(histo,currentHistogram,taus.product(),cumulativeFlags.at("taus").at(currentDir),scaleFactor); |
967 |
> |
else if(currentHistogram.inputCollection == "mets") fill2DHistogram(histo,currentHistogram,mets.product(),cumulativeFlags.at("mets").at(currentDir),scaleFactor); |
968 |
> |
else if(currentHistogram.inputCollection == "tracks") fill2DHistogram(histo,currentHistogram,tracks.product(),cumulativeFlags.at("tracks").at(currentDir),scaleFactor); |
969 |
> |
else if(currentHistogram.inputCollection == "track-event pairs") fill2DHistogram(histo,currentHistogram,tracks.product(),events.product(), |
970 |
> |
cumulativeFlags.at("tracks").at(currentDir),cumulativeFlags.at("events").at(currentDir), |
971 |
> |
cumulativeFlags.at("track-event pairs").at(currentDir),scaleFactor); |
972 |
> |
else if(currentHistogram.inputCollection == "genjets") fill2DHistogram(histo,currentHistogram,genjets.product(),cumulativeFlags.at("genjets").at(currentDir),scaleFactor); |
973 |
> |
else if(currentHistogram.inputCollection == "mcparticles") fill2DHistogram(histo,currentHistogram,mcparticles.product(),cumulativeFlags.at("mcparticles").at(currentDir),scaleFactor); |
974 |
> |
else if(currentHistogram.inputCollection == "primaryvertexs") fill2DHistogram(histo,currentHistogram,primaryvertexs.product(),cumulativeFlags.at("primaryvertexs").at(currentDir),scaleFactor); |
975 |
> |
else if(currentHistogram.inputCollection == "bxlumis") fill2DHistogram(histo,currentHistogram,bxlumis.product(),cumulativeFlags.at("bxlumis").at(currentDir),scaleFactor); |
976 |
> |
else if(currentHistogram.inputCollection == "photons") fill2DHistogram(histo,currentHistogram,photons.product(),cumulativeFlags.at("photons").at(currentDir),scaleFactor); |
977 |
> |
else if(currentHistogram.inputCollection == "superclusters") fill2DHistogram(histo,currentHistogram,superclusters.product(),cumulativeFlags.at("superclusters").at(currentDir),scaleFactor); |
978 |
> |
else if(currentHistogram.inputCollection == "trigobjs") fill2DHistogram(histo,currentHistogram,trigobjs.product(),cumulativeFlags.at("trigobjs").at(currentDir),scaleFactor); |
979 |
> |
else if(currentHistogram.inputCollection == "stops" && datasetType_ == "signalMC") fill2DHistogram(histo,currentHistogram,stops.product(),cumulativeFlags.at("stops").at(currentDir),scaleFactor); |
980 |
> |
} |
981 |
|
} |
666 |
– |
} |
667 |
– |
|
668 |
– |
//fills histograms with the sizes of collections |
669 |
– |
for (uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){ |
670 |
– |
string currentObject = objectsToPlot.at(currentObjectIndex); |
671 |
– |
|
672 |
– |
string objectToPlot = ""; |
673 |
– |
|
674 |
– |
if(currentObject == "muon-muon pairs") objectToPlot = "dimuonPairs"; |
675 |
– |
else if(currentObject == "electron-electron pairs") objectToPlot = "dielectronPairs"; |
676 |
– |
else if(currentObject == "electron-muon pairs") objectToPlot = "electronMuonPairs"; |
677 |
– |
else objectToPlot = currentObject; |
678 |
– |
string tempCurrentObject = objectToPlot; |
679 |
– |
tempCurrentObject.at(0) = toupper(tempCurrentObject.at(0)); |
680 |
– |
string histoName = "num" + tempCurrentObject; |
681 |
– |
|
682 |
– |
|
982 |
|
|
983 |
+ |
//fills histograms with the sizes of collections |
984 |
|
|
985 |
< |
//set position of primary vertex in event, in order to calculate quantities relative to it |
986 |
< |
if(std::find(objectsToCut.begin(), objectsToCut.end(), currentObject) != objectsToCut.end()) { |
987 |
< |
vector<bool> lastCutFlags = cumulativeFlags.at(currentObject).back(); |
988 |
< |
int numToPlot = 0; |
989 |
< |
for (uint currentFlag = 0; currentFlag != lastCutFlags.size(); currentFlag++){ |
990 |
< |
if(lastCutFlags.at(currentFlag)) numToPlot++; |
991 |
< |
} |
992 |
< |
if(objectToPlot == "primaryvertexs"){ |
993 |
< |
oneDHists_.at(currentChannelIndex).at(histoName+"BeforePileupCorrection")->Fill(primaryvertexs->size()); |
994 |
< |
oneDHists_.at(currentChannelIndex).at(histoName+"AfterPileupCorrection")->Fill(primaryvertexs->size(),scaleFactor); |
995 |
< |
} |
996 |
< |
else |
997 |
< |
oneDHists_.at(currentChannelIndex).at(histoName)->Fill(numToPlot,scaleFactor); |
998 |
< |
} |
999 |
< |
else if(objectToPlot == "jets") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(jets->size(),scaleFactor); |
1000 |
< |
else if(objectToPlot == "muons") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(muons->size(),scaleFactor); |
1001 |
< |
else if(objectToPlot == "dimuonPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(muons->size()*(muons->size()-1)/2,scaleFactor); |
1002 |
< |
else if(objectToPlot == "electrons") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size(),scaleFactor); |
1003 |
< |
else if(objectToPlot == "dielectronPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size()*(electrons->size()-1)/2,scaleFactor); |
1004 |
< |
else if(objectToPlot == "electronMuonPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size()*muons->size(),scaleFactor); |
1005 |
< |
else if(objectToPlot == "events") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(events->size(),scaleFactor); |
1006 |
< |
else if(objectToPlot == "taus") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(taus->size(),scaleFactor); |
1007 |
< |
else if(objectToPlot == "mets") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(mets->size(),scaleFactor); |
1008 |
< |
else if(objectToPlot == "tracks") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(tracks->size(),scaleFactor); |
1009 |
< |
else if(objectToPlot == "genjets") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(genjets->size(),scaleFactor); |
1010 |
< |
else if(objectToPlot == "mcparticles") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(mcparticles->size(),scaleFactor); |
1011 |
< |
else if(objectToPlot == "bxlumis") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(bxlumis->size(),scaleFactor); |
1012 |
< |
else if(objectToPlot == "photons") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(photons->size(),scaleFactor); |
1013 |
< |
else if(objectToPlot == "superclusters") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(superclusters->size(),scaleFactor); |
1014 |
< |
else if(objectToPlot == "primaryvertexs"){ |
1015 |
< |
oneDHists_.at(currentChannelIndex).at(histoName+"BeforePileupCorrection")->Fill(primaryvertexs->size()); |
1016 |
< |
oneDHists_.at(currentChannelIndex).at(histoName+"AfterPileupCorrection")->Fill(primaryvertexs->size(),scaleFactor); |
1017 |
< |
} |
985 |
> |
for (uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){ |
986 |
> |
|
987 |
> |
string currentObject = objectsToPlot.at(currentObjectIndex); |
988 |
> |
string objectToPlot = ""; |
989 |
> |
|
990 |
> |
// Name of objectToPlot here must match the name specified in OSUAnalysis::OSUAnalysis(). |
991 |
> |
if(currentObject == "muon-muon pairs") objectToPlot = "dimuonPairs"; |
992 |
> |
else if(currentObject == "electron-electron pairs") objectToPlot = "dielectronPairs"; |
993 |
> |
else if(currentObject == "electron-muon pairs") objectToPlot = "electronMuonPairs"; |
994 |
> |
else if(currentObject == "electron-jet pairs") objectToPlot = "electronJetPairs"; |
995 |
> |
else if(currentObject == "muon-jet pairs") objectToPlot = "muonJetPairs"; |
996 |
> |
else if(currentObject == "jet-jet pairs") objectToPlot = "dijetPairs"; |
997 |
> |
else if(currentObject == "secondary jets") objectToPlot = "secondaryJets"; |
998 |
> |
else if(currentObject == "electron-track pairs") objectToPlot = "electronTrackPairs"; |
999 |
> |
else if(currentObject == "muon-track pairs") objectToPlot = "muonTrackPairs"; |
1000 |
> |
else if(currentObject == "muon-tau pairs") objectToPlot = "muonTauPairs"; |
1001 |
> |
else if(currentObject == "tau-tau pairs") objectToPlot = "ditauPairs"; |
1002 |
> |
else if(currentObject == "tau-track pairs") objectToPlot = "tauTrackPairs"; |
1003 |
> |
else if(currentObject == "track-event pairs") objectToPlot = "trackEventPairs"; |
1004 |
> |
else if(currentObject == "muon-secondary muon pairs") objectToPlot = "muonSecondaryMuonPairs"; |
1005 |
> |
else if(currentObject == "secondary muons") objectToPlot = "secondaryMuons"; |
1006 |
> |
else if(currentObject == "electron-secondary electron pairs") objectToPlot = "electronSecondaryElectronPairs"; |
1007 |
> |
else if(currentObject == "secondary electrons") objectToPlot = "secondaryElectrons"; |
1008 |
> |
else if(currentObject == "electron-trigobj pairs") objectToPlot = "electronTrigobjPairs"; |
1009 |
> |
else if(currentObject == "muon-trigobj pairs") objectToPlot = "muonTrigobjPairs"; |
1010 |
> |
else objectToPlot = currentObject; |
1011 |
> |
|
1012 |
> |
string tempCurrentObject = objectToPlot; |
1013 |
> |
tempCurrentObject.at(0) = toupper(tempCurrentObject.at(0)); |
1014 |
> |
string histoName = "num" + tempCurrentObject; |
1015 |
> |
|
1016 |
> |
|
1017 |
> |
vector<bool> lastCutFlags = cumulativeFlags.at(currentObject).at(currentDir); |
1018 |
> |
|
1019 |
> |
//count the number of objects passing all cuts |
1020 |
> |
int numToPlot = 0; |
1021 |
> |
for (uint currentFlag = 0; currentFlag != lastCutFlags.size(); currentFlag++){ |
1022 |
> |
if(lastCutFlags.at(currentFlag)) numToPlot++; |
1023 |
> |
} |
1024 |
|
|
1025 |
+ |
if(objectToPlot == "primaryvertexs"){ |
1026 |
+ |
oneDHists_.at(currentChannelIndex).at(currentCut).at(histoName+"BeforePileupCorrection")->Fill(primaryvertexs->size()); |
1027 |
+ |
oneDHists_.at(currentChannelIndex).at(currentCut).at(histoName+"AfterPileupCorrection")->Fill(primaryvertexs->size(),scaleFactor); |
1028 |
+ |
} |
1029 |
+ |
else { |
1030 |
+ |
oneDHists_.at(currentChannelIndex).at(currentCut).at(histoName)->Fill(numToPlot,scaleFactor); |
1031 |
+ |
} |
1032 |
+ |
} // end for (uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++) |
1033 |
|
} |
1034 |
|
|
1035 |
+ |
} //end loop over channel |
1036 |
|
|
1037 |
+ |
masterCutFlow_->fillCutFlow(masterScaleFactor); |
1038 |
|
|
1039 |
+ |
} // end void OSUAnalysis::analyze (const edm::Event &event, const edm::EventSetup &setup) |
1040 |
|
|
724 |
– |
} //end loop over channel |
1041 |
|
|
726 |
– |
masterCutFlow_->fillCutFlow(scaleFactor); |
1042 |
|
|
1043 |
+ |
bool |
1044 |
+ |
OSUAnalysis::evaluateComparison (double testValue, string comparison, double cutValue){ |
1045 |
|
|
1046 |
|
|
1047 |
< |
} |
1047 |
> |
if(comparison == ">") return testValue > cutValue; |
1048 |
> |
else if(comparison == ">=") return testValue >= cutValue; |
1049 |
> |
else if(comparison == "<") return testValue < cutValue; |
1050 |
> |
else if(comparison == "<=") return testValue <= cutValue; |
1051 |
> |
else if(comparison == "==") return testValue == cutValue; |
1052 |
> |
else if(comparison == "=") return testValue == cutValue; |
1053 |
> |
else if(comparison == "!=") return testValue != cutValue; |
1054 |
> |
else {cout << "WARNING: invalid comparison operator '" << comparison << "'\n"; return false;} |
1055 |
|
|
1056 |
+ |
} |
1057 |
|
|
1058 |
|
bool |
1059 |
< |
OSUAnalysis::evaluateComparison (double testValue, string comparison, double cutValue){ |
1059 |
> |
OSUAnalysis::evaluateComparison (string testValue, string comparison, string cutValue){ |
1060 |
|
|
1061 |
|
|
1062 |
|
if(comparison == ">") return testValue > cutValue; |
1066 |
|
else if(comparison == "==") return testValue == cutValue; |
1067 |
|
else if(comparison == "=") return testValue == cutValue; |
1068 |
|
else if(comparison == "!=") return testValue != cutValue; |
1069 |
< |
else {std::cout << "WARNING: invalid comparison operator '" << comparison << "'\n"; return false;} |
1069 |
> |
else {cout << "WARNING: invalid comparison operator '" << comparison << "'\n"; return false;} |
1070 |
|
|
1071 |
|
} |
1072 |
|
|
1073 |
|
bool |
1074 |
< |
OSUAnalysis::evaluateTriggers (vector<string> triggersToTest, const BNtriggerCollection* triggerCollection){ |
1074 |
> |
OSUAnalysis::evaluateTriggers (vector<string> triggersToTest, vector<string> triggersToVeto, const BNtriggerCollection* triggerCollection){ |
1075 |
|
|
1076 |
+ |
//initialize to false until a chosen trigger is passed |
1077 |
|
bool triggerDecision = false; |
1078 |
|
|
1079 |
< |
for (BNtriggerCollection::const_iterator trigger = triggerCollection->begin (); trigger != triggerCollection->end (); trigger++) |
1080 |
< |
{ |
1081 |
< |
if(trigger->pass != 1) continue; |
1082 |
< |
for(uint triggerName = 0; triggerName != triggersToTest.size(); triggerName++) |
1083 |
< |
{ |
758 |
< |
if(trigger->name.find(triggersToTest.at(triggerName))!=std::string::npos){ |
759 |
< |
triggerDecision = true; |
760 |
< |
} |
761 |
< |
} |
762 |
< |
} |
763 |
< |
return triggerDecision; |
1079 |
> |
//loop over all triggers defined in the event |
1080 |
> |
for (BNtriggerCollection::const_iterator trigger = triggerCollection->begin (); trigger != triggerCollection->end (); trigger++){ |
1081 |
> |
|
1082 |
> |
//we're only interested in triggers that actually passed |
1083 |
> |
if(trigger->pass != 1) continue; |
1084 |
|
|
1085 |
+ |
//if the event passes one of the veto triggers, exit and return false |
1086 |
+ |
for(uint triggerName = 0; triggerName != triggersToVeto.size(); triggerName++){ |
1087 |
+ |
if(trigger->name.find(triggersToVeto.at(triggerName))!=string::npos) return false; |
1088 |
+ |
} |
1089 |
+ |
//if the event passes one of the chosen triggers, set triggerDecision to true |
1090 |
+ |
for(uint triggerName = 0; triggerName != triggersToTest.size(); triggerName++){ |
1091 |
+ |
if(trigger->name.find(triggersToTest.at(triggerName))!=string::npos) triggerDecision = true; |
1092 |
+ |
} |
1093 |
+ |
} |
1094 |
+ |
//if none of the veto triggers fired: |
1095 |
+ |
//return the OR of all the chosen triggers |
1096 |
+ |
if (triggersToTest.size() != 0) return triggerDecision; |
1097 |
+ |
//or if no triggers were defined return true |
1098 |
+ |
else return true; |
1099 |
|
} |
1100 |
|
|
1101 |
< |
std::vector<std::string> |
1101 |
> |
|
1102 |
> |
vector<string> |
1103 |
|
OSUAnalysis::splitString (string inputString){ |
1104 |
|
|
1105 |
< |
std::stringstream stringStream(inputString); |
1106 |
< |
std::istream_iterator<std::string> begin(stringStream); |
1107 |
< |
std::istream_iterator<std::string> end; |
1108 |
< |
std::vector<std::string> stringVector(begin, end); |
1105 |
> |
stringstream stringStream(inputString); |
1106 |
> |
istream_iterator<string> begin(stringStream); |
1107 |
> |
istream_iterator<string> end; |
1108 |
> |
vector<string> stringVector(begin, end); |
1109 |
|
return stringVector; |
1110 |
|
|
1111 |
|
} |
1112 |
|
|
1113 |
+ |
|
1114 |
+ |
void OSUAnalysis::getTwoObjs(string tempInputCollection, string& obj1, string& obj2) { |
1115 |
+ |
// Set two object strings from the tempInputCollection string, |
1116 |
+ |
// For example, if tempInputCollection is "electron-muon pairs", |
1117 |
+ |
// then obj1 = "electrons" and obj2 = "muons". |
1118 |
+ |
// Note that the objects have an "s" appended. |
1119 |
+ |
|
1120 |
+ |
int dashIndex = tempInputCollection.find("-"); |
1121 |
+ |
int spaceIndex = tempInputCollection.find_last_of(" "); |
1122 |
+ |
int secondWordLength = spaceIndex - dashIndex; |
1123 |
+ |
obj1 = tempInputCollection.substr(0,dashIndex) + "s"; |
1124 |
+ |
obj2 = tempInputCollection.substr(dashIndex+1,secondWordLength-1)+"s"; |
1125 |
+ |
|
1126 |
+ |
} |
1127 |
+ |
|
1128 |
+ |
|
1129 |
+ |
string OSUAnalysis::getObjToGet(string obj) { |
1130 |
+ |
// Return the string corresponding to the object to get for the given obj string. |
1131 |
+ |
// Right now this only handles the case in which obj contains "secondary", |
1132 |
+ |
// e.g, "secondary muons". |
1133 |
+ |
// Note that "s" is NOT appended. |
1134 |
+ |
|
1135 |
+ |
if (obj.find("secondary")==string::npos) return obj; // "secondary" is not found |
1136 |
+ |
int firstSpaceIndex = obj.find_first_of(" "); |
1137 |
+ |
return obj.substr(firstSpaceIndex+1,obj.length()-1); |
1138 |
+ |
|
1139 |
+ |
} |
1140 |
+ |
|
1141 |
+ |
|
1142 |
+ |
//!jet valueLookup |
1143 |
|
double |
1144 |
< |
OSUAnalysis::valueLookup (const BNjet* object, string variable, string function){ |
1144 |
> |
OSUAnalysis::valueLookup (const BNjet* object, string variable, string function, string &stringValue){ |
1145 |
|
|
1146 |
|
double value = 0.0; |
1147 |
|
if(variable == "energy") value = object->energy; |
1261 |
|
else if(variable == "puJetId_loose_cutbased") value = object->puJetId_loose_cutbased; |
1262 |
|
|
1263 |
|
|
1264 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
1264 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
1265 |
|
|
1266 |
|
value = applyFunction(function, value); |
1267 |
|
|
1269 |
|
} |
1270 |
|
|
1271 |
|
|
1272 |
< |
|
1272 |
> |
//!muon valueLookup |
1273 |
|
double |
1274 |
< |
OSUAnalysis::valueLookup (const BNmuon* object, string variable, string function){ |
1274 |
> |
OSUAnalysis::valueLookup (const BNmuon* object, string variable, string function, string &stringValue){ |
1275 |
|
|
1276 |
|
double value = 0.0; |
1277 |
|
if(variable == "energy") value = object->energy; |
1432 |
|
else if(variable == "relPFdBetaIso") value = (object->pfIsoR04SumChargedHadronPt + max(0.0, object->pfIsoR04SumNeutralHadronEt + object->pfIsoR04SumPhotonEt - 0.5*object->pfIsoR04SumPUPt)) / object->pt; |
1433 |
|
else if(variable == "relPFrhoIso") value = ( object->chargedHadronIso + max(0.0, object->neutralHadronIso + object->photonIso - object->AEffDr03*object->rhoPrime) ) / object->pt; |
1434 |
|
else if(variable == "metMT") { |
1435 |
< |
const BNmet *met = chosenMET (); |
1071 |
< |
if (met) |
1435 |
> |
if (const BNmet *met = chosenMET ()) |
1436 |
|
{ |
1437 |
< |
TLorentzVector p1 (object->px, object->py, object->pz, object->energy), |
1438 |
< |
p2 (met->px, met->py, 0.0, met->pt); |
1075 |
< |
|
1076 |
< |
value = (p1 + p2).Mt (); |
1437 |
> |
double dPhi = deltaPhi (object->phi, met->phi); |
1438 |
> |
value = sqrt (2 * object->pt * met->pt * (1 - cos (dPhi))); |
1439 |
|
} |
1440 |
|
else |
1441 |
|
value = -999; |
1553 |
|
value = object->isGlobalMuon > 0 \ |
1554 |
|
&& object->isPFMuon > 0 \ |
1555 |
|
&& object->normalizedChi2 < 10 \ |
1556 |
< |
&& object->numberOfValidMuonHits > 0 \ |
1556 |
> |
&& object->numberOfValidMuonHits > 0 \ |
1557 |
|
&& object->numberOfMatchedStations > 1 \ |
1558 |
|
&& fabs(object->correctedD0Vertex) < 0.2 \ |
1559 |
|
&& fabs(object->correctedDZ) < 0.5 \ |
1562 |
|
} |
1563 |
|
else if(variable == "tightIDdisplaced"){ |
1564 |
|
value = object->isGlobalMuon > 0 \ |
1565 |
+ |
&& object->isPFMuon > 0 \ |
1566 |
|
&& object->normalizedChi2 < 10 \ |
1567 |
< |
&& object->numberOfValidMuonHits > 0 \ |
1567 |
> |
&& object->numberOfValidMuonHits > 0 \ |
1568 |
|
&& object->numberOfMatchedStations > 1 \ |
1569 |
|
&& object->numberOfValidPixelHits > 0 \ |
1570 |
|
&& object->numberOfLayersWithMeasurement > 5; |
1571 |
|
} |
1572 |
|
|
1573 |
< |
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
1573 |
> |
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
1574 |
|
|
1575 |
|
else if(variable == "genMatchedPdgId"){ |
1576 |
|
int index = getGenMatchedParticleIndex(object); |
1590 |
|
} |
1591 |
|
else if(variable == "genMatchedMotherIdReverse"){ |
1592 |
|
int index = getGenMatchedParticleIndex(object); |
1593 |
< |
if(index == -1) value = 23; |
1594 |
< |
else value = 23 -getPdgIdBinValue(mcparticles->at(index).motherId); |
1593 |
> |
if(index == -1) value = 24; |
1594 |
> |
else value = 24 - getPdgIdBinValue(mcparticles->at(index).motherId); |
1595 |
|
} |
1596 |
|
else if(variable == "genMatchedGrandmotherId"){ |
1597 |
|
int index = getGenMatchedParticleIndex(object); |
1603 |
|
} |
1604 |
|
else value = getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
1605 |
|
} |
1606 |
+ |
else if(variable == "genMatchedGrandmotherIdReverse"){ |
1607 |
+ |
int index = getGenMatchedParticleIndex(object); |
1608 |
+ |
if(index == -1) value = 24; |
1609 |
+ |
else if(fabs(mcparticles->at(index).motherId) == 15){ |
1610 |
+ |
int motherIndex = findTauMotherIndex(&mcparticles->at(index)); |
1611 |
+ |
if(motherIndex == -1) value = 24; |
1612 |
+ |
else value = 24 - getPdgIdBinValue(mcparticles->at(motherIndex).motherId); |
1613 |
+ |
} |
1614 |
+ |
else value = 24 - getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
1615 |
+ |
} |
1616 |
+ |
else if(variable == "pfMuonsFromVertex"){ |
1617 |
+ |
double d0Error, dzError; |
1618 |
|
|
1619 |
+ |
d0Error = hypot (object->tkD0err, hypot (chosenVertex ()->xError, chosenVertex ()->yError)); |
1620 |
+ |
dzError = hypot (object->tkDZerr, chosenVertex ()->zError); |
1621 |
+ |
value = fabs (object->correctedD0Vertex) > 0.2 || fabs (object->correctedDZ) > 0.5 |
1622 |
+ |
|| fabs (object->correctedD0Vertex / d0Error) > 99.0 |
1623 |
+ |
|| fabs (object->correctedDZ / dzError) > 99.0; |
1624 |
+ |
value = (object->isStandAloneMuon && !object->isTrackerMuon && !object->isGlobalMuon) || !value; |
1625 |
+ |
} |
1626 |
|
|
1627 |
|
|
1628 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
1628 |
> |
|
1629 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
1630 |
|
|
1631 |
|
value = applyFunction(function, value); |
1632 |
|
|
1633 |
|
return value; |
1634 |
|
} |
1635 |
|
|
1636 |
< |
|
1636 |
> |
//!electron valueLookup |
1637 |
|
double |
1638 |
< |
OSUAnalysis::valueLookup (const BNelectron* object, string variable, string function){ |
1638 |
> |
OSUAnalysis::valueLookup (const BNelectron* object, string variable, string function, string &stringValue){ |
1639 |
|
|
1640 |
|
double value = 0.0; |
1641 |
|
if(variable == "energy") value = object->energy; |
1801 |
|
else if(variable == "detIso") value = (object->trackIso) / object->pt; |
1802 |
|
else if(variable == "relPFrhoIso") value = ( object->chargedHadronIsoDR03 + max(0.0, object->neutralHadronIsoDR03 + object->photonIsoDR03 - object->AEffDr03*object->rhoPrime) ) / object->pt; |
1803 |
|
else if(variable == "metMT") { |
1804 |
< |
const BNmet *met = chosenMET (); |
1422 |
< |
if (met) |
1804 |
> |
if (const BNmet *met = chosenMET ()) |
1805 |
|
{ |
1806 |
< |
TLorentzVector p1 (object->px, object->py, object->pz, object->energy), |
1807 |
< |
p2 (met->px, met->py, 0.0, met->pt); |
1426 |
< |
|
1427 |
< |
value = (p1 + p2).Mt (); |
1806 |
> |
double dPhi = deltaPhi (object->phi, met->phi); |
1807 |
> |
value = sqrt (2 * object->pt * met->pt * (1 - cos (dPhi))); |
1808 |
|
} |
1809 |
|
else |
1810 |
|
value = -999; |
1969 |
|
} |
1970 |
|
|
1971 |
|
|
1972 |
< |
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
1972 |
> |
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
1973 |
|
|
1974 |
|
else if(variable == "genMatchedPdgId"){ |
1975 |
|
int index = getGenMatchedParticleIndex(object); |
1990 |
|
} |
1991 |
|
else if(variable == "genMatchedMotherIdReverse"){ |
1992 |
|
int index = getGenMatchedParticleIndex(object); |
1993 |
< |
if(index == -1) value = 23; |
1994 |
< |
else value = 23 -getPdgIdBinValue(mcparticles->at(index).motherId); |
1993 |
> |
if(index == -1) value = 24; |
1994 |
> |
else value = 24 -getPdgIdBinValue(mcparticles->at(index).motherId); |
1995 |
|
} |
1996 |
|
else if(variable == "genMatchedGrandmotherId"){ |
1997 |
|
int index = getGenMatchedParticleIndex(object); |
2003 |
|
} |
2004 |
|
else value = getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
2005 |
|
} |
2006 |
+ |
else if(variable == "genMatchedGrandmotherIdReverse"){ |
2007 |
+ |
int index = getGenMatchedParticleIndex(object); |
2008 |
+ |
if(index == -1) value = 24; |
2009 |
+ |
else if(fabs(mcparticles->at(index).motherId) == 15){ |
2010 |
+ |
int motherIndex = findTauMotherIndex(&mcparticles->at(index)); |
2011 |
+ |
if(motherIndex == -1) value = 24; |
2012 |
+ |
else value = 24 - getPdgIdBinValue(mcparticles->at(motherIndex).motherId); |
2013 |
+ |
} |
2014 |
+ |
else value = 24 - getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
2015 |
+ |
} |
2016 |
+ |
else if(variable == "pfElectronsFromVertex"){ |
2017 |
+ |
double d0Error, dzError; |
2018 |
|
|
2019 |
+ |
d0Error = hypot (object->tkD0err, hypot (chosenVertex ()->xError, chosenVertex ()->yError)); |
2020 |
+ |
dzError = hypot (object->tkDZerr, chosenVertex ()->zError); |
2021 |
+ |
value = fabs (object->correctedD0Vertex) > 0.2 || fabs (object->correctedDZ) > 0.5 |
2022 |
+ |
|| fabs (object->correctedD0Vertex / d0Error) > 99.0 |
2023 |
+ |
|| fabs (object->correctedDZ / dzError) > 99.0; |
2024 |
+ |
value = !value; |
2025 |
+ |
} |
2026 |
|
|
2027 |
|
|
2028 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2028 |
> |
|
2029 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2030 |
|
|
2031 |
|
value = applyFunction(function, value); |
2032 |
|
|
2033 |
|
return value; |
2034 |
|
} |
2035 |
|
|
2036 |
< |
|
2036 |
> |
//!event valueLookup |
2037 |
|
double |
2038 |
< |
OSUAnalysis::valueLookup (const BNevent* object, string variable, string function){ |
2038 |
> |
OSUAnalysis::valueLookup (const BNevent* object, string variable, string function, string &stringValue){ |
2039 |
|
|
2040 |
|
double value = 0.0; |
2041 |
|
|
2104 |
|
else if(variable == "id2") value = object->id2; |
2105 |
|
else if(variable == "evt") value = object->evt; |
2106 |
|
else if(variable == "puScaleFactor"){ |
2107 |
< |
if(datasetType_ != "data") |
2107 |
> |
if(doPileupReweighting_ && datasetType_ != "data") |
2108 |
|
value = puWeight_->at (events->at (0).numTruePV); |
2109 |
|
else |
2110 |
|
value = 1.0; |
2111 |
|
} |
2112 |
< |
else if(variable == "muonScaleFactor"){ |
2113 |
< |
if(datasetType_ != "data") |
2114 |
< |
// value = muonSFWeight_->at (chosenMuon ()->eta); |
1715 |
< |
value = 1.0; |
1716 |
< |
else |
1717 |
< |
value = 1.0; |
1718 |
< |
} |
1719 |
< |
else if(variable == "electronScaleFactor"){ |
1720 |
< |
if(datasetType_ != "data") |
1721 |
< |
// value = electronSFWeight_->at (chosenElectron ()->eta, chosenElectron ()->pt); |
1722 |
< |
value = 1.0; |
1723 |
< |
else |
1724 |
< |
value = 1.0; |
1725 |
< |
} |
2112 |
> |
else if(variable == "muonScaleFactor") value = muonScaleFactor_; |
2113 |
> |
else if(variable == "electronScaleFactor") value = electronScaleFactor_; |
2114 |
> |
else if(variable == "stopCTauScaleFactor") value = stopCTauScaleFactor_; |
2115 |
|
|
2116 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2116 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2117 |
|
|
2118 |
|
value = applyFunction(function, value); |
2119 |
|
|
2120 |
|
return value; |
2121 |
|
} |
2122 |
|
|
2123 |
+ |
//!tau valueLookup |
2124 |
|
double |
2125 |
< |
OSUAnalysis::valueLookup (const BNtau* object, string variable, string function){ |
2125 |
> |
OSUAnalysis::valueLookup (const BNtau* object, string variable, string function, string &stringValue){ |
2126 |
|
|
2127 |
|
double value = 0.0; |
2128 |
|
|
2168 |
|
|
2169 |
|
|
2170 |
|
|
2171 |
< |
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
2171 |
> |
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
2172 |
|
|
2173 |
|
else if(variable == "genMatchedPdgId"){ |
2174 |
|
int index = getGenMatchedParticleIndex(object); |
2188 |
|
} |
2189 |
|
else if(variable == "genMatchedMotherIdReverse"){ |
2190 |
|
int index = getGenMatchedParticleIndex(object); |
2191 |
< |
if(index == -1) value = 23; |
2192 |
< |
else value = 23 -getPdgIdBinValue(mcparticles->at(index).motherId); |
2191 |
> |
if(index == -1) value = 24; |
2192 |
> |
else value = 24 -getPdgIdBinValue(mcparticles->at(index).motherId); |
2193 |
|
} |
2194 |
|
else if(variable == "genMatchedGrandmotherId"){ |
2195 |
|
int index = getGenMatchedParticleIndex(object); |
2201 |
|
} |
2202 |
|
else value = getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
2203 |
|
} |
2204 |
+ |
else if(variable == "genMatchedGrandmotherIdReverse"){ |
2205 |
+ |
int index = getGenMatchedParticleIndex(object); |
2206 |
+ |
if(index == -1) value = 24; |
2207 |
+ |
else if(fabs(mcparticles->at(index).motherId) == 15){ |
2208 |
+ |
int motherIndex = findTauMotherIndex(&mcparticles->at(index)); |
2209 |
+ |
if(motherIndex == -1) value = 24; |
2210 |
+ |
else value = 24 - getPdgIdBinValue(mcparticles->at(motherIndex).motherId); |
2211 |
+ |
} |
2212 |
+ |
else value = 24 - getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
2213 |
+ |
} |
2214 |
|
|
2215 |
|
|
2216 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2216 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2217 |
|
|
2218 |
|
value = applyFunction(function, value); |
2219 |
|
|
2220 |
|
return value; |
2221 |
|
} |
2222 |
|
|
2223 |
+ |
//!met valueLookup |
2224 |
|
double |
2225 |
< |
OSUAnalysis::valueLookup (const BNmet* object, string variable, string function){ |
2225 |
> |
OSUAnalysis::valueLookup (const BNmet* object, string variable, string function, string &stringValue){ |
2226 |
|
|
2227 |
|
double value = 0.0; |
2228 |
|
|
2286 |
|
else if(variable == "pfT1jet10pt") value = object->pfT1jet10pt; |
2287 |
|
else if(variable == "pfT1jet10phi") value = object->pfT1jet10phi; |
2288 |
|
|
2289 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2289 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2290 |
|
|
2291 |
|
value = applyFunction(function, value); |
2292 |
|
|
2293 |
|
return value; |
2294 |
|
} |
2295 |
|
|
2296 |
+ |
//!track valueLookup |
2297 |
|
double |
2298 |
< |
OSUAnalysis::valueLookup (const BNtrack* object, string variable, string function){ |
2298 |
> |
OSUAnalysis::valueLookup (const BNtrack* object, string variable, string function, string &stringValue){ |
2299 |
|
|
2300 |
|
double value = 0.0; |
2301 |
|
double pMag = sqrt(object->pt * object->pt + |
2302 |
< |
object->pz * object->pz); |
2302 |
> |
object->pz * object->pz); |
2303 |
|
|
2304 |
|
if(variable == "pt") value = object->pt; |
2305 |
|
else if(variable == "px") value = object->px; |
2321 |
|
|
2322 |
|
|
2323 |
|
//additional BNs info for disappTrks |
1922 |
– |
else if(variable == "isGoodPtResolution") value = object->isGoodPtResolution; |
2324 |
|
else if(variable == "caloEMDeltaRp3") value = object->caloEMDeltaRp3; |
2325 |
|
else if(variable == "caloHadDeltaRp3") value = object->caloHadDeltaRp3; |
2326 |
|
else if(variable == "caloEMDeltaRp4") value = object->caloEMDeltaRp4; |
2327 |
|
else if(variable == "caloHadDeltaRp4") value = object->caloHadDeltaRp4; |
2328 |
|
else if(variable == "caloEMDeltaRp5") value = object->caloEMDeltaRp5; |
2329 |
|
else if(variable == "caloHadDeltaRp5") value = object->caloHadDeltaRp5; |
2330 |
+ |
else if(variable == "nTracksRp5") value = object->nTracksRp5; |
2331 |
|
else if(variable == "nHitsMissingOuter") value = object->nHitsMissingOuter; |
2332 |
|
else if(variable == "nHitsMissingInner") value = object->nHitsMissingInner; |
2333 |
|
else if(variable == "nHitsMissingMiddle") value = object->nHitsMissingMiddle; |
2334 |
< |
|
2334 |
> |
else if(variable == "depTrkRp5") value = object->depTrkRp5; |
2335 |
|
|
2336 |
|
//user defined variables |
2337 |
|
else if(variable == "d0wrtBS") value = (object->vx-events->at(0).BSx)*object->py/object->pt - (object->vy-events->at(0).BSy)*object->px/object->pt; |
2338 |
|
else if(variable == "dZwrtBS") value = object->dZ - events->at(0).BSz; |
2339 |
< |
else if(variable == "caloTotDeltaRp5") value =(object->caloHadDeltaRp5 + object->caloEMDeltaRp5); |
2340 |
< |
else if(variable == "caloTotDeltaRp5ByP") value =( (object->caloHadDeltaRp5 + object->caloEMDeltaRp5)/pMag); |
2341 |
< |
|
2342 |
< |
|
2343 |
< |
|
2344 |
< |
|
2345 |
< |
|
2346 |
< |
else if(variable == "isIso") value = getTrkIsIso(object, tracks.product()); |
2347 |
< |
else if(variable == "isMatchedDeadEcal") value = getTrkIsMatchedDeadEcal(object); |
2348 |
< |
else if(variable == "ptErrorByPt") value = (object->ptError/object->pt); |
2349 |
< |
else if(variable == "ptError") value = object->ptError; |
2350 |
< |
else if(variable == "ptRes") value = getTrkPtRes(object); |
2351 |
< |
|
2352 |
< |
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
2339 |
> |
else if(variable == "depTrkRp5MinusPt") value = (object->depTrkRp5 - object->pt); |
2340 |
> |
else if(variable == "caloTotDeltaRp5") value = (object->caloHadDeltaRp5 + object->caloEMDeltaRp5); |
2341 |
> |
else if(variable == "caloTotDeltaRp5ByP") value = ((object->caloHadDeltaRp5 + object->caloEMDeltaRp5)/pMag); |
2342 |
> |
else if(variable == "caloTotDeltaRp5RhoCorr") value = getTrkCaloTotRhoCorr(object); |
2343 |
> |
else if(variable == "caloTotDeltaRp5ByPRhoCorr") value = getTrkCaloTotRhoCorr(object) / pMag; |
2344 |
> |
else if(variable == "isIso") value = getTrkIsIso(object, tracks.product()); |
2345 |
> |
else if(variable == "isMatchedDeadEcal") value = getTrkIsMatchedDeadEcal(object); |
2346 |
> |
else if(variable == "ptErrorByPt") value = (object->ptError/object->pt); |
2347 |
> |
else if(variable == "ptError") value = object->ptError; |
2348 |
> |
else if(variable == "ptRes") value = getTrkPtRes(object); |
2349 |
> |
else if (variable == "d0wrtPV"){ |
2350 |
> |
double vx = object->vx - chosenVertex ()->x, |
2351 |
> |
vy = object->vy - chosenVertex ()->y, |
2352 |
> |
px = object->px, |
2353 |
> |
py = object->py, |
2354 |
> |
pt = object->pt; |
2355 |
> |
value = (-vx * py + vy * px) / pt; |
2356 |
> |
} |
2357 |
> |
else if (variable == "dZwrtPV"){ |
2358 |
> |
double vx = object->vx - chosenVertex ()->x, |
2359 |
> |
vy = object->vy - chosenVertex ()->y, |
2360 |
> |
vz = object->vz - chosenVertex ()->z, |
2361 |
> |
px = object->px, |
2362 |
> |
py = object->py, |
2363 |
> |
pz = object->pz, |
2364 |
> |
pt = object->pt; |
2365 |
> |
value = vz - (vx * px + vy * py)/pt * (pz/pt); |
2366 |
> |
} |
2367 |
> |
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
2368 |
|
|
2369 |
|
else if(variable == "genMatchedPdgId"){ |
2370 |
|
int index = getGenMatchedParticleIndex(object); |
2385 |
|
} |
2386 |
|
else if(variable == "genMatchedMotherIdReverse"){ |
2387 |
|
int index = getGenMatchedParticleIndex(object); |
2388 |
< |
if(index == -1) value = 23; |
2389 |
< |
else value = 23 -getPdgIdBinValue(mcparticles->at(index).motherId); |
2388 |
> |
if(index == -1) value = 24; |
2389 |
> |
else value = 24 -getPdgIdBinValue(mcparticles->at(index).motherId); |
2390 |
|
} |
2391 |
|
else if(variable == "genMatchedGrandmotherId"){ |
2392 |
|
int index = getGenMatchedParticleIndex(object); |
2398 |
|
} |
2399 |
|
else value = getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
2400 |
|
} |
2401 |
+ |
else if(variable == "genMatchedGrandmotherIdReverse"){ |
2402 |
+ |
int index = getGenMatchedParticleIndex(object); |
2403 |
+ |
if(index == -1) value = 24; |
2404 |
+ |
else if(fabs(mcparticles->at(index).motherId) == 15){ |
2405 |
+ |
int motherIndex = findTauMotherIndex(&mcparticles->at(index)); |
2406 |
+ |
if(motherIndex == -1) value = 24; |
2407 |
+ |
else value = 24 - getPdgIdBinValue(mcparticles->at(motherIndex).motherId); |
2408 |
+ |
} |
2409 |
+ |
else value = 24 - getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
2410 |
+ |
} |
2411 |
|
|
2412 |
|
|
2413 |
|
|
2414 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2414 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2415 |
|
|
2416 |
|
value = applyFunction(function, value); |
2417 |
|
|
2418 |
|
return value; |
2419 |
|
} |
2420 |
|
|
2421 |
+ |
//!genjet valueLookup |
2422 |
|
double |
2423 |
< |
OSUAnalysis::valueLookup (const BNgenjet* object, string variable, string function){ |
2423 |
> |
OSUAnalysis::valueLookup (const BNgenjet* object, string variable, string function, string &stringValue){ |
2424 |
|
|
2425 |
|
double value = 0.0; |
2426 |
|
|
2440 |
|
else if(variable == "charge") value = object->charge; |
2441 |
|
|
2442 |
|
|
2443 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2443 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2444 |
|
|
2445 |
|
value = applyFunction(function, value); |
2446 |
|
|
2447 |
|
return value; |
2448 |
|
} |
2449 |
|
|
2450 |
+ |
//!mcparticle valueLookup |
2451 |
|
double |
2452 |
< |
OSUAnalysis::valueLookup (const BNmcparticle* object, string variable, string function){ |
2452 |
> |
OSUAnalysis::valueLookup (const BNmcparticle* object, string variable, string function, string &stringValue){ |
2453 |
|
|
2454 |
|
double value = 0.0; |
2455 |
|
|
2574 |
|
} |
2575 |
|
|
2576 |
|
|
2577 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2577 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2578 |
|
|
2579 |
|
value = applyFunction(function, value); |
2580 |
|
|
2581 |
|
return value; |
2582 |
|
} |
2583 |
|
|
2584 |
+ |
//!primaryvertex valueLookup |
2585 |
|
double |
2586 |
< |
OSUAnalysis::valueLookup (const BNprimaryvertex* object, string variable, string function){ |
2586 |
> |
OSUAnalysis::valueLookup (const BNprimaryvertex* object, string variable, string function, string &stringValue){ |
2587 |
|
|
2588 |
|
double value = 0.0; |
2589 |
|
|
2602 |
|
else if(variable == "isGood") value = object->isGood; |
2603 |
|
|
2604 |
|
|
2605 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2605 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2606 |
|
|
2607 |
|
value = applyFunction(function, value); |
2608 |
|
|
2609 |
|
return value; |
2610 |
|
} |
2611 |
|
|
2612 |
+ |
//!bxlumi valueLookup |
2613 |
|
double |
2614 |
< |
OSUAnalysis::valueLookup (const BNbxlumi* object, string variable, string function){ |
2614 |
> |
OSUAnalysis::valueLookup (const BNbxlumi* object, string variable, string function, string &stringValue){ |
2615 |
|
|
2616 |
|
double value = 0.0; |
2617 |
|
|
2620 |
|
else if(variable == "bx_LUMI_now") value = object->bx_LUMI_now; |
2621 |
|
|
2622 |
|
|
2623 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2623 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2624 |
|
|
2625 |
|
value = applyFunction(function, value); |
2626 |
|
|
2627 |
|
return value; |
2628 |
|
} |
2629 |
|
|
2630 |
+ |
//!photon valueLookup |
2631 |
|
double |
2632 |
< |
OSUAnalysis::valueLookup (const BNphoton* object, string variable, string function){ |
2632 |
> |
OSUAnalysis::valueLookup (const BNphoton* object, string variable, string function, string &stringValue){ |
2633 |
|
|
2634 |
|
double value = 0.0; |
2635 |
|
|
2704 |
|
else if(variable == "seedRecoFlag") value = object->seedRecoFlag; |
2705 |
|
|
2706 |
|
|
2275 |
– |
|
2707 |
|
|
2708 |
< |
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
2708 |
> |
|
2709 |
> |
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
2710 |
|
|
2711 |
|
else if(variable == "genMatchedPdgId"){ |
2712 |
|
int index = getGenMatchedParticleIndex(object); |
2728 |
|
} |
2729 |
|
else if(variable == "genMatchedMotherIdReverse"){ |
2730 |
|
int index = getGenMatchedParticleIndex(object); |
2731 |
< |
if(index == -1) value = 23; |
2732 |
< |
else value = 23 -getPdgIdBinValue(mcparticles->at(index).motherId); |
2731 |
> |
if(index == -1) value = 24; |
2732 |
> |
else value = 24 -getPdgIdBinValue(mcparticles->at(index).motherId); |
2733 |
|
} |
2734 |
|
else if(variable == "genMatchedGrandmotherId"){ |
2735 |
|
int index = getGenMatchedParticleIndex(object); |
2741 |
|
} |
2742 |
|
else value = getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
2743 |
|
} |
2744 |
+ |
else if(variable == "genMatchedGrandmotherIdReverse"){ |
2745 |
+ |
int index = getGenMatchedParticleIndex(object); |
2746 |
+ |
if(index == -1) value = 24; |
2747 |
+ |
else if(fabs(mcparticles->at(index).motherId) == 15){ |
2748 |
+ |
int motherIndex = findTauMotherIndex(&mcparticles->at(index)); |
2749 |
+ |
if(motherIndex == -1) value = 24; |
2750 |
+ |
else value = 24 - getPdgIdBinValue(mcparticles->at(motherIndex).motherId); |
2751 |
+ |
} |
2752 |
+ |
else value = 24 - getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
2753 |
+ |
} |
2754 |
|
|
2755 |
|
|
2756 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2756 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2757 |
|
|
2758 |
|
value = applyFunction(function, value); |
2759 |
|
|
2760 |
|
return value; |
2761 |
|
} |
2762 |
|
|
2763 |
+ |
//!supercluster valueLookup |
2764 |
|
double |
2765 |
< |
OSUAnalysis::valueLookup (const BNsupercluster* object, string variable, string function){ |
2765 |
> |
OSUAnalysis::valueLookup (const BNsupercluster* object, string variable, string function, string &stringValue){ |
2766 |
|
|
2767 |
|
double value = 0.0; |
2768 |
|
|
2776 |
|
else if(variable == "theta") value = object->theta; |
2777 |
|
|
2778 |
|
|
2779 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2779 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2780 |
|
|
2781 |
|
value = applyFunction(function, value); |
2782 |
|
|
2783 |
|
return value; |
2784 |
|
} |
2785 |
|
|
2786 |
+ |
//!trigobj valueLookup |
2787 |
+ |
double |
2788 |
+ |
OSUAnalysis::valueLookup (const BNtrigobj* object, string variable, string function, string &stringValue){ |
2789 |
+ |
|
2790 |
+ |
double value = 0.0; |
2791 |
+ |
|
2792 |
+ |
if(variable == "pt") value = object->pt; |
2793 |
+ |
else if(variable == "eta") value = object->eta; |
2794 |
+ |
else if(variable == "phi") value = object->phi; |
2795 |
+ |
else if(variable == "px") value = object->px; |
2796 |
+ |
else if(variable == "py") value = object->py; |
2797 |
+ |
else if(variable == "pz") value = object->pz; |
2798 |
+ |
else if(variable == "et") value = object->et; |
2799 |
+ |
else if(variable == "energy") value = object->energy; |
2800 |
+ |
else if(variable == "etTotal") value = object->etTotal; |
2801 |
+ |
else if(variable == "id") value = object->id; |
2802 |
+ |
else if(variable == "charge") value = object->charge; |
2803 |
+ |
else if(variable == "isIsolated") value = object->isIsolated; |
2804 |
+ |
else if(variable == "isMip") value = object->isMip; |
2805 |
+ |
else if(variable == "isForward") value = object->isForward; |
2806 |
+ |
else if(variable == "isRPC") value = object->isRPC; |
2807 |
+ |
else if(variable == "bx") value = object->bx; |
2808 |
+ |
else if(variable == "filter") { |
2809 |
+ |
if ((stringValue = object->filter) == "") |
2810 |
+ |
stringValue = "none"; // stringValue should only be empty if value is filled |
2811 |
+ |
} |
2812 |
+ |
|
2813 |
+ |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2814 |
+ |
|
2815 |
+ |
value = applyFunction(function, value); |
2816 |
+ |
|
2817 |
+ |
return value; |
2818 |
+ |
} |
2819 |
|
|
2820 |
+ |
//!muon-muon pair valueLookup |
2821 |
|
double |
2822 |
< |
OSUAnalysis::valueLookup (const BNmuon* object1, const BNmuon* object2, string variable, string function){ |
2822 |
> |
OSUAnalysis::valueLookup (const BNmuon* object1, const BNmuon* object2, string variable, string function, string &stringValue){ |
2823 |
|
|
2824 |
|
double value = 0.0; |
2825 |
|
|
2826 |
|
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
2827 |
+ |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
2828 |
|
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
2829 |
|
else if(variable == "invMass"){ |
2830 |
|
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
2834 |
|
else if(variable == "pt"){ |
2835 |
|
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
2836 |
|
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
2837 |
< |
value = (fourVector1 + fourVector2).Et(); |
2837 |
> |
value = (fourVector1 + fourVector2).Pt(); |
2838 |
|
} |
2839 |
|
else if(variable == "threeDAngle") |
2840 |
|
{ |
2866 |
|
else if(variable == "muon2CorrectedD0Vertex"){ |
2867 |
|
value = object2->correctedD0Vertex; |
2868 |
|
} |
2869 |
< |
else if(variable == "muon1timeAtIpInOut"){ |
2869 |
> |
else if(variable == "muon1timeAtIpInOut"){ |
2870 |
|
value = object1->timeAtIpInOut; |
2871 |
|
} |
2872 |
< |
else if(variable == "muon2timeAtIpInOut"){ |
2872 |
> |
else if(variable == "muon2timeAtIpInOut"){ |
2873 |
|
value = object2->timeAtIpInOut; |
2874 |
|
} |
2875 |
< |
else if(variable == "muon1correctedD0") |
2876 |
< |
{ |
2877 |
< |
value = object1->correctedD0; |
2878 |
< |
} |
2879 |
< |
else if(variable == "muon2correctedD0") |
2880 |
< |
{ |
2881 |
< |
value = object2->correctedD0; |
2882 |
< |
} |
2875 |
> |
else if(variable == "muon1correctedD0") |
2876 |
> |
{ |
2877 |
> |
value = object1->correctedD0; |
2878 |
> |
} |
2879 |
> |
else if(variable == "muon2correctedD0") |
2880 |
> |
{ |
2881 |
> |
value = object2->correctedD0; |
2882 |
> |
} |
2883 |
|
|
2884 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2884 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2885 |
|
|
2886 |
|
value = applyFunction(function, value); |
2887 |
|
|
2888 |
|
return value; |
2889 |
|
} |
2890 |
|
|
2891 |
+ |
//!electron-electron pair valueLookup |
2892 |
|
double |
2893 |
< |
OSUAnalysis::valueLookup (const BNelectron* object1, const BNelectron* object2, string variable, string function){ |
2893 |
> |
OSUAnalysis::valueLookup (const BNelectron* object1, const BNelectron* object2, string variable, string function, string &stringValue){ |
2894 |
|
|
2895 |
|
double value = 0.0; |
2896 |
|
|
2897 |
|
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
2898 |
+ |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
2899 |
|
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
2900 |
|
else if(variable == "invMass"){ |
2901 |
|
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
2905 |
|
else if(variable == "pt"){ |
2906 |
|
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
2907 |
|
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
2908 |
< |
value = (fourVector1 + fourVector2).Et(); |
2908 |
> |
value = (fourVector1 + fourVector2).Pt(); |
2909 |
|
} |
2910 |
|
else if(variable == "threeDAngle") |
2911 |
|
{ |
2937 |
|
value = object2->correctedD0; |
2938 |
|
} |
2939 |
|
|
2940 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2940 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2941 |
|
|
2942 |
|
value = applyFunction(function, value); |
2943 |
|
|
2944 |
|
return value; |
2945 |
|
} |
2946 |
< |
|
2946 |
> |
//!electron-muon pair valueLookup |
2947 |
|
double |
2948 |
< |
OSUAnalysis::valueLookup (const BNelectron* object1, const BNmuon* object2, string variable, string function){ |
2948 |
> |
OSUAnalysis::valueLookup (const BNelectron* object1, const BNmuon* object2, string variable, string function, string &stringValue){ |
2949 |
|
|
2950 |
|
double value = 0.0; |
2951 |
|
|
2952 |
|
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
2953 |
+ |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
2954 |
|
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
2955 |
|
else if(variable == "invMass"){ |
2956 |
|
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
2997 |
|
else if(variable == "muonDetIso"){ |
2998 |
|
value = (object2->trackIsoDR03) / object2->pt; |
2999 |
|
} |
3000 |
+ |
else if(variable == "electronRelPFrhoIso"){ |
3001 |
+ |
value = ( object1->chargedHadronIsoDR03 + max(0.0, object1->neutralHadronIsoDR03 + object1->photonIsoDR03 - object1->AEffDr03*object1->rhoPrime) ) / object1->pt; |
3002 |
+ |
} |
3003 |
+ |
else if(variable == "muonRelPFdBetaIso"){ |
3004 |
+ |
value = (object2->pfIsoR04SumChargedHadronPt + max(0.0, object2->pfIsoR04SumNeutralHadronEt + object2->pfIsoR04SumPhotonEt - 0.5*object2->pfIsoR04SumPUPt)) / object2->pt; |
3005 |
+ |
} |
3006 |
+ |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3007 |
+ |
value = applyFunction(function, value); |
3008 |
+ |
|
3009 |
+ |
return value; |
3010 |
+ |
} |
3011 |
+ |
|
3012 |
+ |
//!electron-jet pair valueLookup |
3013 |
+ |
double |
3014 |
+ |
OSUAnalysis::valueLookup (const BNelectron* object1, const BNjet* object2, string variable, string function, string &stringValue){ |
3015 |
+ |
|
3016 |
+ |
double value = 0.0; |
3017 |
+ |
|
3018 |
+ |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
3019 |
+ |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
3020 |
+ |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3021 |
+ |
else if(variable == "invMass"){ |
3022 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
3023 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
3024 |
+ |
value = (fourVector1 + fourVector2).M(); |
3025 |
+ |
} |
3026 |
+ |
else if(variable == "pt"){ |
3027 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
3028 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
3029 |
+ |
value = (fourVector1 + fourVector2).Pt(); |
3030 |
+ |
} |
3031 |
+ |
else if(variable == "threeDAngle") |
3032 |
+ |
{ |
3033 |
+ |
TVector3 threeVector1(object1->px, object1->py, object1->pz); |
3034 |
+ |
TVector3 threeVector2(object2->px, object2->py, object2->pz); |
3035 |
+ |
value = (threeVector1.Angle(threeVector2)); |
3036 |
+ |
} |
3037 |
+ |
else if(variable == "chargeProduct"){ |
3038 |
+ |
value = object1->charge*object2->charge; |
3039 |
+ |
} |
3040 |
+ |
|
3041 |
+ |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3042 |
+ |
value = applyFunction(function, value); |
3043 |
|
|
3044 |
+ |
return value; |
3045 |
+ |
} |
3046 |
|
|
3047 |
+ |
//!muon-jet pair valueLookup |
3048 |
+ |
double |
3049 |
+ |
OSUAnalysis::valueLookup (const BNmuon* object1, const BNjet* object2, string variable, string function, string &stringValue){ |
3050 |
+ |
|
3051 |
+ |
double value = 0.0; |
3052 |
+ |
|
3053 |
+ |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
3054 |
+ |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
3055 |
+ |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3056 |
+ |
else if(variable == "invMass"){ |
3057 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
3058 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
3059 |
+ |
value = (fourVector1 + fourVector2).M(); |
3060 |
+ |
} |
3061 |
+ |
else if(variable == "pt"){ |
3062 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
3063 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
3064 |
+ |
value = (fourVector1 + fourVector2).Pt(); |
3065 |
+ |
} |
3066 |
+ |
else if(variable == "threeDAngle") |
3067 |
+ |
{ |
3068 |
+ |
TVector3 threeVector1(object1->px, object1->py, object1->pz); |
3069 |
+ |
TVector3 threeVector2(object2->px, object2->py, object2->pz); |
3070 |
+ |
value = (threeVector1.Angle(threeVector2)); |
3071 |
+ |
} |
3072 |
+ |
else if(variable == "chargeProduct"){ |
3073 |
+ |
value = object1->charge*object2->charge; |
3074 |
+ |
} |
3075 |
+ |
|
3076 |
+ |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3077 |
+ |
value = applyFunction(function, value); |
3078 |
+ |
|
3079 |
+ |
return value; |
3080 |
+ |
} |
3081 |
+ |
|
3082 |
+ |
//!jet-jet pair valueLookup |
3083 |
+ |
double |
3084 |
+ |
OSUAnalysis::valueLookup (const BNjet* object1, const BNjet* object2, string variable, string function, string &stringValue){ |
3085 |
+ |
|
3086 |
+ |
double value = 0.0; |
3087 |
+ |
|
3088 |
+ |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
3089 |
+ |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
3090 |
+ |
else if(variable == "absDeltaPt") value = fabs(object1->pt - object2->pt); |
3091 |
+ |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3092 |
+ |
else if(variable == "invMass"){ |
3093 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
3094 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
3095 |
+ |
value = (fourVector1 + fourVector2).M(); |
3096 |
+ |
} |
3097 |
+ |
else if(variable == "pt"){ |
3098 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
3099 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
3100 |
+ |
value = (fourVector1 + fourVector2).Pt(); |
3101 |
+ |
} |
3102 |
+ |
else if(variable == "threeDAngle") |
3103 |
+ |
{ |
3104 |
+ |
TVector3 threeVector1(object1->px, object1->py, object1->pz); |
3105 |
+ |
TVector3 threeVector2(object2->px, object2->py, object2->pz); |
3106 |
+ |
value = (threeVector1.Angle(threeVector2)); |
3107 |
+ |
} |
3108 |
+ |
else if(variable == "chargeProduct"){ |
3109 |
+ |
value = object1->charge*object2->charge; |
3110 |
+ |
} |
3111 |
+ |
|
3112 |
+ |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3113 |
+ |
value = applyFunction(function, value); |
3114 |
+ |
|
3115 |
+ |
return value; |
3116 |
+ |
} |
3117 |
+ |
//!electron-track pair valueLookup |
3118 |
+ |
double |
3119 |
+ |
OSUAnalysis::valueLookup (const BNelectron* object1, const BNtrack* object2, string variable, string function, string &stringValue){ |
3120 |
+ |
double electronMass = 0.000511; |
3121 |
+ |
double value = 0.0; |
3122 |
+ |
TLorentzVector fourVector1(0, 0, 0, 0); |
3123 |
+ |
TLorentzVector fourVector2(0, 0, 0, 0); |
3124 |
+ |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
3125 |
+ |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
3126 |
+ |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3127 |
+ |
else if(variable == "invMass"){ |
3128 |
+ |
fourVector1.SetPtEtaPhiM(object1->pt, object1->eta, object1->phi, electronMass); |
3129 |
+ |
fourVector2.SetPtEtaPhiM(object2->pt, object2->eta, object2->phi, electronMass ); |
3130 |
+ |
|
3131 |
+ |
value = (fourVector1 + fourVector2).M(); |
3132 |
+ |
} |
3133 |
+ |
else if(variable == "chargeProduct"){ |
3134 |
+ |
value = object1->charge*object2->charge; |
3135 |
+ |
} |
3136 |
|
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3137 |
+ |
value = applyFunction(function, value); |
3138 |
+ |
return value; |
3139 |
+ |
|
3140 |
+ |
} |
3141 |
+ |
|
3142 |
+ |
|
3143 |
+ |
//!muon-track pair valueLookup |
3144 |
+ |
double |
3145 |
+ |
OSUAnalysis::valueLookup (const BNmuon* object1, const BNtrack* object2, string variable, string function, string &stringValue){ |
3146 |
+ |
double pionMass = 0.140; |
3147 |
+ |
double muonMass = 0.106; |
3148 |
+ |
double value = 0.0; |
3149 |
+ |
TLorentzVector fourVector1(0, 0, 0, 0); |
3150 |
+ |
TLorentzVector fourVector2(0, 0, 0, 0); |
3151 |
+ |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
3152 |
+ |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
3153 |
+ |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3154 |
+ |
else if(variable == "invMass"){ |
3155 |
+ |
fourVector1.SetPtEtaPhiM(object1->pt, object1->eta, object1->phi, muonMass); |
3156 |
+ |
fourVector2.SetPtEtaPhiM(object2->pt, object2->eta, object2->phi, pionMass ); |
3157 |
+ |
|
3158 |
+ |
value = (fourVector1 + fourVector2).M(); |
3159 |
+ |
} |
3160 |
+ |
else if(variable == "chargeProduct"){ |
3161 |
+ |
value = object1->charge*object2->charge; |
3162 |
+ |
} |
3163 |
+ |
|
3164 |
+ |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3165 |
+ |
value = applyFunction(function, value); |
3166 |
+ |
return value; |
3167 |
+ |
} |
3168 |
+ |
|
3169 |
+ |
//!tau-tau pair valueLookup |
3170 |
+ |
double |
3171 |
+ |
OSUAnalysis::valueLookup (const BNtau* object1, const BNtau* object2, string variable, string function, string &stringValue){ |
3172 |
+ |
double value = 0.0; |
3173 |
+ |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
3174 |
+ |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
3175 |
+ |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3176 |
+ |
else if(variable == "invMass"){ |
3177 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
3178 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
3179 |
+ |
value = (fourVector1 + fourVector2).M(); |
3180 |
+ |
} |
3181 |
+ |
|
3182 |
+ |
else if(variable == "chargeProduct"){ |
3183 |
+ |
value = object1->charge*object2->charge; |
3184 |
+ |
} |
3185 |
+ |
|
3186 |
+ |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3187 |
+ |
value = applyFunction(function, value); |
3188 |
+ |
return value; |
3189 |
+ |
} |
3190 |
+ |
|
3191 |
+ |
//!muon-tau pair valueLookup |
3192 |
+ |
double |
3193 |
+ |
OSUAnalysis::valueLookup (const BNmuon* object1, const BNtau* object2, string variable, string function, string &stringValue){ |
3194 |
+ |
double value = 0.0; |
3195 |
+ |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
3196 |
+ |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
3197 |
+ |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3198 |
+ |
else if(variable == "invMass"){ |
3199 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
3200 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
3201 |
+ |
value = (fourVector1 + fourVector2).M(); |
3202 |
+ |
} |
3203 |
+ |
|
3204 |
+ |
else if(variable == "chargeProduct"){ |
3205 |
+ |
value = object1->charge*object2->charge; |
3206 |
+ |
} |
3207 |
+ |
|
3208 |
+ |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3209 |
+ |
value = applyFunction(function, value); |
3210 |
+ |
return value; |
3211 |
+ |
} |
3212 |
+ |
|
3213 |
+ |
//!tau-track pair valueLookup |
3214 |
+ |
double |
3215 |
+ |
OSUAnalysis::valueLookup (const BNtau* object1, const BNtrack* object2, string variable, string function, string &stringValue){ |
3216 |
+ |
double value = 0.0; |
3217 |
+ |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
3218 |
+ |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3219 |
+ |
else if(variable == "chargeProduct"){ |
3220 |
+ |
value = object1->charge*object2->charge; |
3221 |
+ |
} |
3222 |
+ |
|
3223 |
+ |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3224 |
+ |
value = applyFunction(function, value); |
3225 |
+ |
return value; |
3226 |
+ |
} |
3227 |
+ |
|
3228 |
+ |
|
3229 |
+ |
//!track-event pair valueLookup |
3230 |
+ |
double |
3231 |
+ |
OSUAnalysis::valueLookup (const BNtrack* object1, const BNevent* object2, string variable, string function, string &stringValue){ |
3232 |
+ |
|
3233 |
+ |
double value = 0.0; |
3234 |
+ |
double pMag = sqrt(object1->pt * object1->pt + |
3235 |
+ |
object1->pz * object1->pz); |
3236 |
+ |
|
3237 |
+ |
if (variable == "numPV") value = object2->numPV; |
3238 |
+ |
else if (variable == "caloTotDeltaRp5") value = (object1->caloHadDeltaRp5 + object1->caloEMDeltaRp5); |
3239 |
+ |
else if (variable == "caloTotDeltaRp5ByP") value = ((object1->caloHadDeltaRp5 + object1->caloEMDeltaRp5)/pMag); |
3240 |
+ |
else if (variable == "caloTotDeltaRp5_RhoCorr") value = getTrkCaloTotRhoCorr(object1); |
3241 |
+ |
else if (variable == "caloTotDeltaRp5ByP_RhoCorr") value = getTrkCaloTotRhoCorr(object1) / pMag; |
3242 |
+ |
|
3243 |
+ |
else { cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999; } |
3244 |
+ |
|
3245 |
+ |
value = applyFunction(function, value); |
3246 |
+ |
|
3247 |
+ |
return value; |
3248 |
+ |
|
3249 |
+ |
} |
3250 |
+ |
|
3251 |
+ |
//!electron-trigobj pair valueLookup |
3252 |
+ |
double |
3253 |
+ |
OSUAnalysis::valueLookup (const BNelectron* object1, const BNtrigobj* object2, string variable, string function, string &stringValue){ |
3254 |
+ |
|
3255 |
+ |
double value = 0.0; |
3256 |
+ |
|
3257 |
+ |
if (variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3258 |
+ |
else if (variable == "match"){ |
3259 |
+ |
if (deltaR(object1->eta,object1->phi,object2->eta,object2->phi) < 0.2 && abs(object2->id) == 11) |
3260 |
+ |
stringValue = object2->filter; |
3261 |
+ |
else |
3262 |
+ |
stringValue = "none"; |
3263 |
+ |
} |
3264 |
+ |
|
3265 |
+ |
else { cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999; } |
3266 |
+ |
|
3267 |
+ |
value = applyFunction(function, value); |
3268 |
+ |
|
3269 |
+ |
return value; |
3270 |
+ |
|
3271 |
+ |
} |
3272 |
+ |
|
3273 |
+ |
//!muon-trigobj pair valueLookup |
3274 |
+ |
double |
3275 |
+ |
OSUAnalysis::valueLookup (const BNmuon* object1, const BNtrigobj* object2, string variable, string function, string &stringValue){ |
3276 |
+ |
|
3277 |
+ |
double value = 0.0; |
3278 |
+ |
|
3279 |
+ |
if (variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3280 |
+ |
|
3281 |
+ |
else { cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999; } |
3282 |
+ |
|
3283 |
+ |
value = applyFunction(function, value); |
3284 |
+ |
|
3285 |
+ |
return value; |
3286 |
+ |
|
3287 |
+ |
} |
3288 |
+ |
|
3289 |
+ |
//!stop valueLookup |
3290 |
+ |
double |
3291 |
+ |
OSUAnalysis::valueLookup (const BNstop* object, string variable, string function, string &stringValue){ |
3292 |
+ |
|
3293 |
+ |
|
3294 |
+ |
double value = 0.0; |
3295 |
+ |
|
3296 |
+ |
if(variable == "ctau") value = object->ctau; |
3297 |
+ |
|
3298 |
+ |
else if (variable == "d0"){ |
3299 |
+ |
double vx = object->vx - chosenVertex ()->x, |
3300 |
+ |
vy = object->vy - chosenVertex ()->y, |
3301 |
+ |
px = object->px, |
3302 |
+ |
py = object->py, |
3303 |
+ |
pt = object->pt; |
3304 |
+ |
value = (-vx * py + vy * px) / pt; |
3305 |
+ |
} |
3306 |
+ |
|
3307 |
+ |
else if (variable == "dz"){ |
3308 |
+ |
double vx = object->vx - chosenVertex ()->x, |
3309 |
+ |
vy = object->vy - chosenVertex ()->y, |
3310 |
+ |
vz = object->vz - chosenVertex ()->z, |
3311 |
+ |
px = object->px, |
3312 |
+ |
py = object->py, |
3313 |
+ |
pz = object->pz, |
3314 |
+ |
pt = object->pt; |
3315 |
+ |
value = vz - (vx * px + vy * py)/pt * (pz/pt); |
3316 |
+ |
} |
3317 |
+ |
|
3318 |
+ |
else if (variable == "minD0"){ |
3319 |
+ |
double minD0=999; |
3320 |
+ |
for(BNprimaryvertexCollection::const_iterator vertex = primaryvertexs->begin (); vertex != primaryvertexs->end (); vertex++){ |
3321 |
+ |
double vx = object->vx - vertex->x, |
3322 |
+ |
vy = object->vy - vertex->y, |
3323 |
+ |
px = object->px, |
3324 |
+ |
py = object->py, |
3325 |
+ |
pt = object->pt; |
3326 |
+ |
value = (-vx * py + vy * px) / pt; |
3327 |
+ |
if(abs(value) < abs(minD0)) minD0 = value; |
3328 |
+ |
} |
3329 |
+ |
value = minD0; |
3330 |
+ |
} |
3331 |
+ |
else if (variable == "minDz"){ |
3332 |
+ |
double minDz=999; |
3333 |
+ |
for(BNprimaryvertexCollection::const_iterator vertex = primaryvertexs->begin (); vertex != primaryvertexs->end (); vertex++){ |
3334 |
+ |
double vx = object->vx - vertex->x, |
3335 |
+ |
vy = object->vy - vertex->y, |
3336 |
+ |
vz = object->vz - vertex->z, |
3337 |
+ |
px = object->px, |
3338 |
+ |
py = object->py, |
3339 |
+ |
pz = object->pz, |
3340 |
+ |
pt = object->pt; |
3341 |
+ |
value = vz - (vx * px + vy * py)/pt * (pz/pt); |
3342 |
+ |
if(abs(value) < abs(minDz)) minDz = value; |
3343 |
+ |
} |
3344 |
+ |
value = minDz; |
3345 |
+ |
} |
3346 |
+ |
else if(variable == "distToVertex"){ |
3347 |
+ |
value = sqrt((object->vx-chosenVertex()->x)*(object->vx-chosenVertex()->x) + \ |
3348 |
+ |
(object->vy-chosenVertex()->y)*(object->vy-chosenVertex()->y) + \ |
3349 |
+ |
(object->vz-chosenVertex()->z)*(object->vz-chosenVertex()->z)); |
3350 |
+ |
} |
3351 |
+ |
else if (variable == "minDistToVertex"){ |
3352 |
+ |
double minDistToVertex=999; |
3353 |
+ |
for(BNprimaryvertexCollection::const_iterator vertex = primaryvertexs->begin (); vertex != primaryvertexs->end (); vertex++){ |
3354 |
+ |
value = sqrt((object->vx-vertex->x)*(object->vx-vertex->x) + \ |
3355 |
+ |
(object->vy-vertex->y)*(object->vy-vertex->y) + \ |
3356 |
+ |
(object->vz-vertex->z)*(object->vz-vertex->z)); |
3357 |
+ |
|
3358 |
+ |
if(abs(value) < abs(minDistToVertex)) minDistToVertex = value; |
3359 |
+ |
} |
3360 |
+ |
value = minDistToVertex; |
3361 |
+ |
} |
3362 |
+ |
else if (variable == "distToVertexDifference"){ |
3363 |
+ |
double minDistToVertex=999; |
3364 |
+ |
for(BNprimaryvertexCollection::const_iterator vertex = primaryvertexs->begin (); vertex != primaryvertexs->end (); vertex++){ |
3365 |
+ |
value = sqrt((object->vx-vertex->x)*(object->vx-vertex->x) + \ |
3366 |
+ |
(object->vy-vertex->y)*(object->vy-vertex->y) + \ |
3367 |
+ |
(object->vz-vertex->z)*(object->vz-vertex->z)); |
3368 |
+ |
|
3369 |
+ |
if(abs(value) < abs(minDistToVertex)) minDistToVertex = value; |
3370 |
+ |
} |
3371 |
+ |
double distToChosenVertex = sqrt((object->vx-chosenVertex()->x)*(object->vx-chosenVertex()->x) + \ |
3372 |
+ |
(object->vy-chosenVertex()->y)*(object->vy-chosenVertex()->y) + \ |
3373 |
+ |
(object->vz-chosenVertex()->z)*(object->vz-chosenVertex()->z)); |
3374 |
+ |
|
3375 |
+ |
value = distToChosenVertex - minDistToVertex; |
3376 |
+ |
} |
3377 |
+ |
|
3378 |
+ |
else if (variable == "closestVertexRank"){ |
3379 |
+ |
double minDistToVertex=999; |
3380 |
+ |
int vertex_rank = 0; |
3381 |
+ |
for(BNprimaryvertexCollection::const_iterator vertex = primaryvertexs->begin (); vertex != primaryvertexs->end (); vertex++){ |
3382 |
+ |
vertex_rank++; |
3383 |
+ |
int dist = sqrt((object->vx-vertex->x)*(object->vx-vertex->x) + \ |
3384 |
+ |
(object->vy-vertex->y)*(object->vy-vertex->y) + \ |
3385 |
+ |
(object->vz-vertex->z)*(object->vz-vertex->z)); |
3386 |
+ |
|
3387 |
+ |
if(abs(dist) < abs(minDistToVertex)){ |
3388 |
+ |
value = vertex_rank; |
3389 |
+ |
minDistToVertex = dist; |
3390 |
+ |
} |
3391 |
+ |
} |
3392 |
+ |
} |
3393 |
+ |
|
3394 |
+ |
|
3395 |
+ |
|
3396 |
+ |
|
3397 |
+ |
else { cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999; } |
3398 |
|
|
3399 |
|
value = applyFunction(function, value); |
3400 |
|
|
3401 |
|
return value; |
3402 |
+ |
|
3403 |
|
} |
3404 |
|
|
3405 |
|
|
3406 |
+ |
|
3407 |
+ |
|
3408 |
|
// Calculate the number of tracks in cone of DeltaR<0.5 around track1. |
3409 |
|
// Return true iff no other tracks are found in this cone. |
3410 |
|
int |
3450 |
|
|
3451 |
|
} |
3452 |
|
|
3453 |
+ |
double |
3454 |
+ |
OSUAnalysis::getTrkCaloTotRhoCorr(const BNtrack* track) { |
3455 |
+ |
// Return the pile-up (rho) corrected isolation energy, i.e., the total calorimeter energy around the candidate track. |
3456 |
+ |
if (!useTrackCaloRhoCorr_) return -99; |
3457 |
+ |
// if (!rhokt6CaloJetsHandle_) { |
3458 |
+ |
// cout << "ERROR [getTrkCaloTotRhoCorr]: The collection rhokt6CaloJetsHandle is not available!" << endl; |
3459 |
+ |
// return -99; |
3460 |
+ |
// } |
3461 |
+ |
double radDeltaRCone = 0.5; |
3462 |
+ |
double rhoCorr_kt6CaloJets = *rhokt6CaloJetsHandle_ * TMath::Pi() * pow(radDeltaRCone, 2); // Define effective area as pi*r^2, where r is radius of DeltaR cone. |
3463 |
+ |
double rawCaloTot = track->caloHadDeltaRp5 + track->caloEMDeltaRp5; |
3464 |
+ |
double caloTotRhoCorrCalo = TMath::Max(0., rawCaloTot - rhoCorr_kt6CaloJets); |
3465 |
+ |
return caloTotRhoCorrCalo; |
3466 |
+ |
|
3467 |
+ |
} |
3468 |
+ |
|
3469 |
+ |
|
3470 |
+ |
|
3471 |
+ |
|
3472 |
|
//creates a map of the dead Ecal channels in the barrel and endcap |
3473 |
|
//to see how the map of dead Ecal channels is created look at function getChannelStatusMaps() here: |
3474 |
|
//http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/UserCode/jbrinson/DisappTrk/OSUT3Analysis/AnaTools/src/OSUAnalysis.cc?revision=1.88&view=markup |
3501 |
|
double deltaRLowest = 999; |
3502 |
|
int value = 0; |
3503 |
|
if (DeadEcalVec.size() == 0) WriteDeadEcal(); |
3504 |
< |
for(std::vector<DeadEcal>::const_iterator ecal = DeadEcalVec.begin(); ecal != DeadEcalVec.end(); ++ecal){ |
3504 |
> |
for(vector<DeadEcal>::const_iterator ecal = DeadEcalVec.begin(); ecal != DeadEcalVec.end(); ++ecal){ |
3505 |
|
double eta = ecal->etaEcal; |
3506 |
|
double phi = ecal->phiEcal; |
3507 |
< |
double deltaRtemp = deltaR(eta, track1->eta, phi, track1->phi); |
3507 |
> |
double deltaRtemp = deltaR(eta, phi, track1->eta, track1->phi); |
3508 |
|
if(deltaRtemp < deltaRLowest) deltaRLowest = deltaRtemp; |
3509 |
|
} |
3510 |
|
if (deltaRLowest<0.05) {value = 1;} |
3512 |
|
return value; |
3513 |
|
} |
3514 |
|
|
3515 |
< |
// Returns the smallest DeltaR between the object and any generated true particle in the event. |
3515 |
> |
// Returns the smallest DeltaR between the object and any generated true particle in the event. |
3516 |
|
template <class InputObject> |
3517 |
|
double OSUAnalysis::getGenDeltaRLowest(InputObject object){ |
3518 |
|
double genDeltaRLowest = 999.; |
3519 |
|
for(BNmcparticleCollection::const_iterator mcparticle = mcparticles->begin (); mcparticle != mcparticles->end (); mcparticle++){ |
3520 |
|
double deltaRtemp = deltaR(mcparticle->eta, mcparticle->phi, object->eta, object->phi); |
3521 |
|
if (deltaRtemp < genDeltaRLowest) genDeltaRLowest = deltaRtemp; |
3522 |
< |
} |
3522 |
> |
} |
3523 |
|
return genDeltaRLowest; |
3524 |
|
} |
3525 |
|
|
3532 |
|
else if(function == "log") value = log10(value); |
3533 |
|
|
3534 |
|
else if(function == "") value = value; |
3535 |
< |
else{std::cout << "WARNING: invalid function '" << function << "'\n";} |
3535 |
> |
else{cout << "WARNING: invalid function '" << function << "'\n";} |
3536 |
|
|
3537 |
|
return value; |
3538 |
|
|
3542 |
|
template <class InputCollection> |
3543 |
|
void OSUAnalysis::setObjectFlags(cut ¤tCut, uint currentCutIndex, flagMap &individualFlags, flagMap &cumulativeFlags, InputCollection inputCollection, string inputType){ |
3544 |
|
|
3545 |
+ |
if (currentCut.inputCollection.find("pair")!=string::npos) { |
3546 |
+ |
string obj1, obj2; |
3547 |
+ |
getTwoObjs(currentCut.inputCollection, obj1, obj2); |
3548 |
+ |
if (inputType==obj1 || |
3549 |
+ |
inputType==obj2) { |
3550 |
+ |
// Do not add a cut to individualFlags or cumulativeFlags, if the cut is on a paired collection, |
3551 |
+ |
// and the inputType is a member of the pair. |
3552 |
+ |
// The cut will instead be applied when the setObjectFlags() is called for the paired collection. |
3553 |
+ |
// For example, if currentCut.inputCollection==electron-muon pairs, |
3554 |
+ |
// then the flags should not be set here when inputType==muons or inputType==electrons. |
3555 |
+ |
return; |
3556 |
+ |
} |
3557 |
+ |
} |
3558 |
|
|
3559 |
|
for (uint object = 0; object != inputCollection->size(); object++){ |
3560 |
|
|
2650 |
– |
|
3561 |
|
bool decision = true;//object passes if this cut doesn't cut on that type of object |
3562 |
|
|
2653 |
– |
|
3563 |
|
if(currentCut.inputCollection == inputType){ |
3564 |
|
|
3565 |
|
vector<bool> subcutDecisions; |
3566 |
|
for( int subcutIndex = 0; subcutIndex != currentCut.numSubcuts; subcutIndex++){ |
3567 |
< |
double value = valueLookup(&inputCollection->at(object), currentCut.variables.at(subcutIndex), currentCut.functions.at(subcutIndex)); |
3568 |
< |
subcutDecisions.push_back(evaluateComparison(value,currentCut.comparativeOperators.at(subcutIndex),currentCut.cutValues.at(subcutIndex))); |
3567 |
> |
string stringValue = ""; |
3568 |
> |
double value = valueLookup(&inputCollection->at(object), currentCut.variables.at(subcutIndex), currentCut.functions.at(subcutIndex), stringValue); |
3569 |
> |
if (stringValue == "") subcutDecisions.push_back(evaluateComparison(value,currentCut.comparativeOperators.at(subcutIndex),currentCut.cutValues.at(subcutIndex))); |
3570 |
> |
else subcutDecisions.push_back(evaluateComparison(stringValue,currentCut.comparativeOperators.at(subcutIndex),currentCut.cutStringValues.at(subcutIndex))); |
3571 |
> |
|
3572 |
|
} |
3573 |
|
if(currentCut.numSubcuts == 1) decision = subcutDecisions.at(0); |
3574 |
|
else{ |
3582 |
|
decision = tempDecision; |
3583 |
|
} |
3584 |
|
} |
2673 |
– |
individualFlags.at(inputType).at(currentCutIndex).push_back(decision); |
3585 |
|
|
3586 |
+ |
individualFlags.at(inputType).at(currentCutIndex).push_back(decision); |
3587 |
|
|
3588 |
|
//set flags for objects that pass each cut AND all the previous cuts |
3589 |
|
bool previousCumulativeFlag = true; |
3593 |
|
} |
3594 |
|
cumulativeFlags.at(inputType).at(currentCutIndex).push_back(previousCumulativeFlag && decision); |
3595 |
|
|
2684 |
– |
|
3596 |
|
} |
3597 |
|
|
3598 |
|
} |
3606 |
|
bool sameObjects = false; |
3607 |
|
if(typeid(InputCollection1).name() == typeid(InputCollection2).name()) sameObjects = true; |
3608 |
|
|
3609 |
+ |
// Get the strings for the two objects that make up the pair. |
3610 |
+ |
string obj1Type, obj2Type; |
3611 |
+ |
getTwoObjs(inputType, obj1Type, obj2Type); |
3612 |
+ |
bool isTwoTypesOfObject = true; |
3613 |
+ |
if (obj1Type==obj2Type) isTwoTypesOfObject = false; |
3614 |
+ |
|
3615 |
+ |
// Initialize the flags for individual objects to all be false, if the cut is on the pair. |
3616 |
+ |
// Set them to true later, if any paired object passes (in which case both of its constituents should pass). |
3617 |
+ |
if (currentCut.inputCollection == inputType) { |
3618 |
+ |
for (uint object1 = 0; object1 != inputCollection1->size(); object1++) { |
3619 |
+ |
individualFlags.at(obj1Type).at(currentCutIndex).push_back(false); |
3620 |
+ |
cumulativeFlags.at(obj1Type).at(currentCutIndex).push_back(false); |
3621 |
+ |
} |
3622 |
+ |
if (isTwoTypesOfObject) { // Only initialize the second object if it is different from the first. |
3623 |
+ |
for (uint object2 = 0; object2 != inputCollection2->size(); object2++) { |
3624 |
+ |
individualFlags.at(obj2Type).at(currentCutIndex).push_back(false); |
3625 |
+ |
cumulativeFlags.at(obj2Type).at(currentCutIndex).push_back(false); |
3626 |
+ |
} |
3627 |
+ |
} |
3628 |
+ |
} |
3629 |
|
|
3630 |
|
int counter = 0; |
3631 |
+ |
|
3632 |
|
for (uint object1 = 0; object1 != inputCollection1->size(); object1++){ |
3633 |
|
for (uint object2 = 0; object2 != inputCollection2->size(); object2++){ |
3634 |
|
|
3641 |
|
|
3642 |
|
vector<bool> subcutDecisions; |
3643 |
|
for( int subcutIndex = 0; subcutIndex != currentCut.numSubcuts; subcutIndex++){ |
3644 |
< |
double value = valueLookup(&inputCollection1->at(object1), &inputCollection2->at(object2), currentCut.variables.at(subcutIndex), currentCut.functions.at(subcutIndex)); |
3645 |
< |
subcutDecisions.push_back(evaluateComparison(value,currentCut.comparativeOperators.at(subcutIndex),currentCut.cutValues.at(subcutIndex))); |
3644 |
> |
string stringValue = ""; |
3645 |
> |
double value = valueLookup(&inputCollection1->at(object1), &inputCollection2->at(object2), currentCut.variables.at(subcutIndex), currentCut.functions.at(subcutIndex), stringValue); |
3646 |
> |
if (stringValue == "") subcutDecisions.push_back(evaluateComparison(value,currentCut.comparativeOperators.at(subcutIndex),currentCut.cutValues.at(subcutIndex))); |
3647 |
> |
else subcutDecisions.push_back(evaluateComparison(stringValue,currentCut.comparativeOperators.at(subcutIndex),currentCut.cutStringValues.at(subcutIndex))); |
3648 |
|
} |
3649 |
|
|
3650 |
|
if(currentCut.numSubcuts == 1) decision = subcutDecisions.at(0); |
3659 |
|
decision = tempDecision; |
3660 |
|
} |
3661 |
|
} |
3662 |
+ |
// if (decision) isPassObj1.at(object1) = true; |
3663 |
+ |
// if (decision) isPassObj2.at(object2) = true; |
3664 |
|
individualFlags.at(inputType).at(currentCutIndex).push_back(decision); |
3665 |
+ |
if (decision && currentCut.inputCollection == inputType) { // only set the flags for the individual objects if the pair object is being cut on |
3666 |
+ |
individualFlags.at(obj1Type).at(currentCutIndex).at(object1) = true; |
3667 |
+ |
individualFlags.at(obj2Type).at(currentCutIndex).at(object2) = true; |
3668 |
+ |
} |
3669 |
|
|
3670 |
|
//set flags for objects that pass each cut AND all the previous cuts |
3671 |
|
bool previousCumulativeFlag = true; |
3680 |
|
else if(flags2.size() == 0) currentCumulativeFlag = previousCumulativeFlag && decision && flags1.at(object1); |
3681 |
|
else currentCumulativeFlag = previousCumulativeFlag && decision && flags1.at(object1) && flags2.at(object2); |
3682 |
|
cumulativeFlags.at(inputType).at(currentCutIndex).push_back(currentCumulativeFlag); |
3683 |
< |
|
3683 |
> |
if (currentCumulativeFlag && currentCut.inputCollection == inputType) { // only set the flags for the individual objects if the pair object is being cut on |
3684 |
> |
cumulativeFlags.at(obj1Type).at(currentCutIndex).at(object1) = true && getPreviousCumulativeFlags(currentCutIndex, individualFlags, obj1Type, object1); |
3685 |
> |
cumulativeFlags.at(obj2Type).at(currentCutIndex).at(object2) = true && getPreviousCumulativeFlags(currentCutIndex, individualFlags, obj2Type, object2); |
3686 |
> |
} |
3687 |
|
counter++; |
2745 |
– |
} |
3688 |
|
|
3689 |
< |
} |
3689 |
> |
} // end for (uint object2 = 0; object2 != inputCollection2->size(); object2++) |
3690 |
> |
} // end for (uint object1 = 0; object1 != inputCollection1->size(); object1++) |
3691 |
|
|
3692 |
+ |
} |
3693 |
|
|
3694 |
+ |
|
3695 |
+ |
bool OSUAnalysis::getPreviousCumulativeFlags(uint currentCutIndex, flagMap &individualFlags, string obj1Type, uint object1) { |
3696 |
+ |
// Return true iff for the collection obj1Type, the element with index object1 has individal flags set to true for |
3697 |
+ |
// all cuts up to currentCutIndex |
3698 |
+ |
bool previousCumulativeFlag = true; |
3699 |
+ |
for (uint previousCutIndex = 0; previousCutIndex < currentCutIndex; previousCutIndex++) { |
3700 |
+ |
if (previousCumulativeFlag && individualFlags.at(obj1Type).at(previousCutIndex).at(object1)) previousCumulativeFlag = true; |
3701 |
+ |
else { |
3702 |
+ |
previousCumulativeFlag = false; break; |
3703 |
+ |
} |
3704 |
+ |
} |
3705 |
+ |
return previousCumulativeFlag; |
3706 |
|
} |
3707 |
|
|
3708 |
|
|
3716 |
|
string currentString = parameters.inputVariables.at(0); |
3717 |
|
string inputVariable = ""; |
3718 |
|
string function = ""; |
3719 |
< |
if(currentString.find("(")==std::string::npos){ |
3719 |
> |
if(currentString.find("(")==string::npos){ |
3720 |
|
inputVariable = currentString;// variable to cut on |
3721 |
|
} |
3722 |
|
else{ |
3725 |
|
inputVariable = inputVariable.substr(0,inputVariable.size()-1);//remove trailing ")" |
3726 |
|
} |
3727 |
|
|
3728 |
< |
double value = valueLookup(&inputCollection->at(object), inputVariable, function); |
3728 |
> |
string stringValue = ""; |
3729 |
> |
double value = valueLookup(&inputCollection->at(object), inputVariable, function, stringValue); |
3730 |
|
histo->Fill(value,scaleFactor); |
2774 |
– |
|
3731 |
|
if (printEventInfo_) { |
3732 |
< |
// Write information about event to screen, for testing purposes. |
3733 |
< |
cout << " Info for event: value for histogram " << histo->GetName() << ": " << value << endl; |
3732 |
> |
// Write information about event to screen, for testing purposes. |
3733 |
> |
cout << " Info for event: value for histogram " << histo->GetName() << ": " << value << endl; |
3734 |
|
} |
3735 |
< |
|
3735 |
> |
|
3736 |
|
} |
3737 |
|
} |
3738 |
|
|
3742 |
|
bool sameObjects = false; |
3743 |
|
if(typeid(InputCollection1).name() == typeid(InputCollection2).name()) sameObjects = true; |
3744 |
|
|
3745 |
< |
int pairCounter = 0; |
3745 |
> |
int pairCounter = -1; |
3746 |
|
for (uint object1 = 0; object1 != inputCollection1->size(); object1++){ |
3747 |
|
for (uint object2 = 0; object2 != inputCollection2->size(); object2++){ |
3748 |
|
|
3749 |
|
if(sameObjects && object1 >= object2) continue;//account for duplicate pairs if both collections are the same |
3750 |
|
|
3751 |
+ |
pairCounter++; |
3752 |
|
//only take objects which have passed all cuts and pairs which have passed all cuts |
3753 |
|
if(!plotAllObjectsInPassingEvents_ && !flags1.at(object1)) continue; |
3754 |
|
if(!plotAllObjectsInPassingEvents_ && !flags2.at(object2)) continue; |
3757 |
|
string currentString = parameters.inputVariables.at(0); |
3758 |
|
string inputVariable = ""; |
3759 |
|
string function = ""; |
3760 |
< |
if(currentString.find("(")==std::string::npos){ |
3760 |
> |
if(currentString.find("(")==string::npos){ |
3761 |
|
inputVariable = currentString;// variable to cut on |
3762 |
|
} |
3763 |
|
else{ |
3766 |
|
inputVariable = inputVariable.substr(0,inputVariable.size()-1);//remove trailing ")" |
3767 |
|
} |
3768 |
|
|
3769 |
< |
double value = valueLookup(&inputCollection1->at(object1), &inputCollection2->at(object2), inputVariable, function); |
3769 |
> |
string stringValue = ""; |
3770 |
> |
double value = valueLookup(&inputCollection1->at(object1), &inputCollection2->at(object2), inputVariable, function, stringValue); |
3771 |
|
histo->Fill(value,scaleFactor); |
3772 |
|
|
2815 |
– |
pairCounter++; |
3773 |
|
} |
3774 |
|
} |
3775 |
|
|
3783 |
|
|
3784 |
|
if(!plotAllObjectsInPassingEvents_ && !flags.at(object)) continue; |
3785 |
|
|
3786 |
+ |
string stringValue = ""; |
3787 |
|
string currentString = parameters.inputVariables.at(0); |
3788 |
|
string inputVariable = ""; |
3789 |
|
string function = ""; |
3790 |
< |
if(currentString.find("(")==std::string::npos){ |
3790 |
> |
if(currentString.find("(")==string::npos){ |
3791 |
|
inputVariable = currentString;// variable to cut on |
3792 |
|
} |
3793 |
|
else{ |
3795 |
|
inputVariable = currentString.substr(currentString.find("(")+1);//get rest of string |
3796 |
|
inputVariable = inputVariable.substr(0,inputVariable.size()-1);//remove trailing ")" |
3797 |
|
} |
3798 |
< |
double valueX = valueLookup(&inputCollection->at(object), inputVariable, function); |
3798 |
> |
double valueX = valueLookup(&inputCollection->at(object), inputVariable, function, stringValue); |
3799 |
|
|
3800 |
|
currentString = parameters.inputVariables.at(1); |
3801 |
|
inputVariable = ""; |
3802 |
|
function = ""; |
3803 |
< |
if(currentString.find("(")==std::string::npos){ |
3803 |
> |
if(currentString.find("(")==string::npos){ |
3804 |
|
inputVariable = currentString;// variable to cut on |
3805 |
|
} |
3806 |
|
else{ |
3809 |
|
inputVariable = inputVariable.substr(0,inputVariable.size()-1);//remove trailing ")" |
3810 |
|
} |
3811 |
|
|
3812 |
< |
double valueY = valueLookup(&inputCollection->at(object), inputVariable, function); |
3812 |
> |
double valueY = valueLookup(&inputCollection->at(object), inputVariable, function, stringValue); |
3813 |
|
|
3814 |
|
histo->Fill(valueX,valueY,scaleFactor); |
3815 |
|
|
3823 |
|
bool sameObjects = false; |
3824 |
|
if(typeid(InputCollection1).name() == typeid(InputCollection2).name()) sameObjects = true; |
3825 |
|
|
3826 |
< |
int pairCounter = 0; |
3826 |
> |
int pairCounter = -1; |
3827 |
|
for (uint object1 = 0; object1 != inputCollection1->size(); object1++){ |
3828 |
|
for (uint object2 = 0; object2 != inputCollection2->size(); object2++){ |
3829 |
|
|
3830 |
|
if(sameObjects && object1 >= object2) continue;//account for duplicate pairs if both collections are the same |
3831 |
|
|
3832 |
+ |
pairCounter++; |
3833 |
+ |
|
3834 |
|
//only take objects which have passed all cuts and pairs which have passed all cuts |
3835 |
|
if(!plotAllObjectsInPassingEvents_ && !flags1.at(object1)) continue; |
3836 |
|
if(!plotAllObjectsInPassingEvents_ && !flags2.at(object2)) continue; |
3837 |
|
if(!plotAllObjectsInPassingEvents_ && !pairFlags.at(pairCounter)) continue; |
3838 |
|
|
3839 |
+ |
string stringValue = ""; |
3840 |
|
string currentString = parameters.inputVariables.at(0); |
3841 |
|
string inputVariable = ""; |
3842 |
|
string function = ""; |
3843 |
< |
if(currentString.find("(")==std::string::npos){ |
3843 |
> |
if(currentString.find("(")==string::npos){ |
3844 |
|
inputVariable = currentString;// variable to cut on |
3845 |
|
} |
3846 |
|
else{ |
3848 |
|
inputVariable = currentString.substr(currentString.find("(")+1);//get rest of string |
3849 |
|
inputVariable = inputVariable.substr(0,inputVariable.size()-1);//remove trailing ")" |
3850 |
|
} |
3851 |
< |
double valueX = valueLookup(&inputCollection1->at(object1), &inputCollection2->at(object2), inputVariable, function); |
3851 |
> |
double valueX = valueLookup(&inputCollection1->at(object1), &inputCollection2->at(object2), inputVariable, function, stringValue); |
3852 |
|
|
3853 |
|
currentString = parameters.inputVariables.at(1); |
3854 |
|
inputVariable = ""; |
3855 |
|
function = ""; |
3856 |
< |
if(currentString.find("(")==std::string::npos){ |
3856 |
> |
if(currentString.find("(")==string::npos){ |
3857 |
|
inputVariable = currentString;// variable to cut on |
3858 |
|
} |
3859 |
|
else{ |
3861 |
|
inputVariable = currentString.substr(currentString.find("(")+1);//get rest of string |
3862 |
|
inputVariable = inputVariable.substr(0,inputVariable.size()-1);//remove trailing ")" |
3863 |
|
} |
3864 |
< |
double valueY = valueLookup(&inputCollection1->at(object1), &inputCollection2->at(object2), inputVariable, function); |
3864 |
> |
double valueY = valueLookup(&inputCollection1->at(object1), &inputCollection2->at(object2), inputVariable, function, stringValue); |
3865 |
|
|
3866 |
|
|
3867 |
|
histo->Fill(valueX,valueY,scaleFactor); |
3868 |
|
|
2908 |
– |
pairCounter++; |
2909 |
– |
|
3869 |
|
} |
3870 |
|
} |
3871 |
|
|
3882 |
|
|
3883 |
|
double currentDeltaR = deltaR(object->eta,object->phi,mcparticle->eta,mcparticle->phi); |
3884 |
|
if(currentDeltaR > 0.05) continue; |
3885 |
< |
// cout << std::setprecision(3) << std::setw(20) |
3886 |
< |
// << "\tcurrentParticle: eta = " << mcparticles->at(mcparticle - mcparticles->begin()).eta |
3887 |
< |
// << std::setw(20) |
3888 |
< |
// << "\tphi = " << mcparticles->at(mcparticle - mcparticles->begin()).phi |
3889 |
< |
// << std::setw(20) |
3890 |
< |
// << "\tdeltaR = " << currentDeltaR |
3891 |
< |
// << std::setprecision(1) |
3892 |
< |
// << std::setw(20) |
3893 |
< |
// << "\tid = " << mcparticles->at(mcparticle - mcparticles->begin()).id |
3894 |
< |
// << std::setw(20) |
3895 |
< |
// << "\tmotherId = " << mcparticles->at(mcparticle - mcparticles->begin()).motherId |
3896 |
< |
// << std::setw(20) |
3897 |
< |
// << "\tstatus = " << mcparticles->at(mcparticle - mcparticles->begin()).status<< endl; |
3885 |
> |
// cout << setprecision(3) << setw(20) |
3886 |
> |
// << "\tcurrentParticle: eta = " << mcparticles->at(mcparticle - mcparticles->begin()).eta |
3887 |
> |
// << setw(20) |
3888 |
> |
// << "\tphi = " << mcparticles->at(mcparticle - mcparticles->begin()).phi |
3889 |
> |
// << setw(20) |
3890 |
> |
// << "\tdeltaR = " << currentDeltaR |
3891 |
> |
// << setprecision(1) |
3892 |
> |
// << setw(20) |
3893 |
> |
// << "\tid = " << mcparticles->at(mcparticle - mcparticles->begin()).id |
3894 |
> |
// << setw(20) |
3895 |
> |
// << "\tmotherId = " << mcparticles->at(mcparticle - mcparticles->begin()).motherId |
3896 |
> |
// << setw(20) |
3897 |
> |
// << "\tstatus = " << mcparticles->at(mcparticle - mcparticles->begin()).status<< endl; |
3898 |
|
if(currentDeltaR < bestMatchDeltaR && mcparticles->at(mcparticle - mcparticles->begin()).id != mcparticles->at(mcparticle - mcparticles->begin()).motherId){ |
3899 |
|
bestMatchIndex = mcparticle - mcparticles->begin(); |
3900 |
|
bestMatchDeltaR = currentDeltaR; |
3901 |
|
} |
3902 |
|
|
3903 |
|
} |
3904 |
< |
// if(bestMatchDeltaR != 999) cout << "bestMatch: deltaR = " << bestMatchDeltaR << " id = " << mcparticles->at(bestMatchIndex).id << " motherId = " << mcparticles->at(bestMatchIndex).motherId << endl; |
3905 |
< |
// else cout << "no match found..." << endl; |
3904 |
> |
// if(bestMatchDeltaR != 999) cout << "bestMatch: deltaR = " << bestMatchDeltaR << " id = " << mcparticles->at(bestMatchIndex).id << " motherId = " << mcparticles->at(bestMatchIndex).motherId << endl; |
3905 |
> |
// else cout << "no match found..." << endl; |
3906 |
|
return bestMatchIndex; |
3907 |
|
|
3908 |
|
} |
3956 |
|
// 20 strange baryon |
3957 |
|
// 21 charm baryon |
3958 |
|
// 22 bottom baryon |
3959 |
< |
// 23 other |
3959 |
> |
// 23 QCD string |
3960 |
> |
// 24 other |
3961 |
|
|
3962 |
|
int OSUAnalysis::getPdgIdBinValue(int pdgId){ |
3963 |
|
|
3981 |
|
else if(absPdgId > 3000 && absPdgId < 4000 ) binValue = 20; |
3982 |
|
else if(absPdgId > 4000 && absPdgId < 5000 ) binValue = 21; |
3983 |
|
else if(absPdgId > 5000 && absPdgId < 6000 ) binValue = 22; |
3984 |
+ |
else if(absPdgId == 92 ) binValue = 23; |
3985 |
|
|
3986 |
< |
else binValue = 23; |
3986 |
> |
else binValue = 24; |
3987 |
|
|
3988 |
|
return binValue; |
3989 |
|
|
3993 |
|
OSUAnalysis::chosenVertex () |
3994 |
|
{ |
3995 |
|
const BNprimaryvertex *chosenVertex = 0; |
3996 |
< |
if(std::find(objectsToCut.begin(), objectsToCut.end(), "primaryvertexs") != objectsToCut.end()) { |
3997 |
< |
vector<bool> vertexFlags = cumulativeFlags.at("primaryvertexs").back().size() ? cumulativeFlags.at("primaryvertexs").back() : |
3998 |
< |
cumulativeFlags.at("primaryvertexs").at(cumulativeFlags.at("primaryvertexs").size() - 2); |
3996 |
> |
if(cumulativeFlags.find ("primaryvertexs") != cumulativeFlags.end ()){ |
3997 |
> |
vector<bool> vertexFlags; |
3998 |
> |
for (int i = cumulativeFlags.at("primaryvertexs").size() - 1; i >= 0; i--){ |
3999 |
> |
if (cumulativeFlags.at("primaryvertexs").at(i).size()){ |
4000 |
> |
vertexFlags = cumulativeFlags.at("primaryvertexs").at(i); |
4001 |
> |
break; |
4002 |
> |
} |
4003 |
> |
} |
4004 |
|
for (uint vertexIndex = 0; vertexIndex != vertexFlags.size(); vertexIndex++){ |
4005 |
|
if(!vertexFlags.at(vertexIndex)) continue; |
4006 |
|
chosenVertex = & primaryvertexs->at(vertexIndex); |
4007 |
|
break; |
4008 |
|
} |
4009 |
|
} |
4010 |
< |
else { |
4011 |
< |
chosenVertex = &primaryvertexs->at(0); |
3046 |
< |
} |
4010 |
> |
else if (find (objectsToGet.begin (), objectsToGet.end (), "primaryvertexs") != objectsToGet.end ()) |
4011 |
> |
chosenVertex = & primaryvertexs->at (0); |
4012 |
|
|
4013 |
|
return chosenVertex; |
4014 |
|
} |
4017 |
|
OSUAnalysis::chosenMET () |
4018 |
|
{ |
4019 |
|
const BNmet *chosenMET = 0; |
4020 |
< |
if(std::find(objectsToCut.begin(), objectsToCut.end(), "mets") != objectsToCut.end()) { |
4021 |
< |
vector<bool> metFlags = cumulativeFlags.at("mets").back().size() ? cumulativeFlags.at("mets").back() : |
4022 |
< |
cumulativeFlags.at("mets").at(cumulativeFlags.at("mets").size() - 2); |
4020 |
> |
if(cumulativeFlags.find ("mets") != cumulativeFlags.end ()){ |
4021 |
> |
vector<bool> metFlags; |
4022 |
> |
for (int i = cumulativeFlags.at("mets").size() - 1; i >= 0; i--){ |
4023 |
> |
if (cumulativeFlags.at("mets").at(i).size()){ |
4024 |
> |
metFlags = cumulativeFlags.at("mets").at(i); |
4025 |
> |
break; |
4026 |
> |
} |
4027 |
> |
} |
4028 |
|
for (uint metIndex = 0; metIndex != metFlags.size(); metIndex++){ |
4029 |
|
if(!metFlags.at(metIndex)) continue; |
4030 |
|
chosenMET = & mets->at(metIndex); |
4031 |
|
break; |
4032 |
|
} |
4033 |
|
} |
4034 |
< |
else { |
4035 |
< |
chosenMET = &mets->at(0); |
3066 |
< |
} |
4034 |
> |
else if (find (objectsToGet.begin (), objectsToGet.end (), "mets") != objectsToGet.end ()) |
4035 |
> |
chosenMET = & mets->at (0); |
4036 |
|
|
4037 |
|
return chosenMET; |
4038 |
|
} |
4041 |
|
OSUAnalysis::chosenElectron () |
4042 |
|
{ |
4043 |
|
const BNelectron *chosenElectron = 0; |
4044 |
< |
if(std::find(objectsToCut.begin(), objectsToCut.end(), "electrons") != objectsToCut.end()) { |
4045 |
< |
vector<bool> electronFlags = cumulativeFlags.at("electrons").back().size() ? cumulativeFlags.at("electrons").back() : |
4046 |
< |
cumulativeFlags.at("electrons").at(cumulativeFlags.at("electrons").size() - 2); |
4044 |
> |
if(cumulativeFlags.find ("electrons") != cumulativeFlags.end ()){ |
4045 |
> |
vector<bool> electronFlags; |
4046 |
> |
for (int i = cumulativeFlags.at("electrons").size() - 1; i >= 0; i--){ |
4047 |
> |
if (cumulativeFlags.at("electrons").at(i).size()){ |
4048 |
> |
electronFlags = cumulativeFlags.at("electrons").at(i); |
4049 |
> |
break; |
4050 |
> |
} |
4051 |
> |
} |
4052 |
|
for (uint electronIndex = 0; electronIndex != electronFlags.size(); electronIndex++){ |
4053 |
|
if(!electronFlags.at(electronIndex)) continue; |
4054 |
|
chosenElectron = & electrons->at(electronIndex); |
4055 |
|
break; |
4056 |
|
} |
4057 |
|
} |
4058 |
< |
else { |
4059 |
< |
chosenElectron = &electrons->at(0); |
3086 |
< |
} |
4058 |
> |
else if (find (objectsToGet.begin (), objectsToGet.end (), "electrons") != objectsToGet.end ()) |
4059 |
> |
chosenElectron = & electrons->at (0); |
4060 |
|
|
4061 |
|
return chosenElectron; |
4062 |
|
} |
4065 |
|
OSUAnalysis::chosenMuon () |
4066 |
|
{ |
4067 |
|
const BNmuon *chosenMuon = 0; |
4068 |
< |
if(std::find(objectsToCut.begin(), objectsToCut.end(), "muons") != objectsToCut.end()) { |
4069 |
< |
vector<bool> muonFlags = cumulativeFlags.at("muons").back().size() ? cumulativeFlags.at("muons").back() : |
4070 |
< |
cumulativeFlags.at("muons").at(cumulativeFlags.at("muons").size() - 2); |
4068 |
> |
if(cumulativeFlags.find ("muons") != cumulativeFlags.end ()){ |
4069 |
> |
vector<bool> muonFlags; |
4070 |
> |
for (int i = cumulativeFlags.at("muons").size() - 1; i >= 0; i--){ |
4071 |
> |
if (cumulativeFlags.at("muons").at(i).size()){ |
4072 |
> |
muonFlags = cumulativeFlags.at("muons").at(i); |
4073 |
> |
break; |
4074 |
> |
} |
4075 |
> |
} |
4076 |
|
for (uint muonIndex = 0; muonIndex != muonFlags.size(); muonIndex++){ |
4077 |
|
if(!muonFlags.at(muonIndex)) continue; |
4078 |
|
chosenMuon = & muons->at(muonIndex); |
4079 |
|
break; |
4080 |
|
} |
4081 |
|
} |
4082 |
< |
else { |
4083 |
< |
chosenMuon = &muons->at(0); |
3106 |
< |
} |
4082 |
> |
else if (find (objectsToGet.begin (), objectsToGet.end (), "muons") != objectsToGet.end ()) |
4083 |
> |
chosenMuon = & muons->at (0); |
4084 |
|
|
4085 |
|
return chosenMuon; |
4086 |
|
} |
4087 |
|
|
3111 |
– |
|
4088 |
|
DEFINE_FWK_MODULE(OSUAnalysis); |