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 "AliMpDDLStore.h"
32 #include "AliMpSegmentation.h"
33 #include "AliMpVSegmentation.h"
34 #include "AliMpTriggerSegmentation.h"
35 #include "AliMpEncodePair.h"
37 #include "AliMpDEManager.h"
38 #include "AliMpDEIterator.h"
40 #include "AliMUONGeometryTransformer.h"
41 #include "AliMUONTriggerCrateStore.h"
42 #include "AliMUONLocalTriggerBoard.h"
43 #include "AliMUONTriggerElectronics.h"
44 #include "AliMUONCalibrationData.h"
45 #include "AliMUONMCDataInterface.h"
46 #include "AliMUONDigitStoreV1.h"
47 #include "AliMUONDigitStoreV2R.h"
48 #include "AliMUONTriggerStoreV1.h"
49 #include "AliMUONLocalTrigger.h"
50 #include "AliMUONRawWriter.h"
51 #include "AliMUONDigitMaker.h"
52 #include "AliMUONGlobalTrigger.h"
56 #include "AliRunLoader.h"
57 #include "AliCDBManager.h"
58 #include "AliRawDataHeaderSim.h"
59 #include "AliRawReader.h"
64 #include <TApplication.h>
65 #include <TGDimension.h>
68 #include <TGTextEntry.h>
71 #include <TGImageMap.h>
72 #include <TGTextBuffer.h>
77 ClassImp(AliMUONTriggerGUI)
80 //__________________________________________________________________________
81 AliMUONTriggerGUI::AliMUONTriggerGUI(Int_t runNumber)
112 fTriggerProcessor(0),
119 fCurrentRawEvent(-1),
123 /// main GUI frame of the trigger monitor
132 fFileName = new TString("");
133 fEvString = new TString("");
134 fPath = new TString("");
136 fDigitStore = new AliMUONDigitStoreV2R;
137 fDigitStore->Create();
139 fTriggerStore = new AliMUONTriggerStoreV1;
140 fTriggerStore->Create();
142 fRawDigitStore = new AliMUONDigitStoreV1;
143 fRawDigitStore->Create();
145 fRawTriggerStore = new AliMUONTriggerStoreV1;
146 fRawTriggerStore->Create();
148 fCDBManager = AliCDBManager::Instance();
149 fCDBManager->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
150 fCDBManager->SetRun(runNumber);
151 AliMpCDB::LoadDDLStore();
152 fCalibrationData = new AliMUONCalibrationData(runNumber);
154 fTriggerProcessor = new AliMUONTriggerElectronics(fCalibrationData);
158 fMain = new TGMainFrame(gClient->GetRoot(), 750, 420);
159 fMain->Connect("CloseWindow()", "AliMUONTriggerGUI", this, "CloseWindow()");
163 TGMenuBar *menuBar = new TGMenuBar(fMain);
167 TGPopupMenu *menuFile = new TGPopupMenu(gClient->GetRoot());
168 //menuFile->AddLabel("");
170 menuFile->AddEntry("Run input", kMFILERUN);
171 menuFile->AddEntry("Control", kMFILECNTRL);
172 menuFile->AddEntry("Exit", kMFILEEXIT);
174 menuFile->Connect("Activated(Int_t)", "AliMUONTriggerGUI", this, "HandleMenu(Int_t)");
178 TGPopupMenu *menuCircuit = new TGPopupMenu(gClient->GetRoot());
179 //menuCircuit->AddLabel("");
181 menuCircuit->AddEntry("Open", kMCIRCUITOPEN);
183 menuCircuit->Connect("Activated(Int_t)", "AliMUONTriggerGUI", this, "HandleMenu(Int_t)");
187 TGPopupMenu *menuMap = new TGPopupMenu(gClient->GetRoot());
188 //menuMap->AddLabel("");
190 menuMap->AddEntry("Digits map", kMMAPDIGITS);
191 menuMap->AddEntry("Reset digits", kMRESETDIGITS);
193 menuMap->Connect("Activated(Int_t)", "AliMUONTriggerGUI", this,
194 "HandleMenu(Int_t)");
198 TGPopupMenu *menuTrigger = new TGPopupMenu(gClient->GetRoot());
200 TGPopupMenu *menuTriggerD = new TGPopupMenu(gClient->GetRoot());
201 TGPopupMenu *menuTriggerT = new TGPopupMenu(gClient->GetRoot());
202 TGPopupMenu *menuTriggerF = new TGPopupMenu(gClient->GetRoot());
204 menuTrigger->AddPopup("Digit store", menuTriggerD);
205 menuTrigger->AddSeparator();
206 menuTrigger->AddPopup("Trigger store",menuTriggerT);
207 menuTrigger->AddSeparator();
208 menuTrigger->AddPopup("Front End Test", menuTriggerF);
209 menuTrigger->AddSeparator();
211 menuTriggerD->AddEntry("Create", kMDSTORE);
212 menuTriggerD->AddEntry("Print", kMDSTOREP);
213 menuTriggerD->AddEntry("Clear", kMDSTORECL);
214 menuTriggerT->AddEntry("Create", kMTSTORE);
215 menuTriggerT->AddEntry("Print", kMTSTOREP);
216 menuTriggerT->AddEntry("Clear", kMTSTORECL);
217 menuTriggerF->AddEntry("On", kMFETON);
218 menuTriggerF->AddEntry("Off", kMFETOFF);
219 menuTriggerF->AddEntry("Reg On", kMFETREGON);
220 menuTriggerF->AddEntry("Reg Off",kMFETREGOFF);
221 menuTrigger->AddEntry("Write raw data", kMTRAWDATA);
223 menuTrigger->Connect("Activated(Int_t)", "AliMUONTriggerGUI", this, "HandleMenu(Int_t)");
225 // Add menus to the menu bar
227 menuBar->AddPopup("File", menuFile,
228 new TGLayoutHints(kLHintsTop | kLHintsLeft, 5,5,2,2)
231 menuBar->AddPopup("Maps", menuMap,
232 new TGLayoutHints(kLHintsTop | kLHintsLeft, 5,5,2,2)
235 menuBar->AddPopup("Circuit", menuCircuit,
236 new TGLayoutHints(kLHintsTop | kLHintsLeft, 5,5,2,2)
239 menuBar->AddPopup("TriggerDSET", menuTrigger,
240 new TGLayoutHints(kLHintsTop | kLHintsLeft, 5,5,2,2)
243 // Add menu bar to the main frame
245 fMain->AddFrame(menuBar,
246 new TGLayoutHints(kLHintsTop |
254 fImageMap = new TGImageMap(fMain,"$ALICE_ROOT/MUON/data/guimap.gif");
256 fImageMap->Connect("RegionClicked(Int_t)", "AliMUONTriggerGUI", this, "OpenBoard(Int_t)");
258 fImageMap->SetToolTipText("Map of the local boards as seen from the I.P.");
260 // Add image map to the main frame
262 fMain->AddFrame(fImageMap);
263 fMain->SetWindowName("Map of the local boards as seen from the I.P.");
265 // Resize the main frame
267 TGDimension size = fMain->GetDefaultSize();
270 fMain->MapSubwindows();
274 fBoardsInit = kFALSE;
280 //__________________________________________________________________________
281 void AliMUONTriggerGUI::HandleMenu(Int_t id)
283 /// handles entry numbers in the available menus (EMenuIdentifiers)
285 TGCompositeFrame *runInput1, *runInput2, *runInput3;
286 TGCompositeFrame *control1, *control2, *circuit1, *circuit2;
287 TGCompositeFrame *fetregon1, *fetregon2;
288 TGCompositeFrame *fetregoff1, *fetregoff2;
289 TGLabel *runL1, *runL2, *circuitL1, *fetregonL1, *fetregoffL1;
290 TGTextEntry *runText1, *runText2, *circuitText1;
291 TGTextEntry *fetregonText1, *fetregoffText1;
292 TGTextButton *runApply1, *runApply2, *runCancel;
293 TGTextButton *controlClose, *nextEvent, *previousEvent, *skipToEvent;
294 TGTextButton *circuitCancel, *circuitOpen;
295 TGTextButton *fetregonCancel, *fetregoffCancel;
296 TGTextButton *fetregonRun, *fetregoffRun;
310 fRunInput = new TGTransientFrame(gClient->GetRoot(), fMain, 400, 200);
311 fRunInput->Connect("CloseWindow()", "AliMUONTriggerGUI", this, "CloseRunInput()");
312 fRunInput->DontCallClose(); // to avoid double deletions.
314 // use hierarchical cleaning
315 fRunInput->SetCleanup(kDeepCleanup);
317 fRunInput->SetWindowName("Input file and event number");
319 // input galice and event number frames
321 runInput1 = new TGCompositeFrame(fRunInput, 400, 200, kHorizontalFrame);
322 runInput2 = new TGCompositeFrame(fRunInput, 400, 200, kHorizontalFrame);
326 runL1 = new TGLabel(runInput1, new TGString("Full file path:"));
327 runL2 = new TGLabel(runInput2, new TGString("Event number:"));
331 runText1 = new TGTextEntry(runInput1, fTxtBuffer1 = new TGTextBuffer(100));
333 runText1->SetToolTipText("Enter the path to galice.root or the raw data file (root)");
334 runText1->Resize(300, runText1->GetDefaultHeight());
336 // event number text entry
338 runText2 = new TGTextEntry(runInput2, fTxtBuffer2 = new TGTextBuffer(5));
340 fEvString->Form("%d",0);
341 fTxtBuffer2->AddText(0,fEvString->Data());
343 runText2->SetToolTipText("Enter the first event number to start with");
344 runText2->Resize(300, runText2->GetDefaultHeight());
346 // add to galice frame
348 runInput1->AddFrame(runL1,
349 new TGLayoutHints(kLHintsLeft |
354 runInput1->AddFrame(runText1,
355 new TGLayoutHints(kLHintsRight |
360 // add to event number frame
362 runInput2->AddFrame(runL2,
363 new TGLayoutHints(kLHintsLeft |
368 runInput2->AddFrame(runText2,
369 new TGLayoutHints(kLHintsRight |
374 // add input frames to main input frame
376 fRunInput->AddFrame(runInput1,
377 new TGLayoutHints(kLHintsTop | kLHintsExpandX, 2, 2, 3, 0));
379 fRunInput->AddFrame(runInput2,
380 new TGLayoutHints(kLHintsTop | kLHintsExpandX, 2, 2, 3, 0));
382 // frame with buttons
384 runInput3 = new TGCompositeFrame(fRunInput, 400, 200, kHorizontalFrame);
388 runApply1 = new TGTextButton(runInput3, "Apply (galice)", 1);
389 runApply1->Connect("Clicked()", "AliMUONTriggerGUI", this, "DoRunGalApply()");
390 runApply1->SetToolTipText("Apply changes (galice input)");
392 runApply2 = new TGTextButton(runInput3, "Apply (raw)", 1);
393 runApply2->Connect("Clicked()", "AliMUONTriggerGUI", this, "DoRunRawApply()");
394 runApply2->SetToolTipText("Apply changes (raw data input)");
396 runCancel = new TGTextButton(runInput3, "Cancel", 2);
397 runCancel->Connect("Clicked()", "AliMUONTriggerGUI", this, "DoRunCancel()");
398 runCancel->SetToolTipText("Cancel changes");
402 runInput3->AddFrame(runApply1,
403 new TGLayoutHints(kLHintsTop |
408 runInput3->AddFrame(runApply2,
409 new TGLayoutHints(kLHintsTop |
414 runInput3->AddFrame(runCancel,
415 new TGLayoutHints(kLHintsTop |
420 // add to the main input frame
422 fRunInput->AddFrame(runInput3,
423 new TGLayoutHints(kLHintsTop |
428 fRunInput->MapSubwindows();
430 fRunInput->MapWindow();
436 // control main frame
438 fControl = new TGTransientFrame(gClient->GetRoot(), fMain, 50, 50);
439 fControl->Connect("CloseWindow()", "AliMUONTriggerGUI", this, "CloseControl()");
440 fControl->DontCallClose(); // to avoid double deletions.
442 // use hierarchical cleaning
443 fControl->SetCleanup(kDeepCleanup);
445 fControl->SetWindowName("Run controls");
447 // frame to hold buttons
449 control1 = new TGCompositeFrame(fControl, 50, 50, kVerticalFrame);
453 controlClose = new TGTextButton(control1, "Close", 1);
454 controlClose->Connect("Clicked()", "AliMUONTriggerGUI", this, "DoControlClose()");
455 //controlClose->Resize(300, controlClose->GetDefaultHeight());
457 nextEvent = new TGTextButton(control1, "Next event", 2);
458 nextEvent->Connect("Clicked()", "AliMUONTriggerGUI", this, "DoNextEvent()");
460 previousEvent = new TGTextButton(control1, "Previous event", 3);
461 previousEvent->Connect("Clicked()", "AliMUONTriggerGUI", this, "DoPreviousEvent()");
463 // frame to hold event skip
465 control2 = new TGCompositeFrame(fControl, 50, 50, kHorizontalFrame);
467 // skip to event text field
469 fSkipToEventTxt = new TGTextEntry(control2, fTxtBuffer2 = new TGTextBuffer(5));
471 fTxtBuffer2->AddText(0,fEvString->Data());
473 // skip to event button
475 skipToEvent = new TGTextButton(control2, "Skip to event", 1);
476 skipToEvent->Connect("Clicked()", "AliMUONTriggerGUI", this, "DoSkipToEvent()");
478 // add to event skip frame
480 control2->AddFrame(fSkipToEventTxt,
481 new TGLayoutHints(kLHintsTop |
486 control2->AddFrame(skipToEvent,
487 new TGLayoutHints(kLHintsTop |
494 control1->AddFrame(controlClose,
495 new TGLayoutHints(kLHintsBottom |
500 control1->AddFrame(nextEvent,
501 new TGLayoutHints(kLHintsBottom |
506 control1->AddFrame(previousEvent,
507 new TGLayoutHints(kLHintsBottom |
512 // add to the main frame
514 fControl->AddFrame(control1,
515 new TGLayoutHints(kLHintsBottom |
521 fControl->AddFrame(control2,
522 new TGLayoutHints(kLHintsTop |
527 fControl->MapSubwindows();
529 fControl->MapWindow();
538 fDiMap = new AliMUONTriggerGUIdimap(fBoards,gClient->GetRoot(), fMain, 400, 200);
539 fDiMap->SetLoader(fLoader);
541 fDiMap->SetRawDigitStore(fRawDigitStore);
543 fDiMap->SetMCDataInterface(fMCDataInterface);
545 fDiMap->DrawAllMaps();
546 } else if (!fDiMap->IsOn()) {
547 fDiMap = new AliMUONTriggerGUIdimap(fBoards,gClient->GetRoot(), fMain, 400, 200);
548 fDiMap->SetLoader(fLoader);
550 fDiMap->SetRawDigitStore(fRawDigitStore);
552 fDiMap->SetMCDataInterface(fMCDataInterface);
554 fDiMap->DrawAllMaps();
561 Int_t number, over, pos;
562 for (Int_t ib = 0; ib < kNBoards; ib++) {
563 AliMUONTriggerGUIboard *board = GetBoard(ib);
564 board->ClearXDigits();
565 board->ClearYDigits();
567 number = board->GetNumber();
568 pos = board->GetPosition();
569 over = board->GetYOver();
570 for (Int_t io = 1; io <= over; io++) {
571 if (io == pos) continue;
572 board = GetBoard(number+io-pos);
573 board->ClearYDigits();
581 fCircuit = new TGTransientFrame(gClient->GetRoot(), fMain, 50, 50);
582 fCircuit->Connect("CloseWindow()", "AliMUONTriggerGUI", this, "CloseCircuit()");
583 fCircuit->DontCallClose(); // to avoid double deletions.
585 // use hierarchical cleaning
586 fCircuit->SetCleanup(kDeepCleanup);
588 fCircuit->SetWindowName("Board circuit");
592 circuit1 = new TGCompositeFrame(fCircuit, 400, 200, kHorizontalFrame);
593 circuit2 = new TGCompositeFrame(fCircuit, 400, 200, kHorizontalFrame);
597 circuitL1 = new TGLabel(circuit1, new TGString("Circuit number:"));
601 circuitText1 = new TGTextEntry(circuit1, fTxtCircuit = new TGTextBuffer(10));
604 circuitCancel = new TGTextButton(circuit2, "Cancel", 1);
605 circuitCancel->Connect("Clicked()", "AliMUONTriggerGUI", this, "DoCircuitCancel()");
606 //circuitCancel->Resize(100, circuitCancel->GetDefaultHeight());
608 circuitOpen = new TGTextButton(circuit2, "Open", 2);
609 circuitOpen->Connect("Clicked()", "AliMUONTriggerGUI", this, "DoCircuitOpen()");
610 //circuitOpen->Resize(100, circuitOpen->GetDefaultHeight());
614 circuit1->AddFrame(circuitL1,
615 new TGLayoutHints(kLHintsLeft |
620 circuit1->AddFrame(circuitText1,
621 new TGLayoutHints(kLHintsRight |
626 circuit2->AddFrame(circuitCancel,
627 new TGLayoutHints(kLHintsBottom |
632 circuit2->AddFrame(circuitOpen,
633 new TGLayoutHints(kLHintsBottom |
638 fCircuit->AddFrame(circuit1,
639 new TGLayoutHints(kLHintsTop | kLHintsExpandX, 2, 2, 3, 0));
641 fCircuit->AddFrame(circuit2,
642 new TGLayoutHints(kLHintsTop | kLHintsExpandX, 2, 2, 3, 0));
644 fCircuit->MapSubwindows();
646 fCircuit->MapWindow();
663 CreateTriggerStore();
675 WriteTriggerRawData();
688 fFETRegOn = new TGTransientFrame(gClient->GetRoot(), fMain, 50, 50);
689 fFETRegOn->Connect("CloseWindow()", "AliMUONTriggerGUI", this, "CloseFETRegOn()");
690 fFETRegOn->DontCallClose(); // to avoid double deletions.
692 // use hierarchical cleaning
693 fFETRegOn->SetCleanup(kDeepCleanup);
695 fFETRegOn->SetWindowName("FET ON regional crate");
699 fetregon1 = new TGCompositeFrame(fFETRegOn, 400, 200, kHorizontalFrame);
700 fetregon2 = new TGCompositeFrame(fFETRegOn, 400, 200, kHorizontalFrame);
704 fetregonL1 = new TGLabel(fetregon1, new TGString("Regional crate name:"));
708 fetregonText1 = new TGTextEntry(fetregon1, fTxtFETRegOn = new TGTextBuffer(10));
711 fetregonCancel = new TGTextButton(fetregon2, "Cancel", 1);
712 fetregonCancel->Connect("Clicked()", "AliMUONTriggerGUI", this, "DoFETRegOnCancel()");
713 //fetregonCancel->Resize(100, fetregonCancel->GetDefaultHeight());
715 fetregonRun = new TGTextButton(fetregon2, "Run FET", 2);
716 fetregonRun->Connect("Clicked()", "AliMUONTriggerGUI", this, "DoFETRegOnRun()");
717 //fetregonRun->Resize(100, fetregonRun->GetDefaultHeight());
721 fetregon1->AddFrame(fetregonL1,
722 new TGLayoutHints(kLHintsLeft |
727 fetregon1->AddFrame(fetregonText1,
728 new TGLayoutHints(kLHintsRight |
733 fetregon2->AddFrame(fetregonCancel,
734 new TGLayoutHints(kLHintsBottom |
739 fetregon2->AddFrame(fetregonRun,
740 new TGLayoutHints(kLHintsBottom |
745 fFETRegOn->AddFrame(fetregon1,
746 new TGLayoutHints(kLHintsTop | kLHintsExpandX, 2, 2, 3, 0));
748 fFETRegOn->AddFrame(fetregon2,
749 new TGLayoutHints(kLHintsTop | kLHintsExpandX, 2, 2, 3, 0));
751 fFETRegOn->MapSubwindows();
753 fFETRegOn->MapWindow();
759 fFETRegOff = new TGTransientFrame(gClient->GetRoot(), fMain, 50, 50);
760 fFETRegOff->Connect("CloseWindow()", "AliMUONTriggerGUI", this, "CloseFETRegOff()");
761 fFETRegOff->DontCallClose(); // to avoid double deletions.
763 // use hierarchical cleaning
764 fFETRegOff->SetCleanup(kDeepCleanup);
766 fFETRegOff->SetWindowName("FET OFF regional crate");
770 fetregoff1 = new TGCompositeFrame(fFETRegOff, 400, 200, kHorizontalFrame);
771 fetregoff2 = new TGCompositeFrame(fFETRegOff, 400, 200, kHorizontalFrame);
775 fetregoffL1 = new TGLabel(fetregoff1, new TGString("Regional crate name:"));
779 fetregoffText1 = new TGTextEntry(fetregoff1, fTxtFETRegOff = new TGTextBuffer(10));
782 fetregoffCancel = new TGTextButton(fetregoff2, "Cancel", 1);
783 fetregoffCancel->Connect("Clicked()", "AliMUONTriggerGUI", this, "DoFETRegOffCancel()");
784 //fetregoffCancel->Resize(100, fetregoffCancel->GetDefaultHeight());
786 fetregoffRun = new TGTextButton(fetregoff2, "Run FET", 2);
787 fetregoffRun->Connect("Clicked()", "AliMUONTriggerGUI", this, "DoFETRegOffRun()");
788 //fetregoffRun->Resize(100, fetregoffRun->GetDefaultHeight());
792 fetregoff1->AddFrame(fetregoffL1,
793 new TGLayoutHints(kLHintsLeft |
798 fetregoff1->AddFrame(fetregoffText1,
799 new TGLayoutHints(kLHintsRight |
804 fetregoff2->AddFrame(fetregoffCancel,
805 new TGLayoutHints(kLHintsBottom |
810 fetregoff2->AddFrame(fetregoffRun,
811 new TGLayoutHints(kLHintsBottom |
816 fFETRegOff->AddFrame(fetregoff1,
817 new TGLayoutHints(kLHintsTop | kLHintsExpandX, 2, 2, 3, 0));
819 fFETRegOff->AddFrame(fetregoff2,
820 new TGLayoutHints(kLHintsTop | kLHintsExpandX, 2, 2, 3, 0));
822 fFETRegOff->MapSubwindows();
823 fFETRegOff->Resize();
824 fFETRegOff->MapWindow();
829 printf("Menu item %d selected\n", id);
836 //__________________________________________________________________________
837 void AliMUONTriggerGUI::CloseRunInput() const
839 /// close the run input frame
845 //__________________________________________________________________________
846 void AliMUONTriggerGUI::CloseError() const
848 /// close the error frame
854 //__________________________________________________________________________
855 void AliMUONTriggerGUI::CloseControl() const
857 /// close the event control frame
861 //gSystem->Exec("cd $PWD/mtrun; aliroot -b -q mtsim.C");
865 //__________________________________________________________________________
866 void AliMUONTriggerGUI::CloseCircuit() const
868 /// close the circuit frame
874 //__________________________________________________________________________
875 void AliMUONTriggerGUI::CloseFETRegOn() const
877 /// close the FET regional on frame
883 //__________________________________________________________________________
884 void AliMUONTriggerGUI::CloseFETRegOff() const
886 /// close the FET regional off frame
892 //__________________________________________________________________________
893 void AliMUONTriggerGUI::CloseWindow()
895 /// close the main frame and exit aplication
898 delete fMCDataInterface;
900 gApplication->Terminate();
904 //__________________________________________________________________________
905 void AliMUONTriggerGUI::DoRunGalApply()
907 /// apply changes in the run control frame for galice input
910 printf("This is a run with raw data input.\n");
914 TString es = TString(fTxtBuffer2->GetString());
917 printf("Galice input = %s event = %d \n",fTxtBuffer1->GetString(),fEvent);
919 TString error = TString("");;
921 fPath->Form("%s",fTxtBuffer1->GetString());
922 fFileName->Form("%s",fTxtBuffer1->GetString());
924 if (gSystem->AccessPathName(fFileName->Data()) || !fFileName->EndsWith(".root")) {
926 error.Append("No galice file: ");
927 error.Append(fFileName->Data());
928 DoErrorGUI(error.Data());
932 TFile *ftest = new TFile(fFileName->Data(),"READ");
933 AliRun *galice = (AliRun*)ftest->Get("gAlice");
939 error.Append("No gAlice in file: ");
940 error.Append(fFileName->Data());
941 DoErrorGUI(error.Data());
952 delete fMCDataInterface;
955 fRunLoader = AliRunLoader::Open(fFileName->Data(),"MUONFolder","READ");
957 if (fRunLoader == 0x0) {
959 DoErrorGUI("No run loader !");
963 fRunLoader->LoadgAlice();
964 gAlice = fRunLoader->GetAliRun();
965 fEventsPerRun = AliRunLoader::Instance()->GetNumberOfEvents();
967 fLoader = fRunLoader->GetLoader("MUONLoader");
968 fRunLoader->GetEvent(fEvent);
970 fMCDataInterface = new AliMUONMCDataInterface(fFileName->Data());
972 fRunInput->SendCloseMessage();
979 if (fDiMap->IsOn()) {
980 fDiMap->SetLoader(fLoader);
981 fDiMap->SetMCDataInterface(fMCDataInterface);
991 //__________________________________________________________________________
992 void AliMUONTriggerGUI::DoRunRawApply()
994 /// apply changes in the run control frame for raw date input
996 if (fControlOn) DoControlClose();
998 if (fRunLoader != 0) {
999 printf("This is a run with galice input.\n");
1003 TString es = TString(fTxtBuffer2->GetString());
1006 printf("Raw data input = %s event = %d \n",fTxtBuffer1->GetString(),fEvent);
1008 TString error = TString("");;
1010 fPath->Form("%s",fTxtBuffer1->GetString());
1011 fFileName->Form("%s",fTxtBuffer1->GetString());
1013 if (gSystem->AccessPathName(fFileName->Data()) || !fFileName->EndsWith(".root")) {
1015 error.Append("No raw data file: ");
1016 error.Append(fFileName->Data());
1017 DoErrorGUI(error.Data());
1021 if (fRawReader == 0) {
1022 fRawReader = AliRawReader::Create(fFileName->Data());
1025 fRawReader = AliRawReader::Create(fFileName->Data());
1027 if (fRawReader == 0) {
1028 error.Append("Not a valid raw data file: ");
1029 error.Append(fFileName->Data());
1030 DoErrorGUI(error.Data());
1034 fRawReader->GotoEvent(fEvent);
1035 fCurrentRawEvent = fEvent;
1037 AliMUONDigitMaker digitMaker;
1038 digitMaker.SetMakeTriggerDigits(kTRUE);
1039 digitMaker.Raw2Digits(fRawReader,fRawDigitStore,fRawTriggerStore);
1041 fRunInput->SendCloseMessage();
1048 if (fDiMap->IsOn()) {
1049 fDiMap->SetRawDigitStore(fRawDigitStore);
1059 //__________________________________________________________________________
1060 void AliMUONTriggerGUI::DoRunCancel()
1062 /// cancel the changes in the run control frame
1064 fRunInput->SendCloseMessage();
1068 //__________________________________________________________________________
1069 void AliMUONTriggerGUI::DoErrorGUI(const Char_t *wt)
1071 /// show an error message in a new frame
1073 fError = new TGTransientFrame(gClient->GetRoot(), fMain, 50, 50);
1074 fError->Connect("CloseWindow()", "AliMUONTriggerGUI", this, "CloseError()");
1075 fError->DontCallClose(); // to avoid double deletions.
1077 // use hierarchical cleaning
1078 fError->SetCleanup(kDeepCleanup);
1080 fError->SetWindowName("Error !");
1082 TGCompositeFrame *fW = new TGCompositeFrame(fError, 50, 50, kVerticalFrame);
1084 TGTextButton *fErrorOK = new TGTextButton(fW, "&Ok", 1);
1085 fErrorOK->Connect("Clicked()", "AliMUONTriggerGUI", this, "DoErrorOK()");
1087 fW->AddFrame(fErrorOK,
1088 new TGLayoutHints(kLHintsBottom |
1093 TGLabel *fWL = new TGLabel(fW, new TGString(wt));
1096 new TGLayoutHints(kLHintsTop |
1101 fError->AddFrame(fW,
1102 new TGLayoutHints(kLHintsLeft |
1107 fError->MapSubwindows();
1109 fError->MapWindow();
1113 //__________________________________________________________________________
1114 void AliMUONTriggerGUI::DoNextEvent()
1116 /// load next event from the file
1118 TString error = TString("");
1121 if (fEvent < (fEventsPerRun-1)) {
1123 fRunLoader->GetEvent(fEvent);
1125 fEvString->Form("%d",fEvent);
1126 fTxtBuffer2->RemoveText(0,5);
1127 fTxtBuffer2->AddText(0,fEvString->Data());
1128 fSkipToEventTxt->SetFocus();
1131 error.Form("Only %d event(s) in the run !",fEventsPerRun);
1132 DoErrorGUI(error.Data());
1135 if (fRawReader->NextEvent()) {
1138 AliMUONDigitMaker digitMaker;
1139 digitMaker.SetMakeTriggerDigits(kTRUE);
1140 digitMaker.Raw2Digits(fRawReader,fRawDigitStore,fRawTriggerStore);
1142 fEvString->Form("%d",fCurrentRawEvent);
1143 fTxtBuffer2->RemoveText(0,5);
1144 fTxtBuffer2->AddText(0,fEvString->Data());
1145 fSkipToEventTxt->SetFocus();
1153 //__________________________________________________________________________
1154 void AliMUONTriggerGUI::DoPreviousEvent()
1156 /// load previous event from the input file
1158 TString error = TString("");
1163 fRunLoader->GetEvent(fEvent);
1165 fEvString->Form("%d",fEvent);
1166 fTxtBuffer2->RemoveText(0,5);
1167 fTxtBuffer2->AddText(0,fEvString->Data());
1168 fSkipToEventTxt->SetFocus();
1171 error.Form("Already at event 0 !");
1172 DoErrorGUI(error.Data());
1175 if (fCurrentRawEvent > 0) {
1177 fRawReader->GotoEvent(fCurrentRawEvent);
1179 AliMUONDigitMaker digitMaker;
1180 digitMaker.SetMakeTriggerDigits(kTRUE);
1181 digitMaker.Raw2Digits(fRawReader,fRawDigitStore,fRawTriggerStore);
1183 fEvString->Form("%d",fCurrentRawEvent);
1184 fTxtBuffer2->RemoveText(0,5);
1185 fTxtBuffer2->AddText(0,fEvString->Data());
1186 fSkipToEventTxt->SetFocus();
1194 //__________________________________________________________________________
1195 void AliMUONTriggerGUI::DoSkipToEvent()
1197 /// skip to event -input- from the input file
1199 TString error = TString("");
1201 TString es = TString(fTxtBuffer2->GetString());
1205 if (fEvent < 0 || fEvent > (fEventsPerRun-1)) {
1206 error.Form("Event number out of range !");
1207 DoErrorGUI(error.Data());
1209 fRunLoader->GetEvent(fEvent);
1212 if (fRawReader->GotoEvent(fEvent)) {
1213 fCurrentRawEvent = fEvent;
1215 AliMUONDigitMaker digitMaker;
1216 digitMaker.SetMakeTriggerDigits(kTRUE);
1217 digitMaker.Raw2Digits(fRawReader,fRawDigitStore,fRawTriggerStore);
1219 fEvString->Form("%d",fCurrentRawEvent);
1220 fTxtBuffer2->RemoveText(0,5);
1221 fTxtBuffer2->AddText(0,fEvString->Data());
1222 fSkipToEventTxt->SetFocus();
1229 //__________________________________________________________________________
1230 void AliMUONTriggerGUI::DoErrorOK()
1232 /// close the error frame
1234 fError->SendCloseMessage();
1238 //__________________________________________________________________________
1239 void AliMUONTriggerGUI::DoControlClose()
1241 /// close the event control frame
1243 fControl->SendCloseMessage();
1244 fControlOn = kFALSE;
1248 //__________________________________________________________________________
1249 void AliMUONTriggerGUI::DoCircuitCancel()
1251 /// close the circuit frame
1253 fCircuit->SendCloseMessage();
1257 //__________________________________________________________________________
1258 void AliMUONTriggerGUI::DoFETRegOnCancel()
1260 /// close the FET regional on window
1262 fFETRegOn->SendCloseMessage();
1266 //__________________________________________________________________________
1267 void AliMUONTriggerGUI::DoFETRegOffCancel()
1269 /// close the FET regional off window
1271 fFETRegOff->SendCloseMessage();
1275 //__________________________________________________________________________
1276 void AliMUONTriggerGUI::DoFETRegRun(Int_t onoff)
1278 /// FET ON/OFF for the regional crate
1282 crateName = TString(fTxtFETRegOn->GetString());
1284 crateName = TString(fTxtFETRegOff->GetString());
1286 AliMUONTriggerGUIboard *board;
1289 for (Int_t ib = 0; ib < kNBoards; ib++) {
1290 board = (AliMUONTriggerGUIboard*)fBoards->At(ib);
1291 if (strcmp(board->GetCrateName(),crateName.Data()) != 0) continue;
1297 //__________________________________________________________________________
1298 void AliMUONTriggerGUI::DoFETRegOnRun()
1300 /// FET ON for the regional crate
1303 fFETRegOn->SendCloseMessage();
1307 //__________________________________________________________________________
1308 void AliMUONTriggerGUI::DoFETRegOffRun()
1310 /// FET ON for the regional crate
1313 fFETRegOff->SendCloseMessage();
1317 //__________________________________________________________________________
1318 void AliMUONTriggerGUI::DoCircuitOpen()
1322 TString cs = TString(fTxtCircuit->GetString());
1323 Int_t icirc = cs.Atoi();
1325 AliMUONTriggerGUIboard *board;
1327 for (Int_t ib = 0; ib < kNBoards; ib++) {
1329 board = GetBoard(ib);
1331 if (board->GetIdCircuit() == icirc) {
1336 if (fDiMap->IsOn()) {
1337 fDiMap->SelectBoard(ib);
1341 fCircuit->SendCloseMessage();
1349 //__________________________________________________________________________
1350 AliMUONTriggerGUIboard* AliMUONTriggerGUI::GetBoard(Int_t id) const
1352 /// return board with "id"
1354 if (fBoards == 0) return 0;
1355 void * b = fBoards->UncheckedAt(id);
1356 if (b == 0) return 0;
1358 return (AliMUONTriggerGUIboard*)b;
1362 //__________________________________________________________________________
1363 void AliMUONTriggerGUI::OpenBoard(Int_t id)
1365 /// open board with "id" in a new frame
1367 AliMUONTriggerGUIboard *board = GetBoard(id);
1368 UShort_t status = board->GetStatus();
1369 board->SetOpen(kTRUE);
1371 AliMUONTriggerGUIbdmap *bf;
1374 bf = new AliMUONTriggerGUIbdmap(gClient->GetRoot(), fMain, 400, 200);
1376 if (status & kGood) {
1377 snprintf(text,200,"%s (Circuit %4d) status : working",
1378 board->GetBoardName(),board->GetIdCircuit());
1381 if (status & kWithProblems) {
1382 snprintf(text,200,"%s (Circuit %4d) status : has problems...",
1383 board->GetBoardName(),board->GetIdCircuit());
1386 if (status & kNotWorking) {
1387 snprintf(text,200,"%s (Circuit %4d) status : not working",
1388 board->GetBoardName(),board->GetIdCircuit());
1391 if (status & kUnknown) {
1392 snprintf(text,200,"%s (Circuit %4d) status : unknown",
1393 board->GetBoardName(),board->GetIdCircuit());
1397 bf->SetBoard(Boards(),id);
1398 bf->SetLoader(fLoader);
1399 bf->SetCrateManager(fCrateManager);
1401 bf->SetRawDigitStore(fRawDigitStore);
1402 bf->SetRawTriggerStore(fRawTriggerStore);
1404 bf->SetMCDataInterface(fMCDataInterface);
1411 if (fDiMap->IsOn()) {
1412 fDiMap->SelectBoard(id);
1418 //__________________________________________________________________________
1419 void AliMUONTriggerGUI::Init()
1421 /// initialize the main GUI frame
1428 AliMUONTriggerGUIboard *board;
1429 for (Int_t ib = 0; ib < kNBoards; ib++) {
1430 board = GetBoard(ib);
1436 //__________________________________________________________________________
1437 void AliMUONTriggerGUI::InitBoards()
1439 /// create board objects and define the sensitive regions in the image map
1441 fBoardsInit = kTRUE;
1444 if (fCrateManager == 0x0) {
1445 fCrateManager = new AliMUONTriggerCrateStore();
1446 fCrateManager->ReadFromFile(fCalibrationData);
1449 // create boards geometry from the mapping
1450 AliMUONTriggerGUIboard *board;
1451 for (Int_t ib = 0; ib < kNBoards; ib++) {
1452 Boards()->Add(new AliMUONTriggerGUIboard());
1455 // circuit number to board number in array
1456 Int_t cIdtobId[235];
1457 for (Int_t i = 0; i < 235; i++) cIdtobId[i] = -1;
1461 Int_t manuIdPrev, ich, idet, boardIdTmp = -1;
1462 for (Int_t chamber = 0; chamber < kNMT; chamber++) {
1463 for ( it.First(); ! it.IsDone(); it.Next() ) {
1465 if (it.CurrentDEId()/100 < 11) continue;
1467 ich = it.CurrentDEId()/100 - 11;
1468 if (ich != chamber) continue;
1469 idet = it.CurrentDEId()%100;
1471 const AliMpVSegmentation* seg0 = AliMpSegmentation::Instance()->GetMpSegmentation(it.CurrentDEId(), AliMp::kCath0);
1472 const AliMpVSegmentation* seg1 = AliMpSegmentation::Instance()->GetMpSegmentation(it.CurrentDEId(), AliMp::kCath1);
1476 for (Int_t ix = 0; ix <= seg0->MaxPadIndexX(); ix++) {
1477 for (Int_t iy = 0; iy <= seg0->MaxPadIndexY(); iy++) {
1478 AliMpPad pad = seg0->PadByIndices(ix,iy,kFALSE);
1479 if (pad.IsValid()) {
1480 Int_t manuId = pad.GetLocalBoardId(0);
1481 if (manuId != manuIdPrev) {
1482 AliMpLocalBoard *mpboard = AliMpDDLStore::Instance()->GetLocalBoard(manuId);
1483 manuIdPrev = manuId;
1487 boardId = cIdtobId[manuId];
1489 board = GetBoard(boardId);
1490 if (board->GetNumber() == -1)
1491 board->SetNumber(boardId);
1492 if (board->GetDetElemId() == -1)
1493 board->SetDetElemId(idet);
1494 if (!strcmp(board->GetBoardName(),""))
1495 board->SetBoardName(mpboard->GetName());
1496 cIdtobId[manuId] = boardId;
1498 GetBoard(boardId)->AddPadX(pad,ich);
1501 } // end plane 0 (x-strips)
1505 for (Int_t ix = 0; ix <= seg1->MaxPadIndexX(); ix++) {
1506 for (Int_t iy = 0; iy <= seg1->MaxPadIndexY(); iy++) {
1507 AliMpPad pad = seg1->PadByIndices(ix,iy,kFALSE);
1508 if (pad.IsValid()) {
1509 Int_t nloc = pad.GetNofLocations();
1510 for (Int_t iloc = 0; iloc < nloc; iloc++) {
1511 Int_t manuId = pad.GetLocalBoardId(iloc);
1512 if (manuId != manuIdPrev) {
1513 manuIdPrev = manuId;
1514 boardIdTmp = cIdtobId[manuId];
1516 GetBoard(boardIdTmp)->AddPadY(pad,ich);
1520 } // end plane 1 (y-strips)
1522 } // end det elem loop
1523 } // end chamber loop
1525 for (Int_t ib = 0; ib < kNBoards; ib++) {
1526 board = GetBoard(ib);
1527 board->MakeGeometry();
1528 AliMUONLocalTriggerBoard* b = fCrateManager->LocalBoard(board->GetIdCircuit());
1529 board->SetCrateName((b->GetCrate()).Data());
1532 // create the sensitive map
1534 Int_t nPixelX = 700;
1535 Int_t nPixelY = 676;
1537 Int_t nPixelBorderX = 40; // to guess...
1538 Int_t nPixelBorderY = 40; // to guess...
1541 Float_t boardsX = 2*257.00; // cm
1542 Float_t boardsY = 2*306.61; // cm
1544 UShort_t status = 1;
1545 Float_t xc, yc, xw, yw;
1554 // regions for the image map (from MT11)
1556 for (Int_t ib = 0; ib < kNBoards; ib++) {
1558 board = GetBoard(ib);
1561 board->SetStatus(status);
1563 xc = board->GetXCenter(0);
1564 yc = board->GetYCenter(0);
1565 xw = board->GetXWidth(0);
1566 yw = board->GetYWidth(0);
1568 x = (Int_t)(nPixelX/2 + xc * (nPixelX - 2*nPixelBorderX)/boardsX);
1569 y = (Int_t)(nPixelY/2 - yc * (nPixelY - 2*nPixelBorderY)/boardsY);
1574 w = (UInt_t)(xw*(nPixelX-2*nPixelBorderX)/boardsX);
1575 h = (UInt_t)(yw*(nPixelY-2*nPixelBorderY)/boardsY);
1589 reg = new TGRegion(5,xp,yp);
1590 fImageMap->AddRegion(*reg, ib);
1592 snprintf(text,256,"%s (crate %s circuit %3d, number %3d)",board->GetBoardName(),board->GetCrateName(),board->GetIdCircuit(),board->GetNumber());
1593 fImageMap->SetToolTipText(ib, text);
1595 // Set coordinates of strips boxes
1597 SetStripBoxes(board);
1599 //board->PrintBoard();
1605 //__________________________________________________________________________
1606 void AliMUONTriggerGUI::SetStripBoxes(AliMUONTriggerGUIboard *board)
1608 /// set coordinates of strip boxes
1610 AliMUONGeometryTransformer transformer;
1611 transformer.LoadGeometryData("transform.dat");
1613 const AliMpVSegmentation* seg;
1617 Int_t chamber, detElemId, maxX, maxY;
1618 Float_t xpmin, xpmax, ypmin, ypmax;
1619 Float_t xg1, xg2, yg1, yg2, zg1;
1620 Float_t xlocal1, xlocal2, ylocal1, ylocal2;
1621 Float_t xCenter, yCenter, xWidth, yWidth;
1623 for (Int_t i = 0; i < kNMT; i++) {
1627 xCenter = board->GetXCenter(i);
1628 yCenter = board->GetYCenter(i);
1629 xWidth = board->GetXWidth(i);
1630 yWidth = board->GetYWidth(i);
1632 for ( it.First(chamber-1); ! it.IsDone(); it.Next() ) {
1634 detElemId = it.CurrentDEId();
1636 if (detElemId%100 != board->GetDetElemId()) continue;
1638 /*---------- y-pads cath = 1 ----------*/
1640 seg = AliMpSegmentation::Instance()->GetMpSegmentation(detElemId, AliMp::kCath1);
1642 maxX = seg->MaxPadIndexX();
1643 maxY = seg->MaxPadIndexY();
1645 for (Int_t ix = 0; ix <= maxX; ix++) {
1646 for (Int_t iy = 0; iy <= maxY; iy++) {
1648 pad = seg->PadByIndices(ix,iy,kFALSE);
1650 if (!pad.IsValid()) continue;
1652 // get the pad position and dimensions
1653 xlocal1 = pad.GetPositionX();
1654 ylocal1 = pad.GetPositionY();
1655 xlocal2 = pad.GetDimensionX();
1656 ylocal2 = pad.GetDimensionY();
1658 transformer.Local2Global(detElemId, xlocal1, ylocal1, 0, xg1, yg1, zg1);
1659 // (no transformation for pad dimensions)
1663 // transform in the monitor coordinate system
1675 Int_t iX1, iX2, iY, ixDig;
1676 iX1 = board->GetYSix1();
1677 iX2 = board->GetYSix2();
1678 iY = board->GetYSiy();
1679 if (ix >= iX1 && ix <= iX2 && iy == iY) {
1681 ypmin = -0.5*yWidth;
1682 ypmax = +0.5*yWidth;
1686 board->SetYDigBox(i,ixDig,(Double_t)xpmin,(Double_t)ypmin,
1687 (Double_t)xpmax,(Double_t)ypmax);
1694 /*---------- x-pads cath = 0 ----------*/
1696 seg = AliMpSegmentation::Instance()->GetMpSegmentation(detElemId, AliMp::kCath0);
1698 maxX = seg->MaxPadIndexX();
1699 maxY = seg->MaxPadIndexY();
1701 for (Int_t ix = 0; ix <= maxX; ix++) {
1702 for (Int_t iy = 0; iy <= maxY; iy++) {
1704 pad = seg->PadByIndices(ix,iy,kFALSE);
1706 if (!pad.IsValid()) continue;
1708 // get the pad position and dimensions
1709 xlocal1 = pad.GetPositionX();
1710 ylocal1 = pad.GetPositionY();
1711 xlocal2 = pad.GetDimensionX();
1712 ylocal2 = pad.GetDimensionY();
1714 transformer.Local2Global(detElemId, xlocal1, ylocal1, 0, xg1, yg1, zg1);
1715 // (no transformation for pad dimensions)
1719 // transform in the monitor coordinate system
1731 Int_t iX, iY1, iY2, iyDig;
1732 iX = board->GetXSix();
1733 iY1 = board->GetXSiy1();
1734 iY2 = board->GetXSiy2();
1735 if (ix == iX && iy >= iY1 && iy <= iY2) {
1739 board->SetXDigBox(i,iyDig,(Double_t)xpmin,(Double_t)ypmin,
1740 (Double_t)xpmax,(Double_t)ypmax);
1753 //__________________________________________________________________________
1754 void AliMUONTriggerGUI::CreateDigitStore()
1756 /// create memory resident digits store with set strips
1758 Int_t nstripX, nstripY, detElemId, charge, ix, iy, iX1, iY1;
1759 Int_t cathode, maxX, maxY;
1760 Int_t manuId, manuChannel;
1761 const AliMpVSegmentation* seg;
1763 AliMUONTriggerGUIboard* board;
1766 for (Int_t ib = 0; ib < kNBoards; ib++) {
1768 board = (AliMUONTriggerGUIboard*)fBoards->At(ib);
1769 if (board == 0) continue;
1771 nstripX = board->GetNStripX();
1772 nstripY = board->GetNStripY();
1773 for (Int_t ichamber = 11; ichamber <= 14; ichamber++) {
1775 detElemId = ichamber * 100 + board->GetDetElemId();
1778 for (Int_t isx = 0; isx < nstripX; isx++) {
1780 charge = (Int_t)board->GetXDig(ichamber-11,isx);
1781 if (charge == 0) continue;
1782 ix = board->GetXSix();
1783 iY1 = board->GetXSiy1();
1785 seg = AliMpSegmentation::Instance()->GetMpSegmentation(detElemId, AliMp::GetCathodType(cathode));
1786 maxX = seg->MaxPadIndexX();
1787 maxY = seg->MaxPadIndexY();
1788 if (ix > maxX) printf("Index x > maximum!\n");
1789 if (iy > maxY) printf("Index y > maximum!\n");
1790 pad = seg->PadByIndices(ix,iy,kTRUE);
1791 manuId = pad.GetLocalBoardId(0);
1792 manuChannel = pad.GetLocalBoardChannel(0);
1794 dig = fDigitStore->Add(detElemId,manuId,manuChannel,cathode,AliMUONVDigitStore::kAllow);
1795 dig->SetCharge(charge);
1796 dig->SetPadXY(ix,iy);
1797 //printf("Cathode 0: ix %3d iy %3d manuId %3d manuChannel %3d \n",ix,iy,manuId,manuChannel);
1803 for (Int_t isy = 0; isy < nstripY; isy++) {
1805 charge = board->GetYDig(ichamber-11,isy);
1806 if (charge == 0) continue;
1807 iX1 = board->GetYSix1();
1809 iy = board->GetYSiy();
1810 seg = AliMpSegmentation::Instance()->GetMpSegmentation(detElemId, AliMp::GetCathodType(cathode));
1811 maxX = seg->MaxPadIndexX();
1812 maxY = seg->MaxPadIndexY();
1813 if (ix > maxX) printf("Index x > maximum!\n");
1814 if (iy > maxY) printf("Index y > maximum!\n");
1815 pad = seg->PadByIndices(ix,iy,kTRUE);
1816 manuId = pad.GetLocalBoardId(0);
1817 manuChannel = pad.GetLocalBoardChannel(0);
1819 dig = fDigitStore->Add(detElemId,manuId,manuChannel,cathode,AliMUONVDigitStore::kAllow);
1820 dig->SetCharge(charge);
1821 dig->SetPadXY(ix,iy);
1822 //printf("Cathode 1: ix %3d iy %3d manuId %3d manuChannel %3d \n",ix,iy,manuId,manuChannel);
1832 //__________________________________________________________________________
1833 void AliMUONTriggerGUI::PrintDigitStore() const
1835 /// Print the digits created in the GUI
1837 const AliMpVSegmentation* seg;
1839 Int_t ix, iy, charge, detElemId, cathode;
1842 for (Int_t i = 0; i < kNMT; i++) {
1846 MpPair_t deRange = AliMpDEManager::GetDetElemIdRange(chamber-1);
1847 TIter next(fDigitStore->CreateIterator(AliMp::PairFirst(deRange),AliMp::PairSecond(deRange)));
1848 AliMUONVDigit *mdig;
1850 while ( ( mdig = static_cast<AliMUONVDigit*>(next())) )
1852 cathode = mdig->Cathode();
1856 detElemId = mdig->DetElemId();
1857 charge = (Int_t)mdig->Charge();
1859 seg = AliMpSegmentation::Instance()->GetMpSegmentation(detElemId, AliMp::GetCathodType(cathode));
1860 pad = seg->PadByIndices(ix,iy,kTRUE);
1862 printf("Digit: detElemId %4d cath %1d ix %2d iy %3d charge %1d \n",detElemId,cathode,ix,iy,charge);
1870 //__________________________________________________________________________
1871 void AliMUONTriggerGUI::CreateTriggerStore()
1873 /// Process the DSET digit store and fill the trigger store
1875 if (fDigitStore->GetSize() == 0) {
1876 printf("The digit store is empty...\n");
1881 AliMUONVDigitStore *digitStore = static_cast<AliMUONVDigitStore*>(fDigitStore);
1883 fTriggerProcessor->Digits2Trigger(*digitStore,*fTriggerStore);
1887 //__________________________________________________________________________
1888 void AliMUONTriggerGUI::PrintTriggerStore() const
1890 /// Print the trigger output for DSET digits store
1892 if (!fTStoreOn) return;
1894 TIter next(fTriggerStore->CreateLocalIterator());
1896 UShort_t x2m, x2u, x2d;
1897 Int_t loStripX, loStripY, loDev, loCircuit, iStripX, iStripY, loLpt, loHpt;
1898 AliMUONLocalTrigger *mlt;
1899 while ( ( mlt = static_cast<AliMUONLocalTrigger*>(next()) ) )
1901 loCircuit = mlt->LoCircuit();
1903 AliMUONLocalTriggerBoard* ltb = fCrateManager->LocalBoard(loCircuit);
1904 x2d = ltb->GetSwitch(0);
1905 x2m = ltb->GetSwitch(1);
1906 x2u = ltb->GetSwitch(2);
1908 loStripX = mlt->LoStripX();
1909 loStripY = mlt->LoStripY();
1910 loDev = mlt->LoDev();
1911 loLpt = mlt->LoLpt();
1912 loHpt = mlt->LoHpt();
1914 iStripX = loStripX/2;
1915 if ((x2u == 1 || x2m == 1 || x2d == 1) && x2m == 1) {
1916 iStripY = loStripY/2;
1921 printf("Circ %3d Xs %2d Ys %2d Dev %2d Lpt %1d Hpt %1d \n",loCircuit,loStripX,loStripY,loDev,loLpt,loHpt);
1923 AliMUONGlobalTrigger *globalTrigger = fTriggerStore->Global();
1924 globalTrigger->Print();
1930 //__________________________________________________________________________
1931 void AliMUONTriggerGUI::WriteTriggerRawData()
1933 /// Write raw data (DATE and ROOT) for the trigger store from
1934 /// the DSET digit store
1937 printf("The trigger store is empty... \n");
1943 AliMUONRawWriter *rawWriter = new AliMUONRawWriter();
1944 AliRawDataHeaderSim header;
1945 rawWriter->SetHeader(header);
1946 rawWriter->Digits2Raw(0,fTriggerStore);
1950 // raw data (ddl) to date
1951 // AliSimulation::ConvertRawFilesToDate
1954 char dateFileName[256];
1955 snprintf(dateFileName,256,"TriggerGUI.date");
1956 snprintf(command, 256,"dateStream -c -s -D -o %s -# %d -C -run %d",
1957 dateFileName, 1, 0);
1958 FILE* pipe = gSystem->OpenPipe(command, "w");
1960 UInt_t detectorPattern = 0;
1961 fprintf(pipe, "GDC DetectorPattern %u\n", detectorPattern);
1965 // loop over detectors and DDLs
1966 for (Int_t iDet = 0; iDet < AliDAQ::kNDetectors; iDet++) {
1967 for (Int_t iDDL = 0; iDDL < AliDAQ::NumberOfDdls(iDet); iDDL++) {
1969 Int_t ddlID = AliDAQ::DdlID(iDet,iDDL);
1970 Int_t ldcID = Int_t(ldc + 0.0001);
1971 ldc += AliDAQ::NumberOfLdcs(iDet) / AliDAQ::NumberOfDdls(iDet);
1973 char rawFileName[256];
1974 snprintf(rawFileName, 256,"%s",AliDAQ::DdlFileName(iDet,iDDL));
1975 // check existence and size of raw data file
1976 FILE* file = fopen(rawFileName, "rb");
1977 if (!file) continue;
1978 fseek(file, 0, SEEK_END);
1979 unsigned long size = ftell(file);
1981 if (!size) continue;
1983 if (ldcID != prevLDC) {
1984 fprintf(pipe, " LDC Id %d\n", ldcID);
1987 fprintf(pipe, " Equipment Id %d Payload %s\n", ddlID, rawFileName);
1990 Int_t result = gSystem->ClosePipe(pipe);
1992 // raw data (date) to root
1993 // AliSimulation::ConvertDateToRoot
1995 char rootFileName[256];
1996 snprintf(rootFileName,256,"TriggerGUI.root");
1999 const Int_t kDBSize = 2000000000;
2000 const Int_t kTagDBSize = 1000000000;
2001 const Bool_t kFilter = kFALSE;
2002 const Int_t kCompression = 1;
2004 char* path = gSystem->Which(gSystem->Getenv("PATH"), "alimdc");
2006 printf("the program alimdc was not found\n");
2012 printf("converting DATE file %s to root file %s \n",
2013 dateFileName, rootFileName);
2015 const char* rawDBFS[2] = { "/tmp/mdc1", "/tmp/mdc2" };
2016 const char* tagDBFS = "/tmp/mdc1/tags";
2018 // User defined file system locations
2019 if (gSystem->Getenv("ALIMDC_RAWDB1"))
2020 rawDBFS[0] = gSystem->Getenv("ALIMDC_RAWDB1");
2021 if (gSystem->Getenv("ALIMDC_RAWDB2"))
2022 rawDBFS[1] = gSystem->Getenv("ALIMDC_RAWDB2");
2023 if (gSystem->Getenv("ALIMDC_TAGDB"))
2024 tagDBFS = gSystem->Getenv("ALIMDC_TAGDB");
2026 gSystem->Exec(Form("rm -rf %s",rawDBFS[0]));
2027 gSystem->Exec(Form("rm -rf %s",rawDBFS[1]));
2028 gSystem->Exec(Form("rm -rf %s",tagDBFS));
2030 gSystem->Exec(Form("mkdir %s",rawDBFS[0]));
2031 gSystem->Exec(Form("mkdir %s",rawDBFS[1]));
2032 gSystem->Exec(Form("mkdir %s",tagDBFS));
2034 result = gSystem->Exec(Form("alimdc %d %d %d %d %s",
2035 kDBSize, kTagDBSize, kFilter, kCompression,
2037 gSystem->Exec(Form("mv %s/*.root %s", rawDBFS[0], rootFileName));
2039 gSystem->Exec(Form("rm -rf %s",rawDBFS[0]));
2040 gSystem->Exec(Form("rm -rf %s",rawDBFS[1]));
2041 gSystem->Exec(Form("rm -rf %s",tagDBFS));
2045 //__________________________________________________________________________
2046 void AliMUONTriggerGUI::FETboard(Int_t ib, Int_t amp)
2048 /// Front End test set all strips for board with index "ib"
2049 /// AliMUONTriggerGUIbdmap::DoDigits()
2051 AliMUONTriggerGUIboard *board;
2052 AliMUONTriggerGUIboard *btmp;
2053 Int_t pos, over, number, nStripX, nStripY;
2055 board = (AliMUONTriggerGUIboard*)fBoards->At(ib);
2056 if (board == 0) return;
2058 nStripX = board->GetXSiy2() - board->GetXSiy1() + 1;
2059 nStripY = board->GetYSix2() - board->GetYSix1() + 1;
2061 number = board->GetNumber();
2062 pos = board->GetPosition();
2063 over = board->GetYOver();
2065 for (Int_t imt = 0; imt < kNMT; imt++) {
2067 for (Int_t ix = 0; ix < nStripX; ix++) {
2068 board->SetDigitX(imt,ix,amp);
2071 for (Int_t iy = 0; iy < nStripY; iy++) {
2072 board->SetDigitY(imt,iy,amp);
2074 // extended y-strips
2075 for (Int_t io = 1; io <= over; io++) {
2076 if (io == pos) continue;
2077 btmp = (AliMUONTriggerGUIboard*)fBoards->UncheckedAt(number+io-pos);
2078 btmp->SetDigitY(imt,iy,amp);
2087 //__________________________________________________________________________
2088 void AliMUONTriggerGUI::FET(Int_t onoff)
2090 /// Front End test set all strips for all boards
2091 /// AliMUONTriggerGUIbdmap::DoDigits()
2095 for (Int_t ib = 0; ib < kNBoards; ib++) {
2101 //__________________________________________________________________________
2102 void AliMUONTriggerGUI::ClearDigitStore()
2104 /// Clear the DSET digit store
2106 fDigitStore->Clear();
2110 //__________________________________________________________________________
2111 void AliMUONTriggerGUI::ClearTriggerStore()
2113 /// Clear the trigger store from the DSET digit store
2115 fTriggerStore->Clear();