32 Track& operator=(
const Track& track) =
default;
33 ~Track()
override =
default;
54 void SetMomentum(Floating_t px, Floating_t py, Floating_t pz)
noexcept {
60 void SetMomentum3(
const TVector3& momentum)
noexcept {
66 void SetCharge(Int_t charge)
noexcept { charge_ = charge; }
68 ANALYSISTREE_ATTR_NODISCARD
inline Floating_t GetPx() const noexcept {
return px_; }
69 ANALYSISTREE_ATTR_NODISCARD
inline Floating_t GetPy() const noexcept {
return py_; }
70 ANALYSISTREE_ATTR_NODISCARD
inline Floating_t GetPz() const noexcept {
return pz_; }
71 ANALYSISTREE_ATTR_NODISCARD
inline Floating_t GetPt() const noexcept {
return sqrt(
px_ *
px_ +
py_ *
py_); }
72 ANALYSISTREE_ATTR_NODISCARD
inline Floating_t GetPhi() const noexcept {
return atan2(
py_,
px_); }
73 ANALYSISTREE_ATTR_NODISCARD
inline Floating_t GetEta() const noexcept {
return 0.5f * log((GetP() +
pz_) / (GetP() -
pz_)); }
74 ANALYSISTREE_ATTR_NODISCARD
inline Floating_t GetP() const noexcept {
return sqrt(
px_ *
px_ +
py_ *
py_ +
pz_ *
pz_); }
75 ANALYSISTREE_ATTR_NODISCARD
inline Integer_t GetCharge() const noexcept {
return charge_; }
93 ANALYSISTREE_ATTR_NODISCARD Floating_t
GetRapidity(PdgCode_t pdg)
const {
94 const float mass = GetMassByPdgId(pdg);
104 const float e = sqrt(mass * mass + GetP() * GetP());
105 return 0.5f * log((e + GetPz()) / (e - GetPz()));
116 return Container::GetField<T>(
id);
119 case TrackFields::kPhi:
return GetPhi();
120 case TrackFields::kPt:
return GetPt();
121 case TrackFields::kEta:
return GetEta();
122 case TrackFields::kP:
return GetP();
123 case TrackFields::kPx:
return GetPx();
124 case TrackFields::kPy:
return GetPy();
125 case TrackFields::kPz:
return GetPz();
126 case TrackFields::kQ:
return GetCharge();
127 case TrackFields::kId:
return GetId();
128 default:
throw std::out_of_range(
"Track::GetField - Index " + std::to_string(
id) +
" is not found");
134 void SetField(T value, Int_t field_id) {
136 Container::SetField(value, field_id);
139 case TrackFields::kPx:
px_ = value;
break;
140 case TrackFields::kPy:
py_ = value;
break;
141 case TrackFields::kPz:
pz_ = value;
break;
142 case TrackFields::kQ: charge_ = value;
break;
143 case TrackFields::kId:
break;
144 case TrackFields::kP:
break;
145 case TrackFields::kPt:
break;
146 case TrackFields::kEta:
break;
147 case TrackFields::kPhi:
break;
148 default:
throw std::runtime_error(
"Unknown field");
156 void Print() const noexcept override;
159 static
float GetMassByPdgId(PdgCode_t pdg);
160 static
int GetChargeByPdgId(PdgCode_t pdg);
162 Floating_t
px_{UndefValueFloat};
163 Floating_t
py_{UndefValueFloat};
164 Floating_t
pz_{UndefValueFloat};
165 Integer_t charge_{-1000};
167 ClassDefOverride(Track, 2);