CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
ecaldqm::PedestalTask Class Reference

#include <PedestalTask.h>

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

Public Member Functions

bool analyze (void const *, Collections) override
 
bool filterRunType (short const *) override
 
 PedestalTask ()
 
template<typename DigiCollection >
void runOnDigis (DigiCollection const &)
 
void runOnPnDigis (EcalPnDiodeDigiCollection const &)
 
 ~PedestalTask () override
 
- Public Member Functions inherited from ecaldqm::DQWorkerTask
virtual void addDependencies (DependencySet &)
 
virtual void beginEvent (edm::Event const &, edm::EventSetup const &)
 
 DQWorkerTask ()
 
virtual void endEvent (edm::Event const &, edm::EventSetup const &)
 
virtual bool filterTrigger (edm::TriggerResultsByName const &)
 
virtual void setTokens (edm::ConsumesCollector &)
 
 ~DQWorkerTask () override
 
- Public Member Functions inherited from ecaldqm::DQWorker
virtual void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void beginRun (edm::Run const &, edm::EventSetup const &)
 
virtual void bookMEs (DQMStore::IBooker &)
 
 DQWorker ()
 
virtual void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void endRun (edm::Run const &, edm::EventSetup const &)
 
std::string const & getName () const
 
bool onlineMode () const
 
virtual void releaseMEs ()
 
void setEventNumber (edm::EventNumber_t _e)
 
void setLumiNumber (edm::LuminosityBlockNumber_t _l)
 
void setRunNumber (edm::RunNumber_t _r)
 
void setTime (time_t _t)
 
virtual ~DQWorker ()(false)
 

Private Member Functions

void setParams (edm::ParameterSet const &) override
 

Private Attributes

bool enable_ [nDCC]
 
std::map< int, unsigned > gainToME_
 
std::map< int, unsigned > pnGainToME_
 

Additional Inherited Members

- Public Types inherited from ecaldqm::DQWorkerTask
typedef EcalDCCHeaderBlock::EcalDCCEventSettings EventSettings
 
- Static Public Member Functions inherited from ecaldqm::DQWorkerTask
static void fillDescriptions (edm::ParameterSetDescription &)
 
- Static Public Member Functions inherited from ecaldqm::DQWorker
static void fillDescriptions (edm::ParameterSetDescription &_desc)
 
- Protected Types inherited from ecaldqm::DQWorker
typedef dqm::legacy::DQMStore DQMStore
 
typedef dqm::legacy::MonitorElement MonitorElement
 
- Protected Member Functions inherited from ecaldqm::DQWorkerTask
void setME (edm::ParameterSet const &) final
 
- Protected Member Functions inherited from ecaldqm::DQWorker
void initialize (std::string const &_name, edm::ParameterSet const &)
 
void print_ (std::string const &, int=0) const
 
virtual void setSource (edm::ParameterSet const &)
 
void setVerbosity (int _verbosity)
 
- Protected Attributes inherited from ecaldqm::DQWorker
bool booked_
 
MESetCollection MEs_
 
std::string name_
 
bool onlineMode_
 
Timestamp timestamp_
 
int verbosity_
 
bool willConvertToEDM_
 

Detailed Description

Definition at line 12 of file PedestalTask.h.

Constructor & Destructor Documentation

PedestalTask::PedestalTask ( )

Definition at line 13 of file PedestalTask.cc.

References enable_, and ecaldqm::nDCC.

13 : DQWorkerTask(), gainToME_(), pnGainToME_() { std::fill_n(enable_, nDCC, false); }
std::map< int, unsigned > gainToME_
Definition: PedestalTask.h:28
std::map< int, unsigned > pnGainToME_
Definition: PedestalTask.h:29
ecaldqm::PedestalTask::~PedestalTask ( )
inlineoverride

Member Function Documentation

bool PedestalTask::analyze ( void const *  _p,
Collections  _collection 
)
inlineoverridevirtual

Reimplemented from ecaldqm::DQWorkerTask.

Definition at line 34 of file PedestalTask.h.

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

Referenced by ~PedestalTask().

