//-*- Mode: C++ -*- // $Id: AliHLTTPCCAGBHit.h,v 1.2 2010/09/01 10:38:27 ikulakov Exp $ // ************************************************************************ // This file is property of and copyright by the ALICE HLT Project * // ALICE Experiment at CERN, All rights reserved. * // See cxx source for full Copyright notice * // * //************************************************************************* #ifndef ALIHLTTPCCAGBHIT_H #define ALIHLTTPCCAGBHIT_H #include "AliHLTTPCCADef.h" #include "AliHLTTPCCAMath.h" #include "ITSCAStrip.h" #include using std::ostream; using std::istream; /** * @class AliHLTTPCCAGBHit * * The AliHLTTPCCAGBHit class is the internal representation * of the TPC clusters for the AliHLTTPCCAGBTracker algorithm. * */ class AliHLTTPCCAGBHit { public: AliHLTTPCCAGBHit() : fX( 0 ), fY( 0 ), fZ( 0 ), fErr2X0( 0 ), fErr2X1( 0 ), fErrX12( 0 ), fErr2X2( 0 ), fIRow( 0 ), fID( 0 ), fPhi( 0 ) #if defined(DRIFT_TUBES) , fR( 0 ), fErr2R( 0 ), fIsLeft( false ), fIsPileuped( false ), fXW(0), fYW(0), fZW(0), fTubeR( 0 ), fHalfLength( 0 ), fEX( 0 ), fEY( 0 ), fEZ( 0 ) #endif {} float X() const { return fX; } float Y() const { return fY; } float Z() const { return fZ; } float Err2X() const { return fErr2X0; } float Err2Y() const { return fErr2X1; } float Err2Z() const { return fErr2X2; } void GetLocalX0X1X2( float& x0, float& x1, float &x2 ) const; float Err2X0() const { return fErr2X0; } float Err2X1() const { return fErr2X1; } float ErrX12() const { return fErrX12; } float Err2X2() const { return fErr2X2; } int IRow() const { return fIRow; } int ID() const { return fID; } #if defined(DRIFT_TUBES) float R() const { return fR; } float Err2R() const { return fErr2R; } float Err2A() const { return (fHalfLength/1.5)*(fHalfLength/1.5); } float Beta() const { return -0.5*atan(2*ErrX12()/(Err2X2() - Err2X1())); } float DistanceFromWireToPoint( float x, float y, float z ) const { // distance from line to point is |dr x e| / |e| const float dx = x - fXW; const float dy = y - fYW; const float dz = z - fZW; const float productX = dy*fEZ - dz*fEY; const float productY = dz*fEX - dx*fEZ; const float productZ = dx*fEY - dy*fEX; return sqrt( productX*productX + productY*productY + productZ*productZ ) / sqrt( fEX*fEX + fEY*fEY + fEZ*fEZ ); } bool IsLeft() const { return fIsLeft; } bool IsPileduped() const { return fIsPileuped; } float XW() const { return fXW; } float YW() const { return fYW; } float ZW() const { return fZW; } float C(int i1, int i2) const { return fC[i1][i2]; } #endif ITSCAStrip* BStripP() const { return fBStripP; } ITSCAStrip* FStripP() const { return fFStripP; } void SetX( float v ) { fX = v; } void SetY( float v ) { fY = v; } void SetZ( float v ) { fZ = v; } void SetErr2X( float v ) { fErr2X0 = v; } void SetErr2Y( float v ) { fErr2X1 = v; } void SetErr2Z( float v ) { fErr2X2 = v; } void SetErrYZ( float v ) { fErrX12 = v; } void SetIRow( int v ) { fIRow = v; } void SetID( int v ) { fID = v; } void SetErr2X0( float v ) { fErr2X0 = v; } void SetErr2X1( float v ) { fErr2X1 = v; } void SetErrX12( float v ) { fErrX12 = v; } void SetErr2X2( float v ) { fErr2X2 = v; } void SetFStripP( ITSCAStrip* s ) { fFStripP = s; } void SetBStripP( ITSCAStrip* s ) { fBStripP = s; } void SetAngle( float v ) { fPhi = v; } float Angle() const { return fPhi; } #if defined(DRIFT_TUBES) void SetR(float v) { fR = v; } void SetErr2R(float v) { fErr2R = v; } void SetIsLeft(bool v) { fIsLeft = v; } void SetIsPileuped(bool b) { fIsPileuped = b; } void SetXW( float v ) { fXW = v; } void SetYW( float v ) { fYW = v; } void SetZW( float v ) { fZW = v; } void SetC( float v, int i1, int i2 ) { fC[i1][i2] = v; } #endif static bool Compare( const AliHLTTPCCAGBHit &a, const AliHLTTPCCAGBHit &b ); /// \brief Hits reordering in accordance with the geometry and the track-finder needs: /// Hits are sorted by sector number at first, than by row number and at last by z-coordinate static bool CompareRowDown( const AliHLTTPCCAGBHit &a, const AliHLTTPCCAGBHit &b ) { return ( a.fIRow > b.fIRow ); /// Hits are sorted by row number } static bool ComparePRowDown( const AliHLTTPCCAGBHit *a, const AliHLTTPCCAGBHit *b ) { return ( a->fIRow > b->fIRow ); /// Hits are sorted by row number } friend ostream& operator<<(ostream& out, const AliHLTTPCCAGBHit &a); friend istream& operator>>(istream& in, AliHLTTPCCAGBHit &a); protected: ITSCAStrip* fFStripP, *fBStripP; double fX; //* X position double fY; //* Y position double fZ; //* Z position float fErr2X0; //* position error^2 in local c.s. (x0 is perpendicular to station) float fErr2X1; float fErrX12; // covariance float fErr2X2; double fC[3][3]; // cov matrix in global c.s. int fIRow; //* row number int fID; //* external ID (id of AliTPCcluster) double fPhi; #if defined(DRIFT_TUBES) double fR, fErr2R; bool fIsLeft; bool fIsPileuped; double fXW; //* X wire position double fYW; //* Y wire position double fZW; //* Z wire position double fTubeR, fHalfLength; double fEX, fEY, fEZ; // wire direction #endif }; inline bool AliHLTTPCCAGBHit::Compare( const AliHLTTPCCAGBHit &a, const AliHLTTPCCAGBHit &b ) /// \brief Hits reordering in accordance with the geometry and the track-finder needs: /// Hits are sorted by sector number at first, than by row number and at last by z-coordinate. { //* Comparison function for sorting hits if ( a.fIRow < b.fIRow ) return 1; if ( a.fIRow > b.fIRow ) return 0; return ( a.fZ < b.fZ ); } #endif