Jpp 19.3.0-rc.3
the software that should make you happy
Loading...
Searching...
No Matches
JOSCPROB::JOscillogram Struct Reference

Auxiliary class for creating oscillograms. More...

#include <JOscillogram.hh>

Inheritance diagram for JOSCPROB::JOscillogram:
JOSCPROB::JOscProbHelper

Public Types

typedef JOscProbInterface::JOscParameters_t JOscParameters_t
 
typedef JOscProbInterface::JOscParameterReferences_t JOscParameterReferences_t
 
typedef JOscProbInterface::JParameter_t JParameter_t
 
typedef JOscProbInterface::argument_type argument_type
 
typedef JOscProbInterface::value_type value_type
 
typedef std::shared_ptr< JOscProbInterfacepointer_type
 

Public Member Functions

 JOscillogram (const JOscillogramAxis &abscissa, const JOscillogramAxis &ordinate, const JOscChannel &channel, const JOscProbInterface &oscprob)
 Constructor.
 
 JOscillogram (const std::string &abscissaName, const JGrid< double > abscissaBinning, const std::string &ordinateName, const JGrid< double > ordinateBinning, const JOscChannel &channel, const JOscProbInterface &oscprob)
 Constructor.
 
double getEnergy (const int i, const int j) const
 Get energy corrresponding to the given bin indices.
 
double getCosth (const int i, const int j) const
 Get cosine zenith angle corrresponding to the given bin indices.
 
double getP (const int i, const int j) const
 Get oscillation probability for given bin indices.
 
void configure (const pointer_type &pOscProb)
 Configure oscillation probability function.
 
void configure (const JOscProbInterface &oscProb)
 Configure oscillation probability function.
 
JOscProbInterfacegetOscProbInterface () const
 Get reference to oscillation probability interface.
 
JOscParameterReferences_tgetParameters () const
 Get reference to oscillation parameters interface.
 
void set (const JOscParameters_t &parameters) const
 Set oscillation parameters.
 
void set (const std::string &name, const value_type &value) const
 Set value for a given oscillation parameter.
 
template<class ... Args>
void set (const std::string &name, const value_type &value, const Args &...args) const
 Set value for given list of oscillation parameters.
 
double getBaseline (const double costh) const
 Get baseline for a given cosine zenith angle.
 
double getP (const JOscChannel &channel, const double energy, const double costh) const
 Get oscillation probability corresponding to given oscillation channel, neutrino energy and zenith angle.
 
double getP (const JOscParameters_t &parameters, const JOscChannel &channel, const double energy, const double costh) const
 Get oscillation probability for a given set of oscillation parameters
and a given oscillation channel.
 
double getP (const std::string &name, const double value, const JOscChannel &channel, const double E, const double costh) const
 Get oscillation probability for a given oscillation parameter
and a given oscillation channel.
 
template<class ... Args>
double getP (const std::string &name, const double value, const Args &...args) const
 Get oscillation probability for a given set of oscillation parameters
and a given oscillation channel.
 
JProperties getProperties (const JEquationParameters &eqpars=JOscProbInterface::getEquationParameters())
 Get properties of this class.
 
JProperties getProperties (const JEquationParameters &eqpars=JOscProbInterface::getEquationParameters()) const
 Get properties of this class.
 

Private Member Functions

std::pair< double, double > getTransformation (const int i, const int j) const
 Get energy and cosine zenith angle corresponding to the given bin indices.
 
double getCosth (const double L) const
 Get cosine zenith angle for a given baseline.
 

Private Attributes

JOscillogramAxis abscissa
 Abscissa axis.
 
JOscillogramAxis ordinate
 Ordinate axis.
 
JOscChannel channel
 Oscillation channel.
 

Detailed Description

Auxiliary class for creating oscillograms.

Definition at line 80 of file JOscillogram.hh.

Member Typedef Documentation

◆ JOscParameters_t

◆ JOscParameterReferences_t

◆ JParameter_t

◆ argument_type

◆ value_type

◆ pointer_type

Definition at line 40 of file JOscProbHelper.hh.

Constructor & Destructor Documentation

◆ JOscillogram() [1/2]

JOSCPROB::JOscillogram::JOscillogram ( const JOscillogramAxis & abscissa,
const JOscillogramAxis & ordinate,
const JOscChannel & channel,
const JOscProbInterface & oscprob )
inline

