CMS 3D CMS Logo

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

DTDataIntegrityTest Class Reference

#include <DTDataIntegrityTest.h>

Inheritance diagram for DTDataIntegrityTest:
edm::EDAnalyzer

List of all members.

Public Member Functions

 DTDataIntegrityTest (const edm::ParameterSet &ps)
 Constructor.
 ~DTDataIntegrityTest ()
 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 bookHistos (std::string histoType, int dduId)
 Book the MEs.
void endJob ()
 Endjob.
void endLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &c)
 DQM Client Diagnostic.
std::string getMEName (std::string histoType, int FEDId)
 Get the ME name.

Private Member Functions

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

Private Attributes

int counter
DQMStoredbe
std::map< std::string,
std::map< int, MonitorElement * > > 
dduHistos
std::map< std::string,
std::map< int, std::vector
< MonitorElement * > > > 
dduVectorHistos
MonitorElementglbSummaryHisto
edm::ESHandle< DTReadOutMappingmapping
int nevents
unsigned int nLumiSegs
int nupdates
int prescaleFactor
int run
MonitorElementsummaryHisto
MonitorElementsummaryTDCHisto

Detailed Description

* DQM Client to check the data integrity

Date:
2010/03/15 09:45:52
Revision:
1.14
Author:
S. Bolognesi - INFN TO

* DQM Client to check the data integrity

Date:
2009/11/04 13:36:39
Revision:
1.2
Author:
S. Bolognesi - INFN TO

* DQM Client to check the data integrity

Date:
2009/11/04 13:54:14
Revision:
1.3
Author:
S. Bolognesi - INFN TO

* DQM Client to check the data integrity

Date:
2009/11/04 13:54:28
Revision:
1.3
Author:
S. Bolognesi - INFN TO

Definition at line 24 of file DTDataIntegrityTest.h.


Constructor & Destructor Documentation

DTDataIntegrityTest::DTDataIntegrityTest ( const edm::ParameterSet ps)

Constructor.

Definition at line 30 of file DTDataIntegrityTest.cc.

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

                                                               : nevents(0) {
  
  LogTrace ("DTDQM|DTRawToDigi|DTMonitorClient|DTDataIntegrityTest") << "[DTDataIntegrityTest]: Constructor";

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


}
DTDataIntegrityTest::~DTDataIntegrityTest ( )

Destructor.

Definition at line 41 of file DTDataIntegrityTest.cc.

References LogTrace, and nupdates.

                                         {

  LogTrace ("DTDQM|DTRawToDigi|DTMonitorClient|DTDataIntegrityTest") << "DataIntegrityTest: analyzed " << nupdates << " updates";

}

Member Function Documentation

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

Analyze.

Implements edm::EDAnalyzer.

Definition at line 95 of file DTDataIntegrityTest.cc.

