CMS 3D CMS Logo

TPComparisonTask.cc
Go to the documentation of this file.
1 
3 
4 using namespace hcaldqm;
5 using namespace hcaldqm::constants;
7  // tags and tokens
8  _tag1 = ps.getUntrackedParameter<edm::InputTag>("tag1", edm::InputTag("hcalDigis"));
9  _tag2 = ps.getUntrackedParameter<edm::InputTag>("tag2", edm::InputTag("vmeDigis"));
10  _tok1 = consumes<HcalTrigPrimDigiCollection>(_tag1);
11  _tok2 = consumes<HcalTrigPrimDigiCollection>(_tag2);
12 
13  // tmp flags
14  _skip1x1 = ps.getUntrackedParameter<bool>("skip1x1", true);
15 }
16 
18  edm::Run const& r,
19  edm::EventSetup const& es) {
20  DQTask::bookHistograms(ib, r, es);
21 
22  // GET WHAT YOU NEED
24  es.get<HcalDbRecord>().get(dbs);
26  es.get<HcalElectronicsMapRcd>().get("full", item);
27  _emap = item.product();
28  if (_ptype != fOffline) { // hidefed2crate
29  std::vector<int> vFEDs = hcaldqm::utilities::getFEDList(_emap);
30  std::vector<int> vFEDsVME = hcaldqm::utilities::getFEDVMEList(_emap);
31  std::vector<int> vFEDsuTCA = hcaldqm::utilities::getFEDuTCAList(_emap);
32  }
33  std::vector<uint32_t> vhashVME;
34  std::vector<uint32_t> vhashuTCA;
35  vhashVME.push_back(
37  vhashuTCA.push_back(HcalElectronicsId(CRATE_uTCA_MIN, SLOT_uTCA_MIN, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
40 
41  // INTIALIZE CONTAINERS
42  for (unsigned int i = 0; i < 4; i++) {
44  "Et",
49  0);
51  "FG",
56  0);
57  }
59  "Et",
64  0);
65 
66  if (_ptype != fOffline) { // hidefed2crate
68  "Missing",
73  0);
75  "Missing",
80  0);
82  "EtMsm",
87  0);
89  "EtMsm",
94  0);
96  "FGMsm",
101  0);
103  "FGMsm",
108  0);
109  }
110 
112  "Missing",
116  0);
118  "Missing",
122  0);
124  "EtMsm",
128  0);
130  "FGMsm",
134  0);
135 
136  char aux[20];
137  for (unsigned int i = 0; i < 4; i++) {
138  sprintf(aux, "TS%d", i);
139  _cEt_TTSubdet[i].book(ib, _emap, _subsystem, aux);
140  _cFG_TTSubdet[i].book(ib, _emap, _subsystem, aux);
141  }
143  if (_ptype != fOffline) { // hidefed2crate
150  }
151 
152  _cMsnuTCA.book(ib, _subsystem, std::string("uTCA"));
153  _cMsnVME.book(ib, _subsystem, std::string("VME"));
154  _cEtMsm.book(ib, _subsystem);
155  _cFGMsm.book(ib, _subsystem);
156 
159  // _ehashmap.print();
160  // _cMsn_depth.book(ib);
161  // _cEtMsm_depth.book(ib);
162  // _cFGMsm_depth.book(ib);
163 }
164 
165 /* virtual */ void TPComparisonTask::_resetMonitors(hcaldqm::UpdateFreq uf) { DQTask::_resetMonitors(uf); }
166 
167 /* virtual */ void TPComparisonTask::_process(edm::Event const& e, edm::EventSetup const& es) {
170 
171  if (!e.getByToken(_tok1, coll1))
172  _logger.dqmthrow("Collection HcalTrigPrimDigiCollection isn't available" + _tag1.label() + " " + _tag1.instance());
173  if (!e.getByToken(_tok2, coll2))
174  _logger.dqmthrow("Collection HcalTrigPrimDigiCollection isn't available" + _tag2.label() + " " + _tag2.instance());
175 
176  // assume always coll1 is primary (uTCA) and coll2 is secondary(VME)
177  for (HcalTrigPrimDigiCollection::const_iterator it1 = coll1->begin(); it1 != coll1->end(); ++it1) {
178  // iterate thru utca collection
179  // get the same detid digi from vme collection
180  // if missing - fill vme missing
181  // else correlate
182  // tmp
183  if (_skip1x1)
184  if (it1->id().version() > 0)
185  continue;
186  // \tmp
187 
188  HcalTrigTowerDetId tid = it1->id();
192 
193  if (it2 == coll2->end()) {
194  // missing from VME collection
195  _cMsnVME.fill(tid);
196  if (_ptype != fOffline) { // hidefed2crate
197  _cMsn_FEDVME.fill(eid2);
198  }
199  for (int i = 0; i < it1->size(); i++) {
200  _cEtall_TTSubdet.fill(tid, it1->sample(i).compressedEt(), -2);
201  _cEt_TTSubdet[i].fill(tid, it1->sample(i).compressedEt(), -2);
202  }
203  } else
204  for (int i = 0; i < it1->size(); i++) {
205  _cEtall_TTSubdet.fill(tid, it1->sample(i).compressedEt(), it2->sample(i).compressedEt());
206  _cEt_TTSubdet[i].fill(tid, it1->sample(i).compressedEt(), it2->sample(i).compressedEt());
207  _cFG_TTSubdet[i].fill(tid, it1->sample(i).fineGrain(), it2->sample(i).fineGrain());
208  if (it1->sample(i).compressedEt() != it2->sample(i).compressedEt()) {
209  if (_ptype != fOffline) { // hidefed2crate
210  _cEtMsm_FEDuTCA.fill(eid1);
211  _cEtMsm_FEDVME.fill(eid2);
212  }
213  _cEtMsm.fill(tid);
214  }
215  if (it1->sample(i).fineGrain() != it2->sample(i).fineGrain()) {
216  if (_ptype != fOffline) { // hidefed2crate
217  _cFGMsm_FEDuTCA.fill(eid1);
218  _cFGMsm_FEDVME.fill(eid2);
219  }
220  _cFGMsm.fill(tid);
221  }
222  }
223  }
224  for (HcalTrigPrimDigiCollection::const_iterator it2 = coll2->begin(); it2 != coll2->end(); ++it2) {
225  // itearte thru VME
226  // find utca tp digi by detid
227  // check if present of missing
228  HcalTrigTowerDetId tid = it2->id();
229  if (_skip1x1)
230  if (tid.version() > 0)
231  continue;
232 
234  if (it1 == coll1->end()) {
236  if (_ptype != fOffline) { // hidefed2crate
237  _cMsn_FEDuTCA.fill(eid1);
238  }
239  _cMsnuTCA.fill(tid);
240  for (int i = 0; i < it2->size(); i++) {
241  _cEtall_TTSubdet.fill(tid, -2, it2->sample(i).compressedEt());
242  _cEt_TTSubdet[i].fill(tid, -2, it2->sample(i).compressedEt());
243  }
244  }
245  }
246 }
247 
249  // in the end always
250  DQTask::endLuminosityBlock(lb, es);
251 }
252 
edm::InputTag _tag1
T getUntrackedParameter(std::string const &, T const &) const
int const CRATE_VME_MIN
Definition: Constants.h:83
hcaldqm::Container2D _cMsn_FEDuTCA
hcaldqm::Container2D _cEtMsm_FEDVME
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
hcaldqm::filter::HashFilter _filter_uTCA
void initialize(HcalElectronicsMap const *, ElectronicsMapType etype=fHcalElectronicsMap)
hcaldqm::Container2D _cEtMsm_FEDuTCA
UpdateFreq
Definition: DQTask.h:16
hcaldqm::ContainerSingle2D _cMsnVME
std::vector< T >::const_iterator const_iterator
TPComparisonTask(edm::ParameterSet const &)
virtual void initialize(std::string const &folder, quantity::Quantity *, quantity::Quantity *, quantity::Quantity *qz=new quantity::ValueQuantity(quantity::fN), int debug=0)
int const SPIGOT_MIN
Definition: Constants.h:108
hcaldqm::ContainerSingle2D _cFGMsm
void _resetMonitors(hcaldqm::UpdateFreq) override
int const FIBER_VME_MIN
Definition: Constants.h:113
int ieta() const
get the tower ieta
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
edm::EDGetTokenT< HcalTrigPrimDigiCollection > _tok1
int const FIBERCH_MIN
Definition: Constants.h:122
hcaldqm::electronicsmap::ElectronicsMap _ehashmapVME
virtual void book(DQMStore::IBooker &, std::string subsystem="Hcal", std::string aux="")
std::vector< int > getFEDVMEList(HcalElectronicsMap const *)
Definition: Utilities.cc:101
void _process(edm::Event const &, edm::EventSetup const &) override
ProcessingType _ptype
Definition: DQModule.h:43
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void dqmthrow(std::string const &msg) const
Definition: Logger.h:12
hcaldqm::Container2D _cEtall_TTSubdet
hcaldqm::ContainerSingle2D _cEtMsm
int const FIBER_uTCA_MIN1
Definition: Constants.h:116
edm::EDGetTokenT< HcalTrigPrimDigiCollection > _tok2
edm::InputTag _tag2
hcaldqm::Container2D _cFGMsm_FEDuTCA
Logger _logger
Definition: DQModule.h:54
std::string _name
Definition: DQModule.h:41
HcalElectronicsMap const * _emap
Definition: DQTask.h:59
int const CRATE_uTCA_MIN
Definition: Constants.h:88
const_iterator end() const
hcaldqm::Container2D _cFG_TTSubdet[4]
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
int version() const
get the version code for the trigger tower
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::electronicsmap::ElectronicsMap _ehashmapuTCA
iterator find(key_type k)
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
hcaldqm::ContainerSingle2D _cMsnuTCA
hcaldqm::Container2D _cMsn_FEDVME
virtual void fill(int, int)
hcaldqm::Container2D _cEt_TTSubdet[4]
void book(DQMStore::IBooker &, HcalElectronicsMap const *, std::string subsystem="Hcal", std::string aux="") override
Definition: Container2D.cc:558
hcaldqm::filter::HashFilter _filter_VME
hcaldqm::Container2D _cFGMsm_FEDVME
T const * product() const
Definition: ESHandle.h:86
Readout chain identification for Hcal.
std::string const & instance() const
Definition: InputTag.h:37
void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override
int iphi() const
get the tower iphi
int const SLOT_uTCA_MIN
Definition: Constants.h:95
const_iterator begin() const
Definition: Run.h:45
ib
Definition: cuy.py:662