CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
HcalDDDGeometryLoader Class Reference

#include <HcalDDDGeometryLoader.h>

Public Types

typedef CaloSubdetectorGeometryReturnType
 

Public Member Functions

 HcalDDDGeometryLoader ()=delete
 
 HcalDDDGeometryLoader (const HcalDDDRecConstants *hcons)
 
ReturnType load (const HcalTopology &topo)
 Load all of HCAL. More...
 
ReturnType load (const HcalTopology &topo, DetId::Detector, int)
 
virtual ~HcalDDDGeometryLoader ()
 

Private Member Functions

void fill (HcalSubdetector, HcalDDDGeometry *)
 
void makeCell (const HcalDetId &, const HcalCellType &, double, double, HcalDDDGeometry *geom) const
 

Private Attributes

const HcalDDDRecConstantshcalConstants_
 
bool isBH_
 

Detailed Description

Note
The Geometry as loaded from DDD
Author
S. Banerjee

Definition at line 21 of file HcalDDDGeometryLoader.h.

Member Typedef Documentation

◆ ReturnType

Definition at line 26 of file HcalDDDGeometryLoader.h.

Constructor & Destructor Documentation

◆ HcalDDDGeometryLoader() [1/2]

HcalDDDGeometryLoader::HcalDDDGeometryLoader ( const HcalDDDRecConstants hcons)
explicit

Definition at line 15 of file HcalDDDGeometryLoader.cc.

15  : hcalConstants_(hcons) {
17 }

References hcalConstants_, HcalDDDRecConstants::isBH(), and isBH_.

◆ ~HcalDDDGeometryLoader()

HcalDDDGeometryLoader::~HcalDDDGeometryLoader ( )
virtual

Definition at line 19 of file HcalDDDGeometryLoader.cc.

19 {}

◆ HcalDDDGeometryLoader() [2/2]

HcalDDDGeometryLoader::HcalDDDGeometryLoader ( )
delete

Member Function Documentation

◆ fill()

void HcalDDDGeometryLoader::fill ( HcalSubdetector  subdet,
HcalDDDGeometry geom 
)
private

helper functions to make all the ids and cells, and put them into the vectors and mpas passed in.

Definition at line 65 of file HcalDDDGeometryLoader.cc.

65  {
66  // start by making the new HcalDetIds
67  std::vector<HcalCellType> hcalCells = hcalConstants_->HcalCellTypes(subdet);
68  geom->insertCell(hcalCells);
69 #ifdef EDM_ML_DEBUG
70  std::cout << "HcalDDDGeometryLoader::fill gets " << hcalCells.size() << " cells for subdetector " << subdet
71  << std::endl;
72 #endif
73  // Make the new HcalDetIds and the cells
74 
75  std::vector<HcalDetId> hcalIds;
76  for (auto& hcalCell : hcalCells) {
77  int etaRing = hcalCell.etaBin();
78  int iside = hcalCell.zside();
79  int depthBin = hcalCell.depthSegment();
80  double dphi = hcalCell.phiBinWidth();
81  std::vector<std::pair<int, double> > phis = hcalCell.phis();
82 #ifdef EDM_ML_DEBUG
83  std::cout << "HcalDDDGeometryLoader: Subdet " << subdet << " side " << iside << " eta " << etaRing << " depth "
84  << depthBin << " with " << phis.size() << "modules:" << std::endl;
85  size_t i(0);
86 #endif
87  geom->increaseReserve(phis.size());
88  for (auto& phi : phis) {
89 #ifdef EDM_ML_DEBUG
90  std::cout << "HcalDDDGeometryLoader::fill Cell " << i << " eta " << iside * etaRing << " phi " << phi.first << "("
91  << phi.second / CLHEP::deg << ", " << dphi / CLHEP::deg << ") depth " << depthBin << std::endl;
92  i++;
93 #endif
94  HcalDetId id(subdet, iside * etaRing, phi.first, depthBin);
95  hcalIds.emplace_back(id);
96  makeCell(id, hcalCell, phi.second, dphi, geom);
97  }
98  }
99 
100  edm::LogInfo("HCalGeom") << "Number of HCAL DetIds made for " << subdet << " is " << hcalIds.size();
101 }

