From 9a43ae6590b503f0327802f6251dceb221d69947 Mon Sep 17 00:00:00 2001 From: Eric Torrence <eric.torrence@cern.ch> Date: Sat, 22 Jan 2022 12:17:01 -0800 Subject: [PATCH] Enable new SegmentFinder --- .../Reconstruction/scripts/faser_reco.py | 38 +++++++++++++++++-- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/Control/CalypsoExample/Reconstruction/scripts/faser_reco.py b/Control/CalypsoExample/Reconstruction/scripts/faser_reco.py index aa6e8143..f0fa35b4 100755 --- a/Control/CalypsoExample/Reconstruction/scripts/faser_reco.py +++ b/Control/CalypsoExample/Reconstruction/scripts/faser_reco.py @@ -7,9 +7,11 @@ # filepath - fully qualified path, including url if needed, to the input raw data file # example: "root://hepatl30//atlas/local/torrence/faser/commissioning/TestBeamData/Run-004150/Faser-Physics-004150-00000.raw" # -# runtype - optional flag to specify the data type (TI12Data or TestBeamData). +# runtype - optionally specify the data type (TI12Data, TI12Data02, or TestBeamData). # In a normal file system location, this will be extracted from the directory name, # but runtype will override this assignment. +# TI12Data02 is needed for the IFT geometry. Script will auto-detect this if read +# from normal file system location. # import sys import argparse @@ -26,6 +28,8 @@ parser.add_argument("-n", "--nevents", type=int, default=-1, help="Specify number of events to process (default: all)") parser.add_argument("-v", "--verbose", action='store_true', help="Turn on DEBUG output") +parser.add_argument("--clusterFit", action='store_true', + help="Use ClusterFit (old) track finder - default: SegmentFit(new)") args = parser.parse_args() @@ -47,6 +51,23 @@ else: runtype = filepath.parts[-3] + # Fix TI12 geometry versions as well (needed in production) + # Probably better to do this from configuration in upstream production scripts, + # so lets call this a hack for now + if runtype == "TI12Data": + + runname = filepath.parts[-2] + try: + runnumber = int(runname.split('-')[1]) + except Exception as e: + print(f"Failed to find run number in {filepath}") + print(f"Couldn't parse {runname}") + print(f"Leave runtype as {runtype}!") + else: + if runnumber > 5302: # Last TI12 run on Nov. 23, 2021 without IFT + print(f"Found run number {runnumber}, using TI12 configuration with IFT") + runtype = "TI12Data02" + print(f"Starting reconstruction of {filepath.name} with type {runtype}") if args.nevents > 0: print(f"Reconstructing {args.nevents} events by command-line option") @@ -140,9 +161,18 @@ acc.merge(FaserSCT_ClusterizationCfg(ConfigFlags)) from TrackerSpacePointFormation.TrackerSpacePointFormationConfig import TrackerSpacePointFinderCfg acc.merge(TrackerSpacePointFinderCfg(ConfigFlags)) -# Try Dave's fitter -from TrackerClusterFit.TrackerClusterFitConfig import ClusterFitAlgCfg -acc.merge(ClusterFitAlgCfg(ConfigFlags)) +# Can't use both in the same job, as they write to the same output histograms +if args.clusterFit: + print("Configuring TrackerClusterFit (old)") + # Try Dave's fitter + from TrackerClusterFit.TrackerClusterFitConfig import ClusterFitAlgCfg + acc.merge(ClusterFitAlgCfg(ConfigFlags)) + +else: + print("Configuring TrackerSegmentFit (new)") + # Try Dave's new fitter + from TrackerSegmentFit.TrackerSegmentFitConfig import SegmentFitAlgCfg + acc.merge(SegmentFitAlgCfg(ConfigFlags)) # # Configure output -- GitLab