#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. | |
Static Protected Attributes | |
static const int | DccId_ [18] |
static const int | nTowerMax_ = 44 |
Private Member Functions | |
void | fillMonitorElements (int ready[40][20], const EcalElectronicsMapping *) |
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 19 of file EEDaqInfoTask.h.
EEDaqInfoTask::EEDaqInfoTask | ( | const edm::ParameterSet & | ps | ) |
Constructor.
Definition at line 34 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 56 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, 40, 0., 200., 20, 0., 100.); meEEDaqActiveMap_->setAxisTitle("ix / ix+100", 1); meEEDaqActiveMap_->setAxisTitle("iy", 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 91 of file EEDaqInfoTask.cc.
References DccId_, EcalElectronicsMapping::dccTowerConstituents(), EcalCondTowerObjectContainer< T >::end(), edm::EventSetup::find(), EcalCondTowerObjectContainer< T >::find(), edm::EventSetup::get(), EcalElectronicsMapping::getEcalScDetId(), i, edm::ESHandleBase::isValid(), python::multivaluedict::map(), nTowerMax_, edm::ESHandle< T >::product(), readyLumi, readyRun, and matplotRender::t.
{ // 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(); edm::ESHandle< EcalElectronicsMapping > pElecMapping; iSetup.get< EcalMappingRcd >().get(pElecMapping); if( !pElecMapping.isValid() ) { edm::LogWarning("EEDaqInfoTask") << "EcalElectronicsMapping not available"; return; } const EcalElectronicsMapping *map = pElecMapping.product(); std::vector<DetId> crystals; std::vector<EcalScDetId> scs; for(unsigned i=0 ; i<sizeof(DccId_)/sizeof(int) ; i++){ for(int t=1 ; t<=nTowerMax_ ; t++){ crystals = map->dccTowerConstituents(DccId_[i], t); if(!crystals.size()) continue; scs = map->getEcalScDetId(DccId_[i], t, false); for(unsigned u=0 ; u<scs.size() ; u++){ uint16_t dbStatus = 0; // 0 = good EcalDAQTowerStatus::const_iterator daqStatusIt = daqStatus->find( scs[u].rawId() ); if ( daqStatusIt != daqStatus->end() ) dbStatus = daqStatusIt->getStatusCode(); if ( dbStatus > 0 ) { int jx = scs[u].ix() - 1 + (scs[u].zside()<0 ? 0 : 20); int jy = scs[u].iy() - 1; readyRun[jx][jy] = 0; readyLumi[jx][jy] = 0; } } } } }
void EEDaqInfoTask::beginRun | ( | const edm::Run & | r, |
const edm::EventSetup & | c | ||
) | [protected, virtual] |
BeginRun.
Reimplemented from edm::EDAnalyzer.
Definition at line 160 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 195 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 85 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 150 of file EEDaqInfoTask.cc.
References fillMonitorElements(), edm::EventSetup::get(), patZpeak::handle, python::multivaluedict::map(), edm::ESHandle< T >::product(), and readyLumi.
{ edm::ESHandle< EcalElectronicsMapping > handle; iSetup.get< EcalMappingRcd >().get(handle); const EcalElectronicsMapping *map = handle.product(); if( ! map ) edm::LogWarning("EEDaqInfoTask") << "EcalElectronicsMapping not available"; else this->fillMonitorElements(readyLumi, map); }
void EEDaqInfoTask::endRun | ( | const edm::Run & | r, |
const edm::EventSetup & | c | ||
) | [protected, virtual] |
EndRun.
Reimplemented from edm::EDAnalyzer.
Definition at line 172 of file EEDaqInfoTask.cc.
References fillMonitorElements(), edm::EventSetup::get(), patZpeak::handle, python::multivaluedict::map(), edm::ESHandle< T >::product(), and readyRun.
{ edm::ESHandle< EcalElectronicsMapping > handle; c.get< EcalMappingRcd >().get(handle); const EcalElectronicsMapping *map = handle.product(); if( ! map ) edm::LogWarning("EEDaqInfoTask") << "EcalElectronicsMapping not available"; else this->fillMonitorElements(readyRun, map); }
void EEDaqInfoTask::fillMonitorElements | ( | int | ready[40][20], |
const EcalElectronicsMapping * | map | ||
) | [private] |
Definition at line 215 of file EEDaqInfoTask.cc.
References DccId_, EcalElectronicsMapping::dccTowerConstituents(), MonitorElement::Fill(), EcalElectronicsMapping::getEcalScDetId(), MonitorElement::getNbinsX(), MonitorElement::getNbinsY(), ecalpyutils::ism(), meEEDaqActive_, meEEDaqActiveMap_, meEEDaqFraction_, nTowerMax_, MonitorElement::setBinContent(), and matplotRender::t.
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; if(meEEDaqActiveMap_){ for(int ix=1 ; ix<=meEEDaqActiveMap_->getNbinsX() ; ix++){ for(int iy=1 ; iy<=meEEDaqActiveMap_->getNbinsY() ; iy++){ meEEDaqActiveMap_->setBinContent( ix, iy, -1.0 ); } } } std::vector<DetId> crystals; std::vector<EcalScDetId> scs; for ( unsigned iDcc = 0; iDcc < sizeof(DccId_)/sizeof(int); iDcc++) { for ( int t = 1; t<=nTowerMax_; t++ ) { crystals = map->dccTowerConstituents(DccId_[iDcc], t); if(!crystals.size()) continue; scs = map->getEcalScDetId(DccId_[iDcc], t, false); for(unsigned u=0 ; u<scs.size() ; u++){ // most of the time one DCC tower = one SC int jx = scs[u].ix() - 1 + (scs[u].zside()<0 ? 0 : 20); int jy = scs[u].iy() - 1; if(meEEDaqActiveMap_) meEEDaqActiveMap_->setBinContent( jx+1, jy+1, ready[jx][jy] ); int ncrystals = 0; for(std::vector<DetId>::const_iterator it=crystals.begin() ; it!=crystals.end() ; ++it){ EEDetId id(*it); if( id.zside() == scs[u].zside() && (id.ix()-1)/5+1 == scs[u].ix() && (id.iy()-1)/5+1 == scs[u].iy() ) ncrystals++; } if(ready[jx][jy]) { readySum[iDcc] += ncrystals; readySumTot += ncrystals; } nValidChannels[iDcc] += ncrystals; nValidChannelsTot += ncrystals; } } if( meEEDaqActive_[iDcc] ) meEEDaqActive_[iDcc]->Fill( readySum[iDcc]/float(nValidChannels[iDcc]) ); } if( meEEDaqFraction_ ) meEEDaqFraction_->Fill( readySumTot/float(nValidChannelsTot) ); }
void EEDaqInfoTask::reset | ( | void | ) | [protected] |
Reset.
Definition at line 182 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(); }
const int EEDaqInfoTask::DccId_ [static, protected] |
{1,2,3,4,5,6,7,8,9, 46,47,48,49,50,51,52,53,54}
Definition at line 58 of file EEDaqInfoTask.h.
Referenced by beginLuminosityBlock(), and fillMonitorElements().
DQMStore* EEDaqInfoTask::dqmStore_ [private] |
Definition at line 65 of file EEDaqInfoTask.h.
Referenced by beginJob(), cleanup(), and EEDaqInfoTask().
bool EEDaqInfoTask::enableCleanup_ [private] |
Definition at line 69 of file EEDaqInfoTask.h.
Referenced by EEDaqInfoTask(), and endJob().
MonitorElement* EEDaqInfoTask::meEEDaqActive_[18] [private] |
Definition at line 74 of file EEDaqInfoTask.h.
Referenced by beginJob(), cleanup(), EEDaqInfoTask(), fillMonitorElements(), and reset().
MonitorElement* EEDaqInfoTask::meEEDaqActiveMap_ [private] |
Definition at line 75 of file EEDaqInfoTask.h.
Referenced by beginJob(), cleanup(), EEDaqInfoTask(), fillMonitorElements(), and reset().
MonitorElement* EEDaqInfoTask::meEEDaqFraction_ [private] |
Definition at line 73 of file EEDaqInfoTask.h.
Referenced by beginJob(), cleanup(), EEDaqInfoTask(), fillMonitorElements(), and reset().
bool EEDaqInfoTask::mergeRuns_ [private] |
Definition at line 71 of file EEDaqInfoTask.h.
Referenced by beginRun(), and EEDaqInfoTask().
const int EEDaqInfoTask::nTowerMax_ = 44 [static, protected] |
Definition at line 59 of file EEDaqInfoTask.h.
Referenced by beginLuminosityBlock(), and fillMonitorElements().
std::string EEDaqInfoTask::prefixME_ [private] |
Definition at line 67 of file EEDaqInfoTask.h.
Referenced by beginJob(), cleanup(), and EEDaqInfoTask().
int EEDaqInfoTask::readyLumi[40][20] [private] |
Definition at line 78 of file EEDaqInfoTask.h.
Referenced by beginLuminosityBlock(), and endLuminosityBlock().
int EEDaqInfoTask::readyRun[40][20] [private] |
Definition at line 77 of file EEDaqInfoTask.h.
Referenced by beginLuminosityBlock(), beginRun(), and endRun().