CMS 3D CMS Logo

CaloTowerHardcodeGeometryLoader.cc
Go to the documentation of this file.
6 #include <iostream>
7 #include <iterator>
8 #include <algorithm>
9 
10 //#define DebugLog
11 
13 
14 std::unique_ptr<CaloSubdetectorGeometry> CaloTowerHardcodeGeometryLoader::load(const CaloTowerTopology* limits,
15  const HcalTopology* hcaltopo,
16  const HcalDDDRecConstants* hcons) {
17  m_limits = limits;
18  m_hcaltopo = hcaltopo;
19  m_hcons = hcons;
20 
21  //get eta limits from hcal rec constants
24 
25 #ifdef DebugLog
26  std::cout << "CaloTowerHardcodeGeometryLoader: theHBHEEtaBounds = ";
27  std::copy(theHBHEEtaBounds.begin(), theHBHEEtaBounds.end(), std::ostream_iterator<double>(std::cout, ","));
28  std::cout << std::endl;
29 
30  std::cout << "CaloTowerHardcodeGeometryLoader: lastHBRing = " << m_limits->lastHBRing()
31  << ", lastHERing = " << m_limits->lastHERing() << std::endl;
32  std::cout << "CaloTowerHardcodeGeometryLoader: HcalTopology: firstHBRing = " << hcaltopo->firstHBRing()
33  << ", lastHBRing = " << hcaltopo->lastHBRing() << ", firstHERing = " << hcaltopo->firstHERing()
34  << ", lastHERing = " << hcaltopo->lastHERing() << ", firstHFRing = " << hcaltopo->firstHFRing()
35  << ", lastHFRing = " << hcaltopo->lastHFRing() << std::endl;
36 #endif
37 
39 
40  if (nullptr == geom->cornersMgr())
41  geom->allocateCorners(geom->numberOfCellsForCorners());
42  if (nullptr == geom->parMgr())
43  geom->allocatePar(geom->numberOfParametersPerShape() * geom->numberOfShapes(), geom->numberOfParametersPerShape());
44 
45  // simple loop
46  for (uint32_t din = 0; din < m_limits->sizeForDenseIndexing(); ++din) {
47  makeCell(din, geom);
48  }
49  edm::LogInfo("Geometry") << "CaloTowersHardcodeGeometry made " << m_limits->sizeForDenseIndexing() << " towers.";
50  return std::unique_ptr<CaloSubdetectorGeometry>(geom);
51 }
52 
54  const double EBradius = 143.0; // cm
55  const double HOradius = 406.0 + 1.0;
56  const double EEz = 320.0; // rough (cm)
57  const double HEz = 568.0; // back (cm)
58  const double HFz = 1100.0;
59  const double HFthick = 165;
60  // Tower 17 is the last EB tower
61 
62  //use CT topology to get the DetId for this dense index
64  int ieta = id.ieta();
65  int iphi = id.iphi();
66 
67  //use CT topology to get proper ieta for hcal
68  int etaRing = m_limits->convertCTtoHcal(abs(ieta));
69  int sign = (ieta > 0) ? (1) : (-1);
70  double eta1, eta2;
71 
72 #ifdef DebugLog
73  std::cout << "CaloTowerHardcodeGeometryLoader: ieta = " << ieta << ", iphi = " << iphi << ", etaRing = " << etaRing
74  << std::endl;
75 #endif
76 
77  if (abs(ieta) > m_limits->lastHERing()) {
78  eta1 = theHFEtaBounds.at(etaRing - m_hcaltopo->firstHFRing());
79  eta2 = theHFEtaBounds.at(etaRing - m_hcaltopo->firstHFRing() + 1);
80  } else {
81  eta1 = theHBHEEtaBounds.at(etaRing - 1);
82  eta2 = theHBHEEtaBounds.at(etaRing);
83  }
84  double eta = 0.5 * (eta1 + eta2);
85  double deta = (eta2 - eta1);
86 
87  // in radians
88  double dphi_nominal = 2.0 * M_PI / m_hcaltopo->nPhiBins(1); // always the same
89  double dphi_half = M_PI / m_hcaltopo->nPhiBins(etaRing); // half-width
90 
91  double phi_low = dphi_nominal * (iphi - 1); // low-edge boundaries are constant...
92  double phi = phi_low + dphi_half;
93 
94 #ifdef DebugLog
95  std::cout << "CaloTowerHardcodeGeometryLoader: eta1 = " << eta1 << ", eta2 = " << eta2 << ", eta = " << eta
96  << ", phi = " << phi << std::endl;
97 #endif
98 
99  double x, y, z, thickness;
100  bool alongZ = true;
101  if (abs(ieta) > m_limits->lastHERing()) { // forward
102  z = HFz;
103  double r = z / sinh(eta);
104  x = r * cos(phi);
105  y = r * sin(phi);
106  thickness = HFthick / tanh(eta);
107  } else if (abs(ieta) > m_limits->firstHERing() + 1) { // EE-containing
108  z = EEz;
109  double r = z / sinh(eta);
110  x = r * cos(phi);
111  y = r * sin(phi);
112  thickness = (HEz - EEz) / tanh(eta);
113  } else { // EB-containing
114  x = EBradius * cos(phi);
115  y = EBradius * sin(phi);
116  alongZ = false;
117  z = EBradius * sinh(eta);
118  thickness = (HOradius - EBradius) * cosh(eta);
119  }
120 
121  z *= sign;
122  GlobalPoint point(x, y, z);
123 
124  const double mysign(!alongZ ? 1 : -1);
125  std::vector<CCGFloat> hh;
126  hh.reserve(5);
127  hh.emplace_back(deta / 2);
128  hh.emplace_back(dphi_half);
129  hh.emplace_back(mysign * thickness / 2.);
130 
131  hh.emplace_back(fabs(eta));
132  hh.emplace_back(fabs(z));
133 
134 #ifdef DebugLog
135  std::cout << "CaloTowerHardcodeGeometryLoader: x = " << x << ", y = " << y << ", z = " << z
136  << ", thickness = " << thickness << std::endl;
137 #endif
138 
139  geom->newCell(point, point, point, CaloCellGeometry::getParmPtr(hh, geom->parMgr(), geom->parVecVec()), id);
140 }
IdealObliquePrism.h
DDAxes::y
CaloCellGeometry::CCGFloat
float CCGFloat
Definition: CaloCellGeometry.h:52
MessageLogger.h
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
gather_cfg.cout
cout
Definition: gather_cfg.py:144
HcalTopology
Definition: HcalTopology.h:26
CaloTowerTopology
Definition: CaloTowerTopology.h:13
Validation_hcalonly_cfi.sign
sign
Definition: Validation_hcalonly_cfi.py:32
DDAxes::x
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
CaloTowerTopology::firstHERing
int firstHERing() const
Definition: CaloTowerTopology.h:38
HcalTopology::firstHERing
int firstHERing() const
Definition: HcalTopology.h:93
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
LEDCalibrationChannels.iphi
iphi
Definition: LEDCalibrationChannels.py:64
HcalTopology::firstHFRing
int firstHFRing() const
Definition: HcalTopology.h:96
HcalDDDRecConstants::getEtaTableHF
const std::vector< double > & getEtaTableHF() const
Definition: HcalDDDRecConstants.h:76
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
CaloTowerHardcodeGeometryLoader.h
Calorimetry_cff.thickness
thickness
Definition: Calorimetry_cff.py:115
PVValHelper::eta
Definition: PVValidationHelpers.h:70
HLT_FULL_cff.eta2
eta2
Definition: HLT_FULL_cff.py:9542
DDAxes::z
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
Point3DBase< float, GlobalTag >
CCGFloat
CaloCellGeometry::CCGFloat CCGFloat
Definition: CaloTowerHardcodeGeometryLoader.cc:12
HLT_FULL_cff.eta1
eta1
Definition: HLT_FULL_cff.py:9541
CaloTowerHardcodeGeometryLoader::load
std::unique_ptr< CaloSubdetectorGeometry > load(const CaloTowerTopology *limits, const HcalTopology *hcaltopo, const HcalDDDRecConstants *hcons)
Definition: CaloTowerHardcodeGeometryLoader.cc:14
hh
const auto & hh
Definition: CAHitNtupletGeneratorKernelsImpl.h:455
LEDCalibrationChannels.ieta
ieta
Definition: LEDCalibrationChannels.py:63
CaloTowerTopology::detIdFromDenseIndex
CaloTowerDetId detIdFromDenseIndex(uint32_t din) const
Definition: CaloTowerTopology.cc:247
cropTnPTrees.din
din
Definition: cropTnPTrees.py:30
CaloTowerHardcodeGeometryLoader::m_hcons
const HcalDDDRecConstants * m_hcons
Definition: CaloTowerHardcodeGeometryLoader.h:25
CaloTowerHardcodeGeometryLoader::m_hcaltopo
const HcalTopology * m_hcaltopo
Definition: CaloTowerHardcodeGeometryLoader.h:24
CaloTowerTopology::lastHERing
int lastHERing() const
Definition: CaloTowerTopology.h:39
CaloTowerHardcodeGeometryLoader::theHFEtaBounds
std::vector< double > theHFEtaBounds
Definition: CaloTowerHardcodeGeometryLoader.h:26
CaloTowerHardcodeGeometryLoader::theHBHEEtaBounds
std::vector< double > theHBHEEtaBounds
Definition: CaloTowerHardcodeGeometryLoader.h:26
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:49
CaloTowerHardcodeGeometryLoader::m_limits
const CaloTowerTopology * m_limits
Definition: CaloTowerHardcodeGeometryLoader.h:23
HcalTopology::firstHBRing
int firstHBRing() const
Definition: HcalTopology.h:91
CaloTowerDetId.h
HcalTopology::lastHERing
int lastHERing() const
Definition: HcalTopology.h:94
CaloTowerGeometry
Definition: CaloTowerGeometry.h:16
alignCSCRings.r
r
Definition: alignCSCRings.py:93
TH2PolyOfflineMaps.limits
limits
Definition: TH2PolyOfflineMaps.py:45
DDAxes::phi
CaloTowerTopology::lastHBRing
int lastHBRing() const
Definition: CaloTowerTopology.h:37
CaloTowerTopology::convertCTtoHcal
int convertCTtoHcal(int ct_ieta) const
Definition: CaloTowerTopology.cc:67
CaloCellGeometry::getParmPtr
static const CCGFloat * getParmPtr(const std::vector< CCGFloat > &vd, ParMgr *mgr, ParVecVec &pvv)
Definition: CaloCellGeometry.cc:117
CaloTowerTopology::sizeForDenseIndexing
uint32_t sizeForDenseIndexing() const
Definition: CaloTowerTopology.h:56
HcalTopology::lastHFRing
int lastHFRing() const
Definition: HcalTopology.h:97
CaloSubdetectorGeometry
Definition: CaloSubdetectorGeometry.h:22
HcalDDDRecConstants
Definition: HcalDDDRecConstants.h:23
HcalTopology::nPhiBins
int nPhiBins(int etaRing) const
how many phi segments in this ring
Definition: HcalTopology.cc:956
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
CaloTowerHardcodeGeometryLoader::makeCell
void makeCell(uint32_t din, CaloSubdetectorGeometry *geom) const
Definition: CaloTowerHardcodeGeometryLoader.cc:53
point
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
GlobalPoint.h
HcalTopology::lastHBRing
int lastHBRing() const
Definition: HcalTopology.h:92
HcalDDDRecConstants::getEtaTable
const std::vector< double > & getEtaTable() const
Definition: HcalDDDRecConstants.h:75
CaloTowerDetId
Definition: CaloTowerDetId.h:12