Jpp  18.0.1-rc.2
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 
17 
18 #include "JPhysics/JConstants.hh"
19 #include "JPhysics/JGeane.hh"
20 
21 #include "JSirene/pythia.hh"
22 
23 
24 /**
25  * \file
26  *
27  * Auxiliary methods for evaluating visible energies.
28  * \author bjung
29  */
30 namespace JSIRENE {}
31 namespace JPP { using namespace JSIRENE; }
32 
33 namespace JSIRENE {
34 
35  using JAANET::JPDB;
36  using JAANET::is_muon;
37  using JAANET::getAxis;
38  using JAANET::getPosition;
40 
43 
45 
46  using JPHYSICS::geanc;
47  using JPHYSICS::gWater;
48  using JPHYSICS::MASS_MUON;
52 
53 
54  /**
55  * Get the visible energy of a track.\n
56  * This method accounts for muon radiative energy losses.
57  *
58  * \param track track
59  * \param can detector can
60  * \return visible energy [GeV]
61  */
62  inline Vec getVisibleEnergy(const Trk& track,
63  const JCylinder3D& can) {
64  using namespace std;
65  using namespace JPP;
66 
67  double Evis = 0.0;
68 
69  if (is_finalstate(track)) {
70 
71  if (is_muon(track)) {
72 
73  // Determine muon pathlength inside detector [m]
74 
75  const JCylinder3D::intersection_type& intersection = can.getIntersection(getAxis(track));
76 
77  const double Lmuon = gWater.getX(track.E, MASS_MUON / getSinThetaC());
78  const double Leff = (intersection.first < 0.0 ?
79  min(Lmuon, intersection.second) :
80  min(Lmuon, intersection.second) - intersection.first);
81 
82  // Determine visible energy deposition [GeV]
83 
84  const double dEb = gWater.getEb(track.E, Leff);
85  const double dEc = Leff / geanc();
86 
87  Evis = dEb + dEc;
88 
89  } else if (!is_neutrino(track) && JPDB::getInstance().hasPDG(track.type)) {
90 
91  Evis = pythia(track.type, getKineticEnergy(track));
92  }
93  }
94 
95  return Evis * track.dir / track.dir.len();
96  }
97 
98 
99  /**
100  * Get the visible energy of a track, assuming an infinite detector volume.\n
101  * This method accounts for muon radiative energy losses.
102  *
103  * \param track track
104  */
105  inline Vec getVisibleEnergy(const Trk& track)
106  {
107  static const JCylinder3D can(JCircle2D(JVector2D(), R_EARTH_KM * 1e3), -R_EARTH_KM * 1e3, R_EARTH_KM * 1e3);
108 
109  return getVisibleEnergy(track, can);
110  }
111 
112 
113  /**
114  * Get the visible energy of an event.\n
115  * This method accounts for muon radiative energy losses.
116  *
117  * \param evt event
118  * \param can detector can
119  * \return visible energy [GeV]
120  */
121  inline Vec getVisibleEnergy(const Evt& evt,
122  const JCylinder3D& can)
123  {
124  Vec Evis(0.0, 0.0, 0.0);
125 
126  for (std::vector<Trk>::const_iterator track = evt.mc_trks.begin(); track != evt.mc_trks.end(); ++track) {
127  Evis += getVisibleEnergy(*track, can);
128  }
129 
130  return Evis;
131  }
132 
133 
134  /**
135  * Get the visible energy of an event, assuming an infinite detector volume.\n
136  * This method accounts for muon radiative energy losses.
137  *
138  * \param evt event
139  * \return visible energy [GeV]
140  */
141  inline Vec getVisibleEnergy(const Evt& evt)
142  {
143  Vec Evis(0.0, 0.0, 0.0);
144 
145  for (std::vector<Trk>::const_iterator track = evt.mc_trks.cbegin(); track != evt.mc_trks.cend(); ++track) {
146  Evis += getVisibleEnergy(*track);
147  }
148 
149  return Evis;
150  }
151 }
152 
153 #endif
Data structure for vector in two dimensions.
Definition: JVector2D.hh:32
static const double R_EARTH_KM
Geophysics constants.
Data structure for circle in two dimensions.
Definition: JCircle2D.hh:33
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]
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
intersection_type getIntersection(const JAxis3D &axis) const
Get intersection points of axis with cylinder.
Definition: JCylinder3D.hh:277
double E
Energy [GeV] (either MC truth or reconstructed)
Definition: Trk.hh:20
Collection of particles.
Definition: JPDB.hh:109
double getEb(const double E, const double dx) const
Get energy loss due to pair production and bremsstrahlung.
Definition: JGeane.hh:334
double len() const
Get length.
Definition: Vec.hh:145
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.
JAxis3D getAxis(const Trk &track)
Get axis.
JPosition3D getPosition(const Vec &pos)
Get position.
Definition of hit and track types and auxiliary methods for handling Monte Carlo data.
Physics constants.
int type
MC: particle type in PDG encoding.
Definition: Trk.hh:24
Definition of particle types.
Function object for energy dependent energy loss of the muon.
Definition: JGeane.hh:206
Vec getVisibleEnergy(const Trk &track, const JCylinder3D &can)
Get the visible energy of a track.
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.