CMS 3D CMS Logo

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