#include <EEDcsInfoTask.h>
Public Member Functions | |
EEDcsInfoTask (const edm::ParameterSet &ps) | |
Constructor. | |
virtual | ~EEDcsInfoTask () |
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 * | meEEDcsActive_ [18] |
MonitorElement * | meEEDcsActiveMap_ |
MonitorElement * | meEEDcsFraction_ |
bool | mergeRuns_ |
std::string | prefixME_ |
int | readyLumi [40][20] |
int | readyRun [40][20] |
Definition at line 19 of file EEDcsInfoTask.h.
EEDcsInfoTask::EEDcsInfoTask | ( | const edm::ParameterSet & | ps | ) |
Constructor.
Definition at line 31 of file EEDcsInfoTask.cc.
References dqmStore_, enableCleanup_, edm::ParameterSet::getUntrackedParameter(), i, meEEDcsActive_, meEEDcsActiveMap_, meEEDcsFraction_, 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); meEEDcsFraction_ = 0; meEEDcsActiveMap_ = 0; for (int i = 0; i < 18; i++) { meEEDcsActive_[i] = 0; } }
EEDcsInfoTask::~EEDcsInfoTask | ( | ) | [virtual] |
void EEDcsInfoTask::analyze | ( | const edm::Event & | e, |
const edm::EventSetup & | c | ||
) | [protected, virtual] |
void EEDcsInfoTask::beginJob | ( | void | ) | [protected, virtual] |
BeginJob.
Reimplemented from edm::EDAnalyzer.
Definition at line 53 of file EEDcsInfoTask.cc.
References DQMStore::book2D(), DQMStore::bookFloat(), dqmStore_, MonitorElement::Fill(), trackerHits::histo, i, meEEDcsActive_, meEEDcsActiveMap_, meEEDcsFraction_, prefixME_, Numbers::sEE(), MonitorElement::setAxisTitle(), and DQMStore::setCurrentFolder().
{ char histo[200]; if ( dqmStore_ ) { dqmStore_->setCurrentFolder(prefixME_ + "/EventInfo"); sprintf(histo, "DCSSummary"); meEEDcsFraction_ = dqmStore_->bookFloat(histo); meEEDcsFraction_->Fill(0.0); sprintf(histo, "DCSSummaryMap"); meEEDcsActiveMap_ = dqmStore_->book2D(histo,histo, 40, 0., 200., 20, 0., 100.); meEEDcsActiveMap_->setAxisTitle("ix / ix+100", 1); meEEDcsActiveMap_->setAxisTitle("iy", 2); dqmStore_->setCurrentFolder(prefixME_ + "/EventInfo/DCSContents"); for (int i = 0; i < 18; i++) { sprintf(histo, "EcalEndcap_%s", Numbers::sEE(i+1).c_str()); meEEDcsActive_[i] = dqmStore_->bookFloat(histo); meEEDcsActive_[i]->Fill(-1.0); } } }
void EEDcsInfoTask::beginLuminosityBlock | ( | const edm::LuminosityBlock & | lumiBlock, |
const edm::EventSetup & | iSetup | ||
) | [protected, virtual] |
BeginLuminosityBlock.
Reimplemented from edm::EDAnalyzer.
Definition at line 88 of file EEDcsInfoTask.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<EcalDCSTowerStatusRcd>() ) ) { edm::LogWarning("EEDcsInfoTask") << "EcalDCSTowerStatus record not found"; return; } edm::ESHandle<EcalDCSTowerStatus> pDCSStatus; iSetup.get<EcalDCSTowerStatusRcd>().get(pDCSStatus); if ( !pDCSStatus.isValid() ) { edm::LogWarning("EEDcsInfoTask") << "EcalDCSTowerStatus record not valid"; return; } const EcalDCSTowerStatus* dcsStatus = pDCSStatus.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 EcalDCSTowerStatus::const_iterator dcsStatusIt = dcsStatus->find( scs[u].rawId() ); if ( dcsStatusIt != dcsStatus->end() ) dbStatus = dcsStatusIt->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; } } } } // 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 // EcalDCSTowerStatus::const_iterator dcsStatusIt = dcsStatus->find( eeid.rawId() ); // if ( dcsStatusIt != dcsStatus->end() ) dbStatus = dcsStatusIt->getStatusCode(); // if ( dbStatus > 0 ) { // int offsetSC = (iz > 0) ? 0 : 20; // readyRun[offsetSC+itx][ity] = 0; // readyLumi[offsetSC+itx][ity] = 0; // } // } // } // } // } }
void EEDcsInfoTask::beginRun | ( | const edm::Run & | r, |
const edm::EventSetup & | c | ||
) | [protected, virtual] |
BeginRun.
Reimplemented from edm::EDAnalyzer.
Definition at line 179 of file EEDcsInfoTask.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 EEDcsInfoTask::cleanup | ( | void | ) | [protected] |
Cleanup.
Definition at line 214 of file EEDcsInfoTask.cc.
References dqmStore_, edm::getName(), MonitorElement::getName(), i, meEEDcsActive_, meEEDcsActiveMap_, meEEDcsFraction_, prefixME_, DQMStore::removeElement(), and DQMStore::setCurrentFolder().
Referenced by endJob().
{ if ( dqmStore_ ) { dqmStore_->setCurrentFolder(prefixME_ + "/EventInfo"); if ( meEEDcsFraction_ ) dqmStore_->removeElement( meEEDcsFraction_->getName() ); if ( meEEDcsActiveMap_ ) dqmStore_->removeElement( meEEDcsActiveMap_->getName() ); dqmStore_->setCurrentFolder(prefixME_ + "/EventInfo/DCSContents"); for (int i = 0; i < 18; i++) { if ( meEEDcsActive_[i] ) dqmStore_->removeElement( meEEDcsActive_[i]->getName() ); } } }
void EEDcsInfoTask::endJob | ( | void | ) | [protected, virtual] |
EndJob.
Reimplemented from edm::EDAnalyzer.
Definition at line 82 of file EEDcsInfoTask.cc.
References cleanup(), and enableCleanup_.
{ if ( enableCleanup_ ) this->cleanup(); }
void EEDcsInfoTask::endLuminosityBlock | ( | const edm::LuminosityBlock & | lumiBlock, |
const edm::EventSetup & | iSetup | ||
) | [protected, virtual] |
EndLuminosityBlock.
Reimplemented from edm::EDAnalyzer.
Definition at line 169 of file EEDcsInfoTask.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 EEDcsInfoTask::endRun | ( | const edm::Run & | r, |
const edm::EventSetup & | c | ||
) | [protected, virtual] |
EndRun.
Reimplemented from edm::EDAnalyzer.
Definition at line 191 of file EEDcsInfoTask.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 EEDcsInfoTask::fillMonitorElements | ( | int | ready[40][20], |
const EcalElectronicsMapping * | map | ||
) | [private] |
Definition at line 234 of file EEDcsInfoTask.cc.
References DccId_, EcalElectronicsMapping::dccTowerConstituents(), MonitorElement::Fill(), EcalElectronicsMapping::getEcalScDetId(), MonitorElement::getNbinsX(), MonitorElement::getNbinsY(), ecalpyutils::ism(), meEEDcsActive_, meEEDcsActiveMap_, meEEDcsFraction_, 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(meEEDcsActiveMap_){ for(int ix=1 ; ix<=meEEDcsActiveMap_->getNbinsX() ; ix++){ for(int iy=1 ; iy<=meEEDcsActiveMap_->getNbinsY() ; iy++){ meEEDcsActiveMap_->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(meEEDcsActiveMap_) meEEDcsActiveMap_->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( meEEDcsActive_[iDcc] ) meEEDcsActive_[iDcc]->Fill( readySum[iDcc]/float(nValidChannels[iDcc]) ); } if( meEEDcsFraction_ ) meEEDcsFraction_->Fill( readySumTot/float(nValidChannelsTot) ); }
void EEDcsInfoTask::reset | ( | void | ) | [protected] |
Reset.
Definition at line 201 of file EEDcsInfoTask.cc.
References i, meEEDcsActive_, meEEDcsActiveMap_, meEEDcsFraction_, and MonitorElement::Reset().
Referenced by beginRun().
{ if ( meEEDcsFraction_ ) meEEDcsFraction_->Reset(); for (int i = 0; i < 18; i++) { if ( meEEDcsActive_[i] ) meEEDcsActive_[i]->Reset(); } if ( meEEDcsActiveMap_ ) meEEDcsActiveMap_->Reset(); }
const int EEDcsInfoTask::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 EEDcsInfoTask.h.
Referenced by beginLuminosityBlock(), and fillMonitorElements().
DQMStore* EEDcsInfoTask::dqmStore_ [private] |
Definition at line 65 of file EEDcsInfoTask.h.
Referenced by beginJob(), cleanup(), and EEDcsInfoTask().
bool EEDcsInfoTask::enableCleanup_ [private] |
Definition at line 69 of file EEDcsInfoTask.h.
Referenced by EEDcsInfoTask(), and endJob().
MonitorElement* EEDcsInfoTask::meEEDcsActive_[18] [private] |
Definition at line 74 of file EEDcsInfoTask.h.
Referenced by beginJob(), cleanup(), EEDcsInfoTask(), fillMonitorElements(), and reset().
MonitorElement* EEDcsInfoTask::meEEDcsActiveMap_ [private] |
Definition at line 75 of file EEDcsInfoTask.h.
Referenced by beginJob(), cleanup(), EEDcsInfoTask(), fillMonitorElements(), and reset().
MonitorElement* EEDcsInfoTask::meEEDcsFraction_ [private] |
Definition at line 73 of file EEDcsInfoTask.h.
Referenced by beginJob(), cleanup(), EEDcsInfoTask(), fillMonitorElements(), and reset().
bool EEDcsInfoTask::mergeRuns_ [private] |
Definition at line 71 of file EEDcsInfoTask.h.
Referenced by beginRun(), and EEDcsInfoTask().
const int EEDcsInfoTask::nTowerMax_ = 44 [static, protected] |
Definition at line 59 of file EEDcsInfoTask.h.
Referenced by beginLuminosityBlock(), and fillMonitorElements().
std::string EEDcsInfoTask::prefixME_ [private] |
Definition at line 67 of file EEDcsInfoTask.h.
Referenced by beginJob(), cleanup(), and EEDcsInfoTask().
int EEDcsInfoTask::readyLumi[40][20] [private] |
Definition at line 78 of file EEDcsInfoTask.h.
Referenced by beginLuminosityBlock(), and endLuminosityBlock().
int EEDcsInfoTask::readyRun[40][20] [private] |
Definition at line 77 of file EEDcsInfoTask.h.
Referenced by beginLuminosityBlock(), beginRun(), and endRun().