Jpp  16.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 | Public Attributes | Protected Member Functions | List of all members
JPHYSICS::JCDFTable2D< JArgument_t, JResult_t > Class Template Reference

Custom class for CDF table in 2 dimensions. More...

#include <JCDFTable2D.hh>

Inheritance diagram for JPHYSICS::JCDFTable2D< JArgument_t, JResult_t >:
JTOOLS::JMultiFunction< JFunction_t, JMaplist_t, JDistance_t > JTOOLS::JMultiMap< JFunction_t::argument_type, JFunction_t, JMaplist_t, JDistance_t >

Public Types

typedef JArgument_t argument_type
 
typedef JResult_t result_type
 
typedef JElement2D
< argument_type, result_type
JElement2D_t
 
typedef JPolintFunction1D
< 1, JElement2D_t,
JGridCollection
JFunction1D_t
 
typedef JMapList
< JPolint1FunctionalGridMap
JMaplist_t
 
typedef JMultiFunction
< JFunction1D_t, JMaplist_t
JFunction2D_t
 
typedef JMultiMapTransformer
< 2, argument_type
transformer_type
 
enum  { NUMBER_OF_DIMENSIONS = JMapLength<JMaplist_t>::value + JFunction_t::NUMBER_OF_DIMENSIONS }
 
typedef JMultiMap< typename
JFunction_t::argument_type,
JFunction_t, JMaplist_t,
JDistance_t > 
multimap_type
 
typedef JFunction_t function_type
 
typedef function_type::value_type value_type
 
typedef
multimap_type::abscissa_type 
abscissa_type
 
typedef
multimap_type::ordinate_type 
ordinate_type
 
typedef
multimap_type::const_iterator 
const_iterator
 
typedef
multimap_type::const_reverse_iterator 
const_reverse_iterator
 
typedef multimap_type::iterator iterator
 
typedef
multimap_type::reverse_iterator 
reverse_iterator
 
typedef
multimap_type::super_iterator 
super_iterator
 
typedef
multimap_type::super_const_iterator 
super_const_iterator
 

Public Member Functions

 JCDFTable2D ()
 Default constructor. More...
 
template<class JCDF_t , class JCDFMaplist_t , class JCDFDistance_t >
 JCDFTable2D (const JCDFTable< JCDF_t, JCDFMaplist_t, JCDFDistance_t > &cdf, const int number_of_bins, const double safety_factor=2.0)
 Constructor. More...
 
double getNPE (const double D, const double cd) const
 Get number of photo-electrons. More...
 
const JMultiFunctiongetMultiFunction () const
 Get multidimensional function. More...
 
JMultiFunctiongetMultiFunction ()
 Get multidimensional function. More...
 
template<class JPDF_t , class JPDFMaplist_t , class JPDFDistance_t >
void insert (const JMultiFunction< JPDF_t, JPDFMaplist_t, JPDFDistance_t > &input)
 Insert multidimensional input. More...
 
template<class JHistogram_t , class JHistogramMaplist_t , class JHistogramDistance_t >
void insert (const JMultiHistogram< JHistogram_t, JHistogramMaplist_t, JHistogramDistance_t > &input)
 Insert multidimensional input. More...
 
void compile ()
 Compilation. More...
 
void setExceptionHandler (const typename function_type::supervisor_type &supervisor)
 Set the supervisor for handling of exceptions. More...
 
template<class... Args>
result_type operator() (const Args &...args) const
 Multi-dimensional interpolation method call. More...
 

Public Attributes

JLANG::JSharedPointer
< transformer_type
transformer
 

Protected Member Functions

template<unsigned int N, class __JAbscissa_t , class __JContents_t , template< class, class, class > class __JMap_t, class __JDistance_t >
void insert (const JMultiKey< N, argument_type > &key, const JHistogramMap< __JAbscissa_t, __JContents_t, __JMap_t, __JDistance_t > &input)
 Insert multidimensional histogram at multidimensional key. More...
 
template<class __JValue_t >
void insert (const JMultiKey< JMapLength< JMaplist_t >::value, argument_type > &key, const __JValue_t &input)
 Convert one-dimensional histogram to PDF and insert result at given multidimensional key. More...
 

Detailed Description

template<class JArgument_t, class JResult_t>
class JPHYSICS::JCDFTable2D< JArgument_t, JResult_t >

Custom class for CDF table in 2 dimensions.

This class provides an upper limit for the average number of photo-electrons as a function of the distance and the cosine of the emission angle.

Definition at line 40 of file JCDFTable2D.hh.

