From ef7df42e8aee4f110b13cf3a71029f515e2e3322 Mon Sep 17 00:00:00 2001 From: Paolo Andreetto Date: Fri, 12 Jul 2024 11:37:53 +0200 Subject: [PATCH] Extrapolation to calo for all ACTS processors --- ACTSTracking/ACTSTruthCKFTrackingProc.hxx | 4 ++ ACTSTracking/ACTSTruthTrackingProc.hxx | 4 ++ src/ACTSTruthCKFTrackingProc.cxx | 74 ++++------------------- src/ACTSTruthTrackingProc.cxx | 58 ++++-------------- 4 files changed, 30 insertions(+), 110 deletions(-) diff --git a/ACTSTracking/ACTSTruthCKFTrackingProc.hxx b/ACTSTracking/ACTSTruthCKFTrackingProc.hxx index a39199e..851b138 100644 --- a/ACTSTracking/ACTSTruthCKFTrackingProc.hxx +++ b/ACTSTracking/ACTSTruthCKFTrackingProc.hxx @@ -58,6 +58,10 @@ class ACTSTruthCKFTrackingProc : public ACTSProcBase { uint32_t _eventNumber; uint32_t _runNumber; + // Extrapolation to calo settings + float _caloFaceR = 1857; //mm + float _caloFaceZ = 2307; //mm + // Track fit parameters double _initialTrackError_d0 = 20 * Acts::UnitConstants::um; // Marlin: 1.e3 double _initialTrackError_phi = diff --git a/ACTSTracking/ACTSTruthTrackingProc.hxx b/ACTSTracking/ACTSTruthTrackingProc.hxx index d495467..11b6962 100644 --- a/ACTSTracking/ACTSTruthTrackingProc.hxx +++ b/ACTSTracking/ACTSTruthTrackingProc.hxx @@ -74,6 +74,10 @@ class ACTSTruthTrackingProc : public ACTSProcBase { uint32_t _eventNumber; uint32_t _runNumber; + // Extrapolation to calo settings + float _caloFaceR = 1857; //mm + float _caloFaceZ = 2307; //mm + // Track fit parameters double _initialTrackError_d0 = 20 * Acts::UnitConstants::um; // Marlin: 1.e3 double _initialTrackError_phi = diff --git a/src/ACTSTruthCKFTrackingProc.cxx b/src/ACTSTruthCKFTrackingProc.cxx index 7baaf88..05ae0b0 100644 --- a/src/ACTSTruthCKFTrackingProc.cxx +++ b/src/ACTSTruthCKFTrackingProc.cxx @@ -73,6 +73,15 @@ ACTSTruthCKFTrackingProc::ACTSTruthCKFTrackingProc() registerOutputCollection(LCIO::TRACK, "TrackCollectionName", "Name of track output collection.", _outputTrackCollection, std::string("TruthTracks")); + + // Extrapolation to calo surface + registerProcessorParameter("CaloFace_Radius", + "ECAL Inner Radius (mm).", + _caloFaceR, _caloFaceR); + + registerProcessorParameter("CaloFace_Z", + "ECAL half length (mm).", + _caloFaceZ, _caloFaceZ); } void ACTSTruthCKFTrackingProc::init() { @@ -317,7 +326,8 @@ void ACTSTruthCKFTrackingProc::processEvent(LCEvent* evt) { { std::cout << trackTip.chi2() << std::endl; EVENT::Track* track = ACTSTracking::ACTS2Marlin_track( - trackTip, magneticField(), magCache); + trackTip, magneticField(), magCache, + _caloFaceR, _caloFaceZ, geometryContext(), magneticFieldContext(), trackingGeometry()); trackCollection->addElement(track); } } else { @@ -326,68 +336,6 @@ void ACTSTruthCKFTrackingProc::processEvent(LCEvent* evt) { } } -/* - auto t1 = std::chrono::high_resolution_clock::now(); - TrackFinderResultContainer results = - trackFinder.findTracks(sourceLinks, seeds, ckfOptions); - auto t2 = std::chrono::high_resolution_clock::now(); - std::cout - << "Tracking finding: " - << std::chrono::duration_cast(t2 - t1).count() - << " ms" << std::endl; - - for (TrackFinderResult& result : results) { - if (result.ok()) { - const Acts::CombinatorialKalmanFilterResult& - fitOutput = result.value(); - for (const size_t& trackTip : fitOutput.lastMeasurementIndices) { - if (fitOutput.fittedParameters.count(trackTip) == 0) { - streamlog_out(WARNING) - << "No fitted track parameters for trajectory with entry index = " - << trackTip << std::endl; - continue; - } - - // - // Helpful debug output - Acts::MultiTrajectoryHelpers::TrajectoryState trajState = - Acts::MultiTrajectoryHelpers::trajectoryState( - fitOutput.fittedStates, trackTip); - streamlog_out(DEBUG) << "Trajectory Summary" << std::endl; - streamlog_out(DEBUG) - << "\tchi2Sum " << trajState.chi2Sum << std::endl; - streamlog_out(DEBUG) - << "\tNDF " << trajState.NDF << std::endl; - streamlog_out(DEBUG) - << "\tnHoles " << trajState.nHoles << std::endl; - streamlog_out(DEBUG) - << "\tnMeasurements " << trajState.nMeasurements << std::endl; - streamlog_out(DEBUG) - << "\tnOutliers " << trajState.nOutliers << std::endl; - streamlog_out(DEBUG) - << "\tnStates " << trajState.nStates << std::endl; - - const Acts::BoundTrackParameters& params = - fitOutput.fittedParameters.at(trackTip); - streamlog_out(DEBUG) << "Fitted Paramemeters" << std::endl - << params << std::endl; - - // - // Make track object - EVENT::Track* track = ACTSTracking::ACTS2Marlin_track( - fitOutput, trackTip, magneticField(), magCache); - - // - // Save results - trackCollection->addElement(track); - } - } else { - streamlog_out(WARNING) - << "Track fit error: " << result.error() << std::endl; - _fitFails++; - } - } -*/ // Save the output track collection evt->addCollection(trackCollection, _outputTrackCollection); diff --git a/src/ACTSTruthTrackingProc.cxx b/src/ACTSTruthTrackingProc.cxx index beb5837..7dc0dd8 100644 --- a/src/ACTSTruthTrackingProc.cxx +++ b/src/ACTSTruthTrackingProc.cxx @@ -69,6 +69,15 @@ ACTSTruthTrackingProc::ACTSTruthTrackingProc() registerOutputCollection(LCIO::TRACK, "TrackCollectionName", "Name of track output collection.", _outputTrackCollection, std::string("TruthTracks")); + + // Extrapolation to calo surface + registerProcessorParameter("CaloFace_Radius", + "ECAL Inner Radius (mm).", + _caloFaceR, _caloFaceR); + + registerProcessorParameter("CaloFace_Z", + "ECAL half length (mm).", + _caloFaceZ, _caloFaceZ); } void ACTSTruthTrackingProc::init() { @@ -339,57 +348,12 @@ void ACTSTruthTrackingProc::processEvent(LCEvent* evt) { if (result.ok()) { const auto& fitOutput = result.value(); -/* - if (fitOutput.fittedParameters) { - // Make the track object and relations object - IMPL::LCRelationImpl* relationTrack = new IMPL::LCRelationImpl; - - // - // Helpful debug output - Acts::MultiTrajectoryHelpers::TrajectoryState trajState = - Acts::MultiTrajectoryHelpers::trajectoryState( - fitOutput.fittedStates, fitOutput.lastMeasurementIndex); - streamlog_out(DEBUG) << "Trajectory Summary" << std::endl; - streamlog_out(DEBUG) - << "\tchi2Sum " << trajState.chi2Sum << std::endl; - streamlog_out(DEBUG) - << "\tNDF " << trajState.NDF << std::endl; - streamlog_out(DEBUG) - << "\tnHoles " << trajState.nHoles << std::endl; - streamlog_out(DEBUG) - << "\tnMeasurements " << trajState.nMeasurements << std::endl; - streamlog_out(DEBUG) - << "\tnOutliers " << trajState.nOutliers << std::endl; - streamlog_out(DEBUG) - << "\tnStates " << trajState.nStates << std::endl; - - const Acts::BoundTrackParameters& params = - fitOutput.fittedParameters.value(); - streamlog_out(DEBUG) << "Fitted Paramemeters" << std::endl - << params << std::endl; - - // Make track object - EVENT::Track* track = ACTSTracking::ACTS2Marlin_track( - fitOutput, magneticField(), magCache); - // Save results - trackCollection->addElement(track); - - // Make the particle to track link - relationTrack->setFrom(track); - relationTrack->setTo(mcParticle); - relationTrack->setWeight(1.0); - trackRelationCollection->addElement(relationTrack); - } else { - streamlog_out(WARNING) - << "No fitted paramemeters for track" << std::endl; - _fitFails++; - } -*/ if (fitOutput.hasReferenceSurface()) { EVENT::Track* track = ACTSTracking::ACTS2Marlin_track( - fitOutput, magneticField(), magCache); + fitOutput, magneticField(), magCache, + _caloFaceR, _caloFaceZ, geometryContext(), magneticFieldContext(), trackingGeometry()); trackCollection->addElement(track); IMPL::LCRelationImpl* relationTrack = new IMPL::LCRelationImpl;