#ifndef ROOT_TreeSearch_PatternTree
#define ROOT_TreeSearch_PatternTree
#include "Pattern.h"
#include "TreeWalk.h"
#include <vector>
#include <map>
#include <iostream>
#include <cassert>
using std::vector;
namespace TreeSearch {
class TreeParam_t {
public:
TreeParam_t( UInt_t maxdepth, Double_t width, Double_t maxslope,
const vector<Double_t>& zpos )
: fMaxdepth(maxdepth), fNormalized(false), fWidth(width),
fMaxslope(maxslope), fZpos(zpos) {}
Int_t Normalize();
UInt_t maxdepth() const { return fMaxdepth; }
Double_t width() const { return fWidth; }
Double_t maxslope() const { return fMaxslope; }
const vector<Double_t>& zpos() const { return fZpos; }
private:
UInt_t fMaxdepth;
Bool_t fNormalized;
Double_t fWidth;
Double_t fMaxslope;
vector<Double_t> fZpos;
};
class PatternTree {
public:
PatternTree( const TreeParam_t& param,
UInt_t nPatterns = 0, UInt_t nLinks = 0 );
virtual ~PatternTree();
static PatternTree* Read( const char* filename, const TreeParam_t& param );
void Print( Option_t* opt="", std::ostream& os = std::cout );
Int_t Write( const char* filename );
Bool_t IsOK() const { return fParamOK; }
UInt_t GetNlevels() const { return fParameters.maxdepth()+1; }
UInt_t GetNplanes() const { return fParameters.zpos().size(); }
const TreeParam_t& GetParameters() const { return fParameters; }
Link* GetRoot() { return fLinks.empty() ? 0 : &fLinks.front(); }
Double_t GetWidth() const { return fParameters.width(); }
class CopyPattern : public NodeVisitor {
public:
CopyPattern( PatternTree* tree ) : fTree(tree) { assert(fTree); }
virtual ETreeOp operator() ( const NodeDescriptor& nd );
private:
PatternTree* fTree;
std::map<Pattern*,Int_t> fMap;
void AddChild( Pattern* parent, Pattern* child, Int_t type );
};
friend class CopyPattern;
private:
typedef vector<Pattern>::size_type vpsz_t;
typedef vector<Link>::size_type vlsz_t;
typedef vector<UShort_t>::size_type vsiz_t;
TreeParam_t fParameters;
Bool_t fParamOK;
vector<Pattern> fPatterns;
vector<Link> fLinks;
vector<UShort_t> fBits;
vpsz_t fNpat;
vlsz_t fNlnk;
vsiz_t fNbit;
PatternTree( const PatternTree& orig );
const PatternTree& operator=( const PatternTree& rhs );
ClassDef(PatternTree,0)
};
}
#endif
Last update: Tue Jul 7 19:26:19 2009
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.