FairRoot/PandaRoot
PndFTSCAClusterData.cxx
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 #include "PndFTSCAClusterData.h"
22 #include "PndFTSTPCCAMath.h"
23 
24 void PndFTSCAClusterData::readEvent( const PndFTSCAGBHit *hits, int *offset, int numberOfClusters )
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)
void readEvent(const PndFTSArray< PndFTSSpacePointData * > &clusters, int numberOfClusters, double ClusterZCut)
static T Min(const T &x, const T &y)
Definition: PndCAMath.h:35
std::vector< int > fNumberOfClusters
PndSdsMCPoint * hit
Definition: anasim.C:70
CbmHit * hits[nHits]
Definition: RiemannTest.C:19