CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Private Attributes

EEDataCertificationTask Class Reference

#include <EEDataCertificationTask.h>

Inheritance diagram for EEDataCertificationTask:
edm::EDAnalyzer

List of all members.

Public Member Functions

 EEDataCertificationTask (const edm::ParameterSet &ps)
 Constructor.
virtual ~EEDataCertificationTask ()
 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_
MonitorElementmeEEDataCertification_ [18]
MonitorElementmeEEDataCertificationSummary_
MonitorElementmeEEDataCertificationSummaryMap_
MonitorElementmeEEReportSummary_
MonitorElementmeEEReportSummaryContents_ [36]
bool mergeRuns_
std::string prefixME_

Detailed Description

Definition at line 19 of file EEDataCertificationTask.h.


Constructor & Destructor Documentation

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

Destructor.

Definition at line 55 of file EEDataCertificationTask.cc.

                                                  {

}

Member Function Documentation

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

Analyze.

Implements edm::EDAnalyzer.

Definition at line 412 of file EEDataCertificationTask.cc.

                                                                              {

}
void EEDataCertificationTask::beginJob ( void  ) [protected, virtual]

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 59 of file EEDataCertificationTask.cc.

References DQMStore::book2D(), DQMStore::bookFloat(), dqmStore_, MonitorElement::Fill(), trackerHits::histo, i, meEEDataCertification_, meEEDataCertificationSummary_, meEEDataCertificationSummaryMap_, prefixME_, Numbers::sEE(), MonitorElement::setAxisTitle(), and DQMStore::setCurrentFolder().

                                          {

  char histo[200];

  if ( dqmStore_ ) {

    dqmStore_->setCurrentFolder(prefixME_ + "/EventInfo");

    sprintf(histo, "CertificationSummary");
    meEEDataCertificationSummary_ = dqmStore_->bookFloat(histo);
    meEEDataCertificationSummary_->Fill(-1.0);

    sprintf(histo, "CertificationSummaryMap");
    meEEDataCertificationSummaryMap_ = dqmStore_->book2D(histo,histo, 200, 0., 200., 100, 0., 100.);
    meEEDataCertificationSummaryMap_->setAxisTitle("jx", 1);
    meEEDataCertificationSummaryMap_->setAxisTitle("jy", 2);

    dqmStore_->setCurrentFolder(prefixME_ + "/EventInfo/CertificationContents");

    for (int i = 0; i < 18; i++) {
      sprintf(histo, "EcalEndcap_%s", Numbers::sEE(i+1).c_str());
      meEEDataCertification_[i] = dqmStore_->bookFloat(histo);
      meEEDataCertification_[i]->Fill(-1.0);
    }

  }

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

BeginLuminosityBlock.

Reimplemented from edm::EDAnalyzer.

Definition at line 94 of file EEDataCertificationTask.cc.

                                                                                                                   {

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

BeginRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 266 of file EEDataCertificationTask.cc.

References mergeRuns_, and reset().

                                                                              {

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

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

EndJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 88 of file EEDataCertificationTask.cc.

References cleanup(), and enableCleanup_.

                                         {

  if ( enableCleanup_ ) this->cleanup();

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

EndLuminosityBlock.

Reimplemented from edm::EDAnalyzer.

Definition at line 98 of file EEDataCertificationTask.cc.

References abs, cloneME_, dqmStore_, ExpressReco_HICollisions_FallBack::errors, MonitorElement::Fill(), DQMStore::get(), hDAQ_, hDCS_, hFrontendByLumi_, hIntegrityByLumi_, trackerHits::histo, hSynchronizationByLumi_, i, ecalpyutils::ism(), meEEDataCertification_, meEEDataCertificationSummary_, meEEDataCertificationSummaryMap_, min, prefixME_, reset(), Numbers::sEE(), MonitorElement::setBinContent(), EEDetId::validDetId(), and Numbers::validEE().

                                                                                                                   {

  this->reset();

  char histo[200];

  MonitorElement* me;

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

  sprintf(histo, (prefixME_ + "/EEIntegrityTask/EEIT weighted integrity errors by lumi").c_str());
  me = dqmStore_->get(histo);
  hIntegrityByLumi_ = UtilsClient::getHisto<TH1F*>( me, cloneME_, hIntegrityByLumi_ );

  sprintf(histo, (prefixME_ + "/EEStatusFlagsTask/FEStatus/EESFT weighted frontend errors by lumi").c_str());
  me = dqmStore_->get(histo);
  hFrontendByLumi_ = UtilsClient::getHisto<TH1F*>( me, cloneME_, hFrontendByLumi_ );

  sprintf(histo, (prefixME_ + "/EERawDataTask/EERDT FE synchronization errors by lumi").c_str());
  me = dqmStore_->get(histo);
  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<18; 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)/18.;
    if( hFrontendByLumi_->GetBinContent(0) > 0 ) frontendQual = 1.0 - frontendErrSum/hFrontendByLumi_->GetBinContent(0)/18.;
    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);

    sprintf(histo, (prefixME_ + "/EventInfo/reportSummary").c_str());
    me = dqmStore_->get(histo);
    if( me ) me->Fill(totDQMVal);

    for ( int i=0; i<18; i++) {
      sprintf(histo, "EcalEndcap_%s", Numbers::sEE(i+1).c_str());
      me = dqmStore_->get(prefixME_ + "/EventInfo/reportSummaryContents/" + histo);
      if( me ) me->Fill(DQMVal[i]);

      sprintf(histo, "reportSummaryMap");
      me = dqmStore_->get(prefixME_ + "/EventInfo/" + histo );
      if( me ) {
        for ( int ix = 1; ix <= 100; ix++ ) {
          for ( int iy = 1; iy <= 100; iy++ ) {
            int jx = ( i < 9 ) ? ix : 100 + ix;
            int jy = iy;
            if ( Numbers::validEE(i+1, ix, iy) ) me->setBinContent(jx, jy, DQMVal[i]);
          }
        }
      }
    }

  }

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

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

  float sumCert = 0.;
  float sumCertEE[18];
  int nValidChannels = 0;
  int nValidChannelsEE[18];

  for (int i = 0; i < 18; i++) {
    sumCertEE[i] = 0;
    nValidChannelsEE[i] = 0;
  }

  for ( int iz = -1; iz < 2; iz+=2 ) {
    for ( int ix = 1; ix <= 100; ix++ ) {
      for ( int iy = 1; iy <= 100; iy++ ) {
        int jx = (iz==1) ? 100 + ix : ix;
        int jy = iy;
        if( EEDetId::validDetId(ix, iy, iz) ) {

          // map the 1-18 index to the correct SM
          int ism = 0;
          int firstSec = ( iz < 0 ) ? 1 : 10;
          int lastSec = ( iz < 0 ) ? 9 : 18;
          for (int i = firstSec; i <= lastSec; i++) {
            if ( Numbers::validEE(i, ix, iy) ) ism = i;
          }

          float xvalDQM = DQMVal[ism-1];

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

          if ( hDAQ_ ) xvalDAQ = hDAQ_->GetBinContent( jx, jy );
          if ( hDCS_ ) xvalDCS = hDCS_->GetBinContent( jx, jy );

          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 ( meEEDataCertificationSummaryMap_ ) meEEDataCertificationSummaryMap_->setBinContent( jx, jy, xcert );

          sumCertEE[ism-1] += xcert;
          nValidChannelsEE[ism-1]++;

          sumCert += xcert;
          nValidChannels++;

        } else {
          if ( meEEDataCertificationSummaryMap_ ) meEEDataCertificationSummaryMap_->setBinContent( jx, jy, -1.0 );
        }
      }
    }
  }

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

  for (int i = 0; i < 18; i++) {
    if( meEEDataCertification_[i] ) {
      if( nValidChannelsEE[i]>0 ) meEEDataCertification_[i]->Fill( sumCertEE[i]/nValidChannelsEE[i] );
      else meEEDataCertification_[i]->Fill( 0.0 );
    }
  }

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

EndRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 272 of file EEDataCertificationTask.cc.

References abs, cloneME_, dqmStore_, MonitorElement::Fill(), DQMStore::get(), hDAQ_, hDCS_, hDQM_, trackerHits::histo, i, meEEDataCertification_, meEEDataCertificationSummary_, meEEDataCertificationSummaryMap_, prefixME_, reset(), MonitorElement::setBinContent(), EEDetId::validDetId(), and Numbers::validEE().

                                                                            {

  this->reset();

  char histo[200];

  MonitorElement* me;

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

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

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

  float sumCert = 0.;
  float sumCertEE[18];
  int nValidChannels = 0;
  int nValidChannelsEE[18];

  for (int i = 0; i < 18; i++) {
    sumCertEE[i] = 0.;
    nValidChannelsEE[i] = 0;
  }

  for ( int iz = -1; iz < 2; iz+=2 ) {
    for ( int ix = 1; ix <= 100; ix++ ) {
      for ( int iy = 1; iy <= 100; iy++ ) {
        int jx = (iz==1) ? 100 + ix : ix;
        int jy = iy;
        if( EEDetId::validDetId(ix, iy, iz) ) {

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

          if ( hDQM_ ) xvalDQM = hDQM_->GetBinContent( jx, jy );
          if ( hDAQ_ ) xvalDAQ = hDAQ_->GetBinContent( jx, jy );
          if ( hDCS_ ) xvalDCS = hDCS_->GetBinContent( jx, jy );

          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 ( meEEDataCertificationSummaryMap_ ) meEEDataCertificationSummaryMap_->setBinContent( jx, jy, xcert );

          // map the 1-18 index to the correct SM
          int firstSec = ( iz < 0 ) ? 1 : 10;
          int lastSec = ( iz < 0 ) ? 9 : 18;
          for (int i = firstSec; i <= lastSec; i++) {
            if ( Numbers::validEE(i, ix, iy) ) {
              sumCertEE[i-1] += xcert;
              nValidChannelsEE[i-1]++;
            }
          }

          sumCert += xcert;
          nValidChannels++;

        } else {
          if ( meEEDataCertificationSummaryMap_ ) meEEDataCertificationSummaryMap_->setBinContent( jx, jy, -1.0 );
        }
      }
    }
  }

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

  for (int i = 0; i < 18; i++) {
    if( meEEDataCertification_[i] ) {
      if( nValidChannelsEE[i]>0 ) {
        meEEDataCertification_[i]->Fill( sumCertEE[i]/nValidChannelsEE[i] );
      } else {
        meEEDataCertification_[i]->Fill( 0.0 );
      }
    }
  }

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

Member Data Documentation

Definition at line 66 of file EEDataCertificationTask.h.

Referenced by EEDataCertificationTask(), and endJob().

Definition at line 72 of file EEDataCertificationTask.h.

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

Definition at line 70 of file EEDataCertificationTask.h.

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

Definition at line 74 of file EEDataCertificationTask.h.

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

Definition at line 73 of file EEDataCertificationTask.h.

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

Definition at line 75 of file EEDataCertificationTask.h.

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

Definition at line 80 of file EEDataCertificationTask.h.

Definition at line 81 of file EEDataCertificationTask.h.

Definition at line 68 of file EEDataCertificationTask.h.

Referenced by beginRun(), and EEDataCertificationTask().

std::string EEDataCertificationTask::prefixME_ [private]