CMS 3D CMS Logo

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 
33 
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 
56 
58 
59 // ------------ method called to produce the data ------------
62  iSetup.get<HcalSimNumberingRecord>().get(pHSNDC);
64  iSetup.get<HcalRecNumberingRecord>().get(pHRNDC);
65 
66  if (pHSNDC.isValid() && pHRNDC.isValid()) {
67  std::cout << "about to de-reference the edm's" << std::endl;
68  HcalDDDSimConstants* hcs = (HcalDDDSimConstants*)(&(*pHSNDC));
69  HcalDDDRecConstants* hcr = (HcalDDDRecConstants*)(&(*pHRNDC));
71  HcalNumberingScheme* schme2 = dynamic_cast<HcalNumberingScheme*>(new HcalTestNumberingScheme(false));
72 
73  for (int type = 0; type < 2; ++type) {
74  HcalSubdetector sub = (type == 0) ? HcalBarrel : HcalEndcap;
75  for (int zs = 0; zs < 2; ++zs) {
76  int zside = 2 * zs - 1;
77  std::pair<int, int> etas = hcr->getEtaRange(type);
78  for (int eta = etas.first; eta <= etas.second; ++eta) {
79  std::vector<std::pair<int, double> > phis = hcr->getPhis(sub, eta);
80  for (unsigned int k = 0; k < phis.size(); ++k) {
81  int phi = phis[k].first;
82  int lmin = (type == 1 && eta == 16) ? 8 : 1;
83  int lmax = (type == 1) ? 19 : ((eta == 16) ? 7 : 17);
84  for (int lay = lmin; lay <= lmax; ++lay) {
85  std::pair<int, int> etd = hcs->getEtaDepth(sub, eta, phi, zside, 0, lay);
86  HcalNumberingFromDDD::HcalID tmp(sub, zs, etd.second, etd.first, phi, phi, lay);
87  uint32_t id1 = schme1->getUnitID(tmp);
88  uint32_t id2 = schme2->getUnitID(tmp);
89  DetId id0 = HcalHitRelabeller::relabel(id2, hcr);
90  std::cout << "I/P " << sub << ":" << zside * eta << ":" << phi << ":" << lay << " Normal " << std::hex
91  << id1 << std::dec << " " << HcalDetId(id1) << " Test " << std::hex << id2 << std::dec << " "
92  << HcalDetId(id0);
93  if (id1 != id0.rawId())
94  std::cout << " *** ERROR ***";
95  std::cout << std::endl;
96  }
97  }
98  }
99  }
100  }
101  }
102 }
103 
104 //define this as a plug-in
type
Definition: HCALResponse.h:21
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
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
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 &)
T get() const
Definition: EventSetup.h:73
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
bool isValid() const
Definition: ESHandle.h:44
tmp
align.sh
Definition: createJobs.py:716