CMS 3D CMS Logo

Classes | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes

DTBlockedROChannelsTest Class Reference

#include <DTBlockedROChannelsTest.h>

Inheritance diagram for DTBlockedROChannelsTest:
edm::EDAnalyzer

List of all members.

Classes

class  DTRobBinsMap

Public Member Functions

 DTBlockedROChannelsTest (const edm::ParameterSet &ps)
 Constructor.
 ~DTBlockedROChannelsTest ()
 Destructor.

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c)
 Analyze.
void beginJob ()
 BeginJob.
void beginLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &context)
void beginRun (const edm::Run &run, const edm::EventSetup &c)
 BeginRun.
void endJob ()
 Endjob.
void endLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &c)
 DQM Client Diagnostic in online mode.
void endRun (edm::Run const &run, edm::EventSetup const &eSetup)
 DQM Client Diagnostic in offline mode.
void performClientDiagnostic ()
 DQM Client operations.

Private Member Functions

int readOutToGeometry (int dduId, int rosNumber, int &wheel, int &sector)

Private Attributes

std::map< DTChamberId,
DTRobBinsMap
chamberMap
DQMStoredbe
DTTimeEvolutionHistohSystFractionVsLS
edm::ESHandle< DTReadOutMappingmapping
int nevents
int neventsPrev
unsigned int nLumiSegs
int nupdates
bool offlineMode
int prescaleFactor
unsigned int prevNLumiSegs
double prevTotalPerc
std::map< int, double > resultsPerLumi
int run
MonitorElementsummaryHisto
std::map< int, MonitorElement * > wheelHitos

Detailed Description

* DQM Client to Summarize LS by LS the status of the Read-Out channels.

Date:
2012/03/13 09:00:51
Revision:
1.6
Author:
G. Cerminara - University and INFN Torino

Definition at line 26 of file DTBlockedROChannelsTest.h.


Constructor & Destructor Documentation

DTBlockedROChannelsTest::DTBlockedROChannelsTest ( const edm::ParameterSet ps)

Constructor.

Definition at line 30 of file DTBlockedROChannelsTest.cc.

References edm::ParameterSet::getUntrackedParameter(), LogTrace, offlineMode, and prescaleFactor.

                                                                       : nevents(0),
  neventsPrev(0),
  prevNLumiSegs(0),
  prevTotalPerc(0),
  hSystFractionVsLS(0) 
{
  LogTrace("DTDQM|DTRawToDigi|DTMonitorClient|DTBlockedROChannelsTest")
    << "[DTBlockedROChannelsTest]: Constructor";

  // prescale on the # of LS to update the test
  prescaleFactor = ps.getUntrackedParameter<int>("diagnosticPrescale", 1);

  offlineMode = ps.getUntrackedParameter<bool>("offlineMode", true);
}
DTBlockedROChannelsTest::~DTBlockedROChannelsTest ( )

Destructor.

Definition at line 47 of file DTBlockedROChannelsTest.cc.

References LogTrace, and nupdates.

                                                  {
  LogTrace("DTDQM|DTRawToDigi|DTMonitorClient|DTBlockedROChannelsTest")
    << "DataIntegrityTest: analyzed " << nupdates << " updates";
}

Member Function Documentation

void DTBlockedROChannelsTest::analyze ( const edm::Event e,
const edm::EventSetup c 
) [protected, virtual]

Analyze.

Implements edm::EDAnalyzer.

Definition at line 147 of file DTBlockedROChannelsTest.cc.

References LogTrace, and nevents.

                                                                              {
  // count the analyzed events
  nevents++;
  if(nevents%1000 == 0)
    LogTrace("DTDQM|DTRawToDigi|DTMonitorClient|DTBlockedROChannelsTest")
      << "[DTBlockedROChannelsTest]: "<<nevents<<" events";
}
void DTBlockedROChannelsTest::beginJob ( void  ) [protected, virtual]

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 55 of file DTBlockedROChannelsTest.cc.

