Jpp  18.2.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JVisibleEnergyToolkit.hh
Go to the documentation of this file.
1 #ifndef __JSIRENE__JVISIBLEENERGYTOOLKIT__
2 #define __JSIRENE__JVISIBLEENERGYTOOLKIT__
3 
8 
10 #include "JAAnet/JParticleTypes.hh"
11 #include "JAAnet/JPDB.hh"
12 
13 #include "JGeometry2D/JVector2D.hh"
14 #include "JGeometry2D/JCircle2D.hh"
15 
18 
19 #include "JPhysics/JConstants.hh"
20 #include "JPhysics/JGeane.hh"
21 
22 #include "JSirene/pythia.hh"
23 
24 
25 /**
26  * \file
27  *
28  * Auxiliary methods for evaluating visible energies.
29  * \author bjung
30  */
31 namespace JSIRENE {}
32 namespace JPP { using namespace JSIRENE; }
33 
34 namespace JSIRENE {
35 
38 
39 
40  /**
41  * Get the visible energy of a track.\n
42  * This method accounts for muon radiative energy losses.
43  *
44  * \param track track
45  * \param can detector can
46  * \return visible energy [GeV]
47  */
48  double getVisibleEnergy(const Trk& track,
50  {
51  using namespace std;
52  using namespace JPP;
53 
54  double Evis = 0.0;
55 
56  if (is_finalstate(track)) {
57 
58  if (is_muon(track)) {
59 
60  // Determine muon pathlength inside detector [m]
61 
62  const JCylinder3D::intersection_type& intersection = can.getIntersection(getAxis(track));
63 
64  const double Lmuon = gWater.getX(track.E, MASS_MUON / getSinThetaC());
65  const double Leff = (intersection.first < 0.0 ?
66  min(Lmuon, intersection.second) :
67  min(Lmuon, intersection.second) - intersection.first);
68 
69  // Determine visible energy deposition [GeV]
70 
71  const double dEb = gWater.getEb(track.E, Leff);
72  const double dEc = Leff / geanc();
73 
74  Evis = dEb + dEc;
75 
76  } else if (!is_neutrino(track) && JPDB::getInstance().hasPDG(track.type)) {
77 
78  Evis = pythia(track.type, getKineticEnergy(track));
79  }
80  }
81 
82  return Evis;
83  }
84 
85 
86  /**
87  * Get the visible energy vector of a track.\n
88  * This method accounts for muon radiative energy losses.
89  *
90  * \param track track
91  * \param can detector can
92  * \return visible energy vector [GeV]
93  */
94  inline Vec getVisibleEnergyVector(const Trk& track,
96  return getVisibleEnergy(track, can) * track.dir;
97  }
98 
99 
100  /**
101  * Get the visible energy of a given range of tracks.\n
102  * This method accounts for muon radiative energy losses.
103  *
104  * \param __begin start of track data
105  * \param __end end of track data
106  * \param can detector can
107  * \return visible energy [GeV]
108  */
112  {
113  using namespace std;
114 
115  double Evis = 0.0;
116 
117  for (vector<Trk>::const_iterator track = __begin; track != __end; ++track) {
118  Evis += getVisibleEnergy(*track, can);
119  }
120 
121  return Evis;
122  }
123 
124 
125  /**
126  * Get the visible energy vector of a given range of tracks.\n
127  * This method accounts for muon radiative energy losses.
128  *
129  * \param __begin start of track data
130  * \param __end end of track data
131  * \param can detector can
132  * \return visible energy vector [GeV]
133  */
137  {
138  using namespace std;
139 
140  Vec Evis(0.0, 0.0, 0.0);
141 
142  for (vector<Trk>::const_iterator track = __begin; track != __end; ++track) {
143  Evis += getVisibleEnergyVector(*track, can);
144  }
145 
146  return Evis;
147  }
148 
149 
150  /**
151  * Get the visible energy vector of an event.\n
152  * This method accounts for muon radiative energy losses.
153  *
154  * \param evt event
155  * \param can detector can
156  * \return visible energy [GeV]
157  */
158  inline double getVisibleEnergy(const Evt& evt,
160  {
161  return getVisibleEnergy(evt.mc_trks.begin(), evt.mc_trks.end(), can);
162  }
163 
164 
165  /**
166  * Get the visible energy vector of an event.\n
167  * This method accounts for muon radiative energy losses.
168  *
169  * \param evt event
170  * \param can detector can
171  * \return visible energy vector [GeV]
172  */
173  inline Vec getVisibleEnergyVector(const Evt& evt,
175  {
176  return getVisibleEnergyVector(evt.mc_trks.begin(), evt.mc_trks.end(), can);
177  }
178 }
179 
180 #endif
double geanc()
Equivalent muon track length per unit shower energy.
Definition: JGeane.hh:28
Energy loss of muon.
This file contains converted Fortran code from km3.
bool is_muon(const Trk &track)
Test whether given track is a (anti-)muon.
Vec dir
track direction
Definition: Trk.hh:18
static const double MASS_MUON
muon mass [GeV]
Vec getVisibleEnergyVector(const Trk &track, const JCylinder3D &can=getMaximumContainmentVolume())
Get the visible energy vector of a track.
static const JGeaneWater gWater
Function object for energy loss of muon in sea water.
Definition: JGeane.hh:381
virtual double getX(const double E0, const double E1) const override
Get distance traveled by muon.
Definition: JGeane.hh:349
static const JPythia pythia
Function object for relative light yield as a function of GEANT particle code.
Definition: JPythia.hh:96
double E
Energy [GeV] (either MC truth or reconstructed)
Definition: Trk.hh:20
double getEb(const double E, const double dx) const
Get energy loss due to pair production and bremsstrahlung.
Definition: JGeane.hh:334
static const JPDB & getInstance()
Get particle data book.
Definition: JPDB.hh:125
bool is_neutrino(const Trk &track)
Test whether given track is a neutrino.
bool is_finalstate(const Trk &track)
Test whether given track corresponds to a final state particle.
The Vec class is a straightforward 3-d vector, which also works in pyroot.
Definition: Vec.hh:12
Cylinder object.
Definition: JCylinder3D.hh:39
double getKineticEnergy(const double E, const double m)
Get kinetic energy of particle with given mass.
const JCylinder3D getMaximumContainmentVolume()
Auxiliary function to retrieve the maximum cylindrical containment volume.
JAxis3D getAxis(const Trk &track)
Get axis.
Definition of hit and track types and auxiliary methods for handling Monte Carlo data.
double getVisibleEnergy(const Trk &track, const JCylinder3D &can=getMaximumContainmentVolume())
Get the visible energy of a track.
Physics constants.
int type
MC: particle type in PDG encoding.
Definition: Trk.hh:24
Definition of particle types.
The Trk class represents a Monte Carlo (MC) particle as well as a reconstructed track/shower.
Definition: Trk.hh:14
std::vector< Trk > mc_trks
MC: list of MC truth tracks.
Definition: Evt.hh:49
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
Definition: Evt.hh:20
double getSinThetaC()
Get average sine of Cherenkov angle of water corresponding to group velocity.