CMS 3D CMS Logo

OccupancyTask.cc
Go to the documentation of this file.
7 
8 namespace ecaldqm {
9  OccupancyTask::OccupancyTask() : DQWorkerTask(), recHitThreshold_(0.), tpThreshold_(0.), m_iTime(0.) {}
10 
12  recHitThreshold_ = _params.getUntrackedParameter<double>("recHitThreshold");
13  tpThreshold_ = _params.getUntrackedParameter<double>("tpThreshold");
14  }
15 
17 
18  bool OccupancyTask::filterRunType(short const* _runType) {
19  for (int iFED(0); iFED < 54; iFED++) {
20  if (_runType[iFED] == EcalDCCHeaderBlock::COSMIC || _runType[iFED] == EcalDCCHeaderBlock::MTCC ||
21  _runType[iFED] == EcalDCCHeaderBlock::COSMICS_GLOBAL ||
22  _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_GLOBAL || _runType[iFED] == EcalDCCHeaderBlock::COSMICS_LOCAL ||
23  _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_LOCAL)
24  return true;
25  }
26 
27  return false;
28  }
29 
30  void OccupancyTask::beginRun(edm::Run const&, edm::EventSetup const& _es) { FillLaser = true; }
32  edm::EventSetup const& _es,
33  bool const& ByLumiResetSwitch,
34  bool&) {
35  if (ByLumiResetSwitch) {
36  MEs_.at("DigiAllByLumi").reset(GetElectronicsMap());
37  MEs_.at("TPDigiThrAllByLumi").reset(GetElectronicsMap());
38  MEs_.at("RecHitThrAllByLumi").reset(GetElectronicsMap());
39  }
40  MESet& meLaserCorrProjEta(MEs_.at("LaserCorrProjEta"));
41  m_iTime = _evt.time().value();
42  if (FillLaser) {
43  float lasercalib = 1.;
44  auto const& laser = &_es.getData(lasertoken_);
45  const edm::Timestamp& evtTimeStamp = edm::Timestamp(m_iTime);
46 
47  for (int i = 0; i < EBDetId::kSizeForDenseIndexing; i++) {
49  continue;
51  lasercalib = laser->getLaserCorrection(ebid, evtTimeStamp);
52  meLaserCorrProjEta.fill(getEcalDQMSetupObjects(), ebid, lasercalib);
53  }
54 
55  for (int i = 0; i < EEDetId::kSizeForDenseIndexing; i++) {
57  continue;
59  lasercalib = laser->getLaserCorrection(eeid, evtTimeStamp);
60  meLaserCorrProjEta.fill(getEcalDQMSetupObjects(), eeid, lasercalib);
61  }
62  FillLaser = false;
63  }
64  }
65 
67  MESet& meDCC(MEs_.at("DCC"));
68 
69  for (EcalRawDataCollection::const_iterator dcchItr(_dcchs.begin()); dcchItr != _dcchs.end(); ++dcchItr)
70  meDCC.fill(getEcalDQMSetupObjects(), dcchItr->id());
71  }
72 
73  template <typename DigiCollection>
74  void OccupancyTask::runOnDigis(DigiCollection const& _digis, Collections _collection) {
75  MESet& meDigi(MEs_.at("Digi"));
76  MESet& meDigiProjEta(MEs_.at("DigiProjEta"));
77  MESet& meDigiProjPhi(MEs_.at("DigiProjPhi"));
78  MESet& meDigiAll(MEs_.at("DigiAll"));
79  MESet& meDigiAllByLumi(MEs_.at("DigiAllByLumi"));
80  MESet& meDigiDCC(MEs_.at("DigiDCC"));
81  MESet& meDigi1D(MEs_.at("Digi1D"));
82  MESet& meTrendNDigi(MEs_.at("TrendNDigi"));
83 
84  std::for_each(_digis.begin(), _digis.end(), [&](typename DigiCollection::Digi const& digi) {
85  DetId id(digi.id());
86  meDigi.fill(getEcalDQMSetupObjects(), id);
87  meDigiProjEta.fill(getEcalDQMSetupObjects(), id);
88  meDigiProjPhi.fill(getEcalDQMSetupObjects(), id);
89  meDigiAll.fill(getEcalDQMSetupObjects(), id);
90  meDigiAllByLumi.fill(getEcalDQMSetupObjects(), id);
91  meDigiDCC.fill(getEcalDQMSetupObjects(), id);
92  });
93 
94  int iSubdet(_collection == kEBDigi ? EcalBarrel : EcalEndcap);
95  meDigi1D.fill(getEcalDQMSetupObjects(), iSubdet, double(_digis.size()));
96  meTrendNDigi.fill(getEcalDQMSetupObjects(), iSubdet, double(timestamp_.iLumi), double(_digis.size()));
97  }
98 
100  // MESet& meTPDigiAll(MEs_.at("TPDigiAll"));
101  // MESet& meTPDigiProjEta(MEs_.at("TPDigiProjEta"));
102  // MESet& meTPDigiProjPhi(MEs_.at("TPDigiProjPhi"));
103  MESet& meTPDigiRCT(MEs_.at("TPDigiRCT"));
104  MESet& meTPDigiThrAll(MEs_.at("TPDigiThrAll"));
105  MESet& meTPDigiThrAllByLumi(MEs_.at("TPDigiThrAllByLumi"));
106  MESet& meTPDigiThrProjEta(MEs_.at("TPDigiThrProjEta"));
107  MESet& meTPDigiThrProjPhi(MEs_.at("TPDigiThrProjPhi"));
108  MESet& meTrendNTPDigi(MEs_.at("TrendNTPDigi"));
109 
110  double nFilteredEB(0.);
111  double nFilteredEE(0.);
112 
113  std::for_each(_digis.begin(), _digis.end(), [&](EcalTrigPrimDigiCollection::value_type const& digi) {
114  EcalTrigTowerDetId const& id(digi.id());
115  // meTPDigiProjEta.fill(id);
116  // meTPDigiProjPhi.fill(id);
117  // meTPDigiAll.fill(id);
118  if (digi.compressedEt() > tpThreshold_) {
119  meTPDigiThrProjEta.fill(getEcalDQMSetupObjects(), id);
120  meTPDigiThrProjPhi.fill(getEcalDQMSetupObjects(), id);
121  meTPDigiThrAll.fill(getEcalDQMSetupObjects(), id);
122  meTPDigiThrAllByLumi.fill(getEcalDQMSetupObjects(), id);
123  meTPDigiRCT.fill(getEcalDQMSetupObjects(), id);
124  if (id.subDet() == EcalBarrel)
125  nFilteredEB += 1.;
126  else
127  nFilteredEE += 1.;
128  }
129  });
130 
131  meTrendNTPDigi.fill(getEcalDQMSetupObjects(), EcalBarrel, double(timestamp_.iLumi), nFilteredEB);
132  meTrendNTPDigi.fill(getEcalDQMSetupObjects(), EcalEndcap, double(timestamp_.iLumi), nFilteredEE);
133  }
134 
136  MESet& meRecHitAll(MEs_.at("RecHitAll"));
137  MESet& meRecHitProjEta(MEs_.at("RecHitProjEta"));
138  MESet& meRecHitProjPhi(MEs_.at("RecHitProjPhi"));
139  MESet& meRecHitThrAll(MEs_.at("RecHitThrAll"));
140  MESet& meRecHitThrAllByLumi(MEs_.at("RecHitThrAllByLumi"));
141  MESet& meRecHitThrmvp(MEs_.at("RecHitThrmvp"));
142  MESet& meRecHitThrpm(MEs_.at("RecHitThrpm"));
143  MESet& meRecHitThrProjEta(MEs_.at("RecHitThrProjEta"));
144  MESet& meRecHitThrProjPhi(MEs_.at("RecHitThrProjPhi"));
145  MESet& meRecHitThr1D(MEs_.at("RecHitThr1D"));
146  MESet& meTrendNRecHitThr(MEs_.at("TrendNRecHitThr"));
147 
148  uint32_t mask(~(0x1 << EcalRecHit::kGood));
149  double nFiltered(0.);
150 
151  float nRHThrp(0), nRHThrm(0);
152  int iSubdet(_collection == kEBRecHit ? EcalBarrel : EcalEndcap);
153  std::for_each(_hits.begin(), _hits.end(), [&](EcalRecHitCollection::value_type const& hit) {
154  DetId id(hit.id());
155 
156  meRecHitAll.fill(getEcalDQMSetupObjects(), id);
157  meRecHitProjEta.fill(getEcalDQMSetupObjects(), id);
158  meRecHitProjPhi.fill(getEcalDQMSetupObjects(), id);
159 
160  if (!hit.checkFlagMask(mask) && hit.energy() > recHitThreshold_) {
161  meRecHitThrProjEta.fill(getEcalDQMSetupObjects(), id);
162  meRecHitThrProjPhi.fill(getEcalDQMSetupObjects(), id);
163  meRecHitThrAll.fill(getEcalDQMSetupObjects(), id);
164  meRecHitThrAllByLumi.fill(getEcalDQMSetupObjects(), id);
165  nFiltered += 1.;
166  bool isPlusFar(iSubdet == EcalBarrel ? (EBDetId(id).iphi() > 100 && EBDetId(id).iphi() < 280) : zside(id) > 0);
167  if (isPlusFar)
168  nRHThrp++;
169  else
170  nRHThrm++;
171  }
172  });
173 
174  meRecHitThr1D.fill(getEcalDQMSetupObjects(), iSubdet, nFiltered);
175  meTrendNRecHitThr.fill(getEcalDQMSetupObjects(), iSubdet, double(timestamp_.iLumi), nFiltered);
176  meRecHitThrmvp.fill(getEcalDQMSetupObjects(), iSubdet, nRHThrp, nRHThrm);
177  meRecHitThrpm.fill(getEcalDQMSetupObjects(), iSubdet, nRHThrp - nRHThrm);
178  }
179 
181 } // namespace ecaldqm
EcalDCCHeaderBlock::COSMICS_LOCAL
Definition: EcalDCCHeaderBlock.h:49
EcalRecHit
Definition: EcalRecHit.h:15
mps_fire.i
i
Definition: mps_fire.py:428
edm::SortedCollection::const_iterator
std::vector< T >::const_iterator const_iterator
Definition: SortedCollection.h:80
ecaldqm
Definition: DQWorker.h:37
hit::id
unsigned int id
Definition: SiStripHitEffFromCalibTree.cc:92
ecaldqm::OccupancyTask::setTokens
void setTokens(edm::ConsumesCollector &) override
Definition: OccupancyTask.cc:16
edm::Run
Definition: Run.h:45
ecaldqm::zside
int zside(DetId const &)
Definition: EcalDQMCommonUtils.cc:189
EBDetId
Definition: EBDetId.h:17
EEDetId::unhashIndex
static EEDetId unhashIndex(int hi)
Definition: EEDetId.cc:65
ecaldqm::MESet::fill
virtual void fill(EcalDQMSetupObjects const, DetId const &, double=1., double=1., double=1.)
Definition: MESet.h:74
EBDetId::unhashIndex
static EBDetId unhashIndex(int hi)
get a DetId from a compact index for arrays
Definition: EBDetId.h:110
l1extraParticles_cfi._params
_params
Definition: l1extraParticles_cfi.py:29
TrendClient_cfi.Digi
Digi
Definition: TrendClient_cfi.py:7
edm::SortedCollection
Definition: SortedCollection.h:49
edm::Timestamp::value
TimeValue_t value() const
Definition: Timestamp.h:45
EcalTrigTowerDetId
Definition: EcalTrigTowerDetId.h:14
edm::EventBase::time
edm::Timestamp time() const
Definition: EventBase.h:60
edm::ConsumesCollector::esConsumes
auto esConsumes()
Definition: ConsumesCollector.h:97
ecaldqm::DQWorker::GetElectronicsMap
const EcalElectronicsMapping * GetElectronicsMap()
Definition: DQWorker.cc:118
EcalBarrel
Definition: EcalSubdetector.h:10
LEDCalibrationChannels.iphi
iphi
Definition: LEDCalibrationChannels.py:64
DetId
Definition: DetId.h:17
EcalDCCHeaderBlock::PHYSICS_GLOBAL
Definition: EcalDCCHeaderBlock.h:37
testProducerWithPsetDescEmpty_cfi.x1
x1
Definition: testProducerWithPsetDescEmpty_cfi.py:33
EEDetId::validDenseIndex
static bool validDenseIndex(uint32_t din)
Definition: EEDetId.h:213
ecaldqm::OccupancyTask::beginRun
void beginRun(edm::Run const &, edm::EventSetup const &) override
Definition: OccupancyTask.cc:30
ecaldqm::DQWorkerTask
Definition: DQWorkerTask.h:71
ecaldqm::MESet::reset
virtual void reset(EcalElectronicsMapping const *, double=0., double=0., double=0.)
Definition: MESet.cc:98
edm::SortedCollection::begin
const_iterator begin() const
Definition: SortedCollection.h:262
ecaldqm::OccupancyTask::runOnDigis
void runOnDigis(DigiCollection const &, Collections)
Definition: OccupancyTask.cc:74
EEDetId::kSizeForDenseIndexing
Definition: EEDetId.h:329
ecaldqm::kEBRecHit
Definition: Collections.h:36
EcalRecHit::kGood
Definition: EcalRecHit.h:21
ecaldqm::OccupancyTask::recHitThreshold_
float recHitThreshold_
Definition: OccupancyTask.h:38
ecaldqm::OccupancyTask
Definition: OccupancyTask.h:16
ecaldqm::DQWorker::MEs_
MESetCollection MEs_
Definition: DQWorker.h:125
OccupancyTask.h
EEDetId
Definition: EEDetId.h:14
EcalEndcap
Definition: EcalSubdetector.h:10
ecaldqm::OccupancyTask::lasertoken_
edm::ESGetToken< EcalLaserDbService, EcalLaserDbRecord > lasertoken_
Definition: OccupancyTask.h:36
ecaldqm::OccupancyTask::tpThreshold_
float tpThreshold_
Definition: OccupancyTask.h:39
ecaldqm::OccupancyTask::setParams
void setParams(edm::ParameterSet const &) override
Definition: OccupancyTask.cc:11
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
ecaldqm::OccupancyTask::runOnRawData
void runOnRawData(EcalRawDataCollection const &)
Definition: OccupancyTask.cc:66
edm::SortedCollection::end
const_iterator end() const
Definition: SortedCollection.h:267
EcalDCCHeaderBlock::PHYSICS_LOCAL
Definition: EcalDCCHeaderBlock.h:48
ecaldqm::MESetCollection::at
MESet & at(const std::string &key)
Definition: MESet.h:399
EBDetId::validDenseIndex
static bool validDenseIndex(uint32_t din)
Definition: EBDetId.h:105
ecaldqm::Collections
Collections
Definition: Collections.h:8
EcalDCCHeaderBlock.h
edm::EventSetup
Definition: EventSetup.h:58
ecaldqm::OccupancyTask::runOnTPDigis
void runOnTPDigis(EcalTrigPrimDigiCollection const &)
Definition: OccupancyTask.cc:99
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
ecaldqm::OccupancyTask::OccupancyTask
OccupancyTask()
Definition: OccupancyTask.cc:9
ecaldqm::DQWorker::Timestamp::iLumi
edm::LuminosityBlockNumber_t iLumi
Definition: DQWorker.h:48
ecaldqm::DQWorker::getEcalDQMSetupObjects
const EcalDQMSetupObjects getEcalDQMSetupObjects()
Definition: DQWorker.cc:142
EcalDCCHeaderBlock::COSMICS_GLOBAL
Definition: EcalDCCHeaderBlock.h:38
siStripShotFilter_cfi.DigiCollection
DigiCollection
Definition: siStripShotFilter_cfi.py:6
ecaldqm::kEBDigi
Definition: Collections.h:25
edm::SortedCollection::value_type
T value_type
Definition: SortedCollection.h:77
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
EBDetId::kSizeForDenseIndexing
Definition: EBDetId.h:155
EcalDCCHeaderBlock::MTCC
Definition: EcalDCCHeaderBlock.h:25
ecaldqm::OccupancyTask::filterRunType
bool filterRunType(short const *) override
Definition: OccupancyTask.cc:18
ecaldqm::DQWorker::timestamp_
Timestamp timestamp_
Definition: DQWorker.h:128
EcalDCCHeaderBlock::COSMIC
Definition: EcalDCCHeaderBlock.h:22
DEFINE_ECALDQM_WORKER
#define DEFINE_ECALDQM_WORKER(TYPE)
Definition: DQWorker.h:162
ConsumesCollector.h
ParameterSet.h
ecaldqm::OccupancyTask::FillLaser
bool FillLaser
Definition: OccupancyTask.h:37
ecaldqm::OccupancyTask::m_iTime
edm::TimeValue_t m_iTime
Definition: OccupancyTask.h:40
edm::Event
Definition: Event.h:73
ecaldqm::OccupancyTask::runOnRecHits
void runOnRecHits(EcalRecHitCollection const &, Collections)
Definition: OccupancyTask.cc:135
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
EcalCondDBWriter_cfi.laser
laser
Definition: EcalCondDBWriter_cfi.py:46
hit
Definition: SiStripHitEffFromCalibTree.cc:88
EcalDQMCommonUtils.h
ecaldqm::OccupancyTask::beginEvent
void beginEvent(edm::Event const &, edm::EventSetup const &, bool const &, bool &) override
Definition: OccupancyTask.cc:31
ecaldqm::MESet
Definition: MESet.h:42
edm::Timestamp
Definition: Timestamp.h:30