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