FairRoot/PandaRoot
PndFTSCAClusterData.h
Go to the documentation of this file.
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 "PndFTSCAGBHit.h"
26 #include "PndFTSArray.h"
27 
28 #include "PndFTSCAParameters.h"
29 
30 class PndFTSSpacePointData;
31 
38 {
39  public:
40 
44  PndFTSCAClusterData( const PndFTSCAGBHit *hits, int *offset, int numberOfClusters ) {
45  readEvent( hits, offset, numberOfClusters );
46  }
47 
49 
50  void readEvent( const PndFTSArray<PndFTSSpacePointData *> &clusters,
51  int numberOfClusters, double ClusterZCut );
52  void readEvent( const PndFTSCAGBHit *hits, int *offset, int numberOfClusters );
53 
57  void Merge( int index1, int index2 );
58 
62  //void Split( int index, /* TODO: need some parameters how to split */ );
63 
64  // TODO: some access to history of merges and splits
65 
69  int Slice() const { return fSlice; }
70 
74  int FirstRow() const { return fFirstRow; }
75 
79  int LastRow() const { return fLastRow; }
80 
84  int NumberOfClusters() const { return fData.size(); }
85 
89  int NumberOfClusters( unsigned int rowIndex ) const { return rowIndex < fNumberOfClusters.size() ? fNumberOfClusters[rowIndex] : 0; }
90 
104  int RowOffset( unsigned int rowIndex ) const { return rowIndex < fRowOffset.size() ? fRowOffset[rowIndex] : fData.size(); }
105 
109  float X( int index ) const { assert( index < static_cast<int>( fData.size() ) ); return fData[index].fX; }
110 
114  float Y( int index ) const { assert( index < static_cast<int>( fData.size() ) ); return fData[index].fY; }
115 
119  float Z( int index ) const { assert( index < static_cast<int>( fData.size() ) ); return fData[index].fZ; }
120 
124  int Id( int index ) const { assert( index < static_cast<int>( fData.size() ) ); return fData[index].fId; }
125 
129  int RowNumber( int index ) const { assert( index < static_cast<int>( fData.size() ) ); return fData[index].fRow; }
130 
131  private:
132  struct Data {
133  float fX;
134  float fY;
135  float fZ;
136  int fId;
137  int fRow;
138  };
139 
140  int fSlice; // the slice index this data belongs to
141  int fFirstRow; // see FirstRow()
142  int fLastRow; // see LastRow()
143  std::vector<int> fNumberOfClusters; // list of NumberOfClusters per row for NumberOfClusters(int)
144  std::vector<int> fRowOffset; // see RowOffset()
145  std::vector<Data> fData; // list of data of clusters
146 };
147 
149 
150 #endif // CLUSTERDATA_H
std::vector< Data > fData
int NumberOfClusters(unsigned int rowIndex) const
std::vector< int > fRowOffset
PndFTSCAClusterData(const PndFTSCAGBHit *hits, int *offset, int numberOfClusters)
int Id(int index) const
int NumberOfClusters() const
TVector3 offset(2, 0, 0)
void readEvent(const PndFTSArray< PndFTSSpacePointData * > &clusters, int numberOfClusters, double ClusterZCut)
PndFTSCAClusterData ClusterData
void Merge(int index1, int index2)
float Y(int index) const
float X(int index) const
std::vector< int > fNumberOfClusters
float Z(int index) const
int RowNumber(int index) const
CbmHit * hits[nHits]
Definition: RiemannTest.C:19
int RowOffset(unsigned int rowIndex) const