Adding code to patch St1 HV mapping
[u/mrichter/AliRoot.git] / MUON / AliMUONTriggerGUI.cxx
CommitLineData
905654c2 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
bae1aa70 16// $Id$
17
3d1463c8 18//-----------------------------------------------------------------------------
bae1aa70 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
3d1463c8 24//-----------------------------------------------------------------------------
905654c2 25
26#include "AliMUONTriggerGUI.h"
27#include "AliMUONTriggerGUIboard.h"
28#include "AliMUONTriggerGUIdimap.h"
29#include "AliMUONTriggerGUIbdmap.h"
30
8b067dfe 31#include "AliMpDDLStore.h"
905654c2 32#include "AliMpSegmentation.h"
33#include "AliMpVSegmentation.h"
8b067dfe 34#include "AliMpTriggerSegmentation.h"
168e9c4d 35#include "AliMpEncodePair.h"
f9eb4448 36#include "AliMpCDB.h"
8b067dfe 37#include "AliMpDEManager.h"
905654c2 38#include "AliMpDEIterator.h"
8b067dfe 39
905654c2 40#include "AliMUONGeometryTransformer.h"
41#include "AliMUONTriggerCrateStore.h"
42#include "AliMUONLocalTriggerBoard.h"
43#include "AliMUONTriggerElectronics.h"
44#include "AliMUONCalibrationData.h"
f9eb4448 45#include "AliMUONMCDataInterface.h"
8b067dfe 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"
905654c2 53
54#include "AliRun.h"
8b067dfe 55#include "AliDAQ.h"
905654c2 56#include "AliRunLoader.h"
57#include "AliCDBManager.h"
8b067dfe 58#include "AliRawDataHeaderSim.h"
59#include "AliRawReader.h"
905654c2 60
61#include <TSystem.h>
62#include <TGLabel.h>
63#include <TGFrame.h>
64#include <TApplication.h>
65#include <TGDimension.h>
66#include <TString.h>
67#include <TGMenu.h>
68#include <TGTextEntry.h>
69#include <TGButton.h>
70#include <TFile.h>
71#include <TGImageMap.h>
72#include <TGTextBuffer.h>
73
b785c4bd 74#include <cstdio>
75
905654c2 76/// \cond CLASSIMP
77ClassImp(AliMUONTriggerGUI)
78/// \endcond
79
80//__________________________________________________________________________
f9eb4448 81AliMUONTriggerGUI::AliMUONTriggerGUI(Int_t runNumber)
905654c2 82 : TObject(),
83 fMain(0),
84 fImageMap(0),
85 fTxtBuffer1(0),
86 fTxtBuffer2(0),
87 fTxtCircuit(0),
8b067dfe 88 fTxtFETRegOn(0),
89 fTxtFETRegOff(0),
905654c2 90 fRunInput(0),
91 fError(0),
92 fControl(0),
93 fCircuit(0),
8b067dfe 94 fFETRegOn(0),
95 fFETRegOff(0),
905654c2 96 fSkipToEventTxt(0),
97 fFileName(0),
98 fPath(0),
99 fEvString(0),
100 fChamber(0),
101 fEvent(0),
102 fEventsPerRun(0),
103 fLoader(0),
104 fRunLoader(0),
105 fCDBManager(0),
106 fCalibrationData(0),
f9eb4448 107 fCrateManager(0),
108 fMCDataInterface(0),
905654c2 109 fBoardsInit(0),
8b067dfe 110 fControlOn(kFALSE),
905654c2 111 fDiMap(0),
112 fTriggerProcessor(0),
8b067dfe 113 fBoards(0),
114 fDigitStore(0),
115 fTriggerStore(0),
116 fTStoreOn(kFALSE),
117 fRUNRAW(kFALSE),
118 fRawReader(0),
119 fCurrentRawEvent(-1),
120 fRawDigitStore(0),
121 fRawTriggerStore(0)
905654c2 122{
123 /// main GUI frame of the trigger monitor
124
125 fChamber = 0;
126 fEvent = 0;
127 fEventsPerRun = 0;
128 fRunLoader = 0;
129 fDiMap = 0;
130
131 fBoards = 0;
132 fFileName = new TString("");
133 fEvString = new TString("");
134 fPath = new TString("");
135
8b067dfe 136 fDigitStore = new AliMUONDigitStoreV2R;
137 fDigitStore->Create();
138
139 fTriggerStore = new AliMUONTriggerStoreV1;
140 fTriggerStore->Create();
141
142 fRawDigitStore = new AliMUONDigitStoreV1;
143 fRawDigitStore->Create();
144
145 fRawTriggerStore = new AliMUONTriggerStoreV1;
146 fRawTriggerStore->Create();
905654c2 147
148 fCDBManager = AliCDBManager::Instance();
162637e4 149 fCDBManager->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
f9eb4448 150 fCDBManager->SetRun(runNumber);
151 AliMpCDB::LoadDDLStore();
152 fCalibrationData = new AliMUONCalibrationData(runNumber);
905654c2 153
8b067dfe 154 fTriggerProcessor = new AliMUONTriggerElectronics(fCalibrationData);
155
905654c2 156 // Main frame
157
158 fMain = new TGMainFrame(gClient->GetRoot(), 750, 420);
159 fMain->Connect("CloseWindow()", "AliMUONTriggerGUI", this, "CloseWindow()");
160
161 // Menu bar
162
163 TGMenuBar *menuBar = new TGMenuBar(fMain);
164
165 // File menu
166
167 TGPopupMenu *menuFile = new TGPopupMenu(gClient->GetRoot());
168 //menuFile->AddLabel("");
169
8b067dfe 170 menuFile->AddEntry("Run input", kMFILERUN);
171 menuFile->AddEntry("Control", kMFILECNTRL);
172 menuFile->AddEntry("Exit", kMFILEEXIT);
905654c2 173
174 menuFile->Connect("Activated(Int_t)", "AliMUONTriggerGUI", this, "HandleMenu(Int_t)");
175
176 // Circuit menu
177
178 TGPopupMenu *menuCircuit = new TGPopupMenu(gClient->GetRoot());
179 //menuCircuit->AddLabel("");
180
181 menuCircuit->AddEntry("Open", kMCIRCUITOPEN);
182
183 menuCircuit->Connect("Activated(Int_t)", "AliMUONTriggerGUI", this, "HandleMenu(Int_t)");
184
185 // Digits map menu
186
187 TGPopupMenu *menuMap = new TGPopupMenu(gClient->GetRoot());
188 //menuMap->AddLabel("");
189
190 menuMap->AddEntry("Digits map", kMMAPDIGITS);
191 menuMap->AddEntry("Reset digits", kMRESETDIGITS);
192
193 menuMap->Connect("Activated(Int_t)", "AliMUONTriggerGUI", this,
194 "HandleMenu(Int_t)");
195
196 // Trigger menu
197
198 TGPopupMenu *menuTrigger = new TGPopupMenu(gClient->GetRoot());
905654c2 199
8b067dfe 200 TGPopupMenu *menuTriggerD = new TGPopupMenu(gClient->GetRoot());
201 TGPopupMenu *menuTriggerT = new TGPopupMenu(gClient->GetRoot());
202 TGPopupMenu *menuTriggerF = new TGPopupMenu(gClient->GetRoot());
203
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();
210
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);
905654c2 222
223 menuTrigger->Connect("Activated(Int_t)", "AliMUONTriggerGUI", this, "HandleMenu(Int_t)");
224
225 // Add menus to the menu bar
226
227 menuBar->AddPopup("File", menuFile,
228 new TGLayoutHints(kLHintsTop | kLHintsLeft, 5,5,2,2)
229 );
230
231 menuBar->AddPopup("Maps", menuMap,
232 new TGLayoutHints(kLHintsTop | kLHintsLeft, 5,5,2,2)
233 );
234
235 menuBar->AddPopup("Circuit", menuCircuit,
236 new TGLayoutHints(kLHintsTop | kLHintsLeft, 5,5,2,2)
237 );
238
8b067dfe 239 menuBar->AddPopup("TriggerDSET", menuTrigger,
905654c2 240 new TGLayoutHints(kLHintsTop | kLHintsLeft, 5,5,2,2)
241 );
242
243 // Add menu bar to the main frame
244
245 fMain->AddFrame(menuBar,
246 new TGLayoutHints(kLHintsTop |
247 kLHintsLeft |
248 kLHintsExpandX,
249 0, 0, 1, 1)
250 );
251
252 // The image map
253
254 fImageMap = new TGImageMap(fMain,"$ALICE_ROOT/MUON/data/guimap.gif");
255
256 fImageMap->Connect("RegionClicked(Int_t)", "AliMUONTriggerGUI", this, "OpenBoard(Int_t)");
257
258 fImageMap->SetToolTipText("Map of the local boards as seen from the I.P.");
259
260 // Add image map to the main frame
261
262 fMain->AddFrame(fImageMap);
263 fMain->SetWindowName("Map of the local boards as seen from the I.P.");
264
265 // Resize the main frame
266
267 TGDimension size = fMain->GetDefaultSize();
268 fMain->Resize(size);
269
270 fMain->MapSubwindows();
271
272 fMain->MapWindow();
273
274 fBoardsInit = kFALSE;
275
8b067dfe 276 InitBoards();
905654c2 277
278}
279
280//__________________________________________________________________________
905654c2 281void AliMUONTriggerGUI::HandleMenu(Int_t id)
282{
283 /// handles entry numbers in the available menus (EMenuIdentifiers)
284
285 TGCompositeFrame *runInput1, *runInput2, *runInput3;
286 TGCompositeFrame *control1, *control2, *circuit1, *circuit2;
8b067dfe 287 TGCompositeFrame *fetregon1, *fetregon2;
288 TGCompositeFrame *fetregoff1, *fetregoff2;
289 TGLabel *runL1, *runL2, *circuitL1, *fetregonL1, *fetregoffL1;
905654c2 290 TGTextEntry *runText1, *runText2, *circuitText1;
8b067dfe 291 TGTextEntry *fetregonText1, *fetregoffText1;
292 TGTextButton *runApply1, *runApply2, *runCancel;
905654c2 293 TGTextButton *controlClose, *nextEvent, *previousEvent, *skipToEvent;
294 TGTextButton *circuitCancel, *circuitOpen;
8b067dfe 295 TGTextButton *fetregonCancel, *fetregoffCancel;
296 TGTextButton *fetregonRun, *fetregoffRun;
905654c2 297
298 switch (id) {
299
300 case kMFILEEXIT:
301
302 printf("\nBye. \n");
303 CloseWindow();
304 break;
305
306 case kMFILERUN:
8b067dfe 307
905654c2 308 // input main frame
309
310 fRunInput = new TGTransientFrame(gClient->GetRoot(), fMain, 400, 200);
311 fRunInput->Connect("CloseWindow()", "AliMUONTriggerGUI", this, "CloseRunInput()");
312 fRunInput->DontCallClose(); // to avoid double deletions.
313
314 // use hierarchical cleaning
315 fRunInput->SetCleanup(kDeepCleanup);
316
317 fRunInput->SetWindowName("Input file and event number");
318
319 // input galice and event number frames
320
321 runInput1 = new TGCompositeFrame(fRunInput, 400, 200, kHorizontalFrame);
322 runInput2 = new TGCompositeFrame(fRunInput, 400, 200, kHorizontalFrame);
323
324 // .. with labels
325
8b067dfe 326 runL1 = new TGLabel(runInput1, new TGString("Full file path:"));
905654c2 327 runL2 = new TGLabel(runInput2, new TGString("Event number:"));
328
329 // galice text entry
330
331 runText1 = new TGTextEntry(runInput1, fTxtBuffer1 = new TGTextBuffer(100));
332
8b067dfe 333 runText1->SetToolTipText("Enter the path to galice.root or the raw data file (root)");
905654c2 334 runText1->Resize(300, runText1->GetDefaultHeight());
335
336 // event number text entry
337
338 runText2 = new TGTextEntry(runInput2, fTxtBuffer2 = new TGTextBuffer(5));
339
340 fEvString->Form("%d",0);
341 fTxtBuffer2->AddText(0,fEvString->Data());
342
343 runText2->SetToolTipText("Enter the first event number to start with");
344 runText2->Resize(300, runText2->GetDefaultHeight());
345
346 // add to galice frame
347
348 runInput1->AddFrame(runL1,
349 new TGLayoutHints(kLHintsLeft |
350 kLHintsCenterY,
351 3, 5, 0, 0)
352 );
353
354 runInput1->AddFrame(runText1,
355 new TGLayoutHints(kLHintsRight |
356 kLHintsCenterY,
357 0, 2, 0, 0)
358 );
359
360 // add to event number frame
361
362 runInput2->AddFrame(runL2,
363 new TGLayoutHints(kLHintsLeft |
364 kLHintsCenterY,
365 3, 5, 0, 0)
366 );
367
368 runInput2->AddFrame(runText2,
369 new TGLayoutHints(kLHintsRight |
370 kLHintsCenterY,
371 0, 2, 0, 0)
372 );
373
374 // add input frames to main input frame
375
376 fRunInput->AddFrame(runInput1,
377 new TGLayoutHints(kLHintsTop | kLHintsExpandX, 2, 2, 3, 0));
378
379 fRunInput->AddFrame(runInput2,
380 new TGLayoutHints(kLHintsTop | kLHintsExpandX, 2, 2, 3, 0));
381
382 // frame with buttons
383
384 runInput3 = new TGCompositeFrame(fRunInput, 400, 200, kHorizontalFrame);
385
386 // buttons
387
8b067dfe 388 runApply1 = new TGTextButton(runInput3, "Apply (galice)", 1);
389 runApply1->Connect("Clicked()", "AliMUONTriggerGUI", this, "DoRunGalApply()");
390 runApply1->SetToolTipText("Apply changes (galice input)");
391
392 runApply2 = new TGTextButton(runInput3, "Apply (raw)", 1);
393 runApply2->Connect("Clicked()", "AliMUONTriggerGUI", this, "DoRunRawApply()");
394 runApply2->SetToolTipText("Apply changes (raw data input)");
905654c2 395
396 runCancel = new TGTextButton(runInput3, "Cancel", 2);
8b067dfe 397 runCancel->Connect("Clicked()", "AliMUONTriggerGUI", this, "DoRunCancel()");
398 runCancel->SetToolTipText("Cancel changes");
905654c2 399
400 // add buttons
401
8b067dfe 402 runInput3->AddFrame(runApply1,
403 new TGLayoutHints(kLHintsTop |
404 kLHintsLeft,
405 3, 3, 2, 2)
406 );
407
408 runInput3->AddFrame(runApply2,
905654c2 409 new TGLayoutHints(kLHintsTop |
410 kLHintsLeft,
411 3, 3, 2, 2)
412 );
413
414 runInput3->AddFrame(runCancel,
415 new TGLayoutHints(kLHintsTop |
416 kLHintsLeft,
417 3, 3, 2, 2)
418 );
419
420 // add to the main input frame
421
422 fRunInput->AddFrame(runInput3,
423 new TGLayoutHints(kLHintsTop |
424 kLHintsExpandX,
425 2, 2, 3, 0)
426 );
427
428 fRunInput->MapSubwindows();
429 fRunInput->Resize();
430 fRunInput->MapWindow();
431
905654c2 432 break;
433
434 case kMFILECNTRL:
435
436 // control main frame
437
438 fControl = new TGTransientFrame(gClient->GetRoot(), fMain, 50, 50);
439 fControl->Connect("CloseWindow()", "AliMUONTriggerGUI", this, "CloseControl()");
440 fControl->DontCallClose(); // to avoid double deletions.
441
442 // use hierarchical cleaning
443 fControl->SetCleanup(kDeepCleanup);
444
445 fControl->SetWindowName("Run controls");
446
447 // frame to hold buttons
448
449 control1 = new TGCompositeFrame(fControl, 50, 50, kVerticalFrame);
450
451 // buttons
452
453 controlClose = new TGTextButton(control1, "Close", 1);
454 controlClose->Connect("Clicked()", "AliMUONTriggerGUI", this, "DoControlClose()");
455 //controlClose->Resize(300, controlClose->GetDefaultHeight());
456
457 nextEvent = new TGTextButton(control1, "Next event", 2);
458 nextEvent->Connect("Clicked()", "AliMUONTriggerGUI", this, "DoNextEvent()");
459
460 previousEvent = new TGTextButton(control1, "Previous event", 3);
461 previousEvent->Connect("Clicked()", "AliMUONTriggerGUI", this, "DoPreviousEvent()");
462
463 // frame to hold event skip
464
465 control2 = new TGCompositeFrame(fControl, 50, 50, kHorizontalFrame);
466
467 // skip to event text field
468
469 fSkipToEventTxt = new TGTextEntry(control2, fTxtBuffer2 = new TGTextBuffer(5));
470
471 fTxtBuffer2->AddText(0,fEvString->Data());
472
473 // skip to event button
474
475 skipToEvent = new TGTextButton(control2, "Skip to event", 1);
476 skipToEvent->Connect("Clicked()", "AliMUONTriggerGUI", this, "DoSkipToEvent()");
477
478 // add to event skip frame
479
480 control2->AddFrame(fSkipToEventTxt,
481 new TGLayoutHints(kLHintsTop |
482 kLHintsRight,
483 10, 10, 5, 5)
484 );
485
486 control2->AddFrame(skipToEvent,
487 new TGLayoutHints(kLHintsTop |
488 kLHintsRight,
489 10, 10, 5, 5)
490 );
491
492 // add buttons
493
494 control1->AddFrame(controlClose,
495 new TGLayoutHints(kLHintsBottom |
496 kLHintsExpandX,
497 10, 10, 5, 5)
498 );
499
500 control1->AddFrame(nextEvent,
501 new TGLayoutHints(kLHintsBottom |
502 kLHintsExpandX,
503 10, 10, 5, 5)
504 );
505
506 control1->AddFrame(previousEvent,
507 new TGLayoutHints(kLHintsBottom |
508 kLHintsExpandX,
509 10, 10, 5, 5)
510 );
511
512 // add to the main frame
513
514 fControl->AddFrame(control1,
515 new TGLayoutHints(kLHintsBottom |
516 kLHintsLeft |
517 kLHintsCenterY,
518 3, 5, 0, 0)
519 );
520
521 fControl->AddFrame(control2,
522 new TGLayoutHints(kLHintsTop |
523 kLHintsCenterX,
524 3, 5, 0, 0)
525 );
526
527 fControl->MapSubwindows();
528 fControl->Resize();
529 fControl->MapWindow();
8b067dfe 530
531 fControlOn = kTRUE;
905654c2 532
533 break;
534
535 case kMMAPDIGITS:
536
537 if (fDiMap == 0) {
f9eb4448 538 fDiMap = new AliMUONTriggerGUIdimap(fBoards,gClient->GetRoot(), fMain, 400, 200);
539 fDiMap->SetLoader(fLoader);
e1ac4804 540 if (fRUNRAW) {
541 fDiMap->SetRawDigitStore(fRawDigitStore);
542 } else {
543 fDiMap->SetMCDataInterface(fMCDataInterface);
544 }
f9eb4448 545 fDiMap->DrawAllMaps();
905654c2 546 } else if (!fDiMap->IsOn()) {
f9eb4448 547 fDiMap = new AliMUONTriggerGUIdimap(fBoards,gClient->GetRoot(), fMain, 400, 200);
548 fDiMap->SetLoader(fLoader);
e1ac4804 549 if (fRUNRAW) {
550 fDiMap->SetRawDigitStore(fRawDigitStore);
551 } else {
552 fDiMap->SetMCDataInterface(fMCDataInterface);
553 }
f9eb4448 554 fDiMap->DrawAllMaps();
905654c2 555 }
556
557 break;
558
559 case kMRESETDIGITS:
560
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();
566 // extended y-strips
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();
574 }
575 }
576
577 break;
578
579 case kMCIRCUITOPEN:
580
581 fCircuit = new TGTransientFrame(gClient->GetRoot(), fMain, 50, 50);
582 fCircuit->Connect("CloseWindow()", "AliMUONTriggerGUI", this, "CloseCircuit()");
583 fCircuit->DontCallClose(); // to avoid double deletions.
584
585 // use hierarchical cleaning
586 fCircuit->SetCleanup(kDeepCleanup);
587
588 fCircuit->SetWindowName("Board circuit");
589
590 // sub-frames
591
592 circuit1 = new TGCompositeFrame(fCircuit, 400, 200, kHorizontalFrame);
593 circuit2 = new TGCompositeFrame(fCircuit, 400, 200, kHorizontalFrame);
594
595 // labels
596
597 circuitL1 = new TGLabel(circuit1, new TGString("Circuit number:"));
598
599 // text entry
600
601 circuitText1 = new TGTextEntry(circuit1, fTxtCircuit = new TGTextBuffer(10));
602 // buttons
603
604 circuitCancel = new TGTextButton(circuit2, "Cancel", 1);
605 circuitCancel->Connect("Clicked()", "AliMUONTriggerGUI", this, "DoCircuitCancel()");
606 //circuitCancel->Resize(100, circuitCancel->GetDefaultHeight());
607
608 circuitOpen = new TGTextButton(circuit2, "Open", 2);
609 circuitOpen->Connect("Clicked()", "AliMUONTriggerGUI", this, "DoCircuitOpen()");
610 //circuitOpen->Resize(100, circuitOpen->GetDefaultHeight());
611
612 // adding
613
614 circuit1->AddFrame(circuitL1,
615 new TGLayoutHints(kLHintsLeft |
616 kLHintsCenterY,
617 5, 5, 2, 2)
618 );
619
620 circuit1->AddFrame(circuitText1,
621 new TGLayoutHints(kLHintsRight |
622 kLHintsCenterY,
623 0, 2, 2, 2)
624 );
625
626 circuit2->AddFrame(circuitCancel,
627 new TGLayoutHints(kLHintsBottom |
628 kLHintsCenterY,
629 5, 5, 2, 2)
630 );
631
632 circuit2->AddFrame(circuitOpen,
633 new TGLayoutHints(kLHintsBottom |
634 kLHintsCenterY,
635 5, 5, 2, 2)
636 );
637
638 fCircuit->AddFrame(circuit1,
639 new TGLayoutHints(kLHintsTop | kLHintsExpandX, 2, 2, 3, 0));
640
641 fCircuit->AddFrame(circuit2,
642 new TGLayoutHints(kLHintsTop | kLHintsExpandX, 2, 2, 3, 0));
643
644 fCircuit->MapSubwindows();
645 fCircuit->Resize();
646 fCircuit->MapWindow();
647
648 break;
649
8b067dfe 650 case kMDSTORE:
651 CreateDigitStore();
652 break;
905654c2 653
8b067dfe 654 case kMDSTOREP:
655 PrintDigitStore();
656 break;
905654c2 657
8b067dfe 658 case kMDSTORECL:
659 ClearDigitStore();
660 break;
905654c2 661
8b067dfe 662 case kMTSTORE:
663 CreateTriggerStore();
664 break;
665
666 case kMTSTOREP:
667 PrintTriggerStore();
668 break;
669
670 case kMTSTORECL:
671 ClearTriggerStore();
672 break;
673
674 case kMTRAWDATA:
675 WriteTriggerRawData();
676 break;
677
678 case kMFETON:
679 FET(1);
680 break;
681
682 case kMFETOFF:
683 FET(0);
684 break;
685
686 case kMFETREGON:
687
688 fFETRegOn = new TGTransientFrame(gClient->GetRoot(), fMain, 50, 50);
689 fFETRegOn->Connect("CloseWindow()", "AliMUONTriggerGUI", this, "CloseFETRegOn()");
690 fFETRegOn->DontCallClose(); // to avoid double deletions.
691
692 // use hierarchical cleaning
693 fFETRegOn->SetCleanup(kDeepCleanup);
694
695 fFETRegOn->SetWindowName("FET ON regional crate");
696
697 // sub-frames
698
699 fetregon1 = new TGCompositeFrame(fFETRegOn, 400, 200, kHorizontalFrame);
700 fetregon2 = new TGCompositeFrame(fFETRegOn, 400, 200, kHorizontalFrame);
701
702 // labels
703
704 fetregonL1 = new TGLabel(fetregon1, new TGString("Regional crate name:"));
705
706 // text entry
707
708 fetregonText1 = new TGTextEntry(fetregon1, fTxtFETRegOn = new TGTextBuffer(10));
709 // buttons
710
711 fetregonCancel = new TGTextButton(fetregon2, "Cancel", 1);
712 fetregonCancel->Connect("Clicked()", "AliMUONTriggerGUI", this, "DoFETRegOnCancel()");
713 //fetregonCancel->Resize(100, fetregonCancel->GetDefaultHeight());
714
715 fetregonRun = new TGTextButton(fetregon2, "Run FET", 2);
716 fetregonRun->Connect("Clicked()", "AliMUONTriggerGUI", this, "DoFETRegOnRun()");
717 //fetregonRun->Resize(100, fetregonRun->GetDefaultHeight());
718
719 // adding
720
721 fetregon1->AddFrame(fetregonL1,
722 new TGLayoutHints(kLHintsLeft |
723 kLHintsCenterY,
724 5, 5, 2, 2)
725 );
726
727 fetregon1->AddFrame(fetregonText1,
728 new TGLayoutHints(kLHintsRight |
729 kLHintsCenterY,
730 0, 2, 2, 2)
731 );
732
733 fetregon2->AddFrame(fetregonCancel,
734 new TGLayoutHints(kLHintsBottom |
735 kLHintsCenterY,
736 5, 5, 2, 2)
737 );
738
739 fetregon2->AddFrame(fetregonRun,
740 new TGLayoutHints(kLHintsBottom |
741 kLHintsCenterY,
742 5, 5, 2, 2)
743 );
744
745 fFETRegOn->AddFrame(fetregon1,
746 new TGLayoutHints(kLHintsTop | kLHintsExpandX, 2, 2, 3, 0));
747
748 fFETRegOn->AddFrame(fetregon2,
749 new TGLayoutHints(kLHintsTop | kLHintsExpandX, 2, 2, 3, 0));
750
751 fFETRegOn->MapSubwindows();
752 fFETRegOn->Resize();
753 fFETRegOn->MapWindow();
754
755 break;
756
757 case kMFETREGOFF:
758
759 fFETRegOff = new TGTransientFrame(gClient->GetRoot(), fMain, 50, 50);
760 fFETRegOff->Connect("CloseWindow()", "AliMUONTriggerGUI", this, "CloseFETRegOff()");
761 fFETRegOff->DontCallClose(); // to avoid double deletions.
762
763 // use hierarchical cleaning
764 fFETRegOff->SetCleanup(kDeepCleanup);
765
766 fFETRegOff->SetWindowName("FET OFF regional crate");
767
768 // sub-frames
769
770 fetregoff1 = new TGCompositeFrame(fFETRegOff, 400, 200, kHorizontalFrame);
771 fetregoff2 = new TGCompositeFrame(fFETRegOff, 400, 200, kHorizontalFrame);
772
773 // labels
774
775 fetregoffL1 = new TGLabel(fetregoff1, new TGString("Regional crate name:"));
776
777 // text entry
778
779 fetregoffText1 = new TGTextEntry(fetregoff1, fTxtFETRegOff = new TGTextBuffer(10));
780 // buttons
781
782 fetregoffCancel = new TGTextButton(fetregoff2, "Cancel", 1);
783 fetregoffCancel->Connect("Clicked()", "AliMUONTriggerGUI", this, "DoFETRegOffCancel()");
784 //fetregoffCancel->Resize(100, fetregoffCancel->GetDefaultHeight());
785
786 fetregoffRun = new TGTextButton(fetregoff2, "Run FET", 2);
787 fetregoffRun->Connect("Clicked()", "AliMUONTriggerGUI", this, "DoFETRegOffRun()");
788 //fetregoffRun->Resize(100, fetregoffRun->GetDefaultHeight());
789
790 // adding
791
792 fetregoff1->AddFrame(fetregoffL1,
793 new TGLayoutHints(kLHintsLeft |
794 kLHintsCenterY,
795 5, 5, 2, 2)
796 );
797
798 fetregoff1->AddFrame(fetregoffText1,
799 new TGLayoutHints(kLHintsRight |
800 kLHintsCenterY,
801 0, 2, 2, 2)
802 );
803
804 fetregoff2->AddFrame(fetregoffCancel,
805 new TGLayoutHints(kLHintsBottom |
806 kLHintsCenterY,
807 5, 5, 2, 2)
808 );
809
810 fetregoff2->AddFrame(fetregoffRun,
811 new TGLayoutHints(kLHintsBottom |
812 kLHintsCenterY,
813 5, 5, 2, 2)
814 );
815
816 fFETRegOff->AddFrame(fetregoff1,
817 new TGLayoutHints(kLHintsTop | kLHintsExpandX, 2, 2, 3, 0));
818
819 fFETRegOff->AddFrame(fetregoff2,
820 new TGLayoutHints(kLHintsTop | kLHintsExpandX, 2, 2, 3, 0));
821
822 fFETRegOff->MapSubwindows();
823 fFETRegOff->Resize();
824 fFETRegOff->MapWindow();
905654c2 825
905654c2 826 break;
827
828 default:
829 printf("Menu item %d selected\n", id);
830 break;
831
832 }
833
834}
835
836//__________________________________________________________________________
837void AliMUONTriggerGUI::CloseRunInput() const
838{
839 /// close the run input frame
840
841 delete fRunInput;
842
843}
844
845//__________________________________________________________________________
846void AliMUONTriggerGUI::CloseError() const
847{
848 /// close the error frame
849
850 delete fError;
851
852}
853
854//__________________________________________________________________________
855void AliMUONTriggerGUI::CloseControl() const
856{
857 /// close the event control frame
858
859 delete fControl;
860
861 //gSystem->Exec("cd $PWD/mtrun; aliroot -b -q mtsim.C");
862
863}
864
865//__________________________________________________________________________
866void AliMUONTriggerGUI::CloseCircuit() const
867{
868 /// close the circuit frame
869
870 delete fCircuit;
871
872}
873
874//__________________________________________________________________________
8b067dfe 875void AliMUONTriggerGUI::CloseFETRegOn() const
876{
877 /// close the FET regional on frame
878
879 delete fFETRegOn;
880
881}
882
883//__________________________________________________________________________
884void AliMUONTriggerGUI::CloseFETRegOff() const
885{
886 /// close the FET regional off frame
887
888 delete fFETRegOff;
889
890}
891
892//__________________________________________________________________________
905654c2 893void AliMUONTriggerGUI::CloseWindow()
894{
895 /// close the main frame and exit aplication
896
897 delete fRunLoader;
f9eb4448 898 delete fMCDataInterface;
905654c2 899 printf("\n");
900 gApplication->Terminate();
901
902}
903
904//__________________________________________________________________________
8b067dfe 905void AliMUONTriggerGUI::DoRunGalApply()
905654c2 906{
8b067dfe 907 /// apply changes in the run control frame for galice input
905654c2 908
8b067dfe 909 if (fRUNRAW) {
910 printf("This is a run with raw data input.\n");
911 return;
912 }
905654c2 913
914 TString es = TString(fTxtBuffer2->GetString());
915 fEvent = es.Atoi();
916
8b067dfe 917 printf("Galice input = %s event = %d \n",fTxtBuffer1->GetString(),fEvent);
905654c2 918
919 TString error = TString("");;
920
921 fPath->Form("%s",fTxtBuffer1->GetString());
922 fFileName->Form("%s",fTxtBuffer1->GetString());
905654c2 923
924 if (gSystem->AccessPathName(fFileName->Data()) || !fFileName->EndsWith(".root")) {
925
926 error.Append("No galice file: ");
927 error.Append(fFileName->Data());
928 DoErrorGUI(error.Data());
929
930 } else {
931
932 TFile *ftest = new TFile(fFileName->Data(),"READ");
933 AliRun *galice = (AliRun*)ftest->Get("gAlice");
934 if (galice == 0) {
935
936 ftest->Close();
937 delete ftest;
938
939 error.Append("No gAlice in file: ");
940 error.Append(fFileName->Data());
941 DoErrorGUI(error.Data());
942
943 return;
944
945 } else {
946 ftest->Close();
947 delete ftest;
948 }
949
f9eb4448 950 if (fRunLoader) {
951 delete fRunLoader;
952 delete fMCDataInterface;
953 }
905654c2 954
955 fRunLoader = AliRunLoader::Open(fFileName->Data(),"MUONFolder","READ");
956
957 if (fRunLoader == 0x0) {
958
959 DoErrorGUI("No run loader !");
960
961 } else {
962
963 fRunLoader->LoadgAlice();
964 gAlice = fRunLoader->GetAliRun();
33c3c91a 965 fEventsPerRun = AliRunLoader::Instance()->GetNumberOfEvents();
905654c2 966
967 fLoader = fRunLoader->GetLoader("MUONLoader");
905654c2 968 fRunLoader->GetEvent(fEvent);
969
f9eb4448 970 fMCDataInterface = new AliMUONMCDataInterface(fFileName->Data());
971
905654c2 972 fRunInput->SendCloseMessage();
973
974 if (!fBoardsInit) {
975 InitBoards();
976 }
977
978 if (fDiMap) {
979 if (fDiMap->IsOn()) {
980 fDiMap->SetLoader(fLoader);
f9eb4448 981 fDiMap->SetMCDataInterface(fMCDataInterface);
905654c2 982 }
983 }
984
905654c2 985 }
986
987 }
988
989}
990
991//__________________________________________________________________________
8b067dfe 992void AliMUONTriggerGUI::DoRunRawApply()
905654c2 993{
8b067dfe 994 /// apply changes in the run control frame for raw date input
995
996 if (fControlOn) DoControlClose();
905654c2 997
8b067dfe 998 if (fRunLoader != 0) {
999 printf("This is a run with galice input.\n");
1000 return;
1001 }
905654c2 1002
1003 TString es = TString(fTxtBuffer2->GetString());
1004 fEvent = es.Atoi();
1005
8b067dfe 1006 printf("Raw data input = %s event = %d \n",fTxtBuffer1->GetString(),fEvent);
1007
1008 TString error = TString("");;
1009
1010 fPath->Form("%s",fTxtBuffer1->GetString());
1011 fFileName->Form("%s",fTxtBuffer1->GetString());
1012
1013 if (gSystem->AccessPathName(fFileName->Data()) || !fFileName->EndsWith(".root")) {
1014
1015 error.Append("No raw data file: ");
1016 error.Append(fFileName->Data());
1017 DoErrorGUI(error.Data());
1018
1019 } else {
1020
1021 if (fRawReader == 0) {
1022 fRawReader = AliRawReader::Create(fFileName->Data());
1023 } else {
1024 delete fRawReader;
1025 fRawReader = AliRawReader::Create(fFileName->Data());
1026 }
1027 if (fRawReader == 0) {
1028 error.Append("Not a valid raw data file: ");
1029 error.Append(fFileName->Data());
1030 DoErrorGUI(error.Data());
1031 return;
1032 }
1033
1034 fRawReader->GotoEvent(fEvent);
1035 fCurrentRawEvent = fEvent;
1036
1037 AliMUONDigitMaker digitMaker;
1038 digitMaker.SetMakeTriggerDigits(kTRUE);
1039 digitMaker.Raw2Digits(fRawReader,fRawDigitStore,fRawTriggerStore);
1040
1041 fRunInput->SendCloseMessage();
1042
1043 if (!fBoardsInit) {
1044 InitBoards();
1045 }
1046
1047 if (fDiMap) {
1048 if (fDiMap->IsOn()) {
1049 fDiMap->SetRawDigitStore(fRawDigitStore);
1050 }
1051 }
1052
1053 fRUNRAW = kTRUE;
1054
1055 }
1056
1057}
1058
1059//__________________________________________________________________________
1060void AliMUONTriggerGUI::DoRunCancel()
1061{
1062 /// cancel the changes in the run control frame
905654c2 1063
1064 fRunInput->SendCloseMessage();
1065
1066}
1067
1068//__________________________________________________________________________
1069void AliMUONTriggerGUI::DoErrorGUI(const Char_t *wt)
1070{
1071 /// show an error message in a new frame
1072
1073 fError = new TGTransientFrame(gClient->GetRoot(), fMain, 50, 50);
1074 fError->Connect("CloseWindow()", "AliMUONTriggerGUI", this, "CloseError()");
1075 fError->DontCallClose(); // to avoid double deletions.
1076
1077 // use hierarchical cleaning
1078 fError->SetCleanup(kDeepCleanup);
1079
1080 fError->SetWindowName("Error !");
1081
1082 TGCompositeFrame *fW = new TGCompositeFrame(fError, 50, 50, kVerticalFrame);
1083
1084 TGTextButton *fErrorOK = new TGTextButton(fW, "&Ok", 1);
1085 fErrorOK->Connect("Clicked()", "AliMUONTriggerGUI", this, "DoErrorOK()");
1086
1087 fW->AddFrame(fErrorOK,
1088 new TGLayoutHints(kLHintsBottom |
1089 kLHintsCenterX,
1090 5, 5, 5, 5)
1091 );
1092
1093 TGLabel *fWL = new TGLabel(fW, new TGString(wt));
1094
1095 fW->AddFrame(fWL,
1096 new TGLayoutHints(kLHintsTop |
1097 kLHintsCenterX,
1098 5, 5, 5, 5)
1099 );
1100
1101 fError->AddFrame(fW,
1102 new TGLayoutHints(kLHintsLeft |
1103 kLHintsCenterY,
1104 5, 5, 5, 5)
1105 );
1106
1107 fError->MapSubwindows();
1108 fError->Resize();
1109 fError->MapWindow();
1110
1111}
1112
1113//__________________________________________________________________________
1114void AliMUONTriggerGUI::DoNextEvent()
1115{
1116 /// load next event from the file
1117
1118 TString error = TString("");
1119
8b067dfe 1120 if (!fRUNRAW) {
1121 if (fEvent < (fEventsPerRun-1)) {
1122 fEvent++;
1123 fRunLoader->GetEvent(fEvent);
1124
1125 fEvString->Form("%d",fEvent);
1126 fTxtBuffer2->RemoveText(0,5);
1127 fTxtBuffer2->AddText(0,fEvString->Data());
1128 fSkipToEventTxt->SetFocus();
1129
1130 } else {
1131 error.Form("Only %d event(s) in the run !",fEventsPerRun);
1132 DoErrorGUI(error.Data());
1133 }
1134 } else {
1135 if (fRawReader->NextEvent()) {
1136 fCurrentRawEvent++;
905654c2 1137
8b067dfe 1138 AliMUONDigitMaker digitMaker;
1139 digitMaker.SetMakeTriggerDigits(kTRUE);
1140 digitMaker.Raw2Digits(fRawReader,fRawDigitStore,fRawTriggerStore);
1141
1142 fEvString->Form("%d",fCurrentRawEvent);
1143 fTxtBuffer2->RemoveText(0,5);
1144 fTxtBuffer2->AddText(0,fEvString->Data());
1145 fSkipToEventTxt->SetFocus();
1146
1147 }
905654c2 1148
905654c2 1149 }
1150
1151}
1152
1153//__________________________________________________________________________
1154void AliMUONTriggerGUI::DoPreviousEvent()
1155{
1156 /// load previous event from the input file
1157
1158 TString error = TString("");
1159
8b067dfe 1160 if (!fRUNRAW) {
1161 if (fEvent > 0) {
1162 fEvent--;
1163 fRunLoader->GetEvent(fEvent);
1164
1165 fEvString->Form("%d",fEvent);
1166 fTxtBuffer2->RemoveText(0,5);
1167 fTxtBuffer2->AddText(0,fEvString->Data());
1168 fSkipToEventTxt->SetFocus();
1169
1170 } else {
1171 error.Form("Already at event 0 !");
1172 DoErrorGUI(error.Data());
1173 }
1174 } else {
1175 if (fCurrentRawEvent > 0) {
1176 fCurrentRawEvent--;
1177 fRawReader->GotoEvent(fCurrentRawEvent);
905654c2 1178
8b067dfe 1179 AliMUONDigitMaker digitMaker;
1180 digitMaker.SetMakeTriggerDigits(kTRUE);
1181 digitMaker.Raw2Digits(fRawReader,fRawDigitStore,fRawTriggerStore);
1182
1183 fEvString->Form("%d",fCurrentRawEvent);
1184 fTxtBuffer2->RemoveText(0,5);
1185 fTxtBuffer2->AddText(0,fEvString->Data());
1186 fSkipToEventTxt->SetFocus();
1187
1188 }
905654c2 1189
905654c2 1190 }
1191
1192}
1193
1194//__________________________________________________________________________
1195void AliMUONTriggerGUI::DoSkipToEvent()
1196{
1197 /// skip to event -input- from the input file
1198
1199 TString error = TString("");
1200
1201 TString es = TString(fTxtBuffer2->GetString());
1202 fEvent = es.Atoi();
1203
8b067dfe 1204 if (!fRUNRAW) {
1205 if (fEvent < 0 || fEvent > (fEventsPerRun-1)) {
1206 error.Form("Event number out of range !");
1207 DoErrorGUI(error.Data());
1208 } else {
1209 fRunLoader->GetEvent(fEvent);
1210 }
905654c2 1211 } else {
8b067dfe 1212 if (fRawReader->GotoEvent(fEvent)) {
1213 fCurrentRawEvent = fEvent;
905654c2 1214
8b067dfe 1215 AliMUONDigitMaker digitMaker;
1216 digitMaker.SetMakeTriggerDigits(kTRUE);
1217 digitMaker.Raw2Digits(fRawReader,fRawDigitStore,fRawTriggerStore);
1218
1219 fEvString->Form("%d",fCurrentRawEvent);
1220 fTxtBuffer2->RemoveText(0,5);
1221 fTxtBuffer2->AddText(0,fEvString->Data());
1222 fSkipToEventTxt->SetFocus();
905654c2 1223 }
8b067dfe 1224
905654c2 1225 }
1226
1227}
1228
1229//__________________________________________________________________________
1230void AliMUONTriggerGUI::DoErrorOK()
1231{
1232 /// close the error frame
1233
1234 fError->SendCloseMessage();
1235
1236}
1237
1238//__________________________________________________________________________
1239void AliMUONTriggerGUI::DoControlClose()
1240{
1241 /// close the event control frame
1242
1243 fControl->SendCloseMessage();
8b067dfe 1244 fControlOn = kFALSE;
905654c2 1245
1246}
1247
1248//__________________________________________________________________________
1249void AliMUONTriggerGUI::DoCircuitCancel()
1250{
1251 /// close the circuit frame
1252
1253 fCircuit->SendCloseMessage();
1254
1255}
1256
1257//__________________________________________________________________________
8b067dfe 1258void AliMUONTriggerGUI::DoFETRegOnCancel()
1259{
1260 /// close the FET regional on window
1261
1262 fFETRegOn->SendCloseMessage();
1263
1264}
1265
1266//__________________________________________________________________________
1267void AliMUONTriggerGUI::DoFETRegOffCancel()
1268{
1269 /// close the FET regional off window
1270
1271 fFETRegOff->SendCloseMessage();
1272
1273}
1274
1275//__________________________________________________________________________
1276void AliMUONTriggerGUI::DoFETRegRun(Int_t onoff)
1277{
1278 /// FET ON/OFF for the regional crate
1279
1280 TString crateName;
1281 if (onoff == 1)
1282 crateName = TString(fTxtFETRegOn->GetString());
1283 if (onoff == 0)
1284 crateName = TString(fTxtFETRegOff->GetString());
1285
1286 AliMUONTriggerGUIboard *board;
1287 Int_t amp = onoff;
1288
1289 for (Int_t ib = 0; ib < kNBoards; ib++) {
1290 board = (AliMUONTriggerGUIboard*)fBoards->At(ib);
1291 if (strcmp(board->GetCrateName(),crateName.Data()) != 0) continue;
1292 FETboard(ib,amp);
1293 }
1294
1295}
1296
1297//__________________________________________________________________________
1298void AliMUONTriggerGUI::DoFETRegOnRun()
1299{
1300 /// FET ON for the regional crate
1301
1302 DoFETRegRun(1);
1303 fFETRegOn->SendCloseMessage();
1304
1305}
1306
1307//__________________________________________________________________________
1308void AliMUONTriggerGUI::DoFETRegOffRun()
1309{
1310 /// FET ON for the regional crate
1311
1312 DoFETRegRun(0);
1313 fFETRegOff->SendCloseMessage();
1314
1315}
1316
1317//__________________________________________________________________________
905654c2 1318void AliMUONTriggerGUI::DoCircuitOpen()
1319{
1320 /// open a circuit
1321
1322 TString cs = TString(fTxtCircuit->GetString());
1323 Int_t icirc = cs.Atoi();
1324
1325 AliMUONTriggerGUIboard *board;
1326
1327 for (Int_t ib = 0; ib < kNBoards; ib++) {
1328
1329 board = GetBoard(ib);
1330
1331 if (board->GetIdCircuit() == icirc) {
1332
1333 OpenBoard(ib);
1334
1335 if (fDiMap) {
1336 if (fDiMap->IsOn()) {
1337 fDiMap->SelectBoard(ib);
1338 }
1339 }
1340
1341 fCircuit->SendCloseMessage();
1342 return;
1343 }
1344
1345 }
1346
1347}
1348
1349//__________________________________________________________________________
1350AliMUONTriggerGUIboard* AliMUONTriggerGUI::GetBoard(Int_t id) const
1351{
1352 /// return board with "id"
1353
1354 if (fBoards == 0) return 0;
1355 void * b = fBoards->UncheckedAt(id);
1356 if (b == 0) return 0;
1357
1358 return (AliMUONTriggerGUIboard*)b;
1359
1360}
1361
1362//__________________________________________________________________________
1363void AliMUONTriggerGUI::OpenBoard(Int_t id)
1364{
1365 /// open board with "id" in a new frame
1366
1367 AliMUONTriggerGUIboard *board = GetBoard(id);
1368 UShort_t status = board->GetStatus();
1369 board->SetOpen(kTRUE);
1370
1371 AliMUONTriggerGUIbdmap *bf;
1372 Char_t text[200];
1373
1374 bf = new AliMUONTriggerGUIbdmap(gClient->GetRoot(), fMain, 400, 200);
1375
1376 if (status & kGood) {
b785c4bd 1377 snprintf(text,200,"%s (Circuit %4d) status : working",
905654c2 1378 board->GetBoardName(),board->GetIdCircuit());
1379 }
1380
1381 if (status & kWithProblems) {
b785c4bd 1382 snprintf(text,200,"%s (Circuit %4d) status : has problems...",
905654c2 1383 board->GetBoardName(),board->GetIdCircuit());
1384 }
1385
1386 if (status & kNotWorking) {
b785c4bd 1387 snprintf(text,200,"%s (Circuit %4d) status : not working",
905654c2 1388 board->GetBoardName(),board->GetIdCircuit());
1389 }
1390
1391 if (status & kUnknown) {
b785c4bd 1392 snprintf(text,200,"%s (Circuit %4d) status : unknown",
905654c2 1393 board->GetBoardName(),board->GetIdCircuit());
1394 }
1395
1396 bf->SetName(text);
1397 bf->SetBoard(Boards(),id);
1398 bf->SetLoader(fLoader);
f9eb4448 1399 bf->SetCrateManager(fCrateManager);
e1ac4804 1400 if (fRUNRAW) {
1401 bf->SetRawDigitStore(fRawDigitStore);
1402 bf->SetRawTriggerStore(fRawTriggerStore);
1403 } else {
1404 bf->SetMCDataInterface(fMCDataInterface);
1405 }
905654c2 1406 bf->Init();
1407
1408 bf->Show();
1409
1410 if (fDiMap) {
1411 if (fDiMap->IsOn()) {
1412 fDiMap->SelectBoard(id);
1413 }
1414 }
1415
1416}
1417
1418//__________________________________________________________________________
1419void AliMUONTriggerGUI::Init()
1420{
1421 /// initialize the main GUI frame
1422
1423 if (!fBoardsInit) {
1424 InitBoards();
1425 }
1426
1427 /*
1428 AliMUONTriggerGUIboard *board;
1429 for (Int_t ib = 0; ib < kNBoards; ib++) {
1430 board = GetBoard(ib);
1431 board->Dump();
1432 }
1433 */
1434}
1435
1436//__________________________________________________________________________
1437void AliMUONTriggerGUI::InitBoards()
1438{
1439 /// create board objects and define the sensitive regions in the image map
1440
1441 fBoardsInit = kTRUE;
1442
8b067dfe 1443 // used by bdmap
f9eb4448 1444 if (fCrateManager == 0x0) {
1445 fCrateManager = new AliMUONTriggerCrateStore();
1446 fCrateManager->ReadFromFile(fCalibrationData);
1447 }
905654c2 1448
8b067dfe 1449 // create boards geometry from the mapping
1450 AliMUONTriggerGUIboard *board;
1451 for (Int_t ib = 0; ib < kNBoards; ib++) {
1452 Boards()->Add(new AliMUONTriggerGUIboard());
1453 }
1454
1455 // circuit number to board number in array
1456 Int_t cIdtobId[235];
9bfa8dcb 1457 for (Int_t i = 0; i < 235; i++) cIdtobId[i] = -1;
8b067dfe 1458
1459 AliMpDEIterator it;
1460 Int_t boardId = -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() ) {
1464
1465 if (it.CurrentDEId()/100 < 11) continue;
1466
1467 ich = it.CurrentDEId()/100 - 11;
1468 if (ich != chamber) continue;
1469 idet = it.CurrentDEId()%100;
1470
1471 const AliMpVSegmentation* seg0 = AliMpSegmentation::Instance()->GetMpSegmentation(it.CurrentDEId(), AliMp::kCath0);
1472 const AliMpVSegmentation* seg1 = AliMpSegmentation::Instance()->GetMpSegmentation(it.CurrentDEId(), AliMp::kCath1);
1473
1474 // x-strips
1475 manuIdPrev = 0;
8b067dfe 1476 for (Int_t ix = 0; ix <= seg0->MaxPadIndexX(); ix++) {
1477 for (Int_t iy = 0; iy <= seg0->MaxPadIndexY(); iy++) {
168e9c4d 1478 AliMpPad pad = seg0->PadByIndices(ix,iy,kFALSE);
8b067dfe 1479 if (pad.IsValid()) {
168e9c4d 1480 Int_t manuId = pad.GetLocalBoardId(0);
8b067dfe 1481 if (manuId != manuIdPrev) {
1482 AliMpLocalBoard *mpboard = AliMpDDLStore::Instance()->GetLocalBoard(manuId);
1483 manuIdPrev = manuId;
1484 if (ich == 0) {
1485 boardId++;
1486 } else {
1487 boardId = cIdtobId[manuId];
1488 }
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;
1497 }
1498 GetBoard(boardId)->AddPadX(pad,ich);
1499 }
1500 }
1501 } // end plane 0 (x-strips)
1502
1503 // y-strips
1504 manuIdPrev = 0;
8b067dfe 1505 for (Int_t ix = 0; ix <= seg1->MaxPadIndexX(); ix++) {
1506 for (Int_t iy = 0; iy <= seg1->MaxPadIndexY(); iy++) {
168e9c4d 1507 AliMpPad pad = seg1->PadByIndices(ix,iy,kFALSE);
8b067dfe 1508 if (pad.IsValid()) {
1509 Int_t nloc = pad.GetNofLocations();
1510 for (Int_t iloc = 0; iloc < nloc; iloc++) {
168e9c4d 1511 Int_t manuId = pad.GetLocalBoardId(iloc);
8b067dfe 1512 if (manuId != manuIdPrev) {
1513 manuIdPrev = manuId;
1514 boardIdTmp = cIdtobId[manuId];
1515 }
1516 GetBoard(boardIdTmp)->AddPadY(pad,ich);
1517 }
1518 }
1519 }
1520 } // end plane 1 (y-strips)
1521
1522 } // end det elem loop
1523 } // end chamber loop
1524
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());
1530 }
1531
1532 // create the sensitive map
1533
905654c2 1534 Int_t nPixelX = 700;
1535 Int_t nPixelY = 676;
1536
1537 Int_t nPixelBorderX = 40; // to guess...
1538 Int_t nPixelBorderY = 40; // to guess...
1539
8b067dfe 1540 // boards limits
905654c2 1541 Float_t boardsX = 2*257.00; // cm
1542 Float_t boardsY = 2*306.61; // cm
1543
905654c2 1544 UShort_t status = 1;
8b067dfe 1545 Float_t xc, yc, xw, yw;
1546 Char_t text[256];
905654c2 1547 Int_t x, y;
1548 UInt_t w, h;
1549 Int_t xp[5];
1550 Int_t yp[5];
905654c2 1551
1552 TGRegion *reg;
905654c2 1553
8b067dfe 1554 // regions for the image map (from MT11)
905654c2 1555
1556 for (Int_t ib = 0; ib < kNBoards; ib++) {
1557
8b067dfe 1558 board = GetBoard(ib);
905654c2 1559
1560 status = 1;
1561 board->SetStatus(status);
1562
8b067dfe 1563 xc = board->GetXCenter(0);
1564 yc = board->GetYCenter(0);
1565 xw = board->GetXWidth(0);
1566 yw = board->GetYWidth(0);
905654c2 1567
1568 x = (Int_t)(nPixelX/2 + xc * (nPixelX - 2*nPixelBorderX)/boardsX);
1569 y = (Int_t)(nPixelY/2 - yc * (nPixelY - 2*nPixelBorderY)/boardsY);
1570
1571 if (x < 0) x = 0;
1572 if (y < 0) y = 0;
1573
8b067dfe 1574 w = (UInt_t)(xw*(nPixelX-2*nPixelBorderX)/boardsX);
1575 h = (UInt_t)(yw*(nPixelY-2*nPixelBorderY)/boardsY);
905654c2 1576
1577 xp[0] = x-w/2;
1578 xp[1] = x+w/2;
1579 xp[2] = x+w/2;
1580 xp[3] = x-w/2;
1581 xp[4] = x-w/2;
1582
1583 yp[0] = y-h/2;
1584 yp[1] = y-h/2;
1585 yp[2] = y+h/2;
1586 yp[3] = y+h/2;
1587 yp[4] = y-h/2;
1588
1589 reg = new TGRegion(5,xp,yp);
1590 fImageMap->AddRegion(*reg, ib);
1591
b785c4bd 1592 snprintf(text,256,"%s (crate %s circuit %3d, number %3d)",board->GetBoardName(),board->GetCrateName(),board->GetIdCircuit(),board->GetNumber());
905654c2 1593 fImageMap->SetToolTipText(ib, text);
905654c2 1594
8b067dfe 1595 // Set coordinates of strips boxes
905654c2 1596
8b067dfe 1597 SetStripBoxes(board);
905654c2 1598
8b067dfe 1599 //board->PrintBoard();
905654c2 1600
1601 }
1602
905654c2 1603}
1604
1605//__________________________________________________________________________
1606void AliMUONTriggerGUI::SetStripBoxes(AliMUONTriggerGUIboard *board)
1607{
1608 /// set coordinates of strip boxes
1609
8b067dfe 1610 AliMUONGeometryTransformer transformer;
1611 transformer.LoadGeometryData("transform.dat");
905654c2 1612
1613 const AliMpVSegmentation* seg;
1614 AliMpPad pad;
1615 AliMpDEIterator it;
1616
8b067dfe 1617 Int_t chamber, detElemId, maxX, maxY;
905654c2 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;
1622
1623 for (Int_t i = 0; i < kNMT; i++) {
1624
1625 chamber = 11+i;
1626
1627 xCenter = board->GetXCenter(i);
1628 yCenter = board->GetYCenter(i);
1629 xWidth = board->GetXWidth(i);
1630 yWidth = board->GetYWidth(i);
1631
1632 for ( it.First(chamber-1); ! it.IsDone(); it.Next() ) {
1633
1634 detElemId = it.CurrentDEId();
1635
1636 if (detElemId%100 != board->GetDetElemId()) continue;
1637
8b067dfe 1638 /*---------- y-pads cath = 1 ----------*/
905654c2 1639
8b067dfe 1640 seg = AliMpSegmentation::Instance()->GetMpSegmentation(detElemId, AliMp::kCath1);
905654c2 1641
1642 maxX = seg->MaxPadIndexX();
1643 maxY = seg->MaxPadIndexY();
1644
1645 for (Int_t ix = 0; ix <= maxX; ix++) {
1646 for (Int_t iy = 0; iy <= maxY; iy++) {
1647
168e9c4d 1648 pad = seg->PadByIndices(ix,iy,kFALSE);
905654c2 1649
1650 if (!pad.IsValid()) continue;
1651
1652 // get the pad position and dimensions
6e97fbb8 1653 xlocal1 = pad.GetPositionX();
1654 ylocal1 = pad.GetPositionY();
1655 xlocal2 = pad.GetDimensionX();
1656 ylocal2 = pad.GetDimensionY();
905654c2 1657
8b067dfe 1658 transformer.Local2Global(detElemId, xlocal1, ylocal1, 0, xg1, yg1, zg1);
905654c2 1659 // (no transformation for pad dimensions)
1660 xg2 = xlocal2;
1661 yg2 = ylocal2;
1662
1663 // transform in the monitor coordinate system
905654c2 1664 // ALICE SC
1665 xpmin = +(xg1-xg2);
1666 xpmax = +(xg1+xg2);
1667 ypmin = -(yg2-yg1);
1668 ypmax = +(yg2+yg1);
1669
1670 xpmin -= xCenter;
1671 xpmax -= xCenter;
1672 ypmin -= yCenter;
1673 ypmax -= yCenter;
1674
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) {
1680
1681 ypmin = -0.5*yWidth;
1682 ypmax = +0.5*yWidth;
1683
1684 ixDig = ix - iX1;
1685
1686 board->SetYDigBox(i,ixDig,(Double_t)xpmin,(Double_t)ypmin,
1687 (Double_t)xpmax,(Double_t)ypmax);
1688
1689 }
1690
1691 } // end maxY
1692 } // end maxX
1693
8b067dfe 1694 /*---------- x-pads cath = 0 ----------*/
905654c2 1695
8b067dfe 1696 seg = AliMpSegmentation::Instance()->GetMpSegmentation(detElemId, AliMp::kCath0);
905654c2 1697
1698 maxX = seg->MaxPadIndexX();
1699 maxY = seg->MaxPadIndexY();
1700
1701 for (Int_t ix = 0; ix <= maxX; ix++) {
1702 for (Int_t iy = 0; iy <= maxY; iy++) {
1703
168e9c4d 1704 pad = seg->PadByIndices(ix,iy,kFALSE);
905654c2 1705
1706 if (!pad.IsValid()) continue;
1707
1708 // get the pad position and dimensions
6e97fbb8 1709 xlocal1 = pad.GetPositionX();
1710 ylocal1 = pad.GetPositionY();
1711 xlocal2 = pad.GetDimensionX();
1712 ylocal2 = pad.GetDimensionY();
905654c2 1713
8b067dfe 1714 transformer.Local2Global(detElemId, xlocal1, ylocal1, 0, xg1, yg1, zg1);
905654c2 1715 // (no transformation for pad dimensions)
1716 xg2 = xlocal2;
1717 yg2 = ylocal2;
1718
1719 // transform in the monitor coordinate system
905654c2 1720 // ALICE SC
1721 xpmin = +(xg1+xg2);
1722 xpmax = +(xg1-xg2);
1723 ypmin = -(yg2-yg1);
1724 ypmax = +(yg2+yg1);
1725
1726 xpmin -= xCenter;
1727 xpmax -= xCenter;
1728 ypmin -= yCenter;
1729 ypmax -= yCenter;
1730
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) {
1736
1737 iyDig = iy - iY1;
1738
1739 board->SetXDigBox(i,iyDig,(Double_t)xpmin,(Double_t)ypmin,
1740 (Double_t)xpmax,(Double_t)ypmax);
1741
1742 }
1743
1744 } // end maxY
1745 } // end maxX
1746
1747 } // end detElemId
1748
1749 } // end kNMT loop
1750
1751}
1752
8b067dfe 1753//__________________________________________________________________________
1754void AliMUONTriggerGUI::CreateDigitStore()
1755{
1756 /// create memory resident digits store with set strips
1757
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;
1762 AliMpPad pad;
1763 AliMUONTriggerGUIboard* board;
1764 AliMUONVDigit *dig;
1765
1766 for (Int_t ib = 0; ib < kNBoards; ib++) {
1767
1768 board = (AliMUONTriggerGUIboard*)fBoards->At(ib);
1769 if (board == 0) continue;
1770
1771 nstripX = board->GetNStripX();
1772 nstripY = board->GetNStripY();
1773 for (Int_t ichamber = 11; ichamber <= 14; ichamber++) {
1774
1775 detElemId = ichamber * 100 + board->GetDetElemId();
1776 // x strips
1777 cathode = 0;
1778 for (Int_t isx = 0; isx < nstripX; isx++) {
1779
1780 charge = (Int_t)board->GetXDig(ichamber-11,isx);
1781 if (charge == 0) continue;
1782 ix = board->GetXSix();
1783 iY1 = board->GetXSiy1();
1784 iy = isx + iY1;
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");
168e9c4d 1790 pad = seg->PadByIndices(ix,iy,kTRUE);
1791 manuId = pad.GetLocalBoardId(0);
1792 manuChannel = pad.GetLocalBoardChannel(0);
8b067dfe 1793
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);
1798
1799 } // end x strips
1800
1801 // y strips
1802 cathode = 1;
1803 for (Int_t isy = 0; isy < nstripY; isy++) {
1804
1805 charge = board->GetYDig(ichamber-11,isy);
1806 if (charge == 0) continue;
1807 iX1 = board->GetYSix1();
1808 ix = isy + iX1;
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");
168e9c4d 1815 pad = seg->PadByIndices(ix,iy,kTRUE);
1816 manuId = pad.GetLocalBoardId(0);
1817 manuChannel = pad.GetLocalBoardChannel(0);
8b067dfe 1818
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);
1823
1824 } // end y strips
1825
1826 } // end chambers
1827
1828 } // end boards
1829
1830}
1831
1832//__________________________________________________________________________
1833void AliMUONTriggerGUI::PrintDigitStore() const
1834{
1835 /// Print the digits created in the GUI
1836
1837 const AliMpVSegmentation* seg;
1838 AliMpPad pad;
1839 Int_t ix, iy, charge, detElemId, cathode;
1840
1841 Int_t chamber;
1842 for (Int_t i = 0; i < kNMT; i++) {
1843
1844 chamber = 11+i;
1845
168e9c4d 1846 MpPair_t deRange = AliMpDEManager::GetDetElemIdRange(chamber-1);
1847 TIter next(fDigitStore->CreateIterator(AliMp::PairFirst(deRange),AliMp::PairSecond(deRange)));
8b067dfe 1848 AliMUONVDigit *mdig;
1849
1850 while ( ( mdig = static_cast<AliMUONVDigit*>(next())) )
1851 {
1852 cathode = mdig->Cathode();
1853
1854 ix = mdig->PadX();
1855 iy = mdig->PadY();
1856 detElemId = mdig->DetElemId();
1857 charge = (Int_t)mdig->Charge();
1858
1859 seg = AliMpSegmentation::Instance()->GetMpSegmentation(detElemId, AliMp::GetCathodType(cathode));
168e9c4d 1860 pad = seg->PadByIndices(ix,iy,kTRUE);
1861
8b067dfe 1862 printf("Digit: detElemId %4d cath %1d ix %2d iy %3d charge %1d \n",detElemId,cathode,ix,iy,charge);
1863
1864 }
1865
1866 }
1867
1868}
1869
1870//__________________________________________________________________________
1871void AliMUONTriggerGUI::CreateTriggerStore()
1872{
1873 /// Process the DSET digit store and fill the trigger store
1874
1875 if (fDigitStore->GetSize() == 0) {
1876 printf("The digit store is empty...\n");
1877 return;
1878 }
1879 fTStoreOn = kTRUE;
1880
1881 AliMUONVDigitStore *digitStore = static_cast<AliMUONVDigitStore*>(fDigitStore);
1882
1883 fTriggerProcessor->Digits2Trigger(*digitStore,*fTriggerStore);
1884
1885}
1886
1887//__________________________________________________________________________
1888void AliMUONTriggerGUI::PrintTriggerStore() const
1889{
1890 /// Print the trigger output for DSET digits store
1891
1892 if (!fTStoreOn) return;
1893
1894 TIter next(fTriggerStore->CreateLocalIterator());
1895
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()) ) )
1900 {
1901 loCircuit = mlt->LoCircuit();
1902
1903 AliMUONLocalTriggerBoard* ltb = fCrateManager->LocalBoard(loCircuit);
1904 x2d = ltb->GetSwitch(0);
1905 x2m = ltb->GetSwitch(1);
1906 x2u = ltb->GetSwitch(2);
1907
1908 loStripX = mlt->LoStripX();
1909 loStripY = mlt->LoStripY();
1910 loDev = mlt->LoDev();
1911 loLpt = mlt->LoLpt();
1912 loHpt = mlt->LoHpt();
1913
1914 iStripX = loStripX/2;
1915 if ((x2u == 1 || x2m == 1 || x2d == 1) && x2m == 1) {
1916 iStripY = loStripY/2;
1917 } else {
1918 iStripY = loStripY;
1919 }
1920
1921 printf("Circ %3d Xs %2d Ys %2d Dev %2d Lpt %1d Hpt %1d \n",loCircuit,loStripX,loStripY,loDev,loLpt,loHpt);
1922
1923 AliMUONGlobalTrigger *globalTrigger = fTriggerStore->Global();
1924 globalTrigger->Print();
1925
1926 }
1927
1928}
1929
1930//__________________________________________________________________________
1931void AliMUONTriggerGUI::WriteTriggerRawData()
1932{
1933 /// Write raw data (DATE and ROOT) for the trigger store from
1934 /// the DSET digit store
1935
1936 if (!fTStoreOn) {
1937 printf("The trigger store is empty... \n");
1938 return;
1939 }
1940
1941 // raw data (ddl)
1942
1943 AliMUONRawWriter *rawWriter = new AliMUONRawWriter();
1944 AliRawDataHeaderSim header;
1945 rawWriter->SetHeader(header);
1946 rawWriter->Digits2Raw(0,fTriggerStore);
1947
1948 delete rawWriter;
1949
1950 // raw data (ddl) to date
1951 // AliSimulation::ConvertRawFilesToDate
1952
1953 char command[256];
1954 char dateFileName[256];
290882e9 1955 snprintf(dateFileName,256,"TriggerGUI.date");
1956 snprintf(command, 256,"dateStream -c -s -D -o %s -# %d -C -run %d",
8b067dfe 1957 dateFileName, 1, 0);
1958 FILE* pipe = gSystem->OpenPipe(command, "w");
1959
1960 UInt_t detectorPattern = 0;
1961 fprintf(pipe, "GDC DetectorPattern %u\n", detectorPattern);
1962 Float_t ldc = 0;
1963 Int_t prevLDC = -1;
1964
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++) {
1968
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);
1972
1973 char rawFileName[256];
290882e9 1974 snprintf(rawFileName, 256,"%s",AliDAQ::DdlFileName(iDet,iDDL));
8b067dfe 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);
1980 fclose(file);
1981 if (!size) continue;
1982
1983 if (ldcID != prevLDC) {
1984 fprintf(pipe, " LDC Id %d\n", ldcID);
1985 prevLDC = ldcID;
1986 }
1987 fprintf(pipe, " Equipment Id %d Payload %s\n", ddlID, rawFileName);
1988 }
1989 }
1990 Int_t result = gSystem->ClosePipe(pipe);
1991
1992 // raw data (date) to root
1993 // AliSimulation::ConvertDateToRoot
1994
1995 char rootFileName[256];
290882e9 1996 snprintf(rootFileName,256,"TriggerGUI.root");
8b067dfe 1997
1998 // ALIMDC setup
1999 const Int_t kDBSize = 2000000000;
2000 const Int_t kTagDBSize = 1000000000;
2001 const Bool_t kFilter = kFALSE;
2002 const Int_t kCompression = 1;
2003
2004 char* path = gSystem->Which(gSystem->Getenv("PATH"), "alimdc");
2005 if (!path) {
2006 printf("the program alimdc was not found\n");
2007 return;
2008 } else {
2009 delete[] path;
2010 }
2011
2012 printf("converting DATE file %s to root file %s \n",
2013 dateFileName, rootFileName);
2014
2015 const char* rawDBFS[2] = { "/tmp/mdc1", "/tmp/mdc2" };
2016 const char* tagDBFS = "/tmp/mdc1/tags";
2017
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");
2025
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));
2029
2030 gSystem->Exec(Form("mkdir %s",rawDBFS[0]));
2031 gSystem->Exec(Form("mkdir %s",rawDBFS[1]));
2032 gSystem->Exec(Form("mkdir %s",tagDBFS));
2033
2034 result = gSystem->Exec(Form("alimdc %d %d %d %d %s",
2035 kDBSize, kTagDBSize, kFilter, kCompression,
2036 dateFileName));
2037 gSystem->Exec(Form("mv %s/*.root %s", rawDBFS[0], rootFileName));
2038
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));
2042
2043}
2044
2045//__________________________________________________________________________
2046void AliMUONTriggerGUI::FETboard(Int_t ib, Int_t amp)
2047{
2048 /// Front End test set all strips for board with index "ib"
2049 /// AliMUONTriggerGUIbdmap::DoDigits()
2050
2051 AliMUONTriggerGUIboard *board;
2052 AliMUONTriggerGUIboard *btmp;
2053 Int_t pos, over, number, nStripX, nStripY;
2054
2055 board = (AliMUONTriggerGUIboard*)fBoards->At(ib);
2056 if (board == 0) return;
2057
2058 nStripX = board->GetXSiy2() - board->GetXSiy1() + 1;
2059 nStripY = board->GetYSix2() - board->GetYSix1() + 1;
2060
2061 number = board->GetNumber();
2062 pos = board->GetPosition();
2063 over = board->GetYOver();
2064
2065 for (Int_t imt = 0; imt < kNMT; imt++) {
2066
2067 for (Int_t ix = 0; ix < nStripX; ix++) {
2068 board->SetDigitX(imt,ix,amp);
2069 }
2070
2071 for (Int_t iy = 0; iy < nStripY; iy++) {
2072 board->SetDigitY(imt,iy,amp);
2073
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);
2079 }
2080
2081 }
2082
2083 }
2084
2085}
2086
2087//__________________________________________________________________________
2088void AliMUONTriggerGUI::FET(Int_t onoff)
2089{
2090 /// Front End test set all strips for all boards
2091 /// AliMUONTriggerGUIbdmap::DoDigits()
2092
2093 Int_t amp = onoff;
2094
2095 for (Int_t ib = 0; ib < kNBoards; ib++) {
2096 FETboard(ib,amp);
2097 }
2098
2099}
2100
2101//__________________________________________________________________________
2102void AliMUONTriggerGUI::ClearDigitStore()
2103{
2104 /// Clear the DSET digit store
2105
2106 fDigitStore->Clear();
2107
2108}
2109
2110//__________________________________________________________________________
2111void AliMUONTriggerGUI::ClearTriggerStore()
2112{
2113 /// Clear the trigger store from the DSET digit store
2114
2115 fTriggerStore->Clear();
2116 fTStoreOn = kFALSE;
2117
2118}