CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 
- 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 &)
 
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 ()
 

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 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 12 of file PedestalTask.h.

Constructor & Destructor Documentation

PedestalTask::PedestalTask ( )

Definition at line 14 of file PedestalTask.cc.

References enable_, and ecaldqm::nDCC.

14  :
15  DQWorkerTask(),
16  gainToME_(),
17  pnGainToME_()
18  {
19  std::fill_n(enable_, nDCC, false);
20  }
std::map< int, unsigned > gainToME_
Definition: PedestalTask.h:27
std::map< int, unsigned > pnGainToME_
Definition: PedestalTask.h:28
ecaldqm::PedestalTask::~PedestalTask ( )
inline

Definition at line 15 of file PedestalTask.h.

15 {}

Member Function Documentation

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

Reimplemented from ecaldqm::DQWorkerTask.

Definition at line 33 of file PedestalTask.h.

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

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

Reimplemented from ecaldqm::DQWorkerTask.

Definition at line 52 of file PedestalTask.cc.

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

53  {
54  bool enable(false);
55 
56  for(int iFED(0); iFED < nDCC; iFED++){
57  if(_runType[iFED] == EcalDCCHeaderBlock::PEDESTAL_STD ||
58  _runType[iFED] == EcalDCCHeaderBlock::PEDESTAL_GAP){
59  enable = true;
60  enable_[iFED] = true;
61  }
62  else
63  enable_[iFED] = false;
64  }
65 
66  return enable;
67  }
template<typename DigiCollection >
void PedestalTask::runOnDigis ( DigiCollection const &  _digis)

Definition at line 71 of file PedestalTask.cc.

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

Referenced by analyze().

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

Definition at line 111 of file PedestalTask.cc.

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

Referenced by analyze().

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

Reimplemented from ecaldqm::DQWorker.

Definition at line 23 of file PedestalTask.cc.

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

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

Member Data Documentation

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

Definition at line 30 of file PedestalTask.h.

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

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

Definition at line 27 of file PedestalTask.h.

Referenced by runOnDigis(), and setParams().

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

Definition at line 28 of file PedestalTask.h.

Referenced by runOnPnDigis(), and setParams().