18 #include <TLorentzRotation.h>
19 #include <TParticlePDG.h>
20 #include <TRotation.h>
35 TLorentzRotation computeBoost(
const TLorentzVector& rest,
36 const TLorentzVector*
z) {
37 TLorentzRotation toRest(-(rest.BoostVector()));
40 TLorentzVector boostedZ(*z);
42 rotate.SetZAxis(boostedZ.Vect());
45 rotate = rotate.Inverse();
46 toRest.Transform(rotate);
72 , parentId(std::numeric_limits<Int_t>::
min())
92 static std::stringstream ss;
115 if (ss.fail() || !ss.eof()) {
116 throw std::runtime_error(
"Bad particle input: " + line);
129 std::cout <<
I <<
'\t' <<
KS <<
'\t' <<
id <<
'\t' <<
orig <<
'\t' <<
131 <<
'\t' <<
E <<
'\t' <<
m <<
'\t' <<
xv <<
'\t' <<
yv <<
'\t' <<
zv <<
137 pt = sqrt(pow(
px, 2.) + pow(
py, 2.));
138 p = sqrt(pow(
pt, 2.) + pow(
pz, 2.));
140 Double_t Epluspz =
E +
pz;
141 Double_t Eminuspz =
E -
pz;
142 Double_t Ppluspz =
p +
pz;
143 Double_t Pminuspz =
p -
pz;
144 if (Eminuspz <= 0.0 || Pminuspz == 0.0 ||
145 Ppluspz == 0.0 || Epluspz <= 0.0) {
150 rapidity = 0.5 * log(Epluspz / Eminuspz);
151 eta = 0.5 * log(Ppluspz / Pminuspz);
154 phi = TVector2::Phi_0_2pi(atan2(
py,
px));
160 const TLorentzVector& hadron =
event.BeamHadron()->Get4Vector();
161 const TLorentzVector& lepton =
event.ScatteredLepton()->Get4Vector();
165 const TLorentzVector boson =
event.BeamLepton()->Get4Vector() - lepton;
169 z = hadron.Dot(
Get4Vector()) / hadron.Dot(boson);
173 TLorentzRotation toHadronRest = computeBoost(hadron, &boson);
181 TLorentzVector bosonPrf = (TLorentzVector(boson) *= toHadronRest);
182 TLorentzVector leptonPrf = (TLorentzVector(lepton) *= toHadronRest);
187 TLorentzRotation boost = computeBoost(boson + hadron, &boson);
202 catch(std::exception&
e) {
204 "Exception in Particle::ComputeEventDependentQuantities: " <<
205 e.what() << std::endl;
210 return TLorentzVector(
px,
py,
pz,
E);
214 return static_cast<EventMC*
>(
event.GetObject());
232 if (idx <
GetEvent()->GetNTracks()) {
263 double p_(0.), e_(0.), px_(
ptVsGammaHCM), py_(0.), pz_(0.);
272 e_ = sqrt(pow(p_, 2.) + pow(
m, 2.));
274 e_ = sqrt(pow(p_, 2.) - pow(
m, 2.));
275 if (TMath::IsNaN(e_)) {
305 p_ = sqrt(pow(e_, 2.) + pow(
m, 2.));
310 return TLorentzVector(px_, py_, pz_, e_);