1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 //-----------------------------------------------------------------------------
19 /// \class AliMUONTriggerGUIbdmap
21 /// The gui map of a single board object, strips/digits
23 /// \author Bogdan Vulpescu, LPC Clermont-Ferrand
24 //-----------------------------------------------------------------------------
26 #include <TPolyLine.h>
29 #include <TRootEmbeddedCanvas.h>
31 #include <TPaveText.h>
32 #include <TGTextEdit.h>
35 #include <TObjArray.h>
38 #include "AliRunLoader.h"
39 #include "AliMUONVDigit.h"
40 #include "AliMpVSegmentation.h"
41 #include "AliMpSegmentation.h"
42 #include "AliMUONGeometryTransformer.h"
43 #include "AliMpDEIterator.h"
44 #include "AliMUONLocalTrigger.h"
45 #include "AliMUONLocalTriggerBoard.h"
46 #include "AliMUONTriggerCrateStore.h"
47 #include "AliMUONMCDataInterface.h"
48 #include "AliMUONTriggerStoreV1.h"
49 #include "AliMUONDigitStoreV1.h"
50 #include "AliMpDEManager.h"
52 #include "AliMUONTriggerGUIboard.h"
53 #include "AliMUONTriggerGUIbdmap.h"
56 ClassImp(AliMUONTriggerGUIbdmap)
59 //__________________________________________________________________________
60 AliMUONTriggerGUIbdmap::AliMUONTriggerGUIbdmap(const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h)
81 fCalibrationData(0x0),
86 gStyle->SetPadLeftMargin(0.05);
87 gStyle->SetPadRightMargin(0.05);
88 gStyle->SetPadTopMargin(0.05);
89 gStyle->SetPadBottomMargin(0.05);
91 fMain = new TGTransientFrame(p, main, w, h, kVerticalFrame);
92 fMain->Connect("CloseWindow()", "AliMUONTriggerGUIbdmap", this, "CloseWindow()");
93 fMain->DontCallClose(); // to avoid double deletions.
95 // use hierarchical cleaning
96 fMain->SetCleanup(kDeepCleanup);
98 fMain->ChangeOptions((fMain->GetOptions() & ~kVerticalFrame) | kHorizontalFrame);
100 // strips/digits canvases
104 TRootEmbeddedCanvas *recanvas[4];
106 for (Int_t i = 0; i < kNMT; i++) {
108 sprintf(ecname,"%1d",i+1);
109 recanvas[i] = new TRootEmbeddedCanvas(ecname,fMain,fCanvasSize,fCanvasSize);
111 fCanvas[i] = recanvas[i]->GetCanvas();
113 fCanvas[i]->SetBorderMode(0);
114 fCanvas[i]->SetBit(kNoContextMenu);
116 fCanvas[i]->Connect("ProcessedEvent(Int_t,Int_t,Int_t,TObject*)",
117 "AliMUONTriggerGUIbdmap",this,
118 "EditStrips(Int_t,Int_t,Int_t,TObject*)");
120 fMain->AddFrame(recanvas[i],
122 new TGTableLayoutHints(2,5,2,6,
123 kLHintsExpandX|kLHintsExpandY |
124 kLHintsShrinkX|kLHintsShrinkY |
125 kLHintsFillX|kLHintsFillY)
127 new TGLayoutHints(kLHintsTop |
134 //TGDimension size = fMain->GetDefaultSize();
135 //fMain->Resize(size);
139 TGCompositeFrame *cf0 = new TGCompositeFrame(fMain, 60, 20, kVerticalFrame);
141 TGCompositeFrame *cf1 = new TGCompositeFrame(cf0, 60, 20, kVerticalFrame | kFixedWidth);
143 cf1->AddFrame(fXStrips = new TGCheckButton(cf1, "Draw X strips and digits", 1),
144 new TGLayoutHints(kLHintsTop |
149 cf1->Resize(fXStrips->GetDefaultWidth()+10, fMain->GetDefaultHeight());
151 cf1->AddFrame(fYStrips = new TGCheckButton(cf1, "Draw Y strips and digits", 2),
152 new TGLayoutHints(kLHintsTop |
157 cf1->Resize(fYStrips->GetDefaultWidth()+10, fMain->GetDefaultHeight());
159 cf1->AddFrame(fEditStrips = new TGCheckButton(cf1, "Set/unset strips", 3),
160 new TGLayoutHints(kLHintsTop |
165 fXStrips->Connect("Clicked()", "AliMUONTriggerGUIbdmap", this, "HandleButtons()");
166 fYStrips->Connect("Clicked()", "AliMUONTriggerGUIbdmap", this, "HandleButtons()");
167 fEditStrips->Connect("Clicked()", "AliMUONTriggerGUIbdmap", this, "HandleEditButton()");
170 new TGLayoutHints(kLHintsTop |
175 TGCompositeFrame *cf2 = new TGCompositeFrame(cf0, 60, 20, kHorizontalFrame | kFixedWidth);
177 TGTextButton *digitsButton = new TGTextButton(cf2, "Digits", 4);
178 digitsButton->Connect("Clicked()", "AliMUONTriggerGUIbdmap", this, "DoDigits()");
180 //cf2->Resize(digitsButton->GetDefaultWidth()+40, fMain->GetDefaultHeight());
182 cf2->AddFrame(digitsButton,
183 new TGLayoutHints(kLHintsTop |
189 TGTextButton *dresetButton = new TGTextButton(cf2, "Reset", 5);
190 dresetButton->Connect("Clicked()", "AliMUONTriggerGUIbdmap", this, "ResetDigits()");
192 //cf2->Resize(dresetButton->GetDefaultWidth()+40, fMain->GetDefaultHeight());
194 cf2->AddFrame(dresetButton,
195 new TGLayoutHints(kLHintsTop |
201 TGTextButton *closeButton = new TGTextButton(cf2, "Close", 6);
202 closeButton->Connect("Clicked()", "AliMUONTriggerGUIbdmap", this, "DoClose()");
204 //cf2->Resize(closeButton->GetDefaultWidth()+40, fMain->GetDefaultHeight());
206 cf2->AddFrame(closeButton,
207 new TGLayoutHints(kLHintsTop |
214 new TGLayoutHints(kLHintsTop |
219 // editor window for the local trigger
221 TGCompositeFrame *cf3 = new TGCompositeFrame(cf0, 60, 20, kVerticalFrame | kFixedWidth);
223 fLocTrigE = new TGTextEdit(cf3, 100, 100, kSunkenFrame | kDoubleBorder);
224 cf3->AddFrame(fLocTrigE,
225 new TGLayoutHints(kLHintsExpandX |
231 new TGLayoutHints(kLHintsTop |
237 new TGLayoutHints(kLHintsTop |
242 fIsEditable = kFALSE;
246 fMain->MapSubwindows();
249 fMain->CenterOnParent();
251 //fMain->MapWindow();
252 //gClient->WaitFor(fMain);
256 //__________________________________________________________________________
257 AliMUONTriggerGUIbdmap::~AliMUONTriggerGUIbdmap()
261 fMain->DeleteWindow();
265 //__________________________________________________________________________
266 void AliMUONTriggerGUIbdmap::Show()
268 /// map the main frame
275 //__________________________________________________________________________
276 void AliMUONTriggerGUIbdmap::LocalTriggerInfo()
278 /// print the local trigger
283 sprintf(buffer,"Local trigger info\n");
284 fLocTrigE->LoadBuffer(buffer);
286 AliMUONVTriggerStore *triggerStore;
288 if (fLoader != 0x0) {
289 AliRunLoader *runLoader = fLoader->GetRunLoader();
290 triggerStore = fMCDataInterface->TriggerStore(runLoader->GetEventNumber());
291 } else if (fRawTriggerStore != 0x0) {
292 triggerStore = static_cast<AliMUONVTriggerStore*>(fRawTriggerStore);
294 sprintf(buffer,"No data loaded yet...\n");
295 txt.LoadBuffer(buffer);
296 fLocTrigE->AddText(&txt);
300 Int_t circuitNumber = fBoard->GetIdCircuit();
302 UShort_t x2m, x2u, x2d;
304 Int_t loStripX, loStripY, loDev, loCircuit, iStripX, iStripY, loLpt, loHpt;
305 AliMUONLocalTrigger *mlt;
307 TIter next(triggerStore->CreateLocalIterator());
309 while ( ( mlt = static_cast<AliMUONLocalTrigger*>(next()) ) )
311 loCircuit = mlt->LoCircuit();
313 if (loCircuit == circuitNumber) {
315 AliMUONLocalTriggerBoard* ltb = fCrateManager->LocalBoard(loCircuit);
316 x2d = ltb->GetSwitch(0);
317 x2m = ltb->GetSwitch(1);
318 x2u = ltb->GetSwitch(2);
320 loStripX = mlt->LoStripX();
321 loStripY = mlt->LoStripY();
322 loDev = mlt->LoDev();
323 loLpt = mlt->LoLpt();
324 loHpt = mlt->LoHpt();
326 iStripX = loStripX/2;
327 if ((x2u == 1 || x2m == 1 || x2d == 1) && x2m == 1) {
328 iStripY = loStripY/2;
333 sprintf(buffer,"Circuit = %03d",loCircuit);
334 txt.LoadBuffer(buffer);
335 fLocTrigE->AddText(&txt);
337 sprintf(buffer,"LoStripX = %2d",loStripX);
338 txt.LoadBuffer(buffer);
339 fLocTrigE->AddText(&txt);
341 sprintf(buffer,"LoStripY = %2d",loStripY);
342 txt.LoadBuffer(buffer);
343 fLocTrigE->AddText(&txt);
345 sprintf(buffer,"LoDev = %2d",loDev);
346 txt.LoadBuffer(buffer);
347 fLocTrigE->AddText(&txt);
349 sprintf(buffer,"--------------------");
350 txt.LoadBuffer(buffer);
351 fLocTrigE->AddText(&txt);
353 sprintf(buffer,"X-strip = %2d ( %2d )",iStripX,(loStripX+loDev+1)/2);
354 txt.LoadBuffer(buffer);
355 fLocTrigE->AddText(&txt);
357 sprintf(buffer,"Y-strip = %2d",iStripY);
358 txt.LoadBuffer(buffer);
359 fLocTrigE->AddText(&txt);
361 sprintf(buffer,"--------------------");
362 txt.LoadBuffer(buffer);
363 fLocTrigE->AddText(&txt);
365 sprintf(buffer,"LoLpt = %2d",loLpt);
366 txt.LoadBuffer(buffer);
367 fLocTrigE->AddText(&txt);
369 sprintf(buffer,"LoHpt = %2d",loHpt);
370 txt.LoadBuffer(buffer);
371 fLocTrigE->AddText(&txt);
381 //__________________________________________________________________________
382 void AliMUONTriggerGUIbdmap::Init()
384 /// initialize the boards in the four MT
386 for (Int_t i = 0; i < kNMT; i++) {
388 fXWidth[i] = fBoard->GetXWidth(i);
389 fYWidth[i] = fBoard->GetYWidth(i);
390 fXCenter[i] = fBoard->GetXCenter(i);
391 fYCenter[i] = fBoard->GetYCenter(i);
396 for (Int_t i = 0; i < kNMT; i++) {
397 xw = 1.20*fXWidth[i];
398 yw = 1.20*fYWidth[i];
399 fCanvas[i]->Range(-xw/2,-yw/2,+xw/2,+yw/2);
400 for (Int_t is = 0; is < kNS; is++) {
402 fXDigPL[i][is] = new TPolyLine(5);
403 fYDigPL[i][is] = new TPolyLine(5);
404 fXDigPL[i][is]->SetBit(kCannotPick);
405 fYDigPL[i][is]->SetBit(kCannotPick);
406 fXDigPL[i][is]->SetLineColor(4);
407 fYDigPL[i][is]->SetLineColor(4);
409 fXDigBox[i][is] = new TBox(0,0,0,0);
410 fYDigBox[i][is] = new TBox(0,0,0,0);
411 fXDigBox[i][is]->SetBit(kCannotPick);
412 fYDigBox[i][is]->SetBit(kCannotPick);
413 fXDigBox[i][is]->SetFillStyle(0);
414 fYDigBox[i][is]->SetFillStyle(0);
415 fXDigBox[i][is]->SetLineColor(4);
416 fYDigBox[i][is]->SetLineColor(4);
430 fNStripX = fBoard->GetXSiy2() - fBoard->GetXSiy1() + 1;
431 fNStripY = fBoard->GetYSix2() - fBoard->GetYSix1() + 1;
435 //__________________________________________________________________________
436 void AliMUONTriggerGUIbdmap::HandleEditButton()
438 /// handle the editable check button
440 if (((fXOn && !fYOn) || (!fXOn && fYOn)) &&
441 (fEditStrips->GetState() == kButtonDown)) {
444 fIsEditable = kFALSE;
449 //__________________________________________________________________________
450 void AliMUONTriggerGUIbdmap::EditStrips(Int_t event, Int_t x, Int_t y, TObject *sel)
457 Double_t xf1, yf1, xf2, yf2;
459 Double_t xMin, xMax, yMin, yMax;
460 Float_t xd, yd, fxDim, fyDim, cDim;
463 cDim = (Float_t)fCanvasSize;
465 // the (x,y) event does not really go up to the canvas size...
470 if (event == kButton1Down) {
472 cs = TString(sel->GetName());
477 fCanvas[iMT]->GetRange(xf1,yf1,xf2,yf2);
478 fxDim = (Float_t)xf2;
479 fyDim = (Float_t)yf2;
481 //xd = fxDim*(+2.0*(Float_t)(x)/cDim - 1.0);
482 //yd = fyDim*(-2.0*(Float_t)(y)/cDim + 1.0);
484 xd = +(2.0*fxDim*(Float_t)(x))/cDim - fxDim;
485 yd = -(2.0*fyDim*(Float_t)(y))/cDim + fyDim;
489 for (Int_t ix = 0; ix < fNStripX; ix++) {
491 px = fXDigPL[iMT][ix]->GetX();
492 py = fXDigPL[iMT][ix]->GetY();
498 for (Int_t ip = 0; ip < np; ip++) {
499 xMin = TMath::Min(xMin,px[ip]);
500 xMax = TMath::Max(xMax,px[ip]);
501 yMin = TMath::Min(yMin,py[ip]);
502 yMax = TMath::Max(yMax,py[ip]);
505 if (yd > (Float_t)yMin && yd < (Float_t)yMax) {
507 if (fXDigBox[iMT][ix]->GetFillStyle() == 0) {
509 fXDigBox[iMT][ix]->SetFillStyle(1001);
510 fXDigBox[iMT][ix]->SetFillColor(2);
512 sprintf(cln,"%2d",ix);
514 fXLabelL[iMT][ix]->Clear();
515 fXLabelL[iMT][ix]->AddText(cln);
516 fXLabelL[iMT][ix]->Draw();
518 fXLabelR[iMT][ix]->Clear();
519 fXLabelR[iMT][ix]->AddText(cln);
520 fXLabelR[iMT][ix]->Draw();
522 fXDigBox[iMT][ix]->SetX1(xMin);
523 fXDigBox[iMT][ix]->SetY1(yMin);
524 fXDigBox[iMT][ix]->SetX2(xMax);
525 fXDigBox[iMT][ix]->SetY2(yMax);
527 fXDigBox[iMT][ix]->Draw();
529 } else if (fXDigBox[iMT][ix]->GetFillStyle() == 1001) {
531 fXDigBox[iMT][ix]->SetFillStyle(0);
533 fXLabelL[iMT][ix]->Clear();
534 fXLabelL[iMT][ix]->Draw();
536 fXLabelR[iMT][ix]->Clear();
537 fXLabelR[iMT][ix]->Draw();
539 fXDigBox[iMT][ix]->SetX1(-fBoard->GetXCenter(iMT));
540 fXDigBox[iMT][ix]->SetY1(-fBoard->GetYCenter(iMT));
541 fXDigBox[iMT][ix]->SetX2(-fBoard->GetXCenter(iMT));
542 fXDigBox[iMT][ix]->SetY2(-fBoard->GetYCenter(iMT));
544 fXDigBox[iMT][ix]->Draw();
548 if (!fXDigBox[iMT][ix]->TestBit(kObjInCanvas))
549 fXDigBox[iMT][ix]->Draw();
551 fCanvas[iMT]->Modified();
552 fCanvas[iMT]->Update();
563 for (Int_t iy = 0; iy < fNStripY; iy++) {
565 px = fYDigPL[iMT][iy]->GetX();
566 py = fYDigPL[iMT][iy]->GetY();
572 for (Int_t ip = 0; ip < np; ip++) {
573 xMin = TMath::Min(xMin,px[ip]);
574 xMax = TMath::Max(xMax,px[ip]);
575 yMin = TMath::Min(yMin,py[ip]);
576 yMax = TMath::Max(yMax,py[ip]);
579 if (xd > (Float_t)xMin && xd < (Float_t)xMax) {
581 if (fYDigBox[iMT][iy]->GetFillStyle() == 0) {
583 fYDigBox[iMT][iy]->SetFillStyle(1001);
584 fYDigBox[iMT][iy]->SetFillColor(2);
586 sprintf(cln,"%2d",iy);
588 fYLabelL[iMT][iy]->Clear();
589 fYLabelL[iMT][iy]->AddText(cln);
590 fYLabelL[iMT][iy]->Draw();
592 fYLabelR[iMT][iy]->Clear();
593 fYLabelR[iMT][iy]->AddText(cln);
594 fYLabelR[iMT][iy]->Draw();
596 fYDigBox[iMT][iy]->SetX1(xMin);
597 fYDigBox[iMT][iy]->SetY1(yMin);
598 fYDigBox[iMT][iy]->SetX2(xMax);
599 fYDigBox[iMT][iy]->SetY2(yMax);
601 fYDigBox[iMT][iy]->Draw();
603 } else if (fYDigBox[iMT][iy]->GetFillStyle() == 1001) {
605 fYDigBox[iMT][iy]->SetFillStyle(0);
607 fYLabelL[iMT][iy]->Clear();
608 fYLabelL[iMT][iy]->Draw();
610 fYLabelR[iMT][iy]->Clear();
611 fYLabelR[iMT][iy]->Draw();
613 fYDigBox[iMT][iy]->SetX1(-fBoard->GetXCenter(iMT));
614 fYDigBox[iMT][iy]->SetY1(-fBoard->GetYCenter(iMT));
615 fYDigBox[iMT][iy]->SetX2(-fBoard->GetXCenter(iMT));
616 fYDigBox[iMT][iy]->SetY2(-fBoard->GetYCenter(iMT));
618 fYDigBox[iMT][iy]->Draw();
622 if (!fYDigBox[iMT][iy]->TestBit(kObjInCanvas))
623 fYDigBox[iMT][iy]->Draw();
625 fCanvas[iMT]->Modified();
626 fCanvas[iMT]->Update();
635 } // end button event
641 //__________________________________________________________________________
642 void AliMUONTriggerGUIbdmap::DoDigits()
644 /// set the board digits from GUI input (set/unset)
647 Int_t number = fBoard->GetNumber();
649 pos = fBoard->GetPosition();
650 over = fBoard->GetYOver();
651 AliMUONTriggerGUIboard *board;
653 for (Int_t imt = 0; imt < kNMT; imt++) {
655 for (Int_t ix = 0; ix < fNStripX; ix++) {
656 if (fXDigBox[imt][ix]->GetFillStyle() == 0) {
659 if (fXDigBox[imt][ix]->GetFillStyle() == 1001) {
662 fBoard->SetDigitX(imt,ix,amp);
665 for (Int_t iy = 0; iy < fNStripY; iy++) {
666 if (fYDigBox[imt][iy]->GetFillStyle() == 0) {
669 if (fYDigBox[imt][iy]->GetFillStyle() == 1001) {
672 fBoard->SetDigitY(imt,iy,amp);
675 for (Int_t io = 1; io <= over; io++) {
676 if (io == pos) continue;
677 board = (AliMUONTriggerGUIboard*)fBoards->UncheckedAt(number+io-pos);
678 board->SetDigitY(imt,iy,amp);
687 //__________________________________________________________________________
688 void AliMUONTriggerGUIbdmap::ResetDigits()
690 /// set the board digits from GUI input (set/unset)
693 Int_t number = fBoard->GetNumber();
694 AliMUONTriggerGUIboard *board;
696 pos = fBoard->GetPosition();
697 over = fBoard->GetYOver();
699 for (Int_t imt = 0; imt < kNMT; imt++) {
700 for (Int_t ix = 0; ix < fNStripX; ix++) {
701 fXDigBox[imt][ix]->SetFillStyle(0);
702 fXDigBox[imt][ix]->SetX1(-fBoard->GetXCenter(imt));
703 fXDigBox[imt][ix]->SetY1(-fBoard->GetYCenter(imt));
704 fXDigBox[imt][ix]->SetX2(-fBoard->GetXCenter(imt));
705 fXDigBox[imt][ix]->SetY2(-fBoard->GetYCenter(imt));
707 fBoard->SetDigitX(imt,ix,amp);
709 for (Int_t iy = 0; iy < fNStripY; iy++) {
710 fYDigBox[imt][iy]->SetFillStyle(0);
711 fYDigBox[imt][iy]->SetX1(-fBoard->GetXCenter(imt));
712 fYDigBox[imt][iy]->SetY1(-fBoard->GetYCenter(imt));
713 fYDigBox[imt][iy]->SetX2(-fBoard->GetXCenter(imt));
714 fYDigBox[imt][iy]->SetY2(-fBoard->GetYCenter(imt));
716 fBoard->SetDigitY(imt,iy,amp);
719 for (Int_t io = 1; io <= over; io++) {
720 if (io == pos) continue;
721 board = (AliMUONTriggerGUIboard*)fBoards->UncheckedAt(number+io-pos);
723 board->SetDigitY(imt,iy,amp);
730 fBoard->ClearXDigits();
731 fBoard->ClearYDigits();
734 for (Int_t io = 1; io <= over; io++) {
735 if (io == pos) continue;
736 board = (AliMUONTriggerGUIboard*)fBoards->UncheckedAt(number+io-pos);
737 board->ClearYDigits();
740 fXStrips->SetState(kButtonUp);
741 fYStrips->SetState(kButtonUp);
742 fEditStrips->SetState(kButtonUp);
743 fIsEditable = kFALSE;
751 //__________________________________________________________________________
752 void AliMUONTriggerGUIbdmap::HandleButtons(Int_t id)
754 /// handle the check buttons
757 TGButton *btn = (TGButton *) gTQSender;
758 id = btn->WidgetId();
762 if(fXStrips->GetState() == kButtonDown &&
763 fYStrips->GetState() == kButtonDown ) {
766 DrawStrips(kTRUE,kTRUE);
767 DrawDigits(kTRUE,kTRUE);
774 if(fXStrips->GetState() == kButtonDown &&
775 fYStrips->GetState() == kButtonUp ) {
778 DrawStrips(kTRUE,kFALSE);
779 DrawDigits(kTRUE,kFALSE);
786 if(fXStrips->GetState() == kButtonUp &&
787 fYStrips->GetState() == kButtonDown ) {
790 DrawStrips(kFALSE,kTRUE);
791 DrawDigits(kFALSE,kTRUE);
798 if(fXStrips->GetState() == kButtonUp &&
799 fYStrips->GetState() == kButtonUp ) {
811 //__________________________________________________________________________
812 void AliMUONTriggerGUIbdmap::DrawClear()
814 /// draw the frame of the board image in the canvas
816 for (Int_t i = 0; i < kNMT; i++) {
821 fCanvas[i]->Modified();
822 fCanvas[i]->Update();
828 //__________________________________________________________________________
829 void AliMUONTriggerGUIbdmap::DrawDigits(Bool_t bx, Bool_t by)
831 /// draw the digits in "x" or/and "y"
833 Bool_t drawDigits = kTRUE;
834 Bool_t drawDigitsRaw = kTRUE;
835 if (fLoader == 0x0) {
838 if (fRawDigitStore == 0x0) {
839 drawDigitsRaw = kFALSE;
842 AliMUONTriggerGUIboard *board;
843 Int_t over, pos, number;
844 const AliMpVSegmentation* seg;
846 Int_t cathode, detElemId, ix, iy, charge;
847 Int_t chamber, np = 5;
849 Float_t xpmin, xpmax, ypmin, ypmax;
850 Float_t xg1, xg2, yg1, yg2, zg1;
851 Float_t xdw, ydw, xcw, ycw;
852 Double_t xc1, xc2, yc1, yc2;
855 Double_t xMin, xMax, yMin, yMax;
858 number = fBoard->GetNumber();
859 pos = fBoard->GetPosition();
860 over = fBoard->GetYOver();
862 if (drawDigits || drawDigitsRaw) {
864 for (Int_t i = 0; i < kNMT; i++) {
868 fCanvas[i]->GetRange(xc1,yc1,xc2,yc2);
869 xcw = (Float_t)(0.5*(xc2-xc1));
870 ycw = (Float_t)(0.5*(yc2-yc1));
872 AliMUONVDigitStore *digitStore = 0x0;
873 AliMUONGeometryTransformer transformer;
874 transformer.LoadGeometryData("transform.dat");
877 AliRunLoader *runLoader = fLoader->GetRunLoader();
878 digitStore = fMCDataInterface->DigitStore(runLoader->GetEventNumber());
881 digitStore = static_cast<AliMUONVDigitStore*>(fRawDigitStore);
886 AliMpIntPair deRange = AliMpDEManager::GetDetElemIdRange(chamber-1);
887 TIter next(digitStore->CreateIterator(deRange.GetFirst(),deRange.GetSecond()));
890 while ( ( mdig = static_cast<AliMUONVDigit*>(next())) )
892 cathode = mdig->Cathode();
896 detElemId = mdig->DetElemId();
897 charge = (Int_t)mdig->Charge();
899 Bool_t triggerBgn = kFALSE;
900 Int_t schg = (Int_t)(charge + 0.5);
901 // APPLY CONDITION ON SOFT BACKGROUND
902 Int_t tchg = schg - (Int_t(schg/10))*10;
903 if (schg<=10 || tchg>0) {
909 if (detElemId%100 != fBoard->GetDetElemId()) continue;
911 seg = AliMpSegmentation::Instance()->GetMpSegmentation(detElemId, AliMp::GetCathodType(cathode));
913 pad = seg->PadByIndices(AliMpIntPair(ix,iy),kTRUE);
915 //if (cathode == 0) printf("GUI x: ix %d iy %d \n",ix,iy);
916 //if (cathode == 1) printf("GUI y: ix %d iy %d \n",ix,iy);
918 // get the pad position and dimensions
919 Float_t xlocal1 = pad.Position().X();
920 Float_t ylocal1 = pad.Position().Y();
921 Float_t xlocal2 = pad.Dimensions().X();
922 Float_t ylocal2 = pad.Dimensions().Y();
924 transformer.Local2Global(detElemId, xlocal1, ylocal1, 0, xg1, yg1, zg1);
925 // (no transformation for pad dimensions)
929 // transform in the monitor coordinate system
936 xpmin -= fXCenter[i];
937 xpmax -= fXCenter[i];
938 ypmin -= fYCenter[i];
939 ypmax -= fYCenter[i];
945 if ((xdw > ydw) && bx) {
947 //printf("X strips mdig->Cathode() = %1d \n",mdig->Cathode());
950 iX = fBoard->GetXSix();
951 iY1 = fBoard->GetXSiy1();
952 iY2 = fBoard->GetXSiy2();
953 if (ix == iX && iy >= iY1 && iy <= iY2) {
954 //printf("Digit indices (x-strip) ix = %3d iy = %3d board = %s %d chamber = %2d \n",ix,iy,fBoard->GetBoardName(),fBoard->GetNumber(),chamber);
956 xpmin += 0.01*fXWidth[i];
957 xpmax -= 0.01*fXWidth[i];
961 boxd = new TBox(xpmin,ypmin,xpmax,ypmax);
962 boxd->SetFillStyle(1001);
963 if (triggerBgn) boxd->SetFillColor(6);
964 else boxd->SetFillColor(5);
965 boxd->SetBit(kCannotPick);
968 fXDigBox[i][iy-iY1]->SetFillStyle(1001);
969 fXDigBox[i][iy-iY1]->SetFillColor(2);
970 fXDigBox[i][iy-iY1]->SetX1(xpmin);
971 fXDigBox[i][iy-iY1]->SetY1(ypmin);
972 fXDigBox[i][iy-iY1]->SetX2(xpmax);
973 fXDigBox[i][iy-iY1]->SetY2(ypmax);
974 fXDigBox[i][iy-iY1]->Draw();
976 sprintf(cln,"%2d",(iy-iY1));
977 fXLabelL[i][iy-iY1]->Clear();
978 fXLabelL[i][iy-iY1]->AddText(cln);
979 fXLabelL[i][iy-iY1]->Draw();
980 fXLabelR[i][iy-iY1]->Clear();
981 fXLabelR[i][iy-iY1]->AddText(cln);
982 fXLabelR[i][iy-iY1]->Draw();
984 fBoard->SetDigitX(i,iy-iY1,charge);
991 if ((xdw < ydw) && by) {
993 //printf("Y strips mdig->Cathode() = %1d \n",mdig->Cathode());
996 iX1 = fBoard->GetYSix1();
997 iX2 = fBoard->GetYSix2();
998 iY = fBoard->GetYSiy();
999 if (ix >= iX1 && ix <= iX2 && iy == iY) {
1000 //printf("Digit indices (y-strip) ix = %3d iy = %3d board = %s chamber = %2d \n",ix,iy,fBoard->GetBoardName(),chamber);
1001 ypmin = -0.5*fYWidth[i];
1002 ypmax = +0.5*fYWidth[i];
1004 ypmin = -0.5*fYWidth[i];
1005 ypmax = +0.5*fYWidth[i];
1006 ypmin += 0.01*fYWidth[i];
1007 ypmax -= 0.01*fYWidth[i];
1011 boxd = new TBox(xpmin,ypmin,xpmax,ypmax);
1012 boxd->SetFillStyle(1001);
1013 if (triggerBgn) boxd->SetFillColor(6);
1014 else boxd->SetFillColor(5);
1015 boxd->SetBit(kCannotPick);
1018 fYDigBox[i][ix-iX1]->SetFillStyle(1001);
1019 fYDigBox[i][ix-iX1]->SetFillColor(2);
1020 fYDigBox[i][ix-iX1]->SetX1(xpmin);
1021 fYDigBox[i][ix-iX1]->SetY1(ypmin);
1022 fYDigBox[i][ix-iX1]->SetX2(xpmax);
1023 fYDigBox[i][ix-iX1]->SetY2(ypmax);
1024 fYDigBox[i][ix-iX1]->Draw();
1026 sprintf(cln,"%2d",(ix-iX1));
1027 fYLabelL[i][ix-iX1]->Clear();
1028 fYLabelL[i][ix-iX1]->AddText(cln);
1029 fYLabelL[i][ix-iX1]->Draw();
1030 fYLabelR[i][ix-iX1]->Clear();
1031 fYLabelR[i][ix-iX1]->AddText(cln);
1032 fYLabelR[i][ix-iX1]->Draw();
1034 fBoard->SetDigitY(i,ix-iX1,charge);
1036 // extended y-strips
1037 for (Int_t io = 1; io <= over; io++) {
1038 if (io == pos) continue;
1039 board = (AliMUONTriggerGUIboard*)fBoards->UncheckedAt(number+io-pos);
1040 board->SetDigitY(i,ix-iX1,charge);
1046 } // end digits loop
1048 } // end chamber loop
1053 for (Int_t i = 0; i < kNMT; i++) {
1057 fCanvas[i]->GetRange(xc1,yc1,xc2,yc2);
1058 xcw = (Float_t)(0.5*(xc2-xc1));
1059 ycw = (Float_t)(0.5*(yc2-yc1));
1064 for (ix = 0; ix < fNStripX; ix++) {
1065 //if (fBoard->GetXDig(i,ix) > 0) {
1066 if (fXDigBox[i][ix]->GetFillStyle() == 1001 ||
1067 fBoard->GetXDig(i,ix) > 0) {
1069 px = fXDigPL[i][ix]->GetX();
1070 py = fXDigPL[i][ix]->GetY();
1076 for (Int_t ip = 0; ip < np; ip++) {
1077 xMin = TMath::Min(xMin,px[ip]);
1078 xMax = TMath::Max(xMax,px[ip]);
1079 yMin = TMath::Min(yMin,py[ip]);
1080 yMax = TMath::Max(yMax,py[ip]);
1083 if (fXDigBox[i][ix]->GetFillStyle() == 0) {
1084 fXDigBox[i][ix]->SetFillStyle(1001);
1085 fXDigBox[i][ix]->SetFillColor(2);
1086 fXDigBox[i][ix]->SetX1(xMin);
1087 fXDigBox[i][ix]->SetY1(yMin);
1088 fXDigBox[i][ix]->SetX2(xMax);
1089 fXDigBox[i][ix]->SetY2(yMax);
1092 sprintf(cln,"%2d",ix);
1094 fXLabelL[i][ix]->Clear();
1095 fXLabelL[i][ix]->AddText(cln);
1096 fXLabelL[i][ix]->Draw();
1098 fXLabelR[i][ix]->Clear();
1099 fXLabelR[i][ix]->AddText(cln);
1100 fXLabelR[i][ix]->Draw();
1102 fXDigBox[i][ix]->Draw();
1113 for (iy = 0; iy < fNStripY; iy++) {
1114 //if (fBoard->GetYDig(i,iy) > 0) {
1115 if (fYDigBox[i][iy]->GetFillStyle() == 1001 ||
1116 fBoard->GetYDig(i,iy) > 0) {
1118 px = fYDigPL[i][iy]->GetX();
1119 py = fYDigPL[i][iy]->GetY();
1125 for (Int_t ip = 0; ip < np; ip++) {
1126 xMin = TMath::Min(xMin,px[ip]);
1127 xMax = TMath::Max(xMax,px[ip]);
1128 yMin = TMath::Min(yMin,py[ip]);
1129 yMax = TMath::Max(yMax,py[ip]);
1132 if (fYDigBox[i][iy]->GetFillStyle() == 0) {
1133 fYDigBox[i][iy]->SetFillStyle(1001);
1134 fYDigBox[i][iy]->SetFillColor(2);
1135 fYDigBox[i][iy]->SetX1(xMin);
1136 fYDigBox[i][iy]->SetY1(yMin);
1137 fYDigBox[i][iy]->SetX2(xMax);
1138 fYDigBox[i][iy]->SetY2(yMax);
1141 sprintf(cln,"%2d",iy);
1143 fYLabelL[i][iy]->Clear();
1144 fYLabelL[i][iy]->AddText(cln);
1145 fYLabelL[i][iy]->Draw();
1147 fYLabelR[i][iy]->Clear();
1148 fYLabelR[i][iy]->AddText(cln);
1149 fYLabelR[i][iy]->Draw();
1151 fYDigBox[i][iy]->Draw();
1159 fCanvas[i]->Modified();
1160 fCanvas[i]->Update();
1162 } // end canvas (chamber) loop
1168 //__________________________________________________________________________
1169 void AliMUONTriggerGUIbdmap::DrawStrips(Bool_t bx, Bool_t by)
1171 /// draw the "x" or/and "y" strips
1173 AliMUONGeometryTransformer transformer;
1174 transformer.LoadGeometryData("transform.dat");
1176 const AliMpVSegmentation* seg;
1180 Float_t xg1, xg2, yg1, yg2, zg1;
1181 Float_t xlocal1, xlocal2, ylocal1, ylocal2;
1182 Int_t detElemId, maxX, maxY;
1183 Float_t xdw, ydw, xpmin, xpmax, ypmin, ypmax;
1184 Float_t ptx1, ptx2, pty1, pty2;
1186 Double_t xc1, xc2, yc1, yc2;
1189 Bool_t makeLabelsX = kFALSE;
1190 Bool_t makeLabelsY = kFALSE;
1192 if (bx && !fLabelX) {
1193 makeLabelsX = kTRUE;
1197 if (by && !fLabelY) {
1198 makeLabelsY = kTRUE;
1202 for (Int_t i = 0; i < kNMT; i++) {
1206 fCanvas[i]->GetRange(xc1,yc1,xc2,yc2);
1207 xcw = (Float_t)(0.5*(xc2-xc1));
1208 ycw = (Float_t)(0.5*(yc2-yc1));
1212 for ( it.First(chamber-1); ! it.IsDone(); it.Next() ) {
1214 detElemId = it.CurrentDEId();
1216 if (detElemId%100 != fBoard->GetDetElemId()) continue;
1218 /*---------- y-pads ic = 1 ----------*/
1220 seg = AliMpSegmentation::Instance()->GetMpSegmentation(detElemId, AliMp::kCath1);
1222 maxX = seg->MaxPadIndexX();
1223 maxY = seg->MaxPadIndexY();
1225 for (Int_t ix = 0; ix <= maxX; ix++) {
1226 for (Int_t iy = 0; iy <= maxY; iy++) {
1228 pad = seg->PadByIndices(AliMpIntPair(ix,iy),kFALSE);
1230 if (!pad.IsValid()) continue;
1232 // get the pad position and dimensions
1233 xlocal1 = pad.Position().X();
1234 ylocal1 = pad.Position().Y();
1235 xlocal2 = pad.Dimensions().X();
1236 ylocal2 = pad.Dimensions().Y();
1238 transformer.Local2Global(detElemId, xlocal1, ylocal1, 0, xg1, yg1, zg1);
1239 // (no transformation for pad dimensions)
1243 // transform in the monitor coordinate system
1250 xpmin -= fXCenter[i];
1251 xpmax -= fXCenter[i];
1252 ypmin -= fYCenter[i];
1253 ypmax -= fYCenter[i];
1261 Int_t iX1, iX2, iY, ixDig;
1262 iX1 = fBoard->GetYSix1();
1263 iX2 = fBoard->GetYSix2();
1264 iY = fBoard->GetYSiy();
1265 if (ix >= iX1 && ix <= iX2 && iy == iY) {
1267 ypmin = -0.5*fYWidth[i];
1268 ypmax = +0.5*fYWidth[i];
1270 ypmin += 0.01*fYWidth[i];
1271 ypmax -= 0.01*fYWidth[i];
1276 fYDigPL[i][ixDig]->SetPoint(0,xpmin,ypmin);
1277 fYDigPL[i][ixDig]->SetPoint(1,xpmax,ypmin);
1278 fYDigPL[i][ixDig]->SetPoint(2,xpmax,ypmax);
1279 fYDigPL[i][ixDig]->SetPoint(3,xpmin,ypmax);
1280 fYDigPL[i][ixDig]->SetPoint(4,xpmin,ypmin);
1281 fYDigPL[i][ixDig]->Draw();
1283 fYDigBox[i][ixDig]->SetFillStyle(1001);
1284 fYDigBox[i][ixDig]->SetFillColor(5);
1285 fYDigBox[i][ixDig]->DrawBox(xpmin,ypmin,xpmax,ypmax);
1288 sprintf(cln,"%2d",(ix-iX1));
1292 pty1 = 1.065*ypmin - 0.04*ycw;
1293 pty2 = 1.065*ypmin + 0.04*ycw;
1294 fYLabelL[i][ix-iX1] = new TPaveText(ptx1,pty1,ptx2,pty2);
1295 fYLabelL[i][ix-iX1]->SetBorderSize(0);
1296 fYLabelL[i][ix-iX1]->SetBit(kCannotPick);
1298 pty1 = 1.065*ypmax - 0.04*ycw;
1299 pty2 = 1.065*ypmax + 0.04*ycw;
1300 fYLabelR[i][ix-iX1] = new TPaveText(ptx1,pty1,ptx2,pty2);
1301 fYLabelR[i][ix-iX1]->SetBorderSize(0);
1302 fYLabelR[i][ix-iX1]->SetBit(kCannotPick);
1313 /*---------- x-pads ic = 0 ----------*/
1315 seg = AliMpSegmentation::Instance()->GetMpSegmentation(detElemId, AliMp::kCath0);
1317 maxX = seg->MaxPadIndexX();
1318 maxY = seg->MaxPadIndexY();
1320 for (Int_t ix = 0; ix <= maxX; ix++) {
1321 for (Int_t iy = 0; iy <= maxY; iy++) {
1323 pad = seg->PadByIndices(AliMpIntPair(ix,iy),kFALSE);
1325 if (!pad.IsValid()) continue;
1327 // get the pad position and dimensions
1328 xlocal1 = pad.Position().X();
1329 ylocal1 = pad.Position().Y();
1330 xlocal2 = pad.Dimensions().X();
1331 ylocal2 = pad.Dimensions().Y();
1333 transformer.Local2Global(detElemId, xlocal1, ylocal1, 0, xg1, yg1, zg1);
1334 // (no transformation for pad dimensions)
1338 // transform in the monitor coordinate system
1345 xpmin -= fXCenter[i];
1346 xpmax -= fXCenter[i];
1347 ypmin -= fYCenter[i];
1348 ypmax -= fYCenter[i];
1355 Int_t iX, iY1, iY2, iyDig;
1356 iX = fBoard->GetXSix();
1357 iY1 = fBoard->GetXSiy1();
1358 iY2 = fBoard->GetXSiy2();
1359 if (ix == iX && iy >= iY1 && iy <= iY2) {
1361 xpmin += 0.01*fXWidth[i];
1362 xpmax -= 0.01*fXWidth[i];
1367 fXDigPL[i][iyDig]->SetPoint(0,xpmin,ypmin);
1368 fXDigPL[i][iyDig]->SetPoint(1,xpmax,ypmin);
1369 fXDigPL[i][iyDig]->SetPoint(2,xpmax,ypmax);
1370 fXDigPL[i][iyDig]->SetPoint(3,xpmin,ypmax);
1371 fXDigPL[i][iyDig]->SetPoint(4,xpmin,ypmin);
1372 fXDigPL[i][iyDig]->Draw();
1374 fXDigBox[i][iyDig]->SetFillStyle(1001);
1375 fXDigBox[i][iyDig]->SetFillColor(5);
1376 fXDigBox[i][iyDig]->DrawBox(xpmin,ypmin,xpmax,ypmax);
1379 sprintf(cln,"%2d",(iy-iY1));
1383 ptx1 = 1.065*xpmin - 0.04*xcw;
1384 ptx2 = 1.065*xpmin + 0.04*xcw;
1385 fXLabelL[i][iy-iY1] = new TPaveText(ptx1,pty1,ptx2,pty2);
1386 fXLabelL[i][iy-iY1]->SetBorderSize(0);
1387 fXLabelL[i][iy-iY1]->SetBit(kCannotPick);
1389 ptx1 = 1.065*xpmax - 0.04*xcw;
1390 ptx2 = 1.065*xpmax + 0.04*xcw;
1391 fXLabelR[i][iy-iY1] = new TPaveText(ptx1,pty1,ptx2,pty2);
1392 fXLabelR[i][iy-iY1]->SetBorderSize(0);
1393 fXLabelR[i][iy-iY1]->SetBit(kCannotPick);
1406 fCanvas[i]->Modified();
1407 fCanvas[i]->Update();
1415 //__________________________________________________________________________
1416 void AliMUONTriggerGUIbdmap::CloseWindow() const
1418 /// close dialog in response to window manager close.
1424 //__________________________________________________________________________
1425 void AliMUONTriggerGUIbdmap::DoClose()
1427 /// handle Close button.
1429 fBoard->SetOpen(kFALSE);
1430 TTimer::SingleShot(150,"AliMUONTriggerGUIbdmap",this,"CloseWindow()");