CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes
ecaldqm::TestPulseTask Class Reference

#include <TestPulseTask.h>

Inheritance diagram for ecaldqm::TestPulseTask:
ecaldqm::DQWorkerTask ecaldqm::DQWorker

Public Types

enum  Constants { nGain = 3, nPNGain = 2 }
 
enum  MESets {
  kOccupancy, kShape = kOccupancy + nGain, kAmplitude = kShape + nGain, kPNOccupancy = kAmplitude + nGain,
  kPNAmplitude = kPNOccupancy + nPNGain, nMESets = kPNAmplitude + nPNGain
}
 
- Public Types inherited from ecaldqm::DQWorker
enum  MESets { nMESets }
 

Public Member Functions

void analyze (const void *, Collections) override
 
void beginRun (const edm::Run &, const edm::EventSetup &) override
 
void bookMEs () override
 
void endEvent (const edm::Event &, const edm::EventSetup &) override
 
bool filterRunType (const std::vector< short > &) override
 
void runOnDigis (const EcalDigiCollection &)
 
void runOnPnDigis (const EcalPnDiodeDigiCollection &)
 
void runOnUncalibRecHits (const EcalUncalibratedRecHitCollection &)
 
 TestPulseTask (const edm::ParameterSet &, const edm::ParameterSet &)
 
 ~TestPulseTask ()
 
- Public Member Functions inherited from ecaldqm::DQWorkerTask
virtual void beginEvent (const edm::Event &, const edm::EventSetup &)
 
 DQWorkerTask (const edm::ParameterSet &, const edm::ParameterSet &, std::string const &)
 
virtual bool filterTrigger (const edm::TriggerResultsByName &)
 
virtual const std::vector
< std::pair< Collections,
Collections > > & 
getDependencies ()
 
virtual bool runsOn (unsigned)
 
virtual ~DQWorkerTask ()
 
- Public Member Functions inherited from ecaldqm::DQWorker
virtual void beginLuminosityBlock (const edm::LuminosityBlock &, const edm::EventSetup &)
 
 DQWorker (const edm::ParameterSet &, const edm::ParameterSet &, std::string const &)
 
virtual void endLuminosityBlock (const edm::LuminosityBlock &, const edm::EventSetup &)
 
virtual void endRun (const edm::Run &, const edm::EventSetup &)
 
const std::vector< MESet * > & getMEs ()
 
virtual std::string const & getName ()
 
virtual bool isInitialized ()
 
virtual void reset ()
 
virtual void setInitialized (bool _init)
 
virtual void setVerbosity (int _verbosity)
 
virtual ~DQWorker ()
 

Static Public Member Functions

static void setMEData (std::vector< MEData > &)
 
- Static Public Member Functions inherited from ecaldqm::DQWorker
static void setMEData (std::vector< MEData > &)
 

Protected Attributes

bool enable_ [54]
 
int gain_ [54]
 
std::vector< int > MGPAGains_
 
std::vector< int > MGPAGainsPN_
 
- Protected Attributes inherited from ecaldqm::DQWorkerTask
uint32_t collectionMask_
 
std::vector< std::pair
< Collections, Collections > > 
dependencies_
 
- Protected Attributes inherited from ecaldqm::DQWorker
bool initialized_
 
std::vector< MESet * > MEs_
 
std::string name_
 
int verbosity_
 

Additional Inherited Members

- Static Public Attributes inherited from ecaldqm::DQWorker
static std::map< std::string,
std::vector< MEData > > 
meData
 
- Protected Member Functions inherited from ecaldqm::DQWorker
MESetcreateMESet_ (std::string const &, MEData const &, bool _readOnly=false) const
 
void meSet_ (unsigned, edm::ParameterSet const &)
 

Detailed Description

Definition at line 11 of file TestPulseTask.h.

Member Enumeration Documentation

Enumerator
nGain 
nPNGain 

Definition at line 29 of file TestPulseTask.h.

Enumerator
kOccupancy 
kShape 
kAmplitude 
kPNOccupancy 
kPNAmplitude 
nMESets 

Definition at line 34 of file TestPulseTask.h.

Constructor & Destructor Documentation

ecaldqm::TestPulseTask::TestPulseTask ( const edm::ParameterSet _params,
const edm::ParameterSet _paths 
)