Member Typedef Documentation

template<class JArgument_t , class JResult_t >
typedef JArgument_t JPHYSICS::JCDFTable2D< JArgument_t, JResult_t >::argument_type

Definition at line 46 of file JCDFTable2D.hh.

template<class JArgument_t , class JResult_t >
typedef JResult_t JPHYSICS::JCDFTable2D< JArgument_t, JResult_t >::result_type

Definition at line 47 of file JCDFTable2D.hh.

template<class JArgument_t , class JResult_t >
typedef JElement2D<argument_type, result_type> JPHYSICS::JCDFTable2D< JArgument_t, JResult_t >::JElement2D_t

Definition at line 49 of file JCDFTable2D.hh.

template<class JArgument_t , class JResult_t >
typedef JPolintFunction1D<1, JElement2D_t, JGridCollection> JPHYSICS::JCDFTable2D< JArgument_t, JResult_t >::JFunction1D_t

Definition at line 50 of file JCDFTable2D.hh.

template<class JArgument_t , class JResult_t >
typedef JMapList<JPolint1FunctionalGridMap> JPHYSICS::JCDFTable2D< JArgument_t, JResult_t >::JMaplist_t

Definition at line 51 of file JCDFTable2D.hh.

template<class JArgument_t , class JResult_t >
typedef JMultiFunction<JFunction1D_t, JMaplist_t> JPHYSICS::JCDFTable2D< JArgument_t, JResult_t >::JFunction2D_t

Definition at line 52 of file JCDFTable2D.hh.

template<class JArgument_t , class JResult_t >
typedef JMultiMapTransformer<2, argument_type> JPHYSICS::JCDFTable2D< JArgument_t, JResult_t >::transformer_type

Definition at line 54 of file JCDFTable2D.hh.

template<class JFunction_t, class JMaplist_t, class JDistance_t = JDistance<typename JFunction_t::argument_type>>
typedef JMultiMap<typename JFunction_t::argument_type, JFunction_t, JMaplist_t, JDistance_t> JTOOLS::JMultiFunction< JFunction_t, JMaplist_t, JDistance_t >::multimap_type
inherited

Definition at line 46 of file JMultiFunction.hh.

template<class JFunction_t, class JMaplist_t, class JDistance_t = JDistance<typename JFunction_t::argument_type>>
typedef JFunction_t JTOOLS::JMultiFunction< JFunction_t, JMaplist_t, JDistance_t >::function_type
inherited

Definition at line 50 of file JMultiFunction.hh.

template<class JFunction_t, class JMaplist_t, class JDistance_t = JDistance<typename JFunction_t::argument_type>>
typedef function_type::value_type JTOOLS::JMultiFunction< JFunction_t, JMaplist_t, JDistance_t >::value_type
inherited

Definition at line 52 of file JMultiFunction.hh.

template<class JFunction_t, class JMaplist_t, class JDistance_t = JDistance<typename JFunction_t::argument_type>>
typedef multimap_type::abscissa_type JTOOLS::JMultiFunction< JFunction_t, JMaplist_t, JDistance_t >::abscissa_type
inherited

Definition at line 55 of file JMultiFunction.hh.

template<class JFunction_t, class JMaplist_t, class JDistance_t = JDistance<typename JFunction_t::argument_type>>
typedef multimap_type::ordinate_type JTOOLS::JMultiFunction< JFunction_t, JMaplist_t, JDistance_t >::ordinate_type
inherited

Definition at line 56 of file JMultiFunction.hh.

template<class JFunction_t, class JMaplist_t, class JDistance_t = JDistance<typename JFunction_t::argument_type>>
typedef multimap_type::const_iterator JTOOLS::JMultiFunction< JFunction_t, JMaplist_t, JDistance_t >::const_iterator
inherited

Definition at line 59 of file JMultiFunction.hh.

template<class JFunction_t, class JMaplist_t, class JDistance_t = JDistance<typename JFunction_t::argument_type>>
typedef multimap_type::const_reverse_iterator JTOOLS::JMultiFunction< JFunction_t, JMaplist_t, JDistance_t >::const_reverse_iterator
inherited

Definition at line 60 of file JMultiFunction.hh.

template<class JFunction_t, class JMaplist_t, class JDistance_t = JDistance<typename JFunction_t::argument_type>>
typedef multimap_type::iterator JTOOLS::JMultiFunction< JFunction_t, JMaplist_t, JDistance_t >::iterator
inherited

Definition at line 61 of file JMultiFunction.hh.

