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