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::IBooker &ibooker, const std::string &name, const std::string &title, int nbins, int lsPrescale, bool sliding, int mode=0)
 
 DTTimeEvolutionHisto (DQMStore::IBooker &ibooker, const std::string &name, const std::string &title, int nbins, int firstLS, int lsPrescale, bool sliding, int mode=0)
 
 DTTimeEvolutionHisto (MonitorElement *)
 
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
 
MonitorElementhisto
 
int nBookedBins
 
std::map< int, int > nEventsInLastTimeSlot
 
std::map< int, int > nLumiTrInLastTimeSlot
 
int theFirstLS
 
int theLSPrescale
 
int theMode
 
float valueLastTimeSlot
 

Detailed Description

No description available.

Author
G. Cerminara - INFN Torino

Definition at line 18 of file DTTimeEvolutionHisto.h.

Constructor & Destructor Documentation

DTTimeEvolutionHisto::DTTimeEvolutionHisto ( DQMStore::IBooker ibooker,
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::IBooker ibooker,
const std::string &  name,
const std::string &  title,
int  nbins,
int  firstLS,
int  lsPrescale,
bool  sliding,
int  mode = 0 
)
DTTimeEvolutionHisto::DTTimeEvolutionHisto ( MonitorElement histoGot)

Definition at line 75 of file DTTimeEvolutionHisto.cc.

References histo.

76  theLSPrescale(-1),
77  doSlide(false),
78  theMode(0) { // FIXME: set other memebers to sensible values
79  LogVerbatim("DTDQM|DTMonitorModule|DTMonitorClient|DTTimeEvolutionHisto")
80  << "[DTTimeEvolutionHisto] Retrieve ME with name: " << " "<< endl;
81  histo = histoGot;
82 }
DTTimeEvolutionHisto::~DTTimeEvolutionHisto ( )
virtual

Destructor.

Definition at line 85 of file DTTimeEvolutionHisto.cc.

85 {}

Member Function Documentation

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

Definition at line 205 of file DTTimeEvolutionHisto.cc.

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

Referenced by DTSegmentAnalysisTest::dqmEndJob().

205  {
206  if(histo == 0) {
207  LogWarning("DTDQM|DTMonitorModule|DTMonitorClient|DTTimeEvolutionHisto")
208  << "[DTTimeEvolutionHisto]***Error: pointer to ME is NULL" << endl;
209  return;
210  }
211  int nBins = histo->getNbinsX();
212  if(histForNorm->getNbinsX() != nBins) {
213  LogWarning("DTDQM|DTMonitorModule|DTMonitorClient|DTTimeEvolutionHisto")
214  << "[DTTimeEvolutionHisto]***Error: normalizing histos with != # of bins" << endl;
215  return;
216  }
217  for(int bin = 1; bin <= nBins; ++bin) { // loop over bins
218  if(histForNorm->getBinContent(bin) != 0) {
219  double normValue = histo->getBinContent(bin)/histForNorm->getBinContent(bin);
220  LogVerbatim("DTDQM|DTMonitorModule|DTMonitorClient|DTTimeEvolutionHisto")
221  << "[DTTimeEvolutionHisto] Normalizing bin: " << bin << " to: " << histo->getBinContent(bin) << " / " << histForNorm->getBinContent(bin)
222  << " = " << normValue << endl;
223  histo->setBinContent(bin, normValue);
224  } else {
225  histo->setBinContent(bin, 0);
226  }
227  }
228 }
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 89 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::dqmEndJob(), and updateTimeSlot().

89  {
90 
91  if(!doSlide) {
92 
93  histo->Fill(timeSlot,value);
94  } else {
95  for(int bin = 1; bin != nBookedBins; ++bin) {
96  float value = histo->getBinContent(bin);
97 
98  if(bin == 1) { // average of previous time slots (fixme)
99  histo->setBinContent(bin, (value + histo->getBinContent(bin+1))/2.);
100  } else if(bin != nBookedBins) {
103  //JF to allow easy reading of x-axis
104  if (bin%(2*(int)theLSPrescale)==0){ histo->setBinLabel(bin, histo->getTH1F()->GetXaxis()->GetBinLabel(bin+1),1); }
105  else histo->setBinLabel(bin,"");
106  }
107  }
109  }
110 }
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 119 of file DTTimeEvolutionHisto.cc.

References doSlide, MonitorElement::getBinContent(), histo, eostools::ls(), nBookedBins, nEvents, nEventsInLastTimeSlot, nLumiTrInLastTimeSlot, MonitorElement::setBinLabel(), setTimeSlotValue(), theFirstLS, theLSPrescale, theMode, relativeConstraints::value, and valueLastTimeSlot.

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

