Jpp  18.0.0-rc.4
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Public Attributes | Friends | List of all members
JAANET::JPowerLawFlux Struct Reference

Example function object for computing power-law flux. More...

#include <JPowerLawFlux.hh>

Public Member Functions

 JPowerLawFlux ()
 Default constructor. More...
 
 JPowerLawFlux (const double normalisation, const double spectralIndex)
 Constructor. More...
 
double operator() (const Evt &evt) const
 Get flux of given event. More...
 

Public Attributes

double normalisation
 normalisation [GeV * m^-2 * sr^-1 * s^-1] More...
 
double spectralIndex
 spectral index >= 0 More...
 

Friends

std::istream & operator>> (std::istream &in, JPowerLawFlux &object)
 Stream input. More...
 
std::ostream & operator<< (std::ostream &out, const JPowerLawFlux &object)
 Write power-law parameters to output stream. More...
 

Detailed Description

Example function object for computing power-law flux.

Definition at line 16 of file JPowerLawFlux.hh.

Constructor & Destructor Documentation

JAANET::JPowerLawFlux::JPowerLawFlux ( )
inline

Default constructor.

Definition at line 21 of file JPowerLawFlux.hh.

21  :
22  normalisation(1.0),
23  spectralIndex(0.0)
24  {}
double normalisation
normalisation [GeV * m^-2 * sr^-1 * s^-1]
double spectralIndex
spectral index &gt;= 0
JAANET::JPowerLawFlux::JPowerLawFlux ( const double  normalisation,
const double  spectralIndex 
)
inline

Constructor.

Parameters
normalisationnormalisation [GeV * m^-2 * sr^-1 * s^-1]
spectralIndexspectral index

Definition at line 33 of file JPowerLawFlux.hh.

34  :
37  {}
double normalisation
normalisation [GeV * m^-2 * sr^-1 * s^-1]
double spectralIndex
spectral index &gt;= 0

Member Function Documentation

double JAANET::JPowerLawFlux::operator() ( const Evt evt) const
inline

Get flux of given event.

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

Definition at line 46 of file JPowerLawFlux.hh.

47  {
48  using namespace std;
49  using namespace JPP;
50 
51  if (has_neutrino(evt)) {
52 
53  const Trk& neutrino = get_neutrino(evt);
54 
55  return normalisation * pow(neutrino.E, -spectralIndex);
56 
57  } else {
58 
59  THROW(JNullPointerException, "JPowerLawFlux::operator(): No neutrino for event " << evt.id << '.' << endl);
60  }
61  }
double normalisation
normalisation [GeV * m^-2 * sr^-1 * s^-1]
bool has_neutrino(const Evt &evt)
Test whether given event has an incoming neutrino.
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:696
double E
Energy [GeV] (either MC truth or reconstructed)
Definition: Trk.hh:20
double spectralIndex
spectral index &gt;= 0
T pow(const T &x, const double y)
Power .
Definition: JMath.hh:97
int id
offline event identifier
Definition: Evt.hh:22
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

Friends And Related Function Documentation

std::istream& operator>> ( std::istream &  in,
JPowerLawFlux object 
)
friend

Stream input.

Parameters
ininput stream
objectpower-law flux
Returns
input stream

Definition at line 71 of file JPowerLawFlux.hh.

73  {
74  return in >> object.normalisation
75  >> object.spectralIndex;
76  }
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Definition: JCanberra.sh:46
std::ostream& operator<< ( std::ostream &  out,
const JPowerLawFlux object 
)
friend

Write power-law parameters to output stream.

Parameters
outoutput stream
objectpower-law flux
Returns
output stream

Definition at line 86 of file JPowerLawFlux.hh.

88  {
89  const JFormat format(out);
90 
91  out << FIXED(5,3) << object.normalisation << ' '
92  << FIXED(5,3) << object.spectralIndex;
93 
94  return out;
95  }
Auxiliary data structure for floating point format specification.
Definition: JManip.hh:446
Auxiliary class to temporarily define format specifications.
Definition: JManip.hh:632

Member Data Documentation

double JAANET::JPowerLawFlux::normalisation

normalisation [GeV * m^-2 * sr^-1 * s^-1]

Definition at line 98 of file JPowerLawFlux.hh.

double JAANET::JPowerLawFlux::spectralIndex

spectral index >= 0

Definition at line 99 of file JPowerLawFlux.hh.


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