Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
JVisibleEnergyToolkit.hh
Go to the documentation of this file.
1#ifndef __JSIRENE__JVISIBLEENERGYTOOLKIT__
2#define __JSIRENE__JVISIBLEENERGYTOOLKIT__
3
5
10
13
16
20#include "JPhysics/JGeane.hh"
21
24#include "JAAnet/JPDB.hh"
25
26#include "JSirene/pythia.hh"
27
28
29/**
30 * \file
31 *
32 * Auxiliary methods for evaluating visible energies.
33 * \author bjung
34 */
35namespace JSIRENE {}
36namespace JPP { using namespace JSIRENE; }
37
38namespace JSIRENE {
39
41
42
43 /**
44 * Auxiliary function to retrieve the maximum cylindrical containment volume.
45 *
46 * \return maximum cylindrical containment volume
47 */
49 {
50 using namespace JPP;
51
52 const double R_Earth = R_EARTH_KM * 1e3; // m
53
54 const JVector2D center(0.0, 0.0);
55 const JCircle2D circle(center, R_Earth);
56
57 return JCylinder3D(circle, -R_Earth, R_Earth);
58 }
59
60
61 /**
62 * Get the visible energy of a track.\n
63 * This method accounts for muon radiative energy losses.\n
64 *
65 * Note: The optional parameter `can` is used only when the given track\n
66 * corresponds to a muon and if this track does not contain the\n
67 * `mc_usr_keys::energy_lost_in_can` information, generated by `JSirene`.
68 *
69 * \param track track
70 * \param can detector can
71 * \return visible energy [GeV]
72 */
73 double getVisibleEnergy(const Trk& track,
75 {
76 using namespace std;
77 using namespace JPP;
78
79 double Evis = 0.0;
80
81 if (is_finalstate(track)) {
82
83 const bool isMuon = is_muon(track);
84
85 if (isMuon && track.haveusr(mc_usr_keys::energy_lost_in_can)) {
86
88
89 } else if (isMuon) {
90
91 // Determine muon pathlength inside detector [m]
92
93 const JCylinder3D::intersection_type& intersection = can.getIntersection(getAxis(track));
94
95 const double Lmuon = gWater.getX(track.E, MASS_MUON / getSinThetaC());
96 const double Leff = (min(Lmuon, max(intersection.second, 0.0)) -
97 min(Lmuon, max(intersection.first, 0.0)));
98
99
100 // Determine visible energy deposition [GeV]
101
102 const double Emidpoint = gWater.getE(track.E, Lmuon/2.0);
103
104 const double dEb = gWater.getEb(track.E, Leff);
105 const double dEc = Leff / geanc();
106 const double dEd = Leff * getDeltaRaysFromMuon(Emidpoint);
107
108 Evis = dEb + dEc + dEd;
109
110 } else if (!is_neutrino(track) && JPDB::getInstance().hasPDG(track.type)) {
111
112 Evis = pythia(track.type, getKineticEnergy(track));
113 }
114 }
115
116 return Evis;
117 }
118
119
120 /**
121 * Get the visible energy vector of a track.\n
122 * This method accounts for muon radiative energy losses.
123 *
124 * \param track track
125 * \param can detector can
126 * \return visible energy vector [GeV]
127 */
128 inline Vec getVisibleEnergyVector(const Trk& track,
130 return getVisibleEnergy(track, can) * track.dir;
131 }
132
133
134 /**
135 * Get the visible energy of a given range of tracks.\n
136 * This method accounts for muon radiative energy losses.
137 *
138 * \param __begin start of track data
139 * \param __end end of track data
140 * \param can detector can
141 * \return visible energy [GeV]
142 */
143 inline double getVisibleEnergy(std::vector<Trk>::const_iterator __begin,
144 std::vector<Trk>::const_iterator __end,
146 {
147 using namespace std;
148
149 double Evis = 0.0;
150
151 for (vector<Trk>::const_iterator track = __begin; track != __end; ++track) {
152 Evis += getVisibleEnergy(*track, can);
153 }
154
155 return Evis;
156 }
157
158
159 /**
160 * Get the visible energy vector of a given range of tracks.\n
161 * This method accounts for muon radiative energy losses.
162 *
163 * \param __begin start of track data
164 * \param __end end of track data
165 * \param can detector can
166 * \return visible energy vector [GeV]
167 */
168 inline Vec getVisibleEnergyVector(std::vector<Trk>::const_iterator __begin,
169 std::vector<Trk>::const_iterator __end,
171 {
172 using namespace std;
173
174 Vec Evis(0.0, 0.0, 0.0);
175
176 for (vector<Trk>::const_iterator track = __begin; track != __end; ++track) {
177 Evis += getVisibleEnergyVector(*track, can);
178 }
179
180 return Evis;
181 }
182
183
184 /**
185 * Get the visible energy vector of an event.\n
186 * This method accounts for muon radiative energy losses.
187 *
188 * \param evt event
189 * \param can detector can
190 * \return visible energy [GeV]
191 */
192 inline double getVisibleEnergy(const Evt& evt,
194 {
195 return getVisibleEnergy(evt.mc_trks.begin(), evt.mc_trks.end(), can);
196 }
197
198
199 /**
200 * Get the visible energy vector of an event.\n
201 * This method accounts for muon radiative energy losses.
202 *
203 * \param evt event
204 * \param can detector can
205 * \return visible energy vector [GeV]
206 */
207 inline Vec getVisibleEnergyVector(const Evt& evt,
209 {
210 return getVisibleEnergyVector(evt.mc_trks.begin(), evt.mc_trks.end(), can);
211 }
212}
213
214#endif
Definition of hit and track types and auxiliary methods for handling Monte Carlo data.
Energy loss of muon.
Auxiliary methods for PDF calculations.
Definition of particle types.
Auxiliary methods for physics calculations.
Physics constants.
Data structure for circle in two dimensions.
Definition JCircle2D.hh:35
Data structure for vector in two dimensions.
Definition JVector2D.hh:34
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Detector simulations.
const JCylinder3D getMaximumContainmentVolume()
Forward function declarations.
double getVisibleEnergy(const Trk &, const JCylinder3D &)
Get the visible energy of a track.
static const JPythia pythia
Function object for relative light yield as a function of GEANT particle code.
Definition JPythia.hh:96
Vec getVisibleEnergyVector(const Trk &track, const JCylinder3D &can=getMaximumContainmentVolume())
Get the visible energy vector of a track.
const char *const energy_lost_in_can
Definition io_ascii.hh:46
This file contains converted Fortran code from km3.
bool haveusr(const std::string &key) const
Check availability of user data of the item with given key.
Definition AAObject.hh:42
double getusr(const std::string &key) const
Get user data item with given key.
Definition AAObject.hh:72
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
Definition Evt.hh:21
std::vector< Trk > mc_trks
MC: list of MC truth tracks.
Definition Evt.hh:49
static const JPDB & getInstance()
Get particle data book.
Definition JPDB.hh:131
The cylinder used for photon tracking.
Definition JHead.hh:575
The Trk class represents a Monte Carlo (MC) particle as well as a reconstructed track/shower.
Definition Trk.hh:15
int type
MC: particle type in PDG encoding.
Definition Trk.hh:24
Vec dir
track direction
Definition Trk.hh:18
double E
Energy [GeV] (either MC truth or reconstructed)
Definition Trk.hh:20
The Vec class is a straightforward 3-d vector, which also works in pyroot.
Definition Vec.hh:13