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