BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
Interval.h
Go to the documentation of this file.
1 // @(#)root/tmva $Id$
2 // Author: Peter Speckmayer
3 
4 /**********************************************************************************
5  * Project: TMVA - a Root-integrated toolkit for multivariate data analysis *
6  * Package: TMVA *
7  * Class : Interval *
8  * Web : http://tmva.sourceforge.net *
9  * *
10  * Description: *
11  * Generic range definition (used, eg, in genetic algorithm) *
12  * *
13  * Authors (alphabetical): *
14  * Peter Speckmayer <speckmay@mail.cern.ch> - CERN, Switzerland *
15  * *
16  * Copyright (c) 2005: *
17  * CERN, Switzerland *
18  * MPI-K Heidelberg, Germany *
19  * *
20  * Redistribution and use in source and binary forms, with or without *
21  * modification, are permitted according to the terms listed in LICENSE *
22  * (http://tmva.sourceforge.net/LICENSE) *
23  **********************************************************************************/
24 
25 #ifndef ROOT_TMVA_Interval
26 #define ROOT_TMVA_Interval
27 
28 //////////////////////////////////////////////////////////////////////////////
29 // //
30 // Interval //
31 // //
32 // Interval definition, continuous and discrete //
33 // //
34 // Interval(min,max) : a continous interval [min,max] //
35 // Interval(min,max,n): a "discrete interval" [min,max], i.e the n numbers: //
36 // min, min+step, min+2*step,...., min+(n-1)*step, min+n*step=max //
37 // e.g.: Interval(1,5,5)=1,2,3,4,5 //
38 // Interval(.5,1.,6)= .5, .6., .7, .8, .9, 1.0 //
39 // //
40 // Note: **bin** counting starts from ZERO unlike in ROOT histograms //
41 // //
42 // Example: Interval(.5,1.,6) //
43 // //
44 // [ min max ] //
45 // ------------------------------------------------------------ //
46 // | | | | | | //
47 // .5 .6 .7 .8 .9 1.0 //
48 // //
49 // bin 0 1 2 3 4 5 //
50 // //
51 // //
52 //////////////////////////////////////////////////////////////////////////////
53 //#ifndef ROOT_Rtypes
54 //#include "Rtypes.h"
55 //#endif
56 
57 #include "TMVA/Types.h"
58 
59 class TRandom3;
60 
61 namespace TMVA {
62 
63 // class MsgLogger;
64 
65  class Interval {
66 
67  public:
68 
69  Interval( Double_t min, Double_t max, Int_t nbins = 0 );
70  Interval( const Interval& other );
71  virtual ~Interval();
72 
73  // accessors
74  // accessors
75  virtual Double_t GetMin() const { return fMin; }
76  virtual Double_t GetMax() const { return fMax; }
77  virtual Double_t GetWidth() const;
78  virtual Int_t GetNbins() const { return fNbins; }
79  virtual Double_t GetMean() const;
80  virtual Double_t GetRndm( TRandom3& ) const;
81  virtual Double_t GetElement( Int_t position ) const;
82  virtual Double_t GetStepSize(Int_t iBin=0) const;
83 
84  void SetMax( Double_t m ) { fMax = m; }
85  void SetMin( Double_t m ) { fMin = m; }
86 
87  virtual void Print( std::ostream& os ) const;
88 
89  protected:
90 
91  Double_t fMin, fMax; // the constraints of the Interval
92  Int_t fNbins; // when >0 : number of bins (discrete interval); when ==0 continuous interval
93 
94  private:
95 // MsgLogger& Log() const;
96 
97 // ClassDef(Interval,0) // Interval definition, continous and discrete
98  };
99 
100 } // namespace TMVA
101 
102 #endif
int Int_t
Definition: RtypesCore.h:41
double Double_t
Definition: RtypesCore.h:55
virtual Double_t GetRndm(TRandom3 &) const
Interval(const Interval &other)
Double_t fMin
Definition: Interval.h:91
void SetMax(Double_t m)
Definition: Interval.h:84
virtual void Print(std::ostream &os) const
Int_t fNbins
Definition: Interval.h:92
virtual Double_t GetMin() const
Definition: Interval.h:75
virtual Double_t GetElement(Int_t position) const
virtual Double_t GetWidth() const
virtual Double_t GetMax() const
Definition: Interval.h:76
Double_t fMax
Definition: Interval.h:91
virtual Double_t GetStepSize(Int_t iBin=0) const
void SetMin(Double_t m)
Definition: Interval.h:85
Interval(Double_t min, Double_t max, Int_t nbins=0)
virtual ~Interval()
virtual Int_t GetNbins() const
Definition: Interval.h:78
virtual Double_t GetMean() const