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