Skip to content

Commit 8e4cfe1

Browse files
authored
[ALICE3] Refactor TRK Hit class to rely on ITSMFT (#15173)
* [ALICE3] Refactor TRK Hit class to rely on ITSMFT * Refactor Hit class by removing unused code Removed unnecessary includes and simplified the Print method. * Remove Hit class declaration from TimeFrame.h Removed the declaration of the Hit class from TimeFrame.h.
1 parent 084a237 commit 8e4cfe1

File tree

3 files changed

+6
-150
lines changed
  • Detectors/Upgrades/ALICE3/TRK

3 files changed

+6
-150
lines changed

Detectors/Upgrades/ALICE3/TRK/reconstruction/include/TRKReconstruction/TimeFrame.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ namespace o2
3333
{
3434
namespace trk
3535
{
36-
class Hit;
3736
class GeometryTGeo;
3837

3938
/// TRK TimeFrame class that extends ITS TimeFrame functionality

Detectors/Upgrades/ALICE3/TRK/simulation/include/TRKSimulation/Hit.h

Lines changed: 6 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -12,138 +12,14 @@
1212
/// \file Hit.h
1313
/// \brief Definition of the TRK Hit class
1414

15-
#ifndef ALICEO2_TRK_POINT_H_
16-
#define ALICEO2_TRK_POINT_H_
15+
#ifndef ALICEO2_TRK_HIT_H_
16+
#define ALICEO2_TRK_HIT_H_
1717

18-
#include "SimulationDataFormat/BaseHits.h" // for BasicXYZEHit
19-
#include "Rtypes.h" // for Bool_t, Double_t, Int_t, Double32_t, etc
20-
#include "TVector3.h" // for TVector3
21-
#include <iosfwd>
22-
#include "CommonUtils/ShmAllocator.h"
18+
#include "ITSMFTSimulation/Hit.h"
2319

24-
namespace o2
20+
namespace o2::trk
2521
{
26-
namespace trk
27-
{
28-
29-
class Hit : public o2::BasicXYZEHit<Float_t, Float_t>
30-
{
31-
32-
public:
33-
enum HitStatus_t {
34-
kTrackEntering = 0x1,
35-
kTrackInside = 0x1 << 1,
36-
kTrackExiting = 0x1 << 2,
37-
kTrackOut = 0x1 << 3,
38-
kTrackStopped = 0x1 << 4,
39-
kTrackAlive = 0x1 << 5
40-
};
41-
42-
/// Default constructor
43-
Hit() = default;
44-
45-
/// Class Constructor
46-
/// \param trackID Index of MCTrack
47-
/// \param detID Detector ID
48-
/// \param startPos Coordinates at entrance to active volume [cm]
49-
/// \param pos Coordinates to active volume [cm]
50-
/// \param mom Momentum of track at entrance [GeV]
51-
/// \param endTime Time at entrance [ns]
52-
/// \param time Time since event start [ns]
53-
/// \param eLoss Energy deposit [GeV]
54-
/// \param startStatus: status at entrance
55-
/// \param endStatus: status at exit
56-
inline Hit(int trackID, unsigned short detID, const TVector3& startPos, const TVector3& pos, const TVector3& mom, double startE,
57-
double endTime, double eLoss, unsigned char statusStart, unsigned char status);
58-
59-
// Entrance position getters
60-
math_utils::Point3D<Float_t> GetPosStart() const { return mPosStart; }
61-
Float_t GetStartX() const { return mPosStart.X(); }
62-
Float_t GetStartY() const { return mPosStart.Y(); }
63-
Float_t GetStartZ() const { return mPosStart.Z(); }
64-
template <typename F>
65-
void GetStartPosition(F& x, F& y, F& z) const
66-
{
67-
x = GetStartX();
68-
y = GetStartY();
69-
z = GetStartZ();
70-
}
71-
// momentum getters
72-
math_utils::Vector3D<Float_t> GetMomentum() const { return mMomentum; }
73-
math_utils::Vector3D<Float_t>& GetMomentum() { return mMomentum; }
74-
Float_t GetPx() const { return mMomentum.X(); }
75-
Float_t GetPy() const { return mMomentum.Y(); }
76-
Float_t GetPz() const { return mMomentum.Z(); }
77-
Float_t GetE() const { return mE; }
78-
Float_t GetTotalEnergy() const { return GetE(); }
79-
80-
UChar_t GetStatusEnd() const { return mTrackStatusEnd; }
81-
UChar_t GetStatusStart() const { return mTrackStatusStart; }
82-
83-
Bool_t IsEntering() const { return mTrackStatusEnd & kTrackEntering; }
84-
Bool_t IsInside() const { return mTrackStatusEnd & kTrackInside; }
85-
Bool_t IsExiting() const { return mTrackStatusEnd & kTrackExiting; }
86-
Bool_t IsOut() const { return mTrackStatusEnd & kTrackOut; }
87-
Bool_t IsStopped() const { return mTrackStatusEnd & kTrackStopped; }
88-
Bool_t IsAlive() const { return mTrackStatusEnd & kTrackAlive; }
89-
90-
Bool_t IsEnteringStart() const { return mTrackStatusStart & kTrackEntering; }
91-
Bool_t IsInsideStart() const { return mTrackStatusStart & kTrackInside; }
92-
Bool_t IsExitingStart() const { return mTrackStatusStart & kTrackExiting; }
93-
Bool_t IsOutStart() const { return mTrackStatusStart & kTrackOut; }
94-
Bool_t IsStoppedStart() const { return mTrackStatusStart & kTrackStopped; }
95-
Bool_t IsAliveStart() const { return mTrackStatusStart & kTrackAlive; }
96-
97-
// Entrance position setter
98-
void SetPosStart(const math_utils::Point3D<Float_t>& p) { mPosStart = p; }
99-
100-
/// Output to screen
101-
void Print(const Option_t* opt) const;
102-
friend std::ostream& operator<<(std::ostream& of, const Hit& point)
103-
{
104-
of << "-I- Hit: O2its point for track " << point.GetTrackID() << " in detector " << point.GetDetectorID() << std::endl;
105-
/*
106-
of << " Position (" << point.fX << ", " << point.fY << ", " << point.fZ << ") cm" << std::endl;
107-
of << " Momentum (" << point.fPx << ", " << point.fPy << ", " << point.fPz << ") GeV" << std::endl;
108-
of << " Time " << point.fTime << " ns, Length " << point.fLength << " cm, Energy loss "
109-
<< point.fELoss * 1.0e06 << " keV" << std::endl;
110-
*/
111-
return of;
112-
}
113-
114-
private:
115-
math_utils::Vector3D<Float_t> mMomentum; ///< momentum at entrance
116-
math_utils::Point3D<Float_t> mPosStart; ///< position at entrance (base mPos give position on exit)
117-
Float_t mE; ///< total energy at entrance
118-
UChar_t mTrackStatusEnd; ///< MC status flag at exit
119-
UChar_t mTrackStatusStart; ///< MC status at starting point
120-
121-
ClassDefNV(Hit, 1);
122-
};
123-
124-
Hit::Hit(int trackID, unsigned short detID, const TVector3& startPos, const TVector3& endPos, const TVector3& startMom,
125-
double startE, double endTime, double eLoss, unsigned char startStatus, unsigned char endStatus)
126-
: BasicXYZEHit(endPos.X(), endPos.Y(), endPos.Z(), endTime, eLoss, trackID, detID),
127-
mMomentum(startMom.Px(), startMom.Py(), startMom.Pz()),
128-
mPosStart(startPos.X(), startPos.Y(), startPos.Z()),
129-
mE(startE),
130-
mTrackStatusEnd(endStatus),
131-
mTrackStatusStart(startStatus)
132-
{
133-
}
134-
135-
} // namespace trk
136-
} // namespace o2
137-
138-
#ifdef USESHM
139-
namespace std
140-
{
141-
template <>
142-
class allocator<o2::trk::Hit> : public o2::utils::ShmAllocator<o2::trk::Hit>
143-
{
144-
};
145-
} // namespace std
146-
147-
#endif
22+
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
23+
} // namespace o2::trk
14824

14925
#endif

Detectors/Upgrades/ALICE3/TRK/simulation/src/Hit.cxx

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,3 @@
1313
/// \brief Implementation of the Hit class
1414

1515
#include "TRKSimulation/Hit.h"
16-
17-
#include <iostream>
18-
#include <iostream>
19-
20-
ClassImp(o2::trk::Hit);
21-
22-
using std::cout;
23-
using std::endl;
24-
using namespace o2::trk;
25-
using namespace o2; //::base;
26-
27-
void Hit::Print(const Option_t* opt) const
28-
{
29-
printf(
30-
"Det: %5d Track: %6d E.loss: %.3e P: %+.3e %+.3e %+.3e\n"
31-
"PosIn: %+.3e %+.3e %+.3e PosOut: %+.3e %+.3e %+.3e\n",
32-
GetDetectorID(), GetTrackID(), GetEnergyLoss(), GetPx(), GetPy(), GetPz(),
33-
GetStartX(), GetStartY(), GetStartZ(), GetX(), GetY(), GetZ());
34-
}

0 commit comments

Comments
 (0)