#include <DQM/DTMonitorModule/interface/DTTimeEvolutionHisto.h>
Public Member Functions | |
void | accumulateValueTimeSlot (float value) |
DTTimeEvolutionHisto (DQMStore *dbe, const std::string &name) | |
retrieve the monitor element from DQMStore | |
DTTimeEvolutionHisto (DQMStore *dbe, const std::string &name, const std::string &title, int nbins, int lsPrescale, bool sliding, int mode=0) | |
Constructor Parameters are:
| |
void | normalizeTo (const MonitorElement *histForNorm) |
void | setTimeSlotValue (float value, int timeSlot) |
void | updateTimeSlot (int ls, int nEventsInLS) |
virtual | ~DTTimeEvolutionHisto () |
Destructor. | |
Private Attributes | |
bool | doSlide |
int | firstLSinTimeSlot |
MonitorElement * | histo |
int | nBookedBins |
int | nEventsInLastTimeSlot |
int | nLSinTimeSlot |
int | theLSPrescale |
int | theMode |
float | valueLastTimeSlot |
Definition at line 18 of file DTTimeEvolutionHisto.h.
DTTimeEvolutionHisto::DTTimeEvolutionHisto | ( | DQMStore * | dbe, | |
const std::string & | name, | |||
const std::string & | title, | |||
int | nbins, | |||
int | lsPrescale, | |||
bool | sliding, | |||
int | mode = 0 | |||
) |
Constructor Parameters are:
DTTimeEvolutionHisto::DTTimeEvolutionHisto | ( | DQMStore * | dbe, | |
const std::string & | name | |||
) |
retrieve the monitor element from DQMStore
DTTimeEvolutionHisto::~DTTimeEvolutionHisto | ( | ) | [virtual] |
void DTTimeEvolutionHisto::accumulateValueTimeSlot | ( | float | value | ) |
Definition at line 106 of file DTTimeEvolutionHisto.cc.
References valueLastTimeSlot.
00106 { 00107 valueLastTimeSlot += value; 00108 }
void DTTimeEvolutionHisto::normalizeTo | ( | const MonitorElement * | histForNorm | ) |
Definition at line 168 of file DTTimeEvolutionHisto.cc.
References MonitorElement::getBinContent(), MonitorElement::getNbinsX(), histo, and MonitorElement::setBinContent().
Referenced by DTSegmentAnalysisTest::endRun().
00168 { 00169 if(histo == 0) { 00170 LogWarning("DTDQM|DTMonitorModule|DTMonitorClient|DTTimeEvolutionHisto") 00171 << "[DTTimeEvolutionHisto]***Error: pointer to ME is NULL" << endl; 00172 return; 00173 } 00174 int nBins = histo->getNbinsX(); 00175 if(histForNorm->getNbinsX() != nBins) { 00176 LogWarning("DTDQM|DTMonitorModule|DTMonitorClient|DTTimeEvolutionHisto") 00177 << "[DTTimeEvolutionHisto]***Error: normalizing histos with != # of bins" << endl; 00178 return; 00179 } 00180 for(int bin = 1; bin <= nBins; ++bin) { // loop over bins 00181 if(histForNorm->getBinContent(bin) != 0) { 00182 double normValue = histo->getBinContent(bin)/histForNorm->getBinContent(bin); 00183 LogVerbatim("DTDQM|DTMonitorModule|DTMonitorClient|DTTimeEvolutionHisto") 00184 << "[DTTimeEvolutionHisto] Normalizing bin: " << bin << " to: " << histo->getBinContent(bin) << " / " << histForNorm->getBinContent(bin) 00185 << " = " << normValue << endl; 00186 histo->setBinContent(bin, normValue); 00187 } else { 00188 histo->setBinContent(bin, 0); 00189 } 00190 } 00191 }
Definition at line 82 of file DTTimeEvolutionHisto.cc.
References doSlide, MonitorElement::Fill(), MonitorElement::getBinContent(), MonitorElement::getTH1F(), histo, nBookedBins, MonitorElement::setBinContent(), and MonitorElement::setBinLabel().
Referenced by updateTimeSlot().
00082 { 00083 // LogVerbatim("DTDQM|DTMonitorModule|DTMonitorClient|DTTimeEvolutionHisto") 00084 // << "[DTTimeEvolutionHisto] ME name: " << histo->getName() << endl; 00085 if(!doSlide) { 00086 // LogVerbatim("DTDQM|DTMonitorModule|DTMonitorClient|DTTimeEvolutionHisto") 00087 // << " fill bin: " << timeSlot << " with value: " << value << endl; 00088 histo->Fill(timeSlot,value); 00089 } else { 00090 for(int bin = 1; bin != nBookedBins; ++bin) { 00091 float value = histo->getBinContent(bin); 00092 // LogVerbatim("DTDQM|DTMonitorModule|DTMonitorClient|DTTimeEvolutionHisto") 00093 // << " bin: " << bin << " has value: " << value << endl; 00094 if(bin == 1) { // average of previous time slots (fixme) 00095 histo->setBinContent(bin, (value + histo->getBinContent(bin+1))/2.); 00096 } else if(bin != nBookedBins) { 00097 histo->setBinContent(bin, histo->getBinContent(bin+1)); 00098 histo->setBinLabel(bin, histo->getTH1F()->GetXaxis()->GetBinLabel(bin+1),1); 00099 } 00100 } 00101 histo->setBinContent(nBookedBins, value); 00102 } 00103 }
Definition at line 112 of file DTTimeEvolutionHisto.cc.
References doSlide, firstLSinTimeSlot, MonitorElement::getBinContent(), histo, int, nBookedBins, nEventsInLastTimeSlot, nLSinTimeSlot, MonitorElement::setBinLabel(), setTimeSlotValue(), theMode, value, and valueLastTimeSlot.
Referenced by DTSegmentAnalysisTask::endLuminosityBlock().
00112 { 00113 00114 if(doSlide) { // sliding bins 00115 // count LS in this time-slot 00116 nLSinTimeSlot++; 00117 nEventsInLastTimeSlot += nEventsInLS; 00118 00119 if(nLSinTimeSlot == 1) firstLSinTimeSlot = ls; 00120 00121 if(nLSinTimeSlot%theLSPrescale ==0) { // update the value of the slot and reset the counters 00122 LogVerbatim("DTDQM|DTMonitorModule|DTMonitorClient|DTTimeEvolutionHisto") 00123 << "[DTTimeEvolutionHisto] Update time-slot, # entries: " << valueLastTimeSlot 00124 << " # events: " << nEventsInLastTimeSlot << endl; 00125 // set the bin content 00126 float value = 0; 00127 if(theMode == 0) { 00128 if(nEventsInLastTimeSlot != 0) value = valueLastTimeSlot/(float)nEventsInLastTimeSlot; 00129 } else if(theMode == 1) { 00130 value = valueLastTimeSlot; 00131 } else if(theMode == 2) { 00132 value = nEventsInLastTimeSlot; 00133 } 00134 setTimeSlotValue(value, nBookedBins); 00135 LogVerbatim("DTDQM|DTMonitorModule|DTMonitorClient|DTTimeEvolutionHisto") 00136 << " updated value: " << histo->getBinContent(nBookedBins) << endl; 00137 00138 // set the bin label 00139 stringstream binLabel; binLabel << "LS " << firstLSinTimeSlot; 00140 if(nLSinTimeSlot > 1) binLabel << "-" << ls; 00141 histo->setBinLabel(nBookedBins,binLabel.str(),1); 00142 00143 // reset the counters for the time slot 00144 nLSinTimeSlot = 0; 00145 nEventsInLastTimeSlot = 0; 00146 valueLastTimeSlot = 0; 00147 } 00148 00149 00150 } else { 00151 int binN = (int)ls/(int)theLSPrescale; 00152 // set the bin content 00153 float value = 0; 00154 if(theMode == 1) { 00155 value = valueLastTimeSlot; 00156 } else if(theMode == 2) { 00157 value = nEventsInLS; 00158 } 00159 LogVerbatim("DTDQM|DTMonitorModule|DTMonitorClient|DTTimeEvolutionHisto") 00160 << "[DTTimeEvolutionHisto] Update time-slot: "<< binN << " with value: " << value << endl; 00161 setTimeSlotValue(value,binN); 00162 } 00163 }
bool DTTimeEvolutionHisto::doSlide [private] |
Definition at line 60 of file DTTimeEvolutionHisto.h.
Referenced by setTimeSlotValue(), and updateTimeSlot().
int DTTimeEvolutionHisto::firstLSinTimeSlot [private] |
MonitorElement* DTTimeEvolutionHisto::histo [private] |
Definition at line 65 of file DTTimeEvolutionHisto.h.
Referenced by normalizeTo(), setTimeSlotValue(), and updateTimeSlot().
int DTTimeEvolutionHisto::nBookedBins [private] |
Definition at line 62 of file DTTimeEvolutionHisto.h.
Referenced by setTimeSlotValue(), and updateTimeSlot().
int DTTimeEvolutionHisto::nLSinTimeSlot [private] |
int DTTimeEvolutionHisto::theLSPrescale [private] |
Definition at line 59 of file DTTimeEvolutionHisto.h.
int DTTimeEvolutionHisto::theMode [private] |
float DTTimeEvolutionHisto::valueLastTimeSlot [private] |
Definition at line 57 of file DTTimeEvolutionHisto.h.
Referenced by accumulateValueTimeSlot(), and updateTimeSlot().