119  {
120 
121  if(doSlide) { // sliding bins
122  // count LS in this time-slot
123  if (nEventsInLastTimeSlot.find(ls) != nEventsInLastTimeSlot.end()) {
124  nEventsInLastTimeSlot[ls] += nEventsInLS;
126  } else {
127  nEventsInLastTimeSlot[ls] = nEventsInLS;
129  }
130 
131 
132  if(nEventsInLastTimeSlot.size() > 0 && nEventsInLastTimeSlot.size()%theLSPrescale==0) { // update the value of the slot and reset the counters
133  int firstLSinTimeSlot = nEventsInLastTimeSlot.begin()->first;
134  int lastLSinTimeSlot = nEventsInLastTimeSlot.rbegin()->first;
135 
136  map<int,int>::const_iterator nEventsIt = nEventsInLastTimeSlot.begin();
137  map<int,int>::const_iterator nEventsEnd = nEventsInLastTimeSlot.end();
138 
139  int nEvents = 0;
140  for (;nEventsIt!=nEventsEnd;++nEventsIt)
141  nEvents+=nEventsIt->second;
142 
143  LogVerbatim("DTDQM|DTMonitorModule|DTMonitorClient|DTTimeEvolutionHisto")
144  << "[DTTimeEvolutionHisto] Update time-slot, # entries: " << valueLastTimeSlot
145  << " # events: " << nEvents << endl;
146  // set the bin content
147 
148  float value = 0;
149  if(theMode == 0) {
150  if(nEvents != 0) value = valueLastTimeSlot/(float)nEvents;
151  } else if(theMode == 1) {
152  value = valueLastTimeSlot;
153  } else if(theMode == 2) {
154  value = nEvents;
155  } else if(theMode == 3) {
156  map<int,int>::const_iterator nLumiTrIt = nLumiTrInLastTimeSlot.begin();
157  map<int,int>::const_iterator nLumiTrEnd = nLumiTrInLastTimeSlot.end();
158 
159  float nLumiTr = 0.;
160  for (;nLumiTrIt!=nLumiTrEnd;++nLumiTrIt)
161  nLumiTr+=nLumiTrIt->second;
162 
163  value = valueLastTimeSlot/nLumiTr;
164  }
166  LogVerbatim("DTDQM|DTMonitorModule|DTMonitorClient|DTTimeEvolutionHisto")
167  << " updated value: " << histo->getBinContent(nBookedBins) << endl;
168 
169  // set the bin label
170  stringstream binLabel;
171  binLabel << "LS " << firstLSinTimeSlot;
172  if(nEventsInLastTimeSlot.size() > 1)
173  binLabel << "-" << lastLSinTimeSlot;
174 
175  //if(nBookedBins%(int)theLSPrescale==0)
176  histo->setBinLabel(nBookedBins,binLabel.str(),1);
177 
178  // reset the counters for the time slot
179  nEventsInLastTimeSlot.clear();
180  nLumiTrInLastTimeSlot.clear();
181  valueLastTimeSlot = 0;
182  }
183 
184 
185  } else {
186  int binN = (int)ls-(theFirstLS-1)/(int)theLSPrescale;
187  // set the bin content
188  float value = 0;
189  if(theMode == 1) {
190  value = valueLastTimeSlot;
191  } else if(theMode == 2) {
192  value = nEventsInLS;
193  } else if(theMode == 3) {
195  }
196  LogVerbatim("DTDQM|DTMonitorModule|DTMonitorClient|DTTimeEvolutionHisto")
197  << "[DTTimeEvolutionHisto] Update time-slot: "<< binN << " with value: " << value << endl;
198  setTimeSlotValue(value,binN);
199  }
200 }
std::map< int, int > nLumiTrInLastTimeSlot
def ls
Definition: eostools.py:348
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)
std::map< int, int > nEventsInLastTimeSlot
double getBinContent(int binx) const
get content of bin (1-D)
UInt_t nEvents
Definition: hcalCalib.cc:42

Member Data Documentation

bool DTTimeEvolutionHisto::doSlide
private

Definition at line 74 of file DTTimeEvolutionHisto.h.

Referenced by setTimeSlotValue(), and updateTimeSlot().

MonitorElement* DTTimeEvolutionHisto::histo
private
int DTTimeEvolutionHisto::nBookedBins
private

Definition at line 75 of file DTTimeEvolutionHisto.h.

Referenced by setTimeSlotValue(), and updateTimeSlot().

std::map<int,int> DTTimeEvolutionHisto::nEventsInLastTimeSlot
private

Definition at line 70 of file DTTimeEvolutionHisto.h.

Referenced by updateTimeSlot().

std::map<int,int> DTTimeEvolutionHisto::nLumiTrInLastTimeSlot
private

Definition at line 71 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 76 of file DTTimeEvolutionHisto.h.

Referenced by updateTimeSlot().

float DTTimeEvolutionHisto::valueLastTimeSlot
private

Definition at line 69 of file DTTimeEvolutionHisto.h.

Referenced by accumulateValueTimeSlot(), and updateTimeSlot().