#include <EEPedestalOnlineTask.h>
Public Member Functions | |
EEPedestalOnlineTask (const edm::ParameterSet &ps) | |
Constructor. | |
virtual | ~EEPedestalOnlineTask () |
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 | EEDigiCollection_ |
bool | enableCleanup_ |
int | ievt_ |
bool | init_ |
MonitorElement * | mePedMapG12_ [18] |
bool | mergeRuns_ |
std::string | prefixME_ |
std::string | subfolder_ |
Definition at line 20 of file EEPedestalOnlineTask.h.
EEPedestalOnlineTask::EEPedestalOnlineTask | ( | const edm::ParameterSet & | ps | ) |
Constructor.
Definition at line 28 of file EEPedestalOnlineTask.cc.
References dqmStore_, EEDigiCollection_, enableCleanup_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), i, init_, mePedMapG12_, mergeRuns_, 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); EEDigiCollection_ = ps.getParameter<edm::InputTag>("EEDigiCollection"); for (int i = 0; i < 18; i++) { mePedMapG12_[i] = 0; } }
EEPedestalOnlineTask::~EEPedestalOnlineTask | ( | ) | [virtual] |
void EEPedestalOnlineTask::analyze | ( | const edm::Event & | e, |
const edm::EventSetup & | c | ||
) | [protected, virtual] |
Analyze.
Implements edm::EDAnalyzer.
Definition at line 144 of file EEPedestalOnlineTask.cc.
References ecalMGPA::adc(), EcalMGPASample::adc(), EEDigiCollection_, MonitorElement::Fill(), EcalMGPASample::gainId(), edm::Event::getByLabel(), i, ievt_, init_, Numbers::iSM(), ecalpyutils::ism(), EEDetId::ix(), LogDebug, mePedMapG12_, EcalDataFrame::sample(), and setup().
{ if ( ! init_ ) this->setup(); ievt_++; edm::Handle<EEDigiCollection> digis; if ( e.getByLabel(EEDigiCollection_, digis) ) { int need = digis->size(); LogDebug("EEPedestalOnlineTask") << "event " << ievt_ << " digi collection size " << need; for ( EEDigiCollection::const_iterator digiItr = digis->begin(); digiItr != digis->end(); ++digiItr ) { EEDetId id = digiItr->id(); int ix = id.ix(); int iy = id.iy(); int ism = Numbers::iSM( id ); if ( ism >= 1 && ism <= 9 ) ix = 101 - ix; float xix = ix - 0.5; float xiy = iy - 0.5; EEDataFrame 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(xix, xiy, xval); } } } else { edm::LogWarning("EEPedestalOnlineTask") << EEDigiCollection_ << " not available"; } }
void EEPedestalOnlineTask::beginJob | ( | void | ) | [protected, virtual] |
BeginJob.
Reimplemented from edm::EDAnalyzer.
Definition at line 54 of file EEPedestalOnlineTask.cc.
References dqmStore_, ievt_, prefixME_, DQMStore::rmdir(), and DQMStore::setCurrentFolder().
void EEPedestalOnlineTask::beginRun | ( | const edm::Run & | r, |
const edm::EventSetup & | c | ||
) | [protected, virtual] |
BeginRun.
Reimplemented from edm::EDAnalyzer.
Definition at line 65 of file EEPedestalOnlineTask.cc.
References Numbers::initGeometry(), mergeRuns_, and reset().
{ Numbers::initGeometry(c, false); if ( ! mergeRuns_ ) this->reset(); }
void EEPedestalOnlineTask::cleanup | ( | void | ) | [protected] |
Cleanup.
Definition at line 113 of file EEPedestalOnlineTask.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_ + "/EEPedestalOnlineTask"; if(subfolder_.size()) dir += "/" + subfolder_; dqmStore_->setCurrentFolder(dir); dqmStore_->setCurrentFolder(dir + "/Gain12"); for ( int i = 0; i < 18; i++ ) { if ( mePedMapG12_[i] ) dqmStore_->removeElement( mePedMapG12_[i]->getName() ); mePedMapG12_[i] = 0; } } init_ = false; }
void EEPedestalOnlineTask::endJob | ( | void | ) | [protected, virtual] |
EndJob.
Reimplemented from edm::EDAnalyzer.
Definition at line 136 of file EEPedestalOnlineTask.cc.
References cleanup(), enableCleanup_, and ievt_.
{ edm::LogInfo("EEPedestalOnlineTask") << "analyzed " << ievt_ << " events"; if ( enableCleanup_ ) this->cleanup(); }
void EEPedestalOnlineTask::endRun | ( | const edm::Run & | r, |
const edm::EventSetup & | c | ||
) | [protected, virtual] |
EndRun.
Reimplemented from edm::EDAnalyzer.
Definition at line 73 of file EEPedestalOnlineTask.cc.
{ }
void EEPedestalOnlineTask::reset | ( | void | ) | [protected] |
Reset.
Definition at line 77 of file EEPedestalOnlineTask.cc.
References i, mePedMapG12_, and MonitorElement::Reset().
Referenced by beginRun().
{ for (int i = 0; i < 18; i++) { if ( mePedMapG12_[i] ) mePedMapG12_[i]->Reset(); } }
void EEPedestalOnlineTask::setup | ( | void | ) | [protected] |
Setup.
Definition at line 85 of file EEPedestalOnlineTask.cc.
References DQMStore::bookProfile2D(), dir, dqmStore_, i, init_, Numbers::ix0EE(), Numbers::iy0EE(), mePedMapG12_, mergeVDriftHistosByStation::name, prefixME_, Numbers::sEE(), MonitorElement::setAxisTitle(), DQMStore::setCurrentFolder(), subfolder_, and DQMStore::tag().
Referenced by analyze().
{ init_ = true; std::string name; std::string dir; if ( dqmStore_ ) { dir = prefixME_ + "/EEPedestalOnlineTask"; if(subfolder_.size()) dir += "/" + subfolder_; dqmStore_->setCurrentFolder(dir); dqmStore_->setCurrentFolder(dir + "/Gain12"); for (int i = 0; i < 18; i++) { name = "EEPOT pedestal " + Numbers::sEE(i+1) + " G12"; mePedMapG12_[i] = dqmStore_->bookProfile2D(name, name, 50, Numbers::ix0EE(i+1)+0., Numbers::ix0EE(i+1)+50., 50, Numbers::iy0EE(i+1)+0., Numbers::iy0EE(i+1)+50., 4096, 0., 4096., "s"); mePedMapG12_[i]->setAxisTitle("ix", 1); if ( i+1 >= 1 && i+1 <= 9 ) mePedMapG12_[i]->setAxisTitle("101-ix", 1); mePedMapG12_[i]->setAxisTitle("iy", 2); dqmStore_->tag(mePedMapG12_[i], i+1); } } }
DQMStore* EEPedestalOnlineTask::dqmStore_ [private] |
Definition at line 60 of file EEPedestalOnlineTask.h.
Referenced by beginJob(), cleanup(), EEPedestalOnlineTask(), and setup().
Definition at line 70 of file EEPedestalOnlineTask.h.
Referenced by analyze(), and EEPedestalOnlineTask().
bool EEPedestalOnlineTask::enableCleanup_ [private] |
Definition at line 66 of file EEPedestalOnlineTask.h.
Referenced by EEPedestalOnlineTask(), and endJob().
int EEPedestalOnlineTask::ievt_ [private] |
Definition at line 58 of file EEPedestalOnlineTask.h.
Referenced by analyze(), beginJob(), and endJob().
bool EEPedestalOnlineTask::init_ [private] |
Definition at line 74 of file EEPedestalOnlineTask.h.
Referenced by analyze(), cleanup(), EEPedestalOnlineTask(), and setup().
MonitorElement* EEPedestalOnlineTask::mePedMapG12_[18] [private] |
Definition at line 72 of file EEPedestalOnlineTask.h.
Referenced by analyze(), cleanup(), EEPedestalOnlineTask(), reset(), and setup().
bool EEPedestalOnlineTask::mergeRuns_ [private] |
Definition at line 68 of file EEPedestalOnlineTask.h.
Referenced by beginRun(), and EEPedestalOnlineTask().
std::string EEPedestalOnlineTask::prefixME_ [private] |
Definition at line 62 of file EEPedestalOnlineTask.h.
Referenced by beginJob(), cleanup(), EEPedestalOnlineTask(), and setup().
std::string EEPedestalOnlineTask::subfolder_ [private] |
Definition at line 64 of file EEPedestalOnlineTask.h.
Referenced by cleanup(), EEPedestalOnlineTask(), and setup().