]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/TPCLib/AliHLTTPCTrackGeometry.h
Bugfix for https://savannah.cern.ch/bugs/?97755
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCTrackGeometry.h
1 //-*- Mode: C++ -*-
2 // $Id$
3 #ifndef ALIHLTTPCTRACKGEOMETRY_H
4 #define ALIHLTTPCTRACKGEOMETRY_H
5 //* This file is property of and copyright by the ALICE HLT Project        * 
6 //* ALICE Experiment at CERN, All rights reserved.                         *
7 //* See cxx source for full Copyright notice                               *
8
9 /// @file   AliHLTTPCTrackGeometry.h
10 /// @author Matthias Richter
11 /// @date   2011-05-20
12 /// @brief  Desciption of a track by a sequence of track points
13 ///
14
15 #include "AliHLTTrackGeometry.h"
16 #include <vector>
17
18 class AliHLTGlobalBarrelTrack;
19 class AliHLTDataDeflater;
20
21 /**
22  * @class AliHLTTPCTrackGeometry
23  * Description of tracks in the TPC geometry.
24  * This implementation describes track points of the track crossing with
25  * the pad-row plane (yz). The radial distance of the plane is the x coordinate.
26  * 
27  * The 32bit ids of the planes follow the same coding as the TPC clusters.
28  * - bit 25-31:  7 bit slice number
29  * - bit 22-24:  3 bit partition number
30  * - bit  0-21: 22 bit row number
31  * @ingroup alihlt-tpc
32  */
33 class AliHLTTPCTrackGeometry : public AliHLTTrackGeometry
34 {
35  public:
36   /// standard constructor
37   AliHLTTPCTrackGeometry();
38   /// copy constructor
39   AliHLTTPCTrackGeometry(const AliHLTTPCTrackGeometry&);
40   /// assignment operator
41   AliHLTTPCTrackGeometry& operator=(const AliHLTTPCTrackGeometry&);
42
43   /// destructor
44   ~AliHLTTPCTrackGeometry();
45
46   /// alpha of the plane
47   virtual float GetPlaneAlpha(AliHLTUInt32_t planeId) const;
48   /// radial distance from global {0,0,0}
49   virtual float GetPlaneR(AliHLTUInt32_t planeId) const;
50   /// theta of the plane
51   virtual float GetPlaneTheta(AliHLTUInt32_t planeId) const ;
52   /// check bounds in u and v coordinate
53   virtual bool CheckBounds(AliHLTUInt32_t planeId, float u, float v) const;
54
55   // track interface
56
57   /// calculate the track points, expects the global magnetic field to be initialized
58   virtual int CalculateTrackPoints(const AliHLTExternalTrackParam& track);
59
60   /// calculate the track points, expects the global magnetic field to be initialized
61   virtual int CalculateTrackPoints(AliHLTGlobalBarrelTrack& track);
62
63   /// find the track point which can be associated to a spacepoint with coordinates and id
64   virtual int FindMatchingTrackPoint(AliHLTUInt32_t spacepointId, float spacepoint[3], AliHLTUInt32_t& planeId);
65
66   /// register track points in the index grid
67   virtual int RegisterTrackPoints(AliHLTTrackGrid* pGrid) const;
68
69   /// fill track points to index grid
70   virtual int FillTrackPoints(AliHLTTrackGrid* pGrid) const;
71
72   virtual int Write(const AliHLTGlobalBarrelTrack& track,
73             AliHLTSpacePointContainer* pSpacePoints,
74             AliHLTDataDeflater* pDeflater,
75             AliHLTUInt8_t* outputPtr,
76             AliHLTUInt32_t size,
77             vector<AliHLTUInt32_t>* writtenClusterIds=NULL,
78             const char* option="") const;
79
80   virtual int WriteAssociatedClusters(AliHLTSpacePointContainer* pSpacePoints,
81                                       AliHLTDataDeflater* pDeflater,
82                                       vector<AliHLTUInt32_t>* writtenClusterIds=NULL,
83                                       const char* option="") const;
84
85   int Read(const AliHLTUInt8_t* buffer, AliHLTUInt32_t size, float bz,
86            AliHLTUInt32_t& clusterBlockSize, const char* option=NULL);
87
88   int InitDriftTimeTransformation(float mA, float nA, float mC, float nC) {
89     fDriftTimeFactorA=mA; fDriftTimeOffsetA=nA; fDriftTimeFactorC=mC; fDriftTimeOffsetC=nC; return 0;
90   }
91
92   struct AliHLTTPCTrackBlock {
93     AliHLTUInt16_t   fSize; //! size in byte of the complete track block
94     AliHLTUInt8_t    fSlice; //! slice number -> rotation angle of local coordinates
95     AliHLTUInt8_t    fReserved; //! reserved field to fill 32bit
96     AliHLTFloat32_t  fX; //! first X
97     AliHLTFloat32_t  fY; //! first Y
98     AliHLTFloat32_t  fZ; //! first Z
99     AliHLTFloat32_t  fSinPsi; // local sine of the track momentum azimuthal angle
100     AliHLTFloat32_t  fTgl;    // tangent of the track momentum dip angle
101     AliHLTFloat32_t  fq1Pt;   // 1/pt (1/(GeV/c))
102   };
103
104   /// create a collection of all points
105   virtual AliHLTSpacePointContainer* ConvertToSpacePoints() const {return ConvertToSpacePoints(false);}
106   virtual AliHLTSpacePointContainer* ConvertToSpacePoints(bool bAssociated) const;
107
108   /// get raw track point of id
109   const AliHLTTrackPoint* GetRawTrackPoint(AliHLTUInt32_t id) const;
110   /// get raw track point of id
111   AliHLTTrackPoint* GetRawTrackPoint(AliHLTUInt32_t id);
112
113   int FillRawResidual(int coordinate, TH2* histo, AliHLTSpacePointContainer* points) const;
114
115   const vector<AliHLTTrackGeometry::AliHLTTrackPoint>& GetRawPoints() const {return fRawTrackPoints;}
116
117  private:
118   /// calculate the track points, expects the global magnetic field to be initialized
119   int CalculateTrackPoints(AliHLTGlobalBarrelTrack& track, int firstpadrow, int step);
120
121   vector<AliHLTTrackPoint> fRawTrackPoints; // list of points in raw coordinates
122
123   float fDriftTimeFactorA; //! drift time A side
124   float fDriftTimeOffsetA; //! drift time A side
125   float fDriftTimeFactorC; //! drift time C side
126   float fDriftTimeOffsetC; //! drift time C side
127
128   ClassDef(AliHLTTPCTrackGeometry, 0)
129 };
130 #endif