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
HLTMonElectron Class Reference

#include <DQM/HLTMonElectron/src/HLTMonElectron.cc>

Inheritance diagram for HLTMonElectron:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 HLTMonElectron (const edm::ParameterSet &)
 
 ~HLTMonElectron ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob ()
 
virtual void endJob ()
 
template<class T >
void fillHistos (edm::Handle< trigger::TriggerEventWithRefs > &, const edm::Event &, unsigned int)
 

Private Attributes

DQMStoredbe
 
std::string dirname_
 
std::vector< MonitorElement * > etahist
 
std::vector< MonitorElement * > etahistiso
 
std::vector< MonitorElement * > ethist
 
std::vector< MonitorElement * > ethistiso
 
std::vector< std::vector
< edm::InputTag > > 
isoNames
 
std::ofstream logFile_
 
bool monitorDaemon_
 
int nev_
 
std::string outputFile_
 
std::vector< MonitorElement * > phihist
 
std::vector< MonitorElement * > phihistiso
 
std::vector< std::pair< double,
double > > 
plotBounds
 
std::vector< bool > plotiso
 
unsigned int reqNum
 
std::vector< edm::InputTagtheHLTCollectionLabels
 
int theHLTOutputType
 
std::vector< int > theHLTOutputTypes
 
unsigned int theNbins
 
double thePtMax
 
double thePtMin
 
MonitorElementtotal
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- 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::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

Description: This is a DQM source meant to be an example for general development of HLT DQM code. Based on the general structure used for L1TMonitor DQM sources.

Implementation: <Notes on="" implementation>="">

Definition at line 50 of file HLTMonElectron.h.

Constructor & Destructor Documentation

HLTMonElectron::HLTMonElectron ( const edm::ParameterSet iConfig)
explicit

Definition at line 26 of file HLTMonElectron.cc.

References filters, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), LogDebug, NULL, cppFunctionSkipper::operator, and AlCaHLTBitMon_QueryRunRegistry::string.

27 {
28 
29  LogDebug("HLTMonElectron") << "constructor...." ;
30 
31  logFile_.open("HLTMonElectron.log");
32 
33  dbe = NULL;
34  if (iConfig.getUntrackedParameter < bool > ("DQMStore", false)) {
36  dbe->setVerbose(0);
37  }
38 
39  outputFile_ =
40  iConfig.getUntrackedParameter < std::string > ("outputFile", "");
41  if (outputFile_.size() != 0) {
42  LogInfo("HLTMonElectron") << "L1T Monitoring histograms will be saved to "
43  << outputFile_ ;
44  }
45  else {
46  outputFile_ = "L1TDQM.root";
47  }
48 
49  bool disable =
50  iConfig.getUntrackedParameter < bool > ("disableROOToutput", false);
51  if (disable) {
52  outputFile_ = "";
53  }
54 
55  dirname_="HLT/HLTMonElectron/"+iConfig.getParameter<std::string>("@module_label");
56 
57  if (dbe != NULL) {
59  }
60 
61 
62  //plotting paramters
63  thePtMin = iConfig.getUntrackedParameter<double>("PtMin",0.);
64  thePtMax = iConfig.getUntrackedParameter<double>("PtMax",1000.);
65  theNbins = iConfig.getUntrackedParameter<unsigned int>("Nbins",40);
66 
67  //info for each filter-step
68  reqNum = iConfig.getParameter<unsigned int>("reqNum");
69  std::vector<edm::ParameterSet> filters = iConfig.getParameter<std::vector<edm::ParameterSet> >("filters");
70 
71  for(std::vector<edm::ParameterSet>::iterator filterconf = filters.begin() ; filterconf != filters.end() ; filterconf++){
72  theHLTCollectionLabels.push_back(filterconf->getParameter<edm::InputTag>("HLTCollectionLabels"));
73  theHLTOutputTypes.push_back(filterconf->getParameter<unsigned int>("theHLTOutputTypes"));
74  std::vector<double> bounds = filterconf->getParameter<std::vector<double> >("PlotBounds");
75  assert(bounds.size() == 2);
76  plotBounds.push_back(std::pair<double,double>(bounds[0],bounds[1]));
77  isoNames.push_back(filterconf->getParameter<std::vector<edm::InputTag> >("IsoCollections"));
78  assert(isoNames.back().size()>0);
79  if (isoNames.back().at(0).label()=="none")
80  plotiso.push_back(false);
81  else{
82  plotiso.push_back(true);
83  }
84  }
85 
86 }
#define LogDebug(id)
std::string dirname_
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::vector< std::vector< edm::InputTag > > isoNames
#define NULL
Definition: scimark2.h:8
DQMStore * dbe
std::vector< TPRegexp > filters
Definition: eve_filter.cc:25
std::vector< bool > plotiso
unsigned int reqNum
std::vector< int > theHLTOutputTypes
unsigned int theNbins
std::string outputFile_
void setVerbose(unsigned level)
Definition: DQMStore.cc:631
std::vector< std::pair< double, double > > plotBounds
std::vector< edm::InputTag > theHLTCollectionLabels
std::ofstream logFile_
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:667
HLTMonElectron::~HLTMonElectron ( )

