ATLAS Offline Software
AFP_GeoModelRP.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "AFP_GeoModelFactory.h"
6 #include "GeoModelKernel/GeoMaterial.h"
7 #include "GeoModelKernel/GeoBox.h"
8 #include "GeoModelKernel/GeoTube.h"
9 #include "GeoModelKernel/GeoTubs.h"
10 #include "GeoModelKernel/GeoTrd.h"
11 #include "GeoModelKernel/GeoPgon.h"
12 #include "GeoModelKernel/GeoShapeSubtraction.h"
13 #include "GeoModelKernel/GeoShapeIntersection.h"
14 #include "GeoModelKernel/GeoShapeUnion.h"
15 #include "GeoModelKernel/GeoShapeShift.h"
16 #include "GeoModelKernel/GeoLogVol.h"
17 #include "GeoModelKernel/GeoNameTag.h"
18 #include "GeoModelKernel/GeoPhysVol.h"
19 #include "GeoModelKernel/GeoFullPhysVol.h"
20 #include "GeoModelKernel/GeoTransform.h"
21 #include "GeoModelKernel/GeoAlignableTransform.h"
22 #include "CLHEP/GenericFunctions/AbsFunction.hh"
23 #include "CLHEP/GenericFunctions/Variable.hh"
24 #include "CLHEP/GenericFunctions/Sin.hh"
25 #include "CLHEP/GenericFunctions/Cos.hh"
26 
28 
29 #include <iostream>
30 #include <fstream>
31 #include <string>
32 
33 #include <algorithm>
34 #include <cmath>
35 
36 #include <list>
37 #include <map>
38 
39 #include <cstdlib>
40 
41 #define RPOT_MAINTUBUS_WNDCUTUP 1
42 #define RPOT_MAINTUBUS_LENGTH (70.0*CLHEP::mm)
43 #define RPOT_MAINTUBUS_INNERRADIUS (71.0*CLHEP::mm)
44 #define RPOT_MAINTUBUS_THICKNESS (2.0*CLHEP::mm)
45 #define RPOT_MAINTUBUS_BPTHICKNESS (0.3*CLHEP::mm) //thickness of the bottom part
46 #define RPOT_MAINTUBUS_WNDWIDTH (20.0*CLHEP::mm)//24
47 #define RPOT_MAINTUBUS_WNDHEIGHT (20.0*CLHEP::mm)//30
48 #define RPOT_MAINTUBUS_WNDTHICKNESS (0.3*CLHEP::mm)
49 #define RPOT_MAINTUBUS_FLOORPARTLENGTH (20.0*CLHEP::mm)
50 #define RPOT_MAINTUBUS_FLOORPARTTHICKNESS (2.0*CLHEP::mm)
51 
52 #define RPOT_FLOOR_THICKNESS (2.0*CLHEP::mm)
53 #define RPOT_FLOOR_WNDWIDTH (20.0*CLHEP::mm)
54 #define RPOT_FLOOR_WNDTHICKNESS (0.3*CLHEP::mm)
55 #define RPOT_FLOOR_WNDFACET (45*CLHEP::deg)
56 
57 #define RPOT_FLANGE_THICKNESS (20.0*CLHEP::mm)
58 #define RPOT_FLANGE_OUTERRADIUS (125.0*CLHEP::mm)
59 
60 void AFP_GeoModelFactory::addRomanPot(GeoPhysVol* pPhysMotherVol, const char* pszStationName, HepGeom::Transform3D& TransInMotherVolume)
61 {
62  const double fMainTubusSteelPartLength=RPOT_MAINTUBUS_LENGTH-RPOT_MAINTUBUS_FLOORPARTLENGTH;
63 
64  char szLabel[32];
65  double fLength,fRMin,fRMax;
66  GeoShapeShift* pMoveCut;
67  GeoShape* pSolCut;
68 
69  HepGeom::Transform3D TransRPot=TransInMotherVolume*HepGeom::TranslateX3D(-(0.5*fMainTubusSteelPartLength+RPOT_MAINTUBUS_FLOORPARTLENGTH+RPOT_FLOOR_WNDTHICKNESS));
70 
71  //Main tubus -------------------------------------------------------------------------------------------------
72  fLength=fMainTubusSteelPartLength;
75 
76  GeoTube* pSolTubus=new GeoTube(fRMin, fRMax, 0.5*fLength);
77  sprintf(szLabel,"%s_LogRPMainTubus",pszStationName);
78  GeoLogVol* pLogTubus=new GeoLogVol(szLabel,pSolTubus,m_MapMaterials[std::string("Steel_AFP")]);
79  sprintf(szLabel,"%s_RPMainTubus",pszStationName);
80  GeoFullPhysVol* pPhysTubus=new GeoFullPhysVol(pLogTubus);
81  pPhysMotherVol->add(new GeoNameTag(szLabel));
82  pPhysMotherVol->add(new GeoTransform(Amg::CLHEPTransformToEigen(TransRPot*HepGeom::RotateY3D(90*CLHEP::deg))));
83  pPhysMotherVol->add(pPhysTubus);
84 
85  //Main tubus - floor (bottom) part ---------------------------------------------------------------------------
89 
90  sprintf(szLabel,"%s_LogRPMainTubusFloorPart",pszStationName);
91  pSolTubus=new GeoTube(fRMin, fRMax, 0.5*fLength);
92  sprintf(szLabel,"%s_LogRPMainTubusFloorPart",pszStationName);
93  pLogTubus=new GeoLogVol(szLabel,pSolTubus,m_MapMaterials[std::string("Steel_AFP")]); //XXX
94  pPhysTubus=new GeoFullPhysVol(pLogTubus);
95  sprintf(szLabel,"%s_RPMainTubusFloorPart",pszStationName);
96  pPhysMotherVol->add(new GeoNameTag(szLabel));
97  pPhysMotherVol->add(new GeoTransform(Amg::CLHEPTransformToEigen(TransRPot*HepGeom::TranslateX3D(0.5*fLength+0.5*fMainTubusSteelPartLength)*HepGeom::RotateY3D(90*CLHEP::deg))));
98  pPhysMotherVol->add(pPhysTubus);
99 
100  //--upper mass
104  double fPhi=asin(0.5*RPOT_FLOOR_WNDWIDTH/fRMin);
105  double fDPhi=CLHEP::pi-2*fPhi;
106  GeoTubs* pSolMass=new GeoTubs(fRMin,fRMax,0.5*fLength,fPhi,fDPhi);
107 
108  sprintf(szLabel,"%s_LogRPMainTubusUMass",pszStationName);
109  pLogTubus=new GeoLogVol(szLabel,pSolMass,m_MapMaterials[std::string("Steel_AFP")]); //XXX
110  pPhysTubus=new GeoFullPhysVol(pLogTubus);
111  sprintf(szLabel,"%s_LogRPMainTubusUMass",pszStationName);
112  pPhysMotherVol->add(new GeoNameTag(szLabel));
113  pPhysMotherVol->add(new GeoTransform(Amg::CLHEPTransformToEigen(TransRPot*HepGeom::TranslateX3D(0.5*fLength+0.5*fMainTubusSteelPartLength)*HepGeom::RotateY3D(90*CLHEP::deg))));
114  pPhysMotherVol->add(pPhysTubus);
115 
116  //-lower mass
120  double fSPhi=CLHEP::pi+fPhi;
121  pSolMass=new GeoTubs(fRMin,fRMax,0.5*fLength,fSPhi,fDPhi);
122 
123  sprintf(szLabel,"%s_LogRPMainTubusLMass",pszStationName);
124  pLogTubus=new GeoLogVol(szLabel,pSolMass,m_MapMaterials[std::string("Steel_AFP")]); //XXX
125  pPhysTubus=new GeoFullPhysVol(pLogTubus);
126  sprintf(szLabel,"%s_LogRPMainTubusLMass",pszStationName);
127  pPhysMotherVol->add(new GeoNameTag(szLabel));
128  pPhysMotherVol->add(new GeoTransform(Amg::CLHEPTransformToEigen(TransRPot*HepGeom::TranslateX3D(0.5*fLength+0.5*fMainTubusSteelPartLength)*HepGeom::RotateY3D(90*CLHEP::deg))));
129  pPhysMotherVol->add(pPhysTubus);
130 
131 
132  //Floor tubus -------------------------------------------------------------------------------------------------
133  fLength=RPOT_FLOOR_THICKNESS;
134  fRMin=0.0*CLHEP::mm;
136  pSolTubus=new GeoTube(fRMin, fRMax, 0.5*fLength);
137 
138  //cut volume
141  double fTrdHYLength2=0.5*RPOT_FLOOR_WNDWIDTH;
143  double fTrdHZLength=0.5*(RPOT_FLOOR_THICKNESS-RPOT_FLOOR_WNDTHICKNESS);
144  pSolCut=new GeoTrd(fTrdHXLength1,fTrdHXLength2,fTrdHYLength1,fTrdHYLength2,fTrdHZLength);
145  GeoTrf::Transform3D TransCut=GeoTrf::TranslateZ3D(0.5*fLength-fTrdHZLength);
146  pMoveCut=new GeoShapeShift(pSolCut, TransCut);
147  GeoShapeSubtraction* pSolFloor=new GeoShapeSubtraction(pSolTubus, pMoveCut);
148 
149  sprintf(szLabel,"%s_LogRPFloorTubus",pszStationName);
150  pLogTubus=new GeoLogVol(szLabel,pSolFloor,m_MapMaterials[std::string("Beryllium_AFP")]);
151  pPhysTubus=new GeoFullPhysVol(pLogTubus);
152  sprintf(szLabel,"%s_RPFloorTubus",pszStationName);
153  pPhysMotherVol->add(new GeoNameTag(szLabel));
154  pPhysMotherVol->add(new GeoTransform(Amg::CLHEPTransformToEigen(TransRPot*HepGeom::TranslateX3D(0.5*fMainTubusSteelPartLength+RPOT_MAINTUBUS_FLOORPARTLENGTH+0.5*RPOT_FLOOR_THICKNESS)*HepGeom::RotateY3D(90*CLHEP::deg))));
155  pPhysMotherVol->add(pPhysTubus);
156 
157  //Flange tubus -------------------------------------------------------------------------------------------------
158  fLength=RPOT_FLANGE_THICKNESS;
161 
162  pSolTubus=new GeoTube(fRMin, fRMax, 0.5*fLength);
163  sprintf(szLabel,"%s_LogRPFlangeTubus",pszStationName);
164  pLogTubus=new GeoLogVol(szLabel,pSolTubus,m_MapMaterials[std::string("Steel_AFP")]);
165  pPhysTubus=new GeoFullPhysVol(pLogTubus);
166  sprintf(szLabel,"%s_RPFlangeTubus",pszStationName);
167  pPhysMotherVol->add(new GeoNameTag(szLabel));
168  pPhysMotherVol->add(new GeoTransform(Amg::CLHEPTransformToEigen(TransRPot*HepGeom::TranslateX3D(-0.5*fMainTubusSteelPartLength-0.5*RPOT_FLANGE_THICKNESS)*HepGeom::RotateY3D(90*CLHEP::deg))));
169  pPhysMotherVol->add(pPhysTubus);
170 
171 }
RPOT_MAINTUBUS_LENGTH
#define RPOT_MAINTUBUS_LENGTH
Definition: AFP_GeoModelRP.cxx:42
RPOT_MAINTUBUS_BPTHICKNESS
#define RPOT_MAINTUBUS_BPTHICKNESS
Definition: AFP_GeoModelRP.cxx:45
RPOT_MAINTUBUS_THICKNESS
#define RPOT_MAINTUBUS_THICKNESS
Definition: AFP_GeoModelRP.cxx:44
RPOT_FLOOR_WNDTHICKNESS
#define RPOT_FLOOR_WNDTHICKNESS
Definition: AFP_GeoModelRP.cxx:54
AFP_GeoModelFactory::addRomanPot
void addRomanPot(GeoPhysVol *pPhysMotherVol, const char *pszStationName, HepGeom::Transform3D &TransInMotherVolume)
Definition: AFP_GeoModelRP.cxx:60
RPOT_FLANGE_OUTERRADIUS
#define RPOT_FLANGE_OUTERRADIUS
Definition: AFP_GeoModelRP.cxx:58
deg
#define deg
Definition: SbPolyhedron.cxx:17
AFP_GeoModelFactory.h
pi
#define pi
Definition: TileMuonFitter.cxx:65
RPOT_FLOOR_WNDWIDTH
#define RPOT_FLOOR_WNDWIDTH
Definition: AFP_GeoModelRP.cxx:53
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
drawFromPickle.tan
tan
Definition: drawFromPickle.py:36
CLHEPtoEigenConverter.h
RPOT_MAINTUBUS_FLOORPARTLENGTH
#define RPOT_MAINTUBUS_FLOORPARTLENGTH
Definition: AFP_GeoModelRP.cxx:49
RPOT_FLOOR_WNDFACET
#define RPOT_FLOOR_WNDFACET
Definition: AFP_GeoModelRP.cxx:55
python.SystemOfUnits.mm
int mm
Definition: SystemOfUnits.py:83
RPOT_FLOOR_THICKNESS
#define RPOT_FLOOR_THICKNESS
Definition: AFP_GeoModelRP.cxx:52
Amg::CLHEPTransformToEigen
Amg::Transform3D CLHEPTransformToEigen(const HepGeom::Transform3D &CLHEPtransf)
Converts a CLHEP-based HepGeom::Transform3D into an Eigen Amg::Transform3D.
Definition: CLHEPtoEigenConverter.h:38
RPOT_FLANGE_THICKNESS
#define RPOT_FLANGE_THICKNESS
Definition: AFP_GeoModelRP.cxx:57
RPOT_MAINTUBUS_INNERRADIUS
#define RPOT_MAINTUBUS_INNERRADIUS
Definition: AFP_GeoModelRP.cxx:43
AFP_GeoModelFactory::m_MapMaterials
std::map< std::string, GeoRef< const GeoMaterial > > m_MapMaterials
Definition: AFP_GeoModelFactory.h:44
RPOT_MAINTUBUS_WNDTHICKNESS
#define RPOT_MAINTUBUS_WNDTHICKNESS
Definition: AFP_GeoModelRP.cxx:48