]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/TPCLib/tracking-ca/AliHLTTPCCAStandaloneFramework.h
Update master to aliroot
[u/mrichter/AliRoot.git] / HLT / TPCLib / tracking-ca / AliHLTTPCCAStandaloneFramework.h
1 //-*- Mode: C++ -*-
2 // ************************************************************************
3 // This file is property of and copyright by the ALICE HLT Project        *
4 // ALICE Experiment at CERN, All rights reserved.                         *
5 // See cxx source for full Copyright notice                               *
6 //                                                                        *
7 //*************************************************************************
8
9 #ifndef ALIHLTTPCCASTANDALONEFRAMEWORK_H
10 #define ALIHLTTPCCASTANDALONEFRAMEWORK_H
11
12 #include "AliHLTTPCCADef.h"
13 #if defined(HLTCA_STANDALONE) & defined(HLTCA_STANDALONE_OLD_MERGER)
14 #include "AliHLTTPCCAMerger.h"
15 #define AliHLTTPCGMMerger AliHLTTPCCAMerger
16 #else
17 #include "AliHLTTPCGMMerger.h"
18 #endif
19 #include "AliHLTTPCCAClusterData.h"
20 #include "AliHLTTPCCATrackerFramework.h"
21 #include <iostream>
22 #include <fstream>
23
24 /**
25  * @class AliHLTTPCCAStandaloneFramework
26  *
27  * The class to run the HLT TPC reconstruction (36 CA slice trackers + CA merger )
28  * in a stand-alone mode.
29  * Used by AliTPCtrackerCA, the CA event display, CA performance.
30  *
31  */
32 class AliHLTTPCCAStandaloneFramework
33 {
34 #ifdef HLTCA_STANDALONE
35         friend int DrawGLScene();
36 #endif
37
38   public:
39
40     AliHLTTPCCAStandaloneFramework();
41     ~AliHLTTPCCAStandaloneFramework();
42
43     static AliHLTTPCCAStandaloneFramework &Instance();
44
45         const AliHLTTPCCAParam &Param ( int iSlice ) const { return(fTracker.Param(iSlice)); }
46         const AliHLTTPCCARow &Row ( int iSlice, int iRow ) const { return(fTracker.Row(iSlice, iRow)); }
47     const AliHLTTPCCASliceOutput &Output( int iSlice ) const { return *fSliceOutput[iSlice]; }
48     AliHLTTPCGMMerger  &Merger()  { return fMerger; }
49     AliHLTTPCCAClusterData &ClusterData( int iSlice ) { return fClusterData[iSlice]; }
50
51     /**
52      * prepare for reading of the event
53      */
54     void StartDataReading( int guessForNumberOfClusters = 256 );
55
56     /**
57      *  read next cluster
58      */
59     void ReadCluster( int id, int iSlice, int iRow, float X, float Y, float Z, float Amp ) {
60       fClusterData[iSlice].ReadCluster( id, iRow, X, Y, Z, Amp );
61     }
62
63     /**
64      * finish reading of the event
65      */
66     void FinishDataReading();
67
68     /**
69      *  perform event reconstruction
70      */
71     int ProcessEvent(int forceSingleSlice = -1);
72
73
74     int NSlices() const { return fgkNSlices; }
75
76     double LastTime( int iTimer ) const { return fLastTime[iTimer]; }
77     double StatTime( int iTimer ) const { return fStatTime[iTimer]; }
78     int StatNEvents() const { return fStatNEvents; }
79
80     void WriteSettings( std::ostream &out ) const;
81     void WriteEvent( std::ostream &out ) const;
82     void WriteTracks( std::ostream &out ) const;
83
84     void ReadSettings( std::istream &in );
85     void ReadEvent( std::istream &in );
86     void ReadTracks( std::istream &in );
87
88         int InitGPU(int sliceCount = 1, int forceDeviceID = -1) { return(fTracker.InitGPU(sliceCount, forceDeviceID)); }
89         int ExitGPU() { return(fTracker.ExitGPU()); }
90         void SetGPUDebugLevel(int Level, std::ostream *OutFile = NULL, std::ostream *GPUOutFile = NULL) { fDebugLevel = Level; fTracker.SetGPUDebugLevel(Level, OutFile, GPUOutFile); fMerger.SetDebugLevel(Level);}
91         int SetGPUTrackerOption(char* OptionName, int OptionValue) {return(fTracker.SetGPUTrackerOption(OptionName, OptionValue));}
92         int SetGPUTracker(bool enable) { return(fTracker.SetGPUTracker(enable)); }
93         int GetGPUStatus() const { return(fTracker.GetGPUStatus()); }
94         int GetGPUMaxSliceCount() const { return(fTracker.MaxSliceCount()); }
95         void SetEventDisplay(int v) {fEventDisplay = v;}
96         void SetRunMerger(int v) {fRunMerger = v;}
97
98         int InitializeSliceParam(int iSlice, AliHLTTPCCAParam& param) { return(fTracker.InitializeSliceParam(iSlice, param)); }
99         void SetOutputControl(char* ptr, size_t size) {fOutputControl.fOutputPtr = ptr;fOutputControl.fOutputMaxSize = size;}
100
101   private:
102
103     static const int fgkNSlices = 36;       //* N slices
104
105     AliHLTTPCCAStandaloneFramework( const AliHLTTPCCAStandaloneFramework& );
106     const AliHLTTPCCAStandaloneFramework &operator=( const AliHLTTPCCAStandaloneFramework& ) const;
107
108     AliHLTTPCGMMerger fMerger;  //* global merger
109     AliHLTTPCCAClusterData fClusterData[fgkNSlices];
110         AliHLTTPCCASliceOutput* fSliceOutput[fgkNSlices];
111         AliHLTTPCCASliceOutput::outputControlStruct fOutputControl;
112
113         AliHLTTPCCATrackerFramework fTracker;
114
115     double fLastTime[20]; //* timers
116     double fStatTime[20]; //* timers
117     int fStatNEvents;    //* n events proceed
118
119         int fDebugLevel;        //Tracker Framework Debug Level
120         int fEventDisplay;      //Display event in Standalone Event Display
121         int fRunMerger;         //Run Track Merger
122 };
123
124 #endif //ALIHLTTPCCASTANDALONEFRAMEWORK_H