CMS 3D CMS Logo

CastorHardcodeGeometryLoader.cc
Go to the documentation of this file.
7 #include <algorithm>
8 #include <utility>
9 
11 
13  : theTopology(new CastorTopology), extTopology(theTopology) {
14  init();
15 }
16 
18  : theTopology(nullptr), extTopology(&ht) {
19  init();
20 }
21 
25  theEMSectiondZ = 101.0;
28  theHADSectiondZ = 1212.;
29 }
30 
31 std::unique_ptr<CaloSubdetectorGeometry> CastorHardcodeGeometryLoader::load(DetId::Detector /*det*/, int subdet) {
32  std::unique_ptr<CaloSubdetectorGeometry> hg(new CastorGeometry(extTopology));
33  if (subdet == HcalCastorDetId::SubdetectorId) {
34  fill(HcalCastorDetId::EM, hg.get());
35  fill(HcalCastorDetId::HAD, hg.get());
36  }
37  return hg;
38 }
39 
40 std::unique_ptr<CaloSubdetectorGeometry> CastorHardcodeGeometryLoader::load() {
41  std::unique_ptr<CaloSubdetectorGeometry> hg(new CastorGeometry(extTopology));
42  fill(HcalCastorDetId::EM, hg.get());
43  fill(HcalCastorDetId::HAD, hg.get());
44  return hg;
45 }
46 
48  if (geom->cornersMgr() == nullptr)
50  if (geom->parMgr() == nullptr)
53 
54  // start by making the new HcalDetIds
55  std::vector<HcalCastorDetId> castorIds;
56 
57  const int firstCell(extTopology->firstCell(section));
58  const int lastCell(extTopology->lastCell(section));
59 
60  for (int imodule(firstCell); imodule <= lastCell; ++imodule) {
61  for (int isector(1); isector <= HcalCastorDetId::kNumberSectorsPerEnd; ++isector) {
62  const HcalCastorDetId id(section, false, isector, imodule);
63  if (extTopology->valid(id))
64  castorIds.emplace_back(id);
65  }
66  }
67  // edm::LogInfo("CastorHardcodeGeometry")
68  // << "Number of Castor DetIds made: " << section
69  // << " " << castorIds.size();
70 
71  // for each new HcalCastorDetId, make a CaloCellGeometry
72 
73  for (std::vector<HcalCastorDetId>::const_iterator castorIdItr(castorIds.begin()); castorIdItr != castorIds.end();
74  ++castorIdItr) {
75  makeCell(*castorIdItr, geom);
76  }
77 }
78 
80  const double zside(1.0 * detId.zside());
82  const int module(detId.module());
83  const int isect(detId.sector());
84  const double sector(1.0 * isect);
85 
86  // length units are cm
87 
88  const double sign(0 == isect % 2 ? -1 : 1);
89 
90  //********* HERE ARE HARDWIRED GEOMETRY NUMBERS ACTUALLY USED *****
91 
92  static const double an(atan(1.)); //angle of cant w.r.t. beam
93  static const double can(cos(an));
94  static const double san(sin(an));
95  static const double dxlEM(1.55 / 2.); //halflength of side near beam
96  static const double dxhEM(5.73 / 2.); //halflength of side away from beam
97  static const double dhEM(14.26 / 2.); //halflength of 2nd longest side
98  static const double dR(0.1 + 2. * dhEM * san * dxlEM / (dxhEM - dxlEM));
99  static const double dhHAD(19.88 / 2.); //halflength of 2nd longest side
100 
101  static const double dxhHAD(dxhEM * (2. * dhHAD * san + dR) /
102  (2. * dhEM * san + dR)); //halflength of side away from beam
103  static const double zm(1439.0); //z of start of EM
104  static const double dzEM(5.45 / 2); // halflength in z of EM
105  static const double dzHAD(10.075 / 2); // halflength in z of HAD
106 
107  //*****************************************************************
108 
109  const double dxl(sign * dxlEM); // same for EM and HAD
110 
111  const double dxh(sign * (section == HcalCastorDetId::EM ? dxhEM : dxhHAD));
112  const double dh(section == HcalCastorDetId::EM ? dhEM : dhHAD);
113  const double dz(section == HcalCastorDetId::EM ? dzEM : dzHAD);
114 
115  const double delz(dh * can);
116  const double dy(dh * san);
117  const double dx((dxl + dxh) / 2.);
118  const double leg(dR + dy);
119  const double len(sqrt(leg * leg + dx * dx));
120 
121  static const double dphi(2. * M_PI / (1.0 * HcalCastorDetId::kNumberSectorsPerEnd));
122 
123  const double fphi(atan(dx / (dR + dy)));
124 
125  const double phi(0 == isect % 2 ? (sector - 1.) * dphi - fphi : sector * dphi - fphi);
126 
127  const double sphi(sin(phi));
128  const double cphi(cos(phi));
129 
130  const double xc(len * cphi);
131  const double yc(len * sphi);
132  const double zc(
133  zside *
134  (zm + delz + (module < 3 ? (1. * module - 1.0) * 2. * dzEM : 4. * dzEM + (1. * (module - 2) - 1) * 2. * dzHAD)));
135 
136  const GlobalPoint fc(xc, yc, zc);
137 
138  std::vector<CCGFloat> zz;
140  zz.emplace_back(dxl);
141  zz.emplace_back(dxh);
142  zz.emplace_back(dh);
143  zz.emplace_back(dz);
144  zz.emplace_back(an);
145  zz.emplace_back(dR);
146 
147  geom->newCell(fc, fc, fc, CaloCellGeometry::getParmPtr(zz, geom->parMgr(), geom->parVecVec()), detId);
148 }
CastorHardcodeGeometryLoader::fill
void fill(HcalCastorDetId::Section section, CaloSubdetectorGeometry *cg)
Definition: CastorHardcodeGeometryLoader.cc:47
geometryCSVtoXML.zz
zz
Definition: geometryCSVtoXML.py:19
CaloCellGeometry::CCGFloat
float CCGFloat
Definition: CaloCellGeometry.h:52
MessageLogger.h
CastorTopology::lastCell
int lastCell(HcalCastorDetId::Section section) const
Definition: CastorTopology.cc:273
ecaldqm::zside
int zside(DetId const &)
Definition: EcalDQMCommonUtils.cc:189
CastorGeometryData.h
CastorHardcodeGeometryLoader::makeCell
void makeCell(const HcalCastorDetId &detId, CaloSubdetectorGeometry *geom) const
Definition: CastorHardcodeGeometryLoader.cc:79
HcalCastorDetId::kNumberSectorsPerEnd
Definition: HcalCastorDetId.h:69
CastorHardcodeGeometryLoader::theHADSectiondZ
float theHADSectiondZ
Definition: CastorHardcodeGeometryLoader.h:33
Validation_hcalonly_cfi.sign
sign
Definition: Validation_hcalonly_cfi.py:32
HcalCastorDetId::SubdetectorId
static const int SubdetectorId
Definition: HcalCastorDetId.h:28
HcalCastorDetId::Section
Section
Definition: HcalCastorDetId.h:25
CastorHardcodeGeometryLoader::theEMSectiondX
float theEMSectiondX
Definition: CastorHardcodeGeometryLoader.h:28
CastorHardcodeGeometryLoader::theHADSectiondX
float theHADSectiondX
Definition: CastorHardcodeGeometryLoader.h:31
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
CastorHardcodeGeometryLoader::load
std::unique_ptr< CaloSubdetectorGeometry > load()
Definition: CastorHardcodeGeometryLoader.cc:40
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
HcalCastorDetId::section
Section section() const
get the section
Definition: HcalCastorDetId.cc:49
CastorHardcodeGeometryLoader::init
void init()
Definition: CastorHardcodeGeometryLoader.cc:22
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
CastorHardcodeGeometryLoader::theHADSectiondY
float theHADSectiondY
Definition: CastorHardcodeGeometryLoader.h:32
dYHADPlate
static const double dYHADPlate
Definition: CastorGeometryData.h:35
Point3DBase< float, GlobalTag >
CastorHardcodeGeometryLoader::CastorHardcodeGeometryLoader
CastorHardcodeGeometryLoader()
Definition: CastorHardcodeGeometryLoader.cc:12
HcalCastorDetId
Definition: HcalCastorDetId.h:23
HcalCastorDetId::module
int module() const
get the module (1-2 for EM, 1-12 for HAD)
Definition: HcalCastorDetId.h:58
CastorTopology::valid
virtual bool valid(const HcalCastorDetId &id) const
Definition: CastorTopology.cc:19
CastorTopology
Definition: CastorTopology.h:13
HcalCastorDetId::zside
int zside() const
get the z-side of the cell (1/-1)
Definition: HcalCastorDetId.h:50
CastorHardcodeGeometryLoader.h
HcalCastorDetId::sector
int sector() const
get the sector (1-16)
Definition: HcalCastorDetId.h:62
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:49
PVValHelper::dy
Definition: PVValidationHelpers.h:50
DetId::Detector
Detector
Definition: DetId.h:24
dXHADPlate
static const double dXHADPlate
Definition: CastorGeometryData.h:37
callgraph.module
module
Definition: callgraph.py:61
DDAxes::phi
CastorHardcodeGeometryLoader::extTopology
const CastorTopology * extTopology
Definition: CastorHardcodeGeometryLoader.h:26
timingPdfMaker.can
can
Definition: timingPdfMaker.py:310
dXEMPlate
static const double dXEMPlate
Definition: CastorGeometryData.h:36
CaloCellGeometry.h
PVValHelper::dz
Definition: PVValidationHelpers.h:51
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
hgcalPlots.section
section
Definition: hgcalPlots.py:2679
HcalCastorDetId::kSizeForDenseIndexing
Definition: HcalCastorDetId.h:71
dYEMPlate
static const double dYEMPlate
Definition: CastorGeometryData.h:34
HcalCastorDetId::HAD
Definition: HcalCastorDetId.h:25
CaloCellGeometry::getParmPtr
static const CCGFloat * getParmPtr(const std::vector< CCGFloat > &vd, ParMgr *mgr, ParVecVec &pvv)
Definition: CaloCellGeometry.cc:117
CaloSubdetectorGeometry
Definition: CaloSubdetectorGeometry.h:22
CastorGeometry::k_NumberOfShapes
Definition: CastorGeometry.h:30
CastorHardcodeGeometryLoader::theEMSectiondZ
float theEMSectiondZ
Definition: CastorHardcodeGeometryLoader.h:30
CastorGeometry
Definition: CastorGeometry.h:14
HGC3DClusterGenMatchSelector_cfi.dR
dR
Definition: HGC3DClusterGenMatchSelector_cfi.py:7
IdealCastorTrapezoid.h
CCGFloat
CaloCellGeometry::CCGFloat CCGFloat
Definition: CastorHardcodeGeometryLoader.cc:10
CastorGeometry::k_NumberOfParametersPerShape
Definition: CastorGeometry.h:32
PVValHelper::dx
Definition: PVValidationHelpers.h:49
CastorTopology::firstCell
int firstCell(HcalCastorDetId::Section section) const
Definition: CastorTopology.cc:257
cuy.dh
dh
Definition: cuy.py:354
HcalCastorDetId::EM
Definition: HcalCastorDetId.h:25
CastorGeometry.h
CastorHardcodeGeometryLoader::theEMSectiondY
float theEMSectiondY
Definition: CastorHardcodeGeometryLoader.h:29