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