Definition at line 13 of file TestPulseTask.cc.

References ecaldqm::DQWorkerTask::collectionMask_, enable_, edm::hlt::Exception, gain_, edm::ParameterSet::getUntrackedParameterSet(), kAmplitude, ecaldqm::kEBDigi, ecaldqm::kEBUncalibRecHit, ecaldqm::kEEDigi, ecaldqm::kEEUncalibRecHit, kOccupancy, kPNAmplitude, ecaldqm::kPnDiodeDigi, kPNOccupancy, kShape, ecaldqm::DQWorker::MEs_, MGPAGains_, MGPAGainsPN_, and evf::evtn::offset().

13  :
14  DQWorkerTask(_params, _paths, "TestPulseTask"),
15  MGPAGains_(),
16  MGPAGainsPN_()
17  {
18  using namespace std;
19 
21  (0x1 << kEBDigi) |
22  (0x1 << kEEDigi) |
23  (0x1 << kPnDiodeDigi) |
24  (0x1 << kEBUncalibRecHit) |
25  (0x1 << kEEUncalibRecHit);
26 
27  edm::ParameterSet const& commonParams(_params.getUntrackedParameterSet("Common"));
28  MGPAGains_ = commonParams.getUntrackedParameter<std::vector<int> >("MGPAGains");
29  MGPAGainsPN_ = commonParams.getUntrackedParameter<std::vector<int> >("MGPAGainsPN");
30 
31  for(int idcc(0); idcc < 54; idcc++){
32  enable_[idcc] = false;
33  gain_[idcc] = 12;
34  }
35 
36  for(std::vector<int>::iterator gainItr(MGPAGains_.begin()); gainItr != MGPAGains_.end(); ++gainItr)
37  if(*gainItr != 1 && *gainItr != 6 && *gainItr != 12) throw cms::Exception("InvalidConfiguration") << "MGPA gain" << std::endl;
38 
39  for(std::vector<int>::iterator gainItr(MGPAGainsPN_.begin()); gainItr != MGPAGainsPN_.end(); ++gainItr)
40  if(*gainItr != 1 && *gainItr != 16) throw cms::Exception("InvalidConfiguration") << "PN diode gain" << std::endl;
41 
42  map<string, string> replacements;
43  stringstream ss;
44 
45  for(vector<int>::iterator gainItr(MGPAGains_.begin()); gainItr != MGPAGains_.end(); ++gainItr){
46  ss.str("");
47  ss << *gainItr;
48  replacements["gain"] = ss.str();
49 
50  unsigned offset(0);
51  switch(*gainItr){
52  case 1: offset = 0; break;
53  case 6: offset = 1; break;
54  case 12: offset = 2; break;
55  default: break;
56  }
57 
58  MEs_[kOccupancy + offset]->name(replacements);
59  MEs_[kShape + offset]->name(replacements);
60  MEs_[kAmplitude + offset]->name(replacements);
61  }
62 
63  for(vector<int>::iterator gainItr(MGPAGainsPN_.begin()); gainItr != MGPAGainsPN_.end(); ++gainItr){
64  ss.str("");
65  ss << *gainItr;
66  replacements["pngain"] = ss.str();
67 
68  unsigned offset(0);
69  switch(*gainItr){
70  case 1: offset = 0; break;
71  case 16: offset = 1; break;
72  default: break;
73  }
74 
75  MEs_[kPNOccupancy + offset]->name(replacements);
76  MEs_[kPNAmplitude + offset]->name(replacements);
77  }
78  }
std::vector< int > MGPAGains_
Definition: TestPulseTask.h:48
DQWorkerTask(const edm::ParameterSet &, const edm::ParameterSet &, std::string const &)
Definition: DQWorkerTask.cc:5
ParameterSet getUntrackedParameterSet(std::string const &name, ParameterSet const &defaultValue) const
unsigned int offset(bool)
std::vector< MESet * > MEs_
Definition: DQWorker.h:56
std::vector< int > MGPAGainsPN_
Definition: TestPulseTask.h:49
ecaldqm::TestPulseTask::~TestPulseTask ( )

Definition at line 80 of file TestPulseTask.cc.

