Line data Source code
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 : // $Id$
17 :
18 : //-----------------------------------------------------------------------------
19 : /// \class AliMUONTriggerGUIbdmap
20 : ///
21 : /// The gui map of a single board object, strips/digits
22 : ///
23 : /// \author Bogdan Vulpescu, LPC Clermont-Ferrand
24 : //-----------------------------------------------------------------------------
25 :
26 : #include <TPolyLine.h>
27 : #include <TStyle.h>
28 : #include <TGButton.h>
29 : #include <TRootEmbeddedCanvas.h>
30 : #include <TBox.h>
31 : #include <TPaveText.h>
32 : #include <TGTextEdit.h>
33 : #include <TGText.h>
34 : #include <TTimer.h>
35 : #include <TObjArray.h>
36 : #include <TCanvas.h>
37 :
38 : #include "AliLoader.h"
39 : #include "AliRunLoader.h"
40 : #include "AliMUONVDigit.h"
41 : #include "AliMUONGeometryTransformer.h"
42 : #include "AliMUONLocalTrigger.h"
43 : #include "AliMUONLocalTriggerBoard.h"
44 : #include "AliMUONTriggerCrateStore.h"
45 : #include "AliMUONMCDataInterface.h"
46 : #include "AliMUONTriggerStoreV1.h"
47 : #include "AliMUONDigitStoreV1.h"
48 : #include "AliMUONTriggerGUIboard.h"
49 : #include "AliMUONTriggerGUIbdmap.h"
50 :
51 : #include "AliMpDEManager.h"
52 : #include "AliMpDEIterator.h"
53 : #include "AliMpEncodePair.h"
54 : #include "AliMpVSegmentation.h"
55 : #include "AliMpSegmentation.h"
56 :
57 : #include <cstdio>
58 :
59 :
60 : /// \cond CLASSIMP
61 16 : ClassImp(AliMUONTriggerGUIbdmap)
62 : /// \endcond
63 :
64 : //__________________________________________________________________________
65 : AliMUONTriggerGUIbdmap::AliMUONTriggerGUIbdmap(const TGWindow *p, const TGWindow *mainWindow, UInt_t w, UInt_t h)
66 0 : : TGFrame(0),
67 0 : fMain(0),
68 0 : fLocTrigE(0),
69 0 : fBoard(0),
70 0 : fLoader(0),
71 0 : fMCDataInterface(0),
72 0 : fRawDigitStore(0),
73 0 : fRawTriggerStore(0),
74 0 : fXStrips(0),
75 0 : fYStrips(0),
76 0 : fEditStrips(0),
77 0 : fXOn(0),
78 0 : fYOn(0),
79 0 : fLabelX(0),
80 0 : fLabelY(0),
81 0 : fIsEditable(0),
82 0 : fCanvasSize(0),
83 0 : fNStripX(0),
84 0 : fNStripY(0),
85 0 : fBoards(0),
86 0 : fCalibrationData(0x0),
87 0 : fCrateManager(0)
88 0 : {
89 : /// frame constructor
90 :
91 0 : gStyle->SetPadLeftMargin(0.05);
92 0 : gStyle->SetPadRightMargin(0.05);
93 0 : gStyle->SetPadTopMargin(0.05);
94 0 : gStyle->SetPadBottomMargin(0.05);
95 :
96 0 : fMain = new TGTransientFrame(p, mainWindow, w, h, kVerticalFrame);
97 0 : fMain->Connect("CloseWindow()", "AliMUONTriggerGUIbdmap", this, "CloseWindow()");
98 0 : fMain->DontCallClose(); // to avoid double deletions.
99 :
100 : // use hierarchical cleaning
101 0 : fMain->SetCleanup(kDeepCleanup);
102 :
103 0 : fMain->ChangeOptions((fMain->GetOptions() & ~kVerticalFrame) | kHorizontalFrame);
104 :
105 : // strips/digits canvases
106 :
107 0 : fCanvasSize = 200;
108 :
109 0 : TRootEmbeddedCanvas *recanvas[4];
110 0 : Char_t ecname[2];
111 0 : for (Int_t i = 0; i < kNMT; i++) {
112 :
113 0 : snprintf(ecname,2,"%1d",i+1);
114 0 : recanvas[i] = new TRootEmbeddedCanvas(ecname,fMain,fCanvasSize,fCanvasSize);
115 :
116 0 : fCanvas[i] = recanvas[i]->GetCanvas();
117 :
118 0 : fCanvas[i]->SetBorderMode(0);
119 0 : fCanvas[i]->SetBit(kNoContextMenu);
120 :
121 0 : fCanvas[i]->Connect("ProcessedEvent(Int_t,Int_t,Int_t,TObject*)",
122 : "AliMUONTriggerGUIbdmap",this,
123 : "EditStrips(Int_t,Int_t,Int_t,TObject*)");
124 :
125 0 : fMain->AddFrame(recanvas[i],
126 : /*
127 : new TGTableLayoutHints(2,5,2,6,
128 : kLHintsExpandX|kLHintsExpandY |
129 : kLHintsShrinkX|kLHintsShrinkY |
130 : kLHintsFillX|kLHintsFillY)
131 : */
132 0 : new TGLayoutHints(kLHintsTop |
133 : kLHintsLeft,
134 : 2, 2, 2, 2)
135 : );
136 :
137 : }
138 :
139 : //TGDimension size = fMain->GetDefaultSize();
140 : //fMain->Resize(size);
141 :
142 : // the other frames
143 :
144 0 : TGCompositeFrame *cf0 = new TGCompositeFrame(fMain, 60, 20, kVerticalFrame);
145 :
146 0 : TGCompositeFrame *cf1 = new TGCompositeFrame(cf0, 60, 20, kVerticalFrame | kFixedWidth);
147 :
148 0 : cf1->AddFrame(fXStrips = new TGCheckButton(cf1, "Draw X strips and digits", 1),
149 0 : new TGLayoutHints(kLHintsTop |
150 : kLHintsLeft,
151 : 2, 2, 2, 2)
152 : );
153 :
154 0 : cf1->Resize(fXStrips->GetDefaultWidth()+10, fMain->GetDefaultHeight());
155 :
156 0 : cf1->AddFrame(fYStrips = new TGCheckButton(cf1, "Draw Y strips and digits", 2),
157 0 : new TGLayoutHints(kLHintsTop |
158 : kLHintsLeft,
159 : 2, 2, 2, 2)
160 : );
161 :
162 0 : cf1->Resize(fYStrips->GetDefaultWidth()+10, fMain->GetDefaultHeight());
163 :
164 0 : cf1->AddFrame(fEditStrips = new TGCheckButton(cf1, "Set/unset strips", 3),
165 0 : new TGLayoutHints(kLHintsTop |
166 : kLHintsLeft,
167 : 2, 2, 2, 2)
168 : );
169 :
170 0 : fXStrips->Connect("Clicked()", "AliMUONTriggerGUIbdmap", this, "HandleButtons()");
171 0 : fYStrips->Connect("Clicked()", "AliMUONTriggerGUIbdmap", this, "HandleButtons()");
172 0 : fEditStrips->Connect("Clicked()", "AliMUONTriggerGUIbdmap", this, "HandleEditButton()");
173 :
174 0 : cf0->AddFrame(cf1,
175 0 : new TGLayoutHints(kLHintsTop |
176 : kLHintsExpandX,
177 : 2, 2, 2, 2)
178 : );
179 :
180 0 : TGCompositeFrame *cf2 = new TGCompositeFrame(cf0, 60, 20, kHorizontalFrame | kFixedWidth);
181 :
182 0 : TGTextButton *digitsButton = new TGTextButton(cf2, "Digits", 4);
183 0 : digitsButton->Connect("Clicked()", "AliMUONTriggerGUIbdmap", this, "DoDigits()");
184 :
185 : //cf2->Resize(digitsButton->GetDefaultWidth()+40, fMain->GetDefaultHeight());
186 :
187 0 : cf2->AddFrame(digitsButton,
188 0 : new TGLayoutHints(kLHintsTop |
189 : kLHintsLeft |
190 : kLHintsExpandX,
191 : 2, 2, 5, 5)
192 : );
193 :
194 0 : TGTextButton *dresetButton = new TGTextButton(cf2, "Reset", 5);
195 0 : dresetButton->Connect("Clicked()", "AliMUONTriggerGUIbdmap", this, "ResetDigits()");
196 :
197 : //cf2->Resize(dresetButton->GetDefaultWidth()+40, fMain->GetDefaultHeight());
198 :
199 0 : cf2->AddFrame(dresetButton,
200 0 : new TGLayoutHints(kLHintsTop |
201 : kLHintsLeft |
202 : kLHintsExpandX,
203 : 2, 2, 5, 5)
204 : );
205 :
206 0 : TGTextButton *closeButton = new TGTextButton(cf2, "Close", 6);
207 0 : closeButton->Connect("Clicked()", "AliMUONTriggerGUIbdmap", this, "DoClose()");
208 :
209 : //cf2->Resize(closeButton->GetDefaultWidth()+40, fMain->GetDefaultHeight());
210 :
211 0 : cf2->AddFrame(closeButton,
212 0 : new TGLayoutHints(kLHintsTop |
213 : kLHintsLeft |
214 : kLHintsExpandX,
215 : 2, 2, 5, 5)
216 : );
217 :
218 0 : cf0->AddFrame(cf2,
219 0 : new TGLayoutHints(kLHintsTop |
220 : kLHintsExpandX,
221 : 2, 2, 2, 2)
222 : );
223 :
224 : // editor window for the local trigger
225 :
226 0 : TGCompositeFrame *cf3 = new TGCompositeFrame(cf0, 60, 20, kVerticalFrame | kFixedWidth);
227 :
228 0 : fLocTrigE = new TGTextEdit(cf3, 100, 100, kSunkenFrame | kDoubleBorder);
229 0 : cf3->AddFrame(fLocTrigE,
230 0 : new TGLayoutHints(kLHintsExpandX |
231 : kLHintsExpandY,
232 : 3, 3, 3, 3)
233 : );
234 :
235 0 : cf0->AddFrame(cf3,
236 0 : new TGLayoutHints(kLHintsTop |
237 : kLHintsExpandX,
238 : 2, 2, 2, 2)
239 : );
240 :
241 0 : fMain->AddFrame(cf0,
242 0 : new TGLayoutHints(kLHintsTop |
243 : kLHintsExpandX,
244 : 2, 2, 2, 2)
245 : );
246 :
247 0 : fIsEditable = kFALSE;
248 0 : fLabelX = kFALSE;
249 0 : fLabelY = kFALSE;
250 :
251 0 : fMain->MapSubwindows();
252 0 : fMain->Resize();
253 :
254 0 : fMain->CenterOnParent();
255 :
256 : //fMain->MapWindow();
257 : //gClient->WaitFor(fMain);
258 :
259 0 : }
260 :
261 : //__________________________________________________________________________
262 0 : AliMUONTriggerGUIbdmap::~AliMUONTriggerGUIbdmap()
263 0 : {
264 : /// frame destructor
265 :
266 0 : fMain->DeleteWindow();
267 :
268 0 : }
269 :
270 : //__________________________________________________________________________
271 : void AliMUONTriggerGUIbdmap::Show()
272 : {
273 : /// map the main frame
274 :
275 0 : fMain->MapWindow();
276 0 : LocalTriggerInfo();
277 :
278 0 : }
279 :
280 : //__________________________________________________________________________
281 : void AliMUONTriggerGUIbdmap::LocalTriggerInfo()
282 : {
283 : /// print the local trigger
284 :
285 0 : TGText txt;
286 0 : Char_t buffer[20];
287 :
288 0 : snprintf(buffer,20,"Local trigger info\n");
289 0 : fLocTrigE->LoadBuffer(buffer);
290 :
291 : AliMUONVTriggerStore *triggerStore;
292 :
293 0 : if (fLoader != 0x0) {
294 0 : AliRunLoader *runLoader = fLoader->GetRunLoader();
295 0 : triggerStore = fMCDataInterface->TriggerStore(runLoader->GetEventNumber());
296 0 : } else if (fRawTriggerStore != 0x0) {
297 0 : triggerStore = static_cast<AliMUONVTriggerStore*>(fRawTriggerStore);
298 : } else {
299 0 : snprintf(buffer,20,"No data loaded yet...\n");
300 0 : txt.LoadBuffer(buffer);
301 0 : fLocTrigE->AddText(&txt);
302 0 : return;
303 : }
304 :
305 0 : Int_t circuitNumber = fBoard->GetIdCircuit();
306 :
307 : UShort_t x2m, x2u, x2d;
308 :
309 : Int_t loStripX, loStripY, loDev, loCircuit, iStripX, iStripY, loLpt, loHpt;
310 : AliMUONLocalTrigger *mlt;
311 :
312 0 : TIter next(triggerStore->CreateLocalIterator());
313 :
314 0 : while ( ( mlt = static_cast<AliMUONLocalTrigger*>(next()) ) )
315 : {
316 0 : loCircuit = mlt->LoCircuit();
317 :
318 0 : if (loCircuit == circuitNumber) {
319 :
320 0 : AliMUONLocalTriggerBoard* ltb = fCrateManager->LocalBoard(loCircuit);
321 0 : x2d = ltb->GetSwitch(0);
322 0 : x2m = ltb->GetSwitch(1);
323 0 : x2u = ltb->GetSwitch(2);
324 :
325 0 : loStripX = mlt->LoStripX();
326 0 : loStripY = mlt->LoStripY();
327 0 : loDev = mlt->LoDev();
328 0 : loLpt = mlt->LoLpt();
329 0 : loHpt = mlt->LoHpt();
330 :
331 0 : iStripX = loStripX/2;
332 0 : if ((x2u == 1 || x2m == 1 || x2d == 1) && x2m == 1) {
333 0 : iStripY = loStripY/2;
334 0 : } else {
335 : iStripY = loStripY;
336 : }
337 :
338 0 : snprintf(buffer,20,"Circuit = %03d",loCircuit);
339 0 : txt.LoadBuffer(buffer);
340 0 : fLocTrigE->AddText(&txt);
341 :
342 0 : snprintf(buffer,20,"LoStripX = %2d",loStripX);
343 0 : txt.LoadBuffer(buffer);
344 0 : fLocTrigE->AddText(&txt);
345 :
346 0 : snprintf(buffer,20,"LoStripY = %2d",loStripY);
347 0 : txt.LoadBuffer(buffer);
348 0 : fLocTrigE->AddText(&txt);
349 :
350 0 : snprintf(buffer,20,"LoDev = %2d",loDev);
351 0 : txt.LoadBuffer(buffer);
352 0 : fLocTrigE->AddText(&txt);
353 :
354 0 : snprintf(buffer,20,"--------------------");
355 0 : txt.LoadBuffer(buffer);
356 0 : fLocTrigE->AddText(&txt);
357 :
358 0 : snprintf(buffer,20,"X-strip = %2d ( %2d )",iStripX,(loStripX+loDev+1)/2);
359 0 : txt.LoadBuffer(buffer);
360 0 : fLocTrigE->AddText(&txt);
361 :
362 0 : snprintf(buffer,20,"Y-strip = %2d",iStripY);
363 0 : txt.LoadBuffer(buffer);
364 0 : fLocTrigE->AddText(&txt);
365 :
366 0 : snprintf(buffer,20,"--------------------");
367 0 : txt.LoadBuffer(buffer);
368 0 : fLocTrigE->AddText(&txt);
369 :
370 0 : snprintf(buffer,20,"LoLpt = %2d",loLpt);
371 0 : txt.LoadBuffer(buffer);
372 0 : fLocTrigE->AddText(&txt);
373 :
374 0 : snprintf(buffer,20,"LoHpt = %2d",loHpt);
375 0 : txt.LoadBuffer(buffer);
376 0 : fLocTrigE->AddText(&txt);
377 :
378 : break;
379 :
380 : }
381 :
382 : }
383 :
384 0 : }
385 :
386 : //__________________________________________________________________________
387 : void AliMUONTriggerGUIbdmap::Init()
388 : {
389 : /// initialize the boards in the four MT
390 :
391 0 : for (Int_t i = 0; i < kNMT; i++) {
392 :
393 0 : fXWidth[i] = fBoard->GetXWidth(i);
394 0 : fYWidth[i] = fBoard->GetYWidth(i);
395 0 : fXCenter[i] = fBoard->GetXCenter(i);
396 0 : fYCenter[i] = fBoard->GetYCenter(i);
397 :
398 : }
399 :
400 : Float_t xw, yw;
401 0 : for (Int_t i = 0; i < kNMT; i++) {
402 0 : xw = 1.20*fXWidth[i];
403 0 : yw = 1.20*fYWidth[i];
404 0 : fCanvas[i]->Range(-xw/2,-yw/2,+xw/2,+yw/2);
405 0 : for (Int_t is = 0; is < kNS; is++) {
406 :
407 0 : fXDigPL[i][is] = new TPolyLine(5);
408 0 : fYDigPL[i][is] = new TPolyLine(5);
409 0 : fXDigPL[i][is]->SetBit(kCannotPick);
410 0 : fYDigPL[i][is]->SetBit(kCannotPick);
411 0 : fXDigPL[i][is]->SetLineColor(4);
412 0 : fYDigPL[i][is]->SetLineColor(4);
413 :
414 0 : fXDigBox[i][is] = new TBox(0,0,0,0);
415 0 : fYDigBox[i][is] = new TBox(0,0,0,0);
416 0 : fXDigBox[i][is]->SetBit(kCannotPick);
417 0 : fYDigBox[i][is]->SetBit(kCannotPick);
418 0 : fXDigBox[i][is]->SetFillStyle(0);
419 0 : fYDigBox[i][is]->SetFillStyle(0);
420 0 : fXDigBox[i][is]->SetLineColor(4);
421 0 : fYDigBox[i][is]->SetLineColor(4);
422 :
423 0 : fXLabelL[i][is] = 0;
424 0 : fXLabelR[i][is] = 0;
425 0 : fYLabelL[i][is] = 0;
426 0 : fYLabelR[i][is] = 0;
427 :
428 : }
429 : }
430 :
431 :
432 0 : fXOn = kFALSE;
433 0 : fYOn = kFALSE;
434 :
435 0 : fNStripX = fBoard->GetXSiy2() - fBoard->GetXSiy1() + 1;
436 0 : fNStripY = fBoard->GetYSix2() - fBoard->GetYSix1() + 1;
437 :
438 0 : }
439 :
440 : //__________________________________________________________________________
441 : void AliMUONTriggerGUIbdmap::HandleEditButton()
442 : {
443 : /// handle the editable check button
444 :
445 0 : if (((fXOn && !fYOn) || (!fXOn && fYOn)) &&
446 0 : (fEditStrips->GetState() == kButtonDown)) {
447 0 : fIsEditable = kTRUE;
448 0 : } else {
449 0 : fIsEditable = kFALSE;
450 : }
451 :
452 0 : }
453 :
454 : //__________________________________________________________________________
455 : void AliMUONTriggerGUIbdmap::EditStrips(Int_t event, Int_t x, Int_t y, TObject *sel)
456 : {
457 : /// set/unset strips
458 :
459 0 : TString cs;
460 : Int_t iMT;
461 : Double_t *px, *py;
462 0 : Double_t xf1, yf1, xf2, yf2;
463 : Int_t np = 5;
464 : Double_t xMin, xMax, yMin, yMax;
465 : Float_t xd, yd, fxDim, fyDim, cDim;
466 0 : Char_t cln[3];
467 :
468 0 : cDim = (Float_t)fCanvasSize;
469 :
470 : // the (x,y) event does not really go up to the canvas size...
471 : cDim = 196.0;
472 :
473 0 : if (fIsEditable) {
474 :
475 0 : if (event == kButton1Down) {
476 :
477 0 : cs = TString(sel->GetName());
478 0 : iMT = cs.Atoi()-1;
479 :
480 0 : fCanvas[iMT]->cd();
481 :
482 0 : fCanvas[iMT]->GetRange(xf1,yf1,xf2,yf2);
483 0 : fxDim = (Float_t)xf2;
484 0 : fyDim = (Float_t)yf2;
485 :
486 : //xd = fxDim*(+2.0*(Float_t)(x)/cDim - 1.0);
487 : //yd = fyDim*(-2.0*(Float_t)(y)/cDim + 1.0);
488 :
489 0 : xd = +(2.0*fxDim*(Float_t)(x))/cDim - fxDim;
490 0 : yd = -(2.0*fyDim*(Float_t)(y))/cDim + fyDim;
491 :
492 0 : if (fXOn) {
493 :
494 0 : for (Int_t ix = 0; ix < fNStripX; ix++) {
495 :
496 0 : px = fXDigPL[iMT][ix]->GetX();
497 0 : py = fXDigPL[iMT][ix]->GetY();
498 :
499 : xMin = +9999.;
500 : xMax = -9999.;
501 : yMin = +9999.;
502 : yMax = -9999.;
503 0 : for (Int_t ip = 0; ip < np; ip++) {
504 0 : xMin = TMath::Min(xMin,px[ip]);
505 0 : xMax = TMath::Max(xMax,px[ip]);
506 0 : yMin = TMath::Min(yMin,py[ip]);
507 0 : yMax = TMath::Max(yMax,py[ip]);
508 : }
509 :
510 0 : if (yd > (Float_t)yMin && yd < (Float_t)yMax) {
511 :
512 0 : if (fXDigBox[iMT][ix]->GetFillStyle() == 0) {
513 :
514 0 : fXDigBox[iMT][ix]->SetFillStyle(1001);
515 0 : fXDigBox[iMT][ix]->SetFillColor(2);
516 :
517 0 : snprintf(cln,3,"%2d",ix);
518 :
519 0 : fXLabelL[iMT][ix]->Clear();
520 0 : fXLabelL[iMT][ix]->AddText(cln);
521 0 : fXLabelL[iMT][ix]->Draw();
522 :
523 0 : fXLabelR[iMT][ix]->Clear();
524 0 : fXLabelR[iMT][ix]->AddText(cln);
525 0 : fXLabelR[iMT][ix]->Draw();
526 :
527 0 : fXDigBox[iMT][ix]->SetX1(xMin);
528 0 : fXDigBox[iMT][ix]->SetY1(yMin);
529 0 : fXDigBox[iMT][ix]->SetX2(xMax);
530 0 : fXDigBox[iMT][ix]->SetY2(yMax);
531 :
532 0 : fXDigBox[iMT][ix]->Draw();
533 :
534 0 : } else if (fXDigBox[iMT][ix]->GetFillStyle() == 1001) {
535 :
536 0 : fXDigBox[iMT][ix]->SetFillStyle(0);
537 :
538 0 : fXLabelL[iMT][ix]->Clear();
539 0 : fXLabelL[iMT][ix]->Draw();
540 :
541 0 : fXLabelR[iMT][ix]->Clear();
542 0 : fXLabelR[iMT][ix]->Draw();
543 :
544 0 : fXDigBox[iMT][ix]->SetX1(-fBoard->GetXCenter(iMT));
545 0 : fXDigBox[iMT][ix]->SetY1(-fBoard->GetYCenter(iMT));
546 0 : fXDigBox[iMT][ix]->SetX2(-fBoard->GetXCenter(iMT));
547 0 : fXDigBox[iMT][ix]->SetY2(-fBoard->GetYCenter(iMT));
548 :
549 0 : fXDigBox[iMT][ix]->Draw();
550 :
551 : }
552 :
553 0 : if (!fXDigBox[iMT][ix]->TestBit(kObjInCanvas))
554 0 : fXDigBox[iMT][ix]->Draw();
555 :
556 0 : fCanvas[iMT]->Modified();
557 0 : fCanvas[iMT]->Update();
558 :
559 0 : break;
560 :
561 : }
562 : }
563 :
564 0 : }
565 :
566 0 : if (fYOn) {
567 :
568 0 : for (Int_t iy = 0; iy < fNStripY; iy++) {
569 :
570 0 : px = fYDigPL[iMT][iy]->GetX();
571 0 : py = fYDigPL[iMT][iy]->GetY();
572 :
573 : xMin = +9999.;
574 : xMax = -9999.;
575 : yMin = +9999.;
576 : yMax = -9999.;
577 0 : for (Int_t ip = 0; ip < np; ip++) {
578 0 : xMin = TMath::Min(xMin,px[ip]);
579 0 : xMax = TMath::Max(xMax,px[ip]);
580 0 : yMin = TMath::Min(yMin,py[ip]);
581 0 : yMax = TMath::Max(yMax,py[ip]);
582 : }
583 :
584 0 : if (xd > (Float_t)xMin && xd < (Float_t)xMax) {
585 :
586 0 : if (fYDigBox[iMT][iy]->GetFillStyle() == 0) {
587 :
588 0 : fYDigBox[iMT][iy]->SetFillStyle(1001);
589 0 : fYDigBox[iMT][iy]->SetFillColor(2);
590 :
591 0 : snprintf(cln,3,"%2d",iy);
592 :
593 0 : fYLabelL[iMT][iy]->Clear();
594 0 : fYLabelL[iMT][iy]->AddText(cln);
595 0 : fYLabelL[iMT][iy]->Draw();
596 :
597 0 : fYLabelR[iMT][iy]->Clear();
598 0 : fYLabelR[iMT][iy]->AddText(cln);
599 0 : fYLabelR[iMT][iy]->Draw();
600 :
601 0 : fYDigBox[iMT][iy]->SetX1(xMin);
602 0 : fYDigBox[iMT][iy]->SetY1(yMin);
603 0 : fYDigBox[iMT][iy]->SetX2(xMax);
604 0 : fYDigBox[iMT][iy]->SetY2(yMax);
605 :
606 0 : fYDigBox[iMT][iy]->Draw();
607 :
608 0 : } else if (fYDigBox[iMT][iy]->GetFillStyle() == 1001) {
609 :
610 0 : fYDigBox[iMT][iy]->SetFillStyle(0);
611 :
612 0 : fYLabelL[iMT][iy]->Clear();
613 0 : fYLabelL[iMT][iy]->Draw();
614 :
615 0 : fYLabelR[iMT][iy]->Clear();
616 0 : fYLabelR[iMT][iy]->Draw();
617 :
618 0 : fYDigBox[iMT][iy]->SetX1(-fBoard->GetXCenter(iMT));
619 0 : fYDigBox[iMT][iy]->SetY1(-fBoard->GetYCenter(iMT));
620 0 : fYDigBox[iMT][iy]->SetX2(-fBoard->GetXCenter(iMT));
621 0 : fYDigBox[iMT][iy]->SetY2(-fBoard->GetYCenter(iMT));
622 :
623 0 : fYDigBox[iMT][iy]->Draw();
624 :
625 : }
626 :
627 0 : if (!fYDigBox[iMT][iy]->TestBit(kObjInCanvas))
628 0 : fYDigBox[iMT][iy]->Draw();
629 :
630 0 : fCanvas[iMT]->Modified();
631 0 : fCanvas[iMT]->Update();
632 :
633 0 : break;
634 :
635 : }
636 : }
637 :
638 0 : }
639 :
640 : } // end button event
641 :
642 : } // end IsEditable
643 :
644 0 : }
645 :
646 : //__________________________________________________________________________
647 : void AliMUONTriggerGUIbdmap::DoDigits()
648 : {
649 : /// set the board digits from GUI input (set/unset)
650 :
651 : Int_t amp = 0;
652 0 : Int_t number = fBoard->GetNumber();
653 : Int_t pos, over;
654 0 : pos = fBoard->GetPosition();
655 0 : over = fBoard->GetYOver();
656 : AliMUONTriggerGUIboard *board;
657 :
658 0 : for (Int_t imt = 0; imt < kNMT; imt++) {
659 :
660 0 : for (Int_t ix = 0; ix < fNStripX; ix++) {
661 0 : if (fXDigBox[imt][ix]->GetFillStyle() == 0) {
662 : amp = 0;
663 0 : }
664 0 : if (fXDigBox[imt][ix]->GetFillStyle() == 1001) {
665 : amp = 1;
666 0 : }
667 0 : fBoard->SetDigitX(imt,ix,amp);
668 : }
669 :
670 0 : for (Int_t iy = 0; iy < fNStripY; iy++) {
671 0 : if (fYDigBox[imt][iy]->GetFillStyle() == 0) {
672 : amp = 0;
673 0 : }
674 0 : if (fYDigBox[imt][iy]->GetFillStyle() == 1001) {
675 : amp = 1;
676 0 : }
677 0 : fBoard->SetDigitY(imt,iy,amp);
678 :
679 : // extended y-strips
680 0 : for (Int_t io = 1; io <= over; io++) {
681 0 : if (io == pos) continue;
682 0 : board = (AliMUONTriggerGUIboard*)fBoards->UncheckedAt(number+io-pos);
683 0 : board->SetDigitY(imt,iy,amp);
684 0 : }
685 :
686 : }
687 :
688 : }
689 :
690 0 : }
691 :
692 : //__________________________________________________________________________
693 : void AliMUONTriggerGUIbdmap::ResetDigits()
694 : {
695 : /// set the board digits from GUI input (set/unset)
696 :
697 : Int_t amp = 0;
698 0 : Int_t number = fBoard->GetNumber();
699 : AliMUONTriggerGUIboard *board;
700 : Int_t pos, over;
701 0 : pos = fBoard->GetPosition();
702 0 : over = fBoard->GetYOver();
703 :
704 0 : for (Int_t imt = 0; imt < kNMT; imt++) {
705 0 : for (Int_t ix = 0; ix < fNStripX; ix++) {
706 0 : fXDigBox[imt][ix]->SetFillStyle(0);
707 0 : fXDigBox[imt][ix]->SetX1(-fBoard->GetXCenter(imt));
708 0 : fXDigBox[imt][ix]->SetY1(-fBoard->GetYCenter(imt));
709 0 : fXDigBox[imt][ix]->SetX2(-fBoard->GetXCenter(imt));
710 0 : fXDigBox[imt][ix]->SetY2(-fBoard->GetYCenter(imt));
711 :
712 0 : fBoard->SetDigitX(imt,ix,amp);
713 : }
714 0 : for (Int_t iy = 0; iy < fNStripY; iy++) {
715 0 : fYDigBox[imt][iy]->SetFillStyle(0);
716 0 : fYDigBox[imt][iy]->SetX1(-fBoard->GetXCenter(imt));
717 0 : fYDigBox[imt][iy]->SetY1(-fBoard->GetYCenter(imt));
718 0 : fYDigBox[imt][iy]->SetX2(-fBoard->GetXCenter(imt));
719 0 : fYDigBox[imt][iy]->SetY2(-fBoard->GetYCenter(imt));
720 :
721 0 : fBoard->SetDigitY(imt,iy,amp);
722 :
723 : // extended y-strips
724 0 : for (Int_t io = 1; io <= over; io++) {
725 0 : if (io == pos) continue;
726 0 : board = (AliMUONTriggerGUIboard*)fBoards->UncheckedAt(number+io-pos);
727 :
728 0 : board->SetDigitY(imt,iy,amp);
729 :
730 0 : }
731 :
732 : }
733 : }
734 :
735 0 : fBoard->ClearXDigits();
736 0 : fBoard->ClearYDigits();
737 :
738 : // extended y-strips
739 0 : for (Int_t io = 1; io <= over; io++) {
740 0 : if (io == pos) continue;
741 0 : board = (AliMUONTriggerGUIboard*)fBoards->UncheckedAt(number+io-pos);
742 0 : board->ClearYDigits();
743 0 : }
744 :
745 0 : fXStrips->SetState(kButtonUp);
746 0 : fYStrips->SetState(kButtonUp);
747 0 : fEditStrips->SetState(kButtonUp);
748 0 : fIsEditable = kFALSE;
749 :
750 0 : DrawClear();
751 0 : fXOn = kFALSE;
752 0 : fYOn = kFALSE;
753 :
754 0 : }
755 :
756 : //__________________________________________________________________________
757 : void AliMUONTriggerGUIbdmap::HandleButtons(Int_t id)
758 : {
759 : /// handle the check buttons
760 :
761 0 : if (id == -1) {
762 0 : TGButton *btn = (TGButton *) gTQSender;
763 0 : id = btn->WidgetId();
764 0 : }
765 :
766 : // draw x and y
767 0 : if(fXStrips->GetState() == kButtonDown &&
768 0 : fYStrips->GetState() == kButtonDown ) {
769 :
770 0 : DrawClear();
771 0 : DrawStrips(kTRUE,kTRUE);
772 0 : DrawDigits(kTRUE,kTRUE);
773 0 : fXOn = kTRUE;
774 0 : fYOn = kTRUE;
775 :
776 0 : }
777 :
778 : // draw only x
779 0 : if(fXStrips->GetState() == kButtonDown &&
780 0 : fYStrips->GetState() == kButtonUp ) {
781 :
782 0 : DrawClear();
783 0 : DrawStrips(kTRUE,kFALSE);
784 0 : DrawDigits(kTRUE,kFALSE);
785 0 : fXOn = kTRUE;
786 0 : fYOn = kFALSE;
787 :
788 0 : }
789 :
790 : // draw only y
791 0 : if(fXStrips->GetState() == kButtonUp &&
792 0 : fYStrips->GetState() == kButtonDown ) {
793 :
794 0 : DrawClear();
795 0 : DrawStrips(kFALSE,kTRUE);
796 0 : DrawDigits(kFALSE,kTRUE);
797 0 : fXOn = kFALSE;
798 0 : fYOn = kTRUE;
799 :
800 0 : }
801 :
802 : // clear
803 0 : if(fXStrips->GetState() == kButtonUp &&
804 0 : fYStrips->GetState() == kButtonUp ) {
805 :
806 0 : DrawClear();
807 0 : fXOn = kFALSE;
808 0 : fYOn = kFALSE;
809 :
810 0 : }
811 :
812 0 : HandleEditButton();
813 :
814 0 : }
815 :
816 : //__________________________________________________________________________
817 : void AliMUONTriggerGUIbdmap::DrawClear()
818 : {
819 : /// draw the frame of the board image in the canvas
820 :
821 0 : for (Int_t i = 0; i < kNMT; i++) {
822 :
823 0 : fCanvas[i]->cd();
824 0 : fCanvas[i]->Clear();
825 :
826 0 : fCanvas[i]->Modified();
827 0 : fCanvas[i]->Update();
828 :
829 : }
830 :
831 0 : }
832 :
833 : //__________________________________________________________________________
834 : void AliMUONTriggerGUIbdmap::DrawDigits(Bool_t bx, Bool_t by)
835 : {
836 : /// draw the digits in "x" or/and "y"
837 :
838 : Bool_t drawDigits = kTRUE;
839 : Bool_t drawDigitsRaw = kTRUE;
840 0 : if (fLoader == 0x0) {
841 : drawDigits = kFALSE;
842 0 : }
843 0 : if (fRawDigitStore == 0x0) {
844 : drawDigitsRaw = kFALSE;
845 0 : }
846 :
847 : AliMUONTriggerGUIboard *board;
848 : Int_t over, pos, number;
849 : const AliMpVSegmentation* seg;
850 0 : AliMpPad pad;
851 : Int_t cathode, detElemId, ix, iy, charge;
852 : Int_t chamber, np = 5;
853 0 : AliMpDEIterator it;
854 : Float_t xpmin, xpmax, ypmin, ypmax;
855 0 : Float_t xg1, xg2, yg1, yg2, zg1;
856 : Float_t xdw, ydw, xcw, ycw;
857 0 : Double_t xc1, xc2, yc1, yc2;
858 0 : Char_t cln[3];
859 : TBox *boxd;
860 : Double_t xMin, xMax, yMin, yMax;
861 : Double_t *px, *py;
862 :
863 0 : number = fBoard->GetNumber();
864 0 : pos = fBoard->GetPosition();
865 0 : over = fBoard->GetYOver();
866 :
867 0 : if (drawDigits || drawDigitsRaw) {
868 :
869 0 : for (Int_t i = 0; i < kNMT; i++) {
870 :
871 0 : fCanvas[i]->cd();
872 :
873 0 : fCanvas[i]->GetRange(xc1,yc1,xc2,yc2);
874 0 : xcw = (Float_t)(0.5*(xc2-xc1));
875 0 : ycw = (Float_t)(0.5*(yc2-yc1));
876 :
877 : AliMUONVDigitStore *digitStore = 0x0;
878 0 : AliMUONGeometryTransformer transformer;
879 0 : transformer.LoadGeometryData("transform.dat");
880 :
881 0 : if (drawDigits) {
882 0 : AliRunLoader *runLoader = fLoader->GetRunLoader();
883 0 : digitStore = fMCDataInterface->DigitStore(runLoader->GetEventNumber());
884 0 : }
885 0 : if (drawDigitsRaw) {
886 0 : digitStore = static_cast<AliMUONVDigitStore*>(fRawDigitStore);
887 0 : }
888 :
889 0 : chamber = 11+i;
890 :
891 0 : MpPair_t deRange = AliMpDEManager::GetDetElemIdRange(chamber-1);
892 0 : TIter next(digitStore->CreateIterator(AliMp::PairFirst(deRange),AliMp::PairSecond(deRange)));
893 : AliMUONVDigit *mdig;
894 :
895 0 : while ( ( mdig = static_cast<AliMUONVDigit*>(next())) )
896 : {
897 0 : cathode = mdig->Cathode();
898 :
899 0 : ix = mdig->PadX();
900 0 : iy = mdig->PadY();
901 0 : detElemId = mdig->DetElemId();
902 0 : charge = (Int_t)mdig->Charge();
903 :
904 : Bool_t triggerBgn = kFALSE;
905 0 : Int_t schg = (Int_t)(charge + 0.5);
906 : // APPLY CONDITION ON SOFT BACKGROUND
907 0 : Int_t tchg = schg - (Int_t(schg/10))*10;
908 0 : if (schg<=10 || tchg>0) {
909 : triggerBgn = kFALSE;
910 0 : } else {
911 : triggerBgn = kTRUE;
912 : }
913 :
914 0 : if (detElemId%100 != fBoard->GetDetElemId()) continue;
915 :
916 0 : seg = AliMpSegmentation::Instance()->GetMpSegmentation(detElemId, AliMp::GetCathodType(cathode));
917 :
918 0 : pad = seg->PadByIndices(ix,iy,kTRUE);
919 :
920 : //if (cathode == 0) printf("GUI x: ix %d iy %d \n",ix,iy);
921 : //if (cathode == 1) printf("GUI y: ix %d iy %d \n",ix,iy);
922 :
923 : // get the pad position and dimensions
924 0 : Float_t xlocal1 = pad.GetPositionX();
925 0 : Float_t ylocal1 = pad.GetPositionY();
926 0 : Float_t xlocal2 = pad.GetDimensionX();
927 0 : Float_t ylocal2 = pad.GetDimensionY();
928 :
929 0 : transformer.Local2Global(detElemId, xlocal1, ylocal1, 0, xg1, yg1, zg1);
930 : // (no transformation for pad dimensions)
931 : xg2 = xlocal2;
932 : yg2 = ylocal2;
933 :
934 : // transform in the monitor coordinate system
935 : // ALICE SC
936 0 : xpmin = +(xg1-xg2);
937 0 : xpmax = +(xg1+xg2);
938 0 : ypmin = -(yg2-yg1);
939 0 : ypmax = +(yg2+yg1);
940 :
941 0 : xpmin -= fXCenter[i];
942 0 : xpmax -= fXCenter[i];
943 0 : ypmin -= fYCenter[i];
944 0 : ypmax -= fYCenter[i];
945 :
946 0 : xdw = xpmax-xpmin;
947 0 : ydw = ypmax-ypmin;
948 :
949 : // x-strips
950 0 : if ((xdw > ydw) && bx) {
951 :
952 : //printf("X strips mdig->Cathode() = %1d \n",mdig->Cathode());
953 :
954 : Int_t iX, iY1, iY2;
955 0 : iX = fBoard->GetXSix();
956 0 : iY1 = fBoard->GetXSiy1();
957 0 : iY2 = fBoard->GetXSiy2();
958 0 : if (ix == iX && iy >= iY1 && iy <= iY2) {
959 : //printf("Digit indices (x-strip) ix = %3d iy = %3d board = %s %d chamber = %2d \n",ix,iy,fBoard->GetBoardName(),fBoard->GetNumber(),chamber);
960 : /*
961 : xpmin += 0.01*fXWidth[i];
962 : xpmax -= 0.01*fXWidth[i];
963 : ypmin += 0.1*ydw;
964 : ypmax -= 0.1*ydw;
965 : */
966 0 : boxd = new TBox(xpmin,ypmin,xpmax,ypmax);
967 0 : boxd->SetFillStyle(1001);
968 0 : if (triggerBgn) boxd->SetFillColor(6);
969 0 : else boxd->SetFillColor(5);
970 0 : boxd->SetBit(kCannotPick);
971 0 : boxd->Draw();
972 :
973 0 : fXDigBox[i][iy-iY1]->SetFillStyle(1001);
974 0 : fXDigBox[i][iy-iY1]->SetFillColor(2);
975 0 : fXDigBox[i][iy-iY1]->SetX1(xpmin);
976 0 : fXDigBox[i][iy-iY1]->SetY1(ypmin);
977 0 : fXDigBox[i][iy-iY1]->SetX2(xpmax);
978 0 : fXDigBox[i][iy-iY1]->SetY2(ypmax);
979 0 : fXDigBox[i][iy-iY1]->Draw();
980 :
981 0 : snprintf(cln,3,"%2d",(iy-iY1));
982 0 : fXLabelL[i][iy-iY1]->Clear();
983 0 : fXLabelL[i][iy-iY1]->AddText(cln);
984 0 : fXLabelL[i][iy-iY1]->Draw();
985 0 : fXLabelR[i][iy-iY1]->Clear();
986 0 : fXLabelR[i][iy-iY1]->AddText(cln);
987 0 : fXLabelR[i][iy-iY1]->Draw();
988 :
989 0 : fBoard->SetDigitX(i,iy-iY1,charge);
990 :
991 0 : }
992 :
993 0 : }
994 :
995 : // y-strips
996 0 : if ((xdw < ydw) && by) {
997 :
998 : //printf("Y strips mdig->Cathode() = %1d \n",mdig->Cathode());
999 :
1000 : Int_t iX1, iX2, iY;
1001 0 : iX1 = fBoard->GetYSix1();
1002 0 : iX2 = fBoard->GetYSix2();
1003 0 : iY = fBoard->GetYSiy();
1004 0 : if (ix >= iX1 && ix <= iX2 && iy == iY) {
1005 : //printf("Digit indices (y-strip) ix = %3d iy = %3d board = %s chamber = %2d \n",ix,iy,fBoard->GetBoardName(),chamber);
1006 0 : ypmin = -0.5*fYWidth[i];
1007 0 : ypmax = +0.5*fYWidth[i];
1008 : /*
1009 : ypmin = -0.5*fYWidth[i];
1010 : ypmax = +0.5*fYWidth[i];
1011 : ypmin += 0.01*fYWidth[i];
1012 : ypmax -= 0.01*fYWidth[i];
1013 : xpmin += 0.1*xdw;
1014 : xpmax -= 0.1*xdw;
1015 : */
1016 0 : boxd = new TBox(xpmin,ypmin,xpmax,ypmax);
1017 0 : boxd->SetFillStyle(1001);
1018 0 : if (triggerBgn) boxd->SetFillColor(6);
1019 0 : else boxd->SetFillColor(5);
1020 0 : boxd->SetBit(kCannotPick);
1021 0 : boxd->Draw();
1022 :
1023 0 : fYDigBox[i][ix-iX1]->SetFillStyle(1001);
1024 0 : fYDigBox[i][ix-iX1]->SetFillColor(2);
1025 0 : fYDigBox[i][ix-iX1]->SetX1(xpmin);
1026 0 : fYDigBox[i][ix-iX1]->SetY1(ypmin);
1027 0 : fYDigBox[i][ix-iX1]->SetX2(xpmax);
1028 0 : fYDigBox[i][ix-iX1]->SetY2(ypmax);
1029 0 : fYDigBox[i][ix-iX1]->Draw();
1030 :
1031 0 : snprintf(cln,3,"%2d",(ix-iX1));
1032 0 : fYLabelL[i][ix-iX1]->Clear();
1033 0 : fYLabelL[i][ix-iX1]->AddText(cln);
1034 0 : fYLabelL[i][ix-iX1]->Draw();
1035 0 : fYLabelR[i][ix-iX1]->Clear();
1036 0 : fYLabelR[i][ix-iX1]->AddText(cln);
1037 0 : fYLabelR[i][ix-iX1]->Draw();
1038 :
1039 0 : fBoard->SetDigitY(i,ix-iX1,charge);
1040 :
1041 : // extended y-strips
1042 0 : for (Int_t io = 1; io <= over; io++) {
1043 0 : if (io == pos) continue;
1044 0 : board = (AliMUONTriggerGUIboard*)fBoards->UncheckedAt(number+io-pos);
1045 0 : board->SetDigitY(i,ix-iX1,charge);
1046 0 : }
1047 :
1048 0 : }
1049 0 : }
1050 :
1051 0 : } // end digits loop
1052 :
1053 0 : } // end chamber loop
1054 :
1055 0 : } // end drawDigits
1056 :
1057 : // DSET digits
1058 0 : for (Int_t i = 0; i < kNMT; i++) {
1059 :
1060 0 : fCanvas[i]->cd();
1061 :
1062 0 : fCanvas[i]->GetRange(xc1,yc1,xc2,yc2);
1063 0 : xcw = (Float_t)(0.5*(xc2-xc1));
1064 0 : ycw = (Float_t)(0.5*(yc2-yc1));
1065 :
1066 : // x-strips DSET
1067 0 : if (bx) {
1068 :
1069 0 : for (ix = 0; ix < fNStripX; ix++) {
1070 : //if (fBoard->GetXDig(i,ix) > 0) {
1071 0 : if (fXDigBox[i][ix]->GetFillStyle() == 1001 ||
1072 0 : fBoard->GetXDig(i,ix) > 0) {
1073 :
1074 0 : px = fXDigPL[i][ix]->GetX();
1075 0 : py = fXDigPL[i][ix]->GetY();
1076 :
1077 : xMin = +9999.;
1078 : xMax = -9999.;
1079 : yMin = +9999.;
1080 : yMax = -9999.;
1081 0 : for (Int_t ip = 0; ip < np; ip++) {
1082 0 : xMin = TMath::Min(xMin,px[ip]);
1083 0 : xMax = TMath::Max(xMax,px[ip]);
1084 0 : yMin = TMath::Min(yMin,py[ip]);
1085 0 : yMax = TMath::Max(yMax,py[ip]);
1086 : }
1087 :
1088 0 : if (fXDigBox[i][ix]->GetFillStyle() == 0) {
1089 0 : fXDigBox[i][ix]->SetFillStyle(1001);
1090 0 : fXDigBox[i][ix]->SetFillColor(2);
1091 0 : fXDigBox[i][ix]->SetX1(xMin);
1092 0 : fXDigBox[i][ix]->SetY1(yMin);
1093 0 : fXDigBox[i][ix]->SetX2(xMax);
1094 0 : fXDigBox[i][ix]->SetY2(yMax);
1095 : }
1096 :
1097 0 : snprintf(cln,3,"%2d",ix);
1098 :
1099 0 : fXLabelL[i][ix]->Clear();
1100 0 : fXLabelL[i][ix]->AddText(cln);
1101 0 : fXLabelL[i][ix]->Draw();
1102 :
1103 0 : fXLabelR[i][ix]->Clear();
1104 0 : fXLabelR[i][ix]->AddText(cln);
1105 0 : fXLabelR[i][ix]->Draw();
1106 :
1107 0 : fXDigBox[i][ix]->Draw();
1108 :
1109 : }
1110 :
1111 : }
1112 :
1113 : }
1114 :
1115 : // y-strips DSET
1116 0 : if (by) {
1117 :
1118 0 : for (iy = 0; iy < fNStripY; iy++) {
1119 : //if (fBoard->GetYDig(i,iy) > 0) {
1120 0 : if (fYDigBox[i][iy]->GetFillStyle() == 1001 ||
1121 0 : fBoard->GetYDig(i,iy) > 0) {
1122 :
1123 0 : px = fYDigPL[i][iy]->GetX();
1124 0 : py = fYDigPL[i][iy]->GetY();
1125 :
1126 : xMin = +9999.;
1127 : xMax = -9999.;
1128 : yMin = +9999.;
1129 : yMax = -9999.;
1130 0 : for (Int_t ip = 0; ip < np; ip++) {
1131 0 : xMin = TMath::Min(xMin,px[ip]);
1132 0 : xMax = TMath::Max(xMax,px[ip]);
1133 0 : yMin = TMath::Min(yMin,py[ip]);
1134 0 : yMax = TMath::Max(yMax,py[ip]);
1135 : }
1136 :
1137 0 : if (fYDigBox[i][iy]->GetFillStyle() == 0) {
1138 0 : fYDigBox[i][iy]->SetFillStyle(1001);
1139 0 : fYDigBox[i][iy]->SetFillColor(2);
1140 0 : fYDigBox[i][iy]->SetX1(xMin);
1141 0 : fYDigBox[i][iy]->SetY1(yMin);
1142 0 : fYDigBox[i][iy]->SetX2(xMax);
1143 0 : fYDigBox[i][iy]->SetY2(yMax);
1144 : }
1145 :
1146 0 : snprintf(cln,3,"%2d",iy);
1147 :
1148 0 : fYLabelL[i][iy]->Clear();
1149 0 : fYLabelL[i][iy]->AddText(cln);
1150 0 : fYLabelL[i][iy]->Draw();
1151 :
1152 0 : fYLabelR[i][iy]->Clear();
1153 0 : fYLabelR[i][iy]->AddText(cln);
1154 0 : fYLabelR[i][iy]->Draw();
1155 :
1156 0 : fYDigBox[i][iy]->Draw();
1157 :
1158 : }
1159 :
1160 : }
1161 :
1162 : }
1163 :
1164 0 : fCanvas[i]->Modified();
1165 0 : fCanvas[i]->Update();
1166 :
1167 : } // end canvas (chamber) loop
1168 :
1169 0 : fMain->MapWindow();
1170 :
1171 0 : }
1172 :
1173 : //__________________________________________________________________________
1174 : void AliMUONTriggerGUIbdmap::DrawStrips(Bool_t bx, Bool_t by)
1175 : {
1176 : /// draw the "x" or/and "y" strips
1177 :
1178 0 : AliMUONGeometryTransformer transformer;
1179 0 : transformer.LoadGeometryData("transform.dat");
1180 :
1181 : const AliMpVSegmentation* seg;
1182 0 : AliMpPad pad;
1183 0 : AliMpDEIterator it;
1184 : Int_t chamber;
1185 0 : Float_t xg1, xg2, yg1, yg2, zg1;
1186 : Float_t xlocal1, xlocal2, ylocal1, ylocal2;
1187 : Int_t detElemId, maxX, maxY;
1188 : Float_t xdw, ydw, xpmin, xpmax, ypmin, ypmax;
1189 : Float_t ptx1, ptx2, pty1, pty2;
1190 0 : Char_t cln[3];
1191 0 : Double_t xc1, xc2, yc1, yc2;
1192 : Float_t xcw, ycw;
1193 :
1194 : Bool_t makeLabelsX = kFALSE;
1195 : Bool_t makeLabelsY = kFALSE;
1196 :
1197 0 : if (bx && !fLabelX) {
1198 : makeLabelsX = kTRUE;
1199 0 : fLabelX = kTRUE;
1200 0 : }
1201 :
1202 0 : if (by && !fLabelY) {
1203 : makeLabelsY = kTRUE;
1204 0 : fLabelY = kTRUE;
1205 0 : }
1206 :
1207 0 : for (Int_t i = 0; i < kNMT; i++) {
1208 :
1209 0 : fCanvas[i]->cd();
1210 :
1211 0 : fCanvas[i]->GetRange(xc1,yc1,xc2,yc2);
1212 0 : xcw = (Float_t)(0.5*(xc2-xc1));
1213 0 : ycw = (Float_t)(0.5*(yc2-yc1));
1214 :
1215 0 : chamber = 11+i;
1216 :
1217 0 : for ( it.First(chamber-1); ! it.IsDone(); it.Next() ) {
1218 :
1219 0 : detElemId = it.CurrentDEId();
1220 :
1221 0 : if (detElemId%100 != fBoard->GetDetElemId()) continue;
1222 :
1223 : /*---------- y-pads ic = 1 ----------*/
1224 :
1225 0 : seg = AliMpSegmentation::Instance()->GetMpSegmentation(detElemId, AliMp::kCath1);
1226 :
1227 0 : maxX = seg->MaxPadIndexX();
1228 0 : maxY = seg->MaxPadIndexY();
1229 :
1230 0 : for (Int_t ix = 0; ix <= maxX; ix++) {
1231 0 : for (Int_t iy = 0; iy <= maxY; iy++) {
1232 :
1233 0 : pad = seg->PadByIndices(ix,iy,kFALSE);
1234 :
1235 0 : if (!pad.IsValid()) continue;
1236 :
1237 : // get the pad position and dimensions
1238 0 : xlocal1 = pad.GetPositionX();
1239 0 : ylocal1 = pad.GetPositionY();
1240 0 : xlocal2 = pad.GetDimensionX();
1241 0 : ylocal2 = pad.GetDimensionY();
1242 :
1243 0 : transformer.Local2Global(detElemId, xlocal1, ylocal1, 0, xg1, yg1, zg1);
1244 : // (no transformation for pad dimensions)
1245 : xg2 = xlocal2;
1246 : yg2 = ylocal2;
1247 :
1248 : // transform in the monitor coordinate system
1249 : // ALICE SC
1250 0 : xpmin = +(xg1-xg2);
1251 0 : xpmax = +(xg1+xg2);
1252 0 : ypmin = -(yg2-yg1);
1253 0 : ypmax = +(yg2+yg1);
1254 :
1255 0 : xpmin -= fXCenter[i];
1256 0 : xpmax -= fXCenter[i];
1257 0 : ypmin -= fYCenter[i];
1258 0 : ypmax -= fYCenter[i];
1259 :
1260 : xdw = xpmax-xpmin;
1261 : ydw = ypmax-ypmin;
1262 :
1263 : // y-strips
1264 0 : if (by) {
1265 :
1266 : Int_t iX1, iX2, iY, ixDig;
1267 0 : iX1 = fBoard->GetYSix1();
1268 0 : iX2 = fBoard->GetYSix2();
1269 0 : iY = fBoard->GetYSiy();
1270 0 : if (ix >= iX1 && ix <= iX2 && iy == iY) {
1271 :
1272 0 : ypmin = -0.5*fYWidth[i];
1273 0 : ypmax = +0.5*fYWidth[i];
1274 : /*
1275 : ypmin += 0.01*fYWidth[i];
1276 : ypmax -= 0.01*fYWidth[i];
1277 : xpmin += 0.1*xdw;
1278 : xpmax -= 0.1*xdw;
1279 : */
1280 0 : ixDig = ix - iX1;
1281 0 : fYDigPL[i][ixDig]->SetPoint(0,xpmin,ypmin);
1282 0 : fYDigPL[i][ixDig]->SetPoint(1,xpmax,ypmin);
1283 0 : fYDigPL[i][ixDig]->SetPoint(2,xpmax,ypmax);
1284 0 : fYDigPL[i][ixDig]->SetPoint(3,xpmin,ypmax);
1285 0 : fYDigPL[i][ixDig]->SetPoint(4,xpmin,ypmin);
1286 0 : fYDigPL[i][ixDig]->Draw();
1287 : /*
1288 : fYDigBox[i][ixDig]->SetFillStyle(1001);
1289 : fYDigBox[i][ixDig]->SetFillColor(5);
1290 : fYDigBox[i][ixDig]->DrawBox(xpmin,ypmin,xpmax,ypmax);
1291 : */
1292 0 : if (makeLabelsY) {
1293 0 : snprintf(cln,3,"%2d",(ix-iX1));
1294 : ptx1 = xpmin;
1295 : ptx2 = xpmax;
1296 :
1297 0 : pty1 = 1.065*ypmin - 0.04*ycw;
1298 0 : pty2 = 1.065*ypmin + 0.04*ycw;
1299 0 : fYLabelL[i][ix-iX1] = new TPaveText(ptx1,pty1,ptx2,pty2);
1300 0 : fYLabelL[i][ix-iX1]->SetBorderSize(0);
1301 0 : fYLabelL[i][ix-iX1]->SetBit(kCannotPick);
1302 :
1303 0 : pty1 = 1.065*ypmax - 0.04*ycw;
1304 0 : pty2 = 1.065*ypmax + 0.04*ycw;
1305 0 : fYLabelR[i][ix-iX1] = new TPaveText(ptx1,pty1,ptx2,pty2);
1306 0 : fYLabelR[i][ix-iX1]->SetBorderSize(0);
1307 0 : fYLabelR[i][ix-iX1]->SetBit(kCannotPick);
1308 0 : }
1309 :
1310 : }
1311 :
1312 0 : }
1313 :
1314 : } // end maxY
1315 :
1316 : } // end maxX
1317 :
1318 : /*---------- x-pads ic = 0 ----------*/
1319 :
1320 0 : seg = AliMpSegmentation::Instance()->GetMpSegmentation(detElemId, AliMp::kCath0);
1321 :
1322 0 : maxX = seg->MaxPadIndexX();
1323 0 : maxY = seg->MaxPadIndexY();
1324 :
1325 0 : for (Int_t ix = 0; ix <= maxX; ix++) {
1326 0 : for (Int_t iy = 0; iy <= maxY; iy++) {
1327 :
1328 0 : pad = seg->PadByIndices(ix,iy,kFALSE);
1329 :
1330 0 : if (!pad.IsValid()) continue;
1331 :
1332 : // get the pad position and dimensions
1333 0 : xlocal1 = pad.GetPositionX();
1334 0 : ylocal1 = pad.GetPositionY();
1335 0 : xlocal2 = pad.GetDimensionX();
1336 0 : ylocal2 = pad.GetDimensionY();
1337 :
1338 0 : transformer.Local2Global(detElemId, xlocal1, ylocal1, 0, xg1, yg1, zg1);
1339 : // (no transformation for pad dimensions)
1340 : xg2 = xlocal2;
1341 : yg2 = ylocal2;
1342 :
1343 : // transform in the monitor coordinate system
1344 : // ALICE SC
1345 0 : xpmin = +(xg1-xg2);
1346 0 : xpmax = +(xg1+xg2);
1347 0 : ypmin = -(yg2-yg1);
1348 0 : ypmax = +(yg2+yg1);
1349 :
1350 0 : xpmin -= fXCenter[i];
1351 0 : xpmax -= fXCenter[i];
1352 0 : ypmin -= fYCenter[i];
1353 0 : ypmax -= fYCenter[i];
1354 : xdw = xpmax-xpmin;
1355 : ydw = ypmax-ypmin;
1356 :
1357 : // x-strips
1358 0 : if (bx) {
1359 :
1360 : Int_t iX, iY1, iY2, iyDig;
1361 0 : iX = fBoard->GetXSix();
1362 0 : iY1 = fBoard->GetXSiy1();
1363 0 : iY2 = fBoard->GetXSiy2();
1364 0 : if (ix == iX && iy >= iY1 && iy <= iY2) {
1365 : /*
1366 : xpmin += 0.01*fXWidth[i];
1367 : xpmax -= 0.01*fXWidth[i];
1368 : ypmin += 0.1*ydw;
1369 : ypmax -= 0.1*ydw;
1370 : */
1371 0 : iyDig = iy - iY1;
1372 0 : fXDigPL[i][iyDig]->SetPoint(0,xpmin,ypmin);
1373 0 : fXDigPL[i][iyDig]->SetPoint(1,xpmax,ypmin);
1374 0 : fXDigPL[i][iyDig]->SetPoint(2,xpmax,ypmax);
1375 0 : fXDigPL[i][iyDig]->SetPoint(3,xpmin,ypmax);
1376 0 : fXDigPL[i][iyDig]->SetPoint(4,xpmin,ypmin);
1377 0 : fXDigPL[i][iyDig]->Draw();
1378 : /*
1379 : fXDigBox[i][iyDig]->SetFillStyle(1001);
1380 : fXDigBox[i][iyDig]->SetFillColor(5);
1381 : fXDigBox[i][iyDig]->DrawBox(xpmin,ypmin,xpmax,ypmax);
1382 : */
1383 0 : if (makeLabelsX) {
1384 0 : snprintf(cln,3,"%2d",(iy-iY1));
1385 : pty1 = ypmin;
1386 : pty2 = ypmax;
1387 :
1388 0 : ptx1 = 1.065*xpmin - 0.04*xcw;
1389 0 : ptx2 = 1.065*xpmin + 0.04*xcw;
1390 0 : fXLabelL[i][iy-iY1] = new TPaveText(ptx1,pty1,ptx2,pty2);
1391 0 : fXLabelL[i][iy-iY1]->SetBorderSize(0);
1392 0 : fXLabelL[i][iy-iY1]->SetBit(kCannotPick);
1393 :
1394 0 : ptx1 = 1.065*xpmax - 0.04*xcw;
1395 0 : ptx2 = 1.065*xpmax + 0.04*xcw;
1396 0 : fXLabelR[i][iy-iY1] = new TPaveText(ptx1,pty1,ptx2,pty2);
1397 0 : fXLabelR[i][iy-iY1]->SetBorderSize(0);
1398 0 : fXLabelR[i][iy-iY1]->SetBit(kCannotPick);
1399 0 : }
1400 :
1401 : }
1402 :
1403 0 : }
1404 :
1405 : } // end maxY
1406 :
1407 : } // end maxX
1408 :
1409 0 : } // end DEIterator
1410 :
1411 0 : fCanvas[i]->Modified();
1412 0 : fCanvas[i]->Update();
1413 :
1414 : }
1415 :
1416 0 : fMain->MapWindow();
1417 :
1418 0 : }
1419 :
1420 : //__________________________________________________________________________
1421 : void AliMUONTriggerGUIbdmap::CloseWindow() const
1422 : {
1423 : /// close dialog in response to window manager close.
1424 :
1425 0 : delete this;
1426 :
1427 0 : }
1428 :
1429 : //__________________________________________________________________________
1430 : void AliMUONTriggerGUIbdmap::DoClose()
1431 : {
1432 : /// handle Close button.
1433 :
1434 0 : fBoard->SetOpen(kFALSE);
1435 0 : TTimer::SingleShot(150,"AliMUONTriggerGUIbdmap",this,"CloseWindow()");
1436 :
1437 0 : }
1438 :
1439 :
|