CMS 3D CMS Logo

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

EBDaqInfoTask Class Reference

#include <EBDaqInfoTask.h>

Inheritance diagram for EBDaqInfoTask:
edm::EDAnalyzer

List of all members.

Public Member Functions

 EBDaqInfoTask (const edm::ParameterSet &ps)
 Constructor.
virtual ~EBDaqInfoTask ()
 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 Member Functions

void fillMonitorElements (int ready[72][34])

Private Attributes

DQMStoredqmStore_
bool enableCleanup_
MonitorElementmeEBDaqActive_ [36]
MonitorElementmeEBDaqActiveMap_
MonitorElementmeEBDaqFraction_
bool mergeRuns_
std::string prefixME_
int readyLumi [72][34]
int readyRun [72][34]

Detailed Description

Definition at line 17 of file EBDaqInfoTask.h.


Constructor & Destructor Documentation

EBDaqInfoTask::EBDaqInfoTask ( const edm::ParameterSet ps)

Constructor.

Definition at line 30 of file EBDaqInfoTask.cc.

References dqmStore_, enableCleanup_, edm::ParameterSet::getUntrackedParameter(), i, meEBDaqActive_, meEBDaqActiveMap_, meEBDaqFraction_, mergeRuns_, cmsCodeRules::cppFunctionSkipper::operator, and prefixME_.

                                                      {

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

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

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

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

  meEBDaqFraction_ = 0;
  meEBDaqActiveMap_ = 0;
  for (int i = 0; i < 36; i++) {
    meEBDaqActive_[i] = 0;
  }

}
EBDaqInfoTask::~EBDaqInfoTask ( ) [virtual]

Destructor.

Definition at line 48 of file EBDaqInfoTask.cc.

                              {

}

Member Function Documentation

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

Analyze.

Implements edm::EDAnalyzer.

