From b3364b3ada61fc97b80cdf756d57a6397bd455a7 Mon Sep 17 00:00:00 2001 From: Sylvester Joosten <sjoosten@anl.gov> Date: Tue, 19 Oct 2021 15:40:22 +0000 Subject: [PATCH] Prepare detector benchmarks to be used with truly different detector versions --- README.md | 9 +- .../options/track_reconstruction.py | 66 +++++++--- .../options/track_reconstruction.py | 68 ++++++++--- .../tracking/options/track_reconstruction.py | 113 ++++++++++-------- 4 files changed, 166 insertions(+), 90 deletions(-) diff --git a/README.md b/README.md index c957880e..91de2697 100644 --- a/README.md +++ b/README.md @@ -11,21 +11,20 @@ Reconstruction Benchmarks for the EIC Here we setup to use our local build of the `juggler` library. First set some environment variables. ``` -export JUGGLER_INSTALL_PREFIX=$HOME/stow/juggler +export JUGGLER_INSTALL_PREFIX=/usr/local export JUGGLER_DETECTOR=athena # athena is the default export BEAMLINE_CONFIG=ip6 # ip6 is the default ``` + ``` -git@eicweb.phy.anl.gov:EIC/benchmarks/reconstruction_benchmarks.git && cd reconstruction_benchmarks +git clone https://eicweb.phy.anl.gov/EIC/benchmarks/reconstruction_benchmarks.git && cd reconstruction_benchmarks git clone https://eicweb.phy.anl.gov/EIC/benchmarks/common_bench.git setup source setup/bin/env.sh && ./setup/bin/install_common.sh source .local/bin/env.sh && build_detector.sh mkdir_local_data_link sim_output -mkdir -p results -mkdir -p config - +mkdir -p results config ``` diff --git a/benchmarks/track_finding/options/track_reconstruction.py b/benchmarks/track_finding/options/track_reconstruction.py index 1b428cc4..884ccaf0 100644 --- a/benchmarks/track_finding/options/track_reconstruction.py +++ b/benchmarks/track_finding/options/track_reconstruction.py @@ -5,11 +5,17 @@ from GaudiKernel import SystemOfUnits as units detector_name = "topside" if "JUGGLER_DETECTOR" in os.environ : - detector_name = str(os.environ["JUGGLER_DETECTOR"]) + detector_name = str(os.environ["JUGGLER_DETECTOR"]) detector_path = "" if "DETECTOR_PATH" in os.environ : - detector_path = str(os.environ["DETECTOR_PATH"]) + detector_path = str(os.environ["DETECTOR_PATH"]) + +detector_version = 'default' +if "JUGGLER_DETECTOR_VERSION" in os.environ: + env_version = str(os.environ["JUGGLER_DETECTOR_VERSION"]) + if 'acadia' in env_version: + detector_version = 'acadia' # todo add checks input_sim_file = str(os.environ["JUGGLER_SIM_FILE"]) @@ -40,8 +46,13 @@ from Configurables import Jug__Reco__SimpleClustering as SimpleClustering algorithms = [ ] +input_collections = ['mcparticles','TrackerEndcapHits','TrackerBarrelHits','VertexBarrelHits','GEMTrackerEndcapHits'] +if 'acadia' in detector_version: + input_collections.append('VertexEndcapHits') +else: + input_collections.append('MPGDTrackerBarrelHits') podioinput = PodioInput("PodioReader", - collections=["mcparticles","TrackerEndcapHits","TrackerBarrelHits","VertexBarrelHits","VertexEndcapHits","GEMTrackerEndcapHits"]) + collections=input_collections)#, OutputLevel=DEBUG) algorithms.append( podioinput ) trk_b_digi = TrackerDigi("trk_b_digi", @@ -61,11 +72,18 @@ vtx_b_digi = TrackerDigi("vtx_b_digi", timeResolution=8) algorithms.append( vtx_b_digi ) -vtx_ec_digi = TrackerDigi("vtx_ec_digi", - inputHitCollection="VertexEndcapHits", - outputHitCollection="VertexEndcapRawHits", - timeResolution=8) -algorithms.append( vtx_ec_digi ) +if 'acadia' in detector_version: + vtx_ec_digi = TrackerDigi("vtx_ec_digi", + inputHitCollection="VertexEndcapHits", + outputHitCollection="VertexEndcapRawHits", + timeResolution=8) + algorithms.append( vtx_ec_digi ) +else: + mm_b_digi = TrackerDigi("mm_b_digi", + inputHitCollection="MPGDTrackerBarrelHits", + outputHitCollection="MPGDTrackerBarrelRawHits", + timeResolution=8) + algorithms.append( mm_b_digi ) gem_ec_digi = TrackerDigi("gem_ec_digi", inputHitCollection="GEMTrackerEndcapHits", @@ -89,23 +107,35 @@ vtx_b_reco = TrackerHitReconstruction("vtx_b_reco", outputHitCollection="VertexBarrelRecHits") algorithms.append( vtx_b_reco ) -vtx_ec_reco = TrackerHitReconstruction("vtx_ec_reco", - inputHitCollection = vtx_ec_digi.outputHitCollection, - outputHitCollection="VertexEndcapRecHits") -algorithms.append( vtx_ec_reco ) +if 'acadia' in detector_version: + vtx_ec_reco = TrackerHitReconstruction("vtx_ec_reco", + inputHitCollection = vtx_ec_digi.outputHitCollection, + outputHitCollection="VertexEndcapRecHits") + algorithms.append( vtx_ec_reco ) +else: + mm_b_reco = TrackerHitReconstruction("mm_b_reco", + inputHitCollection = mm_b_digi.outputHitCollection, + outputHitCollection="MPGDTrackerBarrelRecHits") + algorithms.append( mm_b_reco ) + gem_ec_reco = TrackerHitReconstruction("gem_ec_reco", inputHitCollection=gem_ec_digi.outputHitCollection, outputHitCollection="GEMTrackerEndcapRecHits") algorithms.append(gem_ec_reco) +input_tracking_hits = [ + str(trk_b_reco.outputHitCollection), + str(trk_ec_reco.outputHitCollection), + str(vtx_b_reco.outputHitCollection), + str(gem_ec_reco.outputHitCollection) ] +if 'acadia' in detector_version: + input_tracking_hits.append(str(vtx_ec_reco.outputHitCollection)) +else: + input_tracking_hits.append(str(mm_b_reco.outputHitCollection)) + trk_hit_col = TrackingHitsCollector("trk_hit_col", - 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) ], + inputTrackingHits=input_tracking_hits, trackingHits="trackingHits", OutputLevel=DEBUG) algorithms.append( trk_hit_col ) diff --git a/benchmarks/track_fitting/options/track_reconstruction.py b/benchmarks/track_fitting/options/track_reconstruction.py index fa6613a1..9622ba89 100644 --- a/benchmarks/track_fitting/options/track_reconstruction.py +++ b/benchmarks/track_fitting/options/track_reconstruction.py @@ -5,11 +5,17 @@ from GaudiKernel import SystemOfUnits as units detector_name = "athena" if "JUGGLER_DETECTOR" in os.environ : - detector_name = str(os.environ["JUGGLER_DETECTOR"]) + detector_name = str(os.environ["JUGGLER_DETECTOR"]) detector_path = "" if "DETECTOR_PATH" in os.environ : - detector_path = str(os.environ["DETECTOR_PATH"]) + detector_path = str(os.environ["DETECTOR_PATH"]) + +detector_version = 'default' +if "JUGGLER_DETECTOR_VERSION" in os.environ: + env_version = str(os.environ["JUGGLER_DETECTOR_VERSION"]) + if 'acadia' in env_version: + detector_version = 'acadia' # todo add checks input_sim_file = str(os.environ["JUGGLER_SIM_FILE"]) @@ -40,8 +46,13 @@ from Configurables import Jug__Reco__SimpleClustering as SimpleClustering algorithms = [ ] +input_collections = ['mcparticles','TrackerEndcapHits','TrackerBarrelHits','VertexBarrelHits','GEMTrackerEndcapHits'] +if 'acadia' in detector_version: + input_collections.append('VertexEndcapHits') +else: + input_collections.append('MPGDTrackerBarrelHits') podioinput = PodioInput("PodioReader", - collections=["mcparticles","TrackerEndcapHits","TrackerBarrelHits","VertexBarrelHits","VertexEndcapHits","GEMTrackerEndcapHits"])#, OutputLevel=DEBUG) + collections=input_collections)#, OutputLevel=DEBUG) algorithms.append( podioinput ) trk_b_digi = TrackerDigi("trk_b_digi", @@ -61,11 +72,18 @@ vtx_b_digi = TrackerDigi("vtx_b_digi", timeResolution=8) algorithms.append( vtx_b_digi ) -vtx_ec_digi = TrackerDigi("vtx_ec_digi", - inputHitCollection="VertexEndcapHits", - outputHitCollection="VertexEndcapRawHits", - timeResolution=8) -algorithms.append( vtx_ec_digi ) +if 'acadia' in detector_version: + vtx_ec_digi = TrackerDigi("vtx_ec_digi", + inputHitCollection="VertexEndcapHits", + outputHitCollection="VertexEndcapRawHits", + timeResolution=8) + algorithms.append( vtx_ec_digi ) +else: + mm_b_digi = TrackerDigi("mm_b_digi", + inputHitCollection="MPGDTrackerBarrelHits", + outputHitCollection="MPGDTrackerBarrelRawHits", + timeResolution=8) + algorithms.append( mm_b_digi ) gem_ec_digi = TrackerDigi("gem_ec_digi", inputHitCollection="GEMTrackerEndcapHits", @@ -89,24 +107,36 @@ vtx_b_reco = TrackerHitReconstruction("vtx_b_reco", outputHitCollection="VertexBarrelRecHits") algorithms.append( vtx_b_reco ) -vtx_ec_reco = TrackerHitReconstruction("vtx_ec_reco", - inputHitCollection = vtx_ec_digi.outputHitCollection, - outputHitCollection="VertexEndcapRecHits") -algorithms.append( vtx_ec_reco ) +if 'acadia' in detector_version: + vtx_ec_reco = TrackerHitReconstruction("vtx_ec_reco", + inputHitCollection = vtx_ec_digi.outputHitCollection, + outputHitCollection="VertexEndcapRecHits") + algorithms.append( vtx_ec_reco ) +else: + mm_b_reco = TrackerHitReconstruction("mm_b_reco", + inputHitCollection = mm_b_digi.outputHitCollection, + outputHitCollection="MPGDTrackerBarrelRecHits") + algorithms.append( mm_b_reco ) gem_ec_reco = TrackerHitReconstruction("gem_ec_reco", inputHitCollection=gem_ec_digi.outputHitCollection, outputHitCollection="GEMTrackerEndcapRecHits") algorithms.append(gem_ec_reco) +input_tracking_hits = [ + str(trk_b_reco.outputHitCollection), + str(trk_ec_reco.outputHitCollection), + str(vtx_b_reco.outputHitCollection), + str(gem_ec_reco.outputHitCollection) ] +if 'acadia' in detector_version: + input_tracking_hits.append(str(vtx_ec_reco.outputHitCollection)) +else: + input_tracking_hits.append(str(mm_b_reco.outputHitCollection)) + trk_hit_col = TrackingHitsCollector("trk_hit_col", - inputTrackingHits=[ - str(vtx_b_reco.outputHitCollection), - str(vtx_ec_reco.outputHitCollection), - str(trk_b_reco.outputHitCollection), - str(trk_ec_reco.outputHitCollection), - str(gem_ec_reco.outputHitCollection) ], - trackingHits="trackingHits") + inputTrackingHits=input_tracking_hits, + trackingHits="trackingHits", + OutputLevel=DEBUG) algorithms.append( trk_hit_col ) # Hit Source linker diff --git a/benchmarks/tracking/options/track_reconstruction.py b/benchmarks/tracking/options/track_reconstruction.py index f00989d4..9bb3e294 100644 --- a/benchmarks/tracking/options/track_reconstruction.py +++ b/benchmarks/tracking/options/track_reconstruction.py @@ -5,21 +5,34 @@ from GaudiKernel import SystemOfUnits as units detector_name = "topside" if "JUGGLER_DETECTOR" in os.environ : - detector_name = str(os.environ["JUGGLER_DETECTOR"]) + detector_name = str(os.environ["JUGGLER_DETECTOR"]) detector_path = "" if "DETECTOR_PATH" in os.environ : - detector_path = str(os.environ["DETECTOR_PATH"]) + detector_path = str(os.environ["DETECTOR_PATH"]) + +detector_version = 'default' +if "JUGGLER_DETECTOR_VERSION" in os.environ: + env_version = str(os.environ["JUGGLER_DETECTOR_VERSION"]) + if 'acadia' in env_version: + detector_version = 'acadia' # todo add checks input_sim_file = str(os.environ["JUGGLER_SIM_FILE"]) output_rec_file = str(os.environ["JUGGLER_REC_FILE"]) n_events = str(os.environ["JUGGLER_N_EVENTS"]) -geo_service = GeoSvc("GeoSvc", - detectors=["{}/{}.xml".format(detector_path,detector_name)], - materials="config/material-maps.json", - OutputLevel=WARNING) +## only have material maps for acadia right now +if detector_version == 'acadia': + geo_service = GeoSvc("GeoSvc", + detectors=["{}/{}.xml".format(detector_path,detector_name)], + materials="config/material-maps.json", + OutputLevel=WARNING) +else: + geo_service = GeoSvc("GeoSvc", + detectors=["{}/{}.xml".format(detector_path,detector_name)], + #materials="config/material-maps.json", + OutputLevel=WARNING) podioevent = EICDataSvc("EventDataSvc", inputs=[input_sim_file], OutputLevel=WARNING) from Configurables import PodioInput @@ -43,8 +56,13 @@ from Configurables import Jug__Reco__SimpleClustering as SimpleClustering algorithms = [ ] +input_collections = ['mcparticles','TrackerEndcapHits','TrackerBarrelHits','VertexBarrelHits','GEMTrackerEndcapHits'] +if 'acadia' in detector_version: + input_collections.append('VertexEndcapHits') +else: + input_collections.append('MPGDTrackerBarrelHits') podioinput = PodioInput("PodioReader", - collections=["mcparticles","TrackerEndcapHits","TrackerBarrelHits","VertexBarrelHits","VertexEndcapHits","GEMTrackerEndcapHits"])#, OutputLevel=DEBUG) + collections=input_collections)#, OutputLevel=DEBUG) algorithms.append( podioinput ) trk_b_digi = TrackerDigi("trk_b_digi", @@ -64,11 +82,18 @@ vtx_b_digi = TrackerDigi("vtx_b_digi", timeResolution=8) algorithms.append( vtx_b_digi ) -vtx_ec_digi = TrackerDigi("vtx_ec_digi", - inputHitCollection="VertexEndcapHits", - outputHitCollection="VertexEndcapRawHits", - timeResolution=8) -algorithms.append( vtx_ec_digi ) +if 'acadia' in detector_version: + vtx_ec_digi = TrackerDigi("vtx_ec_digi", + inputHitCollection="VertexEndcapHits", + outputHitCollection="VertexEndcapRawHits", + timeResolution=8) + algorithms.append( vtx_ec_digi ) +else: + mm_b_digi = TrackerDigi("mm_b_digi", + inputHitCollection="MPGDTrackerBarrelHits", + outputHitCollection="MPGDTrackerBarrelRawHits", + timeResolution=8) + algorithms.append( mm_b_digi ) gem_ec_digi = TrackerDigi("gem_ec_digi", inputHitCollection="GEMTrackerEndcapHits", @@ -92,25 +117,36 @@ vtx_b_reco = TrackerHitReconstruction("vtx_b_reco", outputHitCollection="VertexBarrelRecHits") algorithms.append( vtx_b_reco ) -vtx_ec_reco = TrackerHitReconstruction("vtx_ec_reco", - inputHitCollection = vtx_ec_digi.outputHitCollection, - outputHitCollection="VertexEndcapRecHits") -algorithms.append( vtx_ec_reco ) +if 'acadia' in detector_version: + vtx_ec_reco = TrackerHitReconstruction("vtx_ec_reco", + inputHitCollection = vtx_ec_digi.outputHitCollection, + outputHitCollection="VertexEndcapRecHits") + algorithms.append( vtx_ec_reco ) +else: + mm_b_reco = TrackerHitReconstruction("mm_b_reco", + inputHitCollection = mm_b_digi.outputHitCollection, + outputHitCollection="MPGDTrackerBarrelRecHits") + algorithms.append( mm_b_reco ) gem_ec_reco = TrackerHitReconstruction("gem_ec_reco", inputHitCollection=gem_ec_digi.outputHitCollection, outputHitCollection="GEMTrackerEndcapRecHits") algorithms.append(gem_ec_reco) +input_tracking_hits = [ + str(trk_b_reco.outputHitCollection), + str(trk_ec_reco.outputHitCollection), + str(vtx_b_reco.outputHitCollection), + str(gem_ec_reco.outputHitCollection) ] +if 'acadia' in detector_version: + input_tracking_hits.append(str(vtx_ec_reco.outputHitCollection)) +else: + input_tracking_hits.append(str(mm_b_reco.outputHitCollection)) + trk_hit_col = TrackingHitsCollector("trk_hit_col", - 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) ], + inputTrackingHits=input_tracking_hits, trackingHits="trackingHits", - OutputLevel=DEBUG) + OutputLevel=VERBOSE) algorithms.append( trk_hit_col ) # Hit Source linker @@ -118,23 +154,23 @@ sourcelinker = TrackerSourceLinker("sourcelinker", inputHitCollection=trk_hit_col.trackingHits, outputSourceLinks="TrackSourceLinks", outputMeasurements="TrackMeasurements", - OutputLevel=DEBUG) + OutputLevel=VERBOSE) algorithms.append( sourcelinker ) ## Track param init truth_trk_init = TrackParamTruthInit("truth_trk_init", inputMCParticles="mcparticles", - outputInitialTrackParameters="InitTrackParams") - #OutputLevel=DEBUG) + outputInitialTrackParameters="InitTrackParams", + OutputLevel=VERBOSE) algorithms.append( truth_trk_init ) # Tracking algorithms trk_find_alg = TrackFindingAlgorithm("trk_find_alg", inputSourceLinks = sourcelinker.outputSourceLinks, inputMeasurements = sourcelinker.outputMeasurements, - inputInitialTrackParameters= "InitTrackParams",#"InitTrackParamsFromClusters", - outputTrajectories="trajectories") - #OutputLevel=DEBUG) + inputInitialTrackParameters= "InitTrackParams", + outputTrajectories="trajectories", + OutputLevel=VERBOSE) algorithms.append( trk_find_alg ) parts_from_fit = ParticlesFromTrackFit("parts_from_fit", @@ -150,24 +186,6 @@ outputTrajectoryParameters = "outputTrajectoryParameters") #OutputLevel=DEBUG) algorithms.append(trajs_from_fit) -#types = [] -## this printout is useful to check that the type information is passed to python correctly -#print("---------------------------------------\n") -#print("---\n# List of input and output types by class") -#for configurable in sorted([ PodioInput, EICDataSvc, PodioOutput, -# TrackerHitReconstruction,ExampleCaloDigi, -# UFSDTrackerDigi, TrackerSourceLinker, -# PodioOutput], -# key=lambda c: c.getType()): -# print("\"{}\":".format(configurable.getType())) -# props = configurable.getDefaultProperties() -# for propname, prop in sorted(props.items()): -# print(" prop name: {}".format(propname)) -# if isinstance(prop, DataHandleBase): -# types.append(prop.type()) -# print(" {}: \"{}\"".format(propname, prop.type())) -#print("---") - out = PodioOutput("out", filename=output_rec_file) out.outputCommands = ["keep *", "drop BarrelTrackSourceLinks", @@ -186,4 +204,3 @@ ApplicationMgr( ExtSvc = [podioevent,geo_service], OutputLevel=WARNING ) - -- GitLab