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& meTPDigiRCT(MEs_.at("TPDigiRCT"));
80  MESet& meTPDigiThrAll(MEs_.at("TPDigiThrAll"));
81  MESet& meTPDigiThrProjEta(MEs_.at("TPDigiThrProjEta"));
82  MESet& meTPDigiThrProjPhi(MEs_.at("TPDigiThrProjPhi"));
83  MESet& meTrendNTPDigi(MEs_.at("TrendNTPDigi"));
84 
85  double nFilteredEB(0.);
86  double nFilteredEE(0.);
87 
88  std::for_each(_digis.begin(), _digis.end(), [&](EcalTrigPrimDigiCollection::value_type const& digi){
89  EcalTrigTowerDetId const& id(digi.id());
90  // meTPDigiProjEta.fill(id);
91  // meTPDigiProjPhi.fill(id);
92  // meTPDigiAll.fill(id);
93  if(digi.compressedEt() > tpThreshold_){
94  meTPDigiThrProjEta.fill(id);
95  meTPDigiThrProjPhi.fill(id);
96  meTPDigiThrAll.fill(id);
97  meTPDigiRCT.fill(id);
98  if(id.subDet() == EcalBarrel) nFilteredEB += 1.;
99  else nFilteredEE += 1.;
100  }
101  });
102 
103  meTrendNTPDigi.fill(EcalBarrel, double(timestamp_.iLumi), nFilteredEB);
104  meTrendNTPDigi.fill(EcalEndcap, double(timestamp_.iLumi), nFilteredEE);
105  }
106 
107  void
109  {
110  MESet& meRecHitAll(MEs_.at("RecHitAll"));
111  MESet& meRecHitProjEta(MEs_.at("RecHitProjEta"));
112  MESet& meRecHitProjPhi(MEs_.at("RecHitProjPhi"));
113  MESet& meRecHitThrAll(MEs_.at("RecHitThrAll"));
114  MESet& meRecHitThrProjEta(MEs_.at("RecHitThrProjEta"));
115  MESet& meRecHitThrProjPhi(MEs_.at("RecHitThrProjPhi"));
116  MESet& meRecHitThr1D(MEs_.at("RecHitThr1D"));
117  MESet& meTrendNRecHitThr(MEs_.at("TrendNRecHitThr"));
118 
119  uint32_t mask(~(0x1 << EcalRecHit::kGood));
120  double nFiltered(0.);
121 
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  nFiltered += 1.;
134  }
135  });
136 
137  int iSubdet(_collection == kEBRecHit ? EcalBarrel : EcalEndcap);
138  meRecHitThr1D.fill(iSubdet, nFiltered);
139  meTrendNRecHitThr.fill(iSubdet, double(timestamp_.iLumi), nFiltered);
140  }
141 
143 }
144 
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)
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
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