Jpp  debug
the software that should make you happy
Public Types | Public Member Functions | Static Public Member Functions | List of all members
JAANET::JDiffuseFlux Struct Reference

Low-level interface for diffuse fluxes. More...

#include <JDiffuseFlux.hh>

Inheritance diagram for JAANET::JDiffuseFlux:
JAANET::JFlux JAANET::JEvtWeightFactor JLANG::JClonable< JClonable_t, JDerived_t >

Public Types

typedef JClonable< JClonable_t >::clone_type clone_type
 

Public Member Functions

virtual ~JDiffuseFlux ()
 Virtual destructor. More...
 
double getFactor (const Evt &evt) const override
 Get diffuse flux for given event. More...
 
double getFactor (const int type, const double log10E, const double costh) const
 Get diffuse flux for given particle PDG-identifier, energy and zenith-angle. More...
 
double getFlux (const int type, const double log10E, const double costh) const
 Get diffuse flux for given particle PDG-identifier, energy and zenith-angle. More...
 
double operator() (const int type, const double log10E, const double costh) const
 Get diffuse flux for given particle PDG-identifier, energy and zenith-angle. More...
 
void Print () const override
 Print flux information. More...
 
double getFlux (const Evt &evt) const
 Get flux of given event. More...
 
double getFlux (const Evt &evt) const
 Get flux of given event. More...
 
double operator() (const Evt &evt) const
 Get event-weight factor of given event. More...
 
virtual bool is_valid () const
 Check whether this event-weight factor is valid. More...
 
void check_validity () const
 Check validity of this event-weight factor. More...
 
virtual JProperties getProperties (const JEquationParameters &eqpars=JEvtWeightFactor::getEquationParameters())
 Get properties of this class. More...
 
virtual JProperties getProperties (const JEquationParameters &eqpars=JEvtWeightFactor::getEquationParameters()) const
 Get properties of this class. More...
 
virtual std::istream & read (std::istream &in)
 Read event-weight factor from input. More...
 
virtual std::ostream & write (std::ostream &out) const
 Write event-weight factor to output. More...
 
virtual clone_type clone () const override
 Get clone of this object. More...
 

Static Public Member Functions

static const char *const getTypeKey ()
 Get type keyword. More...
 
static JEquationParametersgetEquationParameters ()
 Get equation parameters. More...
 
static void setEquationParameters (const JEquationParameters &eqpars)
 Set equation parameters. More...
 

Detailed Description

Low-level interface for diffuse fluxes.

Definition at line 27 of file JDiffuseFlux.hh.

Member Typedef Documentation

◆ clone_type

template<class JClonable_t , class JDerived_t >
typedef JClonable<JClonable_t>::clone_type JLANG::JClonable< JClonable_t, JDerived_t >::clone_type
inherited

Definition at line 61 of file JClonable.hh.

Constructor & Destructor Documentation

◆ ~JDiffuseFlux()

virtual JAANET::JDiffuseFlux::~JDiffuseFlux ( )
inlinevirtual

Virtual destructor.

Definition at line 36 of file JDiffuseFlux.hh.

37  {}

Member Function Documentation

◆ getFactor() [1/2]

double JAANET::JDiffuseFlux::getFactor ( const Evt evt) const
inlineoverridevirtual

Get diffuse flux for given event.

Parameters
evtevent
Returns
diffuse flux [GeV^-1 * m^-2 * sr^-1 * s^-1]

Implements JAANET::JEvtWeightFactor.

Definition at line 46 of file JDiffuseFlux.hh.

47  {
48  const Trk& neutrino = get_neutrino(evt);
49  const double log10E = log10(neutrino.E);
50  const double costh = neutrino.dir.z;
51 
52  return dNdEdOmega(neutrino.type, log10E, costh);
53  }
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: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

◆ getFactor() [2/2]

