CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
npstat::MultivariateFunctorScanner< IndexMapper > Class Template Reference

#include <MultivariateFunctorScanner.h>

Public Member Functions

 MultivariateFunctorScanner (const AbsMultivariateFunctor &fcn, const std::vector< IndexMapper > &maps)
 
double operator() (const unsigned *index, const unsigned indexLen) const
 

Private Member Functions

 MultivariateFunctorScanner ()
 

Private Attributes

std::vector< double > buf_
 
unsigned dim_
 
const AbsMultivariateFunctorfcn_
 
const std::vector< IndexMapper > & mapping_
 

Detailed Description

template<class IndexMapper>
class npstat::MultivariateFunctorScanner< IndexMapper >

This class adapts an object derived from AbsMultivariateFunctor so that it can be used with ArrayND method "functorFill" and such

Definition at line 27 of file MultivariateFunctorScanner.h.

Constructor & Destructor Documentation

◆ MultivariateFunctorScanner() [1/2]

template<class IndexMapper >
npstat::MultivariateFunctorScanner< IndexMapper >::MultivariateFunctorScanner ( const AbsMultivariateFunctor fcn,
const std::vector< IndexMapper > &  maps 
)
inline

A mapper for each coordinate in the "maps" argument will convert the array index into a proper argument for the scanned density.

This functor will NOT make copies of either "fcn" or "maps" parameters. These parameters will be used by reference only (aliased). It is up to the user of this class to ensure proper lifetime of these objects.

Definition at line 40 of file MultivariateFunctorScanner.h.

42  : fcn_(fcn), mapping_(maps), buf_(fcn.minDim()), dim_(fcn.minDim())
43  {
44  if (!(dim_ && dim_ == maps.size())) throw npstat::NpstatInvalidArgument(
45  "In npstat::MultivariateFunctorScanner constructor: "
46  "incompatible arguments");
47  if (dim_ != fcn.maxDim()) throw npstat::NpstatInvalidArgument(
48  "In npstat::MultivariateFunctorScanner constructor: "
49  "functors of variable dimensionality are not supported");
50  }

References npstat::MultivariateFunctorScanner< IndexMapper >::dim_, and fcn().

◆ MultivariateFunctorScanner() [2/2]

template<class IndexMapper >
npstat::MultivariateFunctorScanner< IndexMapper >::MultivariateFunctorScanner ( )
private

Member Function Documentation

◆ operator()()

template<class IndexMapper >
double npstat::MultivariateFunctorScanner< IndexMapper >::operator() ( const unsigned *  index,
const unsigned  indexLen 
) const
inline

Calculate the functor value for the given array indices

Definition at line 53 of file MultivariateFunctorScanner.h.

55  {
56  if (dim_ != indexLen) throw npstat::NpstatInvalidArgument(
57  "In npstat::MultivariateFunctorScanner::operator(): "
58  "incompatible input point dimensionality");
59  assert(index);
60  double* x = &buf_[0];
61  for (unsigned i=0; i<dim_; ++i)
62  x[i] = mapping_[i](index[i]);
63  return fcn_(x, dim_);
64  }

References cms::cuda::assert(), npstat::MultivariateFunctorScanner< IndexMapper >::buf_, npstat::MultivariateFunctorScanner< IndexMapper >::dim_, npstat::MultivariateFunctorScanner< IndexMapper >::fcn_, mps_fire::i, and npstat::MultivariateFunctorScanner< IndexMapper >::mapping_.

Member Data Documentation

◆ buf_

template<class IndexMapper >
std::vector<double> npstat::MultivariateFunctorScanner< IndexMapper >::buf_
mutableprivate

◆ dim_

template<class IndexMapper >
unsigned npstat::MultivariateFunctorScanner< IndexMapper >::dim_
private

◆ fcn_

template<class IndexMapper >
const AbsMultivariateFunctor& npstat::MultivariateFunctorScanner< IndexMapper >::fcn_
private

◆ mapping_

template<class IndexMapper >
const std::vector<IndexMapper>& npstat::MultivariateFunctorScanner< IndexMapper >::mapping_
private
npstat::MultivariateFunctorScanner::buf_
std::vector< double > buf_
Definition: MultivariateFunctorScanner.h:71
mps_fire.i
i
Definition: mps_fire.py:428
npstat::MultivariateFunctorScanner::mapping_
const std::vector< IndexMapper > & mapping_
Definition: MultivariateFunctorScanner.h:70
cms::cuda::assert
assert(be >=bs)
DDAxes::x
fcn
void fcn(int &, double *, double &, double *, int)
Definition: LASBarrelAlgorithm.cc:388
npstat::MultivariateFunctorScanner::fcn_
const AbsMultivariateFunctor & fcn_
Definition: MultivariateFunctorScanner.h:69
npstat::NpstatInvalidArgument
Definition: NpstatException.h:38
npstat::MultivariateFunctorScanner::dim_
unsigned dim_
Definition: MultivariateFunctorScanner.h:72
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46