CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
hcaldqm::DQTask Class Referenceabstract

#include <DQTask.h>

Inheritance diagram for hcaldqm::DQTask:
one::DQMEDAnalyzer< one::DQMLuminosityBlockElements > hcaldqm::DQModule one::dqmimplementation::DQMBaseClass< T... > DigiComparisonTask DigiPhase1Task DigiTask HFRaddamTask LaserTask LEDTask NoCQTask PedestalTask QIE10Task QIE11Task RawTask RecHitTask TestTask TPComparisonTask TPTask UMNioTask

Public Member Functions

void analyze (edm::Event const &, edm::EventSetup const &) override
 
void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) override
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
void dqmBeginRun (edm::Run const &, edm::EventSetup const &) override
 
 DQTask (edm::ParameterSet const &)
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) override
 
 ~DQTask () override
 
- Public Member Functions inherited from one::DQMEDAnalyzer< one::DQMLuminosityBlockElements >
 DQMEDAnalyzer ()=default
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > const &)=delete
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > &&)=delete
 
 ~DQMEDAnalyzer () override=default
 
- Public Member Functions inherited from hcaldqm::DQModule
 DQModule (edm::ParameterSet const &)
 
virtual ~DQModule ()(false)
 

Protected Member Functions

virtual int _getCalibType (edm::Event const &)
 
virtual bool _isApplicable (edm::Event const &)
 
virtual void _process (edm::Event const &, edm::EventSetup const &)=0
 
virtual void _resetMonitors (UpdateFreq)
 

Protected Attributes

ContainerI _cEvsPerLS
 
ContainerI _cEvsTotal
 
ContainerS _cProcessingTypeName
 
ContainerS _cRunKeyName
 
ContainerI _cRunKeyVal
 
edm::ESHandle< HcalDbService_dbService
 
HcalElectronicsMap const * _emap
 
int _procLSs
 
edm::InputTag _tagRaw
 
edm::EDGetTokenT< FEDRawDataCollection_tokRaw
 
std::vector< uint32_t > _vcdaqEids
 
ContainerXXX< uint32_t > _xQuality
 
- Protected Attributes inherited from hcaldqm::DQModule
int _currentLS
 
int _debug
 
int _evsPerLS
 
int _evsTotal
 
Logger _logger
 
int _maxLS
 
ModuleType _mtype
 
std::string _name
 
ProcessingType _ptype
 
std::string _runkeyName
 
int _runkeyVal
 
std::string _subsystem
 

Detailed Description

Definition at line 17 of file DQTask.h.

Constructor & Destructor Documentation

hcaldqm::DQTask::DQTask ( edm::ParameterSet const &  ps)

Definition at line 5 of file DQTask.cc.

References _tagRaw, _tokRaw, and edm::ParameterSet::getUntrackedParameter().

6  : DQModule(ps),
7  _cEvsTotal(_name, "EventsTotal"),
8  _cEvsPerLS(_name, "EventsPerLS"),
9  _cRunKeyVal(_name, "RunKeyValue"),
10  _cRunKeyName(_name, "RunKeyName"),
11  _cProcessingTypeName(_name, "ProcessingType"),
12  _procLSs(0) {
13  // tags and Tokens
14  _tagRaw = ps.getUntrackedParameter<edm::InputTag>("tagRaw", edm::InputTag("rawDataCollector"));
15  _tokRaw = consumes<FEDRawDataCollection>(_tagRaw);
16  }
ContainerI _cEvsTotal
Definition: DQTask.h:38
ContainerS _cRunKeyName
Definition: DQTask.h:41
edm::InputTag _tagRaw
Definition: DQTask.h:54
edm::EDGetTokenT< FEDRawDataCollection > _tokRaw
Definition: DQTask.h:55
ContainerI _cEvsPerLS
Definition: DQTask.h:39
int _procLSs
Definition: DQTask.h:45
std::string _name
Definition: DQModule.h:41
ContainerS _cProcessingTypeName
Definition: DQTask.h:42
ContainerI _cRunKeyVal
Definition: DQTask.h:40
DQModule(edm::ParameterSet const &)
Definition: DQModule.cc:5
hcaldqm::DQTask::~DQTask ( )
inlineoverride

Member Function Documentation

