CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes
npstat::DualAxis Class Reference

#include <DualAxis.h>

Public Member Functions

double coordinate (const unsigned i) const
 
std::vector< double > coords () const
 
 DualAxis (const GridAxis &g)
 
 DualAxis (const UniformAxis &u)
 
 DualAxis (unsigned nCoords, double min, double max, const char *label=0)
 
 DualAxis (const std::vector< double > &coords, const bool useLogSpace=false)
 
 DualAxis (const std::vector< double > &coords, const char *label, const bool useLogSpace=false)
 
std::pair< unsigned, double > getInterval (const double x) const
 
double intervalWidth (const unsigned i=0) const
 
bool isUniform () const
 
const std::string & label () const
 
double length () const
 
std::pair< unsigned, double > linearInterval (const double x) const
 
double max () const
 
double min () const
 
unsigned nCoords () const
 
unsigned nIntervals () const
 
bool operator!= (const DualAxis &r) const
 
bool operator== (const DualAxis &r) const
 
void setLabel (const char *newlabel)
 
bool usesLogSpace () const
 
const GridAxisgetGridAxis () const
 
const UniformAxisgetUniformAxis () const
 
gs::ClassId classId () const
 
bool write (std::ostream &of) const
 

Static Public Member Functions

static const char * classname ()
 
static DualAxisread (const gs::ClassId &id, std::istream &in)
 
static unsigned version ()
 

Private Member Functions

 DualAxis ()
 

Static Private Member Functions

static std::vector< double > dummy_vec ()
 

Private Attributes

GridAxis a_
 
UniformAxis u_
 
bool uniform_
 

Detailed Description

Rectangular grid axis which can be either uniform or non-uniform. Will work a little bit slower than either GridAxis or UniformAxis, but can be used in place of either one of them.

Definition at line 24 of file DualAxis.h.

Constructor & Destructor Documentation

npstat::DualAxis::DualAxis ( const GridAxis g)
inline

Definition at line 28 of file DualAxis.h.

29  : a_(g), u_(2, 0.0, 1.0), uniform_(false) {}
UniformAxis u_
Definition: DualAxis.h:120
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
GridAxis a_
Definition: DualAxis.h:119
npstat::DualAxis::DualAxis ( const UniformAxis u)
inline

Definition at line 31 of file DualAxis.h.

32  : a_(dummy_vec()), u_(u), uniform_(true) {}
static std::vector< double > dummy_vec()
Definition: DualAxis.h:123
UniformAxis u_
Definition: DualAxis.h:120
GridAxis a_
Definition: DualAxis.h:119
npstat::DualAxis::DualAxis ( unsigned  nCoords,
double  min,
double  max,
const char *  label = 0 
)
inline

Definition at line 34 of file DualAxis.h.

36  : a_(dummy_vec()), u_(nCoords, min, max, label), uniform_(true) {}
static std::vector< double > dummy_vec()
Definition: DualAxis.h:123
double max() const
Definition: DualAxis.h:55
UniformAxis u_
Definition: DualAxis.h:120
GridAxis a_
Definition: DualAxis.h:119
unsigned nCoords() const
Definition: DualAxis.h:49
const std::string & label() const
Definition: DualAxis.h:58
double min() const
Definition: DualAxis.h:52
npstat::DualAxis::DualAxis ( const std::vector< double > &  coords,
const bool  useLogSpace = false 
)
inlineexplicit

Definition at line 38 of file DualAxis.h.

40  : a_(coords, useLogSpace), u_(2, 0.0, 1.0), uniform_(false) {}
UniformAxis u_
Definition: DualAxis.h:120
std::vector< double > coords() const
Definition: DualAxis.h:82
GridAxis a_
Definition: DualAxis.h:119
npstat::DualAxis::DualAxis ( const std::vector< double > &  coords,
const char *  label,
const bool  useLogSpace = false 
)
inline

Definition at line 42 of file DualAxis.h.

44  : a_(coords, label, useLogSpace), u_(2,0.0,1.0), uniform_(false) {}
UniformAxis u_
Definition: DualAxis.h:120
std::vector< double > coords() const
Definition: DualAxis.h:82
GridAxis a_
Definition: DualAxis.h:119
const std::string & label() const
Definition: DualAxis.h:58
npstat::DualAxis::DualAxis ( )
inlineprivate

