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  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 
EcalDCCHeaderBlock::COSMICS_LOCAL
Definition: EcalDCCHeaderBlock.h:49
edm::SortedCollection::const_iterator
std::vector< T >::const_iterator const_iterator
Definition: SortedCollection.h:80
MessageLogger.h
edm::Run
Definition: Run.h:45
min
T min(T a, T b)
Definition: MathUtil.h:58
EcalMonitorPrescaler::~EcalMonitorPrescaler
~EcalMonitorPrescaler() override
Definition: EcalMonitorPrescaler.cc:74
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::SortedCollection
Definition: SortedCollection.h:49
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:215
EcalMonitorPrescaler::beginRun
void beginRun(edm::Run const &, edm::EventSetup const &) override
Definition: EcalMonitorPrescaler.cc:76
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
EcalMonitorPrescaler::kLed
Definition: EcalMonitorPrescaler.h:18
edm::Handle
Definition: AssociativeIterator.h:50
dqmdumpme.first
first
Definition: dqmdumpme.py:55
EcalDCCHeaderBlock::LED_GAP
Definition: EcalDCCHeaderBlock.h:45
EcalMonitorPrescaler::kLaser
Definition: EcalMonitorPrescaler.h:18
EcalDCCHeaderBlock::TESTPULSE_GAP
Definition: EcalDCCHeaderBlock.h:43
EcalDCCHeaderBlock::LASER_GAP
Definition: EcalDCCHeaderBlock.h:42
EcalDCCHeaderBlock::PHYSICS_GLOBAL
Definition: EcalDCCHeaderBlock.h:37
MakerMacros.h
EcalDCCHeaderBlock::LASER_STD
Definition: EcalDCCHeaderBlock.h:26
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
EcalMonitorPrescaler::filterBits_
static uint32_t filterBits_[nPrescalers]
Definition: EcalMonitorPrescaler.h:20
edm::SortedCollection::begin
const_iterator begin() const
Definition: SortedCollection.h:262
EcalMonitorPrescaler::EcalMonitorPrescaler
EcalMonitorPrescaler(edm::ParameterSet const &)
Definition: EcalMonitorPrescaler.cc:29
EcalDCCHeaderBlock::PEDESTAL_GAP
Definition: EcalDCCHeaderBlock.h:44
EcalMonitorPrescaler::nPrescalers
Definition: EcalMonitorPrescaler.h:18
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:528
EcalMonitorPrescaler
Definition: EcalMonitorPrescaler.h:9
EcalDCCHeaderBlock::TESTPULSE_MGPA
Definition: EcalDCCHeaderBlock.h:30
EcalMonitorPrescaler.h
EcalMonitorPrescaler::EcalRawDataCollection_
edm::EDGetTokenT< EcalRawDataCollection > EcalRawDataCollection_
Definition: EcalMonitorPrescaler.h:22
edm::LogWarning
Definition: MessageLogger.h:141
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
edm::ParameterSet
Definition: ParameterSet.h:36
Event.h
edm::SortedCollection::end
const_iterator end() const
Definition: SortedCollection.h:267
EcalDCCHeaderBlock::PHYSICS_LOCAL
Definition: EcalDCCHeaderBlock.h:48
EcalMonitorPrescaler::kPhysics
Definition: EcalMonitorPrescaler.h:18
EcalDCCHeaderBlock::PEDESTAL_STD
Definition: EcalDCCHeaderBlock.h:31
edm::EventSetup
Definition: EventSetup.h:57
EcalMonitorPrescaler::kPedestal
Definition: EcalMonitorPrescaler.h:18
EcalDCCHeaderBlock::COSMICS_GLOBAL
Definition: EcalDCCHeaderBlock.h:38
EcalMonitorPrescaler::filter
bool filter(edm::Event &, edm::EventSetup const &) override
Definition: EcalMonitorPrescaler.cc:81
EcalDCCHeaderBlock::PEDESTAL_OFFSET_SCAN
Definition: EcalDCCHeaderBlock.h:32
EcalDCCHeaderBlock::MTCC
Definition: EcalDCCHeaderBlock.h:25
EventSetup.h
EcalDCCHeaderBlock::COSMIC
Definition: EcalDCCHeaderBlock.h:22
ParameterSet.h
EcalDCCHeaderBlock::LED_STD
Definition: EcalDCCHeaderBlock.h:34
EcalMonitorPrescaler::kCalibration
Definition: EcalMonitorPrescaler.h:18
edm::Event
Definition: Event.h:73
EcalMonitorPrescaler::kCosmics
Definition: EcalMonitorPrescaler.h:18
EcalMonitorPrescaler::kTestPulse
Definition: EcalMonitorPrescaler.h:18
EcalMonitorPrescaler::prescalers_
std::pair< unsigned, unsigned > prescalers_[nPrescalers]
Definition: EcalMonitorPrescaler.h:24