#ifndef ROOT_TreeSearch_WirePlane
#define ROOT_TreeSearch_WirePlane
#include "Types.h"
#include "THaSubDetector.h"
#include "TClonesArray.h"
#include "TVector2.h"
#include "TMath.h"
#include <vector>
#include <string>
#include <cassert>
#include <functional>
using std::vector;
using std::string;
class TVector2;
namespace TreeSearch {
class TimeToDistConv;
class Projection;
class MWDC;
class Hit;
class FitCoord;
extern const Double_t kBig;
class WirePlane : public THaSubDetector {
public:
WirePlane( const char* name, const char* description = "",
THaDetectorBase* parent = 0 );
WirePlane() : fSpecial(0),fPartner(0), fProjection(0), fMWDC(0), fTTDConv(0),
fHits(0), fFitCoords(0){}
virtual ~WirePlane();
virtual void Clear( Option_t* opt="" );
virtual Int_t Decode( const THaEvData& );
virtual EStatus Init( const TDatime& date );
virtual void Print( Option_t* opt="" ) const;
FitCoord* AddFitCoord( const FitCoord& coord );
Bool_t Contains( Double_t x, Double_t y ) const;
Bool_t Contains( const TVector2& point ) const;
void EnableCalibration( Bool_t enable = true );
EProjType GetType() const { return fType; }
Double_t GetZ() const { return fOrigin.Z(); }
Projection* GetProjection() const { return fProjection; }
WirePlane* GetPartner() const { return fPartner; }
void SetPartner( WirePlane* p );
MWDC* GetMWDC() const { return fMWDC; }
Double_t GetResolution() const { return fResolution; }
Double_t GetMaxSlope() const;
Double_t GetWireStart() const { return fWireStart+fCoordOffset; }
Double_t GetWireSpacing() const { return fWireSpacing; }
virtual Double_t GetMaxLRdist() const { return GetWireSpacing(); }
TimeToDistConv* GetTTDConv() const { return fTTDConv; }
TSeqCollection* GetHits() const { return fHits; }
Int_t GetNhits() const { return fHits->GetLast()+1; }
TSeqCollection* GetCoords() const { return fFitCoords; }
Int_t GetNcoords() const { return fFitCoords->GetLast()+1; }
UInt_t GetPlaneNum() const { return fPlaneNum; }
void SetSpecial(UInt_t temp);
UInt_t IsSpecial() const { return fSpecial; }
Bool_t IsCalibrating() const { return TestBit(kCalibrating); }
Bool_t IsRequired() const;
void SetPlaneNum( UInt_t n ) { fPlaneNum = n; }
void SetProjection( Projection* p );
void SetRequired( Bool_t enable = true );
#ifdef TESTCODE
void CheckCrosstalk();
#endif
struct ZIsLess
: public std::binary_function< WirePlane*, WirePlane*, bool >
{
bool operator() ( const WirePlane* a, const WirePlane* b ) const
{ assert(a&&b); return ( a->GetZ() < b->GetZ() ); }
};
class NameEquals : public std::unary_function< WirePlane*, bool > {
public:
NameEquals( const char* s ) : name(s?s:"") {}
bool operator() ( const WirePlane* wp ) const
{ assert(wp); return ( name == wp->GetName() ); }
private:
string name;
};
protected:
UInt_t fSpecial;
UInt_t fPlaneNum;
EProjType fType;
Double_t fWireStart;
Double_t fWireSpacing;
Double_t fCoordOffset;
WirePlane* fPartner;
Projection* fProjection;
MWDC* fMWDC;
Double_t fResolution;
Double_t fMinTime;
Double_t fMaxTime;
Double_t ftimeoffset;
UInt_t fMaxHits;
TimeToDistConv* fTTDConv;
vector<float> fTDCOffset;
vector<float> fWireOffset;
TClonesArray* fHits;
TClonesArray* fFitCoords;
#ifdef TESTCODE
UInt_t fNmiss;
UInt_t fNrej;
Int_t fWasSorted;
UInt_t fNhitwires;
UInt_t fNmultihit;
UInt_t fNmaxmul;
UInt_t fNcl;
UInt_t fNdbl;
UInt_t fClsiz;
#endif
virtual Int_t ReadDatabase( const TDatime& date );
virtual Int_t DefineVariables( EMode mode = kDefine );
enum {
kIsRequired = BIT(14),
kCalibrating = BIT(15)
};
ClassDef(WirePlane,0)
};
inline
Bool_t WirePlane::Contains( Double_t x, Double_t y ) const
{
return ( TMath::Abs( x-fOrigin.X() ) < fSize[0] and
TMath::Abs( y-fOrigin.Y() ) < fSize[1] );
}
inline
Bool_t WirePlane::Contains( const TVector2& point ) const
{
return Contains( point.X(), point.Y() );
}
inline
void WirePlane::EnableCalibration( Bool_t enable )
{
SetBit( kCalibrating, enable );
}
inline
Bool_t WirePlane::IsRequired() const
{
return ( not IsCalibrating() and TestBit(kIsRequired) );
}
inline
void WirePlane::SetRequired( Bool_t enable )
{
SetBit( kIsRequired, enable );
}
inline
void WirePlane::SetSpecial( UInt_t temp )
{
fSpecial = temp;
}
}
#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.