CMS 3D CMS Logo

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

L1TTestsSummary Class Reference

#include <L1TTestsSummary.h>

Inheritance diagram for L1TTestsSummary:
edm::EDAnalyzer

List of all members.

Public Member Functions

 L1TTestsSummary (const edm::ParameterSet &ps)
virtual ~L1TTestsSummary ()

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c)
void beginJob (void)
void beginLuminosityBlock (const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context)
void beginRun (const edm::Run &r, const edm::EventSetup &c)
void endJob ()
void endLuminosityBlock (const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c)
void endRun (const edm::Run &r, const edm::EventSetup &c)

Private Member Functions

void updateL1TOccupancyMonitor ()
void updateL1TRateMonitor ()
void updateL1TSummary ()
void updateL1TSyncMonitor ()

Private Attributes

int binYOccpancy
int binYRate
int binYSync
DQMStoremDBE
MonitorElementmL1TOccupancyMonitor
std::string mL1TOccupancyPath
MonitorElementmL1TRateMonitor
std::string mL1TRatePath
MonitorElementmL1TSummary
MonitorElementmL1TSyncMonitor
std::string mL1TSyncPath
bool mMonitorL1TOccupancy
bool mMonitorL1TRate
bool mMonitorL1TSync
edm::ParameterSet mParameters
std::vector< int > mProcessedLS
bool mVerbose

Detailed Description

Definition at line 26 of file L1TTestsSummary.h.


Constructor & Destructor Documentation

L1TTestsSummary::L1TTestsSummary ( const edm::ParameterSet ps)

Definition at line 32 of file L1TTestsSummary.cc.

References gather_cfg::cout, edm::ParameterSet::getUntrackedParameter(), and cppFunctionSkipper::operator.

                                                         {

  if(mVerbose){cout << "[L1TTestsSummary:] Called constructor" << endl;}
  
  // Get parameters
  mParameters          = ps;
  mVerbose             = ps.getUntrackedParameter<bool>("verbose"            ,true);
  mMonitorL1TRate      = ps.getUntrackedParameter<bool>("MonitorL1TRate"     ,true);
  mMonitorL1TSync      = ps.getUntrackedParameter<bool>("MonitorL1TSync"     ,true);
  mMonitorL1TOccupancy = ps.getUntrackedParameter<bool>("MonitorL1TOccupancy",true);

  mL1TRatePath      = ps.getUntrackedParameter<string>("L1TRatePath"     ,"L1T/L1TRate/Certification/");
  mL1TSyncPath      = ps.getUntrackedParameter<string>("L1TSyncPath"     ,"L1T/L1TSync/Certification/");
  mL1TOccupancyPath = ps.getUntrackedParameter<string>("L1TOccupancyPath","L1T/L1TOccupancy/Certification/");
  
  // Get back-end interface
  mDBE  = Service<DQMStore>().operator->();   

}
L1TTestsSummary::~L1TTestsSummary ( ) [virtual]

Definition at line 56 of file L1TTestsSummary.cc.

References gather_cfg::cout.

                                 {
  if(mVerbose){cout << "[L1TTestsSummary:] Called destructor" << endl;}
}

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 234 of file L1TTestsSummary.cc.

{}
void L1TTestsSummary::beginJob ( void  ) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 64 of file L1TTestsSummary.cc.

References gather_cfg::cout, and cppFunctionSkipper::operator.

                                  {

  if(mVerbose){cout << "[L1TTestsSummary:] Called BeginJob" << endl;}

  // get backend interface  
  mDBE = Service<DQMStore>().operator->();

  if (mDBE) {
    mDBE->setCurrentFolder("L1T/L1TOccupancy");
    mDBE->rmdir("L1T/L1TOccupancy");
  }
}
void L1TTestsSummary::beginLuminosityBlock ( const edm::LuminosityBlock lumiSeg,
const edm::EventSetup context 
) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 198 of file L1TTestsSummary.cc.