References gather_cfg::cout, relativeConstraints::geom, HcalDDDRecConstants::HcalCellTypes(), hcalConstants_, mps_fire::i, triggerObjects_cff::id, makeCell(), and phi.

Referenced by load().

◆ load() [1/2]

HcalDDDGeometryLoader::ReturnType HcalDDDGeometryLoader::load ( const HcalTopology topo)

Load all of HCAL.

Definition at line 45 of file HcalDDDGeometryLoader.cc.

45  {
47 
48  if (geom->cornersMgr() == nullptr) {
51  geom->allocateCorners(count);
52  }
53  if (geom->parMgr() == nullptr)
54  geom->allocatePar(500, 3);
55 
60  //fast insertion of valid ids requires sort at end
61  geom->sortValidIds();
62  return geom;
63 }

References submitPVResolutionJobs::count, fill(), relativeConstraints::geom, HcalBarrel, hcalConstants_, HcalEndcap, HcalForward, HcalOuter, and HcalDDDRecConstants::numberOfCells().

◆ load() [2/2]

HcalDDDGeometryLoader::ReturnType HcalDDDGeometryLoader::load ( const HcalTopology topo,
DetId::Detector  det,
int  subdet 
)

Definition at line 21 of file HcalDDDGeometryLoader.cc.

23  {
24  HcalSubdetector hsub = static_cast<HcalSubdetector>(subdet);
25 
27 
28  if (geom->cornersMgr() == nullptr) {
31  geom->allocateCorners(count);
32  }
33 
34  // if( geom->cornersMgr() == 0 ) geom->allocateCorners( 2592 ) ;
35 
36  if (geom->parMgr() == nullptr)
37  geom->allocatePar(500, 3);
38 
39  fill(hsub, geom);
40  //fast insertion of valid ids requires sort at end
41  geom->sortValidIds();
42  return geom;
43 }

References submitPVResolutionJobs::count, fill(), relativeConstraints::geom, HcalBarrel, hcalConstants_, HcalEndcap, HcalForward, HcalOuter, and HcalDDDRecConstants::numberOfCells().

◆ makeCell()

void HcalDDDGeometryLoader::makeCell ( const HcalDetId detId,
const HcalCellType hcalCell,
double  phi,
double  dphi,
HcalDDDGeometry geom 
) const
private

Definition at line 103 of file HcalDDDGeometryLoader.cc.

104  {
105  // the two eta boundaries of the cell
106  double eta1 = hcalCell.etaMin();
107  double eta2 = hcalCell.etaMax();
108  HcalSubdetector subdet = detId.subdet();
109  double eta = 0.5 * (eta1 + eta2) * detId.zside();
110  double deta = (eta2 - eta1);
111  double theta = 2.0 * atan(exp(-eta));
112 
113  // barrel vs forward
114  bool rzType = hcalCell.depthType();
115  bool isBarrel = (subdet == HcalBarrel || subdet == HcalOuter);
116 
117  double z, r, thickness;
118 #ifdef EDM_ML_DEBUG
119  double r0, r1, r2;
120 #endif
121  if (rzType) {
122  r = hcalCell.depthMin();
123  if (isBarrel) {
124  z = r * sinh(eta); // sinh(eta) == 1/tan(theta)
125  thickness = (hcalCell.depthMax() - r) * cosh(eta); // cosh(eta) == 1/sin(theta)
126 #ifdef EDM_ML_DEBUG
127  r1 = r;
128  r2 = hcalCell.depthMax();
129  r0 = 0.5 * (r1 + r2);
130 #endif
131  } else {
132  z = r * sinh(eta2);
133  thickness = 2. * hcalCell.halfSize();
134  r = z / sinh(std::abs(eta));
135 #ifdef EDM_ML_DEBUG
136  r0 = z / sinh(std::abs(eta));
137  r1 = z / sinh(std::abs(eta) + 0.5 * deta);
138  r2 = z / sinh(std::abs(eta) - 0.5 * deta);
139 #endif
140  }
141 #ifdef EDM_ML_DEBUG
142  std::cout << "HcalDDDGeometryLoader::makeCell SubDet " << subdet << " eta = " << eta << " theta = " << theta
143  << " r = " << r << " thickness = " << thickness << " r0-r2 (" << r0 << ":" << r1 << ":" << r2 << ")"
144  << std::endl;
145 #endif
146  } else {
147  z = hcalCell.depthMin();
148  thickness = hcalCell.depthMax() - z;
149  if (isBH_)
150  z += (0.5 * thickness);
151  z *= detId.zside(); // get the sign right.
152  r = z * tan(theta);
154 #ifdef EDM_ML_DEBUG
155  r0 = z / sinh(std::abs(eta));
156  r1 = z / sinh(std::abs(eta) + 0.5 * deta);
157  r2 = z / sinh(std::abs(eta) - 0.5 * deta);
158  std::cout << "HcalDDDGeometryLoader::makeCell SubDet " << subdet << " eta = " << eta << " theta = " << theta
159  << " z = " << z << " r = " << r << " thickness = " << thickness << " r0-r2 (" << r0 << ":" << r1 << ":"
160  << r2 << ")" << std::endl;
161 #endif
162  }
163 
164  double x = r * cos(phi);
165  double y = r * sin(phi);
166  GlobalPoint point(x, y, z);
167 
168 #ifdef EDM_ML_DEBUG
169  std::cout << "HcalDDDGeometryLoader::makeCell for " << detId << " Point " << point << " deta = " << deta
170  << " dphi = " << dphi << " thickness = " << thickness << " isBarrel = " << isBarrel << " " << rzType
171  << std::endl;
172 #endif
173 
174  std::vector<CCGFloat> hp;
175  hp.reserve(3);
176 
177  if (subdet == HcalForward) {
178  hp.emplace_back(deta / 2.);
179  hp.emplace_back(dphi / 2.);
180  hp.emplace_back(thickness / 2.);
181  } else {
182  const double sign(isBarrel ? 1 : -1);
183  hp.emplace_back(deta / 2.);
184  hp.emplace_back(dphi / 2.);
185  hp.emplace_back(sign * thickness / 2.);
186  }
187  geom->newCellFast(point, point, point, CaloCellGeometry::getParmPtr(hp, geom->parMgr(), geom->parVecVec()), detId);
188 }

References funct::abs(), funct::cos(), gather_cfg::cout, HcalCellType::depthMax(), HcalCellType::depthMin(), HcalCellType::depthType(), PVValHelper::eta, HLT_FULL_cff::eta1, HLT_FULL_cff::eta2, HcalCellType::etaMax(), HcalCellType::etaMin(), JetChargeProducer_cfi::exp, relativeConstraints::geom, CaloCellGeometry::getParmPtr(), HcalCellType::halfSize(), HcalBarrel, HcalForward, HcalOuter, trackingPlots::hp, PixelPluginsPhase0_cfi::isBarrel, isBH_, phi, point, alignCSCRings::r, diffTwoXMLs::r1, diffTwoXMLs::r2, Validation_hcalonly_cfi::sign, funct::sin(), HcalDetId::subdet(), funct::tan(), theta(), Calorimetry_cff::thickness, x, y, z, and HcalDetId::zside().

Referenced by fill().

Member Data Documentation

◆ hcalConstants_

const HcalDDDRecConstants* HcalDDDGeometryLoader::hcalConstants_
private

Definition at line 40 of file HcalDDDGeometryLoader.h.

Referenced by fill(), HcalDDDGeometryLoader(), and load().

