Project
Loading...
Searching...
No Matches
Hit.h
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
14
15#ifndef ALICEO2_ITSMFT_POINT_H_
16#define ALICEO2_ITSMFT_POINT_H_
17
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>
23
24namespace o2
25{
26namespace itsmft
27{
28
29class Hit : public o2::BasicXYZEHit<Float_t, Float_t>
30{
31
32 public:
35 kTrackInside = 0x1 << 1,
36 kTrackExiting = 0x1 << 2,
37 kTrackOut = 0x1 << 3,
38 kTrackStopped = 0x1 << 4,
39 kTrackAlive = 0x1 << 5
40 };
41
43 Hit() = default;
44
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; }
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
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:
117 Float_t mE;
118 UChar_t mTrackStatusEnd;
119 UChar_t mTrackStatusStart;
120
121 ClassDefNV(Hit, 3);
122};
123
124Hit::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 itsmft
136} // namespace o2
137
138#ifdef USESHM
139namespace std
140{
141template <>
142class allocator<o2::itsmft::Hit> : public o2::utils::ShmAllocator<o2::itsmft::Hit>
143{
144};
145} // namespace std
146
147#endif
148
149#endif
uint16_t pos
Definition RawData.h:3
int GetTrackID() const
Definition BaseHits.h:30
short GetDetectorID() const
Definition BaseHits.h:73
math_utils::Vector3D< Float_t > GetMomentum() const
Definition Hit.h:72
void SetPosStart(const math_utils::Point3D< Float_t > &p)
Definition Hit.h:98
Bool_t IsStoppedStart() const
Definition Hit.h:94
Bool_t IsOut() const
Definition Hit.h:86
Bool_t IsAliveStart() const
Definition Hit.h:95
UChar_t GetStatusEnd() const
Definition Hit.h:80
void GetStartPosition(F &x, F &y, F &z) const
Definition Hit.h:65
Float_t GetStartZ() const
Definition Hit.h:63
friend std::ostream & operator<<(std::ostream &of, const Hit &point)
Definition Hit.h:102
Float_t GetStartY() const
Definition Hit.h:62
Bool_t IsExitingStart() const
Definition Hit.h:92
Hit()=default
Default constructor.
Bool_t IsEnteringStart() const
Definition Hit.h:90
Float_t GetTotalEnergy() const
Definition Hit.h:78
Bool_t IsStopped() const
Definition Hit.h:87
Float_t GetE() const
Definition Hit.h:77
Float_t GetPz() const
Definition Hit.h:76
Bool_t IsExiting() const
Definition Hit.h:85
math_utils::Vector3D< Float_t > & GetMomentum()
Definition Hit.h:73
@ kTrackStopped
Definition Hit.h:38
@ kTrackInside
Definition Hit.h:35
@ kTrackAlive
Definition Hit.h:39
@ kTrackEntering
Definition Hit.h:34
@ kTrackExiting
Definition Hit.h:36
Bool_t IsOutStart() const
Definition Hit.h:93
Bool_t IsAlive() const
Definition Hit.h:88
Float_t GetPx() const
Definition Hit.h:74
math_utils::Point3D< Float_t > GetPosStart() const
Definition Hit.h:60
Float_t GetStartX() const
Definition Hit.h:61
Bool_t IsEntering() const
Definition Hit.h:83
Float_t GetPy() const
Definition Hit.h:75
UChar_t GetStatusStart() const
Definition Hit.h:81
void Print(const Option_t *opt) const
Output to screen.
Definition Hit.cxx:27
Bool_t IsInside() const
Definition Hit.h:84
Bool_t IsInsideStart() const
Definition Hit.h:91
GLint GLenum GLint x
Definition glcorearb.h:403
GLdouble GLdouble GLdouble z
Definition glcorearb.h:843
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
Defining DataPointCompositeObject explicitly as copiable.