Jpp 21.0.0-rc.3
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
67 *
68 * \param track track
69 * \param can detector can
70 * \return visible energy [GeV]
71 */
72 double getVisibleEnergy(const Trk& track,
74 {
75 using namespace std;
76 using namespace JPP;
77
78 double Evis = 0.0;
79
80 if (is_finalstate(track)) {
81
82 const bool isMuon = is_muon(track);
83
84 if (isMuon) {
85
86 // Determine muon pathlength inside detector [m]
87
88 const JCylinder3D::intersection_type& intersection = can.getIntersection(getAxis(track));
89
90 const double Lmuon = gWater.getX(track.E, MASS_MUON / getSinThetaC());
91 const double Leff = (min(Lmuon, max(intersection.second, 0.0)) -
92 min(Lmuon, max(intersection.first, 0.0)));
93
94
95 // Determine visible energy deposition [GeV]
96
97 const double Emidpoint = gWater.getE(track.E, Lmuon/2.0);
98
99 const double dEb = gWater.getEb(track.E, Leff);
100 const double dEc = Leff / geanc();
101 const double dEd = Leff * JDeltaRays::getEnergyLossFromMuon(Emidpoint);
102
103 Evis = dEb + dEc + dEd;
104
105 } else if (JPDB::getInstance().hasPDG(track.type) &&
106 can.is_inside(getPosition(track))) {
107
108 Evis = pythia(track.type, getKineticEnergy(track));
109 }
110 }
111
112 return Evis;
113 }
114
115
116 /**
117 * Get the visible energy vector of a track.\n
118 * This method accounts for muon radiative energy losses.
119 *
120 * \param track track
121 * \param can detector can
122 * \return visible energy vector [GeV]
123 */
124 inline Vec getVisibleEnergyVector(const Trk& track,
126 return getVisibleEnergy(track, can) * track.dir;
127 }
128
129
130 /**
131 * Get the visible energy of a given range of tracks.\n
132 * This method accounts for muon radiative energy losses.
133 *
134 * \param __begin start of track data
135 * \param __end end of track data
136 * \param can detector can
137 * \return visible energy [GeV]
138 */
139 inline double getVisibleEnergy(std::vector<Trk>::const_iterator __begin,
140 std::vector<Trk>::const_iterator __end,
142 {
143 using namespace std;
144
145 double Evis = 0.0;
146
147 for (vector<Trk>::const_iterator track = __begin; track != __end; ++track) {
148 Evis += getVisibleEnergy(*track, can);
149 }
150
151 return Evis;
152 }
153
154
155 /**
156 * Get the visible energy vector of a given range of tracks.\n
157 * This method accounts for muon radiative energy losses.
158 *
159 * \param __begin start of track data
160 * \param __end end of track data
161 * \param can detector can
162 * \return visible energy vector [GeV]
163 */
164 inline Vec getVisibleEnergyVector(std::vector<Trk>::const_iterator __begin,
165 std::vector<Trk>::const_iterator __end,
167 {
168 using namespace std;
169
170 Vec Evis(0.0, 0.0, 0.0);
171
172 for (vector<Trk>::const_iterator track = __begin; track != __end; ++track) {
173 Evis += getVisibleEnergyVector(*track, can);
174 }
175
176 return Evis;
177 }
178
179
180 /**
181 * Get the visible energy vector of an event.\n
182 * This method accounts for muon radiative energy losses.
183 *
184 * \param evt event
185 * \param can detector can
186 * \return visible energy [GeV]
187 */
188 inline double getVisibleEnergy(const Evt& evt,
190 {
191 return getVisibleEnergy(evt.mc_trks.begin(), evt.mc_trks.end(), can);
192 }
193
194
195 /**
196 * Get the visible energy vector of an event.\n
197 * This method accounts for muon radiative energy losses.
198 *
199 * \param evt event
200 * \param can detector can
201 * \return visible energy vector [GeV]
202 */
203 inline Vec getVisibleEnergyVector(const Evt& evt,
205 {
206 return getVisibleEnergyVector(evt.mc_trks.begin(), evt.mc_trks.end(), can);
207 }
208
209
210 /**
211 * Get visible energy of the leading lepton of a neutrino interaction.
212 *
213 * \param event event
214 * \param can containment volume
215 * \return visible energy of leading lepton [GeV]
216 */
217 inline double getVisibleEnergyLeadingLepton(const Evt& event,
219 {
220 using namespace std;
221 using namespace JPP;
222
223 double Evis = 0.0;
224
225 const Trk& leading_lepton = get_leading_lepton(event);
226
227 if (is_finalstate(leading_lepton)) {
228 Evis = getVisibleEnergy(leading_lepton, can);
229 } else { // For tau-leptons
230 for (vector<Trk>::const_iterator track = event.mc_trks.cbegin(); track != event.mc_trks.cend(); ++track) {
231 if (is_finalstate(*track) && track->mother_id == leading_lepton.id) {
232 Evis += getVisibleEnergy(*track, can);
233 }
234 }
235 }
236
237 return Evis;
238 }
239
240
241 /**
242 * Get visible energy vector of the leading lepton of a neutrino interaction.
243 *
244 * \param event event
245 * \param can containment volume
246 * \return visible energy vector of leading lepton [GeV]
247 */
250 {
251 using namespace std;
252 using namespace JPP;
253
254 Vec Evis(0.0, 0.0, 0.0);
255
256 const Trk& leading_lepton = get_leading_lepton(event);
257
258 if (is_finalstate(leading_lepton)) {
259 Evis = getVisibleEnergyVector(leading_lepton, can);
260 } else { // For tau-leptons
261 for (vector<Trk>::const_iterator track = event.mc_trks.cbegin(); track != event.mc_trks.cend(); ++track) {
262 if (is_finalstate(*track) && track->mother_id == leading_lepton.id) {
263 Evis += getVisibleEnergyVector(*track, can);
264 }
265 }
266 }
267
268 return Evis;
269 }
270}
271
272#endif
Definition of hit and track types and auxiliary methods for handling Monte Carlo data.
Energy loss of muon.
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).
const JCylinder3D getMaximumContainmentVolume()
Forward function declarations.
double getVisibleEnergyLeadingLepton(const Trk &, const JCylinder3D &)
Vec getVisibleEnergyVectorLeadingLepton(const Evt &event, const JCylinder3D &can=getMaximumContainmentVolume())
Get visible energy vector of the leading lepton of a neutrino interaction.
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.
This file contains converted Fortran code from km3.
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
int id
track identifier
Definition Trk.hh:16
Vec dir
track direction
Definition Trk.hh:18
double E
Energy [GeV] (either MC truth or reconstructed)
Definition Trk.hh:20
int mother_id
id of the parent MC particle or of the reconstructed track at the previous stage
Definition Trk.hh:29
The Vec class is a straightforward 3-d vector, which also works in pyroot.
Definition Vec.hh:13