#include <EBPedestalOnlineTask.h>
Public Member Functions | |
EBPedestalOnlineTask (const edm::ParameterSet &ps) | |
Constructor. | |
virtual | ~EBPedestalOnlineTask () |
Destructor. | |
Protected Member Functions | |
void | analyze (const edm::Event &e, const edm::EventSetup &c) |
Analyze. | |
void | beginJob (void) |
BeginJob. | |
void | beginRun (const edm::Run &r, const edm::EventSetup &c) |
BeginRun. | |
void | cleanup (void) |
Cleanup. | |
void | endJob (void) |
EndJob. | |
void | endRun (const edm::Run &r, const edm::EventSetup &c) |
EndRun. | |
void | reset (void) |
Reset. | |
void | setup (void) |
Setup. | |
Private Attributes | |
DQMStore * | dqmStore_ |
edm::InputTag | EBDigiCollection_ |
bool | enableCleanup_ |
int | ievt_ |
bool | init_ |
MonitorElement * | mePedMapG12_ [36] |
bool | mergeRuns_ |
std::string | prefixME_ |
std::string | subfolder_ |
Definition at line 20 of file EBPedestalOnlineTask.h.
EBPedestalOnlineTask::EBPedestalOnlineTask | ( | const edm::ParameterSet & | ps | ) |
Constructor.
Definition at line 28 of file EBPedestalOnlineTask.cc.
References dqmStore_, EBDigiCollection_, enableCleanup_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), i, init_, mePedMapG12_, mergeRuns_, cmsCodeRules::cppFunctionSkipper::operator, prefixME_, and subfolder_.
{ init_ = false; dqmStore_ = edm::Service<DQMStore>().operator->(); prefixME_ = ps.getUntrackedParameter<std::string>("prefixME", ""); subfolder_ = ps.getUntrackedParameter<std::string>("subfolder", ""); enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false); mergeRuns_ = ps.getUntrackedParameter<bool>("mergeRuns", false); EBDigiCollection_ = ps.getParameter<edm::InputTag>("EBDigiCollection"); for (int i = 0; i < 36; i++) { mePedMapG12_[i] = 0; } }
EBPedestalOnlineTask::~EBPedestalOnlineTask | ( | ) | [virtual] |
void EBPedestalOnlineTask::analyze | ( | const edm::Event & | e, |
const edm::EventSetup & | c | ||
) | [protected, virtual] |
Analyze.
Implements edm::EDAnalyzer.
Definition at line 143 of file EBPedestalOnlineTask.cc.
References ecalMGPA::adc(), EcalMGPASample::adc(), EBDigiCollection_, MonitorElement::Fill(), EcalMGPASample::gainId(), edm::Event::getByLabel(), i, EBDetId::ic(), ievt_, init_, Numbers::iSM(), ecalpyutils::ism(), LogDebug, mePedMapG12_, EcalDataFrame::sample(), and setup().
{ if ( ! init_ ) this->setup(); ievt_++; edm::Handle<EBDigiCollection> digis; if ( e.getByLabel(EBDigiCollection_, digis) ) { int nebd = digis->size(); LogDebug("EBPedestalOnlineTask") << "event " << ievt_ << " digi collection size " << nebd; for ( EBDigiCollection::const_iterator digiItr = digis->begin(); digiItr != digis->end(); ++digiItr ) { EBDetId id = digiItr->id(); int ic = id.ic(); int ie = (ic-1)/20 + 1; int ip = (ic-1)%20 + 1; int ism = Numbers::iSM( id ); float xie = ie - 0.5; float xip = ip - 0.5; EBDataFrame dataframe = (*digiItr); int iMax(-1); int maxADC(0); for(int i(0); i < 10; i++){ if(dataframe.sample(i).gainId() != 1) break; int adc(dataframe.sample(i).adc()); if(adc > maxADC){ maxADC = adc; iMax = i; } } if(iMax != 5) continue; for (int i = 0; i < 3; i++) { int adc = dataframe.sample(i).adc(); MonitorElement* mePedMap = 0; if ( dataframe.sample(i).gainId() == 1 ) mePedMap = mePedMapG12_[ism-1]; if ( dataframe.sample(i).gainId() == 2 ) mePedMap = 0; if ( dataframe.sample(i).gainId() == 3 ) mePedMap = 0; float xval = float(adc); if ( mePedMap ) mePedMap->Fill(xie, xip, xval); } } } else { edm::LogWarning("EBPedestalOnlineTask") << EBDigiCollection_ << " not available"; } }
void EBPedestalOnlineTask::beginJob | ( | void | ) | [protected, virtual] |
BeginJob.
Reimplemented from edm::EDAnalyzer.
Definition at line 54 of file EBPedestalOnlineTask.cc.
References dqmStore_, ievt_, prefixME_, DQMStore::rmdir(), and DQMStore::setCurrentFolder().
void EBPedestalOnlineTask::beginRun | ( | const edm::Run & | r, |
const edm::EventSetup & | c | ||
) | [protected, virtual] |
BeginRun.
Reimplemented from edm::EDAnalyzer.
Definition at line 65 of file EBPedestalOnlineTask.cc.
References Numbers::initGeometry(), mergeRuns_, and reset().
{ Numbers::initGeometry(c, false); if ( ! mergeRuns_ ) this->reset(); }
void EBPedestalOnlineTask::cleanup | ( | void | ) | [protected] |
Cleanup.
Definition at line 112 of file EBPedestalOnlineTask.cc.
References dir, dqmStore_, edm::getName(), i, init_, mePedMapG12_, prefixME_, DQMStore::removeElement(), DQMStore::setCurrentFolder(), and subfolder_.
Referenced by endJob().
{ if ( ! init_ ) return; if ( dqmStore_ ) { std::string dir = prefixME_ + "/EBPedestalOnlineTask"; if(subfolder_.size()) dir += "/" + subfolder_; dqmStore_->setCurrentFolder(dir); dqmStore_->setCurrentFolder(dir + "/Gain12"); for ( int i = 0; i < 36; i++ ) { if ( mePedMapG12_[i] ) dqmStore_->removeElement( mePedMapG12_[i]->getName() ); mePedMapG12_[i] = 0; } } init_ = false; }
void EBPedestalOnlineTask::endJob | ( | void | ) | [protected, virtual] |
EndJob.
Reimplemented from edm::EDAnalyzer.
Definition at line 135 of file EBPedestalOnlineTask.cc.
References cleanup(), enableCleanup_, and ievt_.
{ edm::LogInfo("EBPedestalOnlineTask") << "analyzed " << ievt_ << " events"; if ( enableCleanup_ ) this->cleanup(); }
void EBPedestalOnlineTask::endRun | ( | const edm::Run & | r, |
const edm::EventSetup & | c | ||
) | [protected, virtual] |
EndRun.
Reimplemented from edm::EDAnalyzer.
Definition at line 73 of file EBPedestalOnlineTask.cc.
{ }
void EBPedestalOnlineTask::reset | ( | void | ) | [protected] |
Reset.
Definition at line 77 of file EBPedestalOnlineTask.cc.
References i, mePedMapG12_, and MonitorElement::Reset().
Referenced by beginRun().
{ for (int i = 0; i < 36; i++) { if ( mePedMapG12_[i] ) mePedMapG12_[i]->Reset(); } }
void EBPedestalOnlineTask::setup | ( | void | ) | [protected] |
Setup.
Definition at line 85 of file EBPedestalOnlineTask.cc.
References DQMStore::bookProfile2D(), dir, dqmStore_, i, init_, mePedMapG12_, mergeVDriftHistosByStation::name, prefixME_, Numbers::sEB(), MonitorElement::setAxisTitle(), DQMStore::setCurrentFolder(), subfolder_, and DQMStore::tag().
Referenced by analyze().
{ init_ = true; std::string name; std::string dir; if ( dqmStore_ ) { dir = prefixME_ + "/EBPedestalOnlineTask"; if(subfolder_.size()) dir += "/" + subfolder_; dqmStore_->setCurrentFolder(dir); dqmStore_->setCurrentFolder(dir + "/Gain12"); for (int i = 0; i < 36; i++) { name = "EBPOT pedestal " + Numbers::sEB(i+1) + " G12"; mePedMapG12_[i] = dqmStore_->bookProfile2D(name, name, 85, 0., 85., 20, 0., 20., 4096, 0., 4096., "s"); mePedMapG12_[i]->setAxisTitle("ieta", 1); mePedMapG12_[i]->setAxisTitle("iphi", 2); dqmStore_->tag(mePedMapG12_[i], i+1); } } }
DQMStore* EBPedestalOnlineTask::dqmStore_ [private] |
Definition at line 60 of file EBPedestalOnlineTask.h.
Referenced by beginJob(), cleanup(), EBPedestalOnlineTask(), and setup().
Definition at line 70 of file EBPedestalOnlineTask.h.
Referenced by analyze(), and EBPedestalOnlineTask().
bool EBPedestalOnlineTask::enableCleanup_ [private] |
Definition at line 66 of file EBPedestalOnlineTask.h.
Referenced by EBPedestalOnlineTask(), and endJob().
int EBPedestalOnlineTask::ievt_ [private] |
Definition at line 58 of file EBPedestalOnlineTask.h.
Referenced by analyze(), beginJob(), and endJob().
bool EBPedestalOnlineTask::init_ [private] |
Definition at line 74 of file EBPedestalOnlineTask.h.
Referenced by analyze(), cleanup(), EBPedestalOnlineTask(), and setup().
MonitorElement* EBPedestalOnlineTask::mePedMapG12_[36] [private] |
Definition at line 72 of file EBPedestalOnlineTask.h.
Referenced by analyze(), cleanup(), EBPedestalOnlineTask(), reset(), and setup().
bool EBPedestalOnlineTask::mergeRuns_ [private] |
Definition at line 68 of file EBPedestalOnlineTask.h.
Referenced by beginRun(), and EBPedestalOnlineTask().
std::string EBPedestalOnlineTask::prefixME_ [private] |
Definition at line 62 of file EBPedestalOnlineTask.h.
Referenced by beginJob(), cleanup(), EBPedestalOnlineTask(), and setup().
std::string EBPedestalOnlineTask::subfolder_ [private] |
Definition at line 64 of file EBPedestalOnlineTask.h.
Referenced by cleanup(), EBPedestalOnlineTask(), and setup().