#include <EEDaqInfoTask.h>
Public Member Functions | |
EEDaqInfoTask (const edm::ParameterSet &ps) | |
Constructor. | |
virtual | ~EEDaqInfoTask () |
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[40][20]) |
Private Attributes | |
DQMStore * | dqmStore_ |
bool | enableCleanup_ |
MonitorElement * | meEEDaqActive_ [18] |
MonitorElement * | meEEDaqActiveMap_ |
MonitorElement * | meEEDaqFraction_ |
bool | mergeRuns_ |
std::string | prefixME_ |
int | readyLumi [40][20] |
int | readyRun [40][20] |
Definition at line 17 of file EEDaqInfoTask.h.
EEDaqInfoTask::EEDaqInfoTask | ( | const edm::ParameterSet & | ps | ) |
Constructor.
Definition at line 32 of file EEDaqInfoTask.cc.
References dqmStore_, enableCleanup_, edm::ParameterSet::getUntrackedParameter(), i, meEEDaqActive_, meEEDaqActiveMap_, meEEDaqFraction_, 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); meEEDaqFraction_ = 0; meEEDaqActiveMap_ = 0; for (int i = 0; i < 18; i++) { meEEDaqActive_[i] = 0; } }
EEDaqInfoTask::~EEDaqInfoTask | ( | ) | [virtual] |
void EEDaqInfoTask::analyze | ( | const edm::Event & | e, |
const edm::EventSetup & | c | ||
) | [protected, virtual] |
void EEDaqInfoTask::beginJob | ( | void | ) | [protected, virtual] |
BeginJob.
Reimplemented from edm::EDAnalyzer.
Definition at line 54 of file EEDaqInfoTask.cc.
References DQMStore::book2D(), DQMStore::bookFloat(), dqmStore_, MonitorElement::Fill(), trackerHits::histo, i, meEEDaqActive_, meEEDaqActiveMap_, meEEDaqFraction_, prefixME_, Numbers::sEE(), MonitorElement::setAxisTitle(), and DQMStore::setCurrentFolder().
{ char histo[200]; if ( dqmStore_ ) { dqmStore_->setCurrentFolder(prefixME_ + "/EventInfo"); sprintf(histo, "DAQSummary"); meEEDaqFraction_ = dqmStore_->bookFloat(histo); meEEDaqFraction_->Fill(0.0); sprintf(histo, "DAQSummaryMap"); meEEDaqActiveMap_ = dqmStore_->book2D(histo,histo, 200, 0., 200., 100, 0., 100.); meEEDaqActiveMap_->setAxisTitle("jx", 1); meEEDaqActiveMap_->setAxisTitle("jy", 2); dqmStore_->setCurrentFolder(prefixME_ + "/EventInfo/DAQContents"); for (int i = 0; i < 18; i++) { sprintf(histo, "EcalEndcap_%s", Numbers::sEE(i+1).c_str()); meEEDaqActive_[i] = dqmStore_->bookFloat(histo); meEEDaqActive_[i]->Fill(0.0); } } }
void EEDaqInfoTask::beginLuminosityBlock | ( | const edm::LuminosityBlock & | lumiBlock, |
const edm::EventSetup & | iSetup | ||
) | [protected, virtual] |
BeginLuminosityBlock.
Reimplemented from edm::EDAnalyzer.
Definition at line 89 of file EEDaqInfoTask.cc.
References EcalCondTowerObjectContainer< T >::end(), edm::EventSetup::find(), EcalCondTowerObjectContainer< T >::find(), edm::EventSetup::get(), edm::ESHandleBase::isValid(), edm::ESHandle< T >::product(), DetId::rawId(), readyLumi, readyRun, and EcalScDetId::validDetId().
{ // information is by run, so fill the same for the run and for every lumi section for ( int itx = 0; itx < 40; itx++ ) { for ( int ity = 0; ity < 20; ity++ ) { readyLumi[itx][ity] = 1; } } if ( !iSetup.find( edm::eventsetup::EventSetupRecordKey::makeKey<EcalDAQTowerStatusRcd>() ) ) { edm::LogWarning("EEDaqInfoTask") << "EcalDAQTowerStatus record not found"; return; } edm::ESHandle<EcalDAQTowerStatus> pDAQStatus; iSetup.get<EcalDAQTowerStatusRcd>().get(pDAQStatus); if ( !pDAQStatus.isValid() ) { edm::LogWarning("EEDaqInfoTask") << "EcalDAQTowerStatus record not valid"; return; } const EcalDAQTowerStatus* daqStatus = pDAQStatus.product(); for(int iz=-1; iz<=1; iz+=2) { for(int itx=0 ; itx<20; itx++) { for(int ity=0 ; ity<20; ity++) { if (EcalScDetId::validDetId(itx+1,ity+1,iz )){ EcalScDetId eeid(itx+1,ity+1,iz); uint16_t dbStatus = 0; // 0 = good EcalDAQTowerStatus::const_iterator daqStatusIt = daqStatus->find( eeid.rawId() ); if ( daqStatusIt != daqStatus->end() ) dbStatus = daqStatusIt->getStatusCode(); if ( dbStatus > 0 ) { int offsetSC = (iz > 0) ? 0 : 20; readyRun[offsetSC+itx][ity] = 0; readyLumi[offsetSC+itx][ity] = 0; } } } } } }
void EEDaqInfoTask::beginRun | ( | const edm::Run & | r, |
const edm::EventSetup & | c | ||
) | [protected, virtual] |
BeginRun.
Reimplemented from edm::EDAnalyzer.
Definition at line 141 of file EEDaqInfoTask.cc.
References mergeRuns_, readyRun, and reset().
{ if ( ! mergeRuns_ ) this->reset(); for ( int itx = 0; itx < 40; itx++ ) { for ( int ity = 0; ity < 20; ity++ ) { readyRun[itx][ity] = 1; } } }
void EEDaqInfoTask::cleanup | ( | void | ) | [protected] |
Cleanup.
Definition at line 172 of file EEDaqInfoTask.cc.
References dqmStore_, edm::getName(), MonitorElement::getName(), i, meEEDaqActive_, meEEDaqActiveMap_, meEEDaqFraction_, prefixME_, DQMStore::removeElement(), and DQMStore::setCurrentFolder().
Referenced by endJob().
{ if ( dqmStore_ ) { dqmStore_->setCurrentFolder(prefixME_ + "/EventInfo"); if ( meEEDaqFraction_ ) dqmStore_->removeElement( meEEDaqFraction_->getName() ); if ( meEEDaqActiveMap_ ) dqmStore_->removeElement( meEEDaqActiveMap_->getName() ); dqmStore_->setCurrentFolder(prefixME_ + "/EventInfo/DAQContents"); for (int i = 0; i < 18; i++) { if ( meEEDaqActive_[i] ) dqmStore_->removeElement( meEEDaqActive_[i]->getName() ); } } }
void EEDaqInfoTask::endJob | ( | void | ) | [protected, virtual] |
EndJob.
Reimplemented from edm::EDAnalyzer.
Definition at line 83 of file EEDaqInfoTask.cc.
References cleanup(), and enableCleanup_.
{ if ( enableCleanup_ ) this->cleanup(); }
void EEDaqInfoTask::endLuminosityBlock | ( | const edm::LuminosityBlock & | lumiBlock, |
const edm::EventSetup & | iSetup | ||
) | [protected, virtual] |
EndLuminosityBlock.
Reimplemented from edm::EDAnalyzer.
Definition at line 135 of file EEDaqInfoTask.cc.
References fillMonitorElements(), and readyLumi.
{ this->fillMonitorElements(readyLumi); }
void EEDaqInfoTask::endRun | ( | const edm::Run & | r, |
const edm::EventSetup & | c | ||
) | [protected, virtual] |
EndRun.
Reimplemented from edm::EDAnalyzer.
Definition at line 153 of file EEDaqInfoTask.cc.
References fillMonitorElements(), and readyRun.
{ this->fillMonitorElements(readyRun); }
void EEDaqInfoTask::fillMonitorElements | ( | int | ready[40][20] | ) | [private] |
Definition at line 192 of file EEDaqInfoTask.cc.
References MonitorElement::Fill(), h, Numbers::iSM(), ecalpyutils::ism(), gen::k, meEEDaqActive_, meEEDaqActiveMap_, meEEDaqFraction_, evf::evtn::offset(), MonitorElement::setBinContent(), EEDetId::validDetId(), and EEDetId::XYMODE.
Referenced by endLuminosityBlock(), and endRun().
{ float readySum[18]; int nValidChannels[18]; for ( int ism = 0; ism < 18; ism++ ) { readySum[ism] = 0; nValidChannels[ism] = 0; } float readySumTot = 0.; int nValidChannelsTot = 0; for ( int iz = -1; iz < 2; iz+=2 ) { for ( int itx = 0; itx < 20; itx++ ) { for ( int ity = 0; ity < 20; ity++ ) { for ( int h = 0; h < 5; h++ ) { for ( int k = 0; k < 5; k++ ) { int ix = 5*itx + h; int iy = 5*ity + k; int offsetSC = (iz > 0) ? 0 : 20; int offset = (iz > 0) ? 0 : 100; if( EEDetId::validDetId(ix+1, iy+1, iz) ) { if(meEEDaqActiveMap_) meEEDaqActiveMap_->setBinContent( offset+ix+1, iy+1, ready[offsetSC+itx][ity] ); EEDetId id = EEDetId(ix+1, iy+1, iz, EEDetId::XYMODE); int ism = Numbers::iSM(id); if(ready[offsetSC+itx][ity]) { readySum[ism-1]++; readySumTot++; } nValidChannels[ism-1]++; nValidChannelsTot++; } else { if(meEEDaqActiveMap_) meEEDaqActiveMap_->setBinContent( offset+ix+1, iy+1, -1.0 ); } } } } } } for ( int ism = 0; ism < 18; ism++ ) { if( meEEDaqActive_[ism] ) meEEDaqActive_[ism]->Fill( readySum[ism]/float(nValidChannels[ism]) ); } if( meEEDaqFraction_ ) meEEDaqFraction_->Fill( readySumTot/float(nValidChannelsTot) ); }
void EEDaqInfoTask::reset | ( | void | ) | [protected] |
Reset.
Definition at line 159 of file EEDaqInfoTask.cc.
References i, meEEDaqActive_, meEEDaqActiveMap_, meEEDaqFraction_, and MonitorElement::Reset().
Referenced by beginRun().
{ if ( meEEDaqFraction_ ) meEEDaqFraction_->Reset(); for (int i = 0; i < 18; i++) { if ( meEEDaqActive_[i] ) meEEDaqActive_[i]->Reset(); } if ( meEEDaqActiveMap_ ) meEEDaqActiveMap_->Reset(); }
DQMStore* EEDaqInfoTask::dqmStore_ [private] |
Definition at line 60 of file EEDaqInfoTask.h.
Referenced by beginJob(), cleanup(), and EEDaqInfoTask().
bool EEDaqInfoTask::enableCleanup_ [private] |
Definition at line 64 of file EEDaqInfoTask.h.
Referenced by EEDaqInfoTask(), and endJob().
MonitorElement* EEDaqInfoTask::meEEDaqActive_[18] [private] |
Definition at line 69 of file EEDaqInfoTask.h.
Referenced by beginJob(), cleanup(), EEDaqInfoTask(), fillMonitorElements(), and reset().
MonitorElement* EEDaqInfoTask::meEEDaqActiveMap_ [private] |
Definition at line 70 of file EEDaqInfoTask.h.
Referenced by beginJob(), cleanup(), EEDaqInfoTask(), fillMonitorElements(), and reset().
MonitorElement* EEDaqInfoTask::meEEDaqFraction_ [private] |
Definition at line 68 of file EEDaqInfoTask.h.
Referenced by beginJob(), cleanup(), EEDaqInfoTask(), fillMonitorElements(), and reset().
bool EEDaqInfoTask::mergeRuns_ [private] |
Definition at line 66 of file EEDaqInfoTask.h.
Referenced by beginRun(), and EEDaqInfoTask().
std::string EEDaqInfoTask::prefixME_ [private] |
Definition at line 62 of file EEDaqInfoTask.h.
Referenced by beginJob(), cleanup(), and EEDaqInfoTask().
int EEDaqInfoTask::readyLumi[40][20] [private] |
Definition at line 73 of file EEDaqInfoTask.h.
Referenced by beginLuminosityBlock(), and endLuminosityBlock().
int EEDaqInfoTask::readyRun[40][20] [private] |
Definition at line 72 of file EEDaqInfoTask.h.
Referenced by beginLuminosityBlock(), beginRun(), and endRun().