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  MinbiasPreprocessing = 'MinbiasPreprocessing'
52  FastChain = 'FastChain'
53  Digitization = 'Digitization'
54  PileUpPretracking = 'PileUpPretracking'
55  Reconstruction = 'Reconstruction'
56  Derivation = 'Derivation'
57 
58 
59 def validrunformat(lhcperiod):
60  import re
61  for item in lhcperiod.__members__.values():
62  if not re.match("^RUN[0-9]$", item.value):
63  raise ValueError("Value not in a format RUN+single digit %s", item.value)
64  return lhcperiod
65 
66 
67 @validrunformat
69  def __lt__(self, other): #operator specific to validrunformat
70  if not isinstance(other, self.__class__):
71  raise TypeError(f"Invalid comparison of {self.__class__} with {type(other)}")
72  else:
73  return self.value < other.value
74  def __le__(self, other):
75  if not isinstance(other, self.__class__):
76  raise TypeError(f"Invalid comparison of {self.__class__} with {type(other)}")
77  else:
78  return self.value <= other.value
79 
80  Run1 = 'RUN1'
81  Run2 = 'RUN2'
82  Run3 = 'RUN3'
83  Run4 = 'RUN4'
84 
85 
87  Collisions = 'collisions'
88  SingleBeam = 'singlebeam'
89  Cosmics = 'cosmics'
90  TestBeam = 'testbeam'
91 
92 
94  FILLPARAMS = 0
95  MC = 1
96  TrigConf = 2
97  Lumi = 3
98 
99 
101  FileMetaData = auto()
102  EventStreamInfo = auto()
103  EventFormat = auto()
104  CutFlowMetaData = auto()
105  ByteStreamMetaData = auto()
106  LumiBlockMetaData = auto()
107  TriggerMenuMetaData = auto()
108  TruthMetaData = auto()
109  IOVMetaData = auto()
110 
111 
113  pp = "pp"
114  HI = "hi"
115  HIP = "hip"
116  UPC = "upc"
python.Enums.Project.AnalysisBase
AnalysisBase
Definition: Enums.py:21
python.Enums.BeamType
Definition: Enums.py:86
python.Enums.FlagEnum
Definition: Enums.py:6
python.Enums.BunchStructureSource
Definition: Enums.py:93
python.Enums.LHCPeriod.__lt__
def __lt__(self, other)
Definition: Enums.py:69
python.Enums.validrunformat
def validrunformat(lhcperiod)
Definition: Enums.py:59
python.Enums.Project.AthGeneration
AthGeneration
Definition: Enums.py:19
python.Enums.LHCPeriod
Definition: Enums.py:68
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:74
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:112
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:100
python.Enums.ProductionStep
Definition: Enums.py:44