CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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  std::vector<int> vFEDs = utilities::getFEDList(_emap);
30  std::vector<int> vFEDsVME = utilities::getFEDVMEList(_emap);
31  std::vector<int> vFEDsuTCA = utilities::getFEDuTCAList(_emap);
32  std::vector<uint32_t> vhashVME;
33  std::vector<uint32_t> vhashuTCA;
34  vhashVME.push_back(HcalElectronicsId(constants::FIBERCH_MIN,
36  vhashuTCA.push_back(HcalElectronicsId(CRATE_uTCA_MIN, SLOT_uTCA_MIN,
37  FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
39  vhashVME);
41  vhashuTCA);
42 
43  // INITIALIZE
44  for (unsigned int i=0; i<10; i++)
45  {
51  }
57  _cADCMsnuTCA_Subdet.initialize(_name, "ADCMsnuTCA",
61  _cADCMsnVME_Subdet.initialize(_name, "ADCMsnVME",
65  _cMsm_depth.initialize(_name, "Mismatched",
70  _cMsm_FEDVME.initialize(_name, "Mismatched",
75  _cMsm_FEDuTCA.initialize(_name, "Mismatched",
80  _cMsnVME_depth.initialize(_name, "Missing",
85  _cMsnuTCA_depth.initialize(_name, "Missing",
90  _cMsn_FEDVME.initialize(_name, "Missing",
95  _cMsn_FEDuTCA.initialize(_name, "Missing",
100 
101  // BOOK
102  char aux[20];
103  for (unsigned int i=0; i<10; i++)
104  {
105  sprintf(aux, "TS%d", i);
106  _cADC_Subdet[i].book(ib, _emap, _subsystem, aux);
107  }
118 
120  _filter_VME);
122  _filter_uTCA);
123 }
124 
126 {
127  DQTask::_resetMonitors(uf);
128 }
129 
130 /* virtual */ void DigiComparisonTask::_process(edm::Event const& e,
131  edm::EventSetup const& es)
132 {
135 
136  if (!e.getByToken(_tokHBHE1, chbhe1))
137  _logger.dqmthrow("Collection HBHEDigiCollection isn't available"
138  + _tagHBHE1.label() + " " + _tagHBHE1.instance());
139  if (!e.getByToken(_tokHBHE2, chbhe2))
140  _logger.dqmthrow("Collection HBHEDigiCollection isn't available"
141  + _tagHBHE2.label() + " " + _tagHBHE2.instance());
142 
143  // assume that coll1 is primary(uTCA) and coll2 is secondary(VME)
144  // uTCA is X and VME is Y axis
145  for (HBHEDigiCollection::const_iterator it1=chbhe1->begin();
146  it1!=chbhe1->end(); ++it1)
147  {
148  // iterate thru the utca collection
149  // get the same detid digi from vme collection
150  // if missing - fill vme missing
151  // else correlate
152  HcalDetId did = it1->id();
153  HcalElectronicsId eid1 = it1->elecId();
154  HBHEDigiCollection::const_iterator it2 = chbhe2->find(did);
155 
156  // get the eid for vme by did
158  if (it2==chbhe2->end())
159  {
160  // fill the depth plot
161  _cMsnVME_depth.fill(did);
162  _cMsn_FEDVME.fill(eid2);
163  for (int i=0; i<it1->size(); i++)
164  {
165  _cADCMsnVME_Subdet.fill(did, it1->sample(i).adc());
166  _cADCall_Subdet.fill(did, it1->sample(i).adc(), -2);
167  _cADC_Subdet[i].fill(did, it1->sample(i).adc(), -2);
168  }
169  }
170  else
171  for (int i=0; i<it1->size(); i++)
172  {
173  _cADCall_Subdet.fill(did, double(it1->sample(i).adc()),
174  double(it2->sample(i).adc()));
175  _cADC_Subdet[i].fill(did, double(it1->sample(i).adc()),
176  double(it2->sample(i).adc()));
177  if (it1->sample(i).adc()!=it2->sample(i).adc())
178  {
179  // fill depth, uTCA and VME as well for which guys
180  // mismatches happen
181  _cMsm_depth.fill(did);
182  _cMsm_FEDVME.fill(eid2);
183  _cMsm_FEDuTCA.fill(eid1);
184  }
185  }
186  }
187  for (HBHEDigiCollection::const_iterator it2=chbhe2->begin();
188  it2!=chbhe2->end(); ++it2)
189  {
190  // itearte thru VME
191  // find utca digi by detid
192  // check if present or missing
193  HcalDetId did = it2->id();
194  HBHEDigiCollection::const_iterator it1 = chbhe1->find(did);
195  if (it1==chbhe1->end())
196  {
198  _cMsn_FEDuTCA.fill(eid1);
199  for (int i=0; i<it2->size(); i++)
200  {
201  _cADCMsnuTCA_Subdet.fill(did, it2->sample(i).adc());
202  _cADCall_Subdet.fill(did, -2, it2->sample(i).adc());
203  _cADC_Subdet[i].fill(did, -2, it2->sample(i).adc());
204  }
205  }
206  }
207 }
208 
210  edm::LuminosityBlock const& lb, edm::EventSetup const& es)
211 {
212  // in the end always
213  DQTask::endLuminosityBlock(lb, es);
214 }
215 
217 
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
virtual void initialize(std::string const &folder, hashfunctions::HashType, Quantity *, Quantity *qy=new ValueQuantity(quantity::fN), int debug=0)
Definition: Container1D.cc:40
int const CRATE_VME_MIN
Definition: Constants.h:60
int ib
Definition: cuy.py:660
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
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:85
hcaldqm::electronicsmap::ElectronicsMap _ehashmapuTCA
hcaldqm::Container2D _cMsm_FEDVME
edm::EDGetTokenT< HBHEDigiCollection > _tokHBHE2
int const FIBER_VME_MIN
Definition: Constants.h:90
void bookHistograms(fwlite::EventContainer &eventCont)
int const FIBERCH_MIN
Definition: Constants.h:100
edm::InputTag _tagHBHE1
std::vector< int > getFEDVMEList(HcalElectronicsMap const *)
Definition: Utilities.cc:78
hcaldqm::Container1D _cADCMsnuTCA_Subdet
hcaldqm::Container2D _cADCall_Subdet
virtual void fill(HcalDetId const &)
Definition: Container2D.cc:59
edm::EDGetTokenT< HBHEDigiCollection > _tokHBHE1
virtual void _resetMonitors(hcaldqm::UpdateFreq)
virtual void fill(uint32_t)
Definition: Container1D.cc:82
void dqmthrow(std::string const &msg) const
Definition: Logger.h:15
hcaldqm::Container2D _cMsnuTCA_depth
virtual void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &)
hcaldqm::Container2D _cMsn_FEDVME
virtual void initialize(std::string const &folder, hashfunctions::HashType, Quantity *, Quantity *, Quantity *qz=new ValueQuantity(quantity::fN), int debug=0)
Definition: Container2D.cc:32
int const FIBER_uTCA_MIN1
Definition: Constants.h:93
virtual void _process(edm::Event const &, edm::EventSetup const &)
Logger _logger
Definition: DQModule.h:70
std::string _name
Definition: DQModule.h:57
hcaldqm::filter::HashFilter _filter_uTCA
virtual void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
DigiComparisonTask(edm::ParameterSet const &)
int const CRATE_uTCA_MIN
Definition: Constants.h:65
hcaldqm::Container2D _cMsm_depth
virtual void book(DQMStore::IBooker &, HcalElectronicsMap const *, std::string subsystem="Hcal", std::string aux="")
Definition: Container2D.cc:895
virtual void book(DQMStore::IBooker &, HcalElectronicsMap const *, std::string subsystem="Hcal", std::string aux="")
Definition: Container1D.cc:957
hcaldqm::Container2D _cMsm_FEDuTCA
const T & get() const
Definition: EventSetup.h:56
T const * product() const
Definition: ESHandle.h:86
std::string const & label() const
Definition: InputTag.h:36
hcaldqm::Container2D _cMsnVME_depth
hcaldqm::electronicsmap::ElectronicsMap _ehashmapVME
std::vector< int > getFEDList(HcalElectronicsMap const *)
Definition: Utilities.cc:54
std::vector< int > getFEDuTCAList(HcalElectronicsMap const *)
Definition: Utilities.cc:104
std::string _subsystem
Definition: DQModule.h:64
HcalElectronicsMap const * _emap
edm::InputTag _tagHBHE2
hcaldqm::Container1D _cADCMsnVME_Subdet
virtual void initialize(FilterType ftype, HashType htype, std::vector< uint32_t > const &)
Definition: HashFilter.cc:26
hcaldqm::Container2D _cADC_Subdet[10]
Readout chain identification for Hcal.
std::string const & instance() const
Definition: InputTag.h:37
int const SLOT_uTCA_MIN
Definition: Constants.h:72
Definition: Run.h:43
hcaldqm::filter::HashFilter _filter_VME