ATLAS Offline Software
BeamFlags.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
2 
3 #=======================================================================
4 # File: RecExConfig/python/BeamFlags.py
5 #=======================================================================
6 """ Flags for beam structure
7 """
8 #
9 #
10 __author__ = 'D. Rousseau'
11 __version__="$Revision: 1.3 $"
12 __doc__="Beam structure flags . "
13 
14 
15 
16 
17 #=======================================================================
18 # imports
19 #=======================================================================
20 from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer
21 from AthenaCommon.JobProperties import jobproperties
22 
23 class override(JobProperty):
24  """ True wether beam info has to be taken from python rather than filemetadata
25  """
26  statusOn=True
27  allowedTypes=['bool']
28  StoredValue=True
29 
30 
31 
32 class bunchSpacing(JobProperty):
33  """ Bunch spacing in ns
34  """
35  statusOn=True
36  allowedTypes=['int']
37  StoredValue=25
38 #
39 #
40 class numberOfCollisions(JobProperty):
41  """ Number of collisions per beam crossing
42  Should be 2.3*(L/10**33)*(bunchSpacing/25 ns)
43  """
44  statusOn=True
45  allowedTypes=['float']
46  StoredValue=0.
47 #
48 #
49 class beamType(JobProperty):
50  """ Specify data taking type : with colliding beams (default),
51  single beam or cosmics
52  """
53  statusOn=True
54  allowedTypes=['str']
55  allowedValues=['collisions','singlebeam','cosmics']
56  StoredValue='collisions'
57 #
58 #
59 class energy (JobProperty):
60  """ Specify beam energy (MeV)
61  """
62  from AthenaCommon.SystemOfUnits import TeV
63  statusOn=True
64  allowedTypes=['float']
65  StoredValue=7*TeV
66 #
67 #
68 class bunchStructureSource (JobProperty):
69  """ Specify beam energy (MeV)
70  """
71  statusOn=True
72  allowedTypes=['int']
73  allowedValues=[0,1,2,3]
74  StoredValue=2
75 
76 
77 
78 #
79 #
80 class Beam(JobPropertyContainer):
81  """ Beam information """
82  # computes on the fly the expected luminosity
84  return 1E33*(jobproperties.Beam.numberOfCollisions()/2.3)*(25./jobproperties.Beam.bunchSpacing())
85  # true if luminosity is zero
86  def zeroLuminosity(self):
87  if jobproperties.Beam.numberOfCollisions()>0:
88  return False
89  else:
90  return True
91 
92 
93 
94 # add the beam flags container to the top container
95 jobproperties.add_Container(Beam)
96 
97 # I want always the following flags in the Beam container
98 _list_Beam=[override,bunchSpacing,numberOfCollisions,beamType,energy,bunchStructureSource]
99 for j in _list_Beam:
100  jobproperties.Beam.add_JobProperty(j)
101 del _list_Beam
102 
103 # For convenience, a shorthand alias to the beam flags
104 beamFlags = jobproperties.Beam
105 
106 #=======================================================================
SystemOfUnits
python.BeamFlags.bunchStructureSource
Definition: BeamFlags.py:68
python.BeamFlags.numberOfCollisions
Definition: BeamFlags.py:40
python.BeamFlags.beamType
Definition: BeamFlags.py:49
python.BeamFlags.Beam.zeroLuminosity
def zeroLuminosity(self)
Definition: BeamFlags.py:86
python.BeamFlags.Beam.estimatedLuminosity
def estimatedLuminosity(self)
Definition: BeamFlags.py:83
python.BeamFlags.Beam
Definition: BeamFlags.py:80
python.BeamFlags.energy
Definition: BeamFlags.py:59
python.BeamFlags.override
Definition: BeamFlags.py:23
python.BeamFlags.bunchSpacing
Definition: BeamFlags.py:32