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 ()
 
- Public Member Functions inherited from ecaldqm::DQWorkerTask
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 &)
 
void recoverStats ()
 
virtual void setTokens (edm::ConsumesCollector &)
 
void softReset ()
 
virtual ~DQWorkerTask ()
 
- 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]
 
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)
 
- 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::DQWorkerTask
std::set< std::string > resettable_
 
- 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 16 of file TestPulseTask.cc.

References enable_, gain_, and ecaldqm::nDCC.

16  :
17  DQWorkerTask(),
18  gainToME_(),
19  pnGainToME_()
20  {
21  std::fill_n(enable_, nDCC, false);
22  std::fill_n(gain_, nDCC, 0);
23  }
std::map< int, unsigned > gainToME_
Definition: TestPulseTask.h:33
std::map< int, unsigned > pnGainToME_
Definition: TestPulseTask.h:34
ecaldqm::TestPulseTask::~TestPulseTask ( )
inline

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 40 of file TestPulseTask.h.

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

Referenced by ~TestPulseTask().

40  {
41  switch(_collection){
42  case kEcalRawData:
43  if(_p) runOnRawData(*static_cast<EcalRawDataCollection const*>(_p));
44  return true;
45  break;
46  case kEBDigi:
47  if(_p) runOnDigis(*static_cast<EBDigiCollection const*>(_p));
48  return true;
49  break;
50  case kEEDigi:
51  if(_p) runOnDigis(*static_cast<EEDigiCollection const*>(_p));
52  return true;
53  break;
54  case kPnDiodeDigi:
55  if(_p) runOnPnDigis(*static_cast<EcalPnDiodeDigiCollection const*>(_p));
56  return true;
57  break;
60  if(_p) runOnUncalibRecHits(*static_cast<EcalUncalibratedRecHitCollection const*>(_p));
61  return true;
62  break;
63  default:
64  break;
65  }
66  return false;
67  }
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 62 of file TestPulseTask.cc.

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

Referenced by ~TestPulseTask().

63  {
64  bool enable(false);
65 
66  for(int iFED(0); iFED < nDCC; iFED++){
67  if(_runType[iFED] == EcalDCCHeaderBlock::TESTPULSE_MGPA ||
68  _runType[iFED] == EcalDCCHeaderBlock::TESTPULSE_GAP){
69  enable = true;
70  enable_[iFED] = true;
71  }
72  else
73  enable_[iFED] = false;
74  }
75 
76  return enable;
77  }
template<typename DigiCollection >
void ecaldqm::TestPulseTask::runOnDigis ( DigiCollection const &  _digis)

Definition at line 110 of file TestPulseTask.cc.

References EcalMGPASample::adc(), ecaldqm::dccId(), enable_, ecaldqm::MESetMulti::fill(), gain_, gainToME_, hcalTTPDigis_cfi::id, ecaldqm::DQWorker::MEs_, and EcalDataFrame::sample().

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

111  {
112  MESet& meOccupancy(MEs_.at("Occupancy"));
113  MESet& meShape(MEs_.at("Shape"));
114 
115  unsigned iME(-1);
116 
117  for(typename DigiCollection::const_iterator digiItr(_digis.begin()); digiItr != _digis.end(); ++digiItr){
118  DetId id(digiItr->id());
119 
120  meOccupancy.fill(id);
121 
122  int iDCC(dccId(id) - 1);
123 
124  if(!enable_[iDCC]) continue;
125 
126  // EcalDataFrame is not a derived class of edm::DataFrame, but can take edm::DataFrame in the constructor
127  EcalDataFrame dataFrame(*digiItr);
128 
129  if(iME != gainToME_[gain_[iDCC]]){
130  iME = gainToME_[gain_[iDCC]];
131  static_cast<MESetMulti&>(meShape).use(iME);
132  }
133 
134  for(int iSample(0); iSample < 10; iSample++)
135  meShape.fill(id, iSample + 0.5, float(dataFrame.sample(iSample).adc()));
136  }
137  }
std::map< int, unsigned > gainToME_
Definition: TestPulseTask.h:33
Definition: DetId.h:18
MESetCollection MEs_
Definition: DQWorker.h:75
unsigned dccId(DetId const &)
void ecaldqm::TestPulseTask::runOnPnDigis ( EcalPnDiodeDigiCollection const &  _digis)

Definition at line 140 of file TestPulseTask.cc.

References CustomPhysics_cfi::amplitude, edm::SortedCollection< T, SORT >::begin(), ecaldqm::dccId(), enable_, edm::SortedCollection< T, SORT >::end(), muonCSCDigis_cfi::gain, hcalTTPDigis_cfi::id, hpstanc_transforms::max, ecaldqm::DQWorker::MEs_, muonCSCDigis_cfi::pedestal, and pnGainToME_.

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

141  {
142  MESet& mePNAmplitude(MEs_.at("PNAmplitude"));
143 
144  unsigned iME(-1);
145 
146  for(EcalPnDiodeDigiCollection::const_iterator digiItr(_digis.begin()); digiItr != _digis.end(); ++digiItr){
147  EcalPnDiodeDetId const& id(digiItr->id());
148 
149  int iDCC(dccId(id) - 1);
150 
151  if(!enable_[iDCC]) continue;
152 
153  int gain(0);
154  switch(digiItr->sample(0).gainId()){
155  case 0: gain = 1; break;
156  case 1: gain = 16; break;
157  default: continue;
158  }
159 
160  if(pnGainToME_.find(gain) == pnGainToME_.end()) continue;
161 
162  if(iME != pnGainToME_[gain]){
163  iME = pnGainToME_[gain];
164  static_cast<MESetMulti&>(mePNAmplitude).use(iME);
165  }
166 
167  float pedestal(0.);
168  for(int iSample(0); iSample < 4; iSample++)
169  pedestal += digiItr->sample(iSample).adc();
170  pedestal /= 4.;
171 
172  float max(0.);
173  for(int iSample(0); iSample < 50; iSample++)
174  if(digiItr->sample(iSample).adc() > max) max = digiItr->sample(iSample).adc();
175 
176  double amplitude(max - pedestal);
177 
178  mePNAmplitude.fill(id, amplitude);
179  }
180  }
std::vector< EcalPnDiodeDigi >::const_iterator const_iterator
std::map< int, unsigned > pnGainToME_
Definition: TestPulseTask.h:34
MESetCollection MEs_
Definition: DQWorker.h:75
unsigned dccId(DetId const &)
void ecaldqm::TestPulseTask::runOnRawData ( EcalRawDataCollection const &  _rawData)

Definition at line 80 of file TestPulseTask.cc.

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

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

81  {
82  for(EcalRawDataCollection::const_iterator rItr(_rawData.begin()); rItr != _rawData.end(); ++rItr){
83  unsigned iDCC(rItr->id() - 1);
84 
85  if(!enable_[iDCC]){
86  gain_[iDCC] = 0;
87  continue;
88  }
89  switch(rItr->getMgpaGain()){
90  case 1:
91  gain_[iDCC] = 12;
92  break;
93  case 2:
94  gain_[iDCC] = 6;
95  break;
96  case 3:
97  gain_[iDCC] = 1;
98  break;
99  default:
100  break;
101  }
102 
103  if(gainToME_.find(gain_[iDCC]) == gainToME_.end())
104  enable_[iDCC] = false;
105  }
106  }
std::vector< EcalDCCHeaderBlock >::const_iterator const_iterator
std::map< int, unsigned > gainToME_
Definition: TestPulseTask.h:33
void ecaldqm::TestPulseTask::runOnUncalibRecHits ( EcalUncalibratedRecHitCollection const &  _uhits)

Definition at line 183 of file TestPulseTask.cc.

