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