Jpp in_tag_pdf_generation
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 (JPDB::getInstance().hasPDG(track.type) &&
111 can.is_inside(getPosition(track))) {
112
113 Evis = pythia(track.type, getKineticEnergy(track));
114 }
115 }
116
117 return Evis;
118 }
119
120
121 /**
122 * Get the visible energy vector of a track.\n
123 * This method accounts for muon radiative energy losses.
124 *
125 * \param track track
126 * \param can detector can
127 * \return visible energy vector [GeV]
128 */
129 inline Vec getVisibleEnergyVector(const Trk& track,
131 return getVisibleEnergy(track, can) * track.dir;
132 }
133
134
135 /**
136 * Get the visible energy of a given range of tracks.\n
137 * This method accounts for muon radiative energy losses.
138 *
139 * \param __begin start of track data
140 * \param __end end of track data
141 * \param can detector can
142 * \return visible energy [GeV]
143 */
144 inline double getVisibleEnergy(std::vector<Trk>::const_iterator __begin,
145 std::vector<Trk>::const_iterator __end,
147 {
148 using namespace std;
149
150 double Evis = 0.0;
151
152 for (vector<Trk>::const_iterator track = __begin; track != __end; ++track) {
153 Evis += getVisibleEnergy(*track, can);
154 }
155
156 return Evis;
157 }
158
159
160 /**
161 * Get the visible energy vector of a given range of tracks.\n
162 * This method accounts for muon radiative energy losses.
163 *
164 * \param __begin start of track data
165 * \param __end end of track data
166 * \param can detector can
167 * \return visible energy vector [GeV]
168 */
169 inline Vec getVisibleEnergyVector(std::vector<Trk>::const_iterator __begin,
170 std::vector<Trk>::const_iterator __end,
172 {
173 using namespace std;
174
175 Vec Evis(0.0, 0.0, 0.0);
176
177 for (vector<Trk>::const_iterator track = __begin; track != __end; ++track) {
178 Evis += getVisibleEnergyVector(*track, can);
179 }
180
181 return Evis;
182 }
183
184
185 /**
186 * Get the visible energy vector of an event.\n
187 * This method accounts for muon radiative energy losses.
188 *
189 * \param evt event
190 * \param can detector can
191 * \return visible energy [GeV]
192 */
193 inline double getVisibleEnergy(const Evt& evt,
195 {
196 return getVisibleEnergy(evt.mc_trks.begin(), evt.mc_trks.end(), can);
197 }
198
199
200 /**
201 * Get the visible energy vector of an event.\n
202 * This method accounts for muon radiative energy losses.
203 *
204 * \param evt event
205 * \param can detector can
206 * \return visible energy vector [GeV]
207 */
208 inline Vec getVisibleEnergyVector(const Evt& evt,
210 {
211 return getVisibleEnergyVector(evt.mc_trks.begin(), evt.mc_trks.end(), can);
212 }
213
214
215 /**
216 * Get visible energy of the leading lepton of a neutrino interaction.
217 *
218 * \param event event
219 * \param can containment volume
220 * \return visible energy of leading lepton [GeV]
221 */
222 inline double getVisibleEnergyLeadingLepton(const Evt& event,
224 {
225 using namespace std;
226 using namespace JPP;
227
228 double Evis = 0.0;
229
230 const Trk& leading_lepton = get_leading_lepton(event);
231
232 if (is_finalstate(leading_lepton)) {
233 Evis = getVisibleEnergy(leading_lepton, can);
234 } else { // For tau-leptons
235 for (vector<Trk>::const_iterator track = event.mc_trks.cbegin(); track != event.mc_trks.cend(); ++track) {
236 if (is_finalstate(*track) && track->mother_id == leading_lepton.id) {
237 Evis += getVisibleEnergy(*track, can);
238 }
239 }
240 }
241
242 return Evis;
243 }
244
245
246 /**
247 * Get visible energy vector of the leading lepton of a neutrino interaction.
248 *
249 * \param event event
250 * \param can containment volume
251 * \return visible energy vector of leading lepton [GeV]
252 */
255 {
256 using namespace std;
257 using namespace JPP;
258
259 Vec Evis(0.0, 0.0, 0.0);
260
261 const Trk& leading_lepton = get_leading_lepton(event);
262
263 if (is_finalstate(leading_lepton)) {
264 Evis = getVisibleEnergyVector(leading_lepton, can);
265 } else { // For tau-leptons
266 for (vector<Trk>::const_iterator track = event.mc_trks.cbegin(); track != event.mc_trks.cend(); ++track) {
267 if (is_finalstate(*track) && track->mother_id == leading_lepton.id) {
268 Evis += getVisibleEnergyVector(*track, can);
269 }
270 }
271 }
272
273 return Evis;
274 }
275}
276
277#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 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.
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
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
MC id of the parent particle.
Definition Trk.hh:29
The Vec class is a straightforward 3-d vector, which also works in pyroot.
Definition Vec.hh:13