diff --git a/Core/include/Acts/TrackFitting/detail/KalmanUpdateHelpers.hpp b/Core/include/Acts/TrackFitting/detail/KalmanUpdateHelpers.hpp index 1fb7edbde9c..3a11fddbd5d 100644 --- a/Core/include/Acts/TrackFitting/detail/KalmanUpdateHelpers.hpp +++ b/Core/include/Acts/TrackFitting/detail/KalmanUpdateHelpers.hpp @@ -99,8 +99,7 @@ auto kalmanHandleMeasurement( } else { ACTS_VERBOSE( "Filtering step successful. But measurement is determined " - "to " - "be an outlier. Stepping state is not updated.") + "to be an outlier. Stepping state is not updated.") // Set the outlier type flag typeFlags.set(TrackStateFlag::OutlierFlag); trackStateProxy.shareFrom(trackStateProxy, TrackStatePropMask::Predicted, diff --git a/Examples/Algorithms/TruthTracking/ActsExamples/TruthTracking/ParticleSmearing.cpp b/Examples/Algorithms/TruthTracking/ActsExamples/TruthTracking/ParticleSmearing.cpp index cfb3a1d63e1..58bfdd77d50 100644 --- a/Examples/Algorithms/TruthTracking/ActsExamples/TruthTracking/ParticleSmearing.cpp +++ b/Examples/Algorithms/TruthTracking/ActsExamples/TruthTracking/ParticleSmearing.cpp @@ -87,7 +87,7 @@ ActsExamples::ProcessCode ActsExamples::ParticleSmearing::execute( ACTS_VERBOSE("Smearing particle (pos, time, phi, theta, q/p):"); ACTS_VERBOSE(" from: " << particle.position().transpose() << ", " << time - << "," << phi << "," << theta << "," + << ", " << phi << ", " << theta << ", " << (q != 0 ? q / p : 1 / p)); ACTS_VERBOSE(" to: " << perigee ->localToGlobal( @@ -96,9 +96,9 @@ ActsExamples::ProcessCode ActsExamples::ParticleSmearing::execute( params[Acts::eBoundLoc1]}, particle.unitDirection() * p) .transpose() - << ", " << params[Acts::eBoundTime] << "," - << params[Acts::eBoundPhi] << "," - << params[Acts::eBoundTheta] << "," + << ", " << params[Acts::eBoundTime] << ", " + << params[Acts::eBoundPhi] << ", " + << params[Acts::eBoundTheta] << ", " << params[Acts::eBoundQOverP]); // build the track covariance matrix using the smearing sigmas diff --git a/Examples/Detectors/GenericDetector/include/ActsExamples/GenericDetector/GenericDetectorElement.hpp b/Examples/Detectors/GenericDetector/include/ActsExamples/GenericDetector/GenericDetectorElement.hpp index b90214086f4..647ad3848ee 100644 --- a/Examples/Detectors/GenericDetector/include/ActsExamples/GenericDetector/GenericDetectorElement.hpp +++ b/Examples/Detectors/GenericDetector/include/ActsExamples/GenericDetector/GenericDetectorElement.hpp @@ -71,7 +71,7 @@ class GenericDetectorElement : public Acts::IdentifiedDetectorElement { /// Identifier Identifier identifier() const final; - /// Return local to global transform associated with this identifier + /// Return local to global transform associated with this detector element /// /// @param gctx The current geometry context object, e.g. alignment /// @@ -80,7 +80,7 @@ class GenericDetectorElement : public Acts::IdentifiedDetectorElement { const Acts::Transform3& transform( const Acts::GeometryContext& gctx) const override; - /// Return surface associated with this identifier, + /// Return surface associated with this detector element const Acts::Surface& surface() const override; /// Set the identifier after construction (sometimes needed) diff --git a/Examples/Io/Root/include/ActsExamples/Io/Root/RootMeasurementWriter.hpp b/Examples/Io/Root/include/ActsExamples/Io/Root/RootMeasurementWriter.hpp index 6df2600ec4b..9e1123003a8 100644 --- a/Examples/Io/Root/include/ActsExamples/Io/Root/RootMeasurementWriter.hpp +++ b/Examples/Io/Root/include/ActsExamples/Io/Root/RootMeasurementWriter.hpp @@ -213,16 +213,12 @@ class RootMeasurementWriter final : public WriterT { Acts::BoundSymMatrix fullVar = m.expander() * m.covariance() * m.expander().transpose(); - varBound[Acts::eBoundLoc0] = - std::sqrt(fullVar(Acts::eBoundLoc0, Acts::eBoundLoc0)); - varBound[Acts::eBoundLoc1] = - std::sqrt(fullVar(Acts::eBoundLoc1, Acts::eBoundLoc1)); - varBound[Acts::eBoundPhi] = - std::sqrt(fullVar(Acts::eBoundPhi, Acts::eBoundPhi)); + varBound[Acts::eBoundLoc0] = fullVar(Acts::eBoundLoc0, Acts::eBoundLoc0); + varBound[Acts::eBoundLoc1] = fullVar(Acts::eBoundLoc1, Acts::eBoundLoc1); + varBound[Acts::eBoundPhi] = fullVar(Acts::eBoundPhi, Acts::eBoundPhi); varBound[Acts::eBoundTheta] = - std::sqrt(fullVar(Acts::eBoundTheta, Acts::eBoundTheta)); - varBound[Acts::eBoundTime] = - std::sqrt(fullVar(Acts::eBoundTime, Acts::eBoundTime)); + fullVar(Acts::eBoundTheta, Acts::eBoundTheta); + varBound[Acts::eBoundTime] = fullVar(Acts::eBoundTime, Acts::eBoundTime); } /// Convenience function to fill the cluster information diff --git a/Examples/Python/python/acts/examples/simulation.py b/Examples/Python/python/acts/examples/simulation.py index 6e6f55337e4..2c22465cb90 100644 --- a/Examples/Python/python/acts/examples/simulation.py +++ b/Examples/Python/python/acts/examples/simulation.py @@ -579,7 +579,7 @@ def addGeant4( the output folder for the Root output, None triggers no output """ - from acts.examples.geant4 import Geant4Simulation, geant4SimulationConfig + from acts.examples.geant4 import Geant4Simulation, makeGeant4SimulationConfig customLogLevel = acts.examples.defaultLogging(s, logLevel) @@ -600,9 +600,10 @@ def addGeant4( raise AttributeError("detector not given") g4detectorConstruction = getG4DetectorContruction(detector) - g4conf = geant4SimulationConfig( + g4conf = makeGeant4SimulationConfig( level=customLogLevel(), detector=g4detectorConstruction, + randomNumbers=rnd, inputParticles=particles_selected, trackingGeometry=trackingGeometry, magneticField=field, @@ -612,7 +613,6 @@ def addGeant4( g4conf.outputSimHits = "simhits" g4conf.outputParticlesInitial = "particles_initial" g4conf.outputParticlesFinal = "particles_final" - g4conf.randomNumbers = rnd # Simulation alg = Geant4Simulation( diff --git a/Examples/Python/src/Geant4Component.cpp b/Examples/Python/src/Geant4Component.cpp index 46f3d3dbf8f..d976ee8d9ab 100644 --- a/Examples/Python/src/Geant4Component.cpp +++ b/Examples/Python/src/Geant4Component.cpp @@ -81,31 +81,37 @@ PYBIND11_MODULE(ActsPythonBindingsGeant4, mod) { eventActions, trackingActions, steppingActions, detectorConstruction, magneticField, sensitiveSurfaceMapper); - mod.def( - "materialRecordingConfig", - [](Acts::Logging::Level level, G4VUserDetectorConstruction* detector, + auto makeGeant4Config = + [](Acts::Logging::Level& level, std::shared_ptr randomNumbers, - const std::string& inputParticles, - const std::string& outputMaterialTracks) { - // The Geant4 actions needed - std::vector runActions = {}; - std::vector eventActions = {}; - std::vector trackingActions = {}; - - // Set the main Geant4 algorithm, primary generation, detector - // construction - Geant4Simulation::Config g4Cfg; - g4Cfg.randomNumbers = std::move(randomNumbers); - g4Cfg.runManager = std::make_shared(); - g4Cfg.runManager->SetUserInitialization(new MaterialPhysicsList( - Acts::getDefaultLogger("MaterialPhysicsList", level))); + G4VUserDetectorConstruction* detector, G4VUserPhysicsList* physicsList, + const SimParticleTranslation::Config& prCfg) + -> Geant4Simulation::Config { + Geant4Simulation::Config g4Cfg; - MaterialSteppingAction::Config mStepCfg; - mStepCfg.excludeMaterials = {"Air", "Vacuum"}; - std::vector steppingActions = { - new MaterialSteppingAction( - mStepCfg, - Acts::getDefaultLogger("MaterialSteppingAction", level))}; + // Set the main Geant4 algorithm, primary generation, detector + // construction + g4Cfg.randomNumbers = std::move(randomNumbers); + g4Cfg.runManager = std::make_shared(); + g4Cfg.runManager->SetUserInitialization(physicsList); + + // Set the primarty generator + g4Cfg.primaryGeneratorAction = new SimParticleTranslation( + prCfg, Acts::getDefaultLogger("SimParticleTranslation", level)); + g4Cfg.detectorConstruction = detector; + + return g4Cfg; + }; + + mod.def( + "makeGeant4MaterialRecordingConfig", + [makeGeant4Config]( + Acts::Logging::Level level, G4VUserDetectorConstruction* detector, + std::shared_ptr randomNumbers, + const std::string& inputParticles, + const std::string& outputMaterialTracks) { + auto physicsList = new MaterialPhysicsList( + Acts::getDefaultLogger("MaterialPhysicsList", level)); // Read the particle from the generator SimParticleTranslation::Config g4PrCfg; @@ -113,19 +119,18 @@ PYBIND11_MODULE(ActsPythonBindingsGeant4, mod) { g4PrCfg.forceParticle = true; g4PrCfg.forcedMass = 0.; g4PrCfg.forcedPdgCode = 999; - // Set the material tracks at output - g4Cfg.outputMaterialTracks = outputMaterialTracks; - // Set the primarty generator - g4Cfg.primaryGeneratorAction = new SimParticleTranslation( - g4PrCfg, Acts::getDefaultLogger("SimParticleTranslation", level)); - g4Cfg.detectorConstruction = detector; + auto g4Cfg = makeGeant4Config(level, std::move(randomNumbers), detector, + physicsList, g4PrCfg); + + MaterialSteppingAction::Config mStepCfg; + mStepCfg.excludeMaterials = {"Air", "Vacuum"}; + auto steppingAction = new MaterialSteppingAction( + mStepCfg, Acts::getDefaultLogger("MaterialSteppingAction", level)); + g4Cfg.steppingActions = {steppingAction}; - // Set the user actions - g4Cfg.runActions = runActions; - g4Cfg.eventActions = eventActions; - g4Cfg.trackingActions = trackingActions; - g4Cfg.steppingActions = steppingActions; + // Set the material tracks at output + g4Cfg.outputMaterialTracks = outputMaterialTracks; return g4Cfg; }, @@ -133,54 +138,36 @@ PYBIND11_MODULE(ActsPythonBindingsGeant4, mod) { "outputMaterialTracks"_a); mod.def( - "geant4SimulationConfig", - [](Acts::Logging::Level& level, G4VUserDetectorConstruction* detector, - const std::string& inputParticles, - const std::shared_ptr& trackingGeometry, - const std::shared_ptr& - magneticField, - const std::vector& volumeMappings, - const std::vector& materialMappings) { - // The Geant4 actions needed - std::vector runActions = {}; - std::vector eventActions = {}; - std::vector trackingActions = {}; - std::vector steppingActions = {}; - - // Set the main Geant4 algorithm, primary generation, detector - // construction - Geant4Simulation::Config g4Cfg; - - g4Cfg.runManager = std::make_shared(); - g4Cfg.runManager->SetUserInitialization(new FTFP_BERT()); + "makeGeant4SimulationConfig", + [makeGeant4Config]( + Acts::Logging::Level& level, G4VUserDetectorConstruction* detector, + std::shared_ptr randomNumbers, + const std::string& inputParticles, + const std::shared_ptr& trackingGeometry, + const std::shared_ptr& + magneticField, + const std::vector& volumeMappings, + const std::vector& materialMappings) { + auto physicsList = new FTFP_BERT(); + + // Read the particle from the generator + SimParticleTranslation::Config g4PrCfg; + g4PrCfg.inputParticles = inputParticles; + + auto g4Cfg = makeGeant4Config(level, std::move(randomNumbers), detector, + physicsList, g4PrCfg); ParticleTrackingAction::Config g4TrackCfg; ParticleTrackingAction* particleAction = new ParticleTrackingAction( g4TrackCfg, Acts::getDefaultLogger("ParticleTrackingAction", level)); - trackingActions.push_back(particleAction); + g4Cfg.trackingActions.push_back(particleAction); SensitiveSteppingAction::Config g4StepCfg; - SensitiveSteppingAction* sensitiveStepping = - new SensitiveSteppingAction( - g4StepCfg, - Acts::getDefaultLogger("SensitiveSteppingAction", level)); - steppingActions.push_back(sensitiveStepping); - - // Read the particle from the generator - SimParticleTranslation::Config g4PrCfg; - g4PrCfg.inputParticles = inputParticles; - - // Set the primarty generator - g4Cfg.primaryGeneratorAction = new SimParticleTranslation( - g4PrCfg, Acts::getDefaultLogger("SimParticleTranslation", level)); - g4Cfg.detectorConstruction = detector; - - // Set the user actions - g4Cfg.runActions = runActions; - g4Cfg.eventActions = eventActions; - g4Cfg.trackingActions = trackingActions; - g4Cfg.steppingActions = steppingActions; + G4UserSteppingAction* steppingAction = new SensitiveSteppingAction( + g4StepCfg, + Acts::getDefaultLogger("SensitiveSteppingAction", level)); + g4Cfg.steppingActions.push_back(steppingAction); // An ACTS Magnetic field is provided if (magneticField) { @@ -211,7 +198,7 @@ PYBIND11_MODULE(ActsPythonBindingsGeant4, mod) { return g4Cfg; }, - "level"_a, "detector"_a, "inputParticles"_a, + "level"_a, "detector"_a, "randomNumbers"_a, "inputParticles"_a, py::arg("trackingGeometry") = nullptr, py::arg("magneticField") = nullptr, py::arg("volumeMappings") = std::vector{}, py::arg("materialMappings") = std::vector{}); diff --git a/Examples/Python/tests/root_file_hashes.txt b/Examples/Python/tests/root_file_hashes.txt index 8439f613ddf..9b75ee87744 100644 --- a/Examples/Python/tests/root_file_hashes.txt +++ b/Examples/Python/tests/root_file_hashes.txt @@ -43,9 +43,9 @@ test_material_mapping__material-map_tracks.root: 2d167433ac10e36e447c26ac9c35eff test_material_mapping__propagation-material.root: 3015c064835f84f484f09df1a9a56ce8de471a10cce933952db4530969f905aa test_volume_material_mapping__material-map-volume_tracks.root: 1941c8e6a910c9cfa56ad6df6d9cc8930170d6d4f6e56502cf4cdafda0ce91d1 test_volume_material_mapping__propagation-volume-material.root: 2e3d2685bce1fd75b1d022781e52bcdfd264d8e2fe6bebf05cc280ae78f3f7c6 -test_digitization_example__measurements.root: d6fd33d3182bcd669049fe40d13bc7e80fb9009a3ffa964123460db21384a088 +test_digitization_example__measurements.root: ae9968a05c14790ba57961a4151a7bdefcd50d38ca2434fbdb498c8e4f5f00c1 test_digitization_example_input__particles.root: b4f74e5a4d9d67d59a6ca7d0e9b42c727aa6baf04c2841bc2d64cc2c4eef8c02 -test_digitization_example_input__measurements.root: 0786f3d1652ee1b464d73468f7bb7507d8b146cafa499b28005a32a87d4ab491 +test_digitization_example_input__measurements.root: 8dd9e59d7e29a222adb9ee5218baac7e0b3861e3cb26b56889f27cc9e87d9539 test_ckf_tracks_example[generic-full_seeding]__trackstates_ckf.root: 0d5734c60cb1ecee2b830788c839d870d569e4f09e829d491d24eaa3ad679974 test_ckf_tracks_example[generic-full_seeding]__tracksummary_ckf.root: e387abb1764d7fe1d3ecc971129f0b8577a5b479da2a693a463a4655c7942448 test_ckf_tracks_example[generic-full_seeding]__performance_seeding_trees.root: 0d5a0f8d9539563efcca8779bba9c747f0a6f01c9789af41af843b4f0917e6e9 @@ -80,7 +80,7 @@ test_root_prop_step_writer[kwargsConstructor]__prop_steps.root: 810b1b94fa751128 test_root_particle_writer[configPosConstructor]__particles.root: cdda0a2cc454871b8a3c71aa48ac2e5f17263bde6ed195525b13f790b6b81bdc test_root_particle_writer[configKwConstructor]__particles.root: cdda0a2cc454871b8a3c71aa48ac2e5f17263bde6ed195525b13f790b6b81bdc test_root_particle_writer[kwargsConstructor]__particles.root: cdda0a2cc454871b8a3c71aa48ac2e5f17263bde6ed195525b13f790b6b81bdc -test_root_meas_writer__meas.root: 8058397a4165f98eb4fd381d799d19b21b342d67fc756ad0880a7b0d83b47720 +test_root_meas_writer__meas.root: 86af06befdbda76ca9bfc8bba5a5971ed0ecf4fc1ace570c2c768d5d968e0742 test_root_simhits_writer[configPosConstructor]__meas.root: 2f1e5dcd0e2e1bf4c1799c6c9d440d3ba78917b92f81eddd2469cd16ddec965b test_root_simhits_writer[configKwConstructor]__meas.root: 2f1e5dcd0e2e1bf4c1799c6c9d440d3ba78917b92f81eddd2469cd16ddec965b test_root_simhits_writer[kwargsConstructor]__meas.root: 2f1e5dcd0e2e1bf4c1799c6c9d440d3ba78917b92f81eddd2469cd16ddec965b diff --git a/Examples/Scripts/Python/material_recording.py b/Examples/Scripts/Python/material_recording.py index 3979786c482..c5a506fd1b4 100755 --- a/Examples/Scripts/Python/material_recording.py +++ b/Examples/Scripts/Python/material_recording.py @@ -56,7 +56,7 @@ def runMaterialRecording(g4geo, outputDir, tracksPerEvent=10000, s=None): s.addReader(evGen) - g4AlgCfg = acts.examples.geant4.materialRecordingConfig( + g4AlgCfg = acts.examples.geant4.makeGeant4MaterialRecordingConfig( level=acts.logging.INFO, detector=g4geo, inputParticles=evGen.config.outputParticles, diff --git a/Examples/Scripts/TrackingPerformance/boundParamResolution.C b/Examples/Scripts/TrackingPerformance/boundParamResolution.C index 831cb657bca..6272b090eab 100644 --- a/Examples/Scripts/TrackingPerformance/boundParamResolution.C +++ b/Examples/Scripts/TrackingPerformance/boundParamResolution.C @@ -695,6 +695,7 @@ int boundParamResolution(const std::string& inFile, const std::string& treeName, pull_smt[vlID + paramNames.at(ipar)]->Fit("gaus", "q"); TF1* gauss = pull_smt[vlID + paramNames.at(ipar)]->GetFunction("gaus"); + gauss->SetLineColor(kGreen); float mu = gauss->GetParameter(1); float sigma = gauss->GetParameter(2); diff --git a/Plugins/TGeo/include/Acts/Plugins/TGeo/TGeoDetectorElement.hpp b/Plugins/TGeo/include/Acts/Plugins/TGeo/TGeoDetectorElement.hpp index 7691302fabf..a901c292805 100644 --- a/Plugins/TGeo/include/Acts/Plugins/TGeo/TGeoDetectorElement.hpp +++ b/Plugins/TGeo/include/Acts/Plugins/TGeo/TGeoDetectorElement.hpp @@ -111,7 +111,7 @@ class TGeoDetectorElement : public IdentifiedDetectorElement { /// @param gctx The current geometry context object, e.g. alignment const Transform3& transform(const GeometryContext& gctx) const override; - /// Return surface associated with this identifier, which should come from the + /// Return surface associated with this detector element const Surface& surface() const override; /// Retrieve the DigitizationModule