References gather_cfg::cout.

                                                                                                    {
  if(mVerbose){cout << "[L1TTestsSummary:] Called beginLuminosityBlock()" << endl;}
}
void L1TTestsSummary::beginRun ( const edm::Run r,
const edm::EventSetup c 
) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 92 of file L1TTestsSummary.cc.

References gather_cfg::cout, i, and mergeVDriftHistosByStation::name.

                                                                     {  
  
  if(mVerbose){cout << "[L1TTestsSummary:] Called beginRun" << endl;}
  
  int maxLS = 2500;
  
  if(mMonitorL1TRate){

    if(mVerbose){cout << "[L1TTestsSummary:] Initializing L1TRate Module Monitoring" << endl;}
    
    mDBE->setCurrentFolder(mL1TRatePath);
    vector<string> histToMonitor = mDBE->getMEs();
    int            histLines     = histToMonitor.size()+1;
    
    mDBE->setCurrentFolder("L1T/L1TTestsSummary/");    
    mL1TRateMonitor = mDBE->book2D("RateQualitySummary","L1T Rates Monitor Summary",maxLS,+0.5,double(maxLS)+0.5,histLines,0,histLines); 
    mL1TRateMonitor->setAxisTitle("Lumi Section" ,1);

    mL1TRateMonitor->setBinLabel(1,"Summary",2);
    for(unsigned int i=0 ; i<histToMonitor.size() ; i++){
      string name = mDBE->get(mL1TRatePath+histToMonitor[i])->getTH1()->GetName();
      mL1TRateMonitor->setBinLabel(i+2,name,2);  
    }
  }
  if(mMonitorL1TSync){

    if(mVerbose){cout << "[L1TTestsSummary:] Initializing L1TSync Module Monitoring" << endl;}
    
    mDBE->setCurrentFolder(mL1TSyncPath);
    vector<string> histToMonitor = mDBE->getMEs();
    int            histLines     = histToMonitor.size()+1;

    mDBE->setCurrentFolder("L1T/L1TTestsSummary/");  
    mL1TSyncMonitor = mDBE->book2D("SyncQualitySummary","L1T Synchronization Monitor Summary",maxLS,0.5,double(maxLS)+0.5,histLines,0,histLines); 
    mL1TSyncMonitor->setAxisTitle("Lumi Section" ,1);

    mL1TSyncMonitor->setBinLabel(1,"Summary",2);
    for(unsigned int i=0 ; i<histToMonitor.size() ; i++){
      string name = mDBE->get(mL1TSyncPath+histToMonitor[i])->getTH1()->GetName();
      mL1TSyncMonitor->setBinLabel(i+2,name,2);  
    }
    
  }
  if(mMonitorL1TOccupancy){    
        
    if(mVerbose){cout << "[L1TTestsSummary:] Initializing L1TOccupancy Module Monitoring" << endl;}
    
    mDBE->setCurrentFolder(mL1TOccupancyPath);
    vector<string> histToMonitor = mDBE->getMEs();
    int            histLines     = histToMonitor.size()+1;

    mDBE->setCurrentFolder("L1T/L1TTestsSummary/");  
    mL1TOccupancyMonitor = mDBE->book2D("OccupancySummary","L1T Occupancy Monitor Summary",maxLS,+0.5,double(maxLS)+0.5,histLines,0,histLines);
    mL1TOccupancyMonitor->setAxisTitle("Lumi Section" ,1);   

    mL1TOccupancyMonitor->setBinLabel(1,"Summary",2);
    for(unsigned int i=0 ; i<histToMonitor.size() ; i++){
      string name = mDBE->get(mL1TOccupancyPath+histToMonitor[i])->getTH1()->GetName();
      mL1TOccupancyMonitor->setBinLabel(i+2,name,2);  
    } 
  }
  
  //-> Making the summary of summaries
  int testsToMonitor=1;
  if(mMonitorL1TRate)     {testsToMonitor++;}
  if(mMonitorL1TSync)     {testsToMonitor++;}
  if(mMonitorL1TOccupancy){testsToMonitor++;}

  // Creating
  mDBE->setCurrentFolder("L1T/L1TTestsSummary/");  
  mL1TSummary = mDBE->book2D("L1TQualitySummary","L1 Tests Summary",maxLS,+0.5,double(maxLS)+0.5,testsToMonitor,0,testsToMonitor);
  mL1TSummary->setAxisTitle("Lumi Section" ,1);
  mL1TSummary->setBinLabel(1,"L1T Summary",2);
  
  int it=2;
  if(mMonitorL1TRate)     {mL1TSummary->setBinLabel(it,"Rates"          ,2); binYRate    =it; it++;}
  if(mMonitorL1TSync)     {mL1TSummary->setBinLabel(it,"Synchronization",2); binYSync    =it; it++;}
  if(mMonitorL1TOccupancy){mL1TSummary->setBinLabel(it,"Occupancy"      ,2); binYOccpancy=it;}

}
void L1TTestsSummary::endJob ( void  ) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 81 of file L1TTestsSummary.cc.

References gather_cfg::cout.

                            {
  if(mVerbose){cout << "[L1TTestsSummary:] Called endJob" << endl;}
}
void L1TTestsSummary::endLuminosityBlock ( const edm::LuminosityBlock lumiSeg,
const edm::EventSetup c 
) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 209 of file L1TTestsSummary.cc.

References gather_cfg::cout, edm::LuminosityBlockBase::id(), and edm::LuminosityBlockID::luminosityBlock().

                                                                                                 {
  
  int eventLS = lumiSeg.id().luminosityBlock();

  mProcessedLS.push_back(eventLS);
  
  if(mVerbose) {
    cout << "[L1TTestsSummary:] Called endLuminosityBlock()" << endl;
    cout << "[L1TTestsSummary:] Lumisection: " << eventLS << endl;
  }

  if(mMonitorL1TRate)     {updateL1TRateMonitor();}
  if(mMonitorL1TSync)     {updateL1TSyncMonitor();}
  if(mMonitorL1TOccupancy){updateL1TOccupancyMonitor();}
  updateL1TSummary();
  
}
void L1TTestsSummary::endRun ( const edm::Run r,
const edm::EventSetup c 
) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 180 of file L1TTestsSummary.cc.

References gather_cfg::cout.

                                                                   {
  
  if(mVerbose){cout << "[L1TTestsSummary:] Called endRun()" << endl;}
  
  if(mMonitorL1TRate)     {updateL1TRateMonitor();}
  if(mMonitorL1TSync)     {updateL1TSyncMonitor();}
  if(mMonitorL1TOccupancy){updateL1TOccupancyMonitor();}
  updateL1TSummary();
  
}
void L1TTestsSummary::updateL1TOccupancyMonitor ( ) [private]

Definition at line 372 of file L1TTestsSummary.cc.

