Jpp  19.1.0-rc.1
the software that should make you happy
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | 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< typename JFunction_t::argument_type > >

Public Types

typedef JArgument_t argument_type
 
typedef JResult_t result_type
 
typedef JElement2D< argument_type, result_typeJElement2D_t
 
typedef JPolintFunction1D< 1, JElement2D_t, JGridCollectionJFunction1D_t
 
typedef JMapList< JPolint1FunctionalGridMapJMaplist_t
 
typedef JMultiFunction< JFunction1D_t, JMaplist_tJFunction2D_t
 
typedef JMultiMapTransformer< 2, argument_typetransformer_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 __JFunction_t , class __JMaplist_t , class __JDistance_t >
void insert (const JMultiFunction< __JFunction_t, __JMaplist_t, __JDistance_t > &input)
 Insert multidimensional input. More...
 
template<class JHistogram_t , class __JMaplist_t , class __JDistance_t >
void insert (const JMultiHistogram< JHistogram_t, __JMaplist_t, __JDistance_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_typetransformer
 

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 __JElement_t , template< class, class > class __JContainer_t, class __JDistance_t >
void insert (const JMultiKey< JMapLength< JMaplist_t >::value, argument_type > &key, const JHistogram1D< __JElement_t, __JContainer_t, __JDistance_t > &input)
 Convert one-dimensional histogram to PDF and insert result at given multidimensional key. More...
 
template<class JHistogram_t , class __JMaplist_t , class __JDistance_t >
void insert (const JMultiKey< JMapLength< JMaplist_t >::value, argument_type > &key, const JMultiHistogram< JHistogram_t, __JMaplist_t, __JDistance_t > &input)
 Convert multidimensional histogram to PDF and insert result at given multidimensional key. More...
 

Protected Attributes

JArray< NUMBER_OF_DIMENSIONS, argument_typebuffer
 

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

◆ argument_type

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.

◆ result_type

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.

◆ JElement2D_t

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.

◆ JFunction1D_t

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.

◆ JMaplist_t

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.

◆ JFunction2D_t

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.

◆ transformer_type

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.

◆ multimap_type

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 47 of file JMultiFunction.hh.

◆ function_type

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 51 of file JMultiFunction.hh.

◆ value_type

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 53 of file JMultiFunction.hh.

◆ abscissa_type

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 56 of file JMultiFunction.hh.

◆ ordinate_type

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 57 of file JMultiFunction.hh.

◆ const_iterator

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 60 of file JMultiFunction.hh.

◆ const_reverse_iterator

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 61 of file JMultiFunction.hh.

◆ iterator

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 62 of file JMultiFunction.hh.

◆ reverse_iterator

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 63 of file JMultiFunction.hh.

◆ super_iterator

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 65 of file JMultiFunction.hh.

◆ super_const_iterator

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 66 of file JMultiFunction.hh.

Member Enumeration Documentation

◆ anonymous enum

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 49 of file JMultiFunction.hh.

49 { NUMBER_OF_DIMENSIONS = JMapLength<JMaplist_t>::value + JFunction_t::NUMBER_OF_DIMENSIONS };
Length of map list.
Definition: JMapList.hh:45

Constructor & Destructor Documentation

◆ JCDFTable2D() [1/2]

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  {}

◆ JCDFTable2D() [2/2]

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  }
Data structure for direction in three dimensions.
Definition: JDirection3D.hh:35
Direction set covering (part of) solid angle.
Definition: JOmega3D.hh:68
JLANG::JSharedPointer< transformer_type > transformer
Definition: JCDFTable2D.hh:145
JMultiFunction< JFunction1D_t, JMaplist_t > JFunction2D_t
Definition: JCDFTable2D.hh:52
JLANG::JSharedPointer< transformer_type > transformer
Definition: JCDFTable.hh:231
JMultiQuantile_t intensity
Definition: JCDFTable.hh:229
double getNPE(const Args &...args) const
Get number of photo-electrons.
Definition: JCDFTable.hh:159
Transformer for the 1D probability density function (PDF) of the time response of a PMT to a muon.
Template definition of transformer of the probability density function (PDF) of the time response of ...
multimap_type::iterator iterator
void compile()
Compilation.
static JMultiMapTransformer * getClone()
Get clone of default transformer.
collection_type::iterator iterator
Definition: JPolint.hh:1107
static const double PI
Mathematical constants.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
void configure(const T &value, const JAbstractCollection< JAbscissa_t > &bounds, JBool< false > option)
Configuration of value.
JGrid< JAbscissa_t > make_grid(const int nx, const JAbscissa_t Xmin, const JAbscissa_t Xmax)
Helper method for JGrid.
Definition: JGrid.hh:209
int j
Definition: JPolint.hh:792
JRange< int > range_type

Member Function Documentation

◆ getNPE()

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  }
JArray< NUMBER_OF_DIMENSIONS, argument_type > buffer

◆ getMultiFunction() [1/2]

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 98 of file JMultiFunction.hh.

99  {
100  return static_cast<const JMultiFunction&>(*this);
101  }
Multidimensional interpolation method.

◆ getMultiFunction() [2/2]

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 109 of file JMultiFunction.hh.

