ATLAS Offline Software
Enums.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
2 
3 from enum import Enum, auto
4 
5 
6 class FlagEnum(Enum):
7  def __eq__(self, other):
8  if not isinstance(other, self.__class__):
9  raise TypeError(f"Invalid comparison of {self.__class__} with {type(other)}")
10  return self is other
11 
12  __hash__ = Enum.__hash__
13 
14 
16  Athena = 'Athena'
17  AthAnalysis = 'AthAnalysis'
18  AthDerivation = 'AthDerivation'
19  AthGeneration = 'AthGeneration'
20  AthSimulation = 'AthSimulation'
21  AnalysisBase = 'AnalysisBase'
22 
23  @classmethod
24  def determine(cls):
25  import os
26  if "AthSimulation_DIR" in os.environ:
27  return cls.AthSimulation
28  if "AthGeneration_DIR" in os.environ:
29  return cls.AthGeneration
30  if "AthAnalysis_DIR" in os.environ:
31  return cls.AthAnalysis
32  if "AthDerivation_DIR" in os.environ:
33  return cls.AthDerivation
34  if "AnalysisBase_DIR" in os.environ:
35  return cls.AnalysisBase
36  return cls.Athena
37 
38 
40  BS = 'BS'
41  POOL = 'POOL'
42 
43 
45  # steps should be added when needed
46  Default = 'Default'
47  Generation = 'Generation'
48  Simulation = 'Simulation'
49  PileUpPresampling = 'PileUpPresampling'
50  Overlay = 'Overlay'
51  FastChain = 'FastChain'
52  Digitization = 'Digitization'
53  PileUpPretracking = 'PileUpPretracking'
54  Reconstruction = 'Reconstruction'
55  Derivation = 'Derivation'
56 
57 
58 def validrunformat(lhcperiod):
59  import re
60  for item in lhcperiod.__members__.values():
61  if not re.match("^RUN[0-9]$", item.value):
62  raise ValueError("Value not in a format RUN+single digit %s", item.value)
63  return lhcperiod
64 
65 
66 @validrunformat
68  def __lt__(self, other): #operator specific to validrunformat
69  if not isinstance(other, self.__class__):
70  raise TypeError(f"Invalid comparison of {self.__class__} with {type(other)}")
71  else:
72  return self.value < other.value
73  def __le__(self, other):
74  if not isinstance(other, self.__class__):
75  raise TypeError(f"Invalid comparison of {self.__class__} with {type(other)}")
76  else:
77  return self.value <= other.value
78 
79  Run1 = 'RUN1'
80  Run2 = 'RUN2'
81  Run3 = 'RUN3'
82  Run4 = 'RUN4'
83 
84 
86  Collisions = 'collisions'
87  SingleBeam = 'singlebeam'
88  Cosmics = 'cosmics'
89  TestBeam = 'testbeam'
90 
91 
93  FILLPARAMS = 0
94  MC = 1
95  TrigConf = 2
96  Lumi = 3
97 
98 
100  FileMetaData = auto()
101  EventStreamInfo = auto()
102  EventFormat = auto()
103  CutFlowMetaData = auto()
104  ByteStreamMetaData = auto()
105  LumiBlockMetaData = auto()
106  TriggerMenuMetaData = auto()
107  TruthMetaData = auto()
108  IOVMetaData = auto()
109 
110 
112  pp = "pp"
113  HI = "hi"
114  HIP = "hip"
115  UPC = "upc"
python.Enums.Project.AnalysisBase
AnalysisBase
Definition: Enums.py:21
python.Enums.BeamType
Definition: Enums.py:85
python.Enums.FlagEnum
Definition: Enums.py:6
python.Enums.BunchStructureSource
Definition: Enums.py:92
python.Enums.LHCPeriod.__lt__
def __lt__(self, other)
Definition: Enums.py:68
python.Enums.validrunformat
def validrunformat(lhcperiod)
Definition: Enums.py:58
python.Enums.Project.AthGeneration
AthGeneration
Definition: Enums.py:19
python.Enums.LHCPeriod
Definition: Enums.py:67
python.Enums.Project.AthSimulation
AthSimulation
Definition: Enums.py:20
python.Enums.Project.Athena
Athena
Definition: Enums.py:16
python.Enums.LHCPeriod.__le__
def __le__(self, other)
Definition: Enums.py:73
python.Enums.FlagEnum.__eq__
def __eq__(self, other)
Definition: Enums.py:7
python.Enums.Project.AthAnalysis
AthAnalysis
Definition: Enums.py:17
python.Enums.Project
Definition: Enums.py:15
python.Enums.Format
Definition: Enums.py:39
python.Enums.HIMode
Definition: Enums.py:111
python.Enums.Project.determine
def determine(cls)
Definition: Enums.py:24
python.Enums.Project.AthDerivation
AthDerivation
Definition: Enums.py:18
python.Enums.MetadataCategory
Definition: Enums.py:99
python.Enums.ProductionStep
Definition: Enums.py:44