2 """FastCaloSimServices test helpers
4 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
7 from argparse
import ArgumentParser
8 from AthenaConfiguration.Enums
import ProductionStep
9 from AthenaConfiguration.ComponentFactory
import CompFactory
10 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
14 """Configure event loop for FCSServices"""
15 JobOptsDumperAlg = CompFactory.JobOptsDumperAlg
22 """MessageSvc for FCSServices"""
23 MessageSvc = CompFactory.MessageSvc
25 acc.addService(
MessageSvc(setError=[
"HepMcParticleLink"]))
30 """FCSServices test argument parser"""
31 parser = ArgumentParser()
32 parser.add_argument(
"-n",
"--maxEvents", default=3, type=int,
33 help=
"The number of events to run. 0 skips execution")
34 parser.add_argument(
"-t",
"--threads", default=1, type=int,
35 help=
"The number of concurrent threads to run. 0 uses serial Athena.")
36 parser.add_argument(
"-V",
"--verboseAccumulators", default=
False, action=
"store_true",
37 help=
"Print full details of the AlgSequence for each accumulator")
38 parser.add_argument(
"-S",
"--verboseStoreGate", default=
False, action=
"store_true",
39 help=
"Dump the StoreGate(s) each event iteration")
40 parser.add_argument(
"-o",
"--output", default=
'', type=str,
41 help=
"Output RDO file")
42 parser.add_argument(
"-s",
"--outputSig", default=
'', type=str,
43 help=
"Output RDO_SGNL file")
48 """Fill default FCSServices flags for testing"""
50 from AthenaConfiguration.TestDefaults
import defaultGeometryTags, defaultTestFiles
51 configFlags.Input.RunNumbers = [284500]
52 configFlags.Input.OverrideRunNumber =
True
53 configFlags.Input.LumiBlockNumbers = [1]
54 configFlags.Input.Files = defaultTestFiles.EVNT
55 configFlags.Output.HITSFileName =
"myHITSnew.pool.root"
56 configFlags.Common.ProductionStep = ProductionStep.Simulation
59 from SimulationConfig.SimEnums
import BeamPipeSimMode, CalibrationRun, LArParameterization, SimulationFlavour, TruthStrategy
60 configFlags.Sim.TruthStrategy = TruthStrategy.MC15aPlus
61 configFlags.Sim.PhysicsList =
"FTFP_BERT_ATL"
62 configFlags.Sim.CalibrationRun = CalibrationRun.Off
63 configFlags.Sim.RecordStepInfo =
False
64 configFlags.Sim.BeamPipeSimMode = BeamPipeSimMode.FastSim
65 configFlags.Sim.ISFRun =
True
66 configFlags.Sim.ISF.Simulator = SimulationFlavour.ATLFAST3MT
67 configFlags.Sim.FastCalo.ParamsInputFilename =
"FastCaloSim/MC23/TFCSparam_AF3_MC23_Sep23.root"
68 configFlags.Sim.FastCalo.CaloCellsName =
"AllCalo"
70 configFlags.IOVDb.GlobalTag =
"OFLCOND-MC16-SDR-14"
71 configFlags.GeoModel.Align.Dynamic =
False
72 configFlags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2
74 detectors = [
'Bpipe',
'BCM',
'Pixel',
'SCT',
'TRT',
'LAr',
'Tile',
'MBTS',
'CSC',
'MDT',
'RPC',
'TGC']
76 from AthenaConfiguration.DetectorConfigFlags
import setupDetectorFlags
80 configFlags.Sim.LArParameterization = LArParameterization.NoFrozenShowers
83 if args.output ==
'None':
84 configFlags.Output.RDOFileName =
''
86 configFlags.Output.RDOFileName = args.output
89 configFlags.Output.RDO_SGNLFileName = args.outputSig
93 """Postprocess and lock config flags for FCSServices"""
95 configFlags.Concurrency.NumThreads = args.threads
97 configFlags.Scheduler.ShowDataDeps =
True
98 configFlags.Scheduler.ShowDataFlow =
True
99 configFlags.Scheduler.ShowControlFlow =
True
100 configFlags.Concurrency.NumConcurrentEvents = args.threads
106 """Common debugging and execution for FCSServices tests"""
108 if args.verboseAccumulators:
109 accessor.printConfig(withDetails=
True)
110 if args.verboseStoreGate:
111 accessor.getService(
"StoreGateSvc").Dump =
True
115 accessor.printConfig(withDetails=
False)
118 sc = accessor.run(maxEvents=args.maxEvents)
122 return not sc.isSuccess()