Jpp  19.0.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JOscFlux.hh
Go to the documentation of this file.
1 #ifndef __JAANET__JOSCFLUX__
2 #define __JAANET__JOSCFLUX__
3 
5 
8 
9 #include "flux/Flux.hh"
10 
11 #include "JLang/JEquals.hh"
12 #include "JLang/JClonable.hh"
13 
14 #include "JAAnet/JFlux.hh"
15 #include "JAAnet/JDiffuseFlux.hh"
16 #include "JAAnet/JAAnetToolkit.hh"
17 #include "JAAnet/JParticleTypes.hh"
19 
20 #include "JOscProb/JOscChannel.hh"
23 
24 
25 /**
26  * \author bjung
27  */
28 
29 namespace JAANET {}
30 namespace JPP { using namespace JAANET; }
31 
32 namespace JAANET {
33 
34  using JLANG::JEquals;
35  using JLANG::JClonable;
36 
39 
40 
41  /**
42  * Implementation of oscillated neutrino flux.
43  */
44  struct JOscFlux :
45  public JEquals<JOscFlux>,
46  public JClonable<JFlux, JOscFlux>,
47  public JDiffuseFluxHelper,
48  public JOscProbHelper
49  {
50  /**
51  * Default constructor.
52  */
54  {}
55 
56 
57  /**
58  * Constructor.
59  *
60  * \param diffuseFlux diffuse flux object
61  * \param oscProb oscillation probability interface
62  */
63  JOscFlux(const JDiffuseFlux& diffuseFlux,
64  const JOscProbInterface& oscProb)
65  {
66  JDiffuseFluxHelper::configure(diffuseFlux);
68  }
69 
70 
71  /**
72  * Get flux for given event.
73  *
74  * Note that in this evaluation the zenith-angle is defined\n
75  * with respect to the line of sight (i.e. a neutrino pointing straight at you\n
76  * from the center of the Earth has \f$ cos(\theta) = -1.0 \f$).
77  *
78  * \param evt event
79  * \return flux \f$ \left[\mathrm{GeV}^{-1} \, \mathrm{m}^{-2} \, \mathrm{sr}^{-1} * \mathrm{s}^{-1}\right] \f$
80  */
81  double operator()(const Evt& evt) const
82  {
83  using namespace JPP;
84 
85  double flux = 0.0;
86 
87  const Trk& neutrino = get_neutrino(evt);
88  const double costh = -neutrino.dir.z;
89 
90  const int interactionType = evt.w2list[W2LIST_GSEAGEN_CC];
91 
92  if (interactionType == WEAK_CHARGED_CURRENT) {
93 
94  for (int i = 0; i != NUMBER_OF_OSCCHANNELS; ++i) {
95 
96  const JOscChannel& channel = getOscChannel[i];
97 
98  const int inType = ((int) channel.Cparity) * ((int) channel.in);
99  const int outType = ((int) channel.Cparity) * ((int) channel.out);
100 
101  if (outType == neutrino.type) {
102 
103  flux += ( JDiffuseFluxHelper::getFactor(inType, log10(neutrino.E), costh) *
104  JOscProbHelper::getP(channel, neutrino.E, costh) );
105  }
106  }
107 
108  } else if (interactionType == WEAK_NEUTRAL_CURRENT) { // For NC events, the neutrino flavour is irrelevant
109 
110  const int Cparity = (int) getChargeParity(neutrino);
111 
112  flux += (JDiffuseFluxHelper::getFactor(Cparity * TRACK_TYPE_NUE, log10(neutrino.E), costh) +
113  JDiffuseFluxHelper::getFactor(Cparity * TRACK_TYPE_NUMU, log10(neutrino.E), costh) +
114  JDiffuseFluxHelper::getFactor(Cparity * TRACK_TYPE_NUTAU, log10(neutrino.E), costh));
115  }
116 
117  return flux;
118  }
119 
120 
121  /**
122  * Check if this flux is equal to given flux.
123  *
124  * \param object flux object
125  * \return true if this flux is identical to given flux; else false
126  */
127  bool equals(const JOscFlux& object) const
128  {
129  return (static_cast<const JDiffuseFluxHelper&>(object) == static_cast<const JDiffuseFluxHelper&>(*this) &&
130  static_cast<const JOscProbHelper&>(object) == static_cast<const JOscProbHelper&> (*this));
131  }
132 
133 
134  /**
135  * Get event-weight factor for given event.
136  *
137  * \param evt event
138  * \return event-weight factor [GeV^-1 * m^-2 * sr^-1 * s^-1]
139  */
140  double getFactor(const Evt& evt) const override
141  {
142  return (*this)(evt);
143  }
144  };
145 }
146 
147 #endif
bool equals(const JOscFlux &object) const
Check if this flux is equal to given flux.
Definition: JOscFlux.hh:127
Implementation of oscillated neutrino flux.
Definition: JOscFlux.hh:44
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...
static const unsigned int NUMBER_OF_OSCCHANNELS
Number of neutrino oscillation channels.
Definition: JOscChannel.hh:351
Low-level interface for oscillation probability calculators.
Helper class for oscillation probabilities.
void configure(const JOscProbInterface &oscProb)
Configure oscillation probability function.
JChargeParity_t getChargeParity(const int pdgType)
Auxiliary function for retrieving the charge-parity of a given PDG type.
Definition: JOscChannel.hh:83
JOscFlux()
Default constructor.
Definition: JOscFlux.hh:53
void configure(const JDiffuseFlux &diffuseFlux)
Configure oscillation probability function.
JOscFlux(const JDiffuseFlux &diffuseFlux, const JOscProbInterface &oscProb)
Constructor.
Definition: JOscFlux.hh:63
set_variable E_E log10(E_{fit}/E_{#mu})"
static const JOscChannel getOscChannel[]
Declare group of neutrino oscillation channels.
Definition: JOscChannel.hh:326
Neutrino flux.
Definition: JHead.hh:906
Template definition of auxiliary base class for comparison of data structures.
Definition: JEquals.hh:24
Explicit emplate specialization of event-weight factor helper for diffuse flux objects.
Definition of hit and track types and auxiliary methods for handling Monte Carlo data.
Template class for object cloning.
Definition: JClonable.hh:20
double getFactor(const Evt &evt) const override
Get event-weight factor for given event.
Definition: JOscFlux.hh:140
Low-level interface for diffuse fluxes.
Definition: JDiffuseFlux.hh:27
double operator()(const Evt &evt) const
Get flux for given event.
Definition: JOscFlux.hh:81
static const int W2LIST_GSEAGEN_CC
Charged current interaction flag.
Definition of particle types.
double getFactor(const int type, const double log10E, const double costh) const
Get diffuse flux corresponding to given neutrino type, energy and zenith angle.
const Trk & get_neutrino(const Evt &evt)
Get incoming neutrino.
The Trk class represents a Monte Carlo (MC) particle as well as a reconstructed track/shower.
Definition: Trk.hh:14
std::vector< double > w2list
MC: factors that make up w[1]=w2 (see e.g. Tag list or km3net-dataformat/definitions) ...
Definition: Evt.hh:43
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
Definition: Evt.hh:20