17 LogDebug(
"HLTMonElectronConsumer") <<
"constructor...." ;
19 logFile_.open(
"HLTMonElectronConsumer.log");
29 if (outputFile_.size() != 0) {
30 LogInfo(
"HLTMonElectronConsumer") <<
"L1T Monitoring histograms will be saved to "
34 outputFile_ =
"L1TDQM.root";
46 dirname_=
"HLT/HLTMonElectron/"+iConfig.
getParameter<std::string>(
"@module_label");
47 pixeldirname_=
"HLT/HLTMonElectron/"+pixeltag_.label();
48 isodirname_=
"HLT/HLTMonElectron/"+isotag_.
label();
51 dbe->setCurrentFolder(dirname_);
76 LogInfo(
"HLTMonElectronConsumer") <<
" pixelhisto " << pixeltotal->getBinContent(1);
77 if(pixeltotal->getBinContent(1)!=0)
78 pixelEff->Fill(pixeltotal->getBinContent(2)/pixeltotal->getBinContent(1));
82 if(pixeltotal->getBinContent(3)!=0)
83 trackEff->Fill(pixeltotal->getBinContent(4)/pixeltotal->getBinContent(3));
88 for(
int i =0;
i<2 ;
i++){
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));
97 pixelhistosEtOut[
i]->setBinContent(
j,0.);
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));
105 pixelhistosEtaOut[
i]->setBinContent(
j,0.);
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));
113 pixelhistosPhiOut[
i]->setBinContent(
j,0.);
117 LogInfo(
"HLTMonElectronConsumer") <<
" empty pixelhisto " ;
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());
125 isocheck->setBinContent(
i,0.);
128 LogInfo(
"HLTMonElectronConsumer") <<
" empty isohisto " ;
145 dbe->
rmdir(dirname_);
154 std::string tmpname = pixeldirname_ +
"/total eff";
155 LogInfo(
"HLTMonElectronConsumer") <<
" reading histo: " << tmpname;
156 pixeltotal=dbe->
get(tmpname);
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);
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());
183 LogInfo(
"HLTMonElectronConsumer") <<
"pixelhisto doesn't exist during beginJob" ;
185 pixelEff=dbe->
bookFloat(
"total pixelmatch");
186 trackEff=dbe->
bookFloat(
"total trackmatch");
188 LogInfo(
"HLTMonElectronConsumer") <<
"writing: " << pixelEff->getPathname();
191 tmpname = isodirname_ +
"/total eff";
192 LogInfo(
"HLTMonElectronConsumer") <<
" reading histo: " << tmpname;
193 isototal=dbe->
get(tmpname);
195 isocheck = dbe->
book1D(
"consistency check",
"consistency check",refhist->GetNbinsX(),refhist->GetXaxis()->GetXmin(),refhist->GetXaxis()->GetXmax());
207 if (outputFile_.size() != 0 && dbe)
208 dbe->save(outputFile_);
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
void rmdir(const std::string &fullpath)
MonitorElement * bookFloat(const char *name)
Book float.
HLTMonElectronConsumer(const edm::ParameterSet &)
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. "my/long/dir/my_histo")
TH1F * getTH1F(void) const
virtual void analyze(const edm::Event &, const edm::EventSetup &)
~HLTMonElectronConsumer()
void setCurrentFolder(const std::string &fullpath)