Definition at line 89 of file HLTMonElectron.cc.

90 {
91 
92  // do anything here that needs to be done at desctruction time
93  // (e.g. close files, deallocate resources etc.)
94 
95 }

Member Function Documentation

void HLTMonElectron::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDAnalyzer.

Definition at line 104 of file HLTMonElectron.cc.

References edm::Event::getByLabel(), iEvent, LogDebug, n, and pileupDistInMC::total.

105 {
106  using namespace edm;
107  using namespace trigger;
108  nev_++;
109  LogDebug("HLTMonElectron")<< "HLTMonElectron: analyze...." ;
110 
111 
113  iEvent.getByLabel("hltTriggerSummaryRAW",triggerObj);
114  if(!triggerObj.isValid()) {
115  edm::LogWarning("HLTMonElectron") << "RAW-type HLT results not found, skipping event";
116  return;
117  }
118 
119  // total event number
120  total->Fill(theHLTCollectionLabels.size()+0.5);
121 
122 
123  for(unsigned int n=0; n < theHLTCollectionLabels.size() ; n++) { //loop over filter modules
124  switch(theHLTOutputTypes[n]){
125  case 82: // non-iso L1
126  fillHistos<l1extra::L1EmParticleCollection>(triggerObj,iEvent,n);break;
127  case 83: // iso L1
128  fillHistos<l1extra::L1EmParticleCollection>(triggerObj,iEvent,n);break;
129  case 91: //photon
130  fillHistos<reco::RecoEcalCandidateCollection>(triggerObj,iEvent,n);break;
131  case 92: //electron
132  fillHistos<reco::ElectronCollection>(triggerObj,iEvent,n);break;
133  case 100: // TriggerCluster
134  fillHistos<reco::RecoEcalCandidateCollection>(triggerObj,iEvent,n);break;
135  default: throw(cms::Exception("Release Validation Error")<< "HLT output type not implemented: theHLTOutputTypes[n]" );
136  }
137  }
138 }
#define LogDebug(id)
void Fill(long long x)
MonitorElement * total
int iEvent
Definition: GenABIO.cc:230
std::vector< int > theHLTOutputTypes
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
std::vector< edm::InputTag > theHLTCollectionLabels
void HLTMonElectron::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 191 of file HLTMonElectron.cc.

References DQMStore::book1D(), DQMStore::book2D(), i, diffTwoXMLs::label, NULL, cppFunctionSkipper::operator, DQMStore::rmdir(), DQMStore::setCurrentFolder(), AlCaHLTBitMon_QueryRunRegistry::string, and pileupDistInMC::total.

192 {
193  nev_ = 0;
194  DQMStore *dbe = 0;
195  dbe = Service < DQMStore > ().operator->();
196 
197  if (dbe) {
199  dbe->rmdir(dirname_);
200  }
201 
202 
203  if (dbe) {
205 
206  std::string histoname="total eff";
207  MonitorElement* tmphisto;
208 
209 
210  total = dbe->book1D(histoname.c_str(),histoname.c_str(),theHLTCollectionLabels.size()+1,0,theHLTCollectionLabels.size()+1);
211  total->setBinLabel(theHLTCollectionLabels.size()+1,"Total",1);
212  for (unsigned int u=0; u<theHLTCollectionLabels.size(); u++){total->setBinLabel(u+1,theHLTCollectionLabels[u].label().c_str());}
213 
214 
215  for(unsigned int i = 0; i< theHLTCollectionLabels.size() ; i++){
216  histoname = theHLTCollectionLabels[i].label()+"et";
217  tmphisto = dbe->book1D(histoname.c_str(),histoname.c_str(),theNbins,thePtMin,thePtMax);
218  ethist.push_back(tmphisto);
219 
220  histoname = theHLTCollectionLabels[i].label()+"eta";
221  tmphisto = dbe->book1D(histoname.c_str(),histoname.c_str(),theNbins,-2.7,2.7);
222  etahist.push_back(tmphisto);
223 
224  histoname = theHLTCollectionLabels[i].label()+"phi";
225  tmphisto = dbe->book1D(histoname.c_str(),histoname.c_str(),theNbins,-3.2,3.2);
226  phihist.push_back(tmphisto);
227 
228  if(plotiso[i]){
229  histoname = theHLTCollectionLabels[i].label()+"eta isolation";
230  tmphisto = dbe->book2D(histoname.c_str(),histoname.c_str(),theNbins,-2.7,2.7,theNbins,plotBounds[i].first,plotBounds[i].second);
231  }
232  else{
233  tmphisto = NULL;
234  }
235  etahistiso.push_back(tmphisto);
236 
237  if(plotiso[i]){
238  histoname = theHLTCollectionLabels[i].label()+"phi isolation";
239  tmphisto = dbe->book2D(histoname.c_str(),histoname.c_str(),theNbins,-3.2,3.2,theNbins,plotBounds[i].first,plotBounds[i].second);
240  }
241  else{
242  tmphisto = NULL;
243  }
244  phihistiso.push_back(tmphisto);
245 
246  if(plotiso[i]){
247  histoname = theHLTCollectionLabels[i].label()+"et isolation";
248  tmphisto = dbe->book2D(histoname.c_str(),histoname.c_str(),theNbins,thePtMin,thePtMax,theNbins,plotBounds[i].first,plotBounds[i].second);
249  }
250  else{
251  tmphisto = NULL;
252  }
253  ethistiso.push_back(tmphisto);
254 
255 
256  }
257  } // end "if(dbe)"
258 }
std::string dirname_
int i
Definition: DBlmapReader.cc:9
std::vector< MonitorElement * > phihist
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:954
void rmdir(const std::string &fullpath)
Definition: DQMStore.cc:3101
std::vector< MonitorElement * > ethistiso
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)
#define NULL
Definition: scimark2.h:8
DQMStore * dbe
std::vector< bool > plotiso
MonitorElement * total
unsigned int theNbins
std::vector< MonitorElement * > etahist
std::vector< std::pair< double, double > > plotBounds
std::vector< edm::InputTag > theHLTCollectionLabels
std::vector< MonitorElement * > ethist
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:1082
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:667
std::vector< MonitorElement * > phihistiso
std::vector< MonitorElement * > etahistiso
void HLTMonElectron::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 262 of file HLTMonElectron.cc.

262  {
263 
264 // std::cout << "HLTMonElectron: end job...." << std::endl;
265  LogInfo("HLTMonElectron") << "analyzed " << nev_ << " events";
266 
267  if (outputFile_.size() != 0 && dbe)
268  dbe->save(outputFile_);
269 
270  return;
271 }
DQMStore * dbe
std::string outputFile_
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, const uint32_t lumi=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE", const bool resetMEsAfterWriting=false)
Definition: DQMStore.cc:2540
template<class T >
void HLTMonElectron::fillHistos ( edm::Handle< trigger::TriggerEventWithRefs > &  triggerObj,
const edm::Event iEvent,
unsigned int  n 
)
private

Definition at line 140 of file HLTMonElectron.cc.

References asciidump::at, eta(), edm::Event::getByLabel(), i, j, diffTwoXMLs::label, n, phi, and pileupDistInMC::total.

