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

#include <DTTimeEvolutionHisto.h>

Public Member Functions

void accumulateValueTimeSlot (float value)
 
 DTTimeEvolutionHisto (DQMStore *dbe, const std::string &name, const std::string &title, int nbins, int lsPrescale, bool sliding, int mode=0)
 
 DTTimeEvolutionHisto (DQMStore *dbe, const std::string &name, const std::string &title, int nbins, int firstLS, int lsPrescale, bool sliding, int mode=0)
 
 DTTimeEvolutionHisto (DQMStore *dbe, const std::string &name)
 retrieve the monitor element from DQMStore More...
 
void normalizeTo (const MonitorElement *histForNorm)
 
void setTimeSlotValue (float value, int timeSlot)
 
void updateTimeSlot (int ls, int nEventsInLS)
 
virtual ~DTTimeEvolutionHisto ()
 Destructor. More...
 

Private Attributes

bool doSlide
 
int firstLSinTimeSlot
 
MonitorElementhisto
 
int nBookedBins
 
int nEventsInLastTimeSlot
 
int nLSinTimeSlot
 
int theFirstLS
 
int theLSPrescale
 
int theMode
 
float valueLastTimeSlot
 

Detailed Description

No description available.

Date:
2009/10/19 15:53:01
Revision:
1.2
Author
G. Cerminara - INFN Torino

Definition at line 18 of file DTTimeEvolutionHisto.h.

Constructor & Destructor Documentation

DTTimeEvolutionHisto::DTTimeEvolutionHisto ( DQMStore dbe,
const std::string &  name,
const std::string &  title,
int  nbins,
int  lsPrescale,
bool  sliding,
int  mode = 0 
)

Constructor Parameters are:

  • pointer to DQMStore
  • name of the MonitorElement
  • title of the MonitorElement
  • # of bins
  • # of LumiSections per bin
  • mode:
    0 -> rate (over event)
    need to fill using accumulateValueTimeSlot and updateTimeSlot methods
    1 -> # of entries
    2 -> # of events
    3 -> mean over LSs
DTTimeEvolutionHisto::DTTimeEvolutionHisto ( DQMStore dbe,
const std::string &  name,
const std::string &  title,
int  nbins,
int  firstLS,
int  lsPrescale,
bool  sliding,
int  mode = 0 
)
DTTimeEvolutionHisto::DTTimeEvolutionHisto ( DQMStore dbe,
const std::string &  name 
)

retrieve the monitor element from DQMStore

DTTimeEvolutionHisto::~DTTimeEvolutionHisto ( )
virtual

Destructor.

Definition at line 151 of file DTTimeEvolutionHisto.cc.

151 {}

Member Function Documentation

void DTTimeEvolutionHisto::accumulateValueTimeSlot ( float  value)
void DTTimeEvolutionHisto::normalizeTo ( const MonitorElement histForNorm)

Definition at line 246 of file DTTimeEvolutionHisto.cc.

References newFWLiteAna::bin, MonitorElement::getBinContent(), MonitorElement::getNbinsX(), histo, and MonitorElement::setBinContent().

Referenced by DTSegmentAnalysisTest::endRun().

246  {
247  if(histo == 0) {
248  LogWarning("DTDQM|DTMonitorModule|DTMonitorClient|DTTimeEvolutionHisto")
249  << "[DTTimeEvolutionHisto]***Error: pointer to ME is NULL" << endl;
250  return;
251  }
252  int nBins = histo->getNbinsX();
253  if(histForNorm->getNbinsX() != nBins) {
254  LogWarning("DTDQM|DTMonitorModule|DTMonitorClient|DTTimeEvolutionHisto")
255  << "[DTTimeEvolutionHisto]***Error: normalizing histos with != # of bins" << endl;
256  return;
257  }
258  for(int bin = 1; bin <= nBins; ++bin) { // loop over bins
259  if(histForNorm->getBinContent(bin) != 0) {
260  double normValue = histo->getBinContent(bin)/histForNorm->getBinContent(bin);
261  LogVerbatim("DTDQM|DTMonitorModule|DTMonitorClient|DTTimeEvolutionHisto")
262  << "[DTTimeEvolutionHisto] Normalizing bin: " << bin << " to: " << histo->getBinContent(bin) << " / " << histForNorm->getBinContent(bin)
263  << " = " << normValue << endl;
264  histo->setBinContent(bin, normValue);
265  } else {
266  histo->setBinContent(bin, 0);
267  }
268  }
269 }
void setBinContent(int binx, double content)
set content of bin (1-D)
double getBinContent(int binx) const
get content of bin (1-D)
int getNbinsX(void) const
get # of bins in X-axis
void DTTimeEvolutionHisto::setTimeSlotValue ( float  value,
int  timeSlot 
)

Definition at line 155 of file DTTimeEvolutionHisto.cc.

References newFWLiteAna::bin, doSlide, MonitorElement::Fill(), MonitorElement::getBinContent(), MonitorElement::getBinError(), MonitorElement::getTH1F(), histo, nBookedBins, MonitorElement::setBinContent(), MonitorElement::setBinError(), and MonitorElement::setBinLabel().

Referenced by DTDCSByLumiSummary::endRun(), and updateTimeSlot().

