CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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::auto_ptr
< CaloSubdetectorGeometry
load (DetId::Detector det, int subdet)
 
std::auto_ptr
< CaloSubdetectorGeometry
load ()
 
virtual ~CastorHardcodeGeometryLoader ()
 

Private Member Functions

void fill (HcalCastorDetId::Section section, CaloSubdetectorGeometry *cg)
 
void init ()
 
CaloCellGeometrymakeCell (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 12 of file CastorHardcodeGeometryLoader.h.

Constructor & Destructor Documentation

CastorHardcodeGeometryLoader::CastorHardcodeGeometryLoader ( )
CastorHardcodeGeometryLoader::CastorHardcodeGeometryLoader ( const CastorTopology ht)
explicit

Definition at line 16 of file CastorHardcodeGeometryLoader.cc.

References init().

16  :
17  theTopology( 0 ) ,
18  extTopology ( &ht )
19 {
20  init();
21 }
virtual CastorHardcodeGeometryLoader::~CastorHardcodeGeometryLoader ( )
inlinevirtual

Definition at line 16 of file CastorHardcodeGeometryLoader.h.

References theTopology.

16 { delete theTopology ; };

Member Function Documentation

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

Definition at line 57 of file CastorHardcodeGeometryLoader.cc.

References CaloSubdetectorGeometry::addCell(), CaloSubdetectorGeometry::allocateCorners(), CaloSubdetectorGeometry::allocatePar(), CaloSubdetectorGeometry::cornersMgr(), extTopology, CastorTopology::firstCell(), ExpressReco_HICollisions_FallBack::id, CastorGeometry::k_NumberOfParametersPerShape, CastorGeometry::k_NumberOfShapes, HcalCastorDetId::kNumberSectorsPerEnd, HcalCastorDetId::kSizeForDenseIndexing, CastorTopology::lastCell(), makeCell(), CaloSubdetectorGeometry::parMgr(), and CastorTopology::valid().

Referenced by load().

59 {
60  if( geom->cornersMgr() == 0 ) geom->allocateCorners(
62  if( geom->parMgr() == 0 ) geom->allocatePar(
65  CastorGeometry::k_NumberOfParametersPerShape ) ;
66 
67  // start by making the new HcalDetIds
68  std::vector<HcalCastorDetId> castorIds ;
69 
70  const int firstCell ( extTopology->firstCell( section ) ) ;
71  const int lastCell ( extTopology->lastCell( section ) );
72 
73  for( int imodule ( firstCell ) ; imodule <= lastCell ; ++imodule )
74  {
75  for( int isector ( 1 ) ;
76  isector <= HcalCastorDetId::kNumberSectorsPerEnd ; ++isector )
77  {
78  const HcalCastorDetId id ( section, false, isector, imodule ) ;
79  if( extTopology->valid( id ) ) castorIds.push_back( id ) ;
80  }
81  }
82 // edm::LogInfo("CastorHardcodeGeometry")
83 // << "Number of Castor DetIds made: " << section
84 // << " " << castorIds.size();
85 
86  // for each new HcalCastorDetId, make a CaloCellGeometry
87 
88  for( std::vector<HcalCastorDetId>::const_iterator
89  castorIdItr ( castorIds.begin() ) ;
90  castorIdItr != castorIds.end() ; ++castorIdItr )
91  {
92  geom->addCell( *castorIdItr, makeCell( *castorIdItr, geom ) ) ;
93  }
94 }
CaloCellGeometry * makeCell(const HcalCastorDetId &detId, CaloSubdetectorGeometry *geom) const
virtual bool valid(const HcalCastorDetId &id) const
int firstCell(HcalCastorDetId::Section section) const
int lastCell(HcalCastorDetId::Section section) const
void CastorHardcodeGeometryLoader::init ( void  )
private
std::auto_ptr< CaloSubdetectorGeometry > CastorHardcodeGeometryLoader::load ( DetId::Detector  det,
int  subdet 
)
virtual

Definition at line 34 of file CastorHardcodeGeometryLoader.cc.

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

Referenced by CastorHardcodeGeometryEP::produce().

36 {
37  std::auto_ptr<CaloSubdetectorGeometry> hg(new CastorGeometry( extTopology ));
38  if( subdet == HcalCastorDetId::SubdetectorId )
39  {
40  fill( HcalCastorDetId::EM, hg.get() ) ;
41  fill( HcalCastorDetId::HAD, hg.get() ) ;
42  }
43  return hg;
44 }
void fill(HcalCastorDetId::Section section, CaloSubdetectorGeometry *cg)
static const int SubdetectorId
std::auto_ptr< CaloSubdetectorGeometry > CastorHardcodeGeometryLoader::load ( )

Definition at line 47 of file CastorHardcodeGeometryLoader.cc.

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

48 {
49  std::auto_ptr<CaloSubdetectorGeometry> hg
50  ( new CastorGeometry( extTopology ) ) ;
51  fill( HcalCastorDetId::EM, hg.get() ) ;
52  fill( HcalCastorDetId::HAD, hg.get() ) ;
53  return hg;
54 }
void fill(HcalCastorDetId::Section section, CaloSubdetectorGeometry *cg)
CaloCellGeometry * CastorHardcodeGeometryLoader::makeCell ( const HcalCastorDetId detId,
CaloSubdetectorGeometry geom 
) const
private

Definition at line 97 of file CastorHardcodeGeometryLoader.cc.

References CaloSubdetectorGeometry::cornersMgr(), funct::cos(), HcalCastorDetId::EM, benchmark_cfg::fc, CaloCellGeometry::getParmPtr(), CastorGeometry::k_NumberOfParametersPerShape, HcalCastorDetId::kNumberSectorsPerEnd, M_PI, module(), HcalCastorDetId::module(), CaloSubdetectorGeometry::parMgr(), CaloSubdetectorGeometry::parVecVec(), phi, HcalCastorDetId::section(), HcalCastorDetId::sector(), funct::sin(), mathSSE::sqrt(), and HcalCastorDetId::zside().

Referenced by fill().

99 {
100  const double zside ( 1.0*detId.zside() ) ;
101  const HcalCastorDetId::Section section ( detId.section() ) ;
102  const int module ( detId.module() ) ;
103  const int isect ( detId.sector() ) ;
104  const double sector ( 1.0*isect ) ;
105 
106 // length units are cm
107 
108 
109  const double sign ( 0 == isect%2 ? -1 : 1 ) ;
110 
111 //********* HERE ARE HARDWIRED GEOMETRY NUMBERS ACTUALLY USED *****
112 
113  static const double an ( atan( 1.)); //angle of cant w.r.t. beam
114  static const double can ( cos( an ));
115  static const double san ( sin( an ));
116  static const double dxlEM ( 1.55/2. ) ; //halflength of side near beam
117  static const double dxhEM ( 5.73/2. ) ; //halflength of side away from beam
118  static const double dhEM ( 14.26/2. ); //halflength of 2nd longest side
119  static const double dR ( 0.1 + 2.*dhEM*san*dxlEM/( dxhEM-dxlEM ) ) ;
120  static const double dhHAD ( 19.88/2. ); //halflength of 2nd longest side
121 
122  static const double dxhHAD ( dxhEM*( 2.*dhHAD*san + dR )/
123  ( 2.*dhEM*san + dR ) ) ; //halflength of side away from beam
124  static const double zm ( 1439.0 ) ; //z of start of EM
125  static const double dzEM ( 5.45/2 ) ; // halflength in z of EM
126  static const double dzHAD ( 10.075/2 ) ; // halflength in z of HAD
127 
128 //*****************************************************************
129 
130  const double dxl ( sign*dxlEM ) ; // same for EM and HAD
131 
132  const double dxh ( sign*( section == HcalCastorDetId::EM ?
133  dxhEM : dxhHAD ) ) ;
134  const double dh ( section == HcalCastorDetId::EM ?
135  dhEM : dhHAD ) ;
136  const double dz ( section == HcalCastorDetId::EM ?
137  dzEM : dzHAD ) ;
138 
139  const double delz ( dh*can ) ;
140  const double dy ( dh*san ) ;
141  const double dx ( ( dxl + dxh )/2. ) ;
142  const double leg ( dR + dy ) ;
143  const double len ( sqrt( leg*leg + dx*dx ) ) ;
144 
145  static const double dphi
147 
148  const double fphi ( atan( dx/( dR + dy ) ) ) ;
149 
150  const double phi ( 0==isect%2 ? (sector-1.)*dphi - fphi :
151  sector*dphi - fphi ) ;
152 
153  const double sphi ( sin( phi ) ) ;
154  const double cphi ( cos( phi ) ) ;
155 
156  const double xc ( len*cphi ) ;
157  const double yc ( len*sphi ) ;
158  const double zc ( zside*( zm + delz +
159  ( module<3 ? ( 1.*module - 1.0 )*2.*dzEM :
160  4.*dzEM + ( 1.*(module-2) - 1 )*2.*dzHAD ) ) ) ;
161 
162  const GlobalPoint fc ( xc, yc, zc ) ;
163 
164  std::vector<double> zz ;
166  zz.push_back( dxl ) ;
167  zz.push_back( dxh ) ;
168  zz.push_back( dh ) ;
169  zz.push_back( dz ) ;
170  zz.push_back( an ) ;
171  zz.push_back( dR ) ;
172 
173  return new calogeom::IdealCastorTrapezoid(
174  fc,
175  geom->cornersMgr(),
177  geom->parMgr(),
178  geom->parVecVec() ) );
179 }
int module() const
Definition: HLTadd.h:12
int sector() const
get the sector (1-16)
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
int module() const
get the module (1-2 for EM, 1-12 for HAD)
Section section() const
get the section
T sqrt(T t)
Definition: SSEVec.h:28
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
int zside() const
get the z-side of the cell (1/-1)
#define M_PI
Definition: BFit3D.cc:3
CaloCellGeometry::CornersMgr * cornersMgr()
static const double * getParmPtr(const std::vector< double > &vd, ParMgr *mgr, ParVecVec &pvv)
Definition: vlib.h:209
Definition: DDAxes.h:10

Member Data Documentation

const CastorTopology* CastorHardcodeGeometryLoader::extTopology
private

Definition at line 28 of file CastorHardcodeGeometryLoader.h.

Referenced by fill(), and load().

float CastorHardcodeGeometryLoader::theEMSectiondX
private

Definition at line 31 of file CastorHardcodeGeometryLoader.h.

Referenced by init().

float CastorHardcodeGeometryLoader::theEMSectiondY
private

Definition at line 32 of file CastorHardcodeGeometryLoader.h.

Referenced by init().

float CastorHardcodeGeometryLoader::theEMSectiondZ
private

Definition at line 33 of file CastorHardcodeGeometryLoader.h.

Referenced by init().

float CastorHardcodeGeometryLoader::theHADSectiondX
private

Definition at line 34 of file CastorHardcodeGeometryLoader.h.

Referenced by init().

float CastorHardcodeGeometryLoader::theHADSectiondY
private

Definition at line 35 of file CastorHardcodeGeometryLoader.h.

Referenced by init().

float CastorHardcodeGeometryLoader::theHADSectiondZ
private

Definition at line 36 of file CastorHardcodeGeometryLoader.h.

Referenced by init().

CastorTopology* CastorHardcodeGeometryLoader::theTopology
private

Definition at line 27 of file CastorHardcodeGeometryLoader.h.

Referenced by ~CastorHardcodeGeometryLoader().