int hcaldqm::DQTask::_getCalibType ( edm::Event const &  e)
protectedvirtual

Definition at line 137 of file DQTask.cc.

References hcaldqm::DQModule::_logger, _tagRaw, _tokRaw, FEDRawData::data(), Logger::dqmthrow(), hcaldqm::constants::FED_uTCA_MAX, hcaldqm::constants::FED_uTCA_MIN, hcaldqm::constants::FED_VME_MAX, hcaldqm::constants::FED_VME_MIN, hcaldqm::constants::FED_VME_NUM, FEDRawDataCollection::FEDData(), edm::Event::getByToken(), mps_fire::i, edm::InputTag::instance(), createfilelist::int, edm::InputTag::label(), SiStripPI::max, FEDRawData::size(), and Logger::warn().

Referenced by _isApplicable().

137  {
138  int calibType = 0;
139 
141  if (!e.getByToken(_tokRaw, craw))
142  _logger.dqmthrow("Collection FEDRawDataCollection isn't available " + _tagRaw.label() + " " + _tagRaw.instance());
143 
144  int badFEDs = 0;
145  std::vector<int> types(8, 0);
146  for (int i = FED_VME_MIN; i <= FED_VME_MAX; i++) {
147  FEDRawData const &fd = craw->FEDData(i);
148  if (fd.size() < 24) {
149  badFEDs++;
150  continue;
151  }
152  int cval = (int)((HcalDCCHeader const *)(fd.data()))->getCalibType();
153  if (cval > 7)
154  _logger.warn("Unexpected Calib Type in FED " + std::to_string(i));
155  types[cval]++;
156  }
157  for (int i = FED_uTCA_MIN; i <= FED_uTCA_MAX; i++) {
158  FEDRawData const &fd = craw->FEDData(i);
159  if (fd.size() < 24) {
160  badFEDs++;
161  continue;
162  }
163  int cval = (int)((HcalDCCHeader const *)(fd.data()))->getCalibType();
164  if (cval > 7)
165  _logger.warn("Unexpected Calib Type in FED " + std::to_string(i));
166  types[cval]++;
167  }
168 
169  int max = 0;
170  for (unsigned int ic = 0; ic < 8; ic++) {
171  if (types[ic] > max) {
172  max = types[ic];
173  calibType = ic;
174  }
175  }
176  if (max != (FED_VME_NUM + (FED_uTCA_MAX - FED_uTCA_MIN + 1) - badFEDs))
177  _logger.warn("Conflicting Calibration Types found. Assigning " + std::to_string(calibType));
178 
179  return calibType;
180  }
void warn(std::string const &msg) const
Definition: Logger.h:13
edm::InputTag _tagRaw
Definition: DQTask.h:54
edm::EDGetTokenT< FEDRawDataCollection > _tokRaw
Definition: DQTask.h:55
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
int const FED_uTCA_MIN
Definition: Constants.h:75
int const FED_uTCA_MAX
Definition: Constants.h:77
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
void dqmthrow(std::string const &msg) const
Definition: Logger.h:12
int const FED_VME_MIN
Definition: Constants.h:70
Logger _logger
Definition: DQModule.h:54
int const FED_VME_NUM
Definition: Constants.h:73
std::string const & label() const
Definition: InputTag.h:36
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28
int const FED_VME_MAX
Definition: Constants.h:71
std::string const & instance() const
Definition: InputTag.h:37
virtual bool hcaldqm::DQTask::_isApplicable ( edm::Event const &  )
inlineprotectedvirtual

Reimplemented in LaserTask, LEDTask, PedestalTask, QIE11Task, and HFRaddamTask.

Definition at line 34 of file DQTask.h.

References _getCalibType().

Referenced by analyze().

34 { return true; }
virtual void hcaldqm::DQTask::_process ( edm::Event const &  ,
edm::EventSetup const &   
)
protectedpure virtual
void hcaldqm::DQTask::_resetMonitors ( UpdateFreq  uf)
protectedvirtual

Reimplemented in LaserTask, DigiPhase1Task, DigiTask, LEDTask, RecHitTask, RawTask, PedestalTask, TPTask, QIE10Task, QIE11Task, TestTask, TPComparisonTask, DigiComparisonTask, and NoCQTask.

Definition at line 118 of file DQTask.cc.

