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