Logo ROOT   6.07/09
Reference Guide
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 class TRandom3;
58 
59 namespace TMVA {
60 
61  class MsgLogger;
62 
63  class Interval {
64 
65  public:
66 
67  Interval( Double_t min, Double_t max, Int_t nbins = 0 );
68  Interval( const Interval& other );
69  virtual ~Interval();
70 
71  // accessors
72  // accessors
73  virtual Double_t GetMin() const { return fMin; }
74  virtual Double_t GetMax() const { return fMax; }
75  virtual Double_t GetWidth() const;
76  virtual Int_t GetNbins() const { return fNbins; }
77  virtual Double_t GetMean() const;
78  virtual Double_t GetRndm( TRandom3& ) const;
79  virtual Double_t GetElement( Int_t position ) const;
80  virtual Double_t GetStepSize(Int_t iBin=0) const;
81 
82  void SetMax( Double_t m ) { fMax = m; }
83  void SetMin( Double_t m ) { fMin = m; }
84 
85  virtual void Print( std::ostream& os ) const;
86 
87  protected:
88 
89  Double_t fMin, fMax; // the constraints of the Interval
90  Int_t fNbins; // when >0 : number of bins (discrete interval); when ==0 continuous interval
91 
92  private:
93  MsgLogger& Log() const;
94 
95  ClassDef(Interval,0); // Interval definition, continous and discrete
96  };
97 
98 } // namespace TMVA
99 
100 #endif
virtual Int_t GetNbins() const
Definition: Interval.h:76
Double_t fMin
Definition: Interval.h:89
Random number generator class based on M.
Definition: TRandom3.h:29
Double_t fMax
Definition: Interval.h:89
MsgLogger & Log() const
Definition: Interval.cxx:174
int Int_t
Definition: RtypesCore.h:41
virtual Double_t GetMean() const
Definition: Interval.cxx:162
Int_t fNbins
Definition: Interval.h:90
int nbins[3]
#define ClassDef(name, id)
Definition: Rtypes.h:254
virtual ~Interval()
destructor
Definition: Interval.cxx:112
virtual Double_t GetWidth() const
Definition: Interval.cxx:158
virtual Double_t GetMin() const
Definition: Interval.h:73
virtual Double_t GetElement(Int_t position) const
calculates the value of the "number" bin in a discrete interval.
Definition: Interval.cxx:122
void SetMax(Double_t m)
Definition: Interval.h:82
Interval(Double_t min, Double_t max, Int_t nbins=0)
defines minimum and maximum of an interval when nbins > 0, interval describes a discrete distribution...
Definition: Interval.cxx:86
virtual Double_t GetMax() const
Definition: Interval.h:74
virtual Double_t GetStepSize(Int_t iBin=0) const
retuns the step size between the numbers of a "discrete Interval"
Definition: Interval.cxx:138
TMarker * m
Definition: textangle.C:8
virtual Double_t GetRndm(TRandom3 &) const
get uniformely distributed number within interval
Definition: Interval.cxx:153
double Double_t
Definition: RtypesCore.h:55
Abstract ClassifierFactory template that handles arbitrary types.
void SetMin(Double_t m)
Definition: Interval.h:83
virtual void Print(std::ostream &os) const
Definition: Interval.cxx:167