Jpp  18.6.0-rc.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 46 of file JLorentzBoost.hh.

Constructor & Destructor Documentation

JAANET::JLorentzBoost::JLorentzBoost ( )
inline

Default constructor.

Definition at line 52 of file JLorentzBoost.hh.

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

Copy constructor.

Parameters
boostLorentz boost

Definition at line 61 of file JLorentzBoost.hh.

61  :
62  Boost(boost)
63  {}

Member Function Documentation

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

Retrieve gamma factor.

Returns
gamma factor

Definition at line 71 of file JLorentzBoost.hh.

72  {
73  const double beta2 = this->BetaVector().Mag2();
74 
75  return 1.0 / sqrt(1.0 - beta2);
76  }
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 86 of file JLorentzBoost.hh.

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

Lorentz boost operator.

Parameters
vertexevent vertex

Definition at line 97 of file JLorentzBoost.hh.

98  {
99  using namespace JPP;
100  using namespace ROOT::Math;
101 
102  const XYZTVector x0(vertex.getX(), vertex.getY(), vertex.getZ(), vertex.getT() * getSpeedOfLight());
103  const XYZTVector x1 = (*this)(x0);
104 
105  const JPosition3D pos1(x1.X(), x1.Y(), x1.Z());
106 
107  vertex.setPosition(pos1);
108  vertex.setT(x1.T() / getSpeedOfLight());
109  }
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 118 of file JLorentzBoost.hh.

120  {
121  using namespace JPP;
122  using namespace ROOT::Math;
123 
124  const double Ekin = getKineticEnergy(track.getE(), mass);
125 
126  const XYZTVector x0(track.getX(), track.getY(), track.getZ(), track.getT() * getSpeedOfLight());
127  const XYZTVector x1 = (*this)(x0);
128 
129  const PxPyPzEVector p0(Ekin * track.getDX(), Ekin * track.getDY(), Ekin * track.getDZ(), track.getE());
130  const PxPyPzEVector p1 = (*this)(p0);
131 
132  const JVector3D pos1(x1.X(), x1.Y(), x1.Z());
133  const JVersor3D dir1(p1.X(), p1.Y(), p1.Z());
134 
135  track.setPosition (pos1);
136  track.setDirection(dir1);
137  track.setT(x1.T());
138  track.setE(p1.E());
139  }
TPaveText * p1
double getKineticEnergy(const Trk &trk)
Get track kinetic energy.
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 148 of file JLorentzBoost.hh.

149  {
150  using namespace std;
151  using namespace JPP;
152  using namespace ROOT::Math;
153 
154  // Boost momentum 4-vector
155 
156  if (is_finalstate(track) || is_initialstate(track)) {
157 
158  const Vec Ekin = (track.status != TRK_ST_ININUCLEI ?
159  getKineticEnergy(track) * track.dir : Vec(0.0, 0.0, 0.0));
160 
161  const PxPyPzEVector p0(Ekin.x, Ekin.y, Ekin.z, track.E);
162  const PxPyPzEVector p1 = (*this)(p0);
163 
164  track.E = p1.E();
165  track.dir = Vec(p1.Px(), p1.Py(), p1.Pz());
166  if (track.dir.len() > 0) { track.dir.normalize(); }
167 
168  // Boost track vertex and compute new track length,
169  // assuming a relativistic particle traveling at the speed of light
170 
171  JVertex3D x0(getPosition(track.pos), track.t); // Vertex
172  JVertex3D x1(getPosition(track.pos + track.len * track.dir),
173  track.t + track.len / getSpeedOfLight()); // Vertex + travel distance
174 
175  (*this)(x0); // Boost vertices
176  (*this)(x1);
177 
178  track.t = x0.getT() / getSpeedOfLight();
179  track.pos = Vec(x0.getX(), x0.getY(), x0.getZ());
180 
181  track.len = x0.getDistance(x1);
182  }
183  }
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
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
double getKineticEnergy(const Trk &trk)
Get track kinetic energy.
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 192 of file JLorentzBoost.hh.

193  {
194  using namespace std;
195  using namespace JPP;
196 
197  const double dt = hit.t - hit.tdc;
198 
199  JVertex3D vertex(getPosition(hit.pos), hit.t);
200  (*this)(vertex);
201 
202  hit.pos = Vec(vertex.getX(), vertex.getY(), vertex.getZ());
203  hit.t = vertex.getT();
204 
205  hit.tdc = hit.t - getGamma() * dt;
206  }
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 216 of file JLorentzBoost.hh.

217  {
218  using namespace std;
219 
220  for (T i = __begin; i != __end; ++i) {
221  (*this)(*i);
222  }
223  }
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 233 of file JLorentzBoost.hh.

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

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