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 *
7 //*************************************************************************
9 #ifndef ALIHLTTPCCASTANDALONEFRAMEWORK_H
10 #define ALIHLTTPCCASTANDALONEFRAMEWORK_H
12 #include "AliHLTTPCCADef.h"
13 #include "AliHLTTPCCAMerger.h"
14 #include "AliHLTTPCCAClusterData.h"
15 #include "AliHLTTPCCATrackerFramework.h"
18 #include "TStopwatch.h"
21 * @class AliHLTTPCCAStandaloneFramework
23 * The class to run the HLT TPC reconstruction (36 CA slice trackers + CA merger )
24 * in a stand-alone mode.
25 * Used by AliTPCtrackerCA, the CA event display, CA performance.
28 class AliHLTTPCCAStandaloneFramework
33 AliHLTTPCCAStandaloneFramework();
34 ~AliHLTTPCCAStandaloneFramework();
36 static AliHLTTPCCAStandaloneFramework &Instance();
38 const AliHLTTPCCAParam &Param ( int iSlice ) const { return(fTracker.Param(iSlice)); }
39 const AliHLTTPCCARow &Row ( int iSlice, int iRow ) const { return(fTracker.Row(iSlice, iRow)); }
40 const AliHLTTPCCASliceOutput &Output( int iSlice ) const { return *fSliceOutput[iSlice]; }
41 AliHLTTPCCAMerger &Merger() { return fMerger; }
42 AliHLTTPCCAClusterData &ClusterData( int iSlice ) { return fClusterData[iSlice]; }
45 * prepare for reading of the event
47 void StartDataReading( int guessForNumberOfClusters = 256 );
52 void ReadCluster( int id, int iSlice, int iRow, float X, float Y, float Z, float Amp ) {
53 fClusterData[iSlice].ReadCluster( id, iRow, X, Y, Z, Amp );
57 * finish reading of the event
59 void FinishDataReading();
62 * perform event reconstruction
64 void ProcessEvent(int forceSingleSlice = -1);
67 int NSlices() const { return fgkNSlices; }
69 double LastTime( int iTimer ) const { return fLastTime[iTimer]; }
70 double StatTime( int iTimer ) const { return fStatTime[iTimer]; }
71 int StatNEvents() const { return fStatNEvents; }
73 void WriteSettings( std::ostream &out ) const;
74 void WriteEvent( std::ostream &out ) const;
75 void WriteTracks( std::ostream &out ) const;
77 void ReadSettings( std::istream &in );
78 void ReadEvent( std::istream &in );
79 void ReadTracks( std::istream &in );
81 int InitGPU(int sliceCount = 1, int forceDeviceID = -1) { return(fTracker.InitGPU(sliceCount, forceDeviceID)); }
82 int ExitGPU() { return(fTracker.ExitGPU()); }
83 void SetGPUDebugLevel(int Level, std::ostream *OutFile = NULL, std::ostream *GPUOutFile = NULL) { fDebugLevel = Level; fTracker.SetGPUDebugLevel(Level, OutFile, GPUOutFile); }
84 int SetGPUTrackerOption(char* OptionName, int OptionValue) {return(fTracker.SetGPUTrackerOption(OptionName, OptionValue));}
85 int SetGPUTracker(bool enable) { return(fTracker.SetGPUTracker(enable)); }
86 int GetGPUStatus() const { return(fTracker.GetGPUStatus()); }
87 int GetGPUMaxSliceCount() const { return(fTracker.MaxSliceCount()); }
89 int InitializeSliceParam(int iSlice, AliHLTTPCCAParam& param) { return(fTracker.InitializeSliceParam(iSlice, param)); }
91 #ifdef HLTCA_STANDALONE
92 static inline void StandaloneQueryTime(unsigned long long int *i);
93 static inline void StandaloneQueryFreq(unsigned long long int *i);
98 static const int fgkNSlices = 36; //* N slices
100 AliHLTTPCCAStandaloneFramework( const AliHLTTPCCAStandaloneFramework& );
101 const AliHLTTPCCAStandaloneFramework &operator=( const AliHLTTPCCAStandaloneFramework& ) const;
103 AliHLTTPCCAMerger fMerger; //* global merger
104 AliHLTTPCCAClusterData fClusterData[fgkNSlices];
105 AliHLTTPCCASliceOutput* fSliceOutput[fgkNSlices];
106 AliHLTTPCCASliceOutput::outputControlStruct fOutputControl;
108 AliHLTTPCCATrackerFramework fTracker;
110 double fLastTime[20]; //* timers
111 double fStatTime[20]; //* timers
112 int fStatNEvents; //* n events proceed
117 #ifdef HLTCA_STANDALONE
118 void AliHLTTPCCAStandaloneFramework::StandaloneQueryTime(unsigned long long int *i)
121 QueryPerformanceCounter((LARGE_INTEGER*) i);
124 clock_gettime(CLOCK_REALTIME, &t);
125 *i = (unsigned long long int) t.tv_sec * (unsigned long long int) 1000000000 + (unsigned long long int) t.tv_nsec;
129 void AliHLTTPCCAStandaloneFramework::StandaloneQueryFreq(unsigned long long int *i)
132 QueryPerformanceFrequency((LARGE_INTEGER*) i);