ATLAS Offline Software
EndPlateFactory.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "EndPlateFactory.h"
6 
7 // GeoModel includes
9 #include "GeoModelKernel/GeoDefinitions.h"
10 #include "GeoModelKernel/GeoPhysVol.h"
11 #include "GeoModelKernel/GeoLogVol.h"
12 #include "GeoModelKernel/GeoTube.h"
13 #include "GeoModelKernel/GeoPcon.h"
14 #include "GeoModelKernel/GeoBox.h"
15 #include "GeoModelKernel/GeoMaterial.h"
16 #include "GeoModelKernel/GeoTransform.h"
17 
19 
25 
27 
28 #include "GaudiKernel/SystemOfUnits.h"
29 
30 #include <iostream>
31 
32 
34  : InDetDD::SubDetectorFactoryBase(athenaComps, matManager)
35 {
36 }
37 
38 
40 {
41 }
42 
43 
44 
45 //## Other Operations (implementation)
46 void EndPlateFactory::create(GeoPhysVol *mother)
47 {
48  DecodeVersionKey indetVersionKey(geoDbTagSvc(),"InnerDetector");
49  IRDBRecordset_ptr shell = rdbAccessSvc()->getRecordsetPtr("EPShell", indetVersionKey.tag(), indetVersionKey.node());
50  IRDBRecordset_ptr insert = rdbAccessSvc()->getRecordsetPtr("EPInsert", indetVersionKey.tag(), indetVersionKey.node());
51  IRDBRecordset_ptr ribs = rdbAccessSvc()->getRecordsetPtr("EPRibs", indetVersionKey.tag(), indetVersionKey.node());
52 //----------------------------------------------------------------------------------
53 // std::string matName = mat[(int) (*pbfi)[ii]->getFloat("MAT")];
54 // const GeoMaterial* cylMat = materialManager()->getMaterial(matName);
55 // double rmin = (*pbfi)[ii]->getFloat("RIN")*Gaudi::Units::cm;
56 //----------------------------------------------------------------------------------
57  double safety = 0.01*Gaudi::Units::mm;
58  double maxRofEP = 1075.0*Gaudi::Units::mm - safety; // Interfere with TRT PatchPanel1
59  double RibConnection = 550.0*Gaudi::Units::mm;
60 
61  maxRofEP = (*shell)[0]->getDouble("EPMAXR")*Gaudi::Units::mm - safety;
62  RibConnection = (*ribs)[0]->getDouble("RIBCONNECTION")*Gaudi::Units::mm;
63 //
64 // Internal shell. Default (initial) values
65 //
66  double rminInt = 425.*Gaudi::Units::mm;
67  double rmaxInt = 1040.*Gaudi::Units::mm;
68  double thickShell = 3.*Gaudi::Units::mm;
69  double thick2 = 10.*Gaudi::Units::mm;
70  double zposEP = 3370.*Gaudi::Units::mm;
71  double zleng = 42.*Gaudi::Units::mm;
72  rminInt = (*shell)[0]->getDouble("RMININT")*Gaudi::Units::mm;
73  rmaxInt = (*shell)[0]->getDouble("RMAXINT")*Gaudi::Units::mm;
74  thickShell = (*shell)[0]->getDouble("THICKSHELL")*Gaudi::Units::mm;
75  thick2 = (*shell)[0]->getDouble("THICKADD")*Gaudi::Units::mm;
76  zposEP = (*shell)[0]->getDouble("ZSTART")*Gaudi::Units::mm;
77  zleng = (*shell)[0]->getDouble("ZSHIFT")*Gaudi::Units::mm;
78 
79 
80  GeoPcon* shellInt = new GeoPcon(0.,2*M_PI);
81  shellInt->addPlane(0. , rminInt, rminInt+thick2);
82  shellInt->addPlane(zleng , rminInt, rminInt+thick2);
83  shellInt->addPlane(zleng , rminInt, rmaxInt );
84  shellInt->addPlane(zleng+thickShell, rminInt, rmaxInt );
85 
86 // Build the Phys Vol
87 // const GeoMaterial* shellMat = materialManager()->getMaterial("std::Aluminium");
88  const GeoMaterial* shellMat = materialManager()->getMaterial((*shell)[0]->getString("MATERIAL"));
89 // std::cout << "Shell mat. den.="<<shellMat->getDensity()<<" Rad.length="<<shellMat->getRadLength()<<'\n';
90 
91 
92  const GeoLogVol* shellLogInt = new GeoLogVol("EPShellInt",shellInt,shellMat);
93  GeoVPhysVol* shellPhysInt = new GeoPhysVol(shellLogInt);
94 
95  GeoTrf::Translate3D servpos1(0.,0., zposEP);
96  GeoTrf::Vector3D servpos2(0.,0.,-zposEP);
97  GeoTransform* xform1 = new GeoTransform(servpos1);
98  GeoTransform* xform2 = new GeoTransform(GeoTrf::GeoTransformRT(GeoTrf::GeoRotation(0,-M_PI,0),servpos2));
99  mother->add(xform1);
100  mother->add(shellPhysInt);
101  mother->add(xform2);
102  mother->add(shellPhysInt);
103 
104 //----------------------------------------------------------------------------------
105 //
106 // External shell (default/initial values)
107 
108  double zgap = 50.*Gaudi::Units::mm;
109  double rminExt = 250.*Gaudi::Units::mm;
110  double rmaxExt = maxRofEP;
111 
112  zgap = (*shell)[0]->getDouble("ZGAP")*Gaudi::Units::mm;
113  rminExt = (*shell)[0]->getDouble("RMINEXT")*Gaudi::Units::mm;
114 
115 
116  const GeoTube* shellExt = new GeoTube(rminExt,rmaxExt,thickShell/2.);
117  const GeoLogVol* shellLogExt = new GeoLogVol("EPShellExt",shellExt,shellMat);
118  GeoVPhysVol* shellPhysExt = new GeoPhysVol(shellLogExt);
119 
120  GeoTrf::Translate3D servpos3(0.,0., zposEP+zleng+thickShell+zgap+thickShell/2.);
121  GeoTrf::Vector3D servpos4(0.,0.,-zposEP-zleng-thickShell-zgap-thickShell/2.);
122  GeoTransform *xform3 = new GeoTransform(servpos3);
123  GeoTransform* xform4 = new GeoTransform(GeoTrf::GeoTransformRT(GeoTrf::GeoRotation(0,-M_PI,0),servpos4));
124 
125  mother->add(xform3);
126  mother->add(shellPhysExt);
127  mother->add(xform4);
128  mother->add(shellPhysExt);
129 
130 //----------------------------------------------------------------------------------
131 //
132 // Insert - default (initial) values
133 
134  double zthick = 16.0*Gaudi::Units::mm;
135  double zinsert = 3018.*Gaudi::Units::mm-zthick;
136  double rminins = 252.*Gaudi::Units::mm;
137  double rmaxins = 435.*Gaudi::Units::mm;
138  double rthick = 5.*Gaudi::Units::mm;
139  double zlengi = 410.*Gaudi::Units::mm;
140 
141  zthick = (*insert)[0]->getDouble("ZTHICK")*Gaudi::Units::mm;
142  zinsert = (*insert)[0]->getDouble("ZINSERT")*Gaudi::Units::mm;
143  rminins = (*insert)[0]->getDouble("RMININS")*Gaudi::Units::mm;
144  rmaxins = (*insert)[0]->getDouble("RMAXINS")*Gaudi::Units::mm;
145  rthick = (*insert)[0]->getDouble("RTHICK")*Gaudi::Units::mm;
146  zlengi = (*insert)[0]->getDouble("ZLENGINS")*Gaudi::Units::mm;
147 
148  GeoPcon* Insert = new GeoPcon(0.,2*M_PI);
149  Insert->addPlane(0. , rminins, rmaxins+rthick);
150  Insert->addPlane(zthick , rminins, rmaxins+rthick);
151  Insert->addPlane(zthick , rmaxins, rmaxins+rthick);
152  Insert->addPlane(zlengi , rmaxins, rmaxins+rthick);
153 
154  const GeoMaterial* insertMat = materialManager()->getMaterial((*insert)[0]->getString("MATERIAL"));
155 // std::cout << "Insert mat. den.="<<insertMat->getDensity()<<" Rad.length="<<insertMat->getRadLength()<<'\n';
156 // Build the Phys Vol
157  const GeoLogVol* InsertLog = new GeoLogVol("EPInsert",Insert,insertMat);
158  GeoVPhysVol* InsertPhys = new GeoPhysVol(InsertLog);
159 
160  GeoTrf::Translate3D servpos5(0.,0., zinsert);
161  GeoTrf::Vector3D servpos6(0.,0.,-zinsert);
162  GeoTransform *xform5 = new GeoTransform(servpos5);
163  GeoTransform* xform6 = new GeoTransform(GeoTrf::GeoTransformRT(GeoTrf::GeoRotation(0,-M_PI,0),servpos6));
164 
165  mother->add(xform5);
166  mother->add(InsertPhys);
167  mother->add(xform6);
168  mother->add(InsertPhys);
169 
170 // std::cout << "End of EP building !!!" <<zinsert<< '\n';
171 //----------------------------------------------------------------------------------
172 //
173 // Short ribs - default (initial) values
174 // Initial position is along X axis then move and rotate
175 //
176  double ribY = 12.0*Gaudi::Units::mm;
177  double ribZ = zgap - safety;
178  double ribX = 380.0*Gaudi::Units::mm;
179  double posX = 550.0*Gaudi::Units::mm+ribX/2.;
180 
181  ribY = (*ribs)[0]->getDouble("SHORTWID")*Gaudi::Units::mm;
182  ribZ = zgap - safety;
183  ribX = (*ribs)[0]->getDouble("SHORTLENG")*Gaudi::Units::mm;
184  posX = (*ribs)[0]->getDouble("SHORTRSTART")*Gaudi::Units::mm + ribX/2.;
185 
186  const GeoBox* ribShort = new GeoBox(ribX/2., ribY/2., ribZ/2.);
187 
188 
189  const GeoMaterial* ribsMat = materialManager()->getMaterial((*ribs)[0]->getString("MATERIAL"));
190 // std::cout << "Ribs mat. den.="<<ribsMat->getDensity()<<" Rad.length="<<ribsMat->getRadLength()<<'\n';
191 //----------
192  const GeoLogVol* ribShortLog = new GeoLogVol("ShortRib",ribShort,ribsMat);
193  GeoVPhysVol* ribShortPhys = new GeoPhysVol(ribShortLog);
194 
195 
196  GeoTransform *xrib;
197 
198  for (int ip=1; ip<12; ip++){
199  if( ip==3 || ip==6 || ip==9) continue;
200  double angl= ip*M_PI/6.;
201  GeoTrf::Vector3D ribpos_pos( posX*cos(angl), posX*sin(angl), zposEP+zleng+thickShell+zgap/2.);
202  GeoTrf::Vector3D ribpos_neg( posX*cos(angl), posX*sin(angl),-zposEP-zleng-thickShell-zgap/2.);
203  xrib = new GeoTransform(GeoTrf::GeoTransformRT(GeoTrf::GeoRotation(angl,0,0),ribpos_pos));
204  mother->add(xrib);
205  mother->add(ribShortPhys);
206  xrib = new GeoTransform(GeoTrf::GeoTransformRT(GeoTrf::GeoRotation(angl,0,0),ribpos_neg));
207  mother->add(xrib);
208  mother->add(ribShortPhys);
209  }
210 
211 //---------------------------------------------------------------------------------
212 // Long ribs (initial position is along X axis then move and rotate)
213 //
214  double ribY1 = 20.0*Gaudi::Units::mm;
215  double ribZ1 = zgap - safety;
216  double ribX1 = RibConnection-250.*Gaudi::Units::mm;
217  double posX1 = 250.*Gaudi::Units::mm+ribX1/2.;
218 
219  double ribY2 = 30.0*Gaudi::Units::mm;
220  double ribZ2 = zgap - safety;
221  double ribX2 = maxRofEP - RibConnection;
222  double posX2 = RibConnection+ribX2/2.;
223 
224  ribY1 = (*ribs)[0]->getDouble("LONGWID1")*Gaudi::Units::mm;
225  ribZ1 = zgap - safety;
226  ribX1 = RibConnection - (*ribs)[0]->getDouble("LONGLENG1")*Gaudi::Units::mm; // LONGLENG1 is a RMIN of ribs
227  posX1 = (*ribs)[0]->getDouble("LONGLENG1")*Gaudi::Units::mm + ribX1/2.; // It's determined by Pixel volume -> so 250.0!!!
228 
229  ribY2 = (*ribs)[0]->getDouble("LONGWID2")*Gaudi::Units::mm;
230  ribZ2 = zgap - safety;
231  ribX2 = maxRofEP - RibConnection;
232  posX2 = RibConnection+ribX2/2.;
233 
234 
235 
236  const GeoBox* ribLong1 = new GeoBox(ribX1/2. , ribY1/2., ribZ1/2.);
237  const GeoBox* ribLong2 = new GeoBox(ribX2/2.-safety, ribY2/2., ribZ2/2.);
238 
239  const GeoLogVol* ribLong1Log = new GeoLogVol("LongRib1",ribLong1,shellMat);
240  const GeoLogVol* ribLong2Log = new GeoLogVol("LongRib2",ribLong2,shellMat);
241  GeoVPhysVol* ribLong1Phys = new GeoPhysVol(ribLong1Log);
242  GeoVPhysVol* ribLong2Phys = new GeoPhysVol(ribLong2Log);
243 
244 
245  for (int ip=0; ip<4; ip++){
246  double angl= ip*M_PI/2.;
247 // 1st part
248  GeoTrf::Vector3D ribpos_pos1( posX1*cos(angl), posX1*sin(angl), zposEP+zleng+thickShell+zgap/2.);
249  GeoTrf::Vector3D ribpos_neg1( posX1*cos(angl), posX1*sin(angl),-zposEP-zleng-thickShell-zgap/2.);
250  xrib = new GeoTransform(GeoTrf::GeoTransformRT(GeoTrf::GeoRotation(angl,0,0),ribpos_pos1));
251  mother->add(xrib);
252  mother->add(ribLong1Phys);
253  xrib = new GeoTransform(GeoTrf::GeoTransformRT(GeoTrf::GeoRotation(angl,0,0),ribpos_neg1));
254  mother->add(xrib);
255  mother->add(ribLong1Phys);
256 // 2nd part
257  GeoTrf::Vector3D ribpos_pos2( posX2*cos(angl), posX2*sin(angl), zposEP+zleng+thickShell+zgap/2.);
258  GeoTrf::Vector3D ribpos_neg2( posX2*cos(angl), posX2*sin(angl),-zposEP-zleng-thickShell-zgap/2.);
259  xrib = new GeoTransform(GeoTrf::GeoTransformRT(GeoTrf::GeoRotation(angl,0,0),ribpos_pos2));
260  mother->add(xrib);
261  mother->add(ribLong2Phys);
262  xrib = new GeoTransform(GeoTrf::GeoTransformRT(GeoTrf::GeoRotation(angl,0,0),ribpos_neg2));
263  mother->add(xrib);
264  mother->add(ribLong2Phys);
265  }
266 }
267 
268 
IRDBAccessSvc::getRecordsetPtr
virtual IRDBRecordset_ptr getRecordsetPtr(const std::string &node, const std::string &tag, const std::string &tag2node="", const std::string &connName="ATLASDD")=0
Provides access to the Recordset object containing HVS-tagged data.
subproc.shell
shell
Definition: subproc.py:29
EndPlateFactory.h
InDetDD::AthenaComps
Class to hold various Athena components.
Definition: InDetDDAthenaComps.h:21
M_PI
#define M_PI
Definition: ActiveFraction.h:11
beamspotman.posX
posX
Definition: beamspotman.py:1624
DecodeVersionKey::node
const std::string & node() const
Return the version node.
Definition: DecodeVersionKey.cxx:97
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
GeoPrimitives.h
IRDBAccessSvc.h
Definition of the abstract IRDBAccessSvc interface.
DecodeVersionKey
This is a helper class to query the version tags from GeoModelSvc and determine the appropriate tag a...
Definition: DecodeVersionKey.h:18
DecodeVersionKey::tag
const std::string & tag() const
Return version tag.
Definition: DecodeVersionKey.cxx:91
EndPlateFactory::EndPlateFactory
EndPlateFactory(InDetDD::AthenaComps *athenaComps, InDetMaterialManager *matManager)
Definition: EndPlateFactory.cxx:33
find_tgc_unfilled_channelids.ip
ip
Definition: find_tgc_unfilled_channelids.py:3
InDetDD::SubDetectorFactoryBase::rdbAccessSvc
IRDBAccessSvc * rdbAccessSvc()
Definition: InDetSubDetectorFactoryBase.h:43
EndPlateFactory::create
void create(GeoPhysVol *mother)
Definition: EndPlateFactory.cxx:46
IRDBRecordset_ptr
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
Definition: IRDBAccessSvc.h:25
EndPlateFactory::~EndPlateFactory
~EndPlateFactory()
Definition: EndPlateFactory.cxx:39
InDetMaterialManager
InDetMaterialManager.
Definition: InDetMaterialManager.h:34
InDetMaterialManager.h
InDetDD::SubDetectorFactoryBase::geoDbTagSvc
const IGeoDbTagSvc * geoDbTagSvc() const
Definition: InDetSubDetectorFactoryBase.h:41
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
DecodeVersionKey.h
python.SystemOfUnits.mm
int mm
Definition: SystemOfUnits.py:83
IRDBRecord.h
Definition of the abstract IRDBRecord interface.
InDetDD
Message Stream Member.
Definition: FakeTrackBuilder.h:8
InDetDD::SubDetectorFactoryBase::materialManager
InDetMaterialManager * materialManager()
Definition: InDetSubDetectorFactoryBase.h:47
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
IRDBRecordset.h
Definition of the abstract IRDBRecordset interface.
InDetMaterialManager::getMaterial
const GeoMaterial * getMaterial(const std::string &materialName)
Get material. First looks for locally defined material and if not found looks in GeoModel material ma...
Definition: InDetMaterialManager.cxx:96
checker_macros.h
Define macros for attributes used to control the static checker.
IGeoDbTagSvc.h