CMS 3D CMS Logo

DigiComparisonTask.cc
Go to the documentation of this file.
1 
3 
4 using namespace hcaldqm;
5 using namespace hcaldqm::constants;
6 
8  // tags and tokens
9  _tagHBHE1 = ps.getUntrackedParameter<edm::InputTag>("tagHBHE1", edm::InputTag("hcalDigis"));
10  _tagHBHE2 = ps.getUntrackedParameter<edm::InputTag>("tagHBHE2", edm::InputTag("vmeDigis"));
11  _tokHBHE1 = consumes<HBHEDigiCollection>(_tagHBHE1);
12  _tokHBHE2 = consumes<HBHEDigiCollection>(_tagHBHE2);
13 }
15  edm::Run const& r,
16  edm::EventSetup const& es) {
17  DQTask::bookHistograms(ib, r, es);
18 
19  // GET WHAT YOU NEED
21  es.get<HcalDbRecord>().get(dbs);
23  es.get<HcalElectronicsMapRcd>().get("full", item);
24  _emap = item.product();
25  if (_ptype != fOffline) { // hidefed2crate
26  std::vector<int> vFEDs = utilities::getFEDList(_emap);
27  std::vector<int> vFEDsVME = utilities::getFEDVMEList(_emap);
28  std::vector<int> vFEDsuTCA = utilities::getFEDuTCAList(_emap);
29  }
30  std::vector<uint32_t> vhashVME;
31  std::vector<uint32_t> vhashuTCA;
32  vhashVME.push_back(
34  vhashuTCA.push_back(HcalElectronicsId(CRATE_uTCA_MIN, SLOT_uTCA_MIN, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
37 
38  // INITIALIZE
39  for (unsigned int i = 0; i < 10; i++) {
41  "ADC",
46  0);
47  }
49  "ADC",
54  0);
56  "ADCMsnuTCA",
60  0);
62  "ADCMsnVME",
66  0);
68  "Mismatched",
73  0);
74  if (_ptype != fOffline) { // hidefed2crate
76  "Mismatched",
81  0);
83  "Mismatched",
88  0);
89  }
91  "Missing",
96  0);
98  "Missing",
103  0);
104  if (_ptype != fOffline) { // hidefed2crate
106  "Missing",
111  0);
113  "Missing",
118  0);
119  }
120 
121  // BOOK
122  char aux[20];
123  for (unsigned int i = 0; i < 10; i++) {
124  sprintf(aux, "TS%d", i);
125  _cADC_Subdet[i].book(ib, _emap, _subsystem, aux);
126  }
133  if (_ptype != fOffline) { // hidefed2crate
138  }
139 
142 }
143 
144 /* virtual */ void DigiComparisonTask::_resetMonitors(hcaldqm::UpdateFreq uf) { DQTask::_resetMonitors(uf); }
145 
146 /* virtual */ void DigiComparisonTask::_process(edm::Event const& e, edm::EventSetup const& es) {
149 
150  if (!e.getByToken(_tokHBHE1, chbhe1))
151  _logger.dqmthrow("Collection HBHEDigiCollection isn't available" + _tagHBHE1.label() + " " + _tagHBHE1.instance());
152  if (!e.getByToken(_tokHBHE2, chbhe2))
153  _logger.dqmthrow("Collection HBHEDigiCollection isn't available" + _tagHBHE2.label() + " " + _tagHBHE2.instance());
154 
155  // assume that coll1 is primary(uTCA) and coll2 is secondary(VME)
156  // uTCA is X and VME is Y axis
157  for (HBHEDigiCollection::const_iterator it1 = chbhe1->begin(); it1 != chbhe1->end(); ++it1) {
158  // iterate thru the utca collection
159  // get the same detid digi from vme collection
160  // if missing - fill vme missing
161  // else correlate
162  HcalDetId did = it1->id();
163  HcalElectronicsId eid1 = it1->elecId();
164  HBHEDigiCollection::const_iterator it2 = chbhe2->find(did);
165 
166  // get the eid for vme by did
168  if (it2 == chbhe2->end()) {
169  // fill the depth plot
170  _cMsnVME_depth.fill(did);
171  if (_ptype != fOffline) { // hidefed2crate
172  _cMsn_FEDVME.fill(eid2);
173  }
174  for (int i = 0; i < it1->size(); i++) {
175  _cADCMsnVME_Subdet.fill(did, it1->sample(i).adc());
176  _cADCall_Subdet.fill(did, it1->sample(i).adc(), -2);
177  _cADC_Subdet[i].fill(did, it1->sample(i).adc(), -2);
178  }
179  } else
180  for (int i = 0; i < it1->size(); i++) {
181  _cADCall_Subdet.fill(did, double(it1->sample(i).adc()), double(it2->sample(i).adc()));
182  _cADC_Subdet[i].fill(did, double(it1->sample(i).adc()), double(it2->sample(i).adc()));
183  if (it1->sample(i).adc() != it2->sample(i).adc()) {
184  // fill depth, uTCA and VME as well for which guys
185  // mismatches happen
186  _cMsm_depth.fill(did);
187  if (_ptype != fOffline) { // hidefed2crate
188  _cMsm_FEDVME.fill(eid2);
189  _cMsm_FEDuTCA.fill(eid1);
190  }
191  }
192  }
193  }
194  for (HBHEDigiCollection::const_iterator it2 = chbhe2->begin(); it2 != chbhe2->end(); ++it2) {
195  // itearte thru VME
196  // find utca digi by detid
197  // check if present or missing
198  HcalDetId did = it2->id();
199  HBHEDigiCollection::const_iterator it1 = chbhe1->find(did);
200  if (it1 == chbhe1->end()) {
202  if (_ptype != fOffline) { // hidefed2crate
203  _cMsn_FEDuTCA.fill(eid1);
204  }
205  for (int i = 0; i < it2->size(); i++) {
206  _cADCMsnuTCA_Subdet.fill(did, it2->sample(i).adc());
207  _cADCall_Subdet.fill(did, -2, it2->sample(i).adc());
208  _cADC_Subdet[i].fill(did, -2, it2->sample(i).adc());
209  }
210  }
211  }
212 }
213 
215  // in the end always
216  DQTask::endLuminosityBlock(lb, es);
217 }
218 
T getUntrackedParameter(std::string const &, T const &) const
virtual void initialize(std::string const &folder, hashfunctions::HashType, quantity::Quantity *, quantity::Quantity *qy=new quantity::ValueQuantity(quantity::fN), int debug=0)
Definition: Container1D.cc:33
int const CRATE_VME_MIN
Definition: Constants.h:91
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
void initialize(HcalElectronicsMap const *, ElectronicsMapType etype=fHcalElectronicsMap)
UpdateFreq
Definition: DQTask.h:16
hcaldqm::Container2D _cMsn_FEDuTCA
std::vector< T >::const_iterator const_iterator
int const SPIGOT_MIN
Definition: Constants.h:116
hcaldqm::electronicsmap::ElectronicsMap _ehashmapuTCA
hcaldqm::Container2D _cMsm_FEDVME
edm::EDGetTokenT< HBHEDigiCollection > _tokHBHE2
int const FIBER_VME_MIN
Definition: Constants.h:121
int const FIBERCH_MIN
Definition: Constants.h:130
edm::InputTag _tagHBHE1
std::vector< int > getFEDVMEList(HcalElectronicsMap const *)
Definition: Utilities.cc:101
hcaldqm::Container1D _cADCMsnuTCA_Subdet
void _process(edm::Event const &, edm::EventSetup const &) override
hcaldqm::Container2D _cADCall_Subdet
edm::EDGetTokenT< HBHEDigiCollection > _tokHBHE1
ProcessingType _ptype
Definition: DQModule.h:43
virtual void fill(uint32_t)
Definition: Container1D.cc:73
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void dqmthrow(std::string const &msg) const
Definition: Logger.h:12
hcaldqm::Container2D _cMsnuTCA_depth
hcaldqm::Container2D _cMsn_FEDVME
int const FIBER_uTCA_MIN1
Definition: Constants.h:124
void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override
Logger _logger
Definition: DQModule.h:54
void _resetMonitors(hcaldqm::UpdateFreq) override
std::string _name
Definition: DQModule.h:41
HcalElectronicsMap const * _emap
Definition: DQTask.h:59
hcaldqm::filter::HashFilter _filter_uTCA
DigiComparisonTask(edm::ParameterSet const &)
int const CRATE_uTCA_MIN
Definition: Constants.h:96
hcaldqm::Container2D _cMsm_depth
const_iterator end() const
virtual void book(DQMStore::IBooker &, HcalElectronicsMap const *, std::string subsystem="Hcal", std::string aux="")
Definition: Container1D.cc:592
virtual void initialize(std::string const &folder, hashfunctions::HashType, quantity::Quantity *, quantity::Quantity *, quantity::Quantity *qz=new quantity::ValueQuantity(quantity::fN), int debug=0)
Definition: Container2D.cc:25
hcaldqm::Container2D _cMsm_FEDuTCA
example_stream void bookHistograms(DQMStore::IBooker &,@example_stream edm::Run const &,@example_stream edm::EventSetup const &) override
std::string const & label() const
Definition: InputTag.h:36
hcaldqm::Container2D _cMsnVME_depth
iterator find(key_type k)
hcaldqm::electronicsmap::ElectronicsMap _ehashmapVME
std::vector< int > getFEDList(HcalElectronicsMap const *)
Definition: Utilities.cc:83
T get() const
Definition: EventSetup.h:71
std::vector< int > getFEDuTCAList(HcalElectronicsMap const *)
Definition: Utilities.cc:121
void fill(HcalDetId const &) override
Definition: Container2D.cc:52
virtual void initialize(FilterType ftype, hashfunctions::HashType htype, std::vector< uint32_t > const &)
Definition: HashFilter.cc:17
std::string _subsystem
Definition: DQModule.h:48
edm::InputTag _tagHBHE2
hcaldqm::Container1D _cADCMsnVME_Subdet
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
void book(DQMStore::IBooker &, HcalElectronicsMap const *, std::string subsystem="Hcal", std::string aux="") override
Definition: Container2D.cc:558
hcaldqm::Container2D _cADC_Subdet[10]
T const * product() const
Definition: ESHandle.h:86
Readout chain identification for Hcal.
std::string const & instance() const
Definition: InputTag.h:37
int const SLOT_uTCA_MIN
Definition: Constants.h:103
const_iterator begin() const
Definition: Run.h:45
hcaldqm::filter::HashFilter _filter_VME
ib
Definition: cuy.py:662