PandaRoot
PndFTSCAClusterData.h
Go to the documentation of this file.
1 //****************************************************************************
2 //* This file is part of PandaRoot. *
3 //* *
4 //* PandaRoot is distributed under the terms of the *
5 //* GNU General Public License (GPL) version 3, *
6 //* copied verbatim in the file "LICENSE". *
7 //* *
8 //* Copyright (C) 2006 - 2024 FAIR GmbH and copyright holders of PandaRoot *
9 //* The copyright holders are listed in the file "COPYRIGHTHOLDERS". *
10 //* The authors are listed in the file "AUTHORS". *
11 //****************************************************************************
12 
13 /*
14  Copyright (C) 2009 Matthias Kretz <kretz@kde.org>
15 
16  This program is free software; you can redistribute it and/or
17  modify it under the terms of the GNU Library General Public
18  License as published by the Free Software Foundation; either
19  version 2 of the License, or (at your option) version 3.
20 
21  This library is distributed in the hope that it will be useful,
22  but WITHOUT ANY WARRANTY; without even the implied warranty of
23  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24  Library General Public License for more details.
25 
26  You should have received a copy of the GNU Library General Public License
27  along with this library; see the file COPYING.LIB. If not, write to
28  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
29  Boston, MA 02110-1301, USA.
30 
31 */
32 
33 #ifndef CLUSTERDATA_H
34 #define CLUSTERDATA_H
35 
36 #include <vector>
37 #include "PndFTSCAGBHit.h"
38 #include "PndFTSArray.h"
39 
40 #include "PndFTSCAParameters.h"
41 
42 class PndFTSSpacePointData;
43 
50  public:
54  PndFTSCAClusterData(const PndFTSCAGBHit *hits, int *offset, int numberOfClusters) { readEvent(hits, offset, numberOfClusters); }
55 
57 
58  void readEvent(const PndFTSArray<PndFTSSpacePointData *> &clusters, int numberOfClusters, double ClusterZCut);
59  void readEvent(const PndFTSCAGBHit *hits, int *offset, int numberOfClusters);
60 
64  void Merge(int index1, int index2);
65 
69  // void Split( int index, /* TODO: need some parameters how to split */ );
70 
71  // TODO: some access to history of merges and splits
72 
76  int Slice() const { return fSlice; }
77 
81  int FirstRow() const { return fFirstRow; }
82 
86  int LastRow() const { return fLastRow; }
87 
91  int NumberOfClusters() const { return fData.size(); }
92 
96  int NumberOfClusters(unsigned int rowIndex) const { return rowIndex < fNumberOfClusters.size() ? fNumberOfClusters[rowIndex] : 0; }
97 
111  int RowOffset(unsigned int rowIndex) const { return rowIndex < fRowOffset.size() ? fRowOffset[rowIndex] : fData.size(); }
112 
116  float X(int index) const
117  {
118  assert(index < static_cast<int>(fData.size()));
119  return fData[index].fX;
120  }
121 
125  float Y(int index) const
126  {
127  assert(index < static_cast<int>(fData.size()));
128  return fData[index].fY;
129  }
130 
134  float Z(int index) const
135  {
136  assert(index < static_cast<int>(fData.size()));
137  return fData[index].fZ;
138  }
139 
143  int Id(int index) const
144  {
145  assert(index < static_cast<int>(fData.size()));
146  return fData[index].fId;
147  }
148 
152  int RowNumber(int index) const
153  {
154  assert(index < static_cast<int>(fData.size()));
155  return fData[index].fRow;
156  }
157 
158  private:
159  struct Data {
160  float fX;
161  float fY;
162  float fZ;
163  int fId;
164  int fRow;
165  };
166 
167  int fSlice; // the slice index this data belongs to
168  int fFirstRow; // see FirstRow()
169  int fLastRow; // see LastRow()
170  std::vector<int> fNumberOfClusters; // list of NumberOfClusters per row for NumberOfClusters(int)
171  std::vector<int> fRowOffset; // see RowOffset()
172  std::vector<Data> fData; // list of data of clusters
173 };
174 
176 
177 #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