CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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  for (unsigned iP(0); iP != nPrescalers; ++iP)
33  prescalers_[iP].first = 0;
34 
35  prescalers_[kPhysics].second = _ps.getUntrackedParameter<unsigned>("physics", -1);
36  prescalers_[kCosmics].second = _ps.getUntrackedParameter<unsigned>("cosmics", -1);
37  prescalers_[kCalibration].second = _ps.getUntrackedParameter<unsigned>("calibration", -1);
38  prescalers_[kLaser].second = _ps.getUntrackedParameter<unsigned>("laser", -1);
39  prescalers_[kLed].second = _ps.getUntrackedParameter<unsigned>("led", -1);
40  prescalers_[kTestPulse].second = _ps.getUntrackedParameter<unsigned>("testPulse", -1);
41  prescalers_[kPedestal].second = _ps.getUntrackedParameter<unsigned>("pedestal", -1);
42 
43  // Backward compatibility
44  prescalers_[kPhysics].second = std::min(
45  prescalers_[kPhysics].second, (unsigned int)(_ps.getUntrackedParameter<int>("occupancyPrescaleFactor", -1)));
46  prescalers_[kPhysics].second = std::min(
47  prescalers_[kPhysics].second, (unsigned int)(_ps.getUntrackedParameter<int>("integrityPrescaleFactor", -1)));
49  (unsigned int)(_ps.getUntrackedParameter<int>("cosmicPrescaleFactor", -1)));
50  prescalers_[kLaser].second =
51  std::min(prescalers_[kLaser].second, (unsigned int)(_ps.getUntrackedParameter<int>("laserPrescaleFactor", -1)));
52  prescalers_[kLed].second =
53  std::min(prescalers_[kLed].second, (unsigned int)(_ps.getUntrackedParameter<int>("ledPrescaleFactor", -1)));
54  prescalers_[kPedestal].second = std::min(
55  prescalers_[kPedestal].second, (unsigned int)(_ps.getUntrackedParameter<int>("pedestalPrescaleFactor", -1)));
56  prescalers_[kPedestal].second =
58  (unsigned int)(_ps.getUntrackedParameter<int>("pedestalonlinePrescaleFactor", -1)));
60  prescalers_[kTestPulse].second, (unsigned int)(_ps.getUntrackedParameter<int>("testpulsePrescaleFactor", -1)));
61  prescalers_[kPedestal].second =
63  (unsigned int)(_ps.getUntrackedParameter<int>("pedestaloffsetPrescaleFactor", -1)));
64  prescalers_[kPhysics].second = std::min(
65  prescalers_[kPhysics].second, (unsigned int)(_ps.getUntrackedParameter<int>("triggertowerPrescaleFactor", -1)));
67  (unsigned int)(_ps.getUntrackedParameter<int>("timingPrescaleFactor", -1)));
69  (unsigned int)(_ps.getUntrackedParameter<int>("physicsPrescaleFactor", -1)));
71  (unsigned int)(_ps.getUntrackedParameter<int>("clusterPrescaleFactor", -1)));
72 }
73 
75 
77  for (unsigned iP(0); iP != nPrescalers; ++iP)
78  prescalers_[iP].first = 0;
79 }
80 
83 
84  if (!_event.getByToken(EcalRawDataCollection_, dcchs)) {
85  edm::LogWarning("EcalMonitorPrescaler") << "EcalRawDataCollection not available";
86  return false;
87  }
88 
89  uint32_t eventBits(0);
90  for (EcalRawDataCollection::const_iterator dcchItr(dcchs->begin()); dcchItr != dcchs->end(); ++dcchItr)
91  eventBits |= (1 << dcchItr->getRunType());
92 
93  for (unsigned iP(0); iP != nPrescalers; ++iP) {
94  if ((eventBits & filterBits_[iP]) != 0 && ++prescalers_[iP].first % prescalers_[iP].second == 0)
95  return true;
96  }
97 
98  return false;
99 }
100 
T getUntrackedParameter(std::string const &, T const &) const
void beginRun(edm::Run const &, edm::EventSetup const &) override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
std::vector< T >::const_iterator const_iterator
bool filter(edm::Event &, edm::EventSetup const &) override
U second(std::pair< T, U > const &p)
T min(T a, T b)
Definition: MathUtil.h:58
EcalMonitorPrescaler(edm::ParameterSet const &)
edm::EDGetTokenT< EcalRawDataCollection > EcalRawDataCollection_
std::pair< unsigned, unsigned > prescalers_[nPrescalers]
Log< level::Warning, false > LogWarning
Definition: Run.h:45
static uint32_t filterBits_[nPrescalers]