]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/TPCLib/tracking-ca/AliHLTTPCCAClusterData.cxx
changes from Matthias
[u/mrichter/AliRoot.git] / HLT / TPCLib / tracking-ca / AliHLTTPCCAClusterData.cxx
1 /*
2     Copyright (C) 2009 Matthias Kretz <kretz@kde.org>
3
4     This program is free software; you can redistribute it and/or
5     modify it under the terms of the GNU Library General Public
6     License as published by the Free Software Foundation; either
7     version 2 of the License, or (at your option) version 3.
8
9     This library is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12     Library General Public License for more details.
13
14     You should have received a copy of the GNU Library General Public License
15     along with this library; see the file COPYING.LIB.  If not, write to
16     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17     Boston, MA 02110-1301, USA.
18
19 */
20
21 #include "AliHLTTPCCAClusterData.h"
22 #include "AliHLTTPCSpacePointData.h"
23 #include "AliHLTTPCCAMath.h"
24 #include <iostream>
25
26 void AliHLTTPCCAClusterData::readEvent( const AliHLTArray<AliHLTTPCSpacePointData *> &clusters,
27                                         int numberOfClusters, double ClusterZCut )
28 {
29   if ( numberOfClusters <= 0 ) {
30     fSlice = -1;
31     fFirstRow = 0;
32     fLastRow = -1;
33     return;
34   }
35   fSlice = clusters[0]->fID >> 25;
36   fFirstRow = clusters[0]->fPadRow;
37   fLastRow = fFirstRow;
38   int row = fFirstRow;
39   for ( int i = 0; i < row; ++i ) {
40     fNumberOfClusters.push_back( 0 );
41     fRowOffset.push_back( 0 );
42   }
43   fRowOffset.push_back( 0 );
44   for ( int i = 0; i < numberOfClusters; ++i ) {
45     AliHLTTPCSpacePointData *data = clusters[i];
46
47     if ( CAMath::Abs( data->fZ ) > ClusterZCut ) continue;
48
49     while ( row < data->fPadRow ) {
50       fNumberOfClusters.push_back( fData.size() - fRowOffset.back() );
51       fRowOffset.push_back( fData.size() );
52       ++row;
53     }
54     Data d = { data->fX, data->fY, data->fZ, data->fID, data->fPadRow };
55     fData.push_back( d );
56   }
57   fNumberOfClusters.push_back( fData.size() - fRowOffset.back() );
58   fLastRow = row; // the last seen row is the last row in this slice
59 }
60
61 void AliHLTTPCCAClusterData::readEvent( const AliHLTTPCCAGBHit *hits, int *offset, int numberOfClusters )
62 {
63   fSlice = hits[*offset].ISlice();
64   fFirstRow = hits[*offset].IRow(); // the data is row sorted first in the slice, so this is our first row
65   fLastRow = fFirstRow;
66   int row = fFirstRow;
67   for ( int i = 0; i < row; ++i ) {
68     fNumberOfClusters.push_back( 0 );
69     fRowOffset.push_back( 0 );
70   }
71   fRowOffset.push_back( 0 );
72   for ( int &i = *offset; i < numberOfClusters; ++i ) {
73     const AliHLTTPCCAGBHit &hit = hits[i];
74     if ( hit.ISlice() != fSlice ) {
75       // the data is slice sorted first so we're done gathering our data
76       break;
77     }
78     while ( row < hit.IRow() ) {
79       fNumberOfClusters.push_back( fData.size() - fRowOffset.back() );
80       fRowOffset.push_back( fData.size() );
81       ++row;
82     }
83     Data d = { hit.X(), hit.Y(), hit.Z(), hit.ID(), hit.IRow() };
84     fData.push_back( d );
85   }
86   fNumberOfClusters.push_back( fData.size() - fRowOffset.back() );
87   fLastRow = row; // the last seen row is the last row in this slice
88 }