]>
Commit | Line | Data |
---|---|---|
a9e2aefa | 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 | ||
88cb7938 | 16 | /* $Id$ */ |
a9e2aefa | 17 | |
18 | ////////////////////////////////////////////////////////////////////////// | |
19 | // // | |
20 | // AliDisplay // | |
21 | // // | |
22 | // Utility class to display ALICE outline, tracks, hits,.. // | |
23 | // // | |
24 | ////////////////////////////////////////////////////////////////////////// | |
25 | ||
30178c30 | 26 | #include "AliMUONDisplay.h" |
a9e2aefa | 27 | #include "AliMUON.h" |
a9e2aefa | 28 | #include "AliMUONPoints.h" |
d226f81b | 29 | #include "AliMUONGlobalTrigger.h" |
a9e2aefa | 30 | #include "AliMUONHit.h" |
a9e2aefa | 31 | #include "AliMUONDigit.h" |
32 | #include "AliMUONRawCluster.h" | |
572d5bb2 | 33 | #include "AliMUONTrack.h" |
34 | #include "AliMUONTrackParam.h" | |
b7ef3c96 | 35 | #include "AliMUONGeometryTransformer.h" |
7502d0e5 | 36 | #include "AliMUONSegmentation.h" |
37 | #include "AliMUONGeometrySegmentation.h" | |
38 | #include "AliMUONConstants.h" | |
39 | ||
40 | #include "AliMpDEIterator.h" | |
41 | #include "AliMpSegFactory.h" | |
123469eb | 42 | #include "AliMpSlatSegmentation.h" |
43 | #include "AliMpSlat.h" | |
63216d66 | 44 | #include "AliMpSectorSegmentation.h" |
e0d2f4db | 45 | #include "AliMpSector.h" |
e0d2f4db | 46 | #include "AliMpTriggerSegmentation.h" |
47 | #include "AliMpTrigger.h" | |
123469eb | 48 | |
5d12ce38 | 49 | #include "AliMC.h" |
8c343c7c | 50 | #include "AliLog.h" |
7502d0e5 | 51 | #include "AliRun.h" |
52 | #include "AliHeader.h" | |
53 | ||
54 | #include <TButton.h> | |
55 | #include <TColor.h> | |
56 | #include <TCanvas.h> | |
57 | #include <TView.h> | |
58 | #include <TText.h> | |
59 | #include <TPaveLabel.h> | |
60 | #include <TPaveText.h> | |
61 | #include <TDiamond.h> | |
62 | #include <TNode.h> | |
63 | #include <TArc.h> | |
64 | #include <TSlider.h> | |
65 | #include <TVirtualX.h> | |
66 | #include <TMath.h> | |
67 | #include <TGeometry.h> | |
68 | #include <TMarker3DBox.h> | |
69 | #include <TParticle.h> | |
70 | #include <TPolyLine3D.h> | |
71 | #include <TBox.h> | |
a9e2aefa | 72 | |
73 | ||
74 | ||
75 | ClassImp(AliMUONDisplay) | |
76 | ||
77 | ||
78 | //_____________________________________________________________________________ | |
79 | AliMUONDisplay::AliMUONDisplay() | |
30178c30 | 80 | : AliDisplay() |
a9e2aefa | 81 | { |
82 | // Constructor | |
d226f81b | 83 | fPoints = 0; |
84 | fPhits = 0; | |
85 | fRpoints = 0; | |
86 | fCanvas = 0; | |
a9e2aefa | 87 | fNextCathode = kFALSE; |
d226f81b | 88 | fColPad = 0; |
a9e2aefa | 89 | } |
90 | ||
91 | //_____________________________________________________________________________ | |
307d9d04 | 92 | AliMUONDisplay::AliMUONDisplay(Int_t size, AliLoader * loader) |
30178c30 | 93 | : AliDisplay() |
a9e2aefa | 94 | { |
95 | // Create an event display object. | |
96 | // A canvas named "edisplay" is created with a vertical size in pixels | |
97 | // | |
98 | // A QUICK Overview of the Event Display functions | |
99 | // =============================================== | |
100 | // | |
101 | // The event display can ve invoked by executing the macro "display.C" | |
102 | // A canvas like in the picture below will appear. | |
103 | // | |
104 | // On the left side of the canvas, the following buttons appear: | |
105 | // *Next* to move to the next event | |
106 | // *Previous* to move to the previous event | |
107 | ||
108 | // *Pick* Select this option to be able to point on a track with the | |
109 | // mouse. Once on the track, use the right button to select | |
110 | // an action. For example, select SetMarkerAttributes to | |
111 | // change the marker type/color/size for the track. | |
112 | // *Zoom* Select this option (default) if you want to zoom. | |
113 | // To zoom, simply select the selected area with the left button. | |
114 | // *UnZoom* To revert to the previous picture size. | |
115 | // | |
116 | // slider R On the left side, the vertical slider can be used to | |
117 | // set the default picture size. | |
118 | // | |
119 | // When you are in Zoom mode, you can click on the black part of the canvas | |
120 | // to select special options with the right mouse button. | |
121 | ||
122 | // | |
123 | // When you are in pick mode, you can "Inspect" the object pointed by the mouse. | |
124 | // When you are on a track, select the menu item "InspectParticle" | |
125 | // to display the current particle attributes. | |
126 | // | |
127 | // You can activate the Root browser by selecting the Inspect menu | |
128 | // in the canvas tool bar menu. Then select "Start Browser" | |
129 | // This will open a new canvas with the browser. At this point, you may want | |
130 | // to display some histograms (from the Trees). Go to the "File" menu | |
131 | // of the browser and click on "New canvas". | |
132 | // In the browser, click on item "ROOT files" in the left pane. | |
133 | // Click on galice.root. | |
134 | // Click on TH | |
135 | // Click on TPC for example | |
136 | // Click on any variable (eg TPC.fX) to histogram the variable. | |
137 | // | |
138 | // If you are lost, you can click on HELP in any Root canvas or browser. | |
139 | //Begin_Html | |
140 | /* | |
141 | <img src="gif/AliMUONDisplay.gif"> | |
142 | */ | |
143 | //End_Html | |
144 | ||
145 | ||
146 | fPad = 0; | |
147 | ||
148 | gAlice->SetDisplay(this); | |
149 | ||
150 | // Initialize display default parameters | |
151 | SetRange(200,2000); | |
152 | // Set front view by default | |
153 | fTheta = 0; | |
154 | fPhi = -90; | |
155 | fPsi = 0; | |
156 | fChamber = 1; | |
157 | fCathode = 1; | |
158 | // fRzone = 1.e10; | |
159 | fDrawClusters = kTRUE; | |
160 | fDrawCoG = kTRUE; | |
572d5bb2 | 161 | fDrawTracks = kFALSE; |
a9e2aefa | 162 | fZoomMode = 1; |
163 | fZooms = 0; | |
164 | fClustersCuts = 0; | |
d226f81b | 165 | fPoints = 0; |
166 | fPhits = 0; | |
167 | fRpoints = 0; | |
a9e2aefa | 168 | // Create colors |
169 | CreateColors(); | |
170 | // Create display canvas | |
171 | Int_t ysize = size; | |
172 | if (ysize < 100) ysize = 750; | |
173 | Int_t xsize = Int_t(size*830./ysize); | |
572d5bb2 | 174 | fCanvas = new TCanvas("Canvas", "MUON Display",14,47,xsize,ysize); |
a9e2aefa | 175 | fCanvas->ToggleEventStatus(); |
176 | ||
177 | // Create main display pad | |
178 | fPad = new TPad("viewpad", "MUON display",0.15,0,0.9,1); | |
179 | fPad->Draw(); | |
180 | fPad->Modified(); | |
181 | fPad->SetFillColor(30); | |
182 | fPad->SetBorderSize(2); | |
183 | ||
184 | fCanvas->cd(); | |
185 | ||
186 | // Create colors pad | |
187 | fColPad = new TPad("colpad", "Colors pad",0.9,0,1,1); | |
188 | fColPad->Draw(); | |
189 | fColPad->SetFillColor(17); | |
190 | fColPad->SetBorderSize(2); | |
191 | fColPad->cd(); | |
192 | DisplayColorScale(); | |
193 | ||
194 | fCanvas->cd(); | |
195 | // Create user interface control pad | |
196 | DisplayButtons(); | |
197 | fCanvas->cd(); | |
198 | ||
199 | // Create Range and mode pad | |
200 | Float_t dxtr = 0.15; | |
201 | Float_t dytr = 0.45; | |
202 | fTrigPad = new TPad("trigger", "range and mode pad",0,0,dxtr,dytr); | |
a9e2aefa | 203 | fTrigPad->Draw(); |
204 | fTrigPad->cd(); | |
205 | fTrigPad->SetFillColor(22); | |
206 | fTrigPad->SetBorderSize(2); | |
207 | fRangeSlider = new TSlider("range","range",0.7,0.42,0.9,0.98); | |
208 | fRangeSlider->SetObject(this); | |
209 | char pickmode[] = "gAlice->Display()->SetPickMode()"; | |
210 | Float_t db = 0.09; | |
211 | fPickButton = new TButton("Pick",pickmode,0.05,0.32,0.65,0.32+db); | |
212 | fPickButton->SetFillColor(38); | |
213 | fPickButton->Draw(); | |
214 | char zoommode[] = "gAlice->Display()->SetZoomMode()"; | |
215 | fZoomButton = new TButton("Zoom",zoommode,0.05,0.21,0.65,0.21+db); | |
216 | fZoomButton->SetFillColor(38); | |
217 | fZoomButton->Draw(); | |
218 | fArcButton = new TArc(.8,fZoomButton->GetYlowNDC()+0.5*db,0.33*db); | |
219 | fArcButton->SetFillColor(kGreen); | |
220 | fArcButton->Draw(); | |
221 | char butUnzoom[] = "gAlice->Display()->UnZoom()"; | |
222 | TButton *button = new TButton("UnZoom",butUnzoom,0.05,0.05,0.95,0.15); | |
223 | button->SetFillColor(38); | |
224 | button->Draw(); | |
225 | AppendPad(); // append display object as last object to force selection | |
226 | ||
227 | fCanvas->cd(); | |
1c4b7942 | 228 | fTrigPad->SetEditable(kFALSE); |
229 | fButtons->SetEditable(kFALSE); | |
a9e2aefa | 230 | fCanvas->Update(); |
231 | fNextCathode = kFALSE; | |
307d9d04 | 232 | fLoader = loader; |
d226f81b | 233 | // initialize container |
234 | if(fLoader) | |
235 | fMUONData = new AliMUONData(fLoader,"MUON","MUON"); | |
236 | else | |
237 | fMUONData =0x0; | |
a9e2aefa | 238 | } |
239 | ||
30178c30 | 240 | AliMUONDisplay::AliMUONDisplay(const AliMUONDisplay & display) |
241 | : AliDisplay(display) | |
a9e2aefa | 242 | { |
30178c30 | 243 | // Protected copy constructor |
244 | ||
8c343c7c | 245 | AliFatal("Not implemented."); |
a9e2aefa | 246 | } |
247 | ||
248 | ||
249 | ||
250 | //_____________________________________________________________________________ | |
251 | AliMUONDisplay::~AliMUONDisplay() | |
252 | { | |
253 | // Delete space point structure | |
254 | if (fPoints) fPoints->Delete(); | |
255 | delete fPoints; | |
256 | fPoints = 0; | |
257 | // | |
258 | if (fPhits) fPhits->Delete(); | |
259 | delete fPhits; | |
260 | fPhits = 0; | |
261 | // | |
d226f81b | 262 | if (fRpoints) fRpoints->Delete(); |
a9e2aefa | 263 | delete fRpoints; |
d226f81b | 264 | fRpoints = 0; |
a9e2aefa | 265 | } |
266 | ||
267 | //_____________________________________________________________________________ | |
268 | void AliMUONDisplay::Clear(Option_t *) | |
269 | { | |
270 | // Delete graphics temporary objects | |
271 | } | |
272 | ||
273 | //_____________________________________________________________________________ | |
274 | void AliMUONDisplay::DisplayButtons() | |
275 | { | |
276 | // Create the user interface buttons | |
277 | ||
278 | ||
279 | fButtons = new TPad("buttons", "newpad",0,0.45,0.15,1); | |
a9e2aefa | 280 | fButtons->Draw(); |
281 | fButtons->SetFillColor(38); | |
282 | fButtons->SetBorderSize(2); | |
283 | fButtons->cd(); | |
284 | ||
285 | // Int_t butcolor = 33; | |
286 | Float_t dbutton = 0.08; | |
287 | Float_t y = 0.96; | |
288 | Float_t dy = 0.014; | |
289 | Float_t x0 = 0.05; | |
290 | Float_t x1 = 0.95; | |
291 | ||
292 | TButton *button; | |
293 | char but1[] = "gAlice->Display()->ShowNextEvent(1)"; | |
294 | button = new TButton("Event +", but1, x0, y - dbutton, x1, y); | |
295 | button->SetFillColor(38); | |
296 | button->Draw(); | |
297 | ||
298 | y -= dbutton + dy; | |
299 | char but2[] = "gAlice->Display()->ShowNextEvent(-1)"; | |
300 | button = new TButton("Event -", but2, x0, y - dbutton, x1, y); | |
301 | button->SetFillColor(38); | |
302 | button->Draw(); | |
303 | ||
304 | y -= dbutton + dy; | |
305 | char but3[] = "((AliMUONDisplay*)(gAlice->Display()))->NextChamber(1)"; | |
306 | button = new TButton("Chamber +", but3, x0, y - dbutton, x1, y); | |
307 | button->SetFillColor(38); | |
308 | button->Draw(); | |
309 | ||
310 | y -= dbutton + dy; | |
311 | char but4[] = "((AliMUONDisplay*)(gAlice->Display()))->NextChamber(-1)"; | |
312 | button = new TButton("Chamber -", but4, x0, y - dbutton, x1, y); | |
313 | button->SetFillColor(38); | |
314 | button->Draw(); | |
315 | ||
316 | y -= dbutton + dy; | |
317 | char but5[] = "((AliMUONDisplay*)(gAlice->Display()))->SetChamberAndCathode(1,1)"; | |
318 | button = new TButton("Chamber 1", but5, x0, y - dbutton, x1, y); | |
319 | button->SetFillColor(38); | |
320 | button->Draw(); | |
321 | ||
322 | y -= dbutton + dy; | |
323 | char but6[] = "((AliMUONDisplay*)(gAlice->Display()))->NextCathode()"; | |
324 | button = new TButton("Cathode <>", but6, x0, y - dbutton, x1, y); | |
325 | button->SetFillColor(38); | |
326 | button->Draw(); | |
327 | ||
328 | y -= dbutton + dy; | |
329 | char but7[] = "((AliMUONDisplay*)(gAlice->Display()))->Trigger()"; | |
330 | button = new TButton("Trigger", but7, x0, y - dbutton, x1, y); | |
331 | button->SetFillColor(38); | |
332 | button->Draw(); | |
333 | ||
572d5bb2 | 334 | y -= dbutton + dy; |
335 | char but8[] = "((AliMUONDisplay*)(gAlice->Display()))->DrawReco()"; | |
336 | button = new TButton("Tracking", but8, x0, y - dbutton, x1, y); | |
337 | button->SetFillColor(38); | |
338 | button->Draw(); | |
339 | ||
a9e2aefa | 340 | // display logo |
341 | TDiamond *diamond = new TDiamond(0.05,0.015,0.95,0.22); | |
342 | diamond->SetFillColor(50); | |
343 | diamond->SetTextAlign(22); | |
344 | diamond->SetTextColor(5); | |
345 | diamond->SetTextSize(0.11); | |
346 | diamond->Draw(); | |
347 | diamond->AddText(".. "); | |
348 | diamond->AddText("ROOT"); | |
349 | diamond->AddText("MUON"); | |
350 | diamond->AddText("... "); | |
351 | diamond->AddText(" "); | |
352 | } | |
353 | ||
354 | //_____________________________________________________________________________ | |
30178c30 | 355 | void AliMUONDisplay::CreateColors() const |
a9e2aefa | 356 | { |
357 | // Create the colors palette used to display clusters | |
358 | ||
359 | Int_t k,i; | |
360 | Int_t color; | |
361 | Float_t r,g,b; | |
362 | ||
363 | for (k=1;k<=5;k++) { | |
364 | switch(k) { | |
365 | case 1: | |
366 | for (i=1;i<=5;i++) { | |
367 | r=1.; | |
368 | g=i*0.2; | |
369 | b=0.; | |
370 | color=i; | |
371 | color=260+23-color; | |
372 | new TColor(color,r,g,b); | |
373 | } | |
374 | break; | |
375 | case 2: | |
376 | for (i=1;i<=4;i++) { | |
377 | r=1.1-i*0.2; | |
378 | g=1.; | |
379 | b=0.; | |
380 | color=i+5; | |
381 | color=260+23-color; | |
382 | new TColor(color,r,g,b); | |
383 | } | |
384 | break; | |
385 | case 3: | |
386 | for (i=1;i<=4;i++) { | |
387 | r=0.; | |
388 | g=1.; | |
389 | b=i*0.2+0.2; | |
390 | color=i+9; | |
391 | color=260+23-color; | |
392 | new TColor(color,r,g,b); | |
393 | } | |
394 | break; | |
395 | case 4: | |
396 | for (i=1;i<=4;i++) { | |
397 | r=0.; | |
398 | g=1.1-i*0.2; | |
399 | b=1.; | |
400 | color=i+13; | |
401 | color=260+23-color; | |
402 | new TColor(color,r,g,b); | |
403 | } | |
404 | break; | |
405 | case 5: | |
406 | for (i=1;i<=5;i++) { | |
407 | r=i*0.2; | |
408 | g=0.; | |
409 | b=1.; | |
410 | color=i+17; | |
411 | color=260+23-color; | |
412 | new TColor(color,r,g,b); | |
413 | } | |
414 | break; | |
415 | } | |
416 | } | |
417 | } | |
418 | ||
419 | //_____________________________________________________________________________ | |
420 | void AliMUONDisplay::DisplayColorScale() | |
421 | { | |
422 | // Display pulse height color scale | |
423 | Int_t i; | |
424 | Int_t color; | |
425 | Float_t xlow, ylow, xup, yup, hs; | |
426 | Float_t x1, y1, x2, y2; | |
427 | x1 = y1 = 0; | |
428 | x2 = y2 = 1.0; | |
429 | ||
430 | TText *text = new TText(0,0,""); | |
431 | text->SetTextFont(61); | |
432 | text->SetTextSize(0.2); | |
433 | text->SetTextAlign(22); | |
434 | ||
7e4a628d | 435 | |
436 | Int_t adcmax=4096; // default 12 bits ADC | |
437 | ||
a9e2aefa | 438 | |
439 | ||
440 | TBox *box; | |
441 | char label[8]; | |
442 | //*-* draw colortable boxes | |
443 | hs = (y2-y1)/Float_t(22); | |
444 | xlow=x1+.05; | |
445 | xup=x2-0.5; | |
446 | for (i=0;i<22;i++) { | |
447 | ylow = y1 + hs*(Float_t(i)); | |
448 | yup = y1 + hs*(Float_t(i+1)); | |
449 | color = 261+i; | |
450 | Double_t logscale=Double_t(i+1)*(TMath::Log(adcmax)/22); | |
451 | Int_t scale=(Int_t)TMath::Exp(logscale); | |
452 | sprintf(label,"%d",scale); | |
453 | box = new TBox(xlow, ylow, xup, yup); | |
454 | box->Draw(); | |
455 | box->SetFillColor(color); | |
456 | text->DrawText(xlow+0.7, 0.5*(ylow+yup),label); | |
457 | } | |
458 | } | |
459 | ||
460 | //______________________________________________________________________________ | |
461 | Int_t AliMUONDisplay::DistancetoPrimitive(Int_t px, Int_t) | |
462 | { | |
463 | // Compute distance from point px,py to objects in event | |
464 | ||
465 | gPad->SetCursor(kCross); | |
466 | ||
467 | if (gPad == fTrigPad) return 9999; | |
468 | ||
469 | const Int_t kBig = 9999; | |
470 | Int_t dist = kBig; | |
471 | Float_t xmin = gPad->GetX1(); | |
472 | Float_t xmax = gPad->GetX2(); | |
473 | Float_t dx = 0.02*(xmax - xmin); | |
474 | Float_t x = gPad->AbsPixeltoX(px); | |
475 | if (x < xmin+dx || x > xmax-dx) return dist; | |
476 | ||
477 | if (fZoomMode) return 0; | |
478 | else return 7; | |
479 | } | |
480 | ||
481 | //_____________________________________________________________________________ | |
482 | void AliMUONDisplay::Draw(Option_t *) | |
483 | { | |
484 | // Display current event | |
485 | ||
572d5bb2 | 486 | if (!fDrawTracks) |
487 | DrawChamber(); | |
488 | else | |
489 | DrawReco(); | |
490 | ||
491 | } | |
492 | //_____________________________________________________________________________ | |
493 | void AliMUONDisplay::DrawChamber() | |
494 | { | |
a9e2aefa | 495 | |
572d5bb2 | 496 | fDrawTracks = kFALSE; |
497 | fPad->cd(); | |
498 | DrawView(fTheta, fPhi, fPsi); | |
499 | // Display the event number and title | |
500 | fPad->cd(); | |
501 | DrawTitle(); | |
502 | ||
503 | } | |
504 | //_____________________________________________________________________________ | |
505 | void AliMUONDisplay::DrawReco(Option_t *) | |
506 | { | |
507 | // Display current event | |
508 | ||
509 | fDrawTracks = kTRUE; | |
510 | // print kinematics of generated particles | |
511 | PrintKinematics(); | |
512 | // Draw global view of muon system | |
513 | fPad->cd(); | |
514 | DrawGlobalView(135, -50, -140); | |
515 | ||
a9e2aefa | 516 | // Display the event number and title |
517 | fPad->cd(); | |
518 | DrawTitle(); | |
519 | } | |
520 | ||
572d5bb2 | 521 | //_____________________________________________________________________________ |
522 | void AliMUONDisplay::PrintKinematics() | |
523 | { | |
524 | AliRunLoader * runLoader; | |
525 | TParticle *particle = new TParticle(); | |
526 | Int_t nPart; | |
527 | Float_t vertex[3], momentum[3]; | |
528 | ||
529 | if (fLoader) | |
530 | runLoader = fLoader->GetRunLoader(); | |
531 | else | |
532 | runLoader = 0x0; | |
533 | ||
534 | printf("****** Event # %d ******\n",runLoader->GetEventNumber()); | |
535 | runLoader->TreeK()->GetBranch("Particles")->SetAddress(&particle); | |
536 | nPart = (Int_t)runLoader->TreeK()->GetEntries(); | |
537 | for(Int_t iPart = 0; iPart < nPart; iPart++) { | |
538 | runLoader->TreeK()->GetEvent(iPart); | |
539 | vertex[0] = particle->Vx(); | |
540 | vertex[1] = particle->Vy(); | |
541 | vertex[2] = particle->Vz(); | |
542 | momentum[0] = particle->Px(); | |
543 | momentum[1] = particle->Py(); | |
544 | momentum[2] = particle->Pz(); | |
545 | ||
546 | printf("===================================================\n"); | |
547 | printf(" Generated particle # %d \n",iPart); | |
548 | printf(" name: %s \n",particle->GetName()); | |
549 | printf(" vertex x,y,z (cm): %f %f %f \n",vertex[0],vertex[1],vertex[2]); | |
550 | printf(" momentum Px,Py,Pz (GeV/c): %f %f %f \n",momentum[0],momentum[1],momentum[2]); | |
551 | } | |
552 | delete particle; | |
553 | } | |
554 | ||
a9e2aefa | 555 | void AliMUONDisplay::DrawSegmentation() |
556 | { | |
002920d1 | 557 | // to be re-written for new seg |
a9e2aefa | 558 | // Draw graphical representation of segmenatation |
559 | // Attention: still experimental code | |
002920d1 | 560 | // Int_t icat=1; |
a9e2aefa | 561 | |
002920d1 | 562 | // AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON"); |
563 | // AliMUONChamber* iChamber; | |
76dadf7e | 564 | |
002920d1 | 565 | // AliSegmentation* seg; |
566 | // iChamber = &(pMUON->Chamber(fChamber)); | |
567 | // seg=iChamber->SegmentationModel(icat); | |
76dadf7e | 568 | |
002920d1 | 569 | // Float_t zpos=iChamber->Z(); |
570 | // Float_t r=iChamber->ROuter(); | |
a9e2aefa | 571 | |
002920d1 | 572 | // TMarker3DBox *marker; |
573 | // if (icat == 1) { | |
574 | // for (Int_t j=0; j<seg->Npy(); j++) { | |
575 | // Float_t y0; | |
576 | // y0=j*seg->Dpy()-seg->Dpy()/2.; | |
577 | // for (seg->FirstPad(0.,y0,0,300,0.); | |
578 | // seg->MorePads(); | |
579 | // seg->NextPad()) | |
580 | // { | |
581 | // if (seg->ISector()==0) continue; | |
582 | // Float_t x,y,z; | |
583 | // seg->GetPadC(seg->Ix(), seg->Iy(), x, y, z); | |
584 | // Float_t dpx=seg->Dpx(seg->ISector())/2; | |
585 | // Float_t dpy=seg->Dpy(seg->ISector())/2; | |
586 | // marker=new TMarker3DBox(x,y,zpos,dpx,dpy,0,0,0); | |
587 | // marker->SetLineColor(seg->ISector()+1); | |
588 | // marker->SetFillStyle(1001); | |
589 | // marker->SetFillColor(0); | |
590 | // marker->Draw(); | |
591 | // } | |
592 | // } | |
593 | // } else { | |
594 | // for (Int_t j=0; j<250; j++) { | |
595 | // Float_t x0=j*seg->Dpx(); | |
596 | // Float_t y0=TMath::Sqrt(r*r-x0*x0); | |
a9e2aefa | 597 | |
002920d1 | 598 | // for (seg->FirstPad(x0,0,0,0,y0); |
599 | // seg->MorePads(); | |
600 | // seg->NextPad()) | |
601 | // { | |
602 | // if (seg->ISector()==0) continue; | |
a9e2aefa | 603 | |
002920d1 | 604 | // Float_t x,y,z; |
605 | // seg->GetPadC(seg->Ix(), seg->Iy(), x, y, z); | |
606 | // Float_t dpx=seg->Dpx(seg->ISector())/2; | |
607 | // Float_t dpy=seg->Dpy(seg->ISector())/2; | |
608 | // marker=new TMarker3DBox(x,y,zpos,dpx,dpy,0,0,0); | |
609 | // marker->SetLineColor(seg->ISector()+1); | |
610 | // marker->SetFillStyle(1001); | |
611 | // marker->SetFillColor(0); | |
612 | // marker->Draw(); | |
613 | // } | |
614 | // } | |
615 | // } | |
616 | } | |
a9e2aefa | 617 | |
618 | //_____________________________________________________________________________ | |
619 | void AliMUONDisplay::DrawClusters() | |
620 | { | |
621 | // Draw clusters for MUON chambers | |
622 | ||
623 | Int_t ndigits, digit; | |
624 | TObjArray *points; | |
625 | AliMUONPoints *pm; | |
626 | ||
627 | ||
628 | fClustersCuts = 0; | |
629 | points = Points(); | |
630 | if (!points) return; | |
631 | ndigits = points->GetEntriesFast(); | |
632 | for (digit=0;digit<ndigits;digit++){ | |
633 | pm = (AliMUONPoints*)points->UncheckedAt(digit); | |
634 | if (!pm) continue; | |
635 | Float_t *pxyz; | |
636 | pxyz=pm->GetP(); | |
637 | for (Int_t im=0;im<3;im++) { | |
638 | TMarker3DBox *marker=pm->GetMarker(im); | |
639 | if (marker) | |
640 | marker->Draw(); | |
641 | } | |
642 | pm->Draw(); | |
123469eb | 643 | fClustersCuts += pm->GetN(); |
a9e2aefa | 644 | } |
645 | } | |
646 | ||
647 | //_____________________________________________________________________________ | |
648 | void AliMUONDisplay::DrawHits() | |
649 | { | |
650 | // Draw hits for MUON chambers | |
651 | ||
652 | LoadHits(fChamber); | |
653 | ||
654 | Int_t ntracks, track; | |
655 | TObjArray *points; | |
656 | AliMUONPoints *pm; | |
657 | ||
658 | fHitsCuts = 0; | |
659 | points = Phits(); | |
660 | if (!points) return; | |
661 | ntracks = points->GetEntriesFast(); | |
662 | for (track=0;track<ntracks;track++) { | |
663 | pm = (AliMUONPoints*)points->UncheckedAt(track); | |
664 | if (!pm) continue; | |
665 | pm->Draw(); | |
666 | fHitsCuts += pm->GetN(); | |
667 | } | |
668 | } | |
669 | ||
670 | ||
671 | //_____________________________________________________________________________ | |
672 | void AliMUONDisplay::DrawCoG() | |
673 | { | |
674 | // Draw hits for MUON chambers | |
675 | if (!fDrawCoG) return; | |
676 | if (fChamber > 10) return; | |
677 | LoadCoG(fChamber,fCathode); | |
678 | ||
679 | Int_t ncog, icog; | |
680 | TObjArray *points; | |
681 | AliMUONPoints *pm; | |
682 | ||
683 | points = Rpoints(); | |
684 | if (!points) return; | |
685 | ncog = points->GetEntriesFast(); | |
686 | for (icog=0;icog<ncog;icog++) { | |
687 | pm = (AliMUONPoints*)points->UncheckedAt(icog); | |
688 | if (!pm) continue; | |
689 | pm->Draw(); | |
690 | } | |
691 | } | |
a9e2aefa | 692 | //_____________________________________________________________________________ |
572d5bb2 | 693 | void AliMUONDisplay::DrawTracks() |
694 | { | |
695 | // Draw tracks | |
696 | if (!fDrawTracks) return; | |
697 | LoadTracks(); | |
698 | ||
699 | Int_t nTrack, iTrack; | |
700 | TObjArray *points; | |
701 | TPolyLine3D *pm; | |
702 | ||
703 | points = Rpoints(); | |
704 | if (!points) return; | |
705 | nTrack = points->GetEntriesFast(); | |
706 | for ( iTrack = 0; iTrack < nTrack; iTrack++) { | |
707 | pm = (TPolyLine3D*)points->UncheckedAt(iTrack); | |
708 | if (!pm) continue; | |
709 | pm->Draw(); | |
710 | } | |
711 | } | |
712 | //_____________________________________________________________________________ | |
a9e2aefa | 713 | |
714 | void AliMUONDisplay::DrawTitle(Option_t *option) | |
715 | { | |
716 | // Draw the event title | |
717 | ||
718 | Float_t xmin = gPad->GetX1(); | |
719 | Float_t xmax = gPad->GetX2(); | |
720 | Float_t ymin = gPad->GetY1(); | |
721 | Float_t ymax = gPad->GetY2(); | |
722 | Float_t dx = xmax-xmin; | |
723 | Float_t dy = ymax-ymin; | |
724 | ||
30178c30 | 725 | AliRunLoader * runLoader; |
307d9d04 | 726 | if (fLoader) |
30178c30 | 727 | runLoader = fLoader->GetRunLoader(); |
307d9d04 | 728 | else |
30178c30 | 729 | runLoader = 0x0; |
7985603c | 730 | |
731 | ||
a9e2aefa | 732 | if (strlen(option) == 0) { |
733 | TPaveText *title = new TPaveText(xmin +0.01*dx, ymax-0.09*dy, xmin +0.5*dx, ymax-0.01*dy); | |
734 | // title->SetTextSize(0.023932); | |
735 | title->SetTextSize(0.02); | |
736 | title->SetBit(kCanDelete); | |
737 | title->SetFillColor(42); | |
738 | title->Draw(); | |
739 | char ptitle[100]; | |
740 | sprintf(ptitle, "Alice event:%d Run:%d Chamber:%d Cathode:%d", | |
30178c30 | 741 | runLoader->GetEventNumber(), |
a9e2aefa | 742 | gAlice->GetHeader()->GetRun(), |
743 | fChamber, | |
744 | fCathode); | |
745 | title->AddText(ptitle); | |
5d12ce38 | 746 | Int_t nparticles = gAlice->GetMCApp()->Particles()->GetEntriesFast(); |
a9e2aefa | 747 | sprintf(ptitle,"Nparticles = %d Nhits = %d Npads fired = %d", |
748 | nparticles, fHitsCuts,fClustersCuts); | |
749 | title->AddText(ptitle); | |
750 | } else { | |
751 | TPaveLabel *label = new TPaveLabel(xmin +0.01*dx, ymax-0.07*dy, xmin +0.2*dx, ymax-0.01*dy,option); | |
752 | label->SetBit(kCanDelete); | |
753 | label->SetFillColor(42); | |
754 | label->Draw(); | |
755 | } | |
756 | } | |
757 | ||
758 | //_____________________________________________________________________________ | |
759 | void AliMUONDisplay::DrawView(Float_t theta, Float_t phi, Float_t psi) | |
760 | { | |
761 | // Draw a view of MUON clusters | |
c177f73d | 762 | AliInfo(" Draw View"); |
a9e2aefa | 763 | |
764 | gPad->SetCursor(kWatch); | |
765 | // gPad->SetFillColor(39); | |
766 | gPad->SetFillColor(1); | |
767 | gPad->Clear(); | |
768 | // gPad->SetFillColor(39); | |
769 | gPad->SetFillColor(1); | |
770 | ||
771 | ||
772 | Int_t iret=0; | |
773 | TView *view = new TView(1); | |
774 | ||
775 | Float_t range = fRrange*fRangeSlider->GetMaximum(); | |
776 | view->SetRange(-range,-range,-range,range, range, range); | |
777 | // zoom back to full scale only if DrawView not called from NextCathode | |
778 | if (!fNextCathode) { | |
779 | fZoomX0[0] = -1; | |
780 | fZoomY0[0] = -1; | |
781 | fZoomX1[0] = 1; | |
782 | fZoomY1[0] = 1; | |
783 | fZooms = 0; | |
784 | } | |
63216d66 | 785 | |
786 | Float_t xg1, xg2, yg1, yg2, zg1, zg2; | |
787 | ||
123469eb | 788 | // Recovering the chamber |
789 | AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON"); | |
b7ef3c96 | 790 | |
791 | const AliMUONGeometryTransformer* kGeomTransformer | |
792 | = pMUON->GetGeometryTransformer(); | |
793 | ||
794 | AliMUONSegmentation* segmentation = pMUON->GetSegmentation(); | |
7502d0e5 | 795 | AliMpSegFactory segFactory; |
796 | // Mapping segmentation factory will be used only to create mapping | |
797 | // segmentations if not present in the DE segmentations | |
a9e2aefa | 798 | |
799 | // Display MUON Chamber Geometry | |
a9e2aefa | 800 | char nodeName[7]; |
801 | sprintf(nodeName,"MUON%d",100+fChamber); | |
123469eb | 802 | printf(">>>> chamber is %d\n",fChamber); |
803 | ||
804 | if(fChamber < 5) { | |
7502d0e5 | 805 | AliMpDEIterator it; |
806 | for ( it.First(fChamber-1); ! it.IsDone(); it.Next() ) { | |
63216d66 | 807 | |
7502d0e5 | 808 | Int_t detElemId = it.CurrentDE(); |
b7ef3c96 | 809 | AliMpSectorSegmentation * seg = |
810 | (AliMpSectorSegmentation *) segmentation->GetMpSegmentation(detElemId, 0); | |
811 | const AliMpSector * sector = seg->GetSector(); | |
63216d66 | 812 | |
813 | // get sector measurements | |
814 | TVector2 position = sector->Position(); | |
815 | TVector2 dimension = sector->Dimensions(); // half length | |
816 | ||
7c618420 | 817 | Float_t xlocal1 = position.Px(); // mm to cm |
818 | Float_t ylocal1 = position.Py(); | |
819 | Float_t xlocal2 = dimension.Px() * 2.; | |
820 | Float_t ylocal2 = dimension.Px() * 2.; | |
63216d66 | 821 | |
b7ef3c96 | 822 | kGeomTransformer->Local2Global(detElemId, xlocal1, ylocal1, 0, xg1, yg1, zg1); |
823 | kGeomTransformer->Local2Global(detElemId, xlocal2, ylocal2, 0, xg2, yg2, zg2); | |
63216d66 | 824 | |
825 | // drawing | |
826 | TPolyLine3D* poly = new TPolyLine3D(); | |
827 | Int_t nPoint = 0; | |
828 | ||
829 | poly->SetPoint(nPoint++, xg1, yg1, 0.); | |
830 | for (Float_t d = 0; d < TMath::Pi()/2.; d+= 0.01) { | |
831 | Float_t x = xg1 + xg2 * TMath::Cos(d); | |
832 | Float_t y = yg1 + yg2 * TMath::Sin(d); | |
833 | poly->SetPoint(nPoint++, x, y, 0.); | |
834 | } | |
835 | poly->SetPoint(nPoint++, xg1, yg1, 0.); | |
836 | ||
837 | poly->SetLineColor(2); | |
838 | poly->Draw("s"); | |
123469eb | 839 | } |
63216d66 | 840 | |
841 | // } | |
123469eb | 842 | |
63216d66 | 843 | } |
123469eb | 844 | |
845 | if(fChamber >4 && fChamber <11) { | |
7502d0e5 | 846 | AliMpDEIterator it; |
847 | for ( it.First(fChamber-1); ! it.IsDone(); it.Next() ) { | |
848 | Int_t detElemId = it.CurrentDE(); | |
b7ef3c96 | 849 | if ( segmentation->HasDE(detElemId) ) { |
123469eb | 850 | AliMpSlatSegmentation * seg = |
b7ef3c96 | 851 | (AliMpSlatSegmentation *) segmentation->GetMpSegmentation(detElemId, 0); |
7502d0e5 | 852 | if (!seg) { |
853 | // Create mapping segmentation if old trigger segmentation | |
854 | // (not using mapping) | |
855 | seg = (AliMpSlatSegmentation *) | |
856 | segFactory.CreateMpSegmentation(detElemId, 0); | |
16495fbc | 857 | } |
b7ef3c96 | 858 | if (seg) { |
859 | const AliMpSlat* slat = seg->Slat(); | |
860 | Float_t deltax = slat->DX(); | |
861 | Float_t deltay = slat->DY(); | |
862 | Float_t xlocal1 = -deltax; | |
863 | Float_t ylocal1 = -deltay; | |
864 | Float_t xlocal2 = +deltax; | |
865 | Float_t ylocal2 = +deltay; | |
866 | kGeomTransformer->Local2Global(detElemId, xlocal1, ylocal1, 0, xg1, yg1, zg1); | |
867 | kGeomTransformer->Local2Global(detElemId, xlocal2, ylocal2, 0, xg2, yg2, zg2); | |
868 | ||
869 | // drawing slat active volumes | |
870 | Float_t xCenter = (xg1 + xg2)/2.; | |
871 | Float_t yCenter = (yg1 + yg2)/2.; | |
872 | ||
873 | TMarker3DBox* box = new TMarker3DBox(xCenter,yCenter,0,xlocal1,ylocal2,0,0,0); | |
874 | ||
875 | box->SetFillStyle(0); | |
876 | box->SetLineColor(2); | |
877 | box->Draw("s"); | |
878 | ||
879 | // drawing inner circle + disc | |
880 | TPolyLine3D* poly = new TPolyLine3D(); | |
881 | TPolyLine3D* poly1 = new TPolyLine3D(); | |
882 | ||
883 | Int_t nPoint = 0; | |
884 | Int_t nPoint1 = 0; | |
885 | for (Float_t d = 0; d < 6.24; d+= 0.005) { | |
886 | Double_t x = AliMUONConstants::Dmin((fChamber-1)/2) * TMath::Cos(d)/2.; | |
887 | Double_t y = AliMUONConstants::Dmin((fChamber-1)/2) * TMath::Sin(d)/2.; | |
888 | if (nPoint % 2 == 0) poly->SetPoint(nPoint++, 0., 0., 0.); | |
889 | poly->SetPoint(nPoint++, x, y, 0.); | |
890 | poly1->SetPoint(nPoint1++, x, y, 0.); | |
123469eb | 891 | |
b7ef3c96 | 892 | } |
893 | poly->SetLineColor(1); | |
894 | poly->Draw("s"); | |
895 | poly1->SetLineColor(2); | |
896 | poly1->Draw("s"); | |
897 | } | |
123469eb | 898 | } |
899 | } | |
e0d2f4db | 900 | } |
901 | ||
902 | /*-- Trigger Chambers ---------------------------------------*/ | |
903 | if(fChamber >10 && fChamber <15) { | |
7502d0e5 | 904 | AliMpDEIterator it; |
905 | for ( it.First(fChamber-1); ! it.IsDone(); it.Next() ) { | |
906 | Int_t detElemId = it.CurrentDE(); | |
16495fbc | 907 | AliMpTriggerSegmentation * seg |
908 | = (AliMpTriggerSegmentation *) segmentation->GetMpSegmentation(detElemId, 0); | |
909 | if (!seg) { | |
7502d0e5 | 910 | // Create mapping segmentation if old trigger segmentation |
911 | // (not using mapping) | |
912 | seg = (AliMpTriggerSegmentation *) | |
913 | segFactory.CreateMpSegmentation(detElemId, 0); | |
16495fbc | 914 | } |
b7ef3c96 | 915 | if (seg) { |
e0d2f4db | 916 | const AliMpTrigger* slat = seg->Slat(); |
917 | Float_t deltax = slat->DX(); | |
918 | Float_t deltay = slat->DY(); | |
919 | Float_t xlocal1 = -deltax; | |
920 | Float_t ylocal1 = -deltay; | |
921 | Float_t xlocal2 = +deltax; | |
922 | Float_t ylocal2 = +deltay; | |
b7ef3c96 | 923 | |
924 | kGeomTransformer->Local2Global(detElemId, xlocal1, ylocal1, 0, xg1, yg1, zg1); | |
925 | kGeomTransformer->Local2Global(detElemId, xlocal2, ylocal2, 0, xg2, yg2, zg2); | |
e0d2f4db | 926 | |
927 | // drawing slat active volumes | |
928 | Float_t xCenter = (xg1 + xg2)/2.; | |
929 | Float_t yCenter = (yg1 + yg2)/2.; | |
930 | ||
931 | TMarker3DBox* box = new TMarker3DBox(xCenter,yCenter,0,xlocal1,ylocal2,0,0,0); | |
932 | ||
933 | box->SetFillStyle(0); | |
934 | box->SetLineColor(4); | |
935 | box->Draw("s"); | |
b7ef3c96 | 936 | } |
e0d2f4db | 937 | } |
938 | } | |
7502d0e5 | 939 | // Delete mapping segmentations created with factory |
3984c1d5 | 940 | segFactory.DeleteSegmentations(); |
7502d0e5 | 941 | |
a9e2aefa | 942 | //add clusters to the pad |
943 | DrawClusters(); | |
a9e2aefa | 944 | DrawHits(); |
945 | DrawCoG(); | |
a9e2aefa | 946 | // DrawSegmentation(); |
947 | // add itself to the list (must be last) | |
948 | AppendPad(); | |
949 | view->SetView(phi, theta, psi, iret); | |
950 | } | |
951 | ||
572d5bb2 | 952 | //_____________________________________________________________________________ |
953 | void AliMUONDisplay::DrawGlobalView(Float_t theta, Float_t phi, Float_t psi) | |
954 | { | |
955 | // Draw a view of muons chambers with tracks | |
956 | ||
957 | gPad->SetCursor(kWatch); | |
958 | // gPad->SetFillColor(39); | |
959 | gPad->SetFillColor(1); | |
960 | gPad->Clear(); | |
961 | // gPad->SetFillColor(39); | |
962 | gPad->SetFillColor(1); | |
963 | ||
964 | ||
965 | Int_t iret=0; | |
966 | TView *view = new TView(1); | |
967 | ||
968 | Float_t range = fRrange*fRangeSlider->GetMaximum()*3.; | |
969 | view->SetRange(-range,-range,-range,range,range,range); | |
970 | ||
971 | // Display all MUON Chambers segmentation | |
972 | char nodeName[7]; | |
973 | TNode *node1; | |
974 | sprintf(nodeName,"alice"); | |
975 | ||
976 | node1=gAlice->GetGeometry()->GetNode(nodeName); | |
977 | if (node1) node1->Draw("same"); | |
978 | ||
979 | ||
980 | // Draw clusters for all chambers | |
981 | Int_t chamberSave = fChamber; | |
982 | for (fChamber = 1; fChamber <= 10; fChamber++){ | |
983 | DrawCoG(); | |
984 | } | |
985 | fChamber = chamberSave; | |
986 | // Draw reconstructed tracks | |
987 | DrawTracks(); | |
988 | ||
989 | AppendPad(); | |
990 | ||
991 | Float_t zoom = 2.; | |
992 | Float_t shift = 0.9; | |
993 | Float_t x0 = (-1+shift)/zoom; | |
994 | Float_t y0 = (-1+shift)/zoom; | |
995 | Float_t x1 = (1+shift)/zoom; | |
996 | Float_t y1 = (1+shift)/zoom; | |
997 | gPad->Range(x0,y0,x1,y1); | |
998 | view->SetView(phi, theta, psi, iret); | |
999 | ||
1000 | } | |
a9e2aefa | 1001 | |
1002 | //______________________________________________________________________________ | |
1003 | void AliMUONDisplay::ExecuteEvent(Int_t event, Int_t px, Int_t py) | |
1004 | { | |
1005 | // Execute action corresponding to the mouse event | |
1006 | ||
1007 | static Float_t x0, y0, x1, y1; | |
1008 | ||
1009 | static Int_t pxold, pyold; | |
1010 | static Int_t px0, py0; | |
1011 | static Int_t linedrawn; | |
1012 | Float_t temp; | |
1013 | ||
1014 | if (px == 0 && py == 0) { //when called by sliders | |
1015 | if (event == kButton1Up) { | |
1016 | Draw(); | |
1017 | } | |
1018 | return; | |
1019 | } | |
1020 | if (!fZoomMode && gPad->GetView()) { | |
1021 | gPad->GetView()->ExecuteRotateView(event, px, py); | |
1022 | return; | |
1023 | } | |
1024 | ||
1025 | // something to zoom ? | |
1026 | gPad->SetCursor(kCross); | |
1027 | ||
1028 | switch (event) { | |
1029 | ||
1030 | case kButton1Down: | |
1031 | gVirtualX->SetLineColor(-1); | |
1032 | gPad->TAttLine::Modify(); //Change line attributes only if necessary | |
1033 | x0 = gPad->AbsPixeltoX(px); | |
1034 | y0 = gPad->AbsPixeltoY(py); | |
1035 | px0 = px; py0 = py; | |
1036 | pxold = px; pyold = py; | |
1037 | linedrawn = 0; | |
1038 | return; | |
1039 | ||
1040 | case kButton1Motion: | |
1041 | if (linedrawn) gVirtualX->DrawBox(px0, py0, pxold, pyold, TVirtualX::kHollow); | |
1042 | pxold = px; | |
1043 | pyold = py; | |
1044 | linedrawn = 1; | |
1045 | gVirtualX->DrawBox(px0, py0, pxold, pyold, TVirtualX::kHollow); | |
1046 | return; | |
1047 | ||
1048 | case kButton1Up: | |
1049 | gPad->GetCanvas()->FeedbackMode(kFALSE); | |
1050 | if (px == px0) return; | |
1051 | if (py == py0) return; | |
1052 | x1 = gPad->AbsPixeltoX(px); | |
1053 | y1 = gPad->AbsPixeltoY(py); | |
1054 | ||
1055 | if (x1 < x0) {temp = x0; x0 = x1; x1 = temp;} | |
1056 | if (y1 < y0) {temp = y0; y0 = y1; y1 = temp;} | |
1057 | gPad->Range(x0,y0,x1,y1); | |
97ccf8cb | 1058 | if (fZooms < AliMUONConstants::MaxZoom()-1) { |
a9e2aefa | 1059 | fZooms++; |
1060 | fZoomX0[fZooms] = x0; | |
1061 | fZoomY0[fZooms] = y0; | |
1062 | fZoomX1[fZooms] = x1; | |
1063 | fZoomY1[fZooms] = y1; | |
1064 | } | |
1065 | gPad->Modified(kTRUE); | |
1066 | return; | |
1067 | } | |
1068 | } | |
1069 | ||
1070 | //___________________________________________ | |
1071 | void AliMUONDisplay::LoadDigits(Int_t chamber, Int_t cathode) | |
1072 | { | |
1073 | // Read digits info and store x,y,z info in arrays fPoints | |
1074 | // Loop on all detectors | |
1075 | ||
1076 | if (chamber > 14) return; | |
08a636a8 | 1077 | fChamber = chamber; |
1078 | fCathode = cathode; | |
a9e2aefa | 1079 | |
1080 | ResetPoints(); | |
1081 | ||
08a636a8 | 1082 | AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON"); |
76dadf7e | 1083 | AliMUONGeometrySegmentation* segmentation2 = 0x0; |
1084 | ||
d226f81b | 1085 | GetMUONData()->SetTreeAddress("D"); |
a9e2aefa | 1086 | |
d226f81b | 1087 | TClonesArray *muonDigits = GetMUONData()->Digits(chamber-1); |
a9e2aefa | 1088 | if (muonDigits == 0) return; |
1089 | ||
d226f81b | 1090 | gAlice->ResetDigits(); |
00f56532 | 1091 | Int_t nent = 0; |
1092 | ||
307d9d04 | 1093 | if (GetLoader()->TreeD()) { |
1094 | nent = (Int_t) GetLoader()->TreeD()->GetEntries(); | |
49b640e7 | 1095 | // gAlice->TreeD()->GetEvent(nent-2+cathode-1); |
935b9895 | 1096 | GetMUONData()->GetDigits(); |
00f56532 | 1097 | } |
1098 | ||
a9e2aefa | 1099 | Int_t ndigits = muonDigits->GetEntriesFast(); |
1100 | if (ndigits == 0) return; | |
1101 | if (fPoints == 0) fPoints = new TObjArray(ndigits); | |
1102 | ||
b7ef3c96 | 1103 | //segmentation2 = iChamber->SegmentationModel2(cathode); |
1104 | segmentation2 | |
1105 | = pMUON->GetSegmentation()->GetModuleSegmentation(chamber-1, cathode-1); | |
a9e2aefa | 1106 | |
b7ef3c96 | 1107 | Float_t zpos = AliMUONConstants::DefaultChamberZ(chamber-1); |
08a636a8 | 1108 | |
a9e2aefa | 1109 | AliMUONDigit *mdig; |
08a636a8 | 1110 | AliMUONPoints *points = 0; |
1111 | TMarker3DBox *marker = 0; | |
a9e2aefa | 1112 | // |
1113 | //loop over all digits and store their position | |
1114 | ||
08a636a8 | 1115 | Int_t npoints = 1; |
7e4a628d | 1116 | Float_t adcmax = 1024; // default |
1117 | if (chamber<11) adcmax = 4096; | |
a9e2aefa | 1118 | |
08a636a8 | 1119 | for (Int_t digit = 0; digit < ndigits; digit++) { |
a9e2aefa | 1120 | mdig = (AliMUONDigit*)muonDigits->UncheckedAt(digit); |
08a636a8 | 1121 | if (mdig->Cathode() != cathode-1) continue; |
4554f81d | 1122 | |
a9e2aefa | 1123 | // |
1124 | // First get all needed parameters | |
1125 | // | |
08a636a8 | 1126 | Int_t charge = mdig->Signal(); |
1127 | Int_t index = Int_t(TMath::Log(charge)/(TMath::Log(adcmax)/22)); | |
1128 | Int_t color = 261+index; | |
1129 | Int_t colorTrigger = 2; | |
1130 | if (color > 282) color = 282; | |
a9e2aefa | 1131 | |
1132 | if (chamber > 10) { // trigger chamber | |
4554f81d | 1133 | |
08a636a8 | 1134 | Int_t sumCharge = 0; |
1135 | for (Int_t icharge = 0; icharge < 10; icharge++) { | |
1136 | sumCharge = sumCharge+mdig->TrackCharge(icharge); | |
a9e2aefa | 1137 | } |
08a636a8 | 1138 | Int_t testCharge = sumCharge-(Int_t(sumCharge/10))*10; |
1139 | if(sumCharge <= 10 || testCharge > 0) { | |
1140 | colorTrigger = color; | |
a9e2aefa | 1141 | } else { |
08a636a8 | 1142 | colorTrigger = 5; |
a9e2aefa | 1143 | } |
1144 | } | |
1145 | ||
1146 | // get the center of the pad - add on x and y half of pad size | |
802a864d | 1147 | Float_t xpad, ypad, zpad; |
76dadf7e | 1148 | Int_t isec; |
1149 | Float_t dpx, dpy; | |
1150 | ||
002920d1 | 1151 | Int_t detElemId = mdig->DetElemId(); |
1152 | segmentation2->GetPadC(detElemId, mdig->PadX(), mdig->PadY(), xpad, ypad, zpad); | |
1153 | isec = segmentation2->Sector(detElemId, mdig->PadX(), mdig->PadY()); | |
1154 | dpx = segmentation2->Dpx(detElemId, isec)/2; | |
1155 | dpy = segmentation2->Dpy(detElemId, isec)/2; | |
08a636a8 | 1156 | // |
1157 | // segmentation->Dump(); | |
a9e2aefa | 1158 | |
a9e2aefa | 1159 | // |
1160 | // Then set the objects | |
1161 | // | |
1162 | points = new AliMUONPoints(npoints); | |
1163 | fPoints->AddAt(points,digit); | |
1164 | if (chamber > 10) { | |
1165 | points->SetMarkerColor(colorTrigger); | |
1166 | } else { | |
1167 | points->SetMarkerColor(color); | |
1168 | } | |
1169 | points->SetMarkerStyle(21); | |
1170 | points->SetMarkerSize(0.5); | |
1171 | points->SetParticle(-1); | |
1172 | points->SetHitIndex(-1); | |
1173 | points->SetTrackIndex(-1); | |
1174 | points->SetDigitIndex(digit); | |
4554f81d | 1175 | points->SetPoint(0,xpad,ypad,zpos); |
1176 | ||
08a636a8 | 1177 | Int_t lineColor = (zpad-zpos > 0) ? 2:3; |
1178 | marker=new TMarker3DBox(xpad,ypad,zpos,dpx,dpy,0,0,0); | |
1179 | ||
1180 | ||
1181 | marker->SetLineColor(lineColor); | |
1182 | marker->SetFillStyle(1001); | |
1183 | marker->SetFillColor(color); | |
1184 | marker->SetRefObject((TObject*)points); | |
1185 | points->Set3DMarker(0, marker); | |
a9e2aefa | 1186 | } |
1187 | } | |
1188 | //___________________________________________ | |
e0875ac1 | 1189 | void AliMUONDisplay::LoadCoG(Int_t chamber, Int_t /*cathode*/) |
a9e2aefa | 1190 | { |
d226f81b | 1191 | // Read raw clusters info and store x,y,z info in arrays fRpoints |
1192 | // Loop on all detectors | |
a9e2aefa | 1193 | |
1194 | if (chamber > 10) return; | |
1195 | ||
1196 | ResetRpoints(); | |
1197 | ||
d226f81b | 1198 | GetMUONData()->SetTreeAddress("RC"); |
1199 | TClonesArray *muonRawClusters = GetMUONData()->RawClusters(chamber-1); | |
a9e2aefa | 1200 | |
7985603c | 1201 | if (muonRawClusters == 0) return; |
a9e2aefa | 1202 | |
00f56532 | 1203 | Int_t nent = 0; |
d226f81b | 1204 | if (GetMUONData()->TreeR()) { |
1205 | nent=(Int_t) GetMUONData()->TreeR()->GetEntries(); | |
1206 | GetMUONData()->TreeR()->GetEvent(0); | |
00f56532 | 1207 | } |
1208 | ||
a9e2aefa | 1209 | Int_t nrawcl = muonRawClusters->GetEntriesFast(); |
1210 | if (nrawcl == 0) return; | |
d226f81b | 1211 | if (fRpoints == 0) fRpoints = new TObjArray(nrawcl); |
a9e2aefa | 1212 | |
b7ef3c96 | 1213 | Float_t zpos = AliMUONConstants::DefaultChamberZ(chamber-1); |
a9e2aefa | 1214 | AliMUONRawCluster *mRaw; |
1215 | AliMUONPoints *points = 0; | |
1216 | // | |
1217 | //loop over all raw clusters and store their position | |
1218 | points = new AliMUONPoints(nrawcl); | |
1219 | for (Int_t iraw=0;iraw<nrawcl;iraw++) { | |
1220 | mRaw = (AliMUONRawCluster*)muonRawClusters->UncheckedAt(iraw); | |
a9e2aefa | 1221 | points->SetMarkerColor(51); |
1222 | points->SetMarkerStyle(2); | |
1223 | points->SetMarkerSize(1.); | |
1224 | points->SetParticle(-1); | |
1225 | points->SetHitIndex(-1); | |
1226 | points->SetTrackIndex(-1); | |
1227 | points->SetDigitIndex(-1); | |
ba12c242 | 1228 | points->SetPoint(iraw,mRaw->GetX(0),mRaw->GetY(0),zpos); |
d226f81b | 1229 | fRpoints->AddAt(points,iraw); |
ba12c242 | 1230 | // printf("%f and %f and %f\n",mRaw->GetX(0),mRaw->GetY(0),mRaw->GetZ(0)); |
a9e2aefa | 1231 | } |
1232 | } | |
572d5bb2 | 1233 | |
1234 | //___________________________________________ | |
1235 | void AliMUONDisplay::LoadTracks() | |
1236 | { | |
1237 | // Load tracks | |
1238 | AliMUONTrack* recTrack = 0; | |
1239 | AliMUONTrackParam* trackParam = 0; | |
1240 | TClonesArray * trackParamAtHit = 0; | |
1241 | ||
1242 | ResetRpoints(); | |
1243 | ||
1244 | GetMUONData()->SetTreeAddress("RT"); | |
1245 | TClonesArray* recTracksArray = GetMUONData()->RecTracks(); | |
1246 | if (recTracksArray == NULL) return; | |
1247 | GetMUONData()->GetRecTracks(); | |
1248 | ||
1249 | Int_t nRecTracks = 0; | |
1250 | if (recTracksArray) | |
1251 | nRecTracks = (Int_t) recTracksArray->GetEntriesFast(); | |
1252 | ||
1253 | ||
1254 | if (fRpoints == 0) fRpoints = new TObjArray(nRecTracks); | |
1255 | ||
1256 | for (Int_t iRecTracks = 0; iRecTracks < nRecTracks; iRecTracks++) { | |
1257 | // reading info from tracks | |
1258 | recTrack = (AliMUONTrack*) recTracksArray->At(iRecTracks); | |
1259 | ||
1260 | Int_t nTrackHits = recTrack->GetNTrackHits(); | |
1261 | ||
1262 | if (nTrackHits == 0) continue; | |
1263 | ||
1264 | Int_t iPoint = 0; | |
1265 | TPolyLine3D *points = new TPolyLine3D(nTrackHits+1); | |
1266 | points->SetLineColor(6); | |
1267 | points->SetLineWidth(1); | |
1268 | fRpoints->AddAt(points,iRecTracks); | |
1269 | ||
1270 | Float_t xRec=0; | |
1271 | Float_t yRec=0; | |
1272 | Float_t zRec=0; | |
1273 | ||
1274 | trackParam = recTrack->GetTrackParamAtVertex(); | |
1275 | xRec = trackParam->GetNonBendingCoor(); | |
1276 | yRec = trackParam->GetBendingCoor(); | |
1277 | zRec = trackParam->GetZ(); | |
1278 | points->SetPoint(iPoint,xRec,yRec,zRec); | |
1279 | iPoint++; | |
1280 | ||
1281 | for (Int_t iHit = 0; iHit < nTrackHits; iHit++){ | |
1282 | trackParamAtHit = recTrack->GetTrackParamAtHit(); | |
1283 | trackParam = (AliMUONTrackParam*) trackParamAtHit->At(iHit); | |
1284 | xRec = trackParam->GetNonBendingCoor(); | |
1285 | yRec = trackParam->GetBendingCoor(); | |
1286 | zRec = trackParam->GetZ(); | |
1287 | points->SetPoint(iPoint,xRec,yRec,zRec); | |
1288 | iPoint++; | |
1289 | } // end loop rec. hits | |
1290 | PrintTrack(iRecTracks,recTrack); | |
1291 | } // end loop tracks | |
1292 | ||
1293 | ||
1294 | } | |
1295 | ||
1296 | void AliMUONDisplay::PrintTrack(Int_t iRecTracks, AliMUONTrack *recTrack) | |
1297 | { | |
1298 | AliMUONTrackParam *trackParam; | |
1299 | Float_t vertex[3], momentum[3]; | |
1300 | Float_t pYZ, bendingSlope, nonBendingSlope, chi2dof; | |
1301 | Int_t charge; | |
1302 | ||
1303 | trackParam = recTrack->GetTrackParamAtVertex(); | |
1304 | vertex[0] = trackParam->GetNonBendingCoor(); | |
1305 | vertex[1] = trackParam->GetBendingCoor(); | |
1306 | vertex[2] = trackParam->GetZ(); | |
1307 | pYZ = 1./TMath::Abs(trackParam->GetInverseBendingMomentum()); | |
1308 | bendingSlope = trackParam->GetBendingSlope(); | |
1309 | nonBendingSlope = trackParam->GetNonBendingSlope(); | |
1310 | momentum[2] = -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope); | |
1311 | momentum[0] = momentum[2] * nonBendingSlope; | |
1312 | momentum[1] = momentum[2] * bendingSlope; | |
1313 | charge = Int_t(TMath::Sign(1.,trackParam->GetInverseBendingMomentum())); | |
1314 | chi2dof = recTrack->GetFitFMin()/(2.0 * recTrack->GetNTrackHits() - 5.); | |
1315 | ||
1316 | printf("===================================================\n"); | |
1317 | printf(" Reconstructed track # %d \n",iRecTracks); | |
1318 | printf(" charge: %d \n",charge); | |
1319 | printf(" vertex x,y,z (cm): %f %f %f \n",vertex[0],vertex[1],vertex[2]); | |
1320 | printf(" momentum Px,Py,Pz (GeV/c): %f %f %f \n",momentum[0],momentum[1],momentum[2]); | |
1321 | printf(" track chi2/dof: %f \n",chi2dof); | |
1322 | ||
1323 | } | |
1324 | ||
a9e2aefa | 1325 | //___________________________________________ |
a9e2aefa | 1326 | void AliMUONDisplay::LoadHits(Int_t chamber) |
1327 | { | |
307d9d04 | 1328 | // Read hits info and store x,y,z info in arrays fPhits |
1329 | // Loop on all detectors | |
a9e2aefa | 1330 | |
1331 | if (chamber > 14) return; | |
1332 | Int_t track; | |
1333 | ||
1334 | fChamber=chamber; | |
1335 | ||
1336 | ResetPhits(); | |
1337 | ||
b7ef3c96 | 1338 | Float_t zpos=AliMUONConstants::DefaultChamberZ(chamber-1); |
c856e086 | 1339 | |
1340 | if (GetMUONData()->TreeH()) { | |
1341 | GetMUONData()->SetTreeAddress("H"); | |
1342 | Int_t ntracks = (Int_t)GetMUONData()->TreeH()->GetEntries(); //skowron | |
1343 | Int_t nthits = 0; | |
1344 | for (track = 0; track < ntracks; track++) { | |
d226f81b | 1345 | GetMUONData()->ResetHits(); |
1346 | GetMUONData()->GetTrack(track);//skowron | |
1347 | TClonesArray *muonHits = GetMUONData()->Hits(); | |
a9e2aefa | 1348 | if (muonHits == 0) return; |
1349 | nthits += muonHits->GetEntriesFast(); | |
c856e086 | 1350 | } |
1351 | if (fPhits == 0) fPhits = new TObjArray(nthits); | |
1352 | Int_t nhold=0; | |
1353 | for (track=0; track<ntracks;track++) { | |
d226f81b | 1354 | GetMUONData()->ResetHits(); |
1355 | GetMUONData()->GetTrack(track);//skowron | |
1356 | TClonesArray *muonHits = GetMUONData()->Hits(); | |
a9e2aefa | 1357 | if (muonHits == 0) return; |
1358 | Int_t nhits = muonHits->GetEntriesFast(); | |
1359 | if (nhits == 0) continue; | |
1360 | AliMUONHit *mHit; | |
1361 | AliMUONPoints *points = 0; | |
1362 | Int_t npoints=1; | |
1363 | for (Int_t hit=0;hit<nhits;hit++) { | |
c856e086 | 1364 | mHit = (AliMUONHit*)muonHits->UncheckedAt(hit); |
1365 | Int_t nch = mHit->Chamber(); // chamber number | |
1366 | if (nch != chamber) continue; | |
1367 | // | |
1368 | // Retrieve info and set the objects | |
1369 | // | |
1370 | points = new AliMUONPoints(npoints); | |
1371 | fPhits->AddAt(points,nhold+hit); | |
1372 | points->SetMarkerColor(kRed); | |
1373 | points->SetMarkerStyle(5); | |
1374 | points->SetMarkerSize(1.); | |
1375 | points->SetParticle(mHit->Track()); | |
1376 | points->SetHitIndex(hit); | |
1377 | points->SetTrackIndex(track); | |
1378 | points->SetDigitIndex(-1); | |
1379 | points->SetPoint(0,mHit->X(),mHit->Y(),zpos); | |
1380 | // printf("%f and %f and %f\n",mHit->X(),mHit->Y(),mHit->Z()); | |
a9e2aefa | 1381 | } |
1382 | nhold+=nhits; | |
c856e086 | 1383 | } |
a9e2aefa | 1384 | } |
1385 | } | |
1386 | ||
1387 | //_____________________________________________________________________________ | |
1388 | void AliMUONDisplay::Paint(Option_t *) | |
1389 | { | |
1390 | // Paint miscellaneous items | |
1391 | } | |
1392 | ||
1393 | //_____________________________________________________________________________ | |
1394 | void AliMUONDisplay::SetPickMode() | |
1395 | { | |
1396 | // Set parameters for pick mode. | |
1397 | // | |
1398 | fZoomMode = 0; | |
1399 | ||
1400 | fArcButton->SetY1(fPickButton->GetYlowNDC()+0.5*fPickButton->GetHNDC()); | |
1401 | fTrigPad->Modified(); | |
1402 | } | |
1403 | ||
1404 | //_____________________________________________________________________________ | |
1405 | void AliMUONDisplay::SetZoomMode() | |
1406 | { | |
1407 | // Set parameters for zoom mode | |
1408 | fZoomMode = 1; | |
1409 | ||
1410 | fArcButton->SetY1(fZoomButton->GetYlowNDC()+0.5*fZoomButton->GetHNDC()); | |
1411 | fTrigPad->Modified(); | |
1412 | } | |
1413 | ||
1414 | //_____________________________________________________________________________ | |
1415 | void AliMUONDisplay::NextChamber(Int_t delta) | |
1416 | { | |
1417 | // to go from chamber to next chamber if delta = 1 | |
1418 | // or previous chamber otherwise | |
1419 | if (delta == 1) { | |
f665c1ea | 1420 | if (fChamber < AliMUONConstants::NCh()) fChamber++; |
a9e2aefa | 1421 | } else { |
1422 | if (fChamber > 1) fChamber--; | |
1423 | } | |
1424 | if (!fPad) return; | |
1425 | fPad->Clear(); | |
1426 | LoadDigits(fChamber, fCathode); | |
572d5bb2 | 1427 | DrawChamber(); |
a9e2aefa | 1428 | } |
1429 | ||
1430 | //_____________________________________________________________________________ | |
1431 | void AliMUONDisplay::NextCathode() | |
1432 | { | |
1433 | // to switch to other cathode plane | |
1434 | if (!fPad) return; | |
1435 | fPad->Clear(); | |
1436 | if (fCathode == 1) { | |
1437 | LoadDigits(fChamber, 2); | |
1438 | } else { | |
1439 | LoadDigits(fChamber, 1); | |
1440 | } | |
1441 | fNextCathode = kTRUE; // to keep the same zoom | |
572d5bb2 | 1442 | DrawChamber(); |
a9e2aefa | 1443 | fNextCathode = kFALSE; |
1444 | TPad *pad = (TPad*)gPad->GetPadSave(); | |
1445 | pad->Range(fZoomX0[fZooms], fZoomY0[fZooms], | |
1446 | fZoomX1[fZooms], fZoomY1[fZooms]); | |
1447 | pad->Modified(); | |
1448 | fPad->cd(); | |
1449 | DrawTitle(); | |
1450 | } | |
1451 | ||
1452 | //_____________________________________________________________________________ | |
1453 | void AliMUONDisplay::Trigger() | |
1454 | { | |
52c9bc11 | 1455 | |
d226f81b | 1456 | AliMUONGlobalTrigger* globalTrig; |
1457 | ||
1458 | GetMUONData()->SetTreeAddress("GLT"); | |
95e68a13 | 1459 | GetMUONData()->GetTriggerD(); |
d226f81b | 1460 | |
1461 | globalTrig = (AliMUONGlobalTrigger*)GetMUONData()->GlobalTrigger()->UncheckedAt(0); | |
1462 | if (globalTrig == 0) return; | |
1463 | ||
1464 | printf("===================================================\n"); | |
1465 | printf(" Global Trigger output Low pt High pt All\n"); | |
1466 | ||
1467 | printf(" number of Single Plus :\t"); | |
1468 | printf("%i\t",globalTrig->SinglePlusLpt()); | |
1469 | printf("%i\t",globalTrig->SinglePlusHpt()); | |
1470 | printf("%i\t",globalTrig->SinglePlusApt()); | |
1471 | printf("\n"); | |
1472 | ||
1473 | printf(" number of Single Minus :\t"); | |
1474 | printf("%i\t",globalTrig->SingleMinusLpt()); | |
1475 | printf("%i\t",globalTrig->SingleMinusHpt()); | |
1476 | printf("%i\t",globalTrig->SingleMinusApt()); | |
1477 | printf("\n"); | |
1478 | ||
1479 | printf(" number of Single Undefined :\t"); | |
1480 | printf("%i\t",globalTrig->SingleUndefLpt()); | |
1481 | printf("%i\t",globalTrig->SingleUndefHpt()); | |
1482 | printf("%i\t",globalTrig->SingleUndefApt()); | |
1483 | printf("\n"); | |
1484 | ||
1485 | printf(" number of UnlikeSign pair :\t"); | |
1486 | printf("%i\t",globalTrig->PairUnlikeLpt()); | |
1487 | printf("%i\t",globalTrig->PairUnlikeHpt()); | |
1488 | printf("%i\t",globalTrig->PairUnlikeApt()); | |
1489 | printf("\n"); | |
1490 | ||
1491 | printf(" number of LikeSign pair :\t"); | |
1492 | printf("%i\t",globalTrig->PairLikeLpt()); | |
1493 | printf("%i\t",globalTrig->PairLikeHpt()); | |
1494 | printf("%i\t",globalTrig->PairLikeApt()); | |
1495 | printf("\n"); | |
1496 | printf("===================================================\n"); | |
1497 | printf("\n"); | |
1498 | ||
1499 | ||
1500 | // // returns Trigger Decision for current event | |
1501 | // AliMUONTriggerDecision* decision= new AliMUONTriggerDecision(GetLoader(),1); | |
1502 | ||
1503 | // // AliMUONTriggerDecision* decision= new AliMUONTriggerDecision(1); | |
1504 | // AliMUONData* muonData = decision->GetMUONData(); | |
1505 | // muonData->SetTreeAddress("D"); | |
1506 | // decision->Trigger(); | |
a9e2aefa | 1507 | } |
a9e2aefa | 1508 | //_____________________________________________________________________________ |
1509 | void AliMUONDisplay::SetChamberAndCathode(Int_t chamber, Int_t cathode) | |
1510 | { | |
1511 | // Set chamber and cathode number | |
1512 | fChamber = chamber; | |
1513 | fCathode = cathode; | |
1514 | ||
1515 | if (!fPad) return; | |
1516 | fPad->Clear(); | |
1517 | LoadDigits(chamber,cathode); | |
572d5bb2 | 1518 | DrawChamber(); |
a9e2aefa | 1519 | } |
1520 | ||
1521 | void AliMUONDisplay::SetEvent(Int_t newevent) | |
1522 | { | |
1523 | // Chose event | |
1524 | gAlice->GetEvent(newevent); | |
1525 | fEvent=newevent; | |
1526 | if (!gAlice->TreeD()) return; | |
1527 | if (!fPad) return; | |
1528 | fPad->Clear(); | |
1529 | LoadDigits(fChamber,fCathode); | |
1530 | Draw(); | |
1531 | } | |
1532 | ||
1533 | //_____________________________________________________________________________ | |
1534 | void AliMUONDisplay::SetRange(Float_t rrange, Float_t zrange) | |
1535 | { | |
1536 | // Set view range along R and Z | |
1537 | fRrange = rrange; | |
1538 | fZrange = zrange; | |
1539 | ||
1540 | if (!fPad) return; | |
1541 | fPad->Clear(); | |
1542 | Draw(); | |
1543 | } | |
1544 | ||
1545 | //_____________________________________________________________________________ | |
1546 | void AliMUONDisplay::SetView(Float_t theta, Float_t phi, Float_t psi) | |
1547 | { | |
1548 | // change viewing angles for current event | |
1549 | ||
1550 | fPad->cd(); | |
1551 | fPhi = phi; | |
1552 | fTheta = theta; | |
1553 | fPsi = psi; | |
1554 | Int_t iret = 0; | |
1555 | ||
1556 | TView *view = gPad->GetView(); | |
1557 | if (view) view->SetView(fPhi, fTheta, fPsi, iret); | |
1558 | else Draw(); | |
1559 | gPad->Modified(); | |
1560 | } | |
1561 | ||
1562 | //_____________________________________________________________________________ | |
1563 | void AliMUONDisplay::ShowNextEvent(Int_t delta) | |
1564 | { | |
30178c30 | 1565 | AliRunLoader * runLoader; |
307d9d04 | 1566 | if (fLoader) |
30178c30 | 1567 | runLoader = fLoader->GetRunLoader(); |
307d9d04 | 1568 | else |
30178c30 | 1569 | runLoader = 0x0; |
1391e633 | 1570 | |
a9e2aefa | 1571 | // Display (current event_number + delta) |
1572 | // delta = 1 shown next event | |
1573 | // delta = -1 show previous event | |
1574 | if (delta) { | |
30178c30 | 1575 | //runLoader->CleanDetectors(); |
1576 | //runLoader->CleanKinematics(); | |
1577 | Int_t currentEvent = runLoader->GetEventNumber(); | |
1391e633 | 1578 | Int_t newEvent = currentEvent + delta; |
30178c30 | 1579 | runLoader->GetEvent(newEvent); |
1391e633 | 1580 | fEvent=newEvent; |
a9e2aefa | 1581 | } |
a9e2aefa | 1582 | LoadDigits(fChamber, fCathode); |
1583 | fPad->cd(); | |
1584 | Draw(); | |
1585 | } | |
1586 | ||
1587 | //______________________________________________________________________________ | |
1588 | void AliMUONDisplay::UnZoom() | |
1589 | { | |
1590 | // Unzoom | |
1591 | if (fZooms <= 0) return; | |
1592 | fZooms--; | |
1593 | TPad *pad = (TPad*)gPad->GetPadSave(); | |
1594 | pad->Range(fZoomX0[fZooms],fZoomY0[fZooms], fZoomX1[fZooms],fZoomY1[fZooms]); | |
1595 | pad->Modified(); | |
1596 | } | |
1597 | ||
1598 | //_____________________________________________________________________________ | |
1599 | void AliMUONDisplay::ResetPoints() | |
1600 | { | |
1601 | // | |
1602 | // Reset array of points | |
1603 | // | |
1604 | if (fPoints) { | |
1605 | fPoints->Delete(); | |
1606 | delete fPoints; | |
1607 | fPoints = 0; | |
1608 | } | |
1609 | } | |
1610 | //_____________________________________________________________________________ | |
1611 | void AliMUONDisplay::ResetPhits() | |
1612 | { | |
1613 | // | |
1614 | // Reset array of points | |
1615 | // | |
1616 | if (fPhits) { | |
1617 | fPhits->Delete(); | |
1618 | delete fPhits; | |
1619 | fPhits = 0; | |
1620 | } | |
1621 | } | |
1622 | //_____________________________________________________________________________ | |
1623 | void AliMUONDisplay::ResetRpoints() | |
1624 | { | |
1625 | // | |
1626 | // Reset array of points | |
1627 | // | |
d226f81b | 1628 | if (fRpoints) { |
1629 | fRpoints->Clear(); | |
1630 | // delete fRpoints; | |
1631 | fRpoints = 0; | |
a9e2aefa | 1632 | } |
1633 | } | |
a9e2aefa | 1634 | |
30178c30 | 1635 | AliMUONDisplay & AliMUONDisplay::operator = (const AliMUONDisplay & rhs) |
a9e2aefa | 1636 | { |
30178c30 | 1637 | // Protected assignement operator |
1638 | ||
1639 | if (this == &rhs) return *this; | |
1640 | ||
8c343c7c | 1641 | AliFatal("Not implemented."); |
30178c30 | 1642 | |
1643 | return *this; | |
a9e2aefa | 1644 | } |
1645 | ||
1646 | ||
1647 | ||
1648 | ||
1649 | ||
1650 | ||
1651 | ||
1652 | ||
1653 |