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

Public Member Functions

 JOscillogram (const JOscillogramAxis &abscissa, const JOscillogramAxis &ordinate, const JOscChannel &channel, const JOscProbInterpolatorInterface *pInterpolator)
 Constructor. More...
 
 JOscillogram (const std::string &abscissaName, const JGrid< double > abscissaBinning, const std::string &ordinateName, const JGrid< double > ordinateBinning, const JOscChannel &channel, const JOscProbInterpolatorInterface *pInterpolator)
 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...
 

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...
 
const
JOscProbInterpolatorInterface
pInterpolator
 Pointer to oscillation probability interpolator. More...
 

Detailed Description

Auxiliary class for creating oscillograms.

Definition at line 78 of file JOscillogram.hh.

Constructor & Destructor Documentation

JOSCPROB::JOscillogram::JOscillogram ( const JOscillogramAxis abscissa,
const JOscillogramAxis ordinate,
const JOscChannel channel,
const JOscProbInterpolatorInterface pInterpolator 
)
inline

Constructor.

Parameters
abscissaoscillogram abscissa axis definition
ordinateoscillogram ordinate axis definition
channeloscillation channel
pInterpolatorpointer to oscillation probability interpolator

Definition at line 88 of file JOscillogram.hh.

91  :
92  abscissa (abscissa),
93  ordinate (ordinate),
94  channel (channel),
95  pInterpolator(pInterpolator)
96  {
97  if (pInterpolator == NULL) {
98  THROW(JNullPointerException, "JOscillogram::JOscillogram(...): Oscillation probability interpolator is not set");
99  }
100  }
const JOscProbInterpolatorInterface * pInterpolator
Pointer to oscillation probability interpolator.
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:712
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 JOscProbInterpolatorInterface pInterpolator 
)
inline

Constructor.

Parameters
abscissaNameoscillogram abscissa variable name
abscissaBinningoscillogram abscissa binning
ordinateNameoscillogram ordinate variable name
ordinateBinningoscillogram ordinate binning
channeloscillation channel
pInterpolatorpointer to oscillation probability interpolator

Definition at line 113 of file JOscillogram.hh.

118  :
119  abscissa (JOscVars::getType(abscissaName), abscissaBinning),
120  ordinate (JOscVars::getType(ordinateName), ordinateBinning),
121  channel (channel),
122  pInterpolator(pInterpolator)
123  {
124  if (pInterpolator == NULL) {
125  THROW(JNullPointerException, "JOscillogram::JOscillogram(...): Oscillation probability interpolator is not set");
126  }
127  }
const JOscProbInterpolatorInterface * pInterpolator
Pointer to oscillation probability interpolator.
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:712
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 137 of file JOscillogram.hh.

138  {
140 
141  return result.first;
142  }
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:703
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 152 of file JOscillogram.hh.

153  {
155 
156  return result.second;
157  }
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:703
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 167 of file JOscillogram.hh.

168  {
169  const double& energy = getEnergy(i, j);
170  const double& costh = getCosth (i, j);
171 
172  return (*pInterpolator)(channel, energy, costh);
173  }
double getCosth(const int i, const int j) const
Get cosine zenith angle corrresponding to the given bin indices.
const JOscProbInterpolatorInterface * pInterpolator
Pointer to oscillation probability interpolator.
double getEnergy(const int i, const int j) const
Get energy corrresponding to the given bin indices.
JOscChannel channel
Oscillation channel.
then for APP in event gandalf start energy
Definition: JMuonMCEvt.sh:44
int j
Definition: JPolint.hh:703
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 186 of file JOscillogram.hh.

187  {
188  using namespace std;
189 
190  static const JBaselineCalculator& baselineCalculator = pInterpolator->getBaselineCalculator();
191 
192  static int ix = -1;
193  static int iy = -1;
194 
195  static pair<double, double> result = {0.0, 0.0}; // Cache result
196 
197  if (i != ix || j != iy) {
198 
199  ix = i;
200  iy = j;
201 
202  const double x = abscissa.getX(i);
203  const double y = ordinate.getX(j);
204 
205  switch (ordinate.type) {
206  case (int) JOscVars::COSTH:
207  result.second = y;
208  break;
209  case (int) JOscVars::SINTH:
210  result.second = sqrt((1 + y) * (1 - y));
211  break;
212  case (int) JOscVars::BASELINE:
213  result.second = baselineCalculator.getCosth(y);
214  break;
215  default:
216  THROW(JValueOutOfRange, "JOscillogram::getCosth(const double): Invalid ordinate type " << ordinate.type);
217  }
218 
219  switch (abscissa.type) {
220  case (int) JOscVars::ENERGY:
221  result.first = x;
222  break;
223  case (int) JOscVars::LOG10E:
224  result.first = pow(10.0, x);
225  break;
226  case (int) JOscVars::LOE:
227  result.first = (x > 0.0 ? baselineCalculator.getBaseline(result.second) / x : 0.0);
228  break;
229  default:
230  THROW(JValueOutOfRange, "JOscillogram::getEnergy(const double, const double): Invalid abscissa type " << abscissa.type);
231  }
232  }
233 
234  return result;
235  }
const JOscProbInterpolatorInterface * pInterpolator
Pointer to oscillation probability interpolator.
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:712
virtual const JBaselineCalculator & getBaselineCalculator() const =0
Get baseline calculator associated with this interpolation table.
Auxiliary data structure for storing and calculating baselines.
JOscillogramAxis ordinate
Ordinate axis.
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
int j
Definition: JPolint.hh:703

Member Data Documentation

JOscillogramAxis JOSCPROB::JOscillogram::abscissa
private

Abscissa axis.

Definition at line 238 of file JOscillogram.hh.

JOscillogramAxis JOSCPROB::JOscillogram::ordinate
private

Ordinate axis.

Definition at line 239 of file JOscillogram.hh.

JOscChannel JOSCPROB::JOscillogram::channel
private

Oscillation channel.

Definition at line 241 of file JOscillogram.hh.

const JOscProbInterpolatorInterface* JOSCPROB::JOscillogram::pInterpolator
private

Pointer to oscillation probability interpolator.

Definition at line 243 of file JOscillogram.hh.


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