CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ZdcHardcodeGeometryLoader.cc
Go to the documentation of this file.
6 #include <algorithm>
7 
9 
11  theTopology ( new ZdcTopology ) ,
12  extTopology ( theTopology )
13 {
14  init();
15 }
16 
18  theTopology( 0 ) ,
19  extTopology( &ht )
20 {
21  init();
22 }
23 
25 {
26 }
27 
30 {
32  if(subdet == HcalZDCDetId::SubdetectorId)
33  {
34  fill(HcalZDCDetId::EM ,hg );
35  fill(HcalZDCDetId::LUM ,hg );
36  fill(HcalZDCDetId::HAD ,hg );
37  }
38  return hg;
39 }
40 
43 {
45  fill(HcalZDCDetId::EM ,hg );
46  fill(HcalZDCDetId::LUM ,hg );
47  fill(HcalZDCDetId::HAD ,hg );
48  return hg;
49 }
50 
52  ReturnType geom )
53 {
54  // start by making the new HcalDetIds
55  std::vector<HcalZDCDetId> zdcIds;
57  int firstCell = extTopology->firstCell(section);
58  int lastCell = extTopology->lastCell(section);
59  for(int ichannel = firstCell; ichannel <= lastCell; ++ichannel) {
60  id = HcalZDCDetId(section, true, ichannel);
61  if(extTopology->valid(id)) zdcIds.push_back(id);
62  id = HcalZDCDetId(section, false, ichannel);
63  if(extTopology->valid(id)) zdcIds.push_back(id);
64  }
66  if( geom->parMgr() == 0 ) geom->allocatePar(
69 
70  edm::LogInfo("ZdcHardcodeGeometry") << "Number of ZDC DetIds made: " << section << " " << zdcIds.size();
71 
72  // for each new HcalZdcDetId, make a CaloCellGeometry
73 
74  for(std::vector<HcalZDCDetId>::const_iterator zdcIdItr = zdcIds.begin();
75  zdcIdItr != zdcIds.end(); ++zdcIdItr)
76  {
77  makeCell( *zdcIdItr, geom ) ;
78  }
79 }
80 
81 void
83  ReturnType geom) const
84 {
85  double zside ( detId.zside() ) ;
86 
87  const HcalZDCDetId::Section section ( detId.section() ) ;
88 
89  const int channel ( detId.channel() ) ;
90 
91 //********* Here are all the hardcoded numbers you need to know, in **cm**
92 //********* Most are from the zdc.xml and zdclum.xml files ******
93 
94  static const double x0 ( 0 ) ; // these 3 are for the "mother" volume
95  static const double y0 ( 0 ) ;
96  static const double z0 ( 14000 ) ;
97 
98  static const double angEM ( 0 ) ; // the angles of front face wrt vertical
99  static const double angLUM ( 0 ) ;
100  static const double angHAD ( atan( 1. ) ) ; // this is 45 deg
101 
102  // these dimensions are **half**-sizes
103 
104  static const double dxHAD ( 4.8 ) ;
105  static const double dxEM ( dxHAD/5. ) ;
106  static const double dxLUM ( 4.8 ) ; // to be updated when known
107 
108  static const double dhEM ( 6.25 ) ;
109  static const double dhLUM ( 6.25 ) ; // to be updated when known
110  static const double dhHAD ( 6.25 ) ;
111 
112  static const double dzEM ( 33.*0.15 ) ;
113  static const double dzLUM ( 23.5 ) ; // to be updated when known
114  static const double dzHAD ( 0.82*6./cos(angHAD) ) ;
115 
116  // these are not half-dimensions, they are offsets from nominal
117  // for the center-of-front-face points
118 
119  static const double xOffEM ( -4.*dxEM ) ;
120  static const double xOffLUM ( 0 ) ;
121  static const double xOffHAD ( 0 ) ;
122 
123  static const double yOffEM ( 0 ) ;
124  static const double yOffLUM ( 0 ) ;
125  static const double yOffHAD ( 0 ) ;
126 
127  static const double zOffEM ( -49.85 - 0.15 ) ;
128  static const double zOffLUM ( -39.555 ) ;
129  static const double zOffHAD ( -29.00 ) ;
130 
131 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
132 
133  double dx, dh, dz, x, y, z, an ;
134 
135  if( section==HcalZDCDetId::EM )
136  {
137  dx = dxEM ;
138  dh = dhEM ;
139  dz = dzEM ;
140  an = angEM ;
141  x = zside*( x0 + xOffEM + ( channel - 1.0 )*dxEM*2. ) ;
142  y = y0 + yOffEM ;
143  z = zside*( z0 + zOffEM ) ;
144  }
145  else
146  {
147  if( section==HcalZDCDetId::LUM )
148  {
149  dx = dxLUM ;
150  dh = dhLUM ;
151  dz = dzLUM ;
152  an = angLUM ;
153  x = zside*( x0 + xOffLUM ) ;
154  y = y0 + yOffLUM ;
155  z = zside*( z0 + zOffLUM + ( channel - 1.0 )*dzLUM*2. ) ;
156  }
157  else
158  {
159  assert( section==HcalZDCDetId::HAD ) ;
160  dx = dxHAD ;
161  dh = dhHAD ;
162  dz = dzHAD ;
163  an = angHAD ;
164  x = zside*( x0 + xOffHAD ) ;
165  y = y0 + yOffHAD ;
166  z = zside*( z0 + zOffHAD + ( channel - 1.0 )*dzHAD*2. ) ;
167  }
168  }
169 
170  const GlobalPoint fc ( x, y, z );
171 
172  const double dy ( dh*cos( an ) ) ;
173 
174  std::vector<CCGFloat> zz ;
176  zz.push_back( an ) ;
177  zz.push_back( dx ) ;
178  zz.push_back( dy ) ;
179  zz.push_back( dz ) ;
180 
181  geom->newCell( fc, fc, fc,
183  geom->parMgr(),
184  geom->parVecVec() ),
185  detId ) ;
186 }
187 
188 
virtual void newCell(const GlobalPoint &f1, const GlobalPoint &f2, const GlobalPoint &f3, const CCGFloat *parm, const DetId &detId)=0
int zside() const
get the z-side of the cell (1/-1)
Definition: HcalZDCDetId.h:36
void allocatePar(ParVec::size_type n, unsigned int m)
void makeCell(const HcalZDCDetId &detId, CaloSubdetectorGeometry *geom) const
double double double z
virtual bool valid(const HcalZDCDetId &id) const
Definition: ZdcTopology.cc:25
int lastCell(HcalZDCDetId::Section section) const
Definition: ZdcTopology.cc:259
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
void fill(HcalZDCDetId::Section section, CaloSubdetectorGeometry *cg)
CaloCellGeometry::CCGFloat CCGFloat
static const CCGFloat * getParmPtr(const std::vector< CCGFloat > &vd, ParMgr *mgr, ParVecVec &pvv)
Section section() const
get the section
Definition: HcalZDCDetId.h:38
static const int SubdetectorId
Definition: HcalZDCDetId.h:22
CaloCellGeometry::CornersMgr * cornersMgr()
Detector
Definition: DetId.h:26
int channel() const
get the channel
Definition: HcalZDCDetId.h:42
int firstCell(HcalZDCDetId::Section section) const
Definition: ZdcTopology.cc:248
void allocateCorners(CaloCellGeometry::CornersVec::size_type n)
x
Definition: VDTMath.h:216