34  {
35  switch (_collection) {
36  case kEBDigi:
37  if (_p)
38  runOnDigis(*static_cast<EBDigiCollection const*>(_p));
39  return true;
40  break;
41  case kEEDigi:
42  if (_p)
43  runOnDigis(*static_cast<EEDigiCollection const*>(_p));
44  return true;
45  break;
46  case kPnDiodeDigi:
47  if (_p)
48  runOnPnDigis(*static_cast<EcalPnDiodeDigiCollection const*>(_p));
49  return true;
50  break;
51  default:
52  break;
53  }
54 
55  return false;
56  }
void runOnPnDigis(EcalPnDiodeDigiCollection const &)
void runOnDigis(DigiCollection const &)
Definition: PedestalTask.cc:59
bool PedestalTask::filterRunType ( short const *  _runType)
overridevirtual

Reimplemented from ecaldqm::DQWorkerTask.

Definition at line 44 of file PedestalTask.cc.

References Reconstruction_hiPF_cff::enable, enable_, ecaldqm::nDCC, EcalDCCHeaderBlock::PEDESTAL_GAP, and EcalDCCHeaderBlock::PEDESTAL_STD.

Referenced by ~PedestalTask().

44  {
45  bool enable(false);
46 
47  for (int iFED(0); iFED < nDCC; iFED++) {
48  if (_runType[iFED] == EcalDCCHeaderBlock::PEDESTAL_STD || _runType[iFED] == EcalDCCHeaderBlock::PEDESTAL_GAP) {
49  enable = true;
50  enable_[iFED] = true;
51  } else
52  enable_[iFED] = false;
53  }
54 
55  return enable;
56  }
template<typename DigiCollection >
void PedestalTask::runOnDigis ( DigiCollection const &  _digis)

Definition at line 59 of file PedestalTask.cc.

References EcalMGPASample::adc(), ecaldqm::dccId(), enable_, ecaldqm::MESetMulti::fill(), PedestalClient_cfi::gain, EcalMGPASample::gainId(), gainToME_, triggerObjects_cff::id, EcalDataFrame::MAXSAMPLES, ecaldqm::DQWorker::MEs_, and EcalDataFrame::sample().

Referenced by analyze(), and ~PedestalTask().

59  {
60  MESet& mePedestal(MEs_.at("Pedestal"));
61  MESet& meOccupancy(MEs_.at("Occupancy"));
62 
63  unsigned iME(-1);
64 
65  for (typename DigiCollection::const_iterator digiItr(_digis.begin()); digiItr != _digis.end(); ++digiItr) {
66  DetId id(digiItr->id());
67 
68  int iDCC(dccId(id) - 1);
69 
70  if (!enable_[iDCC])
71  continue;
72 
73  // EcalDataFrame is not a derived class of edm::DataFrame, but can take edm::DataFrame in the constructor
74  EcalDataFrame dataFrame(*digiItr);
75 
76  int gain(0);
77  switch (dataFrame.sample(0).gainId()) {
78  case 1:
79  gain = 12;
80  break;
81  case 2:
82  gain = 6;
83  break;
84  case 3:
85  gain = 1;
86  break;
87  default:
88  continue;
89  }
90 
91  if (gainToME_.find(gain) == gainToME_.end())
92  continue;
93 
94  if (iME != gainToME_[gain]) {
95  iME = gainToME_[gain];
96  static_cast<MESetMulti&>(mePedestal).use(iME);
97  }
98 
99  meOccupancy.fill(id);
100 
101  for (int iSample(0); iSample < EcalDataFrame::MAXSAMPLES; iSample++)
102  mePedestal.fill(id, double(dataFrame.sample(iSample).adc()));
103  }
104  }
std::map< int, unsigned > gainToME_
Definition: PedestalTask.h:28
Definition: DetId.h:17
MESetCollection MEs_
Definition: DQWorker.h:78
static constexpr int MAXSAMPLES
Definition: EcalDataFrame.h:48
unsigned dccId(DetId const &)
void PedestalTask::runOnPnDigis ( EcalPnDiodeDigiCollection const &  _digis)

Definition at line 106 of file PedestalTask.cc.

References edm::SortedCollection< T, SORT >::begin(), ecaldqm::dccId(), DEFINE_ECALDQM_WORKER, enable_, edm::SortedCollection< T, SORT >::end(), ecaldqm::MESetMulti::fill(), PedestalClient_cfi::gain, triggerObjects_cff::id, ecaldqm::DQWorker::MEs_, and pnGainToME_.

