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

#include <EBTrendClient.h>

Inheritance diagram for EBTrendClient:
edm::EDAnalyzer

Public Member Functions

 EBTrendClient (const edm::ParameterSet &ps)
 
virtual ~EBTrendClient ()
 
- 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 EBTrendClient.h.

Constructor & Destructor Documentation

EBTrendClient::EBTrendClient ( const edm::ParameterSet ps)

Definition at line 24 of file EBTrendClient.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 }
TObject * previousHist_[nHists_]
Definition: EBTrendClient.h:99
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
MonitorElement * sigmaHourly_[nHists_]
Definition: EBTrendClient.h:85
std::string prefixME_
Definition: EBTrendClient.h:73
TObject * currentHist_[nHists_]
MonitorElement * sigmaMinutely_[nHists_]
Definition: EBTrendClient.h:82
MonitorElement * meanHourly_[nHists_]
Definition: EBTrendClient.h:84
const int nHists_
Definition: EBTrendClient.h:25
MonitorElement * meanMinutely_[nHists_]
Definition: EBTrendClient.h:81
DQMStore * dqmStore_
Definition: EBTrendClient.h:71
EBTrendClient::~EBTrendClient ( )
virtual

Definition at line 53 of file EBTrendClient.cc.

53  {
54 }

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 218 of file EBTrendClient.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_.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 57 of file EBTrendClient.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_ + "/EBTrendClient");
63  dqmStore_->rmdir(prefixME_ + "/EBTrendClient");
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] = "EBClusterTask"; // TH1
77  histTitles_[index] = "EBCLT BC energy";
78  index++;
79 
80  moduleNames_[index] = "EBClusterTask"; // TH1
81  histTitles_[index] = "EBCLT SC energy";
82  index++;
83 
84  moduleNames_[index] = "EBSummaryClient"; // TProfile
85  histTitles_[index] = "EBPOT pedestal G12 mean";
86  index++;
87 
88  moduleNames_[index] = "EBSummaryClient"; // TProfile
89  histTitles_[index] = "EBPOT pedestal G12 rms";
90  index++;
91 
92  moduleNames_[index] = "EBOccupancyTask"; // TH2
93  histTitles_[index] = "EBOT rec hit thr occupancy";
94  index++;
95 
96  moduleNames_[index] = "EBOccupancyTask"; // TH2
97  histTitles_[index] = "EBOT TP digi thr occupancy";
98  index++;
99 
100 }
std::string histTitles_[nHists_]
Definition: EBTrendClient.h:94
void rmdir(const std::string &fullpath)
Definition: DQMStore.cc:2530
std::string prefixME_
Definition: EBTrendClient.h:73
std::string moduleNames_[nHists_]
Definition: EBTrendClient.h:93
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
DQMStore * dqmStore_
Definition: EBTrendClient.h:71
void EBTrendClient::beginRun ( const edm::Run r,
const edm::EventSetup c 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 103 of file EBTrendClient.cc.

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

103  {
104 
105  if ( ! mergeRuns_ ) this->reset();
106 
107  start_time_ = time(NULL);
108 
109 }
void reset(void)
#define NULL
Definition: scimark2.h:8
void EBTrendClient::cleanup ( void  )
protected

Definition at line 177 of file EBTrendClient.cc.

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

Referenced by endJob().

177  {
178 
179  if ( ! init_ ) return;
180 
181  if ( dqmStore_ ) {
182  dqmStore_->setCurrentFolder(prefixME_ + "/EBTrendClient");
183 
184  for(int i=0; i<nHists_; i++) {
186  meanMinutely_[i] = 0;
188  sigmaMinutely_[i] = 0;
189 
191  meanHourly_[i] = 0;
193  sigmaHourly_[i] = 0;
194 
195  if(previousHist_[i]) delete previousHist_[i];
196  previousHist_[i] = 0;
197  if(currentHist_[i]) delete currentHist_[i];
198  currentHist_[i] = 0;
199 
200  }// for
201 
202  }
203 
204  init_ = false;
205 
206 }
TObject * previousHist_[nHists_]
Definition: EBTrendClient.h:99
int i
Definition: DBlmapReader.cc:9
MonitorElement * sigmaHourly_[nHists_]
Definition: EBTrendClient.h:85
std::string prefixME_
Definition: EBTrendClient.h:73
TObject * currentHist_[nHists_]
MonitorElement * sigmaMinutely_[nHists_]
Definition: EBTrendClient.h:82
void removeElement(const std::string &name)
Definition: DQMStore.cc:2572
std::string getName(Reflex::Type &cc)
Definition: ClassFiller.cc:18
MonitorElement * meanHourly_[nHists_]
Definition: EBTrendClient.h:84
const int nHists_
Definition: EBTrendClient.h:25
MonitorElement * meanMinutely_[nHists_]
Definition: EBTrendClient.h:81
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
DQMStore * dqmStore_
Definition: EBTrendClient.h:71
void EBTrendClient::endJob ( void  )
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 209 of file EBTrendClient.cc.

References cleanup(), enableCleanup_, and ievt_.

209  {
210 
211  edm::LogInfo("EBTrendClient") << "analyzed " << ievt_ << " events";
212 
213  if ( enableCleanup_ ) this->cleanup();
214 
215 }
void cleanup(void)
void EBTrendClient::endRun ( const edm::Run r,
const edm::EventSetup c 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 112 of file EBTrendClient.cc.

112  {
113 
114 }
void EBTrendClient::reset ( void  )
protected

Definition at line 117 of file EBTrendClient.cc.

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

Referenced by beginRun().

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

Definition at line 130 of file EBTrendClient.cc.

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

Referenced by analyze().

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

Definition at line 299 of file EBTrendClient.cc.

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

Referenced by analyze().

299  {
300 
303 
304 }
#define NULL
Definition: scimark2.h:8

Member Data Documentation

int EBTrendClient::current_time_
private

Definition at line 90 of file EBTrendClient.h.

Referenced by analyze(), and updateTime().

TObject* EBTrendClient::currentHist_[nHists_]
private

Definition at line 100 of file EBTrendClient.h.

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

DQMStore* EBTrendClient::dqmStore_
private

Definition at line 71 of file EBTrendClient.h.

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

bool EBTrendClient::enableCleanup_
private

Definition at line 75 of file EBTrendClient.h.

Referenced by EBTrendClient(), and endJob().

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

Definition at line 94 of file EBTrendClient.h.

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

int EBTrendClient::ievt_
private

Definition at line 69 of file EBTrendClient.h.

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

bool EBTrendClient::init_
private

Definition at line 87 of file EBTrendClient.h.

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

int EBTrendClient::last_time_
private

Definition at line 91 of file EBTrendClient.h.

Referenced by analyze(), and updateTime().

double EBTrendClient::mean_[nHists_]
private

Definition at line 96 of file EBTrendClient.h.

Referenced by analyze().

MonitorElement* EBTrendClient::meanHourly_[nHists_]
private

Definition at line 84 of file EBTrendClient.h.

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

MonitorElement* EBTrendClient::meanMinutely_[nHists_]
private

Definition at line 81 of file EBTrendClient.h.

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

bool EBTrendClient::mergeRuns_
private

Definition at line 77 of file EBTrendClient.h.

Referenced by beginRun(), and EBTrendClient().

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

Definition at line 93 of file EBTrendClient.h.

Referenced by analyze(), and beginJob().

std::string EBTrendClient::prefixME_
private

Definition at line 73 of file EBTrendClient.h.

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

TObject* EBTrendClient::previousHist_[nHists_]
private

Definition at line 99 of file EBTrendClient.h.

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

double EBTrendClient::rms_[nHists_]
private

Definition at line 97 of file EBTrendClient.h.

Referenced by analyze().

MonitorElement* EBTrendClient::sigmaHourly_[nHists_]
private

Definition at line 85 of file EBTrendClient.h.

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

MonitorElement* EBTrendClient::sigmaMinutely_[nHists_]
private

Definition at line 82 of file EBTrendClient.h.

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

int EBTrendClient::start_time_
private

Definition at line 89 of file EBTrendClient.h.

Referenced by analyze(), and beginRun().

bool EBTrendClient::verbose_
private

Definition at line 79 of file EBTrendClient.h.

Referenced by analyze(), and EBTrendClient().