CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
EmDQM Class Reference

#include <EmDQM.h>

Inheritance diagram for EmDQM:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &event, const edm::EventSetup &)
 
void beginJob ()
 
void beginRun (edm::Run const &, edm::EventSetup const &)
 
 EmDQM (const edm::ParameterSet &pset)
 Constructor. More...
 
void endJob ()
 
void endRun (edm::Run const &, edm::EventSetup const &)
 
 ~EmDQM ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

bool checkGeneratedParticlesRequirement (const edm::Event &event)
 
bool checkRecoParticlesRequirement (const edm::Event &event)
 
template<class T >
void fillHistos (edm::Handle< trigger::TriggerEventWithRefs > &, const edm::Event &, unsigned int, std::vector< reco::Particle > &, bool &)
 

Private Attributes

DQMStoredbe
 
std::string dirname_
 
MonitorElementetagen
 
std::vector< MonitorElement * > etahist
 
std::vector< MonitorElement * > etahistiso
 
std::vector< MonitorElement * > etahistisomatch
 
std::vector< MonitorElement * > etahistmatch
 
MonitorElementetgen
 
std::vector< MonitorElement * > ethist
 
std::vector< MonitorElement * > ethistiso
 
std::vector< MonitorElement * > ethistisomatch
 
std::vector< MonitorElement * > ethistmatch
 
unsigned int gencut_
 
edm::InputTag gencutCollection_
 
double genEtaAcc
 
double genEtAcc
 
std::vector< MonitorElement * > histEtaIsoOfHltObjMatchToGen
 
std::vector< MonitorElement * > histEtaOfHltObjMatchToGen
 
std::vector< MonitorElement * > histEtIsoOfHltObjMatchToGen
 
std::vector< MonitorElement * > histEtOfHltObjMatchToGen
 
std::vector< MonitorElement * > histPhiIsoOfHltObjMatchToGen
 
std::vector< MonitorElement * > histPhiOfHltObjMatchToGen
 
std::set< std::string > hltCollectionLabelsFound
 
std::set< std::string > hltCollectionLabelsMissed
 
HLTConfigProvider hltConf_
 The instance of the HLTConfigProvider as a data member. More...
 
std::vector< std::vector
< edm::InputTag > > 
isoNames
 
bool mcMatchedOnly
 
std::vector< unsigned int > nCandCuts
 
bool noIsolationPlots
 
bool noPhiPlots
 
unsigned int numOfHLTCollectionLabels
 
unsigned int pathIndex
 
int pdgGen
 
MonitorElementphigen
 
std::vector< MonitorElement * > phihist
 
std::vector< MonitorElement * > phihistiso
 
std::vector< MonitorElement * > phihistisomatch
 
std::vector< MonitorElement * > phihistmatch
 
unsigned int plotBins
 
std::vector< std::pair< double,
double > > 
plotBounds
 
double plotEtaMax
 
double plotEtMin
 
std::vector< bool > plotiso
 
unsigned int plotMinEtForEtaEffPlot
 
double plotPhiMax
 
double plotPtMax
 
double plotPtMin
 
GreaterByPt< reco::ParticlepTComparator_
 
GreaterByPt< reco::GenParticlepTGenComparator_
 
unsigned int reqNum
 
std::vector< std::string > theHLTCollectionHumanNames
 
std::vector< edm::InputTagtheHLTCollectionLabels
 
std::string theHltName
 
std::vector< int > theHLTOutputTypes
 
edm::InputTag theL1Seed
 
MonitorElementtotal
 
MonitorElementtotalmatch
 
edm::InputTag triggerobjwithrefs
 
bool useHumanReadableHistTitles
 
unsigned verbosity
 

Static Private Attributes

static const unsigned OUTPUT_ALL = 3
 
static const unsigned OUTPUT_ERRORS = 1
 
static const unsigned OUTPUT_SILENT = 0
 
static const unsigned OUTPUT_WARNINGS = 2
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 24 of file EmDQM.h.

Constructor & Destructor Documentation

EmDQM::EmDQM ( const edm::ParameterSet pset)
explicit

Constructor.

Definition at line 45 of file EmDQM.cc.

References filters, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), i, cppFunctionSkipper::operator, AlCaHLTBitMon_QueryRunRegistry::string, and PFRecoTauDiscriminationAgainstMuon2_cfi::verbosity.

