3 // origin hough/AliL3Hough.h,v 1.31 Fri Feb 25 07:32:13 2005 UTC by cvetan
5 #ifndef ALIHLTTPCHOUGH_H
6 #define ALIHLTTPCHOUGH_H
8 //* This file is property of and copyright by the ALICE HLT Project *
9 //* ALICE Experiment at CERN, All rights reserved. *
10 //* See cxx source for full Copyright notice *
12 /** @file AliHLTTPCHough.h
13 @author Anders Vestbo, Cvetan Cheshkov
15 @brief Steering for HLT TPC hough transform tracking algorithms. */
17 #include "AliHLTTPCRootTypes.h"
19 class AliHLTTPCHoughMaxFinder;
20 class AliHLTTPCHoughTransformer;
21 class AliHLTTPCHistogram;
22 class AliHLTTPCMemHandler;
23 class AliHLTTPCFileHandler;
24 class AliHLTTPCHoughEval;
25 class AliHLTTPCTrackArray;
26 class AliHLTTPCHoughMerger;
27 class AliHLTTPCHoughIntMerger;
28 class AliHLTTPCHoughGlobalMerger;
29 class AliHLTTPCBenchmark;
40 * @class AliHLTTPCHough
41 * Interface class for the HLT TPC Hough transform tracking algorithms
45 * AliHLTTPCHough *hough = new AliHLTTPCHough(path,kTRUE,NumberOfEtaSegments);
46 * hough->ReadData(slice);
48 * hough->FindTrackCandidates();
50 * AliHLTTPCTrackArray *tracks = hough->GetTracks(patch);
54 class AliHLTTPCHough {
58 AliHLTTPCHough(Char_t *path,Bool_t binary,Int_t netasegments=100,Bool_t bit8=kFALSE,Int_t tv=0,Char_t *infile=0,Char_t *ptr=0);
59 virtual ~AliHLTTPCHough();
61 void SetRunLoader(AliRunLoader *runloader) {fRunLoader = runloader;}
63 void Init(Int_t netasegments,Int_t tv,AliRawEvent *rawevent,Float_t zvertex=0.0);
64 void Init(Char_t *path,Bool_t binary,Int_t netasegments=100,Bool_t bit8=kFALSE,Int_t tv=0,Char_t *infile=0,Char_t *ptr=0,Float_t zvertex=0.0);
65 void Init(Bool_t doit=kFALSE, Bool_t addhists=kFALSE);
67 void Process(Int_t minslice,Int_t maxslice);
68 void ReadData(Int_t slice,Int_t eventnr=0);
69 void Transform(Int_t *rowrange = 0);
70 void ProcessSliceIter();
71 void ProcessPatchIter(Int_t patch);
73 void MergeInternally();
74 void MergeEtaSlices();
76 void FindTrackCandidates();
77 void FindTrackCandidatesRow();
78 void AddAllHistograms();
79 void AddAllHistogramsRows();
80 void PrepareForNextPatch(Int_t nextpatch);
81 Int_t Evaluate(Int_t roadwidth=1,Int_t nrowstomiss=1);
82 void EvaluatePatch(Int_t i,Int_t roadwidth,Int_t nrowstomiss);
83 void WriteTracks(Int_t slice,Char_t *path="./");
84 void WriteTracks(Char_t *path);
85 Int_t FillESD(AliESDEvent *esd);
86 void WriteDigits(Char_t *outfile="output_digits.root");
88 void DoBench(Char_t *filename);
92 void SetNEtaSegments(Int_t i) {fNEtaSegments = i;}
93 void SetAddHistograms() {fAddHistograms = kTRUE;}
94 void DoIterative() {fDoIterative = kTRUE;}
95 void SetWriteDigits() {fWriteDigits = kTRUE;}
96 void SetTransformerParams(Float_t ptres=0,Float_t ptmin=0,Float_t ptmax=0,Int_t ny=0,Int_t patch=-1);
97 //{fPtRes=ptres;fNBinY=ny;fLowPt=ptmin;fUpperPt=ptmax;fPhi=psi;}
98 void SetTransformerParams(Int_t nx,Int_t ny,Float_t lpt,Int_t patch);
99 void CalcTransformerParams(Float_t lpt);
100 void SetTransformerParams(Int_t nx,Int_t ny,Float_t lpt,Float_t phi);
101 //{fNBinX=nx;fNBinY=ny;fLowPt=lpt;fPhi=phi;}
102 void SetThreshold(Int_t t=3,Int_t patch=-1);
103 void SetNSaveIterations(Int_t t=10) {fNSaveIterations=t;}
104 void SetPeakThreshold(Int_t threshold=0,Int_t patch=-1);
106 void SetPeakParameters(Int_t kspread,Float_t pratio) {fKappaSpread=kspread; fPeakRatio=pratio;}
109 AliHLTTPCHoughTransformer *GetTransformer(Int_t i) const {if(!fHoughTransformer[i]) return 0; return fHoughTransformer[i];}
110 AliHLTTPCTrackArray *GetTracks(Int_t i) const {if(!fTracks[i]) return 0; return fTracks[i];}
111 AliHLTTPCHoughEval *GetEval(Int_t i) const {if(!fEval[i]) return 0; return fEval[i];}
112 AliHLTTPCHoughMerger *GetMerger() const{if(!fMerger) return 0; return fMerger;}
113 AliHLTTPCHoughIntMerger *GetInterMerger() const {if(!fInterMerger) return 0; return fInterMerger;}
114 AliHLTTPCMemHandler *GetMemHandler(Int_t i) const {if(!fMemHandler[i]) return 0; return fMemHandler[i];}
115 AliHLTTPCHoughMaxFinder *GetMaxFinder() const {return fPeakFinder;}
117 //Special methods for executing Hough Transform as a thread
118 static void *ProcessInThread(void *args);
119 void StartProcessInThread(Int_t minslice,Int_t maxslice);
120 Int_t WaitForThreadFinish();
121 void SetMinMaxSlices(Int_t minslice,Int_t maxslice) {fMinSlice = minslice; fMaxSlice = maxslice;}
122 Int_t GetMinSlice() const {return fMinSlice;}
123 Int_t GetMaxSlice() const {return fMaxSlice;}
126 /// copy constructor not permitted
127 AliHLTTPCHough(const AliHLTTPCHough);
128 /// assignment operator not permitted
129 AliHLTTPCHough& operator=(const AliHLTTPCHough);
131 Char_t *fInputFile;//!
132 Char_t *fInputPtr;//!
133 AliRawEvent *fRawEvent;//!
134 Char_t fPath[1024]; // Path to the files
135 Bool_t fBinary; // Is input binary
136 Bool_t fAddHistograms; // Add all patch histograms at the end or not
137 Bool_t fDoIterative; // Iterative or not
138 Bool_t fWriteDigits; // Write Digits or not
139 Bool_t fUse8bits; // Use 8 bits or not
140 Int_t fNEtaSegments; // Number of eta slices
141 Int_t fNPatches; // Number of patches
142 Int_t fLastPatch; //The index of the last processed patch
143 Int_t fVersion; //which HoughTransformer to use
144 Int_t fCurrentSlice; // Current TPC slice (sector)
145 Int_t fEvent; // Current event number
147 Int_t fPeakThreshold[6]; // Threshold for the peak finder
148 Float_t fLowPt[6]; // Lower limit on Pt
149 Float_t fUpperPt[6]; // Upper limit on Pt
150 Float_t fPtRes[6]; // Desired Pt resolution
151 Float_t fPhi[6]; // Limit on the emission angle
152 Int_t fNBinX[6]; // Number of bins in the Hough space
153 Int_t fNBinY[6]; // Number of bins in the Hough space
154 Int_t fThreshold[6]; // Threshold for digits
155 Int_t fNSaveIterations; //for HoughtransformerVhdl
157 //parameters for the peak finder:
158 Int_t fKappaSpread; // Kappa spread
159 Float_t fPeakRatio; // Peak ratio
161 Float_t fZVertex; // Z position of the primary vertex
163 Int_t fMinSlice; // First TPC slice (sector) to process while running in a thread
164 Int_t fMaxSlice; // Last TPC slice (sector) to process while running in a thread
166 AliHLTTPCMemHandler **fMemHandler; //!
167 AliHLTTPCHoughTransformer **fHoughTransformer; //!
168 AliHLTTPCHoughEval **fEval; //!
169 AliHLTTPCHoughMaxFinder *fPeakFinder; //!
170 AliHLTTPCTrackArray **fTracks; //!
171 AliHLTTPCTrackArray *fGlobalTracks; //!
172 AliHLTTPCHoughMerger *fMerger; //!
173 AliHLTTPCHoughIntMerger *fInterMerger; //!
174 AliHLTTPCHoughGlobalMerger *fGlobalMerger; //!
175 AliHLTTPCBenchmark *fBenchmark; //!
177 AliRunLoader *fRunLoader; // Run Loader
180 Double_t GetCpuTime();
183 TThread *fThread; //! Pointer to the TThread object in case of running in a thread
184 #endif // HAVE_THREAD
186 ClassDef(AliHLTTPCHough,1) //Hough transform base class