81  {
82  }

Member Function Documentation

void ecaldqm::TestPulseTask::analyze ( const void *  _p,
Collections  _collection 
)
inlineoverridevirtual

Reimplemented from ecaldqm::DQWorkerTask.

Definition at line 52 of file TestPulseTask.h.

References ecaldqm::kEBDigi, ecaldqm::kEBUncalibRecHit, ecaldqm::kEEDigi, ecaldqm::kEEUncalibRecHit, ecaldqm::kPnDiodeDigi, runOnDigis(), runOnPnDigis(), and runOnUncalibRecHits().

52  {
53  switch(_collection){
54  case kEBDigi:
55  case kEEDigi:
56  runOnDigis(*static_cast<const EcalDigiCollection*>(_p));
57  break;
58  case kPnDiodeDigi:
59  runOnPnDigis(*static_cast<const EcalPnDiodeDigiCollection*>(_p));
60  break;
61  case kEBUncalibRecHit:
62  case kEEUncalibRecHit:
63  runOnUncalibRecHits(*static_cast<const EcalUncalibratedRecHitCollection*>(_p));
64  break;
65  default:
66  break;
67  }
68  }
void runOnPnDigis(const EcalPnDiodeDigiCollection &)
void runOnDigis(const EcalDigiCollection &)
void runOnUncalibRecHits(const EcalUncalibratedRecHitCollection &)
void ecaldqm::TestPulseTask::beginRun ( const edm::Run ,
const edm::EventSetup  
)
overridevirtual

Reimplemented from ecaldqm::DQWorker.

Definition at line 114 of file TestPulseTask.cc.

References enable_, and gain_.

115  {
116  for(int idcc(0); idcc < 54; idcc++){
117  enable_[idcc] = false;
118  gain_[idcc] = 0;
119  }
120  }
void ecaldqm::TestPulseTask::bookMEs ( )
overridevirtual

Reimplemented from ecaldqm::DQWorker.

Definition at line 85 of file TestPulseTask.cc.

References kAmplitude, kOccupancy, kPNAmplitude, kPNOccupancy, kShape, ecaldqm::DQWorker::MEs_, MGPAGains_, MGPAGainsPN_, and evf::evtn::offset().

86  {
87  for(std::vector<int>::iterator gainItr(MGPAGains_.begin()); gainItr != MGPAGains_.end(); ++gainItr){
88  unsigned offset(0);
89  switch(*gainItr){
90  case 1: offset = 0; break;
91  case 6: offset = 1; break;
92  case 12: offset = 2; break;
93  default: break;
94  }
95 
96  MEs_[kOccupancy + offset]->book();
97  MEs_[kShape + offset]->book();
98  MEs_[kAmplitude + offset]->book();
99  }
100  for(std::vector<int>::iterator gainItr(MGPAGainsPN_.begin()); gainItr != MGPAGainsPN_.end(); ++gainItr){
101  unsigned offset(0);
102  switch(*gainItr){
103  case 1: offset = 0; break;
104  case 16: offset = 1; break;
105  default: break;
106  }
107 
108  MEs_[kPNOccupancy + offset]->book();
109  MEs_[kPNAmplitude + offset]->book();
110  }
111  }
std::vector< int > MGPAGains_
Definition: TestPulseTask.h:48
unsigned int offset(bool)
std::vector< MESet * > MEs_
Definition: DQWorker.h:56
std::vector< int > MGPAGainsPN_
Definition: TestPulseTask.h:49
void ecaldqm::TestPulseTask::endEvent ( const edm::Event ,
const edm::EventSetup  
)
overridevirtual

Reimplemented from ecaldqm::DQWorkerTask.

Definition at line 123 of file TestPulseTask.cc.

References enable_, and gain_.

124  {
125  for(int idcc(0); idcc < 54; idcc++){
126  enable_[idcc] = false;
127  gain_[idcc] = 0;
128  }
129  }
bool ecaldqm::TestPulseTask::filterRunType ( const std::vector< short > &  _runType)
overridevirtual

Reimplemented from ecaldqm::DQWorkerTask.

Definition at line 132 of file TestPulseTask.cc.

References enable_, EcalDCCHeaderBlock::TESTPULSE_GAP, and EcalDCCHeaderBlock::TESTPULSE_MGPA.

