test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Friends
npstat::StorableHistoNDFunctor< Numeric, Axis, Converter > Class Template Reference

#include <StorableHistoNDFunctor.h>

Inheritance diagram for npstat::StorableHistoNDFunctor< Numeric, Axis, Converter >:
npstat::StorableMultivariateFunctor npstat::AbsMultivariateFunctor

Public Types

typedef HistoND< Numeric, Axis > Table
 

Public Member Functions

unsigned interpolationDegree () const
 
virtual unsigned minDim () const
 
virtual double operator() (const double *point, unsigned dim) const
 
void setConverter (const Converter &conv)
 
void setInterpolationDegree (const unsigned deg)
 
template<class Num2 , class Conv2 >
 StorableHistoNDFunctor (const StorableHistoNDFunctor< Num2, Axis, Conv2 > &tab)
 
virtual ~StorableHistoNDFunctor ()
 
template<class Num2 >
 StorableHistoNDFunctor (const HistoND< Num2, Axis > &table, const unsigned degree=1)
 
template<class Num2 >
 StorableHistoNDFunctor (const HistoND< Num2, Axis > &table, const unsigned degree, const std::string &descr)
 
Tableinterpolator ()
 
const Tableinterpolator () const
 
ArrayND< Numeric > & table ()
 
const ArrayND< Numeric > & table () const
 
virtual gs::ClassId classId () const
 
virtual bool write (std::ostream &of) const
 
- Public Member Functions inherited from npstat::StorableMultivariateFunctor
const std::string & description () const
 
void setDescription (const std::string &newDescription)
 
 StorableMultivariateFunctor ()
 
 StorableMultivariateFunctor (const std::string &descr)
 
void validateDescription (const std::string &description) const
 
virtual ~StorableMultivariateFunctor ()
 
bool operator== (const StorableMultivariateFunctor &r) const
 
bool operator!= (const StorableMultivariateFunctor &r) const
 
- Public Member Functions inherited from npstat::AbsMultivariateFunctor
virtual unsigned maxDim () const
 
virtual ~AbsMultivariateFunctor ()
 

Static Public Member Functions

static const char * classname ()
 
static StorableHistoNDFunctorread (const gs::ClassId &id, std::istream &in)
 
static unsigned version ()
 
- Static Public Member Functions inherited from npstat::StorableMultivariateFunctor
static const char * classname ()
 
static
StorableMultivariateFunctor
read (const gs::ClassId &id, std::istream &in)
 
static unsigned version ()
 

Protected Member Functions

virtual bool isEqual (const StorableMultivariateFunctor &other) const
 

Private Member Functions

 StorableHistoNDFunctor ()
 

Static Private Member Functions

static void validateInterDegree (unsigned deg, bool isUniform)
 

Private Attributes

Converter conv_
 
unsigned deg_
 
Table table_
 

Friends

template<typename Num2 , typename Axis2 , typename Conv2 >
class StorableHistoNDFunctor
 

Detailed Description

template<class Numeric, class Axis = HistoAxis, class Converter = Same<Numeric>>
class npstat::StorableHistoNDFunctor< Numeric, Axis, Converter >

This class adapts HistoND template together with various histogram interpolation functions to the StorableMultivariateFunctor interface

Definition at line 31 of file StorableHistoNDFunctor.h.

Member Typedef Documentation

template<class Numeric, class Axis = HistoAxis, class Converter = Same<Numeric>>
typedef HistoND<Numeric,Axis> npstat::StorableHistoNDFunctor< Numeric, Axis, Converter >::Table

Definition at line 37 of file StorableHistoNDFunctor.h.

Constructor & Destructor Documentation

template<class Numeric, class Axis = HistoAxis, class Converter = Same<Numeric>>
template<class Num2 >
npstat::StorableHistoNDFunctor< Numeric, Axis, Converter >::StorableHistoNDFunctor ( const HistoND< Num2, Axis > &  table,
const unsigned  degree = 1 
)
inline

Constructor from a pre-existing histogram. The "degree" argument specifies the interpolation degree which can be 0, 1, or 3.

Definition at line 46 of file StorableHistoNDFunctor.h.

References npstat::HistoND< Numeric, Axis >::isUniformlyBinned(), and npstat::StorableHistoNDFunctor< Numeric, Axis, Converter >::validateInterDegree().

template<class Numeric, class Axis = HistoAxis, class Converter = Same<Numeric>>
template<class Num2 >
npstat::StorableHistoNDFunctor< Numeric, Axis, Converter >::StorableHistoNDFunctor ( const HistoND< Num2, Axis > &  table,
const unsigned  degree,
const std::string &  descr 
)
inline
template<class Numeric, class Axis = HistoAxis, class Converter = Same<Numeric>>
template<class Num2 , class Conv2 >
npstat::StorableHistoNDFunctor< Numeric, Axis, Converter >::StorableHistoNDFunctor ( const StorableHistoNDFunctor< Num2, Axis, Conv2 > &  tab)
inline

Converting copy constructor

Definition at line 62 of file StorableHistoNDFunctor.h.

