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);
58 , id(std::numeric_limits<Int_t>::min())
71 , parentId(std::numeric_limits<Int_t>::min())
84 static std::stringstream ss;
93 if (ss.fail() || !ss.eof()) {
94 throw std::runtime_error(
"Bad particle input: " + line);
104 std::cout <<
I <<
'\t' <<
KS <<
'\t' <<
id <<
'\t' <<
orig <<
'\t' <<
106 <<
'\t' <<
E <<
'\t' <<
m <<
'\t' <<
xv <<
'\t' <<
yv <<
'\t' <<
zv <<
112 pt = sqrt(pow(
px, 2.) + pow(
py, 2.));
113 p = sqrt(pow(
pt, 2.) + pow(
pz, 2.));
115 Double_t Epluspz =
E +
pz;
116 Double_t Eminuspz =
E -
pz;
117 Double_t Ppluspz =
p +
pz;
118 Double_t Pminuspz =
p -
pz;
119 if (Eminuspz <= 0.0 || Pminuspz == 0.0 ||
120 Ppluspz == 0.0 || Epluspz <= 0.0) {
125 rapidity = 0.5 * log(Epluspz / Eminuspz);
126 eta = 0.5 * log(Ppluspz / Pminuspz);
129 phi = TVector2::Phi_0_2pi(atan2(
py,
px));
135 const TLorentzVector& hadron =
event.BeamHadron()->Get4Vector();
136 const TLorentzVector& lepton =
event.ScatteredLepton()->Get4Vector();
137 const TLorentzVector& boson =
event.ExchangeBoson()->Get4Vector();
140 z = hadron.Dot(
Get4Vector()) / hadron.Dot(boson);
144 TLorentzRotation toHadronRest = computeBoost(hadron, &boson);
152 TLorentzVector bosonPrf = (TLorentzVector(boson) *= toHadronRest);
153 TLorentzVector leptonPrf = (TLorentzVector(lepton) *= toHadronRest);
158 TLorentzRotation boost = computeBoost(boson + hadron, &boson);
169 catch(std::exception& e) {
171 "Exception in Particle::ComputeEventDependentQuantities: " <<
172 e.what() << std::endl;
177 return TLorentzVector(
px,
py,
pz,
E);
181 return static_cast<EventMC*
>(
event.GetObject());
199 if (idx <
GetEvent()->GetNTracks()) {
230 double p_(0.), e_(0.), px_(
ptVsGamma), py_(0.), pz_(0.);
239 e_ = sqrt(pow(p_, 2.) + pow(
m, 2.));
241 e_ = sqrt(pow(p_, 2.) - pow(
m, 2.));
242 if (TMath::IsNaN(e_)) {
272 p_ = sqrt(pow(e_, 2.) + pow(
m, 2.));
277 return TLorentzVector(px_, py_, pz_, e_);
Double32_t m
Invariant mass of particle.
UShort_t ldaughter
I of last child particle.
Double32_t px
x component of particle momentum
Double32_t zv
z coordinate of particle production vertex
Double32_t E
Energy of particle.
void SetEvent(EventMC *event)
Double32_t eta
Pseudorapidity of particle.
Double32_t py
y component of particle momentum
UShort_t I
Particle index in event.
virtual void ComputeDerivedQuantities()
double computeHermesPhiH(const TLorentzVector &hadronInPrf, const TLorentzVector &leptonInPrf, const TLorentzVector &photonInPrf)
virtual UInt_t GetNTracks() const
Double32_t xv
x coordinate of particle production vertex
virtual TLorentzVector Get4Vector() const
ParticleMC(const std::string &="")
const EventMC * GetEvent() const
virtual void Print(Option_t *="") const
UShort_t orig
I of parent particle.
Double32_t pz
z component of particle momentum
virtual void SetVertex(const TVector3 &)
Double32_t yv
y coordinate of particle production vertex
Double32_t phi
Azimuthal angle.
Double32_t pt
Transverse momentum of particle.
Double32_t rapidity
Rapidity of particle.
virtual const ParticleMC * GetParent() const
virtual void Set4Vector(const TLorentzVector &)
Double32_t theta
Polar angle.
virtual const ParticleMC * GetChild(UShort_t) const
virtual Bool_t HasChild(Int_t) const
virtual const ParticleMC * GetTrack(UInt_t) const
virtual void ComputeEventDependentQuantities(EventMC &)
virtual TLorentzVector Get4VectorInHadronBosonFrame() const
UShort_t daughter
I of first child particle.
virtual UInt_t GetNChildren() const
Double32_t p
Total momentum of particle.
Int_t parentId
PDG code of this particle's parent.
virtual UInt_t GetIndex() const
virtual Double_t GetNu() const
UShort_t KS
Particle status code: see PYTHIA manual.
Double32_t xFeynman
Feynman x = pz/(2sqrt(s))
virtual Double_t GetW2() const
virtual UShort_t GetParentIndex() const