133  {
134  bool enable(false);
135 
136  for(int iFED(0); iFED < 54; iFED++){
137  if(_runType[iFED] == EcalDCCHeaderBlock::TESTPULSE_MGPA ||
138  _runType[iFED] == EcalDCCHeaderBlock::TESTPULSE_GAP){
139  enable = true;
140  enable_[iFED] = true;
141  }
142  }
143 
144  return enable;
145  }
void ecaldqm::TestPulseTask::runOnDigis ( const EcalDigiCollection _digis)

Definition at line 148 of file TestPulseTask.cc.

References EcalMGPASample::adc(), edm::DataFrameContainer::begin(), ecaldqm::dccId(), enable_, edm::DataFrameContainer::end(), lumiContext::fill, spr::find(), gain_, EcalMGPASample::gainId(), kOccupancy, kShape, ecaldqm::DQWorker::MEs_, MGPAGains_, evf::evtn::offset(), and EcalDataFrame::sample().

Referenced by analyze().

149  {
150  for(EcalDigiCollection::const_iterator digiItr(_digis.begin()); digiItr != _digis.end(); ++digiItr){
151  DetId id(digiItr->id());
152 
153  int iDCC(dccId(id) - 1);
154 
155  if(!enable_[iDCC]) continue;
156 
157  // EcalDataFrame is not a derived class of edm::DataFrame, but can take edm::DataFrame in the constructor
158  EcalDataFrame dataFrame(*digiItr);
159 
160  unsigned offset(0);
161  switch(dataFrame.sample(0).gainId()){
162  case 1: offset = 2; gain_[iDCC] = 12; break;
163  case 2: offset = 1; gain_[iDCC] = 6; break;
164  case 3: offset = 0; gain_[iDCC] = 1; break;
165  default: continue;
166  }
167 
168  if(std::find(MGPAGains_.begin(), MGPAGains_.end(), gain_[iDCC]) == MGPAGains_.end()) continue;
169 
170  MEs_[kOccupancy + offset]->fill(id);
171 
172  for(int iSample(0); iSample < 10; iSample++)
173  MEs_[kShape + offset]->fill(id, iSample + 0.5, float(dataFrame.sample(iSample).adc()));
174  }
175  }
string fill
Definition: lumiContext.py:319
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
std::vector< int > MGPAGains_
Definition: TestPulseTask.h:48
unsigned dccId(const DetId &)
const_iterator begin() const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
unsigned int offset(bool)
Definition: DetId.h:18
std::vector< MESet * > MEs_
Definition: DQWorker.h:56
const_iterator end() const
void ecaldqm::TestPulseTask::runOnPnDigis ( const EcalPnDiodeDigiCollection _digis)

Definition at line 178 of file TestPulseTask.cc.

References edm::SortedCollection< T, SORT >::begin(), ecaldqm::dccId(), enable_, edm::SortedCollection< T, SORT >::end(), spr::find(), kPNAmplitude, kPNOccupancy, max(), ecaldqm::DQWorker::MEs_, MGPAGainsPN_, and evf::evtn::offset().

Referenced by analyze().

179  {
180  for(EcalPnDiodeDigiCollection::const_iterator digiItr(_digis.begin()); digiItr != _digis.end(); ++digiItr){
181  EcalPnDiodeDetId id(digiItr->id());
182 
183  int iDCC(dccId(id) - 1);
184 
185  if(!enable_[iDCC]) continue;
186 
187  unsigned offset(0);
188  int gain(0);
189  switch(digiItr->sample(0).gainId()){
190  case 0: offset = 0; gain = 1; break;
191  case 1: offset = 1; gain = 16; break;
192  default: continue;
193  }
194 
195  if(std::find(MGPAGainsPN_.begin(), MGPAGainsPN_.end(), gain) == MGPAGainsPN_.end()) continue;
196 
197  MEs_[kPNOccupancy + offset]->fill(id);
198 
199  float pedestal(0.);
200  for(int iSample(0); iSample < 4; iSample++)
201  pedestal += digiItr->sample(iSample).adc();
202  pedestal /= 4.;
203 
204  float max(0.);
205  for(int iSample(0); iSample < 50; iSample++)
206  if(digiItr->sample(iSample).adc() > max) max = digiItr->sample(iSample).adc();
207 
208  float amplitude(max - pedestal);
209 
210  MEs_[kPNAmplitude + offset]->fill(id, amplitude);
211  }
212  }
std::vector< EcalPnDiodeDigi >::const_iterator const_iterator
unsigned dccId(const DetId &)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
const T & max(const T &a, const T &b)
unsigned int offset(bool)
const_iterator end() const
std::vector< MESet * > MEs_
Definition: DQWorker.h:56
std::vector< int > MGPAGainsPN_
Definition: TestPulseTask.h:49
const_iterator begin() const
void ecaldqm::TestPulseTask::runOnUncalibRecHits ( const EcalUncalibratedRecHitCollection _uhits)