64  : StorableMultivariateFunctor(tab.description()),
65  table_(tab.table_, Same<Num2>(), tab.title().c_str(),
66  tab.accumulatedDataLabel().c_str()), deg_(tab.deg_) {}
template<class Numeric, class Axis = HistoAxis, class Converter = Same<Numeric>>
virtual npstat::StorableHistoNDFunctor< Numeric, Axis, Converter >::~StorableHistoNDFunctor ( )
inlinevirtual

Definition at line 68 of file StorableHistoNDFunctor.h.

68 {}
template<class Numeric, class Axis = HistoAxis, class Converter = Same<Numeric>>
npstat::StorableHistoNDFunctor< Numeric, Axis, Converter >::StorableHistoNDFunctor ( )
private

Member Function Documentation

template<class Numeric, class Axis = HistoAxis, class Converter = Same<Numeric>>
virtual gs::ClassId npstat::StorableHistoNDFunctor< Numeric, Axis, Converter >::classId ( ) const
inlinevirtual

Method related to "geners" I/O

Implements npstat::StorableMultivariateFunctor.

Definition at line 100 of file StorableHistoNDFunctor.h.

100 {return gs::ClassId(*this);}
template<class Numeric , class Axis , class Converter >
const char * npstat::StorableHistoNDFunctor< Numeric, Axis, Converter >::classname ( )
inlinestatic

Definition at line 149 of file StorableHistoNDFunctor.h.

References AlCaHLTBitMon_QueryRunRegistry::string.

150  {
151  static const std::string myClass(gs::template_class_name<Numeric,Axis>(
152  "npstat::StorableHistoNDFunctor"));
153  return myClass.c_str();
154  }
template<class Numeric, class Axis = HistoAxis, class Converter = Same<Numeric>>
unsigned npstat::StorableHistoNDFunctor< Numeric, Axis, Converter >::interpolationDegree ( ) const
inline

Retrieve interpolation degree

Definition at line 75 of file StorableHistoNDFunctor.h.

References npstat::StorableHistoNDFunctor< Numeric, Axis, Converter >::deg_.

template<class Numeric, class Axis = HistoAxis, class Converter = Same<Numeric>>
Table& npstat::StorableHistoNDFunctor< Numeric, Axis, Converter >::interpolator ( )
inline

Retrieve the underlying HistoND object

Definition at line 82 of file StorableHistoNDFunctor.h.

References npstat::StorableHistoNDFunctor< Numeric, Axis, Converter >::table_.

template<class Numeric, class Axis = HistoAxis, class Converter = Same<Numeric>>
const Table& npstat::StorableHistoNDFunctor< Numeric, Axis, Converter >::interpolator ( ) const
inline
template<class Numeric, class Axis = HistoAxis, class Converter = Same<Numeric>>
virtual bool npstat::StorableHistoNDFunctor< Numeric, Axis, Converter >::isEqual ( const StorableMultivariateFunctor ) const
inlineprotectedvirtual

Method needed to compare objects for equality. Must be overriden by derived classes. It is left up to the derived classes to decide whether they should compare description strings in order to establish equality.

Implements npstat::StorableMultivariateFunctor.

Definition at line 111 of file StorableHistoNDFunctor.h.

References npstat::StorableHistoNDFunctor< Numeric, Axis, Converter >::deg_, npstat::StorableMultivariateFunctor::description(), alignCSCRings::r, and npstat::StorableHistoNDFunctor< Numeric, Axis, Converter >::table_.

112  {
113  // Note the use of static_cast rather than dynamic_cast below.
114  // static_cast works faster and it is guaranteed to succeed here.
115  const StorableHistoNDFunctor& r =
116  static_cast<const StorableHistoNDFunctor&>(other);
117  return table_ == r.table_ && deg_ == r.deg_ &&
118  this->description() == other.description();
119  }
template<class Numeric, class Axis = HistoAxis, class Converter = Same<Numeric>>
virtual unsigned npstat::StorableHistoNDFunctor< Numeric, Axis, Converter >::minDim ( ) const
inlinevirtual
template<class Numeric , class Axis , class Converter >
double npstat::StorableHistoNDFunctor< Numeric, Axis, Converter >::operator() ( const double *  point,
unsigned  dim 
) const
virtual

Function value

Implements npstat::AbsMultivariateFunctor.

Definition at line 142 of file StorableHistoNDFunctor.h.

References npstat::interpolateHistoND(), and table_.

144  {
145  return conv_(interpolateHistoND(table_, point, dim, deg_));
146  }
Float interpolateHistoND(const HistoND< Float, Axis > &histo, const double *coords, unsigned coordsDim, unsigned interpolationDegree)
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
template<class Numeric , class Axis , class Converter >
StorableHistoNDFunctor< Numeric, Axis, Converter > * npstat::StorableHistoNDFunctor< Numeric, Axis, Converter >::read ( const gs::ClassId &  id,
std::istream &  in 
)
static

Definition at line 166 of file StorableHistoNDFunctor.h.

References SiPixelLorentzAngle_cfi::read, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by edmIntegrityCheck.PublishToFileSystem::get().

168  {
169  static const gs::ClassId current(
170  gs::ClassId::makeId<StorableHistoNDFunctor<Numeric,Axis> >());
171  current.ensureSameId(id);
172 
173  std::string descr;
174  gs::read_pod(in, &descr);
175  unsigned deg;
176  gs::read_pod(in, &deg);
177  gs::ClassId tabid(in, 1);
178  if (in.fail()) throw gs::IOReadFailure(
179  "In npstat::StorableHistoNDFunctor::read: "
180  "input stream failure");
181  CPP11_auto_ptr<Table> tab(Table::read(tabid, in));
182  return new StorableHistoNDFunctor(*tab, deg, descr);
183  }
static HistoND * read(const gs::ClassId &id, std::istream &in)
Definition: HistoND.h:3590
template<class Numeric, class Axis = HistoAxis, class Converter = Same<Numeric>>
void npstat::StorableHistoNDFunctor< Numeric, Axis, Converter >::setConverter ( const Converter &  conv)
inline

Change the coordinate converter

Definition at line 96 of file StorableHistoNDFunctor.h.

References conv, and npstat::StorableHistoNDFunctor< Numeric, Axis, Converter >::conv_.

96 {conv_ = conv;}
static HepMC::IO_HEPEVT conv
template<class Numeric , class Axis , class Converter >
void npstat::StorableHistoNDFunctor< Numeric, Axis, Converter >::setInterpolationDegree ( const unsigned  deg)
inline

Set interpolation degree (0, 1, or 3)

Definition at line 186 of file StorableHistoNDFunctor.h.

References table_.

188  {
190  deg_ = deg;
191  }
static void validateInterDegree(unsigned deg, bool isUniform)
bool isUniformlyBinned() const
Definition: HistoND.h:1480
template<class Numeric, class Axis = HistoAxis, class Converter = Same<Numeric>>
ArrayND<Numeric>& npstat::StorableHistoNDFunctor< Numeric, Axis, Converter >::table ( )
inline

Retrieve the tabulated data

Definition at line 88 of file StorableHistoNDFunctor.h.

References npstat::HistoND< Numeric, Axis >::binContents(), and npstat::StorableHistoNDFunctor< Numeric, Axis, Converter >::table_.

89  {return const_cast<ArrayND<Numeric>&>(table_.binContents());}
const ArrayND< Numeric > & binContents() const
Definition: HistoND.h:167
template<class Numeric, class Axis = HistoAxis, class Converter = Same<Numeric>>
const ArrayND<Numeric>& npstat::StorableHistoNDFunctor< Numeric, Axis, Converter >::table ( ) const
inline
template<class Numeric , class Axis , class Converter >
void npstat::StorableHistoNDFunctor< Numeric, Axis, Converter >::validateInterDegree ( unsigned  deg,
bool  isUniform 
)
inlinestaticprivate

Definition at line 194 of file StorableHistoNDFunctor.h.

References convertSQLiteXML::ok.

Referenced by npstat::StorableHistoNDFunctor< Numeric, Axis, Converter >::StorableHistoNDFunctor().

196  {
197  const bool ok = isUniform ? (deg == 0 || deg == 1 || deg == 3) :
198  (deg == 0 || deg == 1);
199  if (!ok)
201  "In npstat::StorableHistoNDFunctor::validateInterDegree: "
202  "unsupported interpolation degree");
203  }
template<class Numeric, class Axis = HistoAxis, class Converter = Same<Numeric>>
static unsigned npstat::StorableHistoNDFunctor< Numeric, Axis, Converter >::version ( )
inlinestatic

Definition at line 106 of file StorableHistoNDFunctor.h.

Referenced by validation.Sample::datasetpattern(), and validation.Sample::filename().

106 {return 1;}
template<class Numeric , class Axis , class Converter >
bool npstat::StorableHistoNDFunctor< Numeric, Axis, Converter >::write ( std::ostream &  of) const
virtual

Implements npstat::StorableMultivariateFunctor.

Definition at line 157 of file StorableHistoNDFunctor.h.

References idDealer::description, and table_.

158  {
159  gs::write_pod(of, this->description());
160  gs::write_pod(of, deg_);
161  return table_.classId().write(of) && table_.write(of);
162  }
bool write(std::ostream &of) const
Definition: HistoND.h:3575
gs::ClassId classId() const
Definition: HistoND.h:837

Friends And Related Function Documentation

template<class Numeric, class Axis = HistoAxis, class Converter = Same<Numeric>>
template<typename Num2 , typename Axis2 , typename Conv2 >
friend class StorableHistoNDFunctor
friend

Definition at line 34 of file StorableHistoNDFunctor.h.

Member Data Documentation

template<class Numeric, class Axis = HistoAxis, class Converter = Same<Numeric>>
Converter npstat::StorableHistoNDFunctor< Numeric, Axis, Converter >::conv_
private
template<class Numeric, class Axis = HistoAxis, class Converter = Same<Numeric>>
unsigned npstat::StorableHistoNDFunctor< Numeric, Axis, Converter >::deg_
private
template<class Numeric, class Axis = HistoAxis, class Converter = Same<Numeric>>
Table npstat::StorableHistoNDFunctor< Numeric, Axis, Converter >::table_
private