ATLAS Offline Software
GeoPixelIFlexServices.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 
6 // Build detailed stave support : face plate + carbon foam + cable flex + cooling pipe + end blocks
7 // This is built one time per layer.
8 
10 
11 #include "GeoModelKernel/GeoBox.h"
12 #include "GeoModelKernel/GeoTube.h"
13 #include "GeoModelKernel/GeoSimplePolygonBrep.h"
14 #include "GeoModelKernel/GeoLogVol.h"
15 #include "GeoModelKernel/GeoPhysVol.h"
16 #include "GeoModelKernel/GeoMaterial.h"
17 #include "GeoModelKernel/GeoNameTag.h"
18 
19 #include "GeoModelKernel/GeoTransform.h"
20 #include "GaudiKernel/SystemOfUnits.h"
21 
22 #include <algorithm>
23 #include <utility>
24 using std::max;
25 
28  GeoModelIO::ReadGeoModel* sqliteReader,
29  std::shared_ptr<std::map<std::string, GeoFullPhysVol*>> mapFPV,
30  std::shared_ptr<std::map<std::string, GeoAlignableTransform*>> mapAX,
31  int iSection)
32  : GeoVPixelFactory(ddmgr, mgr, sqliteReader, std::move(mapFPV), std::move(mapAX)),
33  m_section(iSection),
34  m_supportPhysA(nullptr),
35  m_supportPhysC(nullptr),
36  m_xformSupportA(nullptr),
37  m_xformSupportC(nullptr)
38 {
39 }
40 
42 {
43 
44  m_gmt_mgr->msg(MSG::INFO) <<"Build IBL I-Flex services"<<endmsg;
45 
46  double safety = 0.01*Gaudi::Units::mm;
47 
48  // IBL layer shift ( 2mm shift issue )
49  double layerZshift = m_gmt_mgr->PixelLayerGlobalShift();
50 
51  double barrelZmax = m_gmt_mgr->PixelBarrelHalfLength();
52  int nSectors = m_gmt_mgr->NPixelSectors();
53 
54  // check if sectors are properly defined
55  if(nSectors==0) return nullptr;
56  double angle=360./(double)nSectors*Gaudi::Units::deg;
57 
58  double zmin=0., zmax=0.;
59  double deltaLength = 0.;
60  if(m_section==0) {
62  zmax=barrelZmax-0.001;
63  deltaLength=layerZshift;
64  }
65  else if(m_section==1) {
66  zmin = barrelZmax+0.001;
68  deltaLength=-layerZshift;
69  }
70  else if(m_section==2) {
73  }
74  else if(m_section==3) {
77  }
78 
79  double zStartPosA = zmin+layerZshift;
80  double zStartPosC = -zmax+layerZshift;
81  // Caution : section 0 is in thebarrel volume that is already globally shifted
82  if(m_section==0){
83  zStartPosC=-zmax;
84  }
85  if(m_section==1) zStartPosA=zmin;
86 
87  double innerRadius = m_gmt_mgr->IBLServiceGetMaxRadialPosition("IPT","simple",zmin,zmax)+safety;
88  double outerRadius = m_gmt_mgr->IBLServiceGetMinRadialPosition("IST","simple",zmin,zmax)-safety;
89  double phiOfModuleZero = m_gmt_mgr->PhiOfModuleZero();
90  double layerRadius = m_gmt_mgr->PixelLayerRadius();
91 
92  double halfLengthA = (zmax-zmin)*0.5-deltaLength*.5;
93  double halfLengthC = (zmax-zmin)*0.5+deltaLength*.5;
94 
95  // Define IFlex section for side A and C
96  std::ostringstream lnameA;
97  lnameA<<"Brl0A_FlexRingPP0_S"<<m_section;
98  std::ostringstream lnameC;
99  lnameC<<"Brl0C_FlexRingPP0_S"<<m_section;
100 
101  // Define IFlex section for side A
102  const GeoTube* supportShapeA = new GeoTube(innerRadius,outerRadius,halfLengthA);
103  const GeoTube* supportShapeC = new GeoTube(innerRadius,outerRadius,halfLengthC);
104  const GeoMaterial* ether = m_mat_mgr->getMaterial("special::Ether");
105 // GeoLogVol* supportLogVol_A = new GeoLogVol("Brl0A_FlexRingPP0",supportShapeA,ether);
106 // GeoLogVol* supportLogVol_C = new GeoLogVol("Brl0C_FlexRingPP0",supportShapeC,ether);
107  GeoLogVol* supportLogVol_A = new GeoLogVol(lnameA.str(),supportShapeA,ether);
108  GeoLogVol* supportLogVol_C = new GeoLogVol(lnameC.str(),supportShapeC,ether);
109 
110  m_supportPhysA = new GeoPhysVol(supportLogVol_A);
111  m_supportPhysC = new GeoPhysVol(supportLogVol_C);
112 
113 
114  // -------------- Creation du cooling pipe
115 
116  double cooling_radius = 35.1;
117  double TubeOuterDiam = m_gmt_mgr->IBLStaveTubeOuterDiameter();
118  double TubeInnerDiam = m_gmt_mgr->IBLStaveTubeInnerDiameter();
119  double cooling_angle = -2.154*Gaudi::Units::deg;
120 
121  if(m_gmt_mgr->PixelStaveAxe()==1)
122  {
123  cooling_radius = 34.7 + layerRadius-33.25;
124  cooling_angle = -.1*Gaudi::Units::deg;
125  }
126 
127  const GeoTube* service_coolingPipeA = new GeoTube(0.0,TubeOuterDiam*0.5,halfLengthA);
128  const GeoTube* service_coolingPipeC = new GeoTube(0.0,TubeOuterDiam*0.5,halfLengthC);
129 
130  const GeoMaterial* cp_service_material = m_mat_mgr->getMaterial("pix::CoolingPipe_IBL");
131  GeoLogVol * cp_service_logA = new GeoLogVol("PP0CoolingPipe",service_coolingPipeA,cp_service_material);
132  GeoLogVol * cp_service_logC = new GeoLogVol("PP0CoolingPipe",service_coolingPipeC,cp_service_material);
133  GeoPhysVol* cpPhysVolA = new GeoPhysVol(cp_service_logA);
134  GeoPhysVol* cpPhysVolC = new GeoPhysVol(cp_service_logC);
135 
136  const GeoTube* service_coolingPipeInnerA = new GeoTube(0.0,TubeInnerDiam*0.5,halfLengthA);
137  const GeoTube* service_coolingPipeInnerC = new GeoTube(0.0,TubeInnerDiam*0.5,halfLengthC);
138  const GeoMaterial* cp_service_inner_material = m_mat_mgr->getMaterial(m_gmt_mgr->getMaterialName("CoolingFluid",0,0));
139  GeoLogVol * cp_service_inner_logA = new GeoLogVol("PP0CoolingPipeInner",service_coolingPipeInnerA,cp_service_inner_material);
140  GeoLogVol * cp_service_inner_logC = new GeoLogVol("PP0CoolingPipeInner",service_coolingPipeInnerC,cp_service_inner_material);
141  GeoPhysVol * cp_service_inner_logPVA = new GeoPhysVol(cp_service_inner_logA);
142  GeoPhysVol * cp_service_inner_logPVC = new GeoPhysVol(cp_service_inner_logC);
143 
144  GeoNameTag* cp_service_inner_tag = new GeoNameTag("PP0CoolingPipeInner");
145  GeoTransform* cp_service_inner_xform = new GeoTransform(GeoTrf::Transform3D::Identity());
146  cpPhysVolA->add(cp_service_inner_tag);
147  cpPhysVolA->add(cp_service_inner_xform);
148  cpPhysVolA->add(cp_service_inner_logPVA);
149  cpPhysVolC->add(cp_service_inner_tag);
150  cpPhysVolC->add(cp_service_inner_xform);
151  cpPhysVolC->add(cp_service_inner_logPVC);
152 
153  GeoLogVol* flex_logVolA = nullptr;
154  GeoLogVol* flex_logVolC = nullptr;
155 
156  double flex_angle = -15.001*Gaudi::Units::deg;
157  if(m_gmt_mgr->PixelStaveAxe()==1)
158  flex_angle += 2.14*Gaudi::Units::deg;
159 
160  double flex_rot=0.30265;
161  flex_rot=-0.30265*.5;
162  double flex_rmin=0, flex_rmax=0;
163  double flexYmidPos=0;
164  double flex_width = m_gmt_mgr->IBLStaveFlexWidth();
165 
166  if(m_section!=2){
167 
168  // -------------- Creation du flex (GeoBox)
169 
170  int secIdx=(m_section==3)?3:1;
171  flex_rmin = m_gmt_mgr->IBLFlexPP0Rmin(secIdx);
172  flex_rmax = m_gmt_mgr->IBLFlexPP0Rmax(secIdx);
173 
174  std::string flexMatName="noFlexMatDefined";
175  if(m_section==0)
176  flexMatName = m_gmt_mgr->IBLFlexMaterial(2,"doglegA");
177  else if(m_section==1)
178  flexMatName = m_gmt_mgr->IBLFlexMaterial(3,"doglegA");
179  else if(m_section==3)
180  flexMatName = m_gmt_mgr->IBLFlexMaterial(1,"PP0FlexA");
181 
182  GeoBox * flex_shapeA = new GeoBox((flex_rmax-flex_rmin)*.5, flex_width*.5, halfLengthA);
183  GeoBox * flex_shapeC = new GeoBox((flex_rmax-flex_rmin)*.5, flex_width*.5, halfLengthC);
184  const GeoMaterial* flex_material = m_mat_mgr->getMaterial(flexMatName);
185  if(flex_material==nullptr)
186  {
187  m_gmt_mgr->msg(MSG::ERROR)<<"-> error while reading material "<<flexMatName<<__FILE__<< ":"<< __LINE__<<endmsg;
188  std::abort();
189  } else{
190  flex_logVolA = new GeoLogVol("Flex",flex_shapeA,flex_material);
191  flex_logVolC = new GeoLogVol("Flex",flex_shapeC,flex_material);
192  }
193  }
194  else {
195 
196  // -------------- Creation du flex (GeoSimplePolygonBRep)
197 
198  unsigned int nbFlexPoint=59;
199  double xFlex[59]={-18.029,-15.546,-14.108,-12.832,-12.530,-11.770,-10.522,-9.285,-7.727,-6.132,-4.856,-3.906,-3.183,-1.643,-0.371,1.163,2.590,3.591,4.489,4.933,5.691,6.912,8.018,9.560,10.830,11.159,12.048,12.768,13.982,15.317,18.029,18.029,15.191,13.449,12.742,11.838,10.729,9.181,7.643,6.087,4.643,3.877,3.027,1.953,1.480,-0.071,-1.925,-3.102,-3.864,-5.065,-6.524,-7.999,-9.447,-10.867,-12.305,-13.289,-13.816,-15.377,-18.029};
200  double yFlex[59]={32.768,32.749,32.997,34.143,34.552,35.888,36.844,37.204,37.260,36.858,35.875,34.396,32.984,31.517,31.110,31.364,32.348,33.602,35.204,36.151,37.422,38.466,38.761,38.453,37.521,37.182,35.860,34.828,33.877,33.653,33.668,34.589,34.566,35.449,36.501,37.805,38.814,39.571,39.665,39.034,37.597,36.057,34.440,33.014,32.612,32.021,32.858,34.847,36.074,37.383,37.962,38.205,38.111,37.698,36.831,35.075,34.406,33.655,33.689};
201 
202  flexYmidPos=(yFlex[0]+yFlex[nbFlexPoint-1])*.5;
203 
204  std::vector<double> xShape, yShape;
205  xShape.clear(); yShape.clear();
206  GeoSimplePolygonBrep* Iflex_shape = new GeoSimplePolygonBrep(flex_width*0.5);
207  for(unsigned int iPt=0; iPt<nbFlexPoint; iPt++) Iflex_shape->addVertex(xFlex[iPt],yFlex[iPt]-flexYmidPos);
208 
209  std::string IflexMatName = m_gmt_mgr->IBLFlexMaterial(1, "IFlexA");
210  m_gmt_mgr->msg(MSG::DEBUG)<<"IFlex material : "<<m_section<<" "<<IflexMatName<<endmsg;
211  const GeoMaterial* Iflex_material = m_mat_mgr->getMaterial(IflexMatName);
212 
213  if(Iflex_material==nullptr)
214  {
215  m_gmt_mgr->msg(MSG::ERROR)<<"-> error while reading material "<<IflexMatName<<__FILE__<< ":"<< __LINE__<<endmsg;
216  std::abort();
217  } else{
218  flex_logVolA = new GeoLogVol("IFlex",Iflex_shape,Iflex_material);
219  flex_logVolC = new GeoLogVol("IFlex",Iflex_shape,Iflex_material);
220  }
221  }
222 
223  GeoPhysVol * flexPhysVolA = new GeoPhysVol(flex_logVolA);
224  GeoPhysVol * flexPhysVolC = new GeoPhysVol(flex_logVolC);
225 
226  // Loop over sectors
227  for(int ii = 0; ii < nSectors; ii++) {
228 
229  m_gmt_mgr->SetPhi(ii);
230 
231  // cooling transform
232  double phiOfCooling = phiOfModuleZero+ cooling_angle + ii*angle;
233  std::ostringstream tmp1;
234  tmp1 << "fl" << ii;
235  GeoNameTag * tag1 = new GeoNameTag(tmp1.str());
236  GeoTransform* xform1 = new GeoTransform(GeoTrf::RotateZ3D(phiOfCooling)*GeoTrf::TranslateX3D(cooling_radius));
237  m_supportPhysA->add(tag1);
238  m_supportPhysA->add(xform1);
239  m_supportPhysA->add(cpPhysVolA);
240 
241  m_supportPhysC->add(tag1);
242  m_supportPhysC->add(xform1);
243  m_supportPhysC->add(cpPhysVolC);
244 
245 
246  // flex transform
247  double phiOfFlex = phiOfModuleZero+ flex_angle + ii*angle;
248  std::ostringstream tmp2;
249  tmp2 << "fl" << ii;
250  GeoNameTag * tag2 = new GeoNameTag(tmp2.str());
251 
252  if(m_section==2){
253 
254  // Intermediate flex
255  GeoTransform* xformA2 = new GeoTransform(GeoTrf::RotateZ3D(phiOfFlex)*GeoTrf::TranslateX3D(flexYmidPos)*GeoTrf::RotateZ3D(-90.*Gaudi::Units::deg)*GeoTrf::RotateY3D(-90.*Gaudi::Units::deg)*GeoTrf::RotateX3D(flex_rot));
256  m_supportPhysA->add(tag2);
257  m_supportPhysA->add(xformA2);
258  m_supportPhysA->add(flexPhysVolA);
259 
260  GeoTransform* xformC2 = new GeoTransform(GeoTrf::RotateZ3D(phiOfFlex)*GeoTrf::TranslateX3D(flexYmidPos)*GeoTrf::RotateZ3D(-90.*Gaudi::Units::deg)*GeoTrf::RotateY3D(90.*Gaudi::Units::deg)*GeoTrf::RotateX3D(-flex_rot));
261  m_supportPhysC->add(tag2);
262  m_supportPhysC->add(xformC2);
263  m_supportPhysC->add(flexPhysVolC);
264 
265  }
266  else {
267 
268  // dogleg and PP0 flexes
269 
270  GeoTransform* xform2 = new GeoTransform(GeoTrf::RotateZ3D(phiOfFlex)*GeoTrf::TranslateX3D((flex_rmin+flex_rmax)*.5)*GeoTrf::RotateZ3D(flex_rot));
271 
272  m_supportPhysA->add(tag2);
273  m_supportPhysA->add(xform2);
274  m_supportPhysA->add(flexPhysVolA);
275 
276  m_supportPhysC->add(tag2);
277  m_supportPhysC->add(xform2);
278  m_supportPhysC->add(flexPhysVolC);
279  }
280 
281 
282  }
283 
284  double middleA = zStartPosA+halfLengthA;
285  double middleC = zStartPosC+halfLengthC;
286 
287  GeoTrf::Transform3D supportTrfA = GeoTrf::TranslateZ3D(middleA); //(zmin+zmax)*0.5+layerZshift);
288  m_xformSupportA = new GeoTransform(supportTrfA);
289 
290  // std::cout<<"Section final A "<<m_section<<" - "<<middleA-halfLengthA<<" "<<middleA+halfLengthA<<" "<<middleA<<std::endl;
291 
292  GeoTrf::Transform3D supportTrfC = GeoTrf::TranslateZ3D(middleC); //(zmin+zmax)*0.5+layerZshift);
293  m_xformSupportC = new GeoTransform(supportTrfC);
294 
295  // std::cout<<"Section final C "<<m_section<<" - "<<middleC-halfLengthC<<" "<<middleC+halfLengthC<<" "<<middleC<<std::endl;
296  // std::cout<<"Section ---"<<std::endl;
297 
298  return nullptr;
299 }
PixelGeometryManager::PixelLayerGlobalShift
virtual double PixelLayerGlobalShift()=0
DeMoUpdate.tmp2
string tmp2
Definition: DeMoUpdate.py:1168
PixelGeometryManager
Definition: PixelGeometryManager.h:28
PixelGeometryManager::msg
MsgStream & msg(MSG::Level lvl) const
Definition: PixelGeometryManager.h:611
PixelAthClusterMonAlgCfg.zmin
zmin
Definition: PixelAthClusterMonAlgCfg.py:169
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
deg
#define deg
Definition: SbPolyhedron.cxx:17
GeoPixelIFlexServices::m_supportPhysC
GeoPhysVol * m_supportPhysC
Definition: GeoPixelIFlexServices.h:38
PixelGeometryManager::IBLFlexPP0Rmin
virtual double IBLFlexPP0Rmin(int iPos)=0
GeoPixelIFlexServices::m_xformSupportC
GeoTransform * m_xformSupportC
Definition: GeoPixelIFlexServices.h:40
GeoVPixelFactory::m_gmt_mgr
PixelGeometryManager * m_gmt_mgr
Definition: GeoVPixelFactory.h:43
PixelGeometryManager::NPixelSectors
virtual int NPixelSectors()=0
BchCleanup.mgr
mgr
Definition: BchCleanup.py:294
PixelGeometryManager::IBLFlexPP0Rmax
virtual double IBLFlexPP0Rmax(int iPos)=0
PixelGeometryManager::IBLServiceGetMaxRadialPosition
virtual double IBLServiceGetMaxRadialPosition(const std::string &srvName, const std::string &srvType, double srvZmin, double srvZmax)=0
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
plotBeamSpotCompare.tag1
string tag1
Definition: plotBeamSpotCompare.py:75
angle
double angle(const GeoTrf::Vector2D &a, const GeoTrf::Vector2D &b)
Definition: TRTDetectorFactory_Full.cxx:73
GeoPixelIFlexServices::GeoPixelIFlexServices
GeoPixelIFlexServices(InDetDD::PixelDetectorManager *ddmgr, PixelGeometryManager *mgr, GeoModelIO::ReadGeoModel *sqliteReader, std::shared_ptr< std::map< std::string, GeoFullPhysVol * >> mapFPV, std::shared_ptr< std::map< std::string, GeoAlignableTransform * >> mapAX, int iSection)
Definition: GeoPixelIFlexServices.cxx:26
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
PixelGeometryManager::SetPhi
virtual void SetPhi(int phi)=0
PixelAthClusterMonAlgCfg.zmax
zmax
Definition: PixelAthClusterMonAlgCfg.py:169
plotBeamSpotCompare.tag2
string tag2
Definition: plotBeamSpotCompare.py:76
PixelGeometryManager::IBLStaveTubeInnerDiameter
virtual double IBLStaveTubeInnerDiameter()=0
xAOD::double
double
Definition: CompositeParticle_v1.cxx:159
PixelGeometryManager::PixelBarrelHalfLength
virtual double PixelBarrelHalfLength()=0
GeoPixelIFlexServices::m_xformSupportA
GeoTransform * m_xformSupportA
Definition: GeoPixelIFlexServices.h:39
InDetDD::PixelDetectorManager
Definition: PixelDetectorManager.h:47
GeoVPixelFactory::m_mat_mgr
InDetMaterialManager * m_mat_mgr
Definition: GeoVPixelFactory.h:44
PixelGeometryManager::PixelStaveAxe
virtual int PixelStaveAxe()=0
python.SystemOfUnits.mm
int mm
Definition: SystemOfUnits.py:83
GeoPixelIFlexServices::Build
virtual GeoVPhysVol * Build() override
Definition: GeoPixelIFlexServices.cxx:41
PixelGeometryManager::PhiOfModuleZero
virtual double PhiOfModuleZero()=0
DEBUG
#define DEBUG
Definition: page_access.h:11
PixelGeometryManager::PixelLayerRadius
virtual double PixelLayerRadius()=0
GeoPixelIFlexServices::m_supportPhysA
GeoPhysVol * m_supportPhysA
Definition: GeoPixelIFlexServices.h:37
GeoPixelIFlexServices::m_section
double m_section
Definition: GeoPixelIFlexServices.h:36
GeoVPixelFactory
This is the base class for all the pieces of the Pixel detector.
Definition: GeoVPixelFactory.h:31
PixelGeometryManager::IBLStaveTubeOuterDiameter
virtual double IBLStaveTubeOuterDiameter()=0
PixelGeometryManager::IBLServiceGetMinRadialPosition
virtual double IBLServiceGetMinRadialPosition(const std::string &srvName, const std::string &srvType, double srvZmin, double srvZmax)=0
PixelGeometryManager::getMaterialName
virtual std::string getMaterialName(const std::string &volumeName, int layerdisk=0, int typenum=0)=0
GeoPixelIFlexServices.h
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
PixelGeometryManager::IBLFlexMaterial
virtual std::string IBLFlexMaterial(int iPos, const std::string &flexType)=0
PixelGeometryManager::IBLFlexPP0Z
virtual double IBLFlexPP0Z(int iPos)=0
PixelGeometryManager::IBLStaveFlexWidth
virtual double IBLStaveFlexWidth()=0