Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:10:59

0001 // @(#)root/tmva $Id$
0002 // Author: Peter Speckmayer
0003 
0004 /**********************************************************************************
0005  * Project: TMVA - a Root-integrated toolkit for multivariate data analysis       *
0006  * Package: TMVA                                                                  *
0007  * Class  : Interval                                                              *
0008  *                                             *
0009  *                                                                                *
0010  * Description:                                                                   *
0011  *    Generic range definition (used, eg, in genetic algorithm)                   *
0012  *                                                                                *
0013  * Authors (alphabetical):                                                        *
0014  *      Peter Speckmayer <speckmay@mail.cern.ch>  - CERN, Switzerland             *
0015  *                                                                                *
0016  * Copyright (c) 2005:                                                            *
0017  *      CERN, Switzerland                                                         *
0018  *      MPI-K Heidelberg, Germany                                                 *
0019  *                                                                                *
0020  * Redistribution and use in source and binary forms, with or without             *
0021  * modification, are permitted according to the terms listed in LICENSE           *
0022  * (see tmva/doc/LICENSE)                                          *
0023  **********************************************************************************/
0024 
0025 #ifndef ROOT_TMVA_Interval
0026 #define ROOT_TMVA_Interval
0027 
0028 //////////////////////////////////////////////////////////////////////////////
0029 //                                                                          //
0030 // Interval                                                                 //
0031 //                                                                          //
0032 // Interval definition, continuous and discrete                             //
0033 //                                                                          //
0034 // Interval(min,max)  : a continuous interval [min,max]                     //
0035 // Interval(min,max,n): a "discrete interval" [min,max], i.e the n numbers: //
0036 //          min, min+step, min+2*step,...., min+(n-1)*step, min+n*step=max  //
0037 //   e.g.: Interval(1,5,5)=1,2,3,4,5                                        //
0038 //         Interval(.5,1.,6)= .5, .6., .7, .8, .9, 1.0                      //
0039 //                                                                          //
0040 //  Note: **bin** counting starts from ZERO unlike in ROOT histograms       //
0041 //                                                                          //
0042 //    Example:   Interval(.5,1.,6)                                          //
0043 //                                                                          //
0044 //             [ min                           max ]                        //
0045 //         ------------------------------------------------------------     //
0046 //                |     |     |     |     |     |                           //
0047 //               .5    .6    .7    .8    .9    1.0                          //
0048 //                                                                          //
0049 //         bin    0     1     2     3     4     5                           //
0050 //                                                                          //
0051 //                                                                          //
0052 //////////////////////////////////////////////////////////////////////////////
0053 #include "Rtypes.h"
0054 
0055 class TRandom3;
0056 
0057 namespace TMVA {
0058 
0059    class MsgLogger;
0060 
0061    class Interval {
0062 
0063    public:
0064 
0065       Interval( Double_t min, Double_t max, Int_t nbins = 0 );
0066       Interval( const Interval& other );
0067       virtual ~Interval();
0068 
0069       // accessors
0070       // accessors
0071       virtual Double_t GetMin()   const { return fMin; }
0072       virtual Double_t GetMax()   const { return fMax; }
0073       virtual Double_t GetWidth() const;
0074       virtual Int_t    GetNbins() const { return fNbins; }
0075       virtual Double_t GetMean()  const;
0076       virtual Double_t GetRndm( TRandom3& )  const;
0077       virtual Double_t GetElement( Int_t position ) const;
0078       virtual Double_t GetStepSize(Int_t iBin=0) const;
0079 
0080       void SetMax( Double_t m ) { fMax = m; }
0081       void SetMin( Double_t m ) { fMin = m; }
0082 
0083       virtual void Print( std::ostream& os ) const;
0084 
0085    protected:
0086 
0087       Double_t fMin, fMax;    ///< the constraints of the Interval
0088       Int_t    fNbins;        ///< when >0 : number of bins (discrete interval); when ==0 continuous interval
0089 
0090    private:
0091       MsgLogger& Log() const;
0092 
0093       ClassDef(Interval,0);    // Interval definition, continuous and discrete
0094    };
0095 
0096 } // namespace TMVA
0097 
0098 #endif