]>
Commit | Line | Data |
---|---|---|
6de2bc40 | 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" | |
6f0cdd46 | 13 | #ifdef HLTCA_STANDALONE |
14 | #include "AliHLTTPCCAMerger.h" | |
15 | #define AliHLTTPCGMMerger AliHLTTPCCAMerger | |
16 | #else | |
6d869045 | 17 | #include "AliHLTTPCGMMerger.h" |
6f0cdd46 | 18 | #endif |
6de2bc40 | 19 | #include "AliHLTTPCCAClusterData.h" |
b22af1bf | 20 | #include "AliHLTTPCCATrackerFramework.h" |
6de2bc40 | 21 | #include <iostream> |
7be9b0d7 | 22 | #include <fstream> |
b22af1bf | 23 | #include "TStopwatch.h" |
6de2bc40 | 24 | |
25 | /** | |
26 | * @class AliHLTTPCCAStandaloneFramework | |
27 | * | |
28 | * The class to run the HLT TPC reconstruction (36 CA slice trackers + CA merger ) | |
b8139972 | 29 | * in a stand-alone mode. |
6de2bc40 | 30 | * Used by AliTPCtrackerCA, the CA event display, CA performance. |
31 | * | |
32 | */ | |
33 | class AliHLTTPCCAStandaloneFramework | |
34 | { | |
f0bada7f | 35 | #ifdef HLTCA_STANDALONE |
36 | friend int DrawGLScene(); | |
37 | #endif | |
6de2bc40 | 38 | |
39 | public: | |
40 | ||
41 | AliHLTTPCCAStandaloneFramework(); | |
42 | ~AliHLTTPCCAStandaloneFramework(); | |
43 | ||
44 | static AliHLTTPCCAStandaloneFramework &Instance(); | |
45 | ||
b22af1bf | 46 | const AliHLTTPCCAParam &Param ( int iSlice ) const { return(fTracker.Param(iSlice)); } |
47 | const AliHLTTPCCARow &Row ( int iSlice, int iRow ) const { return(fTracker.Row(iSlice, iRow)); } | |
98512261 | 48 | const AliHLTTPCCASliceOutput &Output( int iSlice ) const { return *fSliceOutput[iSlice]; } |
6d869045 | 49 | AliHLTTPCGMMerger &Merger() { return fMerger; } |
b8139972 | 50 | AliHLTTPCCAClusterData &ClusterData( int iSlice ) { return fClusterData[iSlice]; } |
6de2bc40 | 51 | |
52 | /** | |
53 | * prepare for reading of the event | |
54 | */ | |
55 | void StartDataReading( int guessForNumberOfClusters = 256 ); | |
56 | ||
57 | /** | |
58 | * read next cluster | |
59 | */ | |
b8139972 | 60 | void ReadCluster( int id, int iSlice, int iRow, float X, float Y, float Z, float Amp ) { |
6de2bc40 | 61 | fClusterData[iSlice].ReadCluster( id, iRow, X, Y, Z, Amp ); |
62 | } | |
63 | ||
64 | /** | |
65 | * finish reading of the event | |
66 | */ | |
67 | void FinishDataReading(); | |
68 | ||
69 | /** | |
70 | * perform event reconstruction | |
71 | */ | |
f0bada7f | 72 | int ProcessEvent(int forceSingleSlice = -1); |
6de2bc40 | 73 | |
74 | ||
75 | int NSlices() const { return fgkNSlices; } | |
76 | ||
77 | double LastTime( int iTimer ) const { return fLastTime[iTimer]; } | |
78 | double StatTime( int iTimer ) const { return fStatTime[iTimer]; } | |
79 | int StatNEvents() const { return fStatNEvents; } | |
b8139972 | 80 | |
6de2bc40 | 81 | void WriteSettings( std::ostream &out ) const; |
82 | void WriteEvent( std::ostream &out ) const; | |
83 | void WriteTracks( std::ostream &out ) const; | |
b8139972 | 84 | |
6de2bc40 | 85 | void ReadSettings( std::istream &in ); |
7be9b0d7 | 86 | void ReadEvent( std::istream &in ); |
6de2bc40 | 87 | void ReadTracks( std::istream &in ); |
88 | ||
b22af1bf | 89 | int InitGPU(int sliceCount = 1, int forceDeviceID = -1) { return(fTracker.InitGPU(sliceCount, forceDeviceID)); } |
90 | int ExitGPU() { return(fTracker.ExitGPU()); } | |
91 | void SetGPUDebugLevel(int Level, std::ostream *OutFile = NULL, std::ostream *GPUOutFile = NULL) { fDebugLevel = Level; fTracker.SetGPUDebugLevel(Level, OutFile, GPUOutFile); } | |
92 | int SetGPUTrackerOption(char* OptionName, int OptionValue) {return(fTracker.SetGPUTrackerOption(OptionName, OptionValue));} | |
93 | int SetGPUTracker(bool enable) { return(fTracker.SetGPUTracker(enable)); } | |
d4594e7d | 94 | int GetGPUStatus() const { return(fTracker.GetGPUStatus()); } |
95 | int GetGPUMaxSliceCount() const { return(fTracker.MaxSliceCount()); } | |
f0bada7f | 96 | void SetEventDisplay(int v) {fEventDisplay = v;} |
97 | void SetRunMerger(int v) {fRunMerger = v;} | |
b22af1bf | 98 | |
99 | int InitializeSliceParam(int iSlice, AliHLTTPCCAParam& param) { return(fTracker.InitializeSliceParam(iSlice, param)); } | |
100 | ||
101 | #ifdef HLTCA_STANDALONE | |
102 | static inline void StandaloneQueryTime(unsigned long long int *i); | |
103 | static inline void StandaloneQueryFreq(unsigned long long int *i); | |
31649d4b | 104 | #endif //HLTCA_STANDALONE |
7be9b0d7 | 105 | |
6de2bc40 | 106 | private: |
107 | ||
108 | static const int fgkNSlices = 36; //* N slices | |
109 | ||
110 | AliHLTTPCCAStandaloneFramework( const AliHLTTPCCAStandaloneFramework& ); | |
111 | const AliHLTTPCCAStandaloneFramework &operator=( const AliHLTTPCCAStandaloneFramework& ) const; | |
112 | ||
6d869045 | 113 | AliHLTTPCGMMerger fMerger; //* global merger |
6de2bc40 | 114 | AliHLTTPCCAClusterData fClusterData[fgkNSlices]; |
98512261 | 115 | AliHLTTPCCASliceOutput* fSliceOutput[fgkNSlices]; |
d4594e7d | 116 | AliHLTTPCCASliceOutput::outputControlStruct fOutputControl; |
6de2bc40 | 117 | |
b22af1bf | 118 | AliHLTTPCCATrackerFramework fTracker; |
7be9b0d7 | 119 | |
6de2bc40 | 120 | double fLastTime[20]; //* timers |
121 | double fStatTime[20]; //* timers | |
122 | int fStatNEvents; //* n events proceed | |
7be9b0d7 | 123 | |
f0bada7f | 124 | int fDebugLevel; //Tracker Framework Debug Level |
125 | int fEventDisplay; //Display event in Standalone Event Display | |
126 | int fRunMerger; //Run Track Merger | |
6de2bc40 | 127 | }; |
128 | ||
b22af1bf | 129 | #ifdef HLTCA_STANDALONE |
130 | void AliHLTTPCCAStandaloneFramework::StandaloneQueryTime(unsigned long long int *i) | |
131 | { | |
132 | #ifdef R__WIN32 | |
133 | QueryPerformanceCounter((LARGE_INTEGER*) i); | |
134 | #else | |
135 | timespec t; | |
136 | clock_gettime(CLOCK_REALTIME, &t); | |
137 | *i = (unsigned long long int) t.tv_sec * (unsigned long long int) 1000000000 + (unsigned long long int) t.tv_nsec; | |
31649d4b | 138 | #endif //R__WIN32 |
b22af1bf | 139 | } |
140 | ||
141 | void AliHLTTPCCAStandaloneFramework::StandaloneQueryFreq(unsigned long long int *i) | |
142 | { | |
143 | #ifdef R__WIN32 | |
144 | QueryPerformanceFrequency((LARGE_INTEGER*) i); | |
145 | #else | |
146 | *i = 1000000000; | |
31649d4b | 147 | #endif //R__WIN32 |
b22af1bf | 148 | } |
31649d4b | 149 | #endif //HLTCA_STANDALONE |
b22af1bf | 150 | |
31649d4b | 151 | #endif //ALIHLTTPCCASTANDALONEFRAMEWORK_H |