CMS 3D CMS Logo

IntegrityTask.cc
Go to the documentation of this file.
2 
5 
6 namespace ecaldqm
7 {
10  {
11  }
12 
13  void
15  {
16  // Reset by LS plots at beginning of every LS
17  MEs_.at("MapByLumi").reset();
18  MEs_.at("ByLumi").reset();
19  }
20 
21  template<typename IDCollection>
22  void
23  IntegrityTask::runOnDetIdCollection(IDCollection const& _ids, Collections _collection)
24  {
25  // Collection is empty if there are no errors
26  if(_ids.empty()) return;
27 
28  MESet* set(nullptr);
29  switch(_collection){
30  case kEBGainErrors:
31  case kEEGainErrors:
32  set = &MEs_.at("Gain");
33  break;
34  case kEBChIdErrors:
35  case kEEChIdErrors:
36  set = &MEs_.at("ChId");
37  break;
40  set = &MEs_.at("GainSwitch");
41  break;
42  default:
43  return;
44  }
45 
46  MESet& meMapByLumi(MEs_.at("MapByLumi"));
47  MESet& meByLumi(MEs_.at("ByLumi"));
48  MESet& meTotal(MEs_.at("Total"));
49  MESet& meTrendNErrors(MEs_.at("TrendNErrors"));
50 
51  std::for_each(_ids.begin(), _ids.end(),
52  [&](typename IDCollection::value_type const& id){
53  set->fill(id);
54  int dccid(dccId(id));
55  meByLumi.fill(dccid);
56  meTotal.fill(dccid);
57  // Fill Integrity Errors Map with channel errors for this lumi
58  meMapByLumi.fill(id);
59 
60  meTrendNErrors.fill(double(timestamp_.iLumi), 1.);
61  });
62  }
63 
64  void
66  {
67  // Collection is empty if there are no errors
68  if(_ids.empty()) return;
69 
70  MESet* set(nullptr);
71  switch(_collection){
72  case kTowerIdErrors:
73  set = &MEs_.at("TowerId");
74  break;
75  case kBlockSizeErrors:
76  set = &MEs_.at("BlockSize");
77  break;
78  default:
79  return;
80  }
81 
82  MESet& meMapByLumi(MEs_.at("MapByLumi"));
83  MESet& meByLumi(MEs_.at("ByLumi"));
84  MESet& meTotal(MEs_.at("Total"));
85  MESet& meTrendNErrors(MEs_.at("TrendNErrors"));
86 
87  std::for_each(_ids.begin(), _ids.end(),
89  set->fill(id);
90  int dccid(id.dccId());
91  double nCrystals(0.);
92  std::vector<DetId> chIds( getElectronicsMap()->dccTowerConstituents(dccid, id.towerId()) );
93  if(dccid <= kEEmHigh + 1 || dccid >= kEEpLow + 1)
94  nCrystals = chIds.size();
95  else
96  nCrystals = 25.;
97  meByLumi.fill(dccid, nCrystals);
98  meTotal.fill(dccid, nCrystals);
99  // Fill Integrity Errors Map with tower errors for this lumi
100  // Since binned by crystal for compatibility with channel errors,
101  // fill with constituent channels of tower
102  for(std::vector<DetId>::iterator chItr(chIds.begin()); chItr != chIds.end(); ++chItr)
103  meMapByLumi.fill(*chItr);
104 
105  meTrendNErrors.fill(double(timestamp_.iLumi), nCrystals);
106  });
107  }
108 
110 }
111 
112 
#define DEFINE_ECALDQM_WORKER(TYPE)
Definition: DQWorker.h:108
edm::LuminosityBlockNumber_t iLumi
Definition: DQWorker.h:35
void runOnDetIdCollection(C const &, Collections)
void runOnElectronicsIdCollection(EcalElectronicsIdCollection const &, Collections)
const_iterator end() const
Definition: EDCollection.h:153
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
EcalElectronicsMapping const * getElectronicsMap()
unsigned nCrystals(unsigned)
bool empty() const
Definition: EDCollection.h:90
unsigned towerId(DetId const &)
void beginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override
Timestamp timestamp_
Definition: DQWorker.h:78
const_iterator begin() const
Definition: EDCollection.h:146
MESetCollection MEs_
Definition: DQWorker.h:75
unsigned dccId(DetId const &)