Definition at line 130 of file DualAxis.h.

Referenced by read().

131  : a_(dummy_vec()), u_(2, 0.0, 1.0), uniform_(true) {}
static std::vector< double > dummy_vec()
Definition: DualAxis.h:123
UniformAxis u_
Definition: DualAxis.h:120
GridAxis a_
Definition: DualAxis.h:119

Member Function Documentation

gs::ClassId npstat::DualAxis::classId ( ) const
inline

Method related to "geners" I/O

Definition at line 110 of file DualAxis.h.

110 {return gs::ClassId(*this);}
static const char* npstat::DualAxis::classname ( )
inlinestatic

Definition at line 114 of file DualAxis.h.

114 {return "npstat::DualAxis";}
double npstat::DualAxis::coordinate ( const unsigned  i) const
inline

Definition at line 70 of file DualAxis.h.

References a_, npstat::UniformAxis::coordinate(), npstat::GridAxis::coordinate(), u_, and uniform_.

71  {return uniform_ ? u_.coordinate(i) : a_.coordinate(i);}
int i
Definition: DBlmapReader.cc:9
UniformAxis u_
Definition: DualAxis.h:120
double coordinate(unsigned i) const
Definition: UniformAxis.cc:81
double coordinate(const unsigned i) const
Definition: GridAxis.h:85
GridAxis a_
Definition: DualAxis.h:119
std::vector<double> npstat::DualAxis::coords ( ) const
inline

Definition at line 82 of file DualAxis.h.

References a_, npstat::GridAxis::coords(), npstat::UniformAxis::coords(), u_, and uniform_.

83  {return uniform_ ? u_.coords() : a_.coords();}
UniformAxis u_
Definition: DualAxis.h:120
GridAxis a_
Definition: DualAxis.h:119
std::vector< double > coords() const
Definition: UniformAxis.cc:70
const std::vector< double > & coords() const
Definition: GridAxis.h:46
static std::vector<double> npstat::DualAxis::dummy_vec ( )
inlinestaticprivate

Definition at line 123 of file DualAxis.h.

124  {
125  std::vector<double> vec(2, 0.0);
126  vec[1] = 1.0;
127  return vec;
128  }
const GridAxis* npstat::DualAxis::getGridAxis ( ) const
inline

Return a pointer to the underlying axis. This will be a null pointer if the axis does not correspond to the constructed type.

Definition at line 97 of file DualAxis.h.

References a_, and uniform_.

98  {return uniform_ ? static_cast<const GridAxis*>(0) : &a_;}
GridAxis a_
Definition: DualAxis.h:119
std::pair<unsigned,double> npstat::DualAxis::getInterval ( const double  x) const
inline

Definition at line 64 of file DualAxis.h.

References a_, npstat::UniformAxis::getInterval(), npstat::GridAxis::getInterval(), u_, and uniform_.

65  {return uniform_ ? u_.getInterval(x) : a_.getInterval(x);}
std::pair< unsigned, double > getInterval(double coordinate) const
Definition: GridAxis.cc:58
UniformAxis u_
Definition: DualAxis.h:120
GridAxis a_
Definition: DualAxis.h:119
std::pair< unsigned, double > getInterval(double coordinate) const
Definition: UniformAxis.cc:30
const UniformAxis* npstat::DualAxis::getUniformAxis ( ) const
inline

Definition at line 100 of file DualAxis.h.

References u_, and uniform_.

101  {return uniform_ ? &u_ : static_cast<const UniformAxis*>(0);}
UniformAxis u_
Definition: DualAxis.h:120
double npstat::DualAxis::intervalWidth ( const unsigned  i = 0) const
inline

Definition at line 79 of file DualAxis.h.

References a_, i, npstat::UniformAxis::intervalWidth(), npstat::GridAxis::intervalWidth(), u_, and uniform_.

80  {return uniform_ ? u_.intervalWidth(i) : a_.intervalWidth(i);}
int i
Definition: DBlmapReader.cc:9
double intervalWidth(const unsigned i=0) const
Definition: GridAxis.h:92
UniformAxis u_
Definition: DualAxis.h:120
GridAxis a_
Definition: DualAxis.h:119
double intervalWidth(unsigned) const
Definition: UniformAxis.h:64
bool npstat::DualAxis::isUniform ( ) const
inline

