2 Copyright (C) 2009 Matthias Kretz <kretz@kde.org>
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.
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.
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.
21 #include "AliHLTTPCCAClusterData.h"
22 #include "AliHLTTPCSpacePointData.h"
23 #include "AliHLTTPCCAMath.h"
26 void AliHLTTPCCAClusterData::readEvent( const AliHLTArray<AliHLTTPCSpacePointData *> &clusters,
27 int numberOfClusters, double ClusterZCut )
29 if ( numberOfClusters <= 0 ) {
35 fSlice = clusters[0]->fID >> 25;
36 fFirstRow = clusters[0]->fPadRow;
39 for ( int i = 0; i < row; ++i ) {
40 fNumberOfClusters.push_back( 0 );
41 fRowOffset.push_back( 0 );
43 fRowOffset.push_back( 0 );
44 for ( int i = 0; i < numberOfClusters; ++i ) {
45 AliHLTTPCSpacePointData *data = clusters[i];
47 if ( CAMath::Abs( data->fZ ) > ClusterZCut ) continue;
49 while ( row < data->fPadRow ) {
50 fNumberOfClusters.push_back( fData.size() - fRowOffset.back() );
51 fRowOffset.push_back( fData.size() );
54 Data d = { data->fX, data->fY, data->fZ, data->fID, data->fPadRow };
57 fNumberOfClusters.push_back( fData.size() - fRowOffset.back() );
58 fLastRow = row; // the last seen row is the last row in this slice
61 void AliHLTTPCCAClusterData::readEvent( const AliHLTTPCCAGBHit *hits, int *offset, int numberOfClusters )
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
67 for ( int i = 0; i < row; ++i ) {
68 fNumberOfClusters.push_back( 0 );
69 fRowOffset.push_back( 0 );
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
78 while ( row < hit.IRow() ) {
79 fNumberOfClusters.push_back( fData.size() - fRowOffset.back() );
80 fRowOffset.push_back( fData.size() );
83 Data d = { hit.X(), hit.Y(), hit.Z(), hit.ID(), hit.IRow() };
86 fNumberOfClusters.push_back( fData.size() - fRowOffset.back() );
87 fLastRow = row; // the last seen row is the last row in this slice