Referenced by analyze(), and ~PedestalTask().

106  {
107  MESet& mePNPedestal(MEs_.at("PNPedestal"));
108 
109  unsigned iME(-1);
110 
111  for (EcalPnDiodeDigiCollection::const_iterator digiItr(_digis.begin()); digiItr != _digis.end(); ++digiItr) {
112  EcalPnDiodeDetId id(digiItr->id());
113 
114  int iDCC(dccId(id) - 1);
115 
116  if (!enable_[iDCC])
117  continue;
118 
119  int gain(0);
120  switch (digiItr->sample(0).gainId()) {
121  case 0:
122  gain = 1;
123  break;
124  case 1:
125  gain = 16;
126  break;
127  default:
128  continue;
129  }
130 
131  if (pnGainToME_.find(gain) == pnGainToME_.end())
132  continue;
133 
134  if (iME != pnGainToME_[gain]) {
135  iME = pnGainToME_[gain];
136  static_cast<MESetMulti&>(mePNPedestal).use(iME);
137  }
138 
139  for (int iSample(0); iSample < 50; iSample++)
140  mePNPedestal.fill(id, double(digiItr->sample(iSample).adc()));
141  }
142  }
std::vector< T >::const_iterator const_iterator
std::map< int, unsigned > pnGainToME_
Definition: PedestalTask.h:29
MESetCollection MEs_
Definition: DQWorker.h:78
unsigned dccId(DetId const &)
void PedestalTask::setParams ( edm::ParameterSet const &  _params)
overrideprivatevirtual

Reimplemented from ecaldqm::DQWorker.

Definition at line 15 of file PedestalTask.cc.

References Exception, PedestalClient_cfi::gain, gainToME_, ecaldqm::MESetMulti::getIndex(), edm::ParameterSet::getUntrackedParameter(), ecaldqm::DQWorker::MEs_, PedestalClient_cfi::MGPAGains, PedestalClient_cfi::MGPAGainsPN, EcalCondDBWriter_cfi::pedestal, and pnGainToME_.

Referenced by ~PedestalTask().

15  {
16  std::vector<int> MGPAGains(_params.getUntrackedParameter<std::vector<int> >("MGPAGains"));
17  std::vector<int> MGPAGainsPN(_params.getUntrackedParameter<std::vector<int> >("MGPAGainsPN"));
18 
20 
21  MESetMulti& pedestal(static_cast<MESetMulti&>(MEs_.at("Pedestal")));
22  unsigned nG(MGPAGains.size());
23  for (unsigned iG(0); iG != nG; ++iG) {
24  int gain(MGPAGains[iG]);
25  if (gain != 1 && gain != 6 && gain != 12)
26  throw cms::Exception("InvalidConfiguration") << "MGPA gain";
27  repl["gain"] = std::to_string(gain);
28  gainToME_[gain] = pedestal.getIndex(repl);
29  }
30 
31  repl.clear();
32 
33  MESetMulti& pnPedestal(static_cast<MESetMulti&>(MEs_.at("PNPedestal")));
34  unsigned nGPN(MGPAGainsPN.size());
35  for (unsigned iG(0); iG != nGPN; ++iG) {
36  int gain(MGPAGainsPN[iG]);
37  if (gain != 1 && gain != 16)
38  throw cms::Exception("InvalidConfiguration") << "PN MGPA gain";
39  repl["pngain"] = std::to_string(gain);
40  pnGainToME_[gain] = pnPedestal.getIndex(repl);
41  }
42  }
std::map< int, unsigned > gainToME_
Definition: PedestalTask.h:28
std::map< int, unsigned > pnGainToME_
Definition: PedestalTask.h:29
MESetCollection MEs_
Definition: DQWorker.h:78
std::map< std::string, std::string > PathReplacements
Definition: MESet.h:31

Member Data Documentation

bool ecaldqm::PedestalTask::enable_[nDCC]
private

Definition at line 31 of file PedestalTask.h.

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

std::map<int, unsigned> ecaldqm::PedestalTask::gainToME_
private

Definition at line 28 of file PedestalTask.h.

Referenced by runOnDigis(), and setParams().

std::map<int, unsigned> ecaldqm::PedestalTask::pnGainToME_
private

Definition at line 29 of file PedestalTask.h.

Referenced by runOnPnDigis(), and setParams().