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