Jpp  test_elongated_shower_pde
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 
6 
7 #include "flux/Flux.hh"
8 
9 #include "JLang/JClonable.hh"
10 
11 #include "JAAnet/JFlux.hh"
12 #include "JAAnet/JDiffuseFlux.hh"
13 #include "JAAnet/JAAnetToolkit.hh"
15 
16 #include "JOscProb/JOscProb.hh"
17 #include "JOscProb/JOscChannel.hh"
19 
20 
21 /**
22  * \author bjung
23  */
24 
25 namespace JAANET {
26 
27  using JLANG::JClonable;
28 
29  using JOSCPROB::JOscProb;
32 
35 
36 
37  /**
38  * Implementation of oscillated neutrino flux.
39  */
40  struct JOscFlux :
41  public JClonable<JFlux, JOscFlux>,
42  public JDiffuseFluxHelper,
43  public JOscProbHelper
44  {
45  /**
46  * Default constructor.
47  */
49  {}
50 
51 
52  /**
53  * Constructor.
54  *
55  * \param diffuseFlux diffuse flux object
56  * \param oscProb oscillation probability interface
57  */
58  JOscFlux(const JDiffuseFlux& diffuseFlux,
59  const JOscProb& oscProb)
60  {
61  JDiffuseFluxHelper::configure(diffuseFlux);
63  }
64 
65 
66  /**
67  * Get flux for given event.
68  *
69  * Note that in this evaluation the zenith-angle is defined\n
70  * with respect to the line of sight (i.e. a neutrino pointing straight at you\n
71  * from the center of the Earth has \f$cos(\theta) = -1.0\f$).
72  *
73  * \param evt event
74  * \return flux [GeV^-1 * m^-2 * sr^-1 * s^-1]
75  */
76  double operator()(const Evt& evt) const
77  {
78  double flux = 0.0;
79 
80  const Trk& neutrino = get_neutrino(evt);
81  const double costh = -neutrino.dir.z / neutrino.dir.len();
82 
83  if (costh < 0.0) {
84 
85  const JOscChannel::JFlavour_t flavour = JOscChannel::getFlavour(neutrino);
87 
88  for (int i = 0; i != NUMBER_OF_OSCCHANNELS; ++i) {
89 
90  const JOscChannel& channel = getOscChannel[i];
91  const int typeIn = (int) JOscChannel::getIncomingNeutrinoType(channel);
92 
93  if (channel.out == flavour && channel.Cparity == Cparity) {
94 
95  flux += ( JDiffuseFluxHelper::getFactor(typeIn, log10(neutrino.E), costh) *
96  JOscProbHelper::getOscProb(channel, neutrino.E, costh) );
97  }
98  }
99 
100  } else {
101 
102  flux = JDiffuseFluxHelper::getFactor(neutrino.type, log10(neutrino.E), costh);
103  }
104 
105  return flux;
106  }
107 
108 
109  /**
110  * Get event-weight factor for given event.
111  *
112  * \param evt event
113  * \return event-weight factor [GeV^-1 * m^-2 * sr^-1 * s^-1]
114  */
115  double getFactor(const Evt& evt) const override
116  {
117  return (*this)(evt);
118  }
119  };
120 }
121 
122 #endif
JFlavour_t
Neutrino flavours.
Definition: JOscChannel.hh:35
Low-level interface for retrieving the oscillation probability corresponding to a given oscillation c...
Definition: JOscProb.hh:22
JChargeParity_t
Charge parities.
Definition: JOscChannel.hh:43
static JChargeParity_t getChargeParity(const int Cparity)
Get charge-parity of given neutrino.
Definition: JOscChannel.hh:173
Neutrino oscillation channel.
Definition: JOscChannel.hh:29
double z
Definition: Vec.hh:14
Implementation of oscillated neutrino flux.
Definition: JOscFlux.hh:40
virtual double getOscProb(const JOscChannel &oscChannel, const double energy, const double costh) const
Get oscillation probability corresponding to given oscillation channel, neutrino energy and zenith an...
Vec dir
track direction
Definition: Trk.hh:18
Helper class for oscillation probabilities.
double E
Energy [GeV] (either MC truth or reconstructed)
Definition: Trk.hh:20
double len() const
Get length.
Definition: Vec.hh:145
JOscFlux(const JDiffuseFlux &diffuseFlux, const JOscProb &oscProb)
Constructor.
Definition: JOscFlux.hh:58
JOscFlux()
Default constructor.
Definition: JOscFlux.hh:48
static int getIncomingNeutrinoType(const JOscChannel &channel)
Auxiliary function to retrieve incoming neutrino PDG type.
Definition: JOscChannel.hh:204
void configure(const JDiffuseFlux &diffuseFlux)
Configure oscillation probability function.
set_variable E_E log10(E_{fit}/E_{#mu})"
static const JOscChannel getOscChannel[]
Declare group of neutrino oscillation channels.
Definition: JOscChannel.hh:340
JChargeParity_t Cparity
Charge-parity.
Definition: JOscChannel.hh:301
Neutrino flux.
Definition: JHead.hh:890
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
static JFlavour_t getFlavour(const int pdgID)
Get flavour of neutrino.
Definition: JOscChannel.hh:139
double getFactor(const Evt &evt) const override
Get event-weight factor for given event.
Definition: JOscFlux.hh:115
Low-level interface for diffuse fluxes.
Definition: JDiffuseFlux.hh:24
double operator()(const Evt &evt) const
Get flux for given event.
Definition: JOscFlux.hh:76
int type
MC: particle type in PDG encoding.
Definition: Trk.hh:24
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
virtual void configure(const JOscProb &oscProb)
Configure oscillation probability function.
JFlavour_t out
Outcoming flavour.
Definition: JOscChannel.hh:300
static const int NUMBER_OF_OSCCHANNELS
Number of neutrino oscillation channels.
Definition: JOscChannel.hh:365
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
Definition: Evt.hh:19