155  {
156  // LogVerbatim("DTDQM|DTMonitorModule|DTMonitorClient|DTTimeEvolutionHisto")
157  // << "[DTTimeEvolutionHisto] ME name: " << histo->getName() << endl;
158  if(!doSlide) {
159  // LogVerbatim("DTDQM|DTMonitorModule|DTMonitorClient|DTTimeEvolutionHisto")
160  // << " fill bin: " << timeSlot << " with value: " << value << endl;
161  histo->Fill(timeSlot,value);
162  } else {
163  for(int bin = 1; bin != nBookedBins; ++bin) {
164  float value = histo->getBinContent(bin);
165  // LogVerbatim("DTDQM|DTMonitorModule|DTMonitorClient|DTTimeEvolutionHisto")
166  // << " bin: " << bin << " has value: " << value << endl;
167  if(bin == 1) { // average of previous time slots (fixme)
168  histo->setBinContent(bin, (value + histo->getBinContent(bin+1))/2.);
169  } else if(bin != nBookedBins) {
172  histo->setBinLabel(bin, histo->getTH1F()->GetXaxis()->GetBinLabel(bin+1),1);
173  }
174  }
176  }
177 }
void setBinContent(int binx, double content)
set content of bin (1-D)
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
void Fill(long long x)
void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
double getBinError(int binx) const
get uncertainty on content of bin (1-D) - See TH1::GetBinError for details
TH1F * getTH1F(void) const
double getBinContent(int binx) const
get content of bin (1-D)
void DTTimeEvolutionHisto::updateTimeSlot ( int  ls,
int  nEventsInLS 
)

Definition at line 186 of file DTTimeEvolutionHisto.cc.

References doSlide, firstLSinTimeSlot, MonitorElement::getBinContent(), histo, python.rootplot.utilities::ls(), nBookedBins, nEventsInLastTimeSlot, nLSinTimeSlot, MonitorElement::setBinLabel(), setTimeSlotValue(), theFirstLS, theLSPrescale, theMode, relativeConstraints::value, and valueLastTimeSlot.

Referenced by DTSegmentAnalysisTask::endLuminosityBlock(), and DTBlockedROChannelsTest::performClientDiagnostic().

186  {
187 
188  if(doSlide) { // sliding bins
189  // count LS in this time-slot
190  nLSinTimeSlot++;
191  nEventsInLastTimeSlot += nEventsInLS;
192 
194 
195  if(nLSinTimeSlot%theLSPrescale ==0) { // update the value of the slot and reset the counters
196  LogVerbatim("DTDQM|DTMonitorModule|DTMonitorClient|DTTimeEvolutionHisto")
197  << "[DTTimeEvolutionHisto] Update time-slot, # entries: " << valueLastTimeSlot
198  << " # events: " << nEventsInLastTimeSlot << endl;
199  // set the bin content
200  float value = 0;
201  if(theMode == 0) {
203  } else if(theMode == 1) {
204  value = valueLastTimeSlot;
205  } else if(theMode == 2) {
206  value = nEventsInLastTimeSlot;
207  } else if(theMode == 3) {
209  }
211  LogVerbatim("DTDQM|DTMonitorModule|DTMonitorClient|DTTimeEvolutionHisto")
212  << " updated value: " << histo->getBinContent(nBookedBins) << endl;
213 
214  // set the bin label
215  stringstream binLabel; binLabel << "LS " << firstLSinTimeSlot;
216  if(nLSinTimeSlot > 1) binLabel << "-" << ls;
217  histo->setBinLabel(nBookedBins,binLabel.str(),1);
218 
219  // reset the counters for the time slot
220  nLSinTimeSlot = 0;
222  valueLastTimeSlot = 0;
223  }
224 
225 
226  } else {
227  int binN = (int)ls-(theFirstLS-1)/(int)theLSPrescale;
228  // set the bin content
229  float value = 0;
230  if(theMode == 1) {
231  value = valueLastTimeSlot;
232  } else if(theMode == 2) {
233  value = nEventsInLS;
234  } else if(theMode == 3) {
236  }
237  LogVerbatim("DTDQM|DTMonitorModule|DTMonitorClient|DTTimeEvolutionHisto")
238  << "[DTTimeEvolutionHisto] Update time-slot: "<< binN << " with value: " << value << endl;
239  setTimeSlotValue(value,binN);
240  }
241 }
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
void setTimeSlotValue(float value, int timeSlot)
double getBinContent(int binx) const
get content of bin (1-D)

Member Data Documentation

bool DTTimeEvolutionHisto::doSlide
private

Definition at line 74 of file DTTimeEvolutionHisto.h.

Referenced by setTimeSlotValue(), and updateTimeSlot().

int DTTimeEvolutionHisto::firstLSinTimeSlot
private

Definition at line 77 of file DTTimeEvolutionHisto.h.

Referenced by updateTimeSlot().

MonitorElement* DTTimeEvolutionHisto::histo
private

Definition at line 79 of file DTTimeEvolutionHisto.h.

Referenced by normalizeTo(), setTimeSlotValue(), and updateTimeSlot().

int DTTimeEvolutionHisto::nBookedBins
private

Definition at line 76 of file DTTimeEvolutionHisto.h.

Referenced by setTimeSlotValue(), and updateTimeSlot().

int DTTimeEvolutionHisto::nEventsInLastTimeSlot
private

Definition at line 71 of file DTTimeEvolutionHisto.h.

Referenced by updateTimeSlot().

int DTTimeEvolutionHisto::nLSinTimeSlot
private

Definition at line 75 of file DTTimeEvolutionHisto.h.

Referenced by updateTimeSlot().

int DTTimeEvolutionHisto::theFirstLS
private

Definition at line 72 of file DTTimeEvolutionHisto.h.

Referenced by updateTimeSlot().

int DTTimeEvolutionHisto::theLSPrescale
private

Definition at line 73 of file DTTimeEvolutionHisto.h.

Referenced by updateTimeSlot().

int DTTimeEvolutionHisto::theMode
private

Definition at line 78 of file DTTimeEvolutionHisto.h.

Referenced by updateTimeSlot().

float DTTimeEvolutionHisto::valueLastTimeSlot
private

Definition at line 70 of file DTTimeEvolutionHisto.h.

Referenced by accumulateValueTimeSlot(), and updateTimeSlot().