]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONTriggerGUI.cxx
correct mask for V0 charge decoding in STU payload
[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
905654c2 280//__________________________________________________________________________
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
8b067dfe 874//__________________________________________________________________________
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
905654c2 892//__________________________________________________________________________
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
8b067dfe 1257//__________________________________________________________________________
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
905654c2 1317//__________________________________________________________________________
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];
1457
1458 AliMpDEIterator it;
1459 Int_t boardId = -1;
1460 Int_t manuIdPrev, ich, idet, boardIdTmp = -1;
1461 for (Int_t chamber = 0; chamber < kNMT; chamber++) {
1462 for ( it.First(); ! it.IsDone(); it.Next() ) {
1463
1464 if (it.CurrentDEId()/100 < 11) continue;
1465
1466 ich = it.CurrentDEId()/100 - 11;
1467 if (ich != chamber) continue;
1468 idet = it.CurrentDEId()%100;
1469
1470 const AliMpVSegmentation* seg0 = AliMpSegmentation::Instance()->GetMpSegmentation(it.CurrentDEId(), AliMp::kCath0);
1471 const AliMpVSegmentation* seg1 = AliMpSegmentation::Instance()->GetMpSegmentation(it.CurrentDEId(), AliMp::kCath1);
1472
1473 // x-strips
1474 manuIdPrev = 0;
8b067dfe 1475 for (Int_t ix = 0; ix <= seg0->MaxPadIndexX(); ix++) {
1476 for (Int_t iy = 0; iy <= seg0->MaxPadIndexY(); iy++) {
168e9c4d 1477 AliMpPad pad = seg0->PadByIndices(ix,iy,kFALSE);
8b067dfe 1478 if (pad.IsValid()) {
168e9c4d 1479 Int_t manuId = pad.GetLocalBoardId(0);
8b067dfe 1480 if (manuId != manuIdPrev) {
1481 AliMpLocalBoard *mpboard = AliMpDDLStore::Instance()->GetLocalBoard(manuId);
1482 manuIdPrev = manuId;
1483 if (ich == 0) {
1484 boardId++;
1485 } else {
1486 boardId = cIdtobId[manuId];
1487 }
1488 board = GetBoard(boardId);
1489 if (board->GetNumber() == -1)
1490 board->SetNumber(boardId);
1491 if (board->GetDetElemId() == -1)
1492 board->SetDetElemId(idet);
1493 if (!strcmp(board->GetBoardName(),""))
1494 board->SetBoardName(mpboard->GetName());
1495 cIdtobId[manuId] = boardId;
1496 }
1497 GetBoard(boardId)->AddPadX(pad,ich);
1498 }
1499 }
1500 } // end plane 0 (x-strips)
1501
1502 // y-strips
1503 manuIdPrev = 0;
8b067dfe 1504 for (Int_t ix = 0; ix <= seg1->MaxPadIndexX(); ix++) {
1505 for (Int_t iy = 0; iy <= seg1->MaxPadIndexY(); iy++) {
168e9c4d 1506 AliMpPad pad = seg1->PadByIndices(ix,iy,kFALSE);
8b067dfe 1507 if (pad.IsValid()) {
1508 Int_t nloc = pad.GetNofLocations();
1509 for (Int_t iloc = 0; iloc < nloc; iloc++) {
168e9c4d 1510 Int_t manuId = pad.GetLocalBoardId(iloc);
8b067dfe 1511 if (manuId != manuIdPrev) {
1512 manuIdPrev = manuId;
1513 boardIdTmp = cIdtobId[manuId];
1514 }
1515 GetBoard(boardIdTmp)->AddPadY(pad,ich);
1516 }
1517 }
1518 }
1519 } // end plane 1 (y-strips)
1520
1521 } // end det elem loop
1522 } // end chamber loop
1523
1524 for (Int_t ib = 0; ib < kNBoards; ib++) {
1525 board = GetBoard(ib);
1526 board->MakeGeometry();
1527 AliMUONLocalTriggerBoard* b = fCrateManager->LocalBoard(board->GetIdCircuit());
1528 board->SetCrateName((b->GetCrate()).Data());
1529 }
1530
1531 // create the sensitive map
1532
905654c2 1533 Int_t nPixelX = 700;
1534 Int_t nPixelY = 676;
1535
1536 Int_t nPixelBorderX = 40; // to guess...
1537 Int_t nPixelBorderY = 40; // to guess...
1538
8b067dfe 1539 // boards limits
905654c2 1540 Float_t boardsX = 2*257.00; // cm
1541 Float_t boardsY = 2*306.61; // cm
1542
905654c2 1543 UShort_t status = 1;
8b067dfe 1544 Float_t xc, yc, xw, yw;
1545 Char_t text[256];
905654c2 1546 Int_t x, y;
1547 UInt_t w, h;
1548 Int_t xp[5];
1549 Int_t yp[5];
905654c2 1550
1551 TGRegion *reg;
905654c2 1552
8b067dfe 1553 // regions for the image map (from MT11)
905654c2 1554
1555 for (Int_t ib = 0; ib < kNBoards; ib++) {
1556
8b067dfe 1557 board = GetBoard(ib);
905654c2 1558
1559 status = 1;
1560 board->SetStatus(status);
1561
8b067dfe 1562 xc = board->GetXCenter(0);
1563 yc = board->GetYCenter(0);
1564 xw = board->GetXWidth(0);
1565 yw = board->GetYWidth(0);
905654c2 1566
1567 x = (Int_t)(nPixelX/2 + xc * (nPixelX - 2*nPixelBorderX)/boardsX);
1568 y = (Int_t)(nPixelY/2 - yc * (nPixelY - 2*nPixelBorderY)/boardsY);
1569
1570 if (x < 0) x = 0;
1571 if (y < 0) y = 0;
1572
8b067dfe 1573 w = (UInt_t)(xw*(nPixelX-2*nPixelBorderX)/boardsX);
1574 h = (UInt_t)(yw*(nPixelY-2*nPixelBorderY)/boardsY);
905654c2 1575
1576 xp[0] = x-w/2;
1577 xp[1] = x+w/2;
1578 xp[2] = x+w/2;
1579 xp[3] = x-w/2;
1580 xp[4] = x-w/2;
1581
1582 yp[0] = y-h/2;
1583 yp[1] = y-h/2;
1584 yp[2] = y+h/2;
1585 yp[3] = y+h/2;
1586 yp[4] = y-h/2;
1587
1588 reg = new TGRegion(5,xp,yp);
1589 fImageMap->AddRegion(*reg, ib);
1590
b785c4bd 1591 snprintf(text,256,"%s (crate %s circuit %3d, number %3d)",board->GetBoardName(),board->GetCrateName(),board->GetIdCircuit(),board->GetNumber());
905654c2 1592 fImageMap->SetToolTipText(ib, text);
905654c2 1593
8b067dfe 1594 // Set coordinates of strips boxes
905654c2 1595
8b067dfe 1596 SetStripBoxes(board);
905654c2 1597
8b067dfe 1598 //board->PrintBoard();
905654c2 1599
1600 }
1601
905654c2 1602}
1603
1604//__________________________________________________________________________
1605void AliMUONTriggerGUI::SetStripBoxes(AliMUONTriggerGUIboard *board)
1606{
1607 /// set coordinates of strip boxes
1608
8b067dfe 1609 AliMUONGeometryTransformer transformer;
1610 transformer.LoadGeometryData("transform.dat");
905654c2 1611
1612 const AliMpVSegmentation* seg;
1613 AliMpPad pad;
1614 AliMpDEIterator it;
1615
8b067dfe 1616 Int_t chamber, detElemId, maxX, maxY;
905654c2 1617 Float_t xpmin, xpmax, ypmin, ypmax;
1618 Float_t xg1, xg2, yg1, yg2, zg1;
1619 Float_t xlocal1, xlocal2, ylocal1, ylocal2;
1620 Float_t xCenter, yCenter, xWidth, yWidth;
1621
1622 for (Int_t i = 0; i < kNMT; i++) {
1623
1624 chamber = 11+i;
1625
1626 xCenter = board->GetXCenter(i);
1627 yCenter = board->GetYCenter(i);
1628 xWidth = board->GetXWidth(i);
1629 yWidth = board->GetYWidth(i);
1630
1631 for ( it.First(chamber-1); ! it.IsDone(); it.Next() ) {
1632
1633 detElemId = it.CurrentDEId();
1634
1635 if (detElemId%100 != board->GetDetElemId()) continue;
1636
8b067dfe 1637 /*---------- y-pads cath = 1 ----------*/
905654c2 1638
8b067dfe 1639 seg = AliMpSegmentation::Instance()->GetMpSegmentation(detElemId, AliMp::kCath1);
905654c2 1640
1641 maxX = seg->MaxPadIndexX();
1642 maxY = seg->MaxPadIndexY();
1643
1644 for (Int_t ix = 0; ix <= maxX; ix++) {
1645 for (Int_t iy = 0; iy <= maxY; iy++) {
1646
168e9c4d 1647 pad = seg->PadByIndices(ix,iy,kFALSE);
905654c2 1648
1649 if (!pad.IsValid()) continue;
1650
1651 // get the pad position and dimensions
6e97fbb8 1652 xlocal1 = pad.GetPositionX();
1653 ylocal1 = pad.GetPositionY();
1654 xlocal2 = pad.GetDimensionX();
1655 ylocal2 = pad.GetDimensionY();
905654c2 1656
8b067dfe 1657 transformer.Local2Global(detElemId, xlocal1, ylocal1, 0, xg1, yg1, zg1);
905654c2 1658 // (no transformation for pad dimensions)
1659 xg2 = xlocal2;
1660 yg2 = ylocal2;
1661
1662 // transform in the monitor coordinate system
905654c2 1663 // ALICE SC
1664 xpmin = +(xg1-xg2);
1665 xpmax = +(xg1+xg2);
1666 ypmin = -(yg2-yg1);
1667 ypmax = +(yg2+yg1);
1668
1669 xpmin -= xCenter;
1670 xpmax -= xCenter;
1671 ypmin -= yCenter;
1672 ypmax -= yCenter;
1673
1674 Int_t iX1, iX2, iY, ixDig;
1675 iX1 = board->GetYSix1();
1676 iX2 = board->GetYSix2();
1677 iY = board->GetYSiy();
1678 if (ix >= iX1 && ix <= iX2 && iy == iY) {
1679
1680 ypmin = -0.5*yWidth;
1681 ypmax = +0.5*yWidth;
1682
1683 ixDig = ix - iX1;
1684
1685 board->SetYDigBox(i,ixDig,(Double_t)xpmin,(Double_t)ypmin,
1686 (Double_t)xpmax,(Double_t)ypmax);
1687
1688 }
1689
1690 } // end maxY
1691 } // end maxX
1692
8b067dfe 1693 /*---------- x-pads cath = 0 ----------*/
905654c2 1694
8b067dfe 1695 seg = AliMpSegmentation::Instance()->GetMpSegmentation(detElemId, AliMp::kCath0);
905654c2 1696
1697 maxX = seg->MaxPadIndexX();
1698 maxY = seg->MaxPadIndexY();
1699
1700 for (Int_t ix = 0; ix <= maxX; ix++) {
1701 for (Int_t iy = 0; iy <= maxY; iy++) {
1702
168e9c4d 1703 pad = seg->PadByIndices(ix,iy,kFALSE);
905654c2 1704
1705 if (!pad.IsValid()) continue;
1706
1707 // get the pad position and dimensions
6e97fbb8 1708 xlocal1 = pad.GetPositionX();
1709 ylocal1 = pad.GetPositionY();
1710 xlocal2 = pad.GetDimensionX();
1711 ylocal2 = pad.GetDimensionY();
905654c2 1712
8b067dfe 1713 transformer.Local2Global(detElemId, xlocal1, ylocal1, 0, xg1, yg1, zg1);
905654c2 1714 // (no transformation for pad dimensions)
1715 xg2 = xlocal2;
1716 yg2 = ylocal2;
1717
1718 // transform in the monitor coordinate system
905654c2 1719 // ALICE SC
1720 xpmin = +(xg1+xg2);
1721 xpmax = +(xg1-xg2);
1722 ypmin = -(yg2-yg1);
1723 ypmax = +(yg2+yg1);
1724
1725 xpmin -= xCenter;
1726 xpmax -= xCenter;
1727 ypmin -= yCenter;
1728 ypmax -= yCenter;
1729
1730 Int_t iX, iY1, iY2, iyDig;
1731 iX = board->GetXSix();
1732 iY1 = board->GetXSiy1();
1733 iY2 = board->GetXSiy2();
1734 if (ix == iX && iy >= iY1 && iy <= iY2) {
1735
1736 iyDig = iy - iY1;
1737
1738 board->SetXDigBox(i,iyDig,(Double_t)xpmin,(Double_t)ypmin,
1739 (Double_t)xpmax,(Double_t)ypmax);
1740
1741 }
1742
1743 } // end maxY
1744 } // end maxX
1745
1746 } // end detElemId
1747
1748 } // end kNMT loop
1749
1750}
1751
8b067dfe 1752//__________________________________________________________________________
1753void AliMUONTriggerGUI::CreateDigitStore()
1754{
1755 /// create memory resident digits store with set strips
1756
1757 Int_t nstripX, nstripY, detElemId, charge, ix, iy, iX1, iY1;
1758 Int_t cathode, maxX, maxY;
1759 Int_t manuId, manuChannel;
1760 const AliMpVSegmentation* seg;
1761 AliMpPad pad;
1762 AliMUONTriggerGUIboard* board;
1763 AliMUONVDigit *dig;
1764
1765 for (Int_t ib = 0; ib < kNBoards; ib++) {
1766
1767 board = (AliMUONTriggerGUIboard*)fBoards->At(ib);
1768 if (board == 0) continue;
1769
1770 nstripX = board->GetNStripX();
1771 nstripY = board->GetNStripY();
1772 for (Int_t ichamber = 11; ichamber <= 14; ichamber++) {
1773
1774 detElemId = ichamber * 100 + board->GetDetElemId();
1775 // x strips
1776 cathode = 0;
1777 for (Int_t isx = 0; isx < nstripX; isx++) {
1778
1779 charge = (Int_t)board->GetXDig(ichamber-11,isx);
1780 if (charge == 0) continue;
1781 ix = board->GetXSix();
1782 iY1 = board->GetXSiy1();
1783 iy = isx + iY1;
1784 seg = AliMpSegmentation::Instance()->GetMpSegmentation(detElemId, AliMp::GetCathodType(cathode));
1785 maxX = seg->MaxPadIndexX();
1786 maxY = seg->MaxPadIndexY();
1787 if (ix > maxX) printf("Index x > maximum!\n");
1788 if (iy > maxY) printf("Index y > maximum!\n");
168e9c4d 1789 pad = seg->PadByIndices(ix,iy,kTRUE);
1790 manuId = pad.GetLocalBoardId(0);
1791 manuChannel = pad.GetLocalBoardChannel(0);
8b067dfe 1792
1793 dig = fDigitStore->Add(detElemId,manuId,manuChannel,cathode,AliMUONVDigitStore::kAllow);
1794 dig->SetCharge(charge);
1795 dig->SetPadXY(ix,iy);
1796 //printf("Cathode 0: ix %3d iy %3d manuId %3d manuChannel %3d \n",ix,iy,manuId,manuChannel);
1797
1798 } // end x strips
1799
1800 // y strips
1801 cathode = 1;
1802 for (Int_t isy = 0; isy < nstripY; isy++) {
1803
1804 charge = board->GetYDig(ichamber-11,isy);
1805 if (charge == 0) continue;
1806 iX1 = board->GetYSix1();
1807 ix = isy + iX1;
1808 iy = board->GetYSiy();
1809 seg = AliMpSegmentation::Instance()->GetMpSegmentation(detElemId, AliMp::GetCathodType(cathode));
1810 maxX = seg->MaxPadIndexX();
1811 maxY = seg->MaxPadIndexY();
1812 if (ix > maxX) printf("Index x > maximum!\n");
1813 if (iy > maxY) printf("Index y > maximum!\n");
168e9c4d 1814 pad = seg->PadByIndices(ix,iy,kTRUE);
1815 manuId = pad.GetLocalBoardId(0);
1816 manuChannel = pad.GetLocalBoardChannel(0);
8b067dfe 1817
1818 dig = fDigitStore->Add(detElemId,manuId,manuChannel,cathode,AliMUONVDigitStore::kAllow);
1819 dig->SetCharge(charge);
1820 dig->SetPadXY(ix,iy);
1821 //printf("Cathode 1: ix %3d iy %3d manuId %3d manuChannel %3d \n",ix,iy,manuId,manuChannel);
1822
1823 } // end y strips
1824
1825 } // end chambers
1826
1827 } // end boards
1828
1829}
1830
1831//__________________________________________________________________________
1832void AliMUONTriggerGUI::PrintDigitStore() const
1833{
1834 /// Print the digits created in the GUI
1835
1836 const AliMpVSegmentation* seg;
1837 AliMpPad pad;
1838 Int_t ix, iy, charge, detElemId, cathode;
1839
1840 Int_t chamber;
1841 for (Int_t i = 0; i < kNMT; i++) {
1842
1843 chamber = 11+i;
1844
168e9c4d 1845 MpPair_t deRange = AliMpDEManager::GetDetElemIdRange(chamber-1);
1846 TIter next(fDigitStore->CreateIterator(AliMp::PairFirst(deRange),AliMp::PairSecond(deRange)));
8b067dfe 1847 AliMUONVDigit *mdig;
1848
1849 while ( ( mdig = static_cast<AliMUONVDigit*>(next())) )
1850 {
1851 cathode = mdig->Cathode();
1852
1853 ix = mdig->PadX();
1854 iy = mdig->PadY();
1855 detElemId = mdig->DetElemId();
1856 charge = (Int_t)mdig->Charge();
1857
1858 seg = AliMpSegmentation::Instance()->GetMpSegmentation(detElemId, AliMp::GetCathodType(cathode));
168e9c4d 1859 pad = seg->PadByIndices(ix,iy,kTRUE);
1860
8b067dfe 1861 printf("Digit: detElemId %4d cath %1d ix %2d iy %3d charge %1d \n",detElemId,cathode,ix,iy,charge);
1862
1863 }
1864
1865 }
1866
1867}
1868
1869//__________________________________________________________________________
1870void AliMUONTriggerGUI::CreateTriggerStore()
1871{
1872 /// Process the DSET digit store and fill the trigger store
1873
1874 if (fDigitStore->GetSize() == 0) {
1875 printf("The digit store is empty...\n");
1876 return;
1877 }
1878 fTStoreOn = kTRUE;
1879
1880 AliMUONVDigitStore *digitStore = static_cast<AliMUONVDigitStore*>(fDigitStore);
1881
1882 fTriggerProcessor->Digits2Trigger(*digitStore,*fTriggerStore);
1883
1884}
1885
1886//__________________________________________________________________________
1887void AliMUONTriggerGUI::PrintTriggerStore() const
1888{
1889 /// Print the trigger output for DSET digits store
1890
1891 if (!fTStoreOn) return;
1892
1893 TIter next(fTriggerStore->CreateLocalIterator());
1894
1895 UShort_t x2m, x2u, x2d;
1896 Int_t loStripX, loStripY, loDev, loCircuit, iStripX, iStripY, loLpt, loHpt;
1897 AliMUONLocalTrigger *mlt;
1898 while ( ( mlt = static_cast<AliMUONLocalTrigger*>(next()) ) )
1899 {
1900 loCircuit = mlt->LoCircuit();
1901
1902 AliMUONLocalTriggerBoard* ltb = fCrateManager->LocalBoard(loCircuit);
1903 x2d = ltb->GetSwitch(0);
1904 x2m = ltb->GetSwitch(1);
1905 x2u = ltb->GetSwitch(2);
1906
1907 loStripX = mlt->LoStripX();
1908 loStripY = mlt->LoStripY();
1909 loDev = mlt->LoDev();
1910 loLpt = mlt->LoLpt();
1911 loHpt = mlt->LoHpt();
1912
1913 iStripX = loStripX/2;
1914 if ((x2u == 1 || x2m == 1 || x2d == 1) && x2m == 1) {
1915 iStripY = loStripY/2;
1916 } else {
1917 iStripY = loStripY;
1918 }
1919
1920 printf("Circ %3d Xs %2d Ys %2d Dev %2d Lpt %1d Hpt %1d \n",loCircuit,loStripX,loStripY,loDev,loLpt,loHpt);
1921
1922 AliMUONGlobalTrigger *globalTrigger = fTriggerStore->Global();
1923 globalTrigger->Print();
1924
1925 }
1926
1927}
1928
1929//__________________________________________________________________________
1930void AliMUONTriggerGUI::WriteTriggerRawData()
1931{
1932 /// Write raw data (DATE and ROOT) for the trigger store from
1933 /// the DSET digit store
1934
1935 if (!fTStoreOn) {
1936 printf("The trigger store is empty... \n");
1937 return;
1938 }
1939
1940 // raw data (ddl)
1941
1942 AliMUONRawWriter *rawWriter = new AliMUONRawWriter();
1943 AliRawDataHeaderSim header;
1944 rawWriter->SetHeader(header);
1945 rawWriter->Digits2Raw(0,fTriggerStore);
1946
1947 delete rawWriter;
1948
1949 // raw data (ddl) to date
1950 // AliSimulation::ConvertRawFilesToDate
1951
1952 char command[256];
1953 char dateFileName[256];
290882e9 1954 snprintf(dateFileName,256,"TriggerGUI.date");
1955 snprintf(command, 256,"dateStream -c -s -D -o %s -# %d -C -run %d",
8b067dfe 1956 dateFileName, 1, 0);
1957 FILE* pipe = gSystem->OpenPipe(command, "w");
1958
1959 UInt_t detectorPattern = 0;
1960 fprintf(pipe, "GDC DetectorPattern %u\n", detectorPattern);
1961 Float_t ldc = 0;
1962 Int_t prevLDC = -1;
1963
1964 // loop over detectors and DDLs
1965 for (Int_t iDet = 0; iDet < AliDAQ::kNDetectors; iDet++) {
1966 for (Int_t iDDL = 0; iDDL < AliDAQ::NumberOfDdls(iDet); iDDL++) {
1967
1968 Int_t ddlID = AliDAQ::DdlID(iDet,iDDL);
1969 Int_t ldcID = Int_t(ldc + 0.0001);
1970 ldc += AliDAQ::NumberOfLdcs(iDet) / AliDAQ::NumberOfDdls(iDet);
1971
1972 char rawFileName[256];
290882e9 1973 snprintf(rawFileName, 256,"%s",AliDAQ::DdlFileName(iDet,iDDL));
8b067dfe 1974 // check existence and size of raw data file
1975 FILE* file = fopen(rawFileName, "rb");
1976 if (!file) continue;
1977 fseek(file, 0, SEEK_END);
1978 unsigned long size = ftell(file);
1979 fclose(file);
1980 if (!size) continue;
1981
1982 if (ldcID != prevLDC) {
1983 fprintf(pipe, " LDC Id %d\n", ldcID);
1984 prevLDC = ldcID;
1985 }
1986 fprintf(pipe, " Equipment Id %d Payload %s\n", ddlID, rawFileName);
1987 }
1988 }
1989 Int_t result = gSystem->ClosePipe(pipe);
1990
1991 // raw data (date) to root
1992 // AliSimulation::ConvertDateToRoot
1993
1994 char rootFileName[256];
290882e9 1995 snprintf(rootFileName,256,"TriggerGUI.root");
8b067dfe 1996
1997 // ALIMDC setup
1998 const Int_t kDBSize = 2000000000;
1999 const Int_t kTagDBSize = 1000000000;
2000 const Bool_t kFilter = kFALSE;
2001 const Int_t kCompression = 1;
2002
2003 char* path = gSystem->Which(gSystem->Getenv("PATH"), "alimdc");
2004 if (!path) {
2005 printf("the program alimdc was not found\n");
2006 return;
2007 } else {
2008 delete[] path;
2009 }
2010
2011 printf("converting DATE file %s to root file %s \n",
2012 dateFileName, rootFileName);
2013
2014 const char* rawDBFS[2] = { "/tmp/mdc1", "/tmp/mdc2" };
2015 const char* tagDBFS = "/tmp/mdc1/tags";
2016
2017 // User defined file system locations
2018 if (gSystem->Getenv("ALIMDC_RAWDB1"))
2019 rawDBFS[0] = gSystem->Getenv("ALIMDC_RAWDB1");
2020 if (gSystem->Getenv("ALIMDC_RAWDB2"))
2021 rawDBFS[1] = gSystem->Getenv("ALIMDC_RAWDB2");
2022 if (gSystem->Getenv("ALIMDC_TAGDB"))
2023 tagDBFS = gSystem->Getenv("ALIMDC_TAGDB");
2024
2025 gSystem->Exec(Form("rm -rf %s",rawDBFS[0]));
2026 gSystem->Exec(Form("rm -rf %s",rawDBFS[1]));
2027 gSystem->Exec(Form("rm -rf %s",tagDBFS));
2028
2029 gSystem->Exec(Form("mkdir %s",rawDBFS[0]));
2030 gSystem->Exec(Form("mkdir %s",rawDBFS[1]));
2031 gSystem->Exec(Form("mkdir %s",tagDBFS));
2032
2033 result = gSystem->Exec(Form("alimdc %d %d %d %d %s",
2034 kDBSize, kTagDBSize, kFilter, kCompression,
2035 dateFileName));
2036 gSystem->Exec(Form("mv %s/*.root %s", rawDBFS[0], rootFileName));
2037
2038 gSystem->Exec(Form("rm -rf %s",rawDBFS[0]));
2039 gSystem->Exec(Form("rm -rf %s",rawDBFS[1]));
2040 gSystem->Exec(Form("rm -rf %s",tagDBFS));
2041
2042}
2043
2044//__________________________________________________________________________
2045void AliMUONTriggerGUI::FETboard(Int_t ib, Int_t amp)
2046{
2047 /// Front End test set all strips for board with index "ib"
2048 /// AliMUONTriggerGUIbdmap::DoDigits()
2049
2050 AliMUONTriggerGUIboard *board;
2051 AliMUONTriggerGUIboard *btmp;
2052 Int_t pos, over, number, nStripX, nStripY;
2053
2054 board = (AliMUONTriggerGUIboard*)fBoards->At(ib);
2055 if (board == 0) return;
2056
2057 nStripX = board->GetXSiy2() - board->GetXSiy1() + 1;
2058 nStripY = board->GetYSix2() - board->GetYSix1() + 1;
2059
2060 number = board->GetNumber();
2061 pos = board->GetPosition();
2062 over = board->GetYOver();
2063
2064 for (Int_t imt = 0; imt < kNMT; imt++) {
2065
2066 for (Int_t ix = 0; ix < nStripX; ix++) {
2067 board->SetDigitX(imt,ix,amp);
2068 }
2069
2070 for (Int_t iy = 0; iy < nStripY; iy++) {
2071 board->SetDigitY(imt,iy,amp);
2072
2073 // extended y-strips
2074 for (Int_t io = 1; io <= over; io++) {
2075 if (io == pos) continue;
2076 btmp = (AliMUONTriggerGUIboard*)fBoards->UncheckedAt(number+io-pos);
2077 btmp->SetDigitY(imt,iy,amp);
2078 }
2079
2080 }
2081
2082 }
2083
2084}
2085
2086//__________________________________________________________________________
2087void AliMUONTriggerGUI::FET(Int_t onoff)
2088{
2089 /// Front End test set all strips for all boards
2090 /// AliMUONTriggerGUIbdmap::DoDigits()
2091
2092 Int_t amp = onoff;
2093
2094 for (Int_t ib = 0; ib < kNBoards; ib++) {
2095 FETboard(ib,amp);
2096 }
2097
2098}
2099
2100//__________________________________________________________________________
2101void AliMUONTriggerGUI::ClearDigitStore()
2102{
2103 /// Clear the DSET digit store
2104
2105 fDigitStore->Clear();
2106
2107}
2108
2109//__________________________________________________________________________
2110void AliMUONTriggerGUI::ClearTriggerStore()
2111{
2112 /// Clear the trigger store from the DSET digit store
2113
2114 fTriggerStore->Clear();
2115 fTStoreOn = kFALSE;
2116
2117}