CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Private Attributes

EBDataCertificationTask Class Reference

#include <EBDataCertificationTask.h>

Inheritance diagram for EBDataCertificationTask:
edm::EDAnalyzer

List of all members.

Public Member Functions

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

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c)
 Analyze.
void beginJob (void)
 BeginJob.
void beginLuminosityBlock (const edm::LuminosityBlock &lumiBlock, const edm::EventSetup &iSetup)
 BeginLuminosityBlock.
void beginRun (const edm::Run &r, const edm::EventSetup &c)
 BeginRun.
void cleanup (void)
 Cleanup.
void endJob (void)
 EndJob.
void endLuminosityBlock (const edm::LuminosityBlock &lumiBlock, const edm::EventSetup &iSetup)
 EndLuminosityBlock.
void endRun (const edm::Run &r, const edm::EventSetup &c)
 EndRun.
void reset (void)
 Reset.

Private Attributes

bool cloneME_
DQMStoredqmStore_
bool enableCleanup_
TH2F * hDAQ_
TH2F * hDCS_
TH2F * hDQM_
TH1F * hFrontendByLumi_
TH1F * hIntegrityByLumi_
TH1F * hSynchronizationByLumi_
MonitorElementmeEBDataCertification_ [36]
MonitorElementmeEBDataCertificationSummary_
MonitorElementmeEBDataCertificationSummaryMap_
MonitorElementmeEBReportSummary_
MonitorElementmeEBReportSummaryContents_ [36]
bool mergeRuns_
std::string prefixME_

Detailed Description

Definition at line 19 of file EBDataCertificationTask.h.


Constructor & Destructor Documentation

EBDataCertificationTask::EBDataCertificationTask ( const edm::ParameterSet ps)
EBDataCertificationTask::~EBDataCertificationTask ( ) [virtual]

Destructor.

Definition at line 56 of file EBDataCertificationTask.cc.

                                                  {

}

Member Function Documentation

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

Analyze.

Implements edm::EDAnalyzer.

Definition at line 367 of file EBDataCertificationTask.cc.

                                                                              {

}
void EBDataCertificationTask::beginJob ( void  ) [protected, virtual]
void EBDataCertificationTask::beginLuminosityBlock ( const edm::LuminosityBlock lumiBlock,
const edm::EventSetup iSetup 
) [protected, virtual]

BeginLuminosityBlock.

Reimplemented from edm::EDAnalyzer.