◆ isBH_

bool HcalDDDGeometryLoader::isBH_
private

Definition at line 42 of file HcalDDDGeometryLoader.h.

Referenced by HcalDDDGeometryLoader(), and makeCell().

HcalDDDGeometryLoader::isBH_
bool isBH_
Definition: HcalDDDGeometryLoader.h:42
DDAxes::y
mps_fire.i
i
Definition: mps_fire.py:428
HcalCellType::depthMin
double depthMin() const
Definition: HcalCellType.h:88
HcalDDDGeometryLoader::fill
void fill(HcalSubdetector, HcalDDDGeometry *)
Definition: HcalDDDGeometryLoader.cc:65
gather_cfg.cout
cout
Definition: gather_cfg.py:144
Validation_hcalonly_cfi.sign
sign
Definition: Validation_hcalonly_cfi.py:32
DDAxes::x
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
HcalBarrel
Definition: HcalAssistant.h:33
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
HcalCellType::etaMin
double etaMin() const
lower cell edge. Always positive
Definition: HcalCellType.h:78
trackingPlots.hp
hp
Definition: trackingPlots.py:1230
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
HcalDDDRecConstants::numberOfCells
unsigned int numberOfCells(HcalSubdetector) const
Definition: HcalDDDRecConstants.cc:608
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
submitPVResolutionJobs.count
count
Definition: submitPVResolutionJobs.py:352
HcalOuter
Definition: HcalAssistant.h:35
theta
Geom::Theta< T > theta() const
Definition: Basic3DVectorLD.h:150
Point3DBase< float, GlobalTag >
HcalCellType::halfSize
double halfSize() const
Definition: HcalCellType.h:91
HLT_FULL_cff.eta1
eta1
Definition: HLT_FULL_cff.py:9541
PixelPluginsPhase0_cfi.isBarrel
isBarrel
Definition: PixelPluginsPhase0_cfi.py:17
HcalDDDGeometryLoader::makeCell
void makeCell(const HcalDetId &, const HcalCellType &, double, double, HcalDDDGeometry *geom) const
Definition: HcalDDDGeometryLoader.cc:103
diffTwoXMLs.r2
r2
Definition: diffTwoXMLs.py:73
HcalDetId::subdet
constexpr HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:138
funct::tan
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
HcalDetId
Definition: HcalDetId.h:12
HcalCellType::depthMax
double depthMax() const
Definition: HcalCellType.h:89
HcalDDDGeometryLoader::hcalConstants_
const HcalDDDRecConstants * hcalConstants_
Definition: HcalDDDGeometryLoader.h:40
HcalCellType::depthType
bool depthType() const
Definition: HcalCellType.h:90
alignCSCRings.r
r
Definition: alignCSCRings.py:93
HcalSubdetector
HcalSubdetector
Definition: HcalAssistant.h:31
HcalForward
Definition: HcalAssistant.h:36
DDAxes::phi
HcalEndcap
Definition: HcalAssistant.h:34
diffTwoXMLs.r1
r1
Definition: diffTwoXMLs.py:53
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
HcalDDDGeometry
Definition: HcalDDDGeometry.h:17
CaloCellGeometry::getParmPtr
static const CCGFloat * getParmPtr(const std::vector< CCGFloat > &vd, ParMgr *mgr, ParVecVec &pvv)
Definition: CaloCellGeometry.cc:117
HcalDDDRecConstants::HcalCellTypes
std::vector< HcalCellType > HcalCellTypes(HcalSubdetector) const
Definition: HcalDDDRecConstants.cc:520
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
HcalDetId::zside
constexpr int zside() const
get the z-side of the cell (1/-1)
Definition: HcalDetId.h:141
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
HcalCellType::etaMax
double etaMax() const
cell edge, always positive & greater than etaMin
Definition: HcalCellType.h:81
HcalDDDRecConstants::isBH
bool isBH() const
Definition: HcalDDDRecConstants.h:109