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_
 

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)
 

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

28  {
29 
30  init_ = false;
31 
33 
34  prefixME_ = ps.getUntrackedParameter<std::string>("prefixME", "");
35 
36  enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
37 
38  mergeRuns_ = ps.getUntrackedParameter<bool>("mergeRuns", false);
39 
40  EBDigiCollection_ = ps.getParameter<edm::InputTag>("EBDigiCollection");
41 
42  for (int i = 0; i < 36; i++) {
43  mePedMapG12_[i] = 0;
44  }
45 
46 }
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 48 of file EBPedestalOnlineTask.cc.

48  {
49 
50 }

Member Function Documentation

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

Analyze.

Implements edm::EDAnalyzer.

Definition at line 132 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().

132  {
133 
134  if ( ! init_ ) this->setup();
135 
136  ievt_++;
137 
139 
140  if ( e.getByLabel(EBDigiCollection_, digis) ) {
141 
142  int nebd = digis->size();
143  LogDebug("EBPedestalOnlineTask") << "event " << ievt_ << " digi collection size " << nebd;
144 
145  for ( EBDigiCollection::const_iterator digiItr = digis->begin(); digiItr != digis->end(); ++digiItr ) {
146 
147  EBDetId id = digiItr->id();
148 
149  int ic = id.ic();
150  int ie = (ic-1)/20 + 1;
151  int ip = (ic-1)%20 + 1;
152 
153  int ism = Numbers::iSM( id );
154 
155  float xie = ie - 0.5;
156  float xip = ip - 0.5;
157 
158  EBDataFrame dataframe = (*digiItr);
159 
160  for (int i = 0; i < 3; i++) {
161 
162  int adc = dataframe.sample(i).adc();
163 
164  MonitorElement* mePedMap = 0;
165 
166  if ( dataframe.sample(i).gainId() == 1 ) mePedMap = mePedMapG12_[ism-1];
167  if ( dataframe.sample(i).gainId() == 2 ) mePedMap = 0;
168  if ( dataframe.sample(i).gainId() == 3 ) mePedMap = 0;
169 
170  float xval = float(adc);
171 
172  if ( mePedMap ) mePedMap->Fill(xie, xip, xval);
173 
174  }
175 
176  }
177 
178  } else {
179 
180  edm::LogWarning("EBPedestalOnlineTask") << EBDigiCollection_ << " not available";
181 
182  }
183 
184 }
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:28
int gainId() const
get the gainId (2 bits)
void Fill(long long x)
edm::InputTag EBDigiCollection_
static int iSM(const int ism, const EcalSubdetector subdet)
Definition: Numbers.cc:216
MonitorElement * mePedMapG12_[36]
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:359
int ic() const
get ECAL/crystal number inside SM
Definition: EBDetId.cc:94
int ism(int ieta, int iphi)
Definition: EcalPyUtils.cc:47
int adc() const
get the ADC sample (12 bits)
void EBPedestalOnlineTask::beginJob ( void  )
protectedvirtual

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 52 of file EBPedestalOnlineTask.cc.

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

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

BeginRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 63 of file EBPedestalOnlineTask.cc.

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

63  {
64 
65  Numbers::initGeometry(c, false);
66 
67  if ( ! mergeRuns_ ) this->reset();
68 
69 }
static void initGeometry(const edm::EventSetup &setup, bool verbose=false)
Definition: Numbers.cc:43
void EBPedestalOnlineTask::cleanup ( void  )
protected

Cleanup.

Definition at line 105 of file EBPedestalOnlineTask.cc.

References dqmStore_, edm::getName(), i, init_, mePedMapG12_, prefixME_, DQMStore::removeElement(), and DQMStore::setCurrentFolder().

Referenced by endJob().

105  {
106 
107  if ( ! init_ ) return;
108 
109  if ( dqmStore_ ) {
110  dqmStore_->setCurrentFolder(prefixME_ + "/EBPedestalOnlineTask");
111 
112  dqmStore_->setCurrentFolder(prefixME_ + "/EBPedestalOnlineTask/Gain12");
113  for ( int i = 0; i < 36; i++ ) {
115  mePedMapG12_[i] = 0;
116  }
117 
118  }
119 
120  init_ = false;
121 
122 }
int i
Definition: DBlmapReader.cc:9
void removeElement(const std::string &name)
Definition: DQMStore.cc:2338
MonitorElement * mePedMapG12_[36]
std::string getName(Reflex::Type &cc)
Definition: ClassFiller.cc:18
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:237
void EBPedestalOnlineTask::endJob ( void  )
protectedvirtual

EndJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 124 of file EBPedestalOnlineTask.cc.

References cleanup(), enableCleanup_, and ievt_.

124  {
125 
126  edm::LogInfo("EBPedestalOnlineTask") << "analyzed " << ievt_ << " events";
127 
128  if ( enableCleanup_ ) this->cleanup();
129 
130 }
void cleanup(void)
Cleanup.
void EBPedestalOnlineTask::endRun ( const edm::Run r,
const edm::EventSetup c 
)
protectedvirtual

EndRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 71 of file EBPedestalOnlineTask.cc.

71  {
72 
73 }
void EBPedestalOnlineTask::reset ( void  )
protected

Reset.

Definition at line 75 of file EBPedestalOnlineTask.cc.

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

Referenced by beginRun().

75  {
76 
77  for (int i = 0; i < 36; i++) {
78  if ( mePedMapG12_[i] ) mePedMapG12_[i]->Reset();
79  }
80 
81 }
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 83 of file EBPedestalOnlineTask.cc.

References DQMStore::bookProfile2D(), dqmStore_, trackerHits::histo, i, init_, mePedMapG12_, prefixME_, Numbers::sEB(), MonitorElement::setAxisTitle(), DQMStore::setCurrentFolder(), and DQMStore::tag().

Referenced by analyze().

83  {
84 
85  init_ = true;
86 
87  char histo[200];
88 
89  if ( dqmStore_ ) {
90  dqmStore_->setCurrentFolder(prefixME_ + "/EBPedestalOnlineTask");
91 
92  dqmStore_->setCurrentFolder(prefixME_ + "/EBPedestalOnlineTask/Gain12");
93  for (int i = 0; i < 36; i++) {
94  sprintf(histo, "EBPOT pedestal %s G12", Numbers::sEB(i+1).c_str());
95  mePedMapG12_[i] = dqmStore_->bookProfile2D(histo, histo, 85, 0., 85., 20, 0., 20., 4096, 0., 4096., "s");
96  mePedMapG12_[i]->setAxisTitle("ieta", 1);
97  mePedMapG12_[i]->setAxisTitle("iphi", 2);
98  dqmStore_->tag(mePedMapG12_[i], i+1);
99  }
100 
101  }
102 
103 }
int i
Definition: DBlmapReader.cc:9
static std::string sEB(const int ism)
Definition: Numbers.cc:81
tuple histo
Definition: trackerHits.py:12
void tag(MonitorElement *me, unsigned int myTag)
Definition: DQMStore.cc:1156
MonitorElement * mePedMapG12_[36]
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:237
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:977

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