//-*- Mode: C++ -*- // ***************************************************************************** // * // @Autors: I.Kulakov; M.Zyzak; I.Kisel * // @e-mail: I.Kulakov@gsi.de; M.Zyzak@gsi.de; I.Kisel@compeng.uni-frankfurt.de * // * // ***************************************************************************** #ifndef ITSCAHITS_H #define ITSCAHITS_H #include using std::vector; #include "AliHLTTPCCADef.h" #include "AliHLTTPCCAMath.h" #include "AliHLTTPCCAGBHit.h" #include "ITSCATES.h" #include "ITSCAStrip.h" #include "AliHLTTPCCATrackParamVector.h" #include "AliHLTTPCCAParameters.h" class ITSCAHit { public: ITSCAHit(){} ITSCAHit( const AliHLTTPCCAGBHit& h, int id ):fIStation(h.IRow()), fId(id), fErr2X1(h.Err2X1()), fErrX12(h.ErrX12()), fErr2X2(h.Err2X2()), #ifdef DRIFT_TUBES fR(h.R()), fErr2R(h.Err2R()), fErr2A(h.Err2A()), fBeta(h.Beta()), fIsLeft(h.IsLeft()), #endif fAngle(h.Angle()), fFStripP(h.FStripP()), fBStripP(h.BStripP()) { h.GetLocalX0X1X2( fX0, fX1, fX2 ); }; char IStation() const { return fIStation; } void SetId( int id ) { fId = id; } int Id() const { return fId; }; #ifdef DRIFT_TUBES sfloat_v X1Corrected( const AliHLTTPCCATrackParamVector& p ) const; #endif float X0() const { return fX0; } float X1() const { return fX1; } float X2() const { return fX2; } float FStrip() const { return *fFStripP; }; float BStrip() const { return *fBStripP; }; ITSCAStrip* FStripP() const { return fFStripP; }; ITSCAStrip* BStripP() const { return fBStripP; }; float Err2X1() const { return fErr2X1; } float ErrX12() const { return fErrX12; } float Err2X2() const { return fErr2X2; } #ifdef DRIFT_TUBES float XWire0() const { return fX0; } float XWire1() const { return fX1 - RSigned(); } float XWire2() const { return fX2; } float R() const { return fR; } float RSigned() const { return fIsLeft ? -fR : fR; } float Err2R() const { return fErr2R; } float Err2A() const { return fErr2A; } float Beta() const { return fBeta; } bool IsLeft() const { return fIsLeft; } #endif float Angle() const { return fAngle; } bool IsUsed() const { return fFStripP->IsUsed() || fBStripP->IsUsed(); } void SetAsUsed() { fFStripP->SetAsUsed(); fBStripP->SetAsUsed(); } // comparison of hits on one station, needed for std::sort, returns true if a must be before b. friend bool operator<(const ITSCAHit& a, const ITSCAHit& b) { #ifdef DRIFT_TUBES if ( a.fIStation >= AliHLTTPCCAParameters::NMVDStations ) return (a.Angle() < b.Angle()) || ((a.Angle() == b.Angle()) && (a.X1() < b.X1())); else return a.X2()/abs(a.X0()) < b.X2()/abs(b.X0()); // check why x0 < 0 is possible #else return a.X2()/abs(a.X0()) < b.X2()/abs(b.X0()); // check why x0 < 0 is possible #endif } private: char fIStation; //index of the station int fId; // index of hits in an input array float fX1, fX2, fX0; // local coordinates. fX2 is vertical, along radial direction float fErr2X1, fErrX12, fErr2X2; // errors squared #ifdef DRIFT_TUBES float fR; float fErr2R; float fErr2A; // error along the tube float fBeta; bool fIsLeft; // left side or right side #endif float fAngle; // direction of hit station. Angle between normal and vertical axis. This angle defines local CS of the hit ITSCAStrip* fFStripP, * fBStripP; }; #ifdef DRIFT_TUBES inline sfloat_v ITSCAHit::X1Corrected( const AliHLTTPCCATrackParamVector& p ) const { const sfloat_v xCorr = fR - fR*rsqrt( 1 - p.SinPhi()*p.SinPhi() ); // xCorr /= cos(3.f/180.f*3.141592); // currently neglect stereo angle return (fIsLeft) ? fX1 + xCorr : fX1 - xCorr; } #endif template class ITSCAElementsOnStation; template<> class ITSCAElementsOnStation: public vector { public: char& IStation() { return fISta; } const char& IStation() const { return fISta; } private: char fISta; }; class ITSCAHits { // same as in ITSCAStationArray public: typedef ITSCAHit T; ITSCAElementsOnStation& OnStation(char i) { assert((unsigned char)i& OnStation(char i) const { assert((unsigned char)i& operator[](char i) { assert((unsigned char)i < fElement.size() ); return fElement[i]; } const ITSCAElementsOnStation& operator[](char i) const { assert((unsigned char)i& hits = fElement[i]; std::sort( hits.begin(), hits.end() ); } } void Clean() { // remove used hits for( unsigned int i = 0; i < fElement.size(); ++i ) { ITSCAElementsOnStation& hits = fElement[i]; ITSCAElementsOnStation tmp; tmp.IStation() = i; // tmp.reserve( hits.size() ); for( unsigned int iH = 0; iH < hits.size(); ++iH ) { if ( hits[iH].IsUsed() ) continue; tmp.push_back( hits[iH] ); } hits.clear(); hits = tmp; tmp.clear(); } } protected: vector< ITSCAElementsOnStation > fElement; // hits on stations }; #endif