CMS 3D CMS Logo

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=nullptr)
 
 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

◆ DualAxis() [1/6]

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

Definition at line 27 of file DualAxis.h.

27 : a_(g), u_(2, 0.0, 1.0), uniform_(false) {}
UniformAxis u_
Definition: DualAxis.h:105
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:104

◆ DualAxis() [2/6]

npstat::DualAxis::DualAxis ( const UniformAxis u)
inline

Definition at line 29 of file DualAxis.h.

29 : a_(dummy_vec()), u_(u), uniform_(true) {}
static std::vector< double > dummy_vec()
Definition: DualAxis.h:108
UniformAxis u_
Definition: DualAxis.h:105
GridAxis a_
Definition: DualAxis.h:104

◆ DualAxis() [3/6]

npstat::DualAxis::DualAxis ( unsigned  nCoords,
double  min,
double  max,
const char *  label = nullptr 
)
inline

Definition at line 31 of file DualAxis.h.

32  : a_(dummy_vec()), u_(nCoords, min, max, label), uniform_(true) {}
static std::vector< double > dummy_vec()
Definition: DualAxis.h:108
double min() const
Definition: DualAxis.h:45
const std::string & label() const
Definition: DualAxis.h:49
UniformAxis u_
Definition: DualAxis.h:105
double max() const
Definition: DualAxis.h:47
unsigned nCoords() const
Definition: DualAxis.h:43
GridAxis a_
Definition: DualAxis.h:104

◆ DualAxis() [4/6]

npstat::DualAxis::DualAxis ( const std::vector< double > &  coords,
const bool  useLogSpace = false 
)
inlineexplicit

Definition at line 34 of file DualAxis.h.

35  : a_(coords, useLogSpace), u_(2, 0.0, 1.0), uniform_(false) {}
UniformAxis u_
Definition: DualAxis.h:105
GridAxis a_
Definition: DualAxis.h:104
std::vector< double > coords() const
Definition: DualAxis.h:71

◆ DualAxis() [5/6]

npstat::DualAxis::DualAxis ( const std::vector< double > &  coords,
const char *  label,
const bool  useLogSpace = false 
)
inline

Definition at line 37 of file DualAxis.h.

38  : a_(coords, label, useLogSpace), u_(2, 0.0, 1.0), uniform_(false) {}
const std::string & label() const
Definition: DualAxis.h:49
UniformAxis u_
Definition: DualAxis.h:105
GridAxis a_
Definition: DualAxis.h:104
std::vector< double > coords() const
Definition: DualAxis.h:71

◆ DualAxis() [6/6]

npstat::DualAxis::DualAxis ( )
inlineprivate

Definition at line 114 of file DualAxis.h.

Referenced by read().

114 : a_(dummy_vec()), u_(2, 0.0, 1.0), uniform_(true) {}
static std::vector< double > dummy_vec()
Definition: DualAxis.h:108
UniformAxis u_
Definition: DualAxis.h:105
GridAxis a_
Definition: DualAxis.h:104

Member Function Documentation

◆ classId()

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

Method related to "geners" I/O

Definition at line 95 of file DualAxis.h.

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

◆ classname()

static const char* npstat::DualAxis::classname ( )
inlinestatic

Definition at line 99 of file DualAxis.h.

99 { return "npstat::DualAxis"; }

◆ coordinate()

double npstat::DualAxis::coordinate ( const unsigned  i) const
inline

Definition at line 61 of file DualAxis.h.

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

61 { return uniform_ ? u_.coordinate(i) : a_.coordinate(i); }
double coordinate(unsigned i) const
Definition: UniformAxis.cc:74
UniformAxis u_
Definition: DualAxis.h:105
GridAxis a_
Definition: DualAxis.h:104
double coordinate(const unsigned i) const
Definition: GridAxis.h:82

◆ coords()

std::vector<double> npstat::DualAxis::coords ( ) const
inline

Definition at line 71 of file DualAxis.h.

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

