CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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  }
17  }
18 
19  template <typename IDCollection>
20  void IntegrityTask::runOnDetIdCollection(IDCollection const& _ids, Collections _collection) {
21  // Collection is empty if there are no errors
22  if (_ids.empty())
23  return;
24 
25  MESet* set(nullptr);
26  switch (_collection) {
27  case kEBGainErrors:
28  case kEEGainErrors:
29  set = &MEs_.at("Gain");
30  break;
31  case kEBChIdErrors:
32  case kEEChIdErrors:
33  set = &MEs_.at("ChId");
34  break;
37  set = &MEs_.at("GainSwitch");
38  break;
39  default:
40  return;
41  }
42 
43  MESet& meMapByLumi(MEs_.at("MapByLumi"));
44  MESet& meByLumi(MEs_.at("ByLumi"));
45  MESet& meTotal(MEs_.at("Total"));
46  MESet& meTrendNErrors(MEs_.at("TrendNErrors"));
47 
48  std::for_each(_ids.begin(), _ids.end(), [&](typename IDCollection::value_type const& id) {
49  set->fill(getEcalDQMSetupObjects(), id);
50  int dccid(dccId(id, GetElectronicsMap()));
51  meByLumi.fill(getEcalDQMSetupObjects(), dccid);
52  meTotal.fill(getEcalDQMSetupObjects(), dccid);
53  // Fill Integrity Errors Map with channel errors for this lumi
54  meMapByLumi.fill(getEcalDQMSetupObjects(), id);
55 
56  meTrendNErrors.fill(getEcalDQMSetupObjects(), double(timestamp_.iLumi), 1.);
57  });
58  }
59 
61  // Collection is empty if there are no errors
62  if (_ids.empty())
63  return;
64 
65  MESet* set(nullptr);
66  switch (_collection) {
67  case kTowerIdErrors:
68  set = &MEs_.at("TowerId");
69  break;
70  case kBlockSizeErrors:
71  set = &MEs_.at("BlockSize");
72  break;
73  default:
74  return;
75  }
76 
77  MESet& meMapByLumi(MEs_.at("MapByLumi"));
78  MESet& meByLumi(MEs_.at("ByLumi"));
79  MESet& meTotal(MEs_.at("Total"));
80  MESet& meTrendNErrors(MEs_.at("TrendNErrors"));
81 
82  std::for_each(_ids.begin(), _ids.end(), [&](EcalElectronicsIdCollection::value_type const& id) {
83  set->fill(getEcalDQMSetupObjects(), id);
84  int dccid(id.dccId());
85  double nCrystals(0.);
86  std::vector<DetId> chIds(GetElectronicsMap()->dccTowerConstituents(dccid, id.towerId()));
87  if (dccid <= kEEmHigh + 1 || dccid >= kEEpLow + 1)
88  nCrystals = chIds.size();
89  else
90  nCrystals = 25.;
91  meByLumi.fill(getEcalDQMSetupObjects(), dccid, nCrystals);
92  meTotal.fill(getEcalDQMSetupObjects(), dccid, nCrystals);
93  // Fill Integrity Errors Map with tower errors for this lumi
94  // Since binned by crystal for compatibility with channel errors,
95  // fill with constituent channels of tower
96  for (std::vector<DetId>::iterator chItr(chIds.begin()); chItr != chIds.end(); ++chItr)
97  meMapByLumi.fill(getEcalDQMSetupObjects(), *chItr);
98 
99  meTrendNErrors.fill(getEcalDQMSetupObjects(), double(timestamp_.iLumi), nCrystals);
100  });
101  }
102 
104 } // namespace ecaldqm
#define DEFINE_ECALDQM_WORKER(TYPE)
Definition: DQWorker.h:162
uint16_t *__restrict__ id
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:399
const_iterator end() const
Definition: EDCollection.h:122
unsigned nCrystals(unsigned)
bool empty() const
Definition: EDCollection.h:77
unsigned towerId(DetId const &, EcalElectronicsMapping const *)
unsigned dccId(DetId const &, EcalElectronicsMapping const *)
virtual void fill(EcalDQMSetupObjects const, DetId const &, double=1., double=1., double=1.)
Definition: MESet.h:74
void beginEvent(edm::Event const &, edm::EventSetup const &, bool const &, bool &) override
Definition: IntegrityTask.cc:9
EcalDQMSetupObjects const getEcalDQMSetupObjects()
Definition: DQWorker.cc:142
Timestamp timestamp_
Definition: DQWorker.h:128
const_iterator begin() const
Definition: EDCollection.h:117
MESetCollection MEs_
Definition: DQWorker.h:125
EcalElectronicsMapping const * GetElectronicsMap()
Definition: DQWorker.cc:118
virtual void reset(EcalElectronicsMapping const *, double=0., double=0., double=0.)
Definition: MESet.cc:98