110  {
111  return static_cast<JMultiFunction&>(*this);
112  }

◆ insert() [1/5]

template<class JFunction_t , class JMaplist_t , class JDistance_t = JDistance<typename JFunction_t::argument_type>>
template<class __JFunction_t , class __JMaplist_t , class __JDistance_t >
void JTOOLS::JMultiFunction< JFunction_t, JMaplist_t, JDistance_t >::insert ( const JMultiFunction< __JFunction_t, __JMaplist_t, __JDistance_t > &  input)
inlineinherited

Insert multidimensional input.

Parameters
inputmultidimensional function

Definition at line 121 of file JMultiFunction.hh.

122  {
123  copy(input, *this);
124  }
void copy(const T &input, T &output)
Copy of input to output.

◆ insert() [2/5]

template<class JFunction_t , class JMaplist_t , class JDistance_t = JDistance<typename JFunction_t::argument_type>>
template<class JHistogram_t , class __JMaplist_t , class __JDistance_t >
void JTOOLS::JMultiFunction< JFunction_t, JMaplist_t, JDistance_t >::insert ( const JMultiHistogram< JHistogram_t, __JMaplist_t, __JDistance_t > &  input)
inlineinherited

Insert multidimensional input.

Parameters
inputmultidimensional histogram

Definition at line 133 of file JMultiFunction.hh.

134  {
135  this->insert(JMultiKey<0, argument_type>(), input);
136  }
void insert(const JMultiFunction< __JFunction_t, __JMaplist_t, __JDistance_t > &input)
Insert multidimensional input.
Multidimensional key.
Definition: JMultiKey.hh:69

◆ insert() [3/5]

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 196 of file JMultiFunction.hh.

198  {
199  if (input.size() > 1) {
200 
201  for (auto j = input.begin(), i = j++; j != input.end(); ++i, ++j) {
202 
203  const argument_type x = 0.5 * (i->getX() + j->getX());
204 
205  insert(JMultiKey<N+1, argument_type>(key, x), i->getY());
206  }
207  }
208  }
function_type::argument_type argument_type

◆ insert() [4/5]

template<class JFunction_t , class JMaplist_t , class JDistance_t = JDistance<typename JFunction_t::argument_type>>
template<class __JElement_t , template< class, class > class __JContainer_t, class __JDistance_t >
void JTOOLS::JMultiFunction< JFunction_t, JMaplist_t, JDistance_t >::insert ( const JMultiKey< JMapLength< JMaplist_t >::value, argument_type > &  key,
const JHistogram1D< __JElement_t, __JContainer_t, __JDistance_t > &  input 
)
inlineprotectedinherited

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

Parameters
keymultidimensional key
inputhistogram

Definition at line 218 of file JMultiFunction.hh.

221  {
222  JFunction_t buffer;
223 
224  makePDF(input, buffer);
225 
226  multimap_type::insert(key, buffer);
227  }
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).

◆ insert() [5/5]

template<class JFunction_t , class JMaplist_t , class JDistance_t = JDistance<typename JFunction_t::argument_type>>
template<class JHistogram_t , class __JMaplist_t , class __JDistance_t >
void JTOOLS::JMultiFunction< JFunction_t, JMaplist_t, JDistance_t >::insert ( const JMultiKey< JMapLength< JMaplist_t >::value, argument_type > &  key,
const JMultiHistogram< JHistogram_t, __JMaplist_t, __JDistance_t > &  input 
)
inlineprotectedinherited

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

Parameters
keymultidimensional key
inputmultidimensional histogram

Definition at line 237 of file JMultiFunction.hh.

239  {
240  JFunction_t buffer;
241 
242  makePDF(input, buffer);
243 
244  multimap_type::insert(key, buffer);
245  }

◆ compile()

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 142 of file JMultiFunction.hh.

143  {
144  this->for_each(compiler);
145 
146  for (super_iterator i = this->super_begin(); i != this->super_end(); ++i) {
147  (*i).getValue().compile();
148  }
149  }
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
static const JCompiler compiler
Function object for functional object compilation.
Definition: JFunctional.hh:384

◆ setExceptionHandler()

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 157 of file JMultiFunction.hh.

158  {
159  this->for_each(supervisor);
160 
161  for (super_iterator i = this->super_begin(); i != this->super_end(); ++i) {
162  (*i).getValue().setExceptionHandler(supervisor);
163  }
164  }

◆ operator()()

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 174 of file JMultiFunction.hh.

175  {
176  buffer.set(args...);
177 
178  return this->evaluate(buffer.data());
179  }
const_pointer data() const
Get pointer to data.
Definition: JArray.hh:284
JArray & set(const Args &...args)
Set array.
Definition: JArray.hh:199

Member Data Documentation

◆ transformer

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.

◆ buffer

template<class JFunction_t , class JMaplist_t , class JDistance_t = JDistance<typename JFunction_t::argument_type>>
JArray<NUMBER_OF_DIMENSIONS, argument_type> JTOOLS::JMultiFunction< JFunction_t, JMaplist_t, JDistance_t >::buffer
mutableprotectedinherited

Definition at line 183 of file JMultiFunction.hh.


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