71 { return uniform_ ? u_.coords() : a_.coords(); }
UniformAxis u_
Definition: DualAxis.h:105
GridAxis a_
Definition: DualAxis.h:104
const std::vector< double > & coords() const
Definition: GridAxis.h:43
std::vector< double > coords() const
Definition: UniformAxis.cc:64

◆ dummy_vec()

static std::vector<double> npstat::DualAxis::dummy_vec ( )
inlinestaticprivate

Definition at line 108 of file DualAxis.h.

108  {
109  std::vector<double> vec(2, 0.0);
110  vec[1] = 1.0;
111  return vec;
112  }

◆ getGridAxis()

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 83 of file DualAxis.h.

References a_, and uniform_.

83 { return uniform_ ? static_cast<const GridAxis*>(nullptr) : &a_; }
GridAxis a_
Definition: DualAxis.h:104

◆ getInterval()

std::pair<unsigned, double> npstat::DualAxis::getInterval ( const double  x) const
inline

Definition at line 53 of file DualAxis.h.

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

53  {
54  return uniform_ ? u_.getInterval(x) : a_.getInterval(x);
55  }
UniformAxis u_
Definition: DualAxis.h:105
std::pair< unsigned, double > getInterval(double coordinate) const
Definition: UniformAxis.cc:28
GridAxis a_
Definition: DualAxis.h:104
std::pair< unsigned, double > getInterval(double coordinate) const
Definition: GridAxis.cc:48

◆ getUniformAxis()

const UniformAxis* npstat::DualAxis::getUniformAxis ( ) const
inline

Definition at line 85 of file DualAxis.h.

References u_, and uniform_.

85  {
86  return uniform_ ? &u_ : static_cast<const UniformAxis*>(nullptr);
87  }
UniformAxis u_
Definition: DualAxis.h:105

◆ intervalWidth()

double npstat::DualAxis::intervalWidth ( const unsigned  i = 0) const
inline

Definition at line 67 of file DualAxis.h.

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

67  {
69  }
double intervalWidth(const unsigned i=0) const
Definition: GridAxis.h:88
UniformAxis u_
Definition: DualAxis.h:105
double intervalWidth(unsigned) const
Definition: UniformAxis.h:62
GridAxis a_
Definition: DualAxis.h:104

◆ isUniform()

bool npstat::DualAxis::isUniform ( ) const
inline

Definition at line 41 of file DualAxis.h.

References uniform_.

41 { return uniform_; }

◆ label()

const std::string& npstat::DualAxis::label ( ) const
inline

Definition at line 49 of file DualAxis.h.

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

49 { return uniform_ ? u_.label() : a_.label(); }
UniformAxis u_
Definition: DualAxis.h:105
const std::string & label() const
Definition: GridAxis.h:44
GridAxis a_
Definition: DualAxis.h:104
const std::string & label() const
Definition: UniformAxis.h:36

◆ length()

double npstat::DualAxis::length ( ) const
inline

Definition at line 63 of file DualAxis.h.

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

63 { return uniform_ ? u_.length() : a_.length(); }
UniformAxis u_
Definition: DualAxis.h:105
double length() const
Definition: UniformAxis.h:59
double length() const
Definition: GridAxis.h:85
GridAxis a_
Definition: DualAxis.h:104

◆ linearInterval()

std::pair<unsigned, double> npstat::DualAxis::linearInterval ( const double  x) const
inline

Definition at line 57 of file DualAxis.h.

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

57  {
59  }
std::pair< unsigned, double > linearInterval(double coordinate) const
Definition: GridAxis.cc:71
UniformAxis u_
Definition: DualAxis.h:105
std::pair< unsigned, double > linearInterval(double coordinate) const
Definition: UniformAxis.cc:46
GridAxis a_
Definition: DualAxis.h:104

◆ max()

double npstat::DualAxis::max ( ) const
inline

Definition at line 47 of file DualAxis.h.

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