References hcaldqm::DQModule::_evsPerLS, hcaldqm::f100LS, hcaldqm::f10LS, hcaldqm::f1LS, hcaldqm::f50LS, and hcaldqm::fEvent.

Referenced by analyze(), beginLuminosityBlock(), dqmBeginRun(), and ~DQTask().

118  {
119  // reset per event
120  switch (uf) {
121  case fEvent:
122  break;
123  case f1LS:
124  _evsPerLS = 0;
125  break;
126  case f10LS:
127  break;
128  case f50LS:
129  break;
130  case f100LS:
131  break;
132  default:
133  break;
134  }
135  }
void hcaldqm::DQTask::analyze ( edm::Event const &  e,
edm::EventSetup const &  es 
)
override

Definition at line 22 of file DQTask.cc.

References _cEvsPerLS, _cEvsTotal, hcaldqm::DQModule::_evsPerLS, hcaldqm::DQModule::_evsTotal, _isApplicable(), hcaldqm::DQModule::_logger, hcaldqm::DQModule::_name, _process(), _resetMonitors(), Logger::debug(), hcaldqm::fEvent, and hcaldqm::ContainerI::fill().

Referenced by ~DQTask().

22  {
23  this->_resetMonitors(fEvent);
24  _logger.debug(_name + " processing");
25  if (!this->_isApplicable(e))
26  return;
27 
28  _evsTotal++;
30  _evsPerLS++;
32  this->_process(e, es);
33  }
ContainerI _cEvsTotal
Definition: DQTask.h:38
void debug(STDTYPE const &msg) const
Definition: Logger.h:20
ContainerI _cEvsPerLS
Definition: DQTask.h:39
virtual bool _isApplicable(edm::Event const &)
Definition: DQTask.h:34
virtual void _process(edm::Event const &, edm::EventSetup const &)=0
virtual void fill(int x)
Definition: ContainerI.h:19
Logger _logger
Definition: DQModule.h:54
std::string _name
Definition: DQModule.h:41
virtual void _resetMonitors(UpdateFreq)
Definition: DQTask.cc:118
void hcaldqm::DQTask::beginLuminosityBlock ( edm::LuminosityBlock const &  lb,
edm::EventSetup const &  es 
)
override

Definition at line 84 of file DQTask.cc.

References hcaldqm::DQModule::_currentLS, _procLSs, _resetMonitors(), _xQuality, hcaldqm::f100LS, hcaldqm::f10LS, hcaldqm::f1LS, hcaldqm::f50LS, HcalGenericDetId::genericSubdet(), edm::EventSetup::get(), HcalCondObjectContainer< Item >::getAllChannels(), reco::JetExtendedAssociation::getValue(), HcalCondObjectContainer< Item >::getValues(), HcalGenericDetId::HcalGenUnknown, HcalGenericDetId::isHcalDetId(), edm::LuminosityBlockBase::luminosityBlock(), RecoTauDiscriminantConfiguration::mask, edm::ESHandle< T >::product(), hcaldqm::ContainerXXX< STDTYPE >::push(), and hcaldqm::ContainerXXX< STDTYPE >::reset().

Referenced by ~DQTask().

84  {
85  _currentLS = lb.luminosityBlock();
86  this->_resetMonitors(f1LS);
87 
88  if (_procLSs % 10 == 0)
89  this->_resetMonitors(f10LS);
90  if (_procLSs % 50 == 0)
91  this->_resetMonitors(f50LS);
92  if (_procLSs % 100 == 0)
93  this->_resetMonitors(f100LS);
94 
95  // get the Channel Quality Status for all the channels
96  _xQuality.reset();
98  es.get<HcalChannelQualityRcd>().get("withTopo", hcq);
99  const HcalChannelQuality *cq = hcq.product();
100  std::vector<DetId> detids = cq->getAllChannels();
101  for (std::vector<DetId>::const_iterator it = detids.begin(); it != detids.end(); ++it) {
102  // if unknown skip
104  continue;
105 
106  if (HcalGenericDetId(*it).isHcalDetId()) {
107  HcalDetId did(*it);
108  uint32_t mask = (cq->getValues(did))->getValue();
109  if (mask != 0) {
110  _xQuality.push(did, mask);
111  }
112  }
113  }
114  }
virtual void push(HcalDetId const &, STDTYPE)
Definition: ContainerXXX.h:227
int _procLSs
Definition: DQTask.h:45
const Item * getValues(DetId fId, bool throwOnFail=true) const
virtual void reset()
Definition: ContainerXXX.h:292
ContainerXXX< uint32_t > _xQuality
Definition: DQTask.h:48
std::vector< DetId > getAllChannels() const
bool isHcalDetId() const
virtual void _resetMonitors(UpdateFreq)
Definition: DQTask.cc:118
const JetExtendedData & getValue(const Container &, const reco::JetBaseRef &)
get value for the association. Throw exception if no association found
HcalGenericSubdetector genericSubdet() const
T const * product() const
Definition: ESHandle.h:86
void hcaldqm::DQTask::bookHistograms ( DQMStore::IBooker ib,
edm::Run const &  r,
edm::EventSetup const &  es 
)
override

