Jpp  debug
the software that should make you happy
Public Types | Public Member Functions | Protected Attributes | List of all members
JOSCPROB::JOscProbInterface Class Referenceabstract

Low-level interface for oscillation probability calculators. More...

#include <JOscProbInterface.hh>

Inheritance diagram for JOSCPROB::JOscProbInterface:
JOSCPROB::JBaselineComputer JOSCPROB::JOscParametersHelper< double & > JLANG::JClonable< JClonable_t, JDerived_t >

Public Types

typedef JOscParametersHelper< double & > JOscParametersHelper_t
 
typedef JOscParametersInterface< double > JOscParameters_t
 
typedef JOscParametersInterface< double & > JOscParameterReferences_t
 
typedef JOscParameters_t::JOscParameter_t JOscParameter_t
 
typedef JOscParameters_t::JParameter_t JParameter_t
 
typedef JOscParameters_t::argument_type argument_type
 
typedef JOscParameters_t::value_type value_type
 
typedef std::shared_ptr< JOscParameters_tpointer_type
 
typedef JClonable< JClonable_t >::clone_type clone_type
 

Public Member Functions

 JOscProbInterface ()
 Default constructor. More...
 
 JOscProbInterface (const JOscParameterReferences_t &parameters)
 Constructor. More...
 
template<class ... Args>
 JOscProbInterface (const JOscParameterReferences_t &parameters, const std::string &name, double &value, const Args &...args)
 Constructor. More...
 
virtual ~JOscProbInterface ()
 Virtual destructor. More...
 
virtual double getP (const JOscChannel &channel, const double E, const double costh) const =0
 Get oscillation probability for a given oscillation channel. More...
 
