ATLAS Offline Software
Loading...
Searching...
No Matches
ActsHGTDReconstruction.py
Go to the documentation of this file.
1#!/usr/bin/env python
2# Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
4# Main script execution
5if __name__ == "__main__":
6
7 import argparse
8 import glob
9 import re
10
11 # Initialize the configuration flags
12 from AthenaConfiguration.AllConfigFlags import initConfigFlags
13 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
14 from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
15 flags = initConfigFlags()
16
17 from InDetConfig.ConfigurationHelpers import OnlyTrackingPreInclude
18 OnlyTrackingPreInclude(flags)
19
20 parser = argparse.ArgumentParser(description='Run HGTD reconstruction with ACTS')
21 parser.add_argument('--file_dir', type=str, required=True, help='Path to directory with RDO files')
22 parser.add_argument('--Nfiles', type=int, default=-1, help='Number of files to process (-1 for all)')
23 parser.add_argument('--output_suffix', type=str, default='', help='Suffix to append to output files')
24 args = parser.parse_args()
25
26 # Get the list of all matching files
27 file_pattern = f"{args.file_dir}/RDO*.pool.root.1"
28 all_files = sorted(glob.glob(file_pattern))
29
30 matching_files = []
31 for f in all_files:
32 matching_files.append(f)
33
34 if args.Nfiles > 0 and len(matching_files) > args.Nfiles:
35 matching_files = matching_files[:args.Nfiles]
36 print(f"Limiting to first {args.Nfiles} files as requested")
37
38 flags.Input.Files = matching_files
39
40 # Check the files matched
41 print(f"Matched {len(matching_files)} files:")
42 for f in matching_files:
43 print(f)
44
45 flags.Exec.MaxEvents = -1 #100
46
47 flags.Output.doWriteAOD = True
48 flags.Output.AODFileName = f"ActsHGTD_track_extension_test_AOD_{args.output_suffix}.root"
49 flags.Output.HISTFileName = f"ActsHGTD_track_extension_HIST_{args.output_suffix}.root"
50
51 # Set specific tracking flags
52 flags.Tracking.doTruth = False
53
54 flags.Detector.EnableCalo = False
55 flags.DQ.useTrigger = False
56 flags.Acts.doMonitoring = True
57 flags.HGTD.doMonitoring = True
58
59 flags.Detector.EnableHGTD = True
60 flags.Acts.doITkConversion=False
61 flags.Tracking.doITkConversion=False
62
63 from TrkConfig.TrkConfigFlags import TrackingComponent
64 flags.Tracking.recoChain = [TrackingComponent.ActsChain]
65 flags.Acts.doRotCorrection = False
66
67 flags.lock()
68 flags.dump()
69
70 # Main services configuration
71 acc = MainServicesCfg(flags)
72 acc.getService("MessageSvc").debugLimit = 100000000
73 acc.getService("MessageSvc").verboseLimit = 100000000
74 acc.merge(PoolReadCfg(flags))
75
76 # HGTD Reconstruction - xAOD EDM
77 from ActsConfig.ActsClusterizationConfig import ActsHgtdClusterizationAlgCfg
78 acc.merge(ActsHgtdClusterizationAlgCfg(flags))
79
80 # Schedule the complete ITk tracking reconstruction
81 from InDetConfig.ITkTrackRecoConfig import ITkTrackRecoCfg
82 acc.merge(ITkTrackRecoCfg(flags))
83
84 # Add the HGTD Track Extension Algorithm
85 from ActsConfig.ActsHGTDTrackExtensionAlgConfig import ActsHGTDTrackExtensionAlgConfig
86 acc.merge(ActsHGTDTrackExtensionAlgConfig(flags))
87
88
89 # Run the job
90 acc.printConfig(withDetails = True, summariseProps = True)
91 acc.run()
92
void print(char *figname, TCanvas *c1)