CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HLTExoticaSubAnalysis.cc
Go to the documentation of this file.
1 
10 
15 
16 #include "TPRegexp.h"
17 #include "TString.h"
18 
21 
22 #include <set>
23 #include <algorithm>
24 
25 int verbose=0;
26 
29  const std::string & analysisname,
30  edm::ConsumesCollector && consCollector) :
31  _pset(pset),
32  _analysisname(analysisname),
33  _minCandidates(0),
34  _hltProcessName(pset.getParameter<std::string>("hltProcessName")),
35  _genParticleLabel(pset.getParameter<std::string>("genParticleLabel")),
36  _trigResultsLabel("TriggerResults", "", _hltProcessName),
37  _parametersEta(pset.getParameter<std::vector<double> >("parametersEta")),
38  _parametersPhi(pset.getParameter<std::vector<double> >("parametersPhi")),
39  _parametersTurnOn(pset.getParameter<std::vector<double> >("parametersTurnOn")),
40  _recMuonSelector(0),
41  _recMuonTrkSelector(0),
42  _recTrackSelector(0),
43  _recElecSelector(0),
44  _recMETSelector(0),
45  _recPFMETSelector(0),
46  _recPFMHTSelector(0),
47  _genMETSelector(0),
48  _recCaloMETSelector(0),
49  _l1METSelector(0),
50  _recPFTauSelector(0),
51  _recPhotonSelector(0),
52  _recPFJetSelector(0),
53  _recCaloJetSelector(0)
54 {
55 
56  LogDebug("ExoticaValidation") << "In HLTExoticaSubAnalysis::constructor()";
57 
58  // Specific parameters for this analysis
59  edm::ParameterSet anpset = pset.getParameter<edm::ParameterSet>(analysisname);
60 
61  // If this analysis has a particular set of binnings, use it.
62  // (Taken from the analysis-specific parameter set, of course)
63  // The "true" in the beginning of _pset.insert() means
64  // "overwrite the parameter if need be".
65  if (anpset.exists("parametersTurnOn")) {
66  _parametersTurnOn = anpset.getParameter<std::vector<double> >("parametersTurnOn");
67  _pset.insert(true, "parametersTurnOn", anpset.retrieve("parametersTurnOn"));
68  }
69  if (anpset.exists("parametersEta")) {
70  _parametersEta = anpset.getParameter<std::vector<double> >("parametersEta");
71  _pset.insert(true, "parametersEta", anpset.retrieve("parametersEta"));
72  }
73  if (anpset.exists("parametersPhi")) {
74  _parametersPhi = anpset.getParameter<std::vector<double> >("parametersPhi");
75  _pset.insert(true, "parametersPhi", anpset.retrieve("parametersPhi"));
76  }
77 
78  // Get names of objects that we may want to get from the event.
79  // Notice that genParticles are dealt with separately.
80  this->getNamesOfObjects(anpset);
81 
82  // Since now we have the names, we should register the consumption
83  // of objects.
84  this->registerConsumes(consCollector);
85 
86  // Generic objects: Initialization of basic phase space cuts.
87  for (std::map<unsigned int, edm::InputTag>::const_iterator it = _recLabels.begin();
88  it != _recLabels.end(); ++it) {
89  const std::string objStr = EVTColContainer::getTypeString(it->first);
90  _genCut[it->first] = pset.getParameter<std::string>(std::string(objStr + "_genCut").c_str());
91  _recCut[it->first] = pset.getParameter<std::string>(std::string(objStr + "_recCut").c_str());
92  if (pset.exists(std::string(objStr + "_genCut_leading"))) {
93  _genCut_leading[it->first] = pset.getParameter<std::string>(std::string(objStr + "_genCut_leading").c_str());
94  } else {
95  _genCut_leading[it->first] = "pt>0"; // no cut
96  }
97  if (pset.exists(std::string(objStr + "_recCut_leading"))) {
98  _recCut_leading[it->first] = pset.getParameter<std::string>(std::string(objStr + "_recCut_leading").c_str());
99  } else {
100  _recCut_leading[it->first] = "pt>0"; // no cut
101  }
102  }
103 
104  //--- Updating parameters if has to be modified for this particular specific analysis
105  for (std::map<unsigned int, edm::InputTag>::const_iterator it = _recLabels.begin();
106  it != _recLabels.end(); ++it) {
107  const std::string objStr = EVTColContainer::getTypeString(it->first);
108 
109  try {
110  _genCut[it->first] = anpset.getUntrackedParameter<std::string>(std::string(objStr + "_genCut").c_str());
111  } catch (edm::Exception) {}
112 
113  try {
114  _recCut[it->first] = anpset.getUntrackedParameter<std::string>(std::string(objStr + "_recCut").c_str());
115  } catch (edm::Exception) {}
116 
117  }
118 
120  _hltPathsToCheck = anpset.getParameter<std::vector<std::string> >("hltPathsToCheck");
122  _minCandidates = anpset.getParameter<unsigned int>("minCandidates");
123 
124 }
125 
127 {
128  for (std::map<unsigned int, StringCutObjectSelector<reco::GenParticle>* >::iterator it = _genSelectorMap.begin();
129  it != _genSelectorMap.end(); ++it) {
130  delete it->second;
131  it->second = 0;
132  }
133  delete _recMuonSelector;
134  _recMuonSelector = 0;
135  delete _recMuonTrkSelector;
137  delete _recTrackSelector;
138  _recTrackSelector = 0;
139  delete _recElecSelector;
140  _recElecSelector = 0;
141  delete _recPhotonSelector;
142  _recPhotonSelector = 0;
143  delete _recMETSelector;
144  _recMETSelector = 0;
145  delete _recPFMETSelector;
146  _recPFMETSelector = 0;
147  delete _recPFMHTSelector;
148  _recPFMHTSelector = 0;
149  delete _genMETSelector;
150  _genMETSelector = 0;
151  delete _recCaloMETSelector;
153  delete _l1METSelector;
154  _l1METSelector = 0;
155  delete _recPFTauSelector;
156  _recPFTauSelector = 0;
157  delete _recPFJetSelector;
158  _recPFJetSelector = 0;
159  delete _recCaloJetSelector;
161 }
162 
163 
165 {
166 }
167 
168 
169 // 2014-02-03 -- Thiago
170 // Due to the fact that the DQM has to be thread safe now, we have to do things differently:
171 // 1) Implement the bookHistograms() method in the container class
172 // 2) Make the iBooker from above be known to this class
173 // 3) Separate all booking histograms routines in this and any auxiliary classe to be called
174 // from bookHistograms() in the container class
176  const edm::Run & iRun,
177  const edm::EventSetup & iSetup)
178 {
179 
180  LogDebug("ExoticaValidation") << "In HLTExoticaSubAnalysis::subAnalysisBookHistos()";
181 
182  // Create the folder structure inside HLT/Exotica
183  std::string baseDir = "HLT/Exotica/" + _analysisname + "/";
184  iBooker.setCurrentFolder(baseDir);
185 
186  // Book the gen/reco analysis-dependent histograms (denominators)
187  for (std::map<unsigned int, edm::InputTag>::const_iterator it = _recLabels.begin();
188  it != _recLabels.end(); ++it) {
189  const std::string objStr = EVTColContainer::getTypeString(it->first);
190  std::vector<std::string> sources(2);
191  sources[0] = "gen";
192  sources[1] = "rec";
193 
194  for (size_t i = 0; i < sources.size(); i++) {
195  std::string source = sources[i];
196 
197  if ( !( TString(objStr).Contains("MET") || TString(objStr).Contains("MHT") ) || source!="gen" ) {
198  bookHist(iBooker, source, objStr, "MaxPt1");
199  }
200 
201  if ( !( TString(objStr).Contains("MET") || TString(objStr).Contains("MHT") ) ) {
202  bookHist(iBooker, source, objStr, "Eta");
203  bookHist(iBooker, source, objStr, "Phi");
204  bookHist(iBooker, source, objStr, "MaxPt2");
205  }
206  else { // MET or MHT case
207  if (source == "gen") continue; // gen {any kind of}MET doesn't make sense.
208  else bookHist(iBooker, source, objStr, "SumEt");
209  }
210 
211  }
212  } // closes loop in _recLabels
213 
214  // Call the plotterBookHistos() (which books all the path dependent histograms)
215  LogDebug("ExoticaValidation") << " number of plotters = " << _plotters.size();
216  for (std::vector<HLTExoticaPlotter>::iterator it = _plotters.begin();
217  it != _plotters.end(); ++it) {
218  it->plotterBookHistos(iBooker, iRun, iSetup);
219  }
220 }
221 
222 void HLTExoticaSubAnalysis::beginRun(const edm::Run & iRun, const edm::EventSetup & iSetup)
223 {
224 
225  LogDebug("ExoticaValidation") << "In HLTExoticaSubAnalysis::beginRun()";
226 
229 
230  // Initialize the HLT config.
231  bool changedConfig(true);
232  if (!_hltConfig.init(iRun, iSetup, _hltProcessName, changedConfig)) {
233  edm::LogError("ExoticaValidation") << "HLTExoticaSubAnalysis::constructor(): "
234  << "Initialization of HLTConfigProvider failed!";
235  }
236 
237  // Parse the input paths to get them if they are in the table and associate
238  // them to the last filter of the path (in order to extract the objects).
239  _hltPaths.clear();
240  for (size_t i = 0; i < _hltPathsToCheck.size(); ++i) {
241  bool found = false;
242  TPRegexp pattern(_hltPathsToCheck[i]);
243 
244  // Loop over triggerNames from _hltConfig
245  for (size_t j = 0 ; j < _hltConfig.triggerNames().size(); ++j) {
246  std::string thetriggername = _hltConfig.triggerNames()[j];
247  if (TString(thetriggername).Contains(pattern)) {
248  _hltPaths.insert(thetriggername);
249  found = true;
250  }
251  if(verbose>2 && i==0)
252  std::cout << "--- TRIGGER PATH : " << thetriggername << std::endl;
253  }
254 
255  // Oh dear, the path we wanted seems to not be available
256  if (! found && verbose>2) {
257  edm::LogWarning("ExoticaValidation") << "HLTExoticaSubAnalysis::constructor(): In "
258  << _analysisname << " subfolder NOT found the path: '"
259  << _hltPathsToCheck[i] << "*'" ;
260  }
261  } // Close loop over paths to check.
262 
263  // At this point, _hltpaths contains the names of the paths to check
264  // that were found. Let's log it at trace level.
265  LogTrace("ExoticaValidation") << "SubAnalysis: " << _analysisname
266  << "\nHLT Trigger Paths found >>>";
267  for (std::set<std::string>::const_iterator iter = _hltPaths.begin();
268  iter != _hltPaths.end(); ++iter) {
269  LogTrace("ExoticaValidation") << (*iter) << "\n";
270  }
271 
272  // Initialize the plotters (analysers for each trigger path)
273  _plotters.clear();
274  for (std::set<std::string>::iterator iPath = _hltPaths.begin();
275  iPath != _hltPaths.end(); ++iPath) {
276  // Avoiding the dependence of the version number for the trigger paths
277  std::string path = * iPath;
278  std::string shortpath = path;
279  if (path.rfind("_v") < path.length()) {
280  shortpath = path.substr(0, path.rfind("_v"));
281  }
282  _shortpath2long[shortpath] = path;
283 
284  // Objects needed by the HLT path
285  // Thiago: instead of trying to decode the objects from the path,
286  // put the burden on the user to tell us which objects are needed.
287  //const std::vector<unsigned int> objsNeedHLT = this->getObjectsType(shortpath);
288  std::vector<unsigned int> objsNeedHLT;
289  for (std::map<unsigned int, edm::InputTag>::iterator it = _recLabels.begin() ;
290  it != _recLabels.end(); ++it) {
291  objsNeedHLT.push_back(it->first);
292  }
293 
294  /*std::vector<unsigned int> userInstantiate;
295  // Sanity check: the object needed by a trigger path should be
296  // introduced by the user via config python (_recLabels datamember)
297  for (std::map<unsigned int, edm::InputTag>::iterator it = _recLabels.begin() ;
298  it != _recLabels.end(); ++it) {
299  userInstantiate.push_back(it->first);
300  }
301  for (std::vector<unsigned int>::const_iterator it = objsNeedHLT.begin(); it != objsNeedHLT.end();
302  ++it) {
303  if (std::find(userInstantiate.begin(), userInstantiate.end(), *it) ==
304  userInstantiate.end()) {
305  edm::LogError("ExoticaValidation") << "In HLTExoticaSubAnalysis::beginRun, "
306  << "Incoherence found in the python configuration file!!\nThe SubAnalysis '"
307  << _analysisname << "' has been asked to evaluate the trigger path '"
308  << shortpath << "' (found it in 'hltPathsToCheck') BUT this path"
309  << " needs a '" << EVTColContainer::getTypeString(*it)
310  << "' which has not been instantiated ('recVariableLabels'"
311  << ")" ;
312  exit(-1); // This should probably throw an exception...
313  }
314  }
315  */
316  LogTrace("ExoticaValidation") << " --- " << shortpath;
317 
318  // The hlt path, the objects (electrons, muons, photons, ...)
319  // needed to evaluate the path are the argumens of the plotter
320  HLTExoticaPlotter analyzer(_pset, shortpath, objsNeedHLT);
321  _plotters.push_back(analyzer);
322  }// Okay, at this point we have prepared all the plotters.
323 
324 }
325 
326 
328 {
329  LogDebug("ExoticaValidation") << "In HLTExoticaSubAnalysis::analyze()";
330 
331  // Loop over _recLabels to make sure everything is alright.
332  /*
333  std::cout << "Now printing the _recLabels" << std::endl;
334  for (std::map<unsigned int, edm::InputTag>::iterator it = _recLabels.begin();
335  it != _recLabels.end(); ++it) {
336  std::cout << "Number: " << it->first << "\t" << "Label: " << it->second.label() << std::endl;
337  }
338  */
339 
340  // Initialize the collection (the ones which have not been initialiazed yet)
341  //std::cout << "Setting handles to objects..." << std::endl;
342  this->getHandlesToObjects(iEvent, cols);
343 
344  // Utility map, mapping kinds of objects (GEN, RECO) to strings ("gen","rec")
345  //std::map<Level, std::string> u2str;
346  //u2str[Level::GEN] = "gen";
347  //u2str[Level::RECO] = "rec";
348 
349  // Extract the match structure containing the gen/reco candidates (electron, muons,...). This part is common to all the SubAnalyses
350  std::vector<reco::LeafCandidate> matchesGen; matchesGen.clear();
351  std::vector<reco::LeafCandidate> matchesReco; matchesReco.clear();
352  std::map<int , double> theSumEt; // map< pdgId ; SumEt > in order to keep track of the MET type
353 
354  // --- deal with GEN objects first.
355  // Make each good GEN object into the base cand for a MatchStruct
356  // Our definition of "good" is "passes the selector" defined in the config.py
357  // Save all the MatchStructs in the "matchesGen" vector.
358 
359  for (std::map<unsigned int, edm::InputTag>::iterator it = _recLabels.begin();
360  it != _recLabels.end(); ++it) {
361  // Here we are filling the vector of StringCutObjectSelector<reco::GenParticle>
362  // with objects constructed from the strings saved in _genCut.
363  // Initialize selectors when first event
364 
365  //std::cout << "Loop over the kinds of objects: objects of kind " << it->first << std::endl;
366 
367 
368  if (!_genSelectorMap[it->first]) {
370  }
371 
372  const std::string objTypeStr = EVTColContainer::getTypeString(it->first);
373  // genAnyMET doesn't make sense. No need their matchesGens
374  if ( TString(objTypeStr).Contains("MET") || TString(objTypeStr).Contains("MHT") ) continue;
375 
376  // Now loop over the genParticles, and apply the operator() over each of them.
377  // Fancy syntax: for objects X and Y, X.operator()(Y) is the same as X(Y).
378  for (size_t i = 0; i < cols->genParticles->size(); ++i) {
379  //std::cout << "Now matchesGen.size() is " << matchesGen.size() << std::endl;
380  if (_genSelectorMap[it->first]->operator()(cols->genParticles->at(i))) {
381  const reco::Candidate* cand = &(cols->genParticles->at(i));
382  //std::cout << "Found good cand: cand->pt() = " << cand->pt() << std::endl;
383  //matchesGen.push_back(MatchStruct(cand, it->first));
386  reco::LeafCandidate v(0,cand->p4(),cand->vertex(),it->first,0,true);
387 
388  matchesGen.push_back(v);
389  }
390  }
391  }
392 
393  // Sort the matches by pT for later filling of turn-on curve
394  //std::cout << "Before sorting: matchesGen.size() = " << matchesGen.size() << std::endl;
395 
396  // GreaterByPt<reco::LeafCandidate> comparator;
397  // std::sort(matchesGen.begin(),
398  // matchesGen.end(),
399  // comparator);
400 
401  // --- same for RECO objects
402  // Extraction of the objects candidates
403  if(verbose>0) std::cout << "-- enter loop over recLabels" << std::endl;
404  for (std::map<unsigned int, edm::InputTag>::iterator it = _recLabels.begin();
405  it != _recLabels.end(); ++it) {
406  //std::cout << "Filling RECO \"matchesReco\" vector for particle kind it->first = "
407  // << it->first << ", which means " << it->second.label() << std::endl;
408  // Reco selectors (the function takes into account if it was instantiated
409  // before or not) ### Thiago ---> Then why don't we put it in the beginRun???
410  this->initSelector(it->first);
411  // -- Storing the matchesReco
412  this->insertCandidates(it->first, cols, &matchesReco, theSumEt);
413  if(verbose>0) std::cout << "--- " << EVTColContainer::getTypeString(it->first)
414  << " sumEt=" << theSumEt[it->first] << std::endl;
415  }
416 
417  // std::sort(matchesReco.begin(),
418  // matchesReco.end(),
419  // comparator);
420 
421  // -- Trigger Results
422  const edm::TriggerNames trigNames = iEvent.triggerNames(*(cols->triggerResults));
423 
425 
426  //for (std::map<unsigned int, std::vector<MatchStruct> >::iterator it = sourceMatchMap.begin(); it != sourceMatchMap.end(); ++it) {
427  // it->first: gen/reco it->second: HLT matches (std::vector<MatchStruct>)
428 
429  //if (it->second.size() < _minCandidates) { // FIXME: A bug is potentially here: what about the mixed channels?
430  //continue;
431  //}
432 
436  {
437  if(matchesGen.size() < _minCandidates) return; // FIXME: A bug is potentially here: what about the mixed channels?
438  // Okay, there are enough candidates. Move on!
439 
440  // Filling the gen/reco objects (eff-denominators):
441  // Just the first two different ones, if there are more
442  // The countobjects maps uints (object types, really) --> integers.
443  // Example:
444  // | uint | int |
445  // | 0 | 1 | --> 1 muon used
446  // | 1 | 2 | --> 2 electrons used
447 
448  // Initializing the count of the used objects.
449  std::map<unsigned int, int> countobjects;
450  for (std::map<unsigned int, edm::InputTag>::iterator co = _recLabels.begin();
451  co != _recLabels.end(); ++co) {
452  //countobjects->insert(std::pair<unsigned int, int>(co->first, 0));
453  countobjects.insert(std::pair<unsigned int, int>(co->first, 0));
454  }
455 
456  int counttotal = 0;
457  //int totalobjectssize2 = 2 * countobjects->size();
458  int totalobjectssize2 = 2 * countobjects.size();
459 
460 
461  bool isPassedLeadingCut = true;
462  // We will proceed only when cuts for the pt-leading are satisified.
463  for (size_t j = 0; j != matchesGen.size(); ++j) {
464  const unsigned int objType = matchesGen[j].pdgId();
465  // Cut for the pt-leading object
467  if ( !select( matchesGen[j] ) ) { // No interest case
468  isPassedLeadingCut = false; // Will skip the following matchesReco loop
469  matchesGen.clear();
470  break;
471  }
472  }
473 
474  for (size_t j = 0; ( j != matchesGen.size() ) && isPassedLeadingCut; ++j) {
475  const unsigned int objType = matchesGen[j].pdgId();
476  //std::cout << "(4) Gonna call with " << objType << std::endl;
477  const std::string objTypeStr = EVTColContainer::getTypeString(objType);
478 
479  float pt = matchesGen[j].pt();
480 
481  if (countobjects[objType] == 0) {
482  this->fillHist("gen", objTypeStr, "MaxPt1", pt);
483  ++(countobjects[objType]);
484  ++counttotal;
485  }
486  else if (countobjects[objType] == 1) {
487  this->fillHist("gen", objTypeStr, "MaxPt2", pt);
488  ++(countobjects[objType]);
489  ++counttotal;
490  }
491  else {
492  // Already the minimum two objects has been filled, get out...
493  if (counttotal == totalobjectssize2) {
494  size_t max_size = matchesGen.size();
495  for ( size_t jj = j; jj < max_size; jj++ ) {
496  matchesGen.erase(matchesGen.end());
497  }
498  break;
499  }
500  }
501 
502  float eta = matchesGen[j].eta();
503  float phi = matchesGen[j].phi();
504 
505  this->fillHist("gen", objTypeStr, "Eta", eta);
506  this->fillHist("gen", objTypeStr, "Phi", phi);
507  //this->fillHist("gen", objTypeStr, "SumEt", theSumEt);
508 
509  } // Closes loop in gen
510 
511  // Calling to the plotters analysis (where the evaluation of the different trigger paths are done)
512  //const std::string source = "gen";
513  for (std::vector<HLTExoticaPlotter>::iterator an = _plotters.begin(); an != _plotters.end(); ++an) {
514  const std::string hltPath = _shortpath2long[an->gethltpath()];
515  const bool ispassTrigger = cols->triggerResults->accept(trigNames.triggerIndex(hltPath));
516  LogDebug("ExoticaValidation") << " preparing to call the plotters analysis";
517  an->analyze(ispassTrigger, "gen", matchesGen, theSumEt);
518  LogDebug("ExoticaValidation") << " called the plotter";
519  }
520  }
521 
525  {
526  if(matchesReco.size() < _minCandidates) return; // FIXME: A bug is potentially here: what about the mixed channels?
527 
528  // Okay, there are enough candidates. Move on!
529 
530  // Filling the gen/reco objects (eff-denominators):
531  // Just the first two different ones, if there are more
532  // The countobjects maps uints (object types, really) --> integers.
533  // Example:
534  // | uint | int |
535  // | 0 | 1 | --> 1 muon used
536  // | 1 | 2 | --> 2 electrons used
537  // Initializing the count of the used objects.
538  //std::map<unsigned int, int> * countobjects = new std::map<unsigned int, int>;
539  std::map<unsigned int, int> countobjects;
540  for (std::map<unsigned int, edm::InputTag>::iterator co = _recLabels.begin();
541  co != _recLabels.end(); ++co) {
542  countobjects.insert(std::pair<unsigned int, int>(co->first, 0));
543  }
544 
545  int counttotal = 0;
546  //int totalobjectssize2 = 2 * countobjects->size();
547  int totalobjectssize2 = 2 * countobjects.size();
548 
550  //std::cout << "Our RECO vector has matchesReco.size() = " << matchesReco.size() << std::endl;
551 
552 
553  bool isPassedLeadingCut = true;
554  // We will proceed only when cuts for the pt-leading are satisified.
555  for (size_t j = 0; j != matchesReco.size(); ++j) {
556  const unsigned int objType = matchesReco[j].pdgId();
557  // Cut for the pt-leading object
559  if ( !select( matchesReco[j] ) ) { // No interest case
560  isPassedLeadingCut = false; // Will skip the following matchesReco loop
561  matchesReco.clear();
562  break;
563  }
564  }
565 
566  for (size_t j = 0; ( j != matchesReco.size() ) && isPassedLeadingCut; ++j) {
567  const unsigned int objType = matchesReco[j].pdgId();
568  //std::cout << "(4) Gonna call with " << objType << std::endl;
569  const std::string objTypeStr = EVTColContainer::getTypeString(objType);
570 
571  float pt = matchesReco[j].pt();
572 
573  //if ((*countobjects)[objType] == 0) {
574  if (countobjects[objType] == 0) {
575  this->fillHist("rec", objTypeStr, "MaxPt1", pt);
576  ++(countobjects[objType]);
577  ++counttotal;
578  }
579  else if (countobjects[objType] == 1) {
580  if( ! ( TString(objTypeStr).Contains("MET") || TString(objTypeStr).Contains("MHT") ) ) {
581  this->fillHist("rec", objTypeStr, "MaxPt2", pt);
582  }
583  ++(countobjects[objType]);
584  ++counttotal;
585  }
586  else {
587  // Already the minimum two objects has been filled, get out...
588  if (counttotal == totalobjectssize2) {
589  size_t max_size = matchesReco.size();
590  for ( size_t jj = j; jj < max_size; jj++ ) {
591  matchesReco.erase(matchesReco.end());
592  }
593  break;
594  }
595  }
596 
597  float eta = matchesReco[j].eta();
598  float phi = matchesReco[j].phi();
599 
600  if ( !( TString(objTypeStr).Contains("MET") || TString(objTypeStr).Contains("MHT") ) ) {
601  this->fillHist("rec", objTypeStr, "Eta", eta);
602  this->fillHist("rec", objTypeStr, "Phi", phi);
603  }
604  else {
605  this->fillHist("rec", objTypeStr, "SumEt", theSumEt[objType]);
606  }
607 
608  } // Closes loop in reco
609 
610  //LogDebug("ExoticaValidation") << " deleting countobjects";
611  //delete countobjects;
612 
613  // Calling to the plotters analysis (where the evaluation of the different trigger paths are done)
614  //const std::string source = "reco";
615  for (std::vector<HLTExoticaPlotter>::iterator an = _plotters.begin(); an != _plotters.end(); ++an) {
616  const std::string hltPath = _shortpath2long[an->gethltpath()];
617  const bool ispassTrigger = cols->triggerResults->accept(trigNames.triggerIndex(hltPath));
618  LogDebug("ExoticaValidation") << " preparing to call the plotters analysis";
619  an->analyze(ispassTrigger, "rec", matchesReco, theSumEt);
620  LogDebug("ExoticaValidation") << " called the plotter";
621  }
622  }
623 
624 }
625 
626 
627 // Return the objects (muons,electrons,photons,...) needed by a hlt path.
628 const std::vector<unsigned int> HLTExoticaSubAnalysis::getObjectsType(const std::string & hltPath) const
629 {
630  LogDebug("ExoticaValidation") << "In HLTExoticaSubAnalysis::getObjectsType()";
631 
632  static const unsigned int objSize = 14;
633  static const unsigned int objtriggernames[] = {
648  };
649 
650  std::set<unsigned int> objsType;
651  // The object to deal has to be entered via the config .py
652  for (unsigned int i = 0; i < objSize; ++i) {
653  //std::cout << "(5) Gonna call with " << objtriggernames[i] << std::endl;
654  std::string objTypeStr = EVTColContainer::getTypeString(objtriggernames[i]);
655  // Check if it is needed this object for this trigger
656  if (! TString(hltPath).Contains(objTypeStr)) {
657  continue;
658  }
659 
660  objsType.insert(objtriggernames[i]);
661  }
662 
663  return std::vector<unsigned int>(objsType.begin(), objsType.end());
664 }
665 
666 // Booking the maps: recLabels and genParticle selectors
668 {
669  LogDebug("ExoticaValidation") << "In HLTExoticaSubAnalysis::getNamesOfObjects()";
670 
671  if (anpset.exists("recMuonLabel")) {
672  _recLabels[EVTColContainer::MUON] = anpset.getParameter<edm::InputTag>("recMuonLabel");
674  }
675  if (anpset.exists("recMuonTrkLabel")) {
676  _recLabels[EVTColContainer::MUTRK] = anpset.getParameter<edm::InputTag>("recMuonTrkLabel");
678  }
679  if (anpset.exists("recTrackLabel")) {
680  _recLabels[EVTColContainer::TRACK] = anpset.getParameter<edm::InputTag>("recTrackLabel");
682  }
683  if (anpset.exists("recElecLabel")) {
684  _recLabels[EVTColContainer::ELEC] = anpset.getParameter<edm::InputTag>("recElecLabel");
686  }
687  if (anpset.exists("recPhotonLabel")) {
688  _recLabels[EVTColContainer::PHOTON] = anpset.getParameter<edm::InputTag>("recPhotonLabel");
690  }
691  if (anpset.exists("recMETLabel")) {
692  _recLabels[EVTColContainer::MET] = anpset.getParameter<edm::InputTag>("recMETLabel");
694  }
695  if (anpset.exists("recPFMETLabel")) {
696  _recLabels[EVTColContainer::PFMET] = anpset.getParameter<edm::InputTag>("recPFMETLabel");
698  }
699  if (anpset.exists("recPFMHTLabel")) {
700  _recLabels[EVTColContainer::PFMHT] = anpset.getParameter<edm::InputTag>("recPFMHTLabel");
702  }
703  if (anpset.exists("genMETLabel")) {
706  }
707  if (anpset.exists("recCaloMETLabel")) {
708  _recLabels[EVTColContainer::CALOMET] = anpset.getParameter<edm::InputTag>("recCaloMETLabel");
710  }
711  if (anpset.exists("hltMETLabel")) {
714  }
715  if (anpset.exists("l1METLabel")) {
718  }
719  if (anpset.exists("recPFTauLabel")) {
720  _recLabels[EVTColContainer::PFTAU] = anpset.getParameter<edm::InputTag>("recPFTauLabel");
722  }
723  if (anpset.exists("recPFJetLabel")) {
724  _recLabels[EVTColContainer::PFJET] = anpset.getParameter<edm::InputTag>("recPFJetLabel");
726  }
727  if (anpset.exists("recCaloJetLabel")) {
728  _recLabels[EVTColContainer::CALOJET] = anpset.getParameter<edm::InputTag>("recCaloJetLabel");
730  }
731 
732  if (_recLabels.size() < 1) {
733  edm::LogError("ExoticaValidation") << "HLTExoticaSubAnalysis::getNamesOfObjects, "
734  << "Not included any object (recMuonLabel, recElecLabel, ...) "
735  << "in the analysis " << _analysisname;
736  return;
737  }
738 }
739 
740 // Register consumption of objects.
741 // I have chosen to centralize all consumes() calls here.
743 {
744  // Register that we are getting genParticles
746 
747  // Register that we are getting the trigger results
749  // Loop over _recLabels, see what we need, and register.
750  // Then save the registered token in _tokens.
751  // Remember: _recLabels is a map<uint, edm::InputTag>
752  // Remember: _tokens is a map<uint, edm::EDGetToken>
753  LogDebug("ExoticaValidation") << "We have got " << _recLabels.size() << "recLabels";
754  for (std::map<unsigned int, edm::InputTag>::iterator it = _recLabels.begin();
755  it != _recLabels.end(); ++it) {
756  if (it->first == EVTColContainer::MUON) {
757  edm::EDGetTokenT<reco::MuonCollection> particularToken = iC.consumes<reco::MuonCollection>(it->second);
758  edm::EDGetToken token(particularToken);
759  _tokens[it->first] = token;
760  }
761  else if (it->first == EVTColContainer::MUTRK) {
763  edm::EDGetToken token(particularToken);
764  _tokens[it->first] = token;
765  }
766  else if (it->first == EVTColContainer::TRACK) {
768  edm::EDGetToken token(particularToken);
769  _tokens[it->first] = token;
770  }
771  else if (it->first == EVTColContainer::ELEC) {
773  edm::EDGetToken token(particularToken);
774  _tokens[it->first] = token;
775  }
776  else if (it->first == EVTColContainer::PHOTON) {
778  edm::EDGetToken token(particularToken);
779  _tokens[it->first] = token;
780  }
781  else if (it->first == EVTColContainer::MET) {
782  edm::EDGetTokenT<reco::METCollection> particularToken = iC.consumes<reco::METCollection>(it->second);
783  edm::EDGetToken token(particularToken);
784  _tokens[it->first] = token;
785  }
786  else if (it->first == EVTColContainer::PFMET) {
788  edm::EDGetToken token(particularToken);
789  _tokens[it->first] = token;
790  }
791  else if (it->first == EVTColContainer::PFMHT) {
793  edm::EDGetToken token(particularToken);
794  _tokens[it->first] = token;
795  }
796  else if (it->first == EVTColContainer::GENMET) {
798  edm::EDGetToken token(particularToken);
799  _tokens[it->first] = token;
800  }
801  else if (it->first == EVTColContainer::CALOMET) {
803  edm::EDGetToken token(particularToken);
804  _tokens[it->first] = token;
805  }
806  else if (it->first == EVTColContainer::L1MET) {
808  edm::EDGetToken token(particularToken);
809  _tokens[it->first] = token;
810  }
811  else if (it->first == EVTColContainer::PFTAU) {
813  edm::EDGetToken token(particularToken);
814  _tokens[it->first] = token;
815  }
816  else if (it->first == EVTColContainer::PFJET) {
818  edm::EDGetToken token(particularToken);
819  _tokens[it->first] = token;
820  }
821  else if (it->first == EVTColContainer::CALOJET) {
823  edm::EDGetToken token(particularToken);
824  _tokens[it->first] = token;
825  }
826  else {
827  edm::LogError("ExoticaValidation") << "HLTExoticaSubAnalysis::registerConsumes"
828  << " NOT IMPLEMENTED (yet) ERROR: '" << it->second.label() << "'";
829  }
830  }
831 
832 }
833 
834 // Setting the collections of objects in EVTColContainer
836 {
837  LogDebug("ExoticaValidation") << "In HLTExoticaSubAnalysis::getHandlesToObjects()";
838 
839  if (! col->isCommonInit()) {
840  // Extract the trigger results (path info, pass,...)
842  iEvent.getByToken(_trigResultsToken, trigResults);
843  if (trigResults.isValid()) {
844  col->triggerResults = trigResults.product();
845  LogDebug("ExoticaValidation") << "Added handle to triggerResults";
846  }
847 
848  // Extract the genParticles
850  iEvent.getByToken(_genParticleToken, genPart);
851  if (genPart.isValid()) {
852  col->genParticles = genPart.product();
853  LogDebug("ExoticaValidation") << "Added handle to genParticles";
854  }
855  }
856 
857  // Loop over the tokens and extract all other objects
858  LogDebug("ExoticaValidation") << "We have got " << _tokens.size() << "tokens";
859  for (std::map<unsigned int, edm::EDGetToken>::iterator it = _tokens.begin();
860  it != _tokens.end(); ++it) {
861  if (it->first == EVTColContainer::MUON) {
863  iEvent.getByToken(it->second, theHandle);
864  if (theHandle.isValid()) col->set(theHandle.product());
865  }
866  else if (it->first == EVTColContainer::MUTRK) {
868  iEvent.getByToken(it->second, theHandle);
869  if (theHandle.isValid()) col->set(theHandle.product());
870  }
871  else if (it->first == EVTColContainer::TRACK) {
873  iEvent.getByToken(it->second, theHandle);
874  if (theHandle.isValid()) col->set(theHandle.product());
875  }
876  else if (it->first == EVTColContainer::ELEC) {
878  iEvent.getByToken(it->second, theHandle);
879  if (theHandle.isValid()) col->set(theHandle.product());
880  }
881  else if (it->first == EVTColContainer::PHOTON) {
883  iEvent.getByToken(it->second, theHandle);
884  if (theHandle.isValid()) col->set(theHandle.product());
885  }
886  else if (it->first == EVTColContainer::MET) {
888  iEvent.getByToken(it->second, theHandle);
889  if (theHandle.isValid()) col->set(theHandle.product());
890  }
891  else if (it->first == EVTColContainer::PFMET) {
893  iEvent.getByToken(it->second, theHandle);
894  if (theHandle.isValid()) col->set(theHandle.product());
895  }
896  else if (it->first == EVTColContainer::PFMHT) {
898  iEvent.getByToken(it->second, theHandle);
899  if (theHandle.isValid()) col->setPFMHT(theHandle.product());
900  }
901  else if (it->first == EVTColContainer::GENMET) {
903  iEvent.getByToken(it->second, theHandle);
904  if (theHandle.isValid()) col->set(theHandle.product());
905  }
906  else if (it->first == EVTColContainer::CALOMET) {
908  iEvent.getByToken(it->second, theHandle);
909  if (theHandle.isValid()) col->set(theHandle.product());
910  }
911  else if (it->first == EVTColContainer::L1MET) {
913  iEvent.getByToken(it->second, theHandle);
914  if (theHandle.isValid()) col->set(theHandle.product());
915  }
916  else if (it->first == EVTColContainer::PFTAU) {
918  iEvent.getByToken(it->second, theHandle);
919  if (theHandle.isValid()) col->set(theHandle.product());
920  }
921  else if (it->first == EVTColContainer::PFJET) {
923  iEvent.getByToken(it->second, theHandle);
924  if (theHandle.isValid()) col->set(theHandle.product());
925  }
926  else if (it->first == EVTColContainer::CALOJET) {
928  iEvent.getByToken(it->second, theHandle);
929  if (theHandle.isValid()) col->set(theHandle.product());
930  }
931  else {
932  edm::LogError("ExoticaValidation") << "HLTExoticaSubAnalysis::getHandlesToObjects "
933  << " NOT IMPLEMENTED (yet) ERROR: '" << it->first << "'";
934  }
935  }
936 }
937 
938 // Booking the histograms, and putting them in DQM
940  const std::string & source,
941  const std::string & objType,
942  const std::string & variable)
943 {
944  LogDebug("ExoticaValidation") << "In HLTExoticaSubAnalysis::bookHist()";
945  std::string sourceUpper = source;
946  sourceUpper[0] = std::toupper(sourceUpper[0]);
947  std::string name = source + objType + variable ;
948  TH1F * h = 0;
949 
950  if (variable.find("SumEt") != std::string::npos) {
951  std::string title = "Sum ET of " + sourceUpper + " " + objType;
952  const size_t nBins = _parametersTurnOn.size() - 1;
953  float * edges = new float[nBins + 1];
954  for (size_t i = 0; i < nBins + 1; i++) {
955  edges[i] = _parametersTurnOn[i];
956  }
957  h = new TH1F(name.c_str(), title.c_str(), nBins, edges);
958  delete[] edges;
959  }
960 
961  else if (variable.find("MaxPt") != std::string::npos) {
962  std::string desc = (variable == "MaxPt1") ? "Leading" : "Next-to-Leading";
963  std::string title = "pT of " + desc + " " + sourceUpper + " " + objType;
964  const size_t nBins = _parametersTurnOn.size() - 1;
965  float * edges = new float[nBins + 1];
966  for (size_t i = 0; i < nBins + 1; i++) {
967  edges[i] = _parametersTurnOn[i];
968  }
969  h = new TH1F(name.c_str(), title.c_str(), nBins, edges);
970  delete[] edges;
971  }
972 
973  else {
974  std::string symbol = (variable == "Eta") ? "#eta" : "#phi";
975  std::string title = symbol + " of " + sourceUpper + " " + objType;
976  std::vector<double> params = (variable == "Eta") ? _parametersEta : _parametersPhi;
977  int nBins = (int)params[0];
978  double min = params[1];
979  double max = params[2];
980  h = new TH1F(name.c_str(), title.c_str(), nBins, min, max);
981  }
982 
983  h->Sumw2();
984  // This is the trick, that takes a normal TH1F and puts it in in the DQM
985  // machinery. Seems to be easy!
986  // Updated to use the new iBooker machinery.
987  _elements[name] = iBooker.book1D(name, h);
988  delete h;
989 }
990 
991 // Fill the histograms
993  const std::string & objType,
994  const std::string & variable,
995  const float & value)
996 {
997  std::string sourceUpper = source;
998  sourceUpper[0] = toupper(sourceUpper[0]);
999  std::string name = source + objType + variable ;
1000 
1001  LogDebug("ExoticaValidation") << "In HLTExoticaSubAnalysis::fillHist() " << name << " " << value;
1002  _elements[name]->Fill(value);
1003  LogDebug("ExoticaValidation") << "In HLTExoticaSubAnalysis::fillHist() " << name << " worked";
1004 }
1005 
1006 // Initialize the selectors
1007 void HLTExoticaSubAnalysis::initSelector(const unsigned int & objtype)
1008 {
1009 
1010  LogDebug("ExoticaValidation") << "In HLTExoticaSubAnalysis::initSelector()";
1011 
1012  if (objtype == EVTColContainer::MUON && _recMuonSelector == 0) {
1014  } else if (objtype == EVTColContainer::MUTRK && _recMuonTrkSelector == 0) {
1016  } else if (objtype == EVTColContainer::TRACK && _recTrackSelector == 0) {
1018  } else if (objtype == EVTColContainer::ELEC && _recElecSelector == 0) {
1020  } else if (objtype == EVTColContainer::PHOTON && _recPhotonSelector == 0) {
1022  } else if (objtype == EVTColContainer::MET && _recMETSelector == 0) {
1024  } else if (objtype == EVTColContainer::PFMET && _recPFMETSelector == 0) {
1026  } else if (objtype == EVTColContainer::PFMHT && _recPFMHTSelector == 0) {
1028  } else if (objtype == EVTColContainer::GENMET && _genMETSelector == 0) {
1030  } else if (objtype == EVTColContainer::CALOMET && _recCaloMETSelector == 0) {
1032  } else if (objtype == EVTColContainer::L1MET && _l1METSelector == 0) {
1034  } else if (objtype == EVTColContainer::PFTAU && _recPFTauSelector == 0) {
1036  } else if (objtype == EVTColContainer::PFJET && _recPFJetSelector == 0) {
1038  } else if (objtype == EVTColContainer::CALOJET && _recCaloJetSelector == 0) {
1040  }
1041  /* else
1042  {
1043  FIXME: ERROR NOT IMPLEMENTED
1044  }*/
1045 }
1046 
1047 // Insert the HLT candidates
1048 void HLTExoticaSubAnalysis::insertCandidates(const unsigned int & objType, const EVTColContainer * cols, std::vector<reco::LeafCandidate> * matches, std::map<int,double> & theSumEt)
1049 {
1050 
1051  LogDebug("ExoticaValidation") << "In HLTExoticaSubAnalysis::insertCandidates()";
1052 
1053  theSumEt[objType] = -1;
1054 
1055  if (objType == EVTColContainer::MUON) {
1056  for (size_t i = 0; i < cols->muons->size(); i++) {
1057  LogDebug("ExoticaValidation") << "Inserting muon " << i ;
1058  if (_recMuonSelector->operator()(cols->muons->at(i))) {
1059  reco::LeafCandidate m(0, cols->muons->at(i).p4(), cols->muons->at(i).vertex(), objType, 0, true);
1060  matches->push_back(m);
1061  }
1062  }
1063  } else if (objType == EVTColContainer::MUTRK) {
1064  for (size_t i = 0; i < cols->tracks->size(); i++) {
1065  LogDebug("ExoticaValidation") << "Inserting muonTrack " << i ;
1066  if (_recMuonTrkSelector->operator()(cols->tracks->at(i))) {
1067  ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>> mom4;
1068  ROOT::Math::XYZVector mom3 = cols->tracks->at(i).momentum();
1069  mom4.SetXYZT(mom3.x(),mom3.y(),mom3.z(),mom3.r());
1070  reco::LeafCandidate m(0, mom4, cols->tracks->at(i).vertex(), objType, 0, true);
1071  matches->push_back(m);
1072  }
1073  }
1074  } else if (objType == EVTColContainer::TRACK) {
1075  for (size_t i = 0; i < cols->tracks->size(); i++) {
1076  LogDebug("ExoticaValidation") << "Inserting Track " << i ;
1077  if (_recTrackSelector->operator()(cols->tracks->at(i))) {
1078  ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>> mom4;
1079  ROOT::Math::XYZVector mom3 = cols->tracks->at(i).momentum();
1080  mom4.SetXYZT(mom3.x(),mom3.y(),mom3.z(),mom3.r());
1081  reco::LeafCandidate m(0, mom4, cols->tracks->at(i).vertex(), objType, 0, true);
1082  matches->push_back(m);
1083  }
1084  }
1085  } else if (objType == EVTColContainer::ELEC) {
1086  for (size_t i = 0; i < cols->electrons->size(); i++) {
1087  LogDebug("ExoticaValidation") << "Inserting electron " << i ;
1088  if (_recElecSelector->operator()(cols->electrons->at(i))) {
1089  reco::LeafCandidate m(0, cols->electrons->at(i).p4(), cols->electrons->at(i).vertex(), objType, 0, true);
1090  matches->push_back(m);
1091  }
1092  }
1093  } else if (objType == EVTColContainer::PHOTON) {
1094  for (size_t i = 0; i < cols->photons->size(); i++) {
1095  LogDebug("ExoticaValidation") << "Inserting photon " << i ;
1096  if (_recPhotonSelector->operator()(cols->photons->at(i))) {
1097  reco::LeafCandidate m(0, cols->photons->at(i).p4(), cols->photons->at(i).vertex(), objType, 0, true);
1098  matches->push_back(m);
1099  }
1100  }
1101  } else if (objType == EVTColContainer::PFMET) {
1105  for (size_t i = 0; i < cols->pfMETs->size(); i++) {
1106  LogDebug("ExoticaValidation") << "Inserting PFMET " << i ;
1107  if (_recPFMETSelector->operator()(cols->pfMETs->at(i))) {
1108  reco::LeafCandidate m(0, cols->pfMETs->at(i).p4(), cols->pfMETs->at(i).vertex(), objType, 0, true);
1109  matches->push_back(m);
1110  if(i==0) theSumEt[objType] = cols->pfMETs->at(i).sumEt();
1111  }
1112  }
1113  } else if (objType == EVTColContainer::PFMHT) {
1114  for (size_t i = 0; i < cols->pfMHTs->size(); i++) {
1115  LogDebug("ExoticaValidation") << "Inserting PFMHT " << i ;
1116  if (_recPFMHTSelector->operator()(cols->pfMHTs->at(i))) {
1117  reco::LeafCandidate m(0, cols->pfMHTs->at(i).p4(), cols->pfMHTs->at(i).vertex(), objType, 0, true);
1118  matches->push_back(m);
1119  if(i==0) theSumEt[objType] = cols->pfMHTs->at(i).sumEt();
1120  }
1121  }
1122  } else if (objType == EVTColContainer::GENMET) {
1123  for (size_t i = 0; i < cols->genMETs->size(); i++) {
1124  LogDebug("ExoticaValidation") << "Inserting GENMET " << i ;
1125  if (_genMETSelector->operator()(cols->genMETs->at(i))) {
1126  reco::LeafCandidate m(0, cols->genMETs->at(i).p4(), cols->genMETs->at(i).vertex(), objType, 0, true);
1127  matches->push_back(m);
1128  if(i==0) theSumEt[objType] = cols->genMETs->at(i).sumEt();
1129  }
1130  }
1131  } else if (objType == EVTColContainer::CALOMET) {
1132  for (size_t i = 0; i < cols->caloMETs->size(); i++) {
1133  LogDebug("ExoticaValidation") << "Inserting CALOMET " << i ;
1134  if (_recCaloMETSelector->operator()(cols->caloMETs->at(i))) {
1135  reco::LeafCandidate m(0, cols->caloMETs->at(i).p4(), cols->caloMETs->at(i).vertex(), objType, 0, true);
1136  matches->push_back(m);
1137  if(i==0) theSumEt[objType] = cols->caloMETs->at(i).sumEt();
1138  }
1139  }
1140  } else if (objType == EVTColContainer::L1MET) {
1141  for (size_t i = 0; i < cols->l1METs->size(); i++) {
1142  LogDebug("ExoticaValidation") << "Inserting L1MET " << i ;
1143  if (_l1METSelector->operator()(cols->l1METs->at(i))) {
1144  reco::LeafCandidate m(0, cols->l1METs->at(i).p4(), cols->l1METs->at(i).vertex(), objType, 0, true);
1145  matches->push_back(m);
1146  if(i==0) theSumEt[objType] = cols->l1METs->at(i).etTotal();
1147  }
1148  }
1149  } else if (objType == EVTColContainer::PFTAU) {
1150  for (size_t i = 0; i < cols->pfTaus->size(); i++) {
1151  LogDebug("ExoticaValidation") << "Inserting PFtau " << i ;
1152  if (_recPFTauSelector->operator()(cols->pfTaus->at(i))) {
1153  reco::LeafCandidate m(0, cols->pfTaus->at(i).p4(), cols->pfTaus->at(i).vertex(), objType, 0, true);
1154  matches->push_back(m);
1155  }
1156  }
1157  } else if (objType == EVTColContainer::PFJET) {
1158  for (size_t i = 0; i < cols->pfJets->size(); i++) {
1159  LogDebug("ExoticaValidation") << "Inserting jet " << i ;
1160  if (_recPFJetSelector->operator()(cols->pfJets->at(i))) {
1161  reco::LeafCandidate m(0, cols->pfJets->at(i).p4(), cols->pfJets->at(i).vertex(), objType, 0, true);
1162  matches->push_back(m);
1163  }
1164  }
1165  } else if (objType == EVTColContainer::CALOJET) {
1166  for (size_t i = 0; i < cols->caloJets->size(); i++) {
1167  LogDebug("ExoticaValidation") << "Inserting jet " << i ;
1168  if (_recCaloJetSelector->operator()(cols->caloJets->at(i))) {
1169  reco::LeafCandidate m(0, cols->caloJets->at(i).p4(), cols->caloJets->at(i).vertex(), objType, 0, true);
1170  matches->push_back(m);
1171  }
1172  }
1173  }
1174 
1175  /* else
1176  {
1177  FIXME: ERROR NOT IMPLEMENTED
1178  }*/
1179 }
#define LogDebug(id)
const std::vector< reco::Muon > * muons
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
StringCutObjectSelector< reco::Track > * _recMuonTrkSelector
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
T getParameter(std::string const &) const
unsigned int _minCandidates
The minimum number of reco/gen candidates needed by the analysis.
Entry const & retrieve(char const *) const
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
Definition: Event.cc:199
void getNamesOfObjects(const edm::ParameterSet &anpset)
Creates the maps that map which collection should come from which label.
std::vector< PFTau > PFTauCollection
collection of PFTau objects
Definition: PFTauFwd.h:9
const std::vector< reco::CaloMET > * caloMETs
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
std::vector< reco::GenMET > GenMETCollection
collection of GenMET objects
std::map< unsigned int, std::string > _genCut
gen/rec objects cuts
bool accept() const
Has at least one path accepted the event?
const std::vector< std::string > & triggerNames() const
names of trigger paths
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:13
std::vector< HLTExoticaPlotter > _plotters
The plotters: managers of each hlt path where the plots are done.
bool exists(std::string const &parameterName) const
checks if a parameter exists
StringCutObjectSelector< reco::CaloJet > * _recCaloJetSelector
StringCutObjectSelector< reco::GenMET > * _genMETSelector
std::vector< double > _parametersPhi
list pattern
Definition: chain.py:104
const std::vector< reco::CaloJet > * caloJets
void insert(bool ok_to_replace, char const *, Entry const &)
void fillHist(const std::string &source, const std::string &objType, const std::string &variable, const float &value)
const reco::GenParticleCollection * genParticles
container with all the objects needed
Strings::size_type size() const
Definition: TriggerNames.cc:39
void analyze(const edm::Event &iEvent, const edm::EventSetup &iEventSetup, EVTColContainer *cols)
T eta() const
StringCutObjectSelector< reco::MET > * _recMETSelector
edm::EDGetTokenT< edm::TriggerResults > _trigResultsToken
std::vector< reco::MET > METCollection
collection of MET objects
Definition: METCollection.h:23
dictionary edges
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
const std::vector< reco::PFTau > * pfTaus
std::vector< Muon > MuonCollection
collection of Muon objects
Definition: MuonFwd.h:9
std::map< unsigned int, std::string > _genCut_leading
gen/rec pt-leading objects cuts
StringCutObjectSelector< reco::PFJet > * _recPFJetSelector
void setPFMHT(const reco::PFMETCollection *v)
std::map< unsigned int, edm::InputTag > _recLabels
StringCutObjectSelector< reco::GsfElectron > * _recElecSelector
void set(const reco::MuonCollection *v)
Setter: multiple overloaded function.
std::map< unsigned int, std::string > _recCut_leading
const std::vector< reco::PFMET > * pfMHTs
int iEvent
Definition: GenABIO.cc:230
StringCutObjectSelector< reco::Muon > * _recMuonSelector
tuple path
else: Piece not in the list, fine.
unsigned int triggerIndex(std::string const &name) const
Definition: TriggerNames.cc:32
const std::vector< reco::GenMET > * genMETs
edm::ParameterSet _pset
Internal, working copy of the PSet passed from above.
void subAnalysisBookHistos(DQMStore::IBooker &iBooker, const edm::Run &iRun, const edm::EventSetup &iSetup)
std::vector< double > _parametersEta
Some kinematical parameters.
std::map< unsigned int, std::string > _recCut
const std::vector< unsigned int > getObjectsType(const std::string &hltpath) const
closes analyze method
StringCutObjectSelector< reco::Track > * _recTrackSelector
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
int j
Definition: DBlmapReader.cc:9
const std::vector< reco::PFJet > * pfJets
HLTConfigProvider _hltConfig
Interface to the HLT information.
const std::vector< reco::Track > * tracks
const std::vector< reco::Photon > * photons
virtual const Point & vertex() const =0
vertex position
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
~HLTExoticaSubAnalysis()
End Constructor.
T min(T a, T b)
Definition: MathUtil.h:58
bool isValid() const
Definition: HandleBase.h:76
std::vector< std::string > _hltPathsToCheck
The hlt paths to check for.
#define LogTrace(id)
std::string _hltProcessName
The labels of the object collections to be used in this analysis.
static const char *const trigNames[]
Definition: EcalDumpRaw.cc:74
Transform3DPJ::Vector XYZVector
const std::vector< l1extra::L1EtMissParticle > * l1METs
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
std::vector< reco::CaloMET > CaloMETCollection
collection of CaloMET objects
void registerConsumes(edm::ConsumesCollector &consCollector)
Registers consumption of objects.
T const * product() const
Definition: Handle.h:81
void getHandlesToObjects(const edm::Event &iEvent, EVTColContainer *col)
Gets the collections themselves.
StringCutObjectSelector< reco::PFMET > * _recPFMETSelector
std::string _analysisname
The name of this sub-analysis.
StringCutObjectSelector< reco::Photon > * _recPhotonSelector
std::vector< Photon > PhotonCollection
collectin of Photon objects
Definition: PhotonFwd.h:9
std::map< unsigned int, StringCutObjectSelector< reco::GenParticle > * > _genSelectorMap
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
void beginRun(const edm::Run &iRun, const edm::EventSetup &iEventSetup)
StringCutObjectSelector< l1extra::L1EtMissParticle > * _l1METSelector
const std::vector< reco::GsfElectron > * electrons
std::vector< double > _parametersTurnOn
std::map< unsigned int, edm::EDGetToken > _tokens
std::map< std::string, MonitorElement * > _elements
Structure of the MonitorElements.
StringCutObjectSelector< reco::CaloMET > * _recCaloMETSelector
std::vector< PFJet > PFJetCollection
collection of PFJet objects
HLTExoticaSubAnalysis(const edm::ParameterSet &pset, const std::string &analysisname, edm::ConsumesCollector &&consCollector)
Constructor.
std::vector< reco::PFMET > PFMETCollection
collection of PFMET objects
edm::EDGetTokenT< reco::GenParticleCollection > _genParticleToken
And also the tokens to get the object collections.
tuple cout
Definition: gather_cfg.py:121
void initSelector(const unsigned int &objtype)
Initializes the selectors of the objects based on which object it is.
std::vector< L1EtMissParticle > L1EtMissParticleCollection
const std::vector< reco::PFMET > * pfMETs
int col
Definition: cuy.py:1008
std::set< std::string > _hltPaths
The hlt paths found in the hltConfig.
static const std::string getTypeString(const unsigned int &objtype)
Tranform types into strings.
const edm::TriggerResults * triggerResults
StringCutObjectSelector< reco::PFMET > * _recPFMHTSelector
static std::string const source
Definition: EdmProvDump.cc:43
StringCutObjectSelector< reco::PFTau > * _recPFTauSelector
void bookHist(DQMStore::IBooker &iBooker, const std::string &source, const std::string &objType, const std::string &variable)
The internal functions to book and fill histograms.
Definition: Run.h:41
std::vector< CaloJet > CaloJetCollection
collection of CaloJet objects
std::map< std::string, std::string > _shortpath2long
Relation between the short and long versions of the path.
void insertCandidates(const unsigned int &objtype, const EVTColContainer *col, std::vector< reco::LeafCandidate > *matches, std::map< int, double > &theSumEt)
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector
Definition: DDAxes.h:10