CMS 3D CMS Logo

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

#include <TestPulseTask.h>

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

Public Member Functions

void addDependencies (DependencySet &) override
 
bool analyze (void const *, Collections) override
 
bool filterRunType (short const *) override
 
template<typename DigiCollection >
void runOnDigis (DigiCollection const &)
 
void runOnPnDigis (EcalPnDiodeDigiCollection const &)
 
void runOnRawData (EcalRawDataCollection const &)
 
void runOnUncalibRecHits (EcalUncalibratedRecHitCollection const &)
 
 TestPulseTask ()
 
 ~TestPulseTask () override
 
- Public Member Functions inherited from ecaldqm::DQWorkerTask
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 &)
 
 DQWorker ()
 
virtual void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void endRun (edm::Run const &, edm::EventSetup const &)
 
const EcalDQMSetupObjects getEcalDQMSetupObjects ()
 
const EcalElectronicsMappingGetElectronicsMap ()
 
const CaloGeometryGetGeometry ()
 
const std::string & getName () const
 
const CaloTopologyGetTopology ()
 
const EcalTrigTowerConstituentsMapGetTrigTowerMap ()
 
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]
 
int gain_ [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 14 of file TestPulseTask.h.

Constructor & Destructor Documentation

◆ TestPulseTask()

ecaldqm::TestPulseTask::TestPulseTask ( )

Definition at line 15 of file TestPulseTask.cc.

16  std::fill_n(enable_, nDCC, false);
17  std::fill_n(gain_, nDCC, 0);
18  }

References enable_, gain_, and ecaldqm::nDCC.

◆ ~TestPulseTask()

ecaldqm::TestPulseTask::~TestPulseTask ( )
inlineoverride

Definition at line 17 of file TestPulseTask.h.

17 {}

Member Function Documentation

◆ addDependencies()

void ecaldqm::TestPulseTask::addDependencies ( DependencySet _dependencies)
overridevirtual

Reimplemented from ecaldqm::DQWorkerTask.

Definition at line 49 of file TestPulseTask.cc.

49  {
50  _dependencies.push_back(Dependency(kEBTestPulseUncalibRecHit, kEcalRawData));
51  _dependencies.push_back(Dependency(kEETestPulseUncalibRecHit, kEcalRawData));
52  }

References ecaldqm::kEBTestPulseUncalibRecHit, ecaldqm::kEcalRawData, ecaldqm::kEETestPulseUncalibRecHit, and ecaldqm::DependencySet::push_back().

◆ analyze()

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

Reimplemented from ecaldqm::DQWorkerTask.

Definition at line 41 of file TestPulseTask.h.

41  {
42  switch (_collection) {
43  case kEcalRawData:
44  if (_p)
45  runOnRawData(*static_cast<EcalRawDataCollection const*>(_p));
46  return true;
47  break;
48  case kEBDigi:
49  if (_p)
50  runOnDigis(*static_cast<EBDigiCollection const*>(_p));
51  return true;
52  break;
53  case kEEDigi:
54  if (_p)
55  runOnDigis(*static_cast<EEDigiCollection const*>(_p));
56  return true;
57  break;
58  case kPnDiodeDigi:
59  if (_p)
60  runOnPnDigis(*static_cast<EcalPnDiodeDigiCollection const*>(_p));
61  return true;
62  break;
65  if (_p)
66  runOnUncalibRecHits(*static_cast<EcalUncalibratedRecHitCollection const*>(_p));
67  return true;
68  break;
69  default:
70  break;
71  }
72  return false;
73  }

References ecaldqm::kEBDigi, ecaldqm::kEBTestPulseUncalibRecHit, ecaldqm::kEcalRawData, ecaldqm::kEEDigi, ecaldqm::kEETestPulseUncalibRecHit, ecaldqm::kPnDiodeDigi, runOnDigis(), runOnPnDigis(), runOnRawData(), and runOnUncalibRecHits().

◆ filterRunType()

bool ecaldqm::TestPulseTask::filterRunType ( short const *  _runType)
overridevirtual

Reimplemented from ecaldqm::DQWorkerTask.

Definition at line 54 of file TestPulseTask.cc.

54  {
55  bool enable(false);
56 
57  for (int iFED(0); iFED < nDCC; iFED++) {
58  if (_runType[iFED] == EcalDCCHeaderBlock::TESTPULSE_MGPA || _runType[iFED] == EcalDCCHeaderBlock::TESTPULSE_GAP) {
59  enable = true;
60  enable_[iFED] = true;
61  } else
62  enable_[iFED] = false;
63  }
64 
65  return enable;
66  }