template<class JFunction_t, class JMaplist_t, class JDistance_t = JDistance<typename JFunction_t::argument_type>>
typedef multimap_type::reverse_iterator JTOOLS::JMultiFunction< JFunction_t, JMaplist_t, JDistance_t >::reverse_iterator
inherited

Definition at line 62 of file JMultiFunction.hh.

template<class JFunction_t, class JMaplist_t, class JDistance_t = JDistance<typename JFunction_t::argument_type>>
typedef multimap_type::super_iterator JTOOLS::JMultiFunction< JFunction_t, JMaplist_t, JDistance_t >::super_iterator
inherited

Definition at line 64 of file JMultiFunction.hh.

template<class JFunction_t, class JMaplist_t, class JDistance_t = JDistance<typename JFunction_t::argument_type>>
typedef multimap_type::super_const_iterator JTOOLS::JMultiFunction< JFunction_t, JMaplist_t, JDistance_t >::super_const_iterator
inherited

Definition at line 65 of file JMultiFunction.hh.

Member Enumeration Documentation

template<class JFunction_t, class JMaplist_t, class JDistance_t = JDistance<typename JFunction_t::argument_type>>
anonymous enum
inherited
Enumerator
NUMBER_OF_DIMENSIONS 

Definition at line 48 of file JMultiFunction.hh.

Constructor & Destructor Documentation

template<class JArgument_t , class JResult_t >
JPHYSICS::JCDFTable2D< JArgument_t, JResult_t >::JCDFTable2D ( )
inline

Default constructor.

Definition at line 60 of file JCDFTable2D.hh.

61  {}
template<class JArgument_t , class JResult_t >
template<class JCDF_t , class JCDFMaplist_t , class JCDFDistance_t >
JPHYSICS::JCDFTable2D< JArgument_t, JResult_t >::JCDFTable2D ( const JCDFTable< JCDF_t, JCDFMaplist_t, JCDFDistance_t > &  cdf,
const int  number_of_bins,
const double  safety_factor = 2.0 
)
inline

Constructor.

Parameters
cdfCDF (5D table)
number_of_binsnumber of bins (2D table)
safety_factorsafety factor

Definition at line 72 of file JCDFTable2D.hh.

74  :
76  {
77  using namespace JPP;
78 
79  // extract the weight function
80 
81  try {
82 
84 
85  const JPDFTransformer_t& object = dynamic_cast<const JPDFTransformer_t&>(*(cdf.transformer));
86 
87  transformer.reset(object.transformer.clone());
88  }
89  catch(const std::exception& error) {
91  }
92 
93 
94  // build the 2D table
95 
96  this->configure(make_grid(number_of_bins, cdf.intensity.begin()->getX(), cdf.intensity.rbegin()->getX()));
97 
98  const JOmega3D omega(JDirection3D(0,1,0), JOmega3D::range_type(0.0,0.501*PI), 0.07*PI);
99 
100  for (typename JFunction2D_t::iterator i = this->begin(); i != this->end(); ++i) {
101 
102  i->getY().configure(make_grid(number_of_bins, -1.0, +1.0));
103 
104  for (typename JFunction1D_t::iterator j = i->getY().begin(); j != i->getY().end(); ++j) {
105 
106  const double D = i->getX();
107  const double cd = j->getX();
108  const double W = transformer->getWeight(D, cd);
109 
110  double y = 0.0;
111 
112  for (JOmega3D::const_iterator dir = omega.begin(); dir != omega.end(); ++dir) {
113  y += cdf.getNPE(D, cd, dir->getTheta(), fabs(dir->getPhi()));
114  }
115 
116  y /= omega.size();
117 
118  j->getY() = safety_factor * y / W;
119  }
120  }
121 
122  this->compile();
123  }
void compile()
Compilation.
multimap_type::iterator iterator
double getNPE(const Args &...args) const
Get number of photo-electrons.
Definition: JCDFTable.hh:156
JLANG::JSharedPointer< transformer_type > transformer
Definition: JCDFTable2D.hh:145
JLANG::JSharedPointer< transformer_type > transformer
Definition: JCDFTable.hh:228
JMultiFunction< JFunction1D_t, JMaplist_t > JFunction2D_t
Definition: JCDFTable2D.hh:52
Template definition of transformer of the probability density function (PDF) of the time response of ...
Transformer for the 1D probability density function (PDF) of the time response of a PMT to a muon...
static const double PI
Mathematical constants.
static JMultiMapTransformer * getClone()
Get clone of default transformer.
collection_type::iterator iterator
Definition: JPolint.hh:997
void configure(const T &value, const JAbstractCollection< JAbscissa_t > &bounds, JBool< false > option)
Configuration of value.
JMultiQuantile_t intensity
Definition: JCDFTable.hh:226
int j
Definition: JPolint.hh:682
JGrid< JAbscissa_t > make_grid(const int nx, const JAbscissa_t Xmin, const JAbscissa_t Xmax)
Helper method for JGrid.
Definition: JGrid.hh:177
do echo Generating $dir eval D
Definition: JDrawLED.sh:53

