From f8df6fdc43153f783c1db5976998c2d93030666a Mon Sep 17 00:00:00 2001 From: Whitney Armstrong <warmstrong@anl.gov> Date: Tue, 17 Aug 2021 00:09:10 +0000 Subject: [PATCH] Cleanup of tracking benchmarks. * Removed all but one options file. * If you want to study seeding, then a "track_seeding" benchmark directory is more appropriate. * One options file per reconstruction benchmark is a good pattern to follow (not a hard rule). --- benchmarks/tracking/central_electrons.sh | 2 +- benchmarks/tracking/central_pions.sh | 2 +- benchmarks/tracking/config.yml | 18 +- benchmarks/tracking/multiple_tracks.sh | 2 +- .../options/imagingcluster_seeded_tracking.py | 191 ------------------ ...onstruction.py => track_reconstruction.py} | 18 +- .../tracking/options/truth_seeded_tracking.py | 143 ------------- .../tracking/run_tracking_benchmarks.py | 2 +- 8 files changed, 16 insertions(+), 362 deletions(-) delete mode 100644 benchmarks/tracking/options/imagingcluster_seeded_tracking.py rename benchmarks/tracking/options/{tracker_reconstruction.py => track_reconstruction.py} (94%) delete mode 100644 benchmarks/tracking/options/truth_seeded_tracking.py diff --git a/benchmarks/tracking/central_electrons.sh b/benchmarks/tracking/central_electrons.sh index 32f01d01..0e4df36d 100644 --- a/benchmarks/tracking/central_electrons.sh +++ b/benchmarks/tracking/central_electrons.sh @@ -97,7 +97,7 @@ rootls -t ${JUGGLER_SIM_FILE} if [[ -z "${ANALYSIS_ONLY}" ]] ; then # Need to figure out how to pass file name to juggler from the commandline - gaudirun.py benchmarks/tracking/options/tracker_reconstruction.py + xenv -x ${JUGGLER_INSTALL_PREFIX}/Juggler.xenv gaudirun.py benchmarks/tracking/options/track_reconstruction.py if [[ "$?" -ne "0" ]] ; then echo "ERROR running juggler" exit 1 diff --git a/benchmarks/tracking/central_pions.sh b/benchmarks/tracking/central_pions.sh index 214913fb..a4b724cf 100644 --- a/benchmarks/tracking/central_pions.sh +++ b/benchmarks/tracking/central_pions.sh @@ -96,7 +96,7 @@ rootls -t ${JUGGLER_SIM_FILE} if [[ -z "${ANALYSIS_ONLY}" ]] ; then # Need to figure out how to pass file name to juggler from the commandline - xenv -x ${JUGGLER_INSTALL_PREFIX}/Juggler.xenv gaudirun.py benchmarks/tracking/options/tracker_reconstruction.py + xenv -x ${JUGGLER_INSTALL_PREFIX}/Juggler.xenv gaudirun.py benchmarks/tracking/options/track_reconstruction.py if [[ "$?" -ne "0" ]] ; then echo "ERROR running juggler" exit 1 diff --git a/benchmarks/tracking/config.yml b/benchmarks/tracking/config.yml index a3305b4a..7bde4f11 100644 --- a/benchmarks/tracking/config.yml +++ b/benchmarks/tracking/config.yml @@ -26,25 +26,11 @@ tracking_truth_init_electrons: stage: run timeout: 24 hours script: - - python benchmarks/tracking/run_tracking_benchmarks.py --options truth_seeded_tracking.py --nametag=truth_electron --particle=electron --etamin=-3 --etamax=3 -n 100 + - python benchmarks/tracking/run_tracking_benchmarks.py --nametag=truth_electron --particle=electron --etamin=-3 --etamax=3 -n 100 tracking_truth_init_pions: extends: .rec_benchmark stage: run timeout: 24 hours script: - - python benchmarks/tracking/run_tracking_benchmarks.py --options truth_seeded_tracking.py --nametag=truth_pion --particle=pion+ --etamin=-3 --etamax=3 -n 100 - - #tracking_imclust_init_electrons: - # extends: .rec_benchmark - # stage: run - # timeout: 24 hours - # script: - # - python benchmarks/tracking/run_tracking_benchmarks.py --options imagingcluster_seeded_tracking.py --nametag=imclust_electron --particle=electron --etamin=-3 --etamax=3 -n 100 - # - #tracking_imclust_init_pions: - # extends: .rec_benchmark - # stage: run - # timeout: 24 hours - # script: - # - python benchmarks/tracking/run_tracking_benchmarks.py --options imagingcluster_seeded_tracking.py --nametag=imclust_pion --particle=pion+ --etamin=-3 --etamax=3 -n 100 + - python benchmarks/tracking/run_tracking_benchmarks.py --nametag=truth_pion --particle=pion+ --etamin=-3 --etamax=3 -n 100 diff --git a/benchmarks/tracking/multiple_tracks.sh b/benchmarks/tracking/multiple_tracks.sh index f048b43f..55cfa470 100644 --- a/benchmarks/tracking/multiple_tracks.sh +++ b/benchmarks/tracking/multiple_tracks.sh @@ -97,7 +97,7 @@ rootls -t ${JUGGLER_SIM_FILE} if [[ -z "${ANALYSIS_ONLY}" ]] ; then # Need to figure out how to pass file name to juggler from the commandline - gaudirun.py benchmarks/tracking/options/tracker_reconstruction.py + gaudirun.py benchmarks/tracking/options/track_reconstruction.py if [[ "$?" -ne "0" ]] ; then echo "ERROR running juggler" exit 1 diff --git a/benchmarks/tracking/options/imagingcluster_seeded_tracking.py b/benchmarks/tracking/options/imagingcluster_seeded_tracking.py deleted file mode 100644 index 58faeb74..00000000 --- a/benchmarks/tracking/options/imagingcluster_seeded_tracking.py +++ /dev/null @@ -1,191 +0,0 @@ -from Gaudi.Configuration import * - -from Configurables import ApplicationMgr, EICDataSvc, PodioOutput, GeoSvc -from GaudiKernel.SystemOfUnits import MeV, GeV, mm, cm, mrad - -detector_name = str(os.environ.get("JUGGLER_DETECTOR", "athena")) -detector_path = str(os.environ.get("JUGGLER_DETECTOR_PATH", ".")) -compact_path = str(os.environ.get("JUGGLER_COMPACT_PATH", "{}.xml".format(os.path.join(detector_path, detector_name)))) - -# CAL reconstruction -# get sampling fractions from system environment variable, 1.0 by default -cb_ecal_sf = float(os.environ.get("CB_ECAL_SAMP_FRAC", 0.01324)) - -# todo add checks -input_sims = [f.strip() for f in str.split(os.environ["JUGGLER_SIM_FILE"], ",") if f.strip()] -output_rec = str(os.environ["JUGGLER_REC_FILE"]) -n_events = int(os.environ["JUGGLER_N_EVENTS"]) - -geo_service = GeoSvc("GeoSvc", detectors=[compact_path], OutputLevel=WARNING) -podioevent = EICDataSvc("EventDataSvc", inputs=input_sims, OutputLevel=WARNING) - -from Configurables import PodioInput -from Configurables import Jug__Digi__UFSDTrackerDigi as TrackerDigi -from Configurables import Jug__Reco__TrackerHitReconstruction as TrackerReco - -from Configurables import Jug__Reco__TrackerSourceLinker as TrackerSourceLinker -from Configurables import Jug__Reco__TrackerSourcesLinker as TrackerSourcesLinker -#from Configurables import Jug__Reco__TrackingHitsSourceLinker as TrackingHitsSourceLinker -from Configurables import Jug__Reco__TrackParamImagingClusterInit as TrackParamImagingClusterInit - -from Configurables import Jug__Reco__TrackFindingAlgorithm as TrackFindingAlgorithm -from Configurables import Jug__Reco__ParticlesFromTrackFit as ParticlesFromTrackFit -from Configurables import Jug__Base__InputCopier_dd4pod__Geant4ParticleCollection_dd4pod__Geant4ParticleCollection_ as MCCopier - -from Configurables import Jug__Digi__CalorimeterHitDigi as CalHitDigi -from Configurables import Jug__Reco__ImagingPixelReco as ImCalPixelReco -from Configurables import Jug__Reco__ImagingTopoCluster as ImagingCluster -from Configurables import Jug__Reco__ImagingClusterReco as ImagingClusterReco - - -sim_colls = [ - "mcparticles", - "TrackerEndcapHits", - "TrackerBarrelHits", - "VertexBarrelHits", - "VertexEndcapHits", - "EcalBarrelHits", - "GEMTrackerEndcapHits" -] -podin = PodioInput("PodioReader", collections=sim_colls) -podout = PodioOutput("out", filename=output_rec) - -## copiers to get around input --> output copy bug. Note the "2" appended to the output collection. -mccopier = MCCopier("MCCopier", - inputCollection="mcparticles", - outputCollection="mcparticles2") - -trk_b_digi = TrackerDigi("trk_b_digi", - inputHitCollection="TrackerBarrelHits", - outputHitCollection="TrackerBarrelRawHits", - timeResolution=8) -trk_ec_digi = TrackerDigi("trk_ec_digi", - inputHitCollection="TrackerEndcapHits", - outputHitCollection="TrackerEndcapRawHits", - timeResolution=8) - -vtx_b_digi = TrackerDigi("vtx_b_digi", - inputHitCollection="VertexBarrelHits", - outputHitCollection="VertexBarrelRawHits", - timeResolution=8) - -vtx_ec_digi = TrackerDigi("vtx_ec_digi", - inputHitCollection="VertexEndcapHits", - outputHitCollection="VertexEndcapRawHits", - timeResolution=8) - -gem_ec_digi = TrackerDigi("gem_ec_digi", - inputHitCollection="GEMTrackerEndcapHits", - outputHitCollection="GEMTrackerEndcapRawHits", - timeResolution=10) - -# Tracker and vertex reconstruction -trk_b_reco = TrackerReco("trk_b_reco", - inputHitCollection = trk_b_digi.outputHitCollection, - outputHitCollection="TrackerBarrelRecHits") - -trk_ec_reco = TrackerReco("trk_ec_reco", - inputHitCollection = trk_ec_digi.outputHitCollection, - outputHitCollection="TrackerEndcapRecHits") - -vtx_b_reco = TrackerReco("vtx_b_reco", - inputHitCollection = vtx_b_digi.outputHitCollection, - outputHitCollection="VertexBarrelRecHits") - -vtx_ec_reco = TrackerReco("vtx_ec_reco", - inputHitCollection = vtx_ec_digi.outputHitCollection, - outputHitCollection="VertexEndcapRecHits") - -gem_ec_reco = TrackerReco("gem_ec_reco", - inputHitCollection=gem_ec_digi.outputHitCollection, - outputHitCollection="GEMTrackerEndcapRecHits") - -sourcelinker = TrackerSourcesLinker("trk_srcslnkr", - inputHitCollections=["VertexBarrelRecHits", "TrackerBarrelRecHits"], - outputSourceLinks="TrackerSourceLinks", - outputMeasurements="TrackerMeasurements", - OutputLevel=DEBUG) - -# Central Barrel Ecal (Imaging Cal.) -cb_ecal_daq = dict( - dynamicRangeADC=3*MeV, - capacityADC=8192, - pedestalMean=400, - pedestalSigma=20) # about 6 keV - -cb_ecal_digi = CalHitDigi("cb_ecal_digi", - inputHitCollection="EcalBarrelHits", - outputHitCollection="EcalBarrelHitsDigi", - energyResolutions=[0., 0.02, 0.], # 2% flat resolution - **cb_ecal_daq) - -cb_ecal_reco = ImCalPixelReco("cb_ecal_reco", - inputHitCollection=cb_ecal_digi.outputHitCollection, - outputHitCollection="EcalBarrelHitsReco", - thresholdFactor=3, # about 20 keV - readoutClass="EcalBarrelHits", # readout class - layerField="layer", # field to get layer id - sectorField="module", # field to get sector id - **cb_ecal_daq) - -cb_ecal_cl = ImagingCluster("cb_ecal_cl", - inputHitCollection=cb_ecal_reco.outputHitCollection, - outputProtoClusterCollection="EcalBarrelProtoClusters", - localDistXY=[2.*mm, 2*mm], # same layer - layerDistEtaPhi=[10*mrad, 10*mrad], # adjacent layer - neighbourLayersRange=2, # id diff for adjacent layer - sectorDist=3.*cm) # different sector - -cb_ecal_clreco = ImagingClusterReco("cb_ecal_clreco", - samplingFraction=cb_ecal_sf, - inputHitCollection=cb_ecal_cl.inputHitCollection, - inputProtoClusterCollection=cb_ecal_cl.outputProtoClusterCollection, - outputClusterCollection="EcalBarrelClusters", - outputInfoCollection="EcalBarrelClustersInfo", - outputLayerCollection="EcalBarrelLayers") - -## Track param init -imclust_trk_init = TrackParamImagingClusterInit("imclust_trk_init", - inputClusters="EcalBarrelClusters", - outputInitialTrackParameters="InitTrackParams", - OutputLevel=DEBUG) - -# Tracking algorithms -trk_find_alg = TrackFindingAlgorithm("trk_find_alg", - inputSourceLinks = sourcelinker.outputSourceLinks, - inputMeasurements = sourcelinker.outputMeasurements, - inputInitialTrackParameters= imclust_trk_init.outputInitialTrackParameters, - outputTrajectories="trajectories", - OutputLevel=DEBUG) - -parts_from_fit = ParticlesFromTrackFit("parts_from_fit", - inputTrajectories=trk_find_alg.outputTrajectories, - outputParticles="ReconstructedParticles", - outputTrackParameters="outputTrackParameters", - OutputLevel=DEBUG) - -podout.outputCommands = [ - "keep *", - "drop InitTrackParams", - "drop trajectories", - "drop outputSourceLinks", - "drop outputInitialTrackParameters", - "drop mcparticles", -] - -ApplicationMgr( - TopAlg = [podin, mccopier, - trk_b_digi, trk_ec_digi, vtx_b_digi, vtx_ec_digi, gem_ec_digi, - trk_b_reco, trk_ec_reco, vtx_b_reco, vtx_ec_reco, gem_ec_reco, - cb_ecal_digi, cb_ecal_reco, cb_ecal_cl, cb_ecal_clreco, - sourcelinker, - imclust_trk_init, - trk_find_alg, parts_from_fit, - podout - ], - EvtSel = 'NONE', - EvtMax = n_events, - ExtSvc = [podioevent, geo_service], - OutputLevel=WARNING - ) - diff --git a/benchmarks/tracking/options/tracker_reconstruction.py b/benchmarks/tracking/options/track_reconstruction.py similarity index 94% rename from benchmarks/tracking/options/tracker_reconstruction.py rename to benchmarks/tracking/options/track_reconstruction.py index aeb5ee36..b657a008 100644 --- a/benchmarks/tracking/options/tracker_reconstruction.py +++ b/benchmarks/tracking/options/track_reconstruction.py @@ -29,7 +29,7 @@ from Configurables import Jug__Digi__UFSDTrackerDigi as TrackerDigi from Configurables import Jug__Digi__EMCalorimeterDigi as EMCalorimeterDigi from Configurables import Jug__Reco__TrackerHitReconstruction as TrackerHitReconstruction -from Configurables import Jug__Reco__TrackingHitsCollector as TrackingHitsCollector +from Configurables import Jug__Reco__TrackingHitsCollector2 as TrackingHitsCollector from Configurables import Jug__Reco__TrackerSourceLinker as TrackerSourceLinker from Configurables import Jug__Reco__TrackerSourcesLinker as TrackerSourcesLinker @@ -118,17 +118,19 @@ gem_ec_reco = TrackerHitReconstruction("gem_ec_reco", algorithms.append(gem_ec_reco) trk_hit_col = TrackingHitsCollector("trk_hit_col", - trackerBarrelHits=trk_b_reco.outputHitCollection, - trackerEndcapHits=trk_ec_reco.outputHitCollection, - vertexBarrelHits=vtx_b_reco.outputHitCollection, - vertexEndcapHits=vtx_ec_reco.outputHitCollection, - gemEndcapHits=gem_ec_reco.outputHitCollection, - outputHitCollection="trackingHits") + inputTrackingHits=[ + str(trk_b_reco.outputHitCollection), + str(trk_ec_reco.outputHitCollection), + str(vtx_b_reco.outputHitCollection), + str(vtx_ec_reco.outputHitCollection), + str(gem_ec_reco.outputHitCollection) ], + trackingHits="trackingHits", + OutputLevel=DEBUG) algorithms.append( trk_hit_col ) # Hit Source linker sourcelinker = TrackerSourceLinker("sourcelinker", - inputHitCollection=trk_hit_col.outputHitCollection, + inputHitCollection=trk_hit_col.trackingHits, outputSourceLinks="TrackSourceLinks", outputMeasurements="TrackMeasurements", OutputLevel=DEBUG) diff --git a/benchmarks/tracking/options/truth_seeded_tracking.py b/benchmarks/tracking/options/truth_seeded_tracking.py deleted file mode 100644 index 194d0693..00000000 --- a/benchmarks/tracking/options/truth_seeded_tracking.py +++ /dev/null @@ -1,143 +0,0 @@ -from Gaudi.Configuration import * - -from Configurables import ApplicationMgr, EICDataSvc, PodioOutput, GeoSvc -from GaudiKernel.SystemOfUnits import MeV, GeV, mm, cm, mrad - -detector_name = str(os.environ.get("JUGGLER_DETECTOR", "athena")) -detector_path = str(os.environ.get("JUGGLER_DETECTOR_PATH", ".")) -compact_path = str(os.environ.get("JUGGLER_COMPACT_PATH", "{}.xml".format(os.path.join(detector_path, detector_name)))) - -# todo add checks -input_sims = [f.strip() for f in str.split(os.environ["JUGGLER_SIM_FILE"], ",") if f.strip()] -output_rec = str(os.environ["JUGGLER_REC_FILE"]) -n_events = int(os.environ["JUGGLER_N_EVENTS"]) - -geo_service = GeoSvc("GeoSvc", detectors=[compact_path], OutputLevel=WARNING) -podioevent = EICDataSvc("EventDataSvc", inputs=input_sims, OutputLevel=WARNING) - -from Configurables import PodioInput -from Configurables import Jug__Digi__UFSDTrackerDigi as TrackerDigi -from Configurables import Jug__Reco__TrackerHitReconstruction as TrackerReco - -from Configurables import Jug__Reco__TrackerSourceLinker as TrackerSourceLinker -from Configurables import Jug__Reco__TrackerSourcesLinker as TrackerSourcesLinker -#from Configurables import Jug__Reco__TrackingHitsSourceLinker as TrackingHitsSourceLinker -from Configurables import Jug__Reco__TrackParamTruthInit as TrackParamTruthInit - -from Configurables import Jug__Reco__TrackFindingAlgorithm as TrackFindingAlgorithm -from Configurables import Jug__Reco__ParticlesFromTrackFit as ParticlesFromTrackFit -from Configurables import Jug__Base__InputCopier_dd4pod__Geant4ParticleCollection_dd4pod__Geant4ParticleCollection_ as MCCopier - - -sim_colls = [ - "mcparticles", - "TrackerEndcapHits", - "TrackerBarrelHits", - "VertexBarrelHits", - "VertexEndcapHits", - "EcalBarrelHits", - "GEMTrackerEndcapHits" -] -podin = PodioInput("PodioReader", collections=sim_colls) -podout = PodioOutput("out", filename=output_rec) - -## copiers to get around input --> output copy bug. Note the "2" appended to the output collection. -mccopier = MCCopier("MCCopier", - inputCollection="mcparticles", - outputCollection="mcparticles2") - -trk_b_digi = TrackerDigi("trk_b_digi", - inputHitCollection="TrackerBarrelHits", - outputHitCollection="TrackerBarrelRawHits", - timeResolution=8) -trk_ec_digi = TrackerDigi("trk_ec_digi", - inputHitCollection="TrackerEndcapHits", - outputHitCollection="TrackerEndcapRawHits", - timeResolution=8) - -vtx_b_digi = TrackerDigi("vtx_b_digi", - inputHitCollection="VertexBarrelHits", - outputHitCollection="VertexBarrelRawHits", - timeResolution=8) - -vtx_ec_digi = TrackerDigi("vtx_ec_digi", - inputHitCollection="VertexEndcapHits", - outputHitCollection="VertexEndcapRawHits", - timeResolution=8) - -gem_ec_digi = TrackerDigi("gem_ec_digi", - inputHitCollection="GEMTrackerEndcapHits", - outputHitCollection="GEMTrackerEndcapRawHits", - timeResolution=10) - -# Tracker and vertex reconstruction -trk_b_reco = TrackerReco("trk_b_reco", - inputHitCollection = trk_b_digi.outputHitCollection, - outputHitCollection="TrackerBarrelRecHits") - -trk_ec_reco = TrackerReco("trk_ec_reco", - inputHitCollection = trk_ec_digi.outputHitCollection, - outputHitCollection="TrackerEndcapRecHits") - -vtx_b_reco = TrackerReco("vtx_b_reco", - inputHitCollection = vtx_b_digi.outputHitCollection, - outputHitCollection="VertexBarrelRecHits") - -vtx_ec_reco = TrackerReco("vtx_ec_reco", - inputHitCollection = vtx_ec_digi.outputHitCollection, - outputHitCollection="VertexEndcapRecHits") - -gem_ec_reco = TrackerReco("gem_ec_reco", - inputHitCollection=gem_ec_digi.outputHitCollection, - outputHitCollection="GEMTrackerEndcapRecHits") - -sourcelinker = TrackerSourcesLinker("trk_srcslnkr", - inputHitCollections=["VertexBarrelRecHits", "TrackerBarrelRecHits"], - outputSourceLinks="TrackerSourceLinks", - outputMeasurements="TrackerMeasurements", - OutputLevel=DEBUG) - -## Track param init -truth_trk_init = TrackParamTruthInit("truth_trk_init", - inputMCParticles="mcparticles", - outputInitialTrackParameters="InitTrackParams", - OutputLevel=DEBUG) - -# Tracking algorithms -trk_find_alg = TrackFindingAlgorithm("trk_find_alg", - inputSourceLinks = sourcelinker.outputSourceLinks, - inputMeasurements = sourcelinker.outputMeasurements, - inputInitialTrackParameters= truth_trk_init.outputInitialTrackParameters, - outputTrajectories="trajectories", - OutputLevel=DEBUG) - -parts_from_fit = ParticlesFromTrackFit("parts_from_fit", - inputTrajectories=trk_find_alg.outputTrajectories, - outputParticles="ReconstructedParticles", - outputTrackParameters="outputTrackParameters", - OutputLevel=DEBUG) - -podout.outputCommands = [ - "keep *", - "drop InitTrackParams", - "drop trajectories", - "drop outputSourceLinks", - "drop outputInitialTrackParameters", - "drop mcparticles", -] - -ApplicationMgr( - TopAlg = [podin, mccopier, - trk_b_digi, trk_ec_digi, vtx_b_digi, vtx_ec_digi, gem_ec_digi, - trk_b_reco, trk_ec_reco, vtx_b_reco, vtx_ec_reco, gem_ec_reco, - sourcelinker, - truth_trk_init, - trk_find_alg, parts_from_fit, - podout - ], - EvtSel = 'NONE', - EvtMax = n_events, - ExtSvc = [podioevent, geo_service], - OutputLevel=WARNING - ) - diff --git a/benchmarks/tracking/run_tracking_benchmarks.py b/benchmarks/tracking/run_tracking_benchmarks.py index cfe4f8ec..b0576b1f 100755 --- a/benchmarks/tracking/run_tracking_benchmarks.py +++ b/benchmarks/tracking/run_tracking_benchmarks.py @@ -28,7 +28,7 @@ parser.add_argument('--etamax', type=float, default=4, help='Maximum pseudorapid parser.add_argument('--pmin', type=float, default=5.0, help='Minimum momentum of particles (GeV).') parser.add_argument('--pmax', type=float, default=5.0, help='Maximum momentum of particles (GeV).') parser.add_argument('--compact', type=str, default=default_compact, help='Path to detector compact file.') -parser.add_argument('--options', type=str, default='truth_seeded_tracking.py', help='Path to reconstruction options script.') +parser.add_argument('--options', type=str, default='track_reconstruction.py', help='Path to reconstruction options script.') parser.add_argument('--uploadSizeLimit', type=float, default=10, help='Upper limit of file size (Mb) to be uploaded.') args = parser.parse_args() -- GitLab