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  }
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
IntegrityTask.h
edm::EDCollection::begin
const_iterator begin() const
Definition: EDCollection.h:117
edm::EDCollection::value_type
T value_type
Definition: EDCollection.h:18
ecaldqm
Definition: DQWorker.h:29
ecaldqm::kEEGainSwitchErrors
Definition: Collections.h:16
ecaldqm::MESet::fill
virtual void fill(EcalDQMSetupObjects const, DetId const &, double=1., double=1., double=1.)
Definition: MESet.h:74
ecaldqm::kEBGainErrors
Definition: Collections.h:11
ecaldqm::kEBChIdErrors
Definition: Collections.h:13
ecaldqm::DQWorker::GetElectronicsMap
const EcalElectronicsMapping * GetElectronicsMap()
Definition: DQWorker.cc:104
ecaldqm::kEEGainErrors
Definition: Collections.h:12
ecaldqm::towerId
unsigned towerId(DetId const &, EcalElectronicsMapping const *)
Definition: EcalDQMCommonUtils.cc:77
ecaldqm::kTowerIdErrors
Definition: Collections.h:17
ecaldqm::DQWorkerTask
Definition: DQWorkerTask.h:71
ecaldqm::MESet::reset
virtual void reset(EcalElectronicsMapping const *, double=0., double=0., double=0.)
Definition: MESet.cc:98
ecaldqm::kEEChIdErrors
Definition: Collections.h:14
ecaldqm::IntegrityTask::beginEvent
void beginEvent(edm::Event const &, edm::EventSetup const &, bool const &, bool &) override
Definition: IntegrityTask.cc:9
ecaldqm::DQWorker::MEs_
MESetCollection MEs_
Definition: DQWorker.h:104
edm::EDCollection::empty
bool empty() const
Definition: EDCollection.h:77
ecaldqm::nCrystals
unsigned nCrystals(unsigned)
Definition: EcalDQMCommonUtils.cc:334
ecaldqm::MESetCollection::at
MESet & at(const std::string &key)
Definition: MESet.h:399
ecaldqm::IntegrityTask
Definition: IntegrityTask.h:13
ecaldqm::Collections
Collections
Definition: Collections.h:8
edm::EventSetup
Definition: EventSetup.h:58
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition: JetExtendedAssociation.h:30
edm::EDCollection
Definition: EDCollection.h:16
ecaldqm::dccId
unsigned dccId(DetId const &, EcalElectronicsMapping const *)
Definition: EcalDQMCommonUtils.cc:16
ecaldqm::DQWorker::Timestamp::iLumi
edm::LuminosityBlockNumber_t iLumi
Definition: DQWorker.h:40
ecaldqm::DQWorker::getEcalDQMSetupObjects
const EcalDQMSetupObjects getEcalDQMSetupObjects()
Definition: DQWorker.cc:128
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
ecaldqm::IntegrityTask::runOnDetIdCollection
void runOnDetIdCollection(C const &, Collections)
ecaldqm::kEEpLow
Definition: EcalDQMCommonUtils.h:82
ecaldqm::DQWorker::timestamp_
Timestamp timestamp_
Definition: DQWorker.h:107
ecaldqm::IntegrityTask::runOnElectronicsIdCollection
void runOnElectronicsIdCollection(EcalElectronicsIdCollection const &, Collections)
Definition: IntegrityTask.cc:60
Exception.h
ecaldqm::IntegrityTask::IntegrityTask
IntegrityTask()
Definition: IntegrityTask.cc:7
DEFINE_ECALDQM_WORKER
#define DEFINE_ECALDQM_WORKER(TYPE)
Definition: DQWorker.h:141
ParameterSet.h
edm::Event
Definition: Event.h:73
ecaldqm::kBlockSizeErrors
Definition: Collections.h:18
ecaldqm::kEBGainSwitchErrors
Definition: Collections.h:15
edm::EDCollection::end
const_iterator end() const
Definition: EDCollection.h:122
ecaldqm::MESet
Definition: MESet.h:42