Definition at line 47 of file DualAxis.h.

References uniform_.

47 {return uniform_;}
const std::string& npstat::DualAxis::label ( ) const
inline

Definition at line 58 of file DualAxis.h.

References a_, npstat::UniformAxis::label(), npstat::GridAxis::label(), u_, and uniform_.

59  {return uniform_ ? u_.label() : a_.label();}
const std::string & label() const
Definition: GridAxis.h:47
UniformAxis u_
Definition: DualAxis.h:120
const std::string & label() const
Definition: UniformAxis.h:38
GridAxis a_
Definition: DualAxis.h:119
double npstat::DualAxis::length ( ) const
inline

Definition at line 73 of file DualAxis.h.

References a_, npstat::UniformAxis::length(), npstat::GridAxis::length(), u_, and uniform_.

74  {return uniform_ ? u_.length() : a_.length();}
double length() const
Definition: GridAxis.h:89
UniformAxis u_
Definition: DualAxis.h:120
double length() const
Definition: UniformAxis.h:61
GridAxis a_
Definition: DualAxis.h:119
std::pair<unsigned,double> npstat::DualAxis::linearInterval ( const double  x) const
inline

Definition at line 67 of file DualAxis.h.

References a_, npstat::UniformAxis::linearInterval(), npstat::GridAxis::linearInterval(), u_, and uniform_.

68  {return uniform_ ? u_.linearInterval(x) : a_.linearInterval(x);}
UniformAxis u_
Definition: DualAxis.h:120
GridAxis a_
Definition: DualAxis.h:119
std::pair< unsigned, double > linearInterval(double coordinate) const
Definition: GridAxis.cc:88
std::pair< unsigned, double > linearInterval(double coordinate) const
Definition: UniformAxis.cc:50
double npstat::DualAxis::max ( ) const
inline

Definition at line 55 of file DualAxis.h.

References a_, npstat::UniformAxis::max(), npstat::GridAxis::max(), u_, and uniform_.

56  {return uniform_ ? u_.max() : a_.max();}
double max() const
Definition: UniformAxis.h:37
double max() const
Definition: GridAxis.h:88
UniformAxis u_
Definition: DualAxis.h:120
GridAxis a_
Definition: DualAxis.h:119
double npstat::DualAxis::min ( ) const
inline

Definition at line 52 of file DualAxis.h.

References a_, npstat::UniformAxis::min(), npstat::GridAxis::min(), u_, and uniform_.

53  {return uniform_ ? u_.min() : a_.min();}
double min() const
Definition: GridAxis.h:87
UniformAxis u_
Definition: DualAxis.h:120
GridAxis a_
Definition: DualAxis.h:119
double min() const
Definition: UniformAxis.h:36
unsigned npstat::DualAxis::nCoords ( ) const
inline

Definition at line 49 of file DualAxis.h.

References a_, npstat::UniformAxis::nCoords(), npstat::GridAxis::nCoords(), u_, and uniform_.

50  {return uniform_ ? u_.nCoords() : a_.nCoords();}
unsigned nCoords() const
Definition: UniformAxis.h:35
UniformAxis u_
Definition: DualAxis.h:120
unsigned nCoords() const
Definition: GridAxis.h:84
GridAxis a_
Definition: DualAxis.h:119
unsigned npstat::DualAxis::nIntervals ( ) const
inline

Definition at line 76 of file DualAxis.h.

References a_, npstat::UniformAxis::nIntervals(), npstat::GridAxis::nIntervals(), u_, and uniform_.

77  {return uniform_ ? u_.nIntervals() : a_.nIntervals();}
unsigned nIntervals() const
Definition: GridAxis.h:91
UniformAxis u_
Definition: DualAxis.h:120
unsigned nIntervals() const
Definition: UniformAxis.h:63
GridAxis a_
Definition: DualAxis.h:119
bool npstat::DualAxis::operator!= ( const DualAxis r) const
inline

Definition at line 88 of file DualAxis.h.

References alignCSCRings::r.

89  {return !(*this == r);}
bool npstat::DualAxis::operator== ( const DualAxis r) const
inline

Definition at line 85 of file DualAxis.h.

References a_, u_, and uniform_.

86  {return uniform_ == r.uniform_ && a_ == r.a_ && u_ == r.u_;}
UniformAxis u_
Definition: DualAxis.h:120
GridAxis a_
Definition: DualAxis.h:119
DualAxis * npstat::DualAxis::read ( const gs::ClassId &  id,
std::istream &  in 
)
static

Definition at line 18 of file DualAxis.cc.

References EnergyCorrector::c, DualAxis(), npstat::UniformAxis::read(), and npstat::GridAxis::read().

Referenced by edmIntegrityCheck.PublishToFileSystem::get().

19  {
20  static const gs::ClassId current(gs::ClassId::makeId<DualAxis>());
21  current.ensureSameId(id);
22 
23  unsigned char c;
24  gs::read_pod(in, &c);
25  gs::ClassId clid(in, 1);
26  if (in.fail())
27  throw gs::IOReadFailure("In npstat::DualAxis::read: "
28  "input stream failure");
29  if (c)
30  {
31  CPP11_auto_ptr<UniformAxis> axis(UniformAxis::read(clid, in));
32  return new DualAxis(*axis);
33  }
34  else
35  {
36  CPP11_auto_ptr<GridAxis> axis(GridAxis::read(clid, in));
37  return new DualAxis(*axis);
38  }
39  }
static UniformAxis * read(const gs::ClassId &id, std::istream &in)
Definition: UniformAxis.cc:117
static GridAxis * read(const gs::ClassId &id, std::istream &in)
Definition: GridAxis.cc:154
void npstat::DualAxis::setLabel ( const char *  newlabel)
inline

Modify the axis label

Definition at line 105 of file DualAxis.h.

References a_, npstat::UniformAxis::setLabel(), npstat::GridAxis::setLabel(), u_, and uniform_.

106  {uniform_ ? u_.setLabel(newlabel) : a_.setLabel(newlabel);}
UniformAxis u_
Definition: DualAxis.h:120
void setLabel(const char *newlabel)
Definition: UniformAxis.h:74
GridAxis a_
Definition: DualAxis.h:119
void setLabel(const char *newlabel)
Definition: GridAxis.h:110
bool npstat::DualAxis::usesLogSpace ( ) const
inline

Definition at line 61 of file DualAxis.h.

References a_, u_, uniform_, npstat::UniformAxis::usesLogSpace(), and npstat::GridAxis::usesLogSpace().

62  {return uniform_ ? u_.usesLogSpace() : a_.usesLogSpace();}
UniformAxis u_
Definition: DualAxis.h:120
bool usesLogSpace() const
Definition: GridAxis.h:48
bool usesLogSpace() const
Definition: UniformAxis.h:39
GridAxis a_
Definition: DualAxis.h:119
static unsigned npstat::DualAxis::version ( )
inlinestatic

Definition at line 115 of file DualAxis.h.

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

115 {return 1;}
bool npstat::DualAxis::write ( std::ostream &  of) const

Definition at line 8 of file DualAxis.cc.

References a_, EnergyCorrector::c, npstat::UniformAxis::classId(), npstat::GridAxis::classId(), u_, uniform_, npstat::UniformAxis::write(), and npstat::GridAxis::write().

9  {
10  unsigned char c = uniform_;
11  gs::write_pod(of, c);
12  if (uniform_)
13  return !of.fail() && u_.classId().write(of) && u_.write(of);
14  else
15  return !of.fail() && a_.classId().write(of) && a_.write(of);
16  }
gs::ClassId classId() const
Definition: GridAxis.h:115
UniformAxis u_
Definition: DualAxis.h:120
bool write(std::ostream &of) const
Definition: UniformAxis.cc:108
GridAxis a_
Definition: DualAxis.h:119
bool write(std::ostream &of) const
Definition: GridAxis.cc:144
gs::ClassId classId() const
Definition: UniformAxis.h:78

Member Data Documentation

GridAxis npstat::DualAxis::a_
private
UniformAxis npstat::DualAxis::u_
private
bool npstat::DualAxis::uniform_
private