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