]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/TPCLib/AliHLTTPCClusterFinder.h
fix missing initialization of reconstructor for tracks in HLT (Kostya)
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCClusterFinder.h
CommitLineData
a38a7850 1// @(#) $Id$
4aa41877 2// Original: AliHLTClustFinderNew.h,v 1.13 2004/06/18 10:55:26 loizides
a38a7850 3
01f43166 4#ifndef AliHLTTPC_CLUSTERFINDER
5#define AliHLTTPC_CLUSTERFINDER
297174de 6//* This file is property of and copyright by the ALICE HLT Project *
7//* ALICE Experiment at CERN, All rights reserved. *
8//* See cxx source for full Copyright notice *
a38a7850 9
01f43166 10/** @file AliHLTTPCClusterFinder.h
297174de 11 @author Anders Vestbo, Constantin Loizides
01f43166 12 Kenneth Aamodt kenneth.aamodt@student.uib.no
01f43166 13 @brief Cluster Finder for the TPC
14*/
15
01f43166 16#include "AliHLTLogging.h"
297174de 17#include <vector>
6b15c309 18#include "AliHLTTPCTransform.h"
297174de 19
20class AliHLTTPCPad;
a38a7850 21class AliHLTTPCSpacePointData;
22class AliHLTTPCDigitReader;
297174de 23class AliHLTTPCClusters;
a38a7850 24
297174de 25/**
26 * @class AliHLTTPCClusterFinder
27 *
28 * The current cluster finder for HLT
29 * (Based on STAR L3)
30 *
31 * Basically we have two versions for the cluster finder now.
32 * The default version, reads the data pad by pad, and find the
33 * clusters as it reads the data. The other version has now been
34 * developed to cope with unsorted data. New methods for the unsorted
35 * version can be found at the end of the default one i the source file.
36 * Currently the new version is only build to manage zero-suppressed data.
37 * More functionality will be added later.
38 *
39 * The cluster finder is initialized with the Init function,
40 * providing the slice and patch information to work on.
41 *
42 * The input is a provided by the AliHLTTPCDigitReader class,
43 * using the init() funktion, and the next() funktion in order
44 * to get the next bin. Either packed or unpacked data can be
45 * processed, dependent if one uses AliHLTTPCDigitReaderPacked
46 * class or AliHLTTPCDigitReaderUnpacked class in the
47 * Clusterfinder Component.
48 * The resulting space points will be in the
49 * array given by the SetOutputArray function.
50 *
51 * There are several setters which control the behaviour:
52 *
53 * - SetXYError(Float_t): set fixed error in XY direction
54 * - SetZError(Float_t): set fixed error in Z direction
55 * (used if errors are not calculated)
56 * - SetDeconv(Bool_t): switch on/off deconvolution
57 * - SetThreshold(UInt_t): set charge threshold for cluster
58 * - SetMatchWidth(UInt_t): set the match distance in
59 * time for sequences to be merged
60 * - SetSTDOutput(Bool_t): switch on/off output about found clusters
61 * - SetCalcErr(Bool_t): switch on/off calculation of
62 * space point errors (or widths in raw system)
63 * - SetRawSP(Bool_t): switch on/off convertion to raw system
64 *
65 *
66 * Example Usage:
67 *
68 * <pre>
69 * AliHLTTPCFileHandler *file = new AliHLTTPCFileHandler();
70 * file->SetAliInput(digitfile); //give some input file
71 * for(int slice=0; slice<=35; slice++){
72 * for(int patch=0; pat<6; pat++){
73 * file->Init(slice,patch);
74 * UInt_t ndigits=0;
75 * UInt_t maxclusters=100000;
76 * UInt_t pointsize = maxclusters*sizeof(AliHLTTPCSpacePointData);
77 * AliHLTTPCSpacePointData *points = (AliHLTTPCSpacePointData*)memory->Allocate(pointsize);
78 * AliHLTTPCDigitRowData *digits = (AliHLTTPCDigitRowData*)file->AliAltroDigits2Memory(ndigits,event);
79 * AliHLTTPCClusterFinder *cf = new AliHLTTPCClusterFinder();
80 * cf->SetMatchWidth(2);
81 * cf->InitSlice( slice, patch, row[0], row[1], maxPoints );
82 * cf->SetSTDOutput(kTRUE); //Some output to standard IO
83 * cf->SetRawSP(kFALSE); //Convert space points to local system
84 * cf->SetThreshold(5); //Threshold of cluster charge
85 * cf->SetDeconv(kTRUE); //Deconv in pad and time direction
86 * cf->SetCalcErr(kTRUE); //Calculate the errors of the spacepoints
87 * cf->SetOutputArray(points); //Move the spacepoints to the array
88 * cf->Read(iter->fPtr, iter->fSize ); //give the data to the cf
89 * cf->ProcessDigits(); //process the rows given by init
90 * Int_t npoints = cf->GetNumberOfClusters();
91 * AliHLTTPCMemHandler *out= new AliHLTTPCMemHandler();
92 * out->SetBinaryOutput(fname);
93 * out->Memory2Binary(npoints,points); //store the spacepoints
94 * out->CloseBinaryOutput();
95 * delete out;
96 * file->free();
97 * delete cf;
98 * }
99 * }
100 * </pre>
101 * @ingroup alihlt_tpc
102 */
46b33a24 103class AliHLTTPCClusterFinder : public AliHLTLogging {
a38a7850 104
105 public:
106 struct AliClusterData
107 {
108 UInt_t fTotalCharge; //tot charge of cluster
109 UInt_t fPad; //pad value
110 UInt_t fTime; //time value
111 ULong64_t fPad2; //for error in XY direction
112 ULong64_t fTime2; //for error in Z direction
113 UInt_t fMean; //mean in time
114 UInt_t fFlags; //different flags
115 UInt_t fChargeFalling; //for deconvolution
116 UInt_t fLastCharge; //for deconvolution
117 UInt_t fLastMergedPad; //dont merge twice per pad
d8b2f74a 118 Int_t fRow; //row value
6b15c309 119 UInt_t fQMax; //qmax
a38a7850 120 };
121 typedef struct AliClusterData AliClusterData; //!
122
8f8bf0af 123 /** standard constructor */
124 AliHLTTPCClusterFinder();
125 /** destructor */
126 virtual ~AliHLTTPCClusterFinder();
127
128 void Read(void* ptr,unsigned long size);
129
130 void InitSlice(Int_t slice,Int_t patch,Int_t firstrow, Int_t lastrow,Int_t maxpoints);
131 void InitSlice(Int_t slice,Int_t patch,Int_t maxpoints);
132 void ProcessDigits();
133
134 void SetOutputArray(AliHLTTPCSpacePointData *pt);
135 void WriteClusters(Int_t n_clusters,AliClusterData *list);
8252a538 136 void PrintClusters();
8f8bf0af 137 void SetXYError(Float_t f) {fXYErr=f;}
138 void SetZError(Float_t f) {fZErr=f;}
139 void SetDeconv(Bool_t f) {fDeconvPad=f; fDeconvTime=f;}
6b15c309 140 void SetDeconvPad(Bool_t f) {fDeconvPad=f;}
141 void SetDeconvTime(Bool_t f) {fDeconvTime=f;}
8f8bf0af 142 void SetThreshold(UInt_t i) {fThreshold=i;}
143 void SetOccupancyLimit(Float_t f) {fOccupancyLimit=f;}
8f8bf0af 144 void SetMatchWidth(UInt_t i) {fMatch=i;}
145 void SetSTDOutput(Bool_t f=kFALSE) {fStdout=f;}
146 void SetCalcErr(Bool_t f=kTRUE) {fCalcerr=f;}
147 void SetRawSP(Bool_t f=kFALSE) {fRawSP=f;}
148 void SetReader(AliHLTTPCDigitReader* f){fDigitReader = f;}
149 Int_t GetNumberOfClusters() const {return fNClusters;}
150
151 //----------------------------------Methods for the new unsorted way of reading data ----------
a74855c2 152 void ReadDataUnsorted(void* ptr,unsigned long size);
6b15c309 153 void ReadDataUnsortedDeconvoluteTime(void* ptr,unsigned long size);
8f8bf0af 154 void FindClusters();
155 void WriteClusters(Int_t nclusters,AliHLTTPCClusters *list);
aff6e981 156 void SetUnsorted(Int_t unsorted){fUnsorted=unsorted;}
8252a538 157 void SetPatch(Int_t patch){fCurrentPatch=patch;}
158 void InitializePadArray();
159 Int_t DeInitializePadArray();
160 Bool_t ComparePads(AliHLTTPCPad *nextPad,AliHLTTPCClusters* candidate,Int_t nextPadToRead);
2fdb1ae7 161
162 void SetDoPadSelection(Bool_t input){fDoPadSelection=input;}
163
164 Int_t FillHWAddressList(AliHLTUInt16_t *hwaddlist, Int_t maxHWAddress);
6b15c309 165
166 void UpdateLastTimeBin(){fLastTimeBin=AliHLTTPCTransform::GetNTimeBins();}
167
168 void SetLastTimeBin(Int_t ltb){fLastTimeBin=ltb;}
169
170 void SetFirstTimeBin(Int_t ftb){fFirstTimeBin=ftb;}
2fdb1ae7 171
172 vector<AliHLTUInt16_t> fClustersHWAddressVector; //! transient
173
174 typedef vector<AliHLTTPCPad*> AliHLTTPCPadVector;
175
176 vector<AliHLTTPCPadVector> fRowPadVector; //! transient
177
98034d0d 178 protected:
8f8bf0af 179 /** copy constructor prohibited */
180 AliHLTTPCClusterFinder(const AliHLTTPCClusterFinder&);
181 /** assignment operator prohibited */
182 AliHLTTPCClusterFinder& operator=(const AliHLTTPCClusterFinder&);
183
2a083ac4 184 AliHLTTPCSpacePointData *fSpacePointData; //! array of space points
185 AliHLTTPCDigitReader *fDigitReader; //! reader instance
a38a7850 186
2a083ac4 187 UChar_t* fPtr; //! pointer to packed block
a38a7850 188 unsigned long fSize; //packed block size
6b15c309 189 Bool_t fDeconvTime; //deconv in time direction
a38a7850 190 Bool_t fDeconvPad; //deconv in pad direction
191 Bool_t fStdout; //have print out in write clusters
192 Bool_t fCalcerr; //calculate centroid sigmas
193 Bool_t fRawSP; //store centroids in raw system
194
195
196 Int_t fFirstRow; //first row
197 Int_t fLastRow; //last row
198 Int_t fCurrentRow; //current active row
199 Int_t fCurrentSlice; //current slice
200 Int_t fCurrentPatch; //current patch
201 Int_t fMatch; //size of match
202 UInt_t fThreshold; //threshold for clusters
203 Int_t fNClusters; //number of found clusters
204 Int_t fMaxNClusters; //max. number of clusters
205 Float_t fXYErr; //fixed error in XY
206 Float_t fZErr; //fixed error in Z
5235c3e9 207
208 Float_t fOccupancyLimit; // Occupancy Limit
209
aff6e981 210 Int_t fUnsorted; // enable for processing of unsorted digit data
8252a538 211 Bool_t fVectorInitialized;
212
8252a538 213 vector<AliHLTTPCClusters> fClusters; //! transient
214
215 UInt_t* fNumberOfPadsInRow; //! transient
216
217 UInt_t fNumberOfRows; //! transient
218
2fdb1ae7 219 UInt_t fRowOfFirstCandidate; //! transient
220
221 Bool_t fDoPadSelection; //! transient
a38a7850 222
6b15c309 223 Int_t fFirstTimeBin; //! transient
224
225 Int_t fLastTimeBin; //! transient
226
227 UInt_t fTotalChargeOfPreviousClusterCandidate; //! transient
228
229 Bool_t fChargeOfCandidatesFalling; //! transient
230
64defa03 231
a38a7850 232#ifdef do_mc
233 void GetTrackID(Int_t pad,Int_t time,Int_t *trackID);
234#endif
235
6b15c309 236 ClassDef(AliHLTTPCClusterFinder,6) //Fast cluster finder
a38a7850 237};
238#endif