Definition at line 222 of file EBDaqInfoTask.cc.

                                                                    {

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

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 52 of file EBDaqInfoTask.cc.

References DQMStore::book2D(), DQMStore::bookFloat(), dqmStore_, MonitorElement::Fill(), i, meEBDaqActive_, meEBDaqActiveMap_, meEBDaqFraction_, mergeVDriftHistosByStation::name, prefixME_, Numbers::sEB(), MonitorElement::setAxisTitle(), and DQMStore::setCurrentFolder().

                                {

  std::string name;

  if ( dqmStore_ ) {

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

    name = "DAQSummary";
    meEBDaqFraction_ = dqmStore_->bookFloat(name);
    meEBDaqFraction_->Fill(0.0);

    name = "DAQSummaryMap";
    meEBDaqActiveMap_ = dqmStore_->book2D(name, name, 72, 0., 72., 34, 0., 34.);
    meEBDaqActiveMap_->setAxisTitle("jphi", 1);
    meEBDaqActiveMap_->setAxisTitle("jeta", 2);

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

    for (int i = 0; i < 36; i++) {
      name = "EcalBarrel_" + Numbers::sEB(i+1);
      meEBDaqActive_[i] = dqmStore_->bookFloat(name);
      meEBDaqActive_[i]->Fill(0.0);
    }

  }

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

BeginLuminosityBlock.

Reimplemented from edm::EDAnalyzer.

Definition at line 87 of file EBDaqInfoTask.cc.

References EcalBarrel, EcalCondTowerObjectContainer< T >::end(), edm::EventSetup::find(), EcalCondTowerObjectContainer< T >::find(), edm::EventSetup::get(), edm::ESHandleBase::isValid(), edm::ESHandle< T >::product(), DetId::rawId(), readyLumi, readyRun, and EcalTrigTowerDetId::validDetId().

                                                                                                         {

  // information is by run, so fill the same for the run and for every lumi section
  for ( int iett = 0; iett < 34; iett++ ) {
    for ( int iptt = 0; iptt < 72; iptt++ ) {
      readyLumi[iptt][iett] = 1;
    }
  }


  if ( !iSetup.find( edm::eventsetup::EventSetupRecordKey::makeKey<EcalDAQTowerStatusRcd>() ) ) {
    edm::LogWarning("EBDaqInfoTask") << "EcalDAQTowerStatus record not found";
    return;
  }

  edm::ESHandle<EcalDAQTowerStatus> pDAQStatus;
  iSetup.get<EcalDAQTowerStatusRcd>().get(pDAQStatus);
    if ( !pDAQStatus.isValid() ) {
    edm::LogWarning("EBDaqInfoTask") << "EcalDAQTowerStatus record not valid";
    return;
  }
  const EcalDAQTowerStatus* daqStatus = pDAQStatus.product();

  for(int iz=-1; iz<=1; iz+=2) {
    for(int iptt=0 ; iptt<72; iptt++) {
      for(int iett=0 ; iett<17; iett++) {
        if (EcalTrigTowerDetId::validDetId(iz,EcalBarrel,iett+1,iptt+1 )){

          EcalTrigTowerDetId ebid(iz,EcalBarrel,iett+1,iptt+1);

          uint16_t dbStatus = 0; // 0 = good
          EcalDAQTowerStatus::const_iterator daqStatusIt = daqStatus->find( ebid.rawId() );
          if ( daqStatusIt != daqStatus->end() ) dbStatus = daqStatusIt->getStatusCode();

          if ( dbStatus > 0 ) {
            int ipttEB = iptt;
            int iettEB = (iz==-1) ? iett : 17+iett;
            readyRun[ipttEB][iettEB] = 0;
            readyLumi[ipttEB][iettEB] = 0;
          }

        }
      }
    }
  }

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

BeginRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 143 of file EBDaqInfoTask.cc.

References mergeRuns_, readyRun, and reset().

                                                                    {

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

  for ( int iett = 0; iett < 34; iett++ ) {
    for ( int iptt = 0; iptt < 72; iptt++ ) {
      readyRun[iptt][iett] = 1;
    }
  }

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

EndJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 81 of file EBDaqInfoTask.cc.

References cleanup(), and enableCleanup_.

                               {

  if ( enableCleanup_ ) this->cleanup();

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

EndLuminosityBlock.

Reimplemented from edm::EDAnalyzer.

Definition at line 137 of file EBDaqInfoTask.cc.

References fillMonitorElements(), and readyLumi.

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

EndRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 155 of file EBDaqInfoTask.cc.

References fillMonitorElements(), and readyRun.

void EBDaqInfoTask::fillMonitorElements ( int  ready[72][34]) [private]

Definition at line 194 of file EBDaqInfoTask.cc.

References MonitorElement::Fill(), ecalpyutils::ism(), meEBDaqActive_, meEBDaqActiveMap_, meEBDaqFraction_, and MonitorElement::setBinContent().

Referenced by endLuminosityBlock(), and endRun().

                                                         {

  float readySum[36];
  for ( int ism = 0; ism < 36; ism++ ) readySum[ism] = 0;
  float readySumTot = 0.;

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

      if(meEBDaqActiveMap_) meEBDaqActiveMap_->setBinContent( iptt+1, iett+1, ready[iptt][iett] );

      int ism = ( iett<17 ) ? iptt/4 : 18+iptt/4;
      if(ready[iptt][iett]) {
        readySum[ism]++;
        readySumTot++;
      }

    }
  }

  for ( int ism = 0; ism < 36; ism++ ) {
    if( meEBDaqActive_[ism] ) meEBDaqActive_[ism]->Fill( readySum[ism]/68. );
  }

  if( meEBDaqFraction_ ) meEBDaqFraction_->Fill(readySumTot/34./72.);

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

Reset.

Definition at line 161 of file EBDaqInfoTask.cc.

References i, meEBDaqActive_, meEBDaqActiveMap_, meEBDaqFraction_, and MonitorElement::Reset().

Referenced by beginRun().

                              {

  if ( meEBDaqFraction_ ) meEBDaqFraction_->Reset();

  for (int i = 0; i < 36; i++) {
    if ( meEBDaqActive_[i] ) meEBDaqActive_[i]->Reset();
  }

  if ( meEBDaqActiveMap_ ) meEBDaqActiveMap_->Reset();

}

Member Data Documentation

Definition at line 60 of file EBDaqInfoTask.h.

Referenced by beginJob(), cleanup(), and EBDaqInfoTask().

Definition at line 64 of file EBDaqInfoTask.h.

Referenced by EBDaqInfoTask(), and endJob().

Definition at line 69 of file EBDaqInfoTask.h.

Referenced by beginJob(), cleanup(), EBDaqInfoTask(), fillMonitorElements(), and reset().

Definition at line 70 of file EBDaqInfoTask.h.

Referenced by beginJob(), cleanup(), EBDaqInfoTask(), fillMonitorElements(), and reset().

Definition at line 68 of file EBDaqInfoTask.h.

Referenced by beginJob(), cleanup(), EBDaqInfoTask(), fillMonitorElements(), and reset().

bool EBDaqInfoTask::mergeRuns_ [private]

Definition at line 66 of file EBDaqInfoTask.h.

Referenced by beginRun(), and EBDaqInfoTask().

std::string EBDaqInfoTask::prefixME_ [private]

Definition at line 62 of file EBDaqInfoTask.h.

Referenced by beginJob(), cleanup(), and EBDaqInfoTask().

int EBDaqInfoTask::readyLumi[72][34] [private]

Definition at line 73 of file EBDaqInfoTask.h.

Referenced by beginLuminosityBlock(), and endLuminosityBlock().

int EBDaqInfoTask::readyRun[72][34] [private]

Definition at line 72 of file EBDaqInfoTask.h.

Referenced by beginLuminosityBlock(), beginRun(), and endRun().