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::PedestalTask Class Reference

#include <PedestalTask.h>

Inheritance diagram for ecaldqm::PedestalTask:
ecaldqm::DQWorkerTask ecaldqm::DQWorker

Public Types

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

Public Member Functions

void analyze (const void *, Collections)
 
void bookMEs ()
 
bool filterRunType (const std::vector< short > &)
 
 PedestalTask (const edm::ParameterSet &, const edm::ParameterSet &)
 
void runOnDigis (const EcalDigiCollection &)
 
void runOnPnDigis (const EcalPnDiodeDigiCollection &)
 
 ~PedestalTask ()
 
- 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 void endEvent (const edm::Event &, const edm::EventSetup &)
 
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 &)
 
virtual void beginRun (const edm::Run &, 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_ [BinService::nDCC]
 
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 10 of file PedestalTask.h.

Member Enumeration Documentation

Enumerator
nGain 
nPNGain 

Definition at line 24 of file PedestalTask.h.

Enumerator
kOccupancy 
kPedestal 
kPNOccupancy 
kPNPedestal 
nMESets 

Definition at line 29 of file PedestalTask.h.

Constructor & Destructor Documentation

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

Definition at line 13 of file PedestalTask.cc.

References ecaldqm::DQWorkerTask::collectionMask_, edm::hlt::Exception, edm::ParameterSet::getUntrackedParameterSet(), ecaldqm::kEBDigi, ecaldqm::kEEDigi, kOccupancy, kPedestal, ecaldqm::kPnDiodeDigi, kPNOccupancy, kPNPedestal, ecaldqm::DQWorker::MEs_, MGPAGains_, MGPAGainsPN_, and evf::evtn::offset().

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

Definition at line 72 of file PedestalTask.cc.

73  {
74  }

Member Function Documentation

void ecaldqm::PedestalTask::analyze ( const void *  _p,
Collections  _collection 
)
inlinevirtual

Reimplemented from ecaldqm::DQWorkerTask.

Definition at line 46 of file PedestalTask.h.

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

46  {
47  switch(_collection){
48  case kEBDigi:
49  case kEEDigi:
50  runOnDigis(*static_cast<const EcalDigiCollection*>(_p));
51  break;
52  case kPnDiodeDigi:
53  runOnPnDigis(*static_cast<const EcalPnDiodeDigiCollection*>(_p));
54  break;
55  default:
56  break;
57  }
58  }
void runOnDigis(const EcalDigiCollection &)
void runOnPnDigis(const EcalPnDiodeDigiCollection &)
void ecaldqm::PedestalTask::bookMEs ( )
virtual

Reimplemented from ecaldqm::DQWorker.

Definition at line 77 of file PedestalTask.cc.

References kOccupancy, kPedestal, kPNOccupancy, kPNPedestal, ecaldqm::DQWorker::MEs_, MGPAGains_, MGPAGainsPN_, and evf::evtn::offset().

78  {
79  for(std::vector<int>::iterator gainItr(MGPAGains_.begin()); gainItr != MGPAGains_.end(); ++gainItr){
80  unsigned offset(0);
81  switch(*gainItr){
82  case 1: offset = 0; break;
83  case 6: offset = 1; break;
84  case 12: offset = 2; break;
85  default: break;
86  }
87 
88  MEs_[kOccupancy + offset]->book();
89  MEs_[kPedestal + offset]->book();
90  }
91  for(std::vector<int>::iterator gainItr(MGPAGainsPN_.begin()); gainItr != MGPAGainsPN_.end(); ++gainItr){
92  unsigned offset(0);
93  switch(*gainItr){
94  case 1: offset = 0; break;
95  case 16: offset = 1; break;
96  default: break;
97  }
98 
99  MEs_[kPNOccupancy + offset]->book();
100  MEs_[kPNPedestal + offset]->book();
101  }
102  }
std::vector< int > MGPAGains_
Definition: PedestalTask.h:40
unsigned int offset(bool)
std::vector< int > MGPAGainsPN_
Definition: PedestalTask.h:41
std::vector< MESet * > MEs_
Definition: DQWorker.h:56
bool ecaldqm::PedestalTask::filterRunType ( const std::vector< short > &  _runType)
virtual

Reimplemented from ecaldqm::DQWorkerTask.

Definition at line 105 of file PedestalTask.cc.

References enable_, EcalDCCHeaderBlock::PEDESTAL_GAP, and EcalDCCHeaderBlock::PEDESTAL_STD.

106  {
107  bool enable(false);
108 
109  for(int iFED(0); iFED < 54; iFED++){
110  if(_runType[iFED] == EcalDCCHeaderBlock::PEDESTAL_STD ||
111  _runType[iFED] == EcalDCCHeaderBlock::PEDESTAL_GAP){
112  enable = true;
113  enable_[iFED] = true;
114  }
115  }
116 
117  return enable;
118  }
bool enable_[BinService::nDCC]
Definition: PedestalTask.h:43
void ecaldqm::PedestalTask::runOnDigis ( const EcalDigiCollection _digis)

Definition at line 121 of file PedestalTask.cc.

References EcalMGPASample::adc(), edm::DataFrameContainer::begin(), ecaldqm::dccId(), enable_, edm::DataFrameContainer::end(), spr::find(), EcalMGPASample::gainId(), errorMatrix2Lands_multiChannel::id, kOccupancy, kPedestal, timingPdfMaker::mean, ecaldqm::DQWorker::MEs_, MGPAGains_, evf::evtn::offset(), and EcalDataFrame::sample().

Referenced by analyze().

122  {
123  for(EcalDigiCollection::const_iterator digiItr(_digis.begin()); digiItr != _digis.end(); ++digiItr){
124  DetId id(digiItr->id());
125 
126  int iDCC(dccId(id) - 1);
127 
128  if(!enable_[iDCC]) continue;
129 
130  // EcalDataFrame is not a derived class of edm::DataFrame, but can take edm::DataFrame in the constructor
131  EcalDataFrame dataFrame(*digiItr);
132 
133  unsigned offset(0);
134  int gain(0);
135  switch(dataFrame.sample(0).gainId()){
136  case 1: offset = 2; gain = 12; break;
137  case 2: offset = 1; gain = 6; break;
138  case 3: offset = 0; gain = 1; break;
139  default: continue;
140  }
141 
142  if(std::find(MGPAGains_.begin(), MGPAGains_.end(), gain) == MGPAGains_.end()) continue;
143 
144  MEs_[kOccupancy + offset]->fill(id);
145 
146  float mean(0.);
147  for(int iSample(0); iSample < 10; iSample++)
148  mean += dataFrame.sample(iSample).adc();
149  mean /= 10.;
150 
151  MEs_[kPedestal + offset]->fill(id, mean);
152  }
153  }
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
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
std::vector< int > MGPAGains_
Definition: PedestalTask.h:40
unsigned int offset(bool)
Definition: DetId.h:20
std::vector< MESet * > MEs_
Definition: DQWorker.h:56
const_iterator end() const
bool enable_[BinService::nDCC]
Definition: PedestalTask.h:43
void ecaldqm::PedestalTask::runOnPnDigis ( const EcalPnDiodeDigiCollection _digis)

Definition at line 156 of file PedestalTask.cc.

References edm::SortedCollection< T, SORT >::begin(), ecaldqm::dccId(), enable_, edm::SortedCollection< T, SORT >::end(), spr::find(), errorMatrix2Lands_multiChannel::id, kPNOccupancy, kPNPedestal, timingPdfMaker::mean, ecaldqm::DQWorker::MEs_, MGPAGainsPN_, and evf::evtn::offset().

Referenced by analyze().

157  {
158  for(EcalPnDiodeDigiCollection::const_iterator digiItr(_digis.begin()); digiItr != _digis.end(); ++digiItr){
159  EcalPnDiodeDetId id(digiItr->id());
160 
161  int iDCC(dccId(id) - 1);
162 
163  if(!enable_[iDCC]) continue;
164 
165  unsigned offset(0);
166  int gain(0);
167  switch(digiItr->sample(0).gainId()){
168  case 0: offset = 0; gain = 1; break;
169  case 1: offset = 1; gain = 16; break;
170  default: continue;
171  }
172 
173  if(std::find(MGPAGainsPN_.begin(), MGPAGainsPN_.end(), gain) == MGPAGainsPN_.end()) continue;
174 
175  MEs_[kPNOccupancy + offset]->fill(id);
176 
177  float mean(0.);
178  for(int iSample(0); iSample < 50; iSample++)
179  mean += digiItr->sample(iSample).adc();
180  mean /= 50.;
181 
182  MEs_[kPNPedestal + offset]->fill(id, mean);
183  }
184  }
std::vector< T >::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
unsigned int offset(bool)
std::vector< int > MGPAGainsPN_
Definition: PedestalTask.h:41
const_iterator end() const
std::vector< MESet * > MEs_
Definition: DQWorker.h:56
bool enable_[BinService::nDCC]
Definition: PedestalTask.h:43
const_iterator begin() const
void ecaldqm::PedestalTask::setMEData ( std::vector< MEData > &  _data)
static

Definition at line 188 of file PedestalTask.cc.

References MonitorElement::DQM_KIND_TH2F, MonitorElement::DQM_KIND_TPROFILE, MonitorElement::DQM_KIND_TPROFILE2D, EcalDQMBinningService::kCrystal, EcalDQMBinningService::kEcal2P, EcalDQMBinningService::kEcalMEM2P, kOccupancy, kPedestal, kPNOccupancy, kPNPedestal, EcalDQMBinningService::kSM, EcalDQMBinningService::kSMMEM, EcalDQMBinningService::kSuperCrystal, nGain, and nPNGain.

189  {
190  for(unsigned iGain(0); iGain < nGain; iGain++){
193  }
194  for(unsigned iPNGain(0); iPNGain < nPNGain; iPNGain++){
197  }
198  }

Member Data Documentation

bool ecaldqm::PedestalTask::enable_[BinService::nDCC]
protected

Definition at line 43 of file PedestalTask.h.

Referenced by filterRunType(), runOnDigis(), and runOnPnDigis().

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

Definition at line 40 of file PedestalTask.h.

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

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

Definition at line 41 of file PedestalTask.h.

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