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

#include <ESPedestalClient.h>

Inheritance diagram for ESPedestalClient:
ESClient

Public Member Functions

void analyze (void)
 
void beginJob (DQMStore *dqmStore)
 
void beginRun (void)
 
void cleanup (void)
 
void endJob (void)
 
void endLumiAnalyze (void)
 
void endRun (void)
 
 ESPedestalClient (const edm::ParameterSet &ps)
 
int getEvtPerJob ()
 Get Functions. More...
 
int getEvtPerRun ()
 
void setup (void)
 
virtual ~ESPedestalClient ()
 
- Public Member Functions inherited from ESClient
template<typename T >
TgetHisto (MonitorElement *, bool=false, T *=0) const
 
virtual ~ESClient (void)
 

Private Attributes

bool debug_
 
DQMStoredqmStore_
 
bool enableCleanup_
 
TF1 * fg
 
bool fitPedestal_
 
MonitorElementhPed_ [2][2][40][40]
 
MonitorElementhTotN_ [2][2][40][40]
 
int ievt_
 
int jevt_
 
edm::FileInPath lookup_
 
int nLines_
 
std::string prefixME_
 
int senP_ [4288]
 
int senX_ [4288]
 
int senY_ [4288]
 
int senZ_ [4288]
 
bool verbose_
 

Friends

class ESSummaryClient
 

Detailed Description

Definition at line 20 of file ESPedestalClient.h.

Constructor & Destructor Documentation

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

Definition at line 17 of file ESPedestalClient.cc.

References edm::ParameterSet::getUntrackedParameter(), i, j, gen::k, and m.

17  {
18 
19  verbose_ = ps.getUntrackedParameter<bool>("verbose", true);
20  debug_ = ps.getUntrackedParameter<bool>("debug", true);
21  prefixME_ = ps.getUntrackedParameter<string>("prefixME", "EcalPreshower");
22  lookup_ = ps.getUntrackedParameter<FileInPath>("LookupTable");
23  enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
24  fitPedestal_ = ps.getUntrackedParameter<bool>("fitPedestal", false);
25 
26  for (int i=0; i<2; i++)
27  for (int j=0; j<2; j++)
28  for (int k=0; k<40; k++)
29  for (int m=0; m<40; m++) {
30  hPed_[i][j][k][m] = 0;
31  hTotN_[i][j][k][m] = 0;
32  }
33 
34 }
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
edm::FileInPath lookup_
MonitorElement * hTotN_[2][2][40][40]
int j
Definition: DBlmapReader.cc:9
int k[5][pyjets_maxn]
std::string prefixME_
MonitorElement * hPed_[2][2][40][40]
ESPedestalClient::~ESPedestalClient ( )
virtual

Definition at line 36 of file ESPedestalClient.cc.

36  {
37 }

Member Function Documentation

void ESPedestalClient::analyze ( void  )
virtual

Implements ESClient.

Definition at line 183 of file ESPedestalClient.cc.

183  {
184 
185  ievt_++;
186  jevt_++;
187 
188 }
void ESPedestalClient::beginJob ( DQMStore dqmStore)
virtual

Implements ESClient.

Definition at line 39 of file ESPedestalClient.cc.

References gather_cfg::cout.

39  {
40 
41  dqmStore_ = dqmStore;
42 
43  if ( debug_ ) cout << "ESPedestalClient: beginJob" << endl;
44 
45  ievt_ = 0;
46  jevt_ = 0;
47 
48 }
DQMStore * dqmStore_
tuple cout
Definition: gather_cfg.py:121
void ESPedestalClient::beginRun ( void  )
virtual

Implements ESClient.

Definition at line 50 of file ESPedestalClient.cc.

References gather_cfg::cout, and HcalObjRepresent::setup().

50  {
51 
52  if ( debug_ ) cout << "ESPedestalClient: beginRun" << endl;
53 
54  jevt_ = 0;
55 
56  this->setup();
57 }
tuple cout
Definition: gather_cfg.py:121
void ESPedestalClient::cleanup ( void  )
virtual