140  {
141 
142  std::vector<edm::Ref<T> > recoecalcands;
143  if (!( triggerObj->filterIndex(theHLTCollectionLabels[n])>=triggerObj->size() )){ // only process if availabel
144 
145  // retrieve saved filter objects
146  triggerObj->getObjects(triggerObj->filterIndex(theHLTCollectionLabels[n]),theHLTOutputTypes[n],recoecalcands);
147  //Danger: special case, L1 non-isolated
148  // needs to be merged with L1 iso
149  if(theHLTOutputTypes[n]==82){
150  std::vector<edm::Ref<T> > isocands;
151  triggerObj->getObjects(triggerObj->filterIndex(theHLTCollectionLabels[n]),83,isocands);
152  if(isocands.size()>0)
153  for(unsigned int i=0; i < isocands.size(); i++)
154  recoecalcands.push_back(isocands[i]);
155  }
156 
157 
158  //fill filter objects into histos
159  if (recoecalcands.size()!=0){
160  if(recoecalcands.size() >= reqNum )
161  total->Fill(n+0.5);
162  for (unsigned int i=0; i<recoecalcands.size(); i++) {
163  //unmatched
164  ethist[n]->Fill(recoecalcands[i]->et() );
165  phihist[n]->Fill(recoecalcands[i]->phi() );
166  etahist[n]->Fill(recoecalcands[i]->eta() );
167 
168 
169  //plot isolation variables (show not yet cut iso, i.e. associated to next filter)
170  if(n+1 < theHLTCollectionLabels.size()){ // can't plot beyond last
171  if(plotiso[n+1]){
172  for(unsigned int j = 0 ; j < isoNames[n+1].size() ;j++ ){
174  iEvent.getByLabel(isoNames[n+1].at(j).label(),depMap);
175  typename edm::AssociationMap<edm::OneToValue< T , float > >::const_iterator mapi = depMap->find(recoecalcands[i]);
176  if(mapi!=depMap->end()){ // found candidate in isolation map!
177  etahistiso[n+1]->Fill(recoecalcands[i]->eta(),mapi->val);
178  phihistiso[n+1]->Fill(recoecalcands[i]->phi(),mapi->val);
179  ethistiso[n+1]->Fill(recoecalcands[i]->et(),mapi->val);
180  break; // to avoid multiple filling we only look until we found the candidate once.
181  }
182  }
183  }
184  }
185  }
186  }
187  }
188 }
int i
Definition: DBlmapReader.cc:9
std::vector< MonitorElement * > phihist
std::vector< MonitorElement * > ethistiso
std::vector< std::vector< edm::InputTag > > isoNames
T eta() const
std::vector< bool > plotiso
void Fill(long long x)
MonitorElement * total
unsigned int reqNum
std::vector< int > theHLTOutputTypes
int j
Definition: DBlmapReader.cc:9
std::vector< MonitorElement * > etahist
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
std::vector< edm::InputTag > theHLTCollectionLabels
std::vector< MonitorElement * > ethist
std::vector< MonitorElement * > phihistiso
list at
Definition: asciidump.py:428
std::vector< MonitorElement * > etahistiso
Definition: DDAxes.h:10

Member Data Documentation

DQMStore* HLTMonElectron::dbe
private

Definition at line 64 of file HLTMonElectron.h.

std::string HLTMonElectron::dirname_
private

Definition at line 83 of file HLTMonElectron.h.

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

Definition at line 65 of file HLTMonElectron.h.

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

Definition at line 68 of file HLTMonElectron.h.

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

Definition at line 67 of file HLTMonElectron.h.

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

Definition at line 70 of file HLTMonElectron.h.

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

Definition at line 75 of file HLTMonElectron.h.

std::ofstream HLTMonElectron::logFile_
private

Definition at line 85 of file HLTMonElectron.h.

bool HLTMonElectron::monitorDaemon_
private

Definition at line 84 of file HLTMonElectron.h.

int HLTMonElectron::nev_
private

Definition at line 63 of file HLTMonElectron.h.

std::string HLTMonElectron::outputFile_
private

Definition at line 87 of file HLTMonElectron.h.

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

Definition at line 66 of file HLTMonElectron.h.

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

Definition at line 69 of file HLTMonElectron.h.

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

Definition at line 76 of file HLTMonElectron.h.

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

Definition at line 74 of file HLTMonElectron.h.

unsigned int HLTMonElectron::reqNum
private

Definition at line 77 of file HLTMonElectron.h.

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

Definition at line 72 of file HLTMonElectron.h.

int HLTMonElectron::theHLTOutputType
private

Definition at line 86 of file HLTMonElectron.h.

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

Definition at line 73 of file HLTMonElectron.h.

unsigned int HLTMonElectron::theNbins
private

Definition at line 81 of file HLTMonElectron.h.

double HLTMonElectron::thePtMax
private

Definition at line 80 of file HLTMonElectron.h.

double HLTMonElectron::thePtMin
private

Definition at line 79 of file HLTMonElectron.h.

MonitorElement* HLTMonElectron::total
private

Definition at line 71 of file HLTMonElectron.h.