Jpp  19.0.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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
 

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

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

Definition at line 28 of file JOscProbHelper.hh.

Definition at line 29 of file JOscProbHelper.hh.

Definition at line 30 of file JOscProbHelper.hh.

Definition at line 32 of file JOscProbHelper.hh.

Definition at line 33 of file JOscProbHelper.hh.

Constructor & Destructor Documentation

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),
96  abscissa (abscissa),
97  ordinate (ordinate),
98  channel (channel)
99  {}
JOscProbHelper()
Default constructor.
JOscillogramAxis ordinate
Ordinate axis.
JOscChannel channel
Oscillation channel.
JOscillogramAxis abscissa
Abscissa axis.
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  {}
JOscProbHelper()
Default constructor.
JOscillogramAxis ordinate
Ordinate axis.
JOscChannel channel
Oscillation channel.
JOscillogramAxis abscissa
Abscissa axis.
static type getType(const std::string &name)
Get oscillation variable type.

Member Function Documentation

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.
int j
Definition: JPolint.hh:792
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  }
std::pair< double, double > getTransformation(const int i, const int j) const
Get energy and cosine zenith angle corresponding to the given bin indices.
int j
Definition: JPolint.hh:792
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 getCosth(const int i, const int j) const
Get cosine zenith angle corrresponding to the given bin indices.
double getEnergy(const int i, const int j) const
Get energy corrresponding to the given bin indices.
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...
JOscChannel channel
Oscillation channel.
then for APP in event gandalf start energy
Definition: JMuonMCEvt.sh:44
int j
Definition: JPolint.hh:792
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:
205  result.second = JOscProbHelper::getCosth(y);
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
JOscillogramAxis ordinate
Ordinate axis.
virtual 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
JOscillogramAxis abscissa
Abscissa axis.
T pow(const T &x, const double y)
Power .
Definition: JMath.hh:97
virtual double getBaseline(const double costh) const
Get baseline for a given cosine zenith angle.
int j
Definition: JPolint.hh:792
void JOSCPROB::JOscProbHelper::configure ( const JOscProbInterface oscProb)
inlineinherited

Configure oscillation probability function.

Parameters
oscProboscillation probability function

Definition at line 69 of file JOscProbHelper.hh.

70  {
71  this->reset(oscProb.clone());
72  }
virtual clone_type clone() const override
Get clone of this object.
Definition: JClonable.hh:69
void reset(T &value)
Reset value.
JOscProbInterface& JOSCPROB::JOscProbHelper::getOscProbInterface ( ) const
inlineinherited

Get reference to oscillation probability interface.

Returns
oscillation parameters

Definition at line 80 of file JOscProbHelper.hh.

81  {
82  using namespace JPP;
83 
84  if (static_cast<const JOscProbHelper&>(*this)) {
85  return *(this->get());
86  } else {
87  THROW(JNullPointerException, "JOscProbHelper::getOscProbInterface(): Oscillation probability interface is not set.");
88  }
89  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:712
JOscParameterReferences_t& JOSCPROB::JOscProbHelper::getParameters ( ) const
inlineinherited

Get reference to oscillation parameters interface.

Returns
reference to oscillation parameters interface

Definition at line 97 of file JOscProbHelper.hh.

98  {
100  }
JOscProbInterface & getOscProbInterface() const
Get reference to oscillation probability interface.
JOscParameters_t & getParameters() const
Get reference to oscillation parameters interface.
void JOSCPROB::JOscProbHelper::set ( const JOscParameters_t parameters) const
inlineinherited

Set oscillation parameters.

Parameters
parametersoscillation parameters

Definition at line 108 of file JOscProbHelper.hh.

109  {
110  return getParameters().set(parameters);
111  }
*fatal Wrong number of arguments esac JCookie sh typeset Z DETECTOR typeset Z SOURCE_RUN typeset Z TARGET_RUN set_variable PARAMETERS_FILE $WORKDIR parameters
Definition: diff-Tuna.sh:38
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.
virtual void JOSCPROB::JOscProbHelper::set ( const std::string &  name,
const value_type value 
) const
inlinevirtualinherited

Set value for a given oscillation parameter.

Parameters
nameparameter name
valueparameter value

Definition at line 120 of file JOscProbHelper.hh.

122  {
123  getParameters().set(name, value);
124  }
void set(const std::string &name, const value_type &value)
Set value for a given oscillation parameter.
then fatal The output file must have the wildcard in the name
Definition: JCanberra.sh:31
JOscParameterReferences_t & getParameters() const
Get reference to oscillation parameters interface.
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 135 of file JOscProbHelper.hh.

138  {
139  getParameters().set(name, value, args...);
140  }
void set(const std::string &name, const value_type &value)
Set value for a given oscillation parameter.
then fatal The output file must have the wildcard in the name
Definition: JCanberra.sh:31
JOscParameterReferences_t & getParameters() const
Get reference to oscillation parameters interface.
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 152 of file JOscProbHelper.hh.

155  {
156  return getOscProbInterface().getP(channel, energy, costh);
157  }
JOscProbInterface & getOscProbInterface() const
Get reference to oscillation probability interface.
virtual double getP(const JOscChannel &channel, const double E, const double costh) const =0
Get oscillation probability for a given oscillation channel.
then for APP in event gandalf start energy
Definition: JMuonMCEvt.sh:44
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 170 of file JOscProbHelper.hh.

174  {
175  return getOscProbInterface().getP(parameters, channel, energy, costh);
176  }
JOscProbInterface & getOscProbInterface() const
Get reference to oscillation probability interface.
virtual double getP(const JOscChannel &channel, const double E, const double costh) const =0
Get oscillation probability for a given oscillation channel.
*fatal Wrong number of arguments esac JCookie sh typeset Z DETECTOR typeset Z SOURCE_RUN typeset Z TARGET_RUN set_variable PARAMETERS_FILE $WORKDIR parameters
Definition: diff-Tuna.sh:38
then for APP in event gandalf start energy
Definition: JMuonMCEvt.sh:44
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 190 of file JOscProbHelper.hh.

195  {
196  return getOscProbInterface().getP(name, value, channel, E, costh);
197  }
JOscProbInterface & getOscProbInterface() const
Get reference to oscillation probability interface.
virtual double getP(const JOscChannel &channel, const double E, const double costh) const =0
Get oscillation probability for a given oscillation channel.
then usage $script< input file >[option[primary[working directory]]] nWhere option can be E
Definition: JMuonPostfit.sh:40
then fatal The output file must have the wildcard in the name
Definition: JCanberra.sh:31
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 209 of file JOscProbHelper.hh.

212  {
213  return getOscProbInterface().getP(name, value, args...);
214  }
JOscProbInterface & getOscProbInterface() const
Get reference to oscillation probability interface.
virtual double getP(const JOscChannel &channel, const double E, const double costh) const =0
Get oscillation probability for a given oscillation channel.
then fatal The output file must have the wildcard in the name
Definition: JCanberra.sh:31
virtual double JOSCPROB::JOscProbHelper::getCosth ( const double  L) const
inlinevirtualinherited

Get cosine zenith angle for a given baseline.

Parameters
Lbaseline [km]
Returns
cosine zenith angle

Definition at line 223 of file JOscProbHelper.hh.

224  {
225  return getOscProbInterface().getCosth(L);
226  }
JOscProbInterface & getOscProbInterface() const
Get reference to oscillation probability interface.
virtual double getCosth(const double L) const =0
Get cosine zenith angle for a given baseline.
virtual double JOSCPROB::JOscProbHelper::getBaseline ( const double  costh) const
inlinevirtualinherited

Get baseline for a given cosine zenith angle.

Parameters
costhcosine zenith angle
Returns
baseline [km]

Definition at line 235 of file JOscProbHelper.hh.

236  {
237  return getOscProbInterface().getBaseline(costh);
238  }
JOscProbInterface & getOscProbInterface() const
Get reference to oscillation probability interface.
virtual double getBaseline(const double costh) const =0
Get baseline for a given cosine zenith angle.

Member Data Documentation

JOscillogramAxis JOSCPROB::JOscillogram::abscissa
private

Abscissa axis.

Definition at line 230 of file JOscillogram.hh.

JOscillogramAxis JOSCPROB::JOscillogram::ordinate
private

Ordinate axis.

Definition at line 231 of file JOscillogram.hh.

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: