test
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
HLTMonElectronConsumer Class Reference

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

Inheritance diagram for HLTMonElectronConsumer:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 HLTMonElectronConsumer (const edm::ParameterSet &)
 
 ~HLTMonElectronConsumer ()
 
- 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 ()
 

Private Attributes

DQMStoredbe
 
std::string dirname_
 
MonitorElementisocheck
 
std::string isodirname_
 
edm::InputTag isotag_
 
MonitorElementisototal
 
std::ofstream logFile_
 
bool monitorDaemon_
 
std::string outputFile_
 
std::string pixeldirname_
 
MonitorElementpixelEff
 
MonitorElementpixelhistosEt [4]
 
MonitorElementpixelhistosEta [4]
 
MonitorElementpixelhistosEtaOut [2]
 
MonitorElementpixelhistosEtOut [2]
 
MonitorElementpixelhistosPhi [4]
 
MonitorElementpixelhistosPhiOut [2]
 
edm::InputTag pixeltag_
 
MonitorElementpixeltotal
 
MonitorElementtrackEff
 

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 HLTMonElectronConsumer.h.

Constructor & Destructor Documentation

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

Definition at line 14 of file HLTMonElectronConsumer.cc.

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

15 {
16 
17  LogDebug("HLTMonElectronConsumer") << "constructor...." ;
18 
19  logFile_.open("HLTMonElectronConsumer.log");
20 
21  dbe = NULL;
22  if (iConfig.getUntrackedParameter < bool > ("DQMStore", false)) {
24  dbe->setVerbose(0);
25  }
26 
27  outputFile_ =
28  iConfig.getUntrackedParameter <std::string>("outputFile", "");
29  if (outputFile_.size() != 0) {
30  LogInfo("HLTMonElectronConsumer") << "L1T Monitoring histograms will be saved to "
31  << outputFile_ ;
32  }
33  else {
34  outputFile_ = "L1TDQM.root";
35  }
36 
37  bool disable =
38  iConfig.getUntrackedParameter < bool > ("disableROOToutput", false);
39  if (disable) {
40  outputFile_ = "";
41  }
42 
43  pixeltag_=iConfig.getParameter<edm::InputTag>("PixelTag");
44  isotag_=iConfig.getParameter<edm::InputTag>("IsoTag");
45 
46  dirname_="HLT/HLTMonElectron/"+iConfig.getParameter<std::string>("@module_label");
47  pixeldirname_="HLT/HLTMonElectron/"+pixeltag_.label();
48  isodirname_="HLT/HLTMonElectron/"+isotag_.label();
49 
50  if (dbe != NULL) {
51  dbe->setCurrentFolder(dirname_);
52  }
53 
54 }
#define LogDebug(id)
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
#define NULL
Definition: scimark2.h:8
void setVerbose(unsigned level)
Definition: DQMStore.cc:631
std::string const & label() const
Definition: InputTag.h:42
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:667
HLTMonElectronConsumer::~HLTMonElectronConsumer ( )

Definition at line 57 of file HLTMonElectronConsumer.cc.

58 {
59 
60  // do anything here that needs to be done at desctruction time
61  // (e.g. close files, deallocate resources etc.)
62 
63 }

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 72 of file HLTMonElectronConsumer.cc.

References i, j, NULL, and pileupDistInMC::num.

73 {
74  //total pixelmatch efficiencies from summary histo
75  if(pixeltotal!=NULL){
76  LogInfo("HLTMonElectronConsumer") << " pixelhisto " << pixeltotal->getBinContent(1);
77  if(pixeltotal->getBinContent(1)!=0)
79  else
80  pixelEff->Fill(0.);
81 
82  if(pixeltotal->getBinContent(3)!=0)
84  else
85  trackEff->Fill(0.);
86 
87  // efficiency as kinematic function
88  for(int i =0; i<2 ;i++){
89  TH1F* num;
90  TH1F* denom;
91  num=pixelhistosEt[2*i+1]->getTH1F();
92  denom=pixelhistosEt[2*i]->getTH1F();
93  for(int j=1; j <= pixelhistosEtOut[i]->getNbinsX();j++ ){
94  if(denom->GetBinContent(j)!=0)
95  pixelhistosEtOut[i]->setBinContent(j,num->GetBinContent(j)/denom->GetBinContent(j));
96  else
98  }
99  num=pixelhistosEta[2*i+1]->getTH1F();
100  denom=pixelhistosEta[2*i]->getTH1F();
101  for(int j=1; j <= pixelhistosEtaOut[i]->getNbinsX();j++ ){
102  if(denom->GetBinContent(j)!=0)
103  pixelhistosEtaOut[i]->setBinContent(j,num->GetBinContent(j)/denom->GetBinContent(j));
104  else
106  }
107  num=pixelhistosPhi[2*i+1]->getTH1F();
108  denom=pixelhistosPhi[2*i]->getTH1F();
109  for(int j=1; j <= pixelhistosPhiOut[i]->getNbinsX();j++ ){
110  if(denom->GetBinContent(j)!=0)
111  pixelhistosPhiOut[i]->setBinContent(j,num->GetBinContent(j)/denom->GetBinContent(j));
112  else
114  }
115  }
116  }else
117  LogInfo("HLTMonElectronConsumer") << " empty pixelhisto " ;
118 
119  if(isototal!=NULL){
120  TH1F* refhist = isototal->getTH1F();
121  for(int i =1; i<= refhist->GetNbinsX();i++){
122  if(refhist->GetMaximum(i)!=0)
123  isocheck->setBinContent(i,refhist->GetBinContent(i)/refhist->GetMaximum());
124  else
125  isocheck->setBinContent(i,0.);
126  }
127  }else
128  LogInfo("HLTMonElectronConsumer") << " empty isohisto " ;
129 
130 
131 
132 }
int i
Definition: DBlmapReader.cc:9
void setBinContent(int binx, double content)
set content of bin (1-D)
MonitorElement * pixelhistosEta[4]
#define NULL
Definition: scimark2.h:8
MonitorElement * pixelhistosEtOut[2]
void Fill(long long x)
MonitorElement * pixelhistosPhiOut[2]
MonitorElement * pixelhistosPhi[4]
MonitorElement * pixelhistosEtaOut[2]
MonitorElement * pixelhistosEt[4]
int j
Definition: DBlmapReader.cc:9
TH1F * getTH1F(void) const
double getBinContent(int binx) const
get content of bin (1-D)
int getNbinsX(void) const
get # of bins in X-axis
void HLTMonElectronConsumer::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 137 of file HLTMonElectronConsumer.cc.

References DQMStore::book1D(), DQMStore::bookFloat(), DQMStore::get(), MonitorElement::getTH1F(), i, cppFunctionSkipper::operator, DQMStore::rmdir(), DQMStore::setCurrentFolder(), and AlCaHLTBitMon_QueryRunRegistry::string.

138 {
139 
140  DQMStore *dbe = 0;
141  dbe = Service < DQMStore > ().operator->();
142 
143  if (dbe) {
145  dbe->rmdir(dirname_);
146  }
147 
148 
149  if (dbe) {
151 
152 
153  // load pixel MEs
154  std::string tmpname = pixeldirname_ + "/total eff";
155  LogInfo("HLTMonElectronConsumer") << " reading histo: " << tmpname;
156  pixeltotal=dbe->get(tmpname);
157  TH1F* refhist;
158  if(pixeltotal!=0){
159  for(int i = 0; i<4; i++){
160  LogInfo("HLTMonElectronConsumer") << "loop iteration: "<<i ;
161  refhist=pixeltotal->getTH1F();
162  LogInfo("HLTMonElectronConsumer") << "retrieving: " << pixeldirname_ + "/" + refhist->GetXaxis()->GetBinLabel(i+1) + "eta";
163  tmpname = pixeldirname_ + "/" + refhist->GetXaxis()->GetBinLabel(i+1) + "eta";
164  pixelhistosEta[i]=dbe->get(tmpname);
165  tmpname = pixeldirname_ + "/" + refhist->GetXaxis()->GetBinLabel(i+1) + "et";
166  pixelhistosEt[i]=dbe->get(tmpname);
167  tmpname = pixeldirname_ + "/" + refhist->GetXaxis()->GetBinLabel(i+1) + "phi";
168  pixelhistosPhi[i]=dbe->get(tmpname);
169  }
170  LogInfo("HLTMonElectronConsumer") << "Et ";
171  refhist = pixelhistosEt[0]->getTH1F();
172  pixelhistosEtOut[0] =dbe->book1D("pixel eff et","pixel eff et",refhist->GetNbinsX(),refhist->GetXaxis()->GetXmin(),refhist->GetXaxis()->GetXmax());
173  pixelhistosEtOut[1] =dbe->book1D("track eff et","track eff et",refhist->GetNbinsX(),refhist->GetXaxis()->GetXmin(),refhist->GetXaxis()->GetXmax());
174  LogInfo("HLTMonElectronConsumer") << "Eta ";
175  refhist = pixelhistosEta[0]->getTH1F();
176  pixelhistosEtaOut[0] =dbe->book1D("pixel eff eta","pixel eff eta",refhist->GetNbinsX(),refhist->GetXaxis()->GetXmin(),refhist->GetXaxis()->GetXmax());
177  pixelhistosEtaOut[1] =dbe->book1D("track eff eta","track eff eta",refhist->GetNbinsX(),refhist->GetXaxis()->GetXmin(),refhist->GetXaxis()->GetXmax());
178  LogInfo("HLTMonElectronConsumer") << "Phi ";
179  refhist = pixelhistosPhi[0]->getTH1F();
180  pixelhistosPhiOut[0] =dbe->book1D("pixel eff phi","pixel eff phi",refhist->GetNbinsX(),refhist->GetXaxis()->GetXmin(),refhist->GetXaxis()->GetXmax());
181  pixelhistosPhiOut[1] =dbe->book1D("track eff phi","track eff phi",refhist->GetNbinsX(),refhist->GetXaxis()->GetXmin(),refhist->GetXaxis()->GetXmax());
182  }else
183  LogInfo("HLTMonElectronConsumer") << "pixelhisto doesn't exist during beginJob" ;
184 
185  pixelEff=dbe->bookFloat("total pixelmatch");
186  trackEff=dbe->bookFloat("total trackmatch");
187 
188  LogInfo("HLTMonElectronConsumer") << "writing: " << pixelEff->getPathname();
189 
190 
191  tmpname = isodirname_ + "/total eff";
192  LogInfo("HLTMonElectronConsumer") << " reading histo: " << tmpname;
193  isototal=dbe->get(tmpname);
194  refhist = isototal->getTH1F();
195  isocheck = dbe->book1D("consistency check","consistency check",refhist->GetNbinsX(),refhist->GetXaxis()->GetXmin(),refhist->GetXaxis()->GetXmax());
196 
197 
198  } // end "if(dbe)"
199 }
int i
Definition: DBlmapReader.cc:9
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
MonitorElement * pixelhistosEta[4]
MonitorElement * pixelhistosEtOut[2]
MonitorElement * bookFloat(const char *name)
Book float.
Definition: DQMStore.cc:891
MonitorElement * pixelhistosPhiOut[2]
MonitorElement * pixelhistosPhi[4]
MonitorElement * pixelhistosEtaOut[2]
MonitorElement * pixelhistosEt[4]
const std::string & getPathname(void) const
get pathname of parent folder
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1708
TH1F * getTH1F(void) const
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:667
void HLTMonElectronConsumer::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 203 of file HLTMonElectronConsumer.cc.

