Jpp  master_rocky-43-ge265d140c
the software that should make you happy
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
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. More...
 
 JOscillogram (const std::string &abscissaName, const JGrid< double > abscissaBinning, const std::string &ordinateName, const JGrid< double > ordinateBinning, const JOscChannel &channel, const JOscProbInterface &oscprob)
 Constructor. More...
 
double getEnergy (const int i, const int j) const
 Get energy corrresponding to the given bin indices. More...
 
double getCosth (const int i, const int j) const
 Get cosine zenith angle corrresponding to the given bin indices. More...
 
double getP (const int i, const int j) const
 Get oscillation probability for given bin indices. More...
 
void configure (const pointer_type &pOscProb)
 Configure oscillation probability function. More...
 
void configure (const JOscProbInterface &oscProb)
 Configure oscillation probability function. More...
 
JOscProbInterfacegetOscProbInterface () const
 Get reference to oscillation probability interface. More...
 
JOscParameterReferences_tgetParameters () const
 Get reference to oscillation parameters interface. More...
 
void set (const JOscParameters_t &parameters) const
 Set oscillation parameters. More...
 
void set (const std::string &name, const value_type &value) const
 Set value for a given oscillation parameter. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
double getCosth (const double L) const
 Get cosine zenith angle for a given baseline. More...
 
double getBaseline (const double costh) const
 Get baseline for a given cosine zenith angle. More...
 

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. More...
 
double getCosth (const double L) const
 Get cosine zenith angle for a given baseline. More...
 

Private Attributes

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

Detailed Description

Auxiliary class for creating oscillograms.

Definition at line 80 of file JOscillogram.hh.

Member Typedef Documentation

◆ JOscParameters_t

Definition at line 28 of file JOscProbHelper.hh.

◆ JOscParameterReferences_t

Definition at line 29 of file JOscProbHelper.hh.

◆ JParameter_t

Definition at line 30 of file JOscProbHelper.hh.

◆ argument_type

Definition at line 32 of file JOscProbHelper.hh.

◆ value_type

Definition at line 33 of file JOscProbHelper.hh.

◆ pointer_type

typedef std::shared_ptr<JOscProbInterface> JOSCPROB::JOscProbHelper::pointer_type
inherited

Definition at line 35 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),
121  channel (channel)
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  }
int j
Definition: JPolint.hh:792
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/3]

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 double L) const
Get cosine zenith angle for a given baseline.

◆ 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.
Definition: JException.hh:712
T pow(const T &x, const double y)
Power .
Definition: JMath.hh:97
Definition: JSTDTypes.hh:14
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/3]

double JOSCPROB::JOscProbHelper::getCosth
inlineprivate

Get cosine zenith angle for a given baseline.

Parameters
Lbaseline [km]
Returns
cosine zenith angle

Definition at line 236 of file JOscProbHelper.hh.

237  {
238  return getOscProbInterface().getCosth(L);
239  }
double getCosth(const double L) const
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
oscProboscillation probability function

Definition at line 71 of file JOscProbHelper.hh.

72  {
73  static_cast<pointer_type&>(*this) = pOscProb;
74  }
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 82 of file JOscProbHelper.hh.

83  {
84  this->reset(oscProb.clone());
85  }
void reset(T &value)
Reset value.
virtual clone_type clone() const override
Get clone of this object.
Definition: JClonable.hh:69

◆ getOscProbInterface()

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

Get reference to oscillation probability interface.

Returns
oscillation parameters

Definition at line 93 of file JOscProbHelper.hh.

94  {
95  using namespace JPP;
96 
97  if (static_cast<const JOscProbHelper&>(*this)) {
98  return *(this->get());
99  } else {
100  THROW(JNullPointerException, "JOscProbHelper::getOscProbInterface(): Oscillation probability interface is not set.");
101  }
102  }
Exception for null pointer operation.
Definition: JException.hh:234
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Helper class for oscillation probabilities.

◆ getParameters()

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

Get reference to oscillation parameters interface.

Returns
reference to oscillation parameters interface

Definition at line 110 of file JOscProbHelper.hh.

111  {
113  }
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 121 of file JOscProbHelper.hh.

122  {
123  return getParameters().set(parameters);
124  }
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 133 of file JOscProbHelper.hh.

135  {
136  getParameters().set(name, value);
137  }

◆ 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 148 of file JOscProbHelper.hh.

151  {
152  getParameters().set(name, value, args...);
153  }

◆ 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 165 of file JOscProbHelper.hh.

168  {
169  return getOscProbInterface().getP(channel, energy, costh);
170  }
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 183 of file JOscProbHelper.hh.

187  {
188  return getOscProbInterface().getP(parameters, channel, energy, costh);
189  }

◆ 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 203 of file JOscProbHelper.hh.

208  {
209  return getOscProbInterface().getP(name, value, channel, E, costh);
210  }

◆ 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 222 of file JOscProbHelper.hh.

225  {
226  return getOscProbInterface().getP(name, value, args...);
227  }

◆ getCosth() [3/3]

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

Get cosine zenith angle for a given baseline.

Parameters
Lbaseline [km]
Returns
cosine zenith angle

Definition at line 236 of file JOscProbHelper.hh.

237  {
238  return getOscProbInterface().getCosth(L);
239  }

◆ 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 248 of file JOscProbHelper.hh.

249  {
250  return getOscProbInterface().getBaseline(costh);
251  }
double getBaseline(const double costh) const
Get baseline for a given cosine zenith angle.

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: