npstat is hosted by Hepforge, IPPP Durham
NPStat  5.10.0
LocScaleTransform1D.hh
Go to the documentation of this file.
1 #ifndef NPSTAT_LOCSCALETRANSFORM1D_HH_
2 #define NPSTAT_LOCSCALETRANSFORM1D_HH_
3 
4 /*!
5 // \file LocScaleTransform1D.hh
6 //
7 // \brief Transform y = (x - mu)/sigma
8 //
9 // Author: I. Volobouev
10 //
11 // October 2022
12 */
13 
15 
16 namespace npstat {
18  {
19  public:
20  LocScaleTransform1D(double mu, double sigma);
21  inline virtual ~LocScaleTransform1D() {}
22 
23  inline virtual LocScaleTransform1D* clone() const
24  {return new LocScaleTransform1D(*this);}
25 
26  double transformForward(double x, double* dydx) const;
27  double transformBack(double y) const;
28  inline bool isIncreasing() const {return true;}
29 
30  //@{
31  /** Prototype needed for I/O */
32  inline virtual gs::ClassId classId() const {return gs::ClassId(*this);}
33  virtual bool write(std::ostream&) const;
34  //@}
35 
36  static inline const char* classname()
37  {return "npstat::LocScaleTransform1D";}
38  static inline unsigned version() {return 1;}
39  static LocScaleTransform1D* read(const gs::ClassId& id, std::istream& is);
40 
41  protected:
42  virtual bool isEqual(const AbsDistributionTransform1D&) const;
43 
44  private:
45  void validateScale(double sigma);
46 
47  inline void setParameterChecked(const unsigned which,
48  const double value)
49  {
50  if (which)
51  validateScale(value);
52  params_[which] = value;
53  }
54  inline void setAllParametersChecked(const double* p)
55  {
56  validateScale(p[1]);
57  params_[0] = p[0];
58  params_[1] = p[1];
59  }
60  inline double getParameterChecked(const unsigned which) const
61  {return params_[which];}
62 
63  double params_[2];
64  };
65 }
66 
67 #endif // NPSTAT_LOCSCALETRANSFORM1D_HH_
Interface definition for 1-d coordinate transformations used to build statistical distributions.
Definition: AbsDistributionTransform1D.hh:29
Definition: LocScaleTransform1D.hh:18
double transformForward(double x, double *dydx) const
virtual gs::ClassId classId() const
Definition: LocScaleTransform1D.hh:32
bool isIncreasing() const
Definition: LocScaleTransform1D.hh:28
virtual LocScaleTransform1D * clone() const
Definition: LocScaleTransform1D.hh:23
virtual bool isEqual(const AbsDistributionTransform1D &) const
Definition: AbsArrayProjector.hh:14