test
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;
6  DQTask(ps)
7 {
8  // tags and tokens
10  edm::InputTag("hcalDigis"));
12  edm::InputTag("vmeDigis"));
13  _tok1 = consumes<HcalTrigPrimDigiCollection>(_tag1);
14  _tok2 = consumes<HcalTrigPrimDigiCollection>(_tag2);
15 
16  // tmp flags
17  _skip1x1 = ps.getUntrackedParameter<bool>("skip1x1", true);
18 }
19 
21  edm::Run const& r, edm::EventSetup const& es)
22 {
23  DQTask::bookHistograms(ib, r, es);
24 
25  // GET WHAT YOU NEED
27  es.get<HcalDbRecord>().get(dbs);
29  es.get<HcalElectronicsMapRcd>().get("full", item);
30  _emap = item.product();
31  std::vector<int> vFEDs = utilities::getFEDList(_emap);
32  std::vector<int> vFEDsVME = utilities::getFEDVMEList(_emap);
33  std::vector<int> vFEDsuTCA = utilities::getFEDuTCAList(_emap);
34  std::vector<uint32_t> vhashVME;
35  std::vector<uint32_t> vhashuTCA;
36  vhashVME.push_back(HcalElectronicsId(constants::FIBERCH_MIN,
38  vhashuTCA.push_back(HcalElectronicsId(CRATE_uTCA_MIN, SLOT_uTCA_MIN,
39  FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
41  vhashVME);
43  vhashuTCA);
44 
45  // INTIALIZE CONTAINERS
46  for (unsigned int i=0; i<4; i++)
47  {
58  }
64  _cMsn_FEDVME.initialize(_name, "Missing",
69  _cMsn_FEDuTCA.initialize(_name, "Missing",
94 
95  _cMsnuTCA.initialize(_name, "Missing",
99  _cMsnVME.initialize(_name, "Missing",
103  _cEtMsm.initialize(_name, "EtMsm",
107  _cFGMsm.initialize(_name, "FGMsm",
111 
112  char aux[20];
113  for (unsigned int i=0; i<4; i++)
114  {
115  sprintf(aux, "TS%d", i);
116  _cEt_TTSubdet[i].book(ib, _emap, _subsystem, aux);
117  _cFG_TTSubdet[i].book(ib, _emap, _subsystem, aux);
118  }
126 
127  _cMsnuTCA.book(ib, _subsystem, std::string("uTCA"));
128  _cMsnVME.book(ib, _subsystem, std::string("VME"));
129  _cEtMsm.book(ib, _subsystem);
130  _cFGMsm.book(ib, _subsystem);
131 
133  _filter_VME);
135  _filter_uTCA);
136 // _ehashmap.print();
137 // _cMsn_depth.book(ib);
138 // _cEtMsm_depth.book(ib);
139 // _cFGMsm_depth.book(ib);
140 }
141 
143 {
144  DQTask::_resetMonitors(uf);
145 }
146 
147 /* virtual */ void TPComparisonTask::_process(edm::Event const& e,
148  edm::EventSetup const& es)
149 {
152 
153  if (!e.getByToken(_tok1, coll1))
155  "Collection HcalTrigPrimDigiCollection isn't available" +
156  _tag1.label() + " " + _tag1.instance());
157  if (!e.getByToken(_tok2, coll2))
159  "Collection HcalTrigPrimDigiCollection isn't available" +
160  _tag2.label() + " " + _tag2.instance());
161 
162  // assume always coll1 is primary (uTCA) and coll2 is secondary(VME)
163  for (HcalTrigPrimDigiCollection::const_iterator it1=coll1->begin();
164  it1!=coll1->end(); ++it1)
165  {
166  // iterate thru utca collection
167  // get the same detid digi from vme collection
168  // if missing - fill vme missing
169  // else correlate
170  // tmp
171  if (_skip1x1)
172  if (it1->id().version()>0)
173  continue;
174  // \tmp
175 
176  HcalTrigTowerDetId tid = it1->id();
178  HcalTrigTowerDetId(tid.ieta(), tid.iphi(), 0));
180  _ehashmapuTCA.lookup(tid));
182  _ehashmapVME.lookup(tid));
183 
184  if (it2==coll2->end())
185  {
186  // missing from VME collection
187  _cMsnVME.fill(tid);
188  _cMsn_FEDVME.fill(eid2);
189  for (int i=0; i<it1->size(); i++)
190  {
191  _cEtall_TTSubdet.fill(tid,
192  it1->sample(i).compressedEt(), -2);
193  _cEt_TTSubdet[i].fill(tid,
194  it1->sample(i).compressedEt(), -2);
195  }
196  }
197  else
198  for (int i=0; i<it1->size(); i++)
199  {
200  _cEtall_TTSubdet.fill(tid,
201  it1->sample(i).compressedEt(),
202  it2->sample(i).compressedEt());
203  _cEt_TTSubdet[i].fill(tid,
204  it1->sample(i).compressedEt(),
205  it2->sample(i).compressedEt());
206  _cFG_TTSubdet[i].fill(tid,
207  it1->sample(i).fineGrain(),
208  it2->sample(i).fineGrain());
209  if (it1->sample(i).compressedEt()!=
210  it2->sample(i).compressedEt())
211  {
212  _cEtMsm_FEDuTCA.fill(eid1);
213  _cEtMsm_FEDVME.fill(eid2);
214  _cEtMsm.fill(tid);
215  }
216  if (it1->sample(i).fineGrain()!=
217  it2->sample(i).fineGrain())
218  {
219  _cFGMsm_FEDuTCA.fill(eid1);
220  _cFGMsm_FEDVME.fill(eid2);
221  _cFGMsm.fill(tid);
222  }
223  }
224  }
225  for (HcalTrigPrimDigiCollection::const_iterator it2=coll2->begin();
226  it2!=coll2->end(); ++it2)
227  {
228  // itearte thru VME
229  // find utca tp digi by detid
230  // check if present of missing
231  HcalTrigTowerDetId tid = it2->id();
232  if (_skip1x1)
233  if (tid.version()>0)
234  continue;
235 
237  HcalTrigTowerDetId(tid.ieta(), tid.iphi(), 0));
238  if (it1==coll1->end())
239  {
241  _ehashmapuTCA.lookup(tid));
242  _cMsn_FEDuTCA.fill(eid1);
243  _cMsnuTCA.fill(tid);
244  for (int i=0; i<it2->size(); i++)
245  {
246  _cEtall_TTSubdet.fill(tid,
247  -2, it2->sample(i).compressedEt());
248  _cEt_TTSubdet[i].fill(tid, -2, it2->sample(i).compressedEt());
249  }
250  }
251  }
252 }
253 
255  edm::LuminosityBlock const& lb, edm::EventSetup const& es)
256 {
257  // in the end always
258  DQTask::endLuminosityBlock(lb, es);
259 }
260 
262 
HcalElectronicsMap const * _emap
Container2D _cFGMsm_FEDVME
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
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
Container2D _cEtMsm_FEDVME
UpdateFreq
Definition: DQTask.h:17
virtual void _resetMonitors(UpdateFreq)
std::vector< HcalTriggerPrimitiveDigi >::const_iterator const_iterator
ContainerSingle2D _cEtMsm
TPComparisonTask(edm::ParameterSet const &)
int const SPIGOT_MIN
Definition: Constants.h:85
ContainerSingle2D _cMsnuTCA
Container2D _cFGMsm_FEDuTCA
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
virtual void book(DQMStore::IBooker &, std::string subsystem="Hcal", std::string aux="")
std::vector< int > getFEDVMEList(HcalElectronicsMap const *)
Definition: Utilities.cc:71
ContainerSingle2D _cFGMsm
HashFilter _filter_VME
virtual void fill(HcalDetId const &)
Definition: Container2D.cc:59
Container2D _cEt_TTSubdet[4]
void dqmthrow(std::string const &msg) const
Definition: Logger.h:15
Container2D _cMsn_FEDVME
Container2D _cMsn_FEDuTCA
Container2D _cFG_TTSubdet[4]
electronicsmap::ElectronicsMap _ehashmapVME
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
HashFilter _filter_uTCA
edm::EDGetTokenT< HcalTrigPrimDigiCollection > _tok2
edm::InputTag _tag2
Logger _logger
Definition: DQModule.h:70
Container2D _cEtall_TTSubdet
std::string _name
Definition: DQModule.h:57
int const CRATE_uTCA_MIN
Definition: Constants.h:65
electronicsmap::ElectronicsMap _ehashmapuTCA
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
Container2D _cEtMsm_FEDuTCA
virtual void _process(edm::Event const &, edm::EventSetup const &)
ContainerSingle2D _cMsnVME
virtual void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
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
virtual void fill(int, int)
virtual void initialize(FilterType ftype, HashType htype, std::vector< uint32_t > const &)
Definition: HashFilter.cc:26
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