CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions | Private Attributes
EETrendClient Class Reference

#include <EETrendClient.h>

Inheritance diagram for EETrendClient:
edm::EDAnalyzer

Public Member Functions

 EETrendClient (const edm::ParameterSet &ps)
 
virtual ~EETrendClient ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c)
 
void beginJob (void)
 
void beginRun (const edm::Run &r, const edm::EventSetup &c)
 
void cleanup (void)
 
void endJob (void)
 
void endRun (const edm::Run &r, const edm::EventSetup &c)
 
void reset (void)
 
void setup (void)
 
void updateTime (void)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Private Attributes

int current_time_
 
TObject * currentHist_ [nHists_]
 
DQMStoredqmStore_
 
bool enableCleanup_
 
std::string histTitles_ [nHists_]
 
int ievt_
 
bool init_
 
int last_time_
 
double mean_ [nHists_]
 
MonitorElementmeanHourly_ [nHists_]
 
MonitorElementmeanMinutely_ [nHists_]
 
bool mergeRuns_
 
std::string moduleNames_ [nHists_]
 
std::string prefixME_
 
TObject * previousHist_ [nHists_]
 
double rms_ [nHists_]
 
MonitorElementsigmaHourly_ [nHists_]
 
MonitorElementsigmaMinutely_ [nHists_]
 
int start_time_
 
bool verbose_
 

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)
 
static void prevalidate (ConfigurationDescriptions &)
 

Detailed Description

Definition at line 27 of file EETrendClient.h.

Constructor & Destructor Documentation

EETrendClient::EETrendClient ( const edm::ParameterSet ps)

Definition at line 24 of file EETrendClient.cc.

References currentHist_, dqmStore_, enableCleanup_, edm::ParameterSet::getUntrackedParameter(), i, init_, meanHourly_, meanMinutely_, mergeRuns_, nHists_, cppFunctionSkipper::operator, prefixME_, previousHist_, sigmaHourly_, sigmaMinutely_, and verbose_.

24  {
25 
26  init_ = false;
27 
29 
30  prefixME_ = ps.getUntrackedParameter<std::string>("prefixME", "");
31 
32  enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
33 
34  mergeRuns_ = ps.getUntrackedParameter<bool>("mergeRuns", false);
35 
36  verbose_ = ps.getUntrackedParameter<bool>("verbose", false);
37 
38  // histograms...
39  for(int i=0; i<nHists_; i++) {
40  meanMinutely_[i] = 0;
41  sigmaMinutely_[i] = 0;
42 
43  meanHourly_[i] = 0;
44  sigmaHourly_[i] = 0;
45 
46  previousHist_[i] = 0;
47  currentHist_[i] = 0;
48  } // for
49 
50 }
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
TObject * previousHist_[nHists_]
Definition: EETrendClient.h:99
DQMStore * dqmStore_
Definition: EETrendClient.h:71
MonitorElement * sigmaHourly_[nHists_]
Definition: EETrendClient.h:85
MonitorElement * meanMinutely_[nHists_]
Definition: EETrendClient.h:81
TObject * currentHist_[nHists_]
const int nHists_
Definition: EBTrendClient.h:25
MonitorElement * meanHourly_[nHists_]
Definition: EETrendClient.h:84
MonitorElement * sigmaMinutely_[nHists_]
Definition: EETrendClient.h:82
std::string prefixME_
Definition: EETrendClient.h:73
EETrendClient::~EETrendClient ( )
virtual

Definition at line 53 of file EETrendClient.cc.

53  {
54 }

Member Function Documentation

void EETrendClient::analyze ( const edm::Event e,
const edm::EventSetup c 
)
protectedvirtual

Implements edm::EDAnalyzer.

Definition at line 226 of file EETrendClient.cc.

References ecaldqm::calcBins(), ecaldqm::cloneIt(), gather_cfg::cout, current_time_, currentHist_, dqmStore_, MonitorElement::Fill(), DQMStore::get(), ecaldqm::getMeanRms(), getTProfile(), interpolateCardsSimple::histo, histTitles_, i, ievt_, init_, last_time_, mean_, meanHourly_, meanMinutely_, moduleNames_, nHists_, prefixME_, previousHist_, rms_, setup(), ecaldqm::shift2Right(), sigmaHourly_, sigmaMinutely_, start_time_, updateTime(), and verbose_.

