CMS 3D CMS Logo

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

#include <CastorHardcodeGeometryLoader.h>

Public Member Functions

 CastorHardcodeGeometryLoader ()
 
 CastorHardcodeGeometryLoader (const CastorTopology &ht)
 
virtual std::unique_ptr< CaloSubdetectorGeometryload (DetId::Detector det, int subdet)
 
std::unique_ptr< CaloSubdetectorGeometryload ()
 
virtual ~CastorHardcodeGeometryLoader ()
 

Private Member Functions

void fill (HcalCastorDetId::Section section, CaloSubdetectorGeometry *cg)
 
void init ()
 
void makeCell (const HcalCastorDetId &detId, CaloSubdetectorGeometry *geom) const
 

Private Attributes

const CastorTopologyextTopology
 
float theEMSectiondX
 
float theEMSectiondY
 
float theEMSectiondZ
 
float theHADSectiondX
 
float theHADSectiondY
 
float theHADSectiondZ
 
CastorTopologytheTopology
 

Detailed Description

Definition at line 11 of file CastorHardcodeGeometryLoader.h.

Constructor & Destructor Documentation

◆ CastorHardcodeGeometryLoader() [1/2]

CastorHardcodeGeometryLoader::CastorHardcodeGeometryLoader ( )

◆ CastorHardcodeGeometryLoader() [2/2]

CastorHardcodeGeometryLoader::CastorHardcodeGeometryLoader ( const CastorTopology ht)
explicit

Definition at line 17 of file CastorHardcodeGeometryLoader.cc.

References init().

◆ ~CastorHardcodeGeometryLoader()

virtual CastorHardcodeGeometryLoader::~CastorHardcodeGeometryLoader ( )
inlinevirtual

Definition at line 15 of file CastorHardcodeGeometryLoader.h.

References theTopology.

15 { delete theTopology; };

Member Function Documentation

◆ fill()

void CastorHardcodeGeometryLoader::fill ( HcalCastorDetId::Section  section,
CaloSubdetectorGeometry cg 
)
private

Definition at line 47 of file CastorHardcodeGeometryLoader.cc.

References extTopology, CastorTopology::firstCell(), relativeConstraints::geom, l1ctLayer2EG_cff::id, CastorGeometry::k_NumberOfParametersPerShape, CastorGeometry::k_NumberOfShapes, HcalCastorDetId::kNumberSectorsPerEnd, HcalCastorDetId::kSizeForDenseIndexing, CastorTopology::lastCell(), makeCell(), hgcalPlots::section, and CastorTopology::valid().

Referenced by load().

47  {
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 }
virtual bool valid(const HcalCastorDetId &id) const
void makeCell(const HcalCastorDetId &detId, CaloSubdetectorGeometry *geom) const
int firstCell(HcalCastorDetId::Section section) const
int lastCell(HcalCastorDetId::Section section) const

◆ init()

void CastorHardcodeGeometryLoader::init ( void  )
private

◆ load() [1/2]

std::unique_ptr< CaloSubdetectorGeometry > CastorHardcodeGeometryLoader::load ( DetId::Detector  det,
int  subdet 
)
virtual

Definition at line 31 of file CastorHardcodeGeometryLoader.cc.

References HcalCastorDetId::EM, extTopology, fill(), HcalCastorDetId::HAD, and HcalCastorDetId::SubdetectorId.

Referenced by CastorHardcodeGeometryEP::produce().

31  {
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 }
void fill(HcalCastorDetId::Section section, CaloSubdetectorGeometry *cg)
static const int SubdetectorId

◆ load() [2/2]

std::unique_ptr< CaloSubdetectorGeometry > CastorHardcodeGeometryLoader::load ( )

Definition at line 40 of file CastorHardcodeGeometryLoader.cc.

References HcalCastorDetId::EM, extTopology, fill(), and HcalCastorDetId::HAD.

40  {
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 }
void fill(HcalCastorDetId::Section section, CaloSubdetectorGeometry *cg)

◆ makeCell()

void CastorHardcodeGeometryLoader::makeCell ( const HcalCastorDetId detId,
CaloSubdetectorGeometry geom 
) const
private

Definition at line 79 of file CastorHardcodeGeometryLoader.cc.

References timingPdfMaker::can, funct::cos(), cuy::dh, HGC3DClusterGenMatchSelector_cfi::dR, PVValHelper::dx, PVValHelper::dy, PVValHelper::dz, HcalCastorDetId::EM, relativeConstraints::geom, CaloCellGeometry::getParmPtr(), CastorGeometry::k_NumberOfParametersPerShape, HcalCastorDetId::kNumberSectorsPerEnd, M_PI, HcalCastorDetId::module(), callgraph::module, phi, HcalCastorDetId::section(), hgcalPlots::section, HcalCastorDetId::sector(), Validation_hcalonly_cfi::sign, funct::sin(), mathSSE::sqrt(), HcalCastorDetId::zside(), ecaldqm::zside(), and geometryCSVtoXML::zz.

Referenced by fill().

79  {
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 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
int zside(DetId const &)
T sqrt(T t)
Definition: SSEVec.h:19
int module() const
get the module (1-2 for EM, 1-12 for HAD)
int zside() const
get the z-side of the cell (1/-1)
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
static const CCGFloat * getParmPtr(const std::vector< CCGFloat > &vd, ParMgr *mgr, ParVecVec &pvv)
int sector() const
get the sector (1-16)
#define M_PI
Section section() const
get the section
dh
Definition: cuy.py:354

Member Data Documentation

◆ extTopology

const CastorTopology* CastorHardcodeGeometryLoader::extTopology
private

Definition at line 26 of file CastorHardcodeGeometryLoader.h.

Referenced by fill(), and load().

◆ theEMSectiondX

float CastorHardcodeGeometryLoader::theEMSectiondX
private

Definition at line 28 of file CastorHardcodeGeometryLoader.h.

Referenced by init().

◆ theEMSectiondY

float CastorHardcodeGeometryLoader::theEMSectiondY
private

Definition at line 29 of file CastorHardcodeGeometryLoader.h.

Referenced by init().

◆ theEMSectiondZ

float CastorHardcodeGeometryLoader::theEMSectiondZ
private

Definition at line 30 of file CastorHardcodeGeometryLoader.h.

Referenced by init().

◆ theHADSectiondX

float CastorHardcodeGeometryLoader::theHADSectiondX
private

Definition at line 31 of file CastorHardcodeGeometryLoader.h.

Referenced by init().

◆ theHADSectiondY

float CastorHardcodeGeometryLoader::theHADSectiondY
private

Definition at line 32 of file CastorHardcodeGeometryLoader.h.

Referenced by init().

◆ theHADSectiondZ

float CastorHardcodeGeometryLoader::theHADSectiondZ
private

Definition at line 33 of file CastorHardcodeGeometryLoader.h.

Referenced by init().

◆ theTopology

CastorTopology* CastorHardcodeGeometryLoader::theTopology
private

Definition at line 25 of file CastorHardcodeGeometryLoader.h.

Referenced by ~CastorHardcodeGeometryLoader().