CMS 3D CMS Logo

EcalMonitorPrescaler.cc
Go to the documentation of this file.
2 
6 
9 
10 #include <cmath>
11 #include <iostream>
12 
15  (1 << EcalDCCHeaderBlock::PHYSICS_LOCAL), // kPhysics
17  (1 << EcalDCCHeaderBlock::COSMICS_LOCAL), // kCosmics
27 };
28 
30  : EcalRawDataCollection_(
31  consumes<EcalRawDataCollection>(_ps.getParameter<edm::InputTag>("EcalRawDataCollection"))) {
32  prescalers_[ecaldqm::kPhysics] = _ps.getUntrackedParameter<unsigned>("physics", -1);
33  prescalers_[ecaldqm::kCosmics] = _ps.getUntrackedParameter<unsigned>("cosmics", -1);
34  prescalers_[ecaldqm::kCalibration] = _ps.getUntrackedParameter<unsigned>("calibration", -1);
35  prescalers_[ecaldqm::kLaser] = _ps.getUntrackedParameter<unsigned>("laser", -1);
36  prescalers_[ecaldqm::kLed] = _ps.getUntrackedParameter<unsigned>("led", -1);
37  prescalers_[ecaldqm::kTestPulse] = _ps.getUntrackedParameter<unsigned>("testPulse", -1);
38  prescalers_[ecaldqm::kPedestal] = _ps.getUntrackedParameter<unsigned>("pedestal", -1);
39 
40  // Backward compatibility
42  prescalers_[ecaldqm::kPhysics], (unsigned int)(_ps.getUntrackedParameter<int>("occupancyPrescaleFactor", -1)));
44  prescalers_[ecaldqm::kPhysics], (unsigned int)(_ps.getUntrackedParameter<int>("integrityPrescaleFactor", -1)));
46  (unsigned int)(_ps.getUntrackedParameter<int>("cosmicPrescaleFactor", -1)));
48  std::min(prescalers_[ecaldqm::kLaser], (unsigned int)(_ps.getUntrackedParameter<int>("laserPrescaleFactor", -1)));
50  std::min(prescalers_[ecaldqm::kLed], (unsigned int)(_ps.getUntrackedParameter<int>("ledPrescaleFactor", -1)));
52  prescalers_[ecaldqm::kPedestal], (unsigned int)(_ps.getUntrackedParameter<int>("pedestalPrescaleFactor", -1)));
55  (unsigned int)(_ps.getUntrackedParameter<int>("pedestalonlinePrescaleFactor", -1)));
57  prescalers_[ecaldqm::kTestPulse], (unsigned int)(_ps.getUntrackedParameter<int>("testpulsePrescaleFactor", -1)));
60  (unsigned int)(_ps.getUntrackedParameter<int>("pedestaloffsetPrescaleFactor", -1)));
62  prescalers_[ecaldqm::kPhysics], (unsigned int)(_ps.getUntrackedParameter<int>("triggertowerPrescaleFactor", -1)));
64  (unsigned int)(_ps.getUntrackedParameter<int>("timingPrescaleFactor", -1)));
66  prescalers_[ecaldqm::kPhysics], (unsigned int)(_ps.getUntrackedParameter<int>("physicsPrescaleFactor", -1)));
68  prescalers_[ecaldqm::kPhysics], (unsigned int)(_ps.getUntrackedParameter<int>("clusterPrescaleFactor", -1)));
69 }
70 
72 
73 std::shared_ptr<ecaldqm::PrescaleCounter> EcalMonitorPrescaler::globalBeginRun(edm::Run const &,
74  edm::EventSetup const &) const {
75  return std::make_shared<ecaldqm::PrescaleCounter>();
76 }
77 
80 
81  if (!_event.getByToken(EcalRawDataCollection_, dcchs)) {
82  edm::LogWarning("EcalMonitorPrescaler") << "EcalRawDataCollection not available";
83  return false;
84  }
85 
86  uint32_t eventBits(0);
87  for (EcalRawDataCollection::const_iterator dcchItr(dcchs->begin()); dcchItr != dcchs->end(); ++dcchItr)
88  eventBits |= (1 << dcchItr->getRunType());
89 
90  for (unsigned iP(0); iP != ecaldqm::nPrescalers; ++iP) {
91  if ((eventBits & filterBits_[iP]) != 0 &&
92  ++(runCache(_event.getRun().index())->counters_[iP]) % prescalers_[iP] == 0)
93  return true;
94  }
95 
96  return false;
97 }
98 
100 
std::shared_ptr< ecaldqm::PrescaleCounter > globalBeginRun(edm::Run const &, edm::EventSetup const &) const override
std::vector< T >::const_iterator const_iterator
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:540
T getUntrackedParameter(std::string const &, T const &) const
bool filter(edm::StreamID, edm::Event &, edm::EventSetup const &) const override
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
Run const & getRun() const
Definition: Event.cc:112
const_iterator begin() const
EcalMonitorPrescaler(edm::ParameterSet const &)
const_iterator end() const
edm::EDGetTokenT< EcalRawDataCollection > EcalRawDataCollection_
void globalEndRun(edm::Run const &, edm::EventSetup const &) const override
RunIndex index() const
Definition: Run.cc:28
HLT enums.
unsigned prescalers_[ecaldqm::nPrescalers]
Log< level::Warning, false > LogWarning
static const uint32_t filterBits_[ecaldqm::nPrescalers]
Definition: Run.h:45