226  {
227 
228  if ( ! init_ ) this->setup();
229 
230  ievt_++;
231 
232  // --------------------------------------------------
233  // Collect time information
234  // --------------------------------------------------
235 
236  updateTime();
237 
238  // long int diff_time = (current_time_ - start_time_)/60;
239 
240  long int minuteBinDiff = -1;
241  long int minuteDiff = -1;
242  // ecaldqm::calcBins(5,1,start_time_,last_time_,current_time_,minuteBinDiff,minuteDiff);
243  ecaldqm::calcBins(5,60,start_time_,last_time_,current_time_,minuteBinDiff,minuteDiff);
244 
245  if(minuteBinDiff <= 0) return;
246 
247  long int hourBinDiff = -1;
248  long int hourDiff = -1;
249  ecaldqm::calcBins(1,3600,start_time_,last_time_,current_time_,hourBinDiff,hourDiff);
250 
251 
252  for(int i=0; i<nHists_; i++){
253 
254  mean_[i] = rms_[i] = 0;
255 
256  // delete previous hists if any
257  if(previousHist_[i]) delete previousHist_[i];
258 
259  // assign currentHists to previousHists
261 
262  } // for i
263 
264 
265  std::string histo;
266 
267  MonitorElement* me;
268 
269  // get clones of histograms from other tasks or clients
270  // assign cloned histogrmas to currentHist_[i]
271 
272  for(int i=0; i<nHists_; i++) {
273  histo = prefixME_ + "/" + moduleNames_[i] + "/" + histTitles_[i];
274  me = dqmStore_->get(histo.c_str());
275  currentHist_[i] = ecaldqm::cloneIt(me,histo);
276  }
277 
278 
279  // Get mean and rms and fill Profile
280 
281  for(int i=0; i<nHists_; i++){
282 
284 
285  if(verbose_) {
286  std::cout << std::scientific;
287  std::cout << "EETrendClient mean["<<i<<"] = " << mean_[i] << ", \t rms["<<i<<"] = " << rms_[i] << std::endl;
288  }
289 
290  ecaldqm::shift2Right(meanMinutely_[i]->getTProfile(), minuteBinDiff);
291  meanMinutely_[i]->Fill(minuteDiff,mean_[i]);
292 
293  ecaldqm::shift2Right(sigmaMinutely_[i]->getTProfile(), minuteBinDiff);
294  sigmaMinutely_[i]->Fill(minuteDiff,rms_[i]);
295 
296  ecaldqm::shift2Right(meanHourly_[i]->getTProfile(), hourBinDiff);
297  meanHourly_[i]->Fill(hourDiff,mean_[i]);
298 
299  ecaldqm::shift2Right(sigmaHourly_[i]->getTProfile(), hourBinDiff);
300  sigmaHourly_[i]->Fill(hourDiff,rms_[i]);
301  } // for i
302 
303 
304 }
int i
Definition: DBlmapReader.cc:9
TProfile * getTProfile(std::string name, std::string process, std::string rootfolder, DQMStore *dbe_, bool verb, bool clone)
void updateTime(void)
double mean_[nHists_]
Definition: EETrendClient.h:96
void setup(void)
TObject * previousHist_[nHists_]
Definition: EETrendClient.h:99
DQMStore * dqmStore_
Definition: EETrendClient.h:71
void Fill(long long x)
MonitorElement * sigmaHourly_[nHists_]
Definition: EETrendClient.h:85
std::string moduleNames_[nHists_]
Definition: EETrendClient.h:93
MonitorElement * meanMinutely_[nHists_]
Definition: EETrendClient.h:81
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1468
TObject * currentHist_[nHists_]
const int nHists_
Definition: EBTrendClient.h:25
TObject * cloneIt(MonitorElement *me, std::string histo)
MonitorElement * meanHourly_[nHists_]
Definition: EETrendClient.h:84
double rms_[nHists_]
Definition: EETrendClient.h:97
tuple cout
Definition: gather_cfg.py:121
void calcBins(int binWidth, int divisor, long int start_time, long int last_time, long int current_time, long int &binDiff, long int &diff)
MonitorElement * sigmaMinutely_[nHists_]
Definition: EETrendClient.h:82
void shift2Right(TH1 *h, int bins)
std::string histTitles_[nHists_]
Definition: EETrendClient.h:94
void getMeanRms(TObject *pre, TObject *cur, double &mean, double &rms)
std::string prefixME_
Definition: EETrendClient.h:73
void EETrendClient::beginJob ( void  )
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 57 of file EETrendClient.cc.

References dqmStore_, histTitles_, ievt_, getHLTprescales::index, moduleNames_, prefixME_, DQMStore::rmdir(), and DQMStore::setCurrentFolder().

