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 
32  const std::string & analysisname,
34  _pset(pset),
35  _analysisname(analysisname),
36  _minCandidates(0),
37  _HtJetPtMin(0),
38  _HtJetEtaMax(0),
39  _hltProcessName(pset.getParameter<std::string>("hltProcessName")),
40  _histDirectory(pset.getParameter<std::string>("histDirectory")),
41  _genParticleLabel(iC.consumes<reco::GenParticleCollection>(pset.getParameter<std::string>("genParticleLabel"))),
42  _genJetLabel(iC.consumes<reco::GenJetCollection>(pset.getParameter<std::string>("genJetLabel"))),
43  _recoHtJetLabel(iC.consumes<reco::PFJetCollection>(pset.getUntrackedParameter<std::string>("recoHtJetLabel","ak4PFJetsCHS"))),
44  _parametersEta(pset.getParameter<std::vector<double> >("parametersEta")),
45  _parametersPhi(pset.getParameter<std::vector<double> >("parametersPhi")),
46  _parametersPu(pset.getParameter<std::vector<double> >("parametersPu")),
47  _parametersHt(0),
48  _parametersTurnOn(pset.getParameter<std::vector<double> >("parametersTurnOn")),
49  _trigResultsTag(iC.consumes<edm::TriggerResults>(edm::InputTag("TriggerResults","",_hltProcessName))),
50  _genJetSelector(0),
51  _recMuonSelector(0),
52  _recElecSelector(0),
53  _recCaloMETSelector(0),
54  _recPFMETSelector(0),
55  _recPFTauSelector(0),
56  _recPhotonSelector(0),
57  _recPFJetSelector(0),
58  _recTrackSelector(0),
59  _NminOneCuts(0),
60  _useNminOneCuts(0)
61 {
62  // Specific parameters for this analysis
63  edm::ParameterSet anpset = pset.getParameter<edm::ParameterSet>(analysisname);
64  // Collections labels (but genparticles already initialized)
65  // initializing _recLabels data member)
66  if( anpset.exists("parametersTurnOn") )
67  {
68  _parametersTurnOn = anpset.getParameter<std::vector<double> >("parametersTurnOn");
69  _pset.addParameter("parametersTurnOn",_parametersTurnOn);
70  }
71  this->bookobjects( anpset, iC );
72  // Generic objects: Initialization of cuts
73  for(std::map<unsigned int,std::string>::const_iterator it = _recLabels.begin();
74  it != _recLabels.end(); ++it)
75  {
76  const std::string objStr = EVTColContainer::getTypeString(it->first);
77  _genCut[it->first] = pset.getParameter<std::string>( objStr+"_genCut" );
78  _recCut[it->first] = pset.getParameter<std::string>( objStr+"_recCut" );
79  _cutMinPt[it->first] = pset.getParameter<double>( objStr+"_cutMinPt" );
80  _cutMaxEta[it->first] = pset.getParameter<double>( objStr+"_cutMaxEta" );
81  }
82  //--- Updating parameters if has to be modified for this particular specific analysis
83  for(std::map<unsigned int,std::string>::const_iterator it = _recLabels.begin();
84  it != _recLabels.end(); ++it)
85  {
86  const std::string objStr = EVTColContainer::getTypeString(it->first);
87  if(anpset.existsAs<std::string>( objStr+"_genCut", false))
88  {
89  _genCut[it->first] = anpset.getUntrackedParameter<std::string>( objStr+"_genCut" );
90  }
91  if(anpset.existsAs<std::string>( objStr+"_recCut", false))
92  {
93  _recCut[it->first] = anpset.getUntrackedParameter<std::string>( objStr+"_recCut" );
94  }
95  if(anpset.existsAs<double>( objStr+"_cutMinPt" , false) )
96  {
97  _cutMinPt[it->first] = anpset.getUntrackedParameter<double>( objStr+"_cutMinPt" );
98  }
99  if(anpset.existsAs<double>( objStr+"_cutMaxEta" ,false) )
100  {
101  _cutMaxEta[it->first] = anpset.getUntrackedParameter<double>( objStr+"_cutMaxEta" );
102  }
103  }
104  _hltPathsToCheck = anpset.getParameter<std::vector<std::string> >("hltPathsToCheck");
105  _minCandidates = anpset.getParameter<unsigned int>("minCandidates");
106 
107  std::vector<double> default_parametersHt;
108  default_parametersHt.push_back(100);
109  default_parametersHt.push_back(0);
110  default_parametersHt.push_back(1000);
111  _parametersHt = pset.getUntrackedParameter<std::vector<double> >("parametersHt",default_parametersHt);
112 
113  _HtJetPtMin = anpset.getUntrackedParameter<double>("HtJetPtMin", -1);
114  _HtJetEtaMax = anpset.getUntrackedParameter<double>("HtJetEtaMax", -1);
115 
116  if( _HtJetPtMin>0 && _HtJetEtaMax>0 ) _bookHtPlots = true;
117  else _bookHtPlots = false;
118 
119  if( pset.exists("pileUpInfoLabel") )
120  {
121  _puSummaryInfo = iC.consumes<std::vector< PileupSummaryInfo > >(pset.getParameter<std::string>("pileUpInfoLabel"));
122  }
123 
124  if( anpset.existsAs<std::vector<double>>( "NminOneCuts" , false) )
125  {
126  _NminOneCuts = anpset.getUntrackedParameter<std::vector<double> >("NminOneCuts");
127  if( _NminOneCuts.size() < 9 + _minCandidates ) {
128  edm::LogError("HiggsValidation") << "In HLTHiggsSubAnalysis::HLTHiggsSubAnalysis, "
129  << "Incoherence found in the python configuration file!!\nThe SubAnalysis '"
130  << _analysisname << "' has a vector NminOneCuts with size "
131  << _NminOneCuts.size() << ", while it needs to be at least of size "
132  << (9 + _minCandidates) << ".";
133  exit(-1);
134  }
135  for(std::vector<double>::const_iterator it = _NminOneCuts.begin(); it != _NminOneCuts.end(); ++it)
136  {
137  if( *it ) {
138  _useNminOneCuts = true;
139  break;
140  }
141  }
142  }
143 // NptPlots = ( _useNminOneCuts ? _minCandidates : 2 );
145 }
146 
148 {
149  for(std::map<unsigned int,StringCutObjectSelector<reco::GenParticle>* >::iterator it = _genSelectorMap.begin();
150  it != _genSelectorMap.end(); ++it)
151  {
152  delete it->second;
153  it->second =0;
154  }
155  delete _genJetSelector;
156  _genJetSelector =0;
157  delete _recMuonSelector;
158  _recMuonSelector =0;
159  delete _recElecSelector;
160  _recElecSelector =0;
161  delete _recPhotonSelector;
163  delete _recCaloMETSelector;
165  delete _recPFMETSelector;
167  delete _recPFTauSelector;
169  delete _recPFJetSelector;
171  delete _recTrackSelector;
173 }
174 
175 
177 {
178 }
179 
180 
181 
182 void HLTHiggsSubAnalysis::beginRun(const edm::Run & iRun, const edm::EventSetup & iSetup)
183 {
184  // Initialize the confighlt
185  bool changedConfig;
186  if(!_hltConfig.init(iRun,iSetup,_hltProcessName,changedConfig))
187  {
188  edm::LogError("HiggsValidations") << "HLTHiggsSubAnalysis::beginRun: "
189  << "Initializtion of HLTConfigProvider failed!!";
190  }
191 
192 
193  // Parse the input paths to get them if there are in the table
194  // and associate them the last filter of the path (in order to extract the
195  _hltPaths.clear();
196  for(size_t i = 0; i < _hltPathsToCheck.size(); ++i)
197  {
198  bool found = false;
199  TPRegexp pattern(_hltPathsToCheck[i]);
200  for(size_t j = 0 ; j < _hltConfig.triggerNames().size(); ++j)
201  {
202  std::string thetriggername = _hltConfig.triggerNames()[j];
203  if(TString(thetriggername).Contains(pattern))
204  {
205  _hltPaths.insert(thetriggername);
206  found = true;
207  }
208  }
209  if( ! found )
210  {
211  LogDebug("HiggsValidations") << "HLTHiggsSubAnalysis::beginRun, In "
212  << _analysisname << " subfolder NOT found the path: '"
213  << _hltPathsToCheck[i] << "*'" ;
214  }
215  }
216 
217  LogTrace("HiggsValidation") << "SubAnalysis: " << _analysisname
218  << "\nHLT Trigger Paths found >>>";
219  // Initialize the plotters (analysers for each trigger path)
220  _analyzers.clear();
221  for(std::set<std::string>::iterator iPath = _hltPaths.begin();
222  iPath != _hltPaths.end(); ++iPath)
223  {
224  // Avoiding the dependence of the version number for
225  // the trigger paths
226  std::string path = * iPath;
227  std::string shortpath = path;
228  if(path.rfind("_v") < path.length())
229  {
230  shortpath = path.substr(0, path.rfind("_v"));
231  }
232  _shortpath2long[shortpath] = path;
233 
234  // Objects needed by the HLT path
235  const std::vector<unsigned int> objsNeedHLT = this->getObjectsType(shortpath);
236  // Sanity check: the object needed by a trigger path should be
237  // introduced by the user via config python (_recLabels datamember)
238  std::vector<unsigned int> userInstantiate;
239  for(std::map<unsigned int,std::string>::iterator it = _recLabels.begin() ;
240  it != _recLabels.end(); ++it)
241  {
242  userInstantiate.push_back(it->first);
243  }
244  for(std::vector<unsigned int>::const_iterator it = objsNeedHLT.begin(); it != objsNeedHLT.end();
245  ++it)
246  {
247  if( std::find(userInstantiate.begin(),userInstantiate.end(), *it) ==
248  userInstantiate.end() )
249  {
250  edm::LogError("HiggsValidation") << "In HLTHiggsSubAnalysis::beginRun, "
251  << "Incoherence found in the python configuration file!!\nThe SubAnalysis '"
252  << _analysisname << "' has been asked to evaluate the trigger path '"
253  << shortpath << "' (found it in 'hltPathsToCheck') BUT this path"
254  << " needs a '" << EVTColContainer::getTypeString(*it)
255  << "' which has not been instantiate ('recVariableLabels'"
256  << ")" ;
257  exit(-1);
258  }
259  }
260  LogTrace("HiggsValidation") << " --- " << shortpath;
261 
262  // the hlt path, the objects (elec,muons,photons,...)
263  // needed to evaluate the path are the argumens of the plotter
264  HLTHiggsPlotter analyzer(_pset, shortpath,objsNeedHLT, NptPlots, _NminOneCuts);
265  _analyzers.push_back(analyzer);
266  }
267 }
268 
270 {
271  std::string baseDir = _histDirectory+"/"+_analysisname+"/";
272  ibooker.setCurrentFolder(baseDir);
273  // Book the gen/reco analysis-dependent histograms (denominators)
274  std::vector<std::string> sources(2);
275  sources[0] = "gen";
276  sources[1] = "rec";
277 
278  for(std::map<unsigned int,std::string>::const_iterator it = _recLabels.begin();
279  it != _recLabels.end(); ++it)
280  {
281  const std::string objStr = EVTColContainer::getTypeString(it->first);
282  TString maxPt;
283 
284  for(size_t i = 0; i < sources.size(); i++)
285  {
286  std::string source = sources[i];
287  if( _useNminOneCuts && it->first == EVTColContainer::PFJET) {
288  if( source == "gen" ) continue;
289  else {
290  // N-1 jet plots (dEtaqq, mqq, dPhibb, CSV1, maxCSV_jets, maxCSV_E, PFMET, pt1, pt2, pt3, pt4)
291  if( _NminOneCuts[0] ) bookHist(source, objStr, "dEtaqq", ibooker);
292  if( _NminOneCuts[1] ) bookHist(source, objStr, "mqq", ibooker);
293  if( _NminOneCuts[2] ) bookHist(source, objStr, "dPhibb", ibooker);
294  if( _NminOneCuts[3] ) {
295  if ( _NminOneCuts[6] ) bookHist(source, objStr, "maxCSV", ibooker);
296  else bookHist(source, objStr, "CSV1", ibooker);
297  }
298  if( _NminOneCuts[4] ) bookHist(source, objStr, "CSV2", ibooker);
299  if( _NminOneCuts[5] ) bookHist(source, objStr, "CSV3", ibooker);
300  }
301  }
302 
303  bookHist(source, objStr, "Eta", ibooker);
304  bookHist(source, objStr, "Phi", ibooker);
305  for( unsigned int i=0; i < NptPlots; i++ )
306  {
307  maxPt = "MaxPt";
308  maxPt += i+1;
309  bookHist(source, objStr, maxPt.Data(), ibooker);
310  }
311  }
312  }
313 
314  // Call the bookHistograms (which books all the path dependent histograms)
315  for(std::vector<HLTHiggsPlotter>::iterator it = _analyzers.begin();
316  it != _analyzers.end(); ++it)
317  {
318  it->bookHistograms(ibooker, _useNminOneCuts);
319  }
320  //booking the histograms for overall trigger efficiencies
321  for(size_t i = 0; i < sources.size(); i++)
322  {
323  std::string nameGlobalEfficiency = "SummaryPaths_"+_analysisname+"_"+sources[i];
324 
325  _elements[nameGlobalEfficiency] = ibooker.book1D(nameGlobalEfficiency.c_str(),nameGlobalEfficiency.c_str(),_hltPathsToCheck.size(), 0, _hltPathsToCheck.size());
326 
327  std::string nameGlobalEfficiencyPassing= nameGlobalEfficiency+"_passingHLT";
328  _elements[nameGlobalEfficiencyPassing] = ibooker.book1D(nameGlobalEfficiencyPassing.c_str(),nameGlobalEfficiencyPassing.c_str(),_hltPathsToCheck.size(), 0, _hltPathsToCheck.size());
329 
330  std::string titlePu = "nb of interations in the event";
331  std::string nameVtxPlot = "trueVtxDist_"+_analysisname+"_"+sources[i];
332  std::vector<double> paramsPu = _parametersPu;
333  int nBinsPu = (int)paramsPu[0];
334  double minPu = paramsPu[1];
335  double maxPu = paramsPu[2];
336 
337  std::string titleHt = "sum of jet pT in the event";
338  std::string nameHtPlot = "HtDist_"+_analysisname+"_"+sources[i];
339  std::vector<double> paramsHt = _parametersHt;
340  int nBinsHt = (int)paramsHt[0];
341  double minHt = paramsHt[1];
342  double maxHt = paramsHt[2];
343 
344  if( (! _useNminOneCuts) || sources[i] == "rec" ) _elements[nameVtxPlot] = ibooker.book1D(nameVtxPlot.c_str(), titlePu.c_str(), nBinsPu, minPu, maxPu);
345  if( _bookHtPlots ) _elements[nameHtPlot] = ibooker.book1D(nameHtPlot.c_str(), titleHt.c_str(), nBinsHt, minHt, maxHt);
346  for (size_t j = 0 ; j < _hltPathsToCheck.size() ; j++){
347  //declare the efficiency vs interaction plots
349  std::string shortpath = path;
350  if(path.rfind("_v") < path.length())
351  {
352  shortpath = path.substr(0, path.rfind("_v"));
353  }
354  std::string titlePassingPu = "nb of interations in the event passing path " + shortpath;
355  if( (! _useNminOneCuts) || sources[i] == "rec" ) _elements[nameVtxPlot+"_"+shortpath] = ibooker.book1D(nameVtxPlot+"_"+shortpath, titlePassingPu.c_str(), nBinsPu, minPu, maxPu);
356 
357  std::string titlePassingHt = "sum of jet pT in the event passing path " + shortpath;
358  if( _bookHtPlots ) _elements[nameHtPlot+"_"+shortpath] = ibooker.book1D(nameHtPlot+"_"+shortpath, titlePassingHt.c_str(), nBinsHt, minHt, maxHt);
359 
360  //fill the bin labels of the summary plot
361  _elements[nameGlobalEfficiency]->setBinLabel(j+1,shortpath);
362  _elements[nameGlobalEfficiencyPassing]->setBinLabel(j+1,shortpath);
363  }
364  }
365 }
366 
367 
368 
370  EVTColContainer * cols)
371 {
372  // Initialize the collection (the ones which hasn't been initialiazed yet)
373  this->initobjects(iEvent,cols);
374  // utility map
375  std::map<unsigned int,std::string> u2str;
376  u2str[GEN]="gen";
377  u2str[RECO]="rec";
378 
379  std::map<unsigned int,double> Htmap;
380  Htmap[GEN]=0.;
381  Htmap[RECO]=0.;
382 
384  iEvent.getByToken(_puSummaryInfo,puInfo);
385  int nbMCvtx = -1;
386  if (puInfo.isValid()) {
387  std::vector<PileupSummaryInfo>::const_iterator PVI;
388  for(PVI = puInfo->begin(); PVI != puInfo->end(); ++PVI) {
389  if(PVI->getBunchCrossing()==0){
390  nbMCvtx = PVI->getPU_NumInteractions();
391  break;
392  }
393  }
394  }
395 
396 
397  // Extract the match structure containing the gen/reco candidates (electron, muons,...)
398  // common to all the SubAnalysis
399  //---- Generation
400  // Make each good gen object into the base cand for a MatchStruct
401  std::vector<MatchStruct> * matches = new std::vector<MatchStruct>;
402 // bool alreadyMu = false;
403  for(std::map<unsigned int,std::string>::iterator it = _recLabels.begin();
404  it != _recLabels.end(); ++it)
405  {
406 
407  // Use genJets for jet matchstructs
408  if( it->first == EVTColContainer::PFJET)
409  {
410  // Skip genJets for N-1 plots
411  if( ! _useNminOneCuts )
412  {
413  // Initialize selectors when first event
414  if(!_genJetSelector)
415  {
417  }
418  for(size_t i = 0; i < cols->genJets->size(); ++i)
419  {
420  if(_genJetSelector->operator()(cols->genJets->at(i)))
421  {
422  matches->push_back(MatchStruct(&cols->genJets->at(i),it->first));
423  }
424  }
425  }
426  }
427  // Use genParticles
428  else
429  {
430  // Avoiding the TkMu and Mu case
431 /* if( alreadyMu )
432  {
433  continue;
434  }*/
435  // Initialize selectors when first event
436  if(!_genSelectorMap[it->first])
437  {
439  }
440 
441  for(size_t i = 0; i < cols->genParticles->size(); ++i)
442  {
443  if(_genSelectorMap[it->first]->operator()(cols->genParticles->at(i)))
444  {
445  matches->push_back(MatchStruct(&cols->genParticles->at(i),it->first));
446  }
447  }
448 /* if( it->first == EVTColContainer::MUON || it->first == EVTColContainer::TRACK )
449  {
450  alreadyMu = true;
451  }*/
452  }
453  }
454  // Sort the MatchStructs by pT for later filling of turn-on curve
455  std::sort(matches->begin(), matches->end(), matchesByDescendingPt());
456 
457  // Map to reference the source (gen/reco) with the recoCandidates
458  std::map<unsigned int,std::vector<MatchStruct> > sourceMatchMap; // To be a pointer to delete
459  // --- Storing the generating candidates
460  sourceMatchMap[GEN] = *matches;
461 
462  // Reuse the vector
463  matches->clear();
464  // --- same for RECO objects
465 
466  // Different treatment for jets (b-tag)
467  std::map<std::string,bool> nMinOne;
468  std::map<std::string,bool> jetCutResult;
469  float dEtaqq;
470  float mqq;
471  float dPhibb;
472  float CSV1;
473  float CSV2;
474  float CSV3;
475  bool passAllCuts = false;
476  if( _recLabels.find(EVTColContainer::PFJET) != _recLabels.end() ) {
477  // Initialize jet selector
479  // Initialize and insert pfJets
480  this->initAndInsertJets(iEvent, cols, matches);
481  // Make sure to skip events that don't have enough jets
482  if( matches->size() < NptPlots ) {
483  delete matches;
484  return;
485  }
486  // Cuts on multiple jet events (RECO)
487  if ( _useNminOneCuts ) {
488  this->passJetCuts(matches, jetCutResult, dEtaqq, mqq, dPhibb, CSV1, CSV2, CSV3);
489  }
490  }
491  // Extraction of the objects candidates
492  for(std::map<unsigned int,std::string>::iterator it = _recLabels.begin();
493  it != _recLabels.end(); ++it)
494  {
495  // Reco selectors (the function takes into account if it was instantiated
496  // before or not
497  this->InitSelector(it->first);
498  // -- Storing the matches
499  this->insertcandidates(it->first,cols,matches);
500  }
501 
502  // Sort the MatchStructs by pT for later filling of turn-on curve
503  std::sort(matches->begin(), matches->end(), matchesByDescendingPt());
504 
505  if ( _useNminOneCuts ) {
506  // Check non-jet N-1 Cuts
507  this->passOtherCuts(*matches,jetCutResult);
508 
509  // Make N-1 booleans from jetCutResults
510  for(std::map<std::string,bool>::const_iterator it = jetCutResult.begin(); it != jetCutResult.end(); ++it)
511  {
512  nMinOne[it->first] = true;
513  for(std::map<std::string,bool>::const_iterator it2 = jetCutResult.begin(); it2 != jetCutResult.end(); ++it2)
514  {
515  //ignore CSV2,CSV3 cut plotting CSV1
516  if( it->first=="CSV1" && it2->first=="CSV3") continue;
517  if( it->first=="CSV1" && it2->first=="CSV2") continue;
518 
519  //ignore CSV3 plotting cut CSV2
520  if( it->first=="CSV2" && it2->first=="CSV3") continue;
521 
522  if( it->first != it2->first && !(it2->second) ) {
523  nMinOne[it->first] = false;
524  break;
525  }
526  }
527  }
528  bool temp = false;
529  for(std::map<std::string,bool>::const_iterator it = nMinOne.begin(); it != nMinOne.end(); ++it)
530  {
531  if( temp && it->second ) {
532  passAllCuts = true;
533  break;
534  }
535  if( it->second ) temp = true;
536  }
537  }
538 
539  // --- Storing the reco candidates
540  sourceMatchMap[RECO] = *matches;
541  // --- All the objects are in place
542  delete matches;
543 
544  // -- Trigger Results
545  const edm::TriggerNames trigNames = iEvent.triggerNames(*(cols->triggerResults));
546 
547  if( _bookHtPlots ){
549  iEvent.getByToken(_recoHtJetLabel,recoJet);
550  if( recoJet.isValid() ){
551  for( reco::PFJetCollection::const_iterator iJet = recoJet->begin(); iJet != recoJet->end(); iJet++ ){
552  double pt = iJet->pt();
553  double eta = iJet->eta();
554  if( pt > _HtJetPtMin && fabs(eta) < _HtJetEtaMax ){
555  Htmap[RECO] += pt;
556  }
557  }
558  }
559 
561  iEvent.getByToken(_genJetLabel,genJet);
562  if( genJet.isValid() ){
563  for( reco::GenJetCollection::const_iterator iJet = genJet->begin(); iJet != genJet->end(); iJet++ ){
564  double pt = iJet->pt();
565  double eta = iJet->eta();
566  if( pt > _HtJetPtMin && fabs(eta) < _HtJetEtaMax ){
567  Htmap[GEN] += pt;
568  }
569  }
570  }
571  }
572 
573  // Filling the histograms if pass the minimum amount of candidates needed by the analysis:
574  // GEN + RECO CASE in the same loop
575  for(std::map<unsigned int,std::vector<MatchStruct> >::iterator it = sourceMatchMap.begin();
576  it != sourceMatchMap.end(); ++it)
577  {
578  // it->first: gen/reco it->second: matches (std::vector<MatchStruc>)
579  if( it->second.size() < _minCandidates ) // FIXME: A bug is potentially here: what about the mixed channels?
580  {
581  continue;
582  }
583 
584  // Filling the gen/reco objects (eff-denominators):
585  // Just the first two different ones, if there are more
586  std::map<unsigned int,int> * countobjects = new std::map<unsigned int,int>;
587  // Initializing the count of the used object
588  for(std::map<unsigned int,std::string>::iterator co = _recLabels.begin();
589  co != _recLabels.end(); ++co)
590  {
591  if( !(_useNminOneCuts && co->first == EVTColContainer::PFJET && it->first == GEN) ) // genJets are not there
592  countobjects->insert(std::pair<unsigned int,int>(co->first,0));
593  }
594  int counttotal = 0;
595  const int totalobjectssize2 = NptPlots*countobjects->size();
596  for(size_t j = 0; j < it->second.size(); ++j)
597  {
598  const unsigned int objType = it->second[j].objType;
599  const std::string objTypeStr = EVTColContainer::getTypeString(objType);
600 
601  float pt = (it->second)[j].pt;
602  float eta = (it->second)[j].eta;
603  float phi = (it->second)[j].phi;
604 
605  // PFMET N-1 cut
606  if( _useNminOneCuts && objType == EVTColContainer::PFMET && _NminOneCuts[8] && ! nMinOne["PFMET"] ) {
607  continue;
608  }
609 
610  TString maxPt;
611  if( (unsigned)(*countobjects)[objType] < NptPlots )
612  {
613  maxPt = "MaxPt";
614  maxPt += (*countobjects)[objType]+1;
615  if( _useNminOneCuts && objType == EVTColContainer::PFJET ) {
616  if( nMinOne[maxPt.Data()] )
617  {
618  this->fillHist(u2str[it->first],objTypeStr,maxPt.Data(),pt);
619  }
620  }
621  else {
622  this->fillHist(u2str[it->first],objTypeStr,maxPt.Data(),pt);
623  }
624  // Filled the high pt ...
625  ++((*countobjects)[objType]);
626  ++counttotal;
627  }
628  else {
629  if( (unsigned)(*countobjects)[objType] < _minCandidates ) { // To get correct results for HZZ
630  ++((*countobjects)[objType]);
631  ++counttotal;
632  }
633  else continue; // Otherwise too many entries in Eta and Phi distributions
634  }
635 
636  // Jet N-1 Cuts
637  if( _useNminOneCuts && objType == EVTColContainer::PFJET ) {
638  if( passAllCuts ) {
639  this->fillHist(u2str[it->first],objTypeStr,"Eta",eta);
640  this->fillHist(u2str[it->first],objTypeStr,"Phi",phi);
641  }
642  }
643  else {
644  this->fillHist(u2str[it->first],objTypeStr,"Eta",eta);
645  this->fillHist(u2str[it->first],objTypeStr,"Phi",phi);
646  }
647 
648  // Already the minimum two objects has been filled, get out...
649  if( counttotal == totalobjectssize2 )
650  {
651  break;
652  }
653  }
654  delete countobjects;
655 
656  if( _useNminOneCuts && it->first == RECO) {
657  if( _NminOneCuts[0] && nMinOne["dEtaqq"] ) {
658  this->fillHist(u2str[it->first],EVTColContainer::getTypeString(EVTColContainer::PFJET),"dEtaqq",dEtaqq);
659  }
660  if( _NminOneCuts[1] && nMinOne["mqq"] ) {
661  this->fillHist(u2str[it->first],EVTColContainer::getTypeString(EVTColContainer::PFJET),"mqq",mqq);
662  }
663  if( _NminOneCuts[2] && nMinOne["dPhibb"] ) {
664  this->fillHist(u2str[it->first],EVTColContainer::getTypeString(EVTColContainer::PFJET),"dPhibb",dPhibb);
665  }
666  if( _NminOneCuts[3] ) {
667  std::string nameCSVplot = "CSV1";
668  if ( _NminOneCuts[6] ) nameCSVplot = "maxCSV";
669  if ( nMinOne[nameCSVplot] ) this->fillHist(u2str[it->first],EVTColContainer::getTypeString(EVTColContainer::PFJET),nameCSVplot,CSV1);
670  }
671  if( _NminOneCuts[4] && nMinOne["CSV2"] ) {
672  this->fillHist(u2str[it->first],EVTColContainer::getTypeString(EVTColContainer::PFJET),"CSV2",CSV2);
673  }
674  if( _NminOneCuts[5] && nMinOne["CSV3"] ) {
675  this->fillHist(u2str[it->first],EVTColContainer::getTypeString(EVTColContainer::PFJET),"CSV3",CSV3);
676  }
677  }
678 
679  //fill the efficiency vs nb of interactions
680  std::string nameVtxPlot = "trueVtxDist_"+_analysisname+"_"+u2str[it->first];
681  if( (! _useNminOneCuts) || it->first == RECO ) _elements[nameVtxPlot]->Fill(nbMCvtx);
682 
683  //fill the efficiency vs sum pT of jets
684  std::string nameHtPlot = "HtDist_"+_analysisname+"_"+u2str[it->first];
685  if( _bookHtPlots ) _elements[nameHtPlot]->Fill(Htmap[it->first]);
686 
687 
688  // Calling to the plotters analysis (where the evaluation of the different trigger paths are done)
689  std::string SummaryName = "SummaryPaths_"+_analysisname+"_"+u2str[it->first];
690  const std::string source = u2str[it->first];
691  for(std::vector<HLTHiggsPlotter>::iterator an = _analyzers.begin();
692  an != _analyzers.end(); ++an)
693  {
694  const std::string hltPath = _shortpath2long[an->gethltpath()];
695  const std::string fillShortPath = an->gethltpath();
696  const bool ispassTrigger = cols->triggerResults->accept(trigNames.triggerIndex(hltPath));
697 
698  if( _useNminOneCuts ) {
699  an->analyze(ispassTrigger,source,it->second, nMinOne, dEtaqq, mqq, dPhibb, CSV1, CSV2, CSV3, passAllCuts);
700  }
701  else {
702  an->analyze(ispassTrigger,source,it->second, _minCandidates);
703  }
704 
705  int refOfThePath = -1;
706  for (size_t itePath = 0 ; itePath< _hltPathsToCheck.size() ; itePath++){
707  refOfThePath++;
708  if (TString(hltPath).Contains(_hltPathsToCheck[itePath])) break;
709  }
710  _elements[SummaryName]->Fill(refOfThePath);
711  if (ispassTrigger) {
712  _elements[SummaryName+"_passingHLT"]->Fill(refOfThePath,1);
713  if( (! _useNminOneCuts) || it->first == RECO ) _elements[nameVtxPlot+"_"+fillShortPath.c_str()]->Fill(nbMCvtx);
714  if( _bookHtPlots ) _elements[nameHtPlot+"_"+fillShortPath.c_str()]->Fill(Htmap[it->first]);
715  }
716  else {
717  _elements[SummaryName+"_passingHLT"]->Fill(refOfThePath,0);
718 
719  }
720  }
721  }
722 }
723 
724 // Return the objects (muons,electrons,photons,...) needed by a hlt path.
725 const std::vector<unsigned int> HLTHiggsSubAnalysis::getObjectsType(const std::string & hltPath) const
726 {
727  static const unsigned int objSize = 7;
728  static const unsigned int objtriggernames[] = {
732 // EVTColContainer::TRACK, // Note is tracker muon
737  };
738 
739  std::set<unsigned int> objsType;
740  // The object to deal has to be entered via the config .py
741  for(unsigned int i = 0; i < objSize; ++i)
742  {
743  std::string objTypeStr = EVTColContainer::getTypeString( objtriggernames[i] );
744  // Check if it is needed this object for this trigger
745  if( ! TString(hltPath).Contains(objTypeStr) )
746  {
747  if( (objtriggernames[i] == EVTColContainer::PFJET && TString(hltPath).Contains("WHbbBoost") ) || // fix for HLT_Ele27_WPLoose_Gsf_WHbbBoost_v
748  (objtriggernames[i] == EVTColContainer::PFJET && TString(hltPath).Contains("CSV") ) || // fix for ZnnHbb PFJET
749  (objtriggernames[i] == EVTColContainer::PFMET && TString(hltPath).Contains("MHT")) ) // fix for ZnnHbb PFMET
750  objsType.insert(objtriggernames[i]);
751  else if (objtriggernames[i] == EVTColContainer::PHOTON && TString(hltPath).Contains("Diphoton") ) objsType.insert(objtriggernames[i]); //case of the New Diphoton paths
752  continue;
753  }
754  if( objtriggernames[i] == EVTColContainer::CALOMET && (TString(hltPath).Contains("PFMET") || TString(hltPath).Contains("MHT") ) ) continue; // fix for PFMET
755 
756  objsType.insert(objtriggernames[i]);
757  }
758 
759  return std::vector<unsigned int>(objsType.begin(),objsType.end());
760 }
761 
762 
763 // Booking the maps: recLabels and genParticle selectors
765 {
766  if( anpset.exists("recMuonLabel") )
767  {
768  _recLabels[EVTColContainer::MUON] = anpset.getParameter<std::string>("recMuonLabel");
771  }
772  if( anpset.exists("recElecLabel") )
773  {
774  _recLabels[EVTColContainer::ELEC] = anpset.getParameter<std::string>("recElecLabel");
777  }
778  if( anpset.exists("recPhotonLabel") )
779  {
780  _recLabels[EVTColContainer::PHOTON] = anpset.getParameter<std::string>("recPhotonLabel");
783  }
784  if( anpset.exists("recCaloMETLabel") )
785  {
786  _recLabels[EVTColContainer::CALOMET] = anpset.getParameter<std::string>("recCaloMETLabel");
789  }
790  if( anpset.exists("recPFMETLabel") )
791  {
792  _recLabels[EVTColContainer::PFMET] = anpset.getParameter<std::string>("recPFMETLabel");
795  }
796  if( anpset.exists("recPFTauLabel") )
797  {
798  _recLabels[EVTColContainer::PFTAU] = anpset.getParameter<std::string>("recPFTauLabel");
801  }
802  if( anpset.exists("recJetLabel") )
803  {
804  _recLabels[EVTColContainer::PFJET] = anpset.getParameter<std::string>("recJetLabel");
806  if( anpset.exists("jetTagLabel") )
808  _genJetSelector = 0;
809  }
810  /*if( anpset.exists("recTrackLabel") )
811  {
812  _recLabels[EVTColContainer::TRACK] = anpset.getParameter<std::string>("recTrackLabel");
813  _genSelectorMap[EVTColContainer::TRACK] = 0 ;
814  }*/
815 
816  if( _recLabels.size() < 1 )
817  {
818  edm::LogError("HiggsValidation") << "HLTHiggsSubAnalysis::bookobjects, "
819  << "Not included any object (recMuonLabel, recElecLabel, ...) "
820  << "in the analysis " << _analysisname;
821  return;
822  }
823 }
824 
826 {
827  /*if( col != 0 && col->isAllInit() )
828  {
829  // Already init, not needed to do nothing
830  return;
831  }*/
832  if( ! col->isCommonInit() )
833  {
834  // extract the trigger results (path info, pass,...)
836  iEvent.getByToken(_trigResultsTag,trigResults);
837  if( trigResults.isValid() )
838  {
839  col->triggerResults = trigResults.product();
840  }
841 
842  // GenParticle collection if is there (genJets only if there need to be jets)
844  iEvent.getByToken(_genParticleLabel,genPart);
845  if( genPart.isValid() )
846  {
847  col->genParticles = genPart.product();
848  }
849  }
850 
851  for(std::map<unsigned int,std::string>::iterator it = _recLabels.begin();
852  it != _recLabels.end(); ++it)
853  {
854  if( it->first == EVTColContainer::MUON )
855  {
857  iEvent.getByToken(_recLabelsMuon, theHandle);
858  col->set(theHandle.product());
859  }
860  else if( it->first == EVTColContainer::ELEC )
861  {
863  iEvent.getByToken(_recLabelsElec, theHandle);
864  col->set(theHandle.product());
865  }
866  else if( it->first == EVTColContainer::PHOTON )
867  {
869  iEvent.getByToken(_recLabelsPhoton, theHandle);
870  col->set(theHandle.product());
871  }
872  else if( it->first == EVTColContainer::CALOMET )
873  {
875  iEvent.getByToken(_recLabelsCaloMET, theHandle);
876  col->set(theHandle.product());
877  }
878  else if( it->first == EVTColContainer::PFMET )
879  {
881  iEvent.getByToken(_recLabelsPFMET, theHandle);
882  col->set(theHandle.product());
883  }
884  else if( it->first == EVTColContainer::PFTAU )
885  {
887  iEvent.getByToken(_recLabelsPFTau, theHandle);
888  col->set(theHandle.product());
889  }
890  // PFJets loaded in seperate function initAndInsertJets because they need to be combined with the btags using the Handle (not the product) and for ordering them seperately in the MatchStruct's
891  else if( it->first == EVTColContainer::PFJET )
892  {
893  if( ! _useNminOneCuts) {
894  // GenJet collection
896  iEvent.getByToken(_genJetLabel,genJet);
897  if( genJet.isValid() )
898  {
899  col->genJets = genJet.product();
900  }
901  }
902  }
903  else
904  {
905  edm::LogError("HiggsValidation") << "HLTHiggsSubAnalysis::initobjects "
906  << " NOT IMPLEMENTED (yet) ERROR: '" << it->second << "'";
907  //return; ??
908  }
909  }
910 }
911 
913  const std::string & objType, const std::string & variable, DQMStore::IBooker &ibooker)
914 {
915  std::string sourceUpper = source;
916  sourceUpper[0] = std::toupper(sourceUpper[0]);
917  std::string name = source + objType + variable ;
918  TH1F * h = 0;
919 
920  if(variable.find("MaxPt") != std::string::npos)
921  {
922  std::string desc;
923  if (variable == "MaxPt1") desc = "Leading";
924  else if (variable == "MaxPt2") desc = "Next-to-Leading";
925  else desc = variable.substr(5,6) + "th Leading";
926  std::string title = "pT of " + desc + " " + sourceUpper + " " + objType;
927  const size_t nBinsStandard = _parametersTurnOn.size() - 1;
928  size_t nBins = nBinsStandard;
929  float * edges = new float[nBinsStandard + 1];
930  for(size_t i = 0; i < nBinsStandard + 1; i++)
931  {
932  edges[i] = _parametersTurnOn[i];
933  }
934 
936  if( objType == jetObj ) {
937  const size_t nBinsJets = 25;
938  nBins = nBinsJets;
939  delete [] edges;
940  edges = new float[nBinsJets+1];
941  for(size_t i = 0; i < nBinsJets + 1; i++)
942  {
943  edges[i] = i*10;
944  }
945  }
947  const size_t nBinsJets = 30;
948  nBins = nBinsJets;
949  delete [] edges;
950  edges = new float[nBinsJets+1];
951  for(size_t i = 0; i < nBinsJets + 1; i++)
952  {
953  edges[i] = i*10;
954  }
955  }
956  h = new TH1F(name.c_str(), title.c_str(), nBins, edges);
957  delete [] edges;
958  }
959  else if( variable == "dEtaqq" ){
960  std::string title = "#Delta #eta_{qq} of " + sourceUpper + " " + objType;
961  int nBins = 20;
962  double min = 0;
963  double max = 4.8;
964  h = new TH1F(name.c_str(), title.c_str(), nBins, min, max);
965  }
966  else if ( variable == "mqq" ){
967  std::string title = "m_{qq} of " + sourceUpper + " " + objType;
968  int nBins = 20;
969  double min = 0;
970  double max = 1000;
971  h = new TH1F(name.c_str(), title.c_str(), nBins, min, max);
972  }
973  else if ( variable == "dPhibb" ){
974  std::string title = "#Delta #phi_{bb} of " + sourceUpper + " " + objType;
975  int nBins = 10;
976  double min = 0;
977  double max = 3.1416;
978  h = new TH1F(name.c_str(), title.c_str(), nBins, min, max);
979  }
980  else if ( variable == "CSV1" ){
981  std::string title = "CSV1 of " + sourceUpper + " " + objType;
982  int nBins = 20;
983  double min = 0;
984  double max = 1;
985  h = new TH1F(name.c_str(), title.c_str(), nBins, min, max);
986  }
987  else if ( variable == "CSV2" ){
988  std::string title = "CSV2 of " + sourceUpper + " " + objType;
989  int nBins = 20;
990  double min = 0;
991  double max = 1;
992  h = new TH1F(name.c_str(), title.c_str(), nBins, min, max);
993  }
994  else if ( variable == "CSV3" ){
995  std::string title = "CSV3 of " + sourceUpper + " " + objType;
996  int nBins = 20;
997  double min = 0;
998  double max = 1;
999  h = new TH1F(name.c_str(), title.c_str(), nBins, min, max);
1000  }
1001  else if ( variable == "maxCSV" ){
1002  std::string title = "max CSV of " + sourceUpper + " " + objType;
1003  int nBins = 20;
1004  double min = 0;
1005  double max = 1;
1006  h = new TH1F(name.c_str(), title.c_str(), nBins, min, max);
1007  }
1008  else
1009  {
1010  std::string symbol = (variable == "Eta") ? "#eta" : "#phi";
1011  std::string title = symbol + " of " + sourceUpper + " " + objType;
1012  std::vector<double> params = (variable == "Eta") ? _parametersEta : _parametersPhi;
1013 
1014  int nBins = (int)params[0];
1015  double min = params[1];
1016  double max = params[2];
1017  h = new TH1F(name.c_str(), title.c_str(), nBins, min, max);
1018  }
1019  h->Sumw2();
1020  _elements[name] = ibooker.book1D(name, h);
1021  delete h;
1022 }
1023 
1025  const std::string & objType, const std::string & variable, const float & value )
1026 {
1027  std::string sourceUpper = source;
1028  sourceUpper[0] = toupper(sourceUpper[0]);
1029  std::string name = source + objType + variable ;
1030 
1031  _elements[name]->Fill(value);
1032 }
1033 
1034 
1035 
1036 // Initialize the selectors
1037 void HLTHiggsSubAnalysis::InitSelector(const unsigned int & objtype)
1038 {
1039  if( objtype == EVTColContainer::MUON && _recMuonSelector == 0 )
1040  {
1042  }
1043  else if( objtype == EVTColContainer::ELEC && _recElecSelector == 0)
1044  {
1046  }
1047  else if( objtype == EVTColContainer::PHOTON && _recPhotonSelector == 0)
1048  {
1050  }
1051  else if( objtype == EVTColContainer::CALOMET && _recCaloMETSelector == 0)
1052  {
1054  }
1055  else if( objtype == EVTColContainer::PFMET && _recPFMETSelector == 0)
1056  {
1058  }
1059  else if( objtype == EVTColContainer::PFTAU && _recPFTauSelector == 0 )
1060  {
1062  }
1063  else if( objtype == EVTColContainer::PFJET && _recPFJetSelector == 0 )
1064  {
1066  }
1067  /*else if( objtype == EVTColContainer::TRACK && _recTrackSelector == 0)
1068  {
1069  _recTrackSelector = new StringCutObjectSelector<reco::Track>(_recCut[objtype]);
1070  }*/
1071 /* else
1072  {
1073 FIXME: ERROR NO IMPLEMENTADO
1074  }*/
1075 }
1076 
1078  std::vector<MatchStruct> * matches)
1079 {
1081  iEvent.getByToken(_recLabelsPFJet, PFJetHandle);
1082  cols->set(PFJetHandle.product());
1083 
1085  if( _useNminOneCuts ) {
1086  iEvent.getByToken(_recTagPFJet, JetTagHandle);
1087  }
1088 
1089  for(reco::PFJetCollection::const_iterator it = PFJetHandle->begin();
1090  it != PFJetHandle->end(); ++it)
1091  {
1092  reco::PFJetRef jetRef(PFJetHandle, it - PFJetHandle->begin());
1093  reco::JetBaseRef jetBaseRef(jetRef);
1094 
1095  if(_recPFJetSelector->operator()(*it))
1096  {
1097  if( _useNminOneCuts)
1098  {
1099  float bTag = (*(JetTagHandle.product()))[jetBaseRef];
1100  matches->push_back(MatchStruct(&*it,EVTColContainer::PFJET, bTag));
1101  }
1102  else {
1103  matches->push_back(MatchStruct(&*it,EVTColContainer::PFJET));
1104  }
1105  }
1106  }
1107 }
1108 
1109 void HLTHiggsSubAnalysis::passJetCuts(std::vector<MatchStruct> * matches, std::map<std::string,bool> & jetCutResult, float & dEtaqq, float & mqq, float & dPhibb, float & CSV1, float & CSV2, float & CSV3)
1110 { //dEtaqq, mqq, dPhibb, CSV1, CSV2, CSV3, maxCSV_jets, maxCSV_E, PFMET, pt1, pt2, pt3, pt4
1111 
1112  // Perform pt cuts
1113  std::sort(matches->begin(), matches->end(), matchesByDescendingPt());
1114  TString maxPt;
1115  for( unsigned int i=0; i < NptPlots; i++ )
1116  {
1117  maxPt = "MaxPt";
1118  maxPt += i+1;
1119  if( (*matches)[i].pt > _NminOneCuts[9+i] ) jetCutResult[maxPt.Data()] = true;
1120  else jetCutResult[maxPt.Data()] = false;
1121  }
1122 
1123  unsigned int NbTag = ( (_NminOneCuts[0] || _NminOneCuts[1]) ? 4 : 8 );
1124  if( matches->size() < NbTag ) NbTag = matches->size();
1125  // Perform b-tag ordered cuts
1126  std::sort(matches->begin(), matches->begin()+NbTag, matchesByDescendingBtag());
1127 
1128  if( _NminOneCuts[0] ) {
1129  dEtaqq = fabs((*matches)[2].eta - (*matches)[3].eta);
1130  if( dEtaqq > _NminOneCuts[0] ) jetCutResult["dEtaqq"] = true;
1131  else jetCutResult["dEtaqq"] = false;
1132  }
1133 
1134  if( _NminOneCuts[1] ) {
1135  mqq = ((*matches)[2].lorentzVector + (*matches)[3].lorentzVector).M();
1136  if( mqq > _NminOneCuts[1] ) jetCutResult["mqq"] = true;
1137  else jetCutResult["mqq"] = false;
1138  }
1139 
1140  if( _NminOneCuts[2] ) {
1141  dPhibb = fmod(fabs((*matches)[0].phi - (*matches)[1].phi),3.1416);
1142  if( dPhibb < _NminOneCuts[2] ) jetCutResult["dPhibb"] = true;
1143  else jetCutResult["dPhibb"] = false;
1144  }
1145 
1146  if( _NminOneCuts[4] ) {
1147  CSV2 = (*matches)[1].bTag;
1148  std::string nameCSV2plot = "CSV2";
1149 
1150  if( CSV2 > _NminOneCuts[4] ) jetCutResult[nameCSV2plot] = true;
1151  else jetCutResult[nameCSV2plot] = false;
1152  }
1153 
1154  if( _NminOneCuts[5] ) {
1155  CSV3 = (*matches)[2].bTag;
1156  std::string nameCSV3plot = "CSV3";
1157 
1158  if( CSV3 > _NminOneCuts[5] ) jetCutResult[nameCSV3plot] = true;
1159  else jetCutResult[nameCSV3plot] = false;
1160  }
1161 
1162 
1163  if( _NminOneCuts[3] ) {
1164  CSV1 = (*matches)[0].bTag;
1165  std::string nameCSVplot = "CSV1";
1166  if ( _NminOneCuts[6] ) nameCSVplot = "maxCSV";
1167 
1168  if( CSV1 > _NminOneCuts[3] ) jetCutResult[nameCSVplot] = true;
1169  else jetCutResult[nameCSVplot] = false;
1170 
1171  // max(CSV)
1172  if( _NminOneCuts[6] ) {
1173  std::sort(matches->begin(), matches->end(), matchesByDescendingPt());
1174  CSV1 = (*matches)[0].bTag;
1175  unsigned int Njets = (unsigned int) _NminOneCuts[6];
1176  if ( _NminOneCuts[6] > matches->size()) Njets = matches->size();
1177  for(unsigned int i=1; i < (unsigned int) Njets ; ++i) {
1178  if( (*matches)[i].bTag > CSV1 && (*matches)[i].pt > _NminOneCuts[7] ) CSV1 = (*matches)[i].bTag;
1179  }
1180  }
1181  }
1182 }
1183 
1184 void HLTHiggsSubAnalysis::passOtherCuts(const std::vector<MatchStruct> & matches, std::map<std::string,bool> & jetCutResult){
1185  if( _NminOneCuts[8] ) {
1186  jetCutResult["PFMET"] = false;
1187  for(std::vector<MatchStruct>::const_iterator it = matches.begin(); it != matches.end(); ++it)
1188  {
1189  if( it->objType == EVTColContainer::PFMET ) {
1190  if( it->pt > _NminOneCuts[8] ) jetCutResult["PFMET"] = true;
1191  break;
1192  }
1193  }
1194  }
1195 }
1196 
1197 void HLTHiggsSubAnalysis::insertcandidates(const unsigned int & objType, const EVTColContainer * cols,
1198  std::vector<MatchStruct> * matches)
1199 {
1200  if( objType == EVTColContainer::MUON )
1201  {
1202  for(size_t i = 0; i < cols->muons->size(); i++)
1203  {
1204  if(_recMuonSelector->operator()(cols->muons->at(i)))
1205  {
1206  matches->push_back(MatchStruct(&cols->muons->at(i),objType));
1207  }
1208  }
1209  }
1210  else if( objType == EVTColContainer::ELEC )
1211  {
1212  for(size_t i = 0; i < cols->electrons->size(); i++)
1213  {
1214  if(_recElecSelector->operator()(cols->electrons->at(i)))
1215  {
1216  matches->push_back(MatchStruct(&cols->electrons->at(i),objType));
1217  }
1218  }
1219  }
1220  else if( objType == EVTColContainer::PHOTON )
1221  {
1222  for(size_t i = 0; i < cols->photons->size(); i++)
1223  {
1224  if(_recPhotonSelector->operator()(cols->photons->at(i)))
1225  {
1226  matches->push_back(MatchStruct(&cols->photons->at(i),objType));
1227  }
1228  }
1229  }
1230  else if( objType == EVTColContainer::CALOMET )
1231  {
1232  for(size_t i = 0; i < cols->caloMETs->size(); i++)
1233  {
1234  if(_recCaloMETSelector->operator()(cols->caloMETs->at(i)))
1235  {
1236  matches->push_back(MatchStruct(&cols->caloMETs->at(i),objType));
1237  }
1238  }
1239  }
1240  else if( objType == EVTColContainer::PFMET )
1241  {
1242  for(size_t i = 0; i < cols->pfMETs->size(); i++)
1243  {
1244  if(_recPFMETSelector->operator()(cols->pfMETs->at(i)))
1245  {
1246  matches->push_back(MatchStruct(&cols->pfMETs->at(i),objType));
1247  }
1248  }
1249  }
1250  else if( objType == EVTColContainer::PFTAU )
1251  {
1252  for(size_t i = 0; i < cols->pfTaus->size(); i++)
1253  {
1254  if(_recPFTauSelector->operator()(cols->pfTaus->at(i)))
1255  {
1256  matches->push_back(MatchStruct(&cols->pfTaus->at(i),objType));
1257  }
1258  }
1259  }
1260 // else if( objType == EVTColContainer::PFJET )
1261 // {
1262 // already inserted
1263 // }
1264  /*else if( objType == EVTColContainer::TRACK )
1265  {
1266  for(size_t i = 0; i < cols->tracks->size(); i++)
1267  {
1268  if(_recTrackSelector->operator()(cols->tracks->at(i)))
1269  {
1270  matches->push_back(MatchStruct(&cols->tracks->at(i),objType));
1271  }
1272  }
1273  }*/
1274  /*
1275  else FIXME: Control errores
1276  {
1277  }
1278  */
1279 }
#define LogDebug(id)
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:208
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
edm::EDGetTokenT< reco::PFMETCollection > _recLabelsPFMET
edm::EDGetTokenT< reco::PFJetCollection > _recLabelsPFJet
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:185
edm::EDGetTokenT< reco::GenParticleCollection > _genParticleLabel
void passJetCuts(std::vector< MatchStruct > *matches, std::map< std::string, bool > &jetCutResult, float &dEtaqq, float &mqq, float &dPhibb, float &CSV1, float &CSV2, float &CSV3)
std::map< unsigned int, std::string > _genCut
gen/rec objects cuts
void initobjects(const edm::Event &iEvent, EVTColContainer *col)
edm::EDGetTokenT< reco::PFJetCollection > _recoHtJetLabel
const std::vector< reco::CaloMET > * caloMETs
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
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
std::vector< double > _NminOneCuts
bool accept() const
Has at least one path accepted the event?
std::vector< GenJet > GenJetCollection
collection of GenJet objects
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 reco::GenParticleCollection * genParticles
container with all the objects needed
StringCutObjectSelector< reco::PFMET > * _recPFMETSelector
T eta() const
edm::EDGetTokenT< reco::GenJetCollection > _genJetLabel
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
edm::EDGetTokenT< reco::JetTagCollection > _recTagPFJet
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
void passOtherCuts(const std::vector< MatchStruct > &matches, std::map< std::string, bool > &jetCutResult)
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.
const reco::GenJetCollection * genJets
unsigned int triggerIndex(std::string const &name) const
Definition: TriggerNames.cc:32
StringCutObjectSelector< reco::GenJet > * _genJetSelector
void initAndInsertJets(const edm::Event &iEvent, EVTColContainer *cols, std::vector< MatchStruct > *matches)
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:143
edm::EDGetTokenT< std::vector< PileupSummaryInfo > > _puSummaryInfo
std::vector< HLTHiggsPlotter > _analyzers
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
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:75
#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
std::vector< double > _parametersHt
edm::EDGetTokenT< reco::GsfElectronCollection > _recLabelsElec
HLTHiggsSubAnalysis(const edm::ParameterSet &pset, const std::string &analysisname, edm::ConsumesCollector &&iC)
T const * product() const
Definition: Handle.h:81
StringCutObjectSelector< reco::Muon > * _recMuonSelector
void fillHist(const std::string &source, const std::string &objType, const std::string &variable, const float &value)
std::vector< Photon > PhotonCollection
collectin of Photon objects
Definition: PhotonFwd.h:9
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
const std::vector< reco::GsfElectron > * electrons
Helper structure to order MatchStruct.
Definition: MatchStruct.cc:82
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)
std::vector< PFJet > PFJetCollection
collection of PFJet objects
edm::EDGetTokenT< reco::MuonCollection > _recLabelsMuon
std::vector< double > _parametersPhi
std::vector< std::string > _hltPathsToCheck
the hlt paths with regular expressions
std::vector< reco::PFMET > PFMETCollection
collection of PFMET objects
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
const std::vector< reco::PFMET > * pfMETs
StringCutObjectSelector< reco::PFJet > * _recPFJetSelector
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:42
StringCutObjectSelector< reco::GsfElectron > * _recElecSelector
Definition: Run.h:41
Definition: DDAxes.h:10