StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
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 "AliHLTTPCCAMath.h"
23 
24 void AliHLTTPCCAClusterData::readEvent( const AliHLTTPCCAGBHit *hits, int *offset, int numberOfClusters, int nRows8 )
25 {
26  fNumberOfClusters.reserve( nRows8 );
27  fRowOffset.reserve( nRows8 );
28  fData.reserve( CAMath::Min( 64, numberOfClusters / 64 ) );
29 
30  fSlice = hits[*offset].ISlice();
31  fFirstRow = hits[*offset].IRow(); // the data is row sorted first in the slice, so this is our first row
32  fLastRow = fFirstRow;
33  int row = fFirstRow;
34  for ( int i = 0; i < row; ++i ) {
35  fNumberOfClusters.push_back( 0 );
36  fRowOffset.push_back( 0 );
37  }
38  fRowOffset.push_back( 0 );
39  for ( int &i = *offset; i < numberOfClusters; ++i ) {
40  const AliHLTTPCCAGBHit &hit = hits[i];
41  if ( hit.ISlice() != fSlice ) {
42  // the data is slice sorted first so we're done gathering our data
43  break;
44  }
45  while ( row < hit.IRow() ) {
46  fNumberOfClusters.push_back( fData.size() - fRowOffset.back() );
47  fRowOffset.push_back( fData.size() );
48  ++row;
49  }
50  Data d = { hit.X(), hit.Y(), hit.Z(), hit.ID(), hit.IRow() };
51  fData.push_back( d );
52  }
53  fNumberOfClusters.push_back( fData.size() - fRowOffset.back() );
54  fLastRow = row; // the last seen row is the last row in this slice
55 }