Jpp  debug
the software that should make you happy
Public Member Functions | Protected Attributes | List of all members
JAANET::JVolume Struct Reference

Auxiliary class for histogramming of effective volume. More...

#include <JVolume.hh>

Public Member Functions

 JVolume (const Head &head, const bool Elog10=false)
 Constructor. More...
 
double getAlpha () const
 Get spectral index of energy distribution. More...
 
double getWall () const
 Get generation dependent weight. More...
 
Double_t getXmin () const
 Get minimal abscissa value. More...
 
Double_t getXmax () const
 Get maximal abscissa value. More...
 
Double_t getX (const Double_t E, double constrain=false) const
 Get abscissa value. More...
 
Double_t getE (const Double_t x, double constrain=false) const
 Get energy. More...
 
Double_t getW (TAxis *axis, const Double_t E) const
 Get bin width corrected energy spectrum dependent weight. More...
 
double getW (const double E) const
 Get generation dependent integral value of given energy. More...
 
JVolume & mul (const double factor)
 Multiply weight. More...
 
JVolume & div (const double factor)
 Divide weight. More...
 

Protected Attributes

bool elog
 histogram option More...
 
JTOOLS::JRange< double > E
 Energy range [GeV]. More...
 
double alpha
 spectral index More...
 
double Wall
 generation volume More...
 

Detailed Description

Auxiliary class for histogramming of effective volume.

In this, it is assumed that events are generated according $ \frac{dN}{dE} \propto E^{\alpha} $. The weight is expressed in $ \mathrm{km}^{3} $.

Definition at line 29 of file JVolume.hh.

Constructor & Destructor Documentation

◆ JVolume()

JAANET::JVolume::JVolume ( const Head &  head,
const bool  Elog10 = false 
)
inline

Constructor.

Parameters
headMonte Carlo run header
Elog10application of log10 to energy

Definition at line 36 of file JVolume.hh.

37  :
38  elog (Elog10),
39  E(0.0, 0.0),
40  alpha (0.0),
41  Wall (1.0)
42  {
43  const JHead buffer(head);
44 
45  if (buffer.is_valid(&JHead::spectrum) &&
46  buffer.is_valid(&JHead::cut_nu) &&
47  buffer.is_valid(&JHead::genvol)) {
48 
49  alpha = buffer.spectrum.alpha;
50  E = buffer.cut_nu.E;
51  Wall = (1.0e-9 * (getW(E.getUpperLimit()) -
52  getW(E.getLowerLimit())) *
53  buffer.genvol.volume / buffer.genvol.numberOfEvents); // km^3
54 
55  } else if (buffer.is_valid(&JHead::cut_in) &&
56  buffer.is_valid(&JHead::livetime)) {
57 
58  E = buffer.cut_in.E;
59  Wall = 1.0 / buffer.livetime.numberOfSeconds; // Hz
60  }
61  }
Monte Carlo run header.
Definition: JHead.hh:1236
JAANET::spectrum spectrum
Definition: JHead.hh:1597
JAANET::cut_in cut_in
Definition: JHead.hh:1595
JAANET::livetime livetime
Definition: JHead.hh:1604
JAANET::cut_nu cut_nu
Definition: JHead.hh:1596
JAANET::genvol genvol
Definition: JHead.hh:1600
T getLowerLimit() const
Get lower limit.
Definition: JRange.hh:202
T getUpperLimit() const
Get upper limit.
Definition: JRange.hh:213
bool elog
histogram option
Definition: JVolume.hh:214
double alpha
spectral index
Definition: JVolume.hh:216
JTOOLS::JRange< double > E
Energy range [GeV].
Definition: JVolume.hh:215
Double_t getW(TAxis *axis, const Double_t E) const
Get bin width corrected energy spectrum dependent weight.
Definition: JVolume.hh:156
double Wall
generation volume
Definition: JVolume.hh:217

Member Function Documentation

◆ getAlpha()

double JAANET::JVolume::getAlpha ( ) const
inline

Get spectral index of energy distribution.

Returns
spectral index

Definition at line 69 of file JVolume.hh.

70  {
71  return alpha;
72  }

◆ getWall()

double JAANET::JVolume::getWall ( ) const
inline

Get generation dependent weight.

Returns
weight

Definition at line 80 of file JVolume.hh.

81  {
82  return Wall;
83  }

◆ getXmin()

