ATLAS Offline Software
GeoPixelIFlexServices.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 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 using std::max;
24 
27  GeoModelIO::ReadGeoModel* sqliteReader,
28  std::shared_ptr<std::map<std::string, GeoFullPhysVol*>> mapFPV,
29  std::shared_ptr<std::map<std::string, GeoAlignableTransform*>> mapAX,
30  int iSection)
31  : GeoVPixelFactory(ddmgr, mgr, sqliteReader, mapFPV, mapAX),
32  m_section(iSection),
33  m_supportPhysA(nullptr),
34  m_supportPhysC(nullptr),
35  m_xformSupportA(nullptr),
36  m_xformSupportC(nullptr)
37 {
38 }
39 
41 {
42 
43  m_gmt_mgr->msg(MSG::INFO) <<"Build IBL I-Flex services"<<endmsg;
44 
45  double safety = 0.01*Gaudi::Units::mm;
46 
47  // IBL layer shift ( 2mm shift issue )
48  double layerZshift = m_gmt_mgr->PixelLayerGlobalShift();
49 
50  double barrelZmax = m_gmt_mgr->PixelBarrelHalfLength();
51  int nSectors = m_gmt_mgr->NPixelSectors();
52 
53  // check if sectors are properly defined
54  if(nSectors==0) return nullptr;
55  double angle=360./(double)nSectors*Gaudi::Units::deg;
56 
57  double zmin=0., zmax=0.;
58  double deltaLength = 0.;
59  if(m_section==0) {
61  zmax=barrelZmax-0.001;
62  deltaLength=layerZshift;
63  }
64  else if(m_section==1) {
65  zmin = barrelZmax+0.001;
67  deltaLength=-layerZshift;
68  }
69  else if(m_section==2) {
72  }
73  else if(m_section==3) {
76  }
77 
78  double zStartPosA = zmin+layerZshift;
79  double zStartPosC = -zmax+layerZshift;
80  // Caution : section 0 is in thebarrel volume that is already globally shifted
81  if(m_section==0){
82  zStartPosC=-zmax;
83  }
84  if(m_section==1) zStartPosA=zmin;
85 
86  double innerRadius = m_gmt_mgr->IBLServiceGetMaxRadialPosition("IPT","simple",zmin,zmax)+safety;
87  double outerRadius = m_gmt_mgr->IBLServiceGetMinRadialPosition("IST","simple",zmin,zmax)-safety;
88  double phiOfModuleZero = m_gmt_mgr->PhiOfModuleZero();
89  double layerRadius = m_gmt_mgr->PixelLayerRadius();
90 
91  double halfLengthA = (zmax-zmin)*0.5-deltaLength*.5;
92  double halfLengthC = (zmax-zmin)*0.5+deltaLength*.5;
93 
94  // Define IFlex section for side A and C
95  std::ostringstream lnameA;
96  lnameA<<"Brl0A_FlexRingPP0_S"<<m_section;
97  std::ostringstream lnameC;
98  lnameC<<"Brl0C_FlexRingPP0_S"<<m_section;
99 
100  // Define IFlex section for side A
101  const GeoTube* supportShapeA = new GeoTube(innerRadius,outerRadius,halfLengthA);
102  const GeoTube* supportShapeC = new GeoTube(innerRadius,outerRadius,halfLengthC);
103  const GeoMaterial* ether = m_mat_mgr->getMaterial("special::Ether");
104 // GeoLogVol* supportLogVol_A = new GeoLogVol("Brl0A_FlexRingPP0",supportShapeA,ether);
105 // GeoLogVol* supportLogVol_C = new GeoLogVol("Brl0C_FlexRingPP0",supportShapeC,ether);
106  GeoLogVol* supportLogVol_A = new GeoLogVol(lnameA.str(),supportShapeA,ether);
107  GeoLogVol* supportLogVol_C = new GeoLogVol(lnameC.str(),supportShapeC,ether);
108 
109  m_supportPhysA = new GeoPhysVol(supportLogVol_A);
110  m_supportPhysC = new GeoPhysVol(supportLogVol_C);
111 
112 
113  // -------------- Creation du cooling pipe
114 
115  double cooling_radius = 35.1;
116  double TubeOuterDiam = m_gmt_mgr->IBLStaveTubeOuterDiameter();
117  double TubeInnerDiam = m_gmt_mgr->IBLStaveTubeInnerDiameter();
118  double cooling_angle = -2.154*Gaudi::Units::deg;
119 
120  if(m_gmt_mgr->PixelStaveAxe()==1)
121  {
122  cooling_radius = 34.7 + layerRadius-33.25;
123  cooling_angle = -.1*Gaudi::Units::deg;
124  }
125 
126  const GeoTube* service_coolingPipeA = new GeoTube(0.0,TubeOuterDiam*0.5,halfLengthA);
127  const GeoTube* service_coolingPipeC = new GeoTube(0.0,TubeOuterDiam*0.5,halfLengthC);
128 
129  const GeoMaterial* cp_service_material = m_mat_mgr->getMaterial("pix::CoolingPipe_IBL");
130  GeoLogVol * cp_service_logA = new GeoLogVol("PP0CoolingPipe",service_coolingPipeA,cp_service_material);
131  GeoLogVol * cp_service_logC = new GeoLogVol("PP0CoolingPipe",service_coolingPipeC,cp_service_material);
132  GeoPhysVol* cpPhysVolA = new GeoPhysVol(cp_service_logA);
133  GeoPhysVol* cpPhysVolC = new GeoPhysVol(cp_service_logC);
134 
135  const GeoTube* service_coolingPipeInnerA = new GeoTube(0.0,TubeInnerDiam*0.5,halfLengthA);
136  const GeoTube* service_coolingPipeInnerC = new GeoTube(0.0,TubeInnerDiam*0.5,halfLengthC);
137  const GeoMaterial* cp_service_inner_material = m_mat_mgr->getMaterial(m_gmt_mgr->getMaterialName("CoolingFluid",0,0));
138  GeoLogVol * cp_service_inner_logA = new GeoLogVol("PP0CoolingPipeInner",service_coolingPipeInnerA,cp_service_inner_material);
139  GeoLogVol * cp_service_inner_logC = new GeoLogVol("PP0CoolingPipeInner",service_coolingPipeInnerC,cp_service_inner_material);
140  GeoPhysVol * cp_service_inner_logPVA = new GeoPhysVol(cp_service_inner_logA);
141  GeoPhysVol * cp_service_inner_logPVC = new GeoPhysVol(cp_service_inner_logC);
142 
143  GeoNameTag* cp_service_inner_tag = new GeoNameTag("PP0CoolingPipeInner");
144  GeoTransform* cp_service_inner_xform = new GeoTransform(GeoTrf::Transform3D::Identity());
145  cpPhysVolA->add(cp_service_inner_tag);
146  cpPhysVolA->add(cp_service_inner_xform);
147  cpPhysVolA->add(cp_service_inner_logPVA);
148  cpPhysVolC->add(cp_service_inner_tag);
149  cpPhysVolC->add(cp_service_inner_xform);
150  cpPhysVolC->add(cp_service_inner_logPVC);
151 
152  GeoLogVol* flex_logVolA = nullptr;
153  GeoLogVol* flex_logVolC = nullptr;
154 
155  double flex_angle = -15.001*Gaudi::Units::deg;
156  if(m_gmt_mgr->PixelStaveAxe()==1)
157  flex_angle += 2.14*Gaudi::Units::deg;
158 
159  double flex_rot=0.30265;
160  flex_rot=-0.30265*.5;
161  double flex_rmin=0, flex_rmax=0;
162  double flexYmidPos=0;
163  double flex_width = m_gmt_mgr->IBLStaveFlexWidth();
164 
165  if(m_section!=2){
166 
167  // -------------- Creation du flex (GeoBox)
168 
169  int secIdx=(m_section==3)?3:1;
170  flex_rmin = m_gmt_mgr->IBLFlexPP0Rmin(secIdx);
171  flex_rmax = m_gmt_mgr->IBLFlexPP0Rmax(secIdx);
172 
173  std::string flexMatName="noFlexMatDefined";
174  if(m_section==0)
175  flexMatName = m_gmt_mgr->IBLFlexMaterial(2,"doglegA");
176  else if(m_section==1)
177  flexMatName = m_gmt_mgr->IBLFlexMaterial(3,"doglegA");
178  else if(m_section==3)
179  flexMatName = m_gmt_mgr->IBLFlexMaterial(1,"PP0FlexA");
180 
181  GeoBox * flex_shapeA = new GeoBox((flex_rmax-flex_rmin)*.5, flex_width*.5, halfLengthA);
182  GeoBox * flex_shapeC = new GeoBox((flex_rmax-flex_rmin)*.5, flex_width*.5, halfLengthC);
183  const GeoMaterial* flex_material = m_mat_mgr->getMaterial(flexMatName);
184  if(flex_material==nullptr)
185  {
186  m_gmt_mgr->msg(MSG::ERROR)<<"-> error while reading material "<<flexMatName<<__FILE__<< ":"<< __LINE__<<endmsg;
187  std::abort();
188  } else{
189  flex_logVolA = new GeoLogVol("Flex",flex_shapeA,flex_material);
190  flex_logVolC = new GeoLogVol("Flex",flex_shapeC,flex_material);
191  }
192  }
193  else {
194 
195  // -------------- Creation du flex (GeoSimplePolygonBRep)
196 
197  unsigned int nbFlexPoint=59;
198  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};
199  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};
200 
201  flexYmidPos=(yFlex[0]+yFlex[nbFlexPoint-1])*.5;
202 
203  std::vector<double> xShape, yShape;
204  xShape.clear(); yShape.clear();
205  GeoSimplePolygonBrep* Iflex_shape = new GeoSimplePolygonBrep(flex_width*0.5);
206  for(unsigned int iPt=0; iPt<nbFlexPoint; iPt++) Iflex_shape->addVertex(xFlex[iPt],yFlex[iPt]-flexYmidPos);
207 
208  std::string IflexMatName = m_gmt_mgr->IBLFlexMaterial(1, "IFlexA");
209  m_gmt_mgr->msg(MSG::DEBUG)<<"IFlex material : "<<m_section<<" "<<IflexMatName<<endmsg;
210  const GeoMaterial* Iflex_material = m_mat_mgr->getMaterial(IflexMatName);
211 
212  if(Iflex_material==nullptr)
213  {
214  m_gmt_mgr->msg(MSG::ERROR)<<"-> error while reading material "<<IflexMatName<<__FILE__<< ":"<< __LINE__<<endmsg;
215  std::abort();
216  } else{
217  flex_logVolA = new GeoLogVol("IFlex",Iflex_shape,Iflex_material);
218  flex_logVolC = new GeoLogVol("IFlex",Iflex_shape,Iflex_material);
219  }
220  }
221 
222  GeoPhysVol * flexPhysVolA = new GeoPhysVol(flex_logVolA);
223  GeoPhysVol * flexPhysVolC = new GeoPhysVol(flex_logVolC);
224 
225  // Loop over sectors
226  for(int ii = 0; ii < nSectors; ii++) {
227 
228  m_gmt_mgr->SetPhi(ii);
229 
230  // cooling transform
231  double phiOfCooling = phiOfModuleZero+ cooling_angle + ii*angle;
232  std::ostringstream tmp1;
233  tmp1 << "fl" << ii;
234  GeoNameTag * tag1 = new GeoNameTag(tmp1.str());
235  GeoTransform* xform1 = new GeoTransform(GeoTrf::RotateZ3D(phiOfCooling)*GeoTrf::TranslateX3D(cooling_radius));
236  m_supportPhysA->add(tag1);
237  m_supportPhysA->add(xform1);
238  m_supportPhysA->add(cpPhysVolA);
239 
240  m_supportPhysC->add(tag1);
241  m_supportPhysC->add(xform1);
242  m_supportPhysC->add(cpPhysVolC);
243 
244 
245  // flex transform
246  double phiOfFlex = phiOfModuleZero+ flex_angle + ii*angle;
247  std::ostringstream tmp2;
248  tmp2 << "fl" << ii;
249  GeoNameTag * tag2 = new GeoNameTag(tmp2.str());
250 
251  if(m_section==2){
252 
253  // Intermediate flex
254  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));
255  m_supportPhysA->add(tag2);
256  m_supportPhysA->add(xformA2);
257  m_supportPhysA->add(flexPhysVolA);
258 
259  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));
260  m_supportPhysC->add(tag2);
261  m_supportPhysC->add(xformC2);
262  m_supportPhysC->add(flexPhysVolC);
263 
264  }
265  else {
266 
267  // dogleg and PP0 flexes
268 
269  GeoTransform* xform2 = new GeoTransform(GeoTrf::RotateZ3D(phiOfFlex)*GeoTrf::TranslateX3D((flex_rmin+flex_rmax)*.5)*GeoTrf::RotateZ3D(flex_rot));
270 
271  m_supportPhysA->add(tag2);
272  m_supportPhysA->add(xform2);
273  m_supportPhysA->add(flexPhysVolA);
274 
275  m_supportPhysC->add(tag2);
276  m_supportPhysC->add(xform2);
277  m_supportPhysC->add(flexPhysVolC);
278  }
279 
280 
281  }
282 
283  double middleA = zStartPosA+halfLengthA;
284  double middleC = zStartPosC+halfLengthC;
285 
286  GeoTrf::Transform3D supportTrfA = GeoTrf::TranslateZ3D(middleA); //(zmin+zmax)*0.5+layerZshift);
287  m_xformSupportA = new GeoTransform(supportTrfA);
288 
289  // std::cout<<"Section final A "<<m_section<<" - "<<middleA-halfLengthA<<" "<<middleA+halfLengthA<<" "<<middleA<<std::endl;
290 
291  GeoTrf::Transform3D supportTrfC = GeoTrf::TranslateZ3D(middleC); //(zmin+zmax)*0.5+layerZshift);
292  m_xformSupportC = new GeoTransform(supportTrfC);
293 
294  // std::cout<<"Section final C "<<m_section<<" - "<<middleC-halfLengthC<<" "<<middleC+halfLengthC<<" "<<middleC<<std::endl;
295  // std::cout<<"Section ---"<<std::endl;
296 
297  return nullptr;
298 }
PixelGeometryManager::PixelLayerGlobalShift
virtual double PixelLayerGlobalShift()=0
DeMoUpdate.tmp2
string tmp2
Definition: DeMoUpdate.py:1168
max
#define max(a, b)
Definition: cfImp.cxx:41
PixelGeometryManager
Definition: PixelGeometryManager.h:28
PixelGeometryManager::msg
MsgStream & msg(MSG::Level lvl) const
Definition: PixelGeometryManager.h:611
PixelAthClusterMonAlgCfg.zmin
zmin
Definition: PixelAthClusterMonAlgCfg.py:176
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:25
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
PixelGeometryManager::SetPhi
virtual void SetPhi(int phi)=0
PixelAthClusterMonAlgCfg.zmax
zmax
Definition: PixelAthClusterMonAlgCfg.py:176
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:40
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