#include <DQM/EcalBarrelMonitorTasks/interface/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 (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 | EBDigiCollection_ |
bool | enableCleanup_ |
int | ievt_ |
bool | init_ |
MonitorElement * | mePedMapG12_ [36] |
bool | mergeRuns_ |
std::string | prefixME_ |
Definition at line 20 of file EBPedestalOnlineTask.h.
EBPedestalOnlineTask::EBPedestalOnlineTask | ( | const edm::ParameterSet & | ps | ) |
Constructor.
Definition at line 33 of file EBPedestalOnlineTask.cc.
References dqmStore_, EBDigiCollection_, 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 EBDigiCollection_ = ps.getParameter<edm::InputTag>("EBDigiCollection"); 00046 00047 for (int i = 0; i < 36; i++) { 00048 mePedMapG12_[i] = 0; 00049 } 00050 00051 }
EBPedestalOnlineTask::~EBPedestalOnlineTask | ( | ) | [virtual] |
void EBPedestalOnlineTask::analyze | ( | const edm::Event & | e, | |
const edm::EventSetup & | c | |||
) | [protected, virtual] |
Analyze.
Implements edm::EDAnalyzer.
Definition at line 137 of file EBPedestalOnlineTask.cc.
References ecalMGPA::adc(), EcalMGPASample::adc(), EBDigiCollection_, 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<EBDigiCollection> digis; 00144 00145 if ( e.getByLabel(EBDigiCollection_, digis) ) { 00146 00147 int nebd = digis->size(); 00148 LogDebug("EBPedestalOnlineTask") << "event " << ievt_ << " digi collection size " << nebd; 00149 00150 for ( EBDigiCollection::const_iterator digiItr = digis->begin(); digiItr != digis->end(); ++digiItr ) { 00151 00152 EBDetId id = digiItr->id(); 00153 00154 int ic = id.ic(); 00155 int ie = (ic-1)/20 + 1; 00156 int ip = (ic-1)%20 + 1; 00157 00158 int ism = Numbers::iSM( id ); 00159 00160 float xie = ie - 0.5; 00161 float xip = ip - 0.5; 00162 00163 LogDebug("EBPedestalOnlineTask") << " det id = " << id; 00164 LogDebug("EBPedestalOnlineTask") << " sm, ieta, iphi " << ism << " " << ie << " " << ip; 00165 00166 EBDataFrame dataframe = (*digiItr); 00167 00168 for (int i = 0; i < 3; i++) { 00169 00170 int adc = dataframe.sample(i).adc(); 00171 00172 MonitorElement* mePedMap = 0; 00173 00174 if ( dataframe.sample(i).gainId() == 1 ) mePedMap = mePedMapG12_[ism-1]; 00175 if ( dataframe.sample(i).gainId() == 2 ) mePedMap = 0; 00176 if ( dataframe.sample(i).gainId() == 3 ) mePedMap = 0; 00177 00178 float xval = float(adc); 00179 00180 if ( mePedMap ) mePedMap->Fill(xie, xip, xval); 00181 00182 } 00183 00184 } 00185 00186 } else { 00187 00188 LogWarning("EBPedestalOnlineTask") << EBDigiCollection_ << " not available"; 00189 00190 } 00191 00192 }
void EBPedestalOnlineTask::beginJob | ( | const edm::EventSetup & | c | ) | [protected, virtual] |
BeginJob.
Reimplemented from edm::EDAnalyzer.
Definition at line 57 of file EBPedestalOnlineTask.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_ + "/EBPedestalOnlineTask"); 00063 dqmStore_->rmdir(prefixME_ + "/EBPedestalOnlineTask"); 00064 } 00065 00066 Numbers::initGeometry(c, false); 00067 00068 }
void EBPedestalOnlineTask::beginRun | ( | const edm::Run & | r, | |
const edm::EventSetup & | c | |||
) | [protected, virtual] |
BeginRun.
Reimplemented from edm::EDAnalyzer.
Definition at line 70 of file EBPedestalOnlineTask.cc.
References mergeRuns_, and reset().
00070 { 00071 00072 if ( ! mergeRuns_ ) this->reset(); 00073 00074 }
Cleanup.
Definition at line 110 of file EBPedestalOnlineTask.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_ + "/EBPedestalOnlineTask"); 00116 00117 dqmStore_->setCurrentFolder(prefixME_ + "/EBPedestalOnlineTask/Gain12"); 00118 for ( int i = 0; i < 36; 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 EBPedestalOnlineTask.cc.
References cleanup(), enableCleanup_, and ievt_.
00129 { 00130 00131 LogInfo("EBPedestalOnlineTask") << "analyzed " << ievt_ << " events"; 00132 00133 if ( enableCleanup_ ) this->cleanup(); 00134 00135 }
void EBPedestalOnlineTask::endRun | ( | const edm::Run & | r, | |
const edm::EventSetup & | c | |||
) | [protected, virtual] |
Reset.
Definition at line 80 of file EBPedestalOnlineTask.cc.
References i, mePedMapG12_, and MonitorElement::Reset().
Referenced by beginRun().
00080 { 00081 00082 for (int i = 0; i < 36; i++) { 00083 if ( mePedMapG12_[i] ) mePedMapG12_[i]->Reset(); 00084 } 00085 00086 }
Setup.
Definition at line 88 of file EBPedestalOnlineTask.cc.
References DQMStore::bookProfile2D(), dqmStore_, histo, i, init_, mePedMapG12_, prefixME_, Numbers::sEB(), 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_ + "/EBPedestalOnlineTask"); 00096 00097 dqmStore_->setCurrentFolder(prefixME_ + "/EBPedestalOnlineTask/Gain12"); 00098 for (int i = 0; i < 36; i++) { 00099 sprintf(histo, "EBPOT pedestal %s G12", Numbers::sEB(i+1).c_str()); 00100 mePedMapG12_[i] = dqmStore_->bookProfile2D(histo, histo, 85, 0., 85., 20, 0., 20., 4096, 0., 4096., "s"); 00101 mePedMapG12_[i]->setAxisTitle("ieta", 1); 00102 mePedMapG12_[i]->setAxisTitle("iphi", 2); 00103 dqmStore_->tag(mePedMapG12_[i], i+1); 00104 } 00105 00106 } 00107 00108 }
DQMStore* EBPedestalOnlineTask::dqmStore_ [private] |
Definition at line 60 of file EBPedestalOnlineTask.h.
Referenced by beginJob(), cleanup(), EBPedestalOnlineTask(), and setup().
Definition at line 68 of file EBPedestalOnlineTask.h.
Referenced by analyze(), and EBPedestalOnlineTask().
bool EBPedestalOnlineTask::enableCleanup_ [private] |
Definition at line 64 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 72 of file EBPedestalOnlineTask.h.
Referenced by analyze(), cleanup(), EBPedestalOnlineTask(), and setup().
MonitorElement* EBPedestalOnlineTask::mePedMapG12_[36] [private] |
Definition at line 70 of file EBPedestalOnlineTask.h.
Referenced by analyze(), cleanup(), EBPedestalOnlineTask(), reset(), and setup().
bool EBPedestalOnlineTask::mergeRuns_ [private] |
Definition at line 66 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().