203  {
204 
205 // std::cout << "HLTMonElectronConsumer: end job...." << std::endl;
206 
207  if (outputFile_.size() != 0 && dbe)
208  dbe->save(outputFile_);
209 
210  return;
211 }
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

Member Data Documentation

DQMStore* HLTMonElectronConsumer::dbe
private

Definition at line 63 of file HLTMonElectronConsumer.h.

std::string HLTMonElectronConsumer::dirname_
private

Definition at line 80 of file HLTMonElectronConsumer.h.

MonitorElement* HLTMonElectronConsumer::isocheck
private

Definition at line 69 of file HLTMonElectronConsumer.h.

std::string HLTMonElectronConsumer::isodirname_
private

Definition at line 82 of file HLTMonElectronConsumer.h.

edm::InputTag HLTMonElectronConsumer::isotag_
private

Definition at line 66 of file HLTMonElectronConsumer.h.

MonitorElement* HLTMonElectronConsumer::isototal
private

Definition at line 68 of file HLTMonElectronConsumer.h.

std::ofstream HLTMonElectronConsumer::logFile_
private

Definition at line 84 of file HLTMonElectronConsumer.h.

bool HLTMonElectronConsumer::monitorDaemon_
private

Definition at line 83 of file HLTMonElectronConsumer.h.

std::string HLTMonElectronConsumer::outputFile_
private

Definition at line 85 of file HLTMonElectronConsumer.h.

std::string HLTMonElectronConsumer::pixeldirname_
private

Definition at line 81 of file HLTMonElectronConsumer.h.

MonitorElement* HLTMonElectronConsumer::pixelEff
private

Definition at line 77 of file HLTMonElectronConsumer.h.

MonitorElement* HLTMonElectronConsumer::pixelhistosEt[4]
private

Definition at line 70 of file HLTMonElectronConsumer.h.

MonitorElement* HLTMonElectronConsumer::pixelhistosEta[4]
private

Definition at line 71 of file HLTMonElectronConsumer.h.

MonitorElement* HLTMonElectronConsumer::pixelhistosEtaOut[2]
private

Definition at line 74 of file HLTMonElectronConsumer.h.

MonitorElement* HLTMonElectronConsumer::pixelhistosEtOut[2]
private

Definition at line 73 of file HLTMonElectronConsumer.h.

MonitorElement* HLTMonElectronConsumer::pixelhistosPhi[4]
private

Definition at line 72 of file HLTMonElectronConsumer.h.

MonitorElement* HLTMonElectronConsumer::pixelhistosPhiOut[2]
private

Definition at line 75 of file HLTMonElectronConsumer.h.

edm::InputTag HLTMonElectronConsumer::pixeltag_
private

Definition at line 65 of file HLTMonElectronConsumer.h.

MonitorElement* HLTMonElectronConsumer::pixeltotal
private

Definition at line 76 of file HLTMonElectronConsumer.h.

MonitorElement* HLTMonElectronConsumer::trackEff
private

Definition at line 78 of file HLTMonElectronConsumer.h.