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