1 #include <AliHLTTPCCAGBTracker.h>
2 #include <AliHLTTPCCATracker.h>
10 #ifndef HLTCA_STANDALONE
11 #include <AliHLTTPCCAPerformance.h>
25 static bool SAVE =
false;
26 extern bool SINGLE_THREADED;
27 extern bool DRAW_EVERY_LINK;
30 void dumpLinksFile( std::fstream &file,
int sliceNumber )
36 sprintf( name,
"Links/%02i.%02i.dat", kEvents, sliceNumber );
37 file.open( name, std::ios::out );
42 void dumpTrackletconstructionFile( std::fstream &file,
int sliceNumber )
48 sprintf( name,
"TrackletConstruction/%02i.%02i.dat", kEvents, sliceNumber );
49 file.open( name, std::ios::out );
51 #endif // DUMP_TRACKLETCONSTRUCTION
56 geo.open( filename, std::ios::in );
57 if ( !geo.is_open() ) {
60 CALLGRIND_TOGGLE_COLLECT
61 tracker->ReadSettings(geo);
62 CALLGRIND_TOGGLE_COLLECT
68 FILE *file = std::fopen( filename,
"rb" );
72 CALLGRIND_TOGGLE_COLLECT
73 tracker->ReadEvent( file );
74 CALLGRIND_TOGGLE_COLLECT
79 static bool file_exists(
const char *filename )
82 if ( ( f = std::fopen( filename,
"r" ) ) != NULL ) {
89 static void usage(
const char *execName)
91 std::cout <<
"Usage: " << execName <<
" [OPTION] [event number]\n"
92 "Reconstruct slice tracks and merge them from cluster data read from the Events directory.\n\n"
93 " -h, --help print this message\n"
95 " -links let it draw every vector of links the NeighboursFinder found.\n"
97 " -single force tracker to run on only one core. Per default all available cores will be used\n"
99 " -save dump result of the tracker/merger into a file for later analysis\n"
100 #ifndef HLTCA_STANDALONE
101 " -perf do a performance analysis against Monte-Carlo information right after reconstruction\n\n"
103 "You may specify a specific event to reconstruct if there is more than one available in the Events directory"
107 int main(
int argc,
char **argv)
109 bool fullTiming =
false;
110 #ifndef HLTCA_STANDALONE
111 AliHLTTPCCAPerformance *perf = 0;
113 int eventNumber = -1;
115 for(
int i=1; i < argc; i++ ){
116 if ( !std::strcmp( argv[i],
"-h" ) || !std::strcmp( argv[i],
"--help" ) || !std::strcmp( argv[i],
"-help" ) ) {
120 }
else if ( !std::strcmp( argv[i],
"-links" ) ) {
121 DRAW_EVERY_LINK =
true;
123 }
else if ( !std::strcmp( argv[i],
"-single" ) ) {
124 SINGLE_THREADED =
true;
126 }
else if ( !std::strcmp( argv[i],
"-save" ) ) {
128 #ifndef HLTCA_STANDALONE
129 }
else if ( !std::strcmp( argv[i],
"-perf" ) ) {
130 perf = &AliHLTTPCCAPerformance::Instance();
132 }
else if ( !std::strcmp( argv[i],
"-time" ) ) {
134 }
else if ( !std::strcmp( argv[i],
"-repeat" ) && ++i < argc ) {
135 repetitions = atoi( argv[i] );
137 eventNumber = atoi( argv[i] );
138 std::cout <<
"Only process event " << eventNumber << std::endl;
142 SINGLE_THREADED =
true;
143 perf = &AliHLTTPCCAPerformance::Instance();
152 readSettings(
"Events/settings.dat", tracker );
153 trackerConst = tracker;
156 if ( eventNumber >= 0 ) {
157 kEvents = eventNumber;
159 while ( eventNumber == -1 || eventNumber == kEvents ) {
161 sprintf( name,
"Events/%i.bin", kEvents );
163 std::cout <<
"Loading Event " << kEvents <<
"..." << std::endl;
164 if ( !readEvent( name, tracker ) ) {
165 std::cout <<
"Data for event: " << kEvents <<
" has NOT been read succesfull" << std::endl;
168 std::cout <<
"Event " << kEvents <<
" CPU reconstruction..." << std::endl;
170 #ifndef HLTCA_STANDALONE
172 char nameTr[255], nameP[255];
173 sprintf( nameTr,
"Events/%i.mc.bin", kEvents );
174 sprintf( nameP,
"Events/%i.mcpoints.bin", kEvents );
175 std::cout <<
"Loading Monte-Carlo Data for Event " << kEvents <<
"..." << std::endl;
176 if ( !perf->SetNewEvent( tracker, nameTr, nameP ) ) std::cout <<
"MCdata for event: " << kEvents <<
" has NOT been read succesfull" << std::endl;
182 #ifndef HLTCA_STANDALONE
184 perf->InitSubPerformances();
185 perf->ExecPerformance();
189 const bool ifAvarageTime = 1;
192 std::cout <<
"Reconstruction Time"
193 <<
" Real = " << std::setw( 10 ) << trackerConst->SliceTrackerTime() * 1.e3 <<
" ms,"
194 <<
" CPU = " << std::setw( 10 ) << trackerConst->SliceTrackerCpuTime() * 1.e3 <<
" ms,"
195 <<
" parallelization speedup: " << trackerConst->SliceTrackerCpuTime() / trackerConst->SliceTrackerTime()
199 <<
" | sum slice trackers: " << std::setw( 10 ) << trackerConst->StatTime( 0 ) * 1000. <<
" ms\n"
200 <<
" | NeighboursFinder: " << std::setw( 10 ) << trackerConst->StatTime( 1 ) * 1000. <<
" ms, " << std::setw( 12 ) << trackerConst->StatTime( 5 ) <<
" cycles\n"
201 <<
" | StartHitsFinder: " << std::setw( 10 ) << trackerConst->StatTime( 4 ) * 1000. <<
" ms\n"
202 <<
" | TrackletConstructor: " << std::setw( 10 ) << trackerConst->StatTime( 2 ) * 1000. <<
" ms, " << std::setw( 12 ) << trackerConst->StatTime( 7 ) <<
" cycles\n"
203 <<
" | TrackletSelector: " << std::setw( 10 ) << trackerConst->StatTime( 3 ) * 1000. <<
" ms, " << std::setw( 12 ) << trackerConst->StatTime( 8 ) <<
" cycles\n"
204 <<
" | WriteOutput: " << std::setw( 10 ) << trackerConst->StatTime( 6 ) * 1000. <<
" ms\n"
205 <<
" | merge: " << std::setw( 10 ) << trackerConst->StatTime( 9 ) * 1000. <<
" ms" << std::endl;
210 const int NTimers = 10;
211 static int statIEvent = 0;
212 static double statTime[NTimers];
213 static double statTime_SliceTrackerTime = 0;
214 static double statTime_SliceTrackerCpuTime = 0;
217 for (
int i = 0; i < NTimers; i++){
223 for (
int i = 0; i < NTimers; i++){
224 statTime[i] += trackerConst->StatTime( i );
226 statTime_SliceTrackerTime += trackerConst->SliceTrackerTime();
227 statTime_SliceTrackerCpuTime += trackerConst->SliceTrackerCpuTime();
230 std::cout <<
"Reconstruction Time"
231 <<
" Real = " << std::setw( 10 ) << 1./statIEvent*statTime_SliceTrackerTime * 1.e3 <<
" ms,"
232 <<
" CPU = " << std::setw( 10 ) << 1./statIEvent*statTime_SliceTrackerCpuTime * 1.e3 <<
" ms,"
233 <<
" parallelization speedup: " << statTime_SliceTrackerCpuTime / statTime_SliceTrackerTime
237 <<
" | sum slice trackers: " << std::setw( 10 ) << 1./statIEvent*statTime[ 0 ] * 1000. <<
" ms\n"
238 <<
" | NeighboursFinder: " << std::setw( 10 ) << 1./statIEvent*statTime[ 1 ] * 1000. <<
" ms, " << std::setw( 12 ) << 1./statIEvent*statTime[ 5 ] <<
" cycles\n"
239 <<
" | StartHitsFinder: " << std::setw( 10 ) << 1./statIEvent*statTime[ 4 ] * 1000. <<
" ms\n"
240 <<
" | TrackletConstructor: " << std::setw( 10 ) << 1./statIEvent*statTime[ 2 ] * 1000. <<
" ms, " << std::setw( 12 ) << 1./statIEvent*statTime[ 7 ] <<
" cycles\n"
241 <<
" | TrackletSelector: " << std::setw( 10 ) << 1./statIEvent*statTime[ 3 ] * 1000. <<
" ms, " << std::setw( 12 ) << 1./statIEvent*statTime[ 8 ] <<
" cycles\n"
242 <<
" | WriteOutput: " << std::setw( 10 ) << 1./statIEvent*statTime[ 6 ] * 1000. <<
" ms\n"
243 <<
" | merge: " << std::setw( 10 ) << 1./statIEvent*statTime[ 9 ] * 1000. <<
" ms" << std::endl;
248 sprintf( name,
"%i.dat", kEvents );
250 trackerConst->StoreToFile( name );