]>
Commit | Line | Data |
---|---|---|
a1408c4b | 1 | // $Id$ |
2 | ||
3 | //************************************************************************** | |
4 | //* This file is property of and copyright by the ALICE HLT Project * | |
5 | //* ALICE Experiment at CERN, All rights reserved. * | |
6 | //* * | |
7 | //* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> * | |
8 | //* for The ALICE HLT Project. * | |
9 | //* * | |
10 | //* Permission to use, copy, modify and distribute this software and its * | |
11 | //* documentation strictly for non-commercial purposes is hereby granted * | |
12 | //* without fee, provided that the above copyright notice appears in all * | |
13 | //* copies and that both the copyright notice and this permission notice * | |
14 | //* appear in the supporting documentation. The authors make no claims * | |
15 | //* about the suitability of this software for any purpose. It is * | |
16 | //* provided "as is" without express or implied warranty. * | |
17 | //************************************************************************** | |
18 | ||
19 | /** @file AliHLTGlobalBarrelTrack.cxx | |
20 | @author Matthias Richter | |
21 | @date 2009-06-24 | |
22 | @brief An AliKalmanTrack implementation for global HLT barrel tracks. | |
23 | */ | |
24 | ||
25 | // see header file for class documentation | |
26 | // or | |
27 | // refer to README to build package | |
28 | // or | |
29 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt | |
30 | ||
31 | #include <cassert> | |
32 | #include "AliHLTGlobalBarrelTrack.h" | |
33 | ||
34 | /** ROOT macro for the implementation of ROOT specific class methods */ | |
35 | ClassImp(AliHLTGlobalBarrelTrack) | |
36 | ||
37 | AliHLTGlobalBarrelTrack::AliHLTGlobalBarrelTrack() | |
38 | : AliKalmanTrack() | |
39 | , fPoints() | |
40 | , fLastX(0.0) | |
41 | , fLastY(0.0) | |
093b64dc | 42 | , fTrackID(-1) |
a1408c4b | 43 | { |
44 | // see header file for class documentation | |
45 | // or | |
46 | // refer to README to build package | |
47 | // or | |
48 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt | |
49 | } | |
50 | ||
51 | AliHLTGlobalBarrelTrack::AliHLTGlobalBarrelTrack(const AliHLTGlobalBarrelTrack& t) | |
52 | : AliKalmanTrack(t) | |
53 | , fPoints() | |
54 | , fLastX(t.GetLastPointX()) | |
55 | , fLastY(t.GetLastPointY()) | |
093b64dc | 56 | , fTrackID(t.TrackID()) |
a1408c4b | 57 | { |
58 | // see header file for class documentation | |
59 | fPoints.assign(t.fPoints.begin(), t.fPoints.end()); | |
60 | } | |
61 | ||
5dc6c74b | 62 | AliHLTGlobalBarrelTrack::AliHLTGlobalBarrelTrack(const AliHLTExternalTrackParam& p ) |
093b64dc | 63 | : AliKalmanTrack() |
64 | , fPoints() | |
65 | , fLastX(p.fLastX) | |
66 | , fLastY(p.fLastY) | |
67 | , fTrackID(p.fTrackID) | |
a1408c4b | 68 | { |
69 | // see header file for class documentation | |
093b64dc | 70 | |
71 | // the 5 track parameters are named in the AliHLTExternalTrackParam | |
72 | // while AliExternalTrackParam just uses an array[5] | |
73 | // the members have the some order, fY is the first one | |
74 | Set(p.fX, p.fAlpha, &p.fY, p.fC); | |
75 | SetPoints(p.fPointIDs, p.fNPoints); | |
e1476e32 | 76 | SetNumberOfClusters(p.fNPoints); |
5dc6c74b | 77 | //SetIntegratedLength(GetPathLengthTo( GetLastPointX(), b); |
a1408c4b | 78 | } |
79 | ||
093b64dc | 80 | template <class c> |
81 | AliHLTGlobalBarrelTrack& AliHLTGlobalBarrelTrack::operator=(const c& p) | |
a1408c4b | 82 | { |
83 | // see header file for class documentation | |
84 | this->~AliHLTGlobalBarrelTrack(); | |
093b64dc | 85 | new (this) AliHLTGlobalBarrelTrack(p); |
a1408c4b | 86 | return *this; |
87 | } | |
88 | ||
89 | AliHLTGlobalBarrelTrack::~AliHLTGlobalBarrelTrack() | |
90 | { | |
91 | // see header file for class documentation | |
92 | } | |
93 | ||
5dc6c74b | 94 | |
95 | Double_t AliHLTGlobalBarrelTrack::GetPathLengthTo( Double_t x, Double_t b ) const | |
96 | { | |
97 | // calculate the trajectory length for dx step | |
98 | ||
99 | Double_t dx = x - GetX(); | |
100 | Double_t ey = GetSnp(); | |
101 | if( TMath::Abs( ey )>=kAlmost1 ) return 0; | |
102 | ||
103 | Double_t ex = TMath::Sqrt(1-ey*ey); | |
104 | Double_t k = GetC(b); | |
105 | ||
106 | Double_t ey1 = k * dx + ey; | |
107 | ||
108 | // check for intersection with X=x | |
109 | ||
110 | if ( TMath::Abs( ey1 ) >= kAlmost1 ) return 0; | |
111 | ||
112 | Double_t ex1 = TMath::Sqrt(1-ey1*ey1); | |
113 | ||
5dc6c74b | 114 | Double_t ss = ey + ey1; |
115 | Double_t cc = ex + ex1; | |
116 | ||
117 | if ( TMath::Abs( cc ) < 1.e-4 ) return 0; | |
118 | ||
119 | Double_t tg = ss / cc; | |
120 | Double_t dl = dx * TMath::Sqrt( 1 + tg * tg ); | |
121 | Double_t dSin = dl * k / 2; | |
122 | if ( dSin > 1 ) dSin = 1; | |
123 | if ( dSin < -1 ) dSin = -1; | |
124 | Double_t dS = ( TMath::Abs( k ) > 1.e-4 ) ? ( 2 * TMath::ASin( dSin ) / k ) : dl; | |
125 | ||
126 | return dS*TMath::Sqrt(1 + GetTgl()*GetTgl() ); | |
127 | } | |
128 | ||
129 | ||
130 | ||
131 | int AliHLTGlobalBarrelTrack::ConvertTrackDataArray(const AliHLTTracksData* pTracks, unsigned sizeInByte, vector<AliHLTGlobalBarrelTrack> &tgtArray ) | |
a1408c4b | 132 | { |
133 | // see header file for class documentation | |
134 | int iResult=0; | |
135 | tgtArray.clear(); | |
136 | if (!pTracks || sizeInByte<sizeof(AliHLTTracksData) || pTracks->fCount==0) return 0; | |
137 | ||
138 | const AliHLTUInt8_t* pEnd=reinterpret_cast<const AliHLTUInt8_t*>(pTracks); | |
139 | pEnd+=sizeInByte; | |
140 | ||
141 | tgtArray.resize(pTracks->fCount); | |
142 | const AliHLTUInt8_t* pCurrent=reinterpret_cast<const AliHLTUInt8_t*>(pTracks->fTracklets); | |
d8cddd2e | 143 | for (unsigned i=0; i<pTracks->fCount; i++) { |
093b64dc | 144 | if (pCurrent+sizeof(AliHLTExternalTrackParam)>pEnd) { |
a1408c4b | 145 | iResult=-EINVAL; break; |
146 | } | |
147 | const AliHLTExternalTrackParam* track=reinterpret_cast<const AliHLTExternalTrackParam*>(pCurrent); | |
093b64dc | 148 | if (pCurrent+sizeof(AliHLTExternalTrackParam)+track->fNPoints*sizeof(UInt_t)>pEnd) { |
a1408c4b | 149 | iResult=-EINVAL; break; |
150 | } | |
151 | tgtArray[i]=*track; | |
093b64dc | 152 | pCurrent+=sizeof(AliHLTExternalTrackParam)+track->fNPoints*sizeof(UInt_t); |
a1408c4b | 153 | } |
154 | if (iResult<0) tgtArray.clear(); | |
155 | else iResult=tgtArray.size(); | |
156 | return iResult; | |
157 | } | |
158 | ||
159 | UInt_t AliHLTGlobalBarrelTrack::GetNumberOfPoints() const | |
160 | { | |
161 | // see header file for class documentation | |
162 | return fPoints.size(); | |
163 | } | |
164 | ||
165 | const UInt_t* AliHLTGlobalBarrelTrack::GetPoints() const | |
166 | { | |
167 | // see header file for class documentation | |
168 | if (fPoints.size()==0) return NULL; | |
169 | return &fPoints[0]; | |
170 | } | |
171 | ||
172 | int AliHLTGlobalBarrelTrack::SetPoints(const UInt_t* pArray, UInt_t arraySize) | |
173 | { | |
174 | // see header file for class documentation | |
175 | if (!pArray || arraySize==0) return 0; | |
176 | fPoints.resize(arraySize); | |
d8cddd2e | 177 | for (unsigned i=0; i<arraySize; i++) fPoints[i]=pArray[i]; |
a1408c4b | 178 | return fPoints.size(); |
179 | } | |
093b64dc | 180 | |
181 | void AliHLTGlobalBarrelTrack::Print(Option_t* option) const | |
182 | { | |
183 | // see header file for class documentation | |
184 | cout << "********* Track Id: " << fTrackID << " *******************" << endl; | |
185 | AliExternalTrackParam::Print(option); | |
186 | // cout << " Alpha " << GetAlpha(); | |
187 | // cout << " X " << GetX(); | |
188 | // cout << " Y " << GetY(); | |
189 | // cout << " Z " << GetZ() << endl; | |
190 | // cout << " Snp " << GetSnp(); | |
191 | // cout << " Tgl " << GetTgl(); | |
192 | // cout << " Signed1Pt " << GetSigned1Pt() << endl; | |
193 | } |