References remoteMonitoring_LED_IterMethod_cfg::enable, enable_, ecaldqm::nDCC, EcalDCCHeaderBlock::TESTPULSE_GAP, and EcalDCCHeaderBlock::TESTPULSE_MGPA.

◆ runOnDigis()

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

Definition at line 96 of file TestPulseTask.cc.

96  {
97  MESet& meOccupancy(MEs_.at("Occupancy"));
98  MESet& meShape(MEs_.at("Shape"));
99 
100  unsigned iME(-1);
101 
102  for (typename DigiCollection::const_iterator digiItr(_digis.begin()); digiItr != _digis.end(); ++digiItr) {
103  DetId id(digiItr->id());
104 
105  meOccupancy.fill(getEcalDQMSetupObjects(), id);
106 
107  int iDCC(dccId(id, GetElectronicsMap()) - 1);
108 
109  if (!enable_[iDCC])
110  continue;
111 
112  // EcalDataFrame is not a derived class of edm::DataFrame, but can take edm::DataFrame in the constructor
113  EcalDataFrame dataFrame(*digiItr);
114 
115  if (iME != gainToME_[gain_[iDCC]]) {
116  iME = gainToME_[gain_[iDCC]];
117  static_cast<MESetMulti&>(meShape).use(iME);
118  }
119 
120  for (int iSample(0); iSample < 10; iSample++)
121  meShape.fill(getEcalDQMSetupObjects(), id, iSample + 0.5, float(dataFrame.sample(iSample).adc()));
122  }
123  }

References EcalMGPASample::adc(), ecaldqm::MESetCollection::at(), ecaldqm::dccId(), enable_, gain_, gainToME_, ecaldqm::DQWorker::getEcalDQMSetupObjects(), ecaldqm::DQWorker::GetElectronicsMap(), triggerObjects_cff::id, ecaldqm::DQWorker::MEs_, and EcalDataFrame::sample().

Referenced by analyze().

◆ runOnPnDigis()

void ecaldqm::TestPulseTask::runOnPnDigis ( EcalPnDiodeDigiCollection const &  _digis)

Definition at line 125 of file TestPulseTask.cc.

125  {
126  MESet& mePNAmplitude(MEs_.at("PNAmplitude"));
127 
128  unsigned iME(-1);
129 
130  for (EcalPnDiodeDigiCollection::const_iterator digiItr(_digis.begin()); digiItr != _digis.end(); ++digiItr) {
131  EcalPnDiodeDetId const& id(digiItr->id());
132 
133  int iDCC(dccId(id, GetElectronicsMap()) - 1);
134 
135  if (!enable_[iDCC])
136  continue;
137 
138  int gain(0);
139  switch (digiItr->sample(0).gainId()) {
140  case 0:
141  gain = 1;
142  break;
143  case 1:
144  gain = 16;
145  break;
146  default:
147  continue;
148  }
149 
150  if (pnGainToME_.find(gain) == pnGainToME_.end())
151  continue;
152 
153  if (iME != pnGainToME_[gain]) {
154  iME = pnGainToME_[gain];
155  static_cast<MESetMulti&>(mePNAmplitude).use(iME);
156  }
157 
158  float pedestal(0.);
159  for (int iSample(0); iSample < 4; iSample++)
160  pedestal += digiItr->sample(iSample).adc();
161  pedestal /= 4.;
162 
163  float max(0.);
164  for (int iSample(0); iSample < 50; iSample++)
165  if (digiItr->sample(iSample).adc() > max)
166  max = digiItr->sample(iSample).adc();
167 
168  double amplitude(max - pedestal);
169 
170  mePNAmplitude.fill(getEcalDQMSetupObjects(), id, amplitude);
171  }
172  }

References CustomPhysics_cfi::amplitude, ecaldqm::MESetCollection::at(), edm::SortedCollection< T, SORT >::begin(), ecaldqm::dccId(), enable_, edm::SortedCollection< T, SORT >::end(), PedestalClient_cfi::gain, ecaldqm::DQWorker::getEcalDQMSetupObjects(), ecaldqm::DQWorker::GetElectronicsMap(), triggerObjects_cff::id, SiStripPI::max, ecaldqm::DQWorker::MEs_, EcalCondDBWriter_cfi::pedestal, and pnGainToME_.

Referenced by analyze().

◆ runOnRawData()

void ecaldqm::TestPulseTask::runOnRawData ( EcalRawDataCollection const &  _rawData)

Definition at line 68 of file TestPulseTask.cc.

