CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HLTHiggsSubAnalysis.cc
Go to the documentation of this file.
1 
7 
9 
13 
15 
16 #include "TPRegexp.h"
17 #include "TString.h"
18 
21 
24 
25 #include "TPRegexp.h"
26 #include "TString.h"
27 
28 #include<set>
29 #include<algorithm>
30 
31 
33  const std::string & analysisname,
35  _pset(pset),
36  _analysisname(analysisname),
37  _minCandidates(0),
38  _hltProcessName(pset.getParameter<std::string>("hltProcessName")),
39  _genParticleLabel(iC.consumes<reco::GenParticleCollection>(pset.getParameter<std::string>("genParticleLabel"))),
40  _parametersEta(pset.getParameter<std::vector<double> >("parametersEta")),
41  _parametersPhi(pset.getParameter<std::vector<double> >("parametersPhi")),
42  _parametersPu(pset.getParameter<std::vector<double> >("parametersPu")),
43  _parametersTurnOn(pset.getParameter<std::vector<double> >("parametersTurnOn")),
44  _trigResultsTag(iC.consumes<edm::TriggerResults>(edm::InputTag("TriggerResults","",_hltProcessName))),
45  _recMuonSelector(0),
46  _recElecSelector(0),
47  _recCaloMETSelector(0),
48  _recPFTauSelector(0),
49  _recPhotonSelector(0),
50  _recTrackSelector(0)
51 {
52  // Specific parameters for this analysis
53  edm::ParameterSet anpset = pset.getParameter<edm::ParameterSet>(analysisname);
54  // Collections labels (but genparticles already initialized)
55  // initializing _recLabels data member)
56  this->bookobjects( anpset, iC );
57 
58  // Generic objects: Initialization of cuts
59  for(std::map<unsigned int,std::string>::const_iterator it = _recLabels.begin();
60  it != _recLabels.end(); ++it)
61  {
62  const std::string objStr = EVTColContainer::getTypeString(it->first);
63  _genCut[it->first] = pset.getParameter<std::string>( objStr+"_genCut" );
64  _recCut[it->first] = pset.getParameter<std::string>( objStr+"_recCut" );
65  _cutMinPt[it->first] = pset.getParameter<double>( objStr+"_cutMinPt" );
66  _cutMaxEta[it->first] = pset.getParameter<double>( objStr+"_cutMaxEta" );
67  }
68 
69  //--- Updating parameters if has to be modified for this particular specific analysis
70  for(std::map<unsigned int,std::string>::const_iterator it = _recLabels.begin();
71  it != _recLabels.end(); ++it)
72  {
73 
74  const std::string objStr = EVTColContainer::getTypeString(it->first);
75  if(anpset.existsAs<std::string>( objStr+"_genCut", false))
76  {
77  _genCut[it->first] = anpset.getUntrackedParameter<std::string>( objStr+"_genCut" );
78  }
79  if(anpset.existsAs<std::string>( objStr+"_recCut", false))
80  {
81  _recCut[it->first] = anpset.getUntrackedParameter<std::string>( objStr+"_recCut" );
82  }
83  if(anpset.existsAs<double>( objStr+"_cutMinPt" , false) )
84  {
85  _cutMinPt[it->first] = anpset.getUntrackedParameter<double>( objStr+"_cutMinPt" );
86  }
87  if(anpset.existsAs<double>( objStr+"_cutMaxEta" ,false) )
88  {
89  _cutMaxEta[it->first] = anpset.getUntrackedParameter<double>( objStr+"_cutMaxEta" );
90  }
91  }
92 
93  _hltPathsToCheck = anpset.getParameter<std::vector<std::string> >("hltPathsToCheck");
94  _minCandidates = anpset.getParameter<unsigned int>("minCandidates");
95 
96  if( pset.exists("pileUpInfoLabel") )
97  {
98  _puSummaryInfo = iC.consumes<std::vector< PileupSummaryInfo > >(pset.getParameter<std::string>("pileUpInfoLabel"));
99  }
100 
101 }
102 
104 {
105  for(std::map<unsigned int,StringCutObjectSelector<reco::GenParticle>* >::iterator it = _genSelectorMap.begin();
106  it != _genSelectorMap.end(); ++it)
107  {
108  delete it->second;
109  it->second =0;
110  }
111  delete _recMuonSelector;
112  _recMuonSelector =0;
113  delete _recElecSelector;
114  _recElecSelector =0;
115  delete _recPhotonSelector;
117  delete _recCaloMETSelector;
119  delete _recPFTauSelector;
121  delete _recTrackSelector;
123 }
124 
125 
127 {
128 }
129 
130 
131 
132 void HLTHiggsSubAnalysis::beginRun(const edm::Run & iRun, const edm::EventSetup & iSetup)
133 {
134 
135 
136  // Initialize the confighlt
137  bool changedConfig;
138  if(!_hltConfig.init(iRun,iSetup,_hltProcessName,changedConfig))
139  {
140  edm::LogError("HiggsValidations") << "HLTHiggsSubAnalysis::beginRun: "
141  << "Initializtion of HLTConfigProvider failed!!";
142  }
143 
144 
145  // Parse the input paths to get them if there are in the table
146  // and associate them the last filter of the path (in order to extract the
147  _hltPaths.clear();
148  for(size_t i = 0; i < _hltPathsToCheck.size(); ++i)
149  {
150  bool found = false;
151  TPRegexp pattern(_hltPathsToCheck[i]);
152  for(size_t j = 0 ; j < _hltConfig.triggerNames().size(); ++j)
153  {
154  std::string thetriggername = _hltConfig.triggerNames()[j];
155  if(TString(thetriggername).Contains(pattern))
156  {
157  _hltPaths.insert(thetriggername);
158  found = true;
159  }
160  }
161  if( ! found )
162  {
163  edm::LogWarning("HiggsValidations") << "HLTHiggsSubAnalysis::beginRun, In "
164  << _analysisname << " subfolder NOT found the path: '"
165  << _hltPathsToCheck[i] << "*'" ;
166  }
167  }
168 
169  LogTrace("HiggsValidation") << "SubAnalysis: " << _analysisname
170  << "\nHLT Trigger Paths found >>>";
171  // Initialize the plotters (analysers for each trigger path)
172  _analyzers.clear();
173  for(std::set<std::string>::iterator iPath = _hltPaths.begin();
174  iPath != _hltPaths.end(); ++iPath)
175  {
176  // Avoiding the dependence of the version number for
177  // the trigger paths
178  std::string path = * iPath;
179  std::string shortpath = path;
180  if(path.rfind("_v") < path.length())
181  {
182  shortpath = path.substr(0, path.rfind("_v"));
183  }
184  _shortpath2long[shortpath] = path;
185 
186  // Objects needed by the HLT path
187  const std::vector<unsigned int> objsNeedHLT = this->getObjectsType(shortpath);
188  // Sanity check: the object needed by a trigger path should be
189  // introduced by the user via config python (_recLabels datamember)
190  std::vector<unsigned int> userInstantiate;
191  for(std::map<unsigned int,std::string>::iterator it = _recLabels.begin() ;
192  it != _recLabels.end(); ++it)
193  {
194  userInstantiate.push_back(it->first);
195  }
196  for(std::vector<unsigned int>::const_iterator it = objsNeedHLT.begin(); it != objsNeedHLT.end();
197  ++it)
198  {
199  if( std::find(userInstantiate.begin(),userInstantiate.end(), *it) ==
200  userInstantiate.end() )
201  {
202  edm::LogError("HiggsValidation") << "In HLTHiggsSubAnalysis::beginRun, "
203  << "Incoherence found in the python configuration file!!\nThe SubAnalysis '"
204  << _analysisname << "' has been asked to evaluate the trigger path '"
205  << shortpath << "' (found it in 'hltPathsToCheck') BUT this path"
206  << " needs a '" << EVTColContainer::getTypeString(*it)
207  << "' which has not been instantiate ('recVariableLabels'"
208  << ")" ;
209  exit(-1);
210  }
211  }
212  LogTrace("HiggsValidation") << " --- " << shortpath;
213 
214  // the hlt path, the objects (elec,muons,photons,...)
215  // needed to evaluate the path are the argumens of the plotter
216  HLTHiggsPlotter analyzer(_pset, shortpath,objsNeedHLT);
217  _analyzers.push_back(analyzer);
218  }
219 
220 }
221 
223 {
224  std::string baseDir = "HLT/Higgs/"+_analysisname+"/";
225  ibooker.setCurrentFolder(baseDir);
226  // Book the gen/reco analysis-dependent histograms (denominators)
227  std::vector<std::string> sources(2);
228  sources[0] = "gen";
229  sources[1] = "rec";
230 
231  for(std::map<unsigned int,std::string>::const_iterator it = _recLabels.begin();
232  it != _recLabels.end(); ++it)
233  {
234  const std::string objStr = EVTColContainer::getTypeString(it->first);
235 
236  for(size_t i = 0; i < sources.size(); i++)
237  {
238  std::string source = sources[i];
239  bookHist(source, objStr, "Eta", ibooker);
240  bookHist(source, objStr, "Phi", ibooker);
241  bookHist(source, objStr, "MaxPt1", ibooker);
242  bookHist(source, objStr, "MaxPt2", ibooker);
243  }
244  }
245 
246  // Call the bookHistograms (which books all the path dependent histograms)
247  for(std::vector<HLTHiggsPlotter>::iterator it = _analyzers.begin();
248  it != _analyzers.end(); ++it)
249  {
250  it->bookHistograms(ibooker);
251  }
252  //booking the histograms for overall trigger efficiencies
253  for(size_t i = 0; i < sources.size(); i++)
254  {
255  std::string nameGlobalEfficiency = "SummaryPaths_"+_analysisname+"_"+sources[i];
256 
257  _elements[nameGlobalEfficiency] = ibooker.book1D(nameGlobalEfficiency.c_str(),nameGlobalEfficiency.c_str(),_hltPathsToCheck.size(), 0, _hltPathsToCheck.size());
258 
259  std::string nameGlobalEfficiencyPassing= nameGlobalEfficiency+"_passingHLT";
260  _elements[nameGlobalEfficiencyPassing] = ibooker.book1D(nameGlobalEfficiencyPassing.c_str(),nameGlobalEfficiencyPassing.c_str(),_hltPathsToCheck.size(), 0, _hltPathsToCheck.size());
261 
262  std::string title = "nb of interations in the event";
263  std::string nameVtxPlot = "trueVtxDist_"+_analysisname+"_"+sources[i];
264  std::vector<double> params = _parametersPu;
265  int nBins = (int)params[0];
266  double min = params[1];
267  double max = params[2];
268 
269  _elements[nameVtxPlot] = ibooker.book1D(nameVtxPlot.c_str(), title.c_str(), nBins, min, max);
270  for (size_t j = 0 ; j < _hltPathsToCheck.size() ; j++){
271  //declare the efficiency vs interaction plots
273  std::string shortpath = path;
274  if(path.rfind("_v") < path.length())
275  {
276  shortpath = path.substr(0, path.rfind("_v"));
277  }
278  std::string titlePassing = "nb of interations in the event passing path " + shortpath;
279  _elements[nameVtxPlot+"_"+shortpath] = ibooker.book1D(nameVtxPlot+"_"+shortpath, titlePassing.c_str(), nBins, min, max);
280 
281  //fill the bin labels of the summary plot
282  _elements[nameGlobalEfficiency]->setBinLabel(j+1,shortpath);
283  _elements[nameGlobalEfficiencyPassing]->setBinLabel(j+1,shortpath);
284  }
285  }
286 }
287 
288 
289 
291  EVTColContainer * cols)
292 {
293  // Initialize the collection (the ones which hasn't been initialiazed yet)
294  this->initobjects(iEvent,cols);
295  // utility map
296  std::map<unsigned int,std::string> u2str;
297  u2str[GEN]="gen";
298  u2str[RECO]="rec";
299 
301  iEvent.getByToken(_puSummaryInfo,puInfo);
302  int nbMCvtx = -1;
303  if (puInfo.isValid()) {
304  std::vector<PileupSummaryInfo>::const_iterator PVI;
305  for(PVI = puInfo->begin(); PVI != puInfo->end(); ++PVI) {
306  if(PVI->getBunchCrossing()==0){
307  nbMCvtx = PVI->getPU_NumInteractions();
308  break;
309  }
310  }
311  }
312 
313  // Extract the match structure containing the gen/reco candidates (electron, muons,...)
314  // common to all the SubAnalysis
315  //---- Generation
316  // Make each good gen object into the base cand for a MatchStruct
317  std::vector<MatchStruct> * matches = new std::vector<MatchStruct>;
318 // bool alreadyMu = false;
319  for(std::map<unsigned int,std::string>::iterator it = _recLabels.begin();
320  it != _recLabels.end(); ++it)
321  {
322  // Avoiding the TkMu and Mu case
323 /* if( alreadyMu )
324  {
325  continue;
326  }*/
327  // Initialize selectors when first event
328  if(!_genSelectorMap[it->first])
329  {
331  }
332 
333  for(size_t i = 0; i < cols->genParticles->size(); ++i)
334  {
335  if(_genSelectorMap[it->first]->operator()(cols->genParticles->at(i)))
336  {
337  matches->push_back(MatchStruct(&cols->genParticles->at(i),it->first));
338  }
339  }
340 /* if( it->first == EVTColContainer::MUON || it->first == EVTColContainer::TRACK )
341  {
342  alreadyMu = true;
343  }*/
344  }
345  // Sort the MatchStructs by pT for later filling of turn-on curve
346  std::sort(matches->begin(), matches->end(), matchesByDescendingPt());
347 
348  // Map to reference the source (gen/reco) with the recoCandidates
349  std::map<unsigned int,std::vector<MatchStruct> > sourceMatchMap; // To be a pointer to delete
350  // --- Storing the generating candidates
351  sourceMatchMap[GEN] = *matches;
352 
353  // Reuse the vector
354  matches->clear();
355  // --- same for RECO objects
356  // Extraction of the objects candidates
357  for(std::map<unsigned int,std::string>::iterator it = _recLabels.begin();
358  it != _recLabels.end(); ++it)
359  {
360  // Reco selectors (the function takes into account if it was instantiated
361  // before or not
362  this->InitSelector(it->first);
363  // -- Storing the matches
364  this->insertcandidates(it->first,cols,matches);
365  }
366  // Sort the MatchStructs by pT for later filling of turn-on curve
367  std::sort(matches->begin(), matches->end(), matchesByDescendingPt());
368  // --- Storing the reco candidates
369  sourceMatchMap[RECO] = *matches;
370  // --- All the objects are in place
371  delete matches;
372 
373  // -- Trigger Results
374  const edm::TriggerNames trigNames = iEvent.triggerNames(*(cols->triggerResults));
375 
376  // Filling the histograms if pass the minimum amount of candidates needed by the analysis:
377  // GEN + RECO CASE in the same loop
378  for(std::map<unsigned int,std::vector<MatchStruct> >::iterator it = sourceMatchMap.begin();
379  it != sourceMatchMap.end(); ++it)
380  {
381  // it->first: gen/reco it->second: matches (std::vector<MatchStruc>)
382  if( it->second.size() < _minCandidates ) // FIXME: A bug is potentially here: what about the mixed channels?
383  {
384  continue;
385  }
386 
387  // Filling the gen/reco objects (eff-denominators):
388  // Just the first two different ones, if there are more
389  std::map<unsigned int,int> * countobjects = new std::map<unsigned int,int>;
390  // Initializing the count of the used object
391  for(std::map<unsigned int,std::string>::iterator co = _recLabels.begin();
392  co != _recLabels.end(); ++co)
393  {
394  countobjects->insert(std::pair<unsigned int,int>(co->first,0));
395  }
396  int counttotal = 0;
397  const int totalobjectssize2 = 2*countobjects->size();
398  for(size_t j = 0; j < it->second.size(); ++j)
399  {
400  const unsigned int objType = it->second[j].objType;
401  const std::string objTypeStr = EVTColContainer::getTypeString(objType);
402 
403  float pt = (it->second)[j].pt;
404  float eta = (it->second)[j].eta;
405  float phi = (it->second)[j].phi;
406 
407  this->fillHist(u2str[it->first],objTypeStr,"Eta",eta);
408  this->fillHist(u2str[it->first],objTypeStr,"Phi",phi);
409  if( (*countobjects)[objType] == 0 )
410  {
411  this->fillHist(u2str[it->first],objTypeStr,"MaxPt1",pt);
412  // Filled the high pt ...
413  ++((*countobjects)[objType]);
414  ++counttotal;
415  }
416  else if( (*countobjects)[objType] == 1 )
417  {
418  this->fillHist(u2str[it->first],objTypeStr,"MaxPt2",pt);
419  // Filled the second high pt ...
420  ++((*countobjects)[objType]);
421  ++counttotal;
422  }
423  else
424  {
425  // Already the minimum two objects has been filled, get out...
426  if( counttotal == totalobjectssize2 )
427  {
428  break;
429  }
430  }
431  }
432  delete countobjects;
433 
434  //fill the efficiency vs nb of interactions
435  std::string nameVtxPlot = "trueVtxDist_"+_analysisname+"_"+u2str[it->first];
436  _elements[nameVtxPlot]->Fill(nbMCvtx);
437 
438  // Calling to the plotters analysis (where the evaluation of the different trigger paths are done)
439  std::string SummaryName = "SummaryPaths_"+_analysisname+"_"+u2str[it->first];
440  const std::string source = u2str[it->first];
441  for(std::vector<HLTHiggsPlotter>::iterator an = _analyzers.begin();
442  an != _analyzers.end(); ++an)
443  {
444  const std::string hltPath = _shortpath2long[an->gethltpath()];
445  const std::string fillShortPath = an->gethltpath();
446  const bool ispassTrigger = cols->triggerResults->accept(trigNames.triggerIndex(hltPath));
447  an->analyze(ispassTrigger,source,it->second);
448  int refOfThePath = -1;
449  for (size_t itePath = 0 ; itePath< _hltPathsToCheck.size() ; itePath++){
450  refOfThePath++;
451  if (TString(hltPath).Contains(_hltPathsToCheck[itePath])) break;
452  }
453  _elements[SummaryName]->Fill(refOfThePath);
454  if (ispassTrigger) {
455  _elements[SummaryName+"_passingHLT"]->Fill(refOfThePath,1);
456  _elements[nameVtxPlot+"_"+fillShortPath.c_str()]->Fill(nbMCvtx);
457  }
458  else {
459  _elements[SummaryName+"_passingHLT"]->Fill(refOfThePath,0);
460 
461  }
462  }
463  }
464 }
465 
466 // Return the objects (muons,electrons,photons,...) needed by a hlt path.
467 const std::vector<unsigned int> HLTHiggsSubAnalysis::getObjectsType(const std::string & hltPath) const
468 {
469  static const unsigned int objSize = 5; //6;
470  static const unsigned int objtriggernames[] = { EVTColContainer::MUON,
473 // EVTColContainer::TRACK, // Note is tracker muon
476  };
477 
478  std::set<unsigned int> objsType;
479  // The object to deal has to be entered via the config .py
480  for(unsigned int i = 0; i < objSize; ++i)
481  {
482  std::string objTypeStr = EVTColContainer::getTypeString( objtriggernames[i] );
483  // Check if it is needed this object for this trigger
484  if( ! TString(hltPath).Contains(objTypeStr) )
485  {
486  continue;
487  }
488 
489  objsType.insert(objtriggernames[i]);
490  }
491 
492  return std::vector<unsigned int>(objsType.begin(),objsType.end());
493 }
494 
495 
496 // Booking the maps: recLabels and genParticle selectors
498 {
499  if( anpset.exists("recMuonLabel") )
500  {
501  _recLabels[EVTColContainer::MUON] = anpset.getParameter<std::string>("recMuonLabel");
504  }
505  if( anpset.exists("recElecLabel") )
506  {
507  _recLabels[EVTColContainer::ELEC] = anpset.getParameter<std::string>("recElecLabel");
510  }
511  if( anpset.exists("recPhotonLabel") )
512  {
513  _recLabels[EVTColContainer::PHOTON] = anpset.getParameter<std::string>("recPhotonLabel");
516  }
517  if( anpset.exists("recCaloMETLabel") )
518  {
519  _recLabels[EVTColContainer::CALOMET] = anpset.getParameter<std::string>("recCaloMETLabel");
522  }
523  if( anpset.exists("recPFTauLabel") )
524  {
525  _recLabels[EVTColContainer::PFTAU] = anpset.getParameter<std::string>("recPFTauLabel");
528  }
529  /*if( anpset.exists("recTrackLabel") )
530  {
531  _recLabels[EVTColContainer::TRACK] = anpset.getParameter<std::string>("recTrackLabel");
532  _genSelectorMap[EVTColContainer::TRACK] = 0 ;
533  }*/
534 
535 
536  if( _recLabels.size() < 1 )
537  {
538  edm::LogError("HiggsValidation") << "HLTHiggsSubAnalysis::bookobjects, "
539  << "Not included any object (recMuonLabel, recElecLabel, ...) "
540  << "in the analysis " << _analysisname;
541  return;
542  }
543 }
544 
546 {
547  /*if( col != 0 && col->isAllInit() )
548  {
549  // Already init, not needed to do nothing
550  return;
551  }*/
552  if( ! col->isCommonInit() )
553  {
554  // extract the trigger results (path info, pass,...)
556  iEvent.getByToken(_trigResultsTag,trigResults);
557  if( trigResults.isValid() )
558  {
559  col->triggerResults = trigResults.product();
560  }
561 
562  // GenParticle collection if is there
564  iEvent.getByToken(_genParticleLabel,genPart);
565  if( genPart.isValid() )
566  {
567  col->genParticles = genPart.product();
568  }
569  }
570 
571  for(std::map<unsigned int,std::string>::iterator it = _recLabels.begin();
572  it != _recLabels.end(); ++it)
573  {
574  if( it->first == EVTColContainer::MUON )
575  {
577  iEvent.getByToken(_recLabelsMuon, theHandle);
578  col->set(theHandle.product());
579  }
580  else if( it->first == EVTColContainer::ELEC )
581  {
583  iEvent.getByToken(_recLabelsElec, theHandle);
584  col->set(theHandle.product());
585  }
586  else if( it->first == EVTColContainer::PHOTON )
587  {
589  iEvent.getByToken(_recLabelsPhoton, theHandle);
590  col->set(theHandle.product());
591  }
592  else if( it->first == EVTColContainer::CALOMET )
593  {
595  iEvent.getByToken(_recLabelsCaloMET, theHandle);
596  col->set(theHandle.product());
597  }
598  else if( it->first == EVTColContainer::PFTAU )
599  {
601  iEvent.getByToken(_recLabelsPFTau, theHandle);
602  col->set(theHandle.product());
603  }
604  else
605  {
606  edm::LogError("HiggsValidation") << "HLTHiggsSubAnalysis::initobjects "
607  << " NOT IMPLEMENTED (yet) ERROR: '" << it->second << "'";
608  //return; ??
609  }
610  }
611 }
612 
614  const std::string & objType, const std::string & variable, DQMStore::IBooker &ibooker)
615 {
616  std::string sourceUpper = source;
617  sourceUpper[0] = std::toupper(sourceUpper[0]);
618  std::string name = source + objType + variable ;
619  TH1F * h = 0;
620 
621  if(variable.find("MaxPt") != std::string::npos){
622  std::string desc = (variable == "MaxPt1") ? "Leading" : "Next-to-Leading";
623  std::string title = "pT of " + desc + " " + sourceUpper + " " + objType;
624  const size_t nBins = _parametersTurnOn.size() - 1;
625  float * edges = new float[nBins + 1];
626  for(size_t i = 0; i < nBins + 1; i++)
627  {
628  edges[i] = _parametersTurnOn[i];
629  }
630  h = new TH1F(name.c_str(), title.c_str(), nBins, edges);
631  delete[] edges;
632  }
633  else
634  {
635  std::string symbol = (variable == "Eta") ? "#eta" : "#phi";
636  std::string title = symbol + " of " + sourceUpper + " " + objType;
637  std::vector<double> params = (variable == "Eta") ? _parametersEta : _parametersPhi;
638 
639  int nBins = (int)params[0];
640  double min = params[1];
641  double max = params[2];
642  h = new TH1F(name.c_str(), title.c_str(), nBins, min, max);
643  }
644  h->Sumw2();
645  _elements[name] = ibooker.book1D(name, h);
646  delete h;
647 }
648 
650  const std::string & objType, const std::string & variable, const float & value )
651 {
652  std::string sourceUpper = source;
653  sourceUpper[0] = toupper(sourceUpper[0]);
654  std::string name = source + objType + variable ;
655 
656  _elements[name]->Fill(value);
657 }
658 
659 
660 
661 // Initialize the selectors
662 void HLTHiggsSubAnalysis::InitSelector(const unsigned int & objtype)
663 {
664  if( objtype == EVTColContainer::MUON && _recMuonSelector == 0 )
665  {
667  }
668  else if( objtype == EVTColContainer::ELEC && _recElecSelector == 0)
669  {
671  }
672  else if( objtype == EVTColContainer::PHOTON && _recPhotonSelector == 0)
673  {
675  }
676  else if( objtype == EVTColContainer::CALOMET && _recCaloMETSelector == 0)
677  {
679  }
680  else if( objtype == EVTColContainer::PFTAU && _recPFTauSelector == 0 )
681  {
683  }
684  /*else if( objtype == EVTColContainer::TRACK && _recTrackSelector == 0)
685  {
686  _recTrackSelector = new StringCutObjectSelector<reco::Track>(_recCut[objtype]);
687  }*/
688 /* else
689  {
690 FIXME: ERROR NO IMPLEMENTADO
691  }*/
692 }
693 
694 void HLTHiggsSubAnalysis::insertcandidates(const unsigned int & objType, const EVTColContainer * cols,
695  std::vector<MatchStruct> * matches)
696 {
697  if( objType == EVTColContainer::MUON )
698  {
699  for(size_t i = 0; i < cols->muons->size(); i++)
700  {
701  if(_recMuonSelector->operator()(cols->muons->at(i)))
702  {
703  matches->push_back(MatchStruct(&cols->muons->at(i),objType));
704  }
705  }
706  }
707  else if( objType == EVTColContainer::ELEC )
708  {
709  for(size_t i = 0; i < cols->electrons->size(); i++)
710  {
711  if(_recElecSelector->operator()(cols->electrons->at(i)))
712  {
713  matches->push_back(MatchStruct(&cols->electrons->at(i),objType));
714  }
715  }
716  }
717  else if( objType == EVTColContainer::PHOTON )
718  {
719  for(size_t i = 0; i < cols->photons->size(); i++)
720  {
721  if(_recPhotonSelector->operator()(cols->photons->at(i)))
722  {
723  matches->push_back(MatchStruct(&cols->photons->at(i),objType));
724  }
725  }
726  }
727  else if( objType == EVTColContainer::CALOMET )
728  {
729  for(size_t i = 0; i < cols->caloMETs->size(); i++)
730  {
731  if(_recCaloMETSelector->operator()(cols->caloMETs->at(i)))
732  {
733  matches->push_back(MatchStruct(&cols->caloMETs->at(i),objType));
734  }
735  }
736  }
737  else if( objType == EVTColContainer::PFTAU )
738  {
739  for(size_t i = 0; i < cols->pfTaus->size(); i++)
740  {
741  if(_recPFTauSelector->operator()(cols->pfTaus->at(i)))
742  {
743  matches->push_back(MatchStruct(&cols->pfTaus->at(i),objType));
744  }
745  }
746  }
747  /*else if( objType == EVTColContainer::TRACK )
748  {
749  for(size_t i = 0; i < cols->tracks->size(); i++)
750  {
751  if(_recTrackSelector->operator()(cols->tracks->at(i)))
752  {
753  matches->push_back(MatchStruct(&cols->tracks->at(i),objType));
754  }
755  }
756  }*/
757  /*
758  else FIXME: Control errores
759  {
760  }
761  */
762 }
const std::vector< reco::Muon > * muons
std::vector< double > _parametersTurnOn
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
void InitSelector(const unsigned int &objtype)
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
Definition: Event.cc:204
std::map< std::string, std::string > _shortpath2long
Relation between the short version of a path.
StringCutObjectSelector< reco::CaloMET > * _recCaloMETSelector
std::vector< PFTau > PFTauCollection
collection of PFTau objects
Definition: PFTauFwd.h:9
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:184
edm::EDGetTokenT< reco::GenParticleCollection > _genParticleLabel
std::map< unsigned int, std::string > _genCut
gen/rec objects cuts
void initobjects(const edm::Event &iEvent, EVTColContainer *col)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
edm::EDGetTokenT< reco::PFTauCollection > _recLabelsPFTau
unsigned int _minCandidates
The minimum number of reco/gen candidates needed by the analysis.
std::map< std::string, MonitorElement * > _elements
bool accept() const
Has at least one path accepted the event?
const std::vector< std::string > & triggerNames() const
names of trigger paths
edm::ParameterSet _pset
bool exists(std::string const &parameterName) const
checks if a parameter exists
std::set< std::string > _hltPaths
the hlt paths found in the hltConfig
const std::vector< reco::CaloMET > * caloMETs
const reco::GenParticleCollection * genParticles
container with all the objects needed
Strings::size_type size() const
Definition: TriggerNames.cc:39
T eta() const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
HLTConfigProvider _hltConfig
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
void bookHistograms(DQMStore::IBooker &)
std::vector< double > _parametersPu
edm::EDGetTokenT< reco::PhotonCollection > _recLabelsPhoton
edm::EDGetTokenT< reco::CaloMETCollection > _recLabelsCaloMET
StringCutObjectSelector< reco::Track > * _recTrackSelector
std::map< unsigned int, std::string > _recCut
std::map< unsigned int, StringCutObjectSelector< reco::GenParticle > * > _genSelectorMap
tuple TriggerResults
Definition: old-fu_pass.py:28
void set(const reco::MuonCollection *v)
Setter: multiple overloaded function.
int iEvent
Definition: GenABIO.cc:230
tuple path
else: Piece not in the list, fine.
unsigned int triggerIndex(std::string const &name) const
Definition: TriggerNames.cc:32
edm::EDGetTokenT< std::vector< PileupSummaryInfo > > _puSummaryInfo
std::vector< HLTHiggsPlotter > _analyzers
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:113
int j
Definition: DBlmapReader.cc:9
std::map< unsigned int, std::string > _recLabels
const std::vector< reco::Photon > * photons
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
void analyze(const edm::Event &iEvent, const edm::EventSetup &iEventSetup, EVTColContainer *cols)
T min(T a, T b)
Definition: MathUtil.h:58
std::map< unsigned int, double > _cutMinPt
StringCutObjectSelector< reco::PFTau > * _recPFTauSelector
bool isValid() const
Definition: HandleBase.h:76
#define LogTrace(id)
void beginRun(const edm::Run &iRun, const edm::EventSetup &iEventSetup)
edm::EDGetTokenT< edm::TriggerResults > _trigResultsTag
static const char *const trigNames[]
Definition: EcalDumpRaw.cc:74
void bookHist(const std::string &source, const std::string &objType, const std::string &variable, DQMStore::IBooker &)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
std::vector< reco::CaloMET > CaloMETCollection
collection of CaloMET objects
edm::EDGetTokenT< reco::GsfElectronCollection > _recLabelsElec
HLTHiggsSubAnalysis(const edm::ParameterSet &pset, const std::string &analysisname, edm::ConsumesCollector &&iC)
StringCutObjectSelector< reco::Muon > * _recMuonSelector
void fillHist(const std::string &source, const std::string &objType, const std::string &variable, const float &value)
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
std::vector< Photon > PhotonCollection
collectin of Photon objects
Definition: PhotonFwd.h:9
T const * product() const
Definition: Handle.h:81
const std::vector< reco::GsfElectron > * electrons
Helper structure to order MatchStruct.
Definition: MatchStruct.cc:66
const std::vector< unsigned int > getObjectsType(const std::string &hltpath) const
Extract what objects need this analysis.
void insertcandidates(const unsigned int &objtype, const EVTColContainer *col, std::vector< MatchStruct > *matches)
edm::EDGetTokenT< reco::MuonCollection > _recLabelsMuon
std::vector< double > _parametersPhi
std::vector< std::string > _hltPathsToCheck
the hlt paths with regular expressions
std::vector< double > _parametersEta
Some kinematical parameters.
std::map< unsigned int, double > _cutMaxEta
void bookobjects(const edm::ParameterSet &anpset, edm::ConsumesCollector &iC)
StringCutObjectSelector< reco::Photon > * _recPhotonSelector
int col
Definition: cuy.py:1008
static const std::string getTypeString(const unsigned int &objtype)
Tranform types into strings.
const edm::TriggerResults * triggerResults
static std::string const source
Definition: EdmProvDump.cc:43
StringCutObjectSelector< reco::GsfElectron > * _recElecSelector
Definition: Run.h:41
Definition: DDAxes.h:10