Member Function Documentation

template<class JArgument_t , class JResult_t >
double JPHYSICS::JCDFTable2D< JArgument_t, JResult_t >::getNPE ( const double  D,
const double  cd 
) const
inline

Get number of photo-electrons.

Parameters
Ddistance between EM shower and PMT [m]
cdcosine angle EM shower direction and EM shower - PMT position
Returns
number of photo-electrons

Definition at line 133 of file JCDFTable2D.hh.

135  {
136  const double buffer[] = { D, cd };
137 
138  const double y = this->evaluate(buffer);
139  const double W = this->transformer->getWeight(D, cd);
140 
141  return y * W;
142  }
JLANG::JSharedPointer< transformer_type > transformer
Definition: JCDFTable2D.hh:145
do echo Generating $dir eval D
Definition: JDrawLED.sh:53
template<class JFunction_t, class JMaplist_t, class JDistance_t = JDistance<typename JFunction_t::argument_type>>
const JMultiFunction& JTOOLS::JMultiFunction< JFunction_t, JMaplist_t, JDistance_t >::getMultiFunction ( ) const
inlineinherited

Get multidimensional function.

Returns
this multidimensional function

Definition at line 97 of file JMultiFunction.hh.

98  {
99  return static_cast<const JMultiFunction&>(*this);
100  }
Multidimensional interpolation method.
template<class JFunction_t, class JMaplist_t, class JDistance_t = JDistance<typename JFunction_t::argument_type>>
JMultiFunction& JTOOLS::JMultiFunction< JFunction_t, JMaplist_t, JDistance_t >::getMultiFunction ( )
inlineinherited

Get multidimensional function.

Returns
this multidimensional function

Definition at line 108 of file JMultiFunction.hh.

109  {
110  return static_cast<JMultiFunction&>(*this);
111  }
Multidimensional interpolation method.
template<class JFunction_t, class JMaplist_t, class JDistance_t = JDistance<typename JFunction_t::argument_type>>
template<class JPDF_t , class JPDFMaplist_t , class JPDFDistance_t >
void JTOOLS::JMultiFunction< JFunction_t, JMaplist_t, JDistance_t >::insert ( const JMultiFunction< JPDF_t, JPDFMaplist_t, JPDFDistance_t > &  input)
inlineinherited

Insert multidimensional input.

Parameters
inputmultidimensional function

Definition at line 120 of file JMultiFunction.hh.

121  {
122  copy(input, *this);
123  }
void copy(const T &input, T &output)
Copy of input to output.
template<class JFunction_t, class JMaplist_t, class JDistance_t = JDistance<typename JFunction_t::argument_type>>
template<class JHistogram_t , class JHistogramMaplist_t , class JHistogramDistance_t >
void JTOOLS::JMultiFunction< JFunction_t, JMaplist_t, JDistance_t >::insert ( const JMultiHistogram< JHistogram_t, JHistogramMaplist_t, JHistogramDistance_t > &  input)
inlineinherited

Insert multidimensional input.

Parameters
inputmultidimensional histogram

Definition at line 132 of file JMultiFunction.hh.

133  {
134  this->insert(JMultiKey<0, argument_type>(), input);
135  }
Multidimensional key.
Definition: JMultiKey.hh:34
void insert(const JMultiFunction< JPDF_t, JPDFMaplist_t, JPDFDistance_t > &input)
Insert multidimensional input.
template<class JFunction_t, class JMaplist_t, class JDistance_t = JDistance<typename JFunction_t::argument_type>>
template<unsigned int N, class __JAbscissa_t , class __JContents_t , template< class, class, class > class __JMap_t, class __JDistance_t >
void JTOOLS::JMultiFunction< JFunction_t, JMaplist_t, JDistance_t >::insert ( const JMultiKey< N, argument_type > &  key,
const JHistogramMap< __JAbscissa_t, __JContents_t, __JMap_t, __JDistance_t > &  input 
)
inlineprotectedinherited

