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  DQTask(ps)
8 {
9  // tags and tokens
11  edm::InputTag("hcalDigis"));
13  edm::InputTag("vmeDigis"));
14  _tok1 = consumes<HcalTrigPrimDigiCollection>(_tag1);
15  _tok2 = consumes<HcalTrigPrimDigiCollection>(_tag2);
16 
17  // tmp flags
18  _skip1x1 = ps.getUntrackedParameter<bool>("skip1x1", true);
19 }
20 
22  edm::Run const& r, edm::EventSetup const& es)
23 {
24  DQTask::bookHistograms(ib, r, es);
25 
26  // GET WHAT YOU NEED
28  es.get<HcalDbRecord>().get(dbs);
30  es.get<HcalElectronicsMapRcd>().get("full", item);
31  _emap = item.product();
32  if (_ptype != fOffline) { // hidefed2crate
33  std::vector<int> vFEDs = hcaldqm::utilities::getFEDList(_emap);
34  std::vector<int> vFEDsVME = hcaldqm::utilities::getFEDVMEList(_emap);
35  std::vector<int> vFEDsuTCA = hcaldqm::utilities::getFEDuTCAList(_emap);
36  }
37  std::vector<uint32_t> vhashVME;
38  std::vector<uint32_t> vhashuTCA;
39  vhashVME.push_back(HcalElectronicsId(constants::FIBERCH_MIN,
41  vhashuTCA.push_back(HcalElectronicsId(CRATE_uTCA_MIN, SLOT_uTCA_MIN,
42  FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
44  vhashVME);
46  vhashuTCA);
47 
48  // INTIALIZE CONTAINERS
49  for (unsigned int i=0; i<4; i++)
50  {
61  }
67 
68  if (_ptype != fOffline) { // hidefed2crate
69  _cMsn_FEDVME.initialize(_name, "Missing",
74  _cMsn_FEDuTCA.initialize(_name, "Missing",
99  }
100 
101  _cMsnuTCA.initialize(_name, "Missing",
105  _cMsnVME.initialize(_name, "Missing",
109  _cEtMsm.initialize(_name, "EtMsm",
113  _cFGMsm.initialize(_name, "FGMsm",
117 
118  char aux[20];
119  for (unsigned int i=0; i<4; i++)
120  {
121  sprintf(aux, "TS%d", i);
122  _cEt_TTSubdet[i].book(ib, _emap, _subsystem, aux);
123  _cFG_TTSubdet[i].book(ib, _emap, _subsystem, aux);
124  }
126  if (_ptype != fOffline) { // hidefed2crate
133  }
134 
135  _cMsnuTCA.book(ib, _subsystem, std::string("uTCA"));
136  _cMsnVME.book(ib, _subsystem, std::string("VME"));
137  _cEtMsm.book(ib, _subsystem);
138  _cFGMsm.book(ib, _subsystem);
139 
141  _filter_VME);
143  _filter_uTCA);
144 // _ehashmap.print();
145 // _cMsn_depth.book(ib);
146 // _cEtMsm_depth.book(ib);
147 // _cFGMsm_depth.book(ib);
148 }
149 
151 {
152  DQTask::_resetMonitors(uf);
153 }
154 
155 /* virtual */ void TPComparisonTask::_process(edm::Event const& e,
156  edm::EventSetup const& es)
157 {
160 
161  if (!e.getByToken(_tok1, coll1))
163  "Collection HcalTrigPrimDigiCollection isn't available" +
164  _tag1.label() + " " + _tag1.instance());
165  if (!e.getByToken(_tok2, coll2))
167  "Collection HcalTrigPrimDigiCollection isn't available" +
168  _tag2.label() + " " + _tag2.instance());
169 
170  // assume always coll1 is primary (uTCA) and coll2 is secondary(VME)
172  it1!=coll1->end(); ++it1)
173  {
174  // iterate thru utca collection
175  // get the same detid digi from vme collection
176  // if missing - fill vme missing
177  // else correlate
178  // tmp
179  if (_skip1x1)
180  if (it1->id().version()>0)
181  continue;
182  // \tmp
183 
184  HcalTrigTowerDetId tid = it1->id();
186  HcalTrigTowerDetId(tid.ieta(), tid.iphi(), 0));
188  _ehashmapuTCA.lookup(tid));
190  _ehashmapVME.lookup(tid));
191 
192  if (it2==coll2->end())
193  {
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  {
201  _cEtall_TTSubdet.fill(tid,
202  it1->sample(i).compressedEt(), -2);
203  _cEt_TTSubdet[i].fill(tid,
204  it1->sample(i).compressedEt(), -2);
205  }
206  }
207  else
208  for (int i=0; i<it1->size(); i++)
209  {
210  _cEtall_TTSubdet.fill(tid,
211  it1->sample(i).compressedEt(),
212  it2->sample(i).compressedEt());
213  _cEt_TTSubdet[i].fill(tid,
214  it1->sample(i).compressedEt(),
215  it2->sample(i).compressedEt());
216  _cFG_TTSubdet[i].fill(tid,
217  it1->sample(i).fineGrain(),
218  it2->sample(i).fineGrain());
219  if (it1->sample(i).compressedEt()!=
220  it2->sample(i).compressedEt())
221  {
222  if (_ptype != fOffline) { // hidefed2crate
223  _cEtMsm_FEDuTCA.fill(eid1);
224  _cEtMsm_FEDVME.fill(eid2);
225  }
226  _cEtMsm.fill(tid);
227  }
228  if (it1->sample(i).fineGrain()!=
229  it2->sample(i).fineGrain())
230  {
231  if (_ptype != fOffline) { // hidefed2crate
232  _cFGMsm_FEDuTCA.fill(eid1);
233  _cFGMsm_FEDVME.fill(eid2);
234  }
235  _cFGMsm.fill(tid);
236  }
237  }
238  }
240  it2!=coll2->end(); ++it2)
241  {
242  // itearte thru VME
243  // find utca tp digi by detid
244  // check if present of missing
245  HcalTrigTowerDetId tid = it2->id();
246  if (_skip1x1)
247  if (tid.version()>0)
248  continue;
249 
251  HcalTrigTowerDetId(tid.ieta(), tid.iphi(), 0));
252  if (it1==coll1->end())
253  {
255  _ehashmapuTCA.lookup(tid));
256  if (_ptype != fOffline) { // hidefed2crate
257  _cMsn_FEDuTCA.fill(eid1);
258  }
259  _cMsnuTCA.fill(tid);
260  for (int i=0; i<it2->size(); i++)
261  {
262  _cEtall_TTSubdet.fill(tid,
263  -2, it2->sample(i).compressedEt());
264  _cEt_TTSubdet[i].fill(tid, -2, it2->sample(i).compressedEt());
265  }
266  }
267  }
268 }
269 
271  edm::LuminosityBlock const& lb, edm::EventSetup const& es)
272 {
273  // in the end always
274  DQTask::endLuminosityBlock(lb, es);
275 }
276 
278 
edm::InputTag _tag1
T getUntrackedParameter(std::string const &, T const &) const
int const CRATE_VME_MIN
Definition: Constants.h:111
hcaldqm::Container2D _cMsn_FEDuTCA
hcaldqm::Container2D _cEtMsm_FEDVME
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
hcaldqm::filter::HashFilter _filter_uTCA
void initialize(HcalElectronicsMap const *, ElectronicsMapType etype=fHcalElectronicsMap)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
hcaldqm::Container2D _cEtMsm_FEDuTCA
UpdateFreq
Definition: DQTask.h:17
hcaldqm::ContainerSingle2D _cMsnVME
std::vector< HcalTriggerPrimitiveDigi >::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)
virtual example_stream void bookHistograms(DQMStore::IBooker &,@example_stream edm::Run const &,@example_stream edm::EventSetup const &) override
int const SPIGOT_MIN
Definition: Constants.h:136
hcaldqm::ContainerSingle2D _cFGMsm
void _resetMonitors(hcaldqm::UpdateFreq) override
int const FIBER_VME_MIN
Definition: Constants.h:141
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:151
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:119
void _process(edm::Event const &, edm::EventSetup const &) override
ProcessingType _ptype
Definition: DQModule.h:59
void dqmthrow(std::string const &msg) const
Definition: Logger.h:15
hcaldqm::Container2D _cEtall_TTSubdet
hcaldqm::ContainerSingle2D _cEtMsm
int const FIBER_uTCA_MIN1
Definition: Constants.h:144
edm::EDGetTokenT< HcalTrigPrimDigiCollection > _tok2
edm::InputTag _tag2
hcaldqm::Container2D _cFGMsm_FEDuTCA
Logger _logger
Definition: DQModule.h:70
std::string _name
Definition: DQModule.h:57
HcalElectronicsMap const * _emap
Definition: DQTask.h:73
int const CRATE_uTCA_MIN
Definition: Constants.h:116
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:31
int version() const
get the version code for the trigger tower
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:95
T get() const
Definition: EventSetup.h:62
std::vector< int > getFEDuTCAList(HcalElectronicsMap const *)
Definition: Utilities.cc:145
void fill(HcalDetId const &) override
Definition: Container2D.cc:58
virtual void initialize(FilterType ftype, hashfunctions::HashType htype, std::vector< uint32_t > const &)
Definition: HashFilter.cc:28
std::string _subsystem
Definition: DQModule.h:64
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:894
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:123
const_iterator begin() const
Definition: Run.h:44
ib
Definition: cuy.py:662