68  {
69  for (EcalRawDataCollection::const_iterator rItr(_rawData.begin()); rItr != _rawData.end(); ++rItr) {
70  unsigned iDCC(rItr->id() - 1);
71 
72  if (!enable_[iDCC]) {
73  gain_[iDCC] = 0;
74  continue;
75  }
76  switch (rItr->getMgpaGain()) {
77  case 1:
78  gain_[iDCC] = 12;
79  break;
80  case 2:
81  gain_[iDCC] = 6;
82  break;
83  case 3:
84  gain_[iDCC] = 1;
85  break;
86  default:
87  break;
88  }
89 
90  if (gainToME_.find(gain_[iDCC]) == gainToME_.end())
91  enable_[iDCC] = false;
92  }
93  }

References edm::SortedCollection< T, SORT >::begin(), enable_, edm::SortedCollection< T, SORT >::end(), gain_, and gainToME_.

Referenced by analyze().

◆ runOnUncalibRecHits()

void ecaldqm::TestPulseTask::runOnUncalibRecHits ( EcalUncalibratedRecHitCollection const &  _uhits)

Definition at line 174 of file TestPulseTask.cc.

174  {
175  MESet& meAmplitude(MEs_.at("Amplitude"));
176 
177  unsigned iME(-1);
178 
179  for (EcalUncalibratedRecHitCollection::const_iterator uhitItr(_uhits.begin()); uhitItr != _uhits.end(); ++uhitItr) {
180  DetId id(uhitItr->id());
181 
182  int iDCC(dccId(id, GetElectronicsMap()) - 1);
183 
184  if (!enable_[iDCC])
185  continue;
186 
187  if (iME != gainToME_[gain_[iDCC]]) {
188  iME = gainToME_[gain_[iDCC]];
189  static_cast<MESetMulti&>(meAmplitude).use(iME);
190  }
191 
192  meAmplitude.fill(getEcalDQMSetupObjects(), id, uhitItr->amplitude());
193  }
194  }

References ecaldqm::MESetCollection::at(), edm::SortedCollection< T, SORT >::begin(), ecaldqm::dccId(), enable_, edm::SortedCollection< T, SORT >::end(), gain_, gainToME_, ecaldqm::DQWorker::getEcalDQMSetupObjects(), ecaldqm::DQWorker::GetElectronicsMap(), triggerObjects_cff::id, and ecaldqm::DQWorker::MEs_.

Referenced by analyze().

◆ setParams()

void ecaldqm::TestPulseTask::setParams ( edm::ParameterSet const &  _params)
overrideprivatevirtual

Reimplemented from ecaldqm::DQWorker.

Definition at line 20 of file TestPulseTask.cc.

20  {
21  std::vector<int> MGPAGains(_params.getUntrackedParameter<std::vector<int> >("MGPAGains"));
22  std::vector<int> MGPAGainsPN(_params.getUntrackedParameter<std::vector<int> >("MGPAGainsPN"));
23 
25 
26  MESetMulti& amplitude(static_cast<MESetMulti&>(MEs_.at("Amplitude")));
27  unsigned nG(MGPAGains.size());
28  for (unsigned iG(0); iG != nG; ++iG) {
29  int gain(MGPAGains[iG]);
30  if (gain != 1 && gain != 6 && gain != 12)
31  throw cms::Exception("InvalidConfiguration") << "MGPA gain";
32  repl["gain"] = std::to_string(gain);
33  gainToME_[gain] = amplitude.getIndex(repl);
34  }
35 
36  repl.clear();
37 
38  MESetMulti& pnAmplitude(static_cast<MESetMulti&>(MEs_.at("PNAmplitude")));
39  unsigned nGPN(MGPAGainsPN.size());
40  for (unsigned iG(0); iG != nGPN; ++iG) {
41  int gain(MGPAGainsPN[iG]);
42  if (gain != 1 && gain != 16)
43  throw cms::Exception("InvalidConfiguration") << "PN MGPA gain";
44  repl["pngain"] = std::to_string(gain);
45  pnGainToME_[gain] = pnAmplitude.getIndex(repl);
46  }
47  }

References l1extraParticles_cfi::_params, CustomPhysics_cfi::amplitude, ecaldqm::MESetCollection::at(), Exception, PedestalClient_cfi::gain, gainToME_, ecaldqm::MESetMulti::getIndex(), ecaldqm::DQWorker::MEs_, PedestalClient_cfi::MGPAGains, PedestalClient_cfi::MGPAGainsPN, and pnGainToME_.

Member Data Documentation

◆ enable_

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

◆ gain_

int ecaldqm::TestPulseTask::gain_[nDCC]
private

Definition at line 38 of file TestPulseTask.h.

Referenced by runOnDigis(), runOnRawData(), runOnUncalibRecHits(), and TestPulseTask().

◆ gainToME_

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

Definition at line 34 of file TestPulseTask.h.

Referenced by runOnDigis(), runOnRawData(), runOnUncalibRecHits(), and setParams().

◆ pnGainToME_

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

Definition at line 35 of file TestPulseTask.h.

Referenced by runOnPnDigis(), and setParams().

ecaldqm::kEBTestPulseUncalibRecHit
Definition: Collections.h:34
ecaldqm::TestPulseTask::runOnUncalibRecHits
void runOnUncalibRecHits(EcalUncalibratedRecHitCollection const &)
Definition: TestPulseTask.cc:174
CustomPhysics_cfi.amplitude
amplitude
Definition: CustomPhysics_cfi.py:12
edm::SortedCollection::const_iterator
std::vector< T >::const_iterator const_iterator
Definition: SortedCollection.h:80
ecaldqm::TestPulseTask::gain_
int gain_[nDCC]
Definition: TestPulseTask.h:38
remoteMonitoring_LED_IterMethod_cfg.enable
enable
Definition: remoteMonitoring_LED_IterMethod_cfg.py:423
ecaldqm::kEEDigi
Definition: Collections.h:26
ecaldqm::MESet::PathReplacements
std::map< std::string, std::string > PathReplacements
Definition: MESet.h:46
ecaldqm::TestPulseTask::runOnPnDigis
void runOnPnDigis(EcalPnDiodeDigiCollection const &)
Definition: TestPulseTask.cc:125
l1extraParticles_cfi._params
_params
Definition: l1extraParticles_cfi.py:29
EcalPnDiodeDetId
Definition: EcalPnDiodeDetId.h:22
ecaldqm::kEcalRawData
Definition: Collections.h:10
EcalDataFrame
Definition: EcalDataFrame.h:16
ecaldqm::DQWorker::GetElectronicsMap
const EcalElectronicsMapping * GetElectronicsMap()
Definition: DQWorker.cc:118
EcalDCCHeaderBlock::TESTPULSE_GAP
Definition: EcalDCCHeaderBlock.h:43
ecaldqm::kEETestPulseUncalibRecHit
Definition: Collections.h:35
DetId
Definition: DetId.h:17
PedestalClient_cfi.MGPAGainsPN
MGPAGainsPN
Definition: PedestalClient_cfi.py:27
ecaldqm::DQWorkerTask::DQWorkerTask
DQWorkerTask()
Definition: DQWorkerTask.cc:8
ecaldqm::TestPulseTask::runOnDigis
void runOnDigis(DigiCollection const &)
Definition: TestPulseTask.cc:96
EcalDCCHeaderBlock::TESTPULSE_MGPA
Definition: EcalDCCHeaderBlock.h:30
ecaldqm::DQWorker::MEs_
MESetCollection MEs_
Definition: DQWorker.h:125
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
ecaldqm::MESetCollection::at
MESet & at(const std::string &key)
Definition: MESet.h:399
ecaldqm::kPnDiodeDigi
Definition: Collections.h:27
PedestalClient_cfi.MGPAGains
MGPAGains
Definition: PedestalClient_cfi.py:26
ecaldqm::TestPulseTask::enable_
bool enable_[nDCC]
Definition: TestPulseTask.h:37
EcalCondDBWriter_cfi.pedestal
pedestal
Definition: EcalCondDBWriter_cfi.py:49
ecaldqm::TestPulseTask::runOnRawData
void runOnRawData(EcalRawDataCollection const &)
Definition: TestPulseTask.cc:68
ecaldqm::dccId
unsigned dccId(DetId const &, EcalElectronicsMapping const *)
Definition: EcalDQMCommonUtils.cc:16
PedestalClient_cfi.gain
gain
Definition: PedestalClient_cfi.py:37
ecaldqm::DQWorker::getEcalDQMSetupObjects
const EcalDQMSetupObjects getEcalDQMSetupObjects()
Definition: DQWorker.cc:142
ecaldqm::kEBDigi
Definition: Collections.h:25
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
Exception
Definition: hltDiff.cc:245
ecaldqm::nDCC
Definition: EcalDQMCommonUtils.h:91
ecaldqm::TestPulseTask::pnGainToME_
std::map< int, unsigned > pnGainToME_
Definition: TestPulseTask.h:35
ecaldqm::TestPulseTask::gainToME_
std::map< int, unsigned > gainToME_
Definition: TestPulseTask.h:34