Definition at line 35 of file DQTask.cc.

References _cEvsPerLS, _cEvsTotal, _cProcessingTypeName, _cRunKeyName, _cRunKeyVal, _dbService, _emap, hcaldqm::DQModule::_ptype, hcaldqm::DQModule::_runkeyName, hcaldqm::DQModule::_runkeyVal, hcaldqm::DQModule::_subsystem, _vcdaqEids, _xQuality, hcaldqm::ContainerI::book(), hcaldqm::ContainerS::book(), hcaldqm::hashfunctions::fDChannel, hcaldqm::utilities::fed2crate(), hcaldqm::constants::FED_uTCA_MIN, hcaldqm::constants::FED_VME_MAX, hcaldqm::constants::FED_VME_MIN, hcaldqm::constants::FIBER_uTCA_MIN1, hcaldqm::constants::FIBER_VME_MIN, hcaldqm::constants::FIBERCH_MIN, hcaldqm::ContainerI::fill(), hcaldqm::ContainerS::fill(), edm::EventSetup::get(), HcalDbService::getHcalMapping(), hcaldqm::ContainerXXX< STDTYPE >::initialize(), RunInfo::m_fed_in, FEDNumbering::MAXHCALuTCAFEDID, hcaldqm::pTypeNames, HcalElectronicsId::rawId(), hcaldqm::constants::SPIGOT_MIN, and edm::EventSetup::tryToGet().

Referenced by ~DQTask().

