pxar
 All Classes Namespaces Functions Variables Typedefs Friends
PixGui.cc
1 #include "PixGui.hh"
2 
3 #include <TSystem.h>
4 
5 #include "log.h"
6 
7 #include <TGComboBox.h>
8 #include "PixTab.hh"
9 #include "PixParTab.hh"
10 #include "PixTestFactory.hh"
11 #include "PixUserTestFactory.hh"
12 #include "PixUtil.hh"
13 
14 #include "ConfigParameters.hh"
15 #include "PixTest.hh"
16 #include "PixTestParameters.hh"
17 #include "PixSetup.hh"
18 #include "PixMonitorFrame.hh"
19 
20 #include "dictionaries.h"
21 
22 using namespace std;
23 using namespace pxar;
24 
25 ClassImp(PixGui)
26 
27 // ----------------------------------------------------------------------
28 PixGui::PixGui( const TGWindow *p, UInt_t w, UInt_t h, PixSetup *setup) :
29 TGMainFrame(p, 1, 1, kVerticalFrame), fWidth(w), fHeight(h) {
30 
31  fBorderN = 2;
32  fBorderL = 10;
33  fBorderT = 1;
34 
35  SetWindowName("pXar");
36 
37  fOldDirectory = "nada";
38 
39  gClient->GetColorByName("red", fRed);
40  gClient->GetColorByName("green", fGreen);
41  gClient->GetColorByName("yellow", fYellow);
42  gClient->GetColorByName("white", fWhite);
43  gClient->GetColorByName("DarkSeaGreen", fDarkSeaGreen);
44  gClient->GetColorByName("DarkOrange", fDarkOrange);
45  gClient->GetColorByName("DarkGray", fDarkGray);
46  gClient->GetColorByName("DarkSalmon", fDarkSalmon);
47 
48  fPixSetup = setup;
49  fApi = fPixSetup->getApi();
50  fConfigParameters = fPixSetup->getConfigParameters();
51  fTestParameters = fPixSetup->getPixTestParameters();
52 
53  fPower = true;
54  if (fConfigParameters->getHvOn()) {
55  fHV = true;
56  } else {
57  fHV = false;
58  }
59 
60  // -- create the main frames: fH1 for top stuff and fH2 for tabs
61  fH1 = new TGHorizontalFrame(this, fWidth, static_cast<int>(fHeight*0.2), kFixedHeight);
62  fH2 = new TGHorizontalFrame(this, fWidth, static_cast<int>(fHeight*0.8), kFixedHeight);
63 
64  TGVerticalFrame *h1v1 = new TGVerticalFrame(fH1);
65  TGVerticalFrame *h1v2 = new TGVerticalFrame(fH1);
66  TGVerticalFrame *h1v3 = new TGVerticalFrame(fH1);
67 
68  // ---------------
69  // -- left frame
70  // ---------------
71  TGGroupFrame *pStuff = new TGGroupFrame(h1v1, "lost in space");
72  h1v1->AddFrame(pStuff);
73  pStuff->SetWidth(500);
74  TGVerticalFrame *FpStuff = new TGVerticalFrame(pStuff);
75  pStuff->AddFrame(FpStuff);
76 
77 
78 
79  // ---------------
80  // -- middle frame
81  // ---------------
82  TGGroupFrame *hwControl = new TGGroupFrame(h1v2, "Hardware control");
83  h1v2->AddFrame(hwControl);
84  TGHorizontalFrame *FhwControl = new TGHorizontalFrame(hwControl);
85  hwControl->AddFrame(FhwControl);
86  TGVerticalFrame *h1v2l = new TGVerticalFrame(FhwControl);
87  FhwControl->AddFrame(h1v2l);
88  TGVerticalFrame *h1v2r = new TGVerticalFrame(FhwControl);
89  FhwControl->AddFrame(h1v2r);
90 
91  // left: power
92  TGHorizontalFrame *powerFrame = new TGHorizontalFrame(h1v2l, 150, 75);
93  h1v2l->AddFrame(powerFrame);
94  powerFrame->SetName("powerFrame");
95  powerFrame->AddFrame(new TGLabel(powerFrame, "Power: "), new TGLayoutHints(kLHintsLeft, fBorderN, fBorderN, fBorderN, fBorderN));
96 
97  fbtnPower = new TGTextButton(powerFrame, "Off", B_POWER);
98  fbtnPower->SetToolTipText(fConfigParameters->getNrocs()>1?"Turn on/off module low voltage":"Turn on/off ROC low voltage");
99  fbtnPower->Resize(70,35);
100  fbtnPower->Connect("Clicked()", "PixGui", this, "handleButtons()");
101  if (fPower) {
102  fbtnPower->ChangeBackground(fGreen);
103  fbtnPower->SetText("On");
104  } else {
105  fbtnPower->ChangeBackground(fRed);
106  fbtnPower->SetText("Off");
107  }
108  powerFrame->AddFrame(fbtnPower, new TGLayoutHints(kLHintsRight, fBorderN, fBorderN, fBorderN, fBorderN));
109 
110  // left: HV
111  TGHorizontalFrame *hvFrame = new TGHorizontalFrame(h1v2l, 150,75);
112  h1v2l->AddFrame(hvFrame);
113  hvFrame->SetName("hvFrame");
114  hvFrame->AddFrame(new TGLabel(hvFrame, "HV: "), new TGLayoutHints(kLHintsLeft, fBorderN, fBorderN, fBorderN, fBorderN));
115 
116  fbtnHV = new TGTextButton(hvFrame, "Off", B_HV);
117  hvFrame->AddFrame(fbtnHV, new TGLayoutHints(kLHintsRight, fBorderN, fBorderN, fBorderN, fBorderN));
118  fbtnHV->SetToolTipText(fConfigParameters->getNrocs()>1?"Turn on/off module bias voltage":"Turn on/off ROC bias voltage");
119  fbtnHV->Resize(70,35);
120  fbtnHV->Connect("Clicked()", "PixGui", this, "handleButtons()");
121  if (fHV) {
122  hvOn();
123  } else {
124  hvOff();
125  }
126 
127  Connect("PixTest", "hvOn()", "PixGui", this, "hvOn()");
128  Connect("PixTest", "hvOff()", "PixGui", this, "hvOff()");
129  Connect("PixTest", "powerOn()", "PixGui", this, "powerOn()");
130  Connect("PixTest", "powerOff()", "PixGui", this, "powerOff()");
131 
132 
133  // Left: h/w monitoring
134  fMonitor = new PixMonitorFrame(h1v2l, this);
135  fTimer = new TTimer(1000);
136  fTimer->Connect("Timeout()", "PixMonitorFrame", fMonitor, "Update()");
137  fTimer->TurnOn();
138 
139 
140  // Right: scope probes
141  TGComboBox *signalBoxA[2];
142  TGComboBox *signalBoxD[2];
143 
144  TGHorizontalFrame *sigFrame(0);
145 
146  sigFrame = new TGHorizontalFrame(h1v2r);
147  h1v2r->AddFrame(sigFrame, new TGLayoutHints(kLHintsTop|kLHintsLeft, fBorderN, fBorderN, fBorderN, fBorderN));
148  sigFrame->AddFrame(new TGLabel(sigFrame, "A1:"), new TGLayoutHints(kLHintsLeft, fBorderN, fBorderN, fBorderN, fBorderN));
149  sigFrame->AddFrame(signalBoxA[0] = new TGComboBox(sigFrame), new TGLayoutHints(kLHintsLeft, fBorderN, fBorderN, fBorderN, fBorderN));
150  signalBoxA[0]->SetName("a1");
151 
152  sigFrame = new TGHorizontalFrame(h1v2r);
153  h1v2r->AddFrame(sigFrame, new TGLayoutHints(kLHintsTop|kLHintsLeft, fBorderN, fBorderN, fBorderN, fBorderN));
154  sigFrame->AddFrame(new TGLabel(sigFrame, "A2:"), new TGLayoutHints(kLHintsLeft, fBorderN, fBorderN, fBorderN, fBorderN));
155  sigFrame->AddFrame(signalBoxA[1] = new TGComboBox(sigFrame), new TGLayoutHints(kLHintsLeft, fBorderN, fBorderN, fBorderN, fBorderN));
156  signalBoxA[1]->SetName("a2");
157 
158  sigFrame = new TGHorizontalFrame(h1v2r);
159  h1v2r->AddFrame(sigFrame, new TGLayoutHints(kLHintsTop|kLHintsLeft, fBorderN, fBorderN, fBorderN, fBorderN));
160  sigFrame->AddFrame(new TGLabel(sigFrame, "D1:"), new TGLayoutHints(kLHintsLeft, fBorderN, fBorderN, fBorderN, fBorderN));
161  sigFrame->AddFrame(signalBoxD[0] = new TGComboBox(sigFrame), new TGLayoutHints(kLHintsLeft, fBorderN, fBorderN, fBorderN, fBorderN));
162  signalBoxD[0]->SetName("d1");
163 
164  sigFrame = new TGHorizontalFrame(h1v2r);
165  h1v2r->AddFrame(sigFrame, new TGLayoutHints(kLHintsTop|kLHintsLeft, fBorderN, fBorderN, fBorderN, fBorderN));
166  sigFrame->AddFrame(new TGLabel(sigFrame, "D2:"), new TGLayoutHints(kLHintsLeft, fBorderN, fBorderN, fBorderN, fBorderN));
167  sigFrame->AddFrame(signalBoxD[1] = new TGComboBox(sigFrame), new TGLayoutHints(kLHintsLeft, fBorderN, fBorderN, fBorderN, fBorderN));
168  signalBoxD[1]->SetName("d2");
169 
170  signalBoxA[0]->SetWidth(75);
171  signalBoxA[0]->SetHeight(20);
172  signalBoxA[1]->SetWidth(75);
173  signalBoxA[1]->SetHeight(20);
174  signalBoxD[0]->SetWidth(75);
175  signalBoxD[0]->SetHeight(20);
176  signalBoxD[1]->SetWidth(75);
177  signalBoxD[1]->SetHeight(20);
178 
179  // Get singleton Probe dictionary object:
180  ProbeDictionary * _dict = ProbeDictionary::getInstance();
181 
182  // Get all analog probes:
183  std::vector<std::string> analogsignals = _dict->getAllAnalogNames();
184  std::vector<std::string> digitalsignals = _dict->getAllDigitalNames();
185 
186  for(std::vector<std::string>::iterator it = analogsignals.begin(); it != analogsignals.end(); it++) {
187  signalBoxA[0]->AddEntry(it->c_str(),_dict->getSignal(*it,PROBE_ANALOG));
188  signalBoxA[1]->AddEntry(it->c_str(),_dict->getSignal(*it,PROBE_ANALOG));
189  }
190 
191  for(std::vector<std::string>::iterator it = digitalsignals.begin(); it != digitalsignals.end(); it++) {
192  signalBoxD[0]->AddEntry(it->c_str(),_dict->getSignal(*it,PROBE_DIGITAL));
193  signalBoxD[1]->AddEntry(it->c_str(),_dict->getSignal(*it,PROBE_DIGITAL));
194  }
195 
196  for(int i = 0 ; i <= 1 ; i++) {
197  signalBoxA[i]->Connect("Selected(Int_t)", "PixGui", this, "selectProbes(Int_t)");
198  signalBoxD[i]->Connect("Selected(Int_t)", "PixGui", this, "selectProbes(Int_t)");
199  }
200 
201  signalBoxA[0]->Select(_dict->getSignal(fConfigParameters->getProbe("a1"),PROBE_ANALOG),false);
202  signalBoxA[1]->Select(_dict->getSignal(fConfigParameters->getProbe("a2"),PROBE_ANALOG),false);
203  signalBoxD[0]->Select(_dict->getSignal(fConfigParameters->getProbe("d1"),PROBE_DIGITAL),false);
204  signalBoxD[1]->Select(_dict->getSignal(fConfigParameters->getProbe("d2"),PROBE_DIGITAL),false);
205 
206 
207 
208  // --------------
209  // -- right frame
210  // --------------
211  TGGroupFrame *pControl = new TGGroupFrame(h1v3, "pXar control");
212  h1v3->AddFrame(pControl);
213  TGVerticalFrame *FpControl = new TGVerticalFrame(pControl);
214  pControl->AddFrame(FpControl);
215 
216  TGHorizontalFrame *bFrame = new TGHorizontalFrame(FpControl);
217  FpControl->AddFrame(bFrame, new TGLayoutHints(kLHintsLeft | kLHintsTop, fBorderN, fBorderN, fBorderN, fBorderN));
218 
219  TGTextButton *exitButton = new TGTextButton(bFrame, "exit", B_EXIT);
220  bFrame->AddFrame(exitButton, new TGLayoutHints(kLHintsBottom | kLHintsRight, fBorderN, fBorderN, fBorderN, fBorderN));
221  exitButton->SetToolTipText("exit pxar,\nwrite rootfile,\ndo *not* write config files");
222  exitButton->ChangeOptions(exitButton->GetOptions() );
223  exitButton->Connect("Clicked()", "PixGui", this, "handleButtons()");
224  exitButton->Resize(70,35);
225  exitButton->ChangeBackground(fRed);
226 
227 
228  TGTextButton *writeButton = new TGTextButton(bFrame, "write cfg files", B_WRITEALLFILES);
229  bFrame->AddFrame(writeButton, new TGLayoutHints(kLHintsBottom | kLHintsLeft, fBorderN, fBorderN, fBorderN, fBorderN));
230  writeButton->SetToolTipText("write all config files (ROC/TBM DAC, trim bits, DTB setup, config file)");
231  writeButton->ChangeOptions(writeButton->GetOptions() );
232  writeButton->Connect("Clicked()", "PixGui", this, "handleButtons()");
233  writeButton->Resize(70,35);
234  writeButton->ChangeBackground(fYellow);
235 
236 
237  TGHorizontalFrame *rootfileFrame = new TGHorizontalFrame(FpControl, 150,75);
238  FpControl->AddFrame(rootfileFrame, new TGLayoutHints(kLHintsTop|kLHintsLeft, fBorderN, fBorderN, fBorderN, fBorderN));
239  rootfileFrame->SetName("rootfileFrame");
240 
241  TGTextButton *rootfileButton = new TGTextButton(rootfileFrame, " Change rootfile ", B_FILENAME);
242  rootfileButton->SetToolTipText("change the rootfile name");
243  rootfileButton->Connect("Clicked()", "PixGui", this, "handleButtons()");
244  rootfileFrame->AddFrame(rootfileButton, new TGLayoutHints(kLHintsLeft, fBorderN, fBorderN, fBorderN, fBorderN));
245 
246  TGTextEntry *output = new TGTextEntry(rootfileFrame, fRootFileNameBuffer = new TGTextBuffer(200), B_FILENAME);
247  output->SetText(fConfigParameters->getRootFileName().c_str());
248  output->MoveResize(100, 60, 120, output->GetDefaultHeight());
249  output->Connect("ReturnPressed()", "PixGui", this, "handleButtons()");
250  rootfileFrame->AddFrame(output, new TGLayoutHints(kLHintsRight, fBorderN, fBorderN, fBorderN, fBorderN));
251 
252 
253 
254  TGHorizontalFrame *dirFrame = new TGHorizontalFrame(FpControl, 150,75);
255  FpControl->AddFrame(dirFrame, new TGLayoutHints(kLHintsTop|kLHintsLeft, fBorderN, fBorderN, fBorderN, fBorderN));
256  dirFrame->SetName("dirFrame");
257 
258  TGTextButton *dirButton = new TGTextButton(dirFrame, " Change directory ", B_DIRECTORY);
259  dirButton->Connect("Clicked()", "PixGui", this, "handleButtons()");
260  dirButton->SetToolTipText("change the output directory; will move the rootfile as well");
261  dirFrame->AddFrame(dirButton, new TGLayoutHints(kLHintsLeft, fBorderN, fBorderN, fBorderN, fBorderN));
262 
263  TGTextEntry *doutput = new TGTextEntry(dirFrame, fDirNameBuffer = new TGTextBuffer(200), B_DIRECTORY);
264  doutput->SetText(fConfigParameters->getDirectory().c_str());
265  doutput->MoveResize(100, 60, 120, output->GetDefaultHeight());
266  doutput->Connect("ReturnPressed()", "PixGui", this, "handleButtons()");
267  dirFrame->AddFrame(doutput, new TGLayoutHints(kLHintsRight, fBorderN, fBorderN, fBorderN, fBorderN));
268 
269 
270  h1v3->SetWidth(fWidth-h1v1->GetWidth()-h1v2->GetWidth());
271 
272 
273 
274  // -- tab widget
275  fTabs = new TGTab(fH2, fH2->GetDefaultWidth(), fH2->GetDefaultHeight());
276  fTabs->SetTab(0);
277  fTabs->Connect("Selected(Int_t)", "PixGui", this, "selectedTab(Int_t)");
278 
279  fH2->AddFrame(fTabs, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, fBorderN, fBorderN, fBorderN, fBorderN));
280 
281  if(fApi) fParTab = new PixParTab(this, fConfigParameters, "h/w");
282  fTabs->SetTab(0);
283 
284  if (fApi) fParTab->updateSelection(); // ensure that fId2Idx for all tests is initialized
285 
286  vector<string> tests = fTestParameters->getTests();
287  for (unsigned int i = 0; i < tests.size(); ++i) {
288  createTab(tests[i].c_str());
289  }
290 
291  fH1->AddFrame(h1v1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY, fBorderN, fBorderN, fBorderN, fBorderN));
292  fH1->AddFrame(h1v2, new TGLayoutHints(kLHintsCenterX , fBorderN, fBorderN, fBorderN, fBorderN));
293  fH1->AddFrame(h1v3, new TGLayoutHints(kLHintsRight | kLHintsExpandX | kLHintsExpandY, fBorderN, fBorderN, fBorderN, fBorderN));
294 
295  AddFrame(fH1, new TGLayoutHints(kLHintsTop | kLHintsExpandX));
296  AddFrame(fH2, new TGLayoutHints(kLHintsBottom | kLHintsExpandY | kLHintsExpandX));
297 
298  MapSubwindows();
299  Resize(GetDefaultSize());
300  MapWindow();
301 
302 }
303 
304 // ----------------------------------------------------------------------
305 PixGui::~PixGui() {
306  LOG(logDEBUG) << "PixGui::destructor";
307  delete fTimer;
308  delete fMonitor;
309  delete fTabs;
310  delete fParTab;
311  delete fRootFileNameBuffer;
312  delete fbtnPower;
313  delete fbtnHV;
314  delete fpowerSlider;
315  delete fhvSlider;
316  delete flblPower;
317  delete flblHV;
318  delete fH1;
319  delete fH2;
320 
321 }
322 
323 
324 // ----------------------------------------------------------------------
325 void PixGui::Cleanup() {
326  fPixSetup->getPixMonitor()->dumpSummaries();
327  gApplication->Terminate(0);
328 }
329 
330 
331 // ----------------------------------------------------------------------
332 void PixGui::CloseWindow() {
333  std::vector<PixTest*>::iterator il;
334  for (il = fTestList.begin(); il != fTestList.end(); ++il) {
335  delete (*il);
336  }
337 
338  if (fTimer) fTimer->TurnOff();
339  if (fApi) delete fApi;
340  fPixSetup->getPixMonitor()->dumpSummaries();
341 
342  // DestroyWindow();
343  gApplication->Terminate(0);
344 
345 }
346 
347 // ----------------------------------------------------------------------
348 void PixGui::selectProbes(Int_t /*id*/) {
349  TGComboBox *box = (TGComboBox *) gTQSender;
350 
351  fApi->SignalProbe(box->GetName(),box->GetSelectedEntry()->GetTitle());
352 
353  // Write the selected probe to the configParameters.
354 
355  fConfigParameters->setProbe(box->GetName(),box->GetSelectedEntry()->GetTitle());
356 
357  // fConfigParameters->writeConfigParameterFile();
358 
359 }
360 
361 // ----------------------------------------------------------------------
362 void PixGui::handleButtons(Int_t id) {
363  if (id == -1) {
364  TGButton *btn = (TGButton *) gTQSender;
365  id = btn->WidgetId();
366  }
367 
368  switch (id) {
369  case B_DIRECTORY: {
370  LOG(logDEBUG) << Form("changing base directory: %s", fDirNameBuffer->GetString());
371  fOldDirectory = fConfigParameters->getDirectory();
372  if (0 == gSystem->OpenDirectory(fDirNameBuffer->GetString())) {
373  LOG(logINFO) << "directory " << fDirNameBuffer->GetString() << " does not exist, creating it";
374  int bla = gSystem->MakeDirectory(fDirNameBuffer->GetString());
375  if (bla < 0) {
376  LOG(logWARNING) << " failed to create directory " << fDirNameBuffer->GetString();
377  break;
378  }
379  }
380 
381  fConfigParameters->setDirectory(fDirNameBuffer->GetString());
382  changeRootFile();
383  break;
384  }
385  case B_FILENAME: {
386  LOG(logINFO) << Form("changing rootfilenme: %s", fRootFileNameBuffer->GetString());
387  changeRootFile();
388  break;
389  }
390  case B_EXIT: {
391  LOG(logDEBUG) << "PixGui::exit called";
392  CloseWindow();
393  break;
394  }
395 
396  case B_WRITEALLFILES: {
397  LOG(logDEBUG) << "PixGui::writeAllFiles called";
398  fConfigParameters->writeAllFiles();
399  break;
400  }
401  case B_POWER: {
402  if(fPower == true) {
403  powerOff();
404  } else {
405  powerOn();
406  }
407  break;
408  }
409  case B_HV: {
410  if(fHV == true) {
411  hvOff();
412  } else {
413  hvOn();
414  }
415  break;
416  }
417  default:
418  break;
419  }
420 }
421 
422 // ----------------------------------------------------------------------
423 void PixGui::powerOn() {
424  if (fApi) {
425  fPower = true;
426  fbtnPower->ChangeBackground(fGreen);
427  fbtnPower->SetText("On");
428  fApi->Pon();
429  LOG(logDEBUG) << "Power set On";
430  }
431 }
432 
433 // ----------------------------------------------------------------------
434 void PixGui::powerOff() {
435  if (fApi) {
436  fPower = false;
437  fbtnPower->ChangeBackground(fRed);
438  fbtnPower->SetText("Off");
439  fApi->Poff();
440  LOG(logDEBUG) << "Power set Off";
441  }
442 }
443 
444 
445 // ----------------------------------------------------------------------
446 void PixGui::hvOn() {
447  if (fApi) {
448  fHV = true;
449  fbtnHV->ChangeBackground(fGreen);
450  fbtnHV->SetText("On");
451  fApi->HVon();
452  LOG(logDEBUG) << "HV set On";
453  }
454 }
455 
456 
457 // ----------------------------------------------------------------------
458 void PixGui::hvOff() {
459  if (fApi) {
460  fHV = false;
461  fbtnHV->ChangeBackground(fRed);
462  fbtnHV->SetText("Off");
463  fApi->HVoff();
464  LOG(logDEBUG) << "HV set Off";
465  }
466 }
467 
468 
469 
470 // // --------------------------------------------------------------------------------
471 // // FIXME needed?
472 // void PixGui::createParTab() {
473 // UInt_t w = 400;
474 // UInt_t h = 400;
475 
476 // fParTab = fTabs->AddTab("hardware parameters");
477 // fParTab->SetLayoutManager(new TGVerticalLayout(fParTab));
478 
479 // // create the TopFrame
480 // fhFrame = new TGHorizontalFrame(fParTab, w, 0.5*h);
481 
482 // }
483 
484 
485 // --------------------------------------------------------------------------------
486 void PixGui::createTab(const char* csel) {
487 
488  PixTest *pt = createTest(string(csel));
489  if (0 == pt) {
490  LOG(logDEBUG) << "ERROR: " << csel << " not known, nothing created";
491  return;
492  }
493 
494  fTestList.push_back(pt);
495  PixTab *t = new PixTab(this, pt, string(csel));
496  fPixTabList.push_back(t);
497  // LOG(logDEBUG) << "added tab " << t << " to fPixTabList, now size() = " << fPixTabList.size();
498 
499  pt->Connect("update()", "PixTab", t, "update()");
500  // fTabs->Resize(fTabs->GetDefaultSize());
501  // fTabs->MoveResize(0, 0, 800, 800);
502  MapSubwindows();
503  Resize(GetDefaultSize());
504  MapWindow();
505  fTabs->SetTab(csel);
506 
507 }
508 
509 
510 // ----------------------------------------------------------------------
511 PixTest* PixGui::createTest(string testname) {
512  PixTestFactory *factory = PixTestFactory::instance();
513  PixUserTestFactory *userfactory = PixUserTestFactory::instance();
514  PixTest *t = factory->createTest(testname, fPixSetup);
515  if (0 == t) t = userfactory->createTest(testname, fPixSetup);
516  return t;
517 }
518 
519 
520 // ----------------------------------------------------------------------
521 void PixGui::selectedTab(int id) {
522  fTabs->SetTab(id);
523  if (0 == id) {
524  fParTab->updateParameters();
525  fPixTab = 0;
526  return;
527  }
528  fPixTab = fPixTabList[id-1];
529  // LOG(logDEBUG) << "Switched to tab " << id << " fPixTabList.size() = " << fPixTabList.size() << " fPixTab = " << fPixTab;
530 }
531 
532 
533 // ----------------------------------------------------------------------
534 void PixGui::changeRootFile() {
535  string oldRootFilePath = gFile->GetName();
536  gFile->Close();
537 
538  string newRootFilePath = fConfigParameters->getDirectory() + "/" + fRootFileNameBuffer->GetString();
539 
540  gSystem->Rename(oldRootFilePath.c_str(), newRootFilePath.c_str());
541  TFile *f = TFile::Open(newRootFilePath.c_str(), "UPDATE");
542  (void)f;
543  std::vector<PixTest*>::iterator il;
544  for (il = fTestList.begin(); il != fTestList.end(); ++il) {
545  (*il)->resetDirectory();
546  }
547 }
548 
549 
550 // ----------------------------------------------------------------------
551 void PixGui::updateSelectedRocs(map<int, int> a) {
552 
553  for (unsigned int i = 0; i < fTestList.size(); ++i) {
554  fTestList[i]->setId2Idx(a);
555  }
556 
557 
558 }
559 
560 // ----------------------------------------------------------------------
561 std::string PixGui::getHdiType() {
562  return fConfigParameters->getHdiType();
563 }
Definition: PixTab.hh:22
Definition: PixGui.hh:43