test
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 
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  MESet& meDCC(MEs_.at("DCC"));
43 
44  for(EcalRawDataCollection::const_iterator dcchItr(_dcchs.begin()); dcchItr != _dcchs.end(); ++dcchItr)
45  meDCC.fill(dcchItr->id());
46  }
47 
48  template<typename DigiCollection>
49  void
50  OccupancyTask::runOnDigis(DigiCollection const& _digis, Collections _collection)
51  {
52  MESet& meDigi(MEs_.at("Digi"));
53  MESet& meDigiProjEta(MEs_.at("DigiProjEta"));
54  MESet& meDigiProjPhi(MEs_.at("DigiProjPhi"));
55  MESet& meDigiAll(MEs_.at("DigiAll"));
56  MESet& meDigiDCC(MEs_.at("DigiDCC"));
57  MESet& meDigi1D(MEs_.at("Digi1D"));
58  MESet& meTrendNDigi(MEs_.at("TrendNDigi"));
59 
60  std::for_each(_digis.begin(), _digis.end(), [&](typename DigiCollection::Digi const& digi){
61  DetId id(digi.id());
62  meDigi.fill(id);
63  meDigiProjEta.fill(id);
64  meDigiProjPhi.fill(id);
65  meDigiAll.fill(id);
66  meDigiDCC.fill(id);
67  });
68 
69  int iSubdet(_collection == kEBDigi ? EcalBarrel : EcalEndcap);
70  meDigi1D.fill(iSubdet, double(_digis.size()));
71  meTrendNDigi.fill(iSubdet, double(timestamp_.iLumi), double(_digis.size()));
72  }
73 
74  void
76  {
77  // MESet& meTPDigiAll(MEs_.at("TPDigiAll"));
78  // MESet& meTPDigiProjEta(MEs_.at("TPDigiProjEta"));
79  // MESet& meTPDigiProjPhi(MEs_.at("TPDigiProjPhi"));
80  MESet& meTPDigiRCT(MEs_.at("TPDigiRCT"));
81  MESet& meTPDigiThrAll(MEs_.at("TPDigiThrAll"));
82  MESet& meTPDigiThrProjEta(MEs_.at("TPDigiThrProjEta"));
83  MESet& meTPDigiThrProjPhi(MEs_.at("TPDigiThrProjPhi"));
84  MESet& meTrendNTPDigi(MEs_.at("TrendNTPDigi"));
85 
86  double nFilteredEB(0.);
87  double nFilteredEE(0.);
88 
89  std::for_each(_digis.begin(), _digis.end(), [&](EcalTrigPrimDigiCollection::value_type const& digi){
90  EcalTrigTowerDetId const& id(digi.id());
91  // meTPDigiProjEta.fill(id);
92  // meTPDigiProjPhi.fill(id);
93  // meTPDigiAll.fill(id);
94  if(digi.compressedEt() > tpThreshold_){
95  meTPDigiThrProjEta.fill(id);
96  meTPDigiThrProjPhi.fill(id);
97  meTPDigiThrAll.fill(id);
98  meTPDigiRCT.fill(id);
99  if(id.subDet() == EcalBarrel) nFilteredEB += 1.;
100  else nFilteredEE += 1.;
101  }
102  });
103 
104  meTrendNTPDigi.fill(EcalBarrel, double(timestamp_.iLumi), nFilteredEB);
105  meTrendNTPDigi.fill(EcalEndcap, double(timestamp_.iLumi), nFilteredEE);
106  }
107 
108  void
110  {
111  MESet& meRecHitAll(MEs_.at("RecHitAll"));
112  MESet& meRecHitProjEta(MEs_.at("RecHitProjEta"));
113  MESet& meRecHitProjPhi(MEs_.at("RecHitProjPhi"));
114  MESet& meRecHitThrAll(MEs_.at("RecHitThrAll"));
115  MESet& meRecHitThrmvp(MEs_.at("RecHitThrmvp"));
116  MESet& meRecHitThrpm(MEs_.at("RecHitThrpm"));
117  MESet& meRecHitThrProjEta(MEs_.at("RecHitThrProjEta"));
118  MESet& meRecHitThrProjPhi(MEs_.at("RecHitThrProjPhi"));
119  MESet& meRecHitThr1D(MEs_.at("RecHitThr1D"));
120  MESet& meTrendNRecHitThr(MEs_.at("TrendNRecHitThr"));
121 
122  uint32_t mask(~(0x1 << EcalRecHit::kGood));
123  double nFiltered(0.);
124 
125  float nRHThrp(0), nRHThrm(0);
126  int iSubdet(_collection == kEBRecHit ? EcalBarrel : EcalEndcap);
127  std::for_each(_hits.begin(), _hits.end(), [&](EcalRecHitCollection::value_type const& hit){
128  DetId id(hit.id());
129 
130  meRecHitAll.fill(id);
131  meRecHitProjEta.fill(id);
132  meRecHitProjPhi.fill(id);
133 
134  if(!hit.checkFlagMask(mask) && hit.energy() > recHitThreshold_){
135  meRecHitThrProjEta.fill(id);
136  meRecHitThrProjPhi.fill(id);
137  meRecHitThrAll.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 }
155 
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
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