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
25
26#ifndef ALICEO2_EXT_HIT_H
27#define ALICEO2_EXT_HIT_H
28
29#include "SimulationDataFormat/BaseHits.h" // for BasicXYZEHit
31#include "Rtypes.h"
32#include "TVector3.h"
33#include <iosfwd>
34
35namespace o2::ext
36{
37
38class Hit : public o2::BasicXYZEHit<float, float>
39{
40 public:
43 kTrackInside = 0x1 << 1,
44 kTrackExiting = 0x1 << 2,
45 kTrackOut = 0x1 << 3,
46 kTrackStopped = 0x1 << 4,
47 kTrackAlive = 0x1 << 5
48 };
49
50 Hit() = default;
51
64 Hit(int trackID, unsigned short sensorID, const TVector3& startPos, const TVector3& endPos,
65 const TVector3& startMom, double startE, double endTime, double eLoss,
66 unsigned char startStatus, unsigned char endStatus, int pdg = 0, float length = 0.f)
67 : BasicXYZEHit(endPos.X(), endPos.Y(), endPos.Z(), endTime, eLoss, trackID, sensorID),
68 mMomentum(startMom.Px(), startMom.Py(), startMom.Pz()),
69 mPosStart(startPos.X(), startPos.Y(), startPos.Z()),
70 mE(startE),
71 mLength(length),
72 mPdg(pdg),
73 mTrackStatusEnd(endStatus),
74 mTrackStatusStart(startStatus)
75 {
76 }
77
78 // entrance position
79 math_utils::Point3D<float> GetPosStart() const { return mPosStart; }
80 float GetStartX() const { return mPosStart.X(); }
81 float GetStartY() const { return mPosStart.Y(); }
82 float GetStartZ() const { return mPosStart.Z(); }
83 void SetPosStart(const math_utils::Point3D<float>& p) { mPosStart = p; }
84
85 // momentum / energy
86 math_utils::Vector3D<float> GetMomentum() const { return mMomentum; }
88 float GetPx() const { return mMomentum.X(); }
89 float GetPy() const { return mMomentum.Y(); }
90 float GetPz() const { return mMomentum.Z(); }
91 float GetE() const { return mE; }
92 float GetTotalEnergy() const { return mE; }
93
94 // extra bookkeeping
95 float GetLength() const { return mLength; }
96 void SetLength(float l) { mLength = l; }
97 int GetPdg() const { return mPdg; }
98 void SetPdg(int pdg) { mPdg = pdg; }
99
100 // status flags
101 unsigned char GetStatusStart() const { return mTrackStatusStart; }
102 unsigned char GetStatusEnd() const { return mTrackStatusEnd; }
103 bool IsEntering() const { return mTrackStatusEnd & kTrackEntering; }
104 bool IsInside() const { return mTrackStatusEnd & kTrackInside; }
105 bool IsExiting() const { return mTrackStatusEnd & kTrackExiting; }
106 bool IsOut() const { return mTrackStatusEnd & kTrackOut; }
107 bool IsStopped() const { return mTrackStatusEnd & kTrackStopped; }
108 bool IsAlive() const { return mTrackStatusEnd & kTrackAlive; }
109
110 friend std::ostream& operator<<(std::ostream& of, const Hit& point)
111 {
112 of << "-I- o2::ext::Hit for track " << point.GetTrackID() << " in sensor " << point.GetDetectorID();
113 return of;
114 }
115
116 private:
119 float mE;
120 float mLength;
121 int mPdg;
122 unsigned char mTrackStatusEnd;
123 unsigned char mTrackStatusStart;
124
125 ClassDefNV(Hit, 1);
126};
127
128} // namespace o2::ext
129
130#ifdef USESHM
131namespace std
132{
133template <>
134class allocator<o2::ext::Hit> : public o2::utils::ShmAllocator<o2::ext::Hit>
135{
136};
137} // namespace std
138#endif
139
140#endif // ALICEO2_EXT_HIT_H
int GetTrackID() const
Definition BaseHits.h:30
unsigned short GetDetectorID() const
Definition BaseHits.h:73
HitStatus_t
Definition Hit.h:41
@ kTrackOut
Definition Hit.h:45
@ kTrackExiting
Definition Hit.h:44
@ kTrackInside
Definition Hit.h:43
@ kTrackEntering
Definition Hit.h:42
@ kTrackAlive
Definition Hit.h:47
@ kTrackStopped
Definition Hit.h:46
math_utils::Vector3D< float > GetMomentum() const
Definition Hit.h:86
math_utils::Point3D< float > GetPosStart() const
Definition Hit.h:79
bool IsAlive() const
Definition Hit.h:108
bool IsEntering() const
Definition Hit.h:103
int GetPdg() const
Definition Hit.h:97
void SetLength(float l)
Definition Hit.h:96
math_utils::Vector3D< float > & GetMomentum()
Definition Hit.h:87
bool IsInside() const
Definition Hit.h:104
unsigned char GetStatusStart() const
Definition Hit.h:101
unsigned char GetStatusEnd() const
Definition Hit.h:102
friend std::ostream & operator<<(std::ostream &of, const Hit &point)
Definition Hit.h:110
float GetLength() const
Definition Hit.h:95
bool IsOut() const
Definition Hit.h:106
float GetPy() const
Definition Hit.h:89
float GetE() const
Definition Hit.h:91
Hit(int trackID, unsigned short sensorID, const TVector3 &startPos, const TVector3 &endPos, const TVector3 &startMom, double startE, double endTime, double eLoss, unsigned char startStatus, unsigned char endStatus, int pdg=0, float length=0.f)
Definition Hit.h:64
float GetPx() const
Definition Hit.h:88
float GetStartZ() const
Definition Hit.h:82
float GetTotalEnergy() const
Definition Hit.h:92
float GetStartY() const
Definition Hit.h:81
void SetPdg(int pdg)
Definition Hit.h:98
float GetPz() const
Definition Hit.h:90
float GetStartX() const
Definition Hit.h:80
bool IsExiting() const
Definition Hit.h:105
void SetPosStart(const math_utils::Point3D< float > &p)
Definition Hit.h:83
bool IsStopped() const
Definition Hit.h:107
Hit()=default
GLuint GLsizei GLsizei * length
Definition glcorearb.h:790
Defining ITS Vertex explicitly as messageable.
Definition Cartesian.h:288
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...