46 {
47 
49  dbe->setVerbose(0);
50 
52  // Read from configuration file //
54  dirname_="HLT/HLTEgammaValidation/"+pset.getParameter<std::string>("@module_label");
56 
57  triggerobjwithrefs = pset.getParameter<edm::InputTag>("triggerobject");
58  pathIndex = pset.getUntrackedParameter<unsigned int>("pathIndex", 0);
59  // parameters for generator study
60  reqNum = pset.getParameter<unsigned int>("reqNum");
61  pdgGen = pset.getParameter<int>("pdgGen");
62  genEtaAcc = pset.getParameter<double>("genEtaAcc");
63  genEtAcc = pset.getParameter<double>("genEtAcc");
64  // plotting parameters (untracked because they don't affect the physics)
65  plotEtMin = pset.getUntrackedParameter<double>("genEtMin",0.);
66  plotPtMin = pset.getUntrackedParameter<double>("PtMin",0.);
67  plotPtMax = pset.getUntrackedParameter<double>("PtMax",1000.);
68  plotEtaMax = pset.getUntrackedParameter<double>("EtaMax", 2.7);
69  plotPhiMax = pset.getUntrackedParameter<double>("PhiMax", 3.15);
70  plotBins = pset.getUntrackedParameter<unsigned int>("Nbins",40);
71  plotMinEtForEtaEffPlot = pset.getUntrackedParameter<unsigned int>("minEtForEtaEffPlot", 15);
72  useHumanReadableHistTitles = pset.getUntrackedParameter<bool>("useHumanReadableHistTitles", false);
73  mcMatchedOnly = pset.getUntrackedParameter<bool>("mcMatchedOnly", true);
74  noPhiPlots = pset.getUntrackedParameter<bool>("noPhiPlots", true);
75  noIsolationPlots = pset.getUntrackedParameter<bool>("noIsolationPlots", true);
76  verbosity = pset.getUntrackedParameter<unsigned int>("verbosity",0);
77 
78  //preselction cuts
79  gencutCollection_= pset.getParameter<edm::InputTag>("cutcollection");
80  gencut_ = pset.getParameter<int>("cutnum");
81 
83  // Read in the Vector of Parameter Sets. //
84  // Information for each filter-step //
86  std::vector<edm::ParameterSet> filters =
87  pset.getParameter<std::vector<edm::ParameterSet> >("filters");
88 
89  int i = 0;
90  for(std::vector<edm::ParameterSet>::iterator filterconf = filters.begin() ; filterconf != filters.end() ; filterconf++)
91  {
92 
93  theHLTCollectionLabels.push_back(filterconf->getParameter<edm::InputTag>("HLTCollectionLabels"));
94  theHLTOutputTypes.push_back(filterconf->getParameter<int>("theHLTOutputTypes"));
95  // Grab the human-readable name, if it is not specified, use the Collection Label
96  theHLTCollectionHumanNames.push_back(filterconf->getUntrackedParameter<std::string>("HLTCollectionHumanName",theHLTCollectionLabels[i].label()));
97 
98  std::vector<double> bounds = filterconf->getParameter<std::vector<double> >("PlotBounds");
99  // If the size of plot "bounds" vector != 2, abort
100  assert(bounds.size() == 2);
101  plotBounds.push_back(std::pair<double,double>(bounds[0],bounds[1]));
102  isoNames.push_back(filterconf->getParameter<std::vector<edm::InputTag> >("IsoCollections"));
103  // If the size of the isoNames vector is not greater than zero, abort
104  assert(isoNames.back().size()>0);
105  if (isoNames.back().at(0).label()=="none") {
106  plotiso.push_back(false);
107  } else {
108  if (!noIsolationPlots) plotiso.push_back(true);
109  else plotiso.push_back(false);
110  }
111  nCandCuts.push_back(filterconf->getParameter<int>("ncandcut"));
112  i++;
113  } // END of loop over parameter sets
114 
115  // Record number of HLTCollectionLabels
117 
118 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
unsigned int numOfHLTCollectionLabels
Definition: EmDQM.h:64
std::string dirname_
Definition: EmDQM.h:153
int pdgGen
Definition: EmDQM.h:89
DQMStore * dbe
Definition: EmDQM.h:152
double plotEtaMax
Definition: EmDQM.h:94
double plotEtMin
Definition: EmDQM.h:93
std::vector< TPRegexp > filters
Definition: eve_filter.cc:25
unsigned verbosity
Definition: EmDQM.h:77
std::vector< std::vector< edm::InputTag > > isoNames
Definition: EmDQM.h:73
std::vector< edm::InputTag > theHLTCollectionLabels
Definition: EmDQM.h:63
unsigned int gencut_
Definition: EmDQM.h:111
std::vector< unsigned int > nCandCuts
Definition: EmDQM.h:75
bool noIsolationPlots
Definition: EmDQM.h:68
unsigned int plotMinEtForEtaEffPlot
Definition: EmDQM.h:99
double plotPtMax
Definition: EmDQM.h:97
double plotPtMin
Definition: EmDQM.h:96
edm::InputTag gencutCollection_
Definition: EmDQM.h:108
void setVerbose(unsigned level)
Definition: DQMStore.cc:398
bool noPhiPlots
Definition: EmDQM.h:67
bool mcMatchedOnly
Definition: EmDQM.h:66
double genEtAcc
Definition: EmDQM.h:91
double plotPhiMax
Definition: EmDQM.h:95
bool useHumanReadableHistTitles
Definition: EmDQM.h:65
unsigned int pathIndex
Definition: EmDQM.h:62
std::vector< std::string > theHLTCollectionHumanNames
Definition: EmDQM.h:69
std::vector< int > theHLTOutputTypes
Definition: EmDQM.h:71
edm::InputTag triggerobjwithrefs
Definition: EmDQM.h:61
unsigned int reqNum
Definition: EmDQM.h:88
unsigned int plotBins
Definition: EmDQM.h:98
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:434
std::vector< std::pair< double, double > > plotBounds
Definition: EmDQM.h:74
double genEtaAcc
Definition: EmDQM.h:90
std::vector< bool > plotiso
Definition: EmDQM.h:72
EmDQM::~EmDQM ( )

Destructor.

Definition at line 366 of file EmDQM.cc.

366  {
367 }

Member Function Documentation

void EmDQM::analyze ( const edm::Event event,
const edm::EventSetup setup 
)
virtual

Implements edm::EDAnalyzer.

Definition at line 472 of file EmDQM.cc.

References eta(), event(), JetPDSkim_cfg::hltResults, i, edm::EventBase::isRealData(), edm::HandleBase::isValid(), n, phi, python.multivaluedict::sort(), pileupDistInMC::total, trigger::TriggerCluster, trigger::TriggerElectron, trigger::TriggerL1IsoEG, trigger::TriggerL1NoIsoEG, trigger::TriggerPhoton, and PFRecoTauDiscriminationAgainstMuon2_cfi::verbosity.

473 {
475  // Check if there's enough gen particles //
476  // of interest //
479  event.getByLabel(gencutCollection_,cutCounter);
480  if (cutCounter->size() < (unsigned int)gencut_) {
481  //edm::LogWarning("EmDQM") << "Less than "<< gencut_ <<" gen particles with pdgId=" << pdgGen;
482  return;
483  }
484 
485 
486  // fill L1 and HLT info
487  // get objects possed by each filter
489  event.getByLabel(triggerobjwithrefs,triggerObj);
490  if(!triggerObj.isValid()) {
491  if (verbosity >= OUTPUT_WARNINGS)
492  edm::LogWarning("EmDQM") << "parameter triggerobject (" << triggerobjwithrefs << ") does not corresond to a valid TriggerEventWithRefs product. Please check especially the process name (e.g. when running over reprocessed datasets)";
493  return;
494  }
495 
496  // Were enough high energy gen particles found?
497  if (event.isRealData())
498  {
499  // running validation on data.
500  // TODO: we should check that the entire
501  // run is on the same type (all data or
502  // all MC). Otherwise one gets
503  // uninterpretable results...
504  if (!checkRecoParticlesRequirement(event))
505  return;
506  }
507  else
508  {
509  // MC
511  // if no, throw event away
512  return;
513  }
514 
515 
516  // It was an event worth keeping. Continue.
517 
519  // Fill the bin labeled "Total" //
520  // This will be the number of events looked at. //
524 
525 
527  // Fill generator info //
529  // the gencut_ highest Et generator objects of the preselected type are our matches
530 
531  std::vector<reco::Particle> sortedGen;
532  for(edm::View<reco::Candidate>::const_iterator genpart = cutCounter->begin(); genpart != cutCounter->end();genpart++){
533  reco::Particle tmpcand( genpart->charge(), genpart->p4(), genpart->vertex(),genpart->pdgId(),genpart->status() );
534  if (tmpcand.et() >= plotEtMin) {
535  sortedGen.push_back(tmpcand);
536  }
537  }
538  std::sort(sortedGen.begin(),sortedGen.end(),pTComparator_ );
539 
540  // Now the collection of gen particles is sorted by pt.
541  // So, remove all particles from the collection so that we
542  // only have the top "1 thru gencut_" particles in it
543  if (sortedGen.size() < gencut_){
544  return;
545  }
546  sortedGen.erase(sortedGen.begin()+gencut_,sortedGen.end());
547 
548  for (unsigned int i = 0 ; i < gencut_ ; i++ ) {
549  etgen ->Fill( sortedGen[i].et() ); //validity has been implicitily checked by the cut on gencut_ above
550  if (sortedGen[i].et() > plotMinEtForEtaEffPlot) {
551  etagen->Fill( sortedGen[i].eta() );
552  if (!noPhiPlots) phigen->Fill( sortedGen[i].phi() );
553  }
554  } // END of loop over Generated particles
555  if (gencut_ >= reqNum && !mcMatchedOnly) total->Fill(numOfHLTCollectionLabels+1.5); // this isn't really needed anymore keep for backward comp.
556  if (gencut_ >= reqNum) totalmatch->Fill(numOfHLTCollectionLabels+1.5); // this isn't really needed anymore keep for backward comp.
557 
558  bool accepted = true; // flags that the event has been accepted by all filters before
560  event.getByLabel(edm::InputTag("TriggerResults","", triggerobjwithrefs.process()), hltResults);
562  // Loop over filter modules //
564  for(unsigned int n=0; n < numOfHLTCollectionLabels ; n++) {
565  // check that there are not less sortedGen particles than nCandCut requires for this filter
566  if (sortedGen.size() < nCandCuts.at(n)) {
567  if (verbosity >= OUTPUT_ERRORS)
568  edm::LogError("EmDQM") << "There are less generated particles than the module '" << theHLTCollectionLabels[n].label() << "' requires.";
569  continue;
570  }
571  std::vector<reco::Particle> sortedGenForFilter(sortedGen);
572  sortedGenForFilter.erase(sortedGenForFilter.begin() + nCandCuts.at(n), sortedGenForFilter.end());
573 
574  // Fill only if this filter was run.
575  if (pathIndex != 0 && hltConf_.moduleIndex(pathIndex, theHLTCollectionLabels[n].label()) > hltResults->index(pathIndex)) break;
576  // These numbers are from the Parameter Set, such as:
577  // theHLTOutputTypes = cms.uint32(100)
578  switch(theHLTOutputTypes[n])
579  {
580  case trigger::TriggerL1NoIsoEG: // Non-isolated Level 1
581  fillHistos<l1extra::L1EmParticleCollection>(triggerObj,event,n,sortedGenForFilter,accepted);break;
582  case trigger::TriggerL1IsoEG: // Isolated Level 1
583  fillHistos<l1extra::L1EmParticleCollection>(triggerObj,event,n,sortedGenForFilter,accepted);break;
584  case trigger::TriggerPhoton: // Photon
585  fillHistos<reco::RecoEcalCandidateCollection>(triggerObj,event,n,sortedGenForFilter,accepted);break;
586  case trigger::TriggerElectron: // Electron
587  fillHistos<reco::ElectronCollection>(triggerObj,event,n,sortedGenForFilter,accepted);break;
588  case trigger::TriggerCluster: // TriggerCluster
589  fillHistos<reco::RecoEcalCandidateCollection>(triggerObj,event,n,sortedGenForFilter,accepted);break;
590  default:
591  throw(cms::Exception("Release Validation Error") << "HLT output type not implemented: theHLTOutputTypes[n]" );
592  }
593  } // END of loop over filter modules
594 }
int i
Definition: DBlmapReader.cc:9
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:81
bool checkRecoParticlesRequirement(const edm::Event &event)
Definition: EmDQM.cc:427
unsigned int numOfHLTCollectionLabels
Definition: EmDQM.h:64
MonitorElement * etagen
Definition: EmDQM.h:148
T eta() const
double plotEtMin
Definition: EmDQM.h:93
bool isRealData() const
Definition: EventBase.h:60
static const unsigned OUTPUT_ERRORS
Definition: EmDQM.h:80
MonitorElement * phigen
Definition: EmDQM.h:149
unsigned verbosity
Definition: EmDQM.h:77
void Fill(long long x)
std::vector< edm::InputTag > theHLTCollectionLabels
Definition: EmDQM.h:63
unsigned int moduleIndex(unsigned int trigger, const std::string &module) const
slot position of module on trigger path (0 to size-1)
unsigned int gencut_
Definition: EmDQM.h:111
std::vector< unsigned int > nCandCuts
Definition: EmDQM.h:75
static const unsigned OUTPUT_WARNINGS
Definition: EmDQM.h:81
unsigned int plotMinEtForEtaEffPlot
Definition: EmDQM.h:99
MonitorElement * totalmatch
Definition: EmDQM.h:145
MonitorElement * etgen
Definition: EmDQM.h:147
edm::InputTag gencutCollection_
Definition: EmDQM.h:108
bool noPhiPlots
Definition: EmDQM.h:67
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
bool isValid() const
Definition: HandleBase.h:76
bool mcMatchedOnly
Definition: EmDQM.h:66
bool checkGeneratedParticlesRequirement(const edm::Event &event)
Definition: EmDQM.cc:370
HLTConfigProvider hltConf_
The instance of the HLTConfigProvider as a data member.
Definition: EmDQM.h:58
std::string const & process() const
Definition: InputTag.h:46
unsigned int pathIndex
Definition: EmDQM.h:62
GreaterByPt< reco::Particle > pTComparator_
Definition: EmDQM.h:156
std::vector< int > theHLTOutputTypes
Definition: EmDQM.h:71
edm::InputTag triggerobjwithrefs
Definition: EmDQM.h:61
unsigned int reqNum
Definition: EmDQM.h:88
MonitorElement * total
Definition: EmDQM.h:144
Definition: DDAxes.h:10
void EmDQM::beginJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 125 of file EmDQM.cc.

126 {
127 
128 }
void EmDQM::beginRun ( edm::Run const &  iRun,
edm::EventSetup const &  iSetup 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 131 of file EmDQM.cc.

References i, diffTwoXMLs::label, NULL, AlCaHLTBitMon_QueryRunRegistry::string, pileupDistInMC::total, and PFRecoTauDiscriminationAgainstMuon2_cfi::verbosity.

132 {
133  bool changed(true);
134  if (hltConf_.init(iRun, iSetup, triggerobjwithrefs.process(), changed)) {
135 
136  // if init returns TRUE, initialisation has succeeded!
137 
138  //edm::Service<TFileService> fs;
140 
142  // Set up Histogram of Effiency vs Step. //
143  // theHLTCollectionLabels is a vector of InputTags //
144  // from the configuration file. //
146 
147  std::string histName="total_eff";
148  std::string histTitle = "total events passing";
149  if (!mcMatchedOnly) {
150  // This plot will have bins equal to 2+(number of
151  // HLTCollectionLabels in the config file)
152  total = dbe->book1D(histName.c_str(),histTitle.c_str(),numOfHLTCollectionLabels+2,0,numOfHLTCollectionLabels+2);
155  for (unsigned int u=0; u<numOfHLTCollectionLabels; u++){total->setBinLabel(u+1,theHLTCollectionLabels[u].label().c_str());}
156  }
157 
158  histName="total_eff_MC_matched";
159  histTitle="total events passing (mc matched)";
160  totalmatch = dbe->book1D(histName.c_str(),histTitle.c_str(),numOfHLTCollectionLabels+2,0,numOfHLTCollectionLabels+2);
161  totalmatch->setBinLabel(numOfHLTCollectionLabels+1,"Total");
162  totalmatch->setBinLabel(numOfHLTCollectionLabels+2,"Gen");
163  for (unsigned int u=0; u<numOfHLTCollectionLabels; u++){totalmatch->setBinLabel(u+1,theHLTCollectionLabels[u].label().c_str());}
164 
165  MonitorElement* tmphisto;
166  MonitorElement* tmpiso;
167 
169  // Set up generator-level histograms //
171  std::string pdgIdString;
172  switch(pdgGen) {
173  case 11:
174  pdgIdString="Electron";break;
175  case 22:
176  pdgIdString="Photon";break;
177  default:
178  pdgIdString="Particle";
179  }
180 
181  histName = "gen_et";
182  histTitle= "E_{T} of " + pdgIdString + "s" ;
183  etgen = dbe->book1D(histName.c_str(),histTitle.c_str(),plotBins,plotPtMin,plotPtMax);
184  histName = "gen_eta";
185  histTitle= "#eta of "+ pdgIdString +"s " ;
186  etagen = dbe->book1D(histName.c_str(),histTitle.c_str(),plotBins,-plotEtaMax,plotEtaMax);
187  histName = "gen_phi";
188  histTitle= "#phi of "+ pdgIdString +"s " ;
189  if (!noPhiPlots) phigen = dbe->book1D(histName.c_str(),histTitle.c_str(),plotBins,-plotPhiMax,plotPhiMax);
190 
191 
192 
194  // Set up histograms of HLT objects //
196 
197  // Determine what strings to use for histogram titles
198  std::vector<std::string> HltHistTitle;
199  if ( theHLTCollectionHumanNames.size() == numOfHLTCollectionLabels && useHumanReadableHistTitles ) {
200  HltHistTitle = theHLTCollectionHumanNames;
201  } else {
202  for (unsigned int i =0; i < numOfHLTCollectionLabels; i++) {
203  HltHistTitle.push_back(theHLTCollectionLabels[i].label());
204  }
205  }
206 
207  for(unsigned int i = 0; i< numOfHLTCollectionLabels ; i++){
208  if (!mcMatchedOnly) {
209  // Et distribution of HLT objects passing filter i
210  histName = theHLTCollectionLabels[i].label()+"et_all";
211  histTitle = HltHistTitle[i]+" Et (ALL)";
212  tmphisto = dbe->book1D(histName.c_str(),histTitle.c_str(),plotBins,plotPtMin,plotPtMax);
213  ethist.push_back(tmphisto);
214 
215  // Eta distribution of HLT objects passing filter i
216  histName = theHLTCollectionLabels[i].label()+"eta_all";
217  histTitle = HltHistTitle[i]+" #eta (ALL)";
218  tmphisto = dbe->book1D(histName.c_str(),histTitle.c_str(),plotBins,-plotEtaMax,plotEtaMax);
219  etahist.push_back(tmphisto);
220 
221  if (!noPhiPlots) {
222  // Phi distribution of HLT objects passing filter i
223  histName = theHLTCollectionLabels[i].label()+"phi_all";
224  histTitle = HltHistTitle[i]+" #phi (ALL)";
225  tmphisto = dbe->book1D(histName.c_str(),histTitle.c_str(),plotBins,-plotPhiMax,plotPhiMax);
226  phihist.push_back(tmphisto);
227  }
228 
229 
230  // Et distribution of HLT object that is closest delta-R match to sorted gen particle(s)
231  histName = theHLTCollectionLabels[i].label()+"et";
232  histTitle = HltHistTitle[i]+" Et";
233  tmphisto = dbe->book1D(histName.c_str(),histTitle.c_str(),plotBins,plotPtMin,plotPtMax);
234  histEtOfHltObjMatchToGen.push_back(tmphisto);
235 
236  // eta distribution of HLT object that is closest delta-R match to sorted gen particle(s)
237  histName = theHLTCollectionLabels[i].label()+"eta";
238  histTitle = HltHistTitle[i]+" eta";
239  tmphisto = dbe->book1D(histName.c_str(),histTitle.c_str(),plotBins,-plotEtaMax,plotEtaMax);
240  histEtaOfHltObjMatchToGen.push_back(tmphisto);
241 
242  if (!noPhiPlots) {
243  // phi distribution of HLT object that is closest delta-R match to sorted gen particle(s)
244  histName = theHLTCollectionLabels[i].label()+"phi";
245  histTitle = HltHistTitle[i]+" phi";
246  tmphisto = dbe->book1D(histName.c_str(),histTitle.c_str(),plotBins,-plotPhiMax,plotPhiMax);
247  histPhiOfHltObjMatchToGen.push_back(tmphisto);
248  }
249  }
250 
251  // Et distribution of gen object matching HLT object passing filter i
252  histName = theHLTCollectionLabels[i].label()+"et_MC_matched";
253  histTitle = HltHistTitle[i]+" Et (MC matched)";
254  tmphisto = dbe->book1D(histName.c_str(),histTitle.c_str(),plotBins,plotPtMin,plotPtMax);
255  ethistmatch.push_back(tmphisto);
256 
257  // Eta distribution of gen object matching HLT object passing filter i
258  histName = theHLTCollectionLabels[i].label()+"eta_MC_matched";
259  histTitle = HltHistTitle[i]+" #eta (MC matched)";
260  tmphisto = dbe->book1D(histName.c_str(),histTitle.c_str(),plotBins,-plotEtaMax,plotEtaMax);
261  etahistmatch.push_back(tmphisto);
262 
263  if (!noPhiPlots) {
264  // Phi distribution of gen object matching HLT object passing filter i
265  histName = theHLTCollectionLabels[i].label()+"phi_MC_matched";
266  histTitle = HltHistTitle[i]+" #phi (MC matched)";
267  tmphisto = dbe->book1D(histName.c_str(),histTitle.c_str(),plotBins,-plotPhiMax,plotPhiMax);
268  phihistmatch.push_back(tmphisto);
269  }
270 
271 
272  if (!plotiso[i]) {
273  tmpiso = NULL;
274  if (!mcMatchedOnly) {
275  etahistiso.push_back(tmpiso);
276  phihistiso.push_back(tmpiso);
277  ethistiso.push_back(tmpiso);
278  histEtaIsoOfHltObjMatchToGen.push_back(tmpiso);
279  histPhiIsoOfHltObjMatchToGen.push_back(tmpiso);
280  histEtIsoOfHltObjMatchToGen.push_back(tmpiso);
281  }
282  etahistisomatch.push_back(tmpiso);
283  phihistisomatch.push_back(tmpiso);
284  ethistisomatch.push_back(tmpiso);
285  } else {
286  if (!mcMatchedOnly) {
287  // 2D plot: Isolation values vs eta for all objects
288  histName = theHLTCollectionLabels[i].label()+"eta_isolation_all";
289  histTitle = HltHistTitle[i]+" isolation vs #eta (all)";
290  tmpiso = dbe->book2D(histName.c_str(),histTitle.c_str(),plotBins,-plotEtaMax,plotEtaMax,plotBins,plotBounds[i].first,plotBounds[i].second);
291  etahistiso.push_back(tmpiso);
292 
293  // 2D plot: Isolation values vs phi for all objects
294  histName = theHLTCollectionLabels[i].label()+"phi_isolation_all";
295  histTitle = HltHistTitle[i]+" isolation vs #phi (all)";
296  tmpiso = dbe->book2D(histName.c_str(),histTitle.c_str(),plotBins,-plotPhiMax,plotPhiMax,plotBins,plotBounds[i].first,plotBounds[i].second);
297  phihistiso.push_back(tmpiso);
298 
299  // 2D plot: Isolation values vs et for all objects
300  histName = theHLTCollectionLabels[i].label()+"et_isolation_all";
301  histTitle = HltHistTitle[i]+" isolation vs Et (all)";
302  tmpiso = dbe->book2D(histName.c_str(),histTitle.c_str(),plotBins,plotPtMin,plotPtMax,plotBins,plotBounds[i].first,plotBounds[i].second);
303  ethistiso.push_back(tmpiso);
304 
305  // 2D plot: Isolation values vs eta for HLT object that
306  // is closest delta-R match to sorted gen particle(s)
307  histName = theHLTCollectionLabels[i].label()+"eta_isolation";
308  histTitle = HltHistTitle[i]+" isolation vs #eta";
309  tmpiso = dbe->book2D(histName.c_str(),histTitle.c_str(),plotBins,-plotEtaMax,plotEtaMax,plotBins,plotBounds[i].first,plotBounds[i].second);
310  histEtaIsoOfHltObjMatchToGen.push_back(tmpiso);
311 
312  // 2D plot: Isolation values vs phi for HLT object that
313  // is closest delta-R match to sorted gen particle(s)
314  histName = theHLTCollectionLabels[i].label()+"phi_isolation";
315  histTitle = HltHistTitle[i]+" isolation vs #phi";
316  tmpiso = dbe->book2D(histName.c_str(),histTitle.c_str(),plotBins,-plotPhiMax,plotPhiMax,plotBins,plotBounds[i].first,plotBounds[i].second);
317  histPhiIsoOfHltObjMatchToGen.push_back(tmpiso);
318 
319  // 2D plot: Isolation values vs et for HLT object that
320  // is closest delta-R match to sorted gen particle(s)
321  histName = theHLTCollectionLabels[i].label()+"et_isolation";
322  histTitle = HltHistTitle[i]+" isolation vs Et";
323  tmpiso = dbe->book2D(histName.c_str(),histTitle.c_str(),plotBins,plotPtMin,plotPtMax,plotBins,plotBounds[i].first,plotBounds[i].second);
324  histEtIsoOfHltObjMatchToGen.push_back(tmpiso);
325  }
326 
327  // 2D plot: Isolation values vs eta for matched objects
328  histName = theHLTCollectionLabels[i].label()+"eta_isolation_MC_matched";
329  histTitle = HltHistTitle[i]+" isolation vs #eta (mc matched)";
330  tmpiso = dbe->book2D(histName.c_str(),histTitle.c_str(),plotBins,-plotEtaMax,plotEtaMax,plotBins,plotBounds[i].first,plotBounds[i].second);
331  etahistisomatch.push_back(tmpiso);
332 
333  // 2D plot: Isolation values vs phi for matched objects
334  histName = theHLTCollectionLabels[i].label()+"phi_isolation_MC_matched";
335  histTitle = HltHistTitle[i]+" isolation vs #phi (mc matched)";
336  tmpiso = dbe->book2D(histName.c_str(),histTitle.c_str(),plotBins,-plotPhiMax,plotPhiMax,plotBins,plotBounds[i].first,plotBounds[i].second);
337  phihistisomatch.push_back(tmpiso);
338 
339 
340  // 2D plot: Isolation values vs et for matched objects
341  histName = theHLTCollectionLabels[i].label()+"et_isolation_MC_matched";
342  histTitle = HltHistTitle[i]+" isolation vs Et (mc matched)";
343  tmpiso = dbe->book2D(histName.c_str(),histTitle.c_str(),plotBins,plotPtMin,plotPtMax,plotBins,plotBounds[i].first,plotBounds[i].second);
344  ethistisomatch.push_back(tmpiso);
345 
346  } // END of HLT histograms
347 
348  }
349 
350  if (changed) {
351  // The HLT config has actually changed wrt the previous Run, hence rebook your
352  // histograms or do anything else dependent on the revised HLT config
353  }
354  } else {
355  // if init returns FALSE, initialisation has NOT succeeded, which indicates a problem
356  // with the file and/or code and needs to be investigated!
357  if (verbosity >= OUTPUT_ERRORS)
358  edm::LogError("EmDQM") << " HLT config extraction failure with process name '" << triggerobjwithrefs.process() << "'.";
359  // In this case, all access methods will return empty values!
360  }
361 }
int i
Definition: DBlmapReader.cc:9
std::vector< MonitorElement * > phihist
Definition: EmDQM.h:125
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:722
unsigned int numOfHLTCollectionLabels
Definition: EmDQM.h:64
std::string dirname_
Definition: EmDQM.h:153
int pdgGen
Definition: EmDQM.h:89
DQMStore * dbe
Definition: EmDQM.h:152
std::vector< MonitorElement * > histPhiIsoOfHltObjMatchToGen
Definition: EmDQM.h:142
MonitorElement * etagen
Definition: EmDQM.h:148
double plotEtaMax
Definition: EmDQM.h:94
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
std::vector< MonitorElement * > ethistiso
Definition: EmDQM.h:136
#define NULL
Definition: scimark2.h:8
std::vector< MonitorElement * > histEtaIsoOfHltObjMatchToGen
Definition: EmDQM.h:141
static const unsigned OUTPUT_ERRORS
Definition: EmDQM.h:80
MonitorElement * phigen
Definition: EmDQM.h:149
unsigned verbosity
Definition: EmDQM.h:77
std::vector< edm::InputTag > theHLTCollectionLabels
Definition: EmDQM.h:63
std::vector< MonitorElement * > phihistmatch
Definition: EmDQM.h:128
double plotPtMax
Definition: EmDQM.h:97
MonitorElement * totalmatch
Definition: EmDQM.h:145
double plotPtMin
Definition: EmDQM.h:96
MonitorElement * etgen
Definition: EmDQM.h:147
bool noPhiPlots
Definition: EmDQM.h:67
std::vector< MonitorElement * > histEtaOfHltObjMatchToGen
Definition: EmDQM.h:131
bool mcMatchedOnly
Definition: EmDQM.h:66
std::vector< MonitorElement * > ethistisomatch
Definition: EmDQM.h:139
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
double plotPhiMax
Definition: EmDQM.h:95
HLTConfigProvider hltConf_
The instance of the HLTConfigProvider as a data member.
Definition: EmDQM.h:58
std::vector< MonitorElement * > ethist
Definition: EmDQM.h:126
std::vector< MonitorElement * > etahistmatch
Definition: EmDQM.h:127
std::vector< MonitorElement * > etahistiso
Definition: EmDQM.h:134
std::vector< MonitorElement * > histPhiOfHltObjMatchToGen
Definition: EmDQM.h:132
std::vector< MonitorElement * > ethistmatch
Definition: EmDQM.h:129
std::string const & process() const
Definition: InputTag.h:46
bool useHumanReadableHistTitles
Definition: EmDQM.h:65
std::vector< MonitorElement * > phihistiso
Definition: EmDQM.h:135
std::vector< MonitorElement * > etahist
Definition: EmDQM.h:124
std::vector< MonitorElement * > histEtIsoOfHltObjMatchToGen
Definition: EmDQM.h:140
std::vector< std::string > theHLTCollectionHumanNames
Definition: EmDQM.h:69
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:850
std::vector< MonitorElement * > etahistisomatch
Definition: EmDQM.h:137
edm::InputTag triggerobjwithrefs
Definition: EmDQM.h:61
unsigned int plotBins
Definition: EmDQM.h:98
std::vector< MonitorElement * > histEtOfHltObjMatchToGen
Definition: EmDQM.h:130
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:434
std::vector< std::pair< double, double > > plotBounds
Definition: EmDQM.h:74
MonitorElement * total
Definition: EmDQM.h:144
std::vector< bool > plotiso
Definition: EmDQM.h:72
std::vector< MonitorElement * > phihistisomatch
Definition: EmDQM.h:138
bool EmDQM::checkGeneratedParticlesRequirement ( const edm::Event event)
private

helper to check whether there were enough generator level electrons/photons (MC) or enough reco level electrons/photons to analyze this event.

Returns
if the event has enough of these candidates.

Definition at line 370 of file EmDQM.cc.

References abs, reco::LeafCandidate::et(), eta(), genParticleCandidates2GenParticles_cfi::genParticles, i, edm::HandleBase::isValid(), python.multivaluedict::sort(), and PFRecoTauDiscriminationAgainstMuon2_cfi::verbosity.

371 {
373  // Decide if this was an event of interest. //
374  // Did the highest energy particles happen //
375  // to have |eta| < 2.5 ? Then continue. //
378  event.getByLabel("genParticles", genParticles);
379  if(!genParticles.isValid()) {
380  if (verbosity >= OUTPUT_WARNINGS)
381  edm::LogWarning("EmDQM") << "genParticles invalid.";
382  return false;
383  }
384 
385  std::vector<reco::LeafCandidate> allSortedGenParticles;
386 
387  for(edm::View<reco::Candidate>::const_iterator currentGenParticle = genParticles->begin(); currentGenParticle != genParticles->end(); currentGenParticle++){
388 
389  // TODO: do we need to check the states here again ?
390  // in principle, there should collections produced with the python configuration
391  // (other than 'genParticles') which fulfill these criteria
392  if ( !( abs((*currentGenParticle).pdgId())==pdgGen && (*currentGenParticle).status()==1 && (*currentGenParticle).et() > 2.0) ) continue;
393 
394  reco::LeafCandidate tmpcand( *(currentGenParticle) );
395 
396  if (tmpcand.et() < plotEtMin) continue;
397 
398  allSortedGenParticles.push_back(tmpcand);
399  }
400 
401  std::sort(allSortedGenParticles.begin(), allSortedGenParticles.end(),pTGenComparator_);
402 
403  // return false if not enough particles found
404  if (allSortedGenParticles.size() < gencut_)
405  return false;
406 
407  // additional check (this might be legacy code and we need to check
408  // whether this should not be removed ?)
409 
410  // We now have a sorted collection of all generated particles
411  // with pdgId = pdgGen.
412  // Loop over them to see if the top gen particles have eta within acceptance
413  // bool keepEvent = true;
414  for (unsigned int i = 0 ; i < gencut_ ; i++ ) {
415  bool inECALgap = fabs(allSortedGenParticles[i].eta()) > 1.4442 && fabs(allSortedGenParticles[i].eta()) < 1.556;
416  if ( (fabs(allSortedGenParticles[i].eta()) > genEtaAcc) || inECALgap ) {
417  //edm::LogWarning("EmDQM") << "Throwing event away. Gen particle with pdgId="<< allSortedGenParticles[i].pdgId() <<"; et="<< allSortedGenParticles[i].et() <<"; and eta="<< allSortedGenParticles[i].eta() <<" beyond acceptance.";
418  return false;
419  }
420  }
421 
422  // all tests passed
423  return true;
424 }
int i
Definition: DBlmapReader.cc:9
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:81
int pdgGen
Definition: EmDQM.h:89
#define abs(x)
Definition: mlp_lapack.h:159
T eta() const
double plotEtMin
Definition: EmDQM.h:93
unsigned verbosity
Definition: EmDQM.h:77
GreaterByPt< reco::GenParticle > pTGenComparator_
Definition: EmDQM.h:157
unsigned int gencut_
Definition: EmDQM.h:111
static const unsigned OUTPUT_WARNINGS
Definition: EmDQM.h:81
bool isValid() const
Definition: HandleBase.h:76
double genEtaAcc
Definition: EmDQM.h:90
bool EmDQM::checkRecoParticlesRequirement ( const edm::Event event)
private

similar to checkGeneratedParticlesRequirement(..) but for reconstructed particles. For the moment, there are some additional requirements in the MC version so we can't use the same code for both cases.

Definition at line 427 of file EmDQM.cc.

References edm::HandleBase::isValid(), and PFRecoTauDiscriminationAgainstMuon2_cfi::verbosity.

428 {
429  // note that this code is very similar to the one in checkGeneratedParticlesRequirement(..)
430  // and hopefully can be merged with it at some point in the future
431 
432  edm::Handle< edm::View<reco::Candidate> > referenceParticles;
433  event.getByLabel(gencutCollection_,referenceParticles);
434  if(!referenceParticles.isValid()) {
435  if (verbosity >= OUTPUT_WARNINGS)
436  edm::LogWarning("EmDQM") << "referenceParticles invalid.";
437  return false;
438  }
439 
440  std::vector<const reco::Candidate *> allSortedReferenceParticles;
441 
442  for(edm::View<reco::Candidate>::const_iterator currentReferenceParticle = referenceParticles->begin();
443  currentReferenceParticle != referenceParticles->end();
444  currentReferenceParticle++)
445  {
446  if ( currentReferenceParticle->et() <= 2.0)
447  continue;
448 
449  // Note that for determining the overall efficiency,
450  // we should only allow
451  //
452  // HOWEVER: for turn-on curves, we need to let
453  // more electrons pass
454  if (currentReferenceParticle->et() < plotEtMin)
455  continue;
456 
457  // TODO: instead of filling a new vector we could simply count here...
458  allSortedReferenceParticles.push_back(&(*currentReferenceParticle));
459  }
460 
461  // std::sort(allSortedReferenceParticles.begin(), allSortedReferenceParticles.end(),pTComparator_);
462 
463  // return false if not enough particles found
464  return allSortedReferenceParticles.size() >= gencut_;
465 }
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:81
double plotEtMin
Definition: EmDQM.h:93
unsigned verbosity
Definition: EmDQM.h:77
unsigned int gencut_
Definition: EmDQM.h:111
static const unsigned OUTPUT_WARNINGS
Definition: EmDQM.h:81
edm::InputTag gencutCollection_
Definition: EmDQM.h:108
bool isValid() const
Definition: HandleBase.h:76
void EmDQM::endJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 852 of file EmDQM.cc.

853 {
854 
855 }
void EmDQM::endRun ( edm::Run const &  iRun,
edm::EventSetup const &  iSetup 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 813 of file EmDQM.cc.

References edm::InputTag::encode(), python.multivaluedict::sort(), GlobalPosition_Frontier_DevDB_cff::tag, and PFRecoTauDiscriminationAgainstMuon2_cfi::verbosity.

814 {
815  // print information about hltCollectionLabels which were not found
816  // (but only those which were never found)
817 
818  // check which ones were never found
819  std::vector<std::string> labelsNeverFound;
820 
821 
822  // for (std::set<edm::InputTag>::const_iterator it = hltCollectionLabelsMissed.begin(); it != hltCollectionLabelsMissed.end(); ++it)
823  BOOST_FOREACH(const edm::InputTag &tag, hltCollectionLabelsMissed)
824  {
825  if (hltCollectionLabelsFound.count(tag.encode()) == 0)
826  // never found
827  labelsNeverFound.push_back(tag.encode());
828 
829  } // loop over all tags which were missed at least once
830 
831  if (labelsNeverFound.empty())
832  return;
833 
834  std::sort(labelsNeverFound.begin(), labelsNeverFound.end());
835 
836  // there was at least one label which was never found
837  // (note that this could also be because the corresponding
838  // trigger path slowly fades out to zero efficiency)
839  if (verbosity >= OUTPUT_WARNINGS)
840  edm::LogWarning("EmDQM") << "There were some HLTCollectionLabels which were never found:";
841 
842  BOOST_FOREACH(const edm::InputTag &tag, labelsNeverFound)
843  {
844  if (verbosity >= OUTPUT_ALL)
845  edm::LogPrint("EmDQM") << " " << tag;
846  }
847 }
static const unsigned OUTPUT_ALL
Definition: EmDQM.h:82
std::set< std::string > hltCollectionLabelsFound
Definition: EmDQM.h:114
std::string encode() const
Definition: InputTag.cc:164
unsigned verbosity
Definition: EmDQM.h:77
static const unsigned OUTPUT_WARNINGS
Definition: EmDQM.h:81
std::set< std::string > hltCollectionLabelsMissed
Definition: EmDQM.h:117
template<class T >
void EmDQM::fillHistos ( edm::Handle< trigger::TriggerEventWithRefs > &  triggerObj,
const edm::Event iEvent,
unsigned int  n,
std::vector< reco::Particle > &  sortedGen,
bool &  accepted 
)
private

Definition at line 601 of file EmDQM.cc.

References asciidump::at, deltaR(), alcaDQMUpload::encode(), eta(), edm::Event::getByLabel(), i, edm::HandleBase::isValid(), j, n, phi, pileupDistInMC::total, trigger::TriggerL1IsoEG, trigger::TriggerL1NoIsoEG, and PFRecoTauDiscriminationAgainstMuon2_cfi::verbosity.

602 {
603  std::vector<edm::Ref<T> > recoecalcands;
604  if ( ( triggerObj->filterIndex(theHLTCollectionLabels[n])>=triggerObj->size() )){ // only process if available
606  accepted = false;
607  return;
608  }
609 
611 
613  // Retrieve saved filter objects //
615  triggerObj->getObjects(triggerObj->filterIndex(theHLTCollectionLabels[n]),theHLTOutputTypes[n],recoecalcands);
616  //Danger: special case, L1 non-isolated
617  // needs to be merged with L1 iso
619  std::vector<edm::Ref<T> > isocands;
620  triggerObj->getObjects(triggerObj->filterIndex(theHLTCollectionLabels[n]),trigger::TriggerL1IsoEG,isocands);
621  if (isocands.size()>0)
622  {
623  for (unsigned int i=0; i < isocands.size(); i++)
624  recoecalcands.push_back(isocands[i]);
625  }
626  } // END of if theHLTOutputTypes == 82
627 
628 
629  if (recoecalcands.size() < 1){ // stop if no object passed the previous filter
630  accepted = false;
631  return;
632  }
633 
634  //if (recoecalcands.size() >= reqNum )
635  if (recoecalcands.size() >= nCandCuts.at(n) && !mcMatchedOnly)
636  total->Fill(n+0.5);
637 
639  // check for validity //
640  // prevents crash in CMSSW_3_1_0_pre6 //
642  for (unsigned int j=0; j<recoecalcands.size(); j++){
643  if(!( recoecalcands.at(j).isAvailable())){
644  if (verbosity >= OUTPUT_ERRORS)
645  edm::LogError("EmDQMInvalidRefs") << "Event content inconsistent: TriggerEventWithRefs contains invalid Refs. Invalid refs for: " << theHLTCollectionLabels[n].label() << ". The collection that this module uses may has been dropped in the event.";
646  return;
647  }
648  }
649 
650  if (!mcMatchedOnly) {
652  // Loop over the Generated Particles, and find the //
653  // closest HLT object match. //
655  //for (unsigned int i=0; i < gencut_; i++) {
656  for (unsigned int i=0; i < nCandCuts.at(n); i++) {
657  math::XYZVector currentGenParticleMomentum = sortedGen[i].momentum();
658 
659  float closestDeltaR = 0.5;
660  int closestEcalCandIndex = -1;
661  for (unsigned int j=0; j<recoecalcands.size(); j++) {
662  float deltaR = DeltaR(recoecalcands[j]->momentum(),currentGenParticleMomentum);
663 
664  if (deltaR < closestDeltaR) {
665  closestDeltaR = deltaR;
666  closestEcalCandIndex = j;
667  }
668  }
669 
670  // If an HLT object was found within some delta-R
671  // of this gen particle, store it in a histogram
672  if ( closestEcalCandIndex >= 0 ) {
673  histEtOfHltObjMatchToGen[n] ->Fill( recoecalcands[closestEcalCandIndex]->et() );
674  histEtaOfHltObjMatchToGen[n]->Fill( recoecalcands[closestEcalCandIndex]->eta() );
675  if (!noPhiPlots) histPhiOfHltObjMatchToGen[n]->Fill( recoecalcands[closestEcalCandIndex]->phi() );
676 
677  // Also store isolation info
678  if (n+1 < numOfHLTCollectionLabels){ // can't plot beyond last
679  if (plotiso[n+1] ){ // only plot if requested in config
680  for (unsigned int j = 0 ; j < isoNames[n+1].size() ;j++ ){
682  iEvent.getByLabel(isoNames[n+1].at(j),depMap);
683  if (depMap.isValid()){ //Map may not exist if only one candidate passes a double filter
684  typename edm::AssociationMap<edm::OneToValue< T , float > >::const_iterator mapi = depMap->find(recoecalcands[closestEcalCandIndex]);
685  if (mapi!=depMap->end()) { // found candidate in isolation map!
686  histEtaIsoOfHltObjMatchToGen[n+1]->Fill( recoecalcands[closestEcalCandIndex]->eta(),mapi->val);
687  histPhiIsoOfHltObjMatchToGen[n+1]->Fill( recoecalcands[closestEcalCandIndex]->phi(),mapi->val);
688  histEtIsoOfHltObjMatchToGen[n+1] ->Fill( recoecalcands[closestEcalCandIndex]->et(), mapi->val);
689  }
690  }
691  }
692  }
693  }
694  } // END of if closestEcalCandIndex >= 0
695  }
696 
698  // Loop over all HLT objects in this filter step, and //
699  // fill histograms. //
701  // bool foundAllMatches = false;
702  // unsigned int numOfHLTobjectsMatched = 0;
703  for (unsigned int i=0; i<recoecalcands.size(); i++) {
705  //float closestGenParticleDr = 99.0;
706  //for(unsigned int j =0; j < gencut_; j++) {
707  // math::XYZVector currentGenParticle = sortedGen[j].momentum();
708 
709  // double currentDeltaR = DeltaR(recoecalcands[i]->momentum(),currentGenParticle);
710  // if ( currentDeltaR < closestGenParticleDr ) {
711  // closestGenParticleDr = currentDeltaR;
712  // }
713  //}
715  //if ( !(fabs(closestGenParticleDr < 0.3)) ) continue;
716 
717  //numOfHLTobjectsMatched++;
718  //if (numOfHLTobjectsMatched >= gencut_) foundAllMatches=true;
719 
720  // Fill HLT object histograms
721  ethist[n] ->Fill(recoecalcands[i]->et() );
722  etahist[n]->Fill(recoecalcands[i]->eta() );
723  if (!noPhiPlots) phihist[n]->Fill(recoecalcands[i]->phi() );
724 
726  // Plot isolation variables (show the not-yet-cut //
727  // isolation, i.e. associated to next filter) //
729  if ( n+1 < numOfHLTCollectionLabels ) { // can't plot beyond last
730  if (plotiso[n+1]) {
731  for (unsigned int j = 0 ; j < isoNames[n+1].size() ;j++ ){
733  iEvent.getByLabel(isoNames[n+1].at(j),depMap);
734  if (depMap.isValid()){ //Map may not exist if only one candidate passes a double filter
735  typename edm::AssociationMap<edm::OneToValue< T , float > >::const_iterator mapi = depMap->find(recoecalcands[i]);
736  if (mapi!=depMap->end()){ // found candidate in isolation map!
737  etahistiso[n+1]->Fill(recoecalcands[i]->eta(),mapi->val);
738  phihistiso[n+1]->Fill(recoecalcands[i]->phi(),mapi->val);
739  ethistiso[n+1]->Fill(recoecalcands[i]->et(),mapi->val);
740  }
741  }
742  }
743  }
744  } // END of if n+1 < then the number of hlt collections
745  }
746  }
747 
748 
750  // Fill mc matched objects into histograms //
752  unsigned int mtachedMcParts = 0;
753  float mindist=0.3;
754  if(n==0) mindist=0.5; //low L1-resolution => allow wider matching
755  for(unsigned int i =0; i < nCandCuts.at(n); ++i){
756  //match generator candidate
757  bool matchThis= false;
758  math::XYZVector candDir=sortedGen[i].momentum();
759  unsigned int closest = 0;
760  double closestDr = 1000.;
761  for(unsigned int trigOb = 0 ; trigOb < recoecalcands.size(); ++trigOb){
762  double dr = DeltaR(recoecalcands[trigOb]->momentum(),candDir);
763  if (dr < closestDr) {
764  closestDr = dr;
765  closest = trigOb;
766  }
767  if (closestDr > mindist) { // it's not really a "match" if it's that far away
768  closest = -1;
769  } else {
770  mtachedMcParts++;
771  matchThis = true;
772  }
773  }
774  if ( !matchThis ) {
775  accepted = false;
776  continue; // only plot matched candidates
777  }
778  // fill coordinates of mc particle matching trigger object
779  ethistmatch[n] ->Fill( sortedGen[i].et() );
780  if (sortedGen[i].et() > plotMinEtForEtaEffPlot) {
781  etahistmatch[n]->Fill( sortedGen[i].eta() );
782  if (!noPhiPlots) phihistmatch[n]->Fill( sortedGen[i].phi() );
783  }
785  // Plot isolation variables (show the not-yet-cut //
786  // isolation, i.e. associated to next filter) //
788  if (n+1 < numOfHLTCollectionLabels){ // can't plot beyond last
789  if (plotiso[n+1] ){ // only plot if requested in config
790  for (unsigned int j = 0 ; j < isoNames[n+1].size() ;j++ ){
792  iEvent.getByLabel(isoNames[n+1].at(j),depMap);
793  if (depMap.isValid()){ //Map may not exist if only one candidate passes a double filter
794  typename edm::AssociationMap<edm::OneToValue< T , float > >::const_iterator mapi = depMap->find(recoecalcands[closest]);
795  if (mapi!=depMap->end()){ // found candidate in isolation map!
796  // Only make efficiency plot using photons with some min Et
797  etahistisomatch[n+1]->Fill(sortedGen[i].eta(),mapi->val);
798  phihistisomatch[n+1]->Fill(sortedGen[i].phi(),mapi->val);
799  ethistisomatch[n+1]->Fill(sortedGen[i].et(),mapi->val);
800  }
801  }
802  }
803  }
804  } // END of if n+1 < then the number of hlt collections
805  }
806  // fill total mc matched efficiency
807 
808  if (mtachedMcParts >= nCandCuts.at(n) && accepted == true)
809  totalmatch->Fill(n+0.5);
810 }
int i
Definition: DBlmapReader.cc:9
std::vector< MonitorElement * > phihist
Definition: EmDQM.h:125
unsigned int numOfHLTCollectionLabels
Definition: EmDQM.h:64
Definition: deltaR.h:79
std::set< std::string > hltCollectionLabelsFound
Definition: EmDQM.h:114
std::vector< MonitorElement * > histPhiIsoOfHltObjMatchToGen
Definition: EmDQM.h:142
std::vector< MonitorElement * > ethistiso
Definition: EmDQM.h:136
T eta() const
std::vector< MonitorElement * > histEtaIsoOfHltObjMatchToGen
Definition: EmDQM.h:141
static const unsigned OUTPUT_ERRORS
Definition: EmDQM.h:80
unsigned verbosity
Definition: EmDQM.h:77
std::vector< std::vector< edm::InputTag > > isoNames
Definition: EmDQM.h:73
void Fill(long long x)
std::vector< edm::InputTag > theHLTCollectionLabels
Definition: EmDQM.h:63
std::vector< unsigned int > nCandCuts
Definition: EmDQM.h:75
std::vector< MonitorElement * > phihistmatch
Definition: EmDQM.h:128
unsigned int plotMinEtForEtaEffPlot
Definition: EmDQM.h:99
std::set< std::string > hltCollectionLabelsMissed
Definition: EmDQM.h:117
int j
Definition: DBlmapReader.cc:9
MonitorElement * totalmatch
Definition: EmDQM.h:145
bool noPhiPlots
Definition: EmDQM.h:67
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
std::vector< MonitorElement * > histEtaOfHltObjMatchToGen
Definition: EmDQM.h:131
bool mcMatchedOnly
Definition: EmDQM.h:66
std::vector< MonitorElement * > ethistisomatch
Definition: EmDQM.h:139
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
std::vector< MonitorElement * > ethist
Definition: EmDQM.h:126
std::vector< MonitorElement * > etahistmatch
Definition: EmDQM.h:127
std::vector< MonitorElement * > etahistiso
Definition: EmDQM.h:134
std::vector< MonitorElement * > histPhiOfHltObjMatchToGen
Definition: EmDQM.h:132
std::vector< MonitorElement * > ethistmatch
Definition: EmDQM.h:129
std::vector< MonitorElement * > phihistiso
Definition: EmDQM.h:135
std::vector< MonitorElement * > etahist
Definition: EmDQM.h:124
std::vector< MonitorElement * > histEtIsoOfHltObjMatchToGen
Definition: EmDQM.h:140
std::vector< MonitorElement * > etahistisomatch
Definition: EmDQM.h:137
std::vector< int > theHLTOutputTypes
Definition: EmDQM.h:71
std::vector< MonitorElement * > histEtOfHltObjMatchToGen
Definition: EmDQM.h:130
list at
Definition: asciidump.py:428
MonitorElement * total
Definition: EmDQM.h:144
std::vector< bool > plotiso
Definition: EmDQM.h:72
Definition: DDAxes.h:10
std::vector< MonitorElement * > phihistisomatch
Definition: EmDQM.h:138

Member Data Documentation

DQMStore* EmDQM::dbe
private

Definition at line 152 of file EmDQM.h.

std::string EmDQM::dirname_
private

Definition at line 153 of file EmDQM.h.

MonitorElement* EmDQM::etagen
private

Definition at line 148 of file EmDQM.h.

std::vector<MonitorElement*> EmDQM::etahist
private

Definition at line 124 of file EmDQM.h.

std::vector<MonitorElement*> EmDQM::etahistiso
private

Definition at line 134 of file EmDQM.h.

std::vector<MonitorElement*> EmDQM::etahistisomatch
private

Definition at line 137 of file EmDQM.h.

std::vector<MonitorElement*> EmDQM::etahistmatch
private

Definition at line 127 of file EmDQM.h.

MonitorElement* EmDQM::etgen
private

Definition at line 147 of file EmDQM.h.

std::vector<MonitorElement*> EmDQM::ethist
private

Definition at line 126 of file EmDQM.h.

std::vector<MonitorElement*> EmDQM::ethistiso
private

Definition at line 136 of file EmDQM.h.

std::vector<MonitorElement*> EmDQM::ethistisomatch
private

Definition at line 139 of file EmDQM.h.

std::vector<MonitorElement*> EmDQM::ethistmatch
private

Definition at line 129 of file EmDQM.h.

unsigned int EmDQM::gencut_
private

number of generator level particles (electrons/photons) required (for MC)

Definition at line 111 of file EmDQM.h.

edm::InputTag EmDQM::gencutCollection_
private

collection which should be used for generator particles (MC) or reconstructed particles (data).

This collection is used for matching the HLT objects against (e.g. match the HLT object to generated particles or reconstructed electrons/photons).

Definition at line 108 of file EmDQM.h.

double EmDQM::genEtaAcc
private

Definition at line 90 of file EmDQM.h.

double EmDQM::genEtAcc
private

Definition at line 91 of file EmDQM.h.

std::vector<MonitorElement*> EmDQM::histEtaIsoOfHltObjMatchToGen
private

Definition at line 141 of file EmDQM.h.

std::vector<MonitorElement*> EmDQM::histEtaOfHltObjMatchToGen
private

Definition at line 131 of file EmDQM.h.

std::vector<MonitorElement*> EmDQM::histEtIsoOfHltObjMatchToGen
private

Definition at line 140 of file EmDQM.h.

std::vector<MonitorElement*> EmDQM::histEtOfHltObjMatchToGen
private

Definition at line 130 of file EmDQM.h.

std::vector<MonitorElement*> EmDQM::histPhiIsoOfHltObjMatchToGen
private

Definition at line 142 of file EmDQM.h.

std::vector<MonitorElement*> EmDQM::histPhiOfHltObjMatchToGen
private

Definition at line 132 of file EmDQM.h.

std::set<std::string> EmDQM::hltCollectionLabelsFound
private

which hltCollectionLabels were SEEN at least once

Definition at line 114 of file EmDQM.h.

std::set<std::string> EmDQM::hltCollectionLabelsMissed
private

which hltCollectionLabels were MISSED at least once

Definition at line 117 of file EmDQM.h.

HLTConfigProvider EmDQM::hltConf_
private

The instance of the HLTConfigProvider as a data member.

Definition at line 58 of file EmDQM.h.

std::vector<std::vector<edm::InputTag> > EmDQM::isoNames
private

Definition at line 73 of file EmDQM.h.

bool EmDQM::mcMatchedOnly
private

Definition at line 66 of file EmDQM.h.

std::vector<unsigned int> EmDQM::nCandCuts
private

Definition at line 75 of file EmDQM.h.

bool EmDQM::noIsolationPlots
private

Definition at line 68 of file EmDQM.h.

bool EmDQM::noPhiPlots
private

Definition at line 67 of file EmDQM.h.

unsigned int EmDQM::numOfHLTCollectionLabels
private

Definition at line 64 of file EmDQM.h.

const unsigned EmDQM::OUTPUT_ALL = 3
staticprivate

Definition at line 82 of file EmDQM.h.

const unsigned EmDQM::OUTPUT_ERRORS = 1
staticprivate

Definition at line 80 of file EmDQM.h.

const unsigned EmDQM::OUTPUT_SILENT = 0
staticprivate

Definition at line 79 of file EmDQM.h.

const unsigned EmDQM::OUTPUT_WARNINGS = 2
staticprivate

Definition at line 81 of file EmDQM.h.

unsigned int EmDQM::pathIndex
private

Definition at line 62 of file EmDQM.h.

int EmDQM::pdgGen
private

Definition at line 89 of file EmDQM.h.

MonitorElement* EmDQM::phigen
private

Definition at line 149 of file EmDQM.h.

std::vector<MonitorElement*> EmDQM::phihist
private

Definition at line 125 of file EmDQM.h.

std::vector<MonitorElement*> EmDQM::phihistiso
private

Definition at line 135 of file EmDQM.h.

std::vector<MonitorElement*> EmDQM::phihistisomatch
private

Definition at line 138 of file EmDQM.h.

std::vector<MonitorElement*> EmDQM::phihistmatch
private

Definition at line 128 of file EmDQM.h.

unsigned int EmDQM::plotBins
private

Definition at line 98 of file EmDQM.h.

std::vector<std::pair<double,double> > EmDQM::plotBounds
private

Definition at line 74 of file EmDQM.h.

double EmDQM::plotEtaMax
private

Definition at line 94 of file EmDQM.h.

double EmDQM::plotEtMin
private

Definition at line 93 of file EmDQM.h.

std::vector<bool> EmDQM::plotiso
private

Definition at line 72 of file EmDQM.h.

unsigned int EmDQM::plotMinEtForEtaEffPlot
private

Definition at line 99 of file EmDQM.h.

double EmDQM::plotPhiMax
private

Definition at line 95 of file EmDQM.h.

double EmDQM::plotPtMax
private

Definition at line 97 of file EmDQM.h.

double EmDQM::plotPtMin
private

Definition at line 96 of file EmDQM.h.

GreaterByPt<reco::Particle> EmDQM::pTComparator_
private

Definition at line 156 of file EmDQM.h.

GreaterByPt<reco::GenParticle> EmDQM::pTGenComparator_
private

Definition at line 157 of file EmDQM.h.

unsigned int EmDQM::reqNum
private

Definition at line 88 of file EmDQM.h.

std::vector<std::string> EmDQM::theHLTCollectionHumanNames
private

Definition at line 69 of file EmDQM.h.

std::vector<edm::InputTag> EmDQM::theHLTCollectionLabels
private

Definition at line 63 of file EmDQM.h.

std::string EmDQM::theHltName
private

Definition at line 76 of file EmDQM.h.

std::vector<int> EmDQM::theHLTOutputTypes
private

Definition at line 71 of file EmDQM.h.

edm::InputTag EmDQM::theL1Seed
private

Definition at line 70 of file EmDQM.h.

MonitorElement* EmDQM::total
private

Definition at line 144 of file EmDQM.h.

MonitorElement* EmDQM::totalmatch
private

Definition at line 145 of file EmDQM.h.

edm::InputTag EmDQM::triggerobjwithrefs
private

Definition at line 61 of file EmDQM.h.

bool EmDQM::useHumanReadableHistTitles
private

Definition at line 65 of file EmDQM.h.

unsigned EmDQM::verbosity
private

Definition at line 77 of file EmDQM.h.