Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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#include "Rtypes.h"
54
55class TRandom3;
56
57namespace TMVA {
58
59 class MsgLogger;
60
61 class Interval {
62
63 public:
64
65 Interval( Double_t min, Double_t max, Int_t nbins = 0 );
66 Interval( const Interval& other );
67 virtual ~Interval();
68
69 // accessors
70 // accessors
71 virtual Double_t GetMin() const { return fMin; }
72 virtual Double_t GetMax() const { return fMax; }
73 virtual Double_t GetWidth() const;
74 virtual Int_t GetNbins() const { return fNbins; }
75 virtual Double_t GetMean() const;
76 virtual Double_t GetRndm( TRandom3& ) const;
77 virtual Double_t GetElement( Int_t position ) const;
78 virtual Double_t GetStepSize(Int_t iBin=0) const;
79
80 void SetMax( Double_t m ) { fMax = m; }
81 void SetMin( Double_t m ) { fMin = m; }
82
83 virtual void Print( std::ostream& os ) const;
84
85 protected:
86
87 Double_t fMin, fMax; // the constraints of the Interval
88 Int_t fNbins; // when >0 : number of bins (discrete interval); when ==0 continuous interval
89
90 private:
91 MsgLogger& Log() const;
92
93 ClassDef(Interval,0); // Interval definition, continous and discrete
94 };
95
96} // namespace TMVA
97
98#endif
double Double_t
Definition RtypesCore.h:59
#define ClassDef(name, id)
Definition Rtypes.h:325
The TMVA::Interval Class.
Definition Interval.h:61
virtual Double_t GetRndm(TRandom3 &) const
get uniformly distributed number within interval
Definition Interval.cxx:150
virtual void Print(std::ostream &os) const
Definition Interval.cxx:164
Double_t fMin
Definition Interval.h:87
void SetMax(Double_t m)
Definition Interval.h:80
virtual Double_t GetMin() const
Definition Interval.h:71
MsgLogger & Log() const
Definition Interval.cxx:171
virtual Double_t GetMax() const
Definition Interval.h:72
virtual ~Interval()
destructor
Definition Interval.cxx:109
Double_t fMax
Definition Interval.h:87
virtual Double_t GetElement(Int_t position) const
calculates the value of the "number" bin in a discrete interval.
Definition Interval.cxx:119
virtual Double_t GetStepSize(Int_t iBin=0) const
returns the step size between the numbers of a "discrete Interval"
Definition Interval.cxx:135
virtual Double_t GetWidth() const
Definition Interval.cxx:155
void SetMin(Double_t m)
Definition Interval.h:81
virtual Int_t GetNbins() const
Definition Interval.h:74
virtual Double_t GetMean() const
Definition Interval.cxx:159
ostringstream derivative to redirect and format output
Definition MsgLogger.h:59
Random number generator class based on M.
Definition TRandom3.h:27
create variable transformations
auto * m
Definition textangle.C:8