Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
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.
 
 JPowerLawFlux (const double normalisation, const double spectralIndex)
 Constructor.
 
bool is_valid () const override final
 Check whether this power-law flux is valid.
 
double getFactor (const Evt &evt) const override final
 Get flux of given event.
 
bool equals (const JPowerLawFlux &object) const
 Check if this flux is identical to the given flux.
 
JProperties getProperties (const JEquationParameters &eqpars=JEvtWeightFactor::getEquationParameters()) override final
 Get properties of this class.
 
JProperties getProperties (const JEquationParameters &eqpars=JEvtWeightFactor::getEquationParameters()) const override final
 Get properties of this class.
 
std::istream & read (std::istream &in) override final
 Stream input.
 
virtual clone_type clone () const override
 Get clone of this object.
 

Private Attributes

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

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 >
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.

51 :
54 {
55 check_validity();
56 }

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

65 {
66 return normalisation > 0.0;
67 }

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

77 {
78 using namespace std;
79 using namespace JPP;
80
81 const Trk& primary = get_primary(evt);
82
84 }
const Trk & get_primary(const Evt &evt)
Auxiliary function to retrieve the primary track of an event.
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).
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 93 of file JPowerLawFlux.hh.

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

◆ getProperties() [1/2]

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

Get properties of this class.

Parameters
eqparsequation parameters

Definition at line 105 of file JPowerLawFlux.hh.

106 {
107 return JPowerLawFluxHelper(*this, eqpars);
108 }

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

117 {
118 return JPowerLawFluxHelper(*this, eqpars);
119 }

◆ read()

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

Stream input.

Parameters
ininput stream
Returns
input stream

Definition at line 128 of file JPowerLawFlux.hh.

129 {
130 using namespace std;
131
132 streampos pos = in.tellg();
133
134 if (!(in >> normalisation >> spectralIndex)) {
135
136 in.clear();
137 in.seekg(pos);
138
139 JProperties properties = getProperties();
140
141 in >> properties;
142 }
143
144 check_validity();
145
146 return in;
147 }
Utility class to parse parameter values.
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 177 of file JPowerLawFlux.hh.

◆ spectralIndex

double JAANET::JPowerLawFlux::spectralIndex
private

spectral index >= 0

Definition at line 178 of file JPowerLawFlux.hh.


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