Jpp 21.0.0
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< JOscProbInterface > pointer_type
 

Public Member Functions

 JOscillogram (const JOscillogramAxis &abscissa, const JOscillogramAxis &ordinate, const JOscChannel &channel, const JOscProbHelper &oscprob)
 Constructor.
 
template<class T >
 JOscillogram (const std::string &abscissaName, const T &abscissa, const std::string &ordinateName, const T &ordinate, const JOscChannel &channel, const JOscProbHelper &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.
 
JOscProbInterface & getOscProbInterface () const
 Get reference to oscillation probability interface.
 
JOscParameterReferences_t & getParameters () 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 98 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 JOscProbHelper & oscprob )
inline

Constructor.

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

Definition at line 109 of file JOscillogram.hh.

112 :
113 JOscProbHelper(oscprob),
117 {}
JOscProbHelper()
Default constructor.
JOscChannel channel
Oscillation channel.
JOscillogramAxis abscissa
Abscissa axis.
JOscillogramAxis ordinate
Ordinate axis.

◆ JOscillogram() [2/2]

template<class T >
JOSCPROB::JOscillogram::JOscillogram ( const std::string & abscissaName,
const T & abscissa,
const std::string & ordinateName,
const T & ordinate,
const JOscChannel & channel,
const JOscProbHelper & oscprob )
inline

Constructor.

Parameters
abscissaNameoscillogram abscissa variable name
abscissaoscillogram abscissa axis
ordinateNameoscillogram ordinate variable name
ordinateoscillogram ordinate axis
channeloscillation channel
oscproboscillation probability calculator

Definition at line 131 of file JOscillogram.hh.

136 :
137 JOscProbHelper(oscprob),
138 abscissa (JOscVars::getType(abscissaName), abscissa),
139 ordinate (JOscVars::getType(ordinateName), ordinate),
141 {}
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 151 of file JOscillogram.hh.

152 {
154
155 return result.first;
156 }
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 166 of file JOscillogram.hh.

167 {
169
170 return result.second;
171 }

◆ 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 180 of file JOscillogram.hh.

181 {
182 const double& energy = getEnergy(i, j);
183 const double& costh = getCosth (i, j);
184
185 return JOscProbHelper::getP(channel, energy, costh);
186 }
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 199 of file JOscillogram.hh.

200 {
201 using namespace std;
202
203 static int ix = -1;
204 static int iy = -1;
205
206 static pair<double, double> result = {0.0, 0.0}; // Cache result
207
208 if (i != ix || j != iy) {
209
210 ix = i;
211 iy = j;
212
213 const double x = abscissa.getX(i);
214 const double y = ordinate.getX(j);
215
216 switch (ordinate.type) {
217 case (int) JOscVars::COSTH:
218 result.second = y;
219 break;
220 case (int) JOscVars::SINTH:
221 result.second = sqrt((1 + y) * (1 - y));
222 break;
223 case (int) JOscVars::BASELINE:
225 break;
226 default:
227 THROW(JValueOutOfRange, "JOscillogram::getCosth(const double): Invalid ordinate type " << ordinate.type);
228 }
229
230 switch (abscissa.type) {
231 case (int) JOscVars::ENERGY:
232 result.first = x;
233 break;
234 case (int) JOscVars::LOG10E:
235 result.first = pow(10.0, x);
236 break;
237 case (int) JOscVars::LOE:
238 result.first = (x > 0.0 ? this->getBaseline(result.second) / x : 0.0);
239 break;
240 default:
241 THROW(JValueOutOfRange, "JOscillogram::getEnergy(const double, const double): Invalid abscissa type " << abscissa.type);
242 }
243 }
244
245 return result;
246 }
#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 249 of file JOscillogram.hh.

◆ ordinate

JOscillogramAxis JOSCPROB::JOscillogram::ordinate
private

Ordinate axis.

Definition at line 250 of file JOscillogram.hh.

◆ channel

JOscChannel JOSCPROB::JOscillogram::channel
private

Oscillation channel.

Definition at line 252 of file JOscillogram.hh.


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