FairRoot/PandaRoot
Classes | Public Member Functions | Private Attributes | List of all members
PndFTSCAClusterData Class Reference

#include <PndFTSCAClusterData.h>

Classes

struct  Data
 

Public Member Functions

 PndFTSCAClusterData (const PndFTSCAGBHit *hits, int *offset, int numberOfClusters)
 
 PndFTSCAClusterData ()
 
void readEvent (const PndFTSArray< PndFTSSpacePointData * > &clusters, int numberOfClusters, double ClusterZCut)
 
void readEvent (const PndFTSCAGBHit *hits, int *offset, int numberOfClusters)
 
void Merge (int index1, int index2)
 
int Slice () const
 
int FirstRow () const
 
int LastRow () const
 
int NumberOfClusters () const
 
int NumberOfClusters (unsigned int rowIndex) const
 
int RowOffset (unsigned int rowIndex) const
 
float X (int index) const
 
float Y (int index) const
 
float Z (int index) const
 
int Id (int index) const
 
int RowNumber (int index) const
 

Private Attributes

int fSlice
 
int fFirstRow
 
int fLastRow
 
std::vector< int > fNumberOfClusters
 
std::vector< int > fRowOffset
 
std::vector< DatafData
 

Detailed Description

Cluster data which keeps history about changes

The algorithm doesn't work on this data. Instead the PndFTSCASliceData is created from this.

Definition at line 37 of file PndFTSCAClusterData.h.

Constructor & Destructor Documentation

PndFTSCAClusterData::PndFTSCAClusterData ( const PndFTSCAGBHit hits,
int *  offset,
int  numberOfClusters 
)
inline

Construct PndFTSCAClusterData object from GBHit array.

Definition at line 44 of file PndFTSCAClusterData.h.

References readEvent().

44  {
45  readEvent( hits, offset, numberOfClusters );
46  }
TVector3 offset(2, 0, 0)
void readEvent(const PndFTSArray< PndFTSSpacePointData * > &clusters, int numberOfClusters, double ClusterZCut)
PndFTSCAClusterData::PndFTSCAClusterData ( )
inline

Definition at line 48 of file PndFTSCAClusterData.h.

48 {}

Member Function Documentation

int PndFTSCAClusterData::FirstRow ( ) const
inline

The first row index that contains a cluster.

Definition at line 74 of file PndFTSCAClusterData.h.

References fFirstRow.

74 { return fFirstRow; }
int PndFTSCAClusterData::Id ( int  index) const
inline

Return the global ID of the given cluster.

Definition at line 124 of file PndFTSCAClusterData.h.

References fData.

124 { assert( index < static_cast<int>( fData.size() ) ); return fData[index].fId; }
std::vector< Data > fData
int PndFTSCAClusterData::LastRow ( ) const
inline

The last row index that contains a cluster.

Definition at line 79 of file PndFTSCAClusterData.h.

References fLastRow.

79 { return fLastRow; }
void PndFTSCAClusterData::Merge ( int  index1,
int  index2 
)

"remove" two clusters and "add" a new one, keeping history.

int PndFTSCAClusterData::NumberOfClusters ( ) const
inline

Return the number of clusters in this slice.

Definition at line 84 of file PndFTSCAClusterData.h.

References fData.

84 { return fData.size(); }
std::vector< Data > fData
int PndFTSCAClusterData::NumberOfClusters ( unsigned int  rowIndex) const
inline

Return the number of clusters in the given row, for this slice.

Definition at line 89 of file PndFTSCAClusterData.h.

References fNumberOfClusters.

89 { return rowIndex < fNumberOfClusters.size() ? fNumberOfClusters[rowIndex] : 0; }
std::vector< int > fNumberOfClusters
void PndFTSCAClusterData::readEvent ( const PndFTSArray< PndFTSSpacePointData * > &  clusters,
int  numberOfClusters,
double  ClusterZCut 
)

Referenced by PndFTSCAClusterData().

void PndFTSCAClusterData::readEvent ( const PndFTSCAGBHit hits,
int *  offset,
int  numberOfClusters 
)

Definition at line 24 of file PndFTSCAClusterData.cxx.

References d, fData, fFirstRow, fLastRow, fNumberOfClusters, fRowOffset, fSlice, hit, i, PndFTSCAGBHit::IRow(), CAMath::Min(), offset(), and row.

25 {
26  fNumberOfClusters.reserve( PndFTSCAParameters::NumberOfRows2 );
27  fRowOffset.reserve( PndFTSCAParameters::NumberOfRows2 );
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
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 PndFTSTPCCAGBHit &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 }
int row
Definition: anaLmdDigi.C:67
std::vector< Data > fData
std::vector< int > fRowOffset
TObjArray * d
Int_t i
Definition: run_full.C:25
int IRow() const
Definition: PndFTSCAGBHit.h:56
TVector3 offset(2, 0, 0)
static T Min(const T &x, const T &y)
Definition: PndCAMath.h:35
std::vector< int > fNumberOfClusters
PndSdsMCPoint * hit
Definition: anasim.C:70
int PndFTSCAClusterData::RowNumber ( int  index) const
inline

Return the row number/index of the given cluster.

Definition at line 129 of file PndFTSCAClusterData.h.

References fData.

129 { assert( index < static_cast<int>( fData.size() ) ); return fData[index].fRow; }
std::vector< Data > fData
int PndFTSCAClusterData::RowOffset ( unsigned int  rowIndex) const
inline

Return the index of the first cluster in the given row.

Supports calls with rowIndex greater than the available number of rows. In that case it returns NumberOfClusters.

To iterate over the clusters in one row do:

* const int lastClusterIndex = cd.RowOffset( rowIndex + 1 );
* for ( int hitIndex = cd.RowOffset( rowIndex ); hitIndex < lastClusterIndex; ++hitIndex )
*

Definition at line 104 of file PndFTSCAClusterData.h.

References fData, and fRowOffset.

104 { return rowIndex < fRowOffset.size() ? fRowOffset[rowIndex] : fData.size(); }
std::vector< Data > fData
std::vector< int > fRowOffset
int PndFTSCAClusterData::Slice ( ) const
inline

"remove" one cluster and "add" two new ones, keeping history. The slice index this data belongs to

Definition at line 69 of file PndFTSCAClusterData.h.

References fSlice.

69 { return fSlice; }
float PndFTSCAClusterData::X ( int  index) const
inline

Return the x coordinate of the given cluster.

Definition at line 109 of file PndFTSCAClusterData.h.

References fData.

109 { assert( index < static_cast<int>( fData.size() ) ); return fData[index].fX; }
std::vector< Data > fData
float PndFTSCAClusterData::Y ( int  index) const
inline

Return the y coordinate of the given cluster.

Definition at line 114 of file PndFTSCAClusterData.h.

References fData.

114 { assert( index < static_cast<int>( fData.size() ) ); return fData[index].fY; }
std::vector< Data > fData
float PndFTSCAClusterData::Z ( int  index) const
inline

Return the z coordinate of the given cluster.

Definition at line 119 of file PndFTSCAClusterData.h.

References fData.

119 { assert( index < static_cast<int>( fData.size() ) ); return fData[index].fZ; }
std::vector< Data > fData

Member Data Documentation

std::vector<Data> PndFTSCAClusterData::fData
private

Definition at line 145 of file PndFTSCAClusterData.h.

Referenced by Id(), NumberOfClusters(), readEvent(), RowNumber(), RowOffset(), X(), Y(), and Z().

int PndFTSCAClusterData::fFirstRow
private

Definition at line 141 of file PndFTSCAClusterData.h.

Referenced by FirstRow(), and readEvent().

int PndFTSCAClusterData::fLastRow
private

Definition at line 142 of file PndFTSCAClusterData.h.

Referenced by LastRow(), and readEvent().

std::vector<int> PndFTSCAClusterData::fNumberOfClusters
private

Definition at line 143 of file PndFTSCAClusterData.h.

Referenced by NumberOfClusters(), and readEvent().

std::vector<int> PndFTSCAClusterData::fRowOffset
private

Definition at line 144 of file PndFTSCAClusterData.h.

Referenced by readEvent(), and RowOffset().

int PndFTSCAClusterData::fSlice
private

Definition at line 140 of file PndFTSCAClusterData.h.

Referenced by readEvent(), and Slice().


The documentation for this class was generated from the following files: