#include <DQM/EcalEndcapMonitorTasks/interface/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 (const edm::EventSetup &c) |
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_ |
Definition at line 20 of file EEPedestalOnlineTask.h.
EEPedestalOnlineTask::EEPedestalOnlineTask | ( | const edm::ParameterSet & | ps | ) |
Constructor.
Definition at line 33 of file EEPedestalOnlineTask.cc.
References dqmStore_, EEDigiCollection_, enableCleanup_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), i, init_, mePedMapG12_, mergeRuns_, and prefixME_.
00033 { 00034 00035 init_ = false; 00036 00037 dqmStore_ = Service<DQMStore>().operator->(); 00038 00039 prefixME_ = ps.getUntrackedParameter<string>("prefixME", ""); 00040 00041 enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false); 00042 00043 mergeRuns_ = ps.getUntrackedParameter<bool>("mergeRuns", false); 00044 00045 EEDigiCollection_ = ps.getParameter<edm::InputTag>("EEDigiCollection"); 00046 00047 for (int i = 0; i < 18; i++) { 00048 mePedMapG12_[i] = 0; 00049 } 00050 00051 }
EEPedestalOnlineTask::~EEPedestalOnlineTask | ( | ) | [virtual] |
void EEPedestalOnlineTask::analyze | ( | const edm::Event & | e, | |
const edm::EventSetup & | c | |||
) | [protected, virtual] |
Analyze.
Implements edm::EDAnalyzer.
Definition at line 137 of file EEPedestalOnlineTask.cc.
References ecalMGPA::adc(), EcalMGPASample::adc(), EEDigiCollection_, MonitorElement::Fill(), EcalMGPASample::gainId(), edm::Event::getByLabel(), i, ievt_, init_, Numbers::iSM(), LogDebug, mePedMapG12_, EcalDataFrame::sample(), and setup().
00137 { 00138 00139 if ( ! init_ ) this->setup(); 00140 00141 ievt_++; 00142 00143 Handle<EEDigiCollection> digis; 00144 00145 if ( e.getByLabel(EEDigiCollection_, digis) ) { 00146 00147 int need = digis->size(); 00148 LogDebug("EEPedestalOnlineTask") << "event " << ievt_ << " digi collection size " << need; 00149 00150 for ( EEDigiCollection::const_iterator digiItr = digis->begin(); digiItr != digis->end(); ++digiItr ) { 00151 00152 EEDetId id = digiItr->id(); 00153 00154 int ix = id.ix(); 00155 int iy = id.iy(); 00156 00157 int ism = Numbers::iSM( id ); 00158 00159 if ( ism >= 1 && ism <= 9 ) ix = 101 - ix; 00160 00161 float xix = ix - 0.5; 00162 float xiy = iy - 0.5; 00163 00164 LogDebug("EEPedestalOnlineTask") << " det id = " << id; 00165 LogDebug("EEPedestalOnlineTask") << " sm, ix, iy " << ism << " " << ix << " " << iy; 00166 00167 EEDataFrame dataframe = (*digiItr); 00168 00169 for (int i = 0; i < 3; i++) { 00170 00171 int adc = dataframe.sample(i).adc(); 00172 00173 MonitorElement* mePedMap = 0; 00174 00175 if ( dataframe.sample(i).gainId() == 1 ) mePedMap = mePedMapG12_[ism-1]; 00176 if ( dataframe.sample(i).gainId() == 2 ) mePedMap = 0; 00177 if ( dataframe.sample(i).gainId() == 3 ) mePedMap = 0; 00178 00179 float xval = float(adc); 00180 00181 if ( mePedMap ) mePedMap->Fill(xix, xiy, xval); 00182 00183 } 00184 00185 } 00186 00187 } else { 00188 00189 LogWarning("EEPedestalOnlineTask") << EEDigiCollection_ << " not available"; 00190 00191 } 00192 00193 }
void EEPedestalOnlineTask::beginJob | ( | const edm::EventSetup & | c | ) | [protected, virtual] |
BeginJob.
Reimplemented from edm::EDAnalyzer.
Definition at line 57 of file EEPedestalOnlineTask.cc.
References dqmStore_, ievt_, Numbers::initGeometry(), prefixME_, DQMStore::rmdir(), and DQMStore::setCurrentFolder().
00057 { 00058 00059 ievt_ = 0; 00060 00061 if ( dqmStore_ ) { 00062 dqmStore_->setCurrentFolder(prefixME_ + "/EEPedestalOnlineTask"); 00063 dqmStore_->rmdir(prefixME_ + "/EEPedestalOnlineTask"); 00064 } 00065 00066 Numbers::initGeometry(c, false); 00067 00068 }
void EEPedestalOnlineTask::beginRun | ( | const edm::Run & | r, | |
const edm::EventSetup & | c | |||
) | [protected, virtual] |
BeginRun.
Reimplemented from edm::EDAnalyzer.
Definition at line 70 of file EEPedestalOnlineTask.cc.
References mergeRuns_, and reset().
00070 { 00071 00072 if ( ! mergeRuns_ ) this->reset(); 00073 00074 }
Cleanup.
Definition at line 110 of file EEPedestalOnlineTask.cc.
References dqmStore_, edm::getName(), i, init_, mePedMapG12_, prefixME_, DQMStore::removeElement(), and DQMStore::setCurrentFolder().
Referenced by endJob().
00110 { 00111 00112 if ( ! init_ ) return; 00113 00114 if ( dqmStore_ ) { 00115 dqmStore_->setCurrentFolder(prefixME_ + "/EEPedestalOnlineTask"); 00116 00117 dqmStore_->setCurrentFolder(prefixME_ + "/EEPedestalOnlineTask/Gain12"); 00118 for ( int i = 0; i < 18; i++ ) { 00119 if ( mePedMapG12_[i] ) dqmStore_->removeElement( mePedMapG12_[i]->getName() ); 00120 mePedMapG12_[i] = 0; 00121 } 00122 00123 } 00124 00125 init_ = false; 00126 00127 }
EndJob.
Reimplemented from edm::EDAnalyzer.
Definition at line 129 of file EEPedestalOnlineTask.cc.
References cleanup(), enableCleanup_, and ievt_.
00129 { 00130 00131 LogInfo("EEPedestalOnlineTask") << "analyzed " << ievt_ << " events"; 00132 00133 if ( enableCleanup_ ) this->cleanup(); 00134 00135 }
void EEPedestalOnlineTask::endRun | ( | const edm::Run & | r, | |
const edm::EventSetup & | c | |||
) | [protected, virtual] |
Reset.
Definition at line 80 of file EEPedestalOnlineTask.cc.
References i, mePedMapG12_, and MonitorElement::Reset().
Referenced by beginRun().
00080 { 00081 00082 for (int i = 0; i < 18; i++) { 00083 if ( mePedMapG12_[i] ) mePedMapG12_[i]->Reset(); 00084 } 00085 00086 }
Setup.
Definition at line 88 of file EEPedestalOnlineTask.cc.
References DQMStore::bookProfile2D(), dqmStore_, histo, i, init_, Numbers::ix0EE(), Numbers::iy0EE(), mePedMapG12_, prefixME_, Numbers::sEE(), MonitorElement::setAxisTitle(), DQMStore::setCurrentFolder(), and DQMStore::tag().
Referenced by analyze().
00088 { 00089 00090 init_ = true; 00091 00092 char histo[200]; 00093 00094 if ( dqmStore_ ) { 00095 dqmStore_->setCurrentFolder(prefixME_ + "/EEPedestalOnlineTask"); 00096 00097 dqmStore_->setCurrentFolder(prefixME_ + "/EEPedestalOnlineTask/Gain12"); 00098 for (int i = 0; i < 18; i++) { 00099 sprintf(histo, "EEPOT pedestal %s G12", Numbers::sEE(i+1).c_str()); 00100 mePedMapG12_[i] = dqmStore_->bookProfile2D(histo, histo, 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"); 00101 mePedMapG12_[i]->setAxisTitle("jx", 1); 00102 mePedMapG12_[i]->setAxisTitle("jy", 2); 00103 dqmStore_->tag(mePedMapG12_[i], i+1); 00104 } 00105 00106 } 00107 00108 }
DQMStore* EEPedestalOnlineTask::dqmStore_ [private] |
Definition at line 60 of file EEPedestalOnlineTask.h.
Referenced by beginJob(), cleanup(), EEPedestalOnlineTask(), and setup().
Definition at line 68 of file EEPedestalOnlineTask.h.
Referenced by analyze(), and EEPedestalOnlineTask().
bool EEPedestalOnlineTask::enableCleanup_ [private] |
Definition at line 64 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 72 of file EEPedestalOnlineTask.h.
Referenced by analyze(), cleanup(), EEPedestalOnlineTask(), and setup().
MonitorElement* EEPedestalOnlineTask::mePedMapG12_[18] [private] |
Definition at line 70 of file EEPedestalOnlineTask.h.
Referenced by analyze(), cleanup(), EEPedestalOnlineTask(), reset(), and setup().
bool EEPedestalOnlineTask::mergeRuns_ [private] |
Definition at line 66 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().