CMS 3D CMS Logo

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

#include <DTTimeEvolutionHisto.h>

Public Types

typedef dqm::legacy::DQMStore DQMStore
 
typedef dqm::legacy::MonitorElement MonitorElement
 

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 15 of file DTTimeEvolutionHisto.h.

Member Typedef Documentation

Definition at line 17 of file DTTimeEvolutionHisto.h.

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 73 of file DTTimeEvolutionHisto.cc.

References histo.

74  : valueLastTimeSlot(0),
75  theFirstLS(1),
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: "
81  << " " << endl;
82  histo = histoGot;
83 }
Log< level::Info, true > LogVerbatim
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 190 of file DTTimeEvolutionHisto.cc.

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

190  {
191  if (histo == nullptr) {
192  LogWarning("DTDQM|DTMonitorModule|DTMonitorClient|DTTimeEvolutionHisto")
193  << "[DTTimeEvolutionHisto]***Error: pointer to ME is NULL" << endl;
194  return;
195  }
196  int nBins = histo->getNbinsX();
197  if (histForNorm->getNbinsX() != nBins) {
198  LogWarning("DTDQM|DTMonitorModule|DTMonitorClient|DTTimeEvolutionHisto")
199  << "[DTTimeEvolutionHisto]***Error: normalizing histos with != # of bins" << endl;
200  return;
201  }
202  for (int bin = 1; bin <= nBins; ++bin) { // loop over bins
203  if (histForNorm->getBinContent(bin) != 0) {
204  double normValue = histo->getBinContent(bin) / histForNorm->getBinContent(bin);
205  LogVerbatim("DTDQM|DTMonitorModule|DTMonitorClient|DTTimeEvolutionHisto")
206  << "[DTTimeEvolutionHisto] Normalizing bin: " << bin << " to: " << histo->getBinContent(bin) << " / "
207  << histForNorm->getBinContent(bin) << " = " << normValue << endl;
208  histo->setBinContent(bin, normValue);
209  } else {
210  histo->setBinContent(bin, 0);
211  }
212  }
213 }
Log< level::Info, true > LogVerbatim
virtual int getNbinsX() const
get # of bins in X-axis
virtual double getBinContent(int binx) const
get content of bin (1-D)
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
Log< level::Warning, false > LogWarning
void DTTimeEvolutionHisto::setTimeSlotValue ( float  value,
int  timeSlot 
)

Definition at line 87 of file DTTimeEvolutionHisto.cc.

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

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

87  {
88  if (!doSlide) {
89  histo->Fill(timeSlot, value);
90  } else {
91  for (int bin = 1; bin != nBookedBins; ++bin) {
92  float value = histo->getBinContent(bin);
93 
94  if (bin == 1) { // average of previous time slots (fixme)
95  histo->setBinContent(bin, (value + histo->getBinContent(bin + 1)) / 2.);
96  } else if (bin != nBookedBins) {
99  histo->setBinLabel(bin, histo->getTH1F()->GetXaxis()->GetBinLabel(bin + 1), 1);
100  }
101  }
103  }
104 }
virtual TH1F * getTH1F() const
virtual double getBinError(int binx) const
get uncertainty on content of bin (1-D) - See TH1::GetBinError for details
void Fill(long long x)
virtual 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)
virtual double getBinContent(int binx) const
get content of bin (1-D)
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
virtual void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
void DTTimeEvolutionHisto::updateTimeSlot ( int  ls,
int  nEventsInLS 
)

Definition at line 108 of file DTTimeEvolutionHisto.cc.

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

Referenced by DTBlockedROChannelsTest::performClientDiagnostic().

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

Member Data Documentation

bool DTTimeEvolutionHisto::doSlide
private

Definition at line 72 of file DTTimeEvolutionHisto.h.

Referenced by setTimeSlotValue(), and updateTimeSlot().

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

Definition at line 73 of file DTTimeEvolutionHisto.h.

Referenced by setTimeSlotValue(), and updateTimeSlot().

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

Definition at line 68 of file DTTimeEvolutionHisto.h.

Referenced by updateTimeSlot().

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

Definition at line 69 of file DTTimeEvolutionHisto.h.

Referenced by updateTimeSlot().

int DTTimeEvolutionHisto::theFirstLS
private

Definition at line 70 of file DTTimeEvolutionHisto.h.

Referenced by updateTimeSlot().

int DTTimeEvolutionHisto::theLSPrescale
private

Definition at line 71 of file DTTimeEvolutionHisto.h.

Referenced by updateTimeSlot().

int DTTimeEvolutionHisto::theMode
private

Definition at line 74 of file DTTimeEvolutionHisto.h.

Referenced by updateTimeSlot().

float DTTimeEvolutionHisto::valueLastTimeSlot
private

Definition at line 67 of file DTTimeEvolutionHisto.h.

Referenced by accumulateValueTimeSlot(), and updateTimeSlot().