]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/global/AliFlatTPCseed.cxx
b42e8b37b9512ff331fc3d78b3bed22eeec3a449
[u/mrichter/AliRoot.git] / HLT / global / AliFlatTPCseed.cxx
1 /* $Id$ */
2
3 /**************************************************************************
4  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5  *                                                                        *
6  * Author: The ALICE Off-line Project.                                    *
7  * Contributors are mentioned in the code where appropriate.              *
8  *                                                                        *
9  * Permission to use, copy, modify and distribute this software and its   *
10  * documentation strictly for non-commercial purposes is hereby granted   *
11  * without fee, provided that the above copyright notice appears in all   *
12  * copies and that both the copyright notice and this permission notice   *
13  * appear in the supporting documentation. The authors make no claims     *
14  * about the suitability of this software for any purpose. It is          *
15  * provided "as is" without express or implied warranty.                  *
16  **************************************************************************/
17
18 /**
19  * >> Flat structure representing a TPC seed <<
20  *
21  * To be used in the online and offline calibration schema.
22  *
23  *
24  * Primary Authors : Sergey Gorbunov, Jochen Thaeder, Chiara Zampolli
25  *
26  **************************************************************************/
27
28 #include "AliFlatTPCseed.h"
29 #include "AliTPCseed.h"
30 #include "AliHLTTPCTransform.h"
31 #include "Riostream.h"
32
33
34 void AliFlatTPCseed::SetFromTPCseed( const AliTPCseed *p )
35 {
36   // initialise from AliTPCseed
37
38   Reset();
39   if( !p ) return;
40
41   fParam.SetExternalTrackParam(  p );
42   fLabel = p->GetLabel();
43   AliFlatTPCCluster *clusters = reinterpret_cast< AliFlatTPCCluster* >( fContent );  
44   for( Int_t irow=0; irow<160; irow++ ){
45     const AliTPCclusterMI *cl = p->GetClusterPointer(irow);
46     if( !cl ) continue;
47     AliFlatTPCCluster &flatCluster = clusters[fNTPCClusters];
48     flatCluster.SetTPCCluster( cl );
49     fNTPCClusters++;
50   }
51 }
52
53 void AliFlatTPCseed::GetTPCseed( AliTPCseed *p ) const
54 {
55    // write to AliTPCseed
56   if( !p ) return;
57   p->Reset();
58
59   AliTPCseed seed;
60
61   fParam.GetExternalTrackParam( seed );
62   seed.SetLabel(fLabel);  
63   seed.SetNumberOfClusters(fNTPCClusters);
64
65   AliTPCclusterMI clusters[fNTPCClusters];
66
67   const AliFlatTPCCluster *flatClusters = reinterpret_cast< const AliFlatTPCCluster* >( fContent );
68
69   for( Int_t ic=0; ic<fNTPCClusters; ic++){
70     const AliFlatTPCCluster &flatCluster = flatClusters[ic];    
71     flatCluster.GetTPCCluster( &(clusters[ic]) );
72     int sec = flatCluster.GetSector();
73     int row = flatCluster.GetPadRow();
74     if(sec >= 36) row = row + AliHLTTPCTransform::GetNRowLow();
75     if( row<160 ) seed.SetClusterPointer( row , &(clusters[ic]) );
76   }
77   new (p) AliTPCseed( seed, kTRUE ); // true means that p creates its own cluster objects
78 }