CMS 3D CMS Logo

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