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 AliMUONTriggerGUI
20 /// Graphical User Interface utility class for the MUON trigger detector
21 /// It creates, after initialisation with a data file, a sensitive map
22 /// of the trigger boards
23 /// \author Bogdan Vulpescu, LPC Clermont-Ferrand
24 //-----------------------------------------------------------------------------
26 #include "AliMUONTriggerGUI.h"
27 #include "AliMUONTriggerGUIboard.h"
28 #include "AliMUONTriggerGUIdimap.h"
29 #include "AliMUONTriggerGUIbdmap.h"
31 #include "AliMpSegmentation.h"
32 #include "AliMpVSegmentation.h"
34 #include "AliMpIntPair.h"
36 #include "AliMpDEIterator.h"
37 #include "AliMUONGeometryTransformer.h"
38 #include "AliMUONTriggerCrateStore.h"
39 #include "AliMUONLocalTriggerBoard.h"
40 #include "AliMUONTriggerElectronics.h"
41 #include "AliMUONCalibrationData.h"
44 #include "AliRunLoader.h"
45 #include "AliCDBManager.h"
50 #include <TApplication.h>
51 #include <TGDimension.h>
54 #include <TGTextEntry.h>
57 #include <TGImageMap.h>
58 #include <TGTextBuffer.h>
61 ClassImp(AliMUONTriggerGUI)
64 //__________________________________________________________________________
65 AliMUONTriggerGUI::AliMUONTriggerGUI()
92 /// main GUI frame of the trigger monitor
101 fFileName = new TString("");
102 fEvString = new TString("");
103 fPath = new TString("");
105 fTriggerProcessor = 0;
107 fCDBManager = AliCDBManager::Instance();
108 fCDBManager->SetDefaultStorage("local://$ALICE_ROOT");
109 fCalibrationData = new AliMUONCalibrationData(0); // runnumber zero
113 fMain = new TGMainFrame(gClient->GetRoot(), 750, 420);
114 fMain->Connect("CloseWindow()", "AliMUONTriggerGUI", this, "CloseWindow()");
118 TGMenuBar *menuBar = new TGMenuBar(fMain);
122 TGPopupMenu *menuFile = new TGPopupMenu(gClient->GetRoot());
123 //menuFile->AddLabel("");
125 menuFile->AddEntry("Run", kMFILERUN);
126 menuFile->AddEntry("Control", kMFILECNTRL);
127 menuFile->AddEntry("Exit", kMFILEEXIT);
129 menuFile->Connect("Activated(Int_t)", "AliMUONTriggerGUI", this, "HandleMenu(Int_t)");
133 TGPopupMenu *menuCircuit = new TGPopupMenu(gClient->GetRoot());
134 //menuCircuit->AddLabel("");
136 menuCircuit->AddEntry("Open", kMCIRCUITOPEN);
138 menuCircuit->Connect("Activated(Int_t)", "AliMUONTriggerGUI", this, "HandleMenu(Int_t)");
142 TGPopupMenu *menuMap = new TGPopupMenu(gClient->GetRoot());
143 //menuMap->AddLabel("");
145 menuMap->AddEntry("Digits map", kMMAPDIGITS);
146 menuMap->AddEntry("Reset digits", kMRESETDIGITS);
148 menuMap->Connect("Activated(Int_t)", "AliMUONTriggerGUI", this,
149 "HandleMenu(Int_t)");
153 TGPopupMenu *menuTrigger = new TGPopupMenu(gClient->GetRoot());
154 //menuTrigger->AddLabel("");
156 menuTrigger->AddEntry("Trigger DSET", kMTRIGGERDSET);
158 menuTrigger->Connect("Activated(Int_t)", "AliMUONTriggerGUI", this, "HandleMenu(Int_t)");
160 // Add menus to the menu bar
162 menuBar->AddPopup("File", menuFile,
163 new TGLayoutHints(kLHintsTop | kLHintsLeft, 5,5,2,2)
166 menuBar->AddPopup("Maps", menuMap,
167 new TGLayoutHints(kLHintsTop | kLHintsLeft, 5,5,2,2)
170 menuBar->AddPopup("Circuit", menuCircuit,
171 new TGLayoutHints(kLHintsTop | kLHintsLeft, 5,5,2,2)
174 menuBar->AddPopup("Trigger", menuTrigger,
175 new TGLayoutHints(kLHintsTop | kLHintsLeft, 5,5,2,2)
178 // Add menu bar to the main frame
180 fMain->AddFrame(menuBar,
181 new TGLayoutHints(kLHintsTop |
189 fImageMap = new TGImageMap(fMain,"$ALICE_ROOT/MUON/data/guimap.gif");
191 fImageMap->Connect("RegionClicked(Int_t)", "AliMUONTriggerGUI", this, "OpenBoard(Int_t)");
193 fImageMap->SetToolTipText("Map of the local boards as seen from the I.P.");
195 // Add image map to the main frame
197 fMain->AddFrame(fImageMap);
198 fMain->SetWindowName("Map of the local boards as seen from the I.P.");
200 // Resize the main frame
202 TGDimension size = fMain->GetDefaultSize();
205 fMain->MapSubwindows();
209 fBoardsInit = kFALSE;
211 //HandleMenu(kMFILERUN); // temporary
218 //__________________________________________________________________________
219 void AliMUONTriggerGUI::HandleMenu(Int_t id)
221 /// handles entry numbers in the available menus (EMenuIdentifiers)
223 TGCompositeFrame *runInput1, *runInput2, *runInput3;
224 TGCompositeFrame *control1, *control2, *circuit1, *circuit2;
225 TGLabel *runL1, *runL2, *circuitL1;
226 TGTextEntry *runText1, *runText2, *circuitText1;
227 TGTextButton *runApply, *runCancel;
228 TGTextButton *controlClose, *nextEvent, *previousEvent, *skipToEvent;
229 TGTextButton *circuitCancel, *circuitOpen;
231 //Int_t trigInfo[kNBoards*6] = {-1};
232 //Int_t nLocalTrigger = 0;
234 TString error = TString("");
235 if (id != kMFILEEXIT && id != kMFILERUN && fRunLoader == 0) {
236 error.Append("Run not initialized (Menu: File/Run)");
237 DoErrorGUI(error.Data());
253 fRunInput = new TGTransientFrame(gClient->GetRoot(), fMain, 400, 200);
254 fRunInput->Connect("CloseWindow()", "AliMUONTriggerGUI", this, "CloseRunInput()");
255 fRunInput->DontCallClose(); // to avoid double deletions.
257 // use hierarchical cleaning
258 fRunInput->SetCleanup(kDeepCleanup);
260 fRunInput->SetWindowName("Input file and event number");
262 // input galice and event number frames
264 runInput1 = new TGCompositeFrame(fRunInput, 400, 200, kHorizontalFrame);
265 runInput2 = new TGCompositeFrame(fRunInput, 400, 200, kHorizontalFrame);
269 runL1 = new TGLabel(runInput1, new TGString("Path to gAlice:"));
270 runL2 = new TGLabel(runInput2, new TGString("Event number:"));
274 runText1 = new TGTextEntry(runInput1, fTxtBuffer1 = new TGTextBuffer(100));
276 //fPath->Append("dset"); // temporary
277 //fTxtBuffer1->AddText(0,fPath->Data()); // temporary
279 runText1->SetToolTipText("Enter the path to galice.root");
280 runText1->Resize(300, runText1->GetDefaultHeight());
282 // event number text entry
284 runText2 = new TGTextEntry(runInput2, fTxtBuffer2 = new TGTextBuffer(5));
286 fEvString->Form("%d",0);
287 fTxtBuffer2->AddText(0,fEvString->Data());
289 runText2->SetToolTipText("Enter the first event number to start with");
290 runText2->Resize(300, runText2->GetDefaultHeight());
292 // add to galice frame
294 runInput1->AddFrame(runL1,
295 new TGLayoutHints(kLHintsLeft |
300 runInput1->AddFrame(runText1,
301 new TGLayoutHints(kLHintsRight |
306 // add to event number frame
308 runInput2->AddFrame(runL2,
309 new TGLayoutHints(kLHintsLeft |
314 runInput2->AddFrame(runText2,
315 new TGLayoutHints(kLHintsRight |
320 // add input frames to main input frame
322 fRunInput->AddFrame(runInput1,
323 new TGLayoutHints(kLHintsTop | kLHintsExpandX, 2, 2, 3, 0));
325 fRunInput->AddFrame(runInput2,
326 new TGLayoutHints(kLHintsTop | kLHintsExpandX, 2, 2, 3, 0));
328 // frame with buttons
330 runInput3 = new TGCompositeFrame(fRunInput, 400, 200, kHorizontalFrame);
334 runApply = new TGTextButton(runInput3, "Apply", 1);
335 runApply->Connect("Clicked()", "AliMUONTriggerGUI", this, "DoRunApply()");
336 runApply->SetToolTipText("Apply changes");
338 runCancel = new TGTextButton(runInput3, "Cancel", 2);
339 runCancel->Connect("Clicked()", "AliMUONTriggerGUI", this, "DoRunCancel()"); runCancel->SetToolTipText("Cancel changes");
343 runInput3->AddFrame(runApply,
344 new TGLayoutHints(kLHintsTop |
349 runInput3->AddFrame(runCancel,
350 new TGLayoutHints(kLHintsTop |
355 // add to the main input frame
357 fRunInput->AddFrame(runInput3,
358 new TGLayoutHints(kLHintsTop |
363 fRunInput->MapSubwindows();
365 fRunInput->MapWindow();
367 //DoRunApply(); // temporary
373 // control main frame
375 fControl = new TGTransientFrame(gClient->GetRoot(), fMain, 50, 50);
376 fControl->Connect("CloseWindow()", "AliMUONTriggerGUI", this, "CloseControl()");
377 fControl->DontCallClose(); // to avoid double deletions.
379 // use hierarchical cleaning
380 fControl->SetCleanup(kDeepCleanup);
382 fControl->SetWindowName("Run controls");
384 // frame to hold buttons
386 control1 = new TGCompositeFrame(fControl, 50, 50, kVerticalFrame);
390 controlClose = new TGTextButton(control1, "Close", 1);
391 controlClose->Connect("Clicked()", "AliMUONTriggerGUI", this, "DoControlClose()");
392 //controlClose->Resize(300, controlClose->GetDefaultHeight());
394 nextEvent = new TGTextButton(control1, "Next event", 2);
395 nextEvent->Connect("Clicked()", "AliMUONTriggerGUI", this, "DoNextEvent()");
397 previousEvent = new TGTextButton(control1, "Previous event", 3);
398 previousEvent->Connect("Clicked()", "AliMUONTriggerGUI", this, "DoPreviousEvent()");
400 // frame to hold event skip
402 control2 = new TGCompositeFrame(fControl, 50, 50, kHorizontalFrame);
404 // skip to event text field
406 fSkipToEventTxt = new TGTextEntry(control2, fTxtBuffer2 = new TGTextBuffer(5));
408 fTxtBuffer2->AddText(0,fEvString->Data());
410 // skip to event button
412 skipToEvent = new TGTextButton(control2, "Skip to event", 1);
413 skipToEvent->Connect("Clicked()", "AliMUONTriggerGUI", this, "DoSkipToEvent()");
415 // add to event skip frame
417 control2->AddFrame(fSkipToEventTxt,
418 new TGLayoutHints(kLHintsTop |
423 control2->AddFrame(skipToEvent,
424 new TGLayoutHints(kLHintsTop |
431 control1->AddFrame(controlClose,
432 new TGLayoutHints(kLHintsBottom |
437 control1->AddFrame(nextEvent,
438 new TGLayoutHints(kLHintsBottom |
443 control1->AddFrame(previousEvent,
444 new TGLayoutHints(kLHintsBottom |
449 // add to the main frame
451 fControl->AddFrame(control1,
452 new TGLayoutHints(kLHintsBottom |
458 fControl->AddFrame(control2,
459 new TGLayoutHints(kLHintsTop |
464 fControl->MapSubwindows();
466 fControl->MapWindow();
473 fDiMap = new AliMUONTriggerGUIdimap(fLoader,fBoards,gClient->GetRoot(), fMain, 400, 200);
474 } else if (!fDiMap->IsOn()) {
475 fDiMap = new AliMUONTriggerGUIdimap(fLoader,fBoards,gClient->GetRoot(), fMain, 400, 200);
482 Int_t number, over, pos;
483 for (Int_t ib = 0; ib < kNBoards; ib++) {
484 AliMUONTriggerGUIboard *board = GetBoard(ib);
485 board->ClearXDigits();
486 board->ClearYDigits();
488 number = board->GetNumber();
489 pos = board->GetPosition();
490 over = board->GetYOver();
491 for (Int_t io = 1; io <= over; io++) {
492 if (io == pos) continue;
493 board = GetBoard(number+io-pos);
494 board->ClearYDigits();
502 fCircuit = new TGTransientFrame(gClient->GetRoot(), fMain, 50, 50);
503 fCircuit->Connect("CloseWindow()", "AliMUONTriggerGUI", this, "CloseCircuit()");
504 fCircuit->DontCallClose(); // to avoid double deletions.
506 // use hierarchical cleaning
507 fCircuit->SetCleanup(kDeepCleanup);
509 fCircuit->SetWindowName("Board circuit");
513 circuit1 = new TGCompositeFrame(fCircuit, 400, 200, kHorizontalFrame);
514 circuit2 = new TGCompositeFrame(fCircuit, 400, 200, kHorizontalFrame);
518 circuitL1 = new TGLabel(circuit1, new TGString("Circuit number:"));
522 circuitText1 = new TGTextEntry(circuit1, fTxtCircuit = new TGTextBuffer(10));
525 circuitCancel = new TGTextButton(circuit2, "Cancel", 1);
526 circuitCancel->Connect("Clicked()", "AliMUONTriggerGUI", this, "DoCircuitCancel()");
527 //circuitCancel->Resize(100, circuitCancel->GetDefaultHeight());
529 circuitOpen = new TGTextButton(circuit2, "Open", 2);
530 circuitOpen->Connect("Clicked()", "AliMUONTriggerGUI", this, "DoCircuitOpen()");
531 //circuitOpen->Resize(100, circuitOpen->GetDefaultHeight());
535 circuit1->AddFrame(circuitL1,
536 new TGLayoutHints(kLHintsLeft |
541 circuit1->AddFrame(circuitText1,
542 new TGLayoutHints(kLHintsRight |
547 circuit2->AddFrame(circuitCancel,
548 new TGLayoutHints(kLHintsBottom |
553 circuit2->AddFrame(circuitOpen,
554 new TGLayoutHints(kLHintsBottom |
559 fCircuit->AddFrame(circuit1,
560 new TGLayoutHints(kLHintsTop | kLHintsExpandX, 2, 2, 3, 0));
562 fCircuit->AddFrame(circuit2,
563 new TGLayoutHints(kLHintsTop | kLHintsExpandX, 2, 2, 3, 0));
565 fCircuit->MapSubwindows();
567 fCircuit->MapWindow();
573 cout << "Trigger with boards digits....." << endl;
574 fTriggerProcessor->FeedBoardsGUI(Boards());
576 nLocalTrigger = fTriggerProcessor->TriggerGUI(trigInfo,kTRUE);
578 cout << "Trigger done with " << nLocalTrigger << " local decisions !" << endl;
580 for (Int_t ilo = 0; ilo < nLocalTrigger; ilo++) {
582 cout << "Local decision " << ilo << endl;
583 cout << "Circuit = " << trigInfo[6*ilo+0] << endl;
584 cout << "LoStripX = " << trigInfo[6*ilo+1] << endl;
585 cout << "LoStripY = " << trigInfo[6*ilo+2] << endl;
586 cout << "LoDev = " << trigInfo[6*ilo+3] << endl;
587 cout << "LoLpt = " << trigInfo[6*ilo+4] << endl;
588 cout << "LoHpt = " << trigInfo[6*ilo+5] << endl;
595 printf("Menu item %d selected\n", id);
602 //__________________________________________________________________________
603 void AliMUONTriggerGUI::CloseRunInput() const
605 /// close the run input frame
611 //__________________________________________________________________________
612 void AliMUONTriggerGUI::CloseError() const
614 /// close the error frame
620 //__________________________________________________________________________
621 void AliMUONTriggerGUI::CloseControl() const
623 /// close the event control frame
627 //gSystem->Exec("cd $PWD/mtrun; aliroot -b -q mtsim.C");
631 //__________________________________________________________________________
632 void AliMUONTriggerGUI::CloseCircuit() const
634 /// close the circuit frame
640 //__________________________________________________________________________
641 void AliMUONTriggerGUI::CloseWindow()
643 /// close the main frame and exit aplication
647 gApplication->Terminate();
651 //__________________________________________________________________________
652 void AliMUONTriggerGUI::DoRunApply()
654 /// apply changes in the run control frame
656 printf("Input 1 = %s \n",fTxtBuffer1->GetString());
658 TString es = TString(fTxtBuffer2->GetString());
661 printf("Input 2 = %s event = %d \n",fTxtBuffer2->GetString(),fEvent);
663 TString error = TString("");;
665 fPath->Form("%s",fTxtBuffer1->GetString());
666 fFileName->Form("%s",fTxtBuffer1->GetString());
667 printf("File location: %s \n",fFileName->Data());
669 if (gSystem->AccessPathName(fFileName->Data()) || !fFileName->EndsWith(".root")) {
671 error.Append("No galice file: ");
672 error.Append(fFileName->Data());
673 DoErrorGUI(error.Data());
677 TFile *ftest = new TFile(fFileName->Data(),"READ");
678 AliRun *galice = (AliRun*)ftest->Get("gAlice");
684 error.Append("No gAlice in file: ");
685 error.Append(fFileName->Data());
686 DoErrorGUI(error.Data());
695 if (fRunLoader) delete fRunLoader;
697 fRunLoader = AliRunLoader::Open(fFileName->Data(),"MUONFolder","READ");
699 if (fRunLoader == 0x0) {
701 DoErrorGUI("No run loader !");
705 fRunLoader->LoadgAlice();
706 gAlice = fRunLoader->GetAliRun();
707 fEventsPerRun = gAlice->GetEventsPerRun();
709 fLoader = fRunLoader->GetLoader("MUONLoader");
710 fLoader->LoadDigits("READ");
711 fRunLoader->GetEvent(fEvent);
713 fRunInput->SendCloseMessage();
720 if (fDiMap->IsOn()) {
721 fDiMap->SetLoader(fLoader);
725 //fTriggerProcessor = new AliMUONTriggerElectronics(fCalibrationData);
732 //__________________________________________________________________________
733 void AliMUONTriggerGUI::DoRunCancel()
735 /// cancel the changes in the run control frame
737 printf("Input 1 = %s \n",fTxtBuffer1->GetString());
739 TString es = TString(fTxtBuffer2->GetString());
742 printf("Input 2 = %s event = %d \n",fTxtBuffer2->GetString(),fEvent);
744 fRunInput->SendCloseMessage();
748 //__________________________________________________________________________
749 void AliMUONTriggerGUI::DoErrorGUI(const Char_t *wt)
751 /// show an error message in a new frame
753 fError = new TGTransientFrame(gClient->GetRoot(), fMain, 50, 50);
754 fError->Connect("CloseWindow()", "AliMUONTriggerGUI", this, "CloseError()");
755 fError->DontCallClose(); // to avoid double deletions.
757 // use hierarchical cleaning
758 fError->SetCleanup(kDeepCleanup);
760 fError->SetWindowName("Error !");
762 TGCompositeFrame *fW = new TGCompositeFrame(fError, 50, 50, kVerticalFrame);
764 TGTextButton *fErrorOK = new TGTextButton(fW, "&Ok", 1);
765 fErrorOK->Connect("Clicked()", "AliMUONTriggerGUI", this, "DoErrorOK()");
767 fW->AddFrame(fErrorOK,
768 new TGLayoutHints(kLHintsBottom |
773 TGLabel *fWL = new TGLabel(fW, new TGString(wt));
776 new TGLayoutHints(kLHintsTop |
782 new TGLayoutHints(kLHintsLeft |
787 fError->MapSubwindows();
793 //__________________________________________________________________________
794 void AliMUONTriggerGUI::DoNextEvent()
796 /// load next event from the file
798 TString error = TString("");
800 if (fEvent < (fEventsPerRun-1)) {
802 fRunLoader->GetEvent(fEvent);
804 fEvString->Form("%d",fEvent);
805 fTxtBuffer2->RemoveText(0,5);
806 fTxtBuffer2->AddText(0,fEvString->Data());
807 fSkipToEventTxt->SetFocus();
810 error.Form("Only %d event(s) in the run !",fEventsPerRun);
811 DoErrorGUI(error.Data());
816 //__________________________________________________________________________
817 void AliMUONTriggerGUI::DoPreviousEvent()
819 /// load previous event from the input file
821 TString error = TString("");
825 fRunLoader->GetEvent(fEvent);
827 fEvString->Form("%d",fEvent);
828 fTxtBuffer2->RemoveText(0,5);
829 fTxtBuffer2->AddText(0,fEvString->Data());
830 fSkipToEventTxt->SetFocus();
833 error.Form("Already at event 0 !");
834 DoErrorGUI(error.Data());
839 //__________________________________________________________________________
840 void AliMUONTriggerGUI::DoSkipToEvent()
842 /// skip to event -input- from the input file
844 TString error = TString("");
846 TString es = TString(fTxtBuffer2->GetString());
849 if (fEvent < 0 || fEvent > (fEventsPerRun-1)) {
850 error.Form("Event number out of range !");
851 DoErrorGUI(error.Data());
853 fRunLoader->GetEvent(fEvent);
855 fRunLoader->LoadKinematics();
857 AliStack* stack = gAlice->Stack();
858 Int_t nParticles = stack->GetNtrack();
859 Int_t nPrimaries = stack->GetNprimary();
864 Double_t px, py, pz, theta, phi;
865 for (Int_t i = 0; i < nPrimaries; i++) {
866 part = stack->Particle(i);
868 if (TMath::Abs(part->GetPdgCode()) == 13) {
870 pdgCode = part->GetPdgCode();
874 theta = part->Theta();
876 printf("Kine %d px %f py %f pz %f th %f ph %f \n",pdgCode,px,py,pz,theta,phi);
884 //__________________________________________________________________________
885 void AliMUONTriggerGUI::DoErrorOK()
887 /// close the error frame
889 fError->SendCloseMessage();
893 //__________________________________________________________________________
894 void AliMUONTriggerGUI::DoControlClose()
896 /// close the event control frame
898 fControl->SendCloseMessage();
902 //__________________________________________________________________________
903 void AliMUONTriggerGUI::DoCircuitCancel()
905 /// close the circuit frame
907 fCircuit->SendCloseMessage();
911 //__________________________________________________________________________
912 void AliMUONTriggerGUI::DoCircuitOpen()
916 TString cs = TString(fTxtCircuit->GetString());
917 Int_t icirc = cs.Atoi();
919 AliMUONTriggerGUIboard *board;
921 for (Int_t ib = 0; ib < kNBoards; ib++) {
923 board = GetBoard(ib);
925 if (board->GetIdCircuit() == icirc) {
930 if (fDiMap->IsOn()) {
931 fDiMap->SelectBoard(ib);
935 fCircuit->SendCloseMessage();
943 //__________________________________________________________________________
944 AliMUONTriggerGUIboard* AliMUONTriggerGUI::GetBoard(Int_t id) const
946 /// return board with "id"
948 if (fBoards == 0) return 0;
949 void * b = fBoards->UncheckedAt(id);
950 if (b == 0) return 0;
952 return (AliMUONTriggerGUIboard*)b;
956 //__________________________________________________________________________
957 void AliMUONTriggerGUI::OpenBoard(Int_t id)
959 /// open board with "id" in a new frame
961 AliMUONTriggerGUIboard *board = GetBoard(id);
962 UShort_t status = board->GetStatus();
963 board->SetOpen(kTRUE);
965 AliMUONTriggerGUIbdmap *bf;
968 bf = new AliMUONTriggerGUIbdmap(gClient->GetRoot(), fMain, 400, 200);
970 if (status & kGood) {
971 sprintf(text,"%s (Circuit %4d) status : working",
972 board->GetBoardName(),board->GetIdCircuit());
975 if (status & kWithProblems) {
976 sprintf(text,"%s (Circuit %4d) status : has problems...",
977 board->GetBoardName(),board->GetIdCircuit());
980 if (status & kNotWorking) {
981 sprintf(text,"%s (Circuit %4d) status : not working",
982 board->GetBoardName(),board->GetIdCircuit());
985 if (status & kUnknown) {
986 sprintf(text,"%s (Circuit %4d) status : unknown",
987 board->GetBoardName(),board->GetIdCircuit());
991 bf->SetBoard(Boards(),id);
992 bf->SetLoader(fLoader);
998 if (fDiMap->IsOn()) {
999 fDiMap->SelectBoard(id);
1005 //__________________________________________________________________________
1006 void AliMUONTriggerGUI::Init()
1008 /// initialize the main GUI frame
1015 AliMUONTriggerGUIboard *board;
1016 for (Int_t ib = 0; ib < kNBoards; ib++) {
1017 board = GetBoard(ib);
1023 //__________________________________________________________________________
1024 void AliMUONTriggerGUI::InitBoards()
1026 /// create board objects and define the sensitive regions in the image map
1028 fBoardsInit = kTRUE;
1030 AliMUONTriggerCrateStore* crateManager = new AliMUONTriggerCrateStore();
1031 crateManager->ReadFromFile();
1033 Int_t nPixelX = 700;
1034 Int_t nPixelY = 676;
1036 Int_t nPixelBorderX = 40; // to guess...
1037 Int_t nPixelBorderY = 40; // to guess...
1039 Float_t boardsX = 2*257.00; // cm
1040 Float_t boardsY = 2*306.61; // cm
1044 Int_t side, col, line, nbx, detElemId = 0;
1045 UShort_t status = 1;
1046 Float_t xCenter, yCenter, zCenter, xWidth, yWidth;
1048 Char_t name[8], text[200];
1053 TString mapspath = gSystem->Getenv("ALICE_ROOT");
1054 mapspath.Append("/MUON/data");
1057 AliMUONTriggerGUIboard *board;
1059 // regions for the image map
1061 sprintf(text,"%s/guimapp11.txt",mapspath.Data());
1062 fmap = fopen(text,"r");
1064 for (Int_t ib = 0; ib < kNBoards; ib++) {
1066 fscanf(fmap,"%d %d %d %d %f %f %f %f %f %s \n",&side,&col,&line,&nbx,&xCenter,&yCenter,&xWidth,&yWidth,&zCenter,&name[0]);
1068 //printf("%d %d %d %d %f %f %f %f %f %s \n",side,col,line,nbx,xCenter,yCenter,xWidth,yWidth,zCenter,name);
1070 board = new AliMUONTriggerGUIboard(ib,name);
1073 board->SetStatus(status);
1075 // calculate detElemId%100
1079 if (side == 0) detElemId = 14 - line;
1080 if (side == 1 && line < 5) detElemId = 13 + line;
1081 if (side == 1 && line >= 5) detElemId = line - 5;
1083 board->SetDetElemId(detElemId);
1085 Boards()->Add(board);
1090 x = (Int_t)(nPixelX/2 + xc * (nPixelX - 2*nPixelBorderX)/boardsX);
1091 y = (Int_t)(nPixelY/2 - yc * (nPixelY - 2*nPixelBorderY)/boardsY);
1096 w = (UInt_t)(xWidth*(nPixelX-2*nPixelBorderX)/boardsX);
1097 h = (UInt_t)(yWidth*(nPixelY-2*nPixelBorderY)/boardsY);
1111 reg = new TGRegion(5,xp,yp);
1112 fImageMap->AddRegion(*reg, ib);
1114 if (status & kGood) {
1115 sprintf(text,"%s working",name);
1117 if (status & kWithProblems) {
1118 sprintf(text,"%s has problems...",name);
1120 if (status & kNotWorking) {
1121 sprintf(text,"%s not working",name);
1123 if (status & kUnknown) {
1124 sprintf(text,"%s status unknown",name);
1127 //fImageMap->SetToolTipText(ib, text);
1133 // MT position and dimension in board
1135 for (Int_t imt = 0; imt < kNMT; imt++) {
1137 sprintf(text,"%s/guimapp%2d.txt",mapspath.Data(),11+imt);
1139 fmap = fopen(text,"r");
1141 for (Int_t ib = 0; ib < kNBoards; ib++) {
1143 fscanf(fmap,"%d %d %d %d %f %f %f %f %f %s \n",&side,&col,&line,&nbx,&xCenter,&yCenter,&xWidth,&yWidth,&zCenter,&name[0]);
1145 board = GetBoard(ib);
1146 board->SetDimensions(imt,xCenter,yCenter,zCenter,xWidth,yWidth);
1154 // MT x-strips indices and circuit number
1155 Int_t ix, iy1, iy2, sIx, sIy1, cathode, icirc;
1156 sprintf(text,"%s/guimapix11.txt",mapspath.Data());
1158 fmap = fopen(text,"r");
1160 for (Int_t ib = 0; ib < kNBoards; ib++) {
1162 fscanf(fmap,"%d %d %d %d %d %d %d %s \n",&side,&col,&line,&nbx,&ix,&iy1,&iy2,&name[0]);
1164 board = GetBoard(ib);
1165 board->SetXSindex(ix,iy1,iy2);
1167 // set the circuit number
1168 detElemId = board->GetDetElemId();
1169 detElemId += 100 * 11;
1171 sIx = board->GetXSix();
1172 sIy1 = board->GetXSiy1();
1173 const AliMpVSegmentation* seg =
1174 AliMpSegmentation::Instance()->GetMpSegmentation(detElemId,AliMp::GetCathodType(cathode));
1176 AliMpPad pad = seg->PadByIndices(AliMpIntPair(sIx,sIy1),kTRUE);
1177 AliMpIntPair location = pad.GetLocation(0);
1179 Int_t nboard = location.GetFirst();
1180 AliMUONLocalTriggerBoard* b = crateManager->LocalBoard(nboard);
1181 icirc = b->GetNumber();
1182 board->SetBoardName((Char_t*)b->GetName());
1183 board->SetIdCircuit(icirc);
1185 TString crateName = b->GetCrate();
1187 sprintf(text,"%s (crate %s circuit %3d, number %3d)",board->GetBoardName(),crateName.Data(),icirc,ib);
1188 fImageMap->SetToolTipText(ib, text);
1194 // MT y-strips indices
1197 sprintf(text,"%s/guimapiy11.txt",mapspath.Data());
1199 fmap = fopen(text,"r");
1201 for (Int_t ib = 0; ib < kNBoards; ib++) {
1203 fscanf(fmap,"%d %d %d %d %d %d %d %s \n",&side,&col,&line,&nbx,&ix1,&ix2,&iy,&name[0]);
1205 board = GetBoard(ib);
1206 board->SetYSindex(ix1,ix2,iy);
1212 // Extended y-strips over neighbouring boards
1214 sprintf(text,"%s/guimapp11.txt",mapspath.Data());
1216 fmap = fopen(text,"r");
1218 for (Int_t ib = 0; ib < kNBoards; ib++) {
1220 fscanf(fmap,"%d %d %d %d %f %f %f %f %f %s \n",&side,&col,&line,&nbx,&xCenter,&yCenter,&xWidth,&yWidth,&zCenter,&name[0]);
1222 board = GetBoard(ib);
1224 board->SetPosition(nbx);
1226 if ((col == 2 || col == 3) && (line >= 4 && line <= 6)) {
1230 if (col == 1 && (line == 4 || line == 6)) {
1234 if (col == 7 || line == 1 || line == 9) {
1246 // Set coordinates of strips boxes
1248 for (Int_t ib = 0; ib < kNBoards; ib++) {
1250 board = GetBoard(ib);
1251 SetStripBoxes(board);
1257 //__________________________________________________________________________
1258 void AliMUONTriggerGUI::SetStripBoxes(AliMUONTriggerGUIboard *board)
1260 /// set coordinates of strip boxes
1262 gAlice = fRunLoader->GetAliRun();
1263 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
1264 const AliMUONGeometryTransformer* kGeomTransformer = pMUON->GetGeometryTransformer();
1266 const AliMpVSegmentation* seg;
1270 Int_t chamber, detElemId, maxX, maxY, ic;
1271 Float_t xpmin, xpmax, ypmin, ypmax;
1272 Float_t xg1, xg2, yg1, yg2, zg1;
1273 Float_t xlocal1, xlocal2, ylocal1, ylocal2;
1274 Float_t xCenter, yCenter, xWidth, yWidth;
1276 for (Int_t i = 0; i < kNMT; i++) {
1280 xCenter = board->GetXCenter(i);
1281 yCenter = board->GetYCenter(i);
1282 xWidth = board->GetXWidth(i);
1283 yWidth = board->GetYWidth(i);
1285 for ( it.First(chamber-1); ! it.IsDone(); it.Next() ) {
1287 detElemId = it.CurrentDEId();
1289 if (detElemId%100 != board->GetDetElemId()) continue;
1291 /*---------- y-pads ic = 2 ----------*/
1294 seg = AliMpSegmentation::Instance()->GetMpSegmentation(detElemId, AliMp::GetCathodType(ic-1));
1296 maxX = seg->MaxPadIndexX();
1297 maxY = seg->MaxPadIndexY();
1299 for (Int_t ix = 0; ix <= maxX; ix++) {
1300 for (Int_t iy = 0; iy <= maxY; iy++) {
1302 pad = seg->PadByIndices(AliMpIntPair(ix,iy),kFALSE);
1304 if (!pad.IsValid()) continue;
1306 // get the pad position and dimensions
1307 xlocal1 = pad.Position().X();
1308 ylocal1 = pad.Position().Y();
1309 xlocal2 = pad.Dimensions().X();
1310 ylocal2 = pad.Dimensions().Y();
1312 kGeomTransformer->Local2Global(detElemId, xlocal1, ylocal1, 0, xg1, yg1, zg1);
1313 // (no transformation for pad dimensions)
1317 // transform in the monitor coordinate system
1318 //xpmin = -(xg1+xg2);
1319 //xpmax = -(xg1-xg2);
1320 //ypmin = -(yg2-yg1);
1321 //ypmax = +(yg2+yg1);
1333 Int_t iX1, iX2, iY, ixDig;
1334 iX1 = board->GetYSix1();
1335 iX2 = board->GetYSix2();
1336 iY = board->GetYSiy();
1337 if (ix >= iX1 && ix <= iX2 && iy == iY) {
1339 ypmin = -0.5*yWidth;
1340 ypmax = +0.5*yWidth;
1344 board->SetYDigBox(i,ixDig,(Double_t)xpmin,(Double_t)ypmin,
1345 (Double_t)xpmax,(Double_t)ypmax);
1352 /*---------- x-pads ic = 1 ----------*/
1355 seg = AliMpSegmentation::Instance()->GetMpSegmentation(detElemId, AliMp::GetCathodType(ic-1));
1357 maxX = seg->MaxPadIndexX();
1358 maxY = seg->MaxPadIndexY();
1360 for (Int_t ix = 0; ix <= maxX; ix++) {
1361 for (Int_t iy = 0; iy <= maxY; iy++) {
1363 pad = seg->PadByIndices(AliMpIntPair(ix,iy),kFALSE);
1365 if (!pad.IsValid()) continue;
1367 // get the pad position and dimensions
1368 xlocal1 = pad.Position().X();
1369 ylocal1 = pad.Position().Y();
1370 xlocal2 = pad.Dimensions().X();
1371 ylocal2 = pad.Dimensions().Y();
1373 kGeomTransformer->Local2Global(detElemId, xlocal1, ylocal1, 0, xg1, yg1, zg1);
1374 // (no transformation for pad dimensions)
1378 // transform in the monitor coordinate system
1379 //xpmin = -(xg1+xg2);
1380 //xpmax = -(xg1-xg2);
1381 //ypmin = -(yg2-yg1);
1382 //ypmax = +(yg2+yg1);
1394 Int_t iX, iY1, iY2, iyDig;
1395 iX = board->GetXSix();
1396 iY1 = board->GetXSiy1();
1397 iY2 = board->GetXSiy2();
1398 if (ix == iX && iy >= iY1 && iy <= iY2) {
1402 board->SetXDigBox(i,iyDig,(Double_t)xpmin,(Double_t)ypmin,
1403 (Double_t)xpmax,(Double_t)ypmax);