35  {
36  // initialize some containers to be used by all modules
38 
39  // get the run info FEDs - FEDs registered at cDAQ
40  // and determine if there are any HCAL FEDs in.
41  // push them as ElectronicsIds into the vector
42  if (auto runInfoRec = es.tryToGet<RunInfoRcd>()) {
44  runInfoRec->get(ri);
45  std::vector<int> vfeds = ri->m_fed_in;
46  for (std::vector<int>::const_iterator it = vfeds.begin(); it != vfeds.end(); ++it) {
47  if (*it >= constants::FED_VME_MIN && *it <= FED_VME_MAX)
48  _vcdaqEids.push_back(
50  .rawId());
51  else if (*it >= constants::FED_uTCA_MIN && *it <= FEDNumbering::MAXHCALuTCAFEDID) {
52  std::pair<uint16_t, uint16_t> cspair = utilities::fed2crate(*it);
53  _vcdaqEids.push_back(
54  HcalElectronicsId(cspair.first, cspair.second, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
55  }
56  }
57  }
58 
59  // book some base guys
65 
66  // fill what you can now
70 
71  // Load conditions and emap
72  es.get<HcalDbRecord>().get(_dbService);
74  }
constexpr uint32_t rawId() const
ContainerI _cEvsTotal
Definition: DQTask.h:38
std::pair< uint16_t, uint16_t > fed2crate(int fed)
Definition: Utilities.cc:10
ContainerS _cRunKeyName
Definition: DQTask.h:41
ContainerI _cEvsPerLS
Definition: DQTask.h:39
int const SPIGOT_MIN
Definition: Constants.h:108
int const FIBER_VME_MIN
Definition: Constants.h:113
int const FED_uTCA_MIN
Definition: Constants.h:75
int const FIBERCH_MIN
Definition: Constants.h:122
ProcessingType _ptype
Definition: DQModule.h:43
virtual void fill(std::string const &x)
Definition: ContainerS.h:20
ContainerXXX< uint32_t > _xQuality
Definition: DQTask.h:48
int const FED_VME_MIN
Definition: Constants.h:70
std::vector< int > m_fed_in
Definition: RunInfo.h:26
virtual void book(DQMStore::IBooker &ib, std::string subsystem="Hcal", std::string aux="")
Definition: ContainerI.h:21
int const FIBER_uTCA_MIN1
Definition: Constants.h:116
virtual void fill(int x)
Definition: ContainerI.h:19
virtual void book(DQMStore::IBooker &ib, std::string subsystem="Hcal", std::string aux="")
Definition: ContainerS.h:22
HcalElectronicsMap const * _emap
Definition: DQTask.h:59
edm::ESHandle< HcalDbService > _dbService
Definition: DQTask.h:58
const HcalElectronicsMap * getHcalMapping() const
std::string _subsystem
Definition: DQModule.h:48
std::string _runkeyName
Definition: DQModule.h:47
ContainerS _cProcessingTypeName
Definition: DQTask.h:42
std::vector< uint32_t > _vcdaqEids
Definition: DQTask.h:51
std::string const pTypeNames[nProcessingType]
Definition: DQModule.h:28
virtual void initialize(hashfunctions::HashType, int debug=0)
Definition: ContainerXXX.h:81
int const FED_VME_MAX
Definition: Constants.h:71
ContainerI _cRunKeyVal
Definition: DQTask.h:40
Readout chain identification for Hcal.
void hcaldqm::DQTask::dqmBeginRun ( edm::Run const &  r,
edm::EventSetup const &  es 
)
override

Definition at line 76 of file DQTask.cc.

References _resetMonitors(), hcaldqm::f100LS, hcaldqm::f10LS, hcaldqm::f1LS, hcaldqm::f50LS, and hcaldqm::fEvent.

Referenced by ~DQTask().

76  {
77  this->_resetMonitors(fEvent);
78  this->_resetMonitors(f1LS);
79  this->_resetMonitors(f10LS);
80  this->_resetMonitors(f50LS);
81  this->_resetMonitors(f100LS);
82  }
virtual void _resetMonitors(UpdateFreq)
Definition: DQTask.cc:118
void hcaldqm::DQTask::endLuminosityBlock ( edm::LuminosityBlock const &  lb,
edm::EventSetup const &  es 
)
override

Definition at line 116 of file DQTask.cc.

References _procLSs.

Referenced by ~DQTask().

116 { _procLSs++; }
int _procLSs
Definition: DQTask.h:45

Member Data Documentation

ContainerI hcaldqm::DQTask::_cEvsPerLS
protected

Definition at line 39 of file DQTask.h.

Referenced by analyze(), and bookHistograms().

ContainerI hcaldqm::DQTask::_cEvsTotal
protected

Definition at line 38 of file DQTask.h.

Referenced by analyze(), and bookHistograms().

ContainerS hcaldqm::DQTask::_cProcessingTypeName
protected

Definition at line 42 of file DQTask.h.

Referenced by bookHistograms().

ContainerS hcaldqm::DQTask::_cRunKeyName
protected

Definition at line 41 of file DQTask.h.

Referenced by bookHistograms().

ContainerI hcaldqm::DQTask::_cRunKeyVal
protected

Definition at line 40 of file DQTask.h.

Referenced by bookHistograms().

edm::ESHandle<HcalDbService> hcaldqm::DQTask::_dbService
protected
HcalElectronicsMap const* hcaldqm::DQTask::_emap
protected
int hcaldqm::DQTask::_procLSs
protected

Definition at line 45 of file DQTask.h.

Referenced by beginLuminosityBlock(), and endLuminosityBlock().

edm::InputTag hcaldqm::DQTask::_tagRaw
protected

Definition at line 54 of file DQTask.h.

Referenced by _getCalibType(), and DQTask().

edm::EDGetTokenT<FEDRawDataCollection> hcaldqm::DQTask::_tokRaw
protected

Definition at line 55 of file DQTask.h.

Referenced by _getCalibType(), and DQTask().

std::vector<uint32_t> hcaldqm::DQTask::_vcdaqEids
protected
ContainerXXX<uint32_t> hcaldqm::DQTask::_xQuality
protected