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