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;
6  DQTask(ps)
7 {
8  // tags and tokens
10  edm::InputTag("hcalDigis"));
12  edm::InputTag("vmeDigis"));
13  _tokHBHE1 = consumes<HBHEDigiCollection>(_tagHBHE1);
14  _tokHBHE2 = consumes<HBHEDigiCollection>(_tagHBHE2);
15 }
17  edm::Run const& r, edm::EventSetup const& es)
18 {
19  DQTask::bookHistograms(ib, r, es);
20 
21  // GET WHAT YOU NEED
23  es.get<HcalDbRecord>().get(dbs);
25  es.get<HcalElectronicsMapRcd>().get("full", item);
26  _emap = item.product();
27  std::vector<int> vFEDs = utilities::getFEDList(_emap);
28  std::vector<int> vFEDsVME = utilities::getFEDVMEList(_emap);
29  std::vector<int> vFEDsuTCA = utilities::getFEDuTCAList(_emap);
30  std::vector<uint32_t> vhashVME;
31  std::vector<uint32_t> vhashuTCA;
32  vhashVME.push_back(HcalElectronicsId(constants::FIBERCH_MIN,
34  vhashuTCA.push_back(HcalElectronicsId(CRATE_uTCA_MIN, SLOT_uTCA_MIN,
35  FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
37  vhashVME);
39  vhashuTCA);
40 
41  // INITIALIZE
42  for (unsigned int i=0; i<10; i++)
43  {
49  }
55  _cADCMsnuTCA_Subdet.initialize(_name, "ADCMsnuTCA",
59  _cADCMsnVME_Subdet.initialize(_name, "ADCMsnVME",
63  _cMsm_depth.initialize(_name, "Mismatched",
68  _cMsm_FEDVME.initialize(_name, "Mismatched",
73  _cMsm_FEDuTCA.initialize(_name, "Mismatched",
78  _cMsnVME_depth.initialize(_name, "Missing",
83  _cMsnuTCA_depth.initialize(_name, "Missing",
88  _cMsn_FEDVME.initialize(_name, "Missing",
93  _cMsn_FEDuTCA.initialize(_name, "Missing",
98 
99  // BOOK
100  char aux[20];
101  for (unsigned int i=0; i<10; i++)
102  {
103  sprintf(aux, "TS%d", i);
104  _cADC_Subdet[i].book(ib, _emap, _subsystem, aux);
105  }
116 
118  _filter_VME);
120  _filter_uTCA);
121 }
122 
124 {
125  DQTask::_resetMonitors(uf);
126 }
127 
128 /* virtual */ void DigiComparisonTask::_process(edm::Event const& e,
129  edm::EventSetup const& es)
130 {
133 
134  if (!e.getByToken(_tokHBHE1, chbhe1))
135  _logger.dqmthrow("Collection HBHEDigiCollection isn't available"
136  + _tagHBHE1.label() + " " + _tagHBHE1.instance());
137  if (!e.getByToken(_tokHBHE2, chbhe2))
138  _logger.dqmthrow("Collection HBHEDigiCollection isn't available"
139  + _tagHBHE2.label() + " " + _tagHBHE2.instance());
140 
141  // assume that coll1 is primary(uTCA) and coll2 is secondary(VME)
142  // uTCA is X and VME is Y axis
143  for (HBHEDigiCollection::const_iterator it1=chbhe1->begin();
144  it1!=chbhe1->end(); ++it1)
145  {
146  // iterate thru the utca collection
147  // get the same detid digi from vme collection
148  // if missing - fill vme missing
149  // else correlate
150  HcalDetId did = it1->id();
151  HcalElectronicsId eid1 = it1->elecId();
152  HBHEDigiCollection::const_iterator it2 = chbhe2->find(did);
153 
154  // get the eid for vme by did
156  if (it2==chbhe2->end())
157  {
158  // fill the depth plot
159  _cMsnVME_depth.fill(did);
160  _cMsn_FEDVME.fill(eid2);
161  for (int i=0; i<it1->size(); i++)
162  {
163  _cADCMsnVME_Subdet.fill(did, it1->sample(i).adc());
164  _cADCall_Subdet.fill(did, it1->sample(i).adc(), -2);
165  _cADC_Subdet[i].fill(did, it1->sample(i).adc(), -2);
166  }
167  }
168  else
169  for (int i=0; i<it1->size(); i++)
170  {
171  _cADCall_Subdet.fill(did, double(it1->sample(i).adc()),
172  double(it2->sample(i).adc()));
173  _cADC_Subdet[i].fill(did, double(it1->sample(i).adc()),
174  double(it2->sample(i).adc()));
175  if (it1->sample(i).adc()!=it2->sample(i).adc())
176  {
177  // fill depth, uTCA and VME as well for which guys
178  // mismatches happen
179  _cMsm_depth.fill(did);
180  _cMsm_FEDVME.fill(eid2);
181  _cMsm_FEDuTCA.fill(eid1);
182  }
183  }
184  }
185  for (HBHEDigiCollection::const_iterator it2=chbhe2->begin();
186  it2!=chbhe2->end(); ++it2)
187  {
188  // itearte thru VME
189  // find utca digi by detid
190  // check if present or missing
191  HcalDetId did = it2->id();
192  HBHEDigiCollection::const_iterator it1 = chbhe1->find(did);
193  if (it1==chbhe1->end())
194  {
196  _cMsn_FEDuTCA.fill(eid1);
197  for (int i=0; i<it2->size(); i++)
198  {
199  _cADCMsnuTCA_Subdet.fill(did, it2->sample(i).adc());
200  _cADCall_Subdet.fill(did, -2, it2->sample(i).adc());
201  _cADC_Subdet[i].fill(did, -2, it2->sample(i).adc());
202  }
203  }
204  }
205 }
206 
208  edm::LuminosityBlock const& lb, edm::EventSetup const& es)
209 {
210  // in the end always
211  DQTask::endLuminosityBlock(lb, es);
212 }
213 
215 
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
Container2D _cADC_Subdet[10]
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
std::vector< HBHEDataFrame >::const_iterator const_iterator
int const SPIGOT_MIN
Definition: Constants.h:85
edm::EDGetTokenT< HBHEDigiCollection > _tokHBHE2
virtual void _resetMonitors(UpdateFreq)
Container2D _cMsnuTCA_depth
Container2D _cADCall_Subdet
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:71
virtual void fill(HcalDetId const &)
Definition: Container2D.cc:59
edm::EDGetTokenT< HBHEDigiCollection > _tokHBHE1
virtual void fill(uint32_t)
Definition: Container1D.cc:82
void dqmthrow(std::string const &msg) const
Definition: Logger.h:15
electronicsmap::ElectronicsMap _ehashmapVME
virtual void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &)
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
electronicsmap::ElectronicsMap _ehashmapuTCA
std::string _name
Definition: DQModule.h:57
virtual void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
DigiComparisonTask(edm::ParameterSet const &)
int const CRATE_uTCA_MIN
Definition: Constants.h:65
Container1D _cADCMsnuTCA_Subdet
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
const T & get() const
Definition: EventSetup.h:56
T const * product() const
Definition: ESHandle.h:86
Container2D _cMsnVME_depth
std::string const & label() const
Definition: InputTag.h:36
std::vector< int > getFEDList(HcalElectronicsMap const *)
Definition: Utilities.cc:47
std::vector< int > getFEDuTCAList(HcalElectronicsMap const *)
Definition: Utilities.cc:97
std::string _subsystem
Definition: DQModule.h:64
HcalElectronicsMap const * _emap
edm::InputTag _tagHBHE2
virtual void initialize(FilterType ftype, HashType htype, std::vector< uint32_t > const &)
Definition: HashFilter.cc:26
Container1D _cADCMsnVME_Subdet
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