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  DQTask(ps)
9 {
10  // tags and tokens
12  edm::InputTag("hcalDigis"));
14  edm::InputTag("vmeDigis"));
15  _tokHBHE1 = consumes<HBHEDigiCollection>(_tagHBHE1);
16  _tokHBHE2 = consumes<HBHEDigiCollection>(_tagHBHE2);
17 }
19  edm::Run const& r, edm::EventSetup const& es)
20 {
21  DQTask::bookHistograms(ib, r, es);
22 
23  // GET WHAT YOU NEED
25  es.get<HcalDbRecord>().get(dbs);
27  es.get<HcalElectronicsMapRcd>().get("full", item);
28  _emap = item.product();
29  if (_ptype != fOffline) { // hidefed2crate
30  std::vector<int> vFEDs = utilities::getFEDList(_emap);
31  std::vector<int> vFEDsVME = utilities::getFEDVMEList(_emap);
32  std::vector<int> vFEDsuTCA = utilities::getFEDuTCAList(_emap);
33  }
34  std::vector<uint32_t> vhashVME;
35  std::vector<uint32_t> vhashuTCA;
36  vhashVME.push_back(HcalElectronicsId(constants::FIBERCH_MIN,
38  vhashuTCA.push_back(HcalElectronicsId(CRATE_uTCA_MIN, SLOT_uTCA_MIN,
39  FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
41  vhashVME);
43  vhashuTCA);
44 
45  // INITIALIZE
46  for (unsigned int i=0; i<10; i++)
47  {
53  }
59  _cADCMsnuTCA_Subdet.initialize(_name, "ADCMsnuTCA",
63  _cADCMsnVME_Subdet.initialize(_name, "ADCMsnVME",
67  _cMsm_depth.initialize(_name, "Mismatched",
72  if (_ptype != fOffline) { // hidefed2crate
73  _cMsm_FEDVME.initialize(_name, "Mismatched",
78  _cMsm_FEDuTCA.initialize(_name, "Mismatched",
83  }
84  _cMsnVME_depth.initialize(_name, "Missing",
89  _cMsnuTCA_depth.initialize(_name, "Missing",
94  if (_ptype != fOffline) { // hidefed2crate
95  _cMsn_FEDVME.initialize(_name, "Missing",
100  _cMsn_FEDuTCA.initialize(_name, "Missing",
105  }
106 
107  // BOOK
108  char aux[20];
109  for (unsigned int i=0; i<10; i++)
110  {
111  sprintf(aux, "TS%d", i);
112  _cADC_Subdet[i].book(ib, _emap, _subsystem, aux);
113  }
120  if (_ptype != fOffline) { // hidefed2crate
125  }
126 
128  _filter_VME);
130  _filter_uTCA);
131 }
132 
134 {
135  DQTask::_resetMonitors(uf);
136 }
137 
138 /* virtual */ void DigiComparisonTask::_process(edm::Event const& e,
139  edm::EventSetup const& es)
140 {
143 
144  if (!e.getByToken(_tokHBHE1, chbhe1))
145  _logger.dqmthrow("Collection HBHEDigiCollection isn't available"
146  + _tagHBHE1.label() + " " + _tagHBHE1.instance());
147  if (!e.getByToken(_tokHBHE2, chbhe2))
148  _logger.dqmthrow("Collection HBHEDigiCollection isn't available"
149  + _tagHBHE2.label() + " " + _tagHBHE2.instance());
150 
151  // assume that coll1 is primary(uTCA) and coll2 is secondary(VME)
152  // uTCA is X and VME is Y axis
153  for (HBHEDigiCollection::const_iterator it1=chbhe1->begin();
154  it1!=chbhe1->end(); ++it1)
155  {
156  // iterate thru the utca collection
157  // get the same detid digi from vme collection
158  // if missing - fill vme missing
159  // else correlate
160  HcalDetId did = it1->id();
161  HcalElectronicsId eid1 = it1->elecId();
162  HBHEDigiCollection::const_iterator it2 = chbhe2->find(did);
163 
164  // get the eid for vme by did
166  if (it2==chbhe2->end())
167  {
168  // fill the depth plot
169  _cMsnVME_depth.fill(did);
170  if (_ptype != fOffline) { // hidefed2crate
171  _cMsn_FEDVME.fill(eid2);
172  }
173  for (int i=0; i<it1->size(); i++)
174  {
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  }
180  else
181  for (int i=0; i<it1->size(); i++)
182  {
183  _cADCall_Subdet.fill(did, double(it1->sample(i).adc()),
184  double(it2->sample(i).adc()));
185  _cADC_Subdet[i].fill(did, double(it1->sample(i).adc()),
186  double(it2->sample(i).adc()));
187  if (it1->sample(i).adc()!=it2->sample(i).adc())
188  {
189  // fill depth, uTCA and VME as well for which guys
190  // mismatches happen
191  _cMsm_depth.fill(did);
192  if (_ptype != fOffline) { // hidefed2crate
193  _cMsm_FEDVME.fill(eid2);
194  _cMsm_FEDuTCA.fill(eid1);
195  }
196  }
197  }
198  }
199  for (HBHEDigiCollection::const_iterator it2=chbhe2->begin();
200  it2!=chbhe2->end(); ++it2)
201  {
202  // itearte thru VME
203  // find utca digi by detid
204  // check if present or missing
205  HcalDetId did = it2->id();
206  HBHEDigiCollection::const_iterator it1 = chbhe1->find(did);
207  if (it1==chbhe1->end())
208  {
210  if (_ptype != fOffline) { // hidefed2crate
211  _cMsn_FEDuTCA.fill(eid1);
212  }
213  for (int i=0; i<it2->size(); i++)
214  {
215  _cADCMsnuTCA_Subdet.fill(did, it2->sample(i).adc());
216  _cADCall_Subdet.fill(did, -2, it2->sample(i).adc());
217  _cADC_Subdet[i].fill(did, -2, it2->sample(i).adc());
218  }
219  }
220  }
221 }
222 
224  edm::LuminosityBlock const& lb, edm::EventSetup const& es)
225 {
226  // in the end always
227  DQTask::endLuminosityBlock(lb, es);
228 }
229 
231 
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:41
int const CRATE_VME_MIN
Definition: Constants.h:111
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
void initialize(HcalElectronicsMap const *, ElectronicsMapType etype=fHcalElectronicsMap)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
UpdateFreq
Definition: DQTask.h:17
hcaldqm::Container2D _cMsn_FEDuTCA
std::vector< HBHEDataFrame >::const_iterator const_iterator
int const SPIGOT_MIN
Definition: Constants.h:136
hcaldqm::electronicsmap::ElectronicsMap _ehashmapuTCA
hcaldqm::Container2D _cMsm_FEDVME
edm::EDGetTokenT< HBHEDigiCollection > _tokHBHE2
int const FIBER_VME_MIN
Definition: Constants.h:141
int const FIBERCH_MIN
Definition: Constants.h:151
edm::InputTag _tagHBHE1
std::vector< int > getFEDVMEList(HcalElectronicsMap const *)
Definition: Utilities.cc:119
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:59
virtual void fill(uint32_t)
Definition: Container1D.cc:83
void dqmthrow(std::string const &msg) const
Definition: Logger.h:15
hcaldqm::Container2D _cMsnuTCA_depth
virtual example_stream void bookHistograms(DQMStore::IBooker &,@example_stream edm::Run const &,@example_stream edm::EventSetup const &) override
hcaldqm::Container2D _cMsn_FEDVME
int const FIBER_uTCA_MIN1
Definition: Constants.h:144
void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override
Logger _logger
Definition: DQModule.h:70
void _resetMonitors(hcaldqm::UpdateFreq) override
std::string _name
Definition: DQModule.h:57
HcalElectronicsMap const * _emap
Definition: DQTask.h:73
hcaldqm::filter::HashFilter _filter_uTCA
DigiComparisonTask(edm::ParameterSet const &)
int const CRATE_uTCA_MIN
Definition: Constants.h:116
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:958
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:32
hcaldqm::Container2D _cMsm_FEDuTCA
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:95
T get() const
Definition: EventSetup.h:63
std::vector< int > getFEDuTCAList(HcalElectronicsMap const *)
Definition: Utilities.cc:145
void fill(HcalDetId const &) override
Definition: Container2D.cc:59
virtual void initialize(FilterType ftype, hashfunctions::HashType htype, std::vector< uint32_t > const &)
Definition: HashFilter.cc:28
std::string _subsystem
Definition: DQModule.h:64
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:895
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:123
const_iterator begin() const
Definition: Run.h:44
hcaldqm::filter::HashFilter _filter_VME
ib
Definition: cuy.py:661