Jpp  18.5.2
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/JEquals.hh"
10 #include "JLang/JClonable.hh"
11 
12 #include "JAAnet/JFlux.hh"
13 #include "JAAnet/JDiffuseFlux.hh"
14 #include "JAAnet/JAAnetToolkit.hh"
16 
17 #include "JOscProb/JOscChannel.hh"
20 
21 
22 /**
23  * \author bjung
24  */
25 
26 namespace JAANET {}
27 namespace JPP { using namespace JAANET; }
28 
29 namespace JAANET {
30 
31  using JLANG::JEquals;
32  using JLANG::JClonable;
33 
36 
37 
38  /**
39  * Implementation of oscillated neutrino flux.
40  */
41  struct JOscFlux :
42  public JEquals<JOscFlux>,
43  public JClonable<JFlux, JOscFlux>,
44  public JDiffuseFluxHelper,
45  public JOscProbHelper
46  {
47  /**
48  * Default constructor.
49  */
51  {}
52 
53 
54  /**
55  * Constructor.
56  *
57  * \param diffuseFlux diffuse flux object
58  * \param oscProb oscillation probability interface
59  */
60  JOscFlux(const JDiffuseFlux& diffuseFlux,
61  const JOscProbInterface& oscProb)
62  {
63  JDiffuseFluxHelper::configure(diffuseFlux);
65  }
66 
67 
68  /**
69  * Get flux for given event.
70  *
71  * Note that in this evaluation the zenith-angle is defined\n
72  * with respect to the line of sight (i.e. a neutrino pointing straight at you\n
73  * from the center of the Earth has \f$ cos(\theta) = -1.0 \f$).
74  *
75  * \param evt event
76  * \return flux \f$ \left[\mathrm{GeV}^{-1} \, \mathrm{m}^{-2} \, \mathrm{sr}^{-1} * \mathrm{s}^{-1}\right] \f$
77  */
78  double operator()(const Evt& evt) const
79  {
80  using namespace JPP;
81 
82  double flux = 0.0;
83 
84  const Trk& neutrino = get_neutrino(evt);
85  const double costh = -neutrino.dir.z / neutrino.dir.len();
86 
87  for (int i = 0; i != NUMBER_OF_OSCCHANNELS; ++i) {
88 
89  const JOscChannel& channel = getOscChannel[i];
90 
91  const int inType = ((int) channel.Cparity) * ((int) channel.in);
92  const int outType = ((int) channel.Cparity) * ((int) channel.out);
93 
94  if (outType == neutrino.type) {
95 
96  flux += ( JDiffuseFluxHelper::getFactor(inType, log10(neutrino.E), costh) *
97  JOscProbHelper::getP(channel, neutrino.E, costh) );
98  }
99  }
100 
101  return flux;
102  }
103 
104 
105  /**
106  * Check if this flux is equal to given flux.
107  *
108  * \param object flux object
109  * \return true if this flux is identical to given flux; else false
110  */
111  bool equals(const JOscFlux& object) const
112  {
113  return (static_cast<const JDiffuseFluxHelper&>(object) == static_cast<const JDiffuseFluxHelper&>(*this) &&
114  static_cast<const JOscProbHelper&>(object) == static_cast<const JOscProbHelper&> (*this));
115  }
116 
117 
118  /**
119  * Get event-weight factor for given event.
120  *
121  * \param evt event
122  * \return event-weight factor [GeV^-1 * m^-2 * sr^-1 * s^-1]
123  */
124  double getFactor(const Evt& evt) const override
125  {
126  return (*this)(evt);
127  }
128  };
129 }
130 
131 #endif
bool equals(const JOscFlux &object) const
Check if this flux is equal to given flux.
Definition: JOscFlux.hh:111
Implementation of oscillated neutrino flux.
Definition: JOscFlux.hh:41
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.
JOscFlux()
Default constructor.
Definition: JOscFlux.hh:50
void configure(const JDiffuseFlux &diffuseFlux)
Configure oscillation probability function.
JOscFlux(const JDiffuseFlux &diffuseFlux, const JOscProbInterface &oscProb)
Constructor.
Definition: JOscFlux.hh:60
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:124
Low-level interface for diffuse fluxes.
Definition: JDiffuseFlux.hh:27
double operator()(const Evt &evt) const
Get flux for given event.
Definition: JOscFlux.hh:78
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
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
Definition: Evt.hh:20