ATLAS Offline Software
runIDAlign.py
Go to the documentation of this file.
1 #!/usr/bin/env python3
2 
3 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
4 
5 # File: InDetAlignConfig/scripts/runIDAlign.py
6 # Author: David Brunner (david.brunner@cern.ch), Thomas Strebler (thomas.strebler@cern.ch)
7 
8 import os
9 
10 def parser():
11  from argparse import ArgumentParser
12  parser = ArgumentParser(description='Script to to the IDAlignment')
13 
14 
15  parser.add_argument("-a", '--accumulate', action="store_true", help='Run accumulation step')
16  parser.add_argument("-s", '--solve', action="store_true", help='Run solve step')
17  parser.add_argument("-d", '--dryRun', action="store_true", help='Only configure, print and dont execute')
18 
19 
20  parser.add_argument("-i", "--input", default = ["/afs/cern.ch/user/a/atlidali/public/CA_hackathon/InitialDerivation/calibScripts/data23_13p6TeV.00456316.calibration_IDCalib.merge.RAW._lb0541._SFO-ALL._0001.1"], nargs = "+", help='Input file(s)')
21  parser.add_argument("--maxEvents", default = -1, type = int, help='Number of maximal processed events')
22  parser.add_argument("-t", "--inputTracksCollection", default = "CombinedInDetTracks", type = str, help='Name of the track collection to use')
23 
24 
25  parser.add_argument("--globalTag", default = "CONDBR2-BLKPA-2023-03", help='Global tag')
26  parser.add_argument("--atlasVersion", default = "ATLAS-R3S-2021-03-00-00", help='Global tag')
27  parser.add_argument("--projectName", default = "data23_13p6TeV", help='Global tag')
28 
29  parser.add_argument("--isBFieldOn", action="store_true", default = True, help='Check if Bfield is non-zero')
30  parser.add_argument("--isCosmics", action="store_true", default = False, help='Check if cosmics run')
31  parser.add_argument("--isHeavyIon", action="store_true", default = False, help='Check if heavy ion run')
32 
33  return parser.parse_args()
34 
35 
36 kwargs = parser()
37 
38 from AthenaConfiguration.AllConfigFlags import initConfigFlags
39 from InDetAlignConfig.IDAlignFlags import createInDetAlignFlags
40 
41 flags = initConfigFlags()
42 flags.addFlagsCategory("InDet.Align", createInDetAlignFlags, prefix=True)
43 if kwargs["accumulate"] and not kwargs["solve"]:
44  flags = flags.cloneAndReplace(
45  "Tracking.ActiveConfig",
46  f"Tracking.{flags.Tracking.PrimaryPassConfig.value}Pass")
47 
48 flags.lock()
49 
50 from RecJobTransforms.RecoSteering import RecoSteering
51 cfg = RecoSteering(flags)
52 
53 
56 
57 
58 if kwargs["accumulate"] and not kwargs["solve"]:
59  os.makedirs("Accumulate", exist_ok = True)
60  os.chdir("Accumulate")
61  from InDetAlignConfig.AccumulateConfig import AccumulateCfg
62  cfg.merge(AccumulateCfg(flags))
63 
64 
65 elif kwargs["solve"] and not kwargs["accumulate"]:
66  os.makedirs("Solve", exist_ok = True)
67  os.chdir("Solve")
68  from InDetAlignConfig.SolveConfig import SolveCfg
69  cfg.merge(SolveCfg(flags))
70 
71 else:
72  raise Exception("You can run either the acculumation step or the solve step, but not both at the same time!")
73 
74 
75 
76 if kwargs["dryRun"]:
77  cfg.printConfig()
78 
79 else:
80  cfg.run()
81 
runIDAlign.parser
def parser()
Definition: runIDAlign.py:10
python.RecoSteering.RecoSteering
def RecoSteering(flags)
Definition: RecoSteering.py:6
AccumulateConfig.AccumulateCfg
def AccumulateCfg(flags, **kwargs)
Definition: AccumulateConfig.py:123
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
SolveConfig.SolveCfg
def SolveCfg(flags, **kwargs)
Definition: SolveConfig.py:40