npstat is hosted by Hepforge, IPPP Durham
NPStat  5.10.0
IdentityTransform1D.hh
Go to the documentation of this file.
1 #ifndef NPSTAT_IDENTITYTRANSFORM1D_HH_
2 #define NPSTAT_IDENTITYTRANSFORM1D_HH_
3 
4 /*!
5 // \file IdentityTransform1D.hh
6 //
7 // \brief Identity 1-d coordinate transform, for use where a transform
8 // is expected but not needed
9 //
10 // Author: I. Volobouev
11 //
12 // April 2015
13 */
14 
16 
17 namespace npstat {
19  {
20  public:
21  /**
22  // This transform can be used with one dummy parameter
23  // which is stored internally and can be retrieved
24  */
25  inline explicit IdentityTransform1D(double p0=0.0)
26  : AbsDistributionTransform1D(1U), p_(p0) {}
27 
28  inline virtual ~IdentityTransform1D() {}
29 
30  inline virtual IdentityTransform1D* clone() const
31  {return new IdentityTransform1D(*this);}
32 
33  inline double transformForward(const double x, double* dydx) const
34  {if (dydx) *dydx = 1.0; return x;}
35  inline double transformBack(const double y) const {return y;}
36  inline bool isIncreasing() const {return true;}
37 
38  //@{
39  /** Prototype needed for I/O */
40  inline virtual gs::ClassId classId() const {return gs::ClassId(*this);}
41  virtual bool write(std::ostream&) const;
42  //@}
43 
44  static inline const char* classname()
45  {return "npstat::IdentityTransform1D";}
46  static inline unsigned version() {return 1;}
47  static IdentityTransform1D* read(const gs::ClassId& id, std::istream&);
48 
49  protected:
50  inline bool isEqual(const AbsDistributionTransform1D& o) const
51  {
52  const IdentityTransform1D& r =
53  static_cast<const IdentityTransform1D&>(o);
54  return p_ == r.p_;
55  }
56 
57  private:
58  inline void setParameterChecked(unsigned, double v) {p_ = v;}
59  inline void setAllParametersChecked(const double* p) {p_ = p[0];}
60  inline double getParameterChecked(unsigned) const {return p_;}
61 
62  double p_;
63  };
64 }
65 
66 #endif // NPSTAT_IDENTITYTRANSFORM1D_HH_
Interface definition for 1-d coordinate transformations used to build statistical distributions.
Definition: AbsDistributionTransform1D.hh:29
Definition: IdentityTransform1D.hh:19
virtual gs::ClassId classId() const
Definition: IdentityTransform1D.hh:40
double transformForward(const double x, double *dydx) const
Definition: IdentityTransform1D.hh:33
virtual IdentityTransform1D * clone() const
Definition: IdentityTransform1D.hh:30
bool isEqual(const AbsDistributionTransform1D &o) const
Definition: IdentityTransform1D.hh:50
IdentityTransform1D(double p0=0.0)
Definition: IdentityTransform1D.hh:25
bool isIncreasing() const
Definition: IdentityTransform1D.hh:36
Definition: AbsArrayProjector.hh:14