Implements ESClient.

Definition at line 167 of file ESPedestalClient.cc.

References gather_cfg::cout, i, j, gen::k, and m.

167  {
168 
169  if( ! enableCleanup_ ) return;
170 
171  if ( debug_ ) cout << "ESPedestalClient: cleanup" << endl;
172 
173  for (int i=0; i<2; i++)
174  for (int j=0; j<2; j++)
175  for (int k=0; k<40; k++)
176  for (int m=0; m<40; m++) {
177  hPed_[i][j][k][m] = 0;
178  hTotN_[i][j][k][m] = 0;
179  }
180 
181 }
int i
Definition: DBlmapReader.cc:9
MonitorElement * hTotN_[2][2][40][40]
int j
Definition: DBlmapReader.cc:9
int k[5][pyjets_maxn]
tuple cout
Definition: gather_cfg.py:121
MonitorElement * hPed_[2][2][40][40]
void ESPedestalClient::endJob ( void  )
virtual

Implements ESClient.

Definition at line 59 of file ESPedestalClient.cc.

References edm::cleanup(), gather_cfg::cout, MonitorElement::getTH1F(), and i.

59  {
60 
61  if ( debug_ ) cout << "ESPedestalClient: endJob, ievt = " << ievt_ << 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 (int i=0; i<nLines_; ++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 = dqmStore_->get(dirname+hname);
79 
80  if (meFit==0) continue;
81  TH1F *rootHisto = meFit->getTH1F();
82  rootHisto->Fit("fg", "Q", "", 500, 1800);
83  rootHisto->Fit("fg", "RQ", "", fg->GetParameter(1)-2.*fg->GetParameter(2),fg->GetParameter(1)+2.*fg->GetParameter(2));
84  hPed_[iz][senP_[i]-1][senX_[i]-1][senY_[i]-1]->setBinContent(is+1, (int)(fg->GetParameter(1)+0.5));
85  hTotN_[iz][senP_[i]-1][senX_[i]-1][senY_[i]-1]->setBinContent(is+1, fg->GetParameter(2));
86 
87  }
88  }
89 
90  } else {
91 
92  if ( verbose_ ) cout<<"ESPedestalClient: Use Histogram Mean"<<endl;
93 
94  for (int i=0; i<nLines_; ++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 = dqmStore_->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 
114  this->cleanup();
115 }
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) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1708
DQMStore * dqmStore_
TH1F * getTH1F(void) const
std::string prefixME_
tuple cout
Definition: gather_cfg.py:121
MonitorElement * hPed_[2][2][40][40]
void ESPedestalClient::endLumiAnalyze ( void  )
inlinevirtual

Implements ESClient.

Definition at line 34 of file ESPedestalClient.h.

34 {}
void ESPedestalClient::endRun ( void  )
virtual

Implements ESClient.

Definition at line 117 of file ESPedestalClient.cc.

References edm::cleanup(), and gather_cfg::cout.

117  {
118 
119  if ( debug_ ) cout << "ESPedestalClient: endRun, jevt = " << jevt_ << endl;
120 
121  this->cleanup();
122 }
tuple cout
Definition: gather_cfg.py:121
int ESPedestalClient::getEvtPerJob ( )
inline

Get Functions.

Definition at line 37 of file ESPedestalClient.h.

References ievt_.

37 { return ievt_; }
int ESPedestalClient::getEvtPerRun ( )
inline

Definition at line 38 of file ESPedestalClient.h.

References jevt_.

38 { return jevt_; }
void ESPedestalClient::setup ( void  )
virtual

Implements ESClient.

Definition at line 124 of file ESPedestalClient.cc.

References gather_cfg::cout, mergeVDriftHistosByStation::file, and i.

