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 
34 
44 
46 public:
48  ~HcalTestNumberingTester() override = default;
49  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
50 
51  void beginJob() override {}
52  void analyze(edm::Event const& iEvent, edm::EventSetup const&) override;
53  void endJob() override {}
54 
55 private:
58 };
59 
63 
66  descriptions.add("hcalTestNumberingTest", desc);
67 }
68 
69 // ------------ method called to produce the data ------------
71  const HcalDDDSimConstants* hcs = &iSetup.getData(tokSim_);
72  const HcalDDDRecConstants* hcr = &iSetup.getData(tokReco_);
74  HcalNumberingScheme* schme2 = dynamic_cast<HcalNumberingScheme*>(new HcalTestNumberingScheme(false));
75 
76  for (int type = 0; type < 2; ++type) {
77  HcalSubdetector sub = (type == 0) ? HcalBarrel : HcalEndcap;
78  for (int zs = 0; zs < 2; ++zs) {
79  int zside = 2 * zs - 1;
80  std::pair<int, int> etas = hcr->getEtaRange(type);
81  for (int eta = etas.first; eta <= etas.second; ++eta) {
82  std::vector<std::pair<int, double> > phis = hcr->getPhis(sub, eta);
83  for (unsigned int k = 0; k < phis.size(); ++k) {
84  int phi = phis[k].first;
85  int lmin = (type == 1 && eta == 16) ? 8 : 1;
86  int lmax = (type == 1) ? 19 : ((eta == 16) ? 7 : 17);
87  for (int lay = lmin; lay <= lmax; ++lay) {
88  std::pair<int, int> etd = hcs->getEtaDepth(sub, eta, phi, zside, 0, lay);
89  HcalNumberingFromDDD::HcalID tmp(sub, zs, etd.second, etd.first, phi, phi, lay);
90  uint32_t id1 = schme1->getUnitID(tmp);
91  uint32_t id2 = schme2->getUnitID(tmp);
93  std::string ok = (id1 != id0.rawId()) ? " *** ERROR ***" : " ";
94  edm::LogVerbatim("HcalSim") << "I/P " << sub << ":" << zside * eta << ":" << phi << ":" << lay << " Normal "
95  << std::hex << id1 << std::dec << " " << HcalDetId(id1) << " Test " << std::hex
96  << id2 << std::dec << " " << HcalDetId(id0) << ok;
97  }
98  }
99  }
100  }
101  }
102 }
103 
104 //define this as a plug-in
const edm::ESGetToken< HcalDDDSimConstants, HcalSimNumberingRecord > tokSim_
Log< level::Info, true > LogVerbatim
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::pair< int, int > getEtaRange(const int &i) const
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
const edm::ESGetToken< HcalDDDRecConstants, HcalRecNumberingRecord > tokReco_
std::vector< std::pair< int, double > > getPhis(const int &subdet, const int &ieta) const
virtual uint32_t getUnitID(const HcalNumberingFromDDD::HcalID &id)
int zside(DetId const &)
void analyze(edm::Event const &iEvent, edm::EventSetup const &) override
int iEvent
Definition: GenABIO.cc:224
std::pair< int, int > getEtaDepth(const int &det, int etaR, const int &phi, const int &zside, int depth, const int &lay) const
HcalSubdetector
Definition: HcalAssistant.h:31
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
DetId relabel(const uint32_t testId) const
~HcalTestNumberingTester() override=default
Definition: DetId.h:17
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
void add(std::string const &label, ParameterSetDescription const &psetDescription)
HcalTestNumberingTester(const edm::ParameterSet &)
tmp
align.sh
Definition: createJobs.py:716