CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 &)
 
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]
 
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,
EcalMappingRcd
elecMapHandle
 
edm::ESGetToken
< EcalElectronicsMapping,
EcalMappingRcd
elecMapHandleEndLumi
 
edm::ESGetToken< CaloGeometry,
CaloGeometryRecord
geomHandle
 
edm::ESGetToken< CaloGeometry,
CaloGeometryRecord
geomHandleEndLumi
 
edm::ESGetToken< CaloTopology,
CaloTopologyRecord
topoHandle
 
edm::ESGetToken< CaloTopology,
CaloTopologyRecord
topoHandleEndLumi
 
edm::ESGetToken
< EcalTrigTowerConstituentsMap,
IdealGeometryRecord
ttMapHandle
 
edm::ESGetToken
< EcalTrigTowerConstituentsMap,
IdealGeometryRecord
ttMapHandleEndLumi
 
- 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

ecaldqm::TestPulseTask::TestPulseTask ( )

Definition at line 15 of file TestPulseTask.cc.

References enable_, gain_, and ecaldqm::nDCC.

16  std::fill_n(enable_, nDCC, false);
17  std::fill_n(gain_, nDCC, 0);
18  }
std::map< int, unsigned > gainToME_
Definition: TestPulseTask.h:34
std::map< int, unsigned > pnGainToME_
Definition: TestPulseTask.h:35
ecaldqm::TestPulseTask::~TestPulseTask ( )
inlineoverride

Definition at line 17 of file TestPulseTask.h.

17 {}

Member Function Documentation

void ecaldqm::TestPulseTask::addDependencies ( DependencySet _dependencies)
overridevirtual
bool ecaldqm::TestPulseTask::analyze ( void const *  _p,
Collections  _collection 
)
inlineoverridevirtual

Reimplemented from ecaldqm::DQWorkerTask.

Definition at line 41 of file TestPulseTask.h.

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

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  }
void runOnDigis(DigiCollection const &)
void runOnPnDigis(EcalPnDiodeDigiCollection const &)
void runOnUncalibRecHits(EcalUncalibratedRecHitCollection const &)
void runOnRawData(EcalRawDataCollection const &)
bool ecaldqm::TestPulseTask::filterRunType ( short const *  _runType)
overridevirtual

Reimplemented from ecaldqm::DQWorkerTask.

Definition at line 54 of file TestPulseTask.cc.

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

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  }
template<typename DigiCollection >
void ecaldqm::TestPulseTask::runOnDigis ( DigiCollection const &  _digis)

Definition at line 96 of file TestPulseTask.cc.

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

Referenced by analyze().

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  }
uint16_t *__restrict__ id
MESet & at(const std::string &key)
Definition: MESet.h:399
std::map< int, unsigned > gainToME_
Definition: TestPulseTask.h:34
unsigned dccId(DetId const &, EcalElectronicsMapping const *)
EcalDQMSetupObjects const getEcalDQMSetupObjects()
Definition: DQWorker.cc:142
Definition: DetId.h:17
MESetCollection MEs_
Definition: DQWorker.h:125
EcalElectronicsMapping const * GetElectronicsMap()
Definition: DQWorker.cc:118
void ecaldqm::TestPulseTask::runOnPnDigis ( EcalPnDiodeDigiCollection const &  _digis)

Definition at line 125 of file TestPulseTask.cc.

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

Referenced by analyze().

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  }
uint16_t *__restrict__ id
MESet & at(const std::string &key)
Definition: MESet.h:399
std::vector< T >::const_iterator const_iterator
std::map< int, unsigned > pnGainToME_
Definition: TestPulseTask.h:35
unsigned dccId(DetId const &, EcalElectronicsMapping const *)
EcalDQMSetupObjects const getEcalDQMSetupObjects()
Definition: DQWorker.cc:142
MESetCollection MEs_
Definition: DQWorker.h:125
EcalElectronicsMapping const * GetElectronicsMap()
Definition: DQWorker.cc:118
void ecaldqm::TestPulseTask::runOnRawData ( EcalRawDataCollection const &  _rawData)

Definition at line 68 of file TestPulseTask.cc.

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

Referenced by analyze().

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  }
std::vector< T >::const_iterator const_iterator
std::map< int, unsigned > gainToME_
Definition: TestPulseTask.h:34
void ecaldqm::TestPulseTask::runOnUncalibRecHits ( EcalUncalibratedRecHitCollection const &  _uhits)

Definition at line 174 of file TestPulseTask.cc.

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

Referenced by analyze().

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  }
uint16_t *__restrict__ id
MESet & at(const std::string &key)
Definition: MESet.h:399
std::vector< T >::const_iterator const_iterator
std::map< int, unsigned > gainToME_
Definition: TestPulseTask.h:34
unsigned dccId(DetId const &, EcalElectronicsMapping const *)
EcalDQMSetupObjects const getEcalDQMSetupObjects()
Definition: DQWorker.cc:142
Definition: DetId.h:17
MESetCollection MEs_
Definition: DQWorker.h:125
EcalElectronicsMapping const * GetElectronicsMap()
Definition: DQWorker.cc:118
void ecaldqm::TestPulseTask::setParams ( edm::ParameterSet const &  _params)
overrideprivatevirtual

Reimplemented from ecaldqm::DQWorker.

Definition at line 20 of file TestPulseTask.cc.

References ecaldqm::MESetCollection::at(), Exception, gainToME_, ecaldqm::MESetMulti::getIndex(), edm::ParameterSet::getUntrackedParameter(), ecaldqm::DQWorker::MEs_, and pnGainToME_.

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  }
MESet & at(const std::string &key)
Definition: MESet.h:399
std::map< int, unsigned > gainToME_
Definition: TestPulseTask.h:34
std::map< int, unsigned > pnGainToME_
Definition: TestPulseTask.h:35
MESetCollection MEs_
Definition: DQWorker.h:125
std::map< std::string, std::string > PathReplacements
Definition: MESet.h:46

Member Data Documentation

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

Definition at line 38 of file TestPulseTask.h.

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

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

Definition at line 34 of file TestPulseTask.h.

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

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

Definition at line 35 of file TestPulseTask.h.

Referenced by runOnPnDigis(), and setParams().