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