ATLAS Offline Software
Loading...
Searching...
No Matches
Enums.py
Go to the documentation of this file.
1# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
2
3from enum import Enum, auto
4
5
6class 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
59def 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"
__eq__(self, other)
Definition Enums.py:7
__lt__(self, other)
Definition Enums.py:69
__le__(self, other)
Definition Enums.py:74
validrunformat(lhcperiod)
Definition Enums.py:59