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 edm::EDConsumerBase

Public Member Functions

 EBPedestalOnlineTask (const edm::ParameterSet &ps)
 Constructor. More...
 
virtual ~EBPedestalOnlineTask ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Private Attributes

DQMStoredqmStore_
 
edm::EDGetTokenT
< EBDigiCollection
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
 
- 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 25 of file EBPedestalOnlineTask.cc.

References dqmStore_, EBDigiCollection_, enableCleanup_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), i, init_, mePedMapG12_, mergeRuns_, cppFunctionSkipper::operator, prefixME_, AlCaHLTBitMon_QueryRunRegistry::string, and subfolder_.

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

Destructor.

Definition at line 47 of file EBPedestalOnlineTask.cc.

47  {
48 
49 }

Member Function Documentation

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

Analyze.

Implements edm::EDAnalyzer.

Definition at line 140 of file EBPedestalOnlineTask.cc.

References ecalMGPA::adc(), EcalMGPASample::adc(), EBDigiCollection_, MonitorElement::Fill(), EcalMGPASample::gainId(), edm::Event::getByToken(), i, EBDetId::ic(), ievt_, init_, ecalpyutils::ism(), Numbers::iSM(), LogDebug, mePedMapG12_, EcalDataFrame::sample(), and setup().

140  {
141 
142  if ( ! init_ ) this->setup();
143 
144  ievt_++;
145 
147 
148  if ( e.getByToken(EBDigiCollection_, digis) ) {
149 
150  int nebd = digis->size();
151  LogDebug("EBPedestalOnlineTask") << "event " << ievt_ << " digi collection size " << nebd;
152 
153  for ( EBDigiCollection::const_iterator digiItr = digis->begin(); digiItr != digis->end(); ++digiItr ) {
154 
155  EBDetId id = digiItr->id();
156 
157  int ic = id.ic();
158  int ie = (ic-1)/20 + 1;
159  int ip = (ic-1)%20 + 1;
160 
161  int ism = Numbers::iSM( id );
162 
163  float xie = ie - 0.5;
164  float xip = ip - 0.5;
165 
166  EBDataFrame dataframe = (*digiItr);
167 
168  int iMax(-1);
169  int maxADC(0);
170  for(int i(0); i < 10; i++){
171  if(dataframe.sample(i).gainId() != 1) break;
172  int adc(dataframe.sample(i).adc());
173  if(adc > maxADC){
174  maxADC = adc;
175  iMax = i;
176  }
177  }
178 
179  if(iMax != 5) continue;
180 
181  for (int i = 0; i < 3; i++) {
182 
183  int adc = dataframe.sample(i).adc();
184 
185  MonitorElement* mePedMap = 0;
186 
187  if ( dataframe.sample(i).gainId() == 1 ) mePedMap = mePedMapG12_[ism-1];
188  if ( dataframe.sample(i).gainId() == 2 ) mePedMap = 0;
189  if ( dataframe.sample(i).gainId() == 3 ) mePedMap = 0;
190 
191  float xval = float(adc);
192 
193  if ( mePedMap ) mePedMap->Fill(xie, xip, xval);
194 
195  }
196 
197  }
198 
199  } else {
200 
201  edm::LogWarning("EBPedestalOnlineTask") << "EBDigiCollection not available";
202 
203  }
204 
205 }
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
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
EcalMGPASample sample(int i) const
Definition: EcalDataFrame.h:29
int gainId() const
get the gainId (2 bits)
void Fill(long long x)
edm::EDGetTokenT< EBDigiCollection > EBDigiCollection_
MonitorElement * mePedMapG12_[36]
int ic() const
get ECAL/crystal number inside SM
Definition: EBDetId.cc:46
static unsigned iSM(const unsigned ism, const EcalSubdetector subdet)
Definition: Numbers.cc:243
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 51 of file EBPedestalOnlineTask.cc.

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

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

BeginRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 62 of file EBPedestalOnlineTask.cc.

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

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

Cleanup.

Definition at line 109 of file EBPedestalOnlineTask.cc.

References dir, dqmStore_, i, init_, mePedMapG12_, prefixME_, DQMStore::removeElement(), DQMStore::setCurrentFolder(), AlCaHLTBitMon_QueryRunRegistry::string, and subfolder_.

Referenced by endJob().

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

EndJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 132 of file EBPedestalOnlineTask.cc.

References cleanup(), enableCleanup_, and ievt_.

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

EndRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 70 of file EBPedestalOnlineTask.cc.

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

Reset.

Definition at line 74 of file EBPedestalOnlineTask.cc.

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

Referenced by beginRun().

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

References DQMStore::bookProfile2D(), dir, dqmStore_, i, init_, mePedMapG12_, mergeVDriftHistosByStation::name, prefixME_, Numbers::sEB(), MonitorElement::setAxisTitle(), DQMStore::setCurrentFolder(), AlCaHLTBitMon_QueryRunRegistry::string, subfolder_, and DQMStore::tag().

Referenced by analyze().

82  {
83 
84  init_ = true;
85 
88 
89  if ( dqmStore_ ) {
90  dir = prefixME_ + "/EBPedestalOnlineTask";
91  if(subfolder_.size())
92  dir += "/" + subfolder_;
93 
95 
96  dqmStore_->setCurrentFolder(dir + "/Gain12");
97  for (int i = 0; i < 36; i++) {
98  name = "EBPOT pedestal " + Numbers::sEB(i+1) + " G12";
99  mePedMapG12_[i] = dqmStore_->bookProfile2D(name, name, 85, 0., 85., 20, 0., 20., 4096, 0., 4096., "s");
100  mePedMapG12_[i]->setAxisTitle("ieta", 1);
101  mePedMapG12_[i]->setAxisTitle("iphi", 2);
102  dqmStore_->tag(mePedMapG12_[i], i+1);
103  }
104 
105  }
106 
107 }
int i
Definition: DBlmapReader.cc:9
static std::string sEB(const unsigned ism)
Definition: Numbers.cc:91
void tag(MonitorElement *me, unsigned int myTag)
Definition: DQMStore.cc:1510
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:585
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:1331

Member Data Documentation

DQMStore* EBPedestalOnlineTask::dqmStore_
private

Definition at line 60 of file EBPedestalOnlineTask.h.

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

edm::EDGetTokenT<EBDigiCollection> 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().