CMS 3D CMS Logo

OccupancyTask.cc
Go to the documentation of this file.
2 
5 
7 
8 namespace ecaldqm {
9  OccupancyTask::OccupancyTask() : DQWorkerTask(), recHitThreshold_(0.), tpThreshold_(0.) {}
10 
12  recHitThreshold_ = _params.getUntrackedParameter<double>("recHitThreshold");
13  tpThreshold_ = _params.getUntrackedParameter<double>("tpThreshold");
14  }
15 
16  bool OccupancyTask::filterRunType(short const* _runType) {
17  for (int iFED(0); iFED < 54; iFED++) {
18  if (_runType[iFED] == EcalDCCHeaderBlock::COSMIC || _runType[iFED] == EcalDCCHeaderBlock::MTCC ||
19  _runType[iFED] == EcalDCCHeaderBlock::COSMICS_GLOBAL ||
20  _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_GLOBAL || _runType[iFED] == EcalDCCHeaderBlock::COSMICS_LOCAL ||
21  _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_LOCAL)
22  return true;
23  }
24 
25  return false;
26  }
27 
29  edm::EventSetup const& _es,
30  bool const& ByLumiResetSwitch,
31  bool&) {
32  if (ByLumiResetSwitch) {
33  MEs_.at("DigiAllByLumi").reset();
34  MEs_.at("TPDigiThrAllByLumi").reset();
35  MEs_.at("RecHitThrAllByLumi").reset();
36  }
37  }
38 
40  MESet& meDCC(MEs_.at("DCC"));
41 
42  for (EcalRawDataCollection::const_iterator dcchItr(_dcchs.begin()); dcchItr != _dcchs.end(); ++dcchItr)
43  meDCC.fill(dcchItr->id());
44  }
45 
46  template <typename DigiCollection>
47  void OccupancyTask::runOnDigis(DigiCollection const& _digis, Collections _collection) {
48  MESet& meDigi(MEs_.at("Digi"));
49  MESet& meDigiProjEta(MEs_.at("DigiProjEta"));
50  MESet& meDigiProjPhi(MEs_.at("DigiProjPhi"));
51  MESet& meDigiAll(MEs_.at("DigiAll"));
52  MESet& meDigiAllByLumi(MEs_.at("DigiAllByLumi"));
53  MESet& meDigiDCC(MEs_.at("DigiDCC"));
54  MESet& meDigi1D(MEs_.at("Digi1D"));
55  MESet& meTrendNDigi(MEs_.at("TrendNDigi"));
56 
57  std::for_each(_digis.begin(), _digis.end(), [&](typename DigiCollection::Digi const& digi) {
58  DetId id(digi.id());
59  meDigi.fill(id);
60  meDigiProjEta.fill(id);
61  meDigiProjPhi.fill(id);
62  meDigiAll.fill(id);
63  meDigiAllByLumi.fill(id);
64  meDigiDCC.fill(id);
65  });
66 
67  int iSubdet(_collection == kEBDigi ? EcalBarrel : EcalEndcap);
68  meDigi1D.fill(iSubdet, double(_digis.size()));
69  meTrendNDigi.fill(iSubdet, double(timestamp_.iLumi), double(_digis.size()));
70  }
71 
73  // MESet& meTPDigiAll(MEs_.at("TPDigiAll"));
74  // MESet& meTPDigiProjEta(MEs_.at("TPDigiProjEta"));
75  // MESet& meTPDigiProjPhi(MEs_.at("TPDigiProjPhi"));
76  MESet& meTPDigiRCT(MEs_.at("TPDigiRCT"));
77  MESet& meTPDigiThrAll(MEs_.at("TPDigiThrAll"));
78  MESet& meTPDigiThrAllByLumi(MEs_.at("TPDigiThrAllByLumi"));
79  MESet& meTPDigiThrProjEta(MEs_.at("TPDigiThrProjEta"));
80  MESet& meTPDigiThrProjPhi(MEs_.at("TPDigiThrProjPhi"));
81  MESet& meTrendNTPDigi(MEs_.at("TrendNTPDigi"));
82 
83  double nFilteredEB(0.);
84  double nFilteredEE(0.);
85 
86  std::for_each(_digis.begin(), _digis.end(), [&](EcalTrigPrimDigiCollection::value_type const& digi) {
87  EcalTrigTowerDetId const& id(digi.id());
88  // meTPDigiProjEta.fill(id);
89  // meTPDigiProjPhi.fill(id);
90  // meTPDigiAll.fill(id);
91  if (digi.compressedEt() > tpThreshold_) {
92  meTPDigiThrProjEta.fill(id);
93  meTPDigiThrProjPhi.fill(id);
94  meTPDigiThrAll.fill(id);
95  meTPDigiThrAllByLumi.fill(id);
96  meTPDigiRCT.fill(id);
97  if (id.subDet() == EcalBarrel)
98  nFilteredEB += 1.;
99  else
100  nFilteredEE += 1.;
101  }
102  });
103 
104  meTrendNTPDigi.fill(EcalBarrel, double(timestamp_.iLumi), nFilteredEB);
105  meTrendNTPDigi.fill(EcalEndcap, double(timestamp_.iLumi), nFilteredEE);
106  }
107 
109  MESet& meRecHitAll(MEs_.at("RecHitAll"));
110  MESet& meRecHitProjEta(MEs_.at("RecHitProjEta"));
111  MESet& meRecHitProjPhi(MEs_.at("RecHitProjPhi"));
112  MESet& meRecHitThrAll(MEs_.at("RecHitThrAll"));
113  MESet& meRecHitThrAllByLumi(MEs_.at("RecHitThrAllByLumi"));
114  MESet& meRecHitThrmvp(MEs_.at("RecHitThrmvp"));
115  MESet& meRecHitThrpm(MEs_.at("RecHitThrpm"));
116  MESet& meRecHitThrProjEta(MEs_.at("RecHitThrProjEta"));
117  MESet& meRecHitThrProjPhi(MEs_.at("RecHitThrProjPhi"));
118  MESet& meRecHitThr1D(MEs_.at("RecHitThr1D"));
119  MESet& meTrendNRecHitThr(MEs_.at("TrendNRecHitThr"));
120 
121  uint32_t mask(~(0x1 << EcalRecHit::kGood));
122  double nFiltered(0.);
123 
124  float nRHThrp(0), nRHThrm(0);
125  int iSubdet(_collection == kEBRecHit ? EcalBarrel : EcalEndcap);
126  std::for_each(_hits.begin(), _hits.end(), [&](EcalRecHitCollection::value_type const& hit) {
127  DetId id(hit.id());
128 
129  meRecHitAll.fill(id);
130  meRecHitProjEta.fill(id);
131  meRecHitProjPhi.fill(id);
132 
133  if (!hit.checkFlagMask(mask) && hit.energy() > recHitThreshold_) {
134  meRecHitThrProjEta.fill(id);
135  meRecHitThrProjPhi.fill(id);
136  meRecHitThrAll.fill(id);
137  meRecHitThrAllByLumi.fill(id);
138  nFiltered += 1.;
139  bool isPlusFar(iSubdet == EcalBarrel ? (EBDetId(id).iphi() > 100 && EBDetId(id).iphi() < 280) : zside(id) > 0);
140  if (isPlusFar)
141  nRHThrp++;
142  else
143  nRHThrm++;
144  }
145  });
146 
147  meRecHitThr1D.fill(iSubdet, nFiltered);
148  meTrendNRecHitThr.fill(iSubdet, double(timestamp_.iLumi), nFiltered);
149  meRecHitThrmvp.fill(iSubdet, nRHThrp, nRHThrm);
150  meRecHitThrpm.fill(iSubdet, nRHThrp - nRHThrm);
151  }
152 
154 } // namespace ecaldqm
EcalDCCHeaderBlock::COSMICS_LOCAL
Definition: EcalDCCHeaderBlock.h:49
EcalRecHit
Definition: EcalRecHit.h:15
edm::SortedCollection::const_iterator
std::vector< T >::const_iterator const_iterator
Definition: SortedCollection.h:80
ecaldqm
Definition: DQWorker.h:24
hit::id
unsigned int id
Definition: SiStripHitEffFromCalibTree.cc:92
ecaldqm::zside
int zside(DetId const &)
Definition: EcalDQMCommonUtils.cc:189
EBDetId
Definition: EBDetId.h:17
l1extraParticles_cfi._params
_params
Definition: l1extraParticles_cfi.py:29
TrendClient_cfi.Digi
Digi
Definition: TrendClient_cfi.py:7
edm::SortedCollection
Definition: SortedCollection.h:49
EcalTrigTowerDetId
Definition: EcalTrigTowerDetId.h:14
EcalBarrel
Definition: EcalSubdetector.h:10
LEDCalibrationChannels.iphi
iphi
Definition: LEDCalibrationChannels.py:64
ecaldqm::MESet::fill
virtual void fill(DetId const &, double=1., double=1., double=1.)
Definition: MESet.h:46
DetId
Definition: DetId.h:17
EcalDCCHeaderBlock::PHYSICS_GLOBAL
Definition: EcalDCCHeaderBlock.h:37
testProducerWithPsetDescEmpty_cfi.x1
x1
Definition: testProducerWithPsetDescEmpty_cfi.py:33
ecaldqm::DQWorkerTask
Definition: DQWorkerTask.h:71
edm::SortedCollection::begin
const_iterator begin() const
Definition: SortedCollection.h:262
ecaldqm::OccupancyTask::runOnDigis
void runOnDigis(DigiCollection const &, Collections)
Definition: OccupancyTask.cc:47
ecaldqm::kEBRecHit
Definition: Collections.h:36
EcalRecHit::kGood
Definition: EcalRecHit.h:21
ecaldqm::OccupancyTask::recHitThreshold_
float recHitThreshold_
Definition: OccupancyTask.h:31
ecaldqm::OccupancyTask
Definition: OccupancyTask.h:11
ecaldqm::DQWorker::MEs_
MESetCollection MEs_
Definition: DQWorker.h:78
OccupancyTask.h
EcalEndcap
Definition: EcalSubdetector.h:10
ecaldqm::OccupancyTask::tpThreshold_
float tpThreshold_
Definition: OccupancyTask.h:32
ecaldqm::OccupancyTask::setParams
void setParams(edm::ParameterSet const &) override
Definition: OccupancyTask.cc:11
edm::ParameterSet
Definition: ParameterSet.h:47
ecaldqm::OccupancyTask::runOnRawData
void runOnRawData(EcalRawDataCollection const &)
Definition: OccupancyTask.cc:39
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:362
ecaldqm::Collections
Collections
Definition: Collections.h:8
ecaldqm::MESet::reset
virtual void reset(double=0., double=0., double=0.)
Definition: MESet.cc:98
EcalDCCHeaderBlock.h
edm::EventSetup
Definition: EventSetup.h:57
ecaldqm::OccupancyTask::runOnTPDigis
void runOnTPDigis(EcalTrigPrimDigiCollection const &)
Definition: OccupancyTask.cc:72
ecaldqm::OccupancyTask::OccupancyTask
OccupancyTask()
Definition: OccupancyTask.cc:9
ecaldqm::DQWorker::Timestamp::iLumi
edm::LuminosityBlockNumber_t iLumi
Definition: DQWorker.h:35
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:31
EcalDCCHeaderBlock::MTCC
Definition: EcalDCCHeaderBlock.h:25
ecaldqm::OccupancyTask::filterRunType
bool filterRunType(short const *) override
Definition: OccupancyTask.cc:16
ecaldqm::DQWorker::timestamp_
Timestamp timestamp_
Definition: DQWorker.h:81
EcalDCCHeaderBlock::COSMIC
Definition: EcalDCCHeaderBlock.h:22
DEFINE_ECALDQM_WORKER
#define DEFINE_ECALDQM_WORKER(TYPE)
Definition: DQWorker.h:112
ParameterSet.h
edm::Event
Definition: Event.h:73
ecaldqm::OccupancyTask::runOnRecHits
void runOnRecHits(EcalRecHitCollection const &, Collections)
Definition: OccupancyTask.cc:108
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:28
ecaldqm::MESet
Definition: MESet.h:27