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>
75 ClassImp(AliMUONTriggerGUI)
78 //__________________________________________________________________________
79 AliMUONTriggerGUI::AliMUONTriggerGUI(Int_t runNumber)
110 fTriggerProcessor(0),
117 fCurrentRawEvent(-1),
121 /// main GUI frame of the trigger monitor
130 fFileName = new TString("");
131 fEvString = new TString("");
132 fPath = new TString("");
134 fDigitStore = new AliMUONDigitStoreV2R;
135 fDigitStore->Create();
137 fTriggerStore = new AliMUONTriggerStoreV1;
138 fTriggerStore->Create();
140 fRawDigitStore = new AliMUONDigitStoreV1;
141 fRawDigitStore->Create();
143 fRawTriggerStore = new AliMUONTriggerStoreV1;
144 fRawTriggerStore->Create();
146 fCDBManager = AliCDBManager::Instance();
147 fCDBManager->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
148 fCDBManager->SetRun(runNumber);
149 AliMpCDB::LoadDDLStore();
150 fCalibrationData = new AliMUONCalibrationData(runNumber);
152 fTriggerProcessor = new AliMUONTriggerElectronics(fCalibrationData);
156 fMain = new TGMainFrame(gClient->GetRoot(), 750, 420);
157 fMain->Connect("CloseWindow()", "AliMUONTriggerGUI", this, "CloseWindow()");
161 TGMenuBar *menuBar = new TGMenuBar(fMain);
165 TGPopupMenu *menuFile = new TGPopupMenu(gClient->GetRoot());
166 //menuFile->AddLabel("");
168 menuFile->AddEntry("Run input", kMFILERUN);
169 menuFile->AddEntry("Control", kMFILECNTRL);
170 menuFile->AddEntry("Exit", kMFILEEXIT);
172 menuFile->Connect("Activated(Int_t)", "AliMUONTriggerGUI", this, "HandleMenu(Int_t)");
176 TGPopupMenu *menuCircuit = new TGPopupMenu(gClient->GetRoot());
177 //menuCircuit->AddLabel("");
179 menuCircuit->AddEntry("Open", kMCIRCUITOPEN);
181 menuCircuit->Connect("Activated(Int_t)", "AliMUONTriggerGUI", this, "HandleMenu(Int_t)");
185 TGPopupMenu *menuMap = new TGPopupMenu(gClient->GetRoot());
186 //menuMap->AddLabel("");
188 menuMap->AddEntry("Digits map", kMMAPDIGITS);
189 menuMap->AddEntry("Reset digits", kMRESETDIGITS);
191 menuMap->Connect("Activated(Int_t)", "AliMUONTriggerGUI", this,
192 "HandleMenu(Int_t)");
196 TGPopupMenu *menuTrigger = new TGPopupMenu(gClient->GetRoot());
198 TGPopupMenu *menuTriggerD = new TGPopupMenu(gClient->GetRoot());
199 TGPopupMenu *menuTriggerT = new TGPopupMenu(gClient->GetRoot());
200 TGPopupMenu *menuTriggerF = new TGPopupMenu(gClient->GetRoot());
202 menuTrigger->AddPopup("Digit store", menuTriggerD);
203 menuTrigger->AddSeparator();
204 menuTrigger->AddPopup("Trigger store",menuTriggerT);
205 menuTrigger->AddSeparator();
206 menuTrigger->AddPopup("Front End Test", menuTriggerF);
207 menuTrigger->AddSeparator();
209 menuTriggerD->AddEntry("Create", kMDSTORE);
210 menuTriggerD->AddEntry("Print", kMDSTOREP);
211 menuTriggerD->AddEntry("Clear", kMDSTORECL);
212 menuTriggerT->AddEntry("Create", kMTSTORE);
213 menuTriggerT->AddEntry("Print", kMTSTOREP);
214 menuTriggerT->AddEntry("Clear", kMTSTORECL);
215 menuTriggerF->AddEntry("On", kMFETON);
216 menuTriggerF->AddEntry("Off", kMFETOFF);
217 menuTriggerF->AddEntry("Reg On", kMFETREGON);
218 menuTriggerF->AddEntry("Reg Off",kMFETREGOFF);
219 menuTrigger->AddEntry("Write raw data", kMTRAWDATA);
221 menuTrigger->Connect("Activated(Int_t)", "AliMUONTriggerGUI", this, "HandleMenu(Int_t)");
223 // Add menus to the menu bar
225 menuBar->AddPopup("File", menuFile,
226 new TGLayoutHints(kLHintsTop | kLHintsLeft, 5,5,2,2)
229 menuBar->AddPopup("Maps", menuMap,
230 new TGLayoutHints(kLHintsTop | kLHintsLeft, 5,5,2,2)
233 menuBar->AddPopup("Circuit", menuCircuit,
234 new TGLayoutHints(kLHintsTop | kLHintsLeft, 5,5,2,2)
237 menuBar->AddPopup("TriggerDSET", menuTrigger,
238 new TGLayoutHints(kLHintsTop | kLHintsLeft, 5,5,2,2)
241 // Add menu bar to the main frame
243 fMain->AddFrame(menuBar,
244 new TGLayoutHints(kLHintsTop |
252 fImageMap = new TGImageMap(fMain,"$ALICE_ROOT/MUON/data/guimap.gif");
254 fImageMap->Connect("RegionClicked(Int_t)", "AliMUONTriggerGUI", this, "OpenBoard(Int_t)");
256 fImageMap->SetToolTipText("Map of the local boards as seen from the I.P.");
258 // Add image map to the main frame
260 fMain->AddFrame(fImageMap);
261 fMain->SetWindowName("Map of the local boards as seen from the I.P.");
263 // Resize the main frame
265 TGDimension size = fMain->GetDefaultSize();
268 fMain->MapSubwindows();
272 fBoardsInit = kFALSE;
278 //__________________________________________________________________________
279 void AliMUONTriggerGUI::HandleMenu(Int_t id)
281 /// handles entry numbers in the available menus (EMenuIdentifiers)
283 TGCompositeFrame *runInput1, *runInput2, *runInput3;
284 TGCompositeFrame *control1, *control2, *circuit1, *circuit2;
285 TGCompositeFrame *fetregon1, *fetregon2;
286 TGCompositeFrame *fetregoff1, *fetregoff2;
287 TGLabel *runL1, *runL2, *circuitL1, *fetregonL1, *fetregoffL1;
288 TGTextEntry *runText1, *runText2, *circuitText1;
289 TGTextEntry *fetregonText1, *fetregoffText1;
290 TGTextButton *runApply1, *runApply2, *runCancel;
291 TGTextButton *controlClose, *nextEvent, *previousEvent, *skipToEvent;
292 TGTextButton *circuitCancel, *circuitOpen;
293 TGTextButton *fetregonCancel, *fetregoffCancel;
294 TGTextButton *fetregonRun, *fetregoffRun;
308 fRunInput = new TGTransientFrame(gClient->GetRoot(), fMain, 400, 200);
309 fRunInput->Connect("CloseWindow()", "AliMUONTriggerGUI", this, "CloseRunInput()");
310 fRunInput->DontCallClose(); // to avoid double deletions.
312 // use hierarchical cleaning
313 fRunInput->SetCleanup(kDeepCleanup);
315 fRunInput->SetWindowName("Input file and event number");
317 // input galice and event number frames
319 runInput1 = new TGCompositeFrame(fRunInput, 400, 200, kHorizontalFrame);
320 runInput2 = new TGCompositeFrame(fRunInput, 400, 200, kHorizontalFrame);
324 runL1 = new TGLabel(runInput1, new TGString("Full file path:"));
325 runL2 = new TGLabel(runInput2, new TGString("Event number:"));
329 runText1 = new TGTextEntry(runInput1, fTxtBuffer1 = new TGTextBuffer(100));
331 runText1->SetToolTipText("Enter the path to galice.root or the raw data file (root)");
332 runText1->Resize(300, runText1->GetDefaultHeight());
334 // event number text entry
336 runText2 = new TGTextEntry(runInput2, fTxtBuffer2 = new TGTextBuffer(5));
338 fEvString->Form("%d",0);
339 fTxtBuffer2->AddText(0,fEvString->Data());
341 runText2->SetToolTipText("Enter the first event number to start with");
342 runText2->Resize(300, runText2->GetDefaultHeight());
344 // add to galice frame
346 runInput1->AddFrame(runL1,
347 new TGLayoutHints(kLHintsLeft |
352 runInput1->AddFrame(runText1,
353 new TGLayoutHints(kLHintsRight |
358 // add to event number frame
360 runInput2->AddFrame(runL2,
361 new TGLayoutHints(kLHintsLeft |
366 runInput2->AddFrame(runText2,
367 new TGLayoutHints(kLHintsRight |
372 // add input frames to main input frame
374 fRunInput->AddFrame(runInput1,
375 new TGLayoutHints(kLHintsTop | kLHintsExpandX, 2, 2, 3, 0));
377 fRunInput->AddFrame(runInput2,
378 new TGLayoutHints(kLHintsTop | kLHintsExpandX, 2, 2, 3, 0));
380 // frame with buttons
382 runInput3 = new TGCompositeFrame(fRunInput, 400, 200, kHorizontalFrame);
386 runApply1 = new TGTextButton(runInput3, "Apply (galice)", 1);
387 runApply1->Connect("Clicked()", "AliMUONTriggerGUI", this, "DoRunGalApply()");
388 runApply1->SetToolTipText("Apply changes (galice input)");
390 runApply2 = new TGTextButton(runInput3, "Apply (raw)", 1);
391 runApply2->Connect("Clicked()", "AliMUONTriggerGUI", this, "DoRunRawApply()");
392 runApply2->SetToolTipText("Apply changes (raw data input)");
394 runCancel = new TGTextButton(runInput3, "Cancel", 2);
395 runCancel->Connect("Clicked()", "AliMUONTriggerGUI", this, "DoRunCancel()");
396 runCancel->SetToolTipText("Cancel changes");
400 runInput3->AddFrame(runApply1,
401 new TGLayoutHints(kLHintsTop |
406 runInput3->AddFrame(runApply2,
407 new TGLayoutHints(kLHintsTop |
412 runInput3->AddFrame(runCancel,
413 new TGLayoutHints(kLHintsTop |
418 // add to the main input frame
420 fRunInput->AddFrame(runInput3,
421 new TGLayoutHints(kLHintsTop |
426 fRunInput->MapSubwindows();
428 fRunInput->MapWindow();
434 // control main frame
436 fControl = new TGTransientFrame(gClient->GetRoot(), fMain, 50, 50);
437 fControl->Connect("CloseWindow()", "AliMUONTriggerGUI", this, "CloseControl()");
438 fControl->DontCallClose(); // to avoid double deletions.
440 // use hierarchical cleaning
441 fControl->SetCleanup(kDeepCleanup);
443 fControl->SetWindowName("Run controls");
445 // frame to hold buttons
447 control1 = new TGCompositeFrame(fControl, 50, 50, kVerticalFrame);
451 controlClose = new TGTextButton(control1, "Close", 1);
452 controlClose->Connect("Clicked()", "AliMUONTriggerGUI", this, "DoControlClose()");
453 //controlClose->Resize(300, controlClose->GetDefaultHeight());
455 nextEvent = new TGTextButton(control1, "Next event", 2);
456 nextEvent->Connect("Clicked()", "AliMUONTriggerGUI", this, "DoNextEvent()");
458 previousEvent = new TGTextButton(control1, "Previous event", 3);
459 previousEvent->Connect("Clicked()", "AliMUONTriggerGUI", this, "DoPreviousEvent()");
461 // frame to hold event skip
463 control2 = new TGCompositeFrame(fControl, 50, 50, kHorizontalFrame);
465 // skip to event text field
467 fSkipToEventTxt = new TGTextEntry(control2, fTxtBuffer2 = new TGTextBuffer(5));
469 fTxtBuffer2->AddText(0,fEvString->Data());
471 // skip to event button
473 skipToEvent = new TGTextButton(control2, "Skip to event", 1);
474 skipToEvent->Connect("Clicked()", "AliMUONTriggerGUI", this, "DoSkipToEvent()");
476 // add to event skip frame
478 control2->AddFrame(fSkipToEventTxt,
479 new TGLayoutHints(kLHintsTop |
484 control2->AddFrame(skipToEvent,
485 new TGLayoutHints(kLHintsTop |
492 control1->AddFrame(controlClose,
493 new TGLayoutHints(kLHintsBottom |
498 control1->AddFrame(nextEvent,
499 new TGLayoutHints(kLHintsBottom |
504 control1->AddFrame(previousEvent,
505 new TGLayoutHints(kLHintsBottom |
510 // add to the main frame
512 fControl->AddFrame(control1,
513 new TGLayoutHints(kLHintsBottom |
519 fControl->AddFrame(control2,
520 new TGLayoutHints(kLHintsTop |
525 fControl->MapSubwindows();
527 fControl->MapWindow();
536 fDiMap = new AliMUONTriggerGUIdimap(fBoards,gClient->GetRoot(), fMain, 400, 200);
537 fDiMap->SetLoader(fLoader);
539 fDiMap->SetRawDigitStore(fRawDigitStore);
541 fDiMap->SetMCDataInterface(fMCDataInterface);
543 fDiMap->DrawAllMaps();
544 } else if (!fDiMap->IsOn()) {
545 fDiMap = new AliMUONTriggerGUIdimap(fBoards,gClient->GetRoot(), fMain, 400, 200);
546 fDiMap->SetLoader(fLoader);
548 fDiMap->SetRawDigitStore(fRawDigitStore);
550 fDiMap->SetMCDataInterface(fMCDataInterface);
552 fDiMap->DrawAllMaps();
559 Int_t number, over, pos;
560 for (Int_t ib = 0; ib < kNBoards; ib++) {
561 AliMUONTriggerGUIboard *board = GetBoard(ib);
562 board->ClearXDigits();
563 board->ClearYDigits();
565 number = board->GetNumber();
566 pos = board->GetPosition();
567 over = board->GetYOver();
568 for (Int_t io = 1; io <= over; io++) {
569 if (io == pos) continue;
570 board = GetBoard(number+io-pos);
571 board->ClearYDigits();
579 fCircuit = new TGTransientFrame(gClient->GetRoot(), fMain, 50, 50);
580 fCircuit->Connect("CloseWindow()", "AliMUONTriggerGUI", this, "CloseCircuit()");
581 fCircuit->DontCallClose(); // to avoid double deletions.
583 // use hierarchical cleaning
584 fCircuit->SetCleanup(kDeepCleanup);
586 fCircuit->SetWindowName("Board circuit");
590 circuit1 = new TGCompositeFrame(fCircuit, 400, 200, kHorizontalFrame);
591 circuit2 = new TGCompositeFrame(fCircuit, 400, 200, kHorizontalFrame);
595 circuitL1 = new TGLabel(circuit1, new TGString("Circuit number:"));
599 circuitText1 = new TGTextEntry(circuit1, fTxtCircuit = new TGTextBuffer(10));
602 circuitCancel = new TGTextButton(circuit2, "Cancel", 1);
603 circuitCancel->Connect("Clicked()", "AliMUONTriggerGUI", this, "DoCircuitCancel()");
604 //circuitCancel->Resize(100, circuitCancel->GetDefaultHeight());
606 circuitOpen = new TGTextButton(circuit2, "Open", 2);
607 circuitOpen->Connect("Clicked()", "AliMUONTriggerGUI", this, "DoCircuitOpen()");
608 //circuitOpen->Resize(100, circuitOpen->GetDefaultHeight());
612 circuit1->AddFrame(circuitL1,
613 new TGLayoutHints(kLHintsLeft |
618 circuit1->AddFrame(circuitText1,
619 new TGLayoutHints(kLHintsRight |
624 circuit2->AddFrame(circuitCancel,
625 new TGLayoutHints(kLHintsBottom |
630 circuit2->AddFrame(circuitOpen,
631 new TGLayoutHints(kLHintsBottom |
636 fCircuit->AddFrame(circuit1,
637 new TGLayoutHints(kLHintsTop | kLHintsExpandX, 2, 2, 3, 0));
639 fCircuit->AddFrame(circuit2,
640 new TGLayoutHints(kLHintsTop | kLHintsExpandX, 2, 2, 3, 0));
642 fCircuit->MapSubwindows();
644 fCircuit->MapWindow();
661 CreateTriggerStore();
673 WriteTriggerRawData();
686 fFETRegOn = new TGTransientFrame(gClient->GetRoot(), fMain, 50, 50);
687 fFETRegOn->Connect("CloseWindow()", "AliMUONTriggerGUI", this, "CloseFETRegOn()");
688 fFETRegOn->DontCallClose(); // to avoid double deletions.
690 // use hierarchical cleaning
691 fFETRegOn->SetCleanup(kDeepCleanup);
693 fFETRegOn->SetWindowName("FET ON regional crate");
697 fetregon1 = new TGCompositeFrame(fFETRegOn, 400, 200, kHorizontalFrame);
698 fetregon2 = new TGCompositeFrame(fFETRegOn, 400, 200, kHorizontalFrame);
702 fetregonL1 = new TGLabel(fetregon1, new TGString("Regional crate name:"));
706 fetregonText1 = new TGTextEntry(fetregon1, fTxtFETRegOn = new TGTextBuffer(10));
709 fetregonCancel = new TGTextButton(fetregon2, "Cancel", 1);
710 fetregonCancel->Connect("Clicked()", "AliMUONTriggerGUI", this, "DoFETRegOnCancel()");
711 //fetregonCancel->Resize(100, fetregonCancel->GetDefaultHeight());
713 fetregonRun = new TGTextButton(fetregon2, "Run FET", 2);
714 fetregonRun->Connect("Clicked()", "AliMUONTriggerGUI", this, "DoFETRegOnRun()");
715 //fetregonRun->Resize(100, fetregonRun->GetDefaultHeight());
719 fetregon1->AddFrame(fetregonL1,
720 new TGLayoutHints(kLHintsLeft |
725 fetregon1->AddFrame(fetregonText1,
726 new TGLayoutHints(kLHintsRight |
731 fetregon2->AddFrame(fetregonCancel,
732 new TGLayoutHints(kLHintsBottom |
737 fetregon2->AddFrame(fetregonRun,
738 new TGLayoutHints(kLHintsBottom |
743 fFETRegOn->AddFrame(fetregon1,
744 new TGLayoutHints(kLHintsTop | kLHintsExpandX, 2, 2, 3, 0));
746 fFETRegOn->AddFrame(fetregon2,
747 new TGLayoutHints(kLHintsTop | kLHintsExpandX, 2, 2, 3, 0));
749 fFETRegOn->MapSubwindows();
751 fFETRegOn->MapWindow();
757 fFETRegOff = new TGTransientFrame(gClient->GetRoot(), fMain, 50, 50);
758 fFETRegOff->Connect("CloseWindow()", "AliMUONTriggerGUI", this, "CloseFETRegOff()");
759 fFETRegOff->DontCallClose(); // to avoid double deletions.
761 // use hierarchical cleaning
762 fFETRegOff->SetCleanup(kDeepCleanup);
764 fFETRegOff->SetWindowName("FET OFF regional crate");
768 fetregoff1 = new TGCompositeFrame(fFETRegOff, 400, 200, kHorizontalFrame);
769 fetregoff2 = new TGCompositeFrame(fFETRegOff, 400, 200, kHorizontalFrame);
773 fetregoffL1 = new TGLabel(fetregoff1, new TGString("Regional crate name:"));
777 fetregoffText1 = new TGTextEntry(fetregoff1, fTxtFETRegOff = new TGTextBuffer(10));
780 fetregoffCancel = new TGTextButton(fetregoff2, "Cancel", 1);
781 fetregoffCancel->Connect("Clicked()", "AliMUONTriggerGUI", this, "DoFETRegOffCancel()");
782 //fetregoffCancel->Resize(100, fetregoffCancel->GetDefaultHeight());
784 fetregoffRun = new TGTextButton(fetregoff2, "Run FET", 2);
785 fetregoffRun->Connect("Clicked()", "AliMUONTriggerGUI", this, "DoFETRegOffRun()");
786 //fetregoffRun->Resize(100, fetregoffRun->GetDefaultHeight());
790 fetregoff1->AddFrame(fetregoffL1,
791 new TGLayoutHints(kLHintsLeft |
796 fetregoff1->AddFrame(fetregoffText1,
797 new TGLayoutHints(kLHintsRight |
802 fetregoff2->AddFrame(fetregoffCancel,
803 new TGLayoutHints(kLHintsBottom |
808 fetregoff2->AddFrame(fetregoffRun,
809 new TGLayoutHints(kLHintsBottom |
814 fFETRegOff->AddFrame(fetregoff1,
815 new TGLayoutHints(kLHintsTop | kLHintsExpandX, 2, 2, 3, 0));
817 fFETRegOff->AddFrame(fetregoff2,
818 new TGLayoutHints(kLHintsTop | kLHintsExpandX, 2, 2, 3, 0));
820 fFETRegOff->MapSubwindows();
821 fFETRegOff->Resize();
822 fFETRegOff->MapWindow();
827 printf("Menu item %d selected\n", id);
834 //__________________________________________________________________________
835 void AliMUONTriggerGUI::CloseRunInput() const
837 /// close the run input frame
843 //__________________________________________________________________________
844 void AliMUONTriggerGUI::CloseError() const
846 /// close the error frame
852 //__________________________________________________________________________
853 void AliMUONTriggerGUI::CloseControl() const
855 /// close the event control frame
859 //gSystem->Exec("cd $PWD/mtrun; aliroot -b -q mtsim.C");
863 //__________________________________________________________________________
864 void AliMUONTriggerGUI::CloseCircuit() const
866 /// close the circuit frame
872 //__________________________________________________________________________
873 void AliMUONTriggerGUI::CloseFETRegOn() const
875 /// close the FET regional on frame
881 //__________________________________________________________________________
882 void AliMUONTriggerGUI::CloseFETRegOff() const
884 /// close the FET regional off frame
890 //__________________________________________________________________________
891 void AliMUONTriggerGUI::CloseWindow()
893 /// close the main frame and exit aplication
896 delete fMCDataInterface;
898 gApplication->Terminate();
902 //__________________________________________________________________________
903 void AliMUONTriggerGUI::DoRunGalApply()
905 /// apply changes in the run control frame for galice input
908 printf("This is a run with raw data input.\n");
912 TString es = TString(fTxtBuffer2->GetString());
915 printf("Galice input = %s event = %d \n",fTxtBuffer1->GetString(),fEvent);
917 TString error = TString("");;
919 fPath->Form("%s",fTxtBuffer1->GetString());
920 fFileName->Form("%s",fTxtBuffer1->GetString());
922 if (gSystem->AccessPathName(fFileName->Data()) || !fFileName->EndsWith(".root")) {
924 error.Append("No galice file: ");
925 error.Append(fFileName->Data());
926 DoErrorGUI(error.Data());
930 TFile *ftest = new TFile(fFileName->Data(),"READ");
931 AliRun *galice = (AliRun*)ftest->Get("gAlice");
937 error.Append("No gAlice in file: ");
938 error.Append(fFileName->Data());
939 DoErrorGUI(error.Data());
950 delete fMCDataInterface;
953 fRunLoader = AliRunLoader::Open(fFileName->Data(),"MUONFolder","READ");
955 if (fRunLoader == 0x0) {
957 DoErrorGUI("No run loader !");
961 fRunLoader->LoadgAlice();
962 gAlice = fRunLoader->GetAliRun();
963 fEventsPerRun = AliRunLoader::Instance()->GetNumberOfEvents();
965 fLoader = fRunLoader->GetLoader("MUONLoader");
966 fRunLoader->GetEvent(fEvent);
968 fMCDataInterface = new AliMUONMCDataInterface(fFileName->Data());
970 fRunInput->SendCloseMessage();
977 if (fDiMap->IsOn()) {
978 fDiMap->SetLoader(fLoader);
979 fDiMap->SetMCDataInterface(fMCDataInterface);
989 //__________________________________________________________________________
990 void AliMUONTriggerGUI::DoRunRawApply()
992 /// apply changes in the run control frame for raw date input
994 if (fControlOn) DoControlClose();
996 if (fRunLoader != 0) {
997 printf("This is a run with galice input.\n");
1001 TString es = TString(fTxtBuffer2->GetString());
1004 printf("Raw data input = %s event = %d \n",fTxtBuffer1->GetString(),fEvent);
1006 TString error = TString("");;
1008 fPath->Form("%s",fTxtBuffer1->GetString());
1009 fFileName->Form("%s",fTxtBuffer1->GetString());
1011 if (gSystem->AccessPathName(fFileName->Data()) || !fFileName->EndsWith(".root")) {
1013 error.Append("No raw data file: ");
1014 error.Append(fFileName->Data());
1015 DoErrorGUI(error.Data());
1019 if (fRawReader == 0) {
1020 fRawReader = AliRawReader::Create(fFileName->Data());
1023 fRawReader = AliRawReader::Create(fFileName->Data());
1025 if (fRawReader == 0) {
1026 error.Append("Not a valid raw data file: ");
1027 error.Append(fFileName->Data());
1028 DoErrorGUI(error.Data());
1032 fRawReader->GotoEvent(fEvent);
1033 fCurrentRawEvent = fEvent;
1035 AliMUONDigitMaker digitMaker;
1036 digitMaker.SetMakeTriggerDigits(kTRUE);
1037 digitMaker.Raw2Digits(fRawReader,fRawDigitStore,fRawTriggerStore);
1039 fRunInput->SendCloseMessage();
1046 if (fDiMap->IsOn()) {
1047 fDiMap->SetRawDigitStore(fRawDigitStore);
1057 //__________________________________________________________________________
1058 void AliMUONTriggerGUI::DoRunCancel()
1060 /// cancel the changes in the run control frame
1062 fRunInput->SendCloseMessage();
1066 //__________________________________________________________________________
1067 void AliMUONTriggerGUI::DoErrorGUI(const Char_t *wt)
1069 /// show an error message in a new frame
1071 fError = new TGTransientFrame(gClient->GetRoot(), fMain, 50, 50);
1072 fError->Connect("CloseWindow()", "AliMUONTriggerGUI", this, "CloseError()");
1073 fError->DontCallClose(); // to avoid double deletions.
1075 // use hierarchical cleaning
1076 fError->SetCleanup(kDeepCleanup);
1078 fError->SetWindowName("Error !");
1080 TGCompositeFrame *fW = new TGCompositeFrame(fError, 50, 50, kVerticalFrame);
1082 TGTextButton *fErrorOK = new TGTextButton(fW, "&Ok", 1);
1083 fErrorOK->Connect("Clicked()", "AliMUONTriggerGUI", this, "DoErrorOK()");
1085 fW->AddFrame(fErrorOK,
1086 new TGLayoutHints(kLHintsBottom |
1091 TGLabel *fWL = new TGLabel(fW, new TGString(wt));
1094 new TGLayoutHints(kLHintsTop |
1099 fError->AddFrame(fW,
1100 new TGLayoutHints(kLHintsLeft |
1105 fError->MapSubwindows();
1107 fError->MapWindow();
1111 //__________________________________________________________________________
1112 void AliMUONTriggerGUI::DoNextEvent()
1114 /// load next event from the file
1116 TString error = TString("");
1119 if (fEvent < (fEventsPerRun-1)) {
1121 fRunLoader->GetEvent(fEvent);
1123 fEvString->Form("%d",fEvent);
1124 fTxtBuffer2->RemoveText(0,5);
1125 fTxtBuffer2->AddText(0,fEvString->Data());
1126 fSkipToEventTxt->SetFocus();
1129 error.Form("Only %d event(s) in the run !",fEventsPerRun);
1130 DoErrorGUI(error.Data());
1133 if (fRawReader->NextEvent()) {
1136 AliMUONDigitMaker digitMaker;
1137 digitMaker.SetMakeTriggerDigits(kTRUE);
1138 digitMaker.Raw2Digits(fRawReader,fRawDigitStore,fRawTriggerStore);
1140 fEvString->Form("%d",fCurrentRawEvent);
1141 fTxtBuffer2->RemoveText(0,5);
1142 fTxtBuffer2->AddText(0,fEvString->Data());
1143 fSkipToEventTxt->SetFocus();
1151 //__________________________________________________________________________
1152 void AliMUONTriggerGUI::DoPreviousEvent()
1154 /// load previous event from the input file
1156 TString error = TString("");
1161 fRunLoader->GetEvent(fEvent);
1163 fEvString->Form("%d",fEvent);
1164 fTxtBuffer2->RemoveText(0,5);
1165 fTxtBuffer2->AddText(0,fEvString->Data());
1166 fSkipToEventTxt->SetFocus();
1169 error.Form("Already at event 0 !");
1170 DoErrorGUI(error.Data());
1173 if (fCurrentRawEvent > 0) {
1175 fRawReader->GotoEvent(fCurrentRawEvent);
1177 AliMUONDigitMaker digitMaker;
1178 digitMaker.SetMakeTriggerDigits(kTRUE);
1179 digitMaker.Raw2Digits(fRawReader,fRawDigitStore,fRawTriggerStore);
1181 fEvString->Form("%d",fCurrentRawEvent);
1182 fTxtBuffer2->RemoveText(0,5);
1183 fTxtBuffer2->AddText(0,fEvString->Data());
1184 fSkipToEventTxt->SetFocus();
1192 //__________________________________________________________________________
1193 void AliMUONTriggerGUI::DoSkipToEvent()
1195 /// skip to event -input- from the input file
1197 TString error = TString("");
1199 TString es = TString(fTxtBuffer2->GetString());
1203 if (fEvent < 0 || fEvent > (fEventsPerRun-1)) {
1204 error.Form("Event number out of range !");
1205 DoErrorGUI(error.Data());
1207 fRunLoader->GetEvent(fEvent);
1210 if (fRawReader->GotoEvent(fEvent)) {
1211 fCurrentRawEvent = fEvent;
1213 AliMUONDigitMaker digitMaker;
1214 digitMaker.SetMakeTriggerDigits(kTRUE);
1215 digitMaker.Raw2Digits(fRawReader,fRawDigitStore,fRawTriggerStore);
1217 fEvString->Form("%d",fCurrentRawEvent);
1218 fTxtBuffer2->RemoveText(0,5);
1219 fTxtBuffer2->AddText(0,fEvString->Data());
1220 fSkipToEventTxt->SetFocus();
1227 //__________________________________________________________________________
1228 void AliMUONTriggerGUI::DoErrorOK()
1230 /// close the error frame
1232 fError->SendCloseMessage();
1236 //__________________________________________________________________________
1237 void AliMUONTriggerGUI::DoControlClose()
1239 /// close the event control frame
1241 fControl->SendCloseMessage();
1242 fControlOn = kFALSE;
1246 //__________________________________________________________________________
1247 void AliMUONTriggerGUI::DoCircuitCancel()
1249 /// close the circuit frame
1251 fCircuit->SendCloseMessage();
1255 //__________________________________________________________________________
1256 void AliMUONTriggerGUI::DoFETRegOnCancel()
1258 /// close the FET regional on window
1260 fFETRegOn->SendCloseMessage();
1264 //__________________________________________________________________________
1265 void AliMUONTriggerGUI::DoFETRegOffCancel()
1267 /// close the FET regional off window
1269 fFETRegOff->SendCloseMessage();
1273 //__________________________________________________________________________
1274 void AliMUONTriggerGUI::DoFETRegRun(Int_t onoff)
1276 /// FET ON/OFF for the regional crate
1280 crateName = TString(fTxtFETRegOn->GetString());
1282 crateName = TString(fTxtFETRegOff->GetString());
1284 AliMUONTriggerGUIboard *board;
1287 for (Int_t ib = 0; ib < kNBoards; ib++) {
1288 board = (AliMUONTriggerGUIboard*)fBoards->At(ib);
1289 if (strcmp(board->GetCrateName(),crateName.Data()) != 0) continue;
1295 //__________________________________________________________________________
1296 void AliMUONTriggerGUI::DoFETRegOnRun()
1298 /// FET ON for the regional crate
1301 fFETRegOn->SendCloseMessage();
1305 //__________________________________________________________________________
1306 void AliMUONTriggerGUI::DoFETRegOffRun()
1308 /// FET ON for the regional crate
1311 fFETRegOff->SendCloseMessage();
1315 //__________________________________________________________________________
1316 void AliMUONTriggerGUI::DoCircuitOpen()
1320 TString cs = TString(fTxtCircuit->GetString());
1321 Int_t icirc = cs.Atoi();
1323 AliMUONTriggerGUIboard *board;
1325 for (Int_t ib = 0; ib < kNBoards; ib++) {
1327 board = GetBoard(ib);
1329 if (board->GetIdCircuit() == icirc) {
1334 if (fDiMap->IsOn()) {
1335 fDiMap->SelectBoard(ib);
1339 fCircuit->SendCloseMessage();
1347 //__________________________________________________________________________
1348 AliMUONTriggerGUIboard* AliMUONTriggerGUI::GetBoard(Int_t id) const
1350 /// return board with "id"
1352 if (fBoards == 0) return 0;
1353 void * b = fBoards->UncheckedAt(id);
1354 if (b == 0) return 0;
1356 return (AliMUONTriggerGUIboard*)b;
1360 //__________________________________________________________________________
1361 void AliMUONTriggerGUI::OpenBoard(Int_t id)
1363 /// open board with "id" in a new frame
1365 AliMUONTriggerGUIboard *board = GetBoard(id);
1366 UShort_t status = board->GetStatus();
1367 board->SetOpen(kTRUE);
1369 AliMUONTriggerGUIbdmap *bf;
1372 bf = new AliMUONTriggerGUIbdmap(gClient->GetRoot(), fMain, 400, 200);
1374 if (status & kGood) {
1375 sprintf(text,"%s (Circuit %4d) status : working",
1376 board->GetBoardName(),board->GetIdCircuit());
1379 if (status & kWithProblems) {
1380 sprintf(text,"%s (Circuit %4d) status : has problems...",
1381 board->GetBoardName(),board->GetIdCircuit());
1384 if (status & kNotWorking) {
1385 sprintf(text,"%s (Circuit %4d) status : not working",
1386 board->GetBoardName(),board->GetIdCircuit());
1389 if (status & kUnknown) {
1390 sprintf(text,"%s (Circuit %4d) status : unknown",
1391 board->GetBoardName(),board->GetIdCircuit());
1395 bf->SetBoard(Boards(),id);
1396 bf->SetLoader(fLoader);
1397 bf->SetCrateManager(fCrateManager);
1399 bf->SetRawDigitStore(fRawDigitStore);
1400 bf->SetRawTriggerStore(fRawTriggerStore);
1402 bf->SetMCDataInterface(fMCDataInterface);
1409 if (fDiMap->IsOn()) {
1410 fDiMap->SelectBoard(id);
1416 //__________________________________________________________________________
1417 void AliMUONTriggerGUI::Init()
1419 /// initialize the main GUI frame
1426 AliMUONTriggerGUIboard *board;
1427 for (Int_t ib = 0; ib < kNBoards; ib++) {
1428 board = GetBoard(ib);
1434 //__________________________________________________________________________
1435 void AliMUONTriggerGUI::InitBoards()
1437 /// create board objects and define the sensitive regions in the image map
1439 fBoardsInit = kTRUE;
1442 if (fCrateManager == 0x0) {
1443 fCrateManager = new AliMUONTriggerCrateStore();
1444 fCrateManager->ReadFromFile(fCalibrationData);
1447 // create boards geometry from the mapping
1448 AliMUONTriggerGUIboard *board;
1449 for (Int_t ib = 0; ib < kNBoards; ib++) {
1450 Boards()->Add(new AliMUONTriggerGUIboard());
1453 // circuit number to board number in array
1454 Int_t cIdtobId[235];
1458 Int_t manuIdPrev, ich, idet, boardIdTmp = -1;
1459 for (Int_t chamber = 0; chamber < kNMT; chamber++) {
1460 for ( it.First(); ! it.IsDone(); it.Next() ) {
1462 if (it.CurrentDEId()/100 < 11) continue;
1464 ich = it.CurrentDEId()/100 - 11;
1465 if (ich != chamber) continue;
1466 idet = it.CurrentDEId()%100;
1468 const AliMpVSegmentation* seg0 = AliMpSegmentation::Instance()->GetMpSegmentation(it.CurrentDEId(), AliMp::kCath0);
1469 const AliMpVSegmentation* seg1 = AliMpSegmentation::Instance()->GetMpSegmentation(it.CurrentDEId(), AliMp::kCath1);
1473 for (Int_t ix = 0; ix <= seg0->MaxPadIndexX(); ix++) {
1474 for (Int_t iy = 0; iy <= seg0->MaxPadIndexY(); iy++) {
1475 AliMpPad pad = seg0->PadByIndices(ix,iy,kFALSE);
1476 if (pad.IsValid()) {
1477 Int_t manuId = pad.GetLocalBoardId(0);
1478 if (manuId != manuIdPrev) {
1479 AliMpLocalBoard *mpboard = AliMpDDLStore::Instance()->GetLocalBoard(manuId);
1480 manuIdPrev = manuId;
1484 boardId = cIdtobId[manuId];
1486 board = GetBoard(boardId);
1487 if (board->GetNumber() == -1)
1488 board->SetNumber(boardId);
1489 if (board->GetDetElemId() == -1)
1490 board->SetDetElemId(idet);
1491 if (!strcmp(board->GetBoardName(),""))
1492 board->SetBoardName(mpboard->GetName());
1493 cIdtobId[manuId] = boardId;
1495 GetBoard(boardId)->AddPadX(pad,ich);
1498 } // end plane 0 (x-strips)
1502 for (Int_t ix = 0; ix <= seg1->MaxPadIndexX(); ix++) {
1503 for (Int_t iy = 0; iy <= seg1->MaxPadIndexY(); iy++) {
1504 AliMpPad pad = seg1->PadByIndices(ix,iy,kFALSE);
1505 if (pad.IsValid()) {
1506 Int_t nloc = pad.GetNofLocations();
1507 for (Int_t iloc = 0; iloc < nloc; iloc++) {
1508 Int_t manuId = pad.GetLocalBoardId(iloc);
1509 if (manuId != manuIdPrev) {
1510 manuIdPrev = manuId;
1511 boardIdTmp = cIdtobId[manuId];
1513 GetBoard(boardIdTmp)->AddPadY(pad,ich);
1517 } // end plane 1 (y-strips)
1519 } // end det elem loop
1520 } // end chamber loop
1522 for (Int_t ib = 0; ib < kNBoards; ib++) {
1523 board = GetBoard(ib);
1524 board->MakeGeometry();
1525 AliMUONLocalTriggerBoard* b = fCrateManager->LocalBoard(board->GetIdCircuit());
1526 board->SetCrateName((b->GetCrate()).Data());
1529 // create the sensitive map
1531 Int_t nPixelX = 700;
1532 Int_t nPixelY = 676;
1534 Int_t nPixelBorderX = 40; // to guess...
1535 Int_t nPixelBorderY = 40; // to guess...
1538 Float_t boardsX = 2*257.00; // cm
1539 Float_t boardsY = 2*306.61; // cm
1541 UShort_t status = 1;
1542 Float_t xc, yc, xw, yw;
1551 // regions for the image map (from MT11)
1553 for (Int_t ib = 0; ib < kNBoards; ib++) {
1555 board = GetBoard(ib);
1558 board->SetStatus(status);
1560 xc = board->GetXCenter(0);
1561 yc = board->GetYCenter(0);
1562 xw = board->GetXWidth(0);
1563 yw = board->GetYWidth(0);
1565 x = (Int_t)(nPixelX/2 + xc * (nPixelX - 2*nPixelBorderX)/boardsX);
1566 y = (Int_t)(nPixelY/2 - yc * (nPixelY - 2*nPixelBorderY)/boardsY);
1571 w = (UInt_t)(xw*(nPixelX-2*nPixelBorderX)/boardsX);
1572 h = (UInt_t)(yw*(nPixelY-2*nPixelBorderY)/boardsY);
1586 reg = new TGRegion(5,xp,yp);
1587 fImageMap->AddRegion(*reg, ib);
1589 sprintf(text,"%s (crate %s circuit %3d, number %3d)",board->GetBoardName(),board->GetCrateName(),board->GetIdCircuit(),board->GetNumber());
1590 fImageMap->SetToolTipText(ib, text);
1592 // Set coordinates of strips boxes
1594 SetStripBoxes(board);
1596 //board->PrintBoard();
1602 //__________________________________________________________________________
1603 void AliMUONTriggerGUI::SetStripBoxes(AliMUONTriggerGUIboard *board)
1605 /// set coordinates of strip boxes
1607 AliMUONGeometryTransformer transformer;
1608 transformer.LoadGeometryData("transform.dat");
1610 const AliMpVSegmentation* seg;
1614 Int_t chamber, detElemId, maxX, maxY;
1615 Float_t xpmin, xpmax, ypmin, ypmax;
1616 Float_t xg1, xg2, yg1, yg2, zg1;
1617 Float_t xlocal1, xlocal2, ylocal1, ylocal2;
1618 Float_t xCenter, yCenter, xWidth, yWidth;
1620 for (Int_t i = 0; i < kNMT; i++) {
1624 xCenter = board->GetXCenter(i);
1625 yCenter = board->GetYCenter(i);
1626 xWidth = board->GetXWidth(i);
1627 yWidth = board->GetYWidth(i);
1629 for ( it.First(chamber-1); ! it.IsDone(); it.Next() ) {
1631 detElemId = it.CurrentDEId();
1633 if (detElemId%100 != board->GetDetElemId()) continue;
1635 /*---------- y-pads cath = 1 ----------*/
1637 seg = AliMpSegmentation::Instance()->GetMpSegmentation(detElemId, AliMp::kCath1);
1639 maxX = seg->MaxPadIndexX();
1640 maxY = seg->MaxPadIndexY();
1642 for (Int_t ix = 0; ix <= maxX; ix++) {
1643 for (Int_t iy = 0; iy <= maxY; iy++) {
1645 pad = seg->PadByIndices(ix,iy,kFALSE);
1647 if (!pad.IsValid()) continue;
1649 // get the pad position and dimensions
1650 xlocal1 = pad.GetPositionX();
1651 ylocal1 = pad.GetPositionY();
1652 xlocal2 = pad.GetDimensionX();
1653 ylocal2 = pad.GetDimensionY();
1655 transformer.Local2Global(detElemId, xlocal1, ylocal1, 0, xg1, yg1, zg1);
1656 // (no transformation for pad dimensions)
1660 // transform in the monitor coordinate system
1672 Int_t iX1, iX2, iY, ixDig;
1673 iX1 = board->GetYSix1();
1674 iX2 = board->GetYSix2();
1675 iY = board->GetYSiy();
1676 if (ix >= iX1 && ix <= iX2 && iy == iY) {
1678 ypmin = -0.5*yWidth;
1679 ypmax = +0.5*yWidth;
1683 board->SetYDigBox(i,ixDig,(Double_t)xpmin,(Double_t)ypmin,
1684 (Double_t)xpmax,(Double_t)ypmax);
1691 /*---------- x-pads cath = 0 ----------*/
1693 seg = AliMpSegmentation::Instance()->GetMpSegmentation(detElemId, AliMp::kCath0);
1695 maxX = seg->MaxPadIndexX();
1696 maxY = seg->MaxPadIndexY();
1698 for (Int_t ix = 0; ix <= maxX; ix++) {
1699 for (Int_t iy = 0; iy <= maxY; iy++) {
1701 pad = seg->PadByIndices(ix,iy,kFALSE);
1703 if (!pad.IsValid()) continue;
1705 // get the pad position and dimensions
1706 xlocal1 = pad.GetPositionX();
1707 ylocal1 = pad.GetPositionY();
1708 xlocal2 = pad.GetDimensionX();
1709 ylocal2 = pad.GetDimensionY();
1711 transformer.Local2Global(detElemId, xlocal1, ylocal1, 0, xg1, yg1, zg1);
1712 // (no transformation for pad dimensions)
1716 // transform in the monitor coordinate system
1728 Int_t iX, iY1, iY2, iyDig;
1729 iX = board->GetXSix();
1730 iY1 = board->GetXSiy1();
1731 iY2 = board->GetXSiy2();
1732 if (ix == iX && iy >= iY1 && iy <= iY2) {
1736 board->SetXDigBox(i,iyDig,(Double_t)xpmin,(Double_t)ypmin,
1737 (Double_t)xpmax,(Double_t)ypmax);
1750 //__________________________________________________________________________
1751 void AliMUONTriggerGUI::CreateDigitStore()
1753 /// create memory resident digits store with set strips
1755 Int_t nstripX, nstripY, detElemId, charge, ix, iy, iX1, iY1;
1756 Int_t cathode, maxX, maxY;
1757 Int_t manuId, manuChannel;
1758 const AliMpVSegmentation* seg;
1760 AliMUONTriggerGUIboard* board;
1763 for (Int_t ib = 0; ib < kNBoards; ib++) {
1765 board = (AliMUONTriggerGUIboard*)fBoards->At(ib);
1766 if (board == 0) continue;
1768 nstripX = board->GetNStripX();
1769 nstripY = board->GetNStripY();
1770 for (Int_t ichamber = 11; ichamber <= 14; ichamber++) {
1772 detElemId = ichamber * 100 + board->GetDetElemId();
1775 for (Int_t isx = 0; isx < nstripX; isx++) {
1777 charge = (Int_t)board->GetXDig(ichamber-11,isx);
1778 if (charge == 0) continue;
1779 ix = board->GetXSix();
1780 iY1 = board->GetXSiy1();
1782 seg = AliMpSegmentation::Instance()->GetMpSegmentation(detElemId, AliMp::GetCathodType(cathode));
1783 maxX = seg->MaxPadIndexX();
1784 maxY = seg->MaxPadIndexY();
1785 if (ix > maxX) printf("Index x > maximum!\n");
1786 if (iy > maxY) printf("Index y > maximum!\n");
1787 pad = seg->PadByIndices(ix,iy,kTRUE);
1788 manuId = pad.GetLocalBoardId(0);
1789 manuChannel = pad.GetLocalBoardChannel(0);
1791 dig = fDigitStore->Add(detElemId,manuId,manuChannel,cathode,AliMUONVDigitStore::kAllow);
1792 dig->SetCharge(charge);
1793 dig->SetPadXY(ix,iy);
1794 //printf("Cathode 0: ix %3d iy %3d manuId %3d manuChannel %3d \n",ix,iy,manuId,manuChannel);
1800 for (Int_t isy = 0; isy < nstripY; isy++) {
1802 charge = board->GetYDig(ichamber-11,isy);
1803 if (charge == 0) continue;
1804 iX1 = board->GetYSix1();
1806 iy = board->GetYSiy();
1807 seg = AliMpSegmentation::Instance()->GetMpSegmentation(detElemId, AliMp::GetCathodType(cathode));
1808 maxX = seg->MaxPadIndexX();
1809 maxY = seg->MaxPadIndexY();
1810 if (ix > maxX) printf("Index x > maximum!\n");
1811 if (iy > maxY) printf("Index y > maximum!\n");
1812 pad = seg->PadByIndices(ix,iy,kTRUE);
1813 manuId = pad.GetLocalBoardId(0);
1814 manuChannel = pad.GetLocalBoardChannel(0);
1816 dig = fDigitStore->Add(detElemId,manuId,manuChannel,cathode,AliMUONVDigitStore::kAllow);
1817 dig->SetCharge(charge);
1818 dig->SetPadXY(ix,iy);
1819 //printf("Cathode 1: ix %3d iy %3d manuId %3d manuChannel %3d \n",ix,iy,manuId,manuChannel);
1829 //__________________________________________________________________________
1830 void AliMUONTriggerGUI::PrintDigitStore() const
1832 /// Print the digits created in the GUI
1834 const AliMpVSegmentation* seg;
1836 Int_t ix, iy, charge, detElemId, cathode;
1839 for (Int_t i = 0; i < kNMT; i++) {
1843 MpPair_t deRange = AliMpDEManager::GetDetElemIdRange(chamber-1);
1844 TIter next(fDigitStore->CreateIterator(AliMp::PairFirst(deRange),AliMp::PairSecond(deRange)));
1845 AliMUONVDigit *mdig;
1847 while ( ( mdig = static_cast<AliMUONVDigit*>(next())) )
1849 cathode = mdig->Cathode();
1853 detElemId = mdig->DetElemId();
1854 charge = (Int_t)mdig->Charge();
1856 seg = AliMpSegmentation::Instance()->GetMpSegmentation(detElemId, AliMp::GetCathodType(cathode));
1857 pad = seg->PadByIndices(ix,iy,kTRUE);
1859 printf("Digit: detElemId %4d cath %1d ix %2d iy %3d charge %1d \n",detElemId,cathode,ix,iy,charge);
1867 //__________________________________________________________________________
1868 void AliMUONTriggerGUI::CreateTriggerStore()
1870 /// Process the DSET digit store and fill the trigger store
1872 if (fDigitStore->GetSize() == 0) {
1873 printf("The digit store is empty...\n");
1878 AliMUONVDigitStore *digitStore = static_cast<AliMUONVDigitStore*>(fDigitStore);
1880 fTriggerProcessor->Digits2Trigger(*digitStore,*fTriggerStore);
1884 //__________________________________________________________________________
1885 void AliMUONTriggerGUI::PrintTriggerStore() const
1887 /// Print the trigger output for DSET digits store
1889 if (!fTStoreOn) return;
1891 TIter next(fTriggerStore->CreateLocalIterator());
1893 UShort_t x2m, x2u, x2d;
1894 Int_t loStripX, loStripY, loDev, loCircuit, iStripX, iStripY, loLpt, loHpt;
1895 AliMUONLocalTrigger *mlt;
1896 while ( ( mlt = static_cast<AliMUONLocalTrigger*>(next()) ) )
1898 loCircuit = mlt->LoCircuit();
1900 AliMUONLocalTriggerBoard* ltb = fCrateManager->LocalBoard(loCircuit);
1901 x2d = ltb->GetSwitch(0);
1902 x2m = ltb->GetSwitch(1);
1903 x2u = ltb->GetSwitch(2);
1905 loStripX = mlt->LoStripX();
1906 loStripY = mlt->LoStripY();
1907 loDev = mlt->LoDev();
1908 loLpt = mlt->LoLpt();
1909 loHpt = mlt->LoHpt();
1911 iStripX = loStripX/2;
1912 if ((x2u == 1 || x2m == 1 || x2d == 1) && x2m == 1) {
1913 iStripY = loStripY/2;
1918 printf("Circ %3d Xs %2d Ys %2d Dev %2d Lpt %1d Hpt %1d \n",loCircuit,loStripX,loStripY,loDev,loLpt,loHpt);
1920 AliMUONGlobalTrigger *globalTrigger = fTriggerStore->Global();
1921 globalTrigger->Print();
1927 //__________________________________________________________________________
1928 void AliMUONTriggerGUI::WriteTriggerRawData()
1930 /// Write raw data (DATE and ROOT) for the trigger store from
1931 /// the DSET digit store
1934 printf("The trigger store is empty... \n");
1940 AliMUONRawWriter *rawWriter = new AliMUONRawWriter();
1941 AliRawDataHeaderSim header;
1942 rawWriter->SetHeader(header);
1943 rawWriter->Digits2Raw(0,fTriggerStore);
1947 // raw data (ddl) to date
1948 // AliSimulation::ConvertRawFilesToDate
1951 char dateFileName[256];
1952 sprintf(dateFileName,"TriggerGUI.date");
1953 sprintf(command, "dateStream -c -s -D -o %s -# %d -C -run %d",
1954 dateFileName, 1, 0);
1955 FILE* pipe = gSystem->OpenPipe(command, "w");
1957 UInt_t detectorPattern = 0;
1958 fprintf(pipe, "GDC DetectorPattern %u\n", detectorPattern);
1962 // loop over detectors and DDLs
1963 for (Int_t iDet = 0; iDet < AliDAQ::kNDetectors; iDet++) {
1964 for (Int_t iDDL = 0; iDDL < AliDAQ::NumberOfDdls(iDet); iDDL++) {
1966 Int_t ddlID = AliDAQ::DdlID(iDet,iDDL);
1967 Int_t ldcID = Int_t(ldc + 0.0001);
1968 ldc += AliDAQ::NumberOfLdcs(iDet) / AliDAQ::NumberOfDdls(iDet);
1970 char rawFileName[256];
1971 sprintf(rawFileName, "%s",AliDAQ::DdlFileName(iDet,iDDL));
1972 // check existence and size of raw data file
1973 FILE* file = fopen(rawFileName, "rb");
1974 if (!file) continue;
1975 fseek(file, 0, SEEK_END);
1976 unsigned long size = ftell(file);
1978 if (!size) continue;
1980 if (ldcID != prevLDC) {
1981 fprintf(pipe, " LDC Id %d\n", ldcID);
1984 fprintf(pipe, " Equipment Id %d Payload %s\n", ddlID, rawFileName);
1987 Int_t result = gSystem->ClosePipe(pipe);
1989 // raw data (date) to root
1990 // AliSimulation::ConvertDateToRoot
1992 char rootFileName[256];
1993 sprintf(rootFileName,"TriggerGUI.root");
1996 const Int_t kDBSize = 2000000000;
1997 const Int_t kTagDBSize = 1000000000;
1998 const Bool_t kFilter = kFALSE;
1999 const Int_t kCompression = 1;
2001 char* path = gSystem->Which(gSystem->Getenv("PATH"), "alimdc");
2003 printf("the program alimdc was not found\n");
2009 printf("converting DATE file %s to root file %s \n",
2010 dateFileName, rootFileName);
2012 const char* rawDBFS[2] = { "/tmp/mdc1", "/tmp/mdc2" };
2013 const char* tagDBFS = "/tmp/mdc1/tags";
2015 // User defined file system locations
2016 if (gSystem->Getenv("ALIMDC_RAWDB1"))
2017 rawDBFS[0] = gSystem->Getenv("ALIMDC_RAWDB1");
2018 if (gSystem->Getenv("ALIMDC_RAWDB2"))
2019 rawDBFS[1] = gSystem->Getenv("ALIMDC_RAWDB2");
2020 if (gSystem->Getenv("ALIMDC_TAGDB"))
2021 tagDBFS = gSystem->Getenv("ALIMDC_TAGDB");
2023 gSystem->Exec(Form("rm -rf %s",rawDBFS[0]));
2024 gSystem->Exec(Form("rm -rf %s",rawDBFS[1]));
2025 gSystem->Exec(Form("rm -rf %s",tagDBFS));
2027 gSystem->Exec(Form("mkdir %s",rawDBFS[0]));
2028 gSystem->Exec(Form("mkdir %s",rawDBFS[1]));
2029 gSystem->Exec(Form("mkdir %s",tagDBFS));
2031 result = gSystem->Exec(Form("alimdc %d %d %d %d %s",
2032 kDBSize, kTagDBSize, kFilter, kCompression,
2034 gSystem->Exec(Form("mv %s/*.root %s", rawDBFS[0], rootFileName));
2036 gSystem->Exec(Form("rm -rf %s",rawDBFS[0]));
2037 gSystem->Exec(Form("rm -rf %s",rawDBFS[1]));
2038 gSystem->Exec(Form("rm -rf %s",tagDBFS));
2042 //__________________________________________________________________________
2043 void AliMUONTriggerGUI::FETboard(Int_t ib, Int_t amp)
2045 /// Front End test set all strips for board with index "ib"
2046 /// AliMUONTriggerGUIbdmap::DoDigits()
2048 AliMUONTriggerGUIboard *board;
2049 AliMUONTriggerGUIboard *btmp;
2050 Int_t pos, over, number, nStripX, nStripY;
2052 board = (AliMUONTriggerGUIboard*)fBoards->At(ib);
2053 if (board == 0) return;
2055 nStripX = board->GetXSiy2() - board->GetXSiy1() + 1;
2056 nStripY = board->GetYSix2() - board->GetYSix1() + 1;
2058 number = board->GetNumber();
2059 pos = board->GetPosition();
2060 over = board->GetYOver();
2062 for (Int_t imt = 0; imt < kNMT; imt++) {
2064 for (Int_t ix = 0; ix < nStripX; ix++) {
2065 board->SetDigitX(imt,ix,amp);
2068 for (Int_t iy = 0; iy < nStripY; iy++) {
2069 board->SetDigitY(imt,iy,amp);
2071 // extended y-strips
2072 for (Int_t io = 1; io <= over; io++) {
2073 if (io == pos) continue;
2074 btmp = (AliMUONTriggerGUIboard*)fBoards->UncheckedAt(number+io-pos);
2075 btmp->SetDigitY(imt,iy,amp);
2084 //__________________________________________________________________________
2085 void AliMUONTriggerGUI::FET(Int_t onoff)
2087 /// Front End test set all strips for all boards
2088 /// AliMUONTriggerGUIbdmap::DoDigits()
2092 for (Int_t ib = 0; ib < kNBoards; ib++) {
2098 //__________________________________________________________________________
2099 void AliMUONTriggerGUI::ClearDigitStore()
2101 /// Clear the DSET digit store
2103 fDigitStore->Clear();
2107 //__________________________________________________________________________
2108 void AliMUONTriggerGUI::ClearTriggerStore()
2110 /// Clear the trigger store from the DSET digit store
2112 fTriggerStore->Clear();