47 { return uniform_ ? u_.max() : a_.max(); }
double max() const
Definition: GridAxis.h:84
UniformAxis u_
Definition: DualAxis.h:105
GridAxis a_
Definition: DualAxis.h:104
double max() const
Definition: UniformAxis.h:35

◆ min()

double npstat::DualAxis::min ( ) const
inline

Definition at line 45 of file DualAxis.h.

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

45 { return uniform_ ? u_.min() : a_.min(); }
UniformAxis u_
Definition: DualAxis.h:105
double min() const
Definition: UniformAxis.h:34
GridAxis a_
Definition: DualAxis.h:104
double min() const
Definition: GridAxis.h:83

◆ nCoords()

unsigned npstat::DualAxis::nCoords ( ) const
inline

Definition at line 43 of file DualAxis.h.

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

43 { return uniform_ ? u_.nCoords() : a_.nCoords(); }
UniformAxis u_
Definition: DualAxis.h:105
unsigned nCoords() const
Definition: GridAxis.h:81
unsigned nCoords() const
Definition: UniformAxis.h:33
GridAxis a_
Definition: DualAxis.h:104

◆ nIntervals()

unsigned npstat::DualAxis::nIntervals ( ) const
inline

Definition at line 65 of file DualAxis.h.

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

65 { return uniform_ ? u_.nIntervals() : a_.nIntervals(); }
UniformAxis u_
Definition: DualAxis.h:105
GridAxis a_
Definition: DualAxis.h:104
unsigned nIntervals() const
Definition: GridAxis.h:87
unsigned nIntervals() const
Definition: UniformAxis.h:61

◆ operator!=()

bool npstat::DualAxis::operator!= ( const DualAxis r) const
inline

Definition at line 75 of file DualAxis.h.

References alignCSCRings::r.

75 { return !(*this == r); }

◆ operator==()

bool npstat::DualAxis::operator== ( const DualAxis r) const
inline

Definition at line 73 of file DualAxis.h.

References a_, alignCSCRings::r, u_, and uniform_.

73 { return uniform_ == r.uniform_ && a_ == r.a_ && u_ == r.u_; }
UniformAxis u_
Definition: DualAxis.h:105
GridAxis a_
Definition: DualAxis.h:104

◆ read()

DualAxis * npstat::DualAxis::read ( const gs::ClassId &  id,
std::istream &  in 
)
static

Definition at line 17 of file DualAxis.cc.

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

Referenced by edmIntegrityCheck.PublishToFileSystem::get().

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

◆ setLabel()

void npstat::DualAxis::setLabel ( const char *  newlabel)
inline

Modify the axis label

Definition at line 91 of file DualAxis.h.

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

91 { uniform_ ? u_.setLabel(newlabel) : a_.setLabel(newlabel); }
UniformAxis u_
Definition: DualAxis.h:105
void setLabel(const char *newlabel)
Definition: UniformAxis.h:71
GridAxis a_
Definition: DualAxis.h:104
void setLabel(const char *newlabel)
Definition: GridAxis.h:104

◆ usesLogSpace()

bool npstat::DualAxis::usesLogSpace ( ) const
inline

Definition at line 51 of file DualAxis.h.

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

51 { return uniform_ ? u_.usesLogSpace() : a_.usesLogSpace(); }
bool usesLogSpace() const
Definition: UniformAxis.h:37
UniformAxis u_
Definition: DualAxis.h:105
bool usesLogSpace() const
Definition: GridAxis.h:45
GridAxis a_
Definition: DualAxis.h:104

◆ version()

static unsigned npstat::DualAxis::version ( )
inlinestatic

Definition at line 100 of file DualAxis.h.

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

100 { return 1; }

◆ write()

bool npstat::DualAxis::write ( std::ostream &  of) const

Definition at line 8 of file DualAxis.cc.

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

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

Member Data Documentation

◆ a_

GridAxis npstat::DualAxis::a_
private

◆ u_

UniformAxis npstat::DualAxis::u_
private

◆ uniform_

bool npstat::DualAxis::uniform_
private