CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions | Protected 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

gs::ClassId classId () const override
 
unsigned interpolationDegree () const
 
Tableinterpolator ()
 
const Tableinterpolator () const
 
unsigned minDim () const override
 
double operator() (const double *point, unsigned dim) const override
 
void setConverter (const Converter &conv)
 
void setInterpolationDegree (const unsigned deg)
 
 StorableHistoNDFunctor ()=delete
 
template<class Num2 >
 StorableHistoNDFunctor (const HistoND< Num2, Axis > &table, const unsigned degree, const std::string &descr)
 
template<class Num2 >
 StorableHistoNDFunctor (const HistoND< Num2, Axis > &table, const unsigned degree=1)
 
template<class Num2 , class Conv2 >
 StorableHistoNDFunctor (const StorableHistoNDFunctor< Num2, Axis, Conv2 > &tab)
 
ArrayND< Numeric > & table ()
 
const ArrayND< Numeric > & table () const
 
bool write (std::ostream &of) const override
 
 ~StorableHistoNDFunctor () override
 
- Public Member Functions inherited from npstat::StorableMultivariateFunctor
const std::string & description () const
 
bool operator!= (const StorableMultivariateFunctor &r) const
 
bool operator== (const StorableMultivariateFunctor &r) const
 
void setDescription (const std::string &newDescription)
 
 StorableMultivariateFunctor ()
 
 StorableMultivariateFunctor (const std::string &descr)
 
void validateDescription (const std::string &description) const
 
 ~StorableMultivariateFunctor () override
 
- 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 StorableMultivariateFunctorread (const gs::ClassId &id, std::istream &in)
 
static unsigned version ()
 

Protected Member Functions

bool isEqual (const StorableMultivariateFunctor &other) const override
 

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 26 of file StorableHistoNDFunctor.h.

Member Typedef Documentation

◆ Table

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

Definition at line 31 of file StorableHistoNDFunctor.h.

Constructor & Destructor Documentation

◆ StorableHistoNDFunctor() [1/4]

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 40 of file StorableHistoNDFunctor.h.

42  validateInterDegree(degree, table.isUniformlyBinned());
43  }

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

◆ StorableHistoNDFunctor() [2/4]

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

◆ StorableHistoNDFunctor() [3/4]

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 54 of file StorableHistoNDFunctor.h.

55  : StorableMultivariateFunctor(tab.description()),
56  table_(tab.table_, Same<Num2>(), tab.title().c_str(), tab.accumulatedDataLabel().c_str()),
57  deg_(tab.deg_) {}

◆ StorableHistoNDFunctor() [4/4]

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

Default constructor not implemented

◆ ~StorableHistoNDFunctor()

template<class Numeric, class Axis = HistoAxis, class Converter = Same<Numeric>>
npstat::StorableHistoNDFunctor< Numeric, Axis, Converter >::~StorableHistoNDFunctor ( )
inlineoverride

Definition at line 62 of file StorableHistoNDFunctor.h.

62 {}

Member Function Documentation

◆ classId()

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

Method related to "geners" I/O

Implements npstat::StorableMultivariateFunctor.

Definition at line 92 of file StorableHistoNDFunctor.h.

92 { return gs::ClassId(*this); }

◆ classname()

template<class Numeric , class Axis , class Converter >
const char * npstat::StorableHistoNDFunctor< Numeric, Axis, Converter >::classname ( )
inlinestatic

Definition at line 133 of file StorableHistoNDFunctor.h.

133  {
134  static const std::string myClass(gs::template_class_name<Numeric, Axis>("npstat::StorableHistoNDFunctor"));
135  return myClass.c_str();
136  }

References AlCaHLTBitMon_QueryRunRegistry::string.

◆ interpolationDegree()

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 69 of file StorableHistoNDFunctor.h.

69 { return deg_; }

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

◆ interpolator() [1/2]

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 76 of file StorableHistoNDFunctor.h.

76 { return table_; }

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

◆ interpolator() [2/2]

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

◆ isEqual()

template<class Numeric, class Axis = HistoAxis, class Converter = Same<Numeric>>
bool npstat::StorableHistoNDFunctor< Numeric, Axis, Converter >::isEqual ( const StorableMultivariateFunctor ) const
inlineoverrideprotectedvirtual

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 102 of file StorableHistoNDFunctor.h.

102  {
103  // Note the use of static_cast rather than dynamic_cast below.
104  // static_cast works faster and it is guaranteed to succeed here.
105  const StorableHistoNDFunctor& r = static_cast<const StorableHistoNDFunctor&>(other);
106  return table_ == r.table_ && deg_ == r.deg_ && this->description() == other.description();
107  }

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

◆ minDim()

template<class Numeric, class Axis = HistoAxis, class Converter = Same<Numeric>>
unsigned npstat::StorableHistoNDFunctor< Numeric, Axis, Converter >::minDim ( ) const
inlineoverridevirtual

Minimum expected dimensionality

Implements npstat::AbsMultivariateFunctor.

Definition at line 64 of file StorableHistoNDFunctor.h.

64 { return table_.dim(); };

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

◆ operator()()

template<class Numeric , class Axis , class Converter >
double npstat::StorableHistoNDFunctor< Numeric, Axis, Converter >::operator() ( const double *  point,
unsigned  dim 
) const
overridevirtual

Function value

Implements npstat::AbsMultivariateFunctor.

Definition at line 128 of file StorableHistoNDFunctor.h.

128  {
129  return conv_(interpolateHistoND(table_, point, dim, deg_));
130  }

References npstat::interpolateHistoND(), point, and table_.

◆ read()

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 146 of file StorableHistoNDFunctor.h.

147  {
148  static const gs::ClassId current(gs::ClassId::makeId<StorableHistoNDFunctor<Numeric, Axis> >());
149  current.ensureSameId(id);
150 
151  std::string descr;
152  gs::read_pod(in, &descr);
153  unsigned deg;
154  gs::read_pod(in, &deg);
155  gs::ClassId tabid(in, 1);
156  if (in.fail())
157  throw gs::IOReadFailure(
158  "In npstat::StorableHistoNDFunctor::read: "
159  "input stream failure");
160  CPP11_auto_ptr<Table> tab(Table::read(tabid, in));
161  return new StorableHistoNDFunctor(*tab, deg, descr);
162  }

References recoMuon::in, readEcalDQMStatus::read, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by edmIntegrityCheck.PublishToFileSystem::get().

◆ setConverter()

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 88 of file StorableHistoNDFunctor.h.

88 { conv_ = conv; }

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

◆ setInterpolationDegree()

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 165 of file StorableHistoNDFunctor.h.

165  {
167  deg_ = deg;
168  }

References table_.

◆ table() [1/2]

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

◆ table() [2/2]

template<class Numeric, class Axis = HistoAxis, class Converter = Same<Numeric>>
const ArrayND<Numeric>& npstat::StorableHistoNDFunctor< Numeric, Axis, Converter >::table ( ) const
inline

◆ validateInterDegree()

template<class Numeric , class Axis , class Converter >
void npstat::StorableHistoNDFunctor< Numeric, Axis, Converter >::validateInterDegree ( unsigned  deg,
bool  isUniform 
)
inlinestaticprivate

Definition at line 171 of file StorableHistoNDFunctor.h.

172  {
173  const bool ok = isUniform ? (deg == 0 || deg == 1 || deg == 3) : (deg == 0 || deg == 1);
174  if (!ok)
176  "In npstat::StorableHistoNDFunctor::validateInterDegree: "
177  "unsupported interpolation degree");
178  }

References convertSQLiteXML::ok.

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

◆ version()

template<class Numeric, class Axis = HistoAxis, class Converter = Same<Numeric>>
static unsigned npstat::StorableHistoNDFunctor< Numeric, Axis, Converter >::version ( )
inlinestatic

Definition at line 98 of file StorableHistoNDFunctor.h.

98 { return 1; }

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

◆ write()

template<class Numeric , class Axis , class Converter >
bool npstat::StorableHistoNDFunctor< Numeric, Axis, Converter >::write ( std::ostream &  of) const
overridevirtual

Implements npstat::StorableMultivariateFunctor.

Definition at line 139 of file StorableHistoNDFunctor.h.

139  {
140  gs::write_pod(of, this->description());
141  gs::write_pod(of, deg_);
142  return table_.classId().write(of) && table_.write(of);
143  }

References edmLumisInFiles::description, and table_.

Friends And Related Function Documentation

◆ StorableHistoNDFunctor

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

Definition at line 28 of file StorableHistoNDFunctor.h.

Member Data Documentation

◆ conv_

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

◆ deg_

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

◆ table_

template<class Numeric, class Axis = HistoAxis, class Converter = Same<Numeric>>
Table npstat::StorableHistoNDFunctor< Numeric, Axis, Converter >::table_
private
npstat::StorableHistoNDFunctor::validateInterDegree
static void validateInterDegree(unsigned deg, bool isUniform)
Definition: StorableHistoNDFunctor.h:171
npstat::HistoND::dim
unsigned dim() const
Definition: HistoND.h:173
npstat::StorableHistoNDFunctor::deg_
unsigned deg_
Definition: StorableHistoNDFunctor.h:111
npstat::StorableHistoNDFunctor::StorableHistoNDFunctor
StorableHistoNDFunctor()=delete
npstat::StorableMultivariateFunctor::description
const std::string & description() const
Definition: StorableMultivariateFunctor.h:34
npstat::HistoND::read
static HistoND * read(const gs::ClassId &id, std::istream &in)
Definition: HistoND.h:3502
convertSQLiteXML.ok
bool ok
Definition: convertSQLiteXML.py:98
trackingPlots.other
other
Definition: trackingPlots.py:1464
npstat::NpstatInvalidArgument
Definition: NpstatException.h:38
npstat::interpolateHistoND
Float interpolateHistoND(const HistoND< Float, Axis > &histo, const double *coords, unsigned coordsDim, unsigned interpolationDegree)
Definition: interpolateHistoND.h:156
npstat::HistoND::isUniformlyBinned
bool isUniformlyBinned() const
Definition: HistoND.h:1512
npstat::StorableMultivariateFunctor::StorableMultivariateFunctor
StorableMultivariateFunctor()
Definition: StorableMultivariateFunctor.h:25
recoMuon::in
Definition: RecoMuonEnumerators.h:6
npstat::StorableHistoNDFunctor::table
ArrayND< Numeric > & table()
Definition: StorableHistoNDFunctor.h:82
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
alignCSCRings.r
r
Definition: alignCSCRings.py:93
npstat::StorableHistoNDFunctor::table_
Table table_
Definition: StorableHistoNDFunctor.h:110
npstat::HistoND::binContents
const ArrayND< Numeric > & binContents() const
Definition: HistoND.h:182
npstat::HistoND::classId
gs::ClassId classId() const
Definition: HistoND.h:924
point
*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
npstat::StorableHistoNDFunctor::conv_
Converter conv_
Definition: StorableHistoNDFunctor.h:112
npstat::HistoND::write
bool write(std::ostream &of) const
Definition: HistoND.h:3491
conv
EPOS::IO_EPOS conv
Definition: ReggeGribovPartonMCHadronizer.cc:42