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  // Reset by LS plots at beginning of every LS
30  MEs_.at("DigiAllByLumi").reset();
31  MEs_.at("TPDigiThrAllByLumi").reset();
32  MEs_.at("RecHitThrAllByLumi").reset();
33  }
34 
36  MESet& meDCC(MEs_.at("DCC"));
37 
38  for (EcalRawDataCollection::const_iterator dcchItr(_dcchs.begin()); dcchItr != _dcchs.end(); ++dcchItr)
39  meDCC.fill(dcchItr->id());
40  }
41 
42  template <typename DigiCollection>
43  void OccupancyTask::runOnDigis(DigiCollection const& _digis, Collections _collection) {
44  MESet& meDigi(MEs_.at("Digi"));
45  MESet& meDigiProjEta(MEs_.at("DigiProjEta"));
46  MESet& meDigiProjPhi(MEs_.at("DigiProjPhi"));
47  MESet& meDigiAll(MEs_.at("DigiAll"));
48  MESet& meDigiAllByLumi(MEs_.at("DigiAllByLumi"));
49  MESet& meDigiDCC(MEs_.at("DigiDCC"));
50  MESet& meDigi1D(MEs_.at("Digi1D"));
51  MESet& meTrendNDigi(MEs_.at("TrendNDigi"));
52 
53  std::for_each(_digis.begin(), _digis.end(), [&](typename DigiCollection::Digi const& digi) {
54  DetId id(digi.id());
55  meDigi.fill(id);
56  meDigiProjEta.fill(id);
57  meDigiProjPhi.fill(id);
58  meDigiAll.fill(id);
59  meDigiAllByLumi.fill(id);
60  meDigiDCC.fill(id);
61  });
62 
63  int iSubdet(_collection == kEBDigi ? EcalBarrel : EcalEndcap);
64  meDigi1D.fill(iSubdet, double(_digis.size()));
65  meTrendNDigi.fill(iSubdet, double(timestamp_.iLumi), double(_digis.size()));
66  }
67 
69  // MESet& meTPDigiAll(MEs_.at("TPDigiAll"));
70  // MESet& meTPDigiProjEta(MEs_.at("TPDigiProjEta"));
71  // MESet& meTPDigiProjPhi(MEs_.at("TPDigiProjPhi"));
72  MESet& meTPDigiRCT(MEs_.at("TPDigiRCT"));
73  MESet& meTPDigiThrAll(MEs_.at("TPDigiThrAll"));
74  MESet& meTPDigiThrAllByLumi(MEs_.at("TPDigiThrAllByLumi"));
75  MESet& meTPDigiThrProjEta(MEs_.at("TPDigiThrProjEta"));
76  MESet& meTPDigiThrProjPhi(MEs_.at("TPDigiThrProjPhi"));
77  MESet& meTrendNTPDigi(MEs_.at("TrendNTPDigi"));
78 
79  double nFilteredEB(0.);
80  double nFilteredEE(0.);
81 
82  std::for_each(_digis.begin(), _digis.end(), [&](EcalTrigPrimDigiCollection::value_type const& digi) {
83  EcalTrigTowerDetId const& id(digi.id());
84  // meTPDigiProjEta.fill(id);
85  // meTPDigiProjPhi.fill(id);
86  // meTPDigiAll.fill(id);
87  if (digi.compressedEt() > tpThreshold_) {
88  meTPDigiThrProjEta.fill(id);
89  meTPDigiThrProjPhi.fill(id);
90  meTPDigiThrAll.fill(id);
91  meTPDigiThrAllByLumi.fill(id);
92  meTPDigiRCT.fill(id);
93  if (id.subDet() == EcalBarrel)
94  nFilteredEB += 1.;
95  else
96  nFilteredEE += 1.;
97  }
98  });
99 
100  meTrendNTPDigi.fill(EcalBarrel, double(timestamp_.iLumi), nFilteredEB);
101  meTrendNTPDigi.fill(EcalEndcap, double(timestamp_.iLumi), nFilteredEE);
102  }
103 
105  MESet& meRecHitAll(MEs_.at("RecHitAll"));
106  MESet& meRecHitProjEta(MEs_.at("RecHitProjEta"));
107  MESet& meRecHitProjPhi(MEs_.at("RecHitProjPhi"));
108  MESet& meRecHitThrAll(MEs_.at("RecHitThrAll"));
109  MESet& meRecHitThrAllByLumi(MEs_.at("RecHitThrAllByLumi"));
110  MESet& meRecHitThrmvp(MEs_.at("RecHitThrmvp"));
111  MESet& meRecHitThrpm(MEs_.at("RecHitThrpm"));
112  MESet& meRecHitThrProjEta(MEs_.at("RecHitThrProjEta"));
113  MESet& meRecHitThrProjPhi(MEs_.at("RecHitThrProjPhi"));
114  MESet& meRecHitThr1D(MEs_.at("RecHitThr1D"));
115  MESet& meTrendNRecHitThr(MEs_.at("TrendNRecHitThr"));
116 
117  uint32_t mask(~(0x1 << EcalRecHit::kGood));
118  double nFiltered(0.);
119 
120  float nRHThrp(0), nRHThrm(0);
121  int iSubdet(_collection == kEBRecHit ? EcalBarrel : EcalEndcap);
122  std::for_each(_hits.begin(), _hits.end(), [&](EcalRecHitCollection::value_type const& hit) {
123  DetId id(hit.id());
124 
125  meRecHitAll.fill(id);
126  meRecHitProjEta.fill(id);
127  meRecHitProjPhi.fill(id);
128 
129  if (!hit.checkFlagMask(mask) && hit.energy() > recHitThreshold_) {
130  meRecHitThrProjEta.fill(id);
131  meRecHitThrProjPhi.fill(id);
132  meRecHitThrAll.fill(id);
133  meRecHitThrAllByLumi.fill(id);
134  nFiltered += 1.;
135  bool isPlusFar(iSubdet == EcalBarrel ? (EBDetId(id).iphi() > 100 && EBDetId(id).iphi() < 280) : zside(id) > 0);
136  if (isPlusFar)
137  nRHThrp++;
138  else
139  nRHThrm++;
140  }
141  });
142 
143  meRecHitThr1D.fill(iSubdet, nFiltered);
144  meTrendNRecHitThr.fill(iSubdet, double(timestamp_.iLumi), nFiltered);
145  meRecHitThrmvp.fill(iSubdet, nRHThrp, nRHThrm);
146  meRecHitThrpm.fill(iSubdet, nRHThrp - nRHThrm);
147  }
148 
150 } // namespace ecaldqm
T getUntrackedParameter(std::string const &, T const &) const
#define DEFINE_ECALDQM_WORKER(TYPE)
Definition: DQWorker.h:112
edm::LuminosityBlockNumber_t iLumi
Definition: DQWorker.h:35
void runOnRecHits(EcalRecHitCollection const &, Collections)
std::vector< T >::const_iterator const_iterator
void runOnRawData(EcalRawDataCollection const &)
void runOnDigis(DigiCollection const &, Collections)
int zside(DetId const &)
std::tuple< unsigned int, int, int, DigiType, int, int, int, float > Digi
Definition: GenericDigi.h:40
void runOnTPDigis(EcalTrigPrimDigiCollection const &)
void setParams(edm::ParameterSet const &) override
unsigned int id
const_iterator end() const
Definition: DetId.h:17
Timestamp timestamp_
Definition: DQWorker.h:81
bool filterRunType(short const *) override
void beginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override
virtual void fill(DetId const &, double=1., double=1., double=1.)
Definition: MESet.h:46
MESetCollection MEs_
Definition: DQWorker.h:78
const_iterator begin() const