Double_t JAANET::JVolume::getXmin ( ) const
inline

Get minimal abscissa value.

Returns
abscissa value

Definition at line 91 of file JVolume.hh.

92  {
93  return getX(E.getLowerLimit());
94  }
Double_t getX(const Double_t E, double constrain=false) const
Get abscissa value.
Definition: JVolume.hh:115

◆ getXmax()

Double_t JAANET::JVolume::getXmax ( ) const
inline

Get maximal abscissa value.

Returns
abscissa value

Definition at line 102 of file JVolume.hh.

103  {
104  return getX(E.getUpperLimit());
105  }

◆ getX()

Double_t JAANET::JVolume::getX ( const Double_t  E,
double  constrain = false 
) const
inline

Get abscissa value.

Parameters
Eenergy
constrainconstrain
Returns
abscissa value

Definition at line 115 of file JVolume.hh.

116  {
117  double x = (elog ? log10(E) : E);
118 
119  if (constrain) {
120  if (x < getXmin()) {
121  return getXmin();
122  } else if (x > getXmax()) {
123  return getXmax();
124  }
125  }
126 
127  return x;
128  }
Double_t getXmax() const
Get maximal abscissa value.
Definition: JVolume.hh:102
Double_t getXmin() const
Get minimal abscissa value.
Definition: JVolume.hh:91

◆ getE()

Double_t JAANET::JVolume::getE ( const Double_t  x,
double  constrain = false 
) const
inline

Get energy.

Parameters
xabscissa value
constrainconstrain
Returns
energy

Definition at line 138 of file JVolume.hh.

139  {
140  const double Ex = (elog ? pow(10.0, x) : x);
141 
142  if (constrain)
143  return E.constrain(Ex);
144  else
145  return Ex;
146  }
T constrain(argument_type x) const
Constrain value to range.
Definition: JRange.hh:350
T pow(const T &x, const double y)
Power .
Definition: JMath.hh:97

◆ getW() [1/2]

Double_t JAANET::JVolume::getW ( TAxis *  axis,
const Double_t  E 
) const
inline

Get bin width corrected energy spectrum dependent weight.

Parameters
axisaxis
Eenergy
Returns
weight [km^3]

Definition at line 156 of file JVolume.hh.

157  {
158  const Int_t index = axis->FindBin(getX(E));
159 
160  const Double_t xmin = axis->GetBinLowEdge(index);
161  const Double_t xmax = axis->GetBinUpEdge (index);
162 
163  const Double_t Wmin = getW(getE(xmin));
164  const Double_t Wmax = getW(getE(xmax));
165 
166  return Wall / (Wmax - Wmin);
167  }
const double xmax
Definition: JQuadrature.cc:24
const double xmin
Definition: JQuadrature.cc:23
Double_t getE(const Double_t x, double constrain=false) const
Get energy.
Definition: JVolume.hh:138

◆ getW() [2/2]

double JAANET::JVolume::getW ( const double  E) const
inline

Get generation dependent integral value of given energy.

Parameters
Eenergy
Returns
integral value

Definition at line 176 of file JVolume.hh.

177  {
178  if (alpha != -1.0)
179  return pow(E, 1.0 + alpha) / (1.0 + alpha);
180  else
181  return log(E);
182  }

◆ mul()

JVolume& JAANET::JVolume::mul ( const double  factor)
inline

Multiply weight.

Parameters
factorfactor
Returns
this volume

Definition at line 191 of file JVolume.hh.

192  {
193  Wall *= factor;
194 
195  return *this;
196  }

◆ div()

JVolume& JAANET::JVolume::div ( const double  factor)
inline

Divide weight.

Parameters
factorfactor
Returns
this volume

Definition at line 205 of file JVolume.hh.

206  {
207  Wall /= factor;
208 
209  return *this;
210  }

Member Data Documentation

◆ elog

bool JAANET::JVolume::elog
protected

histogram option

Definition at line 214 of file JVolume.hh.

◆ E

JTOOLS::JRange<double> JAANET::JVolume::E
protected

Energy range [GeV].

Definition at line 215 of file JVolume.hh.

◆ alpha

double JAANET::JVolume::alpha
protected

spectral index

Definition at line 216 of file JVolume.hh.

◆ Wall

double JAANET::JVolume::Wall
protected

generation volume

Definition at line 217 of file JVolume.hh.


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