From 2d9717cf229fe8c77f1b61048711a68299f6a1cb Mon Sep 17 00:00:00 2001 From: Eric Torrence <eric.torrence@cern.ch> Date: Fri, 27 May 2022 08:29:51 +0200 Subject: [PATCH] Particle Gun fix, Updated CKF --- .../scripts/submit_faserMDC_digi.sh | 2 +- .../scripts/submit_faserMDC_digi_merge.sh | 159 ++++++++++++++++++ .../FaserMC-MDC_PG_elec_100GeV-101103.json | 4 +- .../mdc/FaserMC-MDC_PG_elec_logE-101101.json | 6 +- .../mdc/FaserMC-MDC_PG_gam_100GeV-102201.json | 4 +- .../FaserMC-MDC_PG_muon_100GeV-101303.json | 2 +- ...serMC-MDC_PG_muon_fasernu_logE-101302.json | 2 +- .../mdc/FaserMC-MDC_PG_muon_logE-101301.json | 2 +- .../FaserMC-MDC_PG_pion_100GeV-121101.json | 4 +- .../scripts/faserMDC_particlegun.py | 24 +-- .../Reconstruction/CMakeLists.txt | 1 + .../Reconstruction/scripts/faserMDC_reco.py | 58 ++++--- .../Reconstruction/scripts/faser_reco.py | 79 ++++++--- .../python/RadialPosSampler.py | 7 +- .../TrackerPrepRawDataFormationConfig.py | 3 +- .../src/WaveformReconstructionTool.h | 2 +- 16 files changed, 285 insertions(+), 74 deletions(-) create mode 100755 Control/CalypsoExample/Digitization/scripts/submit_faserMDC_digi_merge.sh diff --git a/Control/CalypsoExample/Digitization/scripts/submit_faserMDC_digi.sh b/Control/CalypsoExample/Digitization/scripts/submit_faserMDC_digi.sh index 449bd807..a8e1b905 100755 --- a/Control/CalypsoExample/Digitization/scripts/submit_faserMDC_digi.sh +++ b/Control/CalypsoExample/Digitization/scripts/submit_faserMDC_digi.sh @@ -2,7 +2,7 @@ # Used with a condor file to submit to vanilla universe # # Usage: -# submit_faserMDC_digi.sh filepath [release_directory] [working_directory] +# submit_faserMDC_digi.sh filepath [release_directory] [working_directory] # # filepath - full file name (with path) # release_directory - optional path to release install directory (default pwd) diff --git a/Control/CalypsoExample/Digitization/scripts/submit_faserMDC_digi_merge.sh b/Control/CalypsoExample/Digitization/scripts/submit_faserMDC_digi_merge.sh new file mode 100755 index 00000000..3c500905 --- /dev/null +++ b/Control/CalypsoExample/Digitization/scripts/submit_faserMDC_digi_merge.sh @@ -0,0 +1,159 @@ +#!/bin/bash +# Used with a condor file to submit to vanilla universe +# +# Usage: +# submit_faserMDC_digi_merge.sh dirpath slice nfiles [release_directory] [working_directory] +# +# dirpath - full directory path to HITS files +# slice - ordinal output file number +# nfiles - number of HITS files to process per slice +# release_directory - optional path to release install directory (default pwd) +# working_directory - optional path to output directory location (default pwd) +# +# The release directory must already be set up +# (so an unqualified asetup can set up the release properly) +# +# Script will use git describe to find the release tag. +# If this matches sim/s???? or digi/d???? it will be passed to the job +# +#---------------------------------------- +# Keep track of time +SECONDS=0 +# +# Parse command-line options +dir_path=${1} +slice=${2} +nfiles=${3} +release_directory=${4} +working_directory=${5} +# +# Set defaults if arguments aren't provided +if [ -z "$dir_path" ] +then + echo "No directory specified!" + echo "Usage: submit_faserMDC_digi_merge.sh directory slice nfiles [release dir] [output dir]" + exit 1 +fi +# +if [ -z "$slice" ] +then + echo "Slice number not specified!" + echo "Usage: submit_faserMDC_digi_merge.sh directory slice nfiles [release dir] [output dir]" + exit 1 +fi +# +if [ -z "$nfiles" ] +then + echo "Files per slice not specified!" + echo "Usage: submit_faserMDC_digi_merge.sh directory slice nfiles [release dir] [output dir]" + exit 1 +fi +# +if [ -z "$release_directory" ] +then + release_directory=`pwd` +fi +# +if [ -z "$working_directory" ] +then + working_directory=`pwd` +fi +# +starting_directory=`pwd` +# +# Now extract the run number and file stem +# +# First, get an example filename +file_name=`ls -1 $dir_path | head -1` +# +# Now split based on '.' to get stem +defaultIFS=$IFS +IFS='.' +read file_stem ext <<< "$file_name" +# +# Finally extract the run number +IFS='-' +# Read the split words into an array based on delimiter +read faser short run_number segment <<< "$file_stem" +# +# Set the IFS delimeter back or else echo doesn't work... +IFS=$defaultIFS +# +# Make output directory if needed +output_directory="$working_directory/$run_number" +mkdir -p "$output_directory" +# +# Need to make up an output name +file_stem="$faser-$short-$run_number-RDO-merge-$slice" +# +# This magic redirects everything in this script to our log file +exec >& "$output_directory/$file_stem.log" +echo `date` - $HOSTNAME +echo "Directory: $dir_path" +echo "Slice: $slice" +echo "NFiles: $nfiles" +echo "Release: $release_directory" +echo "Output: $output_directory" +echo "Starting: $starting_directory" +echo "job: $file_stem" +# +# Set up the release (do this automatically)? +export ATLAS_LOCAL_ROOT_BASE=/cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase +source ${ATLAS_LOCAL_ROOT_BASE}/user/atlasLocalSetup.sh +# +# Try automatic +# Always go back to the starting directory in case paths are relative +cd "$starting_directory" +cd "$release_directory" +# asetup +# source build/x8*/setup.sh +# +# Do this by hand +asetup --input=calypso/asetup.faser Athena,22.0.49 +source build/x86*/setup.sh +# +# +# Try to find a release tag +cd calypso +recotag=`git describe` +if [[ "$recotag" == "reco/r"???? ]]; then + tag=`echo "$recotag" | cut -c 6-11` + echo "Found reco tag: $tag" +fi +if [[ "$recotag" == "digi/d"???? ]]; then + tag=`echo "$recotag" | cut -c 6-11` + echo "Found digi tag: $tag" +fi +if [[ "$recotag" == "sim/s"???? ]]; then + tag=`echo "$recotag" | cut -c 5-10` + echo "Found sim tag: $tag" +fi +# +# Move to the run directory +cd "$starting_directory" +cd "$output_directory" +# +# Remove any previous directory if it exists +#if [[ -e "$file_stem" ]]; then +# echo "Remove previous directory $file_stem" +# rm -rf "$file_stem" +#fi +# +# Make run directory +if [[ -e "$file_stem" ]]; then + echo "Directory $file_stem already exists" +else + mkdir "$file_stem" +fi +cd "$file_stem" +# +# Run job +if [[ -z "$tag" ]]; then + faserMDC_digi_merge.py --slice $slice --files $nfiles $dir_path +else + faserMDC_digi_merge.py --slice $slice --files $nfiles --tag $tag $dir_path +fi +# +# Print out ending time +date +echo "Job finished after $SECONDS seconds" diff --git a/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_elec_100GeV-101103.json b/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_elec_100GeV-101103.json index 76297a72..5d894348 100644 --- a/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_elec_100GeV-101103.json +++ b/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_elec_100GeV-101103.json @@ -1,10 +1,10 @@ { - "file_length": 250, + "file_length": 1000, "mass": 0.511, "maxE": 100.0, "minE": 100.0, "pid": [-11, 11], - "radius": 100.0, + "radius": -100.0, "run": 101103, "sampler": "const", "segment": 0, diff --git a/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_elec_logE-101101.json b/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_elec_logE-101101.json index e7e27b8b..4ced9578 100644 --- a/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_elec_logE-101101.json +++ b/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_elec_logE-101101.json @@ -1,10 +1,10 @@ { - "file_length": 250, + "file_length": 500, "mass": 0.511, - "maxE": 1000.0, + "maxE": 5000.0, "minE": 10.0, "pid": [-11, 11], - "radius": 100.0, + "radius": -100.0, "run": 101101, "sampler": "log", "segment": 0, diff --git a/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_gam_100GeV-102201.json b/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_gam_100GeV-102201.json index dd04adad..9fd3bac9 100644 --- a/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_gam_100GeV-102201.json +++ b/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_gam_100GeV-102201.json @@ -1,10 +1,10 @@ { - "file_length": 250, + "file_length": 1000, "mass": 0.0, "maxE": 100.0, "minE": 100.0, "pid": 22, - "radius": 100.0, + "radius": -100.0, "run": 102201, "sampler": "const", "segment": 0, diff --git a/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_muon_100GeV-101303.json b/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_muon_100GeV-101303.json index fd2273d6..f2bb15db 100644 --- a/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_muon_100GeV-101303.json +++ b/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_muon_100GeV-101303.json @@ -4,7 +4,7 @@ "maxE": 100.0, "minE": 100.0, "pid": [-13, 13], - "radius": 100.0, + "radius": -100.0, "run": 101303, "sampler": "const", "segment": 0, diff --git a/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_muon_fasernu_logE-101302.json b/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_muon_fasernu_logE-101302.json index a001e29b..8ae524dc 100644 --- a/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_muon_fasernu_logE-101302.json +++ b/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_muon_fasernu_logE-101302.json @@ -4,7 +4,7 @@ "maxE": 5000.0, "minE": 10.0, "pid": [-13, 13], - "radius": 100.0, + "radius": -100.0, "run": 101302, "sampler": "log", "segment": 0, diff --git a/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_muon_logE-101301.json b/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_muon_logE-101301.json index 1e07b8ac..c462453d 100644 --- a/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_muon_logE-101301.json +++ b/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_muon_logE-101301.json @@ -4,7 +4,7 @@ "maxE": 5000.0, "minE": 10.0, "pid": [-13, 13], - "radius": 100.0, + "radius": -100.0, "run": 101301, "sampler": "log", "segment": 0, diff --git a/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_pion_100GeV-121101.json b/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_pion_100GeV-121101.json index 6802663e..d6fa2431 100644 --- a/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_pion_100GeV-121101.json +++ b/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_pion_100GeV-121101.json @@ -1,10 +1,10 @@ { - "file_length": 250, + "file_length": 1000, "mass": 139.6, "maxE": 100.0, "minE": 100.0, "pid": [211, -211], - "radius": 100.0, + "radius": -100.0, "run": 121101, "sampler": "const", "segment": 0, diff --git a/Control/CalypsoExample/Generation/scripts/faserMDC_particlegun.py b/Control/CalypsoExample/Generation/scripts/faserMDC_particlegun.py index d583c012..c9f9154e 100755 --- a/Control/CalypsoExample/Generation/scripts/faserMDC_particlegun.py +++ b/Control/CalypsoExample/Generation/scripts/faserMDC_particlegun.py @@ -79,7 +79,7 @@ if __name__ == '__main__': # # Preset particle gun parameters # - from math import atan + import ParticleGun as PG from AthenaCommon.SystemOfUnits import GeV, TeV, cm, m from AthenaCommon.PhysicalConstants import pi @@ -92,35 +92,37 @@ if __name__ == '__main__': print(f"Using pid: {args.pid} => {pidarg}") - # For ParticleGun to accept this, we need to turn it into a set... - import ParticleGun as PG - ConfigFlags.Sim.Gun = { + # Create the simgun dictionary + # Negative radius gives uniform sampling + # Positive radius gives Gaussian sampling + sg_dict = { "Generator" : "SingleParticle", "pid" : pidarg, "mass" : args.mass, "theta" : PG.GaussianSampler(0, args.angle, oneside = True), "phi" : [0, 2*pi], "radius" : args.radius, - "randomSeed" : args.outfile } + "randomSeed" : args.outfile + } # Note the nominal z position is -3.75m, which is a bit upstream of vetoNu # The decay volume is approximately -1.5 - 0 m, so -1m is safely inside # To get all the material currently defined in front, specify -5m. # Note zpos is in mm! if args.zpos: - ConfigFlags.Sim.Gun["z"] = args.zpos + sg_dict["z"] = args.zpos # Determine energy sampling if args.sampler == "lin": - ConfigFlags.Sim.Gun["energy"] = PG.UniformSampler(args.minE*GeV, args.maxE*GeV) + sg_dict["energy"] = PG.UniformSampler(args.minE*GeV, args.maxE*GeV) elif args.sampler == "log": - ConfigFlags.Sim.Gun["energy"] = PG.LogSampler(args.minE*GeV, args.maxE*GeV) + sg_dict["energy"] = PG.LogSampler(args.minE*GeV, args.maxE*GeV) elif args.sampler == "const": - ConfigFlags.Sim.Gun["energy"] = PG.ConstSampler(args.maxE*GeV) + sg_dict["energy"] = PG.ConstSampler(args.maxE*GeV) else: print(f"Sampler {args.sampler} not known!") sys.exit(1) - # import sys - # ConfigFlags.fillFromArgs(sys.argv[1:]) + # Pass this in one go to ConfigFlags + ConfigFlags.Sim.Gun = sg_dict # # MDC geometry configuration diff --git a/Control/CalypsoExample/Reconstruction/CMakeLists.txt b/Control/CalypsoExample/Reconstruction/CMakeLists.txt index 4bccc2d7..f8212572 100644 --- a/Control/CalypsoExample/Reconstruction/CMakeLists.txt +++ b/Control/CalypsoExample/Reconstruction/CMakeLists.txt @@ -21,6 +21,7 @@ atlas_add_test( ProdRecoTI12 SCRIPT scripts/faser_reco.py ${CMAKE_CURRENT_SOURCE_DIR}/../rawdata/Faser-Physics-001920-filtered.raw TI12Data PROPERTIES TIMEOUT 300 ) +# Turn this off until we figure out the CKF behavior on testbeam data atlas_add_test( ProdRecoTestBeam SCRIPT scripts/faser_reco.py ${CMAKE_CURRENT_SOURCE_DIR}/../RAWDATA/Faser-Physics-003613-filtered.raw TestBeamData PROPERTIES TIMEOUT 300 ) diff --git a/Control/CalypsoExample/Reconstruction/scripts/faserMDC_reco.py b/Control/CalypsoExample/Reconstruction/scripts/faserMDC_reco.py index 15632432..f9003eec 100755 --- a/Control/CalypsoExample/Reconstruction/scripts/faserMDC_reco.py +++ b/Control/CalypsoExample/Reconstruction/scripts/faserMDC_reco.py @@ -7,11 +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 - optionally specify the data type (TI12Data, TI12Data02, or TestBeamData). +# runtype - optionally specify the data type (TI12Data, TI12Data02, TI12Data03 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. -# MDC will assume this geometry. +# > TI12Data02 is needed for the IFT geometry. +# MDC will assume TI12Data03 geometry. # import sys import time @@ -45,7 +45,7 @@ if len(args.run_type) > 0: # Assume based on MDC reco else: - runtype = "TI12Data02" + runtype = "TI12Data03" # Assume this is MC args.isMC = True @@ -72,6 +72,9 @@ ConfigFlags.IOVDb.DatabaseInstance = "OFLP200" # Use MC conditions for now ConfigFlags.Input.ProjectName = "data20" ConfigFlags.GeoModel.Align.Dynamic = False +# For tracking +ConfigFlags.TrackingGeometry.MaterialSource = "/cvmfs/faser.cern.ch/repo/sw/database/DBRelease/current/acts/material-maps.json" + # TI12 Cosmics geometry if runtype == "TI12Data": ConfigFlags.GeoModel.FaserVersion = "FASER-01" @@ -87,6 +90,11 @@ elif runtype == "TI12Data02": ConfigFlags.GeoModel.FaserVersion = "FASER-02" ConfigFlags.IOVDb.GlobalTag = "OFLCOND-FASER-02" +# Final 2022 TI12 geometry +elif runtype == "TI12Data03": + ConfigFlags.GeoModel.FaserVersion = "FASERNU-03" + ConfigFlags.IOVDb.GlobalTag = "OFLCOND-FASER-02" + else: print("Invalid run type found:", runtype) print("Specify correct type or update list") @@ -102,6 +110,7 @@ if len(args.reco) > 0: ConfigFlags.addFlag("Output.xAODFileName", f"{filestem}-xAOD.root") ConfigFlags.Output.ESDFileName = f"{filestem}-ESD.root" +ConfigFlags.Output.doWriteESD = False # # Play around with this? @@ -142,16 +151,29 @@ acc.merge(WaveformReconstructionCfg(ConfigFlags)) # Tracker clusters from TrackerPrepRawDataFormation.TrackerPrepRawDataFormationConfig import FaserSCT_ClusterizationCfg -acc.merge(FaserSCT_ClusterizationCfg(ConfigFlags)) +acc.merge(FaserSCT_ClusterizationCfg(ConfigFlags, DataObjectName="SCT_RDOs")) +# # SpacePoints from TrackerSpacePointFormation.TrackerSpacePointFormationConfig import TrackerSpacePointFinderCfg acc.merge(TrackerSpacePointFinderCfg(ConfigFlags)) -print("Configuring TrackerSegmentFit (new)") # Try Dave's new fitter +print("Configuring TrackerSegmentFit (new)") from TrackerSegmentFit.TrackerSegmentFitConfig import SegmentFitAlgCfg -acc.merge(SegmentFitAlgCfg(ConfigFlags)) +acc.merge(SegmentFitAlgCfg(ConfigFlags, + SharedHitFraction=0.61, + MinClustersPerFit=5, + TanThetaXZCut=0.083)) +# +# Ghost removal +from FaserActsKalmanFilter.GhostBustersConfig import GhostBustersCfg +acc.merge(GhostBustersCfg(ConfigFlags)) + +# +# Kalman Filter for tracking +from FaserActsKalmanFilter.CKF2Config import CKF2Cfg +acc.merge(CKF2Cfg(ConfigFlags, noDiagnostics=True)) # # Configure output @@ -160,12 +182,17 @@ itemList = [ "xAOD::EventInfo#*" , "xAOD::EventAuxInfo#*" , "xAOD::FaserTriggerData#*" , "xAOD::FaserTriggerDataAux#*" - , "FaserSCT_RDO_Container#*" - , "Tracker::FaserSCT_ClusterContainer#*" + , "FaserSiHitCollection#*" # Strip hits, do we want this? + , "FaserSCT_RDO_Container#*" , "FaserSCT_SpacePointContainer#*" - #, "FaserSCT_SpacePointOverlapCollection#*" + , "Tracker::FaserSCT_ClusterContainer#*" , "TrackCollection#*" ] +# +if args.isMC: + # Add truth records here? + itemList.extend( ["McEventCollection#*"] ) + acc.merge(OutputStreamCfg(ConfigFlags, "xAOD", itemList)) # Waveform reconstruction output @@ -189,16 +216,9 @@ if not args.isMC: replicaSvc.UseGeomSQLite = True # Configure verbosity -# ConfigFlags.dump() +ConfigFlags.dump() if args.verbose: acc.foreach_component("*").OutputLevel = VERBOSE - - #acc.getService("FaserByteStreamInputSvc").DumpFlag = True - #acc.getService("FaserEventSelector").OutputLevel = VERBOSE - #acc.getService("FaserByteStreamInputSvc").OutputLevel = VERBOSE - #acc.getService("FaserByteStreamCnvSvc").OutputLevel = VERBOSE - #acc.getService("FaserByteStreamAddressProviderSvc").OutputLevel = VERBOSE - else: acc.foreach_component("*").OutputLevel = INFO @@ -213,5 +233,5 @@ b = time.time() from AthenaCommon.Logging import log log.info(f"Finish execution in {b-a} seconds") -sys.exit(int(sc.isFailure)) +sys.exit(int(sc.isFailure())) diff --git a/Control/CalypsoExample/Reconstruction/scripts/faser_reco.py b/Control/CalypsoExample/Reconstruction/scripts/faser_reco.py index 1579f4c1..2063b729 100755 --- a/Control/CalypsoExample/Reconstruction/scripts/faser_reco.py +++ b/Control/CalypsoExample/Reconstruction/scripts/faser_reco.py @@ -7,15 +7,18 @@ # 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 - optionally specify the data type (TI12Data, TI12Data02, or TestBeamData). +# runtype - optionally specify the data type (TI12Data, TI12Data02, TI12Data03 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 time import argparse +a = time.time() + parser = argparse.ArgumentParser(description="Run FASER reconstruction") parser.add_argument("file_path", @@ -28,8 +31,6 @@ 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)") parser.add_argument("--isMC", action='store_true', help="Running on digitised MC rather than data") @@ -95,6 +96,10 @@ ConfigFlags.IOVDb.DatabaseInstance = "OFLP200" # Use MC conditions for now ConfigFlags.Input.ProjectName = "data20" ConfigFlags.GeoModel.Align.Dynamic = False +useCKF = True +# Enable ACTS material corrections, this crashes testbeam geometries +ConfigFlags.TrackingGeometry.MaterialSource = "/cvmfs/faser.cern.ch/repo/sw/database/DBRelease/current/acts/material-maps.json" + # TI12 Cosmics geometry if runtype == "TI12Data": ConfigFlags.GeoModel.FaserVersion = "FASER-01" @@ -104,12 +109,18 @@ if runtype == "TI12Data": elif runtype == "TestBeamData" or runtype == "TestBeam2021": ConfigFlags.GeoModel.FaserVersion = "FASER-TB00" ConfigFlags.IOVDb.GlobalTag = "OFLCOND-FASER-TB00" + useCKF = False # New TI12 geometry (ugh) elif runtype == "TI12Data02": ConfigFlags.GeoModel.FaserVersion = "FASER-02" ConfigFlags.IOVDb.GlobalTag = "OFLCOND-FASER-02" +# Final 2022 TI12 geometry +elif runtype == "TI12Data03": + ConfigFlags.GeoModel.FaserVersion = "FASERNU-03" + ConfigFlags.IOVDb.GlobalTag = "OFLCOND-FASER-02" + else: print("Invalid run type found:", runtype) print("Specify correct type or update list") @@ -125,6 +136,7 @@ if len(args.reco) > 0: ConfigFlags.addFlag("Output.xAODFileName", f"{filestem}-xAOD.root") ConfigFlags.Output.ESDFileName = f"{filestem}-ESD.root" +ConfigFlags.Output.doWriteESD = False # # Play around with this? @@ -165,24 +177,32 @@ acc.merge(WaveformReconstructionCfg(ConfigFlags)) # Tracker clusters from TrackerPrepRawDataFormation.TrackerPrepRawDataFormationConfig import FaserSCT_ClusterizationCfg -acc.merge(FaserSCT_ClusterizationCfg(ConfigFlags)) +acc.merge(FaserSCT_ClusterizationCfg(ConfigFlags, DataObjectName="SCT_RDOs")) +# # SpacePoints from TrackerSpacePointFormation.TrackerSpacePointFormationConfig import TrackerSpacePointFinderCfg acc.merge(TrackerSpacePointFinderCfg(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)) +# Try Dave's new fitter +print("Configuring TrackerSegmentFit (new)") +from TrackerSegmentFit.TrackerSegmentFitConfig import SegmentFitAlgCfg +acc.merge(SegmentFitAlgCfg(ConfigFlags, + SharedHitFraction=0.61, + MinClustersPerFit=5, + TanThetaXZCut=0.083)) + +# Turn on CKF track finding +if useCKF: + # + # Ghost removal + from FaserActsKalmanFilter.GhostBustersConfig import GhostBustersCfg + acc.merge(GhostBustersCfg(ConfigFlags)) + + # + # Kalman Filter for tracking + from FaserActsKalmanFilter.CKF2Config import CKF2Cfg + acc.merge(CKF2Cfg(ConfigFlags, noDiagnostics=True)) # # Configure output @@ -191,12 +211,17 @@ itemList = [ "xAOD::EventInfo#*" , "xAOD::EventAuxInfo#*" , "xAOD::FaserTriggerData#*" , "xAOD::FaserTriggerDataAux#*" - , "FaserSCT_RDO_Container#*" - , "Tracker::FaserSCT_ClusterContainer#*" + , "FaserSiHitCollection#*" # Strip hits, do we want this? + , "FaserSCT_RDO_Container#*" , "FaserSCT_SpacePointContainer#*" - #, "FaserSCT_SpacePointOverlapCollection#*" + , "Tracker::FaserSCT_ClusterContainer#*" , "TrackCollection#*" ] +# +if args.isMC: + # Add truth records here? + itemList.extend( ["McEventCollection#*"] ) + acc.merge(OutputStreamCfg(ConfigFlags, "xAOD", itemList)) # Waveform reconstruction output @@ -223,13 +248,6 @@ if not args.isMC: # ConfigFlags.dump() if args.verbose: acc.foreach_component("*").OutputLevel = VERBOSE - - #acc.getService("FaserByteStreamInputSvc").DumpFlag = True - #acc.getService("FaserEventSelector").OutputLevel = VERBOSE - #acc.getService("FaserByteStreamInputSvc").OutputLevel = VERBOSE - #acc.getService("FaserByteStreamCnvSvc").OutputLevel = VERBOSE - #acc.getService("FaserByteStreamAddressProviderSvc").OutputLevel = VERBOSE - else: acc.foreach_component("*").OutputLevel = INFO @@ -238,4 +256,11 @@ acc.foreach_component("*ClassID*").OutputLevel = INFO acc.getService("MessageSvc").Format = "% F%40W%S%7W%R%T %0W%M" # Execute and finish -sys.exit(int(acc.run(maxEvents=args.nevents).isFailure())) +sc = acc.run(maxEvents=args.nevents) + +b = time.time() +from AthenaCommon.Logging import log +log.info(f"Finish execution in {b-a} seconds") + +sys.exit(int(sc.isFailure())) + diff --git a/Generators/FaserParticleGun/python/RadialPosSampler.py b/Generators/FaserParticleGun/python/RadialPosSampler.py index a0ae101c..814235e3 100644 --- a/Generators/FaserParticleGun/python/RadialPosSampler.py +++ b/Generators/FaserParticleGun/python/RadialPosSampler.py @@ -38,9 +38,12 @@ class RadialPosSampler(Sampler): sig = fwhm/(2 * sqrt(2 * log(2))) if self.radius < 0: - return random.uniform(0, abs(self.radius)) + return sqrt(random.uniform(0, abs(self.radius**2))) else: - return random.gauss(0, self.radius) + x = random.gauss(0, self.radius) + y = random.gauss(0, self.radius) + return sqrt(x**2 + y**2) + # return random.gauss(0, sig) @property diff --git a/Tracker/TrackerRecAlgs/TrackerPrepRawDataFormation/python/TrackerPrepRawDataFormationConfig.py b/Tracker/TrackerRecAlgs/TrackerPrepRawDataFormation/python/TrackerPrepRawDataFormationConfig.py index 8a620210..820cc73c 100644 --- a/Tracker/TrackerRecAlgs/TrackerPrepRawDataFormation/python/TrackerPrepRawDataFormationConfig.py +++ b/Tracker/TrackerRecAlgs/TrackerPrepRawDataFormation/python/TrackerPrepRawDataFormationConfig.py @@ -65,5 +65,6 @@ def FaserSCT_OutputCfg(flags): def FaserSCT_ClusterizationCfg(flags, **kwargs): """Return ComponentAccumulator for SCT Clusterization and Output""" acc = FaserSCT_ClusterizationBasicCfg(flags, **kwargs) - acc.merge(FaserSCT_OutputCfg(flags)) + if flags.Output.doWriteESD: + acc.merge(FaserSCT_OutputCfg(flags)) return acc diff --git a/Waveform/WaveRecTools/src/WaveformReconstructionTool.h b/Waveform/WaveRecTools/src/WaveformReconstructionTool.h index b23b60e9..45402ff5 100644 --- a/Waveform/WaveRecTools/src/WaveformReconstructionTool.h +++ b/Waveform/WaveRecTools/src/WaveformReconstructionTool.h @@ -105,7 +105,7 @@ class WaveformReconstructionTool: public extends<AthAlgTool, IWaveformReconstruc // // Fraction of peak to set local hit time - FloatProperty m_timingPeakFraction{this, "TimingPeakFraction", 0.5}; + FloatProperty m_timingPeakFraction{this, "TimingPeakFraction", 0.4}; // // When looking for secondary hits with a primary found above threshold -- GitLab