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