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 (); |
54 |
|
// Construct Cutflow Objects. These store the results of cut decisions and |
55 |
|
// handle filling cut flow histograms. |
56 |
|
masterCutFlow_ = new CutFlow (fs_); |
57 |
– |
vector<TFileDirectory> directories; |
57 |
|
|
58 |
|
//always get vertex collection so we can assign the primary vertex in the event |
59 |
|
objectsToGet.push_back("primaryvertexs"); |
61 |
– |
|
62 |
– |
//always make the plot of number of primary vertices (to check pile-up reweighting) |
60 |
|
objectsToPlot.push_back("primaryvertexs"); |
61 |
+ |
objectsToCut.push_back("primaryvertexs"); |
62 |
+ |
|
63 |
|
|
64 |
|
//always get the MC particles to do GEN-matching |
65 |
|
objectsToGet.push_back("mcparticles"); |
108 |
|
|
109 |
|
} |
110 |
|
|
111 |
+ |
|
112 |
|
vector<edm::ParameterSet> histogramList_ (histogramSets_.at(currentHistogramSet).getParameter<vector<edm::ParameterSet> >("histograms")); |
113 |
|
|
114 |
|
for(uint currentHistogram = 0; currentHistogram != histogramList_.size(); currentHistogram++){ |
171 |
|
tempIdVsGmaIdHisto.title = currentObject+" Gen-matched Particle's Grandmother vs. Particle;Particle;Grandmother"; |
172 |
|
|
173 |
|
|
174 |
< |
int maxNum = 24; |
174 |
> |
int maxNum = 25; |
175 |
|
vector<double> binVector; |
176 |
|
binVector.push_back(maxNum); |
177 |
|
binVector.push_back(0); |
213 |
|
//set triggers for this channel |
214 |
|
vector<string> triggerNames; |
215 |
|
triggerNames.clear(); |
216 |
+ |
vector<string> triggerToVetoNames; |
217 |
+ |
triggerToVetoNames.clear(); |
218 |
+ |
|
219 |
|
tempChannel.triggers.clear(); |
220 |
+ |
tempChannel.triggersToVeto.clear(); |
221 |
|
if(channels_.at(currentChannel).exists("triggers")){ |
222 |
|
triggerNames = channels_.at(currentChannel).getParameter<vector<string> >("triggers"); |
223 |
|
for(uint trigger = 0; trigger!= triggerNames.size(); trigger++) |
224 |
|
tempChannel.triggers.push_back(triggerNames.at(trigger)); |
225 |
|
objectsToGet.push_back("triggers"); |
226 |
|
} |
227 |
< |
|
227 |
> |
if(channels_.at(currentChannel).exists("triggersToVeto")){ |
228 |
> |
triggerToVetoNames = channels_.at(currentChannel).getParameter<vector<string> >("triggersToVeto"); |
229 |
> |
for(uint trigger = 0; trigger!= triggerToVetoNames.size(); trigger++) |
230 |
> |
tempChannel.triggersToVeto.push_back(triggerToVetoNames.at(trigger)); |
231 |
> |
objectsToGet.push_back("triggers"); |
232 |
> |
} |
233 |
|
|
234 |
|
|
235 |
|
|
236 |
|
//create cutFlow for this channel |
237 |
|
cutFlows_.push_back (new CutFlow (fs_, channelName)); |
238 |
+ |
vector<TFileDirectory> directories; //vector of directories in the output file. |
239 |
+ |
vector<string> subSubDirNames;//subdirectories in each channel. |
240 |
+ |
//get list of cuts for this channel |
241 |
+ |
vector<edm::ParameterSet> cuts_ (channels_.at(currentChannel).getParameter<vector<edm::ParameterSet> >("cuts")); |
242 |
|
|
230 |
– |
//book a directory in the output file with the name of the channel |
231 |
– |
TFileDirectory subDir = fs_->mkdir( channelName ); |
232 |
– |
directories.push_back(subDir); |
243 |
|
|
244 |
< |
map<string, TH1D*> oneDhistoMap; |
245 |
< |
oneDHists_.push_back(oneDhistoMap); |
246 |
< |
map<string, TH2D*> twoDhistoMap; |
247 |
< |
twoDHists_.push_back(twoDhistoMap); |
244 |
> |
//loop over and parse all cuts |
245 |
> |
for(uint currentCut = 0; currentCut != cuts_.size(); currentCut++){ |
246 |
> |
cut tempCut; |
247 |
> |
//store input collection for cut |
248 |
> |
string tempInputCollection = cuts_.at(currentCut).getParameter<string> ("inputCollection"); |
249 |
> |
if(tempInputCollection == "muon-electron pairs") tempInputCollection = "electron-muon pairs"; |
250 |
> |
if(tempInputCollection == "jet-electron pairs") tempInputCollection = "electron-jet pairs"; |
251 |
> |
if(tempInputCollection == "jet-muon pairs") tempInputCollection = "muon-jet pairs"; |
252 |
> |
if(tempInputCollection == "event-track pairs") tempInputCollection = "track-event pairs"; |
253 |
> |
if(tempInputCollection == "secondary muon-muon pairs") tempInputCollection = "muon-secondary muon pairs"; |
254 |
> |
if(tempInputCollection == "secondary electron-electron pairs") tempInputCollection = "electron-secondary electron pairs"; |
255 |
> |
if(tempInputCollection == "trigobj-electron pairs") tempInputCollection = "electron-trigobj pairs"; |
256 |
> |
if(tempInputCollection == "trigobj-muon pairs") tempInputCollection = "muon-trigobj pairs"; |
257 |
> |
tempCut.inputCollection = tempInputCollection; |
258 |
> |
if(tempInputCollection.find("pairs")==string::npos){ //just a single object |
259 |
> |
if(tempInputCollection.find("secondary")!=string::npos){//secondary object |
260 |
> |
int spaceIndex = tempInputCollection.find(" "); |
261 |
> |
int secondWordLength = tempInputCollection.size() - spaceIndex; |
262 |
> |
objectsToGet.push_back(tempInputCollection.substr(spaceIndex+1,secondWordLength)); |
263 |
> |
} |
264 |
> |
else{ |
265 |
> |
objectsToGet.push_back(tempInputCollection); |
266 |
> |
} |
267 |
> |
objectsToCut.push_back(tempInputCollection); |
268 |
> |
} |
269 |
> |
else{//pair of objects, need to add them both to objectsToGet |
270 |
> |
string obj1; |
271 |
> |
string obj2; |
272 |
> |
getTwoObjs(tempInputCollection, obj1, obj2); |
273 |
> |
string obj2ToGet = getObjToGet(obj2); |
274 |
> |
objectsToCut.push_back(tempInputCollection); |
275 |
> |
objectsToCut.push_back(obj1); |
276 |
> |
objectsToCut.push_back(obj2); |
277 |
> |
objectsToGet.push_back(tempInputCollection); |
278 |
> |
objectsToGet.push_back(obj1); |
279 |
> |
objectsToGet.push_back(obj2ToGet); |
280 |
|
|
281 |
+ |
} |
282 |
|
|
283 |
|
|
284 |
+ |
|
285 |
+ |
//split cut string into parts and store them |
286 |
+ |
string cutString = cuts_.at(currentCut).getParameter<string> ("cutString"); |
287 |
+ |
vector<string> cutStringVector = splitString(cutString); |
288 |
+ |
if(cutStringVector.size()!=3 && cutStringVector.size() % 4 !=3){ |
289 |
+ |
cout << "Error: Didn't find the expected number elements in the following cut string: '" << cutString << "'\n"; |
290 |
+ |
exit(0); |
291 |
+ |
} |
292 |
+ |
tempCut.numSubcuts = (cutStringVector.size()+1)/4; |
293 |
+ |
for(int subcutIndex = 0; subcutIndex != tempCut.numSubcuts; subcutIndex++){//loop over all the pieces of the cut combined using &,| |
294 |
+ |
int indexOffset = 4 * subcutIndex; |
295 |
+ |
string currentVariableString = cutStringVector.at(indexOffset); |
296 |
+ |
if(currentVariableString.find("(")==string::npos){ |
297 |
+ |
tempCut.functions.push_back("");//no function was specified |
298 |
+ |
tempCut.variables.push_back(currentVariableString);// variable to cut on |
299 |
+ |
} |
300 |
+ |
else{ |
301 |
+ |
tempCut.functions.push_back(currentVariableString.substr(0,currentVariableString.find("(")));//function comes before the "(" |
302 |
+ |
string tempVariable = currentVariableString.substr(currentVariableString.find("(")+1);//get rest of string |
303 |
+ |
tempCut.variables.push_back(tempVariable.substr(0,tempVariable.size()-1));//remove trailing ")" |
304 |
+ |
} |
305 |
+ |
tempCut.comparativeOperators.push_back(cutStringVector.at(indexOffset+1));// comparison to make |
306 |
+ |
tempCut.cutValues.push_back(atof(cutStringVector.at(indexOffset+2).c_str()));// threshold value to pass cut |
307 |
+ |
tempCut.cutStringValues.push_back(cutStringVector.at(indexOffset+2));// string value to pass cut |
308 |
+ |
if(subcutIndex != 0) tempCut.logicalOperators.push_back(cutStringVector.at(indexOffset-1)); // logical comparison (and, or) |
309 |
+ |
} |
310 |
+ |
|
311 |
+ |
//get number of objects required to pass cut for event to pass |
312 |
+ |
string numberRequiredString = cuts_.at(currentCut).getParameter<string> ("numberRequired"); |
313 |
+ |
vector<string> numberRequiredVector = splitString(numberRequiredString); |
314 |
+ |
if(numberRequiredVector.size()!=2){ |
315 |
+ |
cout << "Error: Didn't find two elements in the following number requirement string: '" << numberRequiredString << "'\n"; |
316 |
+ |
exit(0); |
317 |
+ |
} |
318 |
+ |
|
319 |
+ |
int numberRequiredInt = atoi(numberRequiredVector.at(1).c_str()); |
320 |
+ |
tempCut.numberRequired = numberRequiredInt;// number of objects required to pass the cut |
321 |
+ |
tempCut.eventComparativeOperator = numberRequiredVector.at(0);// comparison to make |
322 |
+ |
|
323 |
+ |
//Set up vectors to store the directories and subDIrectories for each channel. |
324 |
+ |
string subSubDirName; |
325 |
+ |
string tempCutName; |
326 |
+ |
if(cuts_.at(currentCut).exists("alias")){ |
327 |
+ |
tempCutName = cuts_.at(currentCut).getParameter<string> ("alias"); |
328 |
+ |
subSubDirName = "After " + cuts_.at(currentCut).getParameter<string> ("alias") + " Cut Applied"; |
329 |
+ |
} |
330 |
+ |
else{ |
331 |
+ |
//construct string for cutflow table |
332 |
+ |
bool plural = numberRequiredInt != 1; |
333 |
+ |
string collectionString = plural ? tempInputCollection : tempInputCollection.substr(0, tempInputCollection.size()-1); |
334 |
+ |
string cutName = numberRequiredString + " " + collectionString + " with " + cutString; |
335 |
+ |
tempCutName = cutName; |
336 |
+ |
subSubDirName = "After " + numberRequiredString + " " + collectionString + " with " + cutString + " Cut Applied"; |
337 |
+ |
} |
338 |
+ |
|
339 |
+ |
subSubDirNames.push_back(subSubDirName); |
340 |
+ |
tempCut.name = tempCutName; |
341 |
+ |
|
342 |
+ |
tempChannel.cuts.push_back(tempCut); |
343 |
+ |
|
344 |
+ |
|
345 |
+ |
}//end loop over cuts |
346 |
+ |
|
347 |
+ |
vector<map<string, TH1D*>> oneDHistsTmp; |
348 |
+ |
vector<map<string, TH2D*>> twoDHistsTmp; |
349 |
+ |
//book a directory in the output file with the name of the channel |
350 |
+ |
TFileDirectory subDir = fs_->mkdir( channelName ); |
351 |
+ |
//loop over the cuts to set up subdirectory for each cut if GetPlotsAfterEachCut_ is true. |
352 |
+ |
if(GetPlotsAfterEachCut_){ |
353 |
+ |
for( uint currentDir=0; currentDir != subSubDirNames.size(); currentDir++){ |
354 |
+ |
TFileDirectory subSubDir = subDir.mkdir( subSubDirNames[currentDir] ); |
355 |
+ |
directories.push_back(subSubDir); |
356 |
+ |
map<string, TH1D*> oneDhistoMap; |
357 |
+ |
oneDHistsTmp.push_back(oneDhistoMap); |
358 |
+ |
map<string, TH2D*> twoDhistoMap; |
359 |
+ |
twoDHistsTmp.push_back(twoDhistoMap); |
360 |
+ |
} |
361 |
+ |
oneDHists_.push_back(oneDHistsTmp); |
362 |
+ |
twoDHists_.push_back(twoDHistsTmp); |
363 |
+ |
} |
364 |
+ |
//only set up directories with names of the channels if GetPlotsAfterEachCut_ is false. |
365 |
+ |
else{ |
366 |
+ |
map<string, TH1D*> oneDhistoMap; |
367 |
+ |
oneDHistsTmp.push_back(oneDhistoMap); |
368 |
+ |
map<string, TH2D*> twoDhistoMap; |
369 |
+ |
twoDHistsTmp.push_back(twoDhistoMap); |
370 |
+ |
oneDHists_.push_back(oneDHistsTmp); |
371 |
+ |
twoDHists_.push_back(twoDHistsTmp); |
372 |
+ |
directories.push_back(subDir); |
373 |
+ |
} |
374 |
|
//book all histograms included in the configuration |
375 |
+ |
for(uint currentDir = 0; currentDir != directories.size(); currentDir++){//loop over all the directories. |
376 |
|
for(uint currentHistogramIndex = 0; currentHistogramIndex != histograms.size(); currentHistogramIndex++){ |
377 |
|
histogram currentHistogram = histograms.at(currentHistogramIndex); |
378 |
|
int numBinsElements = currentHistogram.bins.size(); |
398 |
|
} |
399 |
|
else if(numBinsElements == 3){ |
400 |
|
if (currentHistogram.bins.size () == 3) |
401 |
< |
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)); |
401 |
> |
oneDHists_.at(currentChannel).at(currentDir)[currentHistogram.name] = directories.at(currentDir).make<TH1D> (TString(currentHistogram.name),channelLabel+" channel: "+currentHistogram.title, currentHistogram.bins.at(0), currentHistogram.bins.at(1), currentHistogram.bins.at(2)); |
402 |
|
else |
403 |
|
{ |
404 |
< |
oneDHists_.at(currentChannel)[currentHistogram.name] = directories.at(currentChannel).make<TH1D> (TString(currentHistogram.name),channelLabel+" channel: "+currentHistogram.title, numBinEdgesX - 1, currentHistogram.variableBinsX.data ()); |
404 |
> |
oneDHists_.at(currentChannel).at(currentDir)[currentHistogram.name] = directories.at(currentDir).make<TH1D> (TString(currentHistogram.name),channelLabel+" channel: "+currentHistogram.title, numBinEdgesX - 1, currentHistogram.variableBinsX.data ()); |
405 |
|
} |
406 |
|
} |
407 |
|
else if(numBinsElements == 6){ |
408 |
|
if (currentHistogram.bins.size () == 6) |
409 |
< |
twoDHists_.at(currentChannel)[currentHistogram.name] = directories.at(currentChannel).make<TH2D> (TString(currentHistogram.name),channelLabel+" channel: "+currentHistogram.title, currentHistogram.bins.at(0), currentHistogram.bins.at(1), currentHistogram.bins.at(2),currentHistogram.bins.at(3),currentHistogram.bins.at(4),currentHistogram.bins.at(5)); |
409 |
> |
twoDHists_.at(currentChannel).at(currentDir)[currentHistogram.name] = directories.at(currentDir).make<TH2D> (TString(currentHistogram.name),channelLabel+" channel: "+currentHistogram.title, currentHistogram.bins.at(0), currentHistogram.bins.at(1), currentHistogram.bins.at(2),currentHistogram.bins.at(3),currentHistogram.bins.at(4),currentHistogram.bins.at(5)); |
410 |
|
else |
411 |
< |
twoDHists_.at(currentChannel)[currentHistogram.name] = directories.at(currentChannel).make<TH2D> (TString(currentHistogram.name),channelLabel+" channel: "+currentHistogram.title, numBinEdgesX - 1, currentHistogram.variableBinsX.data (), numBinEdgesY - 1, currentHistogram.variableBinsY.data ()); |
411 |
> |
twoDHists_.at(currentChannel).at(currentDir)[currentHistogram.name] = directories.at(currentDir).make<TH2D> (TString(currentHistogram.name),channelLabel+" channel: "+currentHistogram.title, numBinEdgesX - 1, currentHistogram.variableBinsX.data (), numBinEdgesY - 1, currentHistogram.variableBinsY.data ()); |
412 |
|
} |
413 |
|
|
414 |
|
|
439 |
|
// 20 strange baryon |
440 |
|
// 21 charm baryon |
441 |
|
// 22 bottom baryon |
442 |
< |
// 23 other |
442 |
> |
// 23 QCD string |
443 |
> |
// 24 other |
444 |
|
|
445 |
|
vector<TString> labelArray; |
446 |
|
labelArray.push_back("unmatched"); |
466 |
|
labelArray.push_back("strange baryon"); |
467 |
|
labelArray.push_back("charm baryon"); |
468 |
|
labelArray.push_back("bottom baryon"); |
469 |
+ |
labelArray.push_back("QCD string"); |
470 |
|
labelArray.push_back("other"); |
471 |
|
|
472 |
|
for(int bin = 0; bin !=currentHistogram.bins.at(0); bin++){ |
473 |
|
if(currentHistogram.name.find("GenMatchIdVsMotherId")==string::npos && currentHistogram.name.find("GenMatchIdVsGrandmotherId")==string::npos) { |
474 |
< |
oneDHists_.at(currentChannel)[currentHistogram.name]->GetXaxis()->SetBinLabel(bin+1,labelArray.at(bin)); |
474 |
> |
oneDHists_.at(currentChannel).at(currentDir)[currentHistogram.name]->GetXaxis()->SetBinLabel(bin+1,labelArray.at(bin)); |
475 |
|
} |
476 |
|
else { |
477 |
< |
twoDHists_.at(currentChannel)[currentHistogram.name]->GetYaxis()->SetBinLabel(bin+1,labelArray.at(currentHistogram.bins.at(0)-bin-1)); |
478 |
< |
twoDHists_.at(currentChannel)[currentHistogram.name]->GetXaxis()->SetBinLabel(bin+1,labelArray.at(bin)); |
477 |
> |
twoDHists_.at(currentChannel).at(currentDir)[currentHistogram.name]->GetYaxis()->SetBinLabel(bin+1,labelArray.at(currentHistogram.bins.at(0)-bin-1)); |
478 |
> |
twoDHists_.at(currentChannel).at(currentDir)[currentHistogram.name]->GetXaxis()->SetBinLabel(bin+1,labelArray.at(bin)); |
479 |
|
} |
480 |
|
} |
481 |
|
if(currentHistogram.name.find("GenMatchIdVsMotherId")!=string::npos || currentHistogram.name.find("GenMatchIdVsGrandmotherId")!=string::npos) { |
482 |
< |
twoDHists_.at(currentChannel)[currentHistogram.name]->GetXaxis()->CenterTitle(); |
483 |
< |
twoDHists_.at(currentChannel)[currentHistogram.name]->GetYaxis()->CenterTitle(); |
482 |
> |
twoDHists_.at(currentChannel).at(currentDir)[currentHistogram.name]->GetXaxis()->CenterTitle(); |
483 |
> |
twoDHists_.at(currentChannel).at(currentDir)[currentHistogram.name]->GetYaxis()->CenterTitle(); |
484 |
|
} |
485 |
|
|
486 |
|
} |
496 |
|
if(currentObject == "muon-muon pairs") currentObject = "dimuonPairs"; |
497 |
|
else if(currentObject == "electron-electron pairs") currentObject = "dielectronPairs"; |
498 |
|
else if(currentObject == "electron-muon pairs") currentObject = "electronMuonPairs"; |
499 |
+ |
else if(currentObject == "secondary jets") currentObject = "secondaryJets"; |
500 |
|
else if(currentObject == "jet-jet pairs") currentObject = "dijetPairs"; |
501 |
|
else if(currentObject == "electron-jet pairs") currentObject = "electronJetPairs"; |
502 |
|
else if(currentObject == "muon-jet pairs") currentObject = "muonJetPairs"; |
509 |
|
else if(currentObject == "muon-secondary muon pairs") currentObject = "muonSecondaryMuonPairs"; |
510 |
|
else if(currentObject == "secondary muons") currentObject = "secondaryMuons"; |
511 |
|
else if(currentObject == "electron-secondary electron pairs") currentObject = "electronSecondaryElectronPairs"; |
512 |
< |
else if(currentObject == "secondary electrons") currentObject = "secondaryElectrons"; |
512 |
> |
else if(currentObject == "secondary electrons") currentObject = "secondaryElectrons"; |
513 |
|
else if(currentObject == "electron-trigobj pairs") currentObject = "electronTrigobjPairs"; |
514 |
|
else if(currentObject == "muon-trigobj pairs") currentObject = "muonTrigobjPairs"; |
515 |
|
|
518 |
|
|
519 |
|
if(histoName == "numPrimaryvertexs"){ |
520 |
|
string newHistoName = histoName + "BeforePileupCorrection"; |
521 |
< |
oneDHists_.at(currentChannel)[newHistoName] = directories.at(currentChannel).make<TH1D> (TString(newHistoName),channelLabel+" channel: Number of Selected "+currentObject+" Before Pileup Correction; # "+currentObject, maxNum, 0, maxNum); |
521 |
> |
oneDHists_.at(currentChannel).at(currentDir)[newHistoName] = directories.at(currentDir).make<TH1D> (TString(newHistoName),channelLabel+" channel: Number of Selected "+currentObject+" Before Pileup Correction; # "+currentObject, maxNum, 0, maxNum); |
522 |
|
newHistoName = histoName + "AfterPileupCorrection"; |
523 |
< |
oneDHists_.at(currentChannel)[newHistoName] = directories.at(currentChannel).make<TH1D> (TString(newHistoName),channelLabel+" channel: Number of Selected "+currentObject+ " After Pileup Correction; # "+currentObject, maxNum, 0, maxNum); |
523 |
> |
oneDHists_.at(currentChannel).at(currentDir)[newHistoName] = directories.at(currentDir).make<TH1D> (TString(newHistoName),channelLabel+" channel: Number of Selected "+currentObject+ " After Pileup Correction; # "+currentObject, maxNum, 0, maxNum); |
524 |
|
} |
525 |
|
else |
526 |
< |
oneDHists_.at(currentChannel)[histoName] = directories.at(currentChannel).make<TH1D> (TString(histoName),channelLabel+" channel: Number of Selected "+currentObject+"; # "+currentObject, maxNum, 0, maxNum); |
526 |
> |
oneDHists_.at(currentChannel).at(currentDir)[histoName] = directories.at(currentDir).make<TH1D> (TString(histoName),channelLabel+" channel: Number of Selected "+currentObject+"; # "+currentObject, maxNum, 0, maxNum); |
527 |
|
} |
528 |
< |
|
392 |
< |
|
393 |
< |
|
394 |
< |
|
395 |
< |
//get list of cuts for this channel |
396 |
< |
vector<edm::ParameterSet> cuts_ (channels_.at(currentChannel).getParameter<vector<edm::ParameterSet> >("cuts")); |
397 |
< |
|
398 |
< |
//loop over and parse all cuts |
399 |
< |
for(uint currentCut = 0; currentCut != cuts_.size(); currentCut++){ |
400 |
< |
cut tempCut; |
401 |
< |
//store input collection for cut |
402 |
< |
string tempInputCollection = cuts_.at(currentCut).getParameter<string> ("inputCollection"); |
403 |
< |
if(tempInputCollection == "muon-electron pairs") tempInputCollection = "electron-muon pairs"; |
404 |
< |
if(tempInputCollection == "jet-electron pairs") tempInputCollection = "electron-jet pairs"; |
405 |
< |
if(tempInputCollection == "jet-muon pairs") tempInputCollection = "muon-jet pairs"; |
406 |
< |
if(tempInputCollection == "event-track pairs") tempInputCollection = "track-event pairs"; |
407 |
< |
if(tempInputCollection == "secondary muon-muon pairs") tempInputCollection = "muon-secondary muon pairs"; |
408 |
< |
if(tempInputCollection == "secondary electron-electron pairs") tempInputCollection = "electron-secondary electron pairs"; |
409 |
< |
if(tempInputCollection == "trigobj-electron pairs") tempInputCollection = "electron-trigobj pairs"; |
410 |
< |
if(tempInputCollection == "trigobj-muon pairs") tempInputCollection = "muon-trigobj pairs"; |
411 |
< |
tempCut.inputCollection = tempInputCollection; |
412 |
< |
if(tempInputCollection.find("pairs")==string::npos){ //just a single object |
413 |
< |
if(tempInputCollection.find("secondary")!=string::npos){//secondary object |
414 |
< |
int spaceIndex = tempInputCollection.find(" "); |
415 |
< |
int secondWordLength = tempInputCollection.size() - spaceIndex; |
416 |
< |
objectsToGet.push_back(tempInputCollection.substr(spaceIndex+1,secondWordLength)); |
417 |
< |
} |
418 |
< |
else{ |
419 |
< |
objectsToGet.push_back(tempInputCollection); |
420 |
< |
} |
421 |
< |
objectsToCut.push_back(tempInputCollection); |
422 |
< |
} |
423 |
< |
else{//pair of objects, need to add them both to objectsToGet |
424 |
< |
string obj1; |
425 |
< |
string obj2; |
426 |
< |
getTwoObjs(tempInputCollection, obj1, obj2); |
427 |
< |
string obj2ToGet = getObjToGet(obj2); |
428 |
< |
objectsToCut.push_back(tempInputCollection); |
429 |
< |
objectsToCut.push_back(obj1); |
430 |
< |
objectsToCut.push_back(obj2); |
431 |
< |
objectsToGet.push_back(tempInputCollection); |
432 |
< |
objectsToGet.push_back(obj1); |
433 |
< |
objectsToGet.push_back(obj2ToGet); |
434 |
< |
|
435 |
< |
} |
436 |
< |
|
437 |
< |
|
438 |
< |
|
439 |
< |
//split cut string into parts and store them |
440 |
< |
string cutString = cuts_.at(currentCut).getParameter<string> ("cutString"); |
441 |
< |
vector<string> cutStringVector = splitString(cutString); |
442 |
< |
if(cutStringVector.size()!=3 && cutStringVector.size() % 4 !=3){ |
443 |
< |
cout << "Error: Didn't find the expected number elements in the following cut string: '" << cutString << "'\n"; |
444 |
< |
exit(0); |
445 |
< |
} |
446 |
< |
tempCut.numSubcuts = (cutStringVector.size()+1)/4; |
447 |
< |
for(int subcutIndex = 0; subcutIndex != tempCut.numSubcuts; subcutIndex++){//loop over all the pieces of the cut combined using &,| |
448 |
< |
int indexOffset = 4 * subcutIndex; |
449 |
< |
string currentVariableString = cutStringVector.at(indexOffset); |
450 |
< |
if(currentVariableString.find("(")==string::npos){ |
451 |
< |
tempCut.functions.push_back("");//no function was specified |
452 |
< |
tempCut.variables.push_back(currentVariableString);// variable to cut on |
453 |
< |
} |
454 |
< |
else{ |
455 |
< |
tempCut.functions.push_back(currentVariableString.substr(0,currentVariableString.find("(")));//function comes before the "(" |
456 |
< |
string tempVariable = currentVariableString.substr(currentVariableString.find("(")+1);//get rest of string |
457 |
< |
tempCut.variables.push_back(tempVariable.substr(0,tempVariable.size()-1));//remove trailing ")" |
458 |
< |
} |
459 |
< |
tempCut.comparativeOperators.push_back(cutStringVector.at(indexOffset+1));// comparison to make |
460 |
< |
tempCut.cutValues.push_back(atof(cutStringVector.at(indexOffset+2).c_str()));// threshold value to pass cut |
461 |
< |
tempCut.cutStringValues.push_back(cutStringVector.at(indexOffset+2));// string value to pass cut |
462 |
< |
if(subcutIndex != 0) tempCut.logicalOperators.push_back(cutStringVector.at(indexOffset-1)); // logical comparison (and, or) |
463 |
< |
} |
464 |
< |
|
465 |
< |
//get number of objects required to pass cut for event to pass |
466 |
< |
string numberRequiredString = cuts_.at(currentCut).getParameter<string> ("numberRequired"); |
467 |
< |
vector<string> numberRequiredVector = splitString(numberRequiredString); |
468 |
< |
if(numberRequiredVector.size()!=2){ |
469 |
< |
cout << "Error: Didn't find two elements in the following number requirement string: '" << numberRequiredString << "'\n"; |
470 |
< |
exit(0); |
471 |
< |
} |
472 |
< |
|
473 |
< |
int numberRequiredInt = atoi(numberRequiredVector.at(1).c_str()); |
474 |
< |
tempCut.numberRequired = numberRequiredInt;// number of objects required to pass the cut |
475 |
< |
tempCut.eventComparativeOperator = numberRequiredVector.at(0);// comparison to make |
476 |
< |
|
477 |
< |
|
478 |
< |
string tempCutName; |
479 |
< |
if(cuts_.at(currentCut).exists("alias")){ |
480 |
< |
tempCutName = cuts_.at(currentCut).getParameter<string> ("alias"); |
481 |
< |
} |
482 |
< |
else{ |
483 |
< |
//construct string for cutflow table |
484 |
< |
bool plural = numberRequiredInt != 1; |
485 |
< |
string collectionString = plural ? tempInputCollection : tempInputCollection.substr(0, tempInputCollection.size()-1); |
486 |
< |
string cutName = numberRequiredString + " " + collectionString + " with " + cutString; |
487 |
< |
tempCutName = cutName; |
488 |
< |
} |
489 |
< |
tempCut.name = tempCutName; |
490 |
< |
|
491 |
< |
tempChannel.cuts.push_back(tempCut); |
492 |
< |
|
493 |
< |
|
494 |
< |
}//end loop over cuts |
495 |
< |
|
528 |
> |
}//end of loop over directories |
529 |
|
channels.push_back(tempChannel); |
530 |
|
tempChannel.cuts.clear(); |
498 |
– |
|
531 |
|
}//end loop over channels |
532 |
|
|
533 |
|
|
617 |
|
double masterScaleFactor = 1.0; |
618 |
|
|
619 |
|
//get pile-up event weight |
620 |
< |
if(doPileupReweighting_ && datasetType_ != "data") masterScaleFactor *= puWeight_->at (events->at (0).numTruePV); |
620 |
> |
if (doPileupReweighting_ && datasetType_ != "data") { |
621 |
> |
//for "data" datasets, the numTruePV is always set to -1 |
622 |
> |
if (events->at(0).numTruePV < 0) cout << "WARNING[OSUAnalysis::analyze]: Event has numTruePV<0. Turning off pile-up reweighting." << endl; |
623 |
> |
else masterScaleFactor *= puWeight_->at (events->at (0).numTruePV); |
624 |
> |
} |
625 |
|
|
626 |
|
stopCTauScaleFactor_ = 1.0; |
627 |
|
if (datasetType_ == "signalMC" && regex_match (dataset_, regex ("stop.*to.*_.*mm.*"))) |
638 |
|
cumulativeFlags.clear (); |
639 |
|
|
640 |
|
bool triggerDecision = true; |
641 |
< |
if(currentChannel.triggers.size() != 0){ //triggers specified |
642 |
< |
triggerDecision = evaluateTriggers(currentChannel.triggers,triggers.product()); |
641 |
> |
if(currentChannel.triggers.size() != 0 || currentChannel.triggersToVeto.size() != 0){ //triggers specified |
642 |
> |
triggerDecision = evaluateTriggers(currentChannel.triggers, currentChannel.triggersToVeto, triggers.product()); |
643 |
|
cutFlows_.at(currentChannelIndex)->at ("trigger") = triggerDecision; |
644 |
|
} |
645 |
|
|
646 |
|
//loop over all cuts |
611 |
– |
|
647 |
|
for(uint currentCutIndex = 0; currentCutIndex != currentChannel.cuts.size(); currentCutIndex++){ |
648 |
|
cut currentCut = currentChannel.cuts.at(currentCutIndex); |
614 |
– |
|
649 |
|
for(uint currentObjectIndex = 0; currentObjectIndex != objectsToCut.size(); currentObjectIndex++){ |
650 |
|
string currentObject = objectsToCut.at(currentObjectIndex); |
651 |
|
|
660 |
|
int flagsForPairCutsIndex = max(int(currentCutIndex-1),0); |
661 |
|
|
662 |
|
|
663 |
< |
if(currentObject == "jets") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,jets.product(),"jets"); |
664 |
< |
|
665 |
< |
else if(currentObject == "muons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),"muons"); |
632 |
< |
|
663 |
> |
if (currentObject == "jets") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,jets.product(),"jets"); |
664 |
> |
else if(currentObject == "secondary jets") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,jets.product(),"secondary jets"); |
665 |
> |
else if(currentObject == "muons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),"muons"); |
666 |
|
else if(currentObject == "secondary muons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),"secondary muons"); |
667 |
|
else if(currentObject == "secondary electrons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),"secondary electrons"); |
668 |
|
else if(currentObject == "electrons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),"electrons"); |
754 |
|
|
755 |
|
|
756 |
|
}//end loop over all cuts |
724 |
– |
|
725 |
– |
|
757 |
|
//use cumulative flags to apply cuts at event level |
758 |
|
|
759 |
|
bool eventPassedAllCuts = true; |
760 |
< |
|
760 |
> |
//a vector to store cumulative cut descisions after each cut. |
761 |
> |
vector<bool> eventPassedPreviousCuts; |
762 |
|
//apply trigger (true if none were specified) |
763 |
|
eventPassedAllCuts = eventPassedAllCuts && triggerDecision; |
764 |
|
|
775 |
|
bool cutDecision = evaluateComparison(numberPassing,currentCut.eventComparativeOperator,currentCut.numberRequired); |
776 |
|
cutFlows_.at(currentChannelIndex)->at (currentCut.name) = cutDecision; |
777 |
|
eventPassedAllCuts = eventPassedAllCuts && cutDecision; |
778 |
< |
|
778 |
> |
eventPassedPreviousCuts.push_back(eventPassedAllCuts); |
779 |
|
} |
748 |
– |
|
780 |
|
double scaleFactor = masterScaleFactor; |
781 |
|
|
782 |
+ |
muonScaleFactor_ = electronScaleFactor_ = 1.0; |
783 |
|
if(applyLeptonSF_ && datasetType_ != "data"){ |
784 |
< |
if (chosenMuon ()) scaleFactor *= muonSFWeight_->at (chosenMuon ()->eta); |
785 |
< |
if (chosenElectron ()) scaleFactor *= electronSFWeight_->at (chosenElectron ()->eta, chosenElectron ()->pt); |
784 |
> |
if(cumulativeFlags.find ("muons") != cumulativeFlags.end ()){ |
785 |
> |
vector<bool> muonFlags; |
786 |
> |
for (int i = cumulativeFlags.at("muons").size() - 1; i >= 0; i--){ |
787 |
> |
if (cumulativeFlags.at("muons").at(i).size()){ |
788 |
> |
muonFlags = cumulativeFlags.at("muons").at(i); |
789 |
> |
break; |
790 |
> |
} |
791 |
> |
} |
792 |
> |
for (uint muonIndex = 0; muonIndex != muonFlags.size(); muonIndex++){ |
793 |
> |
if(!muonFlags.at(muonIndex)) continue; |
794 |
> |
muonScaleFactor_ *= muonSFWeight_->at (muons->at(muonIndex).eta); |
795 |
> |
} |
796 |
> |
} |
797 |
> |
if(cumulativeFlags.find ("electrons") != cumulativeFlags.end ()){ |
798 |
> |
vector<bool> electronFlags; |
799 |
> |
for (int i = cumulativeFlags.at("electrons").size() - 1; i >= 0; i--){ |
800 |
> |
if (cumulativeFlags.at("electrons").at(i).size()){ |
801 |
> |
electronFlags = cumulativeFlags.at("electrons").at(i); |
802 |
> |
break; |
803 |
> |
} |
804 |
> |
} |
805 |
> |
for (uint electronIndex = 0; electronIndex != electronFlags.size(); electronIndex++){ |
806 |
> |
if(!electronFlags.at(electronIndex)) continue; |
807 |
> |
electronScaleFactor_ *= electronSFWeight_->at (electrons->at(electronIndex).eta, electrons->at(electronIndex).pt); |
808 |
> |
} |
809 |
> |
} |
810 |
|
} |
811 |
+ |
scaleFactor *= muonScaleFactor_; |
812 |
+ |
scaleFactor *= electronScaleFactor_; |
813 |
|
|
814 |
|
cutFlows_.at(currentChannelIndex)->fillCutFlow(scaleFactor); |
815 |
|
|
758 |
– |
if(!eventPassedAllCuts)continue; |
816 |
|
|
817 |
|
if (printEventInfo_) { |
818 |
|
// Write information about event to screen, for testing purposes. |
823 |
|
<< endl; |
824 |
|
} |
825 |
|
|
769 |
– |
//filling histograms |
770 |
– |
for (uint histogramIndex = 0; histogramIndex != histograms.size(); histogramIndex++){ |
771 |
– |
histogram currentHistogram = histograms.at(histogramIndex); |
772 |
– |
|
773 |
– |
if(currentHistogram.inputVariables.size() == 1){ |
774 |
– |
TH1D* histo; |
775 |
– |
histo = oneDHists_.at(currentChannelIndex).at(currentHistogram.name); |
776 |
– |
|
777 |
– |
if(currentHistogram.inputCollection == "jets") fill1DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("jets").back(),scaleFactor); |
778 |
– |
else if(currentHistogram.inputCollection == "muons") fill1DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("muons").back(),scaleFactor); |
779 |
– |
else if(currentHistogram.inputCollection == "secondary muons") fill1DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("secondary muons").back(),scaleFactor); |
780 |
– |
else if(currentHistogram.inputCollection == "secondary electrons") fill1DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("secondary electrons").back(),scaleFactor); |
781 |
– |
else if(currentHistogram.inputCollection == "muon-muon pairs") fill1DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
782 |
– |
cumulativeFlags.at("muons").back(),cumulativeFlags.at("muons").back(), \ |
783 |
– |
cumulativeFlags.at("muon-muon pairs").back(),scaleFactor); |
784 |
– |
else if(currentHistogram.inputCollection == "muon-secondary muon pairs") fill1DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
785 |
– |
cumulativeFlags.at("muons").back(),cumulativeFlags.at("secondary muons").back(), \ |
786 |
– |
cumulativeFlags.at("muon-secondary muon pairs").back(),scaleFactor); |
787 |
– |
else if(currentHistogram.inputCollection == "electrons") fill1DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("electrons").back(),scaleFactor); |
788 |
– |
else if(currentHistogram.inputCollection == "electron-electron pairs") fill1DHistogram(histo,currentHistogram,electrons.product(),electrons.product(),\ |
789 |
– |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("electrons").back(),\ |
790 |
– |
cumulativeFlags.at("electron-electron pairs").back(),scaleFactor); |
791 |
– |
else if(currentHistogram.inputCollection == "jet-jet pairs") fill1DHistogram(histo,currentHistogram,jets.product(),jets.product(),\ |
792 |
– |
cumulativeFlags.at("jets").back(),cumulativeFlags.at("jets").back(),\ |
793 |
– |
cumulativeFlags.at("jet-jet pairs").back(),scaleFactor); |
794 |
– |
else if(currentHistogram.inputCollection == "electron-secondary electron pairs") fill1DHistogram(histo,currentHistogram,electrons.product(),electrons.product(), \ |
795 |
– |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("secondary electrons").back(), \ |
796 |
– |
cumulativeFlags.at("electron-secondary electron pairs").back(),scaleFactor); |
797 |
– |
else if(currentHistogram.inputCollection == "electron-muon pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),muons.product(), \ |
798 |
– |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("muons").back(), |
799 |
– |
cumulativeFlags.at("electron-muon pairs").back(),scaleFactor); |
800 |
– |
else if(currentHistogram.inputCollection == "electron-jet pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),jets.product(), \ |
801 |
– |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("jets").back(), |
802 |
– |
cumulativeFlags.at("electron-jet pairs").back(),scaleFactor); |
803 |
– |
else if(currentHistogram.inputCollection == "muon-jet pairs") fill1DHistogram(histo,currentHistogram, muons.product(),jets.product(), \ |
804 |
– |
cumulativeFlags.at("muons").back(),cumulativeFlags.at("jets").back(), |
805 |
– |
cumulativeFlags.at("muon-jet pairs").back(),scaleFactor); |
806 |
– |
else if(currentHistogram.inputCollection == "electron-track pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),tracks.product(), |
807 |
– |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("tracks").back(), |
808 |
– |
cumulativeFlags.at("electron-track pairs").back(),scaleFactor); |
809 |
– |
else if(currentHistogram.inputCollection == "muon-track pairs") fill1DHistogram(histo,currentHistogram, muons.product(),tracks.product(), |
810 |
– |
cumulativeFlags.at("muons").back(),cumulativeFlags.at("tracks").back(), |
811 |
– |
cumulativeFlags.at("muon-track pairs").back(),scaleFactor); |
812 |
– |
else if(currentHistogram.inputCollection == "muon-tau pairs") fill1DHistogram(histo,currentHistogram, muons.product(),taus.product(), |
813 |
– |
cumulativeFlags.at("muons").back(),cumulativeFlags.at("taus").back(), |
814 |
– |
cumulativeFlags.at("muon-tau pairs").back(),scaleFactor); |
815 |
– |
else if(currentHistogram.inputCollection == "tau-tau pairs") fill1DHistogram(histo,currentHistogram, taus.product(),taus.product(), |
816 |
– |
cumulativeFlags.at("taus").back(),cumulativeFlags.at("taus").back(), |
817 |
– |
cumulativeFlags.at("tau-tau pairs").back(),scaleFactor); |
818 |
– |
else if(currentHistogram.inputCollection == "tau-track pairs") fill1DHistogram(histo,currentHistogram, taus.product(),tracks.product(), |
819 |
– |
cumulativeFlags.at("taus").back(),cumulativeFlags.at("tracks").back(), |
820 |
– |
cumulativeFlags.at("tau-track pairs").back(),scaleFactor); |
821 |
– |
else if(currentHistogram.inputCollection == "electron-trigobj pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),trigobjs.product(), |
822 |
– |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("trigobjs").back(), |
823 |
– |
cumulativeFlags.at("electron-trigobj pairs").back(),scaleFactor); |
824 |
– |
else if(currentHistogram.inputCollection == "muon-trigobj pairs") fill1DHistogram(histo,currentHistogram, muons.product(),trigobjs.product(), |
825 |
– |
cumulativeFlags.at("muons").back(),cumulativeFlags.at("trigobjs").back(), |
826 |
– |
cumulativeFlags.at("muon-trigobj pairs").back(),scaleFactor); |
827 |
– |
|
828 |
– |
else if(currentHistogram.inputCollection == "events") fill1DHistogram(histo,currentHistogram,events.product(),cumulativeFlags.at("events").back(),scaleFactor); |
829 |
– |
else if(currentHistogram.inputCollection == "taus") fill1DHistogram(histo,currentHistogram,taus.product(),cumulativeFlags.at("taus").back(),scaleFactor); |
830 |
– |
else if(currentHistogram.inputCollection == "mets") fill1DHistogram(histo,currentHistogram,mets.product(),cumulativeFlags.at("mets").back(),scaleFactor); |
831 |
– |
else if(currentHistogram.inputCollection == "tracks") fill1DHistogram(histo,currentHistogram,tracks.product(),cumulativeFlags.at("tracks").back(),scaleFactor); |
832 |
– |
else if(currentHistogram.inputCollection == "genjets") fill1DHistogram(histo,currentHistogram,genjets.product(),cumulativeFlags.at("genjets").back(),scaleFactor); |
833 |
– |
else if(currentHistogram.inputCollection == "mcparticles") fill1DHistogram(histo,currentHistogram,mcparticles.product(),cumulativeFlags.at("mcparticles").back(),scaleFactor); |
834 |
– |
else if(currentHistogram.inputCollection == "primaryvertexs") fill1DHistogram(histo,currentHistogram,primaryvertexs.product(),cumulativeFlags.at("primaryvertexs").back(),scaleFactor); |
835 |
– |
else if(currentHistogram.inputCollection == "bxlumis") fill1DHistogram(histo,currentHistogram,bxlumis.product(),cumulativeFlags.at("bxlumis").back(),scaleFactor); |
836 |
– |
else if(currentHistogram.inputCollection == "photons") fill1DHistogram(histo,currentHistogram,photons.product(),cumulativeFlags.at("photons").back(),scaleFactor); |
837 |
– |
else if(currentHistogram.inputCollection == "superclusters") fill1DHistogram(histo,currentHistogram,superclusters.product(),cumulativeFlags.at("superclusters").back(),scaleFactor); |
838 |
– |
else if(currentHistogram.inputCollection == "trigobjs") fill1DHistogram(histo,currentHistogram,trigobjs.product(),cumulativeFlags.at("trigobjs").back(),scaleFactor); |
839 |
– |
else if(currentHistogram.inputCollection == "stops" && datasetType_ == "signalMC") fill1DHistogram(histo,currentHistogram,stops.product(),cumulativeFlags.at("stops").back(),scaleFactor); |
840 |
– |
} |
841 |
– |
else if(currentHistogram.inputVariables.size() == 2){ |
842 |
– |
TH2D* histo; |
843 |
– |
histo = twoDHists_.at(currentChannelIndex).at(currentHistogram.name); |
844 |
– |
|
845 |
– |
if(currentHistogram.inputCollection == "jets") fill2DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("jets").back(),scaleFactor); |
846 |
– |
else if(currentHistogram.inputCollection == "muons") fill2DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("muons").back(),scaleFactor); |
847 |
– |
else if(currentHistogram.inputCollection == "secondary muons") fill2DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("secondary muons").back(),scaleFactor); |
848 |
– |
else if(currentHistogram.inputCollection == "muon-muon pairs") fill2DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
849 |
– |
cumulativeFlags.at("muons").back(),cumulativeFlags.at("muons").back(), \ |
850 |
– |
cumulativeFlags.at("muon-muon pairs").back(),scaleFactor); |
851 |
– |
else if(currentHistogram.inputCollection == "muon-secondary muon pairs") fill2DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
852 |
– |
cumulativeFlags.at("muons").back(),cumulativeFlags.at("secondary muons").back(), \ |
853 |
– |
cumulativeFlags.at("muon-secondary muon pairs").back(),scaleFactor); |
854 |
– |
else if(currentHistogram.inputCollection == "electrons") fill2DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("electrons").back(),scaleFactor); |
855 |
– |
else if(currentHistogram.inputCollection == "secondary electrons") fill2DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("secondary electrons").back(),scaleFactor); |
856 |
– |
else if(currentHistogram.inputCollection == "electron-electron pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),electrons.product(), \ |
857 |
– |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("electrons").back(), \ |
858 |
– |
cumulativeFlags.at("electron-electron pairs").back(),scaleFactor); |
859 |
– |
else if(currentHistogram.inputCollection == "jet-jet pairs") fill2DHistogram(histo,currentHistogram,jets.product(),jets.product(), \ |
860 |
– |
cumulativeFlags.at("jets").back(),cumulativeFlags.at("jets").back(), \ |
861 |
– |
cumulativeFlags.at("jet-jet pairs").back(),scaleFactor); |
862 |
– |
else if(currentHistogram.inputCollection == "electron-secondary electron pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),electrons.product(), \ |
863 |
– |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("secondary electrons").back(), \ |
864 |
– |
cumulativeFlags.at("electron-secondary electron pairs").back(),scaleFactor); |
865 |
– |
else if(currentHistogram.inputCollection == "electron-muon pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),muons.product(), \ |
866 |
– |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("muons").back(), \ |
867 |
– |
cumulativeFlags.at("electron-muon pairs").back(),scaleFactor); |
868 |
– |
else if(currentHistogram.inputCollection == "electron-jet pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),jets.product(), \ |
869 |
– |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("jets").back(), \ |
870 |
– |
cumulativeFlags.at("electron-jet pairs").back(),scaleFactor); |
871 |
– |
else if(currentHistogram.inputCollection == "muon-jet pairs") fill2DHistogram(histo,currentHistogram,muons.product(),jets.product(), \ |
872 |
– |
cumulativeFlags.at("muons").back(),cumulativeFlags.at("jets").back(), \ |
873 |
– |
cumulativeFlags.at("muon-jet pairs").back(),scaleFactor); |
874 |
– |
else if(currentHistogram.inputCollection == "electron-track pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),tracks.product(), |
875 |
– |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("tracks").back(), |
876 |
– |
cumulativeFlags.at("electron-track pairs").back(),scaleFactor); |
877 |
– |
else if(currentHistogram.inputCollection == "muon-track pairs") fill2DHistogram(histo,currentHistogram,muons.product(),tracks.product(), |
878 |
– |
cumulativeFlags.at("muons").back(),cumulativeFlags.at("tracks").back(), |
879 |
– |
cumulativeFlags.at("muon-track pairs").back(),scaleFactor); |
880 |
– |
else if(currentHistogram.inputCollection == "muon-tau pairs") fill2DHistogram(histo,currentHistogram,muons.product(),taus.product(), |
881 |
– |
cumulativeFlags.at("muons").back(),cumulativeFlags.at("taus").back(), |
882 |
– |
cumulativeFlags.at("muon-tau pairs").back(),scaleFactor); |
883 |
– |
else if(currentHistogram.inputCollection == "tau-tau pairs") fill2DHistogram(histo,currentHistogram,taus.product(),taus.product(), |
884 |
– |
cumulativeFlags.at("taus").back(),cumulativeFlags.at("taus").back(), |
885 |
– |
cumulativeFlags.at("tau-tau pairs").back(),scaleFactor); |
886 |
– |
else if(currentHistogram.inputCollection == "tau-track pairs") fill2DHistogram(histo,currentHistogram,taus.product(),tracks.product(), |
887 |
– |
cumulativeFlags.at("taus").back(),cumulativeFlags.at("tracks").back(), |
888 |
– |
cumulativeFlags.at("tau-track pairs").back(),scaleFactor); |
889 |
– |
else if(currentHistogram.inputCollection == "electron-trigobj pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),trigobjs.product(), |
890 |
– |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("trigobjs").back(), |
891 |
– |
cumulativeFlags.at("electron-trigobj pairs").back(),scaleFactor); |
892 |
– |
else if(currentHistogram.inputCollection == "muon-trigobj pairs") fill2DHistogram(histo,currentHistogram,muons.product(),trigobjs.product(), |
893 |
– |
cumulativeFlags.at("muons").back(),cumulativeFlags.at("trigobjs").back(), |
894 |
– |
cumulativeFlags.at("muon-trigobj pairs").back(),scaleFactor); |
895 |
– |
else if(currentHistogram.inputCollection == "events") fill2DHistogram(histo,currentHistogram,events.product(),cumulativeFlags.at("events").back(),scaleFactor); |
896 |
– |
else if(currentHistogram.inputCollection == "taus") fill2DHistogram(histo,currentHistogram,taus.product(),cumulativeFlags.at("taus").back(),scaleFactor); |
897 |
– |
else if(currentHistogram.inputCollection == "mets") fill2DHistogram(histo,currentHistogram,mets.product(),cumulativeFlags.at("mets").back(),scaleFactor); |
898 |
– |
else if(currentHistogram.inputCollection == "tracks") fill2DHistogram(histo,currentHistogram,tracks.product(),cumulativeFlags.at("tracks").back(),scaleFactor); |
899 |
– |
else if(currentHistogram.inputCollection == "track-event pairs") fill2DHistogram(histo,currentHistogram,tracks.product(),events.product(), |
900 |
– |
cumulativeFlags.at("tracks").back(),cumulativeFlags.at("events").back(), |
901 |
– |
cumulativeFlags.at("track-event pairs").back(),scaleFactor); |
902 |
– |
else if(currentHistogram.inputCollection == "genjets") fill2DHistogram(histo,currentHistogram,genjets.product(),cumulativeFlags.at("genjets").back(),scaleFactor); |
903 |
– |
else if(currentHistogram.inputCollection == "mcparticles") fill2DHistogram(histo,currentHistogram,mcparticles.product(),cumulativeFlags.at("mcparticles").back(),scaleFactor); |
904 |
– |
else if(currentHistogram.inputCollection == "primaryvertexs") fill2DHistogram(histo,currentHistogram,primaryvertexs.product(),cumulativeFlags.at("primaryvertexs").back(),scaleFactor); |
905 |
– |
else if(currentHistogram.inputCollection == "bxlumis") fill2DHistogram(histo,currentHistogram,bxlumis.product(),cumulativeFlags.at("bxlumis").back(),scaleFactor); |
906 |
– |
else if(currentHistogram.inputCollection == "photons") fill2DHistogram(histo,currentHistogram,photons.product(),cumulativeFlags.at("photons").back(),scaleFactor); |
907 |
– |
else if(currentHistogram.inputCollection == "superclusters") fill2DHistogram(histo,currentHistogram,superclusters.product(),cumulativeFlags.at("superclusters").back(),scaleFactor); |
908 |
– |
else if(currentHistogram.inputCollection == "trigobjs") fill2DHistogram(histo,currentHistogram,trigobjs.product(),cumulativeFlags.at("trigobjs").back(),scaleFactor); |
909 |
– |
else if(currentHistogram.inputCollection == "stops" && datasetType_ == "signalMC") fill2DHistogram(histo,currentHistogram,stops.product(),cumulativeFlags.at("stops").back(),scaleFactor); |
910 |
– |
} |
911 |
– |
} |
912 |
– |
|
826 |
|
|
827 |
|
|
828 |
< |
//fills histograms with the sizes of collections |
829 |
< |
for (uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){ |
917 |
< |
|
918 |
< |
string currentObject = objectsToPlot.at(currentObjectIndex); |
919 |
< |
|
920 |
< |
string objectToPlot = ""; |
921 |
< |
|
922 |
< |
// Name of objectToPlot here must match the name specified in OSUAnalysis::OSUAnalysis(). |
923 |
< |
if(currentObject == "muon-muon pairs") objectToPlot = "dimuonPairs"; |
924 |
< |
else if(currentObject == "electron-electron pairs") objectToPlot = "dielectronPairs"; |
925 |
< |
else if(currentObject == "electron-muon pairs") objectToPlot = "electronMuonPairs"; |
926 |
< |
else if(currentObject == "electron-jet pairs") objectToPlot = "electronJetPairs"; |
927 |
< |
else if(currentObject == "muon-jet pairs") objectToPlot = "muonJetPairs"; |
928 |
< |
else if(currentObject == "jet-jet pairs") objectToPlot = "dijetPairs"; |
929 |
< |
else if(currentObject == "electron-track pairs") objectToPlot = "electronTrackPairs"; |
930 |
< |
else if(currentObject == "muon-track pairs") objectToPlot = "muonTrackPairs"; |
931 |
< |
else if(currentObject == "muon-tau pairs") objectToPlot = "muonTauPairs"; |
932 |
< |
else if(currentObject == "tau-tau pairs") objectToPlot = "ditauPairs"; |
933 |
< |
else if(currentObject == "tau-track pairs") objectToPlot = "tauTrackPairs"; |
934 |
< |
else if(currentObject == "track-event pairs") objectToPlot = "trackEventPairs"; |
935 |
< |
else if(currentObject == "muon-secondary muon pairs") objectToPlot = "muonSecondaryMuonPairs"; |
936 |
< |
else if(currentObject == "secondary muons") objectToPlot = "secondaryMuons"; |
937 |
< |
else if(currentObject == "electron-secondary electron pairs") objectToPlot = "electronSecondaryElectronPairs"; |
938 |
< |
else if(currentObject == "secondary electrons") objectToPlot = "secondaryElectrons"; |
939 |
< |
else if(currentObject == "electron-trigobj pairs") objectToPlot = "electronTrigobjPairs"; |
940 |
< |
else if(currentObject == "muon-trigobj pairs") objectToPlot = "muonTrigobjPairs"; |
941 |
< |
else objectToPlot = currentObject; |
942 |
< |
|
943 |
< |
string tempCurrentObject = objectToPlot; |
944 |
< |
tempCurrentObject.at(0) = toupper(tempCurrentObject.at(0)); |
945 |
< |
string histoName = "num" + tempCurrentObject; |
946 |
< |
|
947 |
< |
//set position of primary vertex in event, in order to calculate quantities relative to it |
948 |
< |
if(find(objectsToCut.begin(), objectsToCut.end(), currentObject) != objectsToCut.end()) { |
949 |
< |
vector<bool> lastCutFlags = cumulativeFlags.at(currentObject).back(); |
950 |
< |
int numToPlot = 0; |
951 |
< |
for (uint currentFlag = 0; currentFlag != lastCutFlags.size(); currentFlag++){ |
952 |
< |
if(lastCutFlags.at(currentFlag)) numToPlot++; |
953 |
< |
} |
954 |
< |
if(objectToPlot == "primaryvertexs"){ |
955 |
< |
oneDHists_.at(currentChannelIndex).at(histoName+"BeforePileupCorrection")->Fill(primaryvertexs->size()); |
956 |
< |
oneDHists_.at(currentChannelIndex).at(histoName+"AfterPileupCorrection")->Fill(primaryvertexs->size(),scaleFactor); |
957 |
< |
} |
958 |
< |
else { |
959 |
< |
oneDHists_.at(currentChannelIndex).at(histoName)->Fill(numToPlot,scaleFactor); |
960 |
< |
} |
961 |
< |
} |
962 |
< |
else if(objectToPlot == "jets") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(jets->size(),scaleFactor); |
963 |
< |
else if(objectToPlot == "muons") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(muons->size(),scaleFactor); |
964 |
< |
else if(objectToPlot == "secondaryMuons") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(muons->size(),scaleFactor); |
965 |
< |
else if(objectToPlot == "dimuonPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(muons->size()*(muons->size()-1)/2,scaleFactor); |
966 |
< |
else if(objectToPlot == "muonSecondaryMuonPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(muons->size()*(muons->size()-1)/2,scaleFactor); |
967 |
< |
else if(objectToPlot == "electrons") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size(),scaleFactor); |
968 |
< |
else if(objectToPlot == "secondaryElectrons") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size(),scaleFactor); |
969 |
< |
else if(objectToPlot == "dielectronPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size()*(electrons->size()-1)/2,scaleFactor); |
970 |
< |
else if(objectToPlot == "electronSecondaryElectronPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size()*(electrons->size()-1)/2,scaleFactor); |
971 |
< |
else if(objectToPlot == "electronMuonPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size()*muons->size(),scaleFactor); |
972 |
< |
else if(objectToPlot == "electronJetPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size()*jets->size(),scaleFactor); |
973 |
< |
else if(objectToPlot == "muonJetPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(muons->size()*jets->size(),scaleFactor); |
974 |
< |
else if(objectToPlot == "electronTrackPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size()*tracks->size(),scaleFactor); |
975 |
< |
else if(objectToPlot == "electronTrigobjPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size()*trigobjs->size(),scaleFactor); |
976 |
< |
else if(objectToPlot == "muonTrigobjPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(muons->size()*trigobjs->size(),scaleFactor); |
977 |
< |
else if(objectToPlot == "events") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(events->size(),scaleFactor); |
978 |
< |
else if(objectToPlot == "taus") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(taus->size(),scaleFactor); |
979 |
< |
else if(objectToPlot == "mets") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(mets->size(),scaleFactor); |
980 |
< |
else if(objectToPlot == "tracks") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(tracks->size(),scaleFactor); |
981 |
< |
else if(objectToPlot == "genjets") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(genjets->size(),scaleFactor); |
982 |
< |
else if(objectToPlot == "mcparticles") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(mcparticles->size(),scaleFactor); |
983 |
< |
else if(objectToPlot == "bxlumis") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(bxlumis->size(),scaleFactor); |
984 |
< |
else if(objectToPlot == "photons") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(photons->size(),scaleFactor); |
985 |
< |
else if(objectToPlot == "superclusters") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(superclusters->size(),scaleFactor); |
986 |
< |
else if(objectToPlot == "trigobjs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(trigobjs->size(),scaleFactor); |
987 |
< |
else if(objectToPlot == "primaryvertexs"){ |
988 |
< |
oneDHists_.at(currentChannelIndex).at(histoName+"BeforePileupCorrection")->Fill(primaryvertexs->size()); |
989 |
< |
oneDHists_.at(currentChannelIndex).at(histoName+"AfterPileupCorrection")->Fill(primaryvertexs->size(),scaleFactor); |
990 |
< |
} |
991 |
< |
if(objectToPlot == "stops" && datasetType_ == "signalMC") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(stops->size(),scaleFactor); |
828 |
> |
//filling histograms |
829 |
> |
for(uint currentCut = 0; currentCut != oneDHists_.at(currentChannelIndex).size(); currentCut++){//loop over all the directories in each channel. |
830 |
|
|
831 |
< |
} // end for (uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++) |
831 |
> |
uint currentDir; |
832 |
> |
if(!GetPlotsAfterEachCut_){ currentDir = currentChannel.cuts.size() - oneDHists_.at(currentChannelIndex).size();}//if GetPlotsAfterEachCut_ is true, set currentDir point to the last cut. |
833 |
> |
else currentDir = currentCut; |
834 |
> |
|
835 |
> |
if(!eventPassedPreviousCuts.at(currentDir)) continue; |
836 |
> |
|
837 |
> |
|
838 |
> |
for (uint histogramIndex = 0; histogramIndex != histograms.size(); histogramIndex++){ |
839 |
> |
histogram currentHistogram = histograms.at(histogramIndex); |
840 |
> |
|
841 |
> |
if(currentHistogram.inputVariables.size() == 1){ |
842 |
> |
TH1D* histo; |
843 |
> |
histo = oneDHists_.at(currentChannelIndex).at(currentCut).at(currentHistogram.name); |
844 |
> |
|
845 |
> |
if (currentHistogram.inputCollection == "jets") fill1DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("jets").at(currentDir),scaleFactor); |
846 |
> |
else if(currentHistogram.inputCollection == "secondary jets") fill1DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("secondary jets").at(currentDir),scaleFactor); |
847 |
> |
else if(currentHistogram.inputCollection == "muons") fill1DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("muons").at(currentDir),scaleFactor); |
848 |
> |
else if(currentHistogram.inputCollection == "secondary muons") fill1DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("secondary muons").at(currentDir),scaleFactor); |
849 |
> |
else if(currentHistogram.inputCollection == "secondary electrons") fill1DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("secondary electrons").at(currentDir),scaleFactor); |
850 |
> |
else if(currentHistogram.inputCollection == "muon-muon pairs") fill1DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
851 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("muons").at(currentDir), \ |
852 |
> |
cumulativeFlags.at("muon-muon pairs").at(currentDir),scaleFactor); |
853 |
> |
else if(currentHistogram.inputCollection == "muon-secondary muon pairs") fill1DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
854 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("secondary muons").at(currentDir), \ |
855 |
> |
cumulativeFlags.at("muon-secondary muon pairs").at(currentDir),scaleFactor); |
856 |
> |
else if(currentHistogram.inputCollection == "electrons") fill1DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("electrons").at(currentDir),scaleFactor); |
857 |
> |
else if(currentHistogram.inputCollection == "electron-electron pairs") fill1DHistogram(histo,currentHistogram,electrons.product(),electrons.product(), \ |
858 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("electrons").at(currentDir), \ |
859 |
> |
cumulativeFlags.at("electron-electron pairs").at(currentDir),scaleFactor); |
860 |
> |
else if(currentHistogram.inputCollection == "jet-jet pairs") fill1DHistogram(histo,currentHistogram,jets.product(),jets.product(), \ |
861 |
> |
cumulativeFlags.at("jets").at(currentDir),cumulativeFlags.at("jets").at(currentDir), \ |
862 |
> |
cumulativeFlags.at("jet-jet pairs").at(currentDir),scaleFactor); |
863 |
> |
else if(currentHistogram.inputCollection == "electron-secondary electron pairs") fill1DHistogram(histo,currentHistogram,electrons.product(),electrons.product(), \ |
864 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("secondary electrons").at(currentDir), \ |
865 |
> |
cumulativeFlags.at("electron-secondary electron pairs").at(currentDir),scaleFactor); |
866 |
> |
else if(currentHistogram.inputCollection == "electron-muon pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),muons.product(), \ |
867 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("muons").at(currentDir), |
868 |
> |
cumulativeFlags.at("electron-muon pairs").at(currentDir),scaleFactor); |
869 |
> |
else if(currentHistogram.inputCollection == "electron-jet pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),jets.product(), \ |
870 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("jets").at(currentDir), |
871 |
> |
cumulativeFlags.at("electron-jet pairs").at(currentDir),scaleFactor); |
872 |
> |
else if(currentHistogram.inputCollection == "muon-jet pairs") fill1DHistogram(histo,currentHistogram, muons.product(),jets.product(), \ |
873 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("jets").at(currentDir), |
874 |
> |
cumulativeFlags.at("muon-jet pairs").at(currentDir),scaleFactor); |
875 |
> |
else if(currentHistogram.inputCollection == "electron-track pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),tracks.product(), |
876 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("tracks").at(currentDir), |
877 |
> |
cumulativeFlags.at("electron-track pairs").at(currentDir),scaleFactor); |
878 |
> |
else if(currentHistogram.inputCollection == "muon-track pairs") fill1DHistogram(histo,currentHistogram, muons.product(),tracks.product(), |
879 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("tracks").at(currentDir), |
880 |
> |
cumulativeFlags.at("muon-track pairs").at(currentDir),scaleFactor); |
881 |
> |
else if(currentHistogram.inputCollection == "muon-tau pairs") fill1DHistogram(histo,currentHistogram, muons.product(),taus.product(), |
882 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("taus").at(currentDir), |
883 |
> |
cumulativeFlags.at("muon-tau pairs").at(currentDir),scaleFactor); |
884 |
> |
else if(currentHistogram.inputCollection == "tau-tau pairs") fill1DHistogram(histo,currentHistogram, taus.product(),taus.product(), |
885 |
> |
cumulativeFlags.at("taus").at(currentDir),cumulativeFlags.at("taus").at(currentDir), |
886 |
> |
cumulativeFlags.at("tau-tau pairs").at(currentDir),scaleFactor); |
887 |
> |
else if(currentHistogram.inputCollection == "tau-track pairs") fill1DHistogram(histo,currentHistogram, taus.product(),tracks.product(), |
888 |
> |
cumulativeFlags.at("taus").at(currentDir),cumulativeFlags.at("tracks").at(currentDir), |
889 |
> |
cumulativeFlags.at("tau-track pairs").at(currentDir),scaleFactor); |
890 |
> |
else if(currentHistogram.inputCollection == "electron-trigobj pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),trigobjs.product(), |
891 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("trigobjs").at(currentDir), |
892 |
> |
cumulativeFlags.at("electron-trigobj pairs").at(currentDir),scaleFactor); |
893 |
> |
else if(currentHistogram.inputCollection == "muon-trigobj pairs") fill1DHistogram(histo,currentHistogram, muons.product(),trigobjs.product(), |
894 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("trigobjs").at(currentDir), |
895 |
> |
cumulativeFlags.at("muon-trigobj pairs").at(currentDir),scaleFactor); |
896 |
> |
|
897 |
> |
else if(currentHistogram.inputCollection == "events") fill1DHistogram(histo,currentHistogram,events.product(),cumulativeFlags.at("events").at(currentDir),scaleFactor); |
898 |
> |
else if(currentHistogram.inputCollection == "taus") fill1DHistogram(histo,currentHistogram,taus.product(),cumulativeFlags.at("taus").at(currentDir),scaleFactor); |
899 |
> |
else if(currentHistogram.inputCollection == "mets") fill1DHistogram(histo,currentHistogram,mets.product(),cumulativeFlags.at("mets").at(currentDir),scaleFactor); |
900 |
> |
else if(currentHistogram.inputCollection == "tracks") fill1DHistogram(histo,currentHistogram,tracks.product(),cumulativeFlags.at("tracks").at(currentDir),scaleFactor); |
901 |
> |
else if(currentHistogram.inputCollection == "genjets") fill1DHistogram(histo,currentHistogram,genjets.product(),cumulativeFlags.at("genjets").at(currentDir),scaleFactor); |
902 |
> |
else if(currentHistogram.inputCollection == "mcparticles") fill1DHistogram(histo,currentHistogram,mcparticles.product(),cumulativeFlags.at("mcparticles").at(currentDir),scaleFactor); |
903 |
> |
else if(currentHistogram.inputCollection == "primaryvertexs") fill1DHistogram(histo,currentHistogram,primaryvertexs.product(),cumulativeFlags.at("primaryvertexs").at(currentDir),scaleFactor); |
904 |
> |
else if(currentHistogram.inputCollection == "bxlumis") fill1DHistogram(histo,currentHistogram,bxlumis.product(),cumulativeFlags.at("bxlumis").at(currentDir),scaleFactor); |
905 |
> |
else if(currentHistogram.inputCollection == "photons") fill1DHistogram(histo,currentHistogram,photons.product(),cumulativeFlags.at("photons").at(currentDir),scaleFactor); |
906 |
> |
else if(currentHistogram.inputCollection == "superclusters") fill1DHistogram(histo,currentHistogram,superclusters.product(),cumulativeFlags.at("superclusters").at(currentDir),scaleFactor); |
907 |
> |
else if(currentHistogram.inputCollection == "trigobjs") fill1DHistogram(histo,currentHistogram,trigobjs.product(),cumulativeFlags.at("trigobjs").at(currentDir),scaleFactor); |
908 |
> |
else if(currentHistogram.inputCollection == "stops" && datasetType_ == "signalMC") fill1DHistogram(histo,currentHistogram,stops.product(),cumulativeFlags.at("stops").at(currentDir),scaleFactor); |
909 |
> |
} |
910 |
> |
else if(currentHistogram.inputVariables.size() == 2){ |
911 |
> |
TH2D* histo; |
912 |
> |
histo = twoDHists_.at(currentChannelIndex).at(currentCut).at(currentHistogram.name); |
913 |
> |
|
914 |
> |
if (currentHistogram.inputCollection == "jets") fill2DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("jets").at(currentDir),scaleFactor); |
915 |
> |
else if(currentHistogram.inputCollection == "secondary jets") fill2DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("secondary jets").at(currentDir),scaleFactor); |
916 |
> |
else if(currentHistogram.inputCollection == "muons") fill2DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("muons").at(currentDir),scaleFactor); |
917 |
> |
else if(currentHistogram.inputCollection == "secondary muons") fill2DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("secondary muons").at(currentDir),scaleFactor); |
918 |
> |
else if(currentHistogram.inputCollection == "muon-muon pairs") fill2DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
919 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("muons").at(currentDir), \ |
920 |
> |
cumulativeFlags.at("muon-muon pairs").at(currentDir),scaleFactor); |
921 |
> |
else if(currentHistogram.inputCollection == "muon-secondary muon pairs") fill2DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
922 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("secondary muons").at(currentDir), \ |
923 |
> |
cumulativeFlags.at("muon-secondary muon pairs").at(currentDir),scaleFactor); |
924 |
> |
else if(currentHistogram.inputCollection == "electrons") fill2DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("electrons").at(currentDir),scaleFactor); |
925 |
> |
else if(currentHistogram.inputCollection == "secondary electrons") fill2DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("secondary electrons").at(currentDir),scaleFactor); |
926 |
> |
else if(currentHistogram.inputCollection == "electron-electron pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),electrons.product(), \ |
927 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("electrons").at(currentDir), \ |
928 |
> |
cumulativeFlags.at("electron-electron pairs").at(currentDir),scaleFactor); |
929 |
> |
else if(currentHistogram.inputCollection == "jet-jet pairs") fill2DHistogram(histo,currentHistogram,jets.product(),jets.product(), \ |
930 |
> |
cumulativeFlags.at("jets").at(currentDir),cumulativeFlags.at("jets").at(currentDir), \ |
931 |
> |
cumulativeFlags.at("jet-jet pairs").at(currentDir),scaleFactor); |
932 |
> |
else if(currentHistogram.inputCollection == "electron-secondary electron pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),electrons.product(), \ |
933 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("secondary electrons").at(currentDir), \ |
934 |
> |
cumulativeFlags.at("electron-secondary electron pairs").at(currentDir),scaleFactor); |
935 |
> |
else if(currentHistogram.inputCollection == "electron-muon pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),muons.product(), \ |
936 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("muons").at(currentDir), \ |
937 |
> |
cumulativeFlags.at("electron-muon pairs").at(currentDir),scaleFactor); |
938 |
> |
else if(currentHistogram.inputCollection == "electron-jet pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),jets.product(), \ |
939 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("jets").at(currentDir), \ |
940 |
> |
cumulativeFlags.at("electron-jet pairs").at(currentDir),scaleFactor); |
941 |
> |
else if(currentHistogram.inputCollection == "muon-jet pairs") fill2DHistogram(histo,currentHistogram,muons.product(),jets.product(), \ |
942 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("jets").at(currentDir), \ |
943 |
> |
cumulativeFlags.at("muon-jet pairs").at(currentDir),scaleFactor); |
944 |
> |
else if(currentHistogram.inputCollection == "electron-track pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),tracks.product(), |
945 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("tracks").at(currentDir), |
946 |
> |
cumulativeFlags.at("electron-track pairs").at(currentDir),scaleFactor); |
947 |
> |
else if(currentHistogram.inputCollection == "muon-track pairs") fill2DHistogram(histo,currentHistogram,muons.product(),tracks.product(), |
948 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("tracks").at(currentDir), |
949 |
> |
cumulativeFlags.at("muon-track pairs").at(currentDir),scaleFactor); |
950 |
> |
else if(currentHistogram.inputCollection == "muon-tau pairs") fill2DHistogram(histo,currentHistogram,muons.product(),taus.product(), |
951 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("taus").at(currentDir), |
952 |
> |
cumulativeFlags.at("muon-tau pairs").at(currentDir),scaleFactor); |
953 |
> |
else if(currentHistogram.inputCollection == "tau-tau pairs") fill2DHistogram(histo,currentHistogram,taus.product(),taus.product(), |
954 |
> |
cumulativeFlags.at("taus").at(currentDir),cumulativeFlags.at("taus").at(currentDir), |
955 |
> |
cumulativeFlags.at("tau-tau pairs").at(currentDir),scaleFactor); |
956 |
> |
else if(currentHistogram.inputCollection == "tau-track pairs") fill2DHistogram(histo,currentHistogram,taus.product(),tracks.product(), |
957 |
> |
cumulativeFlags.at("taus").at(currentDir),cumulativeFlags.at("tracks").at(currentDir), |
958 |
> |
cumulativeFlags.at("tau-track pairs").at(currentDir),scaleFactor); |
959 |
> |
else if(currentHistogram.inputCollection == "electron-trigobj pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),trigobjs.product(), |
960 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("trigobjs").at(currentDir), |
961 |
> |
cumulativeFlags.at("electron-trigobj pairs").at(currentDir),scaleFactor); |
962 |
> |
else if(currentHistogram.inputCollection == "muon-trigobj pairs") fill2DHistogram(histo,currentHistogram,muons.product(),trigobjs.product(), |
963 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("trigobjs").at(currentDir), |
964 |
> |
cumulativeFlags.at("muon-trigobj pairs").at(currentDir),scaleFactor); |
965 |
> |
else if(currentHistogram.inputCollection == "events") fill2DHistogram(histo,currentHistogram,events.product(),cumulativeFlags.at("events").at(currentDir),scaleFactor); |
966 |
> |
else if(currentHistogram.inputCollection == "taus") fill2DHistogram(histo,currentHistogram,taus.product(),cumulativeFlags.at("taus").at(currentDir),scaleFactor); |
967 |
> |
else if(currentHistogram.inputCollection == "mets") fill2DHistogram(histo,currentHistogram,mets.product(),cumulativeFlags.at("mets").at(currentDir),scaleFactor); |
968 |
> |
else if(currentHistogram.inputCollection == "tracks") fill2DHistogram(histo,currentHistogram,tracks.product(),cumulativeFlags.at("tracks").at(currentDir),scaleFactor); |
969 |
> |
else if(currentHistogram.inputCollection == "track-event pairs") fill2DHistogram(histo,currentHistogram,tracks.product(),events.product(), |
970 |
> |
cumulativeFlags.at("tracks").at(currentDir),cumulativeFlags.at("events").at(currentDir), |
971 |
> |
cumulativeFlags.at("track-event pairs").at(currentDir),scaleFactor); |
972 |
> |
else if(currentHistogram.inputCollection == "genjets") fill2DHistogram(histo,currentHistogram,genjets.product(),cumulativeFlags.at("genjets").at(currentDir),scaleFactor); |
973 |
> |
else if(currentHistogram.inputCollection == "mcparticles") fill2DHistogram(histo,currentHistogram,mcparticles.product(),cumulativeFlags.at("mcparticles").at(currentDir),scaleFactor); |
974 |
> |
else if(currentHistogram.inputCollection == "primaryvertexs") fill2DHistogram(histo,currentHistogram,primaryvertexs.product(),cumulativeFlags.at("primaryvertexs").at(currentDir),scaleFactor); |
975 |
> |
else if(currentHistogram.inputCollection == "bxlumis") fill2DHistogram(histo,currentHistogram,bxlumis.product(),cumulativeFlags.at("bxlumis").at(currentDir),scaleFactor); |
976 |
> |
else if(currentHistogram.inputCollection == "photons") fill2DHistogram(histo,currentHistogram,photons.product(),cumulativeFlags.at("photons").at(currentDir),scaleFactor); |
977 |
> |
else if(currentHistogram.inputCollection == "superclusters") fill2DHistogram(histo,currentHistogram,superclusters.product(),cumulativeFlags.at("superclusters").at(currentDir),scaleFactor); |
978 |
> |
else if(currentHistogram.inputCollection == "trigobjs") fill2DHistogram(histo,currentHistogram,trigobjs.product(),cumulativeFlags.at("trigobjs").at(currentDir),scaleFactor); |
979 |
> |
else if(currentHistogram.inputCollection == "stops" && datasetType_ == "signalMC") fill2DHistogram(histo,currentHistogram,stops.product(),cumulativeFlags.at("stops").at(currentDir),scaleFactor); |
980 |
> |
} |
981 |
> |
} |
982 |
> |
|
983 |
> |
//fills histograms with the sizes of collections |
984 |
> |
|
985 |
> |
for (uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){ |
986 |
> |
|
987 |
> |
string currentObject = objectsToPlot.at(currentObjectIndex); |
988 |
> |
string objectToPlot = ""; |
989 |
> |
|
990 |
> |
// Name of objectToPlot here must match the name specified in OSUAnalysis::OSUAnalysis(). |
991 |
> |
if(currentObject == "muon-muon pairs") objectToPlot = "dimuonPairs"; |
992 |
> |
else if(currentObject == "electron-electron pairs") objectToPlot = "dielectronPairs"; |
993 |
> |
else if(currentObject == "electron-muon pairs") objectToPlot = "electronMuonPairs"; |
994 |
> |
else if(currentObject == "electron-jet pairs") objectToPlot = "electronJetPairs"; |
995 |
> |
else if(currentObject == "muon-jet pairs") objectToPlot = "muonJetPairs"; |
996 |
> |
else if(currentObject == "jet-jet pairs") objectToPlot = "dijetPairs"; |
997 |
> |
else if(currentObject == "secondary jets") objectToPlot = "secondaryJets"; |
998 |
> |
else if(currentObject == "electron-track pairs") objectToPlot = "electronTrackPairs"; |
999 |
> |
else if(currentObject == "muon-track pairs") objectToPlot = "muonTrackPairs"; |
1000 |
> |
else if(currentObject == "muon-tau pairs") objectToPlot = "muonTauPairs"; |
1001 |
> |
else if(currentObject == "tau-tau pairs") objectToPlot = "ditauPairs"; |
1002 |
> |
else if(currentObject == "tau-track pairs") objectToPlot = "tauTrackPairs"; |
1003 |
> |
else if(currentObject == "track-event pairs") objectToPlot = "trackEventPairs"; |
1004 |
> |
else if(currentObject == "muon-secondary muon pairs") objectToPlot = "muonSecondaryMuonPairs"; |
1005 |
> |
else if(currentObject == "secondary muons") objectToPlot = "secondaryMuons"; |
1006 |
> |
else if(currentObject == "electron-secondary electron pairs") objectToPlot = "electronSecondaryElectronPairs"; |
1007 |
> |
else if(currentObject == "secondary electrons") objectToPlot = "secondaryElectrons"; |
1008 |
> |
else if(currentObject == "electron-trigobj pairs") objectToPlot = "electronTrigobjPairs"; |
1009 |
> |
else if(currentObject == "muon-trigobj pairs") objectToPlot = "muonTrigobjPairs"; |
1010 |
> |
else objectToPlot = currentObject; |
1011 |
> |
|
1012 |
> |
string tempCurrentObject = objectToPlot; |
1013 |
> |
tempCurrentObject.at(0) = toupper(tempCurrentObject.at(0)); |
1014 |
> |
string histoName = "num" + tempCurrentObject; |
1015 |
> |
|
1016 |
> |
|
1017 |
> |
vector<bool> lastCutFlags = cumulativeFlags.at(currentObject).at(currentDir); |
1018 |
> |
|
1019 |
> |
//count the number of objects passing all cuts |
1020 |
> |
int numToPlot = 0; |
1021 |
> |
for (uint currentFlag = 0; currentFlag != lastCutFlags.size(); currentFlag++){ |
1022 |
> |
if(lastCutFlags.at(currentFlag)) numToPlot++; |
1023 |
> |
} |
1024 |
> |
|
1025 |
> |
if(objectToPlot == "primaryvertexs"){ |
1026 |
> |
oneDHists_.at(currentChannelIndex).at(currentCut).at(histoName+"BeforePileupCorrection")->Fill(primaryvertexs->size()); |
1027 |
> |
oneDHists_.at(currentChannelIndex).at(currentCut).at(histoName+"AfterPileupCorrection")->Fill(primaryvertexs->size(),scaleFactor); |
1028 |
> |
} |
1029 |
> |
else { |
1030 |
> |
oneDHists_.at(currentChannelIndex).at(currentCut).at(histoName)->Fill(numToPlot,scaleFactor); |
1031 |
> |
} |
1032 |
> |
} // end for (uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++) |
1033 |
> |
} |
1034 |
|
|
1035 |
|
} //end loop over channel |
1036 |
|
|
1071 |
|
} |
1072 |
|
|
1073 |
|
bool |
1074 |
< |
OSUAnalysis::evaluateTriggers (vector<string> triggersToTest, const BNtriggerCollection* triggerCollection){ |
1074 |
> |
OSUAnalysis::evaluateTriggers (vector<string> triggersToTest, vector<string> triggersToVeto, const BNtriggerCollection* triggerCollection){ |
1075 |
|
|
1076 |
+ |
//initialize to false until a chosen trigger is passed |
1077 |
|
bool triggerDecision = false; |
1078 |
|
|
1079 |
< |
for (BNtriggerCollection::const_iterator trigger = triggerCollection->begin (); trigger != triggerCollection->end (); trigger++) |
1080 |
< |
{ |
1081 |
< |
if(trigger->pass != 1) continue; |
1082 |
< |
for(uint triggerName = 0; triggerName != triggersToTest.size(); triggerName++) |
1083 |
< |
{ |
1043 |
< |
if(trigger->name.find(triggersToTest.at(triggerName))!=string::npos){ |
1044 |
< |
triggerDecision = true; |
1045 |
< |
} |
1046 |
< |
} |
1047 |
< |
} |
1048 |
< |
return triggerDecision; |
1079 |
> |
//loop over all triggers defined in the event |
1080 |
> |
for (BNtriggerCollection::const_iterator trigger = triggerCollection->begin (); trigger != triggerCollection->end (); trigger++){ |
1081 |
> |
|
1082 |
> |
//we're only interested in triggers that actually passed |
1083 |
> |
if(trigger->pass != 1) continue; |
1084 |
|
|
1085 |
+ |
//if the event passes one of the veto triggers, exit and return false |
1086 |
+ |
for(uint triggerName = 0; triggerName != triggersToVeto.size(); triggerName++){ |
1087 |
+ |
if(trigger->name.find(triggersToVeto.at(triggerName))!=string::npos) return false; |
1088 |
+ |
} |
1089 |
+ |
//if the event passes one of the chosen triggers, set triggerDecision to true |
1090 |
+ |
for(uint triggerName = 0; triggerName != triggersToTest.size(); triggerName++){ |
1091 |
+ |
if(trigger->name.find(triggersToTest.at(triggerName))!=string::npos) triggerDecision = true; |
1092 |
+ |
} |
1093 |
+ |
} |
1094 |
+ |
//if none of the veto triggers fired: |
1095 |
+ |
//return the OR of all the chosen triggers |
1096 |
+ |
if (triggersToTest.size() != 0) return triggerDecision; |
1097 |
+ |
//or if no triggers were defined return true |
1098 |
+ |
else return true; |
1099 |
|
} |
1100 |
|
|
1101 |
+ |
|
1102 |
|
vector<string> |
1103 |
|
OSUAnalysis::splitString (string inputString){ |
1104 |
|
|
1432 |
|
else if(variable == "relPFdBetaIso") value = (object->pfIsoR04SumChargedHadronPt + max(0.0, object->pfIsoR04SumNeutralHadronEt + object->pfIsoR04SumPhotonEt - 0.5*object->pfIsoR04SumPUPt)) / object->pt; |
1433 |
|
else if(variable == "relPFrhoIso") value = ( object->chargedHadronIso + max(0.0, object->neutralHadronIso + object->photonIso - object->AEffDr03*object->rhoPrime) ) / object->pt; |
1434 |
|
else if(variable == "metMT") { |
1435 |
< |
const BNmet *met = chosenMET (); |
1386 |
< |
if (met) |
1435 |
> |
if (const BNmet *met = chosenMET ()) |
1436 |
|
{ |
1437 |
< |
TLorentzVector p1 (object->px, object->py, object->pz, object->energy), |
1438 |
< |
p2 (met->px, met->py, 0.0, met->pt); |
1390 |
< |
|
1391 |
< |
value = (p1 + p2).Mt (); |
1437 |
> |
double dPhi = deltaPhi (object->phi, met->phi); |
1438 |
> |
value = sqrt (2 * object->pt * met->pt * (1 - cos (dPhi))); |
1439 |
|
} |
1440 |
|
else |
1441 |
|
value = -999; |
1562 |
|
} |
1563 |
|
else if(variable == "tightIDdisplaced"){ |
1564 |
|
value = object->isGlobalMuon > 0 \ |
1565 |
+ |
&& object->isPFMuon > 0 \ |
1566 |
|
&& object->normalizedChi2 < 10 \ |
1567 |
|
&& object->numberOfValidMuonHits > 0 \ |
1568 |
|
&& object->numberOfMatchedStations > 1 \ |
1590 |
|
} |
1591 |
|
else if(variable == "genMatchedMotherIdReverse"){ |
1592 |
|
int index = getGenMatchedParticleIndex(object); |
1593 |
< |
if(index == -1) value = 23; |
1594 |
< |
else value = 23 - getPdgIdBinValue(mcparticles->at(index).motherId); |
1593 |
> |
if(index == -1) value = 24; |
1594 |
> |
else value = 24 - getPdgIdBinValue(mcparticles->at(index).motherId); |
1595 |
|
} |
1596 |
|
else if(variable == "genMatchedGrandmotherId"){ |
1597 |
|
int index = getGenMatchedParticleIndex(object); |
1605 |
|
} |
1606 |
|
else if(variable == "genMatchedGrandmotherIdReverse"){ |
1607 |
|
int index = getGenMatchedParticleIndex(object); |
1608 |
< |
if(index == -1) value = 23; |
1608 |
> |
if(index == -1) value = 24; |
1609 |
|
else if(fabs(mcparticles->at(index).motherId) == 15){ |
1610 |
|
int motherIndex = findTauMotherIndex(&mcparticles->at(index)); |
1611 |
< |
if(motherIndex == -1) value = 23; |
1612 |
< |
else value = 23 - getPdgIdBinValue(mcparticles->at(motherIndex).motherId); |
1611 |
> |
if(motherIndex == -1) value = 24; |
1612 |
> |
else value = 24 - getPdgIdBinValue(mcparticles->at(motherIndex).motherId); |
1613 |
|
} |
1614 |
< |
else value = 23 - getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
1614 |
> |
else value = 24 - getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
1615 |
> |
} |
1616 |
> |
else if(variable == "pfMuonsFromVertex"){ |
1617 |
> |
double d0Error, dzError; |
1618 |
> |
|
1619 |
> |
d0Error = hypot (object->tkD0err, hypot (chosenVertex ()->xError, chosenVertex ()->yError)); |
1620 |
> |
dzError = hypot (object->tkDZerr, chosenVertex ()->zError); |
1621 |
> |
value = fabs (object->correctedD0Vertex) > 0.2 || fabs (object->correctedDZ) > 0.5 |
1622 |
> |
|| fabs (object->correctedD0Vertex / d0Error) > 99.0 |
1623 |
> |
|| fabs (object->correctedDZ / dzError) > 99.0; |
1624 |
> |
value = (object->isStandAloneMuon && !object->isTrackerMuon && !object->isGlobalMuon) || !value; |
1625 |
|
} |
1626 |
|
|
1627 |
|
|
1801 |
|
else if(variable == "detIso") value = (object->trackIso) / object->pt; |
1802 |
|
else if(variable == "relPFrhoIso") value = ( object->chargedHadronIsoDR03 + max(0.0, object->neutralHadronIsoDR03 + object->photonIsoDR03 - object->AEffDr03*object->rhoPrime) ) / object->pt; |
1803 |
|
else if(variable == "metMT") { |
1804 |
< |
const BNmet *met = chosenMET (); |
1747 |
< |
if (met) |
1804 |
> |
if (const BNmet *met = chosenMET ()) |
1805 |
|
{ |
1806 |
< |
TLorentzVector p1 (object->px, object->py, object->pz, object->energy), |
1807 |
< |
p2 (met->px, met->py, 0.0, met->pt); |
1751 |
< |
|
1752 |
< |
value = (p1 + p2).Mt (); |
1806 |
> |
double dPhi = deltaPhi (object->phi, met->phi); |
1807 |
> |
value = sqrt (2 * object->pt * met->pt * (1 - cos (dPhi))); |
1808 |
|
} |
1809 |
|
else |
1810 |
|
value = -999; |
1990 |
|
} |
1991 |
|
else if(variable == "genMatchedMotherIdReverse"){ |
1992 |
|
int index = getGenMatchedParticleIndex(object); |
1993 |
< |
if(index == -1) value = 23; |
1994 |
< |
else value = 23 -getPdgIdBinValue(mcparticles->at(index).motherId); |
1993 |
> |
if(index == -1) value = 24; |
1994 |
> |
else value = 24 -getPdgIdBinValue(mcparticles->at(index).motherId); |
1995 |
|
} |
1996 |
|
else if(variable == "genMatchedGrandmotherId"){ |
1997 |
|
int index = getGenMatchedParticleIndex(object); |
2005 |
|
} |
2006 |
|
else if(variable == "genMatchedGrandmotherIdReverse"){ |
2007 |
|
int index = getGenMatchedParticleIndex(object); |
2008 |
< |
if(index == -1) value = 23; |
2008 |
> |
if(index == -1) value = 24; |
2009 |
|
else if(fabs(mcparticles->at(index).motherId) == 15){ |
2010 |
|
int motherIndex = findTauMotherIndex(&mcparticles->at(index)); |
2011 |
< |
if(motherIndex == -1) value = 23; |
2012 |
< |
else value = 23 - getPdgIdBinValue(mcparticles->at(motherIndex).motherId); |
2011 |
> |
if(motherIndex == -1) value = 24; |
2012 |
> |
else value = 24 - getPdgIdBinValue(mcparticles->at(motherIndex).motherId); |
2013 |
|
} |
2014 |
< |
else value = 23 - getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
2014 |
> |
else value = 24 - getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
2015 |
> |
} |
2016 |
> |
else if(variable == "pfElectronsFromVertex"){ |
2017 |
> |
double d0Error, dzError; |
2018 |
> |
|
2019 |
> |
d0Error = hypot (object->tkD0err, hypot (chosenVertex ()->xError, chosenVertex ()->yError)); |
2020 |
> |
dzError = hypot (object->tkDZerr, chosenVertex ()->zError); |
2021 |
> |
value = fabs (object->correctedD0Vertex) > 0.2 || fabs (object->correctedDZ) > 0.5 |
2022 |
> |
|| fabs (object->correctedD0Vertex / d0Error) > 99.0 |
2023 |
> |
|| fabs (object->correctedDZ / dzError) > 99.0; |
2024 |
> |
value = !value; |
2025 |
|
} |
2026 |
|
|
2027 |
|
|
2104 |
|
else if(variable == "id2") value = object->id2; |
2105 |
|
else if(variable == "evt") value = object->evt; |
2106 |
|
else if(variable == "puScaleFactor"){ |
2107 |
< |
if(datasetType_ != "data") |
2107 |
> |
if(doPileupReweighting_ && datasetType_ != "data") |
2108 |
|
value = puWeight_->at (events->at (0).numTruePV); |
2109 |
|
else |
2110 |
|
value = 1.0; |
2111 |
|
} |
2112 |
< |
else if(variable == "muonScaleFactor"){ |
2113 |
< |
if(datasetType_ != "data" && applyLeptonSF_) |
2114 |
< |
value = muonSFWeight_->at (chosenMuon ()->eta); |
2050 |
< |
else |
2051 |
< |
value = 1.0; |
2052 |
< |
} |
2053 |
< |
else if(variable == "electronScaleFactor"){ |
2054 |
< |
if(datasetType_ != "data" && applyLeptonSF_) |
2055 |
< |
value = electronSFWeight_->at (chosenElectron ()->eta, chosenElectron ()->pt); |
2056 |
< |
else |
2057 |
< |
value = 1.0; |
2058 |
< |
} |
2059 |
< |
else if(variable == "stopCTauScaleFactor") |
2060 |
< |
value = stopCTauScaleFactor_; |
2112 |
> |
else if(variable == "muonScaleFactor") value = muonScaleFactor_; |
2113 |
> |
else if(variable == "electronScaleFactor") value = electronScaleFactor_; |
2114 |
> |
else if(variable == "stopCTauScaleFactor") value = stopCTauScaleFactor_; |
2115 |
|
|
2116 |
|
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2117 |
|
|
2188 |
|
} |
2189 |
|
else if(variable == "genMatchedMotherIdReverse"){ |
2190 |
|
int index = getGenMatchedParticleIndex(object); |
2191 |
< |
if(index == -1) value = 23; |
2192 |
< |
else value = 23 -getPdgIdBinValue(mcparticles->at(index).motherId); |
2191 |
> |
if(index == -1) value = 24; |
2192 |
> |
else value = 24 -getPdgIdBinValue(mcparticles->at(index).motherId); |
2193 |
|
} |
2194 |
|
else if(variable == "genMatchedGrandmotherId"){ |
2195 |
|
int index = getGenMatchedParticleIndex(object); |
2203 |
|
} |
2204 |
|
else if(variable == "genMatchedGrandmotherIdReverse"){ |
2205 |
|
int index = getGenMatchedParticleIndex(object); |
2206 |
< |
if(index == -1) value = 23; |
2206 |
> |
if(index == -1) value = 24; |
2207 |
|
else if(fabs(mcparticles->at(index).motherId) == 15){ |
2208 |
|
int motherIndex = findTauMotherIndex(&mcparticles->at(index)); |
2209 |
< |
if(motherIndex == -1) value = 23; |
2210 |
< |
else value = 23 - getPdgIdBinValue(mcparticles->at(motherIndex).motherId); |
2209 |
> |
if(motherIndex == -1) value = 24; |
2210 |
> |
else value = 24 - getPdgIdBinValue(mcparticles->at(motherIndex).motherId); |
2211 |
|
} |
2212 |
< |
else value = 23 - getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
2212 |
> |
else value = 24 - getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
2213 |
|
} |
2214 |
|
|
2215 |
|
|
2327 |
|
else if(variable == "caloHadDeltaRp4") value = object->caloHadDeltaRp4; |
2328 |
|
else if(variable == "caloEMDeltaRp5") value = object->caloEMDeltaRp5; |
2329 |
|
else if(variable == "caloHadDeltaRp5") value = object->caloHadDeltaRp5; |
2330 |
+ |
else if(variable == "nTracksRp5") value = object->nTracksRp5; |
2331 |
|
else if(variable == "nHitsMissingOuter") value = object->nHitsMissingOuter; |
2332 |
|
else if(variable == "nHitsMissingInner") value = object->nHitsMissingInner; |
2333 |
|
else if(variable == "nHitsMissingMiddle") value = object->nHitsMissingMiddle; |
2334 |
< |
|
2334 |
> |
else if(variable == "depTrkRp5") value = object->depTrkRp5; |
2335 |
|
|
2336 |
|
//user defined variables |
2337 |
|
else if(variable == "d0wrtBS") value = (object->vx-events->at(0).BSx)*object->py/object->pt - (object->vy-events->at(0).BSy)*object->px/object->pt; |
2338 |
|
else if(variable == "dZwrtBS") value = object->dZ - events->at(0).BSz; |
2339 |
+ |
else if(variable == "depTrkRp5MinusPt") value = (object->depTrkRp5 - object->pt); |
2340 |
|
else if(variable == "caloTotDeltaRp5") value = (object->caloHadDeltaRp5 + object->caloEMDeltaRp5); |
2341 |
|
else if(variable == "caloTotDeltaRp5ByP") value = ((object->caloHadDeltaRp5 + object->caloEMDeltaRp5)/pMag); |
2342 |
|
else if(variable == "caloTotDeltaRp5RhoCorr") value = getTrkCaloTotRhoCorr(object); |
2385 |
|
} |
2386 |
|
else if(variable == "genMatchedMotherIdReverse"){ |
2387 |
|
int index = getGenMatchedParticleIndex(object); |
2388 |
< |
if(index == -1) value = 23; |
2389 |
< |
else value = 23 -getPdgIdBinValue(mcparticles->at(index).motherId); |
2388 |
> |
if(index == -1) value = 24; |
2389 |
> |
else value = 24 -getPdgIdBinValue(mcparticles->at(index).motherId); |
2390 |
|
} |
2391 |
|
else if(variable == "genMatchedGrandmotherId"){ |
2392 |
|
int index = getGenMatchedParticleIndex(object); |
2400 |
|
} |
2401 |
|
else if(variable == "genMatchedGrandmotherIdReverse"){ |
2402 |
|
int index = getGenMatchedParticleIndex(object); |
2403 |
< |
if(index == -1) value = 23; |
2403 |
> |
if(index == -1) value = 24; |
2404 |
|
else if(fabs(mcparticles->at(index).motherId) == 15){ |
2405 |
|
int motherIndex = findTauMotherIndex(&mcparticles->at(index)); |
2406 |
< |
if(motherIndex == -1) value = 23; |
2407 |
< |
else value = 23 - getPdgIdBinValue(mcparticles->at(motherIndex).motherId); |
2406 |
> |
if(motherIndex == -1) value = 24; |
2407 |
> |
else value = 24 - getPdgIdBinValue(mcparticles->at(motherIndex).motherId); |
2408 |
|
} |
2409 |
< |
else value = 23 - getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
2409 |
> |
else value = 24 - getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
2410 |
|
} |
2411 |
|
|
2412 |
|
|
2728 |
|
} |
2729 |
|
else if(variable == "genMatchedMotherIdReverse"){ |
2730 |
|
int index = getGenMatchedParticleIndex(object); |
2731 |
< |
if(index == -1) value = 23; |
2732 |
< |
else value = 23 -getPdgIdBinValue(mcparticles->at(index).motherId); |
2731 |
> |
if(index == -1) value = 24; |
2732 |
> |
else value = 24 -getPdgIdBinValue(mcparticles->at(index).motherId); |
2733 |
|
} |
2734 |
|
else if(variable == "genMatchedGrandmotherId"){ |
2735 |
|
int index = getGenMatchedParticleIndex(object); |
2743 |
|
} |
2744 |
|
else if(variable == "genMatchedGrandmotherIdReverse"){ |
2745 |
|
int index = getGenMatchedParticleIndex(object); |
2746 |
< |
if(index == -1) value = 23; |
2746 |
> |
if(index == -1) value = 24; |
2747 |
|
else if(fabs(mcparticles->at(index).motherId) == 15){ |
2748 |
|
int motherIndex = findTauMotherIndex(&mcparticles->at(index)); |
2749 |
< |
if(motherIndex == -1) value = 23; |
2750 |
< |
else value = 23 - getPdgIdBinValue(mcparticles->at(motherIndex).motherId); |
2749 |
> |
if(motherIndex == -1) value = 24; |
2750 |
> |
else value = 24 - getPdgIdBinValue(mcparticles->at(motherIndex).motherId); |
2751 |
|
} |
2752 |
< |
else value = 23 - getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
2752 |
> |
else value = 24 - getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
2753 |
|
} |
2754 |
|
|
2755 |
|
|
3003 |
|
else if(variable == "muonRelPFdBetaIso"){ |
3004 |
|
value = (object2->pfIsoR04SumChargedHadronPt + max(0.0, object2->pfIsoR04SumNeutralHadronEt + object2->pfIsoR04SumPhotonEt - 0.5*object2->pfIsoR04SumPUPt)) / object2->pt; |
3005 |
|
} |
2950 |
– |
|
3006 |
|
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2952 |
– |
|
3007 |
|
value = applyFunction(function, value); |
3008 |
|
|
3009 |
|
return value; |
3039 |
|
} |
3040 |
|
|
3041 |
|
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2988 |
– |
|
3042 |
|
value = applyFunction(function, value); |
3043 |
|
|
3044 |
|
return value; |
3074 |
|
} |
3075 |
|
|
3076 |
|
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3024 |
– |
|
3077 |
|
value = applyFunction(function, value); |
3078 |
|
|
3079 |
|
return value; |
3087 |
|
|
3088 |
|
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
3089 |
|
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
3090 |
+ |
else if(variable == "absDeltaPt") value = fabs(object1->pt - object2->pt); |
3091 |
|
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3092 |
|
else if(variable == "invMass"){ |
3093 |
|
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
3110 |
|
} |
3111 |
|
|
3112 |
|
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3060 |
– |
|
3113 |
|
value = applyFunction(function, value); |
3114 |
|
|
3115 |
|
return value; |
3130 |
|
|
3131 |
|
value = (fourVector1 + fourVector2).M(); |
3132 |
|
} |
3133 |
< |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3133 |
> |
else if(variable == "chargeProduct"){ |
3134 |
> |
value = object1->charge*object2->charge; |
3135 |
> |
} |
3136 |
> |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3137 |
|
value = applyFunction(function, value); |
3138 |
|
return value; |
3139 |
+ |
|
3140 |
|
} |
3141 |
|
|
3142 |
|
|
3157 |
|
|
3158 |
|
value = (fourVector1 + fourVector2).M(); |
3159 |
|
} |
3160 |
+ |
else if(variable == "chargeProduct"){ |
3161 |
+ |
value = object1->charge*object2->charge; |
3162 |
+ |
} |
3163 |
|
|
3164 |
< |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3164 |
> |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3165 |
|
value = applyFunction(function, value); |
3166 |
|
return value; |
3167 |
|
} |
3179 |
|
value = (fourVector1 + fourVector2).M(); |
3180 |
|
} |
3181 |
|
|
3182 |
< |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3182 |
> |
else if(variable == "chargeProduct"){ |
3183 |
> |
value = object1->charge*object2->charge; |
3184 |
> |
} |
3185 |
> |
|
3186 |
> |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3187 |
|
value = applyFunction(function, value); |
3188 |
|
return value; |
3189 |
|
} |
3201 |
|
value = (fourVector1 + fourVector2).M(); |
3202 |
|
} |
3203 |
|
|
3204 |
< |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3204 |
> |
else if(variable == "chargeProduct"){ |
3205 |
> |
value = object1->charge*object2->charge; |
3206 |
> |
} |
3207 |
> |
|
3208 |
> |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3209 |
|
value = applyFunction(function, value); |
3210 |
|
return value; |
3211 |
|
} |
3216 |
|
double value = 0.0; |
3217 |
|
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
3218 |
|
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3219 |
+ |
else if(variable == "chargeProduct"){ |
3220 |
+ |
value = object1->charge*object2->charge; |
3221 |
+ |
} |
3222 |
|
|
3223 |
< |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3223 |
> |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3224 |
|
value = applyFunction(function, value); |
3225 |
|
return value; |
3226 |
|
} |
3255 |
|
double value = 0.0; |
3256 |
|
|
3257 |
|
if (variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3258 |
+ |
else if (variable == "match"){ |
3259 |
+ |
if (deltaR(object1->eta,object1->phi,object2->eta,object2->phi) < 0.2 && abs(object2->id) == 11) |
3260 |
+ |
stringValue = object2->filter; |
3261 |
+ |
else |
3262 |
+ |
stringValue = "none"; |
3263 |
+ |
} |
3264 |
|
|
3265 |
|
else { cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999; } |
3266 |
|
|
3504 |
|
for(vector<DeadEcal>::const_iterator ecal = DeadEcalVec.begin(); ecal != DeadEcalVec.end(); ++ecal){ |
3505 |
|
double eta = ecal->etaEcal; |
3506 |
|
double phi = ecal->phiEcal; |
3507 |
< |
double deltaRtemp = deltaR(eta, track1->eta, phi, track1->phi); |
3507 |
> |
double deltaRtemp = deltaR(eta, phi, track1->eta, track1->phi); |
3508 |
|
if(deltaRtemp < deltaRLowest) deltaRLowest = deltaRtemp; |
3509 |
|
} |
3510 |
|
if (deltaRLowest<0.05) {value = 1;} |
3728 |
|
string stringValue = ""; |
3729 |
|
double value = valueLookup(&inputCollection->at(object), inputVariable, function, stringValue); |
3730 |
|
histo->Fill(value,scaleFactor); |
3655 |
– |
|
3731 |
|
if (printEventInfo_) { |
3732 |
|
// Write information about event to screen, for testing purposes. |
3733 |
|
cout << " Info for event: value for histogram " << histo->GetName() << ": " << value << endl; |
3956 |
|
// 20 strange baryon |
3957 |
|
// 21 charm baryon |
3958 |
|
// 22 bottom baryon |
3959 |
< |
// 23 other |
3959 |
> |
// 23 QCD string |
3960 |
> |
// 24 other |
3961 |
|
|
3962 |
|
int OSUAnalysis::getPdgIdBinValue(int pdgId){ |
3963 |
|
|
3981 |
|
else if(absPdgId > 3000 && absPdgId < 4000 ) binValue = 20; |
3982 |
|
else if(absPdgId > 4000 && absPdgId < 5000 ) binValue = 21; |
3983 |
|
else if(absPdgId > 5000 && absPdgId < 6000 ) binValue = 22; |
3984 |
+ |
else if(absPdgId == 92 ) binValue = 23; |
3985 |
|
|
3986 |
< |
else binValue = 23; |
3986 |
> |
else binValue = 24; |
3987 |
|
|
3988 |
|
return binValue; |
3989 |
|
|
3993 |
|
OSUAnalysis::chosenVertex () |
3994 |
|
{ |
3995 |
|
const BNprimaryvertex *chosenVertex = 0; |
3996 |
< |
if(find(objectsToCut.begin(), objectsToCut.end(), "primaryvertexs") != objectsToCut.end()) { |
3996 |
> |
if(cumulativeFlags.find ("primaryvertexs") != cumulativeFlags.end ()){ |
3997 |
|
vector<bool> vertexFlags; |
3998 |
|
for (int i = cumulativeFlags.at("primaryvertexs").size() - 1; i >= 0; i--){ |
3999 |
|
if (cumulativeFlags.at("primaryvertexs").at(i).size()){ |
4007 |
|
break; |
4008 |
|
} |
4009 |
|
} |
4010 |
< |
else { |
4011 |
< |
chosenVertex = &primaryvertexs->at(0); |
3935 |
< |
} |
4010 |
> |
else if (find (objectsToGet.begin (), objectsToGet.end (), "primaryvertexs") != objectsToGet.end ()) |
4011 |
> |
chosenVertex = & primaryvertexs->at (0); |
4012 |
|
|
4013 |
|
return chosenVertex; |
4014 |
|
} |
4017 |
|
OSUAnalysis::chosenMET () |
4018 |
|
{ |
4019 |
|
const BNmet *chosenMET = 0; |
4020 |
< |
if(find(objectsToCut.begin(), objectsToCut.end(), "mets") != objectsToCut.end()) { |
4020 |
> |
if(cumulativeFlags.find ("mets") != cumulativeFlags.end ()){ |
4021 |
|
vector<bool> metFlags; |
4022 |
|
for (int i = cumulativeFlags.at("mets").size() - 1; i >= 0; i--){ |
4023 |
|
if (cumulativeFlags.at("mets").at(i).size()){ |
4031 |
|
break; |
4032 |
|
} |
4033 |
|
} |
4034 |
< |
else { |
4035 |
< |
chosenMET = &mets->at(0); |
3960 |
< |
} |
4034 |
> |
else if (find (objectsToGet.begin (), objectsToGet.end (), "mets") != objectsToGet.end ()) |
4035 |
> |
chosenMET = & mets->at (0); |
4036 |
|
|
4037 |
|
return chosenMET; |
4038 |
|
} |
4041 |
|
OSUAnalysis::chosenElectron () |
4042 |
|
{ |
4043 |
|
const BNelectron *chosenElectron = 0; |
4044 |
< |
if(find(objectsToCut.begin(), objectsToCut.end(), "electrons") != objectsToCut.end()) { |
4044 |
> |
if(cumulativeFlags.find ("electrons") != cumulativeFlags.end ()){ |
4045 |
|
vector<bool> electronFlags; |
4046 |
|
for (int i = cumulativeFlags.at("electrons").size() - 1; i >= 0; i--){ |
4047 |
|
if (cumulativeFlags.at("electrons").at(i).size()){ |
4055 |
|
break; |
4056 |
|
} |
4057 |
|
} |
4058 |
< |
else { |
4059 |
< |
chosenElectron = &electrons->at(0); |
3985 |
< |
} |
4058 |
> |
else if (find (objectsToGet.begin (), objectsToGet.end (), "electrons") != objectsToGet.end ()) |
4059 |
> |
chosenElectron = & electrons->at (0); |
4060 |
|
|
4061 |
|
return chosenElectron; |
4062 |
|
} |
4065 |
|
OSUAnalysis::chosenMuon () |
4066 |
|
{ |
4067 |
|
const BNmuon *chosenMuon = 0; |
4068 |
< |
if(find(objectsToCut.begin(), objectsToCut.end(), "muons") != objectsToCut.end()) { |
4068 |
> |
if(cumulativeFlags.find ("muons") != cumulativeFlags.end ()){ |
4069 |
|
vector<bool> muonFlags; |
4070 |
|
for (int i = cumulativeFlags.at("muons").size() - 1; i >= 0; i--){ |
4071 |
|
if (cumulativeFlags.at("muons").at(i).size()){ |
4079 |
|
break; |
4080 |
|
} |
4081 |
|
} |
4082 |
< |
else { |
4083 |
< |
chosenMuon = &muons->at(0); |
4010 |
< |
} |
4082 |
> |
else if (find (objectsToGet.begin (), objectsToGet.end (), "muons") != objectsToGet.end ()) |
4083 |
> |
chosenMuon = & muons->at (0); |
4084 |
|
|
4085 |
|
return chosenMuon; |
4086 |
|
} |