CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Private Attributes

EEStatusFlagsTask Class Reference

#include <EEStatusFlagsTask.h>

Inheritance diagram for EEStatusFlagsTask:
edm::EDAnalyzer

List of all members.

Public Member Functions

 EEStatusFlagsTask (const edm::ParameterSet &ps)
 Constructor.
virtual ~EEStatusFlagsTask ()
 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.
void setup (void)
 Setup.

Private Attributes

DQMStoredqmStore_
edm::InputTag EcalRawDataCollection_
bool enableCleanup_
int ievt_
bool init_
MonitorElementmeEvtType_ [18]
MonitorElementmeFEchErrors_ [18][3]
MonitorElementmeFEchErrorsByLumi_
bool mergeRuns_
std::string prefixME_
std::string subfolder_

Detailed Description

Definition at line 20 of file EEStatusFlagsTask.h.


Constructor & Destructor Documentation

EEStatusFlagsTask::EEStatusFlagsTask ( const edm::ParameterSet ps)

Constructor.

Definition at line 29 of file EEStatusFlagsTask.cc.

References dqmStore_, EcalRawDataCollection_, enableCleanup_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), i, init_, meEvtType_, meFEchErrors_, meFEchErrorsByLumi_, mergeRuns_, cmsCodeRules::cppFunctionSkipper::operator, prefixME_, and subfolder_.

                                                             {

  init_ = false;

  dqmStore_ = edm::Service<DQMStore>().operator->();

  prefixME_ = ps.getUntrackedParameter<std::string>("prefixME", "");

  subfolder_ = ps.getUntrackedParameter<std::string>("subfolder", "");

  enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);

  mergeRuns_ = ps.getUntrackedParameter<bool>("mergeRuns", false);

  EcalRawDataCollection_ = ps.getParameter<edm::InputTag>("EcalRawDataCollection");

  for (int i = 0; i < 18; i++) {
    meEvtType_[i] = 0;

    meFEchErrors_[i][0] = 0;
    meFEchErrors_[i][1] = 0;
    meFEchErrors_[i][2] = 0;
  }

  meFEchErrorsByLumi_ = 0;

}
EEStatusFlagsTask::~EEStatusFlagsTask ( ) [virtual]

Destructor.

Definition at line 57 of file EEStatusFlagsTask.cc.

                                     {

}

Member Function Documentation

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

Analyze.

Implements edm::EDAnalyzer.

Definition at line 247 of file EEStatusFlagsTask.cc.

