From 47e748d4a8ca346b652763da6b200d34b3666f05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Tue, 17 Mar 2026 06:35:02 +0100 Subject: [PATCH 1/3] [ALICE3] Refactor TRK Hit class to rely on ITSMFT --- .../simulation/include/TRKSimulation/Hit.h | 136 +----------------- 1 file changed, 6 insertions(+), 130 deletions(-) diff --git a/Detectors/Upgrades/ALICE3/TRK/simulation/include/TRKSimulation/Hit.h b/Detectors/Upgrades/ALICE3/TRK/simulation/include/TRKSimulation/Hit.h index a178c30069f14..88afac8682cf4 100644 --- a/Detectors/Upgrades/ALICE3/TRK/simulation/include/TRKSimulation/Hit.h +++ b/Detectors/Upgrades/ALICE3/TRK/simulation/include/TRKSimulation/Hit.h @@ -12,138 +12,14 @@ /// \file Hit.h /// \brief Definition of the TRK Hit class -#ifndef ALICEO2_TRK_POINT_H_ -#define ALICEO2_TRK_POINT_H_ +#ifndef ALICEO2_TRK_HIT_H_ +#define ALICEO2_TRK_HIT_H_ -#include "SimulationDataFormat/BaseHits.h" // for BasicXYZEHit -#include "Rtypes.h" // for Bool_t, Double_t, Int_t, Double32_t, etc -#include "TVector3.h" // for TVector3 -#include -#include "CommonUtils/ShmAllocator.h" +#include "ITSMFTSimulation/Hit.h" -namespace o2 +namespace o2::trk { -namespace trk -{ - -class Hit : public o2::BasicXYZEHit -{ - - public: - enum HitStatus_t { - kTrackEntering = 0x1, - kTrackInside = 0x1 << 1, - kTrackExiting = 0x1 << 2, - kTrackOut = 0x1 << 3, - kTrackStopped = 0x1 << 4, - kTrackAlive = 0x1 << 5 - }; - - /// Default constructor - Hit() = default; - - /// Class Constructor - /// \param trackID Index of MCTrack - /// \param detID Detector ID - /// \param startPos Coordinates at entrance to active volume [cm] - /// \param pos Coordinates to active volume [cm] - /// \param mom Momentum of track at entrance [GeV] - /// \param endTime Time at entrance [ns] - /// \param time Time since event start [ns] - /// \param eLoss Energy deposit [GeV] - /// \param startStatus: status at entrance - /// \param endStatus: status at exit - inline Hit(int trackID, unsigned short detID, const TVector3& startPos, const TVector3& pos, const TVector3& mom, double startE, - double endTime, double eLoss, unsigned char statusStart, unsigned char status); - - // Entrance position getters - math_utils::Point3D GetPosStart() const { return mPosStart; } - Float_t GetStartX() const { return mPosStart.X(); } - Float_t GetStartY() const { return mPosStart.Y(); } - Float_t GetStartZ() const { return mPosStart.Z(); } - template - void GetStartPosition(F& x, F& y, F& z) const - { - x = GetStartX(); - y = GetStartY(); - z = GetStartZ(); - } - // momentum getters - math_utils::Vector3D GetMomentum() const { return mMomentum; } - math_utils::Vector3D& GetMomentum() { return mMomentum; } - Float_t GetPx() const { return mMomentum.X(); } - Float_t GetPy() const { return mMomentum.Y(); } - Float_t GetPz() const { return mMomentum.Z(); } - Float_t GetE() const { return mE; } - Float_t GetTotalEnergy() const { return GetE(); } - - UChar_t GetStatusEnd() const { return mTrackStatusEnd; } - UChar_t GetStatusStart() const { return mTrackStatusStart; } - - Bool_t IsEntering() const { return mTrackStatusEnd & kTrackEntering; } - Bool_t IsInside() const { return mTrackStatusEnd & kTrackInside; } - Bool_t IsExiting() const { return mTrackStatusEnd & kTrackExiting; } - Bool_t IsOut() const { return mTrackStatusEnd & kTrackOut; } - Bool_t IsStopped() const { return mTrackStatusEnd & kTrackStopped; } - Bool_t IsAlive() const { return mTrackStatusEnd & kTrackAlive; } - - Bool_t IsEnteringStart() const { return mTrackStatusStart & kTrackEntering; } - Bool_t IsInsideStart() const { return mTrackStatusStart & kTrackInside; } - Bool_t IsExitingStart() const { return mTrackStatusStart & kTrackExiting; } - Bool_t IsOutStart() const { return mTrackStatusStart & kTrackOut; } - Bool_t IsStoppedStart() const { return mTrackStatusStart & kTrackStopped; } - Bool_t IsAliveStart() const { return mTrackStatusStart & kTrackAlive; } - - // Entrance position setter - void SetPosStart(const math_utils::Point3D& p) { mPosStart = p; } - - /// Output to screen - void Print(const Option_t* opt) const; - friend std::ostream& operator<<(std::ostream& of, const Hit& point) - { - of << "-I- Hit: O2its point for track " << point.GetTrackID() << " in detector " << point.GetDetectorID() << std::endl; - /* - of << " Position (" << point.fX << ", " << point.fY << ", " << point.fZ << ") cm" << std::endl; - of << " Momentum (" << point.fPx << ", " << point.fPy << ", " << point.fPz << ") GeV" << std::endl; - of << " Time " << point.fTime << " ns, Length " << point.fLength << " cm, Energy loss " - << point.fELoss * 1.0e06 << " keV" << std::endl; - */ - return of; - } - - private: - math_utils::Vector3D mMomentum; ///< momentum at entrance - math_utils::Point3D mPosStart; ///< position at entrance (base mPos give position on exit) - Float_t mE; ///< total energy at entrance - UChar_t mTrackStatusEnd; ///< MC status flag at exit - UChar_t mTrackStatusStart; ///< MC status at starting point - - ClassDefNV(Hit, 1); -}; - -Hit::Hit(int trackID, unsigned short detID, const TVector3& startPos, const TVector3& endPos, const TVector3& startMom, - double startE, double endTime, double eLoss, unsigned char startStatus, unsigned char endStatus) - : BasicXYZEHit(endPos.X(), endPos.Y(), endPos.Z(), endTime, eLoss, trackID, detID), - mMomentum(startMom.Px(), startMom.Py(), startMom.Pz()), - mPosStart(startPos.X(), startPos.Y(), startPos.Z()), - mE(startE), - mTrackStatusEnd(endStatus), - mTrackStatusStart(startStatus) -{ -} - -} // namespace trk -} // namespace o2 - -#ifdef USESHM -namespace std -{ -template <> -class allocator : public o2::utils::ShmAllocator -{ -}; -} // namespace std - -#endif +using Hit = o2::itsmft::Hit; // For now we rely on the same Hit class as ITSMFT, but we can extend it with TRK-specific information if needed in the future +} // namespace o2::trk #endif From 0d009256647317d86f50d12965fa16870d928d30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Tue, 17 Mar 2026 06:35:40 +0100 Subject: [PATCH 2/3] Refactor Hit class by removing unused code Removed unnecessary includes and simplified the Print method. --- .../ALICE3/TRK/simulation/src/Hit.cxx | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/Detectors/Upgrades/ALICE3/TRK/simulation/src/Hit.cxx b/Detectors/Upgrades/ALICE3/TRK/simulation/src/Hit.cxx index fe496bc59692f..1f49b84114b9d 100644 --- a/Detectors/Upgrades/ALICE3/TRK/simulation/src/Hit.cxx +++ b/Detectors/Upgrades/ALICE3/TRK/simulation/src/Hit.cxx @@ -13,22 +13,3 @@ /// \brief Implementation of the Hit class #include "TRKSimulation/Hit.h" - -#include -#include - -ClassImp(o2::trk::Hit); - -using std::cout; -using std::endl; -using namespace o2::trk; -using namespace o2; //::base; - -void Hit::Print(const Option_t* opt) const -{ - printf( - "Det: %5d Track: %6d E.loss: %.3e P: %+.3e %+.3e %+.3e\n" - "PosIn: %+.3e %+.3e %+.3e PosOut: %+.3e %+.3e %+.3e\n", - GetDetectorID(), GetTrackID(), GetEnergyLoss(), GetPx(), GetPy(), GetPz(), - GetStartX(), GetStartY(), GetStartZ(), GetX(), GetY(), GetZ()); -} From 21e657e34f8e5bfc2eff57e2dc3f23fd25d3d264 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Tue, 17 Mar 2026 06:42:00 +0100 Subject: [PATCH 3/3] Remove Hit class declaration from TimeFrame.h Removed the declaration of the Hit class from TimeFrame.h. --- .../TRK/reconstruction/include/TRKReconstruction/TimeFrame.h | 1 - 1 file changed, 1 deletion(-) diff --git a/Detectors/Upgrades/ALICE3/TRK/reconstruction/include/TRKReconstruction/TimeFrame.h b/Detectors/Upgrades/ALICE3/TRK/reconstruction/include/TRKReconstruction/TimeFrame.h index f42a1c897efb6..c07767d50b113 100644 --- a/Detectors/Upgrades/ALICE3/TRK/reconstruction/include/TRKReconstruction/TimeFrame.h +++ b/Detectors/Upgrades/ALICE3/TRK/reconstruction/include/TRKReconstruction/TimeFrame.h @@ -33,7 +33,6 @@ namespace o2 { namespace trk { -class Hit; class GeometryTGeo; /// TRK TimeFrame class that extends ITS TimeFrame functionality