]>
Commit | Line | Data |
---|---|---|
d54804bf | 1 | // $Id$ |
ce565086 | 2 | // ************************************************************************** |
fbb9b71b | 3 | // This file is property of and copyright by the ALICE HLT Project * |
d54804bf | 4 | // ALICE Experiment at CERN, All rights reserved. * |
5 | // * | |
6 | // Primary Authors: Sergey Gorbunov <sergey.gorbunov@kip.uni-heidelberg.de> * | |
7 | // Ivan Kisel <kisel@kip.uni-heidelberg.de> * | |
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. * | |
ce565086 | 17 | // * |
d54804bf | 18 | //*************************************************************************** |
19 | ||
20 | #include "AliTPCtrackerCA.h" | |
21 | ||
00d07bcd | 22 | #include "TTree.h" |
23 | #include "Riostream.h" | |
24 | //#include "AliCluster.h" | |
d54804bf | 25 | #include "AliTPCClustersRow.h" |
26 | #include "AliTPCParam.h" | |
693d2443 | 27 | #include "AliTPCClusterParam.h" |
28 | ||
d54804bf | 29 | #include "AliRun.h" |
30 | #include "AliRunLoader.h" | |
31 | #include "AliStack.h" | |
32 | ||
d54804bf | 33 | #include "AliHLTTPCCAPerformance.h" |
34 | #include "AliHLTTPCCAParam.h" | |
00d07bcd | 35 | #include "AliHLTTPCCATracker.h" |
6de2bc40 | 36 | #include "AliHLTTPCCAStandaloneFramework.h" |
6d869045 | 37 | #include "AliHLTTPCGMMergedTrack.h" |
d54804bf | 38 | |
39 | #include "TMath.h" | |
40 | #include "AliTPCLoader.h" | |
41 | #include "AliTPC.h" | |
42 | #include "AliTPCclusterMI.h" | |
43 | #include "AliTPCTransform.h" | |
44 | #include "AliTPCcalibDB.h" | |
d54804bf | 45 | #include "AliTPCtrack.h" |
693d2443 | 46 | #include "AliTPCseed.h" |
d54804bf | 47 | #include "AliESDtrack.h" |
48 | #include "AliESDEvent.h" | |
eb30eb49 | 49 | #include "AliTrackReference.h" |
00d07bcd | 50 | #include "TStopwatch.h" |
15d2e9cf | 51 | #include "AliTPCReconstructor.h" |
d4704ce5 | 52 | #include <memory> |
d54804bf | 53 | |
81c309ed | 54 | //#include <fstream.h> |
d54804bf | 55 | |
fbb9b71b | 56 | ClassImp( AliTPCtrackerCA ) |
d54804bf | 57 | |
58 | AliTPCtrackerCA::AliTPCtrackerCA() | |
6de2bc40 | 59 | : AliTracker(), fkParam( 0 ), fClusters( 0 ), fClusterSliceRow( 0 ), fNClusters( 0 ), fDoHLTPerformance( 0 ), fDoHLTPerformanceClusters( 0 ), fStatCPUTime( 0 ), fStatRealTime( 0 ), fStatNEvents( 0 ) |
d54804bf | 60 | { |
61 | //* default constructor | |
62 | } | |
63 | ||
fbb9b71b | 64 | AliTPCtrackerCA::~AliTPCtrackerCA() |
d54804bf | 65 | { |
66 | //* destructor | |
6de2bc40 | 67 | delete[] fClusters; |
68 | delete[] fClusterSliceRow; | |
d54804bf | 69 | } |
70 | ||
693d2443 | 71 | //#include "AliHLTTPCCADisplay.h" |
72 | ||
fbb9b71b | 73 | AliTPCtrackerCA::AliTPCtrackerCA( const AliTPCParam *par ): |
6de2bc40 | 74 | AliTracker(), fkParam( par ), fClusters( 0 ), fClusterSliceRow( 0 ), fNClusters( 0 ), fDoHLTPerformance( 0 ), fDoHLTPerformanceClusters( 0 ), fStatCPUTime( 0 ), fStatRealTime( 0 ), fStatNEvents( 0 ) |
d54804bf | 75 | { |
76 | //* constructor | |
fbb9b71b | 77 | |
c1cab320 | 78 | fDoHLTPerformance = 0; |
79 | fDoHLTPerformanceClusters = 0; | |
d54804bf | 80 | |
6de2bc40 | 81 | AliHLTTPCCAStandaloneFramework &hlt = AliHLTTPCCAStandaloneFramework::Instance(); |
b8139972 | 82 | |
d54804bf | 83 | |
6de2bc40 | 84 | for ( int iSlice = 0; iSlice < hlt.NSlices(); iSlice++ ) { |
43422963 | 85 | |
86 | float bz = AliTracker::GetBz(); | |
87 | ||
88 | float inRmin = fkParam->GetInnerRadiusLow(); | |
89 | //float inRmax = fkParam->GetInnerRadiusUp(); | |
90 | //float outRmin = fkParam->GetOuterRadiusLow(); | |
91 | float outRmax = fkParam->GetOuterRadiusUp(); | |
92 | float plusZmin = 0.0529937; | |
93 | float plusZmax = 249.778; | |
94 | float minusZmin = -249.645; | |
95 | float minusZmax = -0.0799937; | |
96 | float dalpha = 0.349066; | |
fbb9b71b | 97 | float alpha = 0.174533 + dalpha * iSlice; |
98 | ||
99 | bool zPlus = ( iSlice < 18 ); | |
100 | float zMin = zPlus ? plusZmin : minusZmin; | |
101 | float zMax = zPlus ? plusZmax : minusZmax; | |
43422963 | 102 | //TPCZmin = -249.645, ZMax = 249.778 |
103 | //float rMin = inRmin; | |
104 | //float rMax = outRmax; | |
105 | ||
106 | float padPitch = 0.4; | |
107 | float sigmaZ = 0.228808; | |
108 | ||
109 | int nRows = fkParam->GetNRowLow() + fkParam->GetNRowUp(); | |
110 | int dimRowX=fkParam->GetNRowLow()+fkParam->GetNRowUp(); | |
111 | std::auto_ptr<float> rowX(new float[dimRowX]); | |
112 | for ( int irow = 0; irow < fkParam->GetNRowLow(); irow++ ) { | |
113 | (rowX.get())[irow] = fkParam->GetPadRowRadiiLow( irow ); | |
114 | } | |
115 | for ( int irow = 0; irow < fkParam->GetNRowUp(); irow++ ) { | |
116 | (rowX.get())[fkParam->GetNRowLow()+irow] = fkParam->GetPadRowRadiiUp( irow ); | |
117 | } | |
d54804bf | 118 | AliHLTTPCCAParam param; |
43422963 | 119 | param.Initialize( iSlice, nRows, rowX.get(), alpha, dalpha, |
fbb9b71b | 120 | inRmin, outRmax, zMin, zMax, padPitch, sigmaZ, bz ); |
ce565086 | 121 | param.SetHitPickUpFactor( 1. ); |
693d2443 | 122 | param.SetMaxTrackMatchDRow( 5 ); |
123 | param.SetTrackConnectionFactor( 3.5 ); | |
36e3690e | 124 | param.SetMinNTrackClusters( 30 ); |
6d869045 | 125 | param.SetMinTrackPt(0.2); |
693d2443 | 126 | AliTPCClusterParam * clparam = AliTPCcalibDB::Instance()->GetClusterParam(); |
fbb9b71b | 127 | for ( int iRow = 0; iRow < nRows; iRow++ ) { |
128 | int type = ( iRow < 63 ) ? 0 : ( ( iRow > 126 ) ? 1 : 2 ); | |
129 | for ( int iyz = 0; iyz < 2; iyz++ ) { | |
130 | for ( int k = 0; k < 7; k++ ) { | |
131 | //std::cout<<param.fParamS0Par[iyz][type][k]<<" "<<clparam->fParamS0Par[iyz][type][k] - param.fParamS0Par[iyz][type][k]<<std::endl; | |
606eb2ec | 132 | #ifndef HAVE_NOT_ALITPCCLUSTERPARAM_r40128 |
133 | param.SetParamS0Par( iyz, type, k, clparam->ParamS0Par(iyz, type, k)); | |
134 | #else | |
97434970 | 135 | param.SetParamS0Par( iyz, type, k, clparam->fParamS0Par[iyz][type][k] ); |
606eb2ec | 136 | #endif //HAVE_NOT_ALITPCCLUSTERPARAM_r40128 |
fbb9b71b | 137 | } |
693d2443 | 138 | } |
139 | } | |
b22af1bf | 140 | //hlt.SliceTracker( iSlice ).Initialize( param ); |
43422963 | 141 | hlt.InitializeSliceParam(iSlice, param); |
d54804bf | 142 | } |
143 | } | |
144 | ||
145 | ||
146 | ||
fbb9b71b | 147 | int AliTPCtrackerCA::LoadClusters ( TTree * fromTree ) |
148 | { | |
00d07bcd | 149 | // load clusters to the local arrays |
d54804bf | 150 | fNClusters = 0; |
6de2bc40 | 151 | delete[] fClusters; |
152 | delete[] fClusterSliceRow; | |
153 | ||
154 | AliHLTTPCCAStandaloneFramework &hlt = AliHLTTPCCAStandaloneFramework::Instance(); | |
b8139972 | 155 | |
156 | if ( fDoHLTPerformance ) { | |
6de2bc40 | 157 | AliHLTTPCCAPerformance::Instance().StartEvent(); |
b8139972 | 158 | if ( fDoHLTPerformanceClusters ) AliHLTTPCCAPerformance::Instance().SetDoClusterPulls( 1 ); |
6de2bc40 | 159 | } |
d54804bf | 160 | |
fbb9b71b | 161 | if ( !fkParam ) return 1; |
d54804bf | 162 | |
163 | // load mc tracks | |
fbb9b71b | 164 | while ( fDoHLTPerformance ) { |
165 | if ( !gAlice ) break; | |
43422963 | 166 | #ifndef HAVE_NOT_ALIRUNLOADER30859 |
fbb9b71b | 167 | AliRunLoader *rl = AliRunLoader::Instance();//gAlice->GetRunLoader(); |
43422963 | 168 | #else |
169 | // the old way before rev 30859 | |
170 | AliRunLoader *rl = AliRunLoader::GetRunLoader(); | |
171 | #endif | |
fbb9b71b | 172 | if ( !rl ) break; |
d54804bf | 173 | rl->LoadKinematics(); |
174 | AliStack *stack = rl->Stack(); | |
fbb9b71b | 175 | if ( !stack ) break; |
7950380b | 176 | int nMCtracks = stack->GetNtrack(); |
177 | if( nMCtracks<0 || nMCtracks>10000000 ) nMCtracks = 0; | |
d54804bf | 178 | |
7950380b | 179 | AliHLTTPCCAPerformance::Instance().SetNMCTracks( nMCtracks ); |
fbb9b71b | 180 | |
7950380b | 181 | for ( int itr = 0; itr < nMCtracks; itr++ ) { |
fbb9b71b | 182 | TParticle *part = stack->Particle( itr ); |
693d2443 | 183 | AliHLTTPCCAPerformance::Instance().ReadMCTrack( itr, part ); |
d54804bf | 184 | } |
eb30eb49 | 185 | |
186 | { // check for MC tracks at the TPC entrance | |
693d2443 | 187 | |
eb30eb49 | 188 | rl->LoadTrackRefs(); |
00d07bcd | 189 | TTree *mcTree = rl->TreeTR(); |
fbb9b71b | 190 | if ( !mcTree ) break; |
191 | TBranch *branch = mcTree->GetBranch( "TrackReferences" ); | |
192 | if ( !branch ) break; | |
193 | TClonesArray tpcdummy( "AliTrackReference", 1000 ), *tpcRefs = &tpcdummy; | |
194 | branch->SetAddress( &tpcRefs ); | |
7950380b | 195 | |
196 | bool *isTPC = new bool [nMCtracks]; | |
197 | for ( int i = 0; i < nMCtracks; i++ ) isTPC[i] = 0; | |
198 | ||
fbb9b71b | 199 | int nr = ( int )mcTree->GetEntries(); |
200 | for ( int r = 0; r < nr; r++ ) { | |
201 | mcTree->GetEvent( r ); | |
202 | int nref = tpcRefs->GetEntriesFast(); | |
203 | if ( !nref ) continue; | |
204 | AliTrackReference *tpcRef = 0x0; | |
205 | for ( int iref = 0; iref < nref; ++iref ) { | |
206 | tpcRef = ( AliTrackReference* )tpcRefs->UncheckedAt( iref ); | |
207 | if ( tpcRef->DetectorId() == AliTrackReference::kTPC ) break; | |
208 | tpcRef = 0x0; | |
209 | } | |
210 | if ( !tpcRef ) continue; | |
211 | ||
212 | if ( isTPC[tpcRef->Label()] ) continue; | |
213 | ||
214 | AliHLTTPCCAPerformance::Instance().ReadMCTPCTrack( tpcRef->Label(), | |
215 | tpcRef->X(), tpcRef->Y(), tpcRef->Z(), | |
216 | tpcRef->Px(), tpcRef->Py(), tpcRef->Pz() ); | |
217 | isTPC[tpcRef->Label()] = 1; | |
218 | tpcRefs->Clear(); | |
219 | } | |
7950380b | 220 | delete[] isTPC; |
eb30eb49 | 221 | } |
222 | ||
fbb9b71b | 223 | while ( fDoHLTPerformanceClusters ) { |
224 | AliTPCLoader *tpcl = ( AliTPCLoader* ) rl->GetDetectorLoader( "TPC" ); | |
225 | if ( !tpcl ) break; | |
226 | if ( tpcl->TreeH() == 0x0 ) { | |
227 | if ( tpcl->LoadHits() ) break; | |
eb30eb49 | 228 | } |
fbb9b71b | 229 | if ( tpcl->TreeH() == 0x0 ) break; |
230 | ||
231 | AliTPC *tpc = ( AliTPC* ) gAlice->GetDetector( "TPC" ); | |
232 | int nEnt = ( int )tpcl->TreeH()->GetEntries(); | |
233 | int nPoints = 0; | |
234 | for ( int iEnt = 0; iEnt < nEnt; iEnt++ ) { | |
235 | tpc->ResetHits(); | |
236 | tpcl->TreeH()->GetEvent( iEnt ); | |
237 | AliTPChit *phit = ( AliTPChit* )tpc->FirstHit( -1 ); | |
238 | for ( ; phit; phit = ( AliTPChit* )tpc->NextHit() ) nPoints++; | |
eb30eb49 | 239 | } |
693d2443 | 240 | AliHLTTPCCAPerformance::Instance().SetNMCPoints( nPoints ); |
eb30eb49 | 241 | |
fbb9b71b | 242 | for ( int iEnt = 0; iEnt < nEnt; iEnt++ ) { |
243 | tpc->ResetHits(); | |
244 | tpcl->TreeH()->GetEvent( iEnt ); | |
245 | AliTPChit *phit = ( AliTPChit* )tpc->FirstHit( -1 ); | |
246 | for ( ; phit; phit = ( AliTPChit* )tpc->NextHit() ) { | |
247 | AliHLTTPCCAPerformance::Instance().ReadMCPoint( phit->GetTrack(), phit->X(), phit->Y(), phit->Z(), phit->Time(), phit->fSector % 36 ); | |
248 | } | |
eb30eb49 | 249 | } |
250 | break; | |
251 | } | |
252 | break; | |
253 | } | |
fbb9b71b | 254 | |
255 | TBranch * br = fromTree->GetBranch( "Segment" ); | |
256 | if ( !br ) return 1; | |
d54804bf | 257 | |
258 | AliTPCClustersRow *clrow = new AliTPCClustersRow; | |
fbb9b71b | 259 | clrow->SetClass( "AliTPCclusterMI" ); |
260 | clrow->SetArray( 0 ); | |
261 | clrow->GetArray()->ExpandCreateFast( 10000 ); | |
262 | ||
263 | br->SetAddress( &clrow ); | |
264 | ||
d54804bf | 265 | // |
fbb9b71b | 266 | int nEnt = int( fromTree->GetEntries() ); |
d54804bf | 267 | |
268 | fNClusters = 0; | |
fbb9b71b | 269 | for ( int i = 0; i < nEnt; i++ ) { |
270 | br->GetEntry( i ); | |
271 | int sec, row; | |
272 | fkParam->AdjustSectorRow( clrow->GetID(), sec, row ); | |
d54804bf | 273 | fNClusters += clrow->GetArray()->GetEntriesFast(); |
274 | } | |
275 | ||
276 | fClusters = new AliTPCclusterMI [fNClusters]; | |
b8139972 | 277 | fClusterSliceRow = new unsigned int [fNClusters]; |
6de2bc40 | 278 | |
279 | hlt.StartDataReading( fNClusters ); | |
280 | ||
fbb9b71b | 281 | if ( fDoHLTPerformance ) AliHLTTPCCAPerformance::Instance().SetNHits( fNClusters ); |
6de2bc40 | 282 | |
fbb9b71b | 283 | int ind = 0; |
284 | for ( int i = 0; i < nEnt; i++ ) { | |
285 | br->GetEntry( i ); | |
286 | int sec, row; | |
287 | fkParam->AdjustSectorRow( clrow->GetID(), sec, row ); | |
288 | int nClu = clrow->GetArray()->GetEntriesFast(); | |
289 | float x = fkParam->GetPadRowRadii( sec, row ); | |
6de2bc40 | 290 | |
291 | if ( sec >= 36 ) { | |
292 | sec = sec - 36; | |
293 | row = row + fkParam->GetNRowLow(); | |
294 | } | |
b8139972 | 295 | |
296 | unsigned int sliceRow = ( sec << 8 ) + row; | |
6de2bc40 | 297 | |
fbb9b71b | 298 | for ( int icl = 0; icl < nClu; icl++ ) { |
299 | int lab0 = -1; | |
300 | int lab1 = -1; | |
301 | int lab2 = -1; | |
302 | AliTPCclusterMI* cluster = ( AliTPCclusterMI* )( clrow->GetArray()->At( icl ) ); | |
303 | if ( !cluster ) continue; | |
304 | lab0 = cluster->GetLabel( 0 ); | |
305 | lab1 = cluster->GetLabel( 1 ); | |
306 | lab2 = cluster->GetLabel( 2 ); | |
d54804bf | 307 | |
7950380b | 308 | AliTPCTransform *transform = AliTPCcalibDB::Instance()->GetTransform() ; |
fbb9b71b | 309 | if ( !transform ) { |
310 | AliFatal( "Tranformations not in calibDB" ); | |
7950380b | 311 | break; |
d54804bf | 312 | } |
7950380b | 313 | |
314 | transform->SetCurrentRecoParam((AliTPCRecoParam*)AliTPCReconstructor::GetRecoParam()); | |
2cb809a5 | 315 | double xx[3] = {static_cast<double>(cluster->GetRow()), cluster->GetPad(), cluster->GetTimeBin()}; |
fbb9b71b | 316 | int id[1] = {cluster->GetDetector()}; |
317 | transform->Transform( xx, id, 0, 1 ); | |
d54804bf | 318 | |
fbb9b71b | 319 | cluster->SetX( xx[0] ); |
320 | cluster->SetY( xx[1] ); | |
321 | cluster->SetZ( xx[2] ); | |
d54804bf | 322 | |
fbb9b71b | 323 | TGeoHMatrix *mat = fkParam->GetClusterMatrix( cluster->GetDetector() ); |
324 | double pos[3] = {cluster->GetX(), cluster->GetY(), cluster->GetZ()}; | |
325 | double posC[3] = {cluster->GetX(), cluster->GetY(), cluster->GetZ()}; | |
326 | if ( mat ) mat->LocalToMaster( pos, posC ); | |
327 | else { | |
328 | // chack Loading of Geo matrices from GeoManager - TEMPORARY FIX | |
d54804bf | 329 | } |
fbb9b71b | 330 | cluster->SetX( posC[0] ); |
331 | cluster->SetY( posC[1] ); | |
332 | cluster->SetZ( posC[2] ); | |
d54804bf | 333 | |
15d2e9cf | 334 | x = cluster->GetX(); |
fbb9b71b | 335 | float y = cluster->GetY(); |
336 | float z = cluster->GetZ(); | |
d54804bf | 337 | |
fbb9b71b | 338 | |
339 | int index = ind++; | |
d54804bf | 340 | fClusters[index] = *cluster; |
6de2bc40 | 341 | |
342 | fClusterSliceRow[index] = sliceRow; | |
343 | ||
344 | hlt.ReadCluster( index, sec, row, x, y, z, cluster->GetQ() ); | |
345 | ||
fbb9b71b | 346 | if ( fDoHLTPerformance ) AliHLTTPCCAPerformance::Instance().ReadHitLabel( index, lab0, lab1, lab2 ); |
d54804bf | 347 | } |
348 | } | |
349 | delete clrow; | |
6de2bc40 | 350 | |
351 | hlt.FinishDataReading(); | |
352 | ||
b8139972 | 353 | //AliHLTTPCCAPerformance::Instance().SmearClustersMC(); |
6de2bc40 | 354 | |
d54804bf | 355 | return 0; |
356 | } | |
357 | ||
fbb9b71b | 358 | AliCluster * AliTPCtrackerCA::GetCluster( int index ) const |
d54804bf | 359 | { |
fbb9b71b | 360 | return &( fClusters[index] ); |
d54804bf | 361 | } |
362 | ||
fbb9b71b | 363 | int AliTPCtrackerCA::Clusters2Tracks( AliESDEvent *event ) |
d54804bf | 364 | { |
00d07bcd | 365 | // reconstruction |
693d2443 | 366 | //cout<<"Start of AliTPCtrackerCA"<<endl; |
00d07bcd | 367 | TStopwatch timer; |
d54804bf | 368 | |
6de2bc40 | 369 | AliHLTTPCCAStandaloneFramework &hlt = AliHLTTPCCAStandaloneFramework::Instance(); |
370 | ||
371 | hlt.ProcessEvent(); | |
eb30eb49 | 372 | |
6d869045 | 373 | if ( event ) { |
fbb9b71b | 374 | |
6d869045 | 375 | for ( int itr = 0; itr < hlt.Merger().NOutputTracks(); itr++ ) { |
b8139972 | 376 | |
693d2443 | 377 | AliTPCseed tTPC; |
6de2bc40 | 378 | |
6d869045 | 379 | const AliHLTTPCGMMergedTrack &tCA = hlt.Merger().OutputTracks()[itr]; |
6de2bc40 | 380 | |
6d869045 | 381 | AliHLTTPCGMTrackParam par = tCA.GetParam(); |
382 | par.GetExtParam( tTPC, tCA.GetAlpha() ); | |
fbb9b71b | 383 | tTPC.SetMass( 0.13957 ); |
fbb9b71b | 384 | if ( TMath::Abs( tTPC.GetSigned1Pt() ) > 1. / 0.02 ) continue; |
6de2bc40 | 385 | int nhits = tCA.NClusters(); |
fbb9b71b | 386 | int firstHit = 0; |
387 | if ( nhits > 160 ) { | |
388 | firstHit = nhits - 160; | |
389 | nhits = 160; | |
ce565086 | 390 | } |
fbb9b71b | 391 | tTPC.SetNumberOfClusters( nhits ); |
6d869045 | 392 | //float alpha = tCA.GetAlpha(); |
393 | AliHLTTPCGMTrackParam t0 = par; | |
fbb9b71b | 394 | for ( int ih = 0; ih < nhits; ih++ ) { |
6d869045 | 395 | int index = hlt.Merger().OutputClusterIds()[ tCA.FirstClusterRef() + firstHit + ih ]; |
6de2bc40 | 396 | tTPC.SetClusterIndex( ih, index ); |
397 | AliTPCclusterMI *c = &( fClusters[index] ); | |
6d869045 | 398 | //int iSlice = fClusterSliceRow[index] >> 8; |
b8139972 | 399 | int row = fClusterSliceRow[index] & 0xff; |
400 | ||
6de2bc40 | 401 | tTPC.SetClusterPointer( row, c ); |
6d869045 | 402 | /* |
6de2bc40 | 403 | AliTPCTrackerPoint &point = *( tTPC.GetTrackPoint( row ) ); |
fbb9b71b | 404 | { |
b22af1bf | 405 | //AliHLTTPCCATracker &slice = hlt.SliceTracker( iSlice ); |
406 | if ( hlt.Param(iSlice).Alpha() != alpha ) { | |
407 | if ( ! t0.Rotate( hlt.Param(iSlice).Alpha() - alpha, .999 ) ) continue; | |
408 | alpha = hlt.Param(iSlice).Alpha(); | |
fbb9b71b | 409 | } |
b22af1bf | 410 | float x = hlt.Row(iSlice, row).X(); |
411 | if ( !t0.TransportToX( x, hlt.Param(iSlice).GetBz( t0 ), .999 ) ) continue; | |
fbb9b71b | 412 | float sy2, sz2; |
b22af1bf | 413 | //slice.GetErrors2( row, t0, sy2, sz2 ); |
414 | hlt.Param(iSlice).GetClusterErrors2( row, t0.GetZ(), t0.SinPhi(), t0.GetCosPhi(), t0.DzDs(), sy2, sz2 ); | |
fbb9b71b | 415 | point.SetSigmaY( c->GetSigmaY2() / sy2 ); |
416 | point.SetSigmaZ( c->GetSigmaZ2() / sz2 ); | |
417 | point.SetAngleY( TMath::Abs( t0.GetSinPhi() / t0.GetCosPhi() ) ); | |
418 | point.SetAngleZ( TMath::Abs( t0.GetDzDs() ) ); | |
419 | } | |
6d869045 | 420 | */ |
15d2e9cf | 421 | } |
6d869045 | 422 | //tTPC.CookdEdx( 0.02, 0.6 ); |
b8139972 | 423 | |
fbb9b71b | 424 | CookLabel( &tTPC, 0.1 ); |
6d869045 | 425 | |
fbb9b71b | 426 | if ( 1 ) { // correction like in off-line --- Adding systematic error |
427 | ||
428 | const double *param = AliTPCReconstructor::GetRecoParam()->GetSystematicError(); | |
429 | double covar[15]; | |
430 | for ( int i = 0; i < 15; i++ ) covar[i] = 0; | |
431 | covar[0] = param[0] * param[0]; | |
432 | covar[2] = param[1] * param[1]; | |
433 | covar[5] = param[2] * param[2]; | |
434 | covar[9] = param[3] * param[3]; | |
435 | double facC = AliTracker::GetBz() * kB2C; | |
436 | covar[14] = param[4] * param[4] * facC * facC; | |
437 | tTPC.AddCovariance( covar ); | |
15d2e9cf | 438 | } |
439 | ||
d54804bf | 440 | AliESDtrack tESD; |
fbb9b71b | 441 | tESD.UpdateTrackParams( &( tTPC ), AliESDtrack::kTPCin ); |
d54804bf | 442 | //tESD.SetStatus( AliESDtrack::kTPCrefit ); |
443 | //tESD.SetTPCPoints(tTPC.GetPoints()); | |
fbb9b71b | 444 | int ndedx = tTPC.GetNCDEDX( 0 ); |
445 | float sdedx = tTPC.GetSDEDX( 0 ); | |
446 | float dedx = tTPC.GetdEdx(); | |
447 | tESD.SetTPCsignal( dedx, sdedx, ndedx ); | |
448 | //tESD.myTPC = tTPC; | |
693d2443 | 449 | |
fbb9b71b | 450 | event->AddTrack( &tESD ); |
d54804bf | 451 | } |
452 | } | |
6de2bc40 | 453 | |
454 | ||
00d07bcd | 455 | timer.Stop(); |
3dc0bb93 | 456 | |
457 | fStatCPUTime += timer.CpuTime(); | |
458 | fStatRealTime += timer.RealTime(); | |
459 | ||
460 | //cout << "\n\nCA tracker speed: cpu = " << fStatCPUTime / ( fStatNEvents + 1 )*1.e3 << " [ms/ev], real = " << fStatRealTime / ( fStatNEvents + 1 )*1.e3 << " [ms/ev], n calls = " << ( fStatNEvents + 1 ) << endl << endl; | |
461 | ||
462 | ||
463 | //cout<<"Do performance.."<<endl; | |
464 | ||
465 | if ( fDoHLTPerformance ) AliHLTTPCCAPerformance::Instance().Performance(); | |
466 | ||
467 | if ( 0 ) {// Write Event | |
468 | if ( fStatNEvents == 0 ) { | |
469 | fstream geo; | |
470 | geo.open( "CAEvents/settings.dat", ios::out ); | |
471 | if ( geo.is_open() ) { | |
b8139972 | 472 | hlt.WriteSettings( geo ); |
3dc0bb93 | 473 | } |
474 | geo.close(); | |
475 | } | |
476 | ||
477 | fstream hits; | |
478 | char name[255]; | |
479 | sprintf( name, "CAEvents/%i.event.dat", fStatNEvents ); | |
480 | hits.open( name, ios::out ); | |
481 | if ( hits.is_open() ) { | |
6de2bc40 | 482 | hlt.WriteEvent( hits ); |
3dc0bb93 | 483 | fstream tracks; |
484 | sprintf( name, "CAEvents/%i.tracks.dat", fStatNEvents ); | |
485 | tracks.open( name, ios::out ); | |
6de2bc40 | 486 | hlt.WriteTracks( tracks ); |
3dc0bb93 | 487 | } |
488 | hits.close(); | |
489 | if ( fDoHLTPerformance ) { | |
490 | fstream mcevent, mcpoints; | |
491 | char mcname[255]; | |
492 | sprintf( mcname, "CAEvents/%i.mcevent.dat", fStatNEvents ); | |
493 | mcevent.open( mcname, ios::out ); | |
494 | if ( mcevent.is_open() ) { | |
495 | AliHLTTPCCAPerformance::Instance().WriteMCEvent( mcevent ); | |
496 | } | |
497 | if ( 1 && fDoHLTPerformanceClusters ) { | |
498 | sprintf( mcname, "CAEvents/%i.mcpoints.dat", fStatNEvents ); | |
499 | mcpoints.open( mcname, ios::out ); | |
500 | if ( mcpoints.is_open() ) { | |
501 | AliHLTTPCCAPerformance::Instance().WriteMCPoints( mcpoints ); | |
502 | } | |
503 | mcpoints.close(); | |
504 | } | |
505 | mcevent.close(); | |
506 | } | |
507 | } | |
508 | ||
509 | fStatNEvents++; | |
510 | ||
d54804bf | 511 | |
512 | //cout<<"End of AliTPCtrackerCA"<<endl; | |
513 | return 0; | |
514 | } | |
515 | ||
516 | ||
6d869045 | 517 | int AliTPCtrackerCA::RefitInward ( AliESDEvent * /*event*/ ) |
fbb9b71b | 518 | { |
519 | //* forward propagation of ESD tracks | |
6d869045 | 520 | #ifdef XXX |
fbb9b71b | 521 | float xTPC = fkParam->GetInnerRadiusLow(); |
522 | float dAlpha = fkParam->GetInnerAngle() / 180.*TMath::Pi(); | |
523 | float yMax = xTPC * TMath::Tan( dAlpha / 2. ); | |
eb30eb49 | 524 | |
6de2bc40 | 525 | AliHLTTPCCAStandaloneFramework &hlt = AliHLTTPCCAStandaloneFramework::Instance(); |
526 | ||
fbb9b71b | 527 | int nentr = event->GetNumberOfTracks(); |
528 | ||
529 | for ( int itr = 0; itr < nentr; itr++ ) { | |
530 | AliESDtrack *esd = event->GetTrack( itr ); | |
531 | ULong_t status = esd->GetStatus(); | |
532 | if ( !( status&AliESDtrack::kTPCin ) ) continue; | |
eb30eb49 | 533 | AliHLTTPCCATrackParam t0; |
fbb9b71b | 534 | AliHLTTPCCATrackConvertor::SetExtParam( t0, *esd ); |
ce565086 | 535 | AliHLTTPCCATrackParam t = t0; |
fbb9b71b | 536 | float alpha = esd->GetAlpha(); |
537 | //float dEdX=0; | |
6de2bc40 | 538 | AliHLTTPCCAMerger::AliHLTTPCCAClusterInfo infos[500]; |
539 | int hits[500], hits1[500]; | |
fbb9b71b | 540 | int nHits = esd->GetTPCclusters( hits ); |
b8139972 | 541 | for ( int i = 0; i < nHits; i++ ) { |
6de2bc40 | 542 | hits1[i] = i; |
543 | int index = hits[i]; | |
b8139972 | 544 | infos[i].SetISlice( fClusterSliceRow[index] >> 8 ); |
6d869045 | 545 | int row = fClusterSliceRow[index] & 0xff; |
546 | int type = ( row < 63 ) ? 0 : ( ( row > 126 ) ? 1 : 2 ); | |
547 | infos[i].SetRowType( type ); | |
714b7e75 | 548 | infos[i].SetId( index ); |
b8139972 | 549 | infos[i].SetX( fClusters[index].GetX() ); |
550 | infos[i].SetY( fClusters[index].GetY() ); | |
551 | infos[i].SetZ( fClusters[index].GetZ() ); | |
6de2bc40 | 552 | } |
fbb9b71b | 553 | |
0c8713f5 | 554 | bool ok = hlt.Merger().FitTrack( t, alpha, t0, alpha, hits1, nHits, 0, 1,infos ); |
fbb9b71b | 555 | |
fbb9b71b | 556 | if ( ok && nHits > 15 ) { |
6de2bc40 | 557 | if ( t.TransportToXWithMaterial( xTPC, hlt.Merger().SliceParam().GetBz( t ) ) ) { |
fbb9b71b | 558 | if ( t.GetY() > yMax ) { |
559 | if ( t.Rotate( dAlpha ) ) { | |
560 | alpha += dAlpha; | |
6de2bc40 | 561 | t.TransportToXWithMaterial( xTPC, hlt.Merger().SliceParam().GetBz( t ) ); |
fbb9b71b | 562 | } |
563 | } else if ( t.GetY() < -yMax ) { | |
564 | if ( t.Rotate( -dAlpha ) ) { | |
565 | alpha += -dAlpha; | |
6de2bc40 | 566 | t.TransportToXWithMaterial( xTPC, hlt.Merger().SliceParam().GetBz( t ) ); |
fbb9b71b | 567 | } |
568 | } | |
ce565086 | 569 | } |
fbb9b71b | 570 | |
571 | AliTPCtrack tt( *esd ); | |
b8139972 | 572 | if ( AliHLTTPCCATrackConvertor::GetExtParam( t, tt, alpha ) ) { |
573 | if ( t.X() > 50 ) esd->UpdateTrackParams( &tt, AliESDtrack::kTPCrefit ); | |
4acc2401 | 574 | } |
eb30eb49 | 575 | } |
eb30eb49 | 576 | } |
6d869045 | 577 | #endif |
eb30eb49 | 578 | return 0; |
d54804bf | 579 | } |
580 | ||
6d869045 | 581 | int AliTPCtrackerCA::PropagateBack( AliESDEvent * /*event*/ ) |
fbb9b71b | 582 | { |
fbb9b71b | 583 | //* backward propagation of ESD tracks |
6d869045 | 584 | #ifdef XXX |
ce565086 | 585 | |
6de2bc40 | 586 | AliHLTTPCCAStandaloneFramework &hlt = AliHLTTPCCAStandaloneFramework::Instance(); |
587 | ||
fbb9b71b | 588 | int nentr = event->GetNumberOfTracks(); |
ce565086 | 589 | |
fbb9b71b | 590 | for ( int itr = 0; itr < nentr; itr++ ) { |
ce565086 | 591 | |
fbb9b71b | 592 | AliESDtrack *esd = event->GetTrack( itr ); |
593 | ULong_t status = esd->GetStatus(); | |
594 | if ( !( status&AliESDtrack::kTPCin ) ) continue; | |
ce565086 | 595 | |
596 | AliHLTTPCCATrackParam t0; | |
fbb9b71b | 597 | AliHLTTPCCATrackConvertor::SetExtParam( t0, *esd ); |
ce565086 | 598 | AliHLTTPCCATrackParam t = t0; |
fbb9b71b | 599 | float alpha = esd->GetAlpha(); |
600 | //float dEdX=0; | |
6de2bc40 | 601 | AliHLTTPCCAMerger::AliHLTTPCCAClusterInfo infos[500]; |
602 | int hits[500], hits1[500]; | |
fbb9b71b | 603 | int nHits = esd->GetTPCclusters( hits ); |
b8139972 | 604 | for ( int i = 0; i < nHits; i++ ) { |
6de2bc40 | 605 | hits1[i] = i; |
606 | int index = hits[i]; | |
b8139972 | 607 | infos[i].SetISlice( fClusterSliceRow[index] >> 8 ); |
6d869045 | 608 | int row = fClusterSliceRow[index] & 0xff; |
609 | int type = ( row < 63 ) ? 0 : ( ( row > 126 ) ? 1 : 2 ); | |
610 | infos[i].SetRowType( type ); | |
714b7e75 | 611 | infos[i].SetId( index ); |
b8139972 | 612 | infos[i].SetX( fClusters[index].GetX() ); |
613 | infos[i].SetY( fClusters[index].GetY() ); | |
614 | infos[i].SetZ( fClusters[index].GetZ() ); | |
6de2bc40 | 615 | } |
fbb9b71b | 616 | |
0c8713f5 | 617 | bool ok = hlt.Merger().FitTrack( t, alpha, t0, alpha, hits1, nHits, 1, 1, infos ); |
fbb9b71b | 618 | |
fbb9b71b | 619 | if ( ok && nHits > 15 ) { |
620 | AliTPCtrack tt( *esd ); | |
4acc2401 | 621 | if ( AliHLTTPCCATrackConvertor::GetExtParam( t, tt, alpha ) ) { |
622 | if ( t.X() > 50 ) esd->UpdateTrackParams( &tt, AliESDtrack::kTPCout ); | |
623 | } | |
ce565086 | 624 | } |
625 | } | |
6d869045 | 626 | #endif |
ce565086 | 627 | return 0; |
d54804bf | 628 | } |