10 Python module to hold common global flags
13 + The module has been re-written in terms of the new JobProperties and the
14 original class implementation was modified to allow a smooth transition.
16 GlobalFlags.DetGeo.set_atlas()
18 jobproperties.Global.DetGeo='atlas'
19 At some point "GlobalFlags.DetGeo.set_atlas()" we will add a warning
20 message and later on we declare them obsolete
25 __author__ =
"S.Binet, M.Gallas, David Rousseau"
26 __version__=
"$Revision: 1.14 $"
27 __doc__ =
"Global job properties"
29 __all__ = [
"GlobalFlags",
"globalflags" ]
33 from AthenaCommon.JobProperties
import JobProperty, JobPropertyContainer
34 from AthenaCommon.JobProperties
import jobproperties
39 """ Which detector configuration : atlas, combined test beam or commisisoning
43 allowedValues=[
'atlas',
'ctbh8',
'ctbh6',
'commis']
47 for v
in allowedValues:
48 exec(
"def is_%s(self): return self() == '%s'" % (v,v) )
52 """ Detector geometry DB tag
53 see https://twiki.cern.ch/twiki/bin/view/Atlas/DetDescrVersion.
61 StoredValue=
'ATLAS-R2-2016-01-00-01'
64 """ See https://twiki.cern.ch/twiki/bin/view/Atlas/CoolProdTags
68 StoredValue=
'OFLCOND-MC16-SDR-RUN2-09'
72 """Switch between run1/run2 database instance"""
75 allowedValues=[
'auto',
'COMP200',
'CONDBR2']
79 """ Where does the data comes from : real data, geant3 or geant4
83 allowedValues=[
'data',
'geant3',
'geant4']
87 for v
in allowedValues:
88 exec(
"def is_%s(self): return self() == '%s'" % (v,v) )
92 """ Input format of the data
96 allowedValues=[
'zebra',
'pool',
'bytestream']
100 for v
in allowedValues:
101 exec(
"def is_%s(self): return self() == '%s'" % (v,v) )
107 zero -> no pile up at all
115 allowedValues=[
'zero',
'verylow',
'low',
'high']
119 for v
in allowedValues:
120 exec(
"def is_%s(self): return self() == '%s'" % (v,v) )
135 """ if data is overlayed
138 allowedTypes=[
'bool']
144 """ The global flag/job property container.
148 jobproperties.add_Container(Global)
152 list_jobproperties=[DetGeo,DataSource,InputFormat,Luminosity,DetDescrVersion,ConditionsTag,DatabaseInstance,isOverlay]
153 for i
in list_jobproperties:
154 jobproperties.Global.add_JobProperty(i)
158 globalflags=jobproperties.Global
189 _flagPrefix =
'_flag_'
205 raise RuntimeError(
'ERROR : GlobalFlags.%s has not been set!' % cls.__name__)
207 is_ctb = classmethod(is_ctb)
225 _flag_bytestream =
False
234 _flag_verylow =
False
241 _classObjList = [DetGeo,DataSource,InputFormat,Luminosity]
244 for _classObj
in _classObjList:
245 for _attr
in dir(_classObj)[:]:
247 if 0 == _attr.find(_flagPrefix):
256 raise RuntimeError(
'ERROR : GlobalFlags.%s has been already set!' % self.
_clsObj.__name__)
260 raise RuntimeError(
"ERROR GlobalFlags.set_%s() deprecated ! Use globalflags.%s.set_Value_and_Lock(blah) instead !" % (self.
_clsObj.__name__+
"."+self.
_flagName[6:],self.
_clsObj.__name__))
263 jobproperties.set_JobProperties(data)
265 raise RuntimeError(
"ERROR GlobalFlags.is_%s() deprecated ! Use if globalflags.%s == blah instead !" % (self.
_flagName[6:],self.
_clsObj.__name__))
268 raise RuntimeError(
'ERROR : GlobalFlags.%s has not been set!' % self.
_clsObj.__name__)
273 _setMethod = _attr.replace(_flagPrefix,
'set_')
274 setattr(_classObj,_setMethod, _tmpC.set)
275 _isMethod = _attr.replace(_flagPrefix,
'is_')
276 setattr(_classObj,_isMethod, _tmpC.is_xyz)
283 for attr
in dir(classObj):
287 if classObj.__dict__[attr]:
289 print (format % (classObj.__name__, flagName))
292 Print = classmethod(Print)