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  public:
42  PndFTSCAClusterData(const PndFTSCAGBHit *hits, int *offset, int numberOfClusters) { readEvent(hits, offset, numberOfClusters); }
43 
45 
46  void readEvent(const PndFTSArray<PndFTSSpacePointData *> &clusters, int numberOfClusters, double ClusterZCut);
47  void readEvent(const PndFTSCAGBHit *hits, int *offset, int numberOfClusters);
48 
52  void Merge(int index1, int index2);
53 
57  // void Split( int index, /* TODO: need some parameters how to split */ );
58 
59  // TODO: some access to history of merges and splits
60 
64  int Slice() const { return fSlice; }
65 
69  int FirstRow() const { return fFirstRow; }
70 
74  int LastRow() const { return fLastRow; }
75 
79  int NumberOfClusters() const { return fData.size(); }
80 
84  int NumberOfClusters(unsigned int rowIndex) const { return rowIndex < fNumberOfClusters.size() ? fNumberOfClusters[rowIndex] : 0; }
85 
99  int RowOffset(unsigned int rowIndex) const { return rowIndex < fRowOffset.size() ? fRowOffset[rowIndex] : fData.size(); }
100 
104  float X(int index) const
105  {
106  assert(index < static_cast<int>(fData.size()));
107  return fData[index].fX;
108  }
109 
113  float Y(int index) const
114  {
115  assert(index < static_cast<int>(fData.size()));
116  return fData[index].fY;
117  }
118 
122  float Z(int index) const
123  {
124  assert(index < static_cast<int>(fData.size()));
125  return fData[index].fZ;
126  }
127 
131  int Id(int index) const
132  {
133  assert(index < static_cast<int>(fData.size()));
134  return fData[index].fId;
135  }
136 
140  int RowNumber(int index) const
141  {
142  assert(index < static_cast<int>(fData.size()));
143  return fData[index].fRow;
144  }
145 
146  private:
147  struct Data {
148  float fX;
149  float fY;
150  float fZ;
151  int fId;
152  int fRow;
153  };
154 
155  int fSlice; // the slice index this data belongs to
156  int fFirstRow; // see FirstRow()
157  int fLastRow; // see LastRow()
158  std::vector<int> fNumberOfClusters; // list of NumberOfClusters per row for NumberOfClusters(int)
159  std::vector<int> fRowOffset; // see RowOffset()
160  std::vector<Data> fData; // list of data of clusters
161 };
162 
164 
165 #endif // CLUSTERDATA_H
PndFTSCAClusterData(const PndFTSCAGBHit *hits, int *offset, int numberOfClusters)
int RowNumber(int index) const
float Y(int index) const
int NumberOfClusters(unsigned int rowIndex) const
PndFTSCAClusterData ClusterData
void Merge(int index1, int index2)
void readEvent(const PndFTSArray< PndFTSSpacePointData *> &clusters, int numberOfClusters, double ClusterZCut)
float X(int index) const
int Id(int index) const
int RowOffset(unsigned int rowIndex) const
float Z(int index) const