Insert multidimensional histogram at multidimensional key.

Parameters
keymultidimensional key
inputmultidimensional histogram

Definition at line 191 of file JMultiFunction.hh.

193  {
194  if (input.size() > 1) {
195 
196  for (typename JHistogramMap<__JAbscissa_t, __JContents_t, __JMap_t, __JDistance_t>::const_iterator j = input.begin(), i = j++; j != input.end(); ++i, ++j) {
197 
198  const argument_type x = 0.5 * (i->getX() + j->getX());
199 
200  insert(JMultiKey<N+1, argument_type>(key, x), i->getY());
201  }
202  }
203  }
function_type::argument_type argument_type
Multidimensional key.
Definition: JMultiKey.hh:34
collection_type::const_iterator const_iterator
void insert(const JMultiFunction< JPDF_t, JPDFMaplist_t, JPDFDistance_t > &input)
Insert multidimensional input.
int j
Definition: JPolint.hh:682
template<class JFunction_t, class JMaplist_t, class JDistance_t = JDistance<typename JFunction_t::argument_type>>
template<class __JValue_t >
void JTOOLS::JMultiFunction< JFunction_t, JMaplist_t, JDistance_t >::insert ( const JMultiKey< JMapLength< JMaplist_t >::value, argument_type > &  key,
const __JValue_t &  input 
)
inlineprotectedinherited

Convert one-dimensional histogram to PDF and insert result at given multidimensional key.

Parameters
keymultidimensional key
inputhistogram

Definition at line 213 of file JMultiFunction.hh.

215  {
216  JFunction_t buffer;
217 
218  makePDF(input, buffer);
219 
220  multimap_type::insert(key, buffer);
221  }
void makePDF(const JHistogram1D< JElement_t, JContainer_t, JDistance_t > &input, typename JMappable< JElement_t >::map_type &output)
Conversion of histogram to probability density function (PDF).
template<class JFunction_t, class JMaplist_t, class JDistance_t = JDistance<typename JFunction_t::argument_type>>
void JTOOLS::JMultiFunction< JFunction_t, JMaplist_t, JDistance_t >::compile ( )
inlineinherited

Compilation.

Definition at line 141 of file JMultiFunction.hh.

142  {
143  this->for_each(compiler);
144 
145  for (super_iterator i = this->super_begin(); i != this->super_end(); ++i) {
146  (*i).getValue().compile();
147  }
148  }
multimap_type::super_iterator super_iterator
static const JCompiler compiler
Function object for functional object compilation.
Definition: JFunctional.hh:369
JObject_t & for_each(JObject_t &object, JType< JTypeList< JHead_t, JTail_t > > typelist, const JTuple< T > &tuple)
For each data type method.
Definition: JTuple.hh:666
template<class JFunction_t, class JMaplist_t, class JDistance_t = JDistance<typename JFunction_t::argument_type>>
void JTOOLS::JMultiFunction< JFunction_t, JMaplist_t, JDistance_t >::setExceptionHandler ( const typename function_type::supervisor_type &  supervisor)
inlineinherited

Set the supervisor for handling of exceptions.

Parameters
supervisorsupervisor

Definition at line 156 of file JMultiFunction.hh.

157  {
158  this->for_each(supervisor);
159 
160  for (super_iterator i = this->super_begin(); i != this->super_end(); ++i) {
161  (*i).getValue().setExceptionHandler(supervisor);
162  }
163  }
multimap_type::super_iterator super_iterator
JObject_t & for_each(JObject_t &object, JType< JTypeList< JHead_t, JTail_t > > typelist, const JTuple< T > &tuple)
For each data type method.
Definition: JTuple.hh:666
template<class JFunction_t, class JMaplist_t, class JDistance_t = JDistance<typename JFunction_t::argument_type>>
template<class... Args>
result_type JTOOLS::JMultiFunction< JFunction_t, JMaplist_t, JDistance_t >::operator() ( const Args &...  args) const
inlineinherited

Multi-dimensional interpolation method call.

Parameters
argscomma seperated list of abscissa values
Returns
function value

Definition at line 173 of file JMultiFunction.hh.

174  {
175  return this->evaluate(JArray<NUMBER_OF_DIMENSIONS, argument_type>(args...).data());
176  }

Member Data Documentation

template<class JArgument_t , class JResult_t >
JLANG::JSharedPointer<transformer_type> JPHYSICS::JCDFTable2D< JArgument_t, JResult_t >::transformer

Definition at line 145 of file JCDFTable2D.hh.


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