124  {
125 
126  // read in look-up table
127  int iz, ip, ix, iy, fed, kchip, pace, bundle, fiber, optorx;
128  ifstream file;
129 
130  file.open(lookup_.fullPath().c_str());
131  if( file.is_open() ) {
132 
133  file >> nLines_;
134 
135  for (int i=0; i<nLines_; ++i) {
136  file>> iz >> ip >> ix >> iy >> fed >> kchip >> pace >> bundle >> fiber >> optorx;
137 
138  senZ_[i] = iz;
139  senP_[i] = ip;
140  senX_[i] = ix;
141  senY_[i] = iy;
142  }
143 
144  } else {
145  cout<<"ESPedestalClient : Look up table file can not be found in "<<lookup_.fullPath().c_str()<<endl;
146  }
147 
148  // define histograms
149  dqmStore_->setCurrentFolder(prefixME_+"/ESPedestalClient");
150 
151  char hname[300];
152  for (int i=0; i<nLines_; ++i) {
153 
154  iz = (senZ_[i]==1) ? 0:1;
155 
156  sprintf(hname, "Ped Z %d P %d X %d Y %d", senZ_[i], senP_[i], senX_[i], senY_[i]);
157  hPed_[iz][senP_[i]-1][senX_[i]-1][senY_[i]-1] = dqmStore_->book1D(hname, hname, 32, 0, 32);
158 
159  sprintf(hname, "Total Noise Z %d P %d X %d Y %d", senZ_[i], senP_[i], senX_[i], senY_[i]);
160  hTotN_[iz][senP_[i]-1][senX_[i]-1][senY_[i]-1] = dqmStore_->book1D(hname, hname, 32, 0, 32);
161  }
162 
163  fg = new TF1("fg", "gaus");
164 
165 }
int i
Definition: DBlmapReader.cc:9
edm::FileInPath lookup_
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:954
MonitorElement * hTotN_[2][2][40][40]
DQMStore * dqmStore_
std::string prefixME_
tuple cout
Definition: gather_cfg.py:121
std::string fullPath() const
Definition: FileInPath.cc:165
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:667
MonitorElement * hPed_[2][2][40][40]

Friends And Related Function Documentation

friend class ESSummaryClient
friend

Definition at line 22 of file ESPedestalClient.h.

Member Data Documentation

bool ESPedestalClient::debug_
private

Definition at line 47 of file ESPedestalClient.h.

DQMStore* ESPedestalClient::dqmStore_
private

Definition at line 54 of file ESPedestalClient.h.

bool ESPedestalClient::enableCleanup_
private

Definition at line 45 of file ESPedestalClient.h.

TF1* ESPedestalClient::fg
private

Definition at line 59 of file ESPedestalClient.h.

bool ESPedestalClient::fitPedestal_
private

Definition at line 48 of file ESPedestalClient.h.

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

Definition at line 56 of file ESPedestalClient.h.

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

Definition at line 57 of file ESPedestalClient.h.

int ESPedestalClient::ievt_
private

Definition at line 43 of file ESPedestalClient.h.

Referenced by getEvtPerJob().

int ESPedestalClient::jevt_
private

Definition at line 44 of file ESPedestalClient.h.

Referenced by getEvtPerRun().

edm::FileInPath ESPedestalClient::lookup_
private

Definition at line 51 of file ESPedestalClient.h.

int ESPedestalClient::nLines_
private

Definition at line 61 of file ESPedestalClient.h.

std::string ESPedestalClient::prefixME_
private

Definition at line 52 of file ESPedestalClient.h.

int ESPedestalClient::senP_[4288]
private

Definition at line 65 of file ESPedestalClient.h.

int ESPedestalClient::senX_[4288]
private

Definition at line 65 of file ESPedestalClient.h.

int ESPedestalClient::senY_[4288]
private

Definition at line 65 of file ESPedestalClient.h.

int ESPedestalClient::senZ_[4288]
private

Definition at line 65 of file ESPedestalClient.h.

bool ESPedestalClient::verbose_
private

Definition at line 46 of file ESPedestalClient.h.