References edm::SortedCollection< T, SORT >::begin(), ecaldqm::dccId(), DEFINE_ECALDQM_WORKER, enable_, edm::SortedCollection< T, SORT >::end(), ecaldqm::MESetMulti::fill(), gain_, gainToME_, hcalTTPDigis_cfi::id, and ecaldqm::DQWorker::MEs_.

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

184  {
185  MESet& meAmplitude(MEs_.at("Amplitude"));
186 
187  unsigned iME(-1);
188 
189  for(EcalUncalibratedRecHitCollection::const_iterator uhitItr(_uhits.begin()); uhitItr != _uhits.end(); ++uhitItr){
190  DetId id(uhitItr->id());
191 
192  int iDCC(dccId(id) - 1);
193 
194  if(!enable_[iDCC]) continue;
195 
196  if(iME != gainToME_[gain_[iDCC]]){
197  iME = gainToME_[gain_[iDCC]];
198  static_cast<MESetMulti&>(meAmplitude).use(iME);
199  }
200 
201  meAmplitude.fill(id, uhitItr->amplitude());
202  }
203  }
std::vector< EcalUncalibratedRecHit >::const_iterator const_iterator
std::map< int, unsigned > gainToME_
Definition: TestPulseTask.h:33
Definition: DetId.h:18
MESetCollection MEs_
Definition: DQWorker.h:75
unsigned dccId(DetId const &)
void ecaldqm::TestPulseTask::setParams ( edm::ParameterSet const &  _params)
overrideprivatevirtual

Reimplemented from ecaldqm::DQWorker.

Definition at line 26 of file TestPulseTask.cc.

References CustomPhysics_cfi::amplitude, Exception, muonCSCDigis_cfi::gain, gainToME_, ecaldqm::MESetMulti::getIndex(), edm::ParameterSet::getUntrackedParameter(), ecaldqm::DQWorker::MEs_, and pnGainToME_.

Referenced by ~TestPulseTask().

27  {
28  std::vector<int> MGPAGains(_params.getUntrackedParameter<std::vector<int> >("MGPAGains"));
29  std::vector<int> MGPAGainsPN(_params.getUntrackedParameter<std::vector<int> >("MGPAGainsPN"));
30 
32 
33  MESetMulti& amplitude(static_cast<MESetMulti&>(MEs_.at("Amplitude")));
34  unsigned nG(MGPAGains.size());
35  for(unsigned iG(0); iG != nG; ++iG){
36  int gain(MGPAGains[iG]);
37  if(gain != 1 && gain != 6 && gain != 12) throw cms::Exception("InvalidConfiguration") << "MGPA gain";
38  repl["gain"] = std::to_string(gain);
39  gainToME_[gain] = amplitude.getIndex(repl);
40  }
41 
42  repl.clear();
43 
44  MESetMulti& pnAmplitude(static_cast<MESetMulti&>(MEs_.at("PNAmplitude")));
45  unsigned nGPN(MGPAGainsPN.size());
46  for(unsigned iG(0); iG != nGPN; ++iG){
47  int gain(MGPAGainsPN[iG]);
48  if(gain != 1 && gain != 16) throw cms::Exception("InvalidConfiguration") << "PN MGPA gain";
49  repl["pngain"] = std::to_string(gain);
50  pnGainToME_[gain] = pnAmplitude.getIndex(repl);
51  }
52  }
std::map< int, unsigned > gainToME_
Definition: TestPulseTask.h:33
std::map< int, unsigned > pnGainToME_
Definition: TestPulseTask.h:34
MESetCollection MEs_
Definition: DQWorker.h:75
std::map< std::string, std::string > PathReplacements
Definition: MESet.h:31

Member Data Documentation

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

Definition at line 37 of file TestPulseTask.h.

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

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

Definition at line 33 of file TestPulseTask.h.

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

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

Definition at line 34 of file TestPulseTask.h.

Referenced by runOnPnDigis(), and setParams().