57  {
58 
59  ievt_ = 0;
60 
61  if ( dqmStore_ ) {
62  dqmStore_->setCurrentFolder(prefixME_ + "/EETrendClient");
63  dqmStore_->rmdir(prefixME_ + "/EETrendClient");
64  }
65 
66  // noise,
67  // entries of EBOT rec hit thr occupancy
68  // entries of EBOT tp digi occupancy
69  // rec hit energy
70  // ebtmt timing mean ID summary
71  // ebtmt timing RMS ID summary
72  //
73 
74  int index = 0;
75 
76  moduleNames_[index] = "EEClusterTask"; // TH1
77  histTitles_[index] = "EECLT BC energy";
78  index++;
79 
80  moduleNames_[index] = "EEClusterTask"; // TH1
81  histTitles_[index] = "EECLT SC energy";
82  index++;
83 
84  moduleNames_[index] = "EESummaryClient"; // TProfile
85  histTitles_[index] = "EEPOT pedestal G12 mean";
86  index++;
87 
88  moduleNames_[index] = "EESummaryClient"; // TProfile
89  histTitles_[index] = "EEPOT pedestal G12 rms";
90  index++;
91 
92  moduleNames_[index] = "EEOccupancyTask"; // TH2
93  histTitles_[index] = "EEOT rec hit thr occupancy EE -";
94  index++;
95 
96  moduleNames_[index] = "EEOccupancyTask"; // TH2
97  histTitles_[index] = "EEOT rec hit thr occupancy EE +";
98  index++;
99 
100  moduleNames_[index] = "EEOccupancyTask"; // TH2
101  histTitles_[index] = "EEOT TP digi thr occupancy EE -";
102  index++;
103 
104  moduleNames_[index] = "EEOccupancyTask"; // TH2
105  histTitles_[index] = "EEOT TP digi thr occupancy EE +";
106  index++;
107 
108 }
void rmdir(const std::string &fullpath)
Definition: DQMStore.cc:2530
DQMStore * dqmStore_
Definition: EETrendClient.h:71
std::string moduleNames_[nHists_]
Definition: EETrendClient.h:93
std::string histTitles_[nHists_]
Definition: EETrendClient.h:94
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
std::string prefixME_
Definition: EETrendClient.h:73
void EETrendClient::beginRun ( const edm::Run r,
const edm::EventSetup c 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 111 of file EETrendClient.cc.

References mergeRuns_, NULL, reset(), start_time_, and cond::rpcobgas::time.

111  {
112 
113  if ( ! mergeRuns_ ) this->reset();
114 
115  start_time_ = time(NULL);
116 
117 }
#define NULL
Definition: scimark2.h:8
void reset(void)
void EETrendClient::cleanup ( void  )
protected

Definition at line 185 of file EETrendClient.cc.

References currentHist_, dqmStore_, edm::getName(), i, init_, meanHourly_, meanMinutely_, nHists_, prefixME_, previousHist_, DQMStore::removeElement(), DQMStore::setCurrentFolder(), sigmaHourly_, and sigmaMinutely_.

Referenced by endJob().

185  {
186 
187  if ( ! init_ ) return;
188 
189  if ( dqmStore_ ) {
190  dqmStore_->setCurrentFolder(prefixME_ + "/EETrendClient");
191 
192  for(int i=0; i<nHists_; i++) {
194  meanMinutely_[i] = 0;
196  sigmaMinutely_[i] = 0;
197 
199  meanHourly_[i] = 0;
201  sigmaHourly_[i] = 0;
202 
203  if(previousHist_[i]) delete previousHist_[i];
204  previousHist_[i] = 0;
205  if(currentHist_[i]) delete currentHist_[i];
206  currentHist_[i] = 0;
207 
208  }// for
209 
210  }
211 
212  init_ = false;
213 
214 }
int i
Definition: DBlmapReader.cc:9
TObject * previousHist_[nHists_]
Definition: EETrendClient.h:99
DQMStore * dqmStore_
Definition: EETrendClient.h:71
MonitorElement * sigmaHourly_[nHists_]
Definition: EETrendClient.h:85
void removeElement(const std::string &name)
Definition: DQMStore.cc:2572
MonitorElement * meanMinutely_[nHists_]
Definition: EETrendClient.h:81
std::string getName(Reflex::Type &cc)
Definition: ClassFiller.cc:18
TObject * currentHist_[nHists_]
const int nHists_
Definition: EBTrendClient.h:25
MonitorElement * meanHourly_[nHists_]
Definition: EETrendClient.h:84
MonitorElement * sigmaMinutely_[nHists_]
Definition: EETrendClient.h:82
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
std::string prefixME_
Definition: EETrendClient.h:73
void EETrendClient::endJob ( void  )
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 217 of file EETrendClient.cc.

References cleanup(), enableCleanup_, and ievt_.

217  {
218 
219  edm::LogInfo("EETrendClient") << "analyzed " << ievt_ << " events";
220 
221  if ( enableCleanup_ ) this->cleanup();
222 
223 }
void cleanup(void)
void EETrendClient::endRun ( const edm::Run r,
const edm::EventSetup c 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 120 of file EETrendClient.cc.

120  {
121 
122 }
void EETrendClient::reset ( void  )
protected

Definition at line 125 of file EETrendClient.cc.

References i, meanHourly_, meanMinutely_, nHists_, MonitorElement::Reset(), sigmaHourly_, and sigmaMinutely_.

Referenced by beginRun().

125  {
126 
127  for(int i=0; i<nHists_; i++) {
130 
131  if(meanHourly_[i]) meanHourly_[i]->Reset();
132  if(sigmaHourly_[i]) sigmaHourly_[i]->Reset();
133  }// for
134 
135 }
int i
Definition: DBlmapReader.cc:9
MonitorElement * sigmaHourly_[nHists_]
Definition: EETrendClient.h:85
MonitorElement * meanMinutely_[nHists_]
Definition: EETrendClient.h:81
const int nHists_
Definition: EBTrendClient.h:25
MonitorElement * meanHourly_[nHists_]
Definition: EETrendClient.h:84
MonitorElement * sigmaMinutely_[nHists_]
Definition: EETrendClient.h:82
void Reset(void)
reset ME (ie. contents, errors, etc)
void EETrendClient::setup ( void  )
protected

Definition at line 138 of file EETrendClient.cc.

References DQMStore::bookProfile(), dqmStore_, interpolateCardsSimple::histo, histTitles_, i, init_, meanHourly_, meanMinutely_, nHists_, prefixME_, MonitorElement::setAxisTitle(), DQMStore::setCurrentFolder(), sigmaHourly_, and sigmaMinutely_.

Referenced by analyze().

138  {
139 
140  init_ = true;
141 
142  std::string histo;
143 
144  if ( dqmStore_ ) {
145  dqmStore_->setCurrentFolder(prefixME_ + "/EETrendClient");
146 
147  for(int i=0; i<nHists_; i++) {
148 
149  // minutely
150 
151  histo = "Average of " + histTitles_[i] + " Vs 5Minutes";
152  meanMinutely_[i] = dqmStore_->bookProfile(histo.c_str(), histo.c_str(), 12, 0.0, 60.0, 100, 0.0, 1.0e6, "s");
153  meanMinutely_[i]->setAxisTitle("Minutes", 1);
154  histo = "Average of " + histTitles_[i] + " / 5 minutes";
155  meanMinutely_[i]->setAxisTitle(histo.c_str(), 2);
156 
157  histo = "RMS of " + histTitles_[i] + " Vs 5Minutes";
158  sigmaMinutely_[i] = dqmStore_->bookProfile(histo.c_str(), histo.c_str(), 12, 0.0, 60.0, 100, 0.0, 1.0e6, "s");
159  sigmaMinutely_[i]->setAxisTitle("Minutes", 1);
160  histo = "RMS of " + histTitles_[i] + " / 5 minutes";
161  sigmaMinutely_[i]->setAxisTitle(histo.c_str(), 2);
162 
163 
164  // hourly
165 
166  histo = "Average of " + histTitles_[i] + " Vs 1Hour";
167  meanHourly_[i] = dqmStore_->bookProfile(histo.c_str(), histo.c_str(), 24, 0.0, 24.0, 100, 0.0, 1.0e6, "s");
168  meanHourly_[i]->setAxisTitle("Hours", 1);
169  histo = "Average of " + histTitles_[i] + " / hour";
170  meanHourly_[i]->setAxisTitle(histo.c_str(), 2);
171 
172  histo = "RMS of " + histTitles_[i] + " Vs 1Hour";
173  sigmaHourly_[i] = dqmStore_->bookProfile(histo.c_str(), histo.c_str(), 24, 0.0, 24.0, 100, 0.0, 1.0e6, "s");
174  sigmaHourly_[i]->setAxisTitle("Hours", 1);
175  histo = "RMS of " + histTitles_[i] + " / hour";
176  sigmaHourly_[i]->setAxisTitle(histo.c_str(), 2);
177 
178  }// for i
179 
180  }// if
181 
182 }
int i
Definition: DBlmapReader.cc:9
DQMStore * dqmStore_
Definition: EETrendClient.h:71
MonitorElement * sigmaHourly_[nHists_]
Definition: EETrendClient.h:85
MonitorElement * meanMinutely_[nHists_]
Definition: EETrendClient.h:81
MonitorElement * bookProfile(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const char *option="s")
Definition: DQMStore.cc:1031
const int nHists_
Definition: EBTrendClient.h:25
MonitorElement * meanHourly_[nHists_]
Definition: EETrendClient.h:84
MonitorElement * sigmaMinutely_[nHists_]
Definition: EETrendClient.h:82
std::string histTitles_[nHists_]
Definition: EETrendClient.h:94
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
std::string prefixME_
Definition: EETrendClient.h:73
void EETrendClient::updateTime ( void  )
protected

Definition at line 307 of file EETrendClient.cc.

References current_time_, last_time_, NULL, and cond::rpcobgas::time.

Referenced by analyze().

307  {
308 
311 
312 }
#define NULL
Definition: scimark2.h:8

Member Data Documentation

int EETrendClient::current_time_
private

Definition at line 90 of file EETrendClient.h.

Referenced by analyze(), and updateTime().

TObject* EETrendClient::currentHist_[nHists_]
private

Definition at line 100 of file EETrendClient.h.

Referenced by analyze(), cleanup(), and EETrendClient().

DQMStore* EETrendClient::dqmStore_
private

Definition at line 71 of file EETrendClient.h.

Referenced by analyze(), beginJob(), cleanup(), EETrendClient(), and setup().

bool EETrendClient::enableCleanup_
private

Definition at line 75 of file EETrendClient.h.

Referenced by EETrendClient(), and endJob().

std::string EETrendClient::histTitles_[nHists_]
private

Definition at line 94 of file EETrendClient.h.

Referenced by analyze(), beginJob(), and setup().

int EETrendClient::ievt_
private

Definition at line 69 of file EETrendClient.h.

Referenced by analyze(), beginJob(), and endJob().

bool EETrendClient::init_
private

Definition at line 87 of file EETrendClient.h.

Referenced by analyze(), cleanup(), EETrendClient(), and setup().

int EETrendClient::last_time_
private

Definition at line 91 of file EETrendClient.h.

Referenced by analyze(), and updateTime().

double EETrendClient::mean_[nHists_]
private

Definition at line 96 of file EETrendClient.h.

Referenced by analyze().

MonitorElement* EETrendClient::meanHourly_[nHists_]
private

Definition at line 84 of file EETrendClient.h.

Referenced by analyze(), cleanup(), EETrendClient(), reset(), and setup().

MonitorElement* EETrendClient::meanMinutely_[nHists_]
private

Definition at line 81 of file EETrendClient.h.

Referenced by analyze(), cleanup(), EETrendClient(), reset(), and setup().

bool EETrendClient::mergeRuns_
private

Definition at line 77 of file EETrendClient.h.

Referenced by beginRun(), and EETrendClient().

std::string EETrendClient::moduleNames_[nHists_]
private

Definition at line 93 of file EETrendClient.h.

Referenced by analyze(), and beginJob().

std::string EETrendClient::prefixME_
private

Definition at line 73 of file EETrendClient.h.

Referenced by analyze(), beginJob(), cleanup(), EETrendClient(), and setup().

TObject* EETrendClient::previousHist_[nHists_]
private

Definition at line 99 of file EETrendClient.h.

Referenced by analyze(), cleanup(), and EETrendClient().

double EETrendClient::rms_[nHists_]
private

Definition at line 97 of file EETrendClient.h.

Referenced by analyze().

MonitorElement* EETrendClient::sigmaHourly_[nHists_]
private

Definition at line 85 of file EETrendClient.h.

Referenced by analyze(), cleanup(), EETrendClient(), reset(), and setup().

MonitorElement* EETrendClient::sigmaMinutely_[nHists_]
private

Definition at line 82 of file EETrendClient.h.

Referenced by analyze(), cleanup(), EETrendClient(), reset(), and setup().

int EETrendClient::start_time_
private

Definition at line 89 of file EETrendClient.h.

Referenced by analyze(), and beginRun().

bool EETrendClient::verbose_
private

Definition at line 79 of file EETrendClient.h.

Referenced by analyze(), and EETrendClient().