CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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  std::vector<int> vFEDs = hcaldqm::utilities::getFEDList(_emap);
33  std::vector<int> vFEDsVME = hcaldqm::utilities::getFEDVMEList(_emap);
34  std::vector<int> vFEDsuTCA = hcaldqm::utilities::getFEDuTCAList(_emap);
35  std::vector<uint32_t> vhashVME;
36  std::vector<uint32_t> vhashuTCA;
37  vhashVME.push_back(HcalElectronicsId(constants::FIBERCH_MIN,
39  vhashuTCA.push_back(HcalElectronicsId(CRATE_uTCA_MIN, SLOT_uTCA_MIN,
40  FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
42  vhashVME);
44  vhashuTCA);
45 
46  // INTIALIZE CONTAINERS
47  for (unsigned int i=0; i<4; i++)
48  {
59  }
65  _cMsn_FEDVME.initialize(_name, "Missing",
70  _cMsn_FEDuTCA.initialize(_name, "Missing",
95 
96  _cMsnuTCA.initialize(_name, "Missing",
100  _cMsnVME.initialize(_name, "Missing",
104  _cEtMsm.initialize(_name, "EtMsm",
108  _cFGMsm.initialize(_name, "FGMsm",
112 
113  char aux[20];
114  for (unsigned int i=0; i<4; i++)
115  {
116  sprintf(aux, "TS%d", i);
117  _cEt_TTSubdet[i].book(ib, _emap, _subsystem, aux);
118  _cFG_TTSubdet[i].book(ib, _emap, _subsystem, aux);
119  }
127 
128  _cMsnuTCA.book(ib, _subsystem, std::string("uTCA"));
129  _cMsnVME.book(ib, _subsystem, std::string("VME"));
130  _cEtMsm.book(ib, _subsystem);
131  _cFGMsm.book(ib, _subsystem);
132 
134  _filter_VME);
136  _filter_uTCA);
137 // _ehashmap.print();
138 // _cMsn_depth.book(ib);
139 // _cEtMsm_depth.book(ib);
140 // _cFGMsm_depth.book(ib);
141 }
142 
144 {
145  DQTask::_resetMonitors(uf);
146 }
147 
148 /* virtual */ void TPComparisonTask::_process(edm::Event const& e,
149  edm::EventSetup const& es)
150 {
153 
154  if (!e.getByToken(_tok1, coll1))
156  "Collection HcalTrigPrimDigiCollection isn't available" +
157  _tag1.label() + " " + _tag1.instance());
158  if (!e.getByToken(_tok2, coll2))
160  "Collection HcalTrigPrimDigiCollection isn't available" +
161  _tag2.label() + " " + _tag2.instance());
162 
163  // assume always coll1 is primary (uTCA) and coll2 is secondary(VME)
164  for (HcalTrigPrimDigiCollection::const_iterator it1=coll1->begin();
165  it1!=coll1->end(); ++it1)
166  {
167  // iterate thru utca collection
168  // get the same detid digi from vme collection
169  // if missing - fill vme missing
170  // else correlate
171  // tmp
172  if (_skip1x1)
173  if (it1->id().version()>0)
174  continue;
175  // \tmp
176 
177  HcalTrigTowerDetId tid = it1->id();
179  HcalTrigTowerDetId(tid.ieta(), tid.iphi(), 0));
181  _ehashmapuTCA.lookup(tid));
183  _ehashmapVME.lookup(tid));
184 
185  if (it2==coll2->end())
186  {
187  // missing from VME collection
188  _cMsnVME.fill(tid);
189  _cMsn_FEDVME.fill(eid2);
190  for (int i=0; i<it1->size(); i++)
191  {
192  _cEtall_TTSubdet.fill(tid,
193  it1->sample(i).compressedEt(), -2);
194  _cEt_TTSubdet[i].fill(tid,
195  it1->sample(i).compressedEt(), -2);
196  }
197  }
198  else
199  for (int i=0; i<it1->size(); i++)
200  {
201  _cEtall_TTSubdet.fill(tid,
202  it1->sample(i).compressedEt(),
203  it2->sample(i).compressedEt());
204  _cEt_TTSubdet[i].fill(tid,
205  it1->sample(i).compressedEt(),
206  it2->sample(i).compressedEt());
207  _cFG_TTSubdet[i].fill(tid,
208  it1->sample(i).fineGrain(),
209  it2->sample(i).fineGrain());
210  if (it1->sample(i).compressedEt()!=
211  it2->sample(i).compressedEt())
212  {
213  _cEtMsm_FEDuTCA.fill(eid1);
214  _cEtMsm_FEDVME.fill(eid2);
215  _cEtMsm.fill(tid);
216  }
217  if (it1->sample(i).fineGrain()!=
218  it2->sample(i).fineGrain())
219  {
220  _cFGMsm_FEDuTCA.fill(eid1);
221  _cFGMsm_FEDVME.fill(eid2);
222  _cFGMsm.fill(tid);
223  }
224  }
225  }
226  for (HcalTrigPrimDigiCollection::const_iterator it2=coll2->begin();
227  it2!=coll2->end(); ++it2)
228  {
229  // itearte thru VME
230  // find utca tp digi by detid
231  // check if present of missing
232  HcalTrigTowerDetId tid = it2->id();
233  if (_skip1x1)
234  if (tid.version()>0)
235  continue;
236 
238  HcalTrigTowerDetId(tid.ieta(), tid.iphi(), 0));
239  if (it1==coll1->end())
240  {
242  _ehashmapuTCA.lookup(tid));
243  _cMsn_FEDuTCA.fill(eid1);
244  _cMsnuTCA.fill(tid);
245  for (int i=0; i<it2->size(); i++)
246  {
247  _cEtall_TTSubdet.fill(tid,
248  -2, it2->sample(i).compressedEt());
249  _cEt_TTSubdet[i].fill(tid, -2, it2->sample(i).compressedEt());
250  }
251  }
252  }
253 }
254 
256  edm::LuminosityBlock const& lb, edm::EventSetup const& es)
257 {
258  // in the end always
259  DQTask::endLuminosityBlock(lb, es);
260 }
261 
263 
HcalElectronicsMap const * _emap
edm::InputTag _tag1
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
int const CRATE_VME_MIN
Definition: Constants.h:60
int ib
Definition: cuy.py:660
hcaldqm::Container2D _cMsn_FEDuTCA
hcaldqm::Container2D _cEtMsm_FEDVME
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
hcaldqm::filter::HashFilter _filter_uTCA
void initialize(HcalElectronicsMap const *, ElectronicsMapType etype=fHcalElectronicsMap)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
virtual void _resetMonitors(hcaldqm::UpdateFreq)
hcaldqm::Container2D _cEtMsm_FEDuTCA
UpdateFreq
Definition: DQTask.h:17
hcaldqm::ContainerSingle2D _cMsnVME
std::vector< HcalTriggerPrimitiveDigi >::const_iterator const_iterator
TPComparisonTask(edm::ParameterSet const &)
int const SPIGOT_MIN
Definition: Constants.h:85
hcaldqm::ContainerSingle2D _cFGMsm
int const FIBER_VME_MIN
Definition: Constants.h:90
int ieta() const
get the tower ieta
edm::EDGetTokenT< HcalTrigPrimDigiCollection > _tok1
void bookHistograms(fwlite::EventContainer &eventCont)
int const FIBERCH_MIN
Definition: Constants.h:100
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:78
virtual void fill(HcalDetId const &)
Definition: Container2D.cc:59
void dqmthrow(std::string const &msg) const
Definition: Logger.h:15
hcaldqm::Container2D _cEtall_TTSubdet
hcaldqm::ContainerSingle2D _cEtMsm
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
edm::EDGetTokenT< HcalTrigPrimDigiCollection > _tok2
edm::InputTag _tag2
hcaldqm::Container2D _cFGMsm_FEDuTCA
Logger _logger
Definition: DQModule.h:70
std::string _name
Definition: DQModule.h:57
int const CRATE_uTCA_MIN
Definition: Constants.h:65
hcaldqm::Container2D _cFG_TTSubdet[4]
virtual void book(DQMStore::IBooker &, HcalElectronicsMap const *, std::string subsystem="Hcal", std::string aux="")
Definition: Container2D.cc:895
virtual void initialize(std::string const &folder, Quantity *, Quantity *, Quantity *qz=new ValueQuantity(quantity::fN), int debug=0)
int version() const
get the version code for the trigger tower
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::electronicsmap::ElectronicsMap _ehashmapuTCA
virtual void _process(edm::Event const &, edm::EventSetup const &)
virtual void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
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
hcaldqm::ContainerSingle2D _cMsnuTCA
hcaldqm::Container2D _cMsn_FEDVME
virtual void fill(int, int)
hcaldqm::Container2D _cEt_TTSubdet[4]
virtual void initialize(FilterType ftype, HashType htype, std::vector< uint32_t > const &)
Definition: HashFilter.cc:26
hcaldqm::filter::HashFilter _filter_VME
hcaldqm::Container2D _cFGMsm_FEDVME
Readout chain identification for Hcal.
std::string const & instance() const
Definition: InputTag.h:37
virtual void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &)
int iphi() const
get the tower iphi
int const SLOT_uTCA_MIN
Definition: Constants.h:72
Definition: Run.h:43