]>
Commit | Line | Data |
---|---|---|
a38a7850 | 1 | /* |
2 | * Requirements: Running HLT Analysis Framework | |
3 | * with TCP-Dump Subscribe listining on | |
4 | * - Cluster: Hostname, Port | |
5 | * - Tracker: Hostname, Port | |
6 | * - Controlled FilePublisher: Hostname, Port | |
7 | * Usage : | |
8 | * | |
9 | * (1) USE the StartDisplayMacro.C , by adding | |
10 | * gROOT->Macro("StartDisplayMacro.C"); | |
11 | * to the rootlogon.C file | |
12 | * | |
13 | * (2) IN StartDisplayMacro.C subject to change are: | |
14 | * ODH_INIT("<PATH TO GEO FILE>", "<PATH TO LIBRARIES>"); | |
15 | * - <PATH TO LIBRARIES> : The path where libHOMERReader_ROOT.so and libHOMERReader.so are located. | |
16 | * - <PATH TO GEO FILE> : The path where alice.geom is located. | |
17 | * ODH_CONNECT("<NODE>",<PORT>,"<NODE>",<PORT>,"<NODE>",<PORT>); | |
18 | * - <NODE> : The port on which the TCPDumpSubscriber is running. | |
19 | * - <PORT> : The port specified in the TCPDumpSubscriber in the XML configuration file. | |
20 | * use first pair for Cluster Data, second for Tracks Data and third for Raw Data... | |
21 | * but it doesn't matter if you change it. | |
22 | * | |
23 | * | |
24 | * When starting root, Display and Control Bar will pop up. | |
25 | * Nothing will be displayed at the beginning. | |
26 | * - In order to display the geometry. Click <Show Geometry> first. | |
27 | * Different sets of sectors can be selected also. | |
28 | * - In order to dislpay event's click <Next clusters>, <Next tracks> or <Next clusters and tracks> | |
29 | * Displaying PadRow's: | |
30 | * - as Histogram: | |
31 | * once : <Setup PadRow 20 with Histogram> | |
32 | * next event : <Display PadRow> | |
33 | * - in Geometry: | |
34 | * once : <Setup PadRow 20 with Geometry> | |
35 | * next event : <Display PadRow>, <Display PadRow with Clusters>, <Display PadRow with Tracks> or <Display PadRow with Clusters and Tracks> | |
36 | */ | |
37 | ||
38 | ||
39 | // gROOT->GetInterpreter()->AddIncludePath( "$ALIHLT_TOPDIR/BASE" ); | |
40 | // gROOT->GetInterpreter()->AddIncludePath( "$ALIHLT_TOPDIR/TPCLib" ); | |
41 | ||
42 | #include "AliHLTDataTypes.h" | |
43 | #include "AliHLTTPCSpacePointData.h" | |
44 | #include "AliHLTTPCClusterDataFormat.h" | |
45 | #include "AliHLTTPCTrackletDataFormat.h" | |
46 | #include "AliHLTTPCDefinitions.h" | |
47 | #include "AliHLTTPCDigitReader.h" | |
48 | ||
49 | // include because of connecttofile() | |
50 | #include <stdio.h> | |
51 | #include <stdlib.h> | |
52 | //#include <sys/time.h> | |
53 | //#include <sys/types.h> | |
54 | #include <sys/stat.h> | |
55 | #include <fcntl.h> | |
56 | #include <unistd.h> | |
57 | #include <string.h> | |
58 | #include <errno.h> | |
59 | #include <vector> | |
60 | // #include "MLUCString.hpp" | |
61 | // #include "MLUCCmdlineParser.hpp" | |
62 | // #include "MLUCDynamicLibrary.hpp" | |
63 | #include "AliHLTDataTypes.h" | |
64 | #include "AliHLT_C_Component_WrapperInterface.h" | |
65 | ||
66 | ||
67 | ||
68 | //#include "AliHLTTPCTrackArray.h" | |
69 | ||
70 | void* gODH_Reader; /* really HOMERReader* */ | |
71 | void* gODH_Display; /* really AliHLTTPCDisplay* */ | |
72 | ||
73 | ||
74 | /* Dummy function to work around the problem that the interpreter does not load the first function properly... */ | |
75 | int ODH_Dummy() { | |
76 | return 0; | |
77 | } | |
78 | ||
79 | // ######################################################################################################################################## | |
80 | int HLT_OnlineDisplay_HOMER() { | |
81 | gODH_Display = NULL; | |
82 | return 0; | |
83 | } | |
84 | ||
85 | // ######################################################################################################################################## | |
86 | int ODH_Init( char* path_to_geom_file, char* path_to_homer_lib = NULL ) { | |
87 | // --- Load LIBS | |
88 | TString lib; | |
89 | cout << "Loading ROOT libraries (ROOTSYS has to be set)" << endl; | |
90 | ||
91 | gSystem->Load("libPhysics"); | |
92 | gSystem->Load("libEG"); | |
93 | // if(gSystem->Load("libMC")==-1) { | |
94 | gSystem->Load("libGeom"); | |
95 | gSystem->Load("libVMC"); | |
96 | // } | |
97 | ||
98 | cout << "Loading ALICE TPC libraries (ALICE_ROOT & ALICE_TARGET have to be set)" << endl; | |
99 | gSystem->Load("libESD"); | |
100 | gSystem->Load("libSTEER"); | |
364543a0 | 101 | gSystem->Load("libRAWDatabase"); |
102 | gSystem->Load("libRAWDatarec"); | |
a38a7850 | 103 | // gSystem->Load("libCONTAINERS"); |
104 | // if(gSystem->Load("libTPC")!=0) { | |
105 | gSystem->Load("libTPCbase"); | |
106 | gSystem->Load("libTPCrec"); | |
107 | gSystem->Load("libTPCsim"); | |
108 | gSystem->Load("libTPCfast"); | |
109 | // } | |
110 | ||
111 | cout << "Loading HLT libraries (ALIHLT_LIBDIR has to be set)" << endl; | |
112 | gSystem->Load("$(ALIHLT_LIBDIR)/libHLTbase.so"); | |
113 | gSystem->Load("$(ALIHLT_LIBDIR)/libAliHLTTPC.so"); | |
114 | cout << "Loading HOMER library" << endl; | |
115 | ||
116 | if ( path_to_homer_lib ) { | |
117 | lib = path_to_homer_lib; | |
118 | lib += "/"; | |
119 | } | |
120 | else { | |
121 | lib = ""; | |
122 | } | |
123 | ||
124 | lib += "libHOMERReader_ROOT.so"; | |
125 | gSystem->Load( lib ); | |
126 | ||
127 | ||
128 | // --- Create DISPLAY | |
129 | cout << "Creating display" << endl; | |
130 | ||
131 | Char_t *gfile="alice.geom"; // geometrie file | |
132 | TString geoPath; | |
133 | if ( path_to_geom_file ){ | |
134 | geoPath = path_to_geom_file; | |
135 | geoPath += "/"; | |
136 | } | |
137 | else { | |
138 | geoPath = ""; | |
139 | } | |
140 | geoPath += gfile; | |
141 | ||
142 | Int_t slices[] = { 0, 35 }; | |
143 | AliHLTTPCDisplay* display = new AliHLTTPCDisplay( slices, geoPath.Data() ); | |
144 | ||
145 | display->SetSlices(); | |
146 | display->DisplayAll(0,kFALSE,kFALSE,kFALSE,kFALSE); | |
147 | ||
148 | gODH_Display = (void*)display; | |
149 | return 0; | |
150 | } | |
151 | ||
152 | int ODH_SetSliceRange(int minslice,int maxslice){ | |
153 | // sets a range of Slices | |
154 | if (!gODH_Display ) return -1; | |
155 | AliHLTTPCDisplay* display = (AliHLTTPCDisplay*)gODH_Display; | |
156 | ||
157 | display->SetSlices(minslice,maxslice); | |
158 | display->DisplayAll(0,kFALSE,kFALSE,kFALSE,kFALSE); | |
159 | } | |
160 | ||
161 | int ODH_SetSliceRange(int slice){ | |
162 | // sets one slice | |
163 | if (!gODH_Display ) return -1; | |
164 | AliHLTTPCDisplay* display = (AliHLTTPCDisplay*)gODH_Display; | |
165 | ||
166 | display->SetSlices(slice); | |
167 | display->DisplayAll(0,kFALSE,kFALSE,kFALSE,kFALSE); | |
168 | } | |
169 | ||
170 | int ODH_SetSliceRange(){ | |
171 | // sets all Slices | |
172 | if (!gODH_Display ) return -1; | |
173 | AliHLTTPCDisplay* display = (AliHLTTPCDisplay*)gODH_Display; | |
174 | ||
175 | display->SetSlices(); | |
176 | display->DisplayAll(0,kFALSE,kFALSE,kFALSE,kFALSE); | |
177 | } | |
178 | ||
179 | int ODH_SetSlicePair(int slice){ | |
180 | // sets a pair of slices | |
181 | if (!gODH_Display ) return -1; | |
182 | AliHLTTPCDisplay* display = (AliHLTTPCDisplay*)gODH_Display; | |
183 | ||
184 | display->SetSlicesPair(slice); | |
185 | display->DisplayAll(0,kFALSE,kFALSE,kFALSE,kFALSE); | |
186 | } | |
187 | ||
188 | int ODH_SetSlicePair(int minslice, int maxslice){ | |
189 | // sets a pair of slices | |
190 | if (!gODH_Display ) return -1; | |
191 | AliHLTTPCDisplay* display = (AliHLTTPCDisplay*)gODH_Display; | |
192 | ||
193 | display->SetSlicesPair(minslice,maxslice); | |
194 | display->DisplayAll(0,kFALSE,kFALSE,kFALSE,kFALSE); | |
195 | } | |
196 | ||
197 | int ODH_SetInvert(){ | |
198 | // sets a pair of slices | |
199 | if (!gODH_Display ) return -1; | |
200 | AliHLTTPCDisplay* display = (AliHLTTPCDisplay*)gODH_Display; | |
201 | ||
202 | display->SetInvert(); | |
203 | display->DisplayAll(0,kFALSE,kFALSE,kFALSE,kFALSE); | |
204 | } | |
205 | ||
206 | int ODH_SetDrawGeo(){ | |
207 | // sets a pair of slices | |
208 | if (!gODH_Display ) return -1; | |
209 | AliHLTTPCDisplay* display = (AliHLTTPCDisplay*)gODH_Display; | |
210 | ||
211 | display->SetDrawGeo(); | |
212 | display->DisplayAll(0,kFALSE,kFALSE,kFALSE,kFALSE); | |
213 | } | |
214 | ||
215 | // ######################################################################################################################################## | |
216 | int ODH_Connect( char* hostname_clusters, short port_clusters, char* hostname_tracks, short port_tracks, char* hostname_raw, short port_raw ) { | |
217 | HOMERReader* reader; | |
218 | char* hostnames[] = { "NULL", "NULL","NULL" }; | |
219 | unsigned short ports[] = { 0, 0, 0 }; | |
220 | int cnt=0; | |
221 | if ( hostname_clusters ){ | |
222 | hostnames[cnt] = hostname_clusters; | |
223 | ports[cnt] = port_clusters; | |
224 | cnt++; | |
225 | } | |
226 | if ( hostname_tracks ){ | |
227 | hostnames[cnt] = hostname_tracks; | |
228 | ports[cnt] = port_tracks; | |
229 | cnt++; | |
230 | } | |
231 | if ( hostname_raw ){ | |
232 | hostnames[cnt] = hostname_raw; | |
233 | ports[cnt] = port_raw; | |
234 | cnt++; | |
235 | } | |
236 | ||
237 | reader = new HOMERReader( cnt, hostnames, ports ); | |
238 | int ret; | |
239 | ret=reader->GetConnectionStatus(); | |
240 | if ( ret ) { | |
241 | int ndx = reader->GetErrorConnectionNdx(); | |
242 | if ( ndx < cnt ) { | |
243 | printf( "Error establishing connection to TCP source %s:%hu: %s (%d)\n", | |
244 | hostnames[ndx], ports[ndx], | |
245 | strerror(ret), ret ); | |
246 | } | |
247 | else { | |
248 | printf( "Error establishing connection to unknown source with index %d: %s (%d)\n", | |
249 | ndx, | |
250 | strerror(ret), ret ); | |
251 | } | |
252 | delete reader; | |
253 | reader = NULL; | |
254 | } | |
255 | gODH_Reader = (void*)reader; | |
256 | return ret; | |
257 | } | |
258 | ||
259 | // ######################################################################################################################################## | |
260 | int ODH_Disconnect() { | |
261 | if ( !gODH_Reader ) | |
262 | return 0; | |
263 | HOMERReader* reader = (HOMERReader*)gODH_Reader; | |
264 | delete reader; | |
265 | gODH_Reader = NULL; | |
266 | return 0; | |
267 | } | |
268 | ||
269 | // ######################################################################################################################################## | |
270 | Int_t ODH_SetupPadRow(Int_t histswitch, Int_t slice, Int_t padrow){ | |
271 | // PADROW 0 - 158 | |
272 | if (!gODH_Display ) return -1; | |
273 | AliHLTTPCDisplay* display = (AliHLTTPCDisplay*)gODH_Display; | |
274 | ||
275 | // Setup Geometry: histswitch = 0; | |
276 | // Setup Histogram: histswitch = 1|2|3; | |
277 | display->SetupPadRow(histswitch,slice,padrow); | |
278 | ||
279 | return 0; | |
280 | } | |
281 | ||
282 | // ######################################################################################################################################## | |
283 | int ODH_DisplayNextEvent( Bool_t clusterswitch, Bool_t trackswitch, Bool_t padrowswitch, Float_t* clustersEtaRange = NULL ) { | |
284 | ||
285 | if ( !gODH_Reader || !gODH_Display ) return -1; | |
286 | ||
287 | // -- input datatypes , reverse | |
288 | char* spptID="SRETSULC"; | |
289 | //char* spptID="STPECAPS"; | |
290 | char* trkID = "SGESKART"; | |
291 | //char* trkID = "SGESCART"; | |
292 | char* padrowID = "KPWR_LDD"; | |
293 | ||
294 | Int_t minHits = 0; | |
295 | Bool_t x3don = kFALSE; | |
296 | ||
297 | HOMERReader* reader = (HOMERReader*)gODH_Reader; | |
298 | AliHLTTPCDisplay* display = (AliHLTTPCDisplay*)gODH_Display; | |
299 | int ret = reader->ReadNextEvent(); | |
300 | ||
301 | if ( ret ) { | |
302 | int ndx = reader->GetErrorConnectionNdx(); | |
303 | printf( "------------ TRY AGAIN --------------->Error reading event from source %d: %s (%d)\n", ndx, strerror(ret), ret ); | |
304 | ODH_DisplayNextEvent( clusterswitch, trackswitch, padrowswitch, clustersEtaRange); | |
305 | return ret; | |
306 | } | |
307 | ||
308 | unsigned long blockCnt = reader->GetBlockCnt(); | |
309 | printf( "Event 0x%016LX (%Lu) with %lu blocks\n", (ULong64_t)reader->GetEventID(), (ULong64_t)reader->GetEventID(), blockCnt ); | |
310 | ||
311 | for ( unsigned long i = 0; i < blockCnt; i++ ) { | |
312 | char tmp1[9], tmp2[5]; | |
313 | memset( tmp1, 0, 9 ); | |
314 | memset( tmp2, 0, 5 ); | |
315 | void *tmp11 = tmp1; | |
316 | ULong64_t* tmp12 = (ULong64_t*)tmp11; | |
317 | *tmp12 = reader->GetBlockDataType( i ); | |
318 | void *tmp21 = tmp2; | |
319 | ULong_t* tmp22 = (ULong_t*)tmp21; | |
320 | *tmp22 = reader->GetBlockDataOrigin( i ); | |
321 | printf( "Block %lu length: %lu - type: %s - origin: %s\n", | |
322 | i, reader->GetBlockDataLength( i ), tmp1, tmp2 ); | |
323 | } | |
324 | ||
325 | display->ResetDisplay(); | |
326 | ||
327 | // -------------- CLUSTER | |
328 | if ( clusterswitch ) { | |
329 | unsigned long blk = reader->FindBlockNdx( spptID, " CPT",0xFFFFFFFF ); | |
330 | printf( "blk: %lu\n", blk ); | |
331 | while ( blk != ~(unsigned long)0 ) { | |
332 | printf( "Found clusters block %lu\n", blk ); | |
333 | const AliHLTTPCClusterData* clusterData = (const AliHLTTPCClusterData*)reader->GetBlockData( blk ); | |
334 | unsigned long dataLen = reader->GetBlockDataLength( blk ); | |
335 | ||
336 | ULong_t spec = reader->GetBlockDataSpec( blk ); | |
337 | Int_t patch = AliHLTTPCDefinitions::GetMinPatchNr( spec ); | |
338 | Int_t slice = AliHLTTPCDefinitions::GetMinSliceNr( spec ); | |
339 | printf( "%lu Clusters found for slice %u - patch %u\n", clusterData->fSpacePointCnt, slice, patch ); | |
340 | ||
341 | void* tmp30 = clusterData; | |
342 | Byte_t* tmp31 = (Byte_t*)tmp30; | |
343 | unsigned long offset; | |
344 | offset = sizeof(clusterData->fSpacePointCnt); | |
345 | if ( offset <= reader->GetBlockTypeAlignment( blk, 1 ) ) | |
346 | offset = reader->GetBlockTypeAlignment( blk, 1 ); | |
347 | tmp31 += offset; | |
348 | tmp30 = tmp31; | |
349 | AliHLTTPCSpacePointData* tmp32 = (AliHLTTPCSpacePointData*)tmp30; | |
350 | ||
351 | display->SetupClusterDataForPatch( slice, patch, clusterData->fSpacePointCnt, tmp32 ); | |
352 | ||
353 | blk = reader->FindBlockNdx( spptID, " CPT", 0xFFFFFFFF, blk+1 ); | |
354 | printf( "blk: %lu\n", blk ); | |
355 | } | |
356 | } | |
357 | ||
358 | // -------------- PADROW | |
359 | if ( padrowswitch ) { | |
360 | Int_t padrow = display->GetPadrow(); | |
361 | Int_t patch = AliHLTTPCTransform::GetPatch(padrow); | |
362 | Int_t maxpatch = patch; | |
363 | AliHLTUInt8_t padslice = (AliHLTUInt8_t) display->GetSlice(); | |
364 | ||
365 | if (padrow == 30 || padrow == 90 || padrow == 139) maxpatch++; | |
366 | ||
367 | for (Int_t tpatch=patch;tpatch <= maxpatch;tpatch++){ | |
368 | ||
369 | ||
370 | AliHLTUInt32_t padrowSpec = AliHLTTPCDefinitions::EncodeDataSpecification( padslice, padslice,(AliHLTUInt8_t) tpatch,(AliHLTUInt8_t) tpatch ); | |
371 | ||
372 | unsigned long blk; | |
373 | ||
374 | // READ RAW DATA BLOCK | |
375 | blk = reader->FindBlockNdx( padrowID, " CPT", padrowSpec ); | |
376 | printf( "Raw Data found for slice %u/patch %u\n", padslice, tpatch ); | |
377 | ||
378 | unsigned long rawDataBlock = reader->GetBlockData( blk ); | |
379 | unsigned long rawDataLen = reader->GetBlockDataLength( blk ); | |
380 | ||
381 | // READ CLUSTERS BLOCK | |
382 | blk = reader->FindBlockNdx( spptID, " CPT", padrowSpec ); | |
383 | ||
384 | const AliHLTTPCClusterData* clusterData = (const AliHLTTPCClusterData*)reader->GetBlockData( blk ); | |
385 | ||
386 | printf( "%lu Clusters found for slice %u - patch %u\n", clusterData->fSpacePointCnt, padslice, tpatch ); | |
387 | ||
388 | void* tmp30 = clusterData; | |
389 | Byte_t* tmp31 = (Byte_t*)tmp30; | |
390 | unsigned long offset; | |
391 | offset = sizeof(clusterData->fSpacePointCnt); | |
392 | if ( offset <= reader->GetBlockTypeAlignment( blk, 1 ) ) | |
393 | offset = reader->GetBlockTypeAlignment( blk, 1 ); | |
394 | tmp31 += offset; | |
395 | tmp30 = tmp31; | |
396 | AliHLTTPCSpacePointData* tmp32 = (AliHLTTPCSpacePointData*)tmp30; | |
397 | ||
398 | // DISPLAY RAW DATA AND CLUSTERS | |
399 | display->FillPadRow( tpatch, rawDataBlock, rawDataLen, clusterData->fSpacePointCnt, tmp32); | |
400 | } | |
401 | ||
402 | ||
403 | } | |
404 | ||
405 | AliHLTTPCTrackArray* trackArray = NULL; | |
406 | trackArray = new AliHLTTPCTrackArray; | |
407 | if ( !trackArray ) { | |
408 | printf( "No track array\n" ); | |
409 | return -1; | |
410 | } | |
411 | ||
412 | // -------------- TRACKS | |
413 | if ( trackswitch ) { | |
414 | unsigned long blk = reader->FindBlockNdx( trkID, " CPT", 0xFFFFFFFF ); | |
415 | ||
416 | while ( blk != ~(unsigned long)0 ) { | |
417 | printf( "Found tracks in block %lu\n", blk ); | |
418 | const AliHLTTPCTrackletData* trackData = (const AliHLTTPCTrackletData*)reader->GetBlockData( blk ); | |
419 | if ( !trackData ) { | |
420 | printf( "No track data for block %lu\n", blk ); | |
421 | continue; | |
422 | } | |
423 | ||
424 | ULong_t spec = reader->GetBlockDataSpec( blk ); | |
425 | Int_t patchmin = AliHLTTPCDefinitions::GetMinPatchNr( spec ); | |
426 | Int_t patchmax = AliHLTTPCDefinitions::GetMaxPatchNr( spec ); | |
427 | Int_t slice = AliHLTTPCDefinitions::GetMinSliceNr( spec ); | |
428 | ||
429 | printf( "%lu tracks found for slice %u - patch %u-%u\n", trackData->fTrackletCnt, slice, patchmin, patchmax ); | |
430 | ||
431 | void* tmp40 = trackData; | |
432 | Byte_t* tmp41 = (Byte_t*)tmp40; | |
433 | unsigned long offset; | |
434 | ||
435 | offset = sizeof(trackData->fTrackletCnt); | |
436 | ||
437 | if ( offset <= reader->GetBlockTypeAlignment( blk, 1 ) ) offset = reader->GetBlockTypeAlignment( blk, 1 ); | |
438 | ||
439 | tmp41 += offset; | |
440 | tmp40 = tmp41; | |
441 | AliHLTTPCTrackSegmentData* tmp42 = (AliHLTTPCTrackSegmentData*)tmp40; | |
442 | ||
443 | trackArray->FillTracks( trackData->fTrackletCnt, tmp42, slice ); | |
444 | ||
445 | blk = reader->FindBlockNdx( trkID, " CPT", 0xFFFFFFFF, blk+1 ); | |
446 | } | |
447 | ||
448 | ||
449 | } | |
450 | ||
451 | display->SetTracks( trackArray ); | |
452 | ||
453 | // DISPLAY | |
454 | display->DisplayAll( minHits, clusterswitch, trackswitch, x3don, 0. /*, clustersEtaRange */ ); | |
455 | if ( padrowswitch) display->DrawPadRow(x3don); | |
456 | ||
457 | if ( trackArray ) delete trackArray; | |
458 | ||
459 | return 0; | |
460 | } | |
461 | ||
462 | // ######################################################################################################################################## | |
463 | // ######################################################################################################################################## | |
464 | // ######################################################################################################################################## | |
465 | int ODH_SimpleDisplay(char * infiles[7],unsigned int slice){ | |
466 | if ( !gODH_Display ) return -1; | |
467 | ||
468 | FILE * inFH = 1; | |
469 | AliHLTTPCDisplay* display = (AliHLTTPCDisplay*)gODH_Display; | |
470 | int i = 1; | |
471 | char* error = NULL; | |
472 | int errorArg = -1; | |
473 | int errorParam = -1; | |
474 | ||
475 | AliHLTComponent_DataType dataType; | |
476 | AliHLTUInt32_t dataSpec = ~(AliHLTUInt32_t)0; | |
477 | dataType.fStructSize = sizeof(dataType); | |
478 | memset( dataType.fID, '*', 8 ); | |
479 | memset( dataType.fOrigin, '*', 4 ); | |
480 | AliHLTComponent_BlockData blocks[7]; | |
481 | unsigned long totalRead = 0; | |
482 | ||
483 | // --- get INFILE | |
484 | for (int ii = 0;ii<7;ii++){ | |
485 | ||
486 | inFH = fopen( infiles[ii], "r"); | |
487 | if ( inFH == -1 ) { | |
488 | error = "Unable to open input file for reading"; | |
489 | errorArg = i; | |
490 | errorParam = i+1; | |
491 | break; | |
492 | } | |
493 | ||
494 | AliHLTComponent_BlockData newBlock; | |
495 | newBlock.fStructSize = sizeof(AliHLTComponent_BlockData); | |
496 | ||
497 | newBlock.fShmKey.fStructSize = sizeof(AliHLTComponent_ShmData); | |
498 | newBlock.fShmKey.fShmType = gkAliHLTComponent_InvalidShmType; | |
499 | newBlock.fShmKey.fShmID = gkAliHLTComponent_InvalidShmID; | |
500 | ||
501 | fseek( inFH, 0, SEEK_END ); | |
502 | long sz = ftell(inFH); | |
503 | ||
504 | fseek( inFH, 0, SEEK_SET); | |
505 | newBlock.fPtr = new uint8[ sz ]; | |
506 | ||
507 | if ( !newBlock.fPtr ) { | |
508 | fprintf( stderr, "Out of memory trying to allocate memory for input file '%s' of %lu bytes.\n", | |
509 | infile, sz ); | |
510 | return -1; | |
511 | } | |
512 | ||
513 | unsigned long curSize = 0; | |
514 | int ret=1; | |
515 | void * tmp50 = newBlock.fPtr; | |
516 | uint8* tmp51 = (uint8*)tmp50; | |
517 | while ( ret>0 ) { | |
518 | ret = fread(tmp51+curSize,1, sz-curSize,inFH); | |
519 | ||
520 | if ( ret >= 0 ) { | |
521 | curSize += (unsigned long)ret; | |
522 | if ( curSize >= (unsigned long)sz ) { | |
523 | newBlock.fSize = sz; | |
524 | blocks[ii] = newBlock; | |
525 | break; | |
526 | } | |
527 | } | |
528 | else { | |
529 | fprintf( stderr, "%s error reading data from input file after %lu bytes.\n", infile, curSize ); | |
530 | return -1; | |
531 | } | |
532 | } | |
533 | } | |
534 | ||
535 | // --- Setup CLUSTERS | |
536 | for (int ii = 1;ii<7;ii++){ | |
537 | unsigned int patch = ii - 1; | |
538 | const AliHLTTPCClusterData* clusterData = (const AliHLTTPCClusterData*) blocks[ii].fPtr; | |
539 | ||
540 | if ( !clusterData ) { | |
541 | printf( "No ClusterData\n" ); | |
542 | return -1; | |
543 | } | |
544 | ||
545 | void* tmp30 = clusterData; | |
546 | Byte_t* tmp31 = (Byte_t*)tmp30; | |
547 | unsigned long offset; | |
548 | ||
549 | offset = sizeof(clusterData->fSpacePointCnt); | |
550 | ||
551 | tmp31 += offset; | |
552 | tmp30 = tmp31; | |
553 | AliHLTTPCSpacePointData* tmp32 = (AliHLTTPCSpacePointData*)tmp30; | |
554 | ||
555 | display->SetupClusterDataForPatch( slice, patch, clusterData->fSpacePointCnt, tmp32 ); | |
556 | } | |
557 | ||
558 | // --- Setup TRACKS | |
559 | AliHLTTPCTrackArray* trackArray = NULL; | |
560 | trackArray = new AliHLTTPCTrackArray; | |
561 | ||
562 | if ( !trackArray ) { | |
563 | printf( "No track array\n" ); | |
564 | return -1; | |
565 | } | |
566 | ||
567 | const AliHLTTPCTrackletData* trackData = (const AliHLTTPCTrackletData*) blocks[0].fPtr; | |
568 | if ( !trackData ) | |
569 | { | |
570 | printf( "No track data for block %lu\n", blk ); | |
571 | continue; | |
572 | } | |
573 | ||
574 | void* tmp40 = trackData; | |
575 | Byte_t* tmp41 = (Byte_t*)tmp40; | |
576 | unsigned long offset; | |
577 | ||
578 | offset = sizeof(trackData->fTrackletCnt); | |
579 | ||
580 | tmp41 += offset; | |
581 | tmp40 = tmp41; | |
582 | AliHLTTPCTrackSegmentData* tmp42 = (AliHLTTPCTrackSegmentData*)tmp40; | |
583 | ||
584 | trackArray->FillTracks( trackData->fTrackletCnt, tmp42, slice ); | |
585 | ||
586 | display->SetTracks( trackArray ); | |
587 | ||
588 | // --- Display | |
589 | Int_t minHits = 0; | |
590 | ||
591 | display->SetSlices(0,4); | |
592 | display->DisplayAll( minHits, clusterswitch, trackswitch, kFALSE, 0. /*, clustersEtaRange */ ); | |
593 | if ( trackArray ) delete trackArray; | |
594 | ||
595 | return 0; | |
596 | ||
597 | } // END ODH_SimpleDisplay |