]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/global/AliFlatTPCseed.cxx
Merge branch 'master_patch'
[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   fParam.SetExternalTrackParam(  p );
41   fLabel = p->GetLabel();  
42   for( Int_t irow=0; irow<160; irow++ ){
43     AddCluster( p->GetClusterPointer(irow), p->GetTrackPointConst(irow) );
44   }
45 }
46
47 void AliFlatTPCseed::GetTPCseed( AliTPCseed *p ) const
48 {
49    // write to AliTPCseed
50   if( !p ) return;
51   p->Reset();
52
53   AliTPCseed seed;
54
55   fParam.GetExternalTrackParam( seed );
56   seed.SetLabel(fLabel);  
57   seed.SetNumberOfClusters(fNTPCClusters);
58
59   AliTPCclusterMI * clusters = new AliTPCclusterMI[fNTPCClusters];
60
61   const AliFlatTPCCluster *flatClusters = reinterpret_cast< const AliFlatTPCCluster* >( fContent );
62
63   for( Int_t ic=0; ic<fNTPCClusters; ic++){
64     const AliFlatTPCCluster &flatCluster = flatClusters[ic];
65     int sec = flatCluster.GetSector();
66     int row = flatCluster.GetPadRow();
67     if(sec >= 36) row = row + AliHLTTPCTransform::GetNRowLow();
68     if( row<160 ){
69       flatCluster.GetTPCCluster( &(clusters[ic]), seed.GetTrackPoint(row) );
70       seed.SetClusterPointer( row , &(clusters[ic]) );
71     }
72   }
73   new (p) AliTPCseed( seed, kTRUE ); // true means that p creates its own cluster objects
74   delete [] clusters;
75 }