CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
OccupancyTask.cc
Go to the documentation of this file.
1 #include "../interface/OccupancyTask.h"
2 
4 
6 
7 namespace ecaldqm
8 {
10  DQWorkerTask(),
11  recHitThreshold_(0.),
12  tpThreshold_(0.)
13  {
14  }
15 
16  void
18  {
19  recHitThreshold_ = _params.getUntrackedParameter<double>("recHitThreshold");
20  tpThreshold_ = _params.getUntrackedParameter<double>("tpThreshold");
21  }
22 
23  bool
24  OccupancyTask::filterRunType(short const* _runType)
25  {
26  for(int iFED(0); iFED < 54; iFED++){
27  if(_runType[iFED] == EcalDCCHeaderBlock::COSMIC ||
28  _runType[iFED] == EcalDCCHeaderBlock::MTCC ||
29  _runType[iFED] == EcalDCCHeaderBlock::COSMICS_GLOBAL ||
30  _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_GLOBAL ||
31  _runType[iFED] == EcalDCCHeaderBlock::COSMICS_LOCAL ||
32  _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_LOCAL) return true;
33  }
34 
35  return false;
36  }
37 
38  void
40  {
41  MESet& meDCC(MEs_.at("DCC"));
42 
43  for(EcalRawDataCollection::const_iterator dcchItr(_dcchs.begin()); dcchItr != _dcchs.end(); ++dcchItr)
44  meDCC.fill(dcchItr->id());
45  }
46 
47  template<typename DigiCollection>
48  void
49  OccupancyTask::runOnDigis(DigiCollection const& _digis, Collections _collection)
50  {
51  MESet& meDigi(MEs_.at("Digi"));
52  MESet& meDigiProjEta(MEs_.at("DigiProjEta"));
53  MESet& meDigiProjPhi(MEs_.at("DigiProjPhi"));
54  MESet& meDigiAll(MEs_.at("DigiAll"));
55  MESet& meDigiDCC(MEs_.at("DigiDCC"));
56  MESet& meDigi1D(MEs_.at("Digi1D"));
57  MESet& meTrendNDigi(MEs_.at("TrendNDigi"));
58 
59  std::for_each(_digis.begin(), _digis.end(), [&](typename DigiCollection::Digi const& digi){
60  DetId id(digi.id());
61  meDigi.fill(id);
62  meDigiProjEta.fill(id);
63  meDigiProjPhi.fill(id);
64  meDigiAll.fill(id);
65  meDigiDCC.fill(id);
66  });
67 
68  int iSubdet(_collection == kEBDigi ? EcalBarrel : EcalEndcap);
69  meDigi1D.fill(iSubdet, double(_digis.size()));
70  meTrendNDigi.fill(iSubdet, double(timestamp_.iLumi), double(_digis.size()));
71  }
72 
73  void
75  {
76  // MESet& meTPDigiAll(MEs_.at("TPDigiAll"));
77  // MESet& meTPDigiProjEta(MEs_.at("TPDigiProjEta"));
78  // MESet& meTPDigiProjPhi(MEs_.at("TPDigiProjPhi"));
79  MESet& meTPDigiThrAll(MEs_.at("TPDigiThrAll"));
80  MESet& meTPDigiThrProjEta(MEs_.at("TPDigiThrProjEta"));
81  MESet& meTPDigiThrProjPhi(MEs_.at("TPDigiThrProjPhi"));
82  MESet& meTrendNTPDigi(MEs_.at("TrendNTPDigi"));
83 
84  double nFilteredEB(0.);
85  double nFilteredEE(0.);
86 
87  std::for_each(_digis.begin(), _digis.end(), [&](EcalTrigPrimDigiCollection::value_type const& digi){
88  EcalTrigTowerDetId const& id(digi.id());
89  // meTPDigiProjEta.fill(id);
90  // meTPDigiProjPhi.fill(id);
91  // meTPDigiAll.fill(id);
92  if(digi.compressedEt() > tpThreshold_){
93  meTPDigiThrProjEta.fill(id);
94  meTPDigiThrProjPhi.fill(id);
95  meTPDigiThrAll.fill(id);
96  if(id.subDet() == EcalBarrel) nFilteredEB += 1.;
97  else nFilteredEE += 1.;
98  }
99  });
100 
101  meTrendNTPDigi.fill(EcalBarrel, double(timestamp_.iLumi), nFilteredEB);
102  meTrendNTPDigi.fill(EcalEndcap, double(timestamp_.iLumi), nFilteredEE);
103  }
104 
105  void
107  {
108  MESet& meRecHitAll(MEs_.at("RecHitAll"));
109  MESet& meRecHitProjEta(MEs_.at("RecHitProjEta"));
110  MESet& meRecHitProjPhi(MEs_.at("RecHitProjPhi"));
111  MESet& meRecHitThrAll(MEs_.at("RecHitThrAll"));
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  std::for_each(_hits.begin(), _hits.end(), [&](EcalRecHitCollection::value_type const& hit){
121  DetId id(hit.id());
122 
123  meRecHitAll.fill(id);
124  meRecHitProjEta.fill(id);
125  meRecHitProjPhi.fill(id);
126 
127  if(!hit.checkFlagMask(mask) && hit.energy() > recHitThreshold_){
128  meRecHitThrProjEta.fill(id);
129  meRecHitThrProjPhi.fill(id);
130  meRecHitThrAll.fill(id);
131  nFiltered += 1.;
132  }
133  });
134 
135  int iSubdet(_collection == kEBRecHit ? EcalBarrel : EcalEndcap);
136  meRecHitThr1D.fill(iSubdet, nFiltered);
137  meTrendNRecHitThr.fill(iSubdet, double(timestamp_.iLumi), nFiltered);
138  }
139 
141 }
142 
T getUntrackedParameter(std::string const &, T const &) const
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)
DEFINE_ECALDQM_WORKER(CalibrationSummaryClient)
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
virtual void fill(DetId const &, double=1., double=1., double=1.)
Definition: MESet.h:47
MESetCollection MEs_
Definition: DQWorker.h:76
const_iterator begin() const