double JAANET::JDiffuseFlux::getFactor ( const int  type,
const double  log10E,
const double  costh 
) const
inline

Get diffuse flux for given particle PDG-identifier, energy and zenith-angle.

Parameters
typePDG particle type
log10Elogarithmic neutrino energy [GeV]
costhcosine zenith angle
Returns
diffuse flux [GeV^-1 * m^-2 * sr^-1 * s^-1]

Definition at line 64 of file JDiffuseFlux.hh.

67  {
68  return dNdEdOmega(type, log10E, costh);
69  }

◆ getFlux() [1/3]

double JAANET::JDiffuseFlux::getFlux ( const int  type,
const double  log10E,
const double  costh 
) const
inline

Get diffuse flux for given particle PDG-identifier, energy and zenith-angle.

Parameters
typePDG particle type
log10Elogarithmic neutrino energy [GeV]
costhcosine zenith angle
Returns
diffuse flux [GeV^-1 * m^-2 * sr^-1 * s^-1]

Definition at line 80 of file JDiffuseFlux.hh.

83  {
84  return dNdEdOmega(type, log10E, costh);
85  }

◆ operator()() [1/2]

double JAANET::JDiffuseFlux::operator() ( const int  type,
const double  log10E,
const double  costh 
) const
inline

Get diffuse flux for given particle PDG-identifier, energy and zenith-angle.

Parameters
typePDG particle type
log10Elogarithmic neutrino energy [GeV]
costhcosine zenith angle
Returns
diffuse flux [GeV^-1 * m^-2 * sr^-1 * s^-1]

Definition at line 96 of file JDiffuseFlux.hh.

99  {
100  return dNdEdOmega(type, log10E, costh);
101  }

◆ Print()

void JAANET::JDiffuseFlux::Print ( ) const
inlineoverride

Print flux information.

Definition at line 107 of file JDiffuseFlux.hh.

108  {
109  prnt(std::cout);
110  }

◆ getFlux() [2/3]

double JAANET::JFlux::getFlux
inline

Get flux of given event.

Parameters
evtevent
Returns
flux [GeV^-1 * m^-2 * sr^-1 * s^-1]

Definition at line 37 of file JFlux.hh.

38  {
39  return getFactor(evt);
40  }
double getFactor(const Evt &evt) const override
Get diffuse flux for given event.
Definition: JDiffuseFlux.hh:46

◆ getFlux() [3/3]

double JAANET::JFlux::getFlux ( const Evt evt) const
inlineinherited

Get flux of given event.

Parameters
evtevent
Returns
flux [GeV^-1 * m^-2 * sr^-1 * s^-1]

Definition at line 37 of file JFlux.hh.

38  {
39  return getFactor(evt);
40  }
virtual double getFactor(const Evt &evt) const =0
Get event-weight factor of given event.

◆ getTypeKey()

static const char* const JAANET::JEvtWeightFactor::getTypeKey ( )
inlinestaticinherited

Get type keyword.

Returns
type keyword

Definition at line 45 of file JEvtWeightFactor.hh.

46  {
47  return "type";
48  }

◆ operator()() [2/2]

double JAANET::JEvtWeightFactor::operator() ( const Evt evt) const
inlineinherited

Get event-weight factor of given event.

Parameters
evtevent
Returns
event-weight factor

Definition at line 66 of file JEvtWeightFactor.hh.

67  {
68  return getFactor(evt);
69  }

◆ is_valid()

virtual bool JAANET::JEvtWeightFactor::is_valid ( ) const
inlinevirtualinherited

Check whether this event-weight factor is valid.

Returns
true if valid; else false

Definition at line 77 of file JEvtWeightFactor.hh.

78  {
79  return true;
80  }

◆ check_validity()

void JAANET::JEvtWeightFactor::check_validity ( ) const
inlineinherited

Check validity of this event-weight factor.

Definition at line 86 of file JEvtWeightFactor.hh.

