28 ANALYSISTREE_ATTR_NODISCARD PdgCode_t GetPid()
const {
return pid_; }
29 ANALYSISTREE_ATTR_NODISCARD Floating_t GetMass()
const {
return mass_; }
31 void SetMass(Floating_t mass) {
32 CheckIsAllowedSetMassAndChargeExplicitly();
36 void SetCharge(Int_t charge) {
37 CheckIsAllowedSetMassAndChargeExplicitly();
38 Track::SetCharge(charge);
41 void SetPid(PdgCode_t pid);
43 void SetIsAllowedSetMassAndChargeExplicitly(
bool is =
true) { is_allowed_set_charge_and_mass_explicitly_ = is; }
45 void CheckIsAllowedSetMassAndChargeExplicitly()
const;
47 ANALYSISTREE_ATTR_NODISCARD Floating_t GetEnergy()
const {
return sqrt(mass_ * mass_ + GetP() * GetP()); }
48 ANALYSISTREE_ATTR_NODISCARD Floating_t GetKineticEnergy()
const {
return GetEnergy() - mass_; }
51 T GetField(Integer_t iField)
const {
53 return Container::GetField<T>(iField);
56 case ParticleFields::kPhi:
return GetPhi();
57 case ParticleFields::kPt:
return GetPt();
58 case ParticleFields::kRapidity:
return GetRapidity();
59 case ParticleFields::kPid:
return GetPid();
60 case ParticleFields::kMass:
return GetMass();
61 case ParticleFields::kEta:
return GetEta();
62 case ParticleFields::kP:
return GetP();
63 case ParticleFields::kEnergy:
return GetEnergy();
64 case ParticleFields::kKineticEnergy:
return GetKineticEnergy();
65 case ParticleFields::kPx:
return GetPx();
66 case ParticleFields::kPy:
return GetPy();
67 case ParticleFields::kPz:
return GetPz();
68 case ParticleFields::kQ:
return GetCharge();
69 case ParticleFields::kId:
return GetId();
70 default:
throw std::out_of_range(
"Particle::GetField - Index " + std::to_string(iField) +
" is not found");
76 void SetField(T value, Int_t field_id) {
78 Container::SetField(value, field_id);
81 case ParticleFields::kPx:
px_ = value;
break;
82 case ParticleFields::kPy:
py_ = value;
break;
83 case ParticleFields::kPz:
pz_ = value;
break;
84 case ParticleFields::kMass: mass_ = value;
break;
85 case ParticleFields::kQ: charge_ = value;
break;
86 case ParticleFields::kPid: SetPid(value);
break;
87 case ParticleFields::kId:
break;
88 case ParticleFields::kP:
break;
89 case ParticleFields::kEnergy:
break;
90 case ParticleFields::kKineticEnergy:
break;
91 case ParticleFields::kPt:
break;
92 case ParticleFields::kEta:
break;
93 case ParticleFields::kPhi:
break;
94 case ParticleFields::kRapidity:
break;
95 default:
throw std::runtime_error(
"Particle::SetField - Index " + std::to_string(field_id) +
" is not found");
101 Floating_t mass_{-1000.f};
103 bool is_allowed_set_charge_and_mass_explicitly_{
false};
Definition Particle.hpp:11