Jpp  master_rocky-37-gf0c5bc59d
the software that should make you happy
Classes | Public Types | Public Member Functions | Private Attributes | List of all members
JAANET::JPowerLawFlux Struct Referencefinal

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

#include <JPowerLawFlux.hh>

Inheritance diagram for JAANET::JPowerLawFlux:
JLANG::JEquals< JFirst_t, JSecond_t > JLANG::JClonable< JClonable_t, JDerived_t >

Classes

struct  JPowerLawFluxHelper
 Auxiliary class for I/O of power-law flux. More...
 

Public Types

typedef JClonable< JClonable_t >::clone_type clone_type
 

Public Member Functions

 JPowerLawFlux ()
 Default constructor. More...
 
 JPowerLawFlux (const double normalisation, const double spectralIndex)
 Constructor. More...
 
bool is_valid () const override final
 Check whether this power-law flux is valid. More...
 
double getFactor (const Evt &evt) const override final
 Get flux of given event. More...
 
bool equals (const JPowerLawFlux &object) const
 Check if this flux is identical to the given flux. More...
 
JProperties getProperties (const JEquationParameters &eqpars=JEvtWeightFactor::getEquationParameters()) override final
 Get properties of this class. More...
 
JProperties getProperties (const JEquationParameters &eqpars=JEvtWeightFactor::getEquationParameters()) const override final
 Get properties of this class. More...
 
std::istream & read (std::istream &in) override final
 Stream input. More...
 
virtual clone_type clone () const override
 Get clone of this object. More...
 

Private Attributes

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

Detailed Description

Example function object for computing power-law flux.

Definition at line 31 of file JPowerLawFlux.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

◆ JPowerLawFlux() [1/2]

JAANET::JPowerLawFlux::JPowerLawFlux ( )
inline

Default constructor.

Definition at line 38 of file JPowerLawFlux.hh.

38  :
39  normalisation(1.0),
40  spectralIndex(0.0)
41  {}
double spectralIndex
spectral index >= 0
double normalisation
normalisation [GeV * m^-2 * sr^-1 * s^-1]

◆ JPowerLawFlux() [2/2]

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 50 of file JPowerLawFlux.hh.

Member Function Documentation

◆ is_valid()

bool JAANET::JPowerLawFlux::is_valid ( ) const
inlinefinaloverride

Check whether this power-law flux is valid.

Returns
true if valid; else false

Definition at line 62 of file JPowerLawFlux.hh.

63  {
64  return normalisation > 0.0;
65  }

◆ getFactor()

double JAANET::JPowerLawFlux::getFactor ( const Evt evt) const
inlinefinaloverride

Get flux of given event.

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

Definition at line 74 of file JPowerLawFlux.hh.

75  {
76  using namespace std;
77  using namespace JPP;
78 
79  const Trk& primary = get_primary(evt);
80 
81  return normalisation * pow(primary.E, -spectralIndex);
82  }
const Trk & get_primary(const Evt &evt)
Get primary.
T pow(const T &x, const double y)
Power .
Definition: JMath.hh:97
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JSTDTypes.hh:14
Primary particle.
Definition: JHead.hh:1174
The Trk class represents a Monte Carlo (MC) particle as well as a reconstructed track/shower.
Definition: Trk.hh:15

◆ equals()

bool JAANET::JPowerLawFlux::equals ( const JPowerLawFlux object) const
inline

Check if this flux is identical to the given flux.

Parameters
objectpower-law flux object
Returns
true if this flux is identical to given flux; else flase

Definition at line 91 of file JPowerLawFlux.hh.

92  {
93  return (object.normalisation == this->normalisation &&
94  object.spectralIndex == this->spectralIndex);
95  }

◆ getProperties() [1/2]

JProperties JAANET::JPowerLawFlux::getProperties ( const JEquationParameters eqpars = JEvtWeightFactor::getEquationParameters())
inlinefinaloverride

Get properties of this class.

Parameters
eqparsequation parameters

Definition at line 103 of file JPowerLawFlux.hh.

104  {
105  return JPowerLawFluxHelper(*this, eqpars);
106  }

◆ getProperties() [2/2]

JProperties JAANET::JPowerLawFlux::getProperties ( const JEquationParameters eqpars = JEvtWeightFactor::getEquationParameters()) const
inlinefinaloverride

Get properties of this class.

Parameters
eqparsequation parameters

Definition at line 114 of file JPowerLawFlux.hh.

115  {
116  return JPowerLawFluxHelper(*this, eqpars);
117  }

◆ read()

std::istream& JAANET::JPowerLawFlux::read ( std::istream &  in)
inlinefinaloverride

Stream input.

Parameters
ininput stream
Returns
input stream

Definition at line 126 of file JPowerLawFlux.hh.

127  {
128  using namespace std;
129 
130  streampos pos = in.tellg();
131 
132  if (!(in >> normalisation >> spectralIndex)) {
133 
134  in.clear();
135  in.seekg(pos);
136 
137  JProperties properties = getProperties();
138 
139  in >> properties;
140  }
141 
142  check_validity();
143 
144  return in;
145  }
Utility class to parse parameter values.
Definition: JProperties.hh:501
JProperties getProperties(const JEquationParameters &eqpars=JEvtWeightFactor::getEquationParameters()) override final
Get properties of this class.

◆ clone()

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

Member Data Documentation

◆ normalisation

double JAANET::JPowerLawFlux::normalisation
private

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

Definition at line 175 of file JPowerLawFlux.hh.

◆ spectralIndex

double JAANET::JPowerLawFlux::spectralIndex
private

spectral index >= 0

Definition at line 176 of file JPowerLawFlux.hh.


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