Jpp master_rocky-44-g75b7c4f75
the software that should make you happy
Loading...
Searching...
No Matches
JOscFlux.hh
Go to the documentation of this file.
1#ifndef __JAANET__JOSCFLUX__
2#define __JAANET__JOSCFLUX__
3
5
8
9#include "JLang/JClonable.hh"
10
11#include "JAAnet/JGENIETypes.hh"
14
15#include "JAAnet/JFlux.hh"
18
22
23
24/**
25 * \author bjung
26 */
27
28namespace JAANET {}
29namespace JPP { using namespace JAANET; }
30
31namespace JAANET {
32
33 using JLANG::JClonable;
34
37
38
39 /**
40 * Implementation of oscillated neutrino flux.
41 */
42 struct JOscFlux :
43 public JClonable<JFlux, JOscFlux>
44 {
45 /**
46 * Constructor.
47 *
48 * \param diffuseFlux diffuse flux function object
49 * \param oscProb oscillation probability function object
50 */
51 JOscFlux(const JDiffuseFluxHelper& diffuseFlux,
52 const JOscProbHelper& oscProb) :
53 P(oscProb),
54 F(diffuseFlux)
55 {}
56
57
58 /**
59 * Check whether this oscillated neutrino flux object is valid.
60 *
61 * \return true if valid; else false
62 */
63 bool is_valid() const override final
64 {
65 return (F && F->is_valid() &&
66 P && P->getParameters().is_valid());
67 }
68
69
70 /**
71 * Get flux for given event.
72 *
73 * Note that in this evaluation the zenith-angle is defined\n
74 * with respect to the line of sight (i.e. a neutrino pointing straight at you\n
75 * from the center of the Earth has \f$ cos(\theta) = -1.0 \f$).
76 *
77 * \param evt event
78 * \return flux \f$ \left[\mathrm{GeV}^{-1} \, \mathrm{m}^{-2} \, \mathrm{sr}^{-1} \, \mathrm{s}^{-1}\right] \f$
79 */
80 double getFactor(const Evt& evt) const override final
81 {
82 using namespace JPP;
83
84 double flux = 0.0;
85
86 const Trk& neutrino = get_neutrino(evt);
87 const double costh = -neutrino.dir.z;
88
89 const int interactionType = evt.w2list[W2LIST_GSEAGEN_CC];
90
91 if (interactionType == (int) JInteractionTypeGENIE_t::WEAK_CHARGED_CURRENT) {
92
93 for (int i = 0; i != NUMBER_OF_OSCCHANNELS; ++i) {
94
95 const JOscChannel& channel = getOscChannel[i];
96
97 const int inType = ((int) channel.Cparity) * ((int) channel.in);
98 const int outType = ((int) channel.Cparity) * ((int) channel.out);
99
100 if (outType == neutrino.type) {
101
102 flux += ( F.getFlux(inType, log10(neutrino.E), costh) *
103 P.getP (channel, neutrino.E, costh) );
104 }
105 }
106
107 } else if (interactionType == (int) JInteractionTypeGENIE_t::WEAK_NEUTRAL_CURRENT) { // For NC events, the neutrino flavour is irrelevant
108
109 const int Cparity = (int) getChargeParity(neutrino);
110
111 flux += (F.getFlux(Cparity * TRACK_TYPE_NUE, log10(neutrino.E), costh) +
112 F.getFlux(Cparity * TRACK_TYPE_NUMU, log10(neutrino.E), costh) +
113 F.getFlux(Cparity * TRACK_TYPE_NUTAU, log10(neutrino.E), costh));
114 }
115
116 return flux;
117 }
118
119
120 /**
121 * Get properties of this class.
122 *
123 * \param eqpars equation parameters
124 */
126 {
127 return JOscFluxHelper(*this, eqpars);
128 }
129
130
131 /**
132 * Get properties of this class.
133 *
134 * \param eqpars equation parameters
135 */
137 {
138 return JOscFluxHelper(*this, eqpars);
139 }
140
141
142 /**
143 * Stream input.
144 *
145 * \param in input stream
146 * \return input stream
147 */
148 std::istream& read(std::istream& in) override final
149 {
150 using namespace std;
151 using namespace JPP;
152
153 if (F) {
154 F->read(in);
155 }
156
157 if (P) {
158 in >> P->getParameters();
159 }
160
161 check_validity();
162
163 return in;
164 }
165
166
167 protected:
168
171
172
173 private:
174
175 /**
176 * Auxiliary class for I/O of oscillated flux.
177 */
179 public JProperties
180 {
181 /**
182 * Constructor.
183 *
184 * \param oscflux oscillated flux
185 * \param eqpars equation parameters
186 */
187 template<class JOscFlux_t>
188 JOscFluxHelper(JOscFlux_t& oscflux,
189 const JEquationParameters& eqpars) :
190 JProperties(eqpars, 1)
191 {
192 using namespace JPP;
193
194 const JDiffuseFluxHelper& flux = oscflux.F;
195 const JOscProbHelper& oscprob = oscflux.P;
196
197 if (flux) { this->join(flux.getProperties()); }
198 if (oscprob) { this->join(oscprob.getParameters().getProperties()); }
199 }
200 };
201 };
202}
203
204#endif
Definition of hit and track types and auxiliary methods for handling Monte Carlo data.
Definition of GENIE neutrino interaction types.
Definition of particle types.
Utility class to parse parameter values.
JProperties & join(const JProperties &properties)
Join properties objects.
Simple data structure to support I/O of equations (see class JLANG::JEquation).
virtual JProperties getProperties(const JEquationParameters &equation=JOscParametersInterface_t::getEquationParameters())=0
Get properties of this class.
bool is_valid() const
Check validity of oscillation parameters.
Low-level interface for oscillation probability calculators.
Extensions to Evt data format.
@ WEAK_NEUTRAL_CURRENT
Weak neutral current interaction.
@ WEAK_CHARGED_CURRENT
Weak charged current interaction.
const Trk & get_neutrino(const Evt &evt)
Get incoming neutrino.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
Definition Evt.hh:21
Helper class for diffuse flux factor.
double getFlux(const int type, const double log10E, const double costh) const
Get flux for given particle PDG-identifier, energy and zenith-angle.
JProperties getProperties(const JEquationParameters &eqpars=JEvtWeightFactor::getEquationParameters())
Get properties of this class.
bool is_valid() const
Check whether this event-weight factor is valid.
static JEquationParameters & getEquationParameters()
Get equation parameters.
Auxiliary class for I/O of oscillated flux.
Definition JOscFlux.hh:180
JOscFluxHelper(JOscFlux_t &oscflux, const JEquationParameters &eqpars)
Constructor.
Definition JOscFlux.hh:188
Implementation of oscillated neutrino flux.
Definition JOscFlux.hh:44
bool is_valid() const override final
Check whether this oscillated neutrino flux object is valid.
Definition JOscFlux.hh:63
JOscFlux(const JDiffuseFluxHelper &diffuseFlux, const JOscProbHelper &oscProb)
Constructor.
Definition JOscFlux.hh:51
double getFactor(const Evt &evt) const override final
Get flux for given event.
Definition JOscFlux.hh:80
JProperties getProperties(const JEquationParameters &eqpars=JEvtWeightFactor::getEquationParameters()) override final
Get properties of this class.
Definition JOscFlux.hh:125
std::istream & read(std::istream &in) override final
Stream input.
Definition JOscFlux.hh:148
JOscProbHelper P
Definition JOscFlux.hh:169
JDiffuseFluxHelper F
Definition JOscFlux.hh:170
JProperties getProperties(const JEquationParameters &eqpars=JEvtWeightFactor::getEquationParameters()) const override final
Get properties of this class.
Definition JOscFlux.hh:136
Neutrino flux.
Definition JHead.hh:906
Template class for object cloning.
Definition JClonable.hh:59
Neutrino oscillation channel.
JChargeParity_t Cparity
Charge-parity.
JFlavour_t in
Incoming flavour.
JFlavour_t out
Outcoming flavour.
Helper class for oscillation probabilities.
JOscParameterReferences_t & getParameters() const
Get reference to oscillation parameters interface.
double getP(const JOscChannel &channel, const double energy, const double costh) const
Get oscillation probability corresponding to given oscillation channel, neutrino energy and zenith an...
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
double z
Definition Vec.hh:14
static const int W2LIST_GSEAGEN_CC
Charged current interaction flag.