CMS 3D CMS Logo

Public Member Functions | Private Attributes

DTTimeEvolutionHisto Class Reference

#include <DTTimeEvolutionHisto.h>

List of all members.

Public Member Functions

void accumulateValueTimeSlot (float value)
 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, const std::string &title, int nbins, int lsPrescale, bool sliding, int mode=0)
 DTTimeEvolutionHisto (DQMStore *dbe, const std::string &name)
 retrieve the monitor element from DQMStore
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
MonitorElementhisto
int nBookedBins
int nEventsInLastTimeSlot
int nLSinTimeSlot
int theFirstLS
int theLSPrescale
int theMode
float valueLastTimeSlot

Detailed Description

No description available.

Date:
2010/01/19 10:05:31
Revision:
1.3
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.

{}

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().

                                                                        {
  if(histo == 0) {
    LogWarning("DTDQM|DTMonitorModule|DTMonitorClient|DTTimeEvolutionHisto")
      << "[DTTimeEvolutionHisto]***Error: pointer to ME is NULL" << endl;
    return;
  }
  int nBins = histo->getNbinsX();
  if(histForNorm->getNbinsX() != nBins) {
    LogWarning("DTDQM|DTMonitorModule|DTMonitorClient|DTTimeEvolutionHisto")
      << "[DTTimeEvolutionHisto]***Error: normalizing histos with != # of bins" << endl;
    return;
  }
  for(int bin = 1; bin <= nBins; ++bin) { // loop over bins
    if(histForNorm->getBinContent(bin) != 0) {
      double normValue = histo->getBinContent(bin)/histForNorm->getBinContent(bin);
      LogVerbatim("DTDQM|DTMonitorModule|DTMonitorClient|DTTimeEvolutionHisto")
        << "[DTTimeEvolutionHisto] Normalizing bin: " << bin << " to: " <<  histo->getBinContent(bin) << " / " << histForNorm->getBinContent(bin)
        << " = " << normValue << endl;
      histo->setBinContent(bin, normValue);
    } else {
      histo->setBinContent(bin, 0);
    }
  }
}
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 updateTimeSlot().

                                                                     {
  //   LogVerbatim("DTDQM|DTMonitorModule|DTMonitorClient|DTTimeEvolutionHisto")
  //   << "[DTTimeEvolutionHisto] ME name: " <<  histo->getName() << endl;
  if(!doSlide) {
    //     LogVerbatim("DTDQM|DTMonitorModule|DTMonitorClient|DTTimeEvolutionHisto")
    //     << "        fill bin: " << timeSlot << " with value: " << value << endl;
    histo->Fill(timeSlot,value);
  } else {
    for(int bin = 1; bin != nBookedBins; ++bin) {
      float value = histo->getBinContent(bin);
      //       LogVerbatim("DTDQM|DTMonitorModule|DTMonitorClient|DTTimeEvolutionHisto")
      //  << "        bin: " << bin << " has value: " << value << endl;
      if(bin == 1) { // average of previous time slots (fixme)
        histo->setBinContent(bin, (value + histo->getBinContent(bin+1))/2.);
      } else if(bin != nBookedBins) {
        histo->setBinContent(bin, histo->getBinContent(bin+1));
        histo->setBinError(bin, histo->getBinError(bin+1));
        histo->setBinLabel(bin, histo->getTH1F()->GetXaxis()->GetBinLabel(bin+1),1);
      }
    }
    histo->setBinContent(nBookedBins, value);
  }
}
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().

                                                                 {
  
  if(doSlide) { // sliding bins
    // count LS in this time-slot
    nLSinTimeSlot++;
    nEventsInLastTimeSlot += nEventsInLS;
    
    if(nLSinTimeSlot == 1) firstLSinTimeSlot = ls;

    if(nLSinTimeSlot%theLSPrescale ==0) { // update the value of the slot and reset the counters
      LogVerbatim("DTDQM|DTMonitorModule|DTMonitorClient|DTTimeEvolutionHisto")
        << "[DTTimeEvolutionHisto] Update time-slot, # entries: " << valueLastTimeSlot 
        << " # events: " << nEventsInLastTimeSlot << endl;
      // set the bin content
      float value = 0;
      if(theMode == 0) {
        if(nEventsInLastTimeSlot != 0) value = valueLastTimeSlot/(float)nEventsInLastTimeSlot;
      } else if(theMode == 1) {
        value = valueLastTimeSlot;
      } else if(theMode == 2) {
        value = nEventsInLastTimeSlot;
      } else if(theMode == 3) {
        value = valueLastTimeSlot/theLSPrescale;
      }
      setTimeSlotValue(value, nBookedBins);
      LogVerbatim("DTDQM|DTMonitorModule|DTMonitorClient|DTTimeEvolutionHisto")
        << "       updated value: " << histo->getBinContent(nBookedBins) << endl;

      // set the bin label
      stringstream binLabel; binLabel << "LS " << firstLSinTimeSlot;
      if(nLSinTimeSlot > 1) binLabel << "-" << ls;
      histo->setBinLabel(nBookedBins,binLabel.str(),1);

      // reset the counters for the time slot
      nLSinTimeSlot = 0; 
      nEventsInLastTimeSlot = 0;
      valueLastTimeSlot = 0;
    }


  } else {
    int binN = (int)ls-(theFirstLS-1)/(int)theLSPrescale;
    // set the bin content
    float value = 0;
    if(theMode == 1) {
      value = valueLastTimeSlot;
    } else if(theMode == 2) {
      value = nEventsInLS;
    } else if(theMode == 3) {
      value = valueLastTimeSlot/theLSPrescale;
    }
    LogVerbatim("DTDQM|DTMonitorModule|DTMonitorClient|DTTimeEvolutionHisto")
      << "[DTTimeEvolutionHisto] Update time-slot: "<< binN << " with value: " << value << endl;
    setTimeSlotValue(value,binN);
  }
}

Member Data Documentation

Definition at line 74 of file DTTimeEvolutionHisto.h.

Referenced by setTimeSlotValue(), and updateTimeSlot().

Definition at line 77 of file DTTimeEvolutionHisto.h.

Referenced by updateTimeSlot().

Definition at line 79 of file DTTimeEvolutionHisto.h.

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

Definition at line 76 of file DTTimeEvolutionHisto.h.

Referenced by setTimeSlotValue(), and updateTimeSlot().

Definition at line 71 of file DTTimeEvolutionHisto.h.

Referenced by updateTimeSlot().

Definition at line 75 of file DTTimeEvolutionHisto.h.

Referenced by updateTimeSlot().

Definition at line 72 of file DTTimeEvolutionHisto.h.

Referenced by updateTimeSlot().

Definition at line 73 of file DTTimeEvolutionHisto.h.

Referenced by updateTimeSlot().

Definition at line 78 of file DTTimeEvolutionHisto.h.

Referenced by updateTimeSlot().

Definition at line 70 of file DTTimeEvolutionHisto.h.

Referenced by accumulateValueTimeSlot(), and updateTimeSlot().