30 #ifndef ROOT_TMVA_BinarySearchTree
31 #define ROOT_TMVA_BinarySearchTree
63 class BinarySearchTree :
public BinaryTree {
68 BinarySearchTree(
void );
71 BinarySearchTree (
const BinarySearchTree &b);
74 virtual ~BinarySearchTree(
void );
76 virtual Node * CreateNode( UInt_t )
const {
return new BinarySearchTreeNode(); }
77 virtual BinaryTree* CreateTree()
const {
return new BinarySearchTree(); }
78 static BinarySearchTree* CreateFromXML(
void* node, UInt_t tmva_Version_Code = TMVA_VERSION_CODE);
79 virtual const char* ClassName()
const {
return "BinarySearchTree"; }
83 BinarySearchTreeNode* Search( Event * event )
const;
86 void Insert(
const Event * );
89 Double_t GetSumOfWeights(
void )
const;
92 Double_t GetSumOfWeights( Int_t theType )
const;
95 void SetPeriode( Int_t p ) { fPeriod = p; }
98 UInt_t GetPeriode(
void )
const {
return fPeriod; }
101 Double_t SearchVolume( Volume*, std::vector<const TMVA::BinarySearchTreeNode*>* events = 0 );
105 Double_t Fill(
const std::vector<TMVA::Event*>& events,
const std::vector<Int_t>& theVars, Int_t theType = -1 );
109 Double_t Fill(
const std::vector<TMVA::Event*>& events, Int_t theType = -1 );
111 void NormalizeTree ();
113 void CalcStatistics( TMVA::Node* n = 0 );
114 void Clear ( TMVA::Node* n = 0 );
117 Float_t Mean(Types::ESBType sb, UInt_t var ) {
return fMeans[sb==Types::kSignal?0:1][var]; }
120 Float_t RMS(Types::ESBType sb, UInt_t var ) {
return fRMS[sb==Types::kSignal?0:1][var]; }
123 Float_t Min(Types::ESBType sb, UInt_t var ) {
return fMin[sb==Types::kSignal?0:1][var]; }
126 Float_t Max(Types::ESBType sb, UInt_t var ) {
return fMax[sb==Types::kSignal?0:1][var]; }
128 Int_t SearchVolumeWithMaxLimit( TMVA::Volume*, std::vector<const TMVA::BinarySearchTreeNode*>* events = 0, Int_t = -1);
131 Float_t RMS(UInt_t var ) {
return fRMS[0][var]; }
133 void SetNormalize( Bool_t norm ) { fCanNormalize = norm; }
138 void Insert(
const Event*, Node* );
140 BinarySearchTreeNode* Search( Event*, Node *)
const ;
143 Bool_t InVolume (
const std::vector<Float_t>&, Volume* )
const;
145 void DestroyNode ( BinarySearchTreeNode* );
148 void NormalizeTree( std::vector< std::pair< Double_t, const TMVA::Event* > >::iterator,
149 std::vector< std::pair< Double_t, const TMVA::Event* > >::iterator, UInt_t );
152 Double_t SearchVolume( Node*, Volume*, Int_t,
153 std::vector<const TMVA::BinarySearchTreeNode*>* events );
155 UInt_t fCurrentDepth;
156 Bool_t fStatisticsIsValid;
158 std::vector<Float_t> fMeans[2];
159 std::vector<Float_t> fRMS[2];
160 std::vector<Float_t> fMin[2];
161 std::vector<Float_t> fMax[2];
162 std::vector<Double_t> fSum[2];
163 std::vector<Double_t> fSumSq[2];
164 Double_t fNEventsW[2];
165 Double_t fSumOfWeights;
168 Bool_t fCanNormalize;
169 std::vector< std::pair<Double_t,const TMVA::Event*> > fNormalizeTreeTable;
171 ClassDef(BinarySearchTree,0);