]>
Commit | Line | Data |
---|---|---|
36782fc0 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Authors: Jochen Thaeder <thaeder@kip.uni-heidelberg.de> * | |
5 | * for The ALICE Off-line Project. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | /** @file AliHLTTPCDisplayMain.cxx | |
17 | @author Jochen Thaeder | |
18 | @date | |
19 | @brief Interface class for ALICE HLT online Display | |
78b557c2 | 20 | */ |
78b557c2 | 21 | |
78b557c2 | 22 | |
78b557c2 | 23 | #if defined(HAVE_HOMERREADER) |
f8c5e339 | 24 | #include HOMERREADER_HEADER |
78b557c2 | 25 | #endif // defined(HAVE_HOMERREADER) |
26 | //----------- | |
27 | #include "AliHLTTPCDisplayMain.h" | |
28 | #include "AliHLTTPCDisplayCharge.h" | |
29 | #include "AliHLTTPCDisplayPadRow.h" | |
30 | #include "AliHLTTPCDisplayPad.h" | |
31 | #include "AliHLTTPCDisplay3D.h" | |
32 | #include "AliHLTTPCDisplayResiduals.h" | |
33 | #include "AliHLTTPCDisplayFront.h" | |
34 | //----------- | |
35 | #include "AliHLTStdIncludes.h" | |
36 | #include "AliHLTTPCDefinitions.h" | |
37 | #include "AliHLTDataTypes.h" | |
38 | #include "AliHLTTPCSpacePointData.h" | |
39 | #include "AliHLTTPCClusterDataFormat.h" | |
40 | #include "AliHLTTPCTrackletDataFormat.h" | |
41 | #include "AliHLTTPCDigitReader.h" | |
51b88d1e | 42 | #include "AliHLTTPCDigitReaderDecoder.h" |
5235c3e9 | 43 | #include "AliHLTTPCPad.h" |
78b557c2 | 44 | #include "AliHLT_C_Component_WrapperInterface.h" |
45 | #include "AliHLTTPCLogging.h" | |
46 | ||
47 | #include "AliHLTTPCTransform.h" | |
48 | #include "AliHLTTPCTrack.h" | |
49 | #include "AliHLTTPCTrackArray.h" | |
50 | #include "AliHLTTPCMemHandler.h" | |
51 | #include "AliHLTTPCDigitReaderPacked.h" | |
52 | ||
53 | #ifdef use_aliroot | |
54 | #include <TClonesArray.h> | |
55 | #include <AliRun.h> | |
56 | #include <AliSimDigits.h> | |
57 | #include <AliTPCParam.h> | |
58 | #endif | |
59 | ||
60 | #if __GNUC__ >= 3 | |
61 | using namespace std; | |
62 | #endif | |
63 | ||
ecefc48a | 64 | // -- input datatypes , reverse |
65 | const Char_t* spptID = "SRETSULC"; // CLUSTERS | |
66 | const Char_t* trksegID = "SGESKART"; // TRAKSEGS | |
67 | const Char_t* trkID = " SKCART"; // TRACKS | |
68 | const Char_t* padrowID = "KPWR_LDD"; // DDL_RWPK | |
69 | ||
78b557c2 | 70 | ClassImp(AliHLTTPCDisplayMain) |
71 | ||
72 | //____________________________________________________________________________________________________ | |
5eefc803 | 73 | AliHLTTPCDisplayMain::AliHLTTPCDisplayMain(void* pt2GUI, void (*pt2Function)(void*, Int_t)) : |
74 | fPt2Gui(pt2GUI), | |
75 | fPadCallback(pt2Function), | |
76 | fReader(NULL), | |
77 | fTrackParam(), | |
78 | fCanvasArray(NULL), | |
79 | fWorkerArray(NULL), | |
80 | fgNTimeBins(1024), // 446 or 1024 | |
81 | fRawReaderMode(0), | |
82 | fZeroSuppressionThreshold (10), | |
83 | fOccupancyLimit(1.0), | |
84 | fBField(0.4), | |
85 | fNTimeBins(1024), | |
86 | fEventID(0), | |
87 | fConnect(kFALSE), | |
88 | fExistsRawData(kFALSE), | |
89 | fExistsClusterData(kFALSE), | |
90 | fExistsTrackData(kFALSE), | |
91 | fDisplayCharge(NULL), | |
92 | fDisplayPadRow(NULL), | |
93 | fDisplayPad(NULL), | |
94 | fDisplay3D(NULL), | |
95 | fDisplayResiduals(NULL), | |
96 | fDisplayFront(NULL), | |
97 | fCanvasCharge(NULL), | |
98 | fCanvasPadRow(NULL), | |
99 | fCanvasPad(NULL), | |
100 | fCanvas3D(NULL), | |
101 | fCanvasResiduals(NULL), | |
102 | fCanvasFront(NULL), | |
103 | fCanvasHits_S(NULL), | |
104 | fCanvasQ_Track(NULL), | |
105 | fCanvasQ_S(NULL), | |
106 | fCanvasPadRow_Pad(NULL), | |
107 | fTracksPerSlice(), | |
108 | fClusters(), | |
109 | fTracks(NULL), | |
110 | fNcl(), | |
111 | fMinSlice(0), | |
112 | fMaxSlice(35), | |
113 | fSlicePair(kFALSE), | |
114 | fSliceArray(), | |
115 | fSelectCluster(), | |
116 | fZeroSuppression( kTRUE ), | |
117 | fPad(-1), | |
118 | fNPads( AliHLTTPCTransform::GetNPads(0) ), | |
119 | fPadRow(0), | |
120 | fSlicePadRow(0), | |
121 | fSplitPadRow(kFALSE), | |
122 | fFrontDataSwitch(2), | |
123 | fTimeBinMin(0), | |
124 | fTimeBinMax(1024), | |
125 | fSplitFront(kFALSE), | |
126 | fSelectTrackSwitch(kFALSE), | |
127 | fSelectTrack(-1), | |
128 | fSelectTrackSlice(0), | |
129 | fCutHits(0), | |
130 | fCutPt(0.), | |
131 | fCutPsi(0.), | |
132 | fCutLambda(0.), | |
133 | fCut_S(0.), | |
134 | fCutPadrow(159), | |
135 | fKeepView(kTRUE), | |
136 | fTheta(90.), | |
137 | fPhi(0.), | |
138 | fBackColor(1), | |
139 | fLineColor(0), | |
140 | fSwitch3DCluster(kFALSE), | |
141 | fSwitch3DTracks(kFALSE), | |
142 | fSwitch3DPadRow(kFALSE), | |
143 | fSwitch3DGeometry(kTRUE), | |
144 | fSwitch3DRaw(0) { | |
5235c3e9 | 145 | //constructor |
78b557c2 | 146 | |
d54f579e | 147 | AliHLTLogging::SetGlobalLoggingLevel(kHLTLogError); |
36782fc0 | 148 | |
149 | fCanvasArray = new TCanvas* [nCanvasTypes]; | |
150 | fWorkerArray = new void* [nWorkerTypes]; | |
5eefc803 | 151 | |
5235c3e9 | 152 | memset(fClusters,0,36*6*sizeof(AliHLTTPCSpacePointData*)); |
153 | memset(fNcl, 0, 36*6*sizeof(UInt_t)); | |
154 | ||
155 | fTracks = NULL; | |
156 | ||
5235c3e9 | 157 | fTimeBinMax = GetNTimeBins() -1; |
5235c3e9 | 158 | |
5235c3e9 | 159 | SetSliceArray(); |
160 | ||
5235c3e9 | 161 | fTrackParam.kappa = 0.; |
162 | fTrackParam.nHits = 0; | |
163 | fTrackParam.charge = 0; | |
164 | fTrackParam.radius = 0.; | |
165 | fTrackParam.slice = 0; | |
166 | fTrackParam.phi0 = 0.; | |
167 | fTrackParam.psi = 0.; | |
168 | fTrackParam.lambda = 0.; | |
169 | fTrackParam.pt = 0.; | |
170 | fTrackParam.id = 0; | |
171 | fTrackParam.bfield = 0.; | |
172 | fTrackParam.s = 0.; | |
78b557c2 | 173 | } |
174 | ||
175 | //____________________________________________________________________________________________________ | |
176 | AliHLTTPCDisplayMain::~AliHLTTPCDisplayMain() { | |
36782fc0 | 177 | //destructor |
178 | if ( fTracks ) delete fTracks; | |
179 | fTracks = NULL; | |
180 | ||
181 | if ( fCanvasArray ) delete fTracks; | |
182 | fTracks = NULL; | |
183 | ||
184 | if ( fWorkerArray ) delete fWorkerArray; | |
185 | fWorkerArray = NULL; | |
78b557c2 | 186 | |
187 | #if defined(HAVE_HOMERREADER) | |
36782fc0 | 188 | HOMERReader* reader= (HOMERReader*) fReader; |
78b557c2 | 189 | |
190 | if (reader) | |
191 | delete reader; | |
192 | fReader = NULL; | |
193 | #endif // defined(HAVE_HOMERREADER) | |
194 | ||
195 | if (fDisplayResiduals) | |
196 | delete fDisplayResiduals; | |
197 | fDisplayResiduals = NULL; | |
198 | ||
199 | if (fDisplay3D) | |
200 | delete fDisplay3D; | |
201 | fDisplay3D = NULL; | |
202 | ||
203 | if (fDisplayPad) | |
204 | delete fDisplayPad; | |
205 | fDisplayPad = NULL; | |
206 | ||
207 | if (fDisplayPadRow) | |
208 | delete fDisplayPadRow; | |
209 | fDisplayPadRow = NULL; | |
210 | ||
211 | if (fDisplayFront) | |
212 | delete fDisplayFront; | |
213 | fDisplayFront = NULL; | |
214 | ||
215 | if (fDisplayCharge) | |
216 | delete fDisplayCharge; | |
217 | fDisplayCharge = NULL; | |
218 | } | |
219 | ||
220 | //____________________________________________________________________________________________________ | |
221 | Int_t AliHLTTPCDisplayMain::Connect( unsigned int cnt, const char** hostnames, unsigned short* ports, Char_t *gfile){ | |
222 | ||
f3f599e0 | 223 | Char_t* defaultGeometry=NULL; |
224 | #if defined(DEFAULT_GEOMETRY) | |
225 | defaultGeometry=DEFAULT_GEOMETRY; | |
226 | #endif | |
227 | if (gfile!=NULL) { | |
228 | HLTDebug("probing geometry file %s", gfile); | |
229 | ifstream test(gfile); | |
230 | if (test.fail()) { | |
231 | HLTWarning("unable to find geometry file %s, using default file", gfile); | |
232 | gfile=defaultGeometry; | |
233 | } | |
234 | test.close(); | |
235 | } else { | |
236 | HLTDebug("using default geometry file %s", gfile, defaultGeometry); | |
237 | gfile=defaultGeometry; | |
238 | } | |
239 | if (gfile==NULL) { | |
240 | HLTError("geometry file missing"); | |
241 | return -EINVAL; | |
242 | } | |
78b557c2 | 243 | #if defined(HAVE_HOMERREADER) |
5235c3e9 | 244 | |
245 | Int_t ret; | |
246 | ||
247 | while(1) { | |
248 | ||
249 | // -- CONNECT to TCPDumpSubscriber via HOMER | |
250 | // --------------------------------------------- | |
251 | HOMERReader* reader = new HOMERReader( cnt, (const char**) hostnames, ports ); | |
252 | ret=reader->GetConnectionStatus(); | |
78b557c2 | 253 | |
5235c3e9 | 254 | if ( ret ) { |
255 | Int_t ndx = reader->GetErrorConnectionNdx(); | |
256 | if ( ndx < (Int_t) cnt) HLTError("Error establishing connection to TCP source %s:%hu: %s (%d)\n", hostnames[ndx], ports[ndx], strerror(ret), ret ); | |
257 | else HLTError("Error establishing connection to unknown source with index %d: %s (%d)\n",ndx, strerror(ret), ret ); | |
258 | ||
259 | delete reader; | |
260 | reader = NULL; | |
261 | return -1; | |
262 | } | |
78b557c2 | 263 | |
5235c3e9 | 264 | // -- ERROR HANDLING for HOMER (error codes and empty blocks) |
265 | // -------------------------------------------------------------- | |
266 | Int_t ret1 = reader->ReadNextEvent(3000000); // timeout in microseconds (3s) | |
36782fc0 | 267 | |
5235c3e9 | 268 | if ( ret1 ) { |
269 | Int_t ndx = reader->GetErrorConnectionNdx(); | |
270 | ||
36782fc0 | 271 | if ( ret1 == 111 || ret1 == 32 ) { |
5235c3e9 | 272 | HLTError( "Error, No Connection to source %d: %s (%d)\n", ndx, strerror(ret1), ret1 ); |
36782fc0 | 273 | |
5235c3e9 | 274 | delete reader; |
275 | reader = NULL; | |
276 | ||
277 | return -1; | |
278 | } | |
279 | else if (ret1 == 110){ | |
280 | HLTError( "Timout occured, reading event from source %d: %s (%d)\n", ndx, strerror(ret1), ret1 ); | |
36782fc0 | 281 | |
5235c3e9 | 282 | delete reader; |
283 | reader = NULL; | |
284 | ||
285 | return -2; | |
286 | } | |
36782fc0 | 287 | else if ( ret1 == 56 || ret1 == 6 ) { |
5235c3e9 | 288 | HLTError( "Error reading event from source %d: %s (%d) -- RETRY\n", ndx, strerror(ret1), ret1 ); |
36782fc0 | 289 | |
5235c3e9 | 290 | delete reader; |
291 | reader = NULL; | |
292 | ||
293 | continue; | |
294 | } | |
295 | else { | |
296 | HLTError( "General Error reading event from source %d: %s (%d)\n", ndx, strerror(ret1), ret1 ); | |
36782fc0 | 297 | |
5235c3e9 | 298 | delete reader; |
299 | reader = NULL; | |
300 | ||
301 | return -3; | |
302 | } | |
303 | } | |
78b557c2 | 304 | |
5235c3e9 | 305 | unsigned long blockCnt = reader->GetBlockCnt(); |
78b557c2 | 306 | |
5235c3e9 | 307 | HLTDebug( "Event 0x%016LX (%Lu) with %lu blocks\n", (ULong64_t)reader->GetEventID(), (ULong64_t)reader->GetEventID(), blockCnt ); |
78b557c2 | 308 | |
5235c3e9 | 309 | if (blockCnt == 0){ |
310 | delete reader; | |
311 | reader = NULL; | |
312 | continue; | |
78b557c2 | 313 | } |
5235c3e9 | 314 | |
315 | // SWITCH on the Display parts according what DATATAYPES are present | |
316 | // --------------------------------------------------------------------- | |
317 | for ( unsigned long i = 0; i < blockCnt; i++ ) { | |
318 | char tmp1[9]; | |
319 | memset( tmp1, 0, 9 ); | |
320 | void *tmp11 = tmp1; | |
321 | ULong64_t* tmp12 = (ULong64_t*)tmp11; | |
322 | *tmp12 = reader->GetBlockDataType( i ); | |
36782fc0 | 323 | |
5235c3e9 | 324 | if (!strcmp(tmp1,padrowID)) fExistsRawData = kTRUE; |
325 | else if (!strcmp(tmp1,spptID)) fExistsClusterData = kTRUE; | |
ecefc48a | 326 | else if (!strcmp(tmp1,trksegID)) fExistsTrackData = kTRUE; |
5235c3e9 | 327 | else if (!strcmp(tmp1,trkID)) fExistsTrackData = kTRUE; |
78b557c2 | 328 | } |
5235c3e9 | 329 | |
330 | // -- Set reader and eventID | |
331 | // ------------------------------- | |
332 | fEventID = (ULong64_t)reader->GetEventID(); | |
333 | fReader = (void*) reader; | |
334 | fConnect = kTRUE; | |
335 | ||
336 | break; // leave while(1), if connected to source | |
337 | } | |
78b557c2 | 338 | |
5235c3e9 | 339 | |
340 | // -- Initialize TPC Display Classes -- IMPORTANT... don't change the order of them | |
341 | // Check if necessary data types are present | |
342 | // ------------------------------------------------------------------------------------ | |
343 | fDisplay3D = new AliHLTTPCDisplay3D(this, gfile); | |
36782fc0 | 344 | |
5235c3e9 | 345 | if (ExistsRawData()){ |
346 | fDisplayPadRow = new AliHLTTPCDisplayPadRow(this); | |
347 | fDisplayPad = new AliHLTTPCDisplayPad(this); | |
348 | fDisplayFront = new AliHLTTPCDisplayFront(this); | |
349 | } | |
350 | ||
351 | if (ExistsClusterData()){ | |
352 | fDisplayCharge = new AliHLTTPCDisplayCharge(this); | |
353 | } | |
354 | ||
355 | if (ExistsTrackData() && ExistsClusterData() ){ | |
356 | fDisplayResiduals = new AliHLTTPCDisplayResiduals(this); | |
357 | } | |
78b557c2 | 358 | |
36782fc0 | 359 | |
78b557c2 | 360 | |
78b557c2 | 361 | #else |
5235c3e9 | 362 | HLTFatal("HOMER reader not available"); |
36782fc0 | 363 | #endif // defined(HAVE_HOMERREADER) |
364 | ||
365 | return 0; | |
78b557c2 | 366 | } |
367 | ||
368 | //____________________________________________________________________________________________________ | |
5235c3e9 | 369 | Int_t AliHLTTPCDisplayMain::Disconnect(){ |
78b557c2 | 370 | #if defined(HAVE_HOMERREADER) |
371 | // READ CLUSTER and TRACK data | |
372 | HOMERReader* reader = (HOMERReader*)fReader; | |
373 | ||
5235c3e9 | 374 | if (reader) |
375 | delete reader; | |
376 | fReader = NULL; | |
78b557c2 | 377 | |
5235c3e9 | 378 | #else |
379 | HLTFatal("HOMER raeder not available"); | |
380 | #endif // defined(HAVE_HOMERREADER) | |
78b557c2 | 381 | |
5235c3e9 | 382 | return 0; |
383 | } | |
78b557c2 | 384 | |
78b557c2 | 385 | |
5235c3e9 | 386 | //____________________________________________________________________________________________________ |
387 | Int_t AliHLTTPCDisplayMain::ReadData(Bool_t nextSwitch){ | |
388 | // READ CLUSTER and TRACK data | |
78b557c2 | 389 | |
5235c3e9 | 390 | #if defined(HAVE_HOMERREADER) |
391 | HOMERReader* reader = (HOMERReader*)fReader; | |
36782fc0 | 392 | |
5235c3e9 | 393 | // -- reset TracksPerSlice Array |
394 | for(Int_t ii=0;ii<36;ii++) fTracksPerSlice[ii] = 0; | |
395 | ||
396 | Int_t ret; | |
397 | ULong_t blk; | |
398 | ||
399 | // -- READ next event data and ERROR HANDLING for HOMER (error codes and empty blocks) | |
400 | // --------------------------------------------------------------------------------------- | |
401 | if (nextSwitch) { | |
78b557c2 | 402 | |
5235c3e9 | 403 | while(1){ |
404 | ret = reader->ReadNextEvent(); | |
405 | ||
406 | if ( ret == 111 || ret == 32 || ret == 6 ) { | |
407 | Int_t ndx = reader->GetErrorConnectionNdx(); | |
408 | HLTError( "Error, No Connection to source %d: %s (%d)\n", ndx, strerror(ret), ret ); | |
409 | return -1; | |
410 | } | |
411 | else if ( ret == 110 ) { | |
412 | Int_t ndx = reader->GetErrorConnectionNdx(); | |
413 | HLTError( "Timout occured, reading event from source %d: %s (%d)\n", ndx, strerror(ret), ret ); | |
414 | return -2; | |
415 | } | |
416 | else if ( ret == 56) { | |
417 | Int_t ndx = reader->GetErrorConnectionNdx(); | |
418 | HLTError( "Error reading event from source %d: %s (%d) -- RETRY\n", ndx, strerror(ret), ret ); | |
419 | continue; | |
420 | } | |
421 | else if ( ret ) { | |
422 | Int_t ndx = reader->GetErrorConnectionNdx(); | |
423 | HLTError( "General Error reading event from source %d: %s (%d)\n", ndx, strerror(ret), ret ); | |
424 | return -3; | |
425 | } | |
426 | else { | |
427 | break; | |
428 | } | |
429 | } | |
430 | } // end if (nextSwitch) | |
431 | ||
36782fc0 | 432 | // -- Get blockCnt and eventID |
5235c3e9 | 433 | // ------------------------------- |
434 | ULong_t blockCnt = reader->GetBlockCnt(); | |
435 | fEventID = (ULong64_t)reader->GetEventID(); | |
436 | ||
36782fc0 | 437 | HLTError( "Event 0x%016LX (%Lu) with %lu blocks\n", (ULong64_t)reader->GetEventID(), (ULong64_t)reader->GetEventID(), blockCnt ); |
5235c3e9 | 438 | |
439 | // Loop for Debug only | |
440 | for ( ULong_t i = 0; i < blockCnt; i++ ) { | |
441 | Char_t tmp1[9], tmp2[5]; | |
442 | memset( tmp1, 0, 9 ); | |
443 | memset( tmp2, 0, 5 ); | |
444 | void *tmp11 = tmp1; | |
445 | ULong64_t* tmp12 = (ULong64_t*)tmp11; | |
446 | *tmp12 = reader->GetBlockDataType( i ); | |
447 | void *tmp21 = tmp2; | |
448 | ULong_t* tmp22 = (ULong_t*)tmp21; | |
449 | *tmp22 = reader->GetBlockDataOrigin( i ); | |
450 | ||
36782fc0 | 451 | HLTError( "Block %lu length: %lu - type: %s - origin: %s\n",i, reader->GetBlockDataLength( i ), tmp1, tmp2 ); |
5235c3e9 | 452 | } // end for ( ULong_t i = 0; i < blockCnt; i++ ) { |
453 | ||
454 | ||
455 | // -- READ RAW DATA | |
456 | //--------------------- | |
457 | ReadRawData(); | |
458 | ||
459 | // -- READ CLUSTER DATA | |
460 | //------------------------- | |
461 | ReadClusterData(); | |
462 | ||
463 | // -- READ TRACKS | |
464 | //------------------- | |
465 | ReadTrackData(); | |
466 | ||
78b557c2 | 467 | #else |
5235c3e9 | 468 | HLTFatal("HOMER raeder not available"); |
78b557c2 | 469 | #endif // defined(HAVE_HOMERREADER) |
5235c3e9 | 470 | |
471 | return 0; | |
78b557c2 | 472 | } |
473 | ||
474 | //____________________________________________________________________________________________________ | |
5235c3e9 | 475 | void AliHLTTPCDisplayMain::DisplayEvent(Bool_t newRawSlice){ |
78b557c2 | 476 | #if defined(HAVE_HOMERREADER) |
477 | HOMERReader* reader = (HOMERReader*)fReader; | |
478 | ||
479 | //-------------------------------------------------------------------------------------------- | |
480 | // READ RAW DATA for PADROW/PAD HISTOGRAM | |
481 | //-------------------------------------------------------------------------------------------- | |
482 | if ( ExistsRawData() ){ | |
483 | fDisplayPadRow->Reset(); | |
484 | fDisplayPad->Reset(); | |
485 | fDisplayFront->Reset(); | |
486 | ||
36782fc0 | 487 | if (newRawSlice) ReadRawData(); |
5235c3e9 | 488 | |
489 | ||
36782fc0 | 490 | fDisplayPad->Fill(); |
491 | fDisplayPadRow->Fill(); | |
492 | fDisplayFront->Fill(); | |
5235c3e9 | 493 | |
5235c3e9 | 494 | |
78b557c2 | 495 | fDisplayPad->Draw(); |
496 | fDisplayPadRow->Draw(); | |
497 | fDisplayFront->Draw(); | |
498 | } | |
499 | ||
500 | //-------------------------------------------------------------------------------------------- | |
501 | // DRAW RESIDUALS | |
502 | //-------------------------------------------------------------------------------------------- | |
503 | if ( ExistsClusterData() && ExistsTrackData() ){ | |
504 | fDisplayResiduals->Reset(); | |
505 | fDisplayResiduals->Fill(); | |
506 | fDisplayResiduals->Draw(); | |
507 | } | |
508 | ||
509 | //-------------------------------------------------------------------------------------------- | |
510 | // DRAW CHARGE | |
511 | //-------------------------------------------------------------------------------------------- | |
512 | if ( ExistsClusterData() ){ | |
513 | fDisplayCharge->Reset(); | |
514 | fDisplayCharge->Fill(); | |
515 | fDisplayCharge->Draw(); | |
516 | } | |
517 | ||
518 | //-------------------------------------------------------------------------------------------- | |
519 | // DRAW 3D | |
520 | //-------------------------------------------------------------------------------------------- | |
521 | ||
522 | // TAKE CARE !!! EXISTSxxxData() HANDLING of 3D will be done IN this class !!! | |
523 | fDisplay3D->Draw(); | |
36782fc0 | 524 | |
525 | cout << "afterdraw" << endl; | |
78b557c2 | 526 | #else |
5235c3e9 | 527 | HLTFatal("HOMER raeder not available"); |
78b557c2 | 528 | #endif // defined(HAVE_HOMERREADER) |
529 | ||
530 | } | |
531 | ||
532 | //____________________________________________________________________________________________________ | |
533 | void AliHLTTPCDisplayMain::SaveHistograms(){ | |
534 | // Save histograms as eps | |
535 | fDisplayCharge->Save(); | |
536 | fDisplayPadRow->Save(); | |
537 | fDisplayPad->Save(); | |
538 | fDisplay3D->Save(); | |
539 | fDisplayResiduals->Save(); | |
540 | fDisplayFront->Save(); | |
541 | fDisplayCharge->Save(); | |
542 | } | |
543 | ||
544 | //---------------------------------------------------------------------------------------------------- | |
36782fc0 | 545 | // READ DATA |
78b557c2 | 546 | //____________________________________________________________________________________________________ |
5235c3e9 | 547 | //____________________________________________________________________________________________________ |
548 | void AliHLTTPCDisplayMain::ReadRawData(){ | |
549 | // -- READ raw data of one sector into 3D arrays fRawData and fRawDataZeroSuppressed | |
550 | ||
551 | // -- reset arrays | |
552 | memset(fRawData, 0, 159*140*1024*sizeof(UInt_t)); | |
553 | memset(fRawDataZeroSuppressed, 0, 159*140*1024*sizeof(UInt_t)); | |
554 | ||
555 | #if defined(HAVE_HOMERREADER) | |
556 | HOMERReader* reader = (HOMERReader*)fReader; | |
557 | ||
558 | // -- read raw data blocks | |
559 | // --------------------------- | |
560 | ULong_t blk; | |
561 | Char_t* rawID = "KPWR_LDD"; | |
562 | blk = reader->FindBlockNdx( rawID, " CPT",0xFFFFFFFF ); | |
563 | ||
564 | while ( blk != ~(ULong_t)0 ) { | |
565 | HLTDebug( "Found raw data block %lu\n", blk ); | |
566 | ||
0b6c2560 | 567 | #if HOMER_VERSION >= 2 |
5235c3e9 | 568 | // -- Check for corrupt data |
569 | AliHLTUInt64_t corruptFlag = reader->GetBlockStatusFlags( blk ); | |
570 | if (corruptFlag & 0x00000001) { | |
571 | HLTError( "Data block %lu is corrupt\n",blk ); | |
572 | blk = reader->FindBlockNdx( rawID, " CPT", 0xFFFFFFFF, blk+1 ); | |
573 | continue; | |
574 | } | |
0b6c2560 | 575 | #endif |
5235c3e9 | 576 | |
577 | void* rawDataBlock = (void*) reader->GetBlockData( blk ); | |
578 | unsigned long rawDataLen = reader->GetBlockDataLength( blk ); | |
579 | ||
580 | ULong_t spec = reader->GetBlockDataSpec( blk ); | |
581 | Int_t patch = AliHLTTPCDefinitions::GetMinPatchNr( spec ); | |
582 | Int_t slice = AliHLTTPCDefinitions::GetMinSliceNr( spec ); | |
583 | ||
584 | HLTDebug( "Raw data found for slice %u - patch %u\n", slice, patch ); | |
585 | ||
586 | // -- Wrong slice for raw data | |
587 | if ( GetSlicePadRow() != slice) { | |
588 | blk = reader->FindBlockNdx( rawID, " CPT", 0xFFFFFFFF, blk+1 ); | |
589 | continue; | |
590 | } | |
591 | ||
5235c3e9 | 592 | // -- Read data out of block |
51b88d1e | 593 | AliHLTTPCDigitReaderDecoder digitReader; |
5235c3e9 | 594 | |
595 | // Initialize RAW DATA | |
596 | Int_t firstRow = AliHLTTPCTransform::GetFirstRow(patch); | |
597 | Int_t lastRow = AliHLTTPCTransform::GetLastRow(patch); | |
598 | ||
599 | // Outer sector, patches 2, 3, 4, 5 - start counting in patch 2 with row 0 | |
600 | Int_t rowOffset = 0; | |
601 | if ( patch >= 2 ) rowOffset = AliHLTTPCTransform::GetFirstRow( 2 ); | |
602 | ||
603 | // Initialize block for reading packed data | |
51b88d1e | 604 | digitReader.InitBlock(rawDataBlock,rawDataLen,patch,slice); |
5235c3e9 | 605 | |
606 | Bool_t readValue = digitReader.Next(); | |
607 | ||
608 | if (!readValue){ | |
609 | HLTError ( "No value in data block %lu \n", blk); | |
610 | blk = reader->FindBlockNdx( rawID, " CPT", 0xFFFFFFFF, blk+1 ); | |
611 | continue; | |
612 | } | |
613 | ||
614 | // -- Fill Zero Suppressed Array | |
615 | // --------------------------------- | |
616 | ||
617 | Int_t newRow = 0; | |
618 | UShort_t time=0,newTime=0; | |
619 | UInt_t pad=0,newPad=0; | |
620 | Int_t signal=0; | |
621 | ||
622 | Int_t gatingGridOffset=50; | |
36782fc0 | 623 | Int_t signalThreshold = GetZeroSuppressionThreshold(); |
5235c3e9 | 624 | AliHLTTPCPad baseline(gatingGridOffset, GetNTimeBins() ); |
625 | ||
626 | // just to make later conversion to a list of objects easier | |
627 | AliHLTTPCPad* pCurrentPad=NULL; | |
628 | if ( signalThreshold >= 0) { | |
629 | pCurrentPad=&baseline; | |
630 | baseline.SetThreshold(signalThreshold); | |
631 | } | |
632 | ||
633 | while ( readValue ) { // Reads through all digits in block | |
634 | ||
635 | while(1){ //Loop over time bins of current pad | |
636 | // read all the values for one pad at once to calculate the base line | |
637 | if (pCurrentPad) { | |
638 | ||
639 | if (!pCurrentPad->IsStarted()) { | |
640 | ||
f3f599e0 | 641 | // HLTDebug("reading data for pad %d, padrow %d", digitReader.GetPad(), digitReader.GetRow()+rowOffset); |
5235c3e9 | 642 | |
643 | pCurrentPad->SetID(digitReader.GetRow()+rowOffset,digitReader.GetPad()); | |
644 | ||
645 | if ( (pCurrentPad->StartEvent()) >= 0) { | |
646 | // loop over data of one pad and read it into AliHLTTPCPad class | |
647 | do { | |
648 | if ( (digitReader.GetRow()+rowOffset) != pCurrentPad->GetRowNumber() ) break; | |
649 | if ( digitReader.GetPad() != pCurrentPad->GetPadNumber() ) break; | |
650 | pCurrentPad->SetRawData( digitReader.GetTime(), digitReader.GetSignal() ); | |
651 | ||
f3f599e0 | 652 | // HLTDebug("set raw data to pad: bin %d charge %d", digitReader.GetTime(), digitReader.GetSignal()); |
5235c3e9 | 653 | |
654 | } while ( (readValue = digitReader.Next()) != 0 ); | |
655 | } | |
656 | ||
657 | // calculate baseline of pad | |
658 | pCurrentPad->CalculateBaseLine( GetNTimeBins() / 2); | |
659 | ||
660 | if ( pCurrentPad->Next(kTRUE/*do zero suppression*/) == 0 ) { | |
f3f599e0 | 661 | // HLTDebug("no data available after zero suppression"); |
5235c3e9 | 662 | |
663 | pCurrentPad->StopEvent(); | |
664 | pCurrentPad->ResetHistory(); | |
665 | break; | |
666 | } | |
667 | ||
668 | Int_t time = pCurrentPad->GetCurrentPosition(); | |
669 | if ( time > pCurrentPad->GetSize() ) { | |
670 | HLTError("invalid time bin for pad"); | |
671 | break; | |
672 | } | |
673 | } // end - if (!pCurrentPad->IsStarted()) { | |
674 | } // end - if (pCurrentPad) { | |
675 | ||
676 | if (pCurrentPad) { | |
677 | Float_t occupancy=pCurrentPad->GetOccupancy(); | |
36782fc0 | 678 | if ( occupancy < GetOccupancyLimit() ) { |
5235c3e9 | 679 | signal = pCurrentPad->GetCorrectedData(); |
680 | } | |
681 | else { | |
682 | signal = 0; | |
683 | HLTInfo("ignoring pad %d with occupancy level %f %%", pCurrentPad->GetPadNumber(), occupancy); | |
684 | } | |
685 | // signal = pCurrentPad->GetCorrectedData(); | |
686 | } else { | |
687 | signal = digitReader.GetSignal(); | |
688 | } | |
689 | ||
690 | fRawDataZeroSuppressed[ pCurrentPad->GetRowNumber() ][ pCurrentPad->GetPadNumber() ][ pCurrentPad->GetCurrentPosition() ] = (UInt_t)signal; | |
691 | ||
692 | ||
693 | HLTDebug("get next charge value: position %d charge %d", time, signal); | |
694 | ||
695 | if( time >= AliHLTTPCTransform::GetNTimeBins() ){ | |
696 | HLTWarning("Timebin (%d) out of range (%d)", time, AliHLTTPCTransform::GetNTimeBins()); | |
697 | break; | |
698 | } | |
699 | ||
700 | if (pCurrentPad) { | |
701 | ||
702 | if( (pCurrentPad->Next(kTRUE/*do zero suppression*/)) == 0 ) { | |
703 | pCurrentPad->StopEvent(); | |
704 | pCurrentPad->ResetHistory(); | |
705 | ||
706 | if(readValue) { | |
707 | newPad = digitReader.GetPad(); | |
708 | newTime = digitReader.GetTime(); | |
709 | newRow = digitReader.GetRow() + rowOffset; | |
710 | } | |
711 | break; | |
712 | } | |
713 | ||
714 | newPad=pCurrentPad->GetPadNumber(); | |
715 | newTime=pCurrentPad->GetCurrentPosition(); | |
716 | newRow=pCurrentPad->GetRowNumber(); | |
717 | } | |
718 | else { | |
719 | ||
720 | readValue = digitReader.Next(); | |
721 | ||
722 | //Check where to stop: | |
723 | if(!readValue) break; //No more value | |
724 | ||
725 | newPad = digitReader.GetPad(); | |
726 | newTime = digitReader.GetTime(); | |
727 | newRow = digitReader.GetRow() + rowOffset; | |
728 | } | |
729 | ||
730 | if(newPad != pad) break; //new pad | |
731 | if(newTime != time+1) break; //end of sequence | |
732 | ||
733 | time = newTime; | |
734 | ||
735 | } // end - while(1){ // Loop over time bins of current pad | |
736 | ||
737 | if ( !readValue ) break; | |
738 | ||
739 | } // end while ( readValue ) { | |
740 | ||
741 | // -- END ZERO SUPPRESSION | |
742 | ||
743 | // Rewind block for reading packed data | |
51b88d1e | 744 | digitReader.InitBlock(rawDataBlock,rawDataLen,patch,slice); |
5235c3e9 | 745 | |
746 | // -- Fill Raw Array | |
747 | // --------------------- | |
748 | readValue = digitReader.Next(); | |
749 | ||
750 | // LOOP over raw data and fill arrays | |
751 | while ( readValue ){ | |
752 | ||
753 | Int_t row = digitReader.GetRow() + rowOffset; | |
754 | Int_t pad = (Int_t) digitReader.GetPad(); | |
755 | Int_t time = (Int_t) digitReader.GetTime(); | |
756 | UInt_t signal = (UInt_t) digitReader.GetSignal(); | |
757 | ||
758 | fRawData[row][pad][time] = signal; | |
759 | ||
760 | // -- read next value | |
761 | readValue = digitReader.Next(); | |
762 | ||
763 | // -- No more value | |
764 | if(!readValue) break; | |
765 | ||
766 | } // end while ( readValue ){ | |
767 | ||
5235c3e9 | 768 | blk = reader->FindBlockNdx( rawID, " CPT", 0xFFFFFFFF, blk+1 ); |
769 | ||
770 | } // end while ( blk != ~(ULong_t)0 ) { | |
771 | ||
772 | #else | |
773 | HLTFatal("HOMER raeder not available"); | |
774 | #endif // defined(HAVE_HOMERREADER) | |
775 | ||
776 | } | |
777 | ||
778 | //____________________________________________________________________________________________________ | |
779 | void AliHLTTPCDisplayMain::ReadClusterData(){ | |
780 | // -- READ cluster data | |
781 | #if defined(HAVE_HOMERREADER) | |
782 | HOMERReader* reader = (HOMERReader*)fReader; | |
783 | ||
784 | ULong_t blk; | |
ecefc48a | 785 | blk = reader->FindBlockNdx( (char*)spptID, " CPT",0xFFFFFFFF ); |
5235c3e9 | 786 | |
787 | while ( blk != ~(ULong_t)0 ) { | |
788 | HLTDebug( "Found clusters block %lu\n", blk ); | |
789 | ||
790 | const AliHLTTPCClusterData* clusterData = (const AliHLTTPCClusterData*)reader->GetBlockData( blk ); | |
791 | if ( !clusterData ) { | |
792 | HLTError( "No track data for block %lu\n", blk ); | |
ecefc48a | 793 | blk = reader->FindBlockNdx( (char*)spptID, " CPT", 0xFFFFFFFF, blk+1 ); |
5235c3e9 | 794 | continue; |
795 | } | |
796 | ||
797 | ULong_t spec = reader->GetBlockDataSpec( blk ); | |
798 | Int_t patch = AliHLTTPCDefinitions::GetMinPatchNr( spec ); | |
799 | Int_t slice = AliHLTTPCDefinitions::GetMinSliceNr( spec ); | |
800 | ||
801 | HLTDebug( "%lu Clusters found for slice %u - patch %u\n", clusterData->fSpacePointCnt, slice, patch ); | |
802 | ||
803 | void* tmp30 = (void*)clusterData; | |
804 | Byte_t* tmp31 = (Byte_t*)tmp30; | |
805 | ULong_t offset; | |
806 | offset = sizeof(clusterData->fSpacePointCnt); | |
807 | if ( offset <= reader->GetBlockTypeAlignment( blk, 1 ) ) offset = reader->GetBlockTypeAlignment( blk, 1 ); | |
808 | tmp31 += offset; | |
809 | tmp30 = tmp31; | |
810 | AliHLTTPCSpacePointData* tmp32 = (AliHLTTPCSpacePointData*)tmp30; | |
811 | ||
812 | SetupCluster( slice, patch, clusterData->fSpacePointCnt, tmp32 ); | |
813 | ||
ecefc48a | 814 | blk = reader->FindBlockNdx( (char*)spptID, " CPT", 0xFFFFFFFF, blk+1 ); |
5235c3e9 | 815 | } |
816 | ||
817 | #else | |
818 | HLTFatal("HOMER raeder not available"); | |
819 | #endif // defined(HAVE_HOMERREADER) | |
820 | } | |
821 | //____________________________________________________________________________________________________ | |
822 | void AliHLTTPCDisplayMain::ReadTrackData(){ | |
823 | // -- READ track data | |
824 | ||
825 | if ( fTracks ) delete fTracks; | |
826 | fTracks = new AliHLTTPCTrackArray; | |
827 | ||
828 | #if defined(HAVE_HOMERREADER) | |
829 | HOMERReader* reader = (HOMERReader*)fReader; | |
830 | ||
ecefc48a | 831 | ULong_t blk=~(ULong_t)0; |
832 | const Char_t* searchIDs[]={trksegID, trkID, NULL}; | |
833 | const Char_t** currentID=searchIDs; | |
834 | do { | |
835 | blk = reader->FindBlockNdx( (char*)*currentID, " CPT", 0xFFFFFFFF ); | |
836 | } while (blk==~(ULong_t)0 && *(++currentID)!=NULL); | |
837 | ||
838 | while ( blk != ~(ULong_t)0 || (*currentID!=NULL && *(++currentID)!=NULL )) { | |
839 | if (blk == ~(ULong_t)0) { | |
840 | blk = reader->FindBlockNdx( (char*)*currentID, " CPT", 0xFFFFFFFF ); | |
841 | continue; | |
842 | } | |
5235c3e9 | 843 | |
ecefc48a | 844 | HLTDebug( "Found tracks in block %lu type %s\n", blk, *currentID ); |
5235c3e9 | 845 | |
846 | const AliHLTTPCTrackletData* trackData = (const AliHLTTPCTrackletData*)reader->GetBlockData( blk ); | |
847 | ||
848 | if ( !trackData ) { | |
849 | HLTError( "No track data for block %lu\n", blk ); | |
ecefc48a | 850 | blk = reader->FindBlockNdx( (char*)*currentID, " CPT", 0xFFFFFFFF, blk+1 ); |
5235c3e9 | 851 | continue; |
852 | } | |
853 | ||
854 | ULong_t spec = reader->GetBlockDataSpec( blk ); | |
855 | Int_t slice = AliHLTTPCDefinitions::GetMinSliceNr( spec ); | |
856 | Int_t patchmin = AliHLTTPCDefinitions::GetMinPatchNr( spec ); | |
857 | Int_t patchmax = AliHLTTPCDefinitions::GetMaxPatchNr( spec ); | |
858 | ||
859 | HLTDebug( "%lu tracks found for slice %u - patch %u-%u\n", trackData->fTrackletCnt, slice, patchmin, patchmax ); | |
860 | ||
861 | fTracksPerSlice[slice] = trackData->fTrackletCnt; // Fill number if tracks per slice | |
862 | ||
863 | AliHLTTPCTrackSegmentData* tmp42 = (AliHLTTPCTrackSegmentData*) &(trackData->fTracklets[0]); | |
ecefc48a | 864 | fTracks->FillTracks( trackData->fTrackletCnt, tmp42, slice, (*currentID==trksegID?1:0) ); |
5235c3e9 | 865 | |
ecefc48a | 866 | blk = reader->FindBlockNdx( (char*)*currentID, " CPT", 0xFFFFFFFF, blk+1 ); |
5235c3e9 | 867 | } |
868 | ||
869 | SetupTracks(); | |
870 | ||
871 | #else | |
872 | HLTFatal("HOMER raeder not available"); | |
873 | #endif // defined(HAVE_HOMERREADER) | |
874 | } | |
875 | ||
36782fc0 | 876 | //---------------------------------------------------------------------------------------------------- |
877 | // SETUP | |
878 | //____________________________________________________________________________________________________ | |
879 | void AliHLTTPCDisplayMain::SetupCluster(Int_t slice, Int_t patch, UInt_t nofClusters, AliHLTTPCSpacePointData* data) { | |
880 | ||
881 | if (data && slice>=0 && slice<36 && patch>=0 && patch<AliHLTTPCTransform::GetNPatches()) { | |
882 | if (fClusters[slice][patch]!=NULL) { | |
883 | delete(fClusters[slice][patch]); | |
884 | fClusters[slice][patch]=NULL; | |
885 | } | |
886 | Int_t arraysize=nofClusters*sizeof(AliHLTTPCSpacePointData); | |
887 | fClusters[slice][patch] = (AliHLTTPCSpacePointData*)new Byte_t[arraysize]; | |
888 | if (fClusters[slice][patch]) { | |
889 | memcpy(fClusters[slice][patch], data, arraysize); | |
890 | fNcl[slice][patch]=nofClusters; | |
891 | } else { | |
892 | fNcl[slice][patch]=nofClusters; | |
893 | HLTError ( "Memory allocation failed!" ); | |
894 | } | |
895 | } else HLTError ( "Invalid argument!" ); | |
896 | } | |
897 | ||
898 | //____________________________________________________________________________________________________ | |
899 | void AliHLTTPCDisplayMain::SetupTracks() { | |
900 | ||
901 | // Set USED cluster | |
902 | Int_t ntracks = fTracks->GetNTracks(); | |
903 | ||
904 | for(Int_t j=0; j<ntracks; j++) { | |
905 | AliHLTTPCTrack *gtrack = fTracks->GetCheckedTrack(j); | |
906 | if(!gtrack) continue; | |
907 | ||
908 | Int_t nHits = gtrack->GetNHits(); | |
909 | UInt_t *hitnum = gtrack->GetHitNumbers(); | |
910 | ||
911 | for(Int_t h=0; h<nHits; h++){ | |
912 | ||
913 | UInt_t id=hitnum[h]; | |
914 | Int_t slice = (id>>25) & 0x7f; | |
915 | Int_t patch = (id>>22) & 0x7; | |
916 | UInt_t pos = id&0x3fffff; | |
917 | ||
918 | AliHLTTPCSpacePointData *points = fClusters[slice][patch]; | |
919 | ||
920 | if(!points) { | |
921 | HLTError ( "No points at slice %d patch %d position %d!", slice, patch, pos ); | |
922 | continue; | |
923 | } | |
924 | ||
925 | if(pos>=fNcl[slice][patch]) { | |
926 | HLTError ( "Pos is too large: pos %d ncl!", pos,fNcl[slice][patch] ); | |
927 | continue; | |
928 | } | |
929 | points[pos].fUsed = kTRUE; | |
930 | points[pos].fTrackN = j; | |
931 | } | |
932 | } | |
933 | } | |
934 | ||
935 | // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | |
936 | // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | |
937 | // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | |
938 | // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | |
939 | // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | |
940 | // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | |
941 | // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | |
942 | // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | |
943 | // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | |
944 | // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | |
945 | // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | |
946 | // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | |
947 | ||
948 | ||
949 | //---------------------------------------------------------------------------------------------------- | |
950 | // SETTER | |
951 | //____________________________________________________________________________________________________ | |
952 | ||
953 | //____________________________________________________________________________________________________ | |
954 | void AliHLTTPCDisplayMain::SetSliceArray() { | |
955 | Int_t slice=0; | |
956 | Int_t minSlice = fMinSlice; | |
957 | Int_t maxSlice = fMaxSlice; | |
958 | Int_t realslice = 0; | |
959 | ||
960 | for (slice=0;slice< 36;slice++){ | |
961 | fSliceArray[slice] = kFALSE; | |
962 | } | |
963 | ||
964 | // Single Slice, or Range | |
965 | if (minSlice > maxSlice) maxSlice += 17; | |
966 | ||
967 | for (slice=minSlice;slice<=maxSlice;slice++){ | |
968 | realslice = slice % 18; | |
969 | fSliceArray[realslice] = kTRUE; | |
970 | fSliceArray[realslice+18] = kTRUE; | |
971 | } | |
972 | ||
973 | // Pair of Slices | |
974 | if (fSlicePair) { | |
975 | minSlice = fMinSlice + 9; | |
976 | maxSlice = fMaxSlice + 9; | |
977 | ||
978 | if (minSlice > maxSlice) maxSlice += 17; | |
979 | ||
980 | for (slice=minSlice;slice<=maxSlice;slice++){ | |
981 | realslice = slice % 18; | |
982 | fSliceArray[realslice] = kTRUE; | |
983 | fSliceArray[realslice+18] = kTRUE; | |
984 | } | |
985 | } | |
986 | } | |
987 | ||
988 | ||
78b557c2 | 989 | //---------------------------------------------------------------------------------------------------- |
990 | // GETTER | |
991 | //____________________________________________________________________________________________________ | |
992 | Int_t AliHLTTPCDisplayMain::GetGlobalTrack(Int_t slice){ | |
993 | // get global track out of the "selectTrack" parameters | |
994 | Int_t currenttrack= -1; | |
995 | Int_t trackcounter = 0; | |
996 | Int_t ntracks = fTracks->GetNTracks(); | |
997 | ||
998 | if ( slice == fSelectTrackSlice) { | |
999 | for(Int_t j=0; j<ntracks; j++) { | |
1000 | ||
1001 | AliHLTTPCTrack *gtrack = fTracks->GetCheckedTrack(j); | |
1002 | if(!gtrack) continue; | |
1003 | ||
1004 | // --- CHECK if track is should be drawn | |
1005 | // select Single Track | |
1006 | if(gtrack->GetSector() != fSelectTrackSlice) continue; | |
1007 | ||
1008 | if (trackcounter != fSelectTrack){ | |
1009 | trackcounter++; | |
1010 | continue; | |
1011 | } | |
1012 | trackcounter++; | |
1013 | // +++ | |
1014 | //if((fPtThreshold > 0) && (gtrack->GetPt()< fPtThreshold)) continue; | |
1015 | //if(gtrack->GetNHits() < fMinHits) continue; | |
1016 | ||
1017 | currenttrack = j; | |
1018 | break; | |
1019 | } | |
1020 | } | |
1021 | ||
1022 | return currenttrack; | |
1023 | } | |
1024 | ||
1025 | //---------------------------------------------------------------------------------------------------- | |
1026 | // EVENTS | |
1027 | //____________________________________________________________________________________________________ | |
5eefc803 | 1028 | void AliHLTTPCDisplayMain::ExecPadEvent(Int_t event, Int_t px, Int_t /*py*/, TObject *selected){ |
78b557c2 | 1029 | TCanvas *c = (TCanvas *) gTQSender; |
1030 | ||
1031 | if (event == 11 &&selected->InheritsFrom("TH2F")) { | |
1032 | TH2F *hist = (TH2F*) selected; | |
1033 | ||
1034 | Int_t binx = hist->GetXaxis()->FindBin(c->AbsPixeltoX(px)) -1 ; | |
1035 | // Int_t biny = hist->GetYaxis()->FindBin(c->AbsPixeltoY(py)) -1; | |
1036 | ||
1037 | fPadCallback(fPt2Gui, binx); | |
1038 | } | |
1039 | } | |
5235c3e9 | 1040 | |
1041 |