CMS 3D CMS Logo

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

EBDcsInfoTask Class Reference

#include <EBDcsInfoTask.h>

Inheritance diagram for EBDcsInfoTask:
edm::EDAnalyzer

List of all members.

Public Member Functions

 EBDcsInfoTask (const edm::ParameterSet &ps)
 Constructor.
virtual ~EBDcsInfoTask ()
 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_
MonitorElementmeEBDcsActive_ [36]
MonitorElementmeEBDcsActiveMap_
MonitorElementmeEBDcsFraction_
bool mergeRuns_
std::string prefixME_
int readyLumi [72][34]
int readyRun [72][34]

Detailed Description

Definition at line 17 of file EBDcsInfoTask.h.


Constructor & Destructor Documentation

EBDcsInfoTask::EBDcsInfoTask ( const edm::ParameterSet ps)

Constructor.

Definition at line 27 of file EBDcsInfoTask.cc.

References dqmStore_, enableCleanup_, edm::ParameterSet::getUntrackedParameter(), i, meEBDcsActive_, meEBDcsActiveMap_, meEBDcsFraction_, 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);

  meEBDcsFraction_ = 0;
  meEBDcsActiveMap_ = 0;
  for (int i = 0; i < 36; i++) {
    meEBDcsActive_[i] = 0;
  }

}
EBDcsInfoTask::~EBDcsInfoTask ( ) [virtual]

Destructor.

Definition at line 45 of file EBDcsInfoTask.cc.

                              {

}

Member Function Documentation

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

Analyze.

Implements edm::EDAnalyzer.

Definition at line 217 of file EBDcsInfoTask.cc.

                                                                    {

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

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 49 of file EBDcsInfoTask.cc.

References DQMStore::book2D(), DQMStore::bookFloat(), dqmStore_, MonitorElement::Fill(), trackerHits::histo, i, meEBDcsActive_, meEBDcsActiveMap_, meEBDcsFraction_, prefixME_, Numbers::sEB(), MonitorElement::setAxisTitle(), and DQMStore::setCurrentFolder().

                                {

  char histo[200];

  if ( dqmStore_ ) {

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

    sprintf(histo, "DCSSummary");
    meEBDcsFraction_ = dqmStore_->bookFloat(histo);
    meEBDcsFraction_->Fill(0.0);

    sprintf(histo, "DCSSummaryMap");
    meEBDcsActiveMap_ = dqmStore_->book2D(histo,histo, 72, 0., 72., 34, 0., 34.);
    meEBDcsActiveMap_->setAxisTitle("jphi", 1);
    meEBDcsActiveMap_->setAxisTitle("jeta", 2);

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

    for (int i = 0; i < 36; i++) {
      sprintf(histo, "EcalBarrel_%s", Numbers::sEB(i+1).c_str());
      meEBDcsActive_[i] = dqmStore_->bookFloat(histo);
      meEBDcsActive_[i]->Fill(-1.0);
    }

  }

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

BeginLuminosityBlock.

Reimplemented from edm::EDAnalyzer.

Definition at line 84 of file EBDcsInfoTask.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<EcalDCSTowerStatusRcd>() ) ) {
    edm::LogWarning("EBDcsInfoTask") << "EcalDCSTowerStatus record not found";
    return;
  }

  edm::ESHandle<EcalDCSTowerStatus> pDCSStatus;
  iSetup.get<EcalDCSTowerStatusRcd>().get(pDCSStatus);
  if ( !pDCSStatus.isValid() ) {
    edm::LogWarning("EBDcsInfoTask") << "EcalDCSTowerStatus record not valid";
    return;
  }
  const EcalDCSTowerStatus* dcsStatus = pDCSStatus.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
          EcalDCSTowerStatus::const_iterator dcsStatusIt = dcsStatus->find( ebid.rawId() );
          if ( dcsStatusIt != dcsStatus->end() ) dbStatus = dcsStatusIt->getStatusCode();

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

        }
      }
    }
  }


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

BeginRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 138 of file EBDcsInfoTask.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 EBDcsInfoTask::cleanup ( void  ) [protected]
void EBDcsInfoTask::endJob ( void  ) [protected, virtual]

EndJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 78 of file EBDcsInfoTask.cc.

References cleanup(), and enableCleanup_.

                               {

  if ( enableCleanup_ ) this->cleanup();

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

EndLuminosityBlock.

Reimplemented from edm::EDAnalyzer.

Definition at line 132 of file EBDcsInfoTask.cc.

References fillMonitorElements(), and readyLumi.

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

EndRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 150 of file EBDcsInfoTask.cc.

References fillMonitorElements(), and readyRun.

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

Definition at line 189 of file EBDcsInfoTask.cc.

References MonitorElement::Fill(), ecalpyutils::ism(), meEBDcsActive_, meEBDcsActiveMap_, meEBDcsFraction_, 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(meEBDcsActiveMap_) meEBDcsActiveMap_->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( meEBDcsActive_[ism] ) meEBDcsActive_[ism]->Fill( readySum[ism]/68. );
  }

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

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

Reset.

Definition at line 156 of file EBDcsInfoTask.cc.

References i, meEBDcsActive_, meEBDcsActiveMap_, meEBDcsFraction_, and MonitorElement::Reset().

Referenced by beginRun().

                              {

  if ( meEBDcsFraction_ ) meEBDcsFraction_->Reset();

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

  if ( meEBDcsActiveMap_ ) meEBDcsActiveMap_->Reset();

}

Member Data Documentation

Definition at line 60 of file EBDcsInfoTask.h.

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

Definition at line 64 of file EBDcsInfoTask.h.

Referenced by EBDcsInfoTask(), and endJob().

Definition at line 69 of file EBDcsInfoTask.h.

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

Definition at line 70 of file EBDcsInfoTask.h.

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

Definition at line 68 of file EBDcsInfoTask.h.

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

bool EBDcsInfoTask::mergeRuns_ [private]

Definition at line 66 of file EBDcsInfoTask.h.

Referenced by beginRun(), and EBDcsInfoTask().

std::string EBDcsInfoTask::prefixME_ [private]

Definition at line 62 of file EBDcsInfoTask.h.

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

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

Definition at line 73 of file EBDcsInfoTask.h.

Referenced by beginLuminosityBlock(), and endLuminosityBlock().

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

Definition at line 72 of file EBDcsInfoTask.h.

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