Jpp  18.3.1
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::JParameter_t 
JParameter_t
 
typedef
JOscProbInterface::argument_type 
argument_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...
 
JOscParameters_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 argument_type &value) const
 Set value for a given oscillation parameter. More...
 
template<class... Args>
void set (const std::string &name, const argument_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.

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

163  {
164  const double& energy = getEnergy(i, j);
165  const double& costh = getCosth (i, j);
166 
167  return JOscProbHelper::getP(channel, energy, costh);
168  }
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 181 of file JOscillogram.hh.

182  {
183  using namespace std;
184 
185  static int ix = -1;
186  static int iy = -1;
187 
188  static pair<double, double> result = {0.0, 0.0}; // Cache result
189 
190  if (i != ix || j != iy) {
191 
192  ix = i;
193  iy = j;
194 
195  const double x = abscissa.getX(i);
196  const double y = ordinate.getX(j);
197 
198  switch (ordinate.type) {
199  case (int) JOscVars::COSTH:
200  result.second = y;
201  break;
202  case (int) JOscVars::SINTH:
203  result.second = sqrt((1 + y) * (1 - y));
204  break;
205  case (int) JOscVars::BASELINE:
206  result.second = JOscProbHelper::getCosth(y);
207  break;
208  default:
209  THROW(JValueOutOfRange, "JOscillogram::getCosth(const double): Invalid ordinate type " << ordinate.type);
210  }
211 
212  switch (abscissa.type) {
213  case (int) JOscVars::ENERGY:
214  result.first = x;
215  break;
216  case (int) JOscVars::LOG10E:
217  result.first = pow(10.0, x);
218  break;
219  case (int) JOscVars::LOE:
220  result.first = (x > 0.0 ? this->getBaseline(result.second) / x : 0.0);
221  break;
222  default:
223  THROW(JValueOutOfRange, "JOscillogram::getEnergy(const double, const double): Invalid abscissa type " << abscissa.type);
224  }
225  }
226 
227  return result;
228  }
#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 66 of file JOscProbHelper.hh.

67  {
68  this->reset(oscProb.clone());
69  }
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 77 of file JOscProbHelper.hh.

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

Get reference to oscillation parameters interface.

Returns
reference to oscillation parameters interface

Definition at line 94 of file JOscProbHelper.hh.

95  {
97  }
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 105 of file JOscProbHelper.hh.

106  {
107  return getParameters().set(parameters);
108  }
JOscParameters_t & getParameters() const
Get reference to oscillation parameters interface.
*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, argument_type value)
Set value for a given oscillation parameter.
virtual void JOSCPROB::JOscProbHelper::set ( const std::string name,
const argument_type value 
) const
inlinevirtualinherited

Set value for a given oscillation parameter.

Parameters
nameparameter name
valueparameter value

Definition at line 117 of file JOscProbHelper.hh.

119  {
120  getParameters().set(name, value);
121  }
JOscParameters_t & getParameters() const
Get reference to oscillation parameters interface.
then echo Enter input within $TIMEOUT_S seconds echo n User name
Definition: JCookie.sh:42
void set(const std::string &name, argument_type value)
Set value for a given oscillation parameter.
template<class... Args>
void JOSCPROB::JOscProbHelper::set ( const std::string name,
const argument_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 132 of file JOscProbHelper.hh.

135  {
136  getParameters().set(name, value, args...);
137  }
JOscParameters_t & getParameters() const
Get reference to oscillation parameters interface.
then echo Enter input within $TIMEOUT_S seconds echo n User name
Definition: JCookie.sh:42
void set(const std::string &name, argument_type value)
Set value for a given oscillation parameter.
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 149 of file JOscProbHelper.hh.

152  {
153  return getOscProbInterface().getP(channel, energy, costh);
154  }
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 167 of file JOscProbHelper.hh.

171  {
172  return getOscProbInterface().getP(parameters, channel, energy, costh);
173  }
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 187 of file JOscProbHelper.hh.

192  {
193  return getOscProbInterface().getP(name, value, channel, E, costh);
194  }
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 echo Enter input within $TIMEOUT_S seconds echo n User name
Definition: JCookie.sh:42
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 206 of file JOscProbHelper.hh.

209  {
210  return getOscProbInterface().getP(name, value, args...);
211  }
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 echo Enter input within $TIMEOUT_S seconds echo n User name
Definition: JCookie.sh:42
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 220 of file JOscProbHelper.hh.

221  {
222  return getOscProbInterface().getCosth(L);
223  }
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 232 of file JOscProbHelper.hh.

233  {
234  return getOscProbInterface().getBaseline(costh);
235  }
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 231 of file JOscillogram.hh.

JOscillogramAxis JOSCPROB::JOscillogram::ordinate
private

Ordinate axis.

Definition at line 232 of file JOscillogram.hh.

JOscChannel JOSCPROB::JOscillogram::channel
private

Oscillation channel.

Definition at line 234 of file JOscillogram.hh.


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