Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update tracking to use Acts v36.0 #1454

Merged
merged 54 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
f1ccef8
move acts to v36 and required ldmx::tracking code changes, ldmx-sw bu…
bloodyyugo Aug 14, 2024
85cfe4e
remove now non-existent acts component from linking
tomeichlersmith Aug 14, 2024
356047a
v36 is building, linking, running and give resonable results. Still …
bloodyyugo Aug 20, 2024
c6ce7b8
forgot a couple of changes to MeasurementCalibrator
bloodyyugo Aug 20, 2024
08fb5ad
fix up CKF so that it makes everything for ldmx::track; GSF builds bu…
bloodyyugo Aug 24, 2024
19e4e54
Once in a while CKFProcessor crashes when it cant extrapolate to targ…
bloodyyugo Aug 27, 2024
7a1a2ac
Add back a block I accidently deleted
bloodyyugo Aug 28, 2024
8a77993
adapted GSF for v36 and added tagger/recoil flexibility
EBerzin Aug 29, 2024
3688575
move acts to v36 and required ldmx::tracking code changes, ldmx-sw bu…
bloodyyugo Aug 14, 2024
181a274
remove now non-existent acts component from linking
tomeichlersmith Aug 14, 2024
7eb0f96
v36 is building, linking, running and give resonable results. Still …
bloodyyugo Aug 20, 2024
c30bd8c
forgot a couple of changes to MeasurementCalibrator
bloodyyugo Aug 20, 2024
ded9895
fix up CKF so that it makes everything for ldmx::track; GSF builds bu…
bloodyyugo Aug 24, 2024
650968f
Once in a while CKFProcessor crashes when it cant extrapolate to targ…
bloodyyugo Aug 27, 2024
8aa69a3
Add back a block I accidently deleted
bloodyyugo Aug 28, 2024
d0af2ab
adapted GSF for v36 and added tagger/recoil flexibility
EBerzin Aug 29, 2024
b38ac17
Merge branch 'actsv36.0' of github.com:LDMX-Software/ldmx-sw into act…
tvami Aug 30, 2024
0b0e445
add new plots and ranges to dqm
bloodyyugo Aug 30, 2024
5e098b0
Merge branch 'trunk' into actsv36.0
bloodyyugo Sep 4, 2024
273906a
update the example reco so that it actually works right
bloodyyugo Sep 13, 2024
89b61e0
clang_format and some other cleanup
bloodyyugo Sep 13, 2024
2cb03b6
Merge branch 'actsv36.0' of github.com:LDMX-Software/ldmx-sw into act…
bloodyyugo Sep 13, 2024
9d3b6b1
Merge branch 'trunk' into actsv36.0
bloodyyugo Sep 13, 2024
6939ab4
clang-format checker didnt like my comment for some reason
bloodyyugo Sep 13, 2024
1739cdb
merge trunk again
bloodyyugo Sep 14, 2024
c4c6e2b
damn formatting
bloodyyugo Sep 14, 2024
e1af10f
Update Tracking/include/Tracking/Reco/DigitizationProcessor.h
bloodyyugo Sep 14, 2024
b658406
Update Tracking/include/Tracking/Reco/GSFProcessor.h
bloodyyugo Sep 14, 2024
5041665
Update Tracking/include/Tracking/Sim/MeasurementCalibrator.h
bloodyyugo Sep 14, 2024
b127dc6
Update Tracking/python/tracking.py
bloodyyugo Sep 14, 2024
5bcbb32
Update Tracking/include/Tracking/Reco/TruthSeedProcessor.h
bloodyyugo Sep 14, 2024
c34e7d7
Update Tracking/src/Tracking/Reco/CKFProcessor.cxx
bloodyyugo Sep 14, 2024
6f82fdf
Update Tracking/include/Tracking/Sim/MeasurementCalibrator.h
bloodyyugo Sep 14, 2024
1e5bed4
Update Tracking/include/Tracking/Sim/MeasurementCalibrator.h
bloodyyugo Sep 14, 2024
974c04d
Update Tracking/include/Tracking/Sim/MeasurementCalibrator.h
bloodyyugo Sep 14, 2024
f28dcb7
Update Tracking/include/Tracking/Sim/MeasurementCalibrator.h
bloodyyugo Sep 14, 2024
8a8d2cd
Update Tracking/src/Tracking/Reco/CKFProcessor.cxx
bloodyyugo Sep 14, 2024
a764456
Update Tracking/src/Tracking/Reco/SeedFinderProcessor.cxx
bloodyyugo Sep 14, 2024
3f722a4
Update Tracking/include/Tracking/Reco/TrackExtrapolatorTool.h
bloodyyugo Sep 14, 2024
c0fa81c
Update Tracking/include/Tracking/Reco/TrackExtrapolatorTool.h
bloodyyugo Sep 14, 2024
571af65
Update Tracking/include/Tracking/Reco/TrackExtrapolatorTool.h
bloodyyugo Sep 14, 2024
5c4113b
Update Tracking/include/Tracking/Reco/TrackExtrapolatorTool.h
bloodyyugo Sep 14, 2024
776dbbd
Update Tracking/include/Tracking/Reco/TrackExtrapolatorTool.h
bloodyyugo Sep 14, 2024
7a9ff1d
Update Tracking/src/Tracking/Reco/Vertexer.cxx
bloodyyugo Sep 14, 2024
358e15a
Update Tracking/src/Tracking/Reco/VertexProcessor.cxx
bloodyyugo Sep 14, 2024
0b4de1f
Update Tracking/src/Tracking/Reco/Vertexer.cxx
bloodyyugo Sep 14, 2024
cdf353c
Update Tracking/src/Tracking/Reco/CKFProcessor.cxx
bloodyyugo Sep 14, 2024
31c7fdd
Update Tracking/src/Tracking/Reco/CKFProcessor.cxx
bloodyyugo Sep 14, 2024
376d912
Update Tracking/src/Tracking/Reco/CKFProcessor.cxx
bloodyyugo Sep 14, 2024
b55a7aa
add typename to make it clearer
bloodyyugo Sep 14, 2024
791b84f
formatting and unused variable changes. Hopefully I didnt screw this up
bloodyyugo Sep 14, 2024
35f4685
clean up some comments from tvami. Probably some more clang-format i…
bloodyyugo Sep 14, 2024
11d98d3
a few more changes for clang-format
bloodyyugo Sep 15, 2024
733d0c1
add specific measurement_collection to pn validation config
bloodyyugo Sep 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/validation_samples/ecal_pn/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@
seed_recoil_dqm.title = ""

recoil_dqm = tkdqm.TrackingRecoDQM("RecoilTrackerDQM")
recoil_dqm.measurement_collection=digi_recoil.out_collection
recoil_dqm.buildHistograms()
recoil_dqm.track_collection = tracking_recoil.out_trk_collection
recoil_dqm.truth_collection = "RecoilTruthTracks"
Expand Down
13 changes: 4 additions & 9 deletions Tracking/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,11 @@ if(BUILD_EVENT_ONLY)
endif()

# since ACTS changes frequently enough, we build it as a submodule of Tracking
# here we 'set' some CMake variables that we would have passed to 'cmake' on
# here we could 'set' some CMake variables that we would have passed to 'cmake' on
# the command line with '-D' if we were building ACTS directly.
#set(ACTS_BUILD_PLUGIN_DD4HEP ON) # representing geometry with DD4hep right now
#set(ACTS_BUILD_PLUGIN_TGEO ON) # representing geometry with DD4hep right now
set(ACTS_BUILD_PLUGIN_IDENTIFICATION ON) #This turns on the identiers
set(ACTS_BUILD_EXAMPLES OFF) # don't waste time building examples
set(CMAKE_CXX_STANDARD 17) # set C++ standard we use within ldmx-sw
add_subdirectory(acts) # now build acts
#add_subdirectory(acts-dd4hep)
# for example, disable the building of examples (which is already disabled by default)
#set(ACTS_BUILD_EXAMPLES OFF) # don't waste time building examples
add_subdirectory(acts) # now build acts
# luckily for us, adding ACTS as a subdirectory produces the same CMake targets
# as find_package, so we don't need to do anything else from here on out

Expand All @@ -79,7 +75,6 @@ setup_library(module Tracking
dependencies Framework::Configure
Framework::Framework
ActsCore
ActsPluginIdentification
Geant4::Interface
ROOT::Physics
Tracking::Event
Expand Down
2 changes: 1 addition & 1 deletion Tracking/acts
Submodule acts updated 2789 files
162 changes: 89 additions & 73 deletions Tracking/exampleConfigs/reco.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

import os,math
from LDMX.Framework import ldmxcfg
from LDMX.SimCore import generators
from LDMX.SimCore import simulator

p = ldmxcfg.Process("TrackerReco")

Expand All @@ -14,21 +16,33 @@
# From the conditions
from LDMX.Tracking import geo

n_evts=1000 #number of events to gen/reco

# set up a simple particle gun for this example #
# just 8gev electrons started upstream of tagger and first ts #
partGunString='single_8gev_e_upstream_tagger'
detector = 'ldmx-det-v14-8gev-no-cals'
#### set up beam simulation
sim = simulator.simulator('inclusive_single_8gev')
sim.setDetector(detector,include_scoring_planes = True)
sim.description = 'A single 8gev electron shot from upstream of the 8gev tagger.'
sim.beamSpotSmear = [20., 80., 0]
particle_gun = generators.single_8gev_e_upstream_tagger()
sim.generators.append(particle_gun)
#### end beam simulation

# Truth seeder
# Runs truth tracking producing tracks from target scoring plane hits for Recoil
# and generated electros for Tagger.
# Truth tracks can be used for assessing tracking performance or using as seeds
truth_tracking = tracking.TruthSeedProcessor()
truth_tracking.debug = True
truth_tracking.trk_coll_name = "RecoilTruthSeeds"
truth_tracking.pdgIDs = [11]
truth_tracking.scoring_hits = "TargetScoringPlaneHits"
truth_tracking.z_min = 0.
truth_tracking.track_id = -1
truth_tracking.p_cut = 0.05 # In MeV
truth_tracking.pz_cut = 0.03
truth_tracking.p_cutEcal = 0. # In MeV
truth_tracking = tracking.TruthSeedProcessor("TruthSeeds")
truth_tracking.debug = False
#truth_tracking.trk_coll_name = "RecoilTruthSeeds"
#truth_tracking.pdgIDs = [11]
#truth_tracking.scoring_hits = "TargetScoringPlaneHits"
#truth_tracking.z_min = 0.
#truth_tracking.track_id = -1
#truth_tracking.p_cut = 0.05 # In MeV


# These smearing quantities are default. We expect around 6um hit resolution in bending plane
Expand All @@ -41,20 +55,20 @@
# Smearing Processor - Tagger
# Runs G4 hit smearing producing measurements in the Tagger tracker.
# Hits that belong to the same sensor with the same trackID are merged together to reduce combinatorics
digiTagger = tracking.DigitizationProcessor("DigitizationProcessor")
digiTagger.hit_collection = "TaggerSimHits"
digiTagger.out_collection = "DigiTaggerSimHits"
digiTagger.merge_hits = True
digiTagger.sigma_u = uSmearing
digiTagger.sigma_v = vSmearing
digi_tagger = tracking.DigitizationProcessor("DigitizationProcessor")
digi_tagger.hit_collection = "TaggerSimHits"
digi_tagger.out_collection = "DigiTaggerSimHits"
digi_tagger.merge_hits = True
digi_tagger.sigma_u = uSmearing
digi_tagger.sigma_v = vSmearing

# Smearing Processor - Recoil
digiRecoil = tracking.DigitizationProcessor("DigitizationProcessorRecoil")
digiRecoil.hit_collection = "RecoilSimHits"
digiRecoil.out_collection = "DigiRecoilSimHits"
digiRecoil.merge_hits = True
digiRecoil.sigma_u = uSmearing
digiRecoil.sigma_v = vSmearing
digi_recoil = tracking.DigitizationProcessor("DigitizationProcessorRecoil")
digi_recoil.hit_collection = "RecoilSimHits"
digi_recoil.out_collection = "DigiRecoilSimHits"
digi_recoil.merge_hits = True
digi_recoil.sigma_u = uSmearing
digi_recoil.sigma_v = vSmearing


# Seed Finder Tagger
Expand All @@ -63,25 +77,26 @@
# parameters and the impact parameters at the target or generation point. For the tagger one should look
# for compatibility with the beam orbit / beam spot

seederTagger = tracking.SeedFinderProcessor()
seederTagger.input_hits_collection = digiTagger.out_collection
seederTagger.out_seed_collection = "TaggerRecoSeeds"
seederTagger.pmin = 2.
seederTagger.pmax = 8.
seederTagger.d0min = -60.
seederTagger.d0max = 0.
seeder_tagger = tracking.SeedFinderProcessor("SeedTagger")
seeder_tagger.input_hits_collection = digi_tagger.out_collection
seeder_tagger.out_seed_collection = "TaggerRecoSeeds"
seeder_tagger.pmin = 0.1
seeder_tagger.pmax = 10.0
seeder_tagger.d0min = -45.
seeder_tagger.d0max = 45.
seeder_tagger.z0max = 60.

#Seed finder processor - Recoil
seederRecoil = tracking.SeedFinderProcessor("SeedRecoil")
seederRecoil.perigee_location = [0.,0.,0.]
seederRecoil.input_hits_collection = digiRecoil.out_collection
seederRecoil.out_seed_collection = "RecoilRecoSeeds"
seederRecoil.bfield = 1.5
seederRecoil.pmin = 0.1
seederRecoil.pmax = 4.
seederRecoil.d0min = -0.5
seederRecoil.d0max = 0.5
seederRecoil.z0max = 10.
seeder_recoil = tracking.SeedFinderProcessor("SeedRecoil")
seeder_recoil.perigee_location = [0.,0.,0.]
seeder_recoil.input_hits_collection = digi_recoil.out_collection
seeder_recoil.out_seed_collection = "RecoilRecoSeeds"
seeder_recoil.bfield = 1.5
seeder_recoil.pmin = 0.1
seeder_recoil.pmax = 10.0
seeder_recoil.d0min = -40.0
seeder_recoil.d0max = 40.0
seeder_recoil.z0max = 50.


# Producer for running the CKF track finding starting from the found seeds.
Expand All @@ -93,14 +108,14 @@
tracking_tagger.const_b_field = False

#Target location for the CKF extrapolation
tracking_tagger.seed_coll_name = seederTagger.out_seed_collection
tracking_tagger.seed_coll_name = seeder_tagger.out_seed_collection
tracking_tagger.out_trk_collection = "TaggerTracks"

#smear the hits used for finding/fitting
tracking_tagger.trackID = -1 #1
tracking_tagger.pdgID = -9999 #11
tracking_tagger.measurement_collection = digiTagger.out_collection
tracking_tagger.min_hits = 5
tracking_tagger.measurement_collection = digi_tagger.out_collection
tracking_tagger.min_hits = 6


#CKF Options
Expand All @@ -110,73 +125,74 @@
tracking_recoil.propagator_step_size = 1000. #mm
tracking_recoil.bfield = -1.5 #in T #From looking at the BField map
tracking_recoil.const_b_field = False

tracking_recoil.taggerTracking=False
#Target location for the CKF extrapolation
#tracking_recoil.seed_coll_name = seederRecoil.out_seed_collection
#tracking_recoil.seed_coll_name = seeder_recoil.out_seed_collection
tracking_recoil.seed_coll_name = "RecoilTruthSeeds"
tracking_recoil.out_trk_collection = "RecoilTracks"

#smear the hits used for finding/fitting
tracking_recoil.trackID = -1 #1
tracking_recoil.pdgID = -9999 #11
tracking_recoil.measurement_collection = digiRecoil.out_collection
tracking_recoil.min_hits = 5
tracking_recoil.measurement_collection = digi_recoil.out_collection
tracking_recoil.min_hits = 6


from LDMX.Tracking import dqm
digi_dqm = dqm.TrackerDigiDQM()
tracking_dqm = dqm.TrackingRecoDQM()

seed_tagger_dqm = dqm.TrackingRecoDQM("SeedTaggerDQM")
seed_tagger_dqm.track_collection = seeder_tagger.out_seed_collection
seed_tagger_dqm.truth_collection = "TaggerTruthTracks"
seed_tagger_dqm.title = ""
seed_tagger_dqm.buildHistograms()

tagger_dqm = dqm.TrackingRecoDQM("TaggerDQM")
tagger_dqm.track_collection = tracking_tagger.out_trk_collection
tagger_dqm.truth_collection = "TaggerTruthTracks"
tagger_dqm.trackStates = ["target"]
tagger_dqm.title = ""
tagger_dqm.measurement_collection=digi_tagger.out_collection
tagger_dqm.truth_hit_collection="TaggerSimHits"
tagger_dqm.buildHistograms()


seed_recoil_dqm = dqm.TrackingRecoDQM("SeedRecoilDQM")
seed_recoil_dqm.track_collection = seederRecoil.out_seed_collection
seed_recoil_dqm.track_collection = seeder_recoil.out_seed_collection
seed_recoil_dqm.truth_collection = "RecoilTruthTracks"
seed_recoil_dqm.title = ""
seed_recoil_dqm.buildHistograms()

recoil_dqm = dqm.TrackingRecoDQM("RecoilDQM")
recoil_dqm.track_collection = tracking_recoil.out_trk_collection
recoil_dqm.truth_collection = "RecoilTruthTracks"
recoil_dqm.trackStates = ["ecal","target"]
recoil_dqm.title = ""
recoil_dqm.measurement_collection=digi_recoil.out_collection
recoil_dqm.truth_hit_collection="RecoilSimHits"
recoil_dqm.buildHistograms()

# This sequence runs the digitization in the tagger and recoil
# Then the truth tracking to have TruthTracks in the final state
# the nominal seeding is ran on the tagger and recoil
# Track finding is then raun in the tagger and in the recoil
# Finally two dqm examples are run in the recoil tracks and using the seed tracks

p.sequence = [digiTagger, digiRecoil,
truth_tracking,
seederTagger, seederRecoil,
p.sequence = [sim,truth_tracking,digi_tagger, digi_recoil,
seeder_tagger, seeder_recoil,
tracking_tagger, tracking_recoil,
recoil_dqm, seed_recoil_dqm]

# The input file to be added.
# for now, we just take the first argument on the command line
import sys
p.inputFiles = [sys.argv[1]]

# Example about how to drop some of the collections in the output file.
p.keep = [
# "drop .*SimHits.*", #drop all sim hits
"drop .*Ecal.*", #drop all ecal (Digis are not removed)
# "drop .*Magnet*",
"drop .*Hcal.*",
"drop .*Scoring.*",
"drop .*SimParticles.*",
"drop .*TriggerPad.*",
"drop .*trig.*"
]
recoil_dqm, seed_recoil_dqm,
tagger_dqm, seed_tagger_dqm]

# Output name
# just append '_withTracking' to the name of the input file
from pathlib import Path
input_filepath = Path(p.inputFiles[0])
p.outputFiles = [str(input_filepath.with_suffix(''))+'_withTracking.root']
p.outputFiles = ['test_8gev_electrons_withTracking.root']

# lower log level so 'info' and above messages can be printed
p.termLogLevel=1

# Number of events
p.maxEvents = 10000
p.maxEvents = n_evts

# Where to store DQM plots
p.histogramFile = "test_dqmMonitoringFile.root"
Expand Down
24 changes: 10 additions & 14 deletions Tracking/include/Tracking/Reco/CKFProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include "Acts/Definitions/TrackParametrization.hpp"
#include "Acts/Definitions/Units.hpp"
#include "Acts/EventData/TrackParameters.hpp"
#include "Acts/EventData/detail/TransformationFreeToBound.hpp"
#include "Acts/Utilities/Logger.hpp"

// geometry
Expand Down Expand Up @@ -76,22 +75,17 @@

//--- Interpolated magnetic field ---//
#include "Tracking/Sim/BFieldXYZUtils.h"
// mg Aug 2024 not sure if these are needed...
using Updater = Acts::GainMatrixUpdater;
using Smoother = Acts::GainMatrixSmoother;

using ActionList =
Acts::ActionList<Acts::detail::SteppingLogger, Acts::MaterialInteractor>;
using AbortList = Acts::AbortList<Acts::EndOfWorldReached>;

using CkfPropagator = Acts::Propagator<Acts::EigenStepper<>, Acts::Navigator>;
using GsfPropagator = Acts::Propagator<
Acts::MultiEigenStepperLoop<
Acts::StepperExtensionList<
Acts::detail::GenericDefaultExtension<double>>,
Acts::WeightedComponentReducerLoop, Acts::detail::VoidAuctioneer>,
Acts::Navigator>;

//?!
// using PropagatorOptions =
// Acts::DenseStepperPropagatorOptions<ActionList, AbortList>;
using TrackContainer = Acts::TrackContainer<Acts::VectorTrackContainer,
Acts::VectorMultiTrajectory>;

namespace tracking {
namespace reco {
Expand Down Expand Up @@ -161,8 +155,10 @@ class CKFProcessor final : public TrackingGeometryUser {
// time profiling
std::map<std::string, double> profiling_map_;

bool debug_{false};
bool debug_acts_{false};

std::shared_ptr<Acts::PlaneSurface> target_surface;
Acts::RotationMatrix3 surf_rotation;
// Constant BField
double bfield_{0};
// Use constant bfield
Expand Down Expand Up @@ -209,8 +205,8 @@ class CKFProcessor final : public TrackingGeometryUser {
std::unique_ptr<const CkfPropagator> propagator_;

// The CKF
std::unique_ptr<const Acts::CombinatorialKalmanFilter<
CkfPropagator, Acts::VectorMultiTrajectory>>
std::unique_ptr<
const Acts::CombinatorialKalmanFilter<CkfPropagator, TrackContainer>>
ckf_;

// Track Extrapolator Tool
Expand Down
Loading