87  {
88  using namespace JPP;
89 
90  if (!is_valid()) {
91  THROW(JValueOutOfRange, "JEvtWeightFactor():check_validity(): Invalid event-weight factor " << *this);
92  }
93  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:712
Exception for accessing a value in a collection that is outside of its range.
Definition: JException.hh:180
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
virtual bool is_valid() const
Check whether this event-weight factor is valid.

◆ getEquationParameters()

static JEquationParameters& JAANET::JEvtWeightFactor::getEquationParameters ( )
inlinestaticinherited

Get equation parameters.

Returns
equation parameters

Definition at line 101 of file JEvtWeightFactor.hh.

102  {
103  static JEquationParameters equation("=", ",", "./", "#");
104 
105  return equation;
106  }
Simple data structure to support I/O of equations (see class JLANG::JEquation).

◆ setEquationParameters()

static void JAANET::JEvtWeightFactor::setEquationParameters ( const JEquationParameters eqpars)
inlinestaticinherited

Set equation parameters.

Parameters
eqparsequation parameters

Definition at line 114 of file JEvtWeightFactor.hh.

115  {
116  getEquationParameters() = eqpars;
117  }
static JEquationParameters & getEquationParameters()
Get equation parameters.

◆ getProperties() [1/2]

virtual JProperties JAANET::JEvtWeightFactor::getProperties ( const JEquationParameters eqpars = JEvtWeightFactor::getEquationParameters())
inlinevirtualinherited

Get properties of this class.

Parameters
eqparsequation parameters

Reimplemented in JAANET::JEvtWeightFactorTFormula.

Definition at line 125 of file JEvtWeightFactor.hh.

126  {
127  return JProperties(eqpars,1);
128  }
Utility class to parse parameter values.
Definition: JProperties.hh:501

◆ getProperties() [2/2]

virtual JProperties JAANET::JEvtWeightFactor::getProperties ( const JEquationParameters eqpars = JEvtWeightFactor::getEquationParameters()) const
inlinevirtualinherited

Get properties of this class.

Parameters
eqparsequation parameters

Reimplemented in JAANET::JEvtWeightFactorTFormula.

Definition at line 136 of file JEvtWeightFactor.hh.

137  {
138  return JProperties(eqpars,1);
139  }

◆ read()

virtual std::istream& JAANET::JEvtWeightFactor::read ( std::istream &  in)
inlinevirtualinherited

Read event-weight factor from input.

Parameters
ininput stream
Returns
input stream

Reimplemented in JAANET::JEvtWeightFactorTFormula.

Definition at line 148 of file JEvtWeightFactor.hh.

149  {
150  using namespace std;
151  using namespace JPP;
152 
153  JStringStream is(in);
154 
155  if (getFileStatus(is.str().c_str())) {
156  is.load();
157  }
158 
159  JProperties properties = getProperties();
160  is >> properties;
161 
162  check_validity();
163 
164  return in;
165  }
Wrapper class around STL stringstream class to facilitate optional loading of data from file.
static JStat getFileStatus
Function object for file status.
Definition: JStat.hh:173
Definition: JSTDTypes.hh:14
virtual JProperties getProperties(const JEquationParameters &eqpars=JEvtWeightFactor::getEquationParameters())
Get properties of this class.
void check_validity() const
Check validity of this event-weight factor.

◆ write()

virtual std::ostream& JAANET::JEvtWeightFactor::write ( std::ostream &  out) const
inlinevirtualinherited

Write event-weight factor to output.

Parameters
outoutput stream
Returns
output stream

Definition at line 174 of file JEvtWeightFactor.hh.

175  {
176  return out << getProperties();
177  }

◆ clone()

template<class JClonable_t , class JDerived_t >
virtual clone_type JLANG::JClonable< JClonable_t, JDerived_t >::clone ( ) const
inlineoverridevirtualinherited

The documentation for this struct was generated from the following file: