Jpp  18.2.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | List of all members
JAANET::JLorentzBoost Struct Reference

Auxiliary class for performing Lorentz boosts. More...

#include <JLorentzBoost.hh>

Inheritance diagram for JAANET::JLorentzBoost:

Public Member Functions

 JLorentzBoost ()
 Default constructor. More...
 
 JLorentzBoost (const Boost &boost)
 Copy constructor. More...
 
double getGamma () const
 Retrieve gamma factor. More...
 
template<class CoordSystem >
LorentzVector< CoordSystem > operator() (const LorentzVector< CoordSystem > &x4) const
 Lorentz boost operator. More...
 
void operator() (JVertex3D &vertex) const
 Lorentz boost operator. More...
 
void operator() (JTrack3E &track, const double mass) const
 Lorentz boost operator. More...
 
void operator() (Trk &track) const
 Lorentz boost operator. More...
 
void operator() (Hit &hit) const
 Lorentz boost operator. More...
 
template<class T >
void operator() (T __begin, T __end) const
 Lorentz boost operator. More...
 
void operator() (Evt &event) const
 Lorentz boost operator. More...
 

Detailed Description

Auxiliary class for performing Lorentz boosts.

Definition at line 45 of file JLorentzBoost.hh.

Constructor & Destructor Documentation

JAANET::JLorentzBoost::JLorentzBoost ( )
inline

Default constructor.

Definition at line 51 of file JLorentzBoost.hh.

52  {}
JAANET::JLorentzBoost::JLorentzBoost ( const Boost &  boost)
inline

Copy constructor.

Parameters
boostLorentz boost

Definition at line 60 of file JLorentzBoost.hh.

60  :
61  Boost(boost)
62  {}

Member Function Documentation

double JAANET::JLorentzBoost::getGamma ( ) const
inline

Retrieve gamma factor.

Returns
gamma factor

Definition at line 70 of file JLorentzBoost.hh.

71  {
72  const double beta2 = this->BetaVector().Mag2();
73 
74  return 1.0 / sqrt(1.0 - beta2);
75  }
template<class CoordSystem >
LorentzVector<CoordSystem> JAANET::JLorentzBoost::operator() ( const LorentzVector< CoordSystem > &  x4) const
inline

Lorentz boost operator.

Parameters
x44-vector
Returns
boosted 4-vector

Definition at line 85 of file JLorentzBoost.hh.

86  {
87  return static_cast<const Boost&>(*this)(x4);
88  }
void JAANET::JLorentzBoost::operator() ( JVertex3D vertex) const
inline

Lorentz boost operator.

Parameters
vertexevent vertex

Definition at line 96 of file JLorentzBoost.hh.

97  {
98  using namespace JPP;
99  using namespace ROOT::Math;
100 
101  const XYZTVector x0(vertex.getX(), vertex.getY(), vertex.getZ(), vertex.getT() * getSpeedOfLight());
102  const XYZTVector x1 = (*this)(x0);
103 
104  const JPosition3D pos1(x1.X(), x1.Y(), x1.Z());
105 
106  vertex.setPosition(pos1);
107  vertex.setT(x1.T() / getSpeedOfLight());
108  }
const double getSpeedOfLight()
Get speed of light.
void JAANET::JLorentzBoost::operator() ( JTrack3E track,
const double  mass 
) const
inline

Lorentz boost operator.

Parameters
tracktrack
masstrack particle mass

Definition at line 117 of file JLorentzBoost.hh.

119  {
120  using namespace JPP;
121  using namespace ROOT::Math;
122 
123  const double Ekin = getKineticEnergy(track.getE(), mass);
124 
125  const XYZTVector x0(track.getX(), track.getY(), track.getZ(), track.getT() * getSpeedOfLight());
126  const XYZTVector x1 = (*this)(x0);
127 
128  const PxPyPzEVector p0(Ekin * track.getDX(), Ekin * track.getDY(), Ekin * track.getDZ(), track.getE());
129  const PxPyPzEVector p1 = (*this)(p0);
130 
131  const JVector3D pos1(x1.X(), x1.Y(), x1.Z());
132  const JVersor3D dir1(p1.X(), p1.Y(), p1.Z());
133 
134  track.setPosition (pos1);
135  track.setDirection(dir1);
136  track.setT(x1.T());
137  track.setE(p1.E());
138  }
TPaveText * p1
double getKineticEnergy(const double E, const double m)
Get kinetic energy of particle with given mass.
const double getSpeedOfLight()
Get speed of light.
void JAANET::JLorentzBoost::operator() ( Trk track) const
inline

Lorentz boost operator.

N.B.: Only initial and final state tracks are boosted.

Parameters
tracktrack

Definition at line 147 of file JLorentzBoost.hh.

148  {
149  using namespace std;
150  using namespace JPP;
151  using namespace ROOT::Math;
152 
153  // Boost momentum 4-vector
154 
155  if (is_finalstate(track) || is_initialstate(track)) {
156 
157  const Vec Ekin = (track.status != TRK_ST_ININUCLEI ?
158  getKineticEnergy(track) * track.dir : Vec(0.0, 0.0, 0.0));
159 
160  const PxPyPzEVector p0(Ekin.x, Ekin.y, Ekin.z, track.E);
161  const PxPyPzEVector p1 = (*this)(p0);
162 
163  track.E = p1.E();
164  track.dir = Vec(p1.Px(), p1.Py(), p1.Pz());
165  if (track.dir.len() > 0) { track.dir.normalize(); }
166 
167  // Boost track vertex and compute new track length,
168  // assuming a relativistic particle traveling at the speed of light
169 
170  JVertex3D x0(getPosition(track.pos), track.t); // Vertex
171  JVertex3D x1(getPosition(track.pos + track.len * track.dir),
172  track.t + track.len / getSpeedOfLight()); // Vertex + travel distance
173 
174  (*this)(x0); // Boost vertices
175  (*this)(x1);
176 
177  track.t = x0.getT() / getSpeedOfLight();
178  track.pos = Vec(x0.getX(), x0.getY(), x0.getZ());
179 
180  track.len = x0.getDistance(x1);
181  }
182  }
TPaveText * p1
double t
track time [ns] (when the particle is at pos )
Definition: Trk.hh:19
double z
Definition: Vec.hh:14
Vec dir
track direction
Definition: Trk.hh:18
double E
Energy [GeV] (either MC truth or reconstructed)
Definition: Trk.hh:20
double y
Definition: Vec.hh:14
double len() const
Get length.
Definition: Vec.hh:145
bool is_finalstate(const Trk &track)
Test whether given track corresponds to a final state particle.
double x
Definition: Vec.hh:14
The Vec class is a straightforward 3-d vector, which also works in pyroot.
Definition: Vec.hh:12
double getKineticEnergy(const double E, const double m)
Get kinetic energy of particle with given mass.
JPosition3D getPosition(const Vec &pos)
Get position.
double len
length, if applicable [m]
Definition: Trk.hh:22
static const int TRK_ST_ININUCLEI
Initial state nuclei (gseagen)
Definition: trkmembers.hh:19
bool is_initialstate(const Trk &track)
Test whether given track corresponds to an initial state particle.
Vec & normalize()
Normalise this vector.
Definition: Vec.hh:159
int status
MC status code, see km3net-dataformat/definitions/trkmembers.csv for values.
Definition: Trk.hh:28
Vec pos
postion [m] of the track at time t
Definition: Trk.hh:17
const double getSpeedOfLight()
Get speed of light.
void JAANET::JLorentzBoost::operator() ( Hit hit) const
inline

Lorentz boost operator.

N.B.: The time-over-threshold is not boosted.

Parameters
hithit

Definition at line 191 of file JLorentzBoost.hh.

192  {
193  using namespace std;
194  using namespace JPP;
195 
196  const double dt = hit.t - hit.tdc;
197 
198  JVertex3D vertex(getPosition(hit.pos), hit.t);
199  (*this)(vertex);
200 
201  hit.pos = Vec(vertex.getX(), vertex.getY(), vertex.getZ());
202  hit.t = vertex.getT();
203 
204  hit.tdc = hit.t - getGamma() * dt;
205  }
Vec pos
hit position
Definition: Hit.hh:25
unsigned int tdc
hit tdc (=time in ns)
Definition: Hit.hh:16
The Vec class is a straightforward 3-d vector, which also works in pyroot.
Definition: Vec.hh:12
JPosition3D getPosition(const Vec &pos)
Get position.
double getGamma() const
Retrieve gamma factor.
double t
hit time (from tdc+calibration or MC truth)
Definition: Hit.hh:23
template<class T >
void JAANET::JLorentzBoost::operator() ( T  __begin,
T  __end 
) const
inline

Lorentz boost operator.

Parameters
__beginbegin of data
__endend of data

Definition at line 215 of file JLorentzBoost.hh.

216  {
217  using namespace std;
218 
219  for (T i = __begin; i != __end; ++i) {
220  (*this)(*i);
221  }
222  }
do set_variable OUTPUT_DIRECTORY $WORKDIR T
void JAANET::JLorentzBoost::operator() ( Evt event) const
inline

Lorentz boost operator.

N.B.: Intermediate state tracks as well as
the event timestamps and MC-time variable are not boosted.

Parameters
eventevent

Definition at line 232 of file JLorentzBoost.hh.

233  {
234  (*this)(event.mc_trks.begin(), event.mc_trks.end());
235  (*this)(event.mc_hits.begin(), event.mc_hits.end());
236  (*this)(event.trks.begin(), event.trks.end());
237  (*this)(event.hits.begin(), event.hits.end());
238  }

The documentation for this struct was generated from the following file: