CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions | Private Attributes
EBPedestalOnlineTask Class Reference

#include <EBPedestalOnlineTask.h>

Inheritance diagram for EBPedestalOnlineTask:
edm::EDAnalyzer

Public Member Functions

 EBPedestalOnlineTask (const edm::ParameterSet &ps)
 Constructor. More...
 
virtual ~EBPedestalOnlineTask ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c)
 Analyze. More...
 
void beginJob (void)
 BeginJob. More...
 
void beginRun (const edm::Run &r, const edm::EventSetup &c)
 BeginRun. More...
 
void cleanup (void)
 Cleanup. More...
 
void endJob (void)
 EndJob. More...
 
void endRun (const edm::Run &r, const edm::EventSetup &c)
 EndRun. More...
 
void reset (void)
 Reset. More...
 
void setup (void)
 Setup. More...
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Private Attributes

DQMStoredqmStore_
 
edm::InputTag EBDigiCollection_
 
bool enableCleanup_
 
int ievt_
 
bool init_
 
MonitorElementmePedMapG12_ [36]
 
bool mergeRuns_
 
std::string prefixME_
 
std::string subfolder_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 

Detailed Description

Definition at line 20 of file EBPedestalOnlineTask.h.

Constructor & Destructor Documentation

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_, cppFunctionSkipper::operator, prefixME_, and subfolder_.

28  {
29 
30  init_ = false;
31 
33 
34  prefixME_ = ps.getUntrackedParameter<std::string>("prefixME", "");
35 
36  subfolder_ = ps.getUntrackedParameter<std::string>("subfolder", "");
37 
38  enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
39 
40  mergeRuns_ = ps.getUntrackedParameter<bool>("mergeRuns", false);
41 
42  EBDigiCollection_ = ps.getParameter<edm::InputTag>("EBDigiCollection");
43 
44  for (int i = 0; i < 36; i++) {
45  mePedMapG12_[i] = 0;
46  }
47 
48 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
edm::InputTag EBDigiCollection_
MonitorElement * mePedMapG12_[36]
EBPedestalOnlineTask::~EBPedestalOnlineTask ( )
virtual

Destructor.

Definition at line 50 of file EBPedestalOnlineTask.cc.

50  {
51 
52 }

Member Function Documentation

void EBPedestalOnlineTask::analyze ( const edm::Event e,
const edm::EventSetup c 
)
protectedvirtual

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_, ecalpyutils::ism(), Numbers::iSM(), LogDebug, mePedMapG12_, EcalDataFrame::sample(), and setup().

143  {
144 
145  if ( ! init_ ) this->setup();
146 
147  ievt_++;
148 
150 
151  if ( e.getByLabel(EBDigiCollection_, digis) ) {
152 
153  int nebd = digis->size();
154  LogDebug("EBPedestalOnlineTask") << "event " << ievt_ << " digi collection size " << nebd;
155 
156  for ( EBDigiCollection::const_iterator digiItr = digis->begin(); digiItr != digis->end(); ++digiItr ) {
157 
158  EBDetId id = digiItr->id();
159 
160  int ic = id.ic();
161  int ie = (ic-1)/20 + 1;
162  int ip = (ic-1)%20 + 1;
163 
164  int ism = Numbers::iSM( id );
165 
166  float xie = ie - 0.5;
167  float xip = ip - 0.5;
168 
169  EBDataFrame dataframe = (*digiItr);
170 
171  int iMax(-1);
172  int maxADC(0);
173  for(int i(0); i < 10; i++){
174  if(dataframe.sample(i).gainId() != 1) break;
175  int adc(dataframe.sample(i).adc());
176  if(adc > maxADC){
177  maxADC = adc;
178  iMax = i;
179  }
180  }
181 
182  if(iMax != 5) continue;
183 
184  for (int i = 0; i < 3; i++) {
185 
186  int adc = dataframe.sample(i).adc();
187 
188  MonitorElement* mePedMap = 0;
189 
190  if ( dataframe.sample(i).gainId() == 1 ) mePedMap = mePedMapG12_[ism-1];
191  if ( dataframe.sample(i).gainId() == 2 ) mePedMap = 0;
192  if ( dataframe.sample(i).gainId() == 3 ) mePedMap = 0;
193 
194  float xval = float(adc);
195 
196  if ( mePedMap ) mePedMap->Fill(xie, xip, xval);
197 
198  }
199 
200  }
201 
202  } else {
203 
204  edm::LogWarning("EBPedestalOnlineTask") << EBDigiCollection_ << " not available";
205 
206  }
207 
208 }
int adc(sample_type sample)
get the ADC sample (12 bits)
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
EcalMGPASample sample(int i) const
Definition: EcalDataFrame.h:30
int gainId() const
get the gainId (2 bits)
void Fill(long long x)
edm::InputTag EBDigiCollection_
MonitorElement * mePedMapG12_[36]
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
int ic() const
get ECAL/crystal number inside SM
Definition: EBDetId.cc:94
static unsigned iSM(const unsigned ism, const EcalSubdetector subdet)
Definition: Numbers.cc:246
int ism(int ieta, int iphi)
Definition: EcalPyUtils.cc:56
int adc() const
get the ADC sample (12 bits)
void EBPedestalOnlineTask::beginJob ( void  )
protectedvirtual

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 54 of file EBPedestalOnlineTask.cc.

References dqmStore_, ievt_, prefixME_, DQMStore::rmdir(), and DQMStore::setCurrentFolder().

54  {
55 
56  ievt_ = 0;
57 
58  if ( dqmStore_ ) {
59  dqmStore_->setCurrentFolder(prefixME_ + "/EBPedestalOnlineTask");
60  dqmStore_->rmdir(prefixME_ + "/EBPedestalOnlineTask");
61  }
62 
63 }
void rmdir(const std::string &fullpath)
Definition: DQMStore.cc:2530
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
void EBPedestalOnlineTask::beginRun ( const edm::Run r,
const edm::EventSetup c 
)
protectedvirtual

BeginRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 65 of file EBPedestalOnlineTask.cc.

References Numbers::initGeometry(), mergeRuns_, and reset().

65  {
66 
67  Numbers::initGeometry(c, false);
68 
69  if ( ! mergeRuns_ ) this->reset();
70 
71 }
static void initGeometry(const edm::EventSetup &setup, bool verbose=false)
Definition: Numbers.cc:50
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().

112  {
113 
114  if ( ! init_ ) return;
115 
116  if ( dqmStore_ ) {
117  std::string dir = prefixME_ + "/EBPedestalOnlineTask";
118  if(subfolder_.size())
119  dir += "/" + subfolder_;
120 
122 
123  dqmStore_->setCurrentFolder(dir + "/Gain12");
124  for ( int i = 0; i < 36; i++ ) {
126  mePedMapG12_[i] = 0;
127  }
128 
129  }
130 
131  init_ = false;
132 
133 }
int i
Definition: DBlmapReader.cc:9
void removeElement(const std::string &name)
Definition: DQMStore.cc:2572
MonitorElement * mePedMapG12_[36]
std::string getName(Reflex::Type &cc)
Definition: ClassFiller.cc:18
dbl *** dir
Definition: mlp_gen.cc:35
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
void EBPedestalOnlineTask::endJob ( void  )
protectedvirtual

EndJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 135 of file EBPedestalOnlineTask.cc.

References cleanup(), enableCleanup_, and ievt_.

135  {
136 
137  edm::LogInfo("EBPedestalOnlineTask") << "analyzed " << ievt_ << " events";
138 
139  if ( enableCleanup_ ) this->cleanup();
140 
141 }
void cleanup(void)
Cleanup.
void EBPedestalOnlineTask::endRun ( const edm::Run r,
const edm::EventSetup c 
)
protectedvirtual

EndRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 73 of file EBPedestalOnlineTask.cc.

73  {
74 
75 }
void EBPedestalOnlineTask::reset ( void  )
protected

Reset.

Definition at line 77 of file EBPedestalOnlineTask.cc.

References i, mePedMapG12_, and MonitorElement::Reset().

Referenced by beginRun().

77  {
78 
79  for (int i = 0; i < 36; i++) {
80  if ( mePedMapG12_[i] ) mePedMapG12_[i]->Reset();
81  }
82 
83 }
int i
Definition: DBlmapReader.cc:9
MonitorElement * mePedMapG12_[36]
void Reset(void)
reset ME (ie. contents, errors, etc)
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().

85  {
86 
87  init_ = true;
88 
89  std::string name;
90  std::string dir;
91 
92  if ( dqmStore_ ) {
93  dir = prefixME_ + "/EBPedestalOnlineTask";
94  if(subfolder_.size())
95  dir += "/" + subfolder_;
96 
98 
99  dqmStore_->setCurrentFolder(dir + "/Gain12");
100  for (int i = 0; i < 36; i++) {
101  name = "EBPOT pedestal " + Numbers::sEB(i+1) + " G12";
102  mePedMapG12_[i] = dqmStore_->bookProfile2D(name, name, 85, 0., 85., 20, 0., 20., 4096, 0., 4096., "s");
103  mePedMapG12_[i]->setAxisTitle("ieta", 1);
104  mePedMapG12_[i]->setAxisTitle("iphi", 2);
105  dqmStore_->tag(mePedMapG12_[i], i+1);
106  }
107 
108  }
109 
110 }
int i
Definition: DBlmapReader.cc:9
static std::string sEB(const unsigned ism)
Definition: Numbers.cc:94
void tag(MonitorElement *me, unsigned int myTag)
Definition: DQMStore.cc:1354
MonitorElement * mePedMapG12_[36]
dbl *** dir
Definition: mlp_gen.cc:35
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
MonitorElement * bookProfile2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, int nchZ, double lowZ, double highZ, const char *option="s")
Definition: DQMStore.cc:1175

Member Data Documentation

DQMStore* EBPedestalOnlineTask::dqmStore_
private

Definition at line 60 of file EBPedestalOnlineTask.h.

Referenced by beginJob(), cleanup(), EBPedestalOnlineTask(), and setup().

edm::InputTag EBPedestalOnlineTask::EBDigiCollection_
private

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().