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