Skip to content
Snippets Groups Projects

Clean-up setting of ConfigFlag.Detector. flags

Merged John Derek Chapman requested to merge jchapman/athena:DetectorFlagCleanup_master into master
All threads resolved!
Files
11
@@ -4,43 +4,6 @@
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
"""
# based on https://acode-browser1.usatlas.bnl.gov/lxr/source/athena/Control/AthenaServices/python/Configurables.py#0247
def EvtIdModifierSvc_add_modifier(svc,
run_nbr=None, evt_nbr=None, time_stamp=None, lbk_nbr=None,
nevts=1):
if run_nbr is None:
modify_run_nbr = 0
run_nbr = 0
else:
modify_run_nbr = 1
if evt_nbr is None:
modify_evt_nbr = 0
evt_nbr = 0
else:
modify_evt_nbr = 1
if time_stamp is None:
modify_time_stamp = 0
time_stamp = 0
else:
modify_time_stamp = 1
if lbk_nbr is None:
modify_lbk_nbr = 0
lbk_nbr = 0
else:
modify_lbk_nbr = 1
mod_bit = int(0b0000
| (modify_run_nbr << 0)
| (modify_evt_nbr << 1)
| (modify_time_stamp << 2)
| (modify_lbk_nbr << 3))
svc.Modifiers += [run_nbr, evt_nbr, time_stamp, lbk_nbr,
nevts, mod_bit]
if __name__ == '__main__':
@@ -62,6 +25,8 @@ if __name__ == '__main__':
from AthenaConfiguration.Enums import ProductionStep
ConfigFlags.Common.ProductionStep = ProductionStep.Simulation
ConfigFlags.Input.RunNumber = [284500] #Isn't updating - todo: investigate
ConfigFlags.Input.OverrideRunNumber = True
ConfigFlags.Input.LumiBlockNumber = [1]
from AthenaConfiguration.TestDefaults import defaultTestFiles
inputDir = defaultTestFiles.d
ConfigFlags.Input.Files = ['/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SimCoreTests/valid1.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.evgen.EVNT.e4993.EVNT.08166201._000012.pool.root.1'] #defaultTestFiles.EVNT
@@ -80,52 +45,10 @@ if __name__ == '__main__':
ConfigFlags.IOVDb.GlobalTag = "OFLCOND-MC16-SDR-14"
ConfigFlags.GeoModel.Align.Dynamic = False
#set the detector flags:
#inner detectors
ConfigFlags.Detector.SimulateBCM = True
ConfigFlags.Detector.GeometryBCM = True
ConfigFlags.Detector.SimulateDBM = True
ConfigFlags.Detector.GeometryDBM = True
ConfigFlags.Detector.SimulatePixel = True
ConfigFlags.Detector.GeometryPixel = True
ConfigFlags.Detector.SimulateSCT = True
ConfigFlags.Detector.GeometrySCT = True
ConfigFlags.Detector.SimulateTRT = True
ConfigFlags.Detector.GeometryTRT = True
#muon
ConfigFlags.Detector.SimulateMuon = True #True
ConfigFlags.Detector.GeometryMuon = True #True <these two break it (others can be true)
ConfigFlags.Detector.SimulateMDT = True #True
ConfigFlags.Detector.GeometryMDT = True #True
ConfigFlags.Detector.SimulateRPC = True #True
ConfigFlags.Detector.GeometryRPC = True #True
ConfigFlags.Detector.SimulateTGC = True #True
ConfigFlags.Detector.GeometryTGC = True #True
ConfigFlags.Detector.SimulateCSC = True #True
ConfigFlags.Detector.GeometryCSC = True #True
#LAr
ConfigFlags.Detector.SimulateLAr = True
ConfigFlags.Detector.GeometryLAr = True
ConfigFlags.Detector.SimulateTile = True
ConfigFlags.Detector.GeometryTile = True
ConfigFlags.Detector.SimulateHGTD = False
#ConfigFlags.Detector.GeometryHGTD = False #isn't a flag -- is it needed?
ConfigFlags.Detector.SimulateBpipe = True
ConfigFlags.Detector.GeometryBpipe = True
#forward region not migrated yet
ConfigFlags.Detector.SimulateLucid = False
ConfigFlags.Detector.SimulateZDC = False
ConfigFlags.Detector.SimulateALFA = False
ConfigFlags.Detector.SimulateAFP = False
ConfigFlags.Detector.SimulateFwdRegion = False
ConfigFlags.Detector.SimulateForward = False
detectors =['Bpipe', 'BCM', 'DBM', 'Pixel', 'SCT', 'TRT', 'LAr', 'Tile', 'CSC', 'MDT', 'RPC', 'TGC']
# Setup detector flags
from SimuJobTransforms.SimulationTestHelpers import setupDetectorSimulateFlagsFromList
setupDetectorSimulateFlagsFromList(ConfigFlags, detectors)
# Finalize
ConfigFlags.lock()
@@ -136,26 +59,6 @@ if __name__ == '__main__':
from AthenaPoolCnvSvc.PoolWriteConfig import PoolWriteCfg
cfg.merge(PoolReadCfg(ConfigFlags))
cfg.merge(PoolWriteCfg(ConfigFlags))
# todo its own cfg ...
myRunNumber = 284500
myFirstLB = 1
myInitialTimeStamp = 1446539185
evtMax = 4
from AthenaConfiguration.ComponentFactory import CompFactory
evtIdModifierSvc = CompFactory.EvtIdModifierSvc(EvtStoreName="StoreGateSvc")
iovDbMetaDataTool = CompFactory.IOVDbMetaDataTool()
iovDbMetaDataTool.MinMaxRunNumbers = [myRunNumber, 2147483647]
cfg.addPublicTool(iovDbMetaDataTool)
EvtIdModifierSvc_add_modifier(evtIdModifierSvc, run_nbr=myRunNumber, lbk_nbr=myFirstLB, time_stamp=myInitialTimeStamp, nevts=evtMax)
eventSelector = cfg.getService("EventSelector")
eventSelector.OverrideRunNumber = True
eventSelector.RunNumber = myRunNumber
eventSelector.FirstLB = myFirstLB
eventSelector.InitialTimeStamp = myInitialTimeStamp # Necessary to avoid a crash
if hasattr(eventSelector, "OverrideRunNumberFromInput"):
eventSelector.OverrideRunNumberFromInput = True
cfg.addService(evtIdModifierSvc, create=True)
# ... up to here?
# add BeamEffectsAlg
from BeamEffects.BeamEffectsAlgConfig import BeamEffectsAlgCfg
@@ -164,7 +67,7 @@ if __name__ == '__main__':
#add the G4AtlasAlg
from G4AtlasAlg.G4AtlasAlgConfigNew import G4AtlasAlgCfg
cfg.merge(G4AtlasAlgCfg(ConfigFlags))
from TileGeoG4SD.TileGeoG4SDToolConfig import TileGeoG4SDCalcCfg
cfg.merge(TileGeoG4SDCalcCfg(ConfigFlags))
@@ -172,7 +75,7 @@ if __name__ == '__main__':
OutputStreamHITS = cfg.getEventAlgo("OutputStreamHITS")
OutputStreamHITS.ItemList.remove("xAOD::EventInfo#EventInfo")
OutputStreamHITS.ItemList.remove("xAOD::EventAuxInfo#EventInfoAux.")
# FIXME hack because deduplication is broken
PoolAttributes = ["TREE_BRANCH_OFFSETTAB_LEN = '100'"]
PoolAttributes += ["DatabaseName = '" + ConfigFlags.Output.HITSFileName + "'; ContainerName = 'TTree=CollectionTree'; TREE_AUTO_FLUSH = '1'"]
@@ -183,7 +86,7 @@ if __name__ == '__main__':
cfg.getService("StoreGateSvc").Dump = True
cfg.getService("ConditionStore").Dump = True
cfg.printConfig(withDetails=True, summariseProps = True)
ConfigFlags.dump()
# Execute and finish
Loading