Constructor.

Parameters
abscissaoscillogram abscissa axis definition
ordinateoscillogram ordinate axis definition
channeloscillation channel
oscproboscillation probability calculator

Definition at line 91 of file JOscillogram.hh.

94 :
95 JOscProbHelper(oscprob),
99 {}
JOscProbHelper()
Default constructor.
JOscChannel channel
Oscillation channel.
JOscillogramAxis abscissa
Abscissa axis.
JOscillogramAxis ordinate
Ordinate axis.

◆ JOscillogram() [2/2]

JOSCPROB::JOscillogram::JOscillogram ( const std::string & abscissaName,
const JGrid< double > abscissaBinning,
const std::string & ordinateName,
const JGrid< double > ordinateBinning,
const JOscChannel & channel,
const JOscProbInterface & oscprob )
inline

Constructor.

Parameters
abscissaNameoscillogram abscissa variable name
abscissaBinningoscillogram abscissa binning
ordinateNameoscillogram ordinate variable name
ordinateBinningoscillogram ordinate binning
channeloscillation channel
oscproboscillation probability calculator

Definition at line 112 of file JOscillogram.hh.

117 :
118 JOscProbHelper(oscprob),
119 abscissa (JOscVars::getType(abscissaName), abscissaBinning),
120 ordinate (JOscVars::getType(ordinateName), ordinateBinning),
122 {}
static type getType(const std::string &name)
Get oscillation variable type.

Member Function Documentation

◆ getEnergy()

double JOSCPROB::JOscillogram::getEnergy ( const int i,
const int j ) const
inline

Get energy corrresponding to the given bin indices.

Parameters
iabscissa bin index
jordinate bin index
Returns
energy [GeV]

Definition at line 132 of file JOscillogram.hh.

133 {
135
136 return result.first;
137 }
std::pair< double, double > getTransformation(const int i, const int j) const
Get energy and cosine zenith angle corresponding to the given bin indices.

◆ getCosth() [1/2]

double JOSCPROB::JOscillogram::getCosth ( const int i,
const int j ) const
inline

Get cosine zenith angle corrresponding to the given bin indices.

Parameters
iabscissa bin index
jordinate bin index
Returns
energy [GeV]

Definition at line 147 of file JOscillogram.hh.

148 {
150
151 return result.second;
152 }

◆ getP() [1/5]

double JOSCPROB::JOscillogram::getP ( const int i,
const int j ) const
inline

Get oscillation probability for given bin indices.

Parameters
iabscissa bin index
jordinate bin index
Returns
oscillation probability

Definition at line 161 of file JOscillogram.hh.

162 {
163 const double& energy = getEnergy(i, j);
164 const double& costh = getCosth (i, j);
165
166 return JOscProbHelper::getP(channel, energy, costh);
167 }
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...
double getEnergy(const int i, const int j) const
Get energy corrresponding to the given bin indices.
double getCosth(const int i, const int j) const
Get cosine zenith angle corrresponding to the given bin indices.

◆ getTransformation()

std::pair< double, double > JOSCPROB::JOscillogram::getTransformation ( const int i,
const int j ) const
inlineprivate

Get energy and cosine zenith angle corresponding to the given bin indices.

Parameters
iabscissa bin index
jordinate bin index
Returns
transformed coordinate (E [GeV], costh)

Definition at line 180 of file JOscillogram.hh.

181 {
182 using namespace std;
183
184 static int ix = -1;
185 static int iy = -1;
186
187 static pair<double, double> result = {0.0, 0.0}; // Cache result
188
189 if (i != ix || j != iy) {
190
191 ix = i;
192 iy = j;
193
194 const double x = abscissa.getX(i);
195 const double y = ordinate.getX(j);
196
197 switch (ordinate.type) {
198 case (int) JOscVars::COSTH:
199 result.second = y;
200 break;
201 case (int) JOscVars::SINTH:
202 result.second = sqrt((1 + y) * (1 - y));
203 break;
204 case (int) JOscVars::BASELINE:
206 break;
207 default:
208 THROW(JValueOutOfRange, "JOscillogram::getCosth(const double): Invalid ordinate type " << ordinate.type);
209 }
210
211 switch (abscissa.type) {
212 case (int) JOscVars::ENERGY:
213 result.first = x;
214 break;
215 case (int) JOscVars::LOG10E:
216 result.first = pow(10.0, x);
217 break;
218 case (int) JOscVars::LOE:
219 result.first = (x > 0.0 ? this->getBaseline(result.second) / x : 0.0);
220 break;
221 default:
222 THROW(JValueOutOfRange, "JOscillogram::getEnergy(const double, const double): Invalid abscissa type " << abscissa.type);
223 }
224 }
225
226 return result;
227 }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
T pow(const T &x, const double y)
Power .
Definition JMath.hh:97
int j
Definition JPolint.hh:801
double getBaseline(const double costh) const
Get baseline for a given cosine zenith angle.
double getCosth(const double L) const
Get cosine zenith angle for a given baseline.
virtual abscissa_type getX(int index) const override
Get abscissa value.
Definition JGrid.hh:87

◆ getCosth() [2/2]

double JOSCPROB::JOscProbHelper::getCosth ( const double L) const
inlineprivate

Get cosine zenith angle for a given baseline.

Parameters
Lbaseline [km]
Returns
cosine zenith angle

Definition at line 167 of file JOscProbHelper.hh.

168 {
169 return getOscProbInterface().getCosth(L);
170 }
virtual double getCosth(const double L) const =0
Get cosine zenith angle for a given baseline.
JOscProbInterface & getOscProbInterface() const
Get reference to oscillation probability interface.

◆ configure() [1/2]

void JOSCPROB::JOscProbHelper::configure ( const pointer_type & pOscProb)
inlineinherited

Configure oscillation probability function.

Parameters
pOscProbshared pointer to oscillation probability function

Definition at line 76 of file JOscProbHelper.hh.

77 {
78 static_cast<pointer_type&>(*this) = pOscProb;
79 }
std::shared_ptr< JOscProbInterface > pointer_type

◆ configure() [2/2]

void JOSCPROB::JOscProbHelper::configure ( const JOscProbInterface & oscProb)
inlineinherited

Configure oscillation probability function.

Parameters
oscProboscillation probability function

Definition at line 87 of file JOscProbHelper.hh.

88 {
89 this->reset(oscProb.clone());
90 }
void reset(T &value)
Reset value.

◆ getOscProbInterface()

JOscProbInterface & JOSCPROB::JOscProbHelper::getOscProbInterface ( ) const
inlineinherited

Get reference to oscillation probability interface.

Returns
oscillation parameters

Definition at line 98 of file JOscProbHelper.hh.

99 {
100 using namespace JPP;
101
102 if (static_cast<const JOscProbHelper&>(*this)) {
103 return *(this->get());
104 } else {
105 THROW(JNullPointerException, "JOscProbHelper::getOscProbInterface(): Oscillation probability interface is not set.");
106 }
107 }
Exception for null pointer operation.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Helper class for oscillation probability calculators.

◆ getParameters()

JOscParameterReferences_t & JOSCPROB::JOscProbHelper::getParameters ( ) const
inlineinherited

Get reference to oscillation parameters interface.

Returns
reference to oscillation parameters interface

Definition at line 115 of file JOscProbHelper.hh.

116 {
118 }
JOscParameters_t & getParameters() const
Get reference to oscillation parameters interface.

◆ set() [1/3]

void JOSCPROB::JOscProbHelper::set ( const JOscParameters_t & parameters) const
inlineinherited

Set oscillation parameters.

Parameters
parametersoscillation parameters

Definition at line 126 of file JOscProbHelper.hh.

127 {
128 return getParameters().set(parameters);
129 }
void set(const std::string &name, const value_type &value)
Set value for a given oscillation parameter.
JOscParameterReferences_t & getParameters() const
Get reference to oscillation parameters interface.

◆ set() [2/3]

void JOSCPROB::JOscProbHelper::set ( const std::string & name,
const value_type & value ) const
inlineinherited

Set value for a given oscillation parameter.

Parameters
nameparameter name
valueparameter value

Definition at line 138 of file JOscProbHelper.hh.

140 {
141 getParameters().set(name, value);
142 }

◆ set() [3/3]

template<class ... Args>
void JOSCPROB::JOscProbHelper::set ( const std::string & name,
const value_type & value,
const Args &... args ) const
inlineinherited

Set value for given list of oscillation parameters.

Parameters
nameparameter name
valueparameter value
argsremaining pairs of parameter names and values

