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