```// @(#)root/tmva \$Id\$
// Author: Peter Speckmayer

/**********************************************************************************
* Project: TMVA - a Root-integrated toolkit for multivariate data analysis       *
* Package: TMVA                                                                  *
* Class  : Interval                                                              *
* Web    : http://tmva.sourceforge.net                                           *
*                                                                                *
* Description:                                                                   *
*    Generic range definition (used, eg, in genetic algorithm)                   *
*                                                                                *
* Authors (alphabetical):                                                        *
*      Peter Speckmayer <speckmay@mail.cern.ch>  - CERN, Switzerland             *
*                                                                                *
* Copyright (c) 2005:                                                            *
*      CERN, Switzerland                                                         *
*      MPI-K Heidelberg, Germany                                                 *
*                                                                                *
* Redistribution and use in source and binary forms, with or without             *
* modification, are permitted according to the terms listed in LICENSE           *
**********************************************************************************/

#ifndef ROOT_TMVA_Interval
#define ROOT_TMVA_Interval

//////////////////////////////////////////////////////////////////////////////
//                                                                          //
// Interval                                                                 //
//                                                                          //
// Interval definition, continuous and discrete                             //
//                                                                          //
// Interval(min,max)  : a continous interval [min,max]                      //
// Interval(min,max,n): a "discrete interval" [min,max], i.e the n numbers: //
//          min, min+step, min+2*step,...., min+(n-1)*step, min+n*step=max  //
//   e.g.: Interval(1,5,5)=1,2,3,4,5                                        //
//         Interval(.5,1.,6)= .5, .6., .7, .8, .9, 1.0                      //
//                                                                          //
//  Note: **bin** counting starts from ZERO unlike in ROOT histograms       //
//                                                                          //
//    Example:   Interval(.5,1.,6)                                          //
//                                                                          //
//             [ min                           max ]                        //
//         ------------------------------------------------------------     //
//                |     |     |     |     |     |                           //
//               .5    .6    .7    .8    .9    1.0                          //
//                                                                          //
//         bin    0     1     2     3     4     5                           //
//                                                                          //
//                                                                          //
//////////////////////////////////////////////////////////////////////////////
#ifndef ROOT_Rtypes
#include "Rtypes.h"
#endif

class TRandom3;

namespace TMVA {

class MsgLogger;

class Interval {

public:

Interval( Double_t min, Double_t max, Int_t nbins = 0 );
Interval( const Interval& other );
virtual ~Interval();

// accessors
// accessors
virtual Double_t GetMin()   const { return fMin; }
virtual Double_t GetMax()   const { return fMax; }
virtual Double_t GetWidth() const;
virtual Int_t    GetNbins() const { return fNbins; }
virtual Double_t GetMean()  const;
virtual Double_t GetRndm( TRandom3& )  const;
virtual Double_t GetElement( Int_t position ) const;
virtual Double_t GetStepSize(Int_t iBin=0) const;

void SetMax( Double_t m ) { fMax = m; }
void SetMin( Double_t m ) { fMin = m; }

virtual void Print( std::ostream& os ) const;

protected:

Double_t fMin, fMax;    // the constraints of the Interval
Int_t    fNbins;        // when >0 : number of bins (discrete interval); when ==0 continuous interval

private:
MsgLogger& Log() const;

ClassDef(Interval,0)    // Interval definition, continous and discrete
};

} // namespace TMVA

#endif
```
Interval.h:1
Interval.h:2
Interval.h:3
Interval.h:4
Interval.h:5
Interval.h:6
Interval.h:7
Interval.h:8
Interval.h:9
Interval.h:10
Interval.h:11
Interval.h:12
Interval.h:13
Interval.h:14
Interval.h:15
Interval.h:16
Interval.h:17
Interval.h:18
Interval.h:19
Interval.h:20
Interval.h:21
Interval.h:22
Interval.h:23
Interval.h:24
Interval.h:25
Interval.h:26
Interval.h:27
Interval.h:28
Interval.h:29
Interval.h:30
Interval.h:31
Interval.h:32
Interval.h:33
Interval.h:34
Interval.h:35
Interval.h:36
Interval.h:37
Interval.h:38
Interval.h:39
Interval.h:40
Interval.h:41
Interval.h:42
Interval.h:43
Interval.h:44
Interval.h:45
Interval.h:46
Interval.h:47
Interval.h:48
Interval.h:49
Interval.h:50
Interval.h:51
Interval.h:52
Interval.h:53
Interval.h:54
Interval.h:55
Interval.h:56
Interval.h:57
Interval.h:58
Interval.h:59
Interval.h:60
Interval.h:61
Interval.h:62
Interval.h:63
Interval.h:64
Interval.h:65
Interval.h:66
Interval.h:67
Interval.h:68
Interval.h:69
Interval.h:70
Interval.h:71
Interval.h:72
Interval.h:73
Interval.h:74
Interval.h:75
Interval.h:76
Interval.h:77
Interval.h:78
Interval.h:79
Interval.h:80
Interval.h:81
Interval.h:82
Interval.h:83
Interval.h:84
Interval.h:85
Interval.h:86
Interval.h:87
Interval.h:88
Interval.h:89
Interval.h:90
Interval.h:91
Interval.h:92
Interval.h:93
Interval.h:94
Interval.h:95
Interval.h:96
Interval.h:97
Interval.h:98
Interval.h:99
Interval.h:100