]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/hough/AliHLTHough.h
New version of SPD raw-data reconstruction. The format now correponds to the actual...
[u/mrichter/AliRoot.git] / HLT / hough / AliHLTHough.h
1 // @(#) $Id$
2
3 #ifndef ALIL3HOUGH_H
4 #define ALIL3HOUGH_H
5
6 #include "AliHLTRootTypes.h"
7
8 class AliHLTHoughMaxFinder;
9 class AliHLTHoughBaseTransformer;
10 class AliHLTHistogram;
11 class AliHLTMemHandler;
12 class AliHLTFileHandler;
13 class AliHLTHoughEval;
14 class AliHLTTrackArray;
15 class AliHLTHoughMerger;
16 class AliHLTHoughIntMerger;
17 class AliHLTHoughGlobalMerger;
18 class AliHLTBenchmark;
19
20 #include "TThread.h"
21 #ifdef use_newio
22 #include <AliRunLoader.h>
23 #include <../RAW/AliRawEvent.h>
24 #endif
25 #ifdef use_aliroot
26 #include <AliESD.h>
27 #include <AliESDHLTtrack.h>
28 #endif
29
30 class AliHLTHough {
31  public:
32   
33   AliHLTHough(); 
34   AliHLTHough(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);
35   virtual ~AliHLTHough();
36
37 #ifdef use_newio  
38   void SetRunLoader(AliRunLoader *runloader) {fRunLoader = runloader;}
39 #endif
40
41   void Init(Int_t netasegments,Int_t tv,AliRawEvent *rawevent,Float_t zvertex=0.0);
42   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);
43   void Init(Bool_t doit=kFALSE, Bool_t addhists=kFALSE);
44
45   void Process(Int_t minslice,Int_t maxslice);
46   void ReadData(Int_t slice,Int_t eventnr=0);
47   void Transform(Int_t *rowrange = 0);
48   void ProcessSliceIter();
49   void ProcessPatchIter(Int_t patch);
50   void MergePatches();
51   void MergeInternally();
52   void MergeEtaSlices();
53
54   void FindTrackCandidates();
55   void FindTrackCandidatesRow();
56   void AddAllHistograms();
57   void AddAllHistogramsRows();
58   void PrepareForNextPatch(Int_t nextpatch);
59   Int_t Evaluate(Int_t roadwidth=1,Int_t nrowstomiss=1);
60   void EvaluatePatch(Int_t i,Int_t roadwidth,Int_t nrowstomiss);
61   void WriteTracks(Int_t slice,Char_t *path="./");
62   void WriteTracks(Char_t *path);
63 #ifdef use_aliroot
64   Int_t FillESD(AliESD *esd);
65 #endif
66   void WriteDigits(Char_t *outfile="output_digits.root");
67   void InitEvaluate();
68   void DoBench(Char_t *filename);
69   void AddTracks();
70   
71   //Setters
72   void SetNEtaSegments(Int_t i) {fNEtaSegments = i;}
73   void SetAddHistograms() {fAddHistograms = kTRUE;}
74   void DoIterative() {fDoIterative = kTRUE;}
75   void SetWriteDigits() {fWriteDigits = kTRUE;}
76   void SetTransformerParams(Float_t ptres=0,Float_t ptmin=0,Float_t ptmax=0,Int_t ny=0,Int_t patch=-1);
77   //{fPtRes=ptres;fNBinY=ny;fLowPt=ptmin;fUpperPt=ptmax;fPhi=psi;}
78   void SetTransformerParams(Int_t nx,Int_t ny,Float_t lpt,Int_t patch);
79   void CalcTransformerParams(Float_t lpt);
80   void SetTransformerParams(Int_t nx,Int_t ny,Float_t lpt,Float_t phi);
81   //{fNBinX=nx;fNBinY=ny;fLowPt=lpt;fPhi=phi;}
82   void SetThreshold(Int_t t=3,Int_t patch=-1);
83   void SetNSaveIterations(Int_t t=10) {fNSaveIterations=t;}
84   void SetPeakThreshold(Int_t threshold=0,Int_t patch=-1);
85   
86   void SetPeakParameters(Int_t kspread,Float_t pratio) {fKappaSpread=kspread; fPeakRatio=pratio;}
87   
88   //Getters
89   AliHLTHoughBaseTransformer *GetTransformer(Int_t i) {if(!fHoughTransformer[i]) return 0; return fHoughTransformer[i];}
90   AliHLTTrackArray *GetTracks(Int_t i) {if(!fTracks[i]) return 0; return fTracks[i];}
91   AliHLTHoughEval *GetEval(Int_t i) {if(!fEval[i]) return 0; return fEval[i];}
92   AliHLTHoughMerger *GetMerger() {if(!fMerger) return 0; return fMerger;}
93   AliHLTHoughIntMerger *GetInterMerger() {if(!fInterMerger) return 0; return fInterMerger;}
94   AliHLTMemHandler *GetMemHandler(Int_t i) {if(!fMemHandler[i]) return 0; return fMemHandler[i];}
95   AliHLTHoughMaxFinder *GetMaxFinder() {return fPeakFinder;}
96
97   //Special methods for executing Hough Transform as a thread
98   static void *ProcessInThread(void *args);
99   void StartProcessInThread(Int_t minslice,Int_t maxslice);
100   Int_t WaitForThreadFinish();
101   void SetMinMaxSlices(Int_t minslice,Int_t maxslice) {fMinSlice = minslice; fMaxSlice = maxslice;} 
102   Int_t GetMinSlice() {return fMinSlice;}
103   Int_t GetMaxSlice() {return fMaxSlice;}
104   
105  private:
106   Char_t *fInputFile;//!
107   Char_t *fInputPtr;//!
108   AliRawEvent *fRawEvent;//!
109   Char_t fPath[1024]; // Path to the files
110   Bool_t fBinary; // Is input binary
111   Bool_t fAddHistograms; // Add all patch histograms at the end or not
112   Bool_t fDoIterative; // Iterative or not
113   Bool_t fWriteDigits; // Write Digits or not
114   Bool_t fUse8bits; // Use 8 bits or not
115   Int_t fNEtaSegments; // Number of eta slices
116   Int_t fNPatches; // Number of patches
117   Int_t fLastPatch; //The index of the last processed patch
118   Int_t fVersion; //which HoughTransformer to use
119   Int_t fCurrentSlice; // Current TPC slice (sector)
120   Int_t fEvent; // Current event number
121
122   Int_t fPeakThreshold[6]; // Threshold for the peak finder
123   Float_t fLowPt[6]; // Lower limit on Pt
124   Float_t fUpperPt[6]; // Upper limit on Pt
125   Float_t fPtRes[6]; // Desired Pt resolution
126   Float_t fPhi[6]; // Limit on the emission angle
127   Int_t fNBinX[6]; // Number of bins in the Hough space
128   Int_t fNBinY[6]; // Number of bins in the Hough space
129   Int_t fThreshold[6]; // Threshold for digits
130   Int_t fNSaveIterations; //for HoughtransformerVhdl
131   
132   //parameters for the peak finder:
133   Int_t fKappaSpread; // Kappa spread
134   Float_t fPeakRatio; // Peak ratio
135
136   Float_t fZVertex; // Z position of the primary vertex
137
138   Int_t fMinSlice; // First TPC slice (sector) to process while running in a thread
139   Int_t fMaxSlice; // Last TPC slice (sector) to process while running in a thread
140
141   AliHLTMemHandler **fMemHandler; //!
142   AliHLTHoughBaseTransformer **fHoughTransformer; //!
143   AliHLTHoughEval **fEval; //!
144   AliHLTHoughMaxFinder *fPeakFinder; //!
145   AliHLTTrackArray **fTracks; //!
146   AliHLTTrackArray *fGlobalTracks; //!
147   AliHLTHoughMerger *fMerger; //!
148   AliHLTHoughIntMerger *fInterMerger; //!
149   AliHLTHoughGlobalMerger *fGlobalMerger; //!
150   AliHLTBenchmark *fBenchmark; //!
151
152 #ifdef use_newio
153   AliRunLoader *fRunLoader; // Run Loader
154 #endif
155
156   void CleanUp();
157   Double_t GetCpuTime();
158
159   TThread *fThread; // Pointer to the TThread object in case of running in a thread
160
161   ClassDef(AliHLTHough,1) //Hough transform base class
162 };
163
164 typedef AliHLTHough AliL3Hough; // for backward comaptibility
165
166 #endif
167
168
169
170
171
172
173