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