References Numbers::crystals(), EcalEndcap, EcalRawDataCollection_, MonitorElement::Fill(), edm::Event::getByLabel(), i, ievt_, init_, Numbers::iSM(), ecalpyutils::ism(), EEDetId::ix(), meEvtType_, meFEchErrors_, meFEchErrorsByLumi_, setup(), ntuplemaker::status, and Numbers::subDet().

                                                                        {

  if ( ! init_ ) this->setup();

  ievt_++;

  // fill bin 0 with number of events in the lumi
  if ( meFEchErrorsByLumi_ ) meFEchErrorsByLumi_->Fill(0.);

  edm::Handle<EcalRawDataCollection> dcchs;

  if ( e.getByLabel(EcalRawDataCollection_, dcchs) ) {

    for ( EcalRawDataCollection::const_iterator dcchItr = dcchs->begin(); dcchItr != dcchs->end(); ++dcchItr ) {

      if ( Numbers::subDet( *dcchItr ) != EcalEndcap ) continue;

      int ism = Numbers::iSM( *dcchItr, EcalEndcap );
      float xism = ism + 0.5;

      if ( meEvtType_[ism-1] ) meEvtType_[ism-1]->Fill(dcchItr->getRunType()+0.5);

      const std::vector<short> status = dcchItr->getFEStatus();

      for ( unsigned int itt=1; itt<=status.size(); itt++ ) {

        if ( itt > 70 ) continue;

        if ( itt >= 42 && itt <= 68 ) continue;

        if ( ( ism == 8 || ism == 17 ) && ( itt >= 18 && itt <= 24 ) ) continue;

        if ( itt >= 1 && itt <= 41 ) {

          std::vector<DetId>* crystals = Numbers::crystals( dcchItr->id(), itt );

          for ( unsigned int i=0; i<crystals->size(); i++ ) {

          EEDetId id = (*crystals)[i];

          int ix = id.ix();
          int iy = id.iy();

          if ( ism >= 1 && ism <= 9 ) ix = 101 - ix;

          float xix = ix - 0.5;
          float xiy = iy - 0.5;

          if ( ! ( status[itt-1] == 0 || status[itt-1] == 1 || status[itt-1] == 7 || status[itt-1] == 8 || status[itt-1] == 12 || status[itt-1] == 15 ) ) {
            if ( meFEchErrors_[ism-1][0] ) meFEchErrors_[ism-1][0]->Fill(xix, xiy);
            if ( meFEchErrorsByLumi_ ) meFEchErrorsByLumi_->Fill(xism, 1./34./crystals->size());
          }

          }

        } else if ( itt == 69 || itt == 70 ) {

          if ( ! ( status[itt-1] == 0 || status[itt-1] == 1 || status[itt-1] == 7 || status[itt-1] == 8 || status[itt-1] == 12 || status[itt-1] == 15 ) ) {
            if ( meFEchErrors_[ism-1][1] ) meFEchErrors_[ism-1][1]->Fill(itt-68-0.5, 0);
          }

        }

        if ( meFEchErrors_[ism-1][2] ) meFEchErrors_[ism-1][2]->Fill(status[itt-1]+0.5);

      }

    }

  } else {

    edm::LogWarning("EEStatusFlagsTask") << EcalRawDataCollection_ << " not available";

  }

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

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 61 of file EEStatusFlagsTask.cc.

References dqmStore_, ievt_, prefixME_, DQMStore::rmdir(), DQMStore::setCurrentFolder(), and subfolder_.

                                    {

  ievt_ = 0;

  if ( dqmStore_ ) {
    dqmStore_->setCurrentFolder(prefixME_ + "/EEStatusFlagsTask");
    if(subfolder_.size())
      dqmStore_->setCurrentFolder(prefixME_ + "/EEStatusFlagsTask/" + subfolder_);
    dqmStore_->rmdir(prefixME_ + "/EEStatusFlagsTask");
  }

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

BeginLuminosityBlock.

Reimplemented from edm::EDAnalyzer.

Definition at line 74 of file EEStatusFlagsTask.cc.

References meFEchErrorsByLumi_, and MonitorElement::Reset().

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

BeginRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 83 of file EEStatusFlagsTask.cc.

References Numbers::initGeometry(), mergeRuns_, and reset().

                                                                        {

  Numbers::initGeometry(c, false);

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

}
void EEStatusFlagsTask::cleanup ( void  ) [protected]

Cleanup.

Definition at line 203 of file EEStatusFlagsTask.cc.

References dir, dqmStore_, edm::getName(), MonitorElement::getName(), i, init_, meEvtType_, meFEchErrors_, meFEchErrorsByLumi_, prefixME_, DQMStore::removeElement(), DQMStore::setCurrentFolder(), and subfolder_.

Referenced by endJob().

                                   {

  if ( ! init_ ) return;

  if ( dqmStore_ ) {
    std::string dir = prefixME_ + "/EEStatusFlagsTask";
    if(subfolder_.size())
      dir = prefixME_ + "/EEStatusFlagsTask/" + subfolder_;

    dqmStore_->setCurrentFolder(dir + "");

    dqmStore_->setCurrentFolder(dir + "/EvtType");
    for (int i = 0; i < 18; i++) {
      if ( meEvtType_[i] ) dqmStore_->removeElement( meEvtType_[i]->getName() );
      meEvtType_[i] = 0;
    }

    dqmStore_->setCurrentFolder(dir + "/FEStatus");
    for (int i = 0; i < 18; i++) {
      if ( meFEchErrors_[i][0] ) dqmStore_->removeElement( meFEchErrors_[i][0]->getName() );
      meFEchErrors_[i][0] = 0;
      if ( meFEchErrors_[i][1] ) dqmStore_->removeElement( meFEchErrors_[i][1]->getName() );
      meFEchErrors_[i][1] = 0;
      if ( meFEchErrors_[i][2] ) dqmStore_->removeElement( meFEchErrors_[i][2]->getName() );
      meFEchErrors_[i][2] = 0;
    }

    if ( meFEchErrorsByLumi_ ) dqmStore_->removeElement( meFEchErrorsByLumi_->getName() );
    meFEchErrorsByLumi_ = 0;

  }

  init_ = false;

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

EndJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 239 of file EEStatusFlagsTask.cc.

References cleanup(), enableCleanup_, and ievt_.

                                  {

  edm::LogInfo("EEStatusFlagsTask") << "analyzed " << ievt_ << " events";

  if ( enableCleanup_ ) this->cleanup();

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

EndLuminosityBlock.

Reimplemented from edm::EDAnalyzer.

Definition at line 80 of file EEStatusFlagsTask.cc.

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

EndRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 91 of file EEStatusFlagsTask.cc.

                                                                      {

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

Reset.

Definition at line 95 of file EEStatusFlagsTask.cc.

References i, meEvtType_, meFEchErrors_, meFEchErrorsByLumi_, and MonitorElement::Reset().

Referenced by beginRun().

                                  {

  for (int i = 0; i < 18; i++) {
    if ( meEvtType_[i] ) meEvtType_[i]->Reset();

    if ( meFEchErrors_[i][0] ) meFEchErrors_[i][0]->Reset();
    if ( meFEchErrors_[i][1] ) meFEchErrors_[i][1]->Reset();
    if ( meFEchErrors_[i][2] ) meFEchErrors_[i][2]->Reset();
  }
  if ( meFEchErrorsByLumi_ ) meFEchErrorsByLumi_->Reset();

}
void EEStatusFlagsTask::setup ( void  ) [protected]

Setup.

Definition at line 108 of file EEStatusFlagsTask.cc.

References EcalDCCHeaderBlock::BEAMH2, EcalDCCHeaderBlock::BEAMH4, DQMStore::book1D(), DQMStore::book2D(), EcalDCCHeaderBlock::COSMIC, EcalDCCHeaderBlock::COSMICS_GLOBAL, EcalDCCHeaderBlock::COSMICS_LOCAL, dir, dqmStore_, EcalDCCHeaderBlock::HALO_GLOBAL, EcalDCCHeaderBlock::HALO_LOCAL, i, init_, Numbers::ix0EE(), Numbers::iy0EE(), EcalDCCHeaderBlock::LASER_DELAY_SCAN, EcalDCCHeaderBlock::LASER_GAP, EcalDCCHeaderBlock::LASER_POWER_SCAN, EcalDCCHeaderBlock::LASER_STD, EcalDCCHeaderBlock::LED_GAP, EcalDCCHeaderBlock::LED_STD, meEvtType_, meFEchErrors_, meFEchErrorsByLumi_, EcalDCCHeaderBlock::MTCC, mergeVDriftHistosByStation::name, EcalDCCHeaderBlock::PEDESTAL_25NS_SCAN, EcalDCCHeaderBlock::PEDESTAL_GAP, EcalDCCHeaderBlock::PEDESTAL_OFFSET_SCAN, EcalDCCHeaderBlock::PEDESTAL_STD, EcalDCCHeaderBlock::PHYSICS_GLOBAL, EcalDCCHeaderBlock::PHYSICS_LOCAL, prefixME_, Numbers::sEE(), MonitorElement::setAxisTitle(), MonitorElement::setBinLabel(), DQMStore::setCurrentFolder(), MonitorElement::setLumiFlag(), subfolder_, DQMStore::tag(), EcalDCCHeaderBlock::TESTPULSE_GAP, EcalDCCHeaderBlock::TESTPULSE_MGPA, and EcalDCCHeaderBlock::TESTPULSE_SCAN_MEM.

Referenced by analyze().

                                 {

  init_ = true;

  std::string name;
  std::string dir;

  if ( dqmStore_ ) {
    dir = prefixME_ + "/EEStatusFlagsTask";
    if(subfolder_.size())
      dir = prefixME_ + "/EEStatusFlagsTask/" + subfolder_;

    dqmStore_->setCurrentFolder(dir);

    dqmStore_->setCurrentFolder(dir + "/EvtType");
    for (int i = 0; i < 18; i++) {
      name = "EESFT EVTTYPE " + Numbers::sEE(i+1);
      meEvtType_[i] = dqmStore_->book1D(name, name, 31, -1., 30.);
      meEvtType_[i]->setBinLabel(1, "UNKNOWN", 1);
      meEvtType_[i]->setBinLabel(2+EcalDCCHeaderBlock::COSMIC, "COSMIC", 1);
      meEvtType_[i]->setBinLabel(2+EcalDCCHeaderBlock::BEAMH4, "BEAMH4", 1);
      meEvtType_[i]->setBinLabel(2+EcalDCCHeaderBlock::BEAMH2, "BEAMH2", 1);
      meEvtType_[i]->setBinLabel(2+EcalDCCHeaderBlock::MTCC, "MTCC", 1);
      meEvtType_[i]->setBinLabel(2+EcalDCCHeaderBlock::LASER_STD, "LASER_STD", 1);
      meEvtType_[i]->setBinLabel(2+EcalDCCHeaderBlock::LASER_POWER_SCAN, "LASER_POWER_SCAN", 1);
      meEvtType_[i]->setBinLabel(2+EcalDCCHeaderBlock::LASER_DELAY_SCAN, "LASER_DELAY_SCAN", 1);
      meEvtType_[i]->setBinLabel(2+EcalDCCHeaderBlock::TESTPULSE_SCAN_MEM, "TESTPULSE_SCAN_MEM", 1);
      meEvtType_[i]->setBinLabel(2+EcalDCCHeaderBlock::TESTPULSE_MGPA, "TESTPULSE_MGPA", 1);
      meEvtType_[i]->setBinLabel(2+EcalDCCHeaderBlock::PEDESTAL_STD, "PEDESTAL_STD", 1);
      meEvtType_[i]->setBinLabel(2+EcalDCCHeaderBlock::PEDESTAL_OFFSET_SCAN, "PEDESTAL_OFFSET_SCAN", 1);
      meEvtType_[i]->setBinLabel(2+EcalDCCHeaderBlock::PEDESTAL_25NS_SCAN, "PEDESTAL_25NS_SCAN", 1);
      meEvtType_[i]->setBinLabel(2+EcalDCCHeaderBlock::LED_STD, "LED_STD", 1);
      meEvtType_[i]->setBinLabel(2+EcalDCCHeaderBlock::PHYSICS_GLOBAL, "PHYSICS_GLOBAL", 1);
      meEvtType_[i]->setBinLabel(2+EcalDCCHeaderBlock::COSMICS_GLOBAL, "COSMICS_GLOBAL", 1);
      meEvtType_[i]->setBinLabel(2+EcalDCCHeaderBlock::HALO_GLOBAL, "HALO_GLOBAL", 1);
      meEvtType_[i]->setBinLabel(2+EcalDCCHeaderBlock::LASER_GAP, "LASER_GAP", 1);
      meEvtType_[i]->setBinLabel(2+EcalDCCHeaderBlock::TESTPULSE_GAP, "TESTPULSE_GAP");
      meEvtType_[i]->setBinLabel(2+EcalDCCHeaderBlock::PEDESTAL_GAP, "PEDESTAL_GAP");
      meEvtType_[i]->setBinLabel(2+EcalDCCHeaderBlock::LED_GAP, "LED_GAP", 1);
      meEvtType_[i]->setBinLabel(2+EcalDCCHeaderBlock::PHYSICS_LOCAL, "PHYSICS_LOCAL", 1);
      meEvtType_[i]->setBinLabel(2+EcalDCCHeaderBlock::COSMICS_LOCAL, "COSMICS_LOCAL", 1);
      meEvtType_[i]->setBinLabel(2+EcalDCCHeaderBlock::HALO_LOCAL, "HALO_LOCAL", 1);
      dqmStore_->tag(meEvtType_[i], i+1);
    }

    dqmStore_->setCurrentFolder(dir + "/FEStatus");
    for (int i = 0; i < 18; i++) {
      name = "EESFT front-end status " + Numbers::sEE(i+1);
      meFEchErrors_[i][0] = dqmStore_->book2D(name, name, 50, Numbers::ix0EE(i+1)+0., Numbers::ix0EE(i+1)+50., 50, Numbers::iy0EE(i+1)+0., Numbers::iy0EE(i+1)+50.);
      meFEchErrors_[i][0]->setAxisTitle("ix", 1);
      if ( i+1 >= 1 && i+1 <= 9 ) meFEchErrors_[i][0]->setAxisTitle("101-ix", 1);
      meFEchErrors_[i][0]->setAxisTitle("iy", 2);
      dqmStore_->tag(meFEchErrors_[i][0], i+1);

      name = "EESFT MEM front-end status " + Numbers::sEE(i+1);
      meFEchErrors_[i][1] = dqmStore_->book2D(name, name, 2, 0., 2., 1, 0., 1.);
      meFEchErrors_[i][1]->setAxisTitle("pseudo-strip", 1);
      meFEchErrors_[i][1]->setAxisTitle("channel", 2);
      dqmStore_->tag(meFEchErrors_[i][1], i+1);

      name = "EESFT front-end status bits " + Numbers::sEE(i+1);
      meFEchErrors_[i][2] = dqmStore_->book1D(name, name, 16, 0., 16.);
      meFEchErrors_[i][2]->setBinLabel(1+0, "ACTIVE", 1);
      meFEchErrors_[i][2]->setBinLabel(1+1, "DISABLED", 1);
      meFEchErrors_[i][2]->setBinLabel(1+2, "TIMEOUT", 1);
      meFEchErrors_[i][2]->setBinLabel(1+3, "HEADER", 1);
      meFEchErrors_[i][2]->setBinLabel(1+4, "CHANNEL ID", 1);
      meFEchErrors_[i][2]->setBinLabel(1+5, "LINK", 1);
      meFEchErrors_[i][2]->setBinLabel(1+6, "BLOCKSIZE", 1);
      meFEchErrors_[i][2]->setBinLabel(1+7, "SUPPRESSED", 1);
      meFEchErrors_[i][2]->setBinLabel(1+8, "FORCED FS", 1);
      meFEchErrors_[i][2]->setBinLabel(1+9, "L1A SYNC", 1);
      meFEchErrors_[i][2]->setBinLabel(1+10, "BX SYNC", 1);
      meFEchErrors_[i][2]->setBinLabel(1+11, "L1A+BX SYNC", 1);
      meFEchErrors_[i][2]->setBinLabel(1+12, "FIFO FULL+L1A", 1);
      meFEchErrors_[i][2]->setBinLabel(1+13, "H PARITY", 1);
      meFEchErrors_[i][2]->setBinLabel(1+14, "V PARITY", 1);
      meFEchErrors_[i][2]->setBinLabel(1+15, "FORCED ZS", 1);
      dqmStore_->tag(meFEchErrors_[i][2], i+1);
    }

    // checking the number of front-end errors in each DCC for each lumi
    // tower error is weighted by 1/34
    // bin 0 contains the number of processed events in the lumi (for normalization)
    name = "EESFT weighted frontend errors by lumi";
    meFEchErrorsByLumi_ = dqmStore_->book1D(name, name, 18, 1., 19.);
    meFEchErrorsByLumi_->setLumiFlag();
    for (int i = 0; i < 18; i++) {
      meFEchErrorsByLumi_->setBinLabel(i+1, Numbers::sEE(i+1).c_str(), 1);
    }

  }

}

Member Data Documentation

Definition at line 66 of file EEStatusFlagsTask.h.

Referenced by beginJob(), cleanup(), EEStatusFlagsTask(), and setup().

Definition at line 76 of file EEStatusFlagsTask.h.

Referenced by analyze(), and EEStatusFlagsTask().

Definition at line 72 of file EEStatusFlagsTask.h.

Referenced by EEStatusFlagsTask(), and endJob().

int EEStatusFlagsTask::ievt_ [private]

Definition at line 64 of file EEStatusFlagsTask.h.

Referenced by analyze(), beginJob(), and endJob().

bool EEStatusFlagsTask::init_ [private]

Definition at line 83 of file EEStatusFlagsTask.h.

Referenced by analyze(), cleanup(), EEStatusFlagsTask(), and setup().

Definition at line 78 of file EEStatusFlagsTask.h.

Referenced by analyze(), cleanup(), EEStatusFlagsTask(), reset(), and setup().

Definition at line 80 of file EEStatusFlagsTask.h.

Referenced by analyze(), cleanup(), EEStatusFlagsTask(), reset(), and setup().

Definition at line 74 of file EEStatusFlagsTask.h.

Referenced by beginRun(), and EEStatusFlagsTask().

std::string EEStatusFlagsTask::prefixME_ [private]

Definition at line 68 of file EEStatusFlagsTask.h.

Referenced by beginJob(), cleanup(), EEStatusFlagsTask(), and setup().

std::string EEStatusFlagsTask::subfolder_ [private]

Definition at line 70 of file EEStatusFlagsTask.h.

Referenced by beginJob(), cleanup(), EEStatusFlagsTask(), and setup().