double getP (const JOscParameters_t &parameters, const JOscChannel &channel, const double E, 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 operator() (const JOscChannel &channel, const double E, const double costh) const
 Get oscillation probability for a given oscillation channel. More...
 
double operator() (const JOscParameters_t &parameters, const JOscChannel &channel, const double E, const double costh) const
 Get oscillation probability for a given set of oscillation parameters
and a given oscillation channel. More...
 
double operator() (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 operator() (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 getMinimumBaseline () const
 Get minimum baseline. More...
 
double getMaximumBaseline () const
 Get maximum baseline. More...
 
double getInnerRadius () const
 Get inner radius. More...
 
double getOuterRadius () const
 Get outer radius. 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...
 
double operator() (const double costh) const
 Get baseline for a given cosine zenith angle. More...
 
void configure (const pointer_type &p)
 Configure oscillation parameters. More...
 
void configure (const JOscParameters_t &parameters)
 Configure oscillation parameters. More...
 
JOscParameters_tgetParameters () const
 Get reference to oscillation parameters interface. More...
 
JOscParameters_tget () const
 Get pointer to oscillation parameters interface. More...
 
JOscParameter_tget (const std::string &name) const
 Get oscillation parameter. More...
 
void set (const std::string &name, const value_type &value) const
 Set value for a given oscillation parameter. More...
 
void set (const std::string &name, const value_type &value, const Args &...args) const
 Set value for given list of oscillation parameters. More...
 
void set (const JOscParametersInterface< value_type > &parameters) const
 Set oscillation parameters. More...
 
bool is_valid () const
 Check validity of oscillation parameters. More...
 
virtual clone_type clone () const override
 Get clone of this object. More...
 

Protected Attributes

double Lmin
 Minimum baseline [km]. More...
 
double Lmax
 Maximum baseline [km]. More...
 

Detailed Description

Low-level interface for oscillation probability calculators.

Definition at line 29 of file JOscProbInterface.hh.

Member Typedef Documentation

◆ JOscParametersHelper_t

Definition at line 36 of file JOscProbInterface.hh.

◆ JOscParameters_t

Definition at line 38 of file JOscProbInterface.hh.

◆ JOscParameterReferences_t

Definition at line 39 of file JOscProbInterface.hh.

◆ JOscParameter_t

Definition at line 41 of file JOscProbInterface.hh.

◆ JParameter_t

Definition at line 42 of file JOscProbInterface.hh.

◆ argument_type

Definition at line 33 of file JOscParametersHelper.hh.

◆ value_type

Definition at line 34 of file JOscParametersHelper.hh.

◆ pointer_type

typedef std::shared_ptr<JOscParameters_t> JOSCPROB::JOscParametersHelper< double & >::pointer_type
inherited

Definition at line 36 of file JOscParametersHelper.hh.

◆ clone_type

template<class JClonable_t , class JDerived_t >
typedef JClonable<JClonable_t>::clone_type JLANG::JClonable< JClonable_t, JDerived_t >::clone_type
inherited

Definition at line 61 of file JClonable.hh.

Constructor & Destructor Documentation

◆ JOscProbInterface() [1/3]

JOSCPROB::JOscProbInterface::JOscProbInterface ( )
inline

Default constructor.

Definition at line 48 of file JOscProbInterface.hh.

49  {}

◆ JOscProbInterface() [2/3]

JOSCPROB::JOscProbInterface::JOscProbInterface ( const JOscParameterReferences_t parameters)
inline

Constructor.

Parameters
parametersoscillation parameters

Definition at line 57 of file JOscProbInterface.hh.

57  :
58  JOscParametersHelper_t(parameters)
59  {}
JOscParametersHelper< double & > JOscParametersHelper_t

◆ JOscProbInterface() [3/3]

template<class ... Args>
JOSCPROB::JOscProbInterface::JOscProbInterface ( const JOscParameterReferences_t parameters,
const std::string &  name,
double &  value,
const Args &...  args 
)
inline

Constructor.

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

Definition at line 71 of file JOscProbInterface.hh.

74  :
75  JOscParametersHelper_t(parameters, name, value, args...)
76  {}

◆ ~JOscProbInterface()

virtual JOSCPROB::JOscProbInterface::~JOscProbInterface ( )
inlinevirtual

Virtual destructor.

Definition at line 82 of file JOscProbInterface.hh.

83  {}

Member Function Documentation

◆ getP() [1/4]

virtual double JOSCPROB::JOscProbInterface::getP ( const JOscChannel channel,
const double  E,
const double  costh 
) const
pure virtual

Get oscillation probability for a given oscillation channel.

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

◆ getP() [2/4]

double JOSCPROB::JOscProbInterface::getP ( const JOscParameters_t parameters,
const JOscChannel channel,
const double  E,
const double  costh 
) const
inline

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

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

Definition at line 109 of file JOscProbInterface.hh.

113  {
114  this->set(parameters);
115 
116  return getP(channel, E, costh);
117  }
virtual double getP(const JOscChannel &channel, const double E, const double costh) const =0
Get oscillation probability for a given oscillation channel.
void set(const std::string &name, const value_type &value) const
Set value for a given oscillation parameter.

◆ getP() [3/4]

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

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 131 of file JOscProbInterface.hh.

136  {
137  this->set(name, value);
138 
139  return getP(channel, E, costh);
140  }

◆ getP() [4/4]

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

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 152 of file JOscProbInterface.hh.

155  {
156  this->set(name, value);
157 
158  return getP(args...);
159  }

◆ operator()() [1/5]

double JOSCPROB::JOscProbInterface::operator() ( const JOscChannel channel,
const double  E,
const double  costh 
) const
inline

Get oscillation probability for a given oscillation channel.

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

Definition at line 170 of file JOscProbInterface.hh.

173  {
174  return getP(channel, E, costh);
175  }

◆ operator()() [2/5]

double JOSCPROB::JOscProbInterface::operator() ( const JOscParameters_t parameters,
const JOscChannel channel,
const double  E,
const double  costh 
) const
inline

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

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

Definition at line 188 of file JOscProbInterface.hh.

192  {
193  return getP(parameters, channel, E, costh);
194  }

◆ operator()() [3/5]

double JOSCPROB::JOscProbInterface::operator() ( const std::string &  name,
const double  value,
const JOscChannel channel,
const double  E,
const double  costh 
) const
inline

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 208 of file JOscProbInterface.hh.

213  {
214  return getP(name, value, channel, E, costh);
215  }

◆ operator()() [4/5]

template<class ... Args>
double JOSCPROB::JOscProbInterface::operator() ( const std::string &  name,
const double  value,
const Args &...  args 
) const
inline

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 227 of file JOscProbInterface.hh.

230  {
231  return getP(name, value, args...);
232  }

◆ getMinimumBaseline()

double JOSCPROB::JBaselineComputer::getMinimumBaseline ( ) const
inlineinherited

Get minimum baseline.

Returns
maximum baseline [km]

Definition at line 52 of file JBaselineComputer.hh.

53  {
54  return Lmin;
55  }
double Lmin
Minimum baseline [km].

◆ getMaximumBaseline()

double JOSCPROB::JBaselineComputer::getMaximumBaseline ( ) const
inlineinherited

Get maximum baseline.

Returns
maximum baseline [km]

Definition at line 63 of file JBaselineComputer.hh.

64  {
65  return Lmax;
66  }
double Lmax
Maximum baseline [km].

◆ getInnerRadius()

double JOSCPROB::JBaselineComputer::getInnerRadius ( ) const
inlineinherited

Get inner radius.

Returns
inner radius [km]

Definition at line 74 of file JBaselineComputer.hh.

75  {
76  return 0.5 * (Lmax - Lmin);
77  }

◆ getOuterRadius()

double JOSCPROB::JBaselineComputer::getOuterRadius ( ) const
inlineinherited

Get outer radius.

Returns
outer radius [km]

Definition at line 85 of file JBaselineComputer.hh.

86  {
87  return 0.5 * (Lmax + Lmin);;
88  }

◆ getCosth()

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

Get cosine zenith angle for a given baseline.

Parameters
Lbaseline [km]
Returns
cosine zenith angle

Definition at line 97 of file JBaselineComputer.hh.

98  {
99  const double r = getInnerRadius();
100  const double R = getOuterRadius();
101 
102  return (R*R - r*r - L*L) / (2*L*r);
103  }
data_type r[M+1]
Definition: JPolint.hh:868
double getInnerRadius() const
Get inner radius.
double getOuterRadius() const
Get outer radius.

◆ getBaseline()

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

Get baseline for a given cosine zenith angle.

Parameters
costhcosine zenith angle
Returns
baseline [km]

Definition at line 112 of file JBaselineComputer.hh.

113  {
114  const double r = getInnerRadius();
115  const double R = getOuterRadius();
116 
117  const double ct = (fabs(costh) < 1.0 ? costh : (costh < 0 ? -1.0 : 1.0));
118 
119  return (-r * ct + sqrt(R*R - r*r * (1 - ct) * (1 + ct)));
120  }

◆ operator()() [5/5]

double JOSCPROB::JBaselineComputer::operator() ( const double  costh) const
inlineinherited

Get baseline for a given cosine zenith angle.

Parameters
costhcosine zenith angle
Returns
baseline [km]

Definition at line 129 of file JBaselineComputer.hh.

130  {
131  return getBaseline(costh);
132  }
double getBaseline(const double costh) const
Get baseline for a given cosine zenith angle.

◆ configure() [1/2]

void JOSCPROB::JOscParametersHelper< double & >::configure ( const pointer_type p)
inlineinherited

Configure oscillation parameters.

Parameters
pshared pointer to oscillation parameters

Definition at line 94 of file JOscParametersHelper.hh.

95  {
96  static_cast<pointer_type&>(*this);
97  }
std::shared_ptr< JOscParameters_t > pointer_type

◆ configure() [2/2]

void JOSCPROB::JOscParametersHelper< double & >::configure ( const JOscParameters_t parameters)
inlineinherited

Configure oscillation parameters.

Parameters
parametersoscillation parameters

Definition at line 105 of file JOscParametersHelper.hh.

106  {
107  using namespace std;
108  using namespace JPP;
109 
110  JOscParameters_t* p = dynamic_cast<JOscParameters_t*>(parameters.clone());
111 
112  if (p != NULL) {
113  reset(p);
114  } else {
115  THROW(JNullPointerException, "JOscParametersHelper::configure(): Unable to retrieve oscillation parameters interface.");
116  }
117  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:712
Exception for null pointer operation.
Definition: JException.hh:234
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
void reset(T &value)
Reset value.
Definition: JSTDTypes.hh:14
JOscParametersInterface< double & > JOscParameters_t

◆ getParameters()

JOscParameters_t& JOSCPROB::JOscParametersHelper< double & >::getParameters ( ) const
inlineinherited

Get reference to oscillation parameters interface.

Returns
reference to oscillation parameters interface

Definition at line 125 of file JOscParametersHelper.hh.

126  {
127  using namespace JPP;
128 
129  if (static_cast<const JOscParametersHelper_t&>(*this)) {
130  return *(this->get());
131  } else {
132  THROW(JNullPointerException, "JOscParametersHelper::getParameters(): Oscillation parameters interface is not set.");
133  }
134  }
JOscParametersHelper< double & > JOscParametersHelper_t

◆ get() [1/2]

JOscParameters_t* JOSCPROB::JOscParametersHelper< double & >::get ( ) const
inlineinherited

Get pointer to oscillation parameters interface.

Returns
pointer to oscillation parameters interface

Definition at line 142 of file JOscParametersHelper.hh.

143  {
144  return pointer_type::get();
145  }

◆ get() [2/2]

JOscParameter_t& JOSCPROB::JOscParametersHelper< double & >::get ( const std::string &  name) const
inlineinherited

Get oscillation parameter.

Parameters
nameparameter name
Returns
parameter

Definition at line 154 of file JOscParametersHelper.hh.

155  {
156  return getParameters().get(name);
157  }
const JOscParameter_t & get(const std::string &name) const
Get oscillation parameter.
JOscParameters_t & getParameters() const
Get reference to oscillation parameters interface.

◆ set() [1/3]

void JOSCPROB::JOscParametersHelper< double & >::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 167 of file JOscParametersHelper.hh.

169  {
170  getParameters().set(name, value);
171  }
void set(const std::string &name, const value_type &value)
Set value for a given oscillation parameter.

◆ set() [2/3]

void JOSCPROB::JOscParametersHelper< double & >::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 182 of file JOscParametersHelper.hh.

185  {
186  this->set(name, value);
187  this->set(args...);
188  }

◆ set() [3/3]

void JOSCPROB::JOscParametersHelper< double & >::set ( const JOscParametersInterface< value_type > &  parameters) const
inlineinherited

Set oscillation parameters.

Parameters
parametersoscillation parameters

Definition at line 196 of file JOscParametersHelper.hh.

197  {
198  using namespace std;
199  using namespace JPP;
200 
201  const JProperties properties = parameters.getProperties();
202 
203  for (JProperties::const_iterator i = properties.cbegin(); i != properties.cend(); ++i) {
204 
205  const JOscParameter<value_type>& parameter = i->second.getValue<const JOscParameter<value_type> >();
206 
207  this->set(i->first, parameter.getValue());
208  }
209  }
Utility class to parse parameter values.
Definition: JProperties.hh:501
const value_type getValue() const
Get value of parameter.
Definition: JParameter.hh:82
virtual JProperties getProperties(const JEquationParameters &equation=JOscParametersInterface_t::getEquationParameters())=0
Get properties of this class.
Abstract base class for oscillation parameter.

◆ is_valid()

bool JOSCPROB::JOscParametersHelper< double & >::is_valid ( ) const
inlineinherited

Check validity of oscillation parameters.

Returns
true if all oscillation parameters are valid; else false

Definition at line 217 of file JOscParametersHelper.hh.

218  {
219  return getParameters().is_valid();
220  }
bool is_valid() const
Check validity of oscillation parameters.

◆ clone()

template<class JClonable_t , class JDerived_t >
virtual clone_type JLANG::JClonable< JClonable_t, JDerived_t >::clone ( ) const
inlineoverridevirtualinherited

Member Data Documentation

◆ Lmin

double JOSCPROB::JBaselineComputer::Lmin
protectedinherited

Minimum baseline [km].

Definition at line 165 of file JBaselineComputer.hh.

◆ Lmax

double JOSCPROB::JBaselineComputer::Lmax
protectedinherited

Maximum baseline [km].

Definition at line 166 of file JBaselineComputer.hh.


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