References a, b, gather_cfg::cout, QReport::getBadChannels(), getBin(), QReport::getMessage(), MonitorElement::getQReport(), QReport::getQTresult(), QReport::getStatus(), MonitorElement::getTH1(), and i.

                                               {
  
  mDBE->setCurrentFolder(mL1TOccupancyPath);
  vector<string> histToMonitor = mDBE->getMEs();
  
  for(unsigned int i=0 ; i<histToMonitor.size() ; i++){

    MonitorElement* me = mDBE->get(mL1TOccupancyPath+histToMonitor[i]);
    if(mVerbose) {cout << "[L1TTestsSummary:] Found ME: " << me->getTH1()->GetName() << endl;}

    const QReport * myQReport = me->getQReport("L1TOccupancyTest"); //get QReport associated to your ME  
    if(myQReport) {
      float  qtresult  = myQReport->getQTresult();        // get QT result value
      int    qtstatus  = myQReport->getStatus();          // get QT status value (see table below)
      string qtmessage = myQReport->getMessage() ; // get the whole QT result message
      vector<DQMChannel> qtBadChannels = myQReport->getBadChannels();

      if(mVerbose) {
        cout << "[L1TTestsSummary:] Found QReport for ME: " << me->getTH1()->GetName() << endl;
        cout << "[L1TTestsSummary:] Result=" << qtresult << " status=" << qtstatus << " message=" << qtmessage << endl;
        cout << "[L1TTestsSummary:] Bad Channels size=" << qtBadChannels.size() << endl;
      }

      for(unsigned int i=0 ; i<mProcessedLS.size() ; i++){
        int binx = mL1TOccupancyMonitor->getTH2F()->GetXaxis()->FindBin(mProcessedLS[i]);
        int biny = mL1TOccupancyMonitor->getTH2F()->GetYaxis()->FindBin(me->getTH1()->GetName());
        mL1TOccupancyMonitor->setBinContent(binx,biny,100);
      }

      for(unsigned int a=0 ; a<qtBadChannels.size() ; a++){
        for(unsigned int b=0 ; b<mProcessedLS.size() ; b++){
          
          // Converting bin to value
          double valueBinBad = me->getTH1()->GetBinCenter(qtBadChannels[a].getBin());
  
          if(valueBinBad==mProcessedLS[b]){
            int binx = mL1TOccupancyMonitor->getTH2F()->GetXaxis()->FindBin(valueBinBad);
            int biny = mL1TOccupancyMonitor->getTH2F()->GetYaxis()->FindBin(me->getTH1()->GetName());
            mL1TOccupancyMonitor->setBinContent(binx,biny,300);
          }
        }
      }
    }
  } 
    
  //-> Filling the summaries
  int nBinX = mL1TOccupancyMonitor->getTH2F()->GetXaxis()->GetNbins();
  int nBinY = mL1TOccupancyMonitor->getTH2F()->GetYaxis()->GetNbins();
  for(int binx=1; binx<=nBinX ; binx++){
    int GlobalStatus=0;
    for(int biny=2; biny<=nBinY ; biny++){
      double flag = mL1TOccupancyMonitor->getBinContent(binx,biny);
      if(GlobalStatus<flag){GlobalStatus=flag;}
    }
    
    // NOTE: Assumes mL1TSummary has same size then mL1TOccupancyMonitor
    mL1TOccupancyMonitor->setBinContent(binx,           1,GlobalStatus);
    mL1TSummary         ->setBinContent(binx,binYOccpancy,GlobalStatus);
  } 
}
void L1TTestsSummary::updateL1TRateMonitor ( ) [private]

Definition at line 240 of file L1TTestsSummary.cc.

References a, b, gather_cfg::cout, QReport::getBadChannels(), getBin(), QReport::getMessage(), MonitorElement::getQReport(), QReport::getQTresult(), QReport::getStatus(), MonitorElement::getTH1(), and i.

                                          {
  
  mDBE->setCurrentFolder(mL1TRatePath);
  vector<string> histToMonitor = mDBE->getMEs();
  
  for(unsigned int i=0 ; i<histToMonitor.size() ; i++){

    MonitorElement* me = mDBE->get(mL1TRatePath+histToMonitor[i]);
    if(mVerbose) {cout << "[L1TTestsSummary:] Found ME: " << me->getTH1()->GetName() << endl;}

    const QReport * myQReport = me->getQReport("L1TRateTest"); //get QReport associated to your ME  
    if(myQReport) {
      float  qtresult  = myQReport->getQTresult(); // get QT result value
      int    qtstatus  = myQReport->getStatus();   // get QT status value (see table below)
      string qtmessage = myQReport->getMessage() ; // get the whole QT result message
      vector<DQMChannel> qtBadChannels = myQReport->getBadChannels();

      if(mVerbose) {
        cout << "[L1TTestsSummary:] Found QReport for ME: " << me->getTH1()->GetName() << endl;
        cout << "[L1TTestsSummary:] Result=" << qtresult << " status=" << qtstatus << " message=" << qtmessage << endl;
        cout << "[L1TTestsSummary:] Bad Channels size=" << qtBadChannels.size() << endl;
      }

      for(unsigned int i=0 ; i<mProcessedLS.size()-1 ; i++){
        int binx = mL1TRateMonitor->getTH2F()->GetXaxis()->FindBin(mProcessedLS[i]);
        int biny = mL1TRateMonitor->getTH2F()->GetYaxis()->FindBin(me->getTH1()->GetName());
        mL1TRateMonitor->setBinContent(binx,biny,100);
      }

      for(unsigned int a=0 ; a<qtBadChannels.size() ; a++){
        for(unsigned int b=0 ; b<mProcessedLS.size()-1 ; b++){
   
          // Converting bin to value
          double valueBinBad = me->getTH1()->GetBinCenter(qtBadChannels[a].getBin());
     
          if(valueBinBad==(mProcessedLS[b])){
            int binx = mL1TRateMonitor->getTH2F()->GetXaxis()->FindBin(valueBinBad);
            int biny = mL1TRateMonitor->getTH2F()->GetYaxis()->FindBin(me->getTH1()->GetName());
            mL1TRateMonitor->setBinContent(binx,biny,300);
          }
        }
      }
    }
  } 

  //-> Filling the summaries
  int nBinX = mL1TRateMonitor->getTH2F()->GetXaxis()->GetNbins();
  int nBinY = mL1TRateMonitor->getTH2F()->GetYaxis()->GetNbins();
  for(int binx=1; binx<=nBinX ; binx++){
    int GlobalStatus=0;
    for(int biny=2; biny<=nBinY ; biny++){
      double flag = mL1TRateMonitor->getBinContent(binx,biny);
      if(GlobalStatus<flag){GlobalStatus=flag;}
    }
    
    // NOTE: Assumes mL1TSummary has same size then mL1TRateMonitor
    mL1TRateMonitor->setBinContent(binx,       1,GlobalStatus);
    mL1TSummary    ->setBinContent(binx,binYRate,GlobalStatus);
  } 
}
void L1TTestsSummary::updateL1TSummary ( ) [private]

Definition at line 437 of file L1TTestsSummary.cc.

                                      {

  int nBinX = mL1TSummary->getTH2F()->GetXaxis()->GetNbins();  
  for(int binx=1; binx<=nBinX ; binx++){
    int GlobalStatus=0;
    if(mMonitorL1TRate){
      if(mL1TSummary->getBinContent(binx,binYRate)>GlobalStatus){
        GlobalStatus=mL1TSummary->getBinContent(binx,binYRate);
      }
    }
    if(mMonitorL1TSync)     {
      if(mL1TSummary->getBinContent(binx,binYSync)>GlobalStatus){
        GlobalStatus=mL1TSummary->getBinContent(binx,binYSync);
      }
    }
    if(mMonitorL1TOccupancy){
      if(mL1TSummary->getBinContent(binx,binYOccpancy)>GlobalStatus){
        GlobalStatus=mL1TSummary->getBinContent(binx,binYOccpancy);
      }
    }
    mL1TSummary->setBinContent(binx,1,GlobalStatus);
  }  
}
void L1TTestsSummary::updateL1TSyncMonitor ( ) [private]

Definition at line 307 of file L1TTestsSummary.cc.

References a, b, gather_cfg::cout, QReport::getBadChannels(), getBin(), QReport::getMessage(), MonitorElement::getQReport(), QReport::getQTresult(), QReport::getStatus(), MonitorElement::getTH1(), and i.

                                          {
  
  mDBE->setCurrentFolder(mL1TSyncPath);
  vector<string> histToMonitor = mDBE->getMEs();
  
  for(unsigned int i=0 ; i<histToMonitor.size() ; i++){

    MonitorElement* me = mDBE->get(mL1TSyncPath+histToMonitor[i]);
    if(mVerbose) {cout << "[L1TTestsSummary:] Found ME: " << me->getTH1()->GetName() << endl;}

    const QReport * myQReport = me->getQReport("L1TSyncTest"); //get QReport associated to your ME  
    if(myQReport) {
      float              qtresult      = myQReport->getQTresult();    // get QT result value
      int                qtstatus      = myQReport->getStatus();      // get QT status value (see table below)
      string             qtmessage     = myQReport->getMessage() ;    // get the whole QT result message
      vector<DQMChannel> qtBadChannels = myQReport->getBadChannels();

      if(mVerbose) {
        cout << "[L1TTestsSummary:] Found QReport for ME: " << me->getTH1()->GetName() << endl;
        cout << "[L1TTestsSummary:] Result=" << qtresult << " status=" << qtstatus << " message=" << qtmessage << endl;
        cout << "[L1TTestsSummary:] Bad Channels size=" << qtBadChannels.size() << endl;
      }

      for(unsigned int i=0 ; i<mProcessedLS.size() ; i++){
        int binx = mL1TSyncMonitor->getTH2F()->GetXaxis()->FindBin(mProcessedLS[i]);
        int biny = mL1TSyncMonitor->getTH2F()->GetYaxis()->FindBin(me->getTH1()->GetName());
        mL1TSyncMonitor->setBinContent(binx,biny,100);
      }

      for(unsigned int a=0 ; a<qtBadChannels.size() ; a++){ 
        for(unsigned int b=0 ; b<mProcessedLS.size() ; b++){
          
          // Converting bin to value
          double valueBinBad = me->getTH1()->GetBinCenter(qtBadChannels[a].getBin());
          
          if(valueBinBad==mProcessedLS[b]){
            int binx = mL1TSyncMonitor->getTH2F()->GetXaxis()->FindBin(valueBinBad);
            int biny = mL1TSyncMonitor->getTH2F()->GetYaxis()->FindBin(me->getTH1()->GetName());
            mL1TSyncMonitor->setBinContent(binx,biny,300);
          }
        }
      }
    }
  } 

  //-> Filling the summaries
  int nBinX = mL1TSyncMonitor->getTH2F()->GetXaxis()->GetNbins();
  int nBinY = mL1TSyncMonitor->getTH2F()->GetYaxis()->GetNbins();
  for(int binx=1; binx<=nBinX ; binx++){
    int GlobalStatus=0;
    for(int biny=2; biny<=nBinY ; biny++){
      double flag = mL1TSyncMonitor->getBinContent(binx,biny);
      if(GlobalStatus<flag){GlobalStatus=flag;}
    }
    
    // NOTE: Assumes mL1TSummary has same size then mL1TSyncMonitor
    mL1TSyncMonitor->setBinContent(binx,       1,GlobalStatus);
    mL1TSummary    ->setBinContent(binx,binYSync,GlobalStatus);
  } 
}

Member Data Documentation

Definition at line 64 of file L1TTestsSummary.h.

Definition at line 64 of file L1TTestsSummary.h.

Definition at line 64 of file L1TTestsSummary.h.

Definition at line 54 of file L1TTestsSummary.h.

Definition at line 77 of file L1TTestsSummary.h.

std::string L1TTestsSummary::mL1TOccupancyPath [private]

Definition at line 69 of file L1TTestsSummary.h.

Definition at line 75 of file L1TTestsSummary.h.

std::string L1TTestsSummary::mL1TRatePath [private]

Definition at line 67 of file L1TTestsSummary.h.

Definition at line 78 of file L1TTestsSummary.h.

Definition at line 76 of file L1TTestsSummary.h.

std::string L1TTestsSummary::mL1TSyncPath [private]

Definition at line 68 of file L1TTestsSummary.h.

Definition at line 61 of file L1TTestsSummary.h.

Definition at line 59 of file L1TTestsSummary.h.

Definition at line 60 of file L1TTestsSummary.h.

Definition at line 55 of file L1TTestsSummary.h.

std::vector<int> L1TTestsSummary::mProcessedLS [private]

Definition at line 72 of file L1TTestsSummary.h.

bool L1TTestsSummary::mVerbose [private]

Definition at line 58 of file L1TTestsSummary.h.