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