#ifndef ROOT_TreeSearch_Projection
#define ROOT_TreeSearch_Projection
#include "THaAnalysisObject.h"
#include "TreeWalk.h"
#include "Types.h"
#include "TMath.h"
#include "TClonesArray.h"
#include "TVector2.h"
#include <vector>
#include <set>
#include <cassert>
#include <functional>
#include <list>
class THaDetectorBase;
class TBits;
namespace TreeSearch {
class Hitpattern;
class PatternTree;
class WirePlane;
class Road;
class Projection : public THaAnalysisObject {
public:
Projection( EProjType type, const char* name, Double_t angle,
THaDetectorBase* parent );
Projection() : fDetector(0), fPatternTree(0), fPlaneCombos(0),
fHitpattern(0), fRoads(0) ,frawRoads(0), fRoadCorners(0) {}
virtual ~Projection();
void AddPlane( WirePlane* wp, WirePlane* partner = 0 );
virtual void Clear( Option_t* opt="" );
virtual Int_t Decode( const THaEvData& );
virtual EStatus Init( const TDatime& date );
EStatus InitLevel2( const TDatime& date );
virtual void Print( Option_t* opt="" ) const;
void Reset();
Int_t FillHitpattern();
Int_t Track();
Int_t MakeRoads();
Double_t GetAngle() const;
const TVector2& GetAxis() const { return fAxis; }
UInt_t GetBinMaxDistB() const { return fBackMaxBinDist; }
UInt_t GetBinMaxDistF() const { return fFrontMaxBinDist; }
UInt_t GetMaxMiss() const {return fMaxMiss;}
const pdbl_t& GetChisqLimits( UInt_t i ) const;
Double_t GetConfLevel() const { return fConfLevel; }
Double_t GetCosAngle() const { return fAxis.X(); }
UInt_t GetHitMaxDist() const { return fHitMaxDist; }
Hitpattern* GetHitpattern() const { return fHitpattern; }
Double_t GetMaxSlope() const { return fMaxSlope; }
UInt_t GetMinFitPlanes() const { return fMinFitPlanes; }
UInt_t GetNgoodRoads() const { return fNgoodRoads; }
UInt_t GetNlevels() const { return fNlevels; }
UInt_t GetNpatterns() const;
UInt_t GetNplanes() const { return (UInt_t)fPlanes.size(); }
UInt_t GetNroads() const;
UInt_t GetrawNroads() const;
TBits* GetPlaneCombos() const { return fPlaneCombos; }
WirePlane* GetPlane ( UInt_t plane ) const { return fPlanes[plane]; }
Double_t GetPlaneZ( UInt_t plane ) const;
Road* GetRoad ( UInt_t i ) const;
Double_t GetSinAngle() const { return fAxis.Y(); }
EProjType GetType() const { return fType; }
Double_t GetWidth() const { return fWidth; }
Double_t GetZsize() const;
void SetMaxSlope( Double_t m ) { fMaxSlope = m; }
void SetPatternTree( PatternTree* pt ) { fPatternTree = pt; }
void SetWidth( Double_t width ) { fWidth = width; }
#ifdef TESTCODE
std::vector<TreeSearch::WirePlane*>& GetListOfPlanes() { return fPlanes; }
#endif
enum {
kEventDisplay = BIT(14)
};
protected:
typedef std::vector<Node_t*> NodeVec_t;
EProjType fType;
std::vector<WirePlane*> fPlanes;
UInt_t fNlevels;
Double_t fMaxSlope;
Double_t fWidth;
TVector2 fAxis;
THaDetectorBase* fDetector;
PatternTree* fPatternTree;
UInt_t fMinFitPlanes;
UInt_t fMaxMiss;
Bool_t fRequire1of2;
TBits* fPlaneCombos;
UInt_t fMaxPat;
UInt_t fFrontMaxBinDist;
UInt_t fBackMaxBinDist;
UInt_t fHitMaxDist;
Double_t fConfLevel;
vec_pdbl_t fChisqLimits;
Hitpattern* fHitpattern;
NodeVec_t fPatternsFound;
TClonesArray* fRoads;
TClonesArray* frawRoads;
UInt_t fNgoodRoads;
TClonesArray* fRoadCorners;
#ifdef TESTCODE
UInt_t n_hits, n_bins, n_binhits, maxhits_bin;
UInt_t n_test, n_pat, n_roads, n_dupl, n_badfits;
Double_t t_treesearch, t_roads, t_fit, t_track;
#endif
Bool_t FitRoads();
Bool_t RemoveDuplicateRoads();
void SetAngle( Double_t a );
static void PrintNode(const Node_t& node);
static void PrintNodeP(const Node_t* node);
virtual Int_t ReadDatabase( const TDatime& date );
virtual Int_t DefineVariables( EMode mode = kDefine );
virtual const char* GetDBFileName() const;
virtual void MakePrefix();
class ComparePattern : public NodeVisitor {
public:
ComparePattern( const Hitpattern* hitpat, const TBits* combos,
NodeVec_t* matches )
: fHitpattern(hitpat), fPlaneCombos(combos), fMatches(matches)
#ifdef TESTCODE
, fNtest(0)
#endif
{ assert(fHitpattern && fPlaneCombos && fMatches); }
virtual ETreeOp operator() ( const NodeDescriptor& nd );
#ifdef TESTCODE
UInt_t GetNtest() const { return fNtest; }
#endif
private:
const Hitpattern* fHitpattern;
const TBits* fPlaneCombos;
NodeVec_t* fMatches;
#ifdef TESTCODE
UInt_t fNtest;
#endif
};
private:
Projection( const Projection& orig );
const Projection& operator=( const Projection& rhs );
ClassDef(Projection,0)
};
inline
Double_t Projection::GetAngle() const
{
return TMath::ATan2( fAxis.Y(), fAxis.X() );
}
inline const pdbl_t& Projection::GetChisqLimits( UInt_t i ) const
{
assert( i < fChisqLimits.size() );
return fChisqLimits[i];
}
inline
UInt_t Projection::GetNpatterns() const
{
return static_cast<UInt_t>( fPatternsFound.size() );
}
inline
UInt_t Projection::GetrawNroads() const
{
assert( frawRoads && frawRoads->GetLast()+1 >= 0 );
return static_cast<UInt_t>( frawRoads->GetLast()+1 );
}
inline
UInt_t Projection::GetNroads() const
{
assert( fRoads && fRoads->GetLast()+1 >= 0 );
return static_cast<UInt_t>( fRoads->GetLast()+1 );
}
inline
Road* Projection::GetRoad( UInt_t i ) const
{
assert( fRoads && i < GetNroads() );
return (Road*)fRoads->UncheckedAt(i);
}
}
#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.