CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
HcalTestNumberingTest.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: HcalTestNumberingTester
4 // Class: HcalTestNumberingTester
5 //
13 //
14 // Original Author: Sunanda Banerjee
15 // Created: Mon 2013/12/26
16 //
17 
18 // system include files
19 #include <memory>
20 #include <iostream>
21 #include <fstream>
22 
23 // user include files
28 
34 
44 
46 public:
48  ~HcalTestNumberingTester() override;
49 
50  void beginJob() override {}
51  void analyze(edm::Event const& iEvent, edm::EventSetup const&) override;
52  void endJob() override {}
53 
54 private:
57 };
58 
62 
64 
65 // ------------ method called to produce the data ------------
67  const HcalDDDSimConstants* hcs = &iSetup.getData(tokSim_);
68  const HcalDDDRecConstants* hcr = &iSetup.getData(tokReco_);
70  HcalNumberingScheme* schme2 = dynamic_cast<HcalNumberingScheme*>(new HcalTestNumberingScheme(false));
71 
72  for (int type = 0; type < 2; ++type) {
73  HcalSubdetector sub = (type == 0) ? HcalBarrel : HcalEndcap;
74  for (int zs = 0; zs < 2; ++zs) {
75  int zside = 2 * zs - 1;
76  std::pair<int, int> etas = hcr->getEtaRange(type);
77  for (int eta = etas.first; eta <= etas.second; ++eta) {
78  std::vector<std::pair<int, double> > phis = hcr->getPhis(sub, eta);
79  for (unsigned int k = 0; k < phis.size(); ++k) {
80  int phi = phis[k].first;
81  int lmin = (type == 1 && eta == 16) ? 8 : 1;
82  int lmax = (type == 1) ? 19 : ((eta == 16) ? 7 : 17);
83  for (int lay = lmin; lay <= lmax; ++lay) {
84  std::pair<int, int> etd = hcs->getEtaDepth(sub, eta, phi, zside, 0, lay);
85  HcalNumberingFromDDD::HcalID tmp(sub, zs, etd.second, etd.first, phi, phi, lay);
86  uint32_t id1 = schme1->getUnitID(tmp);
87  uint32_t id2 = schme2->getUnitID(tmp);
88  DetId id0 = HcalHitRelabeller::relabel(id2, hcr);
89  std::string ok = (id1 != id0.rawId()) ? " *** ERROR ***" : " ";
90  edm::LogVerbatim("HcalSim") << "I/P " << sub << ":" << zside * eta << ":" << phi << ":" << lay << " Normal "
91  << std::hex << id1 << std::dec << " " << HcalDetId(id1) << " Test " << std::hex
92  << id2 << std::dec << " " << HcalDetId(id0) << ok;
93  }
94  }
95  }
96  }
97  }
98 }
99 
100 //define this as a plug-in
const edm::ESGetToken< HcalDDDSimConstants, HcalSimNumberingRecord > tokSim_
Log< level::Info, true > LogVerbatim
const edm::ESGetToken< HcalDDDRecConstants, HcalRecNumberingRecord > tokReco_
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
virtual uint32_t getUnitID(const HcalNumberingFromDDD::HcalID &id)
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
int zside(DetId const &)
void analyze(edm::Event const &iEvent, edm::EventSetup const &) override
bool getData(T &iHolder) const
Definition: EventSetup.h:128
int iEvent
Definition: GenABIO.cc:224
HcalSubdetector
Definition: HcalAssistant.h:31
std::vector< std::pair< int, double > > getPhis(const int &subdet, const int &ieta) const
Definition: DetId.h:17
HcalTestNumberingTester(const edm::ParameterSet &)
std::pair< int, int > getEtaDepth(const int &det, int etaR, const int &phi, const int &zside, int depth, const int &lay) const
DetId relabel(const uint32_t testId) const
std::pair< int, int > getEtaRange(const int &i) const
tmp
align.sh
Definition: createJobs.py:716
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283