![]() |
![]() |
#include <DQM/L1THcalClient/src/L1THcalClient.cc>
Public Member Functions | |
TH1F * | get1DHisto (string meName, DQMStore *dbi) |
TH2F * | get2DHisto (string meName, DQMStore *dbi) |
L1THcalClient (const edm::ParameterSet &) | |
~L1THcalClient () | |
Private Member Functions | |
virtual void | analyze (const edm::Event &, const edm::EventSetup &) |
virtual void | beginJob (const edm::EventSetup &) |
void | calcEff (TH1F *num, TH1F *den, MonitorElement *me) |
virtual void | endJob () |
Private Attributes | |
DQMStore * | dbe |
MonitorElement * | hcalEff_1_ |
MonitorElement * | hcalEff_2_ |
MonitorElement * | hcalEff_3_ |
MonitorElement * | hcalEff_4_ |
MonitorElement * | hcalEff_HBHE [56][72] |
MonitorElement * | hcalEff_HF [8][18] |
MonitorElement * | hcalPlateau_ |
MonitorElement * | hcalThreshold_ |
MonitorElement * | hcalWidth_ |
std::string | input_dir |
int | minEventsforFit |
int | nevents |
int | nupdates |
std::string | output_dir |
Implementation: <Notes on="" implementation>="">
Definition at line 46 of file L1THcalClient.h.
L1THcalClient::L1THcalClient | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 53 of file L1THcalClient.cc.
References dbe, edm::ParameterSet::getUntrackedParameter(), input_dir, minEventsforFit, and output_dir.
00054 { 00055 minEventsforFit = iConfig.getUntrackedParameter<int>("minEventsforFit",1000); 00056 input_dir = "L1T/L1THCALTPGXAna/"; 00057 output_dir = "L1T/L1THCALTPGXAna/Tests/"; 00058 00059 dbe = edm::Service<DQMStore>().operator->(); 00060 // dbe->showDirStructure(); 00061 // dbe->setVerbose(1); 00062 00063 LogInfo( "TriggerDQM"); 00064 }
L1THcalClient::~L1THcalClient | ( | ) |
Definition at line 68 of file L1THcalClient.cc.
00069 { 00070 00071 LogInfo("TriggerDQM")<<"[TriggerDQM]: ending... "; 00072 00073 }
void L1THcalClient::analyze | ( | const edm::Event & | iEvent, | |
const edm::EventSetup & | iSetup | |||
) | [private, virtual] |
Implements edm::EDAnalyzer.
Definition at line 163 of file L1THcalClient.cc.
References calcEff(), GenMuonPlsPt100GeV_cfg::cout, dbe, MonitorElement::Fill(), get1DHisto(), hcalEff_1_, hcalEff_2_, hcalEff_3_, hcalEff_4_, hcalEff_HBHE, hcalEff_HF, hcalPlateau_, hcalThreshold_, hcalWidth_, i, input_dir, j, minEventsforFit, nevents, output_dir, dimuonsSequences_cff::threshold, and width.
00164 { 00165 using namespace edm; 00166 nevents++; 00167 if (nevents%10 == 0) LogInfo("TriggerDQM")<<"[TriggerDQM]: event analyzed "<<nevents; 00168 00169 //} 00170 // //void L1THcalClient::endLuminosityBlock(const edm::LuminosityBlock & iLumiSection, const edm::EventSetup & iSetup) { 00171 // LogInfo("TriggerDQM")<<"[TriggerDQM]: end Lumi Section."; 00172 //dbe->setCurrentFolder("L1T/QTests"); 00173 TF1 *turnon = new TF1("turnon","[0]*0.5*(TMath::Erf((x -[1])*0.5/[2])+1.)",0,30); 00174 TH1F *eff_histo; 00175 00176 //efficiency by region 00177 //std::cout << "before eff calc \n"; 00178 TH1F *hcalEff_num = this->get1DHisto(input_dir+"HcalTP1",dbe); 00179 if (!hcalEff_num) std::cout << "numerator not found\n"; 00180 TH1F *hcalEff_den = this->get1DHisto(input_dir+"HcalAll1",dbe); 00181 if (!hcalEff_den) std::cout << "denominator not found\n"; 00182 //hcalEff_1_ = 00183 // dbe->book1D("HcalEff1","HCAL Efficiency - 1",effBins,effMinHBHE,effMaxHBHE); 00184 calcEff(hcalEff_num, hcalEff_den, hcalEff_1_); 00185 if (hcalEff_num->GetEntries() > minEventsforFit && nevents%1000 == 0) 00186 { 00187 eff_histo = this->get1DHisto(output_dir+"HcalEff1",dbe); 00188 turnon->SetParameter(0,1); 00189 turnon->SetParameter(1,2); 00190 turnon->SetParameter(2,6); 00191 eff_histo->Fit("turnon","LL,E"); 00192 } 00193 hcalEff_num = this->get1DHisto(input_dir+"HcalTP2",dbe); 00194 if (!hcalEff_num) std::cout << "numerator not found\n"; 00195 hcalEff_den = this->get1DHisto(input_dir+"HcalAll2",dbe); 00196 if (!hcalEff_den) std::cout << "denominator not found\n"; 00197 //hcalEff_2_ = 00198 // dbe->book1D("HcalEff2","HCAL Efficiency - 2",effBins,effMinHBHE,effMaxHBHE); 00199 calcEff(hcalEff_num, hcalEff_den, hcalEff_2_); 00200 if (hcalEff_num->GetEntries() > minEventsforFit && nevents%1000 == 0) 00201 { 00202 eff_histo = this->get1DHisto(output_dir+"HcalEff2",dbe); 00203 turnon->SetParameter(0,1); 00204 turnon->SetParameter(1,2); 00205 turnon->SetParameter(2,6); 00206 eff_histo->Fit("turnon","LL,E"); 00207 } 00208 hcalEff_num = this->get1DHisto(input_dir+"HcalTP3",dbe); 00209 if (!hcalEff_num) std::cout << "numerator not found\n"; 00210 hcalEff_den = this->get1DHisto(input_dir+"HcalAll3",dbe); 00211 if (!hcalEff_den) std::cout << "denominator not found\n"; 00212 //hcalEff_3_ = 00213 //dbe->book1D("HcalEff3","HCAL Efficiency - 3",effBins,effMinHBHE,effMaxHBHE); 00214 calcEff(hcalEff_num, hcalEff_den, hcalEff_3_); 00215 if (hcalEff_num->GetEntries() > minEventsforFit && nevents%1000 == 0) 00216 { 00217 eff_histo = this->get1DHisto(output_dir+"HcalEff3",dbe); 00218 turnon->SetParameter(0,1); 00219 turnon->SetParameter(1,3); 00220 turnon->SetParameter(2,6); 00221 eff_histo->Fit("turnon","LL,E"); 00222 } 00223 hcalEff_num = this->get1DHisto(input_dir+"HcalTP4",dbe); 00224 if (!hcalEff_num) std::cout << "numerator not found\n"; 00225 hcalEff_den = this->get1DHisto(input_dir+"HcalAll4",dbe); 00226 if (!hcalEff_den) std::cout << "denominator not found\n"; 00227 // hcalEff_4_ = 00228 //dbe->book1D("HcalEff4","HCAL Efficiency - 4",effBins,effMinHF,effMaxHF); 00229 calcEff(hcalEff_num, hcalEff_den, hcalEff_4_); 00230 if (hcalEff_num->GetEntries() > minEventsforFit && nevents%1000 == 0) 00231 { 00232 eff_histo = this->get1DHisto(output_dir+"HcalEff4",dbe); 00233 turnon->SetParameter(0,1); 00234 turnon->SetParameter(1,1); 00235 turnon->SetParameter(2,6); 00236 eff_histo->Fit("turnon","LL,E"); 00237 } 00238 double plateau, threshold, width; 00239 00240 00241 if (0){ 00242 //efficiency histos for HBHE 00243 for (int i=0; i < 56; i++) 00244 { 00245 char hname[20],htitle[30]; 00246 int ieta, iphi; 00247 char subdirname[80]; 00248 for (int j=0; j < 72; j++) 00249 { 00250 iphi = j+1; 00251 if (i<28) ieta = i-28; 00252 else ieta = i-27; 00253 sprintf(hname,"eff_%d_%d",ieta,iphi); 00254 sprintf(htitle,"Eff <%d,%d>",ieta,iphi); 00255 //hcalEff_HBHE[i][j] = dbe->book1D(hname, htitle, effBins,effMinHBHE,effMaxHBHE); 00256 sprintf(subdirname,"%sEffByChannel/EtaTower%d/",input_dir.c_str(),ieta); 00257 hcalEff_num = this->get1DHisto((string)subdirname+(string)hname+"_num",dbe); 00258 hcalEff_den = this->get1DHisto((string)subdirname+(string)hname+"_den",dbe); 00259 if (!hcalEff_num) std::cout <<(string)subdirname+(string)hname+"_num" << "numerator not found\n"; 00260 if (!hcalEff_num) std::cout << "numerator not found\n"; 00261 if (!hcalEff_den) std::cout << "denominator not found\n"; 00262 calcEff(hcalEff_num, hcalEff_den, hcalEff_HBHE[i][j]); 00263 00264 if (hcalEff_num->GetEntries() > minEventsforFit && nevents%1000 == 0) 00265 { 00266 sprintf(subdirname,"%sEffByChannel/EtaTower%d/",output_dir.c_str(),ieta); 00267 eff_histo = this->get1DHisto((string)subdirname+(string)hname,dbe); 00268 turnon->SetParameter(0,1); 00269 turnon->SetParameter(1,3); 00270 turnon->SetParameter(2,6); 00271 eff_histo->Fit("turnon","LL,E"); 00272 plateau = turnon->GetParameter(0); 00273 threshold = turnon->GetParameter(1); 00274 width = turnon->GetParameter(2); 00275 hcalPlateau_->Fill(ieta,iphi,plateau); 00276 hcalThreshold_->Fill(ieta,iphi,threshold); 00277 hcalWidth_->Fill(ieta,iphi,width); 00278 } 00279 } 00280 } 00281 //efficiency histos for HF 00282 for (int i=0; i < 8; i++) 00283 { 00284 char hname[20],htitle[30]; 00285 int ieta, iphi; 00286 char subdirname[80]; 00287 for (int j=0; j < 18; j++) 00288 { 00289 iphi = j*4+1; 00290 if (i<4) ieta = i-32; 00291 else ieta = i+25; 00292 sprintf(hname,"eff_%d_%d",ieta,iphi); 00293 sprintf(htitle,"Eff <%d,%d>",ieta,iphi); 00294 //hcalEff_HF[i][j] = dbe->book1D(hname, htitle, effBins,effMinHF,effMaxHF); 00295 sprintf(subdirname,"%sEffByChannel/EtaTower%d/",input_dir.c_str(),ieta); 00296 hcalEff_num = this->get1DHisto((string)subdirname+(string)hname+"_num",dbe); 00297 hcalEff_den = this->get1DHisto((string)subdirname+(string)hname+"_den",dbe); 00298 if (!hcalEff_num) std::cout <<(string)subdirname+(string)hname+"_num" << "numerator not found\n"; 00299 if (!hcalEff_den) std::cout << "denominator not found\n"; 00300 calcEff(hcalEff_num, hcalEff_den, hcalEff_HF[i][j]); 00301 if (hcalEff_num->GetEntries() > minEventsforFit && nevents%1000 == 0) 00302 { 00303 sprintf(subdirname,"%sEffByChannel/EtaTower%d/",output_dir.c_str(),ieta); 00304 eff_histo = this->get1DHisto((string)subdirname+(string)hname,dbe); 00305 turnon->SetParameter(0,1); 00306 turnon->SetParameter(1,1); 00307 turnon->SetParameter(2,6); 00308 eff_histo->Fit("turnon","LL,E"); 00309 plateau = turnon->GetParameter(0); 00310 threshold = turnon->GetParameter(1); 00311 width = turnon->GetParameter(2); 00312 hcalPlateau_->Fill(ieta,iphi,plateau); 00313 hcalThreshold_->Fill(ieta,iphi,threshold); 00314 hcalWidth_->Fill(ieta,iphi,width); 00315 } 00316 } 00317 } 00318 } 00319 }
void L1THcalClient::beginJob | ( | const edm::EventSetup & | ) | [private, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 82 of file L1THcalClient.cc.
References DQMStore::book1D(), DQMStore::book2D(), dbe, effBins, effMaxHBHE, effMaxHF, effMinHBHE, effMinHF, hcalEff_1_, hcalEff_2_, hcalEff_3_, hcalEff_4_, hcalEff_HBHE, hcalEff_HF, hcalPlateau_, hcalThreshold_, hcalWidth_, i, j, nevents, output_dir, DQMStore::setCurrentFolder(), TPETABINS, TPETAMAX, TPETAMIN, TPPHIBINS, TPPHIMAX, and TPPHIMIN.
00083 { 00084 LogInfo("TriggerDQM")<<"[TriggerDQM]: Begin Job"; 00085 // LogInfo("TriggerDQM")<<"[TriggerDQM]: Standalone = "<<stdalone; 00086 nevents = 0; 00087 dbe->setCurrentFolder(output_dir); 00088 //2-D plots 00089 hcalPlateau_ = 00090 dbe->book2D("FitPlateau","HCAL Fit Plateau",TPETABINS,TPETAMIN,TPETAMAX, 00091 TPPHIBINS,TPPHIMIN,TPPHIMAX); 00092 hcalThreshold_ = 00093 dbe->book2D("FitThreshold","HCAL Fit Threshold",TPETABINS,TPETAMIN,TPETAMAX, 00094 TPPHIBINS,TPPHIMIN,TPPHIMAX); 00095 hcalWidth_ = 00096 dbe->book2D("FitWidth","HCAL Fit Width",TPETABINS,TPETAMIN,TPETAMAX, 00097 TPPHIBINS,TPPHIMIN,TPPHIMAX); 00098 hcalEff_1_ = 00099 dbe->book1D("HcalEff1","HCAL Efficiency - 1",effBins,effMinHBHE,effMaxHBHE); 00100 hcalEff_2_ = 00101 dbe->book1D("HcalEff2","HCAL Efficiency - 2",effBins,effMinHBHE,effMaxHBHE); 00102 hcalEff_3_ = 00103 dbe->book1D("HcalEff3","HCAL Efficiency - 3",effBins,effMinHBHE,effMaxHBHE); 00104 hcalEff_4_ = 00105 dbe->book1D("HcalEff4","HCAL Efficiency - 4",effBins,effMinHF,effMaxHF); 00106 00107 00108 00109 00110 if (0){ 00111 //efficiency histos for HBHE 00112 for (int i=0; i < 56; i++) 00113 { 00114 char hname[20],htitle[20]; 00115 char dirname[80]; 00116 int ieta, iphi; 00117 if (i<28) ieta = i-28; 00118 else ieta = i-27; 00119 sprintf(dirname,"%sEffByChannel/EtaTower%d",output_dir.c_str(),ieta); 00120 dbe->setCurrentFolder(dirname); 00121 for (int j=0; j < 72; j++) 00122 { 00123 iphi = j+1; 00124 if (i<28) ieta = i-28; 00125 else ieta = i-27; 00126 sprintf(hname,"eff_%d_%d",ieta,iphi); 00127 sprintf(htitle,"Eff <%d,%d>",ieta,iphi); 00128 hcalEff_HBHE[i][j] = dbe->book1D(hname, htitle, effBins,effMinHBHE,effMaxHBHE); 00129 } 00130 } 00131 //efficiency histos for HF 00132 for (int i=0; i < 8; i++) 00133 { 00134 char hname[20],htitle[20]; 00135 char dirname[80]; 00136 int ieta, iphi; 00137 if (i<4) ieta = i-32; 00138 else ieta = i+25; 00139 sprintf(dirname,"%sEffByChannel/EtaTower%d",output_dir.c_str(),ieta); 00140 dbe->setCurrentFolder(dirname); 00141 for (int j=0; j < 18; j++) 00142 { 00143 iphi = j*4+1; 00144 if (i<4) ieta = i-32; 00145 else ieta = i+25; 00146 sprintf(hname,"eff_%d_%d",ieta,iphi); 00147 sprintf(htitle,"Eff <%d,%d>",ieta,iphi); 00148 hcalEff_HF[i][j] = dbe->book1D(hname, htitle, effBins,effMinHF,effMaxHF); 00149 } 00150 } 00151 } 00152 00153 }
void L1THcalClient::calcEff | ( | TH1F * | num, | |
TH1F * | den, | |||
MonitorElement * | me | |||
) | [private] |
Definition at line 321 of file L1THcalClient.cc.
References GenMuonPlsPt100GeV_cfg::cout, and MonitorElement::setBinContent().
Referenced by analyze().
00322 { 00323 if (num->GetNbinsX() != den->GetNbinsX()) 00324 { 00325 std::cout << "numerator and denominator do not have the same number of bins!\n"; 00326 return; 00327 } 00328 double eff; 00329 for (int bin = 0; bin <= num->GetNbinsX(); bin++) 00330 { 00331 if (den->GetBinContent(bin) != 0) eff = num->GetBinContent(bin)/den->GetBinContent(bin); 00332 else eff = 0; 00333 me->setBinContent(bin,eff); 00334 } 00335 }
Reimplemented from edm::EDAnalyzer.
Definition at line 156 of file L1THcalClient.cc.
00156 { 00157 00158 LogInfo("TriggerDQM")<<"[TriggerDQM]: endJob"; 00159 00160 }
TH1F * L1THcalClient::get1DHisto | ( | string | meName, | |
DQMStore * | dbi | |||
) |
Definition at line 337 of file L1THcalClient.cc.
References DQMStore::get(), MonitorElement::getTH1F(), and NULL.
Referenced by analyze().
00338 { 00339 00340 // string mePath = "Collector/GlobalDQM/L1T/" + meName; 00341 00342 // MonitorElement * me_ = dbi->get(mePath); 00343 MonitorElement * me_ = dbi->get(meName); 00344 00345 TH1F * meHisto = NULL; 00346 00347 if (me_) { 00348 00349 meHisto = me_->getTH1F(); 00350 } 00351 else { 00352 00353 LogInfo("TriggerDQM") << "ME " << meName << " NOT FOUND!"; 00354 00355 } 00356 00357 return meHisto; 00358 }
TH2F * L1THcalClient::get2DHisto | ( | string | meName, | |
DQMStore * | dbi | |||
) |
Definition at line 360 of file L1THcalClient.cc.
References DQMStore::get(), MonitorElement::getTH2F(), and NULL.
00361 { 00362 00363 // string mePath = "Collector/GlobalDQM/L1T/" + meName; 00364 00365 MonitorElement * me_ = dbi->get(meName); 00366 00367 TH2F * meHisto = NULL; 00368 00369 if (me_) { 00370 00371 meHisto = me_->getTH2F(); 00372 } 00373 else { 00374 00375 LogInfo("TriggerDQM") << "ME NOT FOUND."; 00376 00377 } 00378 00379 return meHisto; 00380 }
DQMStore* L1THcalClient::dbe [private] |
Definition at line 64 of file L1THcalClient.h.
Referenced by analyze(), beginJob(), and L1THcalClient().
MonitorElement* L1THcalClient::hcalEff_1_ [private] |
MonitorElement* L1THcalClient::hcalEff_2_ [private] |
MonitorElement* L1THcalClient::hcalEff_3_ [private] |
MonitorElement* L1THcalClient::hcalEff_4_ [private] |
MonitorElement* L1THcalClient::hcalEff_HBHE[56][72] [private] |
MonitorElement* L1THcalClient::hcalEff_HF[8][18] [private] |
MonitorElement* L1THcalClient::hcalPlateau_ [private] |
MonitorElement* L1THcalClient::hcalThreshold_ [private] |
MonitorElement* L1THcalClient::hcalWidth_ [private] |
std::string L1THcalClient::input_dir [private] |
int L1THcalClient::minEventsforFit [private] |
int L1THcalClient::nevents [private] |
int L1THcalClient::nupdates [private] |
Definition at line 62 of file L1THcalClient.h.
std::string L1THcalClient::output_dir [private] |
Definition at line 68 of file L1THcalClient.h.
Referenced by analyze(), beginJob(), and L1THcalClient().