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

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

Inheritance diagram for L1THcalClient:
edm::EDAnalyzer

Public Member Functions

TH1F * get1DHisto (std::string meName, DQMStore *dbi)
 
TH2F * get2DHisto (std::string meName, DQMStore *dbi)
 
 L1THcalClient (const edm::ParameterSet &)
 
 ~L1THcalClient ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob (void)
 
void calcEff (TH1F *num, TH1F *den, MonitorElement *me)
 
virtual void endJob ()
 

Private Attributes

DQMStoredbe
 
MonitorElementhcalEff_1_
 
MonitorElementhcalEff_2_
 
MonitorElementhcalEff_3_
 
MonitorElementhcalEff_4_
 
MonitorElementhcalEff_HBHE [56][72]
 
MonitorElementhcalEff_HF [8][18]
 
MonitorElementhcalPlateau_
 
MonitorElementhcalThreshold_
 
MonitorElementhcalWidth_
 
std::string input_dir
 
int minEventsforFit
 
int nevents
 
int nupdates
 
std::string output_dir
 

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)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

Description: <one line="" class="" summary>="">

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

Definition at line 43 of file L1THcalClient.h.

Constructor & Destructor Documentation

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

Definition at line 53 of file L1THcalClient.cc.

References edm::ParameterSet::getUntrackedParameter(), cmsCodeRules.cppFunctionSkipper::operator, and o2o::output_dir.

54 {
55  minEventsforFit = iConfig.getUntrackedParameter<int>("minEventsforFit",1000);
56  input_dir = "L1T/L1THCALTPGXAna/";
57  output_dir = "L1T/L1THCALTPGXAna/Tests/";
58 
60  // dbe->showDirStructure();
61  // dbe->setVerbose(1);
62 
63  LogInfo( "TriggerDQM");
64 }
std::string output_dir
Definition: L1THcalClient.h:65
T getUntrackedParameter(std::string const &, T const &) const
std::string input_dir
Definition: L1THcalClient.h:64
DQMStore * dbe
Definition: L1THcalClient.h:61
L1THcalClient::~L1THcalClient ( )

Definition at line 68 of file L1THcalClient.cc.

69 {
70 
71  LogInfo("TriggerDQM")<<"[TriggerDQM]: ending... ";
72 
73 }

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 163 of file L1THcalClient.cc.

References gather_cfg::cout, i, j, nevents, o2o::output_dir, dtT0WireCalibration_cfg::threshold, and tablePrinter::width.

164 {
165  using namespace edm;
166  nevents++;
167  if (nevents%10 == 0) LogInfo("TriggerDQM")<<"[TriggerDQM]: event analyzed "<<nevents;
168 
169  //}
170  // //void L1THcalClient::endLuminosityBlock(const edm::LuminosityBlock & iLumiSection, const edm::EventSetup & iSetup) {
171  // LogInfo("TriggerDQM")<<"[TriggerDQM]: end Lumi Section.";
172  //dbe->setCurrentFolder("L1T/QTests");
173  TF1 *turnon = new TF1("turnon","[0]*0.5*(TMath::Erf((x -[1])*0.5/[2])+1.)",0,30);
174  TH1F *eff_histo;
175 
176  //efficiency by region
177  //std::cout << "before eff calc \n";
178  TH1F *hcalEff_num = this->get1DHisto(input_dir+"HcalTP1",dbe);
179  if (!hcalEff_num) std::cout << "numerator not found\n";
180  TH1F *hcalEff_den = this->get1DHisto(input_dir+"HcalAll1",dbe);
181  if (!hcalEff_den) std::cout << "denominator not found\n";
182  //hcalEff_1_ =
183  // dbe->book1D("HcalEff1","HCAL Efficiency - 1",effBins,effMinHBHE,effMaxHBHE);
184  calcEff(hcalEff_num, hcalEff_den, hcalEff_1_);
185  if (hcalEff_num->GetEntries() > minEventsforFit && nevents%1000 == 0)
186  {
187  eff_histo = this->get1DHisto(output_dir+"HcalEff1",dbe);
188  turnon->SetParameter(0,1);
189  turnon->SetParameter(1,2);
190  turnon->SetParameter(2,6);
191  eff_histo->Fit("turnon","LL,E");
192  }
193  hcalEff_num = this->get1DHisto(input_dir+"HcalTP2",dbe);
194  if (!hcalEff_num) std::cout << "numerator not found\n";
195  hcalEff_den = this->get1DHisto(input_dir+"HcalAll2",dbe);
196  if (!hcalEff_den) std::cout << "denominator not found\n";
197  //hcalEff_2_ =
198  // dbe->book1D("HcalEff2","HCAL Efficiency - 2",effBins,effMinHBHE,effMaxHBHE);
199  calcEff(hcalEff_num, hcalEff_den, hcalEff_2_);
200  if (hcalEff_num->GetEntries() > minEventsforFit && nevents%1000 == 0)
201  {
202  eff_histo = this->get1DHisto(output_dir+"HcalEff2",dbe);
203  turnon->SetParameter(0,1);
204  turnon->SetParameter(1,2);
205  turnon->SetParameter(2,6);
206  eff_histo->Fit("turnon","LL,E");
207  }
208  hcalEff_num = this->get1DHisto(input_dir+"HcalTP3",dbe);
209  if (!hcalEff_num) std::cout << "numerator not found\n";
210  hcalEff_den = this->get1DHisto(input_dir+"HcalAll3",dbe);
211  if (!hcalEff_den) std::cout << "denominator not found\n";
212  //hcalEff_3_ =
213  //dbe->book1D("HcalEff3","HCAL Efficiency - 3",effBins,effMinHBHE,effMaxHBHE);
214  calcEff(hcalEff_num, hcalEff_den, hcalEff_3_);
215  if (hcalEff_num->GetEntries() > minEventsforFit && nevents%1000 == 0)
216  {
217  eff_histo = this->get1DHisto(output_dir+"HcalEff3",dbe);
218  turnon->SetParameter(0,1);
219  turnon->SetParameter(1,3);
220  turnon->SetParameter(2,6);
221  eff_histo->Fit("turnon","LL,E");
222  }
223  hcalEff_num = this->get1DHisto(input_dir+"HcalTP4",dbe);
224  if (!hcalEff_num) std::cout << "numerator not found\n";
225  hcalEff_den = this->get1DHisto(input_dir+"HcalAll4",dbe);
226  if (!hcalEff_den) std::cout << "denominator not found\n";
227  // hcalEff_4_ =
228  //dbe->book1D("HcalEff4","HCAL Efficiency - 4",effBins,effMinHF,effMaxHF);
229  calcEff(hcalEff_num, hcalEff_den, hcalEff_4_);
230  if (hcalEff_num->GetEntries() > minEventsforFit && nevents%1000 == 0)
231  {
232  eff_histo = this->get1DHisto(output_dir+"HcalEff4",dbe);
233  turnon->SetParameter(0,1);
234  turnon->SetParameter(1,1);
235  turnon->SetParameter(2,6);
236  eff_histo->Fit("turnon","LL,E");
237  }
238  double plateau, threshold, width;
239 
240 
241  if (0){
242  //efficiency histos for HBHE
243  for (int i=0; i < 56; i++)
244  {
245  char hname[20],htitle[30];
246  int ieta, iphi;
247  char subdirname[80];
248  for (int j=0; j < 72; j++)
249  {
250  iphi = j+1;
251  if (i<28) ieta = i-28;
252  else ieta = i-27;
253  sprintf(hname,"eff_%d_%d",ieta,iphi);
254  sprintf(htitle,"Eff <%d,%d>",ieta,iphi);
255  //hcalEff_HBHE[i][j] = dbe->book1D(hname, htitle, effBins,effMinHBHE,effMaxHBHE);
256  sprintf(subdirname,"%sEffByChannel/EtaTower%d/",input_dir.c_str(),ieta);
257  hcalEff_num = this->get1DHisto((string)subdirname+(string)hname+"_num",dbe);
258  hcalEff_den = this->get1DHisto((string)subdirname+(string)hname+"_den",dbe);
259  if (!hcalEff_num) std::cout <<(string)subdirname+(string)hname+"_num" << "numerator not found\n";
260  if (!hcalEff_num) std::cout << "numerator not found\n";
261  if (!hcalEff_den) std::cout << "denominator not found\n";
262  calcEff(hcalEff_num, hcalEff_den, hcalEff_HBHE[i][j]);
263 
264  if (hcalEff_num->GetEntries() > minEventsforFit && nevents%1000 == 0)
265  {
266  sprintf(subdirname,"%sEffByChannel/EtaTower%d/",output_dir.c_str(),ieta);
267  eff_histo = this->get1DHisto((string)subdirname+(string)hname,dbe);
268  turnon->SetParameter(0,1);
269  turnon->SetParameter(1,3);
270  turnon->SetParameter(2,6);
271  eff_histo->Fit("turnon","LL,E");
272  plateau = turnon->GetParameter(0);
273  threshold = turnon->GetParameter(1);
274  width = turnon->GetParameter(2);
275  hcalPlateau_->Fill(ieta,iphi,plateau);
276  hcalThreshold_->Fill(ieta,iphi,threshold);
277  hcalWidth_->Fill(ieta,iphi,width);
278  }
279  }
280  }
281  //efficiency histos for HF
282  for (int i=0; i < 8; i++)
283  {
284  char hname[20],htitle[30];
285  int ieta, iphi;
286  char subdirname[80];
287  for (int j=0; j < 18; j++)
288  {
289  iphi = j*4+1;
290  if (i<4) ieta = i-32;
291  else ieta = i+25;
292  sprintf(hname,"eff_%d_%d",ieta,iphi);
293  sprintf(htitle,"Eff <%d,%d>",ieta,iphi);
294  //hcalEff_HF[i][j] = dbe->book1D(hname, htitle, effBins,effMinHF,effMaxHF);
295  sprintf(subdirname,"%sEffByChannel/EtaTower%d/",input_dir.c_str(),ieta);
296  hcalEff_num = this->get1DHisto((string)subdirname+(string)hname+"_num",dbe);
297  hcalEff_den = this->get1DHisto((string)subdirname+(string)hname+"_den",dbe);
298  if (!hcalEff_num) std::cout <<(string)subdirname+(string)hname+"_num" << "numerator not found\n";
299  if (!hcalEff_den) std::cout << "denominator not found\n";
300  calcEff(hcalEff_num, hcalEff_den, hcalEff_HF[i][j]);
301  if (hcalEff_num->GetEntries() > minEventsforFit && nevents%1000 == 0)
302  {
303  sprintf(subdirname,"%sEffByChannel/EtaTower%d/",output_dir.c_str(),ieta);
304  eff_histo = this->get1DHisto((string)subdirname+(string)hname,dbe);
305  turnon->SetParameter(0,1);
306  turnon->SetParameter(1,1);
307  turnon->SetParameter(2,6);
308  eff_histo->Fit("turnon","LL,E");
309  plateau = turnon->GetParameter(0);
310  threshold = turnon->GetParameter(1);
311  width = turnon->GetParameter(2);
312  hcalPlateau_->Fill(ieta,iphi,plateau);
313  hcalThreshold_->Fill(ieta,iphi,threshold);
314  hcalWidth_->Fill(ieta,iphi,width);
315  }
316  }
317  }
318  }
319 }
std::string output_dir
Definition: L1THcalClient.h:65
int i
Definition: DBlmapReader.cc:9
MonitorElement * hcalEff_1_
Definition: L1THcalClient.h:76
void calcEff(TH1F *num, TH1F *den, MonitorElement *me)
MonitorElement * hcalEff_4_
Definition: L1THcalClient.h:79
void Fill(long long x)
MonitorElement * hcalEff_2_
Definition: L1THcalClient.h:77
int j
Definition: DBlmapReader.cc:9
MonitorElement * hcalEff_HF[8][18]
Definition: L1THcalClient.h:81
std::string input_dir
Definition: L1THcalClient.h:64
TH1F * get1DHisto(std::string meName, DQMStore *dbi)
MonitorElement * hcalThreshold_
Definition: L1THcalClient.h:74
perl if(1 lt scalar(@::datatypes))
Definition: edlooper.cc:31
MonitorElement * hcalPlateau_
Definition: L1THcalClient.h:73
MonitorElement * hcalWidth_
Definition: L1THcalClient.h:75
tuple cout
Definition: gather_cfg.py:41
MonitorElement * hcalEff_3_
Definition: L1THcalClient.h:78
DQMStore * dbe
Definition: L1THcalClient.h:61
MonitorElement * hcalEff_HBHE[56][72]
Definition: L1THcalClient.h:80
void L1THcalClient::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 82 of file L1THcalClient.cc.

References effBins, effMaxHBHE, effMaxHF, effMinHBHE, effMinHF, i, j, nevents, o2o::output_dir, TPETABINS, TPETAMAX, TPETAMIN, TPPHIBINS, TPPHIMAX, and TPPHIMIN.

83 {
84  LogInfo("TriggerDQM")<<"[TriggerDQM]: Begin Job";
85  // LogInfo("TriggerDQM")<<"[TriggerDQM]: Standalone = "<<stdalone;
86  nevents = 0;
88  //2-D plots
89  hcalPlateau_ =
90  dbe->book2D("FitPlateau","HCAL Fit Plateau",TPETABINS,TPETAMIN,TPETAMAX,
93  dbe->book2D("FitThreshold","HCAL Fit Threshold",TPETABINS,TPETAMIN,TPETAMAX,
95  hcalWidth_ =
96  dbe->book2D("FitWidth","HCAL Fit Width",TPETABINS,TPETAMIN,TPETAMAX,
98  hcalEff_1_ =
99  dbe->book1D("HcalEff1","HCAL Efficiency - 1",effBins,effMinHBHE,effMaxHBHE);
100  hcalEff_2_ =
101  dbe->book1D("HcalEff2","HCAL Efficiency - 2",effBins,effMinHBHE,effMaxHBHE);
102  hcalEff_3_ =
103  dbe->book1D("HcalEff3","HCAL Efficiency - 3",effBins,effMinHBHE,effMaxHBHE);
104  hcalEff_4_ =
105  dbe->book1D("HcalEff4","HCAL Efficiency - 4",effBins,effMinHF,effMaxHF);
106 
107 
108 
109 
110  if (0){
111  //efficiency histos for HBHE
112  for (int i=0; i < 56; i++)
113  {
114  char hname[20],htitle[20];
115  char dirname[80];
116  int ieta, iphi;
117  if (i<28) ieta = i-28;
118  else ieta = i-27;
119  sprintf(dirname,"%sEffByChannel/EtaTower%d",output_dir.c_str(),ieta);
120  dbe->setCurrentFolder(dirname);
121  for (int j=0; j < 72; j++)
122  {
123  iphi = j+1;
124  if (i<28) ieta = i-28;
125  else ieta = i-27;
126  sprintf(hname,"eff_%d_%d",ieta,iphi);
127  sprintf(htitle,"Eff <%d,%d>",ieta,iphi);
128  hcalEff_HBHE[i][j] = dbe->book1D(hname, htitle, effBins,effMinHBHE,effMaxHBHE);
129  }
130  }
131  //efficiency histos for HF
132  for (int i=0; i < 8; i++)
133  {
134  char hname[20],htitle[20];
135  char dirname[80];
136  int ieta, iphi;
137  if (i<4) ieta = i-32;
138  else ieta = i+25;
139  sprintf(dirname,"%sEffByChannel/EtaTower%d",output_dir.c_str(),ieta);
140  dbe->setCurrentFolder(dirname);
141  for (int j=0; j < 18; j++)
142  {
143  iphi = j*4+1;
144  if (i<4) ieta = i-32;
145  else ieta = i+25;
146  sprintf(hname,"eff_%d_%d",ieta,iphi);
147  sprintf(htitle,"Eff <%d,%d>",ieta,iphi);
148  hcalEff_HF[i][j] = dbe->book1D(hname, htitle, effBins,effMinHF,effMaxHF);
149  }
150  }
151  }
152 
153 }
std::string output_dir
Definition: L1THcalClient.h:65
int i
Definition: DBlmapReader.cc:9
MonitorElement * hcalEff_1_
Definition: L1THcalClient.h:76
const float TPETAMIN
Definition: L1TCompare.cc:111
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:514
const float effMinHF
const unsigned int TPPHIBINS
Definition: L1TCompare.cc:106
MonitorElement * hcalEff_4_
Definition: L1THcalClient.h:79
const float TPETAMAX
Definition: L1TCompare.cc:112
const unsigned int TPETABINS
Definition: L1TCompare.cc:110
const float effMaxHBHE
MonitorElement * hcalEff_2_
Definition: L1THcalClient.h:77
int j
Definition: DBlmapReader.cc:9
MonitorElement * hcalEff_HF[8][18]
Definition: L1THcalClient.h:81
const float effMinHBHE
const unsigned int effBins
const float TPPHIMIN
Definition: L1TCompare.cc:107
const float TPPHIMAX
Definition: L1TCompare.cc:108
MonitorElement * hcalThreshold_
Definition: L1THcalClient.h:74
MonitorElement * hcalPlateau_
Definition: L1THcalClient.h:73
MonitorElement * hcalWidth_
Definition: L1THcalClient.h:75
MonitorElement * hcalEff_3_
Definition: L1THcalClient.h:78
DQMStore * dbe
Definition: L1THcalClient.h:61
const float effMaxHF
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:642
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:232
MonitorElement * hcalEff_HBHE[56][72]
Definition: L1THcalClient.h:80
void L1THcalClient::calcEff ( TH1F *  num,
TH1F *  den,
MonitorElement me 
)
private

Definition at line 321 of file L1THcalClient.cc.

References newFWLiteAna::bin, gather_cfg::cout, and MonitorElement::setBinContent().

322 {
323  if (num->GetNbinsX() != den->GetNbinsX())
324  {
325  std::cout << "numerator and denominator do not have the same number of bins!\n";
326  return;
327  }
328  double eff;
329  for (int bin = 0; bin <= num->GetNbinsX(); bin++)
330  {
331  if (den->GetBinContent(bin) != 0) eff = num->GetBinContent(bin)/den->GetBinContent(bin);
332  else eff = 0;
333  me->setBinContent(bin,eff);
334  }
335 }
void setBinContent(int binx, double content)
set content of bin (1-D)
long long int num
Definition: procUtils.cc:71
tuple cout
Definition: gather_cfg.py:41
void L1THcalClient::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 156 of file L1THcalClient.cc.

156  {
157 
158  LogInfo("TriggerDQM")<<"[TriggerDQM]: endJob";
159 
160 }
TH1F * L1THcalClient::get1DHisto ( std::string  meName,
DQMStore dbi 
)

Definition at line 337 of file L1THcalClient.cc.

References DQMStore::get(), MonitorElement::getTH1F(), and NULL.

338 {
339 
340  // string mePath = "Collector/GlobalDQM/L1T/" + meName;
341 
342  // MonitorElement * me_ = dbi->get(mePath);
343  MonitorElement * me_ = dbi->get(meName);
344 
345  TH1F * meHisto = NULL;
346 
347  if (me_) {
348 
349  meHisto = me_->getTH1F();
350  }
351  else {
352 
353  LogInfo("TriggerDQM") << "ME " << meName << " NOT FOUND!";
354 
355  }
356 
357  return meHisto;
358 }
#define NULL
Definition: scimark2.h:8
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1265
TH1F * getTH1F(void) const
TH2F * L1THcalClient::get2DHisto ( std::string  meName,
DQMStore dbi 
)

Definition at line 360 of file L1THcalClient.cc.

References DQMStore::get(), MonitorElement::getTH2F(), and NULL.

361 {
362 
363  // string mePath = "Collector/GlobalDQM/L1T/" + meName;
364 
365  MonitorElement * me_ = dbi->get(meName);
366 
367  TH2F * meHisto = NULL;
368 
369  if (me_) {
370 
371  meHisto = me_->getTH2F();
372  }
373  else {
374 
375  LogInfo("TriggerDQM") << "ME NOT FOUND.";
376 
377  }
378 
379  return meHisto;
380 }
#define NULL
Definition: scimark2.h:8
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1265
TH2F * getTH2F(void) const

Member Data Documentation

DQMStore* L1THcalClient::dbe
private

Definition at line 61 of file L1THcalClient.h.

MonitorElement* L1THcalClient::hcalEff_1_
private

Definition at line 76 of file L1THcalClient.h.

MonitorElement* L1THcalClient::hcalEff_2_
private

Definition at line 77 of file L1THcalClient.h.

MonitorElement* L1THcalClient::hcalEff_3_
private

Definition at line 78 of file L1THcalClient.h.

MonitorElement* L1THcalClient::hcalEff_4_
private

Definition at line 79 of file L1THcalClient.h.

MonitorElement* L1THcalClient::hcalEff_HBHE[56][72]
private

Definition at line 80 of file L1THcalClient.h.

MonitorElement* L1THcalClient::hcalEff_HF[8][18]
private

Definition at line 81 of file L1THcalClient.h.

MonitorElement* L1THcalClient::hcalPlateau_
private

Definition at line 73 of file L1THcalClient.h.

MonitorElement* L1THcalClient::hcalThreshold_
private

Definition at line 74 of file L1THcalClient.h.

MonitorElement* L1THcalClient::hcalWidth_
private

Definition at line 75 of file L1THcalClient.h.

std::string L1THcalClient::input_dir
private

Definition at line 64 of file L1THcalClient.h.

int L1THcalClient::minEventsforFit
private

Definition at line 66 of file L1THcalClient.h.

int L1THcalClient::nevents
private

Definition at line 59 of file L1THcalClient.h.

int L1THcalClient::nupdates
private

Definition at line 59 of file L1THcalClient.h.

std::string L1THcalClient::output_dir
private

Definition at line 65 of file L1THcalClient.h.