Definition at line 95 of file EBDataCertificationTask.cc.

                                                                                                                   {

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

BeginRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 241 of file EBDataCertificationTask.cc.

References mergeRuns_, and reset().

                                                                              {

  if ( ! mergeRuns_ ) this->reset();

}
void EBDataCertificationTask::cleanup ( void  ) [protected]
void EBDataCertificationTask::endJob ( void  ) [protected, virtual]

EndJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 89 of file EBDataCertificationTask.cc.

References cleanup(), and enableCleanup_.

                                         {

  if ( enableCleanup_ ) this->cleanup();

}
void EBDataCertificationTask::endLuminosityBlock ( const edm::LuminosityBlock lumiBlock,
const edm::EventSetup iSetup 
) [protected, virtual]

EndLuminosityBlock.

Reimplemented from edm::EDAnalyzer.

Definition at line 99 of file EBDataCertificationTask.cc.

References abs, cloneME_, dqmStore_, benchmark_cfg::errors, MonitorElement::Fill(), DQMStore::get(), hDAQ_, hDCS_, hFrontendByLumi_, hIntegrityByLumi_, hSynchronizationByLumi_, i, ecalpyutils::ism(), meEBDataCertification_, meEBDataCertificationSummary_, meEBDataCertificationSummaryMap_, min, prefixME_, reset(), Numbers::sEB(), and MonitorElement::setBinContent().

                                                                                                                   {

  this->reset();

  MonitorElement* me;

  // evaluate the DQM quality of observables checked by lumi
  float DQMVal[36];
  for (int i = 0; i < 36; i++) {
    DQMVal[i] = -1.;
  }

  me = dqmStore_->get(prefixME_ + "/EBIntegrityTask/EBIT weighted integrity errors by lumi");
  hIntegrityByLumi_ = UtilsClient::getHisto<TH1F*>( me, cloneME_, hIntegrityByLumi_ );

  me = dqmStore_->get(prefixME_ + "/EBStatusFlagsTask/FEStatus/EBSFT weighted frontend errors by lumi");
  hFrontendByLumi_ = UtilsClient::getHisto<TH1F*>( me, cloneME_, hFrontendByLumi_ );

  me = dqmStore_->get(prefixME_ + "/EBRawDataTask/EBRDT FE synchronization errors by lumi");
  hSynchronizationByLumi_ = UtilsClient::getHisto<TH1F*>( me, cloneME_, hSynchronizationByLumi_ );

  if( hIntegrityByLumi_ && hFrontendByLumi_ && hSynchronizationByLumi_ ) {

    float integrityErrSum = 0.;
    float integrityQual = 1.0;
    float frontendErrSum = 0.;
    float frontendQual = 1.0;
    float synchronizationErrSum = 0.;
    float synchronizationQual = 1.0;

    for ( int i=0; i<36; i++) {
      float ismIntegrityQual = 1.0;
      if( hIntegrityByLumi_->GetBinContent(0) > 0 ) {
        float errors = hIntegrityByLumi_->GetBinContent(i+1);
        ismIntegrityQual = 1.0 - errors/hIntegrityByLumi_->GetBinContent(0);
        integrityErrSum += errors;
      }
      float ismFrontendQual = 1.0;
      if( hFrontendByLumi_->GetBinContent(0) > 0 ) {
        float errors = hFrontendByLumi_->GetBinContent(i+1);
        ismFrontendQual = 1.0 - errors/hFrontendByLumi_->GetBinContent(0);
        frontendErrSum += errors;
      }
      float ismSynchronizationQual = 1.0;
      if( hSynchronizationByLumi_->GetBinContent(0) > 0 ) {
        float errors = hSynchronizationByLumi_->GetBinContent(i+1);
        ismSynchronizationQual = 1.0 - errors/hSynchronizationByLumi_->GetBinContent(0);
        synchronizationErrSum += errors;
      }
      float minVal= std::min(ismIntegrityQual,ismFrontendQual);
      DQMVal[i] = std::min(minVal,ismSynchronizationQual);
    }

    if( hIntegrityByLumi_->GetBinContent(0) > 0 ) integrityQual = 1.0 - integrityErrSum/hIntegrityByLumi_->GetBinContent(0)/36.;
    if( hFrontendByLumi_->GetBinContent(0) > 0 ) frontendQual = 1.0 - frontendErrSum/hFrontendByLumi_->GetBinContent(0)/36.;
    if( hSynchronizationByLumi_->GetBinContent(0) > 0 ) synchronizationQual = 1.0 - synchronizationErrSum/hSynchronizationByLumi_->GetBinContent(0)/36.;
    float minVal = std::min(integrityQual,frontendQual);
    float totDQMVal = std::min(minVal,synchronizationQual);

    me = dqmStore_->get((prefixME_ + "/EventInfo/reportSummary"));
    if( me ) me->Fill(totDQMVal);
    for ( int i=0; i<36; i++) {
      me = dqmStore_->get(prefixME_ + "/EventInfo/reportSummaryContents/EcalBarrel_" + Numbers::sEB(i+1) ) ;
      if( me ) me->Fill(DQMVal[i]);

      me = dqmStore_->get(prefixME_ + "/EventInfo/reportSummaryMap");
      if( me ) {
        for ( int iett = 0; iett < 34; iett++ ) {
          for ( int iptt = 0; iptt < 72; iptt++ ) {
            int ism = ( iett<17 ) ? iptt/4+1 : 18+iptt/4+1;
            if( i == (ism-1) ) me->setBinContent(iptt+1, iett+1, DQMVal[ism-1]);
          }
        }
      }
    }

  }

  // now combine reduced DQM with DCS and DAQ
  me = dqmStore_->get(prefixME_ + "/EventInfo/DAQSummaryMap");
  hDAQ_ = UtilsClient::getHisto<TH2F*>( me, cloneME_, hDAQ_ );

  me = dqmStore_->get(prefixME_ + "/EventInfo/DCSSummaryMap");
  hDCS_ = UtilsClient::getHisto<TH2F*>( me, cloneME_, hDCS_ );

  float sumCert = 0.;
  float sumCertEB[36];
  int nValidChannels = 0;
  int nValidChannelsEB[36];

  for (int i = 0; i < 36; i++) {
    sumCertEB[i] = 0.;
    nValidChannelsEB[i] = 0;
  }

  for ( int iett = 0; iett < 34; iett++ ) {
    for ( int iptt = 0; iptt < 72; iptt++ ) {

      int ism = ( iett<17 ) ? iptt/4+1 : 18+iptt/4+1;

      float xvalDQM = DQMVal[ism-1];

      float xvalDAQ, xvalDCS;
      xvalDAQ = xvalDCS = -1.;
      float xcert = -1.;

      if ( hDAQ_ ) xvalDAQ = hDAQ_->GetBinContent( iptt+1, iett+1 );
      if ( hDCS_ ) xvalDCS = hDCS_->GetBinContent( iptt+1, iett+1 );

      if ( xvalDQM == -1  || ( xvalDAQ == -1 && xvalDCS == -1 ) ) {
        // problems: DQM empty or DAQ and DCS not available
        xcert = 0.0;
      } else {
        // do not consider the white value of DAQ and DCS (problems with DB)
        xcert = std::abs(xvalDQM) * std::abs(xvalDAQ) * std::abs(xvalDCS);
      }

      if ( meEBDataCertificationSummaryMap_ ) meEBDataCertificationSummaryMap_->setBinContent( iptt+1, iett+1, xcert );

      sumCertEB[ism-1] += xcert;
      nValidChannelsEB[ism-1]++;

      sumCert += xcert;
      nValidChannels++;

    }
  }

  if( meEBDataCertificationSummary_ ) {
    if( nValidChannels>0 ) meEBDataCertificationSummary_->Fill( sumCert/nValidChannels );
    else meEBDataCertificationSummary_->Fill( 0.0 );
  }

  for (int i = 0; i < 36; i++) {
    if( meEBDataCertification_[i] ) {
      if( nValidChannelsEB[i]>0 ) meEBDataCertification_[i]->Fill( sumCertEB[i]/nValidChannelsEB[i] );
      else meEBDataCertification_[i]->Fill( 0.0 );
    }
  }

}
void EBDataCertificationTask::endRun ( const edm::Run r,
const edm::EventSetup c 
) [protected, virtual]

EndRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 247 of file EBDataCertificationTask.cc.

References abs, cloneME_, dqmStore_, MonitorElement::Fill(), DQMStore::get(), hDAQ_, hDCS_, hDQM_, i, ecalpyutils::ism(), meEBDataCertification_, meEBDataCertificationSummary_, meEBDataCertificationSummaryMap_, prefixME_, reset(), and MonitorElement::setBinContent().

                                                                            {

  this->reset();

  MonitorElement* me;

  me = dqmStore_->get(prefixME_ + "/EventInfo/reportSummaryMap");
  hDQM_ = UtilsClient::getHisto<TH2F*>( me, cloneME_, hDQM_ );

  me = dqmStore_->get(prefixME_ + "/EventInfo/DAQSummaryMap");
  hDAQ_ = UtilsClient::getHisto<TH2F*>( me, cloneME_, hDAQ_ );

  me = dqmStore_->get(prefixME_ + "/EventInfo/DCSSummaryMap");
  hDCS_ = UtilsClient::getHisto<TH2F*>( me, cloneME_, hDCS_ );

  float sumCert = 0.;
  float sumCertEB[36];
  int nValidChannels = 0;
  int nValidChannelsEB[36];

  for (int i = 0; i < 36; i++) {
    sumCertEB[i] = 0.;
    nValidChannelsEB[i] = 0;
  }

  for ( int iett = 0; iett < 34; iett++ ) {
    for ( int iptt = 0; iptt < 72; iptt++ ) {

      float xvalDQM, xvalDAQ, xvalDCS;
      xvalDQM = xvalDAQ = xvalDCS = -1.;
      float xcert = -1;

      if ( hDQM_ ) xvalDQM = hDQM_->GetBinContent( iptt+1, iett+1 );
      if ( hDAQ_ ) xvalDAQ = hDAQ_->GetBinContent( iptt+1, iett+1 );
      if ( hDCS_ ) xvalDCS = hDCS_->GetBinContent( iptt+1, iett+1 );

      if ( xvalDQM == -1 || ( xvalDAQ == -1 && xvalDCS == -1 ) ) {
        // problems: DQM empty or DAQ and DCS not available
        xcert = 0.0;
      } else {
        // do not consider the white value of DAQ and DCS (problems with DB)
        xcert = std::abs(xvalDQM) * std::abs(xvalDAQ) * std::abs(xvalDCS);
      }

      if ( meEBDataCertificationSummaryMap_ ) meEBDataCertificationSummaryMap_->setBinContent( iptt+1, iett+1, xcert );

      int ism = ( iett<17 ) ? iptt/4+1 : 18+iptt/4+1;

      sumCertEB[ism-1] += xcert;
      nValidChannelsEB[ism-1]++;

      sumCert += xcert;
      nValidChannels++;

    }
  }

  if( meEBDataCertificationSummary_ ) {
    if( nValidChannels>0 ) {
      meEBDataCertificationSummary_->Fill( sumCert/nValidChannels );
    } else {
      meEBDataCertificationSummary_->Fill( 0.0 );
    }
  }

  for (int i = 0; i < 36; i++) {
    if( meEBDataCertification_[i] ) {
      if( nValidChannelsEB[i]>0 ) {
        meEBDataCertification_[i]->Fill( sumCertEB[i]/nValidChannelsEB[i] );
      } else {
        meEBDataCertification_[i]->Fill( 0.0 );
      }
    }
  }

}
void EBDataCertificationTask::reset ( void  ) [protected]

Member Data Documentation

Definition at line 66 of file EBDataCertificationTask.h.

Referenced by EBDataCertificationTask(), and endJob().

Definition at line 70 of file EBDataCertificationTask.h.

Referenced by cleanup(), EBDataCertificationTask(), and endRun().

Definition at line 74 of file EBDataCertificationTask.h.

Referenced by cleanup(), EBDataCertificationTask(), and endLuminosityBlock().

Definition at line 73 of file EBDataCertificationTask.h.

Referenced by cleanup(), EBDataCertificationTask(), and endLuminosityBlock().

Definition at line 75 of file EBDataCertificationTask.h.

Referenced by cleanup(), EBDataCertificationTask(), and endLuminosityBlock().

Definition at line 80 of file EBDataCertificationTask.h.

Definition at line 81 of file EBDataCertificationTask.h.

Definition at line 68 of file EBDataCertificationTask.h.

Referenced by beginRun(), and EBDataCertificationTask().

std::string EBDataCertificationTask::prefixME_ [private]