References DQMStore::book2D(), dbe, hSystFractionVsLS, LogTrace, nupdates, offlineMode, cmsCodeRules::cppFunctionSkipper::operator, run, MonitorElement::setAxisTitle(), DQMStore::setCurrentFolder(), summaryHisto, and wheelHitos.

                                       {
  LogTrace("DTDQM|DTRawToDigi|DTMonitorClient|DTBlockedROChannelsTest")
    << "[DTBlockedROChannelsTest]: BeginJob";

  nupdates = 0;
  run=0;

  dbe = Service<DQMStore>().operator->();

  // book the summary histogram
  dbe->setCurrentFolder("DT/00-ROChannels");
  summaryHisto = dbe->book2D("ROChannelSummary","Summary Blocked RO Channels",12,1,13,5,-2,3);
  summaryHisto->setAxisTitle("Sector",1);
  summaryHisto->setAxisTitle("Wheel",2);

  for(int wheel = -2; wheel != 3; ++wheel) {
    stringstream namestream;  namestream << "ROChannelSummary_W" << wheel;
    stringstream titlestream; titlestream << "Blocked RO Channels (Wh " << wheel << ")";
    wheelHitos[wheel] = dbe->book2D(namestream.str().c_str(),titlestream.str().c_str(),12,1,13,4,1,5);
    wheelHitos[wheel]->setAxisTitle("Sector",1);
    wheelHitos[wheel]->setBinLabel(1,"MB1",2);
    wheelHitos[wheel]->setBinLabel(2,"MB2",2);
    wheelHitos[wheel]->setBinLabel(3,"MB3",2);
    wheelHitos[wheel]->setBinLabel(4,"MB4",2);
  }

  if(!offlineMode) {
    hSystFractionVsLS = new DTTimeEvolutionHisto(dbe, "EnabledROChannelsVsLS", "% RO channels",
        500, 5, true, 3);
  }

}
void DTBlockedROChannelsTest::beginLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  context 
) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 128 of file DTBlockedROChannelsTest.cc.

References LogTrace, nevents, run, and edm::LuminosityBlockBase::run().

                               {
  LogTrace("DTDQM|DTRawToDigi|DTMonitorClient|DTBlockedROChannelsTest")
    <<"[DTBlockedROChannelsTest]: Begin of LS transition";

  // Get the run number
  run = lumiSeg.run();
  nevents = 0;

  //   // loop over all chambers and read the values at the beginning of the LS
  //   for(map<DTChamberId, DTRobBinsMap>::iterator chAndRobs = chamberMap.begin();
  //       chAndRobs != chamberMap.end(); ++chAndRobs) {
  //     (*chAndRobs).second.readNewValues(); 
  //   }

}
void DTBlockedROChannelsTest::beginRun ( const edm::Run run,
const edm::EventSetup c 
) [protected, virtual]

BeginRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 91 of file DTBlockedROChannelsTest.cc.

References chamberMap, dbe, edm::EventSetup::get(), LogTrace, mapping, FEDNumbering::MAXDTFEDID, FEDNumbering::MINDTFEDID, and relativeConstraints::station.

                                                                                {
  // get the RO mapping
  context.get<DTReadOutMappingRcd>().get(mapping);

  // fill the map of the robs per chamber
  for(int dduId = FEDNumbering::MINDTFEDID; dduId<=FEDNumbering::MAXDTFEDID; ++dduId) { //loop over DDUs
    for(int ros = 1; ros != 13; ++ros) { // loop over ROSs
      for(int rob = 1; rob != 26; ++rob) { // loop over ROBs    
        int wheel = 0;
        int station = 0;
        int sector = 0;
        int dummy = 0;
        if(!mapping->readOutToGeometry(dduId,ros,rob-1,0,2,wheel,station,sector,dummy,dummy,dummy) ||
            !mapping->readOutToGeometry(dduId,ros,rob-1,0,16,wheel,station,sector,dummy,dummy,dummy)) {
          DTChamberId chId(wheel, station, sector);
          if(chamberMap.find(chId) == chamberMap.end()) {
            chamberMap[chId] = DTRobBinsMap(dduId, ros, dbe);
            chamberMap[chId].addRobBin(rob);
          } 
          chamberMap[chId].addRobBin(rob);
        } else {
          LogTrace("DTDQM|DTRawToDigi|DTMonitorClient|DTBlockedROChannelsTest")
            << "[DTRobBinsMap] FED: " << dduId << " ROS " << ros << " ROB: " << rob-1
            << " not in the mapping!" << endl;
        }
      }
    }
  }
  // loop over all chambers and remove the init flag
  for(map<DTChamberId, DTRobBinsMap>::iterator chAndRobs = chamberMap.begin();
      chAndRobs != chamberMap.end(); ++chAndRobs) {
    chAndRobs->second.init(false);
  }
}
void DTBlockedROChannelsTest::endJob ( void  ) [protected, virtual]

Endjob.

Reimplemented from edm::EDAnalyzer.

Definition at line 257 of file DTBlockedROChannelsTest.cc.

References LogTrace.

                                    {
  LogTrace("DTDQM|DTRawToDigi|DTMonitorClient|DTBlockedROChannelsTest")
    <<"[DTBlockedROChannelsTest] endjob called!";
}
void DTBlockedROChannelsTest::endLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  c 
) [protected, virtual]

DQM Client Diagnostic in online mode.

Reimplemented from edm::EDAnalyzer.

Definition at line 157 of file DTBlockedROChannelsTest.cc.

References edm::LuminosityBlockBase::id(), LogTrace, edm::LuminosityBlockID::luminosityBlock(), nLumiSegs, nupdates, offlineMode, performClientDiagnostic(), and prescaleFactor.

                                                                                                          {

  // counts number of lumiSegs 
  nLumiSegs = lumiSeg.id().luminosityBlock();

  // prescale factor
  if (nLumiSegs%prescaleFactor != 0 || offlineMode) return;

  LogTrace("DTDQM|DTRawToDigi|DTMonitorClient|DTBlockedROChannelsTest")
    <<"[DTBlockedROChannelsTest]: End of LS " << nLumiSegs << ". Client called in online mode, performing client operations";
  performClientDiagnostic();

  // counts number of updats 
  nupdates++;

}
void DTBlockedROChannelsTest::endRun ( edm::Run const &  run,
edm::EventSetup const &  eSetup 
) [protected, virtual]

DQM Client Diagnostic in offline mode.

Reimplemented from edm::EDAnalyzer.

Definition at line 265 of file DTBlockedROChannelsTest.cc.

References LogTrace, offlineMode, and performClientDiagnostic().

                                                                                   {

  if (offlineMode) {
    LogTrace("DTDQM|DTRawToDigi|DTMonitorClient|DTBlockedROChannelsTest")
      <<"[DTBlockedROChannelsTest] endRun called. Client called in offline mode, performing operations.";
    performClientDiagnostic();
  }
  // commented out since trend plots need to be updated in by lumi certification  
  //   if(offlineMode) {
  //     // fill a trend plot based on the results stored in the map
  //     float fBin = resultsPerLumi.begin()->first;
  //     float lBin = resultsPerLumi.rbegin()->first;
  //     dbe->setCurrentFolder("DT/00-ROChannels");

  //     //   MonitorElement* hSystFractionVsLS =  dbe->book1D("EnabledROChannelsVsLS", "% RO channels vs LS", nBins,fBin,lBin);
  //     hSystFractionVsLS = new DTTimeEvolutionHisto(dbe, "EnabledROChannelsVsLS", "% RO channels",
  //                                             (int)lBin-(int)fBin, fBin, 1, false, 2);

  //     for(map<int, double>::const_iterator bin = resultsPerLumi.begin();
  //    bin != resultsPerLumi.end(); ++bin) {
  //       hSystFractionVsLS->setTimeSlotValue((*bin).second, (*bin).first);
  //     }
  //   }
}
void DTBlockedROChannelsTest::performClientDiagnostic ( ) [protected]

DQM Client operations.

Definition at line 175 of file DTBlockedROChannelsTest.cc.

References DTTimeEvolutionHisto::accumulateValueTimeSlot(), chamberMap, dbe, MonitorElement::Fill(), DQMStore::get(), MonitorElement::getIntValue(), hSystFractionVsLS, nevents, neventsPrev, nLumiSegs, offlineMode, prevTotalPerc, MonitorElement::Reset(), pileupReCalc_HLTpaths::scale, DTChamberId::sector(), DTChamberId::station(), summaryHisto, DTTimeEvolutionHisto::updateTimeSlot(), DTChamberId::wheel(), and wheelHitos.

Referenced by endLuminosityBlock(), and endRun().

                                                      {

  // skip empty LSs

  if(nevents == 0) { // hack to work also in offline DQM
    MonitorElement *procEvt =  dbe->get("DT/EventInfo/processedEvents");
    if(procEvt != 0) {
      int procEvents = procEvt->getIntValue();
      nevents = procEvents - neventsPrev;
      neventsPrev = procEvents;
    }
  }

  double totalPerc = prevTotalPerc;
  // check again!
  if(nevents != 0) { // skip the computation if no events in the last LS

    // reset the histos
    summaryHisto->Reset();
    for(int wheel = -2; wheel != 3; ++wheel) {
      wheelHitos[wheel]->Reset();
    }

    totalPerc = 0.;

    // loop over all chambers and fill the wheel plots
    for(map<DTChamberId, DTRobBinsMap>::iterator chAndRobs = chamberMap.begin();
        chAndRobs != chamberMap.end(); ++chAndRobs) {
      DTChamberId chId = (*chAndRobs).first;
      double scale = 1.;
      int sectorForPlot = chId.sector();
      if(sectorForPlot == 13 || (sectorForPlot == 4 && chId.station() ==4)) {
        sectorForPlot = 4;
        scale = 0.5;
      } else if(sectorForPlot == 14 || (sectorForPlot == 10 && chId.station() ==4)) {
        sectorForPlot = 10;
        scale = 0.5;
      }

      // NOTE: can be called only ONCE per event per each chamber
      double chPercent = (*chAndRobs).second.getChamberPercentage(); 
      wheelHitos[chId.wheel()]->Fill(sectorForPlot, chId.station(),
          scale*chPercent);
      totalPerc += chPercent*scale*1./240.; // CB has to be 240 as double stations are taken into account by scale factor
      //       if(chPercent != 1.) {
      //        cout << "Ch: " << (*chAndRobs).first << endl;
      //        cout << "      perc: " << chPercent << endl;
      //       }
      // Fill the summary
      summaryHisto->Fill(sectorForPlot, chId.wheel(), 0.25*scale*chPercent);
    }
  }

  // commented out since trend plots need to be updated in by lumi certification  
  //   // this part is executed even if no events were processed in order to include the last LS 
  //   if(offlineMode) { // save the results in a map and draw them in the end-run
  //     if(resultsPerLumi.size() == 0) { // the first 2 LS are analyzed together
  // //       cout << "LS: " << nLumiSegs << " total %: " << totalPerc << endl;
  //       resultsPerLumi[nLumiSegs] = totalPerc;
  //     } else {
  // //       cout << "LS: " << nLumiSegs << " total %: " << prevTotalPerc << endl;
  //       resultsPerLumi[nLumiSegs] = prevTotalPerc;
  //     }
  //     prevTotalPerc = totalPerc;
  //     prevNLumiSegs = nLumiSegs;

  //   } else { // directly fill the histo
  //     hSystFractionVsLS->accumulateValueTimeSlot(totalPerc);
  //     hSystFractionVsLS->updateTimeSlot(nLumiSegs, nevents);
  //     prevTotalPerc = totalPerc;
  //   }

  if(!offlineMode) { // fill trend histo only in online
    hSystFractionVsLS->accumulateValueTimeSlot(totalPerc);
    hSystFractionVsLS->updateTimeSlot(nLumiSegs, nevents);
    prevTotalPerc = totalPerc;
  }

}
int DTBlockedROChannelsTest::readOutToGeometry ( int  dduId,
int  rosNumber,
int &  wheel,
int &  sector 
) [private]

Definition at line 292 of file DTBlockedROChannelsTest.cc.

References mapping.

                                                                                         {

  int dummy;
  return mapping->readOutToGeometry(dduId,ros,2,2,2,wheel,dummy,sector,dummy,dummy,dummy);

}

Member Data Documentation

Definition at line 133 of file DTBlockedROChannelsTest.h.

Referenced by beginRun(), and performClientDiagnostic().

Definition at line 92 of file DTBlockedROChannelsTest.h.

Referenced by beginJob(), and performClientDiagnostic().

Definition at line 82 of file DTBlockedROChannelsTest.h.

Referenced by beginRun(), and readOutToGeometry().

Definition at line 73 of file DTBlockedROChannelsTest.h.

Referenced by performClientDiagnostic().

unsigned int DTBlockedROChannelsTest::nLumiSegs [private]

Definition at line 74 of file DTBlockedROChannelsTest.h.

Referenced by endLuminosityBlock(), and performClientDiagnostic().

Definition at line 70 of file DTBlockedROChannelsTest.h.

Referenced by DTBlockedROChannelsTest(), and endLuminosityBlock().

Definition at line 75 of file DTBlockedROChannelsTest.h.

Definition at line 76 of file DTBlockedROChannelsTest.h.

Referenced by performClientDiagnostic().

std::map<int, double> DTBlockedROChannelsTest::resultsPerLumi [private]

Definition at line 91 of file DTBlockedROChannelsTest.h.

Definition at line 78 of file DTBlockedROChannelsTest.h.

Referenced by beginJob(), and beginLuminosityBlock().

Definition at line 87 of file DTBlockedROChannelsTest.h.

Referenced by beginJob(), and performClientDiagnostic().

Definition at line 86 of file DTBlockedROChannelsTest.h.

Referenced by beginJob(), and performClientDiagnostic().