StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
AliHLTTPCCAClusterData.h
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 #ifndef CLUSTERDATA_H
22 #define CLUSTERDATA_H
23 
24 #include <vector>
25 #include "AliHLTTPCCAGBHit.h"
26 #include "AliHLTArray.h"
27 
28 #include "AliHLTTPCCAParameters.h"
29 
30 class AliHLTTPCSpacePointData;
31 
38 {
39  public:
40 
44  AliHLTTPCCAClusterData( const AliHLTTPCCAGBHit *hits, int *offset, int numberOfClusters, int nRows8 ):
45  fSlice(0), fFirstRow(0), fLastRow(0), fNumberOfClusters(0), fRowOffset(0), fData(0)
46  {
47  readEvent( hits, offset, numberOfClusters, nRows8 );
48  }
49 
50  AliHLTTPCCAClusterData(): fSlice(0), fFirstRow(0), fLastRow(0), fNumberOfClusters(0), fRowOffset(0), fData(0) {}
51 
52  // void readEvent( const AliHLTArray<AliHLTTPCSpacePointData *> &clusters,
53  // int numberOfClusters, double ClusterZCut );
54  void readEvent( const AliHLTTPCCAGBHit *hits, int *offset, int numberOfClusters, int nRows8 );
55 
59  void Merge( int index1, int index2 );
60 
64  //void Split( int index, /* TODO: need some parameters how to split */ );
65 
66  // TODO: some access to history of merges and splits
67 
71  int Slice() const { return fSlice; }
72 
76  int FirstRow() const { return fFirstRow; }
77 
81  int LastRow() const { return fLastRow; }
82 
86  int NumberOfClusters() const { return fData.size(); }
87 
91  int NumberOfClusters( unsigned int rowIndex ) const { return rowIndex < fNumberOfClusters.size() ? fNumberOfClusters[rowIndex] : 0; }
92 
106  int RowOffset( unsigned int rowIndex ) const { return rowIndex < fRowOffset.size() ? fRowOffset[rowIndex] : fData.size(); }
107 
111  float X( int index ) const { assert( index < static_cast<int>( fData.size() ) ); return fData[index].fX; }
112 
116  float Y( int index ) const { assert( index < static_cast<int>( fData.size() ) ); return fData[index].fY; }
117 
121  float Z( int index ) const { assert( index < static_cast<int>( fData.size() ) ); return fData[index].fZ; }
122 
126  int Id( int index ) const { assert( index < static_cast<int>( fData.size() ) ); return fData[index].fId; }
127 
131  int RowNumber( int index ) const { assert( index < static_cast<int>( fData.size() ) ); return fData[index].fRow; }
132 
133  private:
134  struct Data {
135  float fX;
136  float fY;
137  float fZ;
138  int fId;
139  int fRow;
140  };
141 
142  int fSlice; // the slice index this data belongs to
143  int fFirstRow; // see FirstRow()
144  int fLastRow; // see LastRow()
145  std::vector<int> fNumberOfClusters; // list of NumberOfClusters per row for NumberOfClusters(int)
146  std::vector<int> fRowOffset; // see RowOffset()
147  std::vector<Data> fData; // list of data of clusters
148 };
149 
151 
152 #endif // CLUSTERDATA_H
float Y(int index) const
int RowOffset(unsigned int rowIndex) const
int RowNumber(int index) const
int NumberOfClusters(unsigned int rowIndex) const
int Id(int index) const
float X(int index) const
void Merge(int index1, int index2)
AliHLTTPCCAClusterData(const AliHLTTPCCAGBHit *hits, int *offset, int numberOfClusters, int nRows8)
float Z(int index) const