References LogTrace, and nevents.

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

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 48 of file DTDataIntegrityTest.cc.

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

                                  {

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

  //nSTAEvents = 0;
  nupdates = 0;
  run=0;

  dbe = Service<DQMStore>().operator->();
  
  // book the summary histogram
  dbe->setCurrentFolder("DT/00-DataIntegrity");
  summaryHisto = dbe->book2D("DataIntegritySummary","Summary Data Integrity",12,1,13,5,-2,3);
  summaryHisto->setAxisTitle("Sector",1);
  summaryHisto->setAxisTitle("Wheel",2);

  dbe->setCurrentFolder("DT/00-DataIntegrity");
  summaryTDCHisto = dbe->book2D("DataIntegrityTDCSummary","TDC Summary Data Integrity",12,1,13,5,-2,3);
  summaryTDCHisto->setAxisTitle("Sector",1);
  summaryTDCHisto->setAxisTitle("Wheel",2);

  dbe->setCurrentFolder("DT/00-DataIntegrity");
  glbSummaryHisto = dbe->book2D("DataIntegrityGlbSummary","Summary Data Integrity",12,1,13,5,-2,3);
  glbSummaryHisto->setAxisTitle("Sector",1);
  glbSummaryHisto->setAxisTitle("Wheel",2);

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

Reimplemented from edm::EDAnalyzer.

Definition at line 84 of file DTDataIntegrityTest.cc.

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

                                                                                                        {

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

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

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

BeginRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 76 of file DTDataIntegrityTest.cc.

References edm::EventSetup::get(), and mapping.

                                                                           {

  context.get<DTReadOutMappingRcd>().get(mapping);

}
void DTDataIntegrityTest::bookHistos ( std::string  histoType,
int  dduId 
) [protected]

Book the MEs.

void DTDataIntegrityTest::endJob ( void  ) [protected, virtual]

Endjob.

Reimplemented from edm::EDAnalyzer.

Definition at line 216 of file DTDataIntegrityTest.cc.

References LogTrace.

                                {

  LogTrace ("DTDQM|DTRawToDigi|DTMonitorClient|DTDataIntegrityTest") <<"[DTDataIntegrityTest] endjob called!";

//   dbe->rmdir("DT/DTDataIntegrity");
}
void DTDataIntegrityTest::endLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  c 
) [protected, virtual]

DQM Client Diagnostic.

Reimplemented from edm::EDAnalyzer.

Definition at line 105 of file DTDataIntegrityTest.cc.

References counter, dbe, DQMStore::get(), MonitorElement::getBinContent(), MonitorElement::getTH1F(), MonitorElement::getTH2F(), glbSummaryHisto, edm::LuminosityBlockBase::id(), LogTrace, edm::LuminosityBlockID::luminosityBlock(), max(), FEDNumbering::MAXDTFEDID, FEDNumbering::MINDTFEDID, nLumiSegs, nupdates, prescaleFactor, readOutToGeometry(), query::result, MonitorElement::setBinContent(), summaryHisto, summaryTDCHisto, and plotscripts::wheelNumber().

                                                                                                      {

  // counts number of lumiSegs 
  nLumiSegs = lumiSeg.id().luminosityBlock();
  stringstream nLumiSegs_s; nLumiSegs_s << nLumiSegs;
  
  // prescale factor
  if (nLumiSegs%prescaleFactor != 0) return;
  
  LogTrace ("DTDQM|DTRawToDigi|DTMonitorClient|DTDataIntegrityTest")
    <<"[DTDataIntegrityTest]: End of LS " << nLumiSegs << ", performing client operations";


  // counts number of updats 
  nupdates++;

  
  //Counter for x bin in the timing histos
  counter++;

  //Loop on FED id
  for (int dduId=FEDNumbering::MINDTFEDID; dduId<=FEDNumbering::MAXDTFEDID; ++dduId){
    LogTrace ("DTDQM|DTRawToDigi|DTMonitorClient|DTDataIntegrityTest")
      <<"[DTDataIntegrityTest]:FED Id: "<<dduId;
 
    //Each nTimeBin onUpdate remove timing histos and book a new bunch of them
    stringstream dduId_s; dduId_s << dduId;
    
    string histoType;
    
    //Check if the list of ROS is compatible with the channels enabled
    string rosStatusName = "DT/00-DataIntegrity/FED" + dduId_s.str() + "/FED" + dduId_s.str() + "_ROSStatus";
    MonitorElement * FED_ROSStatus = dbe->get(rosStatusName);
     
    // Get the error summary histo
    string fedSummaryName = "DT/00-DataIntegrity/FED" + dduId_s.str() + "_ROSSummary";
    MonitorElement * FED_ROSSummary = dbe->get(fedSummaryName);

    // Get the event lenght plot (used to counr # of processed evts)
    string fedEvLenName = "DT/00-DataIntegrity/FED" + dduId_s.str() + "/FED" + dduId_s.str() + "_EventLenght";
    MonitorElement * FED_EvLenght = dbe->get(fedEvLenName);

    // Get the histos for FED integrity
    string fedIntegrityFolder = "DT/FEDIntegrity/";
    MonitorElement * hFEDEntry = dbe->get(fedIntegrityFolder+"FEDEntries");
    MonitorElement * hFEDFatal = dbe->get(fedIntegrityFolder+"FEDFatal");
    MonitorElement * hFEDNonFatal = dbe->get(fedIntegrityFolder+"FEDNonFatal");

    if(hFEDEntry && hFEDFatal && hFEDNonFatal) {

      if(FED_ROSSummary && FED_ROSStatus && FED_EvLenght) {
        TH2F * histoFEDSummary = FED_ROSSummary->getTH2F();
        TH2F * histoROSStatus  = FED_ROSStatus->getTH2F();
        TH1F * histoEvLenght   = FED_EvLenght->getTH1F();
        // Check that the FED is in the ReadOut using the FEDIntegrity histos
        bool fedNotReadout = (hFEDEntry->getBinContent(dduId-769) == 0 &&
                              hFEDFatal->getBinContent(dduId-769) == 0 &&
                              hFEDNonFatal->getBinContent(dduId-769) == 0);
        int nFEDEvts = histoEvLenght->Integral();
        for(int rosNumber = 1; rosNumber <= 12; ++rosNumber) { // loop on the ROS
          int wheelNumber, sectorNumber;
          if (!readOutToGeometry(dduId,rosNumber,wheelNumber,sectorNumber)) {
            int result = -2;
            float nErrors  = histoFEDSummary->Integral(1,14,rosNumber,rosNumber);
            nErrors += histoROSStatus->Integral(2,8,rosNumber,rosNumber);
            if(nErrors == 0) { // no errors
              result = 0;
            } else { // there are errors
              result = 2;
            }
            summaryHisto->setBinContent(sectorNumber,wheelNumber+3,result);
            int tdcResult = -2;
            float nTDCErrors = histoFEDSummary->Integral(15,15,rosNumber,rosNumber); 
            if(nTDCErrors == 0) { // no errors
              tdcResult = 0;
            } else { // there are errors
              tdcResult = 2;
            }
            summaryTDCHisto->setBinContent(sectorNumber,wheelNumber+3,tdcResult);
            // FIXME: different errors should have different weights
            float sectPerc = max((float)0., ((float)nFEDEvts-nErrors)/(float)nFEDEvts);
            glbSummaryHisto->setBinContent(sectorNumber,wheelNumber+3,sectPerc);
           
            if(fedNotReadout) {
              // no data in this FED: it is off
              summaryHisto->setBinContent(sectorNumber,wheelNumber+3,1);
              summaryTDCHisto->setBinContent(sectorNumber,wheelNumber+3,1);
              glbSummaryHisto->setBinContent(sectorNumber,wheelNumber+3,0);
            }
          }
        }
      
      } else { // no data in this FED: it is off
        for(int rosNumber = 1; rosNumber <= 12; ++rosNumber) {
          int wheelNumber, sectorNumber;
          if (!readOutToGeometry(dduId,rosNumber,wheelNumber,sectorNumber)) {
            summaryHisto->setBinContent(sectorNumber,wheelNumber+3,1);
            summaryTDCHisto->setBinContent(sectorNumber,wheelNumber+3,1);
            glbSummaryHisto->setBinContent(sectorNumber,wheelNumber+3,0);
          } 
        }
      }

    }
    
  }
  
}
std::string DTDataIntegrityTest::getMEName ( std::string  histoType,
int  FEDId 
) [protected]

Get the ME name.

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

Definition at line 245 of file DTDataIntegrityTest.cc.

References mapping.

Referenced by endLuminosityBlock().

                                                                                     {

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

}

Member Data Documentation

Definition at line 71 of file DTDataIntegrityTest.h.

Referenced by endLuminosityBlock().

Definition at line 79 of file DTDataIntegrityTest.h.

Referenced by beginJob(), and endLuminosityBlock().

std::map<std::string, std::map<int, MonitorElement*> > DTDataIntegrityTest::dduHistos [private]

Definition at line 85 of file DTDataIntegrityTest.h.

std::map<std::string, std::map<int, std::vector <MonitorElement*> > > DTDataIntegrityTest::dduVectorHistos [private]

Definition at line 87 of file DTDataIntegrityTest.h.

Definition at line 91 of file DTDataIntegrityTest.h.

Referenced by beginJob(), and endLuminosityBlock().

Definition at line 80 of file DTDataIntegrityTest.h.

Referenced by beginRun(), and readOutToGeometry().

Definition at line 73 of file DTDataIntegrityTest.h.

Referenced by analyze().

unsigned int DTDataIntegrityTest::nLumiSegs [private]

Definition at line 74 of file DTDataIntegrityTest.h.

Referenced by endLuminosityBlock().

Definition at line 64 of file DTDataIntegrityTest.h.

Referenced by beginJob(), endLuminosityBlock(), and ~DTDataIntegrityTest().

Definition at line 67 of file DTDataIntegrityTest.h.

Referenced by DTDataIntegrityTest(), and endLuminosityBlock().

int DTDataIntegrityTest::run [private]

Definition at line 76 of file DTDataIntegrityTest.h.

Referenced by beginJob(), and beginLuminosityBlock().

Definition at line 89 of file DTDataIntegrityTest.h.

Referenced by beginJob(), and endLuminosityBlock().

Definition at line 90 of file DTDataIntegrityTest.h.

Referenced by beginJob(), and endLuminosityBlock().