Definition at line 153 of file JOscProbHelper.hh.

156 {
157 getParameters().set(name, value, args...);
158 }

◆ getBaseline()

double JOSCPROB::JOscProbHelper::getBaseline ( const double costh) const
inlineinherited

Get baseline for a given cosine zenith angle.

Parameters
costhcosine zenith angle
Returns
baseline [km]

Definition at line 179 of file JOscProbHelper.hh.

180 {
181 return getOscProbInterface().getBaseline(costh);
182 }
virtual double getBaseline(const double costh) const =0
Get baseline for a given cosine zenith angle.

◆ getP() [2/5]

double JOSCPROB::JOscProbHelper::getP ( const JOscChannel & channel,
const double energy,
const double costh ) const
inlineinherited

Get oscillation probability corresponding to given oscillation channel, neutrino energy and zenith angle.

Parameters
channeloscillation channel
energyneutrino energy [GeV]
costhcosine zenith angle
Returns
oscillation probability

Definition at line 194 of file JOscProbHelper.hh.

197 {
198 return getOscProbInterface().getP(channel, energy, costh);
199 }
virtual double getP(const JOscChannel &channel, const double E, const double costh) const =0
Get oscillation probability for a given oscillation channel.

◆ getP() [3/5]

double JOSCPROB::JOscProbHelper::getP ( const JOscParameters_t & parameters,
const JOscChannel & channel,
const double energy,
const double costh ) const
inlineinherited

Get oscillation probability for a given set of oscillation parameters
and a given oscillation channel.

Parameters
channeloscillation channel
parametersoscillation parameters
energyneutrino energy [GeV]
costhcosine zenith angle
Returns
oscillation probability

Definition at line 212 of file JOscProbHelper.hh.

216 {
217 return getOscProbInterface().getP(parameters, channel, energy, costh);
218 }

◆ getP() [4/5]

double JOSCPROB::JOscProbHelper::getP ( const std::string & name,
const double value,
const JOscChannel & channel,
const double E,
const double costh ) const
inlineinherited

Get oscillation probability for a given oscillation parameter
and a given oscillation channel.

Parameters
nameparameter name
valueparameter value
channeloscillation channel
Eneutrino energy [GeV]
costhcosine zenith angle
Returns
oscillation probability

Definition at line 232 of file JOscProbHelper.hh.

237 {
238 return getOscProbInterface().getP(name, value, channel, E, costh);
239 }

◆ getP() [5/5]

template<class ... Args>
double JOSCPROB::JOscProbHelper::getP ( const std::string & name,
const double value,
const Args &... args ) const
inlineinherited

Get oscillation probability for a given set of oscillation parameters
and a given oscillation channel.

Parameters
nameparameter name
valueparameter value
argsremaining arguments

Definition at line 251 of file JOscProbHelper.hh.

254 {
255 return getOscProbInterface().getP(name, value, args...);
256 }

◆ getProperties() [1/2]

JProperties JOSCPROB::JOscProbHelper::getProperties ( const JEquationParameters & eqpars = JOscProbInterface::getEquationParameters())
inlineinherited

Get properties of this class.

Parameters
eqparsequation parameters

Definition at line 264 of file JOscProbHelper.hh.

265 {
266 return getOscProbInterface().getProperties(eqpars);
267 }
virtual JProperties getProperties(const JEquationParameters &equation=JOscParameters_t::getEquationParameters())
Get properties of this class.

◆ getProperties() [2/2]

JProperties JOSCPROB::JOscProbHelper::getProperties ( const JEquationParameters & eqpars = JOscProbInterface::getEquationParameters()) const
inlineinherited

Get properties of this class.

Parameters
eqparsequation parameters

Definition at line 275 of file JOscProbHelper.hh.

276 {
277 return getOscProbInterface().getProperties(eqpars);
278 }

Member Data Documentation

◆ abscissa

JOscillogramAxis JOSCPROB::JOscillogram::abscissa
private

Abscissa axis.

Definition at line 230 of file JOscillogram.hh.

◆ ordinate

JOscillogramAxis JOSCPROB::JOscillogram::ordinate
private

Ordinate axis.

Definition at line 231 of file JOscillogram.hh.

◆ channel

JOscChannel JOSCPROB::JOscillogram::channel
private

Oscillation channel.

Definition at line 233 of file JOscillogram.hh.


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