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

#include <ESPedestalClient.h>

Inheritance diagram for ESPedestalClient:
ESClient

Public Member Functions

void endJobAnalyze (DQMStore::IGetter &) override
 
 ESPedestalClient (const edm::ParameterSet &)
 
 ~ESPedestalClient ()
 
- Public Member Functions inherited from ESClient
virtual void endLumiAnalyze (DQMStore::IGetter &)
 
 ESClient (edm::ParameterSet const &)
 
template<typename T >
TgetHisto (MonitorElement *, bool=false, T *=0) const
 
void setup (DQMStore::IBooker &)
 
virtual ~ESClient ()
 

Private Member Functions

void book (DQMStore::IBooker &) override
 

Private Attributes

TF1 * fg_
 
bool fitPedestal_
 
MonitorElementhPed_ [2][2][40][40]
 
MonitorElementhTotN_ [2][2][40][40]
 
std::vector< int > senP_
 
std::vector< int > senX_
 
std::vector< int > senY_
 
std::vector< int > senZ_
 

Additional Inherited Members

- Protected Attributes inherited from ESClient
bool cloneME_
 
bool debug_
 
bool initialized_
 
std::string prefixME_
 
bool verbose_
 

Detailed Description

Definition at line 14 of file ESPedestalClient.h.

Constructor & Destructor Documentation

ESPedestalClient::ESPedestalClient ( const edm::ParameterSet ps)

Definition at line 13 of file ESPedestalClient.cc.

References gather_cfg::cout, mergeVDriftHistosByStation::file, edm::FileInPath::fullPath(), edm::ParameterSet::getUntrackedParameter(), hPed_, hTotN_, i, j, roll_playback::k, m, submitDQMOfflineCAF::nLines, senP_, senX_, senY_, senZ_, and AlCaHLTBitMon_QueryRunRegistry::string.

13  :
14  ESClient(ps),
15  fitPedestal_(ps.getUntrackedParameter<bool>("fitPedestal")),
16  fg_(new TF1("fg", "gaus")),
17  senZ_(),
18  senP_(),
19  senX_(),
20  senY_()
21 {
22  for (int i=0; i<2; i++)
23  for (int j=0; j<2; j++)
24  for (int k=0; k<40; k++)
25  for (int m=0; m<40; m++) {
26  hPed_[i][j][k][m] = 0;
27  hTotN_[i][j][k][m] = 0;
28  }
29 
30  std::string lutPath(ps.getUntrackedParameter<edm::FileInPath>("LookupTable").fullPath());
31 
32  // read in look-up table
33  int nLines, iz, ip, ix, iy, fed, kchip, pace, bundle, fiber, optorx;
34  ifstream file(lutPath);
35 
36  if( file.is_open() ) {
37 
38  file >> nLines;
39 
40  for (int i=0; i<nLines; ++i) {
41  file>> iz >> ip >> ix >> iy >> fed >> kchip >> pace >> bundle >> fiber >> optorx;
42 
43  senZ_.push_back(iz);
44  senP_.push_back(ip);
45  senX_.push_back(ix);
46  senY_.push_back(iy);
47  }
48 
49  file.close();
50  } else {
51  cout<<"ESPedestalClient : Look up table file can not be found in "<<lutPath<<endl;
52  }
53 }
std::vector< int > senP_
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
MonitorElement * hTotN_[2][2][40][40]
ESClient(edm::ParameterSet const &)
Definition: ESClient.cc:5
std::vector< int > senX_
int j
Definition: DBlmapReader.cc:9
std::vector< int > senZ_
std::vector< int > senY_
tuple cout
Definition: gather_cfg.py:121
std::string fullPath() const
Definition: FileInPath.cc:165
MonitorElement * hPed_[2][2][40][40]
ESPedestalClient::~ESPedestalClient ( )

Definition at line 55 of file ESPedestalClient.cc.

References fg_.

55  {
56  delete fg_;
57 }

Member Function Documentation

void ESPedestalClient::book ( DQMStore::IBooker _ibooker)
overrideprivatevirtual

Reimplemented from ESClient.

Definition at line 115 of file ESPedestalClient.cc.

References DQMStore::IBooker::book1D(), hPed_, hTotN_, i, ESClient::prefixME_, senP_, senX_, senY_, senZ_, and DQMStore::IBooker::setCurrentFolder().

115  {
116 
117  // define histograms
118  _ibooker.setCurrentFolder(prefixME_+"/ESPedestalClient");
119 
120  char hname[300];
121  for (unsigned i=0; i<senZ_.size(); ++i) {
122 
123  int iz = (senZ_[i]==1) ? 0:1;
124 
125  sprintf(hname, "Ped Z %d P %d X %d Y %d", senZ_[i], senP_[i], senX_[i], senY_[i]);
126  hPed_[iz][senP_[i]-1][senX_[i]-1][senY_[i]-1] = _ibooker.book1D(hname, hname, 32, 0, 32);
127 
128  sprintf(hname, "Total Noise Z %d P %d X %d Y %d", senZ_[i], senP_[i], senX_[i], senY_[i]);
129  hTotN_[iz][senP_[i]-1][senX_[i]-1][senY_[i]-1] = _ibooker.book1D(hname, hname, 32, 0, 32);
130  }
131 
132 }
std::vector< int > senP_
int i
Definition: DBlmapReader.cc:9
MonitorElement * hTotN_[2][2][40][40]
std::vector< int > senX_
std::string prefixME_
Definition: ESClient.h:31
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
std::vector< int > senZ_
std::vector< int > senY_
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
MonitorElement * hPed_[2][2][40][40]
void ESPedestalClient::endJobAnalyze ( DQMStore::IGetter _igetter)
overridevirtual

