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  (objtriggernames[i] == EVTColContainer::PHOTON && TString(hltPath).Contains("Diphoton")) )
751  {
752  objsType.insert(objtriggernames[i]); //case of the New Diphoton paths
753  }
754  continue;
755  }
756  if( ( objtriggernames[i] == EVTColContainer::CALOMET && (TString(hltPath).Contains("PFMET") || TString(hltPath).Contains("MHT") ) ) || // fix for PFMET
757  (objtriggernames[i] == EVTColContainer::PFJET && TString(hltPath).Contains("JetIdCleaned")) ) // fix for Htaunu
758  {
759  continue;
760  }
761 
762  objsType.insert(objtriggernames[i]);
763  }
764 
765  return std::vector<unsigned int>(objsType.begin(),objsType.end());
766 }
767 
768 
769 // Booking the maps: recLabels and genParticle selectors
771 {
772  if( anpset.exists("recMuonLabel") )
773  {
774  _recLabels[EVTColContainer::MUON] = anpset.getParameter<std::string>("recMuonLabel");
777  }
778  if( anpset.exists("recElecLabel") )
779  {
780  _recLabels[EVTColContainer::ELEC] = anpset.getParameter<std::string>("recElecLabel");
783  }
784  if( anpset.exists("recPhotonLabel") )
785  {
786  _recLabels[EVTColContainer::PHOTON] = anpset.getParameter<std::string>("recPhotonLabel");
789  }
790  if( anpset.exists("recCaloMETLabel") )
791  {
792  _recLabels[EVTColContainer::CALOMET] = anpset.getParameter<std::string>("recCaloMETLabel");
795  }
796  if( anpset.exists("recPFMETLabel") )
797  {
798  _recLabels[EVTColContainer::PFMET] = anpset.getParameter<std::string>("recPFMETLabel");
801  }
802  if( anpset.exists("recPFTauLabel") )
803  {
804  _recLabels[EVTColContainer::PFTAU] = anpset.getParameter<std::string>("recPFTauLabel");
807  }
808  if( anpset.exists("recJetLabel") )
809  {
810  _recLabels[EVTColContainer::PFJET] = anpset.getParameter<std::string>("recJetLabel");
812  if( anpset.exists("jetTagLabel") )
814  _genJetSelector = 0;
815  }
816  /*if( anpset.exists("recTrackLabel") )
817  {
818  _recLabels[EVTColContainer::TRACK] = anpset.getParameter<std::string>("recTrackLabel");
819  _genSelectorMap[EVTColContainer::TRACK] = 0 ;
820  }*/
821 
822  if( _recLabels.size() < 1 )
823  {
824  edm::LogError("HiggsValidation") << "HLTHiggsSubAnalysis::bookobjects, "
825  << "Not included any object (recMuonLabel, recElecLabel, ...) "
826  << "in the analysis " << _analysisname;
827  return;
828  }
829 }
830 
832 {
833  /*if( col != 0 && col->isAllInit() )
834  {
835  // Already init, not needed to do nothing
836  return;
837  }*/
838  if( ! col->isCommonInit() )
839  {
840  // extract the trigger results (path info, pass,...)
842  iEvent.getByToken(_trigResultsTag,trigResults);
843  if( trigResults.isValid() )
844  {
845  col->triggerResults = trigResults.product();
846  }
847 
848  // GenParticle collection if is there (genJets only if there need to be jets)
850  iEvent.getByToken(_genParticleLabel,genPart);
851  if( genPart.isValid() )
852  {
853  col->genParticles = genPart.product();
854  }
855  }
856 
857  for(std::map<unsigned int,std::string>::iterator it = _recLabels.begin();
858  it != _recLabels.end(); ++it)
859  {
860  if( it->first == EVTColContainer::MUON )
861  {
863  iEvent.getByToken(_recLabelsMuon, theHandle);
864  col->set(theHandle.product());
865  }
866  else if( it->first == EVTColContainer::ELEC )
867  {
869  iEvent.getByToken(_recLabelsElec, theHandle);
870  col->set(theHandle.product());
871  }
872  else if( it->first == EVTColContainer::PHOTON )
873  {
875  iEvent.getByToken(_recLabelsPhoton, theHandle);
876  col->set(theHandle.product());
877  }
878  else if( it->first == EVTColContainer::CALOMET )
879  {
881  iEvent.getByToken(_recLabelsCaloMET, theHandle);
882  col->set(theHandle.product());
883  }
884  else if( it->first == EVTColContainer::PFMET )
885  {
887  iEvent.getByToken(_recLabelsPFMET, theHandle);
888  col->set(theHandle.product());
889  }
890  else if( it->first == EVTColContainer::PFTAU )
891  {
893  iEvent.getByToken(_recLabelsPFTau, theHandle);
894  col->set(theHandle.product());
895  }
896  // 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
897  else if( it->first == EVTColContainer::PFJET )
898  {
899  if( ! _useNminOneCuts) {
900  // GenJet collection
902  iEvent.getByToken(_genJetLabel,genJet);
903  if( genJet.isValid() )
904  {
905  col->genJets = genJet.product();
906  }
907  }
908  }
909  else
910  {
911  edm::LogError("HiggsValidation") << "HLTHiggsSubAnalysis::initobjects "
912  << " NOT IMPLEMENTED (yet) ERROR: '" << it->second << "'";
913  //return; ??
914  }
915  }
916 }
917 
919  const std::string & objType, const std::string & variable, DQMStore::IBooker &ibooker)
920 {
921  std::string sourceUpper = source;
922  sourceUpper[0] = std::toupper(sourceUpper[0]);
923  std::string name = source + objType + variable ;
924  TH1F * h = 0;
925 
926  if(variable.find("MaxPt") != std::string::npos)
927  {
928  std::string desc;
929  if (variable == "MaxPt1") desc = "Leading";
930  else if (variable == "MaxPt2") desc = "Next-to-Leading";
931  else desc = variable.substr(5,6) + "th Leading";
932  std::string title = "pT of " + desc + " " + sourceUpper + " " + objType;
933  const size_t nBinsStandard = _parametersTurnOn.size() - 1;
934  size_t nBins = nBinsStandard;
935  float * edges = new float[nBinsStandard + 1];
936  for(size_t i = 0; i < nBinsStandard + 1; i++)
937  {
938  edges[i] = _parametersTurnOn[i];
939  }
940 
942  if( objType == jetObj ) {
943  const size_t nBinsJets = 25;
944  nBins = nBinsJets;
945  delete [] edges;
946  edges = new float[nBinsJets+1];
947  for(size_t i = 0; i < nBinsJets + 1; i++)
948  {
949  edges[i] = i*10;
950  }
951  }
953  const size_t nBinsJets = 30;
954  nBins = nBinsJets;
955  delete [] edges;
956  edges = new float[nBinsJets+1];
957  for(size_t i = 0; i < nBinsJets + 1; i++)
958  {
959  edges[i] = i*10;
960  }
961  }
962  h = new TH1F(name.c_str(), title.c_str(), nBins, edges);
963  delete [] edges;
964  }
965  else if( variable == "dEtaqq" ){
966  std::string title = "#Delta #eta_{qq} of " + sourceUpper + " " + objType;
967  int nBins = 20;
968  double min = 0;
969  double max = 4.8;
970  h = new TH1F(name.c_str(), title.c_str(), nBins, min, max);
971  }
972  else if ( variable == "mqq" ){
973  std::string title = "m_{qq} of " + sourceUpper + " " + objType;
974  int nBins = 20;
975  double min = 0;
976  double max = 1000;
977  h = new TH1F(name.c_str(), title.c_str(), nBins, min, max);
978  }
979  else if ( variable == "dPhibb" ){
980  std::string title = "#Delta #phi_{bb} of " + sourceUpper + " " + objType;
981  int nBins = 10;
982  double min = 0;
983  double max = 3.1416;
984  h = new TH1F(name.c_str(), title.c_str(), nBins, min, max);
985  }
986  else if ( variable == "CSV1" ){
987  std::string title = "CSV1 of " + sourceUpper + " " + objType;
988  int nBins = 20;
989  double min = 0;
990  double max = 1;
991  h = new TH1F(name.c_str(), title.c_str(), nBins, min, max);
992  }
993  else if ( variable == "CSV2" ){
994  std::string title = "CSV2 of " + sourceUpper + " " + objType;
995  int nBins = 20;
996  double min = 0;
997  double max = 1;
998  h = new TH1F(name.c_str(), title.c_str(), nBins, min, max);
999  }
1000  else if ( variable == "CSV3" ){
1001  std::string title = "CSV3 of " + sourceUpper + " " + objType;
1002  int nBins = 20;
1003  double min = 0;
1004  double max = 1;
1005  h = new TH1F(name.c_str(), title.c_str(), nBins, min, max);
1006  }
1007  else if ( variable == "maxCSV" ){
1008  std::string title = "max CSV of " + sourceUpper + " " + objType;
1009  int nBins = 20;
1010  double min = 0;
1011  double max = 1;
1012  h = new TH1F(name.c_str(), title.c_str(), nBins, min, max);
1013  }
1014  else
1015  {
1016  std::string symbol = (variable == "Eta") ? "#eta" : "#phi";
1017  std::string title = symbol + " of " + sourceUpper + " " + objType;
1018  std::vector<double> params = (variable == "Eta") ? _parametersEta : _parametersPhi;
1019 
1020  int nBins = (int)params[0];
1021  double min = params[1];
1022  double max = params[2];
1023  h = new TH1F(name.c_str(), title.c_str(), nBins, min, max);
1024  }
1025  h->Sumw2();
1026  _elements[name] = ibooker.book1D(name, h);
1027  delete h;
1028 }
1029 
1031  const std::string & objType, const std::string & variable, const float & value )
1032 {
1033  std::string sourceUpper = source;
1034  sourceUpper[0] = toupper(sourceUpper[0]);
1035  std::string name = source + objType + variable ;
1036 
1037  _elements[name]->Fill(value);
1038 }
1039 
1040 
1041 
1042 // Initialize the selectors
1043 void HLTHiggsSubAnalysis::InitSelector(const unsigned int & objtype)
1044 {
1045  if( objtype == EVTColContainer::MUON && _recMuonSelector == 0 )
1046  {
1048  }
1049  else if( objtype == EVTColContainer::ELEC && _recElecSelector == 0)
1050  {
1052  }
1053  else if( objtype == EVTColContainer::PHOTON && _recPhotonSelector == 0)
1054  {
1056  }
1057  else if( objtype == EVTColContainer::CALOMET && _recCaloMETSelector == 0)
1058  {
1060  }
1061  else if( objtype == EVTColContainer::PFMET && _recPFMETSelector == 0)
1062  {
1064  }
1065  else if( objtype == EVTColContainer::PFTAU && _recPFTauSelector == 0 )
1066  {
1068  }
1069  else if( objtype == EVTColContainer::PFJET && _recPFJetSelector == 0 )
1070  {
1072  }
1073  /*else if( objtype == EVTColContainer::TRACK && _recTrackSelector == 0)
1074  {
1075  _recTrackSelector = new StringCutObjectSelector<reco::Track>(_recCut[objtype]);
1076  }*/
1077 /* else
1078  {
1079 FIXME: ERROR NO IMPLEMENTADO
1080  }*/
1081 }
1082 
1084  std::vector<MatchStruct> * matches)
1085 {
1087  iEvent.getByToken(_recLabelsPFJet, PFJetHandle);
1088  cols->set(PFJetHandle.product());
1089 
1091  if( _useNminOneCuts ) {
1092  iEvent.getByToken(_recTagPFJet, JetTagHandle);
1093  }
1094 
1095  for(reco::PFJetCollection::const_iterator it = PFJetHandle->begin();
1096  it != PFJetHandle->end(); ++it)
1097  {
1098  reco::PFJetRef jetRef(PFJetHandle, it - PFJetHandle->begin());
1099  reco::JetBaseRef jetBaseRef(jetRef);
1100 
1101  if(_recPFJetSelector->operator()(*it))
1102  {
1103  if( _useNminOneCuts)
1104  {
1105  float bTag = (*(JetTagHandle.product()))[jetBaseRef];
1106  matches->push_back(MatchStruct(&*it,EVTColContainer::PFJET, bTag));
1107  }
1108  else {
1109  matches->push_back(MatchStruct(&*it,EVTColContainer::PFJET));
1110  }
1111  }
1112  }
1113 }
1114 
1115 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)
1116 { //dEtaqq, mqq, dPhibb, CSV1, CSV2, CSV3, maxCSV_jets, maxCSV_E, PFMET, pt1, pt2, pt3, pt4
1117 
1118  // Perform pt cuts
1119  std::sort(matches->begin(), matches->end(), matchesByDescendingPt());
1120  TString maxPt;
1121  for( unsigned int i=0; i < NptPlots; i++ )
1122  {
1123  maxPt = "MaxPt";
1124  maxPt += i+1;
1125  if( (*matches)[i].pt > _NminOneCuts[9+i] ) jetCutResult[maxPt.Data()] = true;
1126  else jetCutResult[maxPt.Data()] = false;
1127  }
1128 
1129  unsigned int NbTag = ( (_NminOneCuts[0] || _NminOneCuts[1]) ? 4 : 8 );
1130  if( matches->size() < NbTag ) NbTag = matches->size();
1131  // Perform b-tag ordered cuts
1132  std::sort(matches->begin(), matches->begin()+NbTag, matchesByDescendingBtag());
1133 
1134  if( _NminOneCuts[0] ) {
1135  dEtaqq = fabs((*matches)[2].eta - (*matches)[3].eta);
1136  if( dEtaqq > _NminOneCuts[0] ) jetCutResult["dEtaqq"] = true;
1137  else jetCutResult["dEtaqq"] = false;
1138  }
1139 
1140  if( _NminOneCuts[1] ) {
1141  mqq = ((*matches)[2].lorentzVector + (*matches)[3].lorentzVector).M();
1142  if( mqq > _NminOneCuts[1] ) jetCutResult["mqq"] = true;
1143  else jetCutResult["mqq"] = false;
1144  }
1145 
1146  if( _NminOneCuts[2] ) {
1147  dPhibb = fmod(fabs((*matches)[0].phi - (*matches)[1].phi),3.1416);
1148  if( dPhibb < _NminOneCuts[2] ) jetCutResult["dPhibb"] = true;
1149  else jetCutResult["dPhibb"] = false;
1150  }
1151 
1152  if( _NminOneCuts[4] ) {
1153  CSV2 = (*matches)[1].bTag;
1154  std::string nameCSV2plot = "CSV2";
1155 
1156  if( CSV2 > _NminOneCuts[4] ) jetCutResult[nameCSV2plot] = true;
1157  else jetCutResult[nameCSV2plot] = false;
1158  }
1159 
1160  if( _NminOneCuts[5] ) {
1161  CSV3 = (*matches)[2].bTag;
1162  std::string nameCSV3plot = "CSV3";
1163 
1164  if( CSV3 > _NminOneCuts[5] ) jetCutResult[nameCSV3plot] = true;
1165  else jetCutResult[nameCSV3plot] = false;
1166  }
1167 
1168 
1169  if( _NminOneCuts[3] ) {
1170  CSV1 = (*matches)[0].bTag;
1171  std::string nameCSVplot = "CSV1";
1172  if ( _NminOneCuts[6] ) nameCSVplot = "maxCSV";
1173 
1174  if( CSV1 > _NminOneCuts[3] ) jetCutResult[nameCSVplot] = true;
1175  else jetCutResult[nameCSVplot] = false;
1176 
1177  // max(CSV)
1178  if( _NminOneCuts[6] ) {
1179  std::sort(matches->begin(), matches->end(), matchesByDescendingPt());
1180  CSV1 = (*matches)[0].bTag;
1181  unsigned int Njets = (unsigned int) _NminOneCuts[6];
1182  if ( _NminOneCuts[6] > matches->size()) Njets = matches->size();
1183  for(unsigned int i=1; i < (unsigned int) Njets ; ++i) {
1184  if( (*matches)[i].bTag > CSV1 && (*matches)[i].pt > _NminOneCuts[7] ) CSV1 = (*matches)[i].bTag;
1185  }
1186  }
1187  }
1188 }
1189 
1190 void HLTHiggsSubAnalysis::passOtherCuts(const std::vector<MatchStruct> & matches, std::map<std::string,bool> & jetCutResult){
1191  if( _NminOneCuts[8] ) {
1192  jetCutResult["PFMET"] = false;
1193  for(std::vector<MatchStruct>::const_iterator it = matches.begin(); it != matches.end(); ++it)
1194  {
1195  if( it->objType == EVTColContainer::PFMET ) {
1196  if( it->pt > _NminOneCuts[8] ) jetCutResult["PFMET"] = true;
1197  break;
1198  }
1199  }
1200  }
1201 }
1202 
1203 void HLTHiggsSubAnalysis::insertcandidates(const unsigned int & objType, const EVTColContainer * cols,
1204  std::vector<MatchStruct> * matches)
1205 {
1206  if( objType == EVTColContainer::MUON )
1207  {
1208  for(size_t i = 0; i < cols->muons->size(); i++)
1209  {
1210  if(_recMuonSelector->operator()(cols->muons->at(i)))
1211  {
1212  matches->push_back(MatchStruct(&cols->muons->at(i),objType));
1213  }
1214  }
1215  }
1216  else if( objType == EVTColContainer::ELEC )
1217  {
1218  for(size_t i = 0; i < cols->electrons->size(); i++)
1219  {
1220  if(_recElecSelector->operator()(cols->electrons->at(i)))
1221  {
1222  matches->push_back(MatchStruct(&cols->electrons->at(i),objType));
1223  }
1224  }
1225  }
1226  else if( objType == EVTColContainer::PHOTON )
1227  {
1228  for(size_t i = 0; i < cols->photons->size(); i++)
1229  {
1230  if(_recPhotonSelector->operator()(cols->photons->at(i)))
1231  {
1232  matches->push_back(MatchStruct(&cols->photons->at(i),objType));
1233  }
1234  }
1235  }
1236  else if( objType == EVTColContainer::CALOMET )
1237  {
1238  for(size_t i = 0; i < cols->caloMETs->size(); i++)
1239  {
1240  if(_recCaloMETSelector->operator()(cols->caloMETs->at(i)))
1241  {
1242  matches->push_back(MatchStruct(&cols->caloMETs->at(i),objType));
1243  }
1244  }
1245  }
1246  else if( objType == EVTColContainer::PFMET )
1247  {
1248  for(size_t i = 0; i < cols->pfMETs->size(); i++)
1249  {
1250  if(_recPFMETSelector->operator()(cols->pfMETs->at(i)))
1251  {
1252  matches->push_back(MatchStruct(&cols->pfMETs->at(i),objType));
1253  }
1254  }
1255  }
1256  else if( objType == EVTColContainer::PFTAU )
1257  {
1258  for(size_t i = 0; i < cols->pfTaus->size(); i++)
1259  {
1260  if(_recPFTauSelector->operator()(cols->pfTaus->at(i)))
1261  {
1262  matches->push_back(MatchStruct(&cols->pfTaus->at(i),objType));
1263  }
1264  }
1265  }
1266 // else if( objType == EVTColContainer::PFJET )
1267 // {
1268 // already inserted
1269 // }
1270  /*else if( objType == EVTColContainer::TRACK )
1271  {
1272  for(size_t i = 0; i < cols->tracks->size(); i++)
1273  {
1274  if(_recTrackSelector->operator()(cols->tracks->at(i)))
1275  {
1276  matches->push_back(MatchStruct(&cols->tracks->at(i),objType));
1277  }
1278  }
1279  }*/
1280  /*
1281  else FIXME: Control errores
1282  {
1283  }
1284  */
1285 }
#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