]>
Commit | Line | Data |
---|---|---|
8278a469 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
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 | ||
88cb7938 | 16 | /* $Id$ */ |
8278a469 | 17 | |
18 | ////////////////////////////////////////////////////////////////////////// | |
19 | // // | |
20 | // AliDisplay // | |
21 | // // | |
22 | // Utility class to display ALICE outline, tracks, hits,.. // | |
23 | // // | |
24 | ////////////////////////////////////////////////////////////////////////// | |
25 | ||
26 | #include <TROOT.h> | |
27 | #include <TTree.h> | |
28 | #include <TButton.h> | |
29 | #include <TColor.h> | |
30 | #include <TCanvas.h> | |
31 | #include <TView.h> | |
32 | #include <TText.h> | |
33 | #include <TPolyMarker3D.h> | |
488e98ba | 34 | #include <TAtt3D.h> |
35 | #include <TAttLine.h> | |
8278a469 | 36 | #include <TPolyMarker.h> |
37 | #include <TPaveLabel.h> | |
38 | #include <TPaveText.h> | |
39 | #include <TList.h> | |
40 | #include <TDiamond.h> | |
41 | #include <TNode.h> | |
42 | #include <TArc.h> | |
43 | #include <TTUBE.h> | |
44 | #include <TSlider.h> | |
94de3818 | 45 | #include <TGeometry.h> |
8278a469 | 46 | #include <TSliderBox.h> |
47 | #include <TGaxis.h> | |
48 | #include <TVirtualX.h> | |
49 | #include <TMath.h> | |
50 | #include <TRandom.h> | |
51 | #include <X3DBuffer.h> | |
237c933d | 52 | #include <TParticle.h> |
8278a469 | 53 | |
54 | #include "AliRun.h" | |
55 | #include "AliPDG.h" | |
56 | #include "AliDetector.h" | |
57 | #include "AliRICH.h" | |
58 | #include "AliRICHConst.h" | |
59 | #include "AliRICHDisplay.h" | |
60 | #include "AliRICHPoints.h" | |
9e1a0ddb | 61 | #include "AliHeader.h" |
8278a469 | 62 | |
237c933d | 63 | #include "AliRICHHit.h" |
64 | #include "AliRICHCerenkov.h" | |
b251a2b5 | 65 | #include "AliRICHSDigit.h" |
237c933d | 66 | #include "AliRICHDigit.h" |
67 | #include "AliRICHRawCluster.h" | |
a4622d0f | 68 | #include "AliRICHRecHit1D.h" |
69 | #include "AliRICHRecHit3D.h" | |
237c933d | 70 | #include "AliRICHEllipse.h" |
8278a469 | 71 | |
72 | ClassImp(AliRICHDisplay) | |
73 | ||
74 | ||
75 | //____________________________________________________________________________ | |
76 | AliRICHDisplay::AliRICHDisplay() | |
77 | { | |
237c933d | 78 | |
79 | // default constructor | |
2685bf00 | 80 | fColPad = 0; |
8278a469 | 81 | fPoints = 0; |
82 | fPhits = 0; | |
83 | fPCerenkovs = 0; | |
84 | fCanvas = 0; | |
85 | fRpoints = 0; | |
86 | fRecpoints = 0; | |
87 | } | |
88 | ||
89 | //_____________________________________________________________________________ | |
90 | AliRICHDisplay::AliRICHDisplay(Int_t size) | |
91 | { | |
92 | // Create an event display object. | |
93 | // A canvas named "edisplay" is created with a vertical size in pixels | |
94 | // | |
95 | // A QUICK Overview of the Event Display functions | |
96 | // =============================================== | |
97 | // | |
98 | // The event display can ve invoked by executing the macro "display.C" | |
99 | // A canvas like in the picture below will appear. | |
100 | // | |
101 | // On the left side of the canvas, the following buttons appear: | |
102 | // *Next* to move to the next event | |
103 | // *Previous* to move to the previous event | |
104 | ||
105 | // *Pick* Select this option to be able to point on a track with the | |
106 | // mouse. Once on the track, use the right button to select | |
107 | // an action. For example, select SetMarkerAttributes to | |
108 | // change the marker type/color/size for the track. | |
109 | // *Zoom* Select this option (default) if you want to zoom. | |
110 | // To zoom, simply select the selected area with the left button. | |
111 | // *UnZoom* To revert to the previous picture size. | |
112 | // | |
113 | // slider R On the left side, the vertical slider can be used to | |
114 | // set the default picture size. | |
115 | // | |
116 | // When you are in Zoom mode, you can click on the black part of the canvas | |
117 | // to select special options with the right mouse button. | |
118 | ||
119 | // | |
120 | // When you are in pick mode, you can "Inspect" the object pointed by the mouse. | |
121 | // When you are on a track, select the menu item "InspectParticle" | |
122 | // to display the current particle attributes. | |
123 | // | |
124 | // You can activate the Root browser by selecting the Inspect menu | |
125 | // in the canvas tool bar menu. Then select "Start Browser" | |
126 | // This will open a new canvas with the browser. At this point, you may want | |
127 | // to display some histograms (from the Trees). Go to the "File" menu | |
128 | // of the browser and click on "New canvas". | |
129 | // In the browser, click on item "ROOT files" in the left pane. | |
130 | // Click on galice.root. | |
131 | // Click on TH | |
132 | // Click on TPC for example | |
133 | // Click on any variable (eg TPC.fX) to histogram the variable. | |
134 | // | |
135 | // If you are lost, you can click on HELP in any Root canvas or browser. | |
136 | //Begin_Html | |
137 | /* | |
138 | <img src="gif/AliRICHDisplay.gif"> | |
139 | */ | |
140 | //End_Html | |
141 | ||
142 | ||
143 | fPad = 0; | |
144 | ||
145 | gAlice->SetDisplay(this); | |
146 | ||
147 | // Initialize display default parameters | |
148 | SetRange(); | |
149 | ||
150 | // Set front view by default | |
192b81a6 | 151 | fTheta = 90; //inclined HMPID |
152 | fPhi = 30; //inclined HMPID | |
153 | //fTheta = 90; //normal HMPID | |
154 | //fPhi = 90; //normal HMPID | |
8278a469 | 155 | fPsi = 0; |
156 | fChamber = 1; | |
157 | fCathode = 1; | |
158 | // fRzone = 1.e10; | |
159 | fDrawClusters = kTRUE; | |
160 | fDrawCoG = kTRUE; | |
161 | fDrawRecHits = kTRUE; | |
162 | fZoomMode = 1; | |
163 | fZooms = 0; | |
164 | fClustersCuts = 0; | |
165 | fPoints = 0; | |
166 | fPCerenkovs = 0; | |
167 | fPhits = 0; | |
168 | fRpoints = 0; | |
169 | fRecpoints = 0; | |
170 | // Create colors | |
171 | CreateColors(); | |
172 | // Create display canvas | |
173 | Int_t ysize = size; | |
174 | if (ysize < 100) ysize = 750; | |
175 | Int_t xsize = Int_t(size*830./ysize); | |
176 | fCanvas = new TCanvas("Canvas", "RICH Clusters Display",14,47,xsize,ysize); | |
177 | fCanvas->ToggleEventStatus(); | |
178 | ||
179 | // Create main display pad | |
180 | fPad = new TPad("viewpad", "RICH display",0.15,0,0.9,1); | |
181 | fPad->Draw(); | |
182 | fPad->Modified(); | |
183 | fPad->SetFillColor(1); | |
184 | fPad->SetBorderSize(2); | |
185 | ||
186 | fCanvas->cd(); | |
187 | ||
188 | // Create colors pad | |
189 | fColPad = new TPad("colpad", "Colors pad",0.9,0,1,1); | |
190 | fColPad->Draw(); | |
191 | fColPad->Modified(); | |
192 | fColPad->SetFillColor(19); | |
193 | fColPad->SetBorderSize(2); | |
194 | fColPad->cd(); | |
195 | DisplayColorScale(); | |
196 | ||
197 | fCanvas->cd(); | |
198 | ||
199 | // Create user interface control pad | |
200 | DisplayButtons(); | |
201 | fCanvas->cd(); | |
202 | ||
203 | // Create Range and mode pad | |
204 | Float_t dxtr = 0.15; | |
205 | Float_t dytr = 0.45; | |
206 | fTrigPad = new TPad("trigger", "range and mode pad",0,0,dxtr,dytr); | |
8278a469 | 207 | fTrigPad->Draw(); |
208 | fTrigPad->cd(); | |
209 | fTrigPad->SetFillColor(22); | |
210 | fTrigPad->SetBorderSize(2); | |
211 | fRangeSlider = new TSlider("range","range",0.7,0.42,0.9,0.98); | |
212 | fRangeSlider->SetObject(this); | |
213 | char pickmode[] = "gAlice->Display()->SetPickMode()"; | |
214 | Float_t db = 0.09; | |
215 | fPickButton = new TButton("Pick",pickmode,0.05,0.32,0.65,0.32+db); | |
216 | fPickButton->SetFillColor(38); | |
217 | fPickButton->Draw(); | |
218 | char zoommode[] = "gAlice->Display()->SetZoomMode()"; | |
219 | fZoomButton = new TButton("Zoom",zoommode,0.05,0.21,0.65,0.21+db); | |
220 | fZoomButton->SetFillColor(38); | |
221 | fZoomButton->Draw(); | |
222 | fArcButton = new TArc(.8,fZoomButton->GetYlowNDC()+0.5*db,0.33*db); | |
223 | fArcButton->SetFillColor(kGreen); | |
224 | fArcButton->Draw(); | |
225 | char butUnzoom[] = "gAlice->Display()->UnZoom()"; | |
226 | TButton *button = new TButton("UnZoom",butUnzoom,0.05,0.05,0.95,0.15); | |
227 | button->SetFillColor(38); | |
228 | button->Draw(); | |
229 | AppendPad(); // append display object as last object to force selection | |
230 | ||
9f0fdec5 | 231 | fTrigPad->SetEditable(kFALSE); |
232 | fButtons->SetEditable(kFALSE); | |
8278a469 | 233 | fCanvas->cd(); |
234 | fCanvas->Update(); | |
235 | } | |
236 | ||
237 | ||
238 | //_____________________________________________________________________________ | |
239 | AliRICHDisplay::~AliRICHDisplay() | |
240 | { | |
241 | // Delete space point structure | |
242 | if (fPoints) fPoints->Delete(); | |
243 | delete fPoints; | |
244 | fPoints = 0; | |
245 | // | |
246 | if (fPhits) fPhits->Delete(); | |
247 | delete fPhits; | |
248 | fPhits = 0; | |
249 | // | |
250 | if (fRpoints) fRpoints->Delete(); | |
251 | delete fRpoints; | |
252 | fRpoints = 0; | |
253 | // | |
254 | if (fRecpoints) fRecpoints->Delete(); | |
255 | delete fRecpoints; | |
256 | fRecpoints = 0; | |
257 | // | |
258 | if (fPCerenkovs) fPCerenkovs->Delete(); | |
259 | delete fPCerenkovs; | |
260 | fPCerenkovs = 0; | |
261 | } | |
262 | ||
263 | //_____________________________________________________________________________ | |
264 | void AliRICHDisplay::Clear(Option_t *) | |
265 | { | |
266 | // Delete graphics temporary objects | |
267 | } | |
268 | ||
269 | //_____________________________________________________________________________ | |
270 | void AliRICHDisplay::DisplayButtons() | |
271 | { | |
272 | // Create the user interface buttons | |
273 | ||
274 | ||
275 | fButtons = new TPad("buttons", "newpad",0,0.45,0.15,1); | |
8278a469 | 276 | fButtons->Draw(); |
277 | fButtons->SetFillColor(38); | |
278 | fButtons->SetBorderSize(2); | |
279 | fButtons->cd(); | |
280 | ||
281 | // Int_t butcolor = 33; | |
282 | Float_t dbutton = 0.08; | |
283 | Float_t y = 0.96; | |
284 | Float_t dy = 0.014; | |
285 | Float_t x0 = 0.05; | |
286 | Float_t x1 = 0.95; | |
287 | ||
288 | TButton *button; | |
289 | char but1[] = "gAlice->Display()->ShowNextEvent(1)"; | |
290 | button = new TButton("Next",but1,x0,y-dbutton,x1,y); | |
291 | button->SetFillColor(38); | |
292 | button->Draw(); | |
293 | ||
294 | y -= dbutton +dy; | |
295 | char but2[] = "gAlice->Display()->ShowNextEvent(-1)"; | |
296 | button = new TButton("Previous",but2,x0,y-dbutton,x1,y); | |
297 | button->SetFillColor(38); | |
298 | button->Draw(); | |
299 | ||
300 | y -= dbutton +dy; | |
301 | char but7[] = "gAlice->Display()->DrawViewGL()"; | |
302 | button = new TButton("OpenGL",but7,x0,y-dbutton,x1,y); | |
303 | button->SetFillColor(38); | |
304 | button->Draw(); | |
305 | ||
306 | y -= dbutton +dy; | |
307 | char but8[] = "gAlice->Display()->DrawViewX3D()"; | |
308 | button = new TButton("X3D",but8,x0,y-dbutton,x1,y); | |
309 | button->SetFillColor(38); | |
310 | button->Draw(); | |
311 | ||
312 | // display logo | |
313 | TDiamond *diamond = new TDiamond(0.05,0.015,0.95,0.22); | |
314 | diamond->SetFillColor(50); | |
315 | diamond->SetTextAlign(22); | |
316 | diamond->SetTextColor(5); | |
317 | diamond->SetTextSize(0.11); | |
318 | diamond->Draw(); | |
319 | diamond->AddText(".. "); | |
320 | diamond->AddText("ROOT"); | |
321 | diamond->AddText("RICH"); | |
322 | diamond->AddText("... "); | |
323 | diamond->AddText(" "); | |
324 | } | |
325 | ||
326 | //_____________________________________________________________________________ | |
327 | void AliRICHDisplay::CreateColors() | |
328 | { | |
329 | // Create the colors palette used to display clusters | |
330 | ||
331 | Int_t k,i; | |
332 | Int_t color; | |
333 | Float_t r,g,b; | |
334 | ||
335 | for (k=1;k<=5;k++) { | |
336 | switch(k) { | |
337 | case 1: | |
338 | for (i=1;i<=5;i++) { | |
339 | r=1.; | |
340 | g=i*0.2; | |
341 | b=0.; | |
342 | color=i; | |
343 | color=700+23-color; | |
344 | new TColor(color,r,g,b); | |
345 | } | |
346 | break; | |
347 | case 2: | |
348 | for (i=1;i<=4;i++) { | |
349 | r=1.1-i*0.2; | |
350 | g=1.; | |
351 | b=0.; | |
352 | color=i+5; | |
353 | color=700+23-color; | |
354 | new TColor(color,r,g,b); | |
355 | } | |
356 | break; | |
357 | case 3: | |
358 | for (i=1;i<=4;i++) { | |
359 | r=0.; | |
360 | g=1.; | |
361 | b=i*0.2+0.2; | |
362 | color=i+9; | |
363 | color=700+23-color; | |
364 | new TColor(color,r,g,b); | |
365 | } | |
366 | break; | |
367 | case 4: | |
368 | for (i=1;i<=4;i++) { | |
369 | r=0.; | |
370 | g=1.1-i*0.2; | |
371 | b=1.; | |
372 | color=i+13; | |
373 | color=700+23-color; | |
374 | new TColor(color,r,g,b); | |
375 | } | |
376 | break; | |
377 | case 5: | |
378 | for (i=1;i<=5;i++) { | |
379 | r=i*0.2; | |
380 | g=0.; | |
381 | b=1.; | |
382 | color=i+17; | |
383 | color=700+23-color; | |
384 | new TColor(color,r,g,b); | |
385 | } | |
386 | break; | |
387 | } | |
388 | } | |
389 | } | |
390 | ||
391 | //_____________________________________________________________________________ | |
392 | void AliRICHDisplay::DisplayColorScale() | |
393 | { | |
237c933d | 394 | |
395 | // Draw the color scale in the RICH display canvas | |
8278a469 | 396 | |
397 | Int_t i; | |
398 | Int_t color; | |
399 | Float_t xlow, ylow, xup, yup, hs; | |
400 | Float_t x1, y1, x2, y2; | |
401 | x1 = y1 = 0; | |
402 | x2 = y2 = 20; | |
403 | ||
404 | gPad->SetFillColor(0); | |
405 | gPad->Clear(); | |
406 | gPad->Range(x1,y1,x2,y2); | |
407 | TText *text = new TText(0,0,""); | |
408 | text->SetTextFont(61); | |
731293a6 | 409 | text->SetTextSize(0.2); |
8278a469 | 410 | text->SetTextAlign(22); |
411 | ||
412 | TBox *box; | |
413 | char label[8]; | |
414 | //*-* draw colortable boxes | |
415 | hs = (y2-y1)/Float_t(22); | |
416 | xlow=x1+1; | |
417 | xup=x2-9; | |
418 | for (i=0;i<22;i++) { | |
419 | ylow = y1 + hs*(Float_t(i)); | |
420 | yup = y1 + hs*(Float_t(i+1)); | |
421 | color = 701+i; | |
422 | Double_t logscale=Double_t(i+1)*(TMath::Log(adc_satm)/22); | |
423 | Int_t scale=(Int_t)TMath::Exp(logscale); | |
424 | sprintf(label,"%d",scale); | |
425 | box = new TBox(xlow, ylow, xup, yup); | |
426 | box->SetFillColor(color); | |
427 | box->Draw(); | |
428 | text->DrawText(xup+4, 0.5*(ylow+yup),label); | |
429 | } | |
430 | } | |
431 | ||
432 | //______________________________________________________________________________ | |
433 | Int_t AliRICHDisplay::DistancetoPrimitive(Int_t px, Int_t) | |
434 | { | |
435 | // Compute distance from point px,py to objects in event | |
436 | ||
437 | gPad->SetCursor(kCross); | |
438 | ||
439 | if (gPad == fTrigPad) return 9999; | |
440 | ||
237c933d | 441 | const Int_t kBig = 9999; |
442 | Int_t dist = kBig; | |
8278a469 | 443 | Float_t xmin = gPad->GetX1(); |
444 | Float_t xmax = gPad->GetX2(); | |
445 | Float_t dx = 0.02*(xmax - xmin); | |
446 | Float_t x = gPad->AbsPixeltoX(px); | |
447 | if (x < xmin+dx || x > xmax-dx) return dist; | |
448 | if (fZoomMode) return 0; | |
449 | else return 7; | |
450 | } | |
451 | ||
452 | //_____________________________________________________________________________ | |
453 | void AliRICHDisplay::Draw(Option_t *) | |
454 | { | |
455 | // Display current event | |
456 | ||
457 | fPad->cd(); | |
458 | ||
459 | DrawView(fTheta, fPhi, fPsi); // see how to draw PGON+inner frames | |
460 | ||
461 | // Display the event number and title | |
462 | fPad->cd(); | |
463 | DrawTitle(); | |
464 | } | |
465 | ||
466 | //_____________________________________________________________________________ | |
467 | void AliRICHDisplay::DrawCoG() | |
468 | { | |
469 | // Draw hits for RICH chambers | |
470 | ||
471 | if (!fDrawCoG) return; | |
472 | ResetRpoints(); | |
237c933d | 473 | for (Int_t chamber=0;chamber<kNCH;chamber++) { |
8278a469 | 474 | LoadCoG(chamber,1); |
475 | } | |
476 | ||
477 | Int_t ncog, icog; | |
478 | TObjArray *points; | |
479 | AliRICHPoints *pm; | |
480 | points = fRpoints; | |
481 | if (!points) return; | |
482 | ncog = points->GetEntriesFast(); | |
483 | for (icog=0; icog < ncog; icog++) { | |
484 | pm = (AliRICHPoints*)points->UncheckedAt(icog); | |
485 | if (!pm) continue; | |
486 | pm->Draw(); | |
487 | } | |
488 | } | |
489 | ||
490 | void AliRICHDisplay::DrawRecHits() | |
491 | { | |
492 | // Draw rec hits for RICH chambers | |
493 | ||
494 | if (!fDrawRecHits) return; | |
495 | //ResetRecpoints(); | |
237c933d | 496 | for (Int_t chamber=0;chamber<kNCH;chamber++) { |
8278a469 | 497 | LoadRecHits(chamber,1); |
498 | } | |
499 | ||
500 | Int_t nrec, irec; | |
501 | TObjArray *points; | |
502 | AliRICHPoints *pm; | |
503 | points = fRecpoints; | |
504 | if (!points) return; | |
505 | nrec = points->GetEntriesFast(); | |
e524e1a0 | 506 | //printf("Nrec %d\n",nrec); |
8278a469 | 507 | for (irec=0; irec < nrec; irec++) { |
508 | pm = (AliRICHPoints*)points->UncheckedAt(irec); | |
509 | if (!pm) continue; | |
510 | pm->Draw(); | |
511 | } | |
512 | } | |
513 | ||
514 | //_____________________________________________________________________________ | |
515 | ||
516 | void AliRICHDisplay::DrawCerenkovs() | |
517 | { | |
518 | // Draw cerenkovs hits for RICH chambers | |
519 | ||
520 | LoadCerenkovs(fChamber); | |
521 | //printf("\nDrawCerenkovs\n"); | |
522 | ||
523 | Int_t ntracks, track; | |
524 | TObjArray *cpoints; | |
525 | AliRICHPoints *pm; | |
526 | ||
527 | fHitsCuts = 0; | |
528 | cpoints = fPCerenkovs; | |
529 | //printf ("Cpoints: %p",cpoints); | |
530 | if (!cpoints) return; | |
531 | ntracks = cpoints->GetEntriesFast(); | |
532 | //printf("DrawCerenkovs - ntracks %d \n",ntracks); | |
533 | for (track=0;track<ntracks;track++) { | |
534 | pm = (AliRICHPoints*)cpoints->UncheckedAt(track); | |
535 | if (!pm) continue; | |
536 | pm->Draw(); | |
537 | fHitsCuts += pm->GetN(); | |
538 | } | |
539 | } | |
540 | ||
541 | //_____________________________________________________________________________ | |
542 | ||
543 | void AliRICHDisplay::DrawClusters() | |
544 | { | |
545 | // Draw clusterss for RICH chambers | |
546 | ||
547 | Int_t ndigits, digit; | |
548 | TObjArray *points; | |
549 | AliRICHPoints *pm; | |
550 | ||
551 | fClustersCuts = 0; | |
552 | points = fPoints; | |
553 | if (!points) return; | |
554 | ndigits = points->GetEntriesFast(); | |
555 | for (digit=0;digit<ndigits;digit++){ | |
556 | pm = (AliRICHPoints*)points->UncheckedAt(digit); | |
557 | if (!pm) continue; | |
558 | pm->Draw(); | |
559 | Float_t *pxyz; | |
560 | pxyz=pm->GetP(); | |
561 | for (Int_t im=0;im<3;im++) { | |
562 | TMarker3DBox *marker=pm->GetMarker(im); | |
563 | if (marker) | |
564 | marker->Draw(); | |
565 | } | |
566 | fClustersCuts +=pm->GetN(); | |
567 | } | |
568 | } | |
569 | ||
570 | //_____________________________________________________________________________ | |
571 | void AliRICHDisplay::DrawHits() | |
572 | { | |
573 | // Draw hits for RICH chambers | |
574 | ||
575 | LoadHits(fChamber); | |
576 | ||
577 | Int_t ntracks, track; | |
578 | TObjArray *points; | |
579 | AliRICHPoints *pm; | |
580 | ||
581 | fHitsCuts = 0; | |
582 | points = Phits(); | |
583 | if (!fPhits) return; | |
584 | // ntracks = points->GetEntriesFast(); | |
585 | ntracks = fPhits->GetEntriesFast(); | |
586 | ||
587 | //printf("DrawHits - ntracks %d \n",ntracks); | |
588 | for (track=0;track<ntracks;track++) { | |
589 | pm = (AliRICHPoints*)fPhits->UncheckedAt(track); | |
590 | if (!pm) continue; | |
591 | pm->Draw(); | |
592 | fHitsCuts += pm->GetN(); | |
593 | } | |
594 | } | |
595 | ||
596 | ||
597 | //_____________________________________________________________________________ | |
598 | void AliRICHDisplay::DrawTitle(Option_t *option) | |
599 | { | |
600 | // Draw the event title | |
601 | ||
602 | Float_t xmin = gPad->GetX1(); | |
603 | Float_t xmax = gPad->GetX2(); | |
604 | Float_t ymin = gPad->GetY1(); | |
605 | Float_t ymax = gPad->GetY2(); | |
606 | Float_t dx = xmax-xmin; | |
607 | Float_t dy = ymax-ymin; | |
608 | ||
609 | if (strlen(option) == 0) { | |
610 | TPaveText *title = new TPaveText(xmin +0.01*dx, ymax-0.09*dy, xmin +0.5*dx, ymax-0.01*dy); | |
611 | title->SetBit(kCanDelete); | |
612 | title->SetFillColor(42); | |
613 | title->Draw(); | |
614 | char ptitle[100]; | |
615 | sprintf(ptitle,"Alice event: %d, Run:%d", | |
616 | gAlice->GetHeader()->GetEvent(), gAlice->GetHeader()->GetRun()); | |
617 | title->AddText(ptitle); | |
618 | Int_t nparticles = gAlice->Particles()->GetEntriesFast(); | |
619 | sprintf(ptitle,"Nparticles = %d Nhits = %d Npads fired = %d", | |
620 | nparticles, fHitsCuts,fClustersCuts); | |
621 | title->AddText(ptitle); | |
622 | } else { | |
623 | TPaveLabel *label = | |
624 | new TPaveLabel(xmin +0.01*dx, ymax-0.07*dy, xmin +0.2*dx, ymax-0.01*dy,option); | |
625 | label->SetBit(kCanDelete); | |
626 | label->SetFillColor(42); | |
627 | label->Draw(); | |
628 | } | |
629 | } | |
630 | ||
631 | //_____________________________________________________________________________ | |
632 | void AliRICHDisplay::DrawView(Float_t theta, Float_t phi, Float_t psi) | |
633 | { | |
634 | // Draw a view of RICH clusters | |
635 | ||
636 | gPad->SetCursor(kWatch); | |
637 | gPad->SetFillColor(1); | |
638 | gPad->Clear(); | |
639 | ||
640 | Int_t iret; | |
641 | TView *view = new TView(1); | |
642 | Float_t range = fRrange*fRangeSlider->GetMaximum(); | |
643 | view->SetRange(-range,-range,-range,range, range, range); | |
644 | fZoomX0[0] = -1; | |
645 | fZoomY0[0] = -1; | |
646 | fZoomX1[0] = 1; | |
647 | fZoomY1[0] = 1; | |
648 | fZooms = 0; | |
649 | ||
650 | //Display RICH Chamber Geometry | |
651 | gAlice->GetGeometry()->Draw("same"); | |
652 | ||
653 | //add clusters to the pad | |
654 | DrawClusters(); | |
0339e982 | 655 | DrawHits(); |
731293a6 | 656 | //DrawCerenkovs(); |
e524e1a0 | 657 | if (gAlice->TreeR()) |
658 | { | |
659 | //printf("Calling DrawCoG\n"); | |
0339e982 | 660 | DrawCoG(); |
e524e1a0 | 661 | //printf("Calling DrawRecHits\n"); |
0339e982 | 662 | DrawRecHits(); |
e524e1a0 | 663 | } |
8278a469 | 664 | /*for (Int_t i=0;i<7;i++) |
665 | LoadRecHits(i,1);*/ | |
666 | ||
667 | // add itself to the list (must be last) | |
668 | AppendPad(); | |
669 | ||
670 | view->SetView(phi, theta, psi, iret); | |
671 | } | |
672 | ||
673 | //______________________________________________________________________________ | |
674 | void AliRICHDisplay::ExecuteEvent(Int_t event, Int_t px, Int_t py) | |
675 | { | |
676 | // Execute action corresponding to the mouse event | |
677 | ||
678 | static Float_t x0, y0, x1, y1; | |
679 | ||
680 | static Int_t pxold, pyold; | |
681 | static Int_t px0, py0; | |
682 | static Int_t linedrawn; | |
683 | Float_t temp; | |
684 | ||
685 | if (px == 0 && py == 0) { //when called by sliders | |
686 | if (event == kButton1Up) { | |
64ee71e7 | 687 | printf("Drawing event %d\n",event); |
688 | Draw(); | |
8278a469 | 689 | } |
690 | return; | |
691 | } | |
692 | if (!fZoomMode && gPad->GetView()) { | |
693 | gPad->GetView()->ExecuteRotateView(event, px, py); | |
694 | return; | |
695 | } | |
696 | ||
697 | // something to zoom ? | |
698 | gPad->SetCursor(kCross); | |
699 | ||
700 | switch (event) { | |
701 | ||
702 | case kButton1Down: | |
703 | gVirtualX->SetLineColor(-1); | |
704 | gPad->TAttLine::Modify(); //Change line attributes only if necessary | |
705 | x0 = gPad->AbsPixeltoX(px); | |
706 | y0 = gPad->AbsPixeltoY(py); | |
707 | px0 = px; py0 = py; | |
708 | pxold = px; pyold = py; | |
709 | linedrawn = 0; | |
710 | return; | |
711 | ||
712 | case kButton1Motion: | |
713 | if (linedrawn) gVirtualX->DrawBox(px0, py0, pxold, pyold, TVirtualX::kHollow); | |
714 | pxold = px; | |
715 | pyold = py; | |
716 | linedrawn = 1; | |
717 | gVirtualX->DrawBox(px0, py0, pxold, pyold, TVirtualX::kHollow); | |
718 | return; | |
719 | ||
720 | case kButton1Up: | |
721 | gPad->GetCanvas()->FeedbackMode(kFALSE); | |
722 | if (px == px0) return; | |
723 | if (py == py0) return; | |
724 | x1 = gPad->AbsPixeltoX(px); | |
725 | y1 = gPad->AbsPixeltoY(py); | |
726 | ||
727 | if (x1 < x0) {temp = x0; x0 = x1; x1 = temp;} | |
728 | if (y1 < y0) {temp = y0; y0 = y1; y1 = temp;} | |
729 | gPad->Range(x0,y0,x1,y1); | |
730 | if (fZooms < kMAXZOOM-1) { | |
731 | fZooms++; | |
732 | fZoomX0[fZooms] = x0; | |
733 | fZoomY0[fZooms] = y0; | |
734 | fZoomX1[fZooms] = x1; | |
735 | fZoomY1[fZooms] = y1; | |
736 | } | |
737 | gPad->Modified(kTRUE); | |
738 | return; | |
739 | } | |
740 | ||
741 | } | |
742 | //___________________________________________ | |
743 | void AliRICHDisplay::LoadCoG(Int_t chamber, Int_t cathode) | |
744 | { | |
745 | // Read raw clusters info and store x,y,z info in arrays fRpoints | |
746 | // Loop on all detectors | |
747 | ||
748 | if (chamber > 6) return; | |
749 | ||
e524e1a0 | 750 | //printf("Entering LoadCoG\n"); |
8278a469 | 751 | |
752 | ||
237c933d | 753 | AliRICH *pRICH = (AliRICH*)gAlice->GetModule("RICH"); |
8278a469 | 754 | AliRICHChamber* iChamber; |
755 | ||
237c933d | 756 | TClonesArray *pRICHrawclust = pRICH->RawClustAddress(chamber); |
e524e1a0 | 757 | //printf ("Chamber:%d has adress:%p\n", chamber, pRICHrawclust ); |
237c933d | 758 | if (pRICHrawclust == 0) return; |
8278a469 | 759 | |
237c933d | 760 | pRICH->ResetRawClusters(); |
8278a469 | 761 | |
762 | ||
763 | Int_t nent=(Int_t)gAlice->TreeR()->GetEntries(); | |
764 | gAlice->TreeR()->GetEvent(nent-1+cathode-1); | |
237c933d | 765 | Int_t nrawcl = pRICHrawclust->GetEntriesFast(); |
e524e1a0 | 766 | //printf ("nrawcl:%d\n",nrawcl); |
8278a469 | 767 | if (nrawcl == 0) return; |
768 | if (fRpoints == 0) fRpoints = new TObjArray(nrawcl); | |
769 | ||
237c933d | 770 | iChamber = &(pRICH->Chamber(chamber)); |
8278a469 | 771 | AliRICHRawCluster *mRaw; |
772 | AliRICHPoints *points = 0; | |
773 | // | |
774 | //loop over all raw clusters and store their position | |
775 | points = new AliRICHPoints(nrawcl); | |
776 | for (Int_t iraw=0;iraw<nrawcl;iraw++) { | |
237c933d | 777 | mRaw = (AliRICHRawCluster*)pRICHrawclust->UncheckedAt(iraw); |
8278a469 | 778 | fRpoints->AddAt(points,iraw); |
779 | points->SetMarkerColor(3); | |
780 | points->SetMarkerStyle(3); | |
781 | points->SetMarkerSize(1.); | |
782 | points->SetParticle(-1); | |
783 | points->SetHitIndex(-1); | |
784 | points->SetTrackIndex(-1); | |
785 | points->SetDigitIndex(-1); | |
64ee71e7 | 786 | Float_t vectorLoc[3]={mRaw->fX,5,mRaw->fY}; |
237c933d | 787 | Float_t vectorGlob[3]; |
788 | iChamber->LocaltoGlobal(vectorLoc,vectorGlob); | |
789 | points->SetPoint(iraw,vectorGlob[0],vectorGlob[1],vectorGlob[2]); | |
8278a469 | 790 | } |
791 | } | |
792 | //___________________________________________ | |
793 | void AliRICHDisplay::LoadRecHits(Int_t chamber, Int_t cathode) | |
794 | { | |
795 | // Read rec. hits info | |
796 | // Loop on all detectors | |
797 | ||
798 | if (chamber > 6) return; | |
799 | ||
e524e1a0 | 800 | ///printf("Entering LoadRecHits\n"); |
8278a469 | 801 | |
802 | ||
237c933d | 803 | AliRICH *pRICH = (AliRICH*)gAlice->GetModule("RICH"); |
8278a469 | 804 | AliRICHChamber* iChamber; |
805 | ||
a4622d0f | 806 | TClonesArray *pRICHrechits1D = pRICH->RecHitsAddress1D(chamber); |
e524e1a0 | 807 | //printf ("Chamber:%d\n", chamber); |
a4622d0f | 808 | if (pRICHrechits1D != 0) |
809 | { | |
810 | ||
811 | //RICH->ResetRecHits(); | |
812 | ||
813 | ||
814 | Int_t nent1D=(Int_t)gAlice->TreeR()->GetEntries(); | |
815 | gAlice->TreeR()->GetEvent(nent1D-1+cathode-1); | |
816 | Int_t nrechits1D = pRICHrechits1D->GetEntriesFast(); | |
e524e1a0 | 817 | //printf ("nrechits1D:%d\n",nrechits1D); |
a4622d0f | 818 | if (nrechits1D != 0) |
819 | { | |
820 | if (fRecpoints == 0) fRecpoints = new TObjArray(50); | |
821 | ||
822 | iChamber = &(pRICH->Chamber(chamber)); | |
823 | AliRICHRecHit1D *mRec1D; | |
824 | AliRICHPoints *points1D = 0; | |
825 | //AliRICHEllipse *ellipse = 0; | |
826 | // | |
827 | //loop over all rechits and store their position | |
828 | ||
829 | points1D = new AliRICHPoints(nrechits1D); | |
830 | for (Int_t irec=0;irec<nrechits1D;irec++) { | |
831 | mRec1D = (AliRICHRecHit1D*)pRICHrechits1D->UncheckedAt(irec); | |
832 | fRecpoints->AddAt(points1D,irec); | |
833 | points1D->SetMarkerColor(38); | |
834 | points1D->SetMarkerStyle(8); | |
731293a6 | 835 | points1D->SetMarkerSize(.5); |
a4622d0f | 836 | points1D->SetParticle(-1); |
837 | points1D->SetHitIndex(-1); | |
838 | points1D->SetTrackIndex(-1); | |
839 | points1D->SetDigitIndex(-1); | |
64ee71e7 | 840 | Float_t vectorLoc[3]={mRec1D->fX,5,mRec1D->fY}; |
a4622d0f | 841 | Float_t vectorGlob[3]; |
842 | iChamber->LocaltoGlobal(vectorLoc,vectorGlob); | |
843 | points1D->SetPoint(irec,vectorGlob[0],vectorGlob[1],vectorGlob[2]); | |
844 | //Float_t theta = iChamber->GetRotMatrix()->GetTheta(); | |
845 | //Float_t phi = iChamber->GetRotMatrix()->GetPhi(); | |
846 | //ellipse=new TEllipse(vectorGlob[0],vectorGlob[2],10,10,0,360,phi); | |
e524e1a0 | 847 | //printf("Generating ellipse %d\n",irec); |
a4622d0f | 848 | AliRICHEllipse *ellipse=new AliRICHEllipse(mRec1D->fX,mRec1D->fY,mRec1D->fOmega,mRec1D->fTheta,mRec1D->fPhi,mRec1D->fEmissPoint); |
64ee71e7 | 849 | printf("Ring at x:%f, y:%f - Omega:%f rad, theta:%3.1f deg, phi:%3.1f deg\n",mRec1D->fX,mRec1D->fY,mRec1D->fOmega,mRec1D->fTheta*180/TMath::Pi(),mRec1D->fPhi*180/TMath::Pi()); |
850 | printf("fEmissPoint:%f\n",mRec1D->fEmissPoint); | |
a4622d0f | 851 | ellipse->CerenkovRingDrawing(chamber,irec); |
852 | //ellipse->SetFillStyle(1001); | |
853 | ellipse->SetMarkerColor(38); | |
854 | ellipse->Draw(); | |
855 | //marker->SetRefObject((TObject*)points1D); | |
856 | //points1D->Set3DMarker(0, marker); | |
857 | } | |
858 | } | |
859 | } | |
860 | ||
861 | TClonesArray *pRICHrechits3D = pRICH->RecHitsAddress3D(chamber); | |
e524e1a0 | 862 | //printf ("Chamber:%d\n", chamber); |
a4622d0f | 863 | if (pRICHrechits3D != 0) |
864 | { | |
865 | ||
866 | //RICH->ResetRecHits(); | |
867 | ||
868 | ||
869 | Int_t nent3D=(Int_t)gAlice->TreeR()->GetEntries(); | |
870 | gAlice->TreeR()->GetEvent(nent3D-1+cathode-1); | |
871 | Int_t nrechits3D = pRICHrechits3D->GetEntriesFast(); | |
e524e1a0 | 872 | //printf ("nrechits3D:%d\n",nrechits3D); |
a4622d0f | 873 | if (nrechits3D != 0) |
874 | { | |
875 | if (fRecpoints == 0) fRecpoints = new TObjArray(50); | |
876 | ||
877 | iChamber = &(pRICH->Chamber(chamber)); | |
878 | AliRICHRecHit3D *mRec3D; | |
879 | AliRICHPoints *points3D = 0; | |
880 | //AliRICHEllipse *ellipse = 0; | |
881 | // | |
882 | //loop over all rechits and store their position | |
883 | ||
884 | points3D = new AliRICHPoints(nrechits3D); | |
885 | for (Int_t irec=0;irec<nrechits3D;irec++) { | |
886 | mRec3D = (AliRICHRecHit3D*)pRICHrechits3D->UncheckedAt(irec); | |
887 | fRecpoints->AddAt(points3D,irec); | |
888 | points3D->SetMarkerColor(42); | |
889 | points3D->SetMarkerStyle(8); | |
890 | points3D->SetMarkerSize(1.); | |
891 | points3D->SetParticle(-1); | |
892 | points3D->SetHitIndex(-1); | |
893 | points3D->SetTrackIndex(-1); | |
894 | points3D->SetDigitIndex(-1); | |
64ee71e7 | 895 | Float_t vectorLoc[3]={mRec3D->fX,5,mRec3D->fY}; |
a4622d0f | 896 | Float_t vectorGlob[3]; |
897 | iChamber->LocaltoGlobal(vectorLoc,vectorGlob); | |
898 | points3D->SetPoint(irec,vectorGlob[0],vectorGlob[1],vectorGlob[2]); | |
899 | //Float_t theta = iChamber->GetRotMatrix()->GetTheta(); | |
900 | //Float_t phi = iChamber->GetRotMatrix()->GetPhi(); | |
901 | //ellipse=new TEllipse(vectorGlob[0],vectorGlob[2],10,10,0,360,phi); | |
e524e1a0 | 902 | //printf("Generating ellipse %d\n",irec); |
a4622d0f | 903 | AliRICHEllipse *ellipse=new AliRICHEllipse(mRec3D->fX,mRec3D->fY,mRec3D->fOmega,mRec3D->fTheta,mRec3D->fPhi,0.75); |
64ee71e7 | 904 | printf("Ring at x:%f, y:%f - Omega:%f rad, theta:%3.1f deg, phi:%3.1f deg\n",mRec3D->fX,mRec3D->fY,mRec3D->fOmega,mRec3D->fTheta*180/TMath::Pi(),mRec3D->fPhi*180/TMath::Pi()); |
731293a6 | 905 | //ellipse->CerenkovRingDrawing(chamber,irec); |
a4622d0f | 906 | //ellipse->SetFillStyle(1001); |
731293a6 | 907 | ellipse->CreatePoints(chamber); |
908 | ellipse->SetMarkerStyle(7); | |
a4622d0f | 909 | ellipse->SetMarkerColor(42); |
731293a6 | 910 | ellipse->SetMarkerSize(1); |
a4622d0f | 911 | ellipse->Draw(); |
912 | //marker->SetRefObject((TObject*)points3D); | |
913 | //points3D->Set3DMarker(0, marker); | |
914 | } | |
915 | } | |
916 | } | |
8278a469 | 917 | } |
918 | //___________________________________________ | |
919 | void AliRICHDisplay::LoadDigits() | |
920 | { | |
921 | // Read digits info and store x,y,z info in arrays fPoints | |
922 | // Loop on all detectors | |
923 | ||
924 | ResetPoints(); | |
237c933d | 925 | AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH"); |
8278a469 | 926 | AliRICHChamber* iChamber; |
a2f7eaf6 | 927 | AliSegmentation* segmentation; |
237c933d | 928 | Int_t nAllDigits=0; |
8278a469 | 929 | Int_t ich; |
50755e99 | 930 | |
e524e1a0 | 931 | //printf("Entering LoadDigits\n"); |
50755e99 | 932 | |
933 | if (gAlice->TreeD()) | |
934 | { | |
8278a469 | 935 | |
50755e99 | 936 | for (ich=0; ich<kNCH; ich++) { |
937 | TClonesArray *pRICHdigits = pRICH->DigitsAddress(ich); | |
e524e1a0 | 938 | //printf ("Chamber:%d has adress:%p\n", ich, pRICHdigits ); |
50755e99 | 939 | if (pRICHdigits == 0) continue; |
940 | gAlice->ResetDigits(); | |
e524e1a0 | 941 | gAlice->TreeD()->GetEvent(0); |
50755e99 | 942 | Int_t ndigits = pRICHdigits->GetEntriesFast(); |
e524e1a0 | 943 | //printf("ndigits:%d\n",ndigits); |
50755e99 | 944 | nAllDigits+=ndigits; |
945 | } | |
8278a469 | 946 | |
50755e99 | 947 | if (fPoints == 0) fPoints = new TObjArray(nAllDigits); |
948 | Int_t counter=0; | |
949 | for (ich=0; ich<kNCH; ich++) { | |
950 | TClonesArray *pRICHdigits = pRICH->DigitsAddress(ich); | |
951 | if (pRICHdigits == 0) continue; | |
952 | gAlice->ResetDigits(); | |
e524e1a0 | 953 | gAlice->TreeD()->GetEvent(0); |
50755e99 | 954 | Int_t ndigits = pRICHdigits->GetEntriesFast(); |
955 | if (ndigits == 0) continue; | |
956 | iChamber = &(pRICH->Chamber(ich)); | |
957 | segmentation=iChamber->GetSegmentationModel(); | |
958 | Float_t dpx = segmentation->Dpx(); | |
959 | Float_t dpy = segmentation->Dpy(); | |
960 | ||
961 | //printf("Dpx:%d, Dpy:%d\n",dpx,dpy); | |
962 | ||
963 | AliRICHDigit *mdig; | |
964 | AliRICHPoints *points = 0; | |
965 | TMarker3DBox *marker = 0; | |
966 | // | |
967 | //loop over all digits and store their position | |
968 | Int_t npoints=1; | |
969 | ||
970 | for (Int_t digit=0;digit<ndigits;digit++) { | |
237c933d | 971 | mdig = (AliRICHDigit*)pRICHdigits->UncheckedAt(digit); |
8278a469 | 972 | points = new AliRICHPoints(npoints); |
973 | fPoints->AddAt(points,counter); | |
974 | counter++; | |
6e585aa2 | 975 | Int_t charge=mdig->Signal(); |
8278a469 | 976 | Int_t index=Int_t(TMath::Log(charge)/(TMath::Log(adc_satm)/22)); |
977 | Int_t color=701+index; | |
978 | if (color>722) color=722; | |
979 | points->SetMarkerColor(color); | |
980 | points->SetMarkerStyle(21); | |
981 | points->SetMarkerSize(0.5); | |
a2f7eaf6 | 982 | Float_t xpad, ypad, zpad; |
6e585aa2 | 983 | segmentation->GetPadC(mdig->PadX(), mdig->PadY(),xpad, ypad, zpad); |
64ee71e7 | 984 | Float_t vectorLoc[3]={xpad,5,ypad}; |
237c933d | 985 | Float_t vectorGlob[3]; |
986 | iChamber->LocaltoGlobal(vectorLoc,vectorGlob); | |
8278a469 | 987 | points->SetParticle(-1); |
988 | points->SetHitIndex(-1); | |
989 | points->SetTrackIndex(-1); | |
990 | points->SetDigitIndex(digit); | |
237c933d | 991 | points->SetPoint(0,vectorGlob[0],vectorGlob[1],vectorGlob[2]); |
64ee71e7 | 992 | //printf("Y position (digit): %f\n", vectorGlob[1]); |
8278a469 | 993 | |
6e585aa2 | 994 | segmentation->GetPadC(mdig->PadX(), mdig->PadY(), xpad, ypad, zpad); |
8278a469 | 995 | Float_t theta = iChamber->GetRotMatrix()->GetTheta(); |
996 | Float_t phi = iChamber->GetRotMatrix()->GetPhi(); | |
237c933d | 997 | marker=new TMarker3DBox(vectorGlob[0],vectorGlob[1],vectorGlob[2], |
8278a469 | 998 | dpy/2,0,dpx/2,theta,phi); |
999 | marker->SetLineColor(2); | |
1000 | marker->SetFillStyle(1001); | |
1001 | marker->SetFillColor(color); | |
1002 | marker->SetRefObject((TObject*)points); | |
1003 | points->Set3DMarker(0, marker); | |
50755e99 | 1004 | } // loop over digits |
1005 | } // loop over chambers | |
1006 | } //if TreeD | |
8278a469 | 1007 | } |
1008 | ||
1009 | ||
1010 | //___________________________________________ | |
1011 | void AliRICHDisplay::LoadHits(Int_t chamber) | |
1012 | { | |
1013 | // Read hits info and store x,y,z info in arrays fPhits | |
1014 | // Loop on all detectors | |
1015 | ||
1016 | ||
1017 | fChamber=chamber; | |
1018 | ResetPhits(); | |
1019 | ||
237c933d | 1020 | AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH"); |
8278a469 | 1021 | AliRICHChamber* iChamber; |
1022 | ||
237c933d | 1023 | iChamber = &(pRICH->Chamber(chamber-1)); |
88cb7938 | 1024 | Int_t ntracks = (Int_t)pRICH->TreeH()->GetEntries(); |
8278a469 | 1025 | Int_t track; |
1026 | ||
1027 | if (fPhits == 0) fPhits = new TObjArray(ntracks); | |
1028 | //TVector *xp = new TVector(1000); | |
1029 | //TVector *yp = new TVector(1000); | |
1030 | //TVector *zp = new TVector(1000); | |
1031 | //TVector *ptrk = new TVector(1000); | |
1032 | //TVector *phit = new TVector(1000); | |
237c933d | 1033 | Int_t nAllHits=0; |
8278a469 | 1034 | for (track=0; track<ntracks;track++) { |
1035 | gAlice->ResetHits(); | |
88cb7938 | 1036 | pRICH->TreeH()->GetEvent(track); |
237c933d | 1037 | TClonesArray *pRICHhits = pRICH->Hits(); |
1038 | if (pRICHhits == 0) return; | |
1039 | Int_t nhits = pRICHhits->GetEntriesFast(); | |
1040 | nAllHits+=nhits; | |
8278a469 | 1041 | } |
1042 | ||
237c933d | 1043 | fPhits = new TObjArray(nAllHits); |
8278a469 | 1044 | |
1045 | Int_t npoints=0; | |
1046 | for (track=0; track<ntracks;track++) { | |
1047 | gAlice->ResetHits(); | |
88cb7938 | 1048 | pRICH->TreeH()->GetEvent(track); |
237c933d | 1049 | TClonesArray *pRICHhits = pRICH->Hits(); |
1050 | if (pRICHhits == 0) return; | |
1051 | Int_t nhits = pRICHhits->GetEntriesFast(); | |
8278a469 | 1052 | if (nhits == 0) continue; |
1053 | AliRICHHit *mHit; | |
1054 | AliRICHPoints *points = 0; | |
1055 | for (Int_t hit=0;hit<nhits;hit++) { | |
1056 | points = new AliRICHPoints(1); | |
1057 | fPhits->AddAt(points,npoints); | |
237c933d | 1058 | mHit = (AliRICHHit*)pRICHhits->UncheckedAt(hit); |
50755e99 | 1059 | TParticle *current = (TParticle*)gAlice->Particle(mHit->Track()); |
8278a469 | 1060 | if (current->GetPdgCode() == 50000050) { |
1061 | points->SetMarkerColor(kBlue); | |
1062 | } else if (current->GetPdgCode() == 50000051) { | |
1063 | points->SetMarkerColor(kYellow); | |
1064 | } else { | |
1065 | points->SetMarkerColor(kRed); | |
1066 | } | |
1067 | points->SetMarkerStyle(5); | |
1068 | points->SetMarkerSize(1.); | |
94de3818 | 1069 | points->SetParticle(mHit->Track()); |
8278a469 | 1070 | points->SetHitIndex(hit); |
0976a54b | 1071 | points->SetTrackIndex(track); |
8278a469 | 1072 | points->SetDigitIndex(-1); |
0339e982 | 1073 | points->SetPoint(0,mHit->X(), mHit->Y(), mHit->Z()); |
8278a469 | 1074 | npoints++; |
1075 | } | |
1076 | } | |
1077 | } | |
1078 | ||
1079 | //_____________________________________________________________________________ | |
1080 | ||
1081 | void AliRICHDisplay::LoadCerenkovs(Int_t chamber) | |
1082 | { | |
1083 | // Read cerenkov hits info and store x,y,z info in array fPCerenkovs | |
1084 | // Loop on all detectors | |
1085 | ||
1086 | fChamber=chamber; | |
1087 | ResetPCerenkovs(); | |
1088 | ||
237c933d | 1089 | AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH"); |
8278a469 | 1090 | AliRICHChamber* iChamber; |
1091 | ||
237c933d | 1092 | iChamber = &(pRICH->Chamber(chamber-1)); |
8278a469 | 1093 | |
237c933d | 1094 | pRICH->SetTreeAddress(); |
88cb7938 | 1095 | Int_t ntracks = (Int_t)pRICH->TreeH()->GetEntries(); |
8278a469 | 1096 | |
1097 | if (fPCerenkovs == 0) fPCerenkovs = new TObjArray(ntracks); | |
1098 | TVector *xp = new TVector(1000); | |
1099 | TVector *yp = new TVector(1000); | |
1100 | TVector *zp = new TVector(1000); | |
1101 | TVector *ptrk = new TVector(1000); | |
1102 | TVector *phit = new TVector(1000); | |
1103 | for (Int_t track=0; track<ntracks;track++) { | |
1104 | gAlice->ResetHits(); | |
88cb7938 | 1105 | pRICH->TreeH()->GetEvent(track); |
237c933d | 1106 | TClonesArray *pRICHCerenkovs = pRICH->Cerenkovs(); |
1107 | if (pRICHCerenkovs == 0) return; | |
1108 | Int_t nhits = pRICHCerenkovs->GetEntriesFast(); | |
8278a469 | 1109 | if (nhits == 0) continue; |
1110 | AliRICHCerenkov *mCerenkov; | |
1111 | AliRICHPoints *cpoints = 0; | |
1112 | Int_t npoints=0; | |
1113 | ||
1114 | ||
1115 | //Display Cerenkov hits in blue | |
1116 | ||
1117 | for (Int_t hit=0;hit<nhits;hit++) { | |
237c933d | 1118 | mCerenkov = (AliRICHCerenkov*)pRICHCerenkovs->UncheckedAt(hit); |
94de3818 | 1119 | (*xp)(npoints)=mCerenkov->X(); |
1120 | (*yp)(npoints)=mCerenkov->Y(); | |
1121 | (*zp)(npoints)=mCerenkov->Z(); | |
8278a469 | 1122 | (*ptrk)(npoints)=Float_t(mCerenkov->GetTrack()); |
1123 | (*phit)(npoints)=Float_t(hit); | |
1124 | npoints++; | |
1125 | } | |
1126 | if (npoints == 0) continue; | |
1127 | cpoints = new AliRICHPoints(npoints); | |
1128 | for (Int_t p=0;p<npoints;p++) { | |
1129 | cpoints->SetMarkerColor(kBlue); | |
1130 | cpoints->SetMarkerStyle(5); | |
1131 | cpoints->SetMarkerSize(1.); | |
1132 | cpoints->SetParticle(Int_t((*ptrk)(p))); | |
1133 | cpoints->SetHitIndex(Int_t((*phit)(p))); | |
1134 | cpoints->SetTrackIndex(track); | |
1135 | cpoints->SetDigitIndex(-1); | |
1136 | cpoints->SetPoint(p,(*xp)(p),(*yp)(p),(*zp)(p)); | |
1137 | } | |
1138 | xp->Zero(); | |
1139 | yp->Zero(); | |
1140 | ptrk->Zero(); | |
1141 | phit->Zero(); | |
1142 | fPCerenkovs->AddAt(cpoints,track); | |
1143 | } | |
1144 | } | |
1145 | ||
1146 | //_____________________________________________________________________________ | |
1147 | void AliRICHDisplay::Paint(Option_t *) | |
1148 | { | |
1149 | // Paint miscellaneous items | |
1150 | ||
1151 | } | |
1152 | ||
1153 | //_____________________________________________________________________________ | |
1154 | void AliRICHDisplay::SetPickMode() | |
1155 | { | |
237c933d | 1156 | |
1157 | // Toggle pick mode | |
1158 | ||
8278a469 | 1159 | fZoomMode = 0; |
1160 | ||
1161 | fArcButton->SetY1(fPickButton->GetYlowNDC()+0.5*fPickButton->GetHNDC()); | |
1162 | fTrigPad->Modified(); | |
1163 | } | |
1164 | ||
1165 | //_____________________________________________________________________________ | |
1166 | void AliRICHDisplay::SetZoomMode() | |
1167 | { | |
237c933d | 1168 | |
1169 | // Toggle Zoom mode | |
1170 | ||
8278a469 | 1171 | fZoomMode = 1; |
1172 | ||
1173 | fArcButton->SetY1(fZoomButton->GetYlowNDC()+0.5*fZoomButton->GetHNDC()); | |
1174 | fTrigPad->Modified(); | |
1175 | } | |
1176 | ||
1177 | //_____________________________________________________________________________ | |
1178 | void AliRICHDisplay::SetChamberAndCathode(Int_t chamber, Int_t cathode) | |
1179 | { | |
1180 | // Set chamber and cathode number | |
1181 | fChamber = chamber; | |
1182 | fCathode = cathode; | |
1183 | ||
e524e1a0 | 1184 | //printf("SetChamberAndCathode - fChamber fCathode %d %d\n",fChamber,fCathode); |
8278a469 | 1185 | if (!fPad) return; |
1186 | fPad->Clear(); | |
1187 | LoadDigits(); | |
1188 | Draw(); | |
1189 | } | |
1190 | ||
1191 | //_____________________________________________________________________________ | |
1192 | void AliRICHDisplay::SetRange(Float_t rrange, Float_t zrange) | |
1193 | { | |
1194 | // Set view range along R and Z | |
1195 | fRrange = rrange; | |
1196 | fZrange = zrange; | |
1197 | ||
1198 | if (!fPad) return; | |
1199 | fPad->Clear(); | |
1200 | Draw(); | |
1201 | } | |
1202 | ||
1203 | //_____________________________________________________________________________ | |
1204 | void AliRICHDisplay::SetView(Float_t theta, Float_t phi, Float_t psi) | |
1205 | { | |
1206 | // change viewing angles for current event | |
1207 | ||
1208 | fPad->cd(); | |
1209 | fPhi = phi; | |
1210 | fTheta = theta; | |
1211 | fPsi = psi; | |
1212 | Int_t iret = 0; | |
1213 | ||
1214 | TView *view = gPad->GetView(); | |
1215 | if (view) view->SetView(fPhi, fTheta, fPsi, iret); | |
1216 | else Draw(); | |
1217 | ||
1218 | gPad->Modified(); | |
1219 | } | |
1220 | ||
1221 | //_____________________________________________________________________________ | |
1222 | void AliRICHDisplay::ShowNextEvent(Int_t delta) | |
1223 | { | |
1224 | // Display (current event_number+delta) | |
1225 | // delta = 1 shown next event | |
1226 | // delta = -1 show previous event | |
1227 | ||
1228 | if (delta) { | |
1229 | gAlice->Clear(); | |
237c933d | 1230 | Int_t currentEvent = gAlice->GetHeader()->GetEvent(); |
1231 | Int_t newEvent = currentEvent + delta; | |
1232 | gAlice->GetEvent(newEvent); | |
8278a469 | 1233 | if (!gAlice->TreeD()) return; |
1234 | } | |
1235 | LoadDigits(); | |
1236 | DrawClusters(); | |
1237 | fPad->cd(); | |
1238 | Draw(); | |
1239 | ||
1240 | ||
1241 | } | |
1242 | ||
1243 | //______________________________________________________________________________ | |
1244 | void AliRICHDisplay::UnZoom() | |
1245 | { | |
237c933d | 1246 | |
1247 | // Return to previous zoom factor | |
1248 | ||
8278a469 | 1249 | if (fZooms <= 0) return; |
1250 | fZooms--; | |
1251 | TPad *pad = (TPad*)gPad->GetPadSave(); | |
1252 | pad->Range(fZoomX0[fZooms],fZoomY0[fZooms], fZoomX1[fZooms],fZoomY1[fZooms]); | |
1253 | pad->Modified(); | |
1254 | } | |
1255 | ||
1256 | //_____________________________________________________________________________ | |
1257 | void AliRICHDisplay::ResetPoints() | |
1258 | { | |
1259 | // | |
1260 | // Reset array of points | |
1261 | // | |
1262 | if (fPoints) { | |
1263 | fPoints->Delete(); | |
1264 | delete fPoints; | |
1265 | fPoints = 0; | |
1266 | } | |
1267 | } | |
1268 | //_____________________________________________________________________________ | |
1269 | void AliRICHDisplay::ResetRpoints() | |
1270 | { | |
1271 | // | |
1272 | // Reset array of points | |
1273 | // | |
1274 | if (fRpoints) { | |
1275 | fRpoints->Delete(); | |
1276 | delete fRpoints; | |
1277 | fRpoints = 0; | |
1278 | } | |
1279 | } | |
1280 | //_____________________________________________________________________________ | |
1281 | void AliRICHDisplay::ResetRecpoints() | |
1282 | { | |
1283 | // | |
1284 | // Reset array of points | |
1285 | // | |
1286 | if (fRecpoints) { | |
1287 | fRecpoints->Delete(); | |
1288 | delete fRecpoints; | |
1289 | fRecpoints = 0; | |
1290 | } | |
1291 | } | |
1292 | //_____________________________________________________________________________ | |
1293 | void AliRICHDisplay::ResetPhits() | |
1294 | { | |
1295 | // | |
1296 | // Reset array of points | |
1297 | // | |
1298 | if (fPhits) { | |
1299 | fPhits->Delete(); | |
1300 | delete fPhits; | |
1301 | fPhits = 0; | |
1302 | } | |
1303 | } | |
1304 | //_____________________________________________________________________________ | |
1305 | void AliRICHDisplay::ResetPCerenkovs() | |
1306 | { | |
1307 | // | |
1308 | // Reset array of points | |
1309 | // | |
1310 | if (fPCerenkovs) { | |
1311 | fPCerenkovs->Delete(); | |
1312 | delete fPCerenkovs; | |
1313 | fPCerenkovs = 0; | |
1314 | } | |
1315 | } | |
1316 | ||
1317 | //_____________________________________________________________________________ | |
1318 | ||
1319 | void AliRICHDisplay::DrawViewGL() | |
1320 | { | |
1321 | // Draw current view using OPENGL | |
1322 | ||
1323 | TPad *pad = (TPad*)gPad->GetPadSave(); | |
1324 | pad->cd(); | |
1325 | TView *view = pad->GetView(); | |
1326 | if (!view) return; | |
1327 | pad->x3d("OPENGL"); | |
1328 | } | |
1329 | ||
1330 | //_____________________________________________________________________________ | |
1331 | void AliRICHDisplay::DrawViewX3D() | |
1332 | { | |
1333 | // Draw current view using X3D | |
1334 | ||
1335 | TPad *pad = (TPad*)gPad->GetPadSave(); | |
1336 | pad->cd(); | |
1337 | TView *view = pad->GetView(); | |
1338 | if (!view) return; | |
1339 | pad->x3d(); | |
1340 | } |