Reimplemented from ESClient.

Definition at line 59 of file ESPedestalClient.cc.

References gather_cfg::cout, ESClient::debug_, fg_, fitPedestal_, DQMStore::IGetter::get(), MonitorElement::getTH1F(), hPed_, hTotN_, i, ESClient::prefixME_, senP_, senX_, senY_, senZ_, MonitorElement::setBinContent(), and ESClient::verbose_.

59  {
60 
61  if ( debug_ ) cout << "ESPedestalClient: endJob" << endl;
62 
63  // Preform pedestal fit
64  char hname[300];
65  int iz = 0;
66  if (fitPedestal_) {
67 
68  if ( verbose_ ) cout<<"ESPedestalClient: Fit Pedestal"<<endl;
69 
70  for (unsigned i=0; i<senZ_.size(); ++i) {
71 
72  iz = (senZ_[i]==1) ? 0:1;
73 
74  for (int is=0; is<32; ++is) {
75 
76  string dirname = prefixME_ + "/ESPedestalTask/";
77  sprintf(hname, "ADC Z %d P %d X %d Y %d Str %d", senZ_[i], senP_[i], senX_[i], senY_[i], is+1);
78  MonitorElement *meFit = _igetter.get(dirname+hname);
79 
80  if (meFit==0) continue;
81  TH1F *rootHisto = meFit->getTH1F();
82 
83  rootHisto->Fit(fg_, "Q", "", 500, 1800);
84  rootHisto->Fit(fg_, "RQ", "", fg_->GetParameter(1)-2.*fg_->GetParameter(2),fg_->GetParameter(1)+2.*fg_->GetParameter(2));
85  hPed_[iz][senP_[i]-1][senX_[i]-1][senY_[i]-1]->setBinContent(is+1, (int)(fg_->GetParameter(1)+0.5));
86  hTotN_[iz][senP_[i]-1][senX_[i]-1][senY_[i]-1]->setBinContent(is+1, fg_->GetParameter(2));
87  }
88  }
89 
90  } else {
91 
92  if ( verbose_ ) cout<<"ESPedestalClient: Use Histogram Mean"<<endl;
93 
94  for (unsigned i=0; i<senZ_.size(); ++i) {
95 
96  iz = (senZ_[i]==1) ? 0:1;
97 
98  for (int is=0; is<32; ++is) {
99 
100  string dirname = prefixME_ + "/ESPedestalTask/";
101  sprintf(hname, "ADC Z %d P %d X %d Y %d Str %d", senZ_[i], senP_[i], senX_[i], senY_[i], is+1);
102  MonitorElement *meMean = _igetter.get(dirname+hname);
103 
104  if (meMean==0) continue;
105  TH1F *rootHisto = meMean->getTH1F();
106 
107  hPed_[iz][senP_[i]-1][senX_[i]-1][senY_[i]-1]->setBinContent(is+1, (int)(rootHisto->GetMean()+0.5));
108  hTotN_[iz][senP_[i]-1][senX_[i]-1][senY_[i]-1]->setBinContent(is+1, rootHisto->GetRMS());
109 
110  }
111  }
112  }
113 }
std::vector< int > senP_
int i
Definition: DBlmapReader.cc:9
void setBinContent(int binx, double content)
set content of bin (1-D)
MonitorElement * hTotN_[2][2][40][40]
MonitorElement * get(const std::string &path)
Definition: DQMStore.cc:298
std::vector< int > senX_
std::string prefixME_
Definition: ESClient.h:31
bool debug_
Definition: ESClient.h:34
std::vector< int > senZ_
std::vector< int > senY_
bool verbose_
Definition: ESClient.h:33
TH1F * getTH1F(void) const
tuple cout
Definition: gather_cfg.py:121
MonitorElement * hPed_[2][2][40][40]

Member Data Documentation

TF1* ESPedestalClient::fg_
private

Definition at line 28 of file ESPedestalClient.h.

Referenced by endJobAnalyze(), and ~ESPedestalClient().

bool ESPedestalClient::fitPedestal_
private

Definition at line 23 of file ESPedestalClient.h.

Referenced by endJobAnalyze().

MonitorElement* ESPedestalClient::hPed_[2][2][40][40]
private

Definition at line 25 of file ESPedestalClient.h.

Referenced by book(), endJobAnalyze(), and ESPedestalClient().

MonitorElement* ESPedestalClient::hTotN_[2][2][40][40]
private

Definition at line 26 of file ESPedestalClient.h.

Referenced by book(), endJobAnalyze(), and ESPedestalClient().

std::vector<int> ESPedestalClient::senP_
private

Definition at line 31 of file ESPedestalClient.h.

Referenced by book(), endJobAnalyze(), and ESPedestalClient().

std::vector<int> ESPedestalClient::senX_
private

Definition at line 32 of file ESPedestalClient.h.

Referenced by book(), endJobAnalyze(), and ESPedestalClient().

std::vector<int> ESPedestalClient::senY_
private

Definition at line 33 of file ESPedestalClient.h.

Referenced by book(), endJobAnalyze(), and ESPedestalClient().

std::vector<int> ESPedestalClient::senZ_
private

Definition at line 30 of file ESPedestalClient.h.

Referenced by book(), endJobAnalyze(), and ESPedestalClient().