ATLAS Offline Software
G4TestBeamGeometryConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2 
3 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4 from AthenaConfiguration.ComponentFactory import CompFactory
5 from AthenaCommon.SystemOfUnits import mm
6 
7 
10 
11 def TileTB_Beampipe1Cfg(flags, name="TileTB_BeamPipe1", **kwargs):
12  result = ComponentAccumulator()
13  kwargs.setdefault("DetectorName", "BEAMPIPE1")
14  kwargs.setdefault("InnerRadius", 0.*mm)
15  kwargs.setdefault("OuterRadius", 100.*mm)
16  dz=268500.*mm
17  kwargs.setdefault("dZ", dz)
18  kwargs.setdefault("Material", 'Vacuum')
19  kwargs.setdefault("OffsetX",-12080.*mm-dz)
20  import math
21  kwargs.setdefault("RotateY", math.radians(-90.))
22  result.setPrivateTools(CompFactory.CylindricalEnvelope(name, **kwargs))
23  return result
24 
25 
26 def TileTB_Beampipe2Cfg(flags, name="TileTB_BeamPipe2", **kwargs):
27  result = ComponentAccumulator()
28  kwargs.setdefault("DetectorName", "BEAMPIPE2")
29  kwargs.setdefault("InnerRadius", 0.*mm)
30  kwargs.setdefault("OuterRadius", 100.*mm)
31  dz=6419.8*mm
32  kwargs.setdefault("dZ", dz)
33  kwargs.setdefault("Material", 'Vacuum')
34  kwargs.setdefault("OffsetX",1945.*mm-dz)
35  import math
36  kwargs.setdefault("RotateY", math.radians(-90.))
37  result.setPrivateTools(CompFactory.CylindricalEnvelope(name, **kwargs))
38  return result
39 
40 
41 def TileTB_MYLAREQUIVCfg(flags, name="TileTB_MYLAREQUIV", **kwargs):
42  result = ComponentAccumulator()
43  kwargs.setdefault("DetectorName", "MYLAREQUIV")
44  kwargs.setdefault("InnerRadius", 0.*mm)
45  kwargs.setdefault("OuterRadius", 100.*mm)
46  dz=0.00168*mm
47  kwargs.setdefault("dZ", dz)
48  kwargs.setdefault("Material", 'Mylar')
49  kwargs.setdefault("OffsetX",-12080*mm+dz)
50  import math
51  kwargs.setdefault("RotateY", math.radians(-90.))
52  result.setPrivateTools(CompFactory.CylindricalEnvelope(name, **kwargs))
53  return result
54 
55 
56 def TileTB_S1Cfg(flags, name="TileTB_S1", **kwargs):
57  result = ComponentAccumulator()
58  kwargs.setdefault("DetectorName", "S1")
59  kwargs.setdefault("dX", 5.*mm)
60  kwargs.setdefault("dY", 52.5*mm)
61  kwargs.setdefault("dZ", 50.*mm)
62  kwargs.setdefault("Material", 'Scintillator')
63  kwargs.setdefault("OffsetX",-12074.6*mm)
64  result.setPrivateTools(CompFactory.BoxEnvelope(name, **kwargs))
65  return result
66 
67 
68 def TileTB_S2Cfg(flags, name="TileTB_S2", **kwargs):
69  result = ComponentAccumulator()
70  kwargs.setdefault("DetectorName", "S2")
71  kwargs.setdefault("dX", 10.*mm)
72  kwargs.setdefault("dY", 40.*mm)
73  kwargs.setdefault("dZ", 27.5*mm)
74  kwargs.setdefault("Material", 'Scintillator')
75  kwargs.setdefault("OffsetX",-11294.6*mm)
76  result.setPrivateTools(CompFactory.BoxEnvelope(name, **kwargs))
77  return result
78 
79 
80 def TileTB_S3Cfg(flags, name="TileTB_S3", **kwargs):
81  result = ComponentAccumulator()
82  kwargs.setdefault("DetectorName", "S3")
83  kwargs.setdefault("dX", 10.*mm)
84  kwargs.setdefault("dY", 40.*mm)
85  kwargs.setdefault("dZ", 27.5*mm)
86  kwargs.setdefault("Material", 'Scintillator')
87  kwargs.setdefault("OffsetX",-10994.6*mm)
88  result.setPrivateTools(CompFactory.BoxEnvelope(name, **kwargs))
89  return result
90 
91 
94 
95 def TileTB_CALOEnvelopeCfg(flags, name="TileTB_CALO", **kwargs):
96  result = ComponentAccumulator()
97  kwargs.setdefault("DetectorName", "CALO")
98  import math
99  kwargs.setdefault("StartPhi", math.radians(-27))
100  kwargs.setdefault("DeltaPhi", math.radians(60))
101  kwargs.setdefault("NSurfaces", 3)
102  kwargs.setdefault("InnerRadii", [2269.*mm,950.*mm,950.*mm])
103  kwargs.setdefault("OuterRadii", [5145.*mm,5145.*mm,5145.*mm])
104  kwargs.setdefault("ZSurfaces", [-3400.*mm,-1050.*mm,6600.*mm])
105  # Check the consistency of the flags
106  if flags.TestBeam.Eta != 'NONE' and (flags.TestBeam.Theta != 'NONE' or flags.TestBeam.Z != 'NONE'):
107  raise ValueError('THE ETA PARAMETER CAN NOT BE SET TOGETHER WITH THETA AND Z')
108  elif (flags.TestBeam.Theta == 'NONE' or flags.TestBeam.Z == 'NONE') and flags.TestBeam.Eta == 'NONE':
109  raise ValueError('THETA AND Z ARE NOT SET')
110  import math
111  from AthenaCommon import PhysicalConstants
112  DeltaY=0.0
113  if flags.TestBeam.Y != 'NONE' :
114  DeltaY=-flags.TestBeam.Y
115  PhiZ=0.0
116  if flags.TestBeam.Phi != 'NONE':
117  PhiZ=-math.radians(flags.TestBeam.Phi)
118  if flags.TestBeam.Eta != 'NONE':
119  # Mode 1 -> User enters only eta
120  eta=flags.TestBeam.Eta
121  ThetaY=-(PhysicalConstants.pi*0.5)+2*math.atan(math.exp(-eta))
122  DeltaX=float(2298-6208)/math.cosh(eta)+6208
123  DeltaF=0.0
124  DeltaZ=0.0
125  elif not (flags.TestBeam.Theta == 'NONE' or flags.TestBeam.Z == 'NONE'):
126  theta=flags.TestBeam.Theta
127  z=flags.TestBeam.Z
128  eta=0.0
129  if abs(theta) < 70.01:
130  # Mode 2 -> User enters theta!=+/-90 and Z
131  # Z is the distance from center of the module to the desired
132  # entrace point calculated at R=2290 (start of tilecal
133  # module)
134  ThetaY=math.radians(theta)
135  DeltaX=2298.0+3910.0*(1.0-math.cos(ThetaY))
136  DeltaF=(2290.0*math.tan(-ThetaY)-z)
137  DeltaZ=DeltaF*math.cos(ThetaY)
138  elif abs(abs(theta)-90.0) < 0.01:
139  # Mode 3 -> User enters theta=(+/-)90 and Z
140  # Z is the distance from ATLAS center to corresponding
141  # tilerow
142  # e.g center of first tile row is at 2300 + 100/2 = 2350
143  sign=int(theta>0)*2-1
144  ThetaY=sign*math.radians(90.0)
145  DeltaX=2298.0+2290.0+5640.0/2
146  DeltaF=0.0
147  DeltaZ=-sign*math.fabs(z)
148  else:
149  print ('Tile table rotation: ERROR unknown rotation mode')
150  raise ValueError('UNKNOWN MODE - NEITHER ETA NOR THETA AND Z ARE SET')
151  kwargs.setdefault("RotateZ",PhiZ)
152  kwargs.setdefault("RotateY",ThetaY)
153  kwargs.setdefault("OffsetX",DeltaX)
154  kwargs.setdefault("OffsetY",DeltaY)
155  kwargs.setdefault("OffsetZ",DeltaZ)
156  SubDetectorList=[]
157  if flags.Detector.GeometryCalo:
158  from G4AtlasTools.G4GeometryToolConfig import TileGeoDetectorToolCfg
159  toolTile = result.popToolsAndMerge(TileGeoDetectorToolCfg(flags))
160  SubDetectorList += [ toolTile ]
161  from MuonWall.MuonWallConfig import MuonWallTileTBCfg
162  muonWallTool = result.popToolsAndMerge(MuonWallTileTBCfg(flags))
163  SubDetectorList += [muonWallTool]
164  kwargs.setdefault("SubDetectors", SubDetectorList)
165  result.setPrivateTools(CompFactory.PolyconicalEnvelope(name, **kwargs))
166  return result
167 
168 
169 def TileTB_WorldEnvelopeCfg(flags, name="TileTB_World", **kwargs):
170  result = ComponentAccumulator()
171  kwargs.setdefault("DetectorName", "CTB")
172  kwargs.setdefault("dX", 600000.*mm)
173  kwargs.setdefault("dY", 5000.*mm)
174  kwargs.setdefault("dZ", 10000.*mm)
175  SubDetectorList=[]
176  if flags.Detector.GeometryCalo:
177  tbCaloTool = result.popToolsAndMerge(TileTB_CALOEnvelopeCfg(flags))
178  SubDetectorList += [tbCaloTool]
179  bp1Tool = result.popToolsAndMerge(TileTB_Beampipe1Cfg(flags))
180  SubDetectorList += [bp1Tool]
181  bp2Tool = result.popToolsAndMerge(TileTB_Beampipe2Cfg(flags))
182  SubDetectorList += [bp2Tool]
183  s1Tool = result.popToolsAndMerge(TileTB_S1Cfg(flags))
184  SubDetectorList += [s1Tool]
185  s2Tool = result.popToolsAndMerge(TileTB_S2Cfg(flags))
186  SubDetectorList += [s2Tool]
187  s3Tool = result.popToolsAndMerge(TileTB_S3Cfg(flags))
188  SubDetectorList += [s3Tool]
189  # Not used in currently supported Tile Test Beam setups, but left as a reminder
190  #larEqvTool = result.popToolsAndMerge(TileTB_MYLAREQUIVCfg(flags))
191  #SubDetectorList += [larEqvTool]
192  kwargs.setdefault("SubDetectors", SubDetectorList)
193  result.setPrivateTools(CompFactory.BoxEnvelope(name, **kwargs))
194  return result
G4GeometryToolConfig.TileGeoDetectorToolCfg
def TileGeoDetectorToolCfg(flags, name='Tile', **kwargs)
Definition: G4GeometryToolConfig.py:158
SystemOfUnits
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
G4TestBeamGeometryConfig.TileTB_S3Cfg
def TileTB_S3Cfg(flags, name="TileTB_S3", **kwargs)
Definition: G4TestBeamGeometryConfig.py:80
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
G4TestBeamGeometryConfig.TileTB_MYLAREQUIVCfg
def TileTB_MYLAREQUIVCfg(flags, name="TileTB_MYLAREQUIV", **kwargs)
Definition: G4TestBeamGeometryConfig.py:41
G4TestBeamGeometryConfig.TileTB_S2Cfg
def TileTB_S2Cfg(flags, name="TileTB_S2", **kwargs)
Definition: G4TestBeamGeometryConfig.py:68
G4TestBeamGeometryConfig.TileTB_Beampipe2Cfg
def TileTB_Beampipe2Cfg(flags, name="TileTB_BeamPipe2", **kwargs)
Definition: G4TestBeamGeometryConfig.py:26
G4TestBeamGeometryConfig.TileTB_WorldEnvelopeCfg
def TileTB_WorldEnvelopeCfg(flags, name="TileTB_World", **kwargs)
Definition: G4TestBeamGeometryConfig.py:169
G4TestBeamGeometryConfig.TileTB_CALOEnvelopeCfg
def TileTB_CALOEnvelopeCfg(flags, name="TileTB_CALO", **kwargs)
— Tile TB 2000-2003 ---------------------------------------------—
Definition: G4TestBeamGeometryConfig.py:95
G4TestBeamGeometryConfig.TileTB_S1Cfg
def TileTB_S1Cfg(flags, name="TileTB_S1", **kwargs)
Definition: G4TestBeamGeometryConfig.py:56
G4TestBeamGeometryConfig.TileTB_Beampipe1Cfg
def TileTB_Beampipe1Cfg(flags, name="TileTB_BeamPipe1", **kwargs)
— Ancillary volumes TB 2000-2003 ---------------------------------------------—
Definition: G4TestBeamGeometryConfig.py:11
readCCLHist.float
float
Definition: readCCLHist.py:83
MuonWallConfig.MuonWallTileTBCfg
def MuonWallTileTBCfg(flags, name="MuonWallTileTB", **kwargs)
Definition: MuonWallConfig.py:43