Warning, file /include/root/TMVA/BinarySearchTree.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030 #ifndef ROOT_TMVA_BinarySearchTree
0031 #define ROOT_TMVA_BinarySearchTree
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041 #include <vector>
0042 #include <queue>
0043 #include <utility>
0044
0045 #ifndef ROOT_time
0046 #include "time.h"
0047 #endif
0048
0049 #include "TMVA/Volume.h"
0050 #include "TMVA/BinaryTree.h"
0051 #include "TMVA/BinarySearchTreeNode.h"
0052 #include "TMVA/VariableInfo.h"
0053
0054 class TString;
0055 class TTree;
0056
0057
0058
0059
0060 namespace TMVA {
0061
0062 class Event;
0063
0064
0065 class BinarySearchTree : public BinaryTree {
0066
0067 public:
0068
0069
0070 BinarySearchTree( void );
0071
0072
0073 BinarySearchTree (const BinarySearchTree &b);
0074
0075
0076 virtual ~BinarySearchTree( void );
0077
0078 Node * CreateNode( UInt_t ) const override { return new BinarySearchTreeNode(); }
0079 BinaryTree* CreateTree() const override { return new BinarySearchTree(); }
0080 static BinarySearchTree* CreateFromXML(void* node, UInt_t tmva_Version_Code = TMVA_VERSION_CODE);
0081 const char* ClassName() const override { return "BinarySearchTree"; }
0082
0083
0084
0085 BinarySearchTreeNode* Search( Event * event ) const;
0086
0087
0088 void Insert( const Event * );
0089
0090
0091 Double_t GetSumOfWeights( void ) const;
0092
0093
0094 Double_t GetSumOfWeights( Int_t theType ) const;
0095
0096
0097 void SetPeriode( Int_t p ) { fPeriod = p; }
0098
0099
0100 UInt_t GetPeriode( void ) const { return fPeriod; }
0101
0102
0103 Double_t SearchVolume( Volume*, std::vector<const TMVA::BinarySearchTreeNode*>* events = nullptr );
0104
0105
0106
0107 Double_t Fill( const std::vector<TMVA::Event*>& events, const std::vector<Int_t>& theVars, Int_t theType = -1 );
0108
0109
0110
0111 Double_t Fill( const std::vector<TMVA::Event*>& events, Int_t theType = -1 );
0112
0113 void NormalizeTree ();
0114
0115 void CalcStatistics( TMVA::Node* n = nullptr );
0116 void Clear ( TMVA::Node* n = nullptr );
0117
0118
0119 Float_t Mean(Types::ESBType sb, UInt_t var ) { return fMeans[sb==Types::kSignal?0:1][var]; }
0120
0121
0122 Float_t RMS(Types::ESBType sb, UInt_t var ) { return fRMS[sb==Types::kSignal?0:1][var]; }
0123
0124
0125 Float_t Min(Types::ESBType sb, UInt_t var ) { return fMin[sb==Types::kSignal?0:1][var]; }
0126
0127
0128 Float_t Max(Types::ESBType sb, UInt_t var ) { return fMax[sb==Types::kSignal?0:1][var]; }
0129
0130 Int_t SearchVolumeWithMaxLimit( TMVA::Volume*, std::vector<const TMVA::BinarySearchTreeNode*>* events = nullptr, Int_t = -1);
0131
0132
0133 Float_t RMS(UInt_t var ) { return fRMS[0][var]; }
0134
0135 void SetNormalize( Bool_t norm ) { fCanNormalize = norm; }
0136
0137 private:
0138
0139
0140 void Insert( const Event*, Node* );
0141
0142 BinarySearchTreeNode* Search( Event*, Node *) const ;
0143
0144
0145 Bool_t InVolume (const std::vector<Float_t>&, Volume* ) const;
0146
0147 void DestroyNode ( BinarySearchTreeNode* );
0148
0149
0150 void NormalizeTree( std::vector< std::pair< Double_t, const TMVA::Event* > >::iterator,
0151 std::vector< std::pair< Double_t, const TMVA::Event* > >::iterator, UInt_t );
0152
0153
0154 Double_t SearchVolume( Node*, Volume*, Int_t,
0155 std::vector<const TMVA::BinarySearchTreeNode*>* events );
0156 UInt_t fPeriod;
0157 UInt_t fCurrentDepth;
0158 Bool_t fStatisticsIsValid;
0159
0160 std::vector<Float_t> fMeans[2];
0161 std::vector<Float_t> fRMS[2];
0162 std::vector<Float_t> fMin[2];
0163 std::vector<Float_t> fMax[2];
0164 std::vector<Double_t> fSum[2];
0165 std::vector<Double_t> fSumSq[2];
0166 Double_t fNEventsW[2];
0167 Double_t fSumOfWeights;
0168
0169
0170 Bool_t fCanNormalize;
0171 std::vector< std::pair<Double_t,const TMVA::Event*> > fNormalizeTreeTable;
0172
0173 ClassDefOverride(BinarySearchTree,0);
0174 };
0175
0176 }
0177
0178 #endif