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 &, bool const &, bool &)
 
 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 &)
 
bool checkElectronicsMap (bool=true)
 
bool checkGeometry (bool=true)
 
bool checkTopology (bool=true)
 
bool checkTrigTowerMap (bool=true)
 
 DQWorker ()
 
virtual void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void endRun (edm::Run const &, edm::EventSetup const &)
 
EcalDQMSetupObjects const getEcalDQMSetupObjects ()
 
EcalElectronicsMapping const * GetElectronicsMap ()
 
CaloGeometry const * GetGeometry ()
 
std::string const & getName () const
 
CaloTopology const * GetTopology ()
 
EcalTrigTowerConstituentsMap const * GetTrigTowerMap ()
 
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 setSetupObjects (edm::EventSetup const &)
 
void setSetupObjectsEndLumi (edm::EventSetup const &)
 
void setTime (time_t _t)
 
void setTokens (edm::ConsumesCollector &)
 
virtual ~DQWorker () noexcept(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)
 
- Public Attributes inherited from ecaldqm::DQWorker
edm::ESGetToken< EcalElectronicsMapping, EcalMappingRcdelecMapHandle
 
edm::ESGetToken< EcalElectronicsMapping, EcalMappingRcdelecMapHandleEndLumi
 
edm::ESGetToken< CaloGeometry, CaloGeometryRecordgeomHandle
 
edm::ESGetToken< CaloGeometry, CaloGeometryRecordgeomHandleEndLumi
 
edm::ESGetToken< CaloTopology, CaloTopologyRecordtopoHandle
 
edm::ESGetToken< CaloTopology, CaloTopologyRecordtopoHandleEndLumi
 
edm::ESGetToken< EcalTrigTowerConstituentsMap, IdealGeometryRecordttMapHandle
 
edm::ESGetToken< EcalTrigTowerConstituentsMap, IdealGeometryRecordttMapHandleEndLumi
 
- 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::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

◆ ~PedestalTask()

ecaldqm::PedestalTask::~PedestalTask ( )
inlineoverride

Definition at line 15 of file PedestalTask.h.

15 {}

Member Function Documentation

◆ analyze()

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

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

◆ filterRunType()

bool PedestalTask::filterRunType ( short const *  _runType)
overridevirtual

Reimplemented from ecaldqm::DQWorkerTask.

Definition at line 44 of file PedestalTask.cc.

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

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  }

◆ runOnDigis()

template<typename DigiCollection >
void PedestalTask::runOnDigis ( DigiCollection const &  _digis)

Definition at line 59 of file PedestalTask.cc.

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

Referenced by analyze().

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, GetElectronicsMap()) - 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(getEcalDQMSetupObjects(), id);
100 
101  for (int iSample(0); iSample < EcalDataFrame::MAXSAMPLES; iSample++)
102  mePedestal.fill(getEcalDQMSetupObjects(), id, double(dataFrame.sample(iSample).adc()));
103  }
104  }
MESet & at(const std::string &key)
Definition: MESet.h:399
std::map< int, unsigned > gainToME_
Definition: PedestalTask.h:28
unsigned dccId(DetId const &, EcalElectronicsMapping const *)
EcalElectronicsMapping const * GetElectronicsMap()
Definition: DQWorker.cc:150
EcalDQMSetupObjects const getEcalDQMSetupObjects()
Definition: DQWorker.cc:170
Definition: DetId.h:17
MESetCollection MEs_
Definition: DQWorker.h:131
static constexpr int MAXSAMPLES
Definition: EcalDataFrame.h:48

◆ runOnPnDigis()

void PedestalTask::runOnPnDigis ( EcalPnDiodeDigiCollection const &  _digis)

Definition at line 106 of file PedestalTask.cc.

References ecaldqm::MESetCollection::at(), edm::SortedCollection< T, SORT >::begin(), ecaldqm::dccId(), enable_, edm::SortedCollection< T, SORT >::end(), ecaldqm::MESetMulti::fill(), PedestalClient_cfi::gain, ecaldqm::DQWorker::getEcalDQMSetupObjects(), ecaldqm::DQWorker::GetElectronicsMap(), l1ctLayer2EG_cff::id, ecaldqm::DQWorker::MEs_, and pnGainToME_.

Referenced by analyze().

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, GetElectronicsMap()) - 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(getEcalDQMSetupObjects(), id, double(digiItr->sample(iSample).adc()));
141  }
142  }
MESet & at(const std::string &key)
Definition: MESet.h:399
std::vector< T >::const_iterator const_iterator
unsigned dccId(DetId const &, EcalElectronicsMapping const *)
EcalElectronicsMapping const * GetElectronicsMap()
Definition: DQWorker.cc:150
EcalDQMSetupObjects const getEcalDQMSetupObjects()
Definition: DQWorker.cc:170
std::map< int, unsigned > pnGainToME_
Definition: PedestalTask.h:29
MESetCollection MEs_
Definition: DQWorker.h:131

◆ setParams()

void PedestalTask::setParams ( edm::ParameterSet const &  _params)
overrideprivatevirtual

Reimplemented from ecaldqm::DQWorker.

Definition at line 15 of file PedestalTask.cc.

References l1extraParticles_cfi::_params, ecaldqm::MESetCollection::at(), Exception, PedestalClient_cfi::gain, gainToME_, ecaldqm::MESetMulti::getIndex(), ecaldqm::DQWorker::MEs_, PedestalClient_cfi::MGPAGains, PedestalClient_cfi::MGPAGainsPN, EcalCondDBWriter_cfi::pedestal, pnGainToME_, and cond::impl::to_string().

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  }
MESet & at(const std::string &key)
Definition: MESet.h:399
std::string to_string(const V &value)
Definition: OMSAccess.h:77
std::map< int, unsigned > gainToME_
Definition: PedestalTask.h:28
std::map< int, unsigned > pnGainToME_
Definition: PedestalTask.h:29
MESetCollection MEs_
Definition: DQWorker.h:131
std::map< std::string, std::string > PathReplacements
Definition: MESet.h:46

Member Data Documentation

◆ enable_

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

Definition at line 31 of file PedestalTask.h.

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

◆ gainToME_

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

Definition at line 28 of file PedestalTask.h.

Referenced by runOnDigis(), and setParams().

◆ pnGainToME_

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

Definition at line 29 of file PedestalTask.h.

Referenced by runOnPnDigis(), and setParams().