Definition at line 215 of file TestPulseTask.cc.

References edm::SortedCollection< T, SORT >::begin(), ecaldqm::dccId(), enable_, edm::SortedCollection< T, SORT >::end(), gain_, kAmplitude, ecaldqm::DQWorker::MEs_, and evf::evtn::offset().

Referenced by analyze().

216  {
217  for(EcalUncalibratedRecHitCollection::const_iterator uhitItr(_uhits.begin()); uhitItr != _uhits.end(); ++uhitItr){
218  DetId id(uhitItr->id());
219 
220  int iDCC(dccId(id) - 1);
221 
222  if(!enable_[iDCC]) continue;
223 
224  unsigned offset(0);
225  switch(gain_[iDCC]){
226  case 1: offset = 0; break;
227  case 6: offset = 1; break;
228  case 12: offset = 2; break;
229  default: continue;
230  }
231 
232  MEs_[kAmplitude + offset]->fill(id, uhitItr->amplitude());
233  }
234  }
std::vector< EcalUncalibratedRecHit >::const_iterator const_iterator
unsigned dccId(const DetId &)
unsigned int offset(bool)
const_iterator end() const
Definition: DetId.h:18
std::vector< MESet * > MEs_
Definition: DQWorker.h:56
const_iterator begin() const
void ecaldqm::TestPulseTask::setMEData ( std::vector< MEData > &  _data)
static

Definition at line 238 of file TestPulseTask.cc.

References MonitorElement::DQM_KIND_TH2F, MonitorElement::DQM_KIND_TPROFILE, MonitorElement::DQM_KIND_TPROFILE2D, EcalDQMBinningService::AxisSpecs::high, kAmplitude, EcalDQMBinningService::kCrystal, EcalDQMBinningService::kEcal2P, EcalDQMBinningService::kEcalMEM2P, kOccupancy, kPNAmplitude, kPNOccupancy, kShape, EcalDQMBinningService::kSM, EcalDQMBinningService::kSMMEM, EcalDQMBinningService::kSuperCrystal, EcalDQMBinningService::AxisSpecs::low, EcalDQMBinningService::AxisSpecs::nbins, nGain, and nPNGain.

239  {
241  axis.nbins = 10;
242  axis.low = 0.;
243  axis.high = 10.;
244 
245  for(unsigned iGain(0); iGain < nGain; iGain++){
247  _data[kShape + iGain] = MEData("Shape", BinService::kSM, BinService::kSuperCrystal, MonitorElement::DQM_KIND_TPROFILE2D, 0, &axis);
249  }
250  for(unsigned iPNGain(0); iPNGain < nPNGain; iPNGain++){
253  }
254  }

Member Data Documentation

bool ecaldqm::TestPulseTask::enable_[54]
protected
int ecaldqm::TestPulseTask::gain_[54]
protected

Definition at line 47 of file TestPulseTask.h.

Referenced by beginRun(), endEvent(), runOnDigis(), runOnUncalibRecHits(), and TestPulseTask().

std::vector<int> ecaldqm::TestPulseTask::MGPAGains_
protected

Definition at line 48 of file TestPulseTask.h.

Referenced by bookMEs(), runOnDigis(), and TestPulseTask().

std::vector<int> ecaldqm::TestPulseTask::MGPAGainsPN_
protected

Definition at line 49 of file TestPulseTask.h.

Referenced by bookMEs(), runOnPnDigis(), and TestPulseTask().