KaliVeda
Toolkit for HIC analysis
KVDataAnalysisLauncher.cpp
1 #include "KVDataAnalysisLauncher.h"
2 #include "TGLabel.h"
3 #include "TGMsgBox.h"
4 #include "TColor.h"
5 #include "TGButtonGroup.h"
6 #include "TGFileDialog.h"
7 #include "TObjString.h"
8 #include "TDatime.h"
9 #include "TApplication.h"
10 #include "TSocket.h"
11 #include "TGToolTip.h"
12 #include "TGFileDialog.h"
13 #include "Riostream.h"
14 #include "TClass.h"
15 #include "KVDataRepositoryManager.h"
16 #include "KVDataRepository.h"
17 #include "KVDataSetManager.h"
18 #include "KVDataSet.h"
19 #include "KVDataAnalysisTask.h"
20 #include "KV2Body.h"
21 #include "KVNucleus.h"
22 #include "KVExpDB.h"
23 #include "KVBatchSystemManager.h"
24 #include "TSystemDirectory.h"
25 #include "KVInputDialog.h"
26 #include "KVBatchSystemGUI.h"
27 #include "KVBatchSystemParametersGUI.h"
28 #include <KVRunFile.h>
29 #include <optional>
30 
31 #define TTDELAY 750
32 
33 //maximum length of runlist shown next to "Selected Runs :"
34 #define MAX_LENGTH_SELECTED_RUNS 40
35 
36 //#define KVDAL_DEBUG
37 
38 using namespace std;
39 
41 
42 //__________________________________________
43 
44 
47 void KVGFileList::Init(const TString& fileList, const TString& title)
48 {
49  // Init window
52  1, 1, 1, 1);
55  1, 1, 1, 1);
56 
57  // File list TGListBox
58  lbFileList = new TGListBox(this, LB_Files);
59  lbFileList->SetMultipleSelections(kTRUE);
60  lbFileList->Resize(350, 96);
61  this->AddFrame(lbFileList, eXeY);
62 
63  // File Name TGTextEntry
64  teFileName = new TGTextEntry(this, "");
65  this->AddFrame(teFileName, eX);
66 
67  // buttons
68  TGCompositeFrame* cf = new TGCompositeFrame(this, 1200, 350, kHorizontalFrame);
69  boutAdd = new TGTextButton(cf, "Add File");
70  boutAdd->SetToolTipText("Add a file to the list", TTDELAY);
71  boutAdd->Connect("Clicked()",
72  "KVGFileList",
73  this,
74  "AddFile()");
75  cf->AddFrame(boutAdd, eX);
76 
77  boutRem = new TGTextButton(cf, "Remove File");
78  boutRem->SetToolTipText("Remove the selected file from the list", TTDELAY);
79  boutRem->Connect("Clicked()",
80  "KVGFileList",
81  this,
82  "RemoveFiles()");
83  cf->AddFrame(boutRem, eX);
84 
85  boutAllRem = new TGTextButton(cf, "Remove All File");
86  boutAllRem->SetToolTipText("Remove all files from the list", TTDELAY);
87  boutAllRem->Connect("Clicked()",
88  "KVGFileList",
89  this,
90  "RemoveAllFiles()");
91  cf->AddFrame(boutAllRem, eX);
92 
93  this->AddFrame(cf, eX);
94 
95  TGTextButton* bout = new TGTextButton(this, "Done");
96  bout->SetToolTipText("Close window", TTDELAY);
97  bout->Connect("Clicked()",
98  "KVGFileList",
99  this,
100  "Done()");
101  this->AddFrame(bout, eX);
102 
103  // Map all widgets
104  MapSubwindows();
105  Resize(GetDefaultSize());
106  SetWindowName(title);
107  SetIconName(title);
108 
109  fileListString = fileList;
110  fileDialogDir = gSystem->Getenv("PWD");
111 
112  entryMax = 0;
113 }
114 
115 
116 
119 
120 KVGFileList::KVGFileList(const TString& fileList, const TString& title,
121  const TGWindow* p, const TGWindow* main,
122  Bool_t ok):
123  TGTransientFrame(p, main, 10, 10)
124 {
125  // Createur
126 
127  if (ok) {
128  Init(fileList, title);
129  InitFileList();
130  MapRaised();
131  fClient->WaitFor(this);
132  }
133 }
134 
135 
136 
139 
141 {
142  // Destructeur
143  delete lbFileList;
144  delete teFileName;
145  delete boutAdd;
146  delete boutRem;
147  delete boutAllRem;
148 }
149 
150 
151 
155 
157 {
158  // Init the file name list box from a TString. Add all fields separated by a
159  // white space.
160 
161  fileListString.Begin(" ");
162 
163 
164  while (!fileListString.End()) {
165  auto fileName = fileListString.Next();
166  if (fileName.Length() && !lbFileList->FindEntry(fileName)) {
167  lbFileList->AddEntry(new TGString(fileName), entryMax);
168  entryMax++;
169  }
170  }
171 
173  lbFileList->Layout();
174 }
175 
176 
177 
181 
183 {
184  // Add a file to the listbox. If the TGTextEntry is ampty, a file open dialog
185  // appears
186  TString fileName = teFileName->GetText();
187  if (!fileName.Length())
188  fileName = GetFileFromDialog();
189  if (fileName.Length() &&
190  !lbFileList->FindEntry(fileName) &&
191  CanAdd(fileName)) {
192  lbFileList->AddEntry(new TGString(fileName), entryMax);
193  entryMax++;
194  }
196  lbFileList->Layout();
197 }
198 
199 
200 
203 
205 {
206  // Remove all the selected files from the TGListBox
207 
208  TList sel;
210  TIter next(&sel);
211  TGLBEntry* e = nullptr;
212  while ((e = (TGLBEntry*)next())) {
213  gSystem->Unload(((TGTextLBEntry*)e)->GetText()->GetString());
214  lbFileList->RemoveEntry(e->EntryId());
215  }
217  lbFileList->Layout();
218 }
219 
220 
221 
224 
226 {
227  // Remove all the files from the TGListBox
229  entryMax = 0;
231  lbFileList->Layout();
232 }
233 
234 
235 
238 
240 {
241  // build the file list string from the content of the TGListBox
242  fileListString = "";
243  for (Int_t i = 0; i < entryMax; i++) {
245  if (fileListString.Length()) fileListString += " ";
246  fileListString += e->GetText()->GetString();
247  }
248  }
249  CloseWindow();
250 }
251 
252 
253 
256 
258 {
259  // Gets the file name from a TGFileDialog
260  TGFileInfo fil;
261  const char* filTypes[] = {"Shared Object Files", "*.so",
262  0, 0
263  };
264  fil.fFileTypes = filTypes;
265  fil.fIniDir = StrDup(fileDialogDir.Data());
266  new TGFileDialog(gClient->GetRoot(), this, kFDOpen, &fil);
267  fileDialogDir = fil.fIniDir;
268  if (fil.fFilename)
269  return fil.fFilename;
270  return {};
271 }
272 
273 
274 
277 
279 {
280  // tells whether the file in ths string fn can be added to the list box
281  Bool_t ok = kTRUE;
282 
283  FileStat_t fs;
284  auto tmp = fn;
285  gSystem->ExpandPathName(tmp);
286  if (gSystem->GetPathInfo(tmp, fs)) {
287  ok = kFALSE;
288  new TGMsgBox(gClient->GetRoot(), this,
289  "File does not exist",
290  Form("The file \"%s\" does not exist. Nothing added.",
291  fn.Data()),
293  }
294  else {
295  auto fname = fn;
296  if (!fname.EndsWith(".so")) {
297  ok = kFALSE;
298  new TGMsgBox(gClient->GetRoot(), this,
299  "Not a share object",
300  Form("The file \"%s\" is not a shared object. Nothing added.",
301  fn.Data()),
303 
304  }
305  }
306  return ok;
307 }
308 
309 
310 
312 
313 
314 
317 void KVGDirectoryList::Init(const TString& fileList, const TString& title)
318 {
319  // init window
320  KVGFileList::Init(fileList, title);
321 
322  boutAdd->SetText("Add Directory");
323  boutAdd->SetToolTipText("Add a directory to the list.", TTDELAY);
324  boutAdd->Layout();
325 
326  boutRem->SetText("Remove Directory");
327  boutRem->SetToolTipText("Remove the selected directories from the list.", TTDELAY);
328  boutRem->Layout();
329 
330  boutAllRem->SetText("Remove All Directories");
331  boutAllRem->SetToolTipText("Remove all directories from the list.", TTDELAY);
332  boutAllRem->Layout();
333 }
334 
335 
336 
339 
340 KVGDirectoryList::KVGDirectoryList(const TString& fileList, const TString& title,
341  const TGWindow* p, const TGWindow* main,
342  Bool_t ok):
343  KVGFileList(fileList, title, p, main, kFALSE)
344 {
345  // Createur
346 
347  if (ok) {
348  Init(fileList, title);
349  InitFileList();
350  MapRaised();
351  fClient->WaitFor(this);
352  }
353 }
354 
355 
356 
359 
361 {
362  // Gets the file name from a TGFileDialog
363  TGFileInfo fil;
364  const char* filTypes[] = {"Include Files", "*.[h,H]*",
365  0, 0
366  };
367  fil.fFileTypes = filTypes;
368  fil.fIniDir = StrDup(fileDialogDir.Data());
369  new TGFileDialog(gClient->GetRoot(), this, kFDOpen, &fil);
370  fileDialogDir = fil.fIniDir;
371  if (fil.fFilename)
372  return fil.fIniDir;
373  return {};
374 }
375 
376 
377 
380 
382 {
383  // tells whether the file in ths string fn can be added to the list box
384  Bool_t ok = kTRUE;
385 
386  FileStat_t fs;
387  TString tmp = fn;
388  gSystem->ExpandPathName(tmp);
389  if (gSystem->GetPathInfo(tmp.Data(), fs)) {
390  ok = kFALSE;
391  new TGMsgBox(gClient->GetRoot(), this,
392  "Directory does not exist",
393  Form("The directory \"%s\" does not exist. Nothing added.",
394  fn.Data()),
396  }
397  else {
398  if (!(fs.fMode & kS_IFDIR)) {
399  ok = kFALSE;
400  new TGMsgBox(gClient->GetRoot(), this,
401  "Not a directory",
402  Form("The path \"%s\" is not a directory. Nothing added.",
403  fn.Data()),
405 
406  }
407  }
408  return ok;
409 }
410 
411 
413 
414 
415 
423 {
424  // Main window width and height can be set using .kvrootrc variables:
425  // KaliVedaGUI.MainGUIWidth: 800
426  // KaliVedaGUI.MainGUIHeight: 600
427  // Maximum column width of runlist can be set using:
428  // KaliVedaGUI.MaxColWidth: 500
429 
430  entryMax = -1;
431  //Initialisation of resource file
432  GUIenv = new TEnv(".KVDataAnalysisGUIrc");
433  //initialisation of list used by Get/SetResource
434  ResourceNames.Add(new TNamed("Repository", ""));
435  ResourceNames.Add(new TNamed("DataSet", ""));
436  ResourceNames.Add(new TNamed("Task", ""));
437  NbResNames = ResourceNames.GetEntries();
438 
439  // list of user analysis classes present in working directory
440  UserClassNames = new TList;
441  UserClassNames->SetOwner(kTRUE);
442 
443  //initialise repositories, datasets, etc.
444  if (!gDataRepositoryManager) {
446  gDataRepositoryManager->Init();
447  }
448  if (gDataRepositoryManager->GetListOfRepositories()->GetEntries() == 0) {
449  exit(1);
450  }
451  ia = 0;
452  GetDataAnalyser();//this will set up gBatchSystemManager
453  gBatchSystemManager->GetDefaultBatchSystem()->cd();
454 
455  // Creation de l'environnement d'affichage et ajout des 2 boutons a cet
456  // environnement
457 
460  1, 1, 1, 1);
463  1, 1, 1, 1);
465  1, 1, 1, 1);
467  1, 1, 1, 1);
468  fMainGuiWidth = gEnv->GetValue("KaliVedaGUI.MainGUIWidth", 400);
469  fMainGuiHeight = gEnv->GetValue("KaliVedaGUI.MainGUIHeight", 600);
470 
471  // Creation des 3 frames dans la fenetre
472  TGCompositeFrame* cfSelect = new TGCompositeFrame(this, fMainGuiWidth, 350, kVerticalFrame);
473 
474  Int_t justMode = kTextBottom | kTextRight;
475  TGCompositeFrame* cf = new TGCompositeFrame(cfSelect, fMainGuiWidth, 350, kHorizontalFrame);
476  // Label du Repository
477  TGLabel* lab = new TGLabel(cf, "DATA REPOSITORY : ");
478  lab->Resize(150, 20);
479  lab->SetTextJustify(justMode);
480  cf->AddFrame(lab);
481  // ComboBox du Repository
482  cbRepository = new TGComboBox(cf, CB_DataRepository);
483  cbRepository->Select(-1);
484  cbRepository->Resize(150, 20);
485  cbRepository->Connect("Selected(Int_t)",
486  "KVDataAnalysisLauncher",
487  this,
488  "SelectedRepository(Int_t)");
489  cf->AddFrame(cbRepository, LHtopleft);
490 
491  // Label du Data Set
492  lab = new TGLabel(cf, "DATASET : ");
493  lab->Resize(150, 20);
494  lab->SetTextJustify(justMode);
496  20, 1, 1, 1));
497  // ComboBox du Data Set
498  cbDataSet = new TGComboBox(cf, CB_DataSet);
499  cbDataSet->Select(-1);
500  cbDataSet->Resize(150, 20);
501  cbDataSet->Connect("Selected(Int_t)",
502  "KVDataAnalysisLauncher",
503  this,
504  "SelectedDataSet(Int_t)");
505  cf->AddFrame(cbDataSet, LHtopleft);
506  cfSelect->AddFrame(cf, centerX);
507 
508  cf = new TGCompositeFrame(cfSelect, fMainGuiWidth, 350, kHorizontalFrame);
509  // Label du Task
510  lab = new TGLabel(cf, "ANALYSIS TASK : ");
511  lab->SetTextJustify(justMode);
512  lab->Resize(150, 20);
514  1, 1, 1, 1));
515  // ComboBox du Task
516  cbTask = new TGComboBox(cf, CB_AnalysisTask);
517  cbTask->Select(-1);
518  cbTask->Resize(350, 20);
519  cbTask->Connect("Selected(int)",
520  "KVDataAnalysisLauncher",
521  this,
522  "SetSystemList(int)");
523  cf->AddFrame(cbTask, LHtopleft);
524  cfSelect->AddFrame(cf, centerX);
525 
526  AddFrame(cfSelect, new TGLayoutHints(kLHintsLeft | kLHintsTop
528  10, 10, 1, 1));
529  // Systems list
530  lvSystems = new KVListView(KVDBSystem::Class(), this, fMainGuiWidth, 250);
531  lvSystems->SetDataColumns(6);
532  lvSystems->SetMaxColumnSize(gEnv->GetValue("KaliVedaGUI.MaxColWidth", 200));
533  lvSystems->SetDataColumn(1, "Zproj");
534  lvSystems->SetDataColumn(2, "Ztarget");
535  lvSystems->SetDataColumn(3, "Ebeam");
536  lvSystems->GetDataColumn(3)->SetDataFormat("%4.1lf");
537  lvSystems->SetDataColumn(4, "Runs", "GetNumberRuns");
538  lvSystems->SetDataColumn(5, "Events");
539  lvSystems->SetDataColumn(0, "System", "GetName");
540  lvSystems->ActivateSortButtons();
541  // disable context menu, Browse & multi-select functions
542  lvSystems->AllowBrowse(kFALSE);
543  lvSystems->AllowContextMenu(kFALSE);
544  lvSystems->AllowMultipleSelection(kTRUE);
545  lvSystems->Connect("SelectionChanged()", "KVDataAnalysisLauncher", this, "SystemSelectionChanged()");
546  AddFrame(lvSystems, new TGLayoutHints(kLHintsExpandX,
547  10, 10, 15, 15));
548 
549  // Frame pour la liste des runs
550 
551  TGCompositeFrame* cfRuns = new TGCompositeFrame(this, fMainGuiWidth, 400, kVerticalFrame);
552  lvRuns = new KVListView(KVRunFile::Class(), cfRuns, fMainGuiWidth, 300);
553  lvRuns->SetDataColumns(8);
554  lvRuns->SetMaxColumnSize(gEnv->GetValue("KaliVedaGUI.MaxColWidth", 200));
555  int iicc = 0;
556  lvRuns->SetDataColumn(iicc++, "Run/Index", "GetRunIndexString");
557  lvRuns->SetDataColumn(iicc++, "Events", "", kTextRight);
558  lvRuns->SetDataColumn(iicc++, "File", "GetName");
559  lvRuns->SetDataColumn(iicc++, "Date", "GetFileWritten");
560  lvRuns->SetDataColumn(iicc++, "Comments", "", kTextLeft);
561  lvRuns->SetDataColumn(iicc++, "Trigger", "");
562  lvRuns->SetDataColumn(iicc++, "Version");
563  lvRuns->SetDataColumn(iicc++, "User");
564  lvRuns->ActivateSortButtons();
565  // disable context menu & Browse functions
566  lvRuns->AllowBrowse(kFALSE);
567  lvRuns->AllowContextMenu(kFALSE);
568  lvRuns->Connect("SelectionChanged()", "KVDataAnalysisLauncher", this, "UpdateListOfSelectedRuns()");
569  cfRuns->AddFrame(lvRuns, new TGLayoutHints(kLHintsLeft | kLHintsTop |
571  10, 10, 15, 15));
572 
573  // Boutons de selection
574  TGCompositeFrame* cfSelAll = new TGCompositeFrame(cfRuns, fMainGuiWidth, 20, kHorizontalFrame);
575  auto BrefreshDir = new TGPictureButton(cfSelAll, gClient->GetPicture("refresh2.xpm"));
576  BrefreshDir->Resize(20, 20);
577  cfSelAll->AddFrame(BrefreshDir, eX);
578  BrefreshDir->SetToolTipText("Update available runfiles for this datatype");
579  BrefreshDir->Connect("Clicked()", "KVDataAnalysisLauncher", this, "UpdateAvailableRuns()");
580  TGTextButton* bout = new TGTextButton(cfSelAll, "Select All");
581  bout->SetToolTipText("Select all runs for the analysis.", TTDELAY);
582  bout->Connect("Clicked()",
583  "KVDataAnalysisLauncher",
584  this,
585  "SelectAll()");
586  cfSelAll->AddFrame(bout, eX);
587  bout = new TGTextButton(cfSelAll, "Deselect All");
588  bout->SetToolTipText("Deselect all runs.", TTDELAY);
589  bout->Connect("Clicked()",
590  "KVDataAnalysisLauncher",
591  this,
592  "DeselectAll()");
593  cfSelAll->AddFrame(bout, eX);
594  bout = new TGTextButton(cfSelAll, "Runlist");
595  bout->SetToolTipText("Enter list of runs to analyse.", TTDELAY);
596  bout->Connect("Clicked()",
597  "KVDataAnalysisLauncher",
598  this,
599  "EnterRunlist()");
600  cfSelAll->AddFrame(bout, eX);
601  bStageSelect = new TGTextButton(cfSelAll, "Stage selection");
602  bStageSelect->SetToolTipText("Select all unconverted runs", TTDELAY);
603  // bStageSelect->Connect("Clicked()",
604  // "KVDataAnalysisLauncher",
605  // this,
606  // "SelectAllUnconvertedRuns()");
607  bStageSelect->Connect("Clicked()",
608  "KVDataAnalysisLauncher",
609  this,
610  "DoStageSelection()");
611  bStageSelect->SetEnabled(false);
612  cfSelAll->AddFrame(bStageSelect, eX);
613  cfRuns->AddFrame(cfSelAll, eX);
614 
615  TGHorizontalFrame* runs_and_nbevents = new TGHorizontalFrame(cfRuns, fMainGuiWidth, 20);
616  selectedRuns = new TGLabel(runs_and_nbevents, " ");
617  runs_and_nbevents->AddFrame(selectedRuns, new TGLayoutHints(kLHintsExpandX | kLHintsCenterY, 2, 2, 0, 0));
618  TGHorizontalFrame* bidule = new TGHorizontalFrame(runs_and_nbevents);
619  TGLabel* nevents = new TGLabel(bidule, "Events : ");
620  bidule->AddFrame(nevents, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 2, 2, 0, 0));
621  teNbToRead = new TGNumberEntry(bidule, 0);
622 #ifdef __WITHOUT_TGNUMBERENTRY_SETNUMSTYLE
623  teNbToRead->SetFormat(TGNumberFormat::kNESInteger, teNbToRead->GetNumAttr());
624 #else
625  teNbToRead->SetNumStyle(TGNumberFormat::kNESInteger);
626 #endif
627 #ifdef __WITHOUT_TGNUMBERENTRY_SETNUMATTR
628  teNbToRead->SetFormat(teNbToRead->GetNumStyle(), TGNumberFormat::kNEANonNegative);
629 #else
630  teNbToRead->SetNumAttr(TGNumberFormat::kNEANonNegative);
631 #endif
632  teNbToRead->GetNumberEntry()->SetToolTipText("Number of events to read [0 => all events]", TTDELAY);
633  teNbToRead->Resize(150, 20);
634  bidule->AddFrame(teNbToRead, new TGLayoutHints(kLHintsRight | kLHintsCenterY, 2, 2, 0, 0));
635  runs_and_nbevents->AddFrame(bidule, new TGLayoutHints(kLHintsRight, 2, 2, 0, 0));
636  cfRuns->AddFrame(runs_and_nbevents, eX);
637 
638  AddFrame(cfRuns, eXeY);
639 
640  // UserClass
641  cfAnalysis = new TGCompositeFrame(this, fMainGuiWidth, 20, kVerticalFrame);
642  cf = new TGCompositeFrame(cfAnalysis, fMainGuiWidth, 20, kHorizontalFrame);
643  // Label for User Class name
644  fUserClassLabel = new TGLabel(cf, "User Class");
645  cf->AddFrame(fUserClassLabel, eX);
646  // Label du Task
647  lab = new TGLabel(cf, "User class options");
648  cf->AddFrame(lab, eX);
649 
650  cfAnalysis->AddFrame(cf, eX);
651 
652  cf = new TGCompositeFrame(cfAnalysis, fMainGuiWidth, 20, kHorizontalFrame);
653  cbUserClass = new TGComboBox(cf);
654  cbUserClass->Select(-1);
655  cbUserClass->Resize(150, 20);
656  cf->AddFrame(cbUserClass, eX);
657  cbUserClass->Connect("Selected(Int_t)", "KVDataAnalysisLauncher", this,
658  "SelectedUserClass(Int_t)");
659  btEditClass = new TGPictureButton(cf, "query_new.xpm");
660  btEditClass->SetEnabled(kFALSE);
661  btEditClass->Connect("Clicked()", "KVDataAnalysisLauncher", this, "EditUserClassFiles()");
662  btEditClass->SetToolTipText(Form("Open analysis class source files in %s", gSystem->Getenv("EDITOR")), TTDELAY);
663  cf->AddFrame(btEditClass, new TGLayoutHints(kLHintsTop | kLHintsLeft, 2, 2, 2, 2));
664 
665  teUserOptions = new TGTextEntry(cf, "");
666  teUserOptions->SetToolTipText("Comma-separated list of options for user analysis class: PAR1=VAL1,PAR2=VAL2,etc.", TTDELAY);
667  cf->AddFrame(teUserOptions, eX);
668 
669  cfAnalysis->AddFrame(cf, eX);
670 
671  AddFrame(cfAnalysis, eX);
672 
673  cf = new TGCompositeFrame(this, fMainGuiWidth, 20, kHorizontalFrame);
674  // Frame for the user's libraries
675  bout = new TGTextButton(cf, "User's libraries", B_Libs);
676  bout->Connect("Clicked()",
677  "KVDataAnalysisLauncher",
678  this,
679  "SetUserLibraries()");
680  cf->AddFrame(bout, eX);
681 
682  bout = new TGTextButton(cf, "User's includes", B_Incs);
683  bout->Connect("Clicked()",
684  "KVDataAnalysisLauncher",
685  this,
686  "SetUserIncludes()");
687  cf->AddFrame(bout, eX);
688 
689  this->AddFrame(cf, eX);
690 
691  // Process et Quit
692 #ifdef KVDAL_DEBUG
693  cout << "Creation Process/Quit" << endl;
694 #endif
695  TGCompositeFrame* cfProcess = new TGCompositeFrame(this, fMainGuiWidth, 20, kHorizontalFrame);
696  withBatch = new TGTextButton(cfProcess, "BatchMode");
697  withBatch->SetToolTipText(gBatchSystem->GetTitle());
698  withBatch->AllowStayDown(kTRUE);
699  withBatch->Connect("Clicked()", "KVDataAnalysisLauncher", this, "SetBatch()");
700  cfProcess->AddFrame(withBatch, eX);
701  doBatchParams = new TGTextButton(cfProcess, "Batch Parameters");
702  doBatchParams->SetToolTipText("Set parameters of batch jobs");
703  doBatchParams->Connect("Clicked()", "KVDataAnalysisLauncher", this, "SetBatchParameters()");
704  cfProcess->AddFrame(doBatchParams, eX);
705  // Bouton de process
706  bout = new TGTextButton(cfProcess, "&Process", B_Process);
707  bout->SetToolTipText("Run the analysis.", TTDELAY);
708  bout->Connect("Clicked()", "KVDataAnalysisLauncher", this, "Process()");
709  // bout->Associate(this);
710  cfProcess->AddFrame(bout, eX);
711  // Bouton de sortie
712  bout = new TGTextButton(cfProcess, "&Quit", B_Quit);
713  bout->SetToolTipText("Close GUI and quit.", TTDELAY);
714  bout->Connect("Clicked()", "KVDataAnalysisLauncher", this, "Exit()");
715  // bout->Associate(this);
716  cfProcess->AddFrame(bout, eX);
717 
718  this->AddFrame(cfProcess, eX);
719  // On affiche tout le monde maintenant
720  MapSubwindows();
721 
722  Resize(GetDefaultSize());
723 
724  SetWindowName(Form("KaliVeda Analysis Launcher on %s", gSystem->HostName()));
725  SetIconName(Form("KaliVeda Analysis Launcher on %s", gSystem->HostName()));
726 
727  MapWindow();
728  SetWMSize(fMainGuiWidth, fMainGuiHeight);
729 
730  SetRepositoryList();
731 
732  FillListOfUserClasses();
733  //fill drop down list of user classes in working directory
734  SetUserClassList();
735  checkCompilation = kFALSE;
736 
737  // Reset last known state of interface
738  TString tmp(GetResource("Repository", ""));
739  SetRepository(tmp.Data());
740 
741  if (GUIenv->GetValue("KVDataAnalysisLauncher.Batch", kFALSE))
742  withBatch->SetState(kButtonDown);
743  else
744  withBatch->SetState(kButtonUp);
745  SetBatch();
746 
747  fUserLibraries = GUIenv->GetValue("KVDataAnalysisLauncher.UserLibraries", "");
748  fUserIncludes = GUIenv->GetValue("KVDataAnalysisLauncher.UserIncludes", "");
749 
750 }
751 
752 
753 
756 
758 {
759  // Destructeur
760  if (ia) delete ia;
761  if (GUIenv) delete GUIenv;
762  delete UserClassNames;
763 }
764 
765 
766 
769 
771 {
772  // Sets the list of all possible repositories in the repository combo box
773 #ifdef __WITHOUT_TGCOMBOBOX_REMOVEALL
775 #else
777 #endif
778  cbRepository->Select(-1);
779  TIter next((TList*)gDataRepositoryManager->GetListOfRepositories());
780  TObject* o = 0;
781  Int_t i = 0;
782  while ((o = next())) {
783  cbRepository->AddEntry(o->GetName(), i);
784  i++;
785  }
786 
787  cbRepository->Layout();
788 
789 }
790 
791 
792 
797 
799 {
800  // Called when repository is selected in drop-down list
801  //
802  // Calls SetDataSetList() to fill list of available datasets for given repository
803 
805  if (sel)
806  SetDataSetList(sel->GetTitle());
807 }
808 
809 
810 
813 
815 {
816  // Sets the list of all available data sets in the data sets combo box
817  if (!gDataRepositoryManager->GetRepository(repository)) {
818  Warning("SetDataSetList", "Called for undefined repository '%s'", repository.Data());
819  return;
820  }
821 
822  SetResource("Repository", repository);
823 
824  TString ds = GetSavedResource("DataSet", "");
825 
826 #ifdef __WITHOUT_TGCOMBOBOX_REMOVEALL
828 #else
829  cbDataSet->RemoveAll();
830 #endif
831  cbDataSet->Select(-1);
832  gDataRepositoryManager->GetRepository(repository)->cd();
833  Int_t nbds = gDataSetManager->GetNavailable();
834  Int_t i = 0;
835  while (i < nbds) {
836  cbDataSet->AddEntry(gDataSetManager->GetAvailableDataSet(i + 1)->GetName(), i);
837  i++;
838  }
839 
840  cbDataSet->Layout();
841 
842  if (ds.Length()) {
843  SetDataSet(ds.Data());
844  }
845  else {
846  SetTask();
847  }
848 
849 }
850 
851 
852 
857 
859 {
860  // Called when dataset is selected in drop-down list
861  //
862  // Calls SetTaskList() to fill list of available tasks for given dataset
863 
864  auto sel = cbDataSet->GetSelectedEntry();
865  // allow list to close & GUI to relax before e.g. building database for new dataset
867  if (sel)
868  SetTaskList(sel->GetTitle());
869 }
870 
871 
872 
876 
878 {
879  // Sets the list of all possible tasks in the tasks combo box
880  // Called when a new dataset is selected in the dropdown list
881 
882  SetResource("DataSet", dataset);
883 
884  TString ds = GetSavedResource("Task", "");
885 
886 #ifdef __WITHOUT_TGCOMBOBOX_REMOVEALL
887  RemoveAll(cbTask);
888 #else
889  cbTask->RemoveAll();
890 #endif
891  cbTask->Select(-1);
892 #ifdef KVDAL_DEBUG
893  cout << "DataSet : [" << dataset << "]" << endl;
894 #endif
895  gDataSetManager->GetDataSet(dataset)->cd();
896  Int_t nbt = gDataSet->GetNtasks();
897 
898  GetDataAnalyser()->SetDataSet(gDataSet);
899 
900  noSystems = (!gExpDB || !gExpDB->GetSystems()->GetSize());
901  if (noSystems) lvSystems->RemoveAll();
902 
903  Int_t i = 0;
904  while (i < nbt) {
905  cbTask->AddEntry(gDataSet->GetAnalysisTask(i + 1)->GetType(), i);
906  i++;
907  }
908 
909  cbTask->Layout();
910 
911  if (ds.Length()) {
912  SetTask(ds.Data());
913  }
914  else {
915  SetSystem();
916  }
917 }
918 
919 
920 
924 
926 {
927  //Get analyser for task
928  //If task = 0 we return the current analyser
929 
930  if (!task) {
931  if (!ia) ia = new KVDataSetAnalyser;
932  }
933  else {
934  if (ia) delete ia;
936  if (!ia) ia = new KVDataSetAnalyser;
937  ia->SetAnalysisTask(task);
938  }
939  return ia;
940 }
941 
942 
943 
954 
956 {
957  // Sets the list of all possible systems in the system list.
958  // Called every time a task is selected.
959  //
960  // The choice of task may lead to a change of batch system:
961  // - if the current system is PROOFLite but the data to be read by the task is
962  // not in a TFile (i.e. not in a TTree) then we switch to Xterm batch system.
963  // - if the current system is Xterm but the data to be read by the task *is*
964  // in a TFile (i.e. in a TTree) then we switch to PROOFLite batch system
965 
966  // allow list to close & GUI to relax before e.g. building database for new dataset
968 
969  KVDataAnalysisTask* task = gDataSet->GetAnalysisTask(itask + 1);
970 
971  TString current_batch = gBatchSystem->GetName();
972  TString data_reader = gDataSet->GetDataSetEnv(Form("DataSet.RunFileClass.%s", task->GetPrereq()));
973 
974  if (current_batch == "PROOFLite" && data_reader != "TFile") {
975  gBatchSystemManager->GetBatchSystem("Xterm")->cd();
976  withBatch->SetToolTipText(gBatchSystem->GetTitle());
977  Info("SetSystemList", "Switched batch system to %s: %s", gBatchSystem->GetName(), gBatchSystem->GetTitle());
978  }
979  else if (current_batch == "Xterm" && data_reader == "TFile") {
980  gBatchSystemManager->GetBatchSystem("PROOFLite")->cd();
981  withBatch->SetToolTipText(gBatchSystem->GetTitle());
982  Info("SetSystemList", "Switched batch system to %s: %s", gBatchSystem->GetName(), gBatchSystem->GetTitle());
983  }
984 
985  GetDataAnalyser(task);
986 
987  SetResource("Task", task->GetTitle());
988 
989  if (!task->WithUserClass()) {
990  //no user class required
992  }
993  else {
994  //user class required
996  }
997 
998  source_type = task->GetPrereq();
999  // conversion task? if so, enable stage selection
1000  if (!task->GetOutputDataType().IsNull()) {
1001  output_type = task->GetOutputDataType();
1003  }
1004  else {
1005  bStageSelect->SetEnabled(false);
1006  }
1007 
1008  //update display
1009  cfAnalysis->Layout();
1010 
1011  TString ds = GetSavedResource("System", "");
1012  lastSelectedSystem = 0;
1013  if (!noSystems) {
1014  auto sys_list = gDataSet->GetListOfAvailableSystems(task);
1015  if (!sys_list.IsEmpty()) {
1016  lvSystems->Display(&sys_list);
1017  }
1018  }
1019  if (ds.Length()) {
1020  SetSystem(ds.Data());
1021  }
1022  else {
1023  SetRunsList();
1024  }
1025 }
1026 
1027 
1028 
1032 
1034 {
1035  // Sets the list of all available runs in the runs list box
1036 
1037 // SetResource("Trigger", "All");
1038  listOfRuns.Clear();
1040  if (entryMax > -1) {
1041  lvRuns->RemoveAll();
1042  list_of_runs.Clear();
1043  entryMax = -1;
1044  }
1045 
1046  KVDataAnalysisTask* task = gDataSet->GetAnalysisTask(cbTask->GetSelected() + 1);
1047  KVDBSystem* system = 0;
1048  if (!noSystems || !strcmp(task->GetPrereq(), "*")) {
1049  // case where systems are defined for dataset and user has
1050  // selected a specific system
1051  // OR for online analysis (prereq data type="*")
1052  system = lastSelectedSystem;
1053  GetDataAnalyser()->SetSystem(system);
1054  if (!system) {
1055  // no system selected
1056  // clear runs list
1057  SetRuns();
1058  return;
1059  }
1060  }
1061 
1062  //Setting name of system in ressources file
1063  if (!noSystems) {
1064  // dataset with defined systems
1065  if (system) {
1066  // user has chosen a system
1067  SetResource("System", system->GetName());
1068  }
1069  else {
1070  // user chose "All" for system
1071  SetResource("System", "All");
1072  }
1073  }
1074  else {
1075  // no systems defined for dataset
1076  SetResource("System", "Unknown");
1077  }
1078 
1079  // loop over selected systems, add all runs to run list
1080  lvRuns->RemoveAll();
1081  list_of_runs.Clear();
1082  run_index_list run_list;
1083  for (auto sys_p : listofSelectedSystems) {
1084  auto system = (KVDBSystem*)sys_p;
1085  auto rl = gDataSet->GetRunList(task->GetPrereq(), system);
1086  run_list.Add(rl);
1087  auto lor = gDataSet->GetListOfAvailableRunFilesForSystem(task, system);
1088  list_of_runs.AddAll(&lor);
1089  lor.Clear("nodelete");
1090  }
1092  listOfSystemRuns = run_list;
1094 
1095  SetRuns("");
1096 
1097  // Set saved user class, number of events for current
1098  // repository, dataset, task, system, trigger & runs
1099  auto ds = GetSavedResource("UserClass", "");
1100  SetUserClass(ds);
1101  ds = GetSavedResource("NbEventsToRead", "");
1102  teNbToRead->SetIntNumber(ds.Atoi());
1103 }
1104 
1105 
1106 
1111 
1113 {
1114  // Called when user analysis class is selected in drop-down list
1115  //
1116  // Calls UserClassSelected() with name of class
1117 
1118  auto sel = cbUserClass->GetSelectedEntry();
1119  if (sel)
1120  UserClassSelected(sel->GetTitle());
1121 }
1122 
1123 
1124 
1125 
1128 
1130 {
1131  // Select all runs currently in the displayed list of runs
1132  lvRuns->SelectAll();
1134 }
1135 
1136 
1137 
1140 
1142 {
1143  // Deselect all runs currently in the displayed list of runs
1144  lvRuns->UnSelectAll();
1146 }
1147 
1148 
1149 
1152 
1154 {
1155  // Run the analysis task
1156 
1157  TString oriIncludePath = gSystem->GetIncludePath();
1158 
1159  if (gDataRepository->IsRemote()) {
1160  cout << "Checking connection to remote repository." << endl;
1161  if (!gDataRepository->IsConnected()) {
1162  cout << "Connection to server refused" << endl;
1163  cout << "Process aborted." << endl;
1164  WarningBox("Connection refused", "Connection to server refused\nProcess aborted.");
1165  return;
1166  }
1167  }
1168 
1169  KVDataAnalysisTask* task = gDataSet->GetAnalysisTask(cbTask->GetSelected() + 1);
1170  KVDataSetAnalyser* datan = GetDataAnalyser(task);
1171  bool online_analysis = !strcmp(task->GetPrereq(), "*");
1172 
1173  //set global pointer to analyser
1174  gDataAnalyser = datan;
1175 
1176  datan->SetDataSet(gDataSet);
1177  datan->SetAnalysisTask(task);
1178  if (listOfRuns.GetNValues()) {
1179  datan->SetRuns(listOfRuns, kFALSE);
1180  datan->SetFullRunList(listOfRuns);
1181  }
1182  else if (!online_analysis) {
1183  WarningBox("Empty Run List", "The list of runs to process is empty.");
1184  return;
1185  }
1186 
1187  if (fUserIncludes.Length()) {
1189  }
1190  if (fUserLibraries.Length()) {
1192  }
1193 
1194  //Need a user class for the analysis ?
1195  TString kvs(GetUserClass());
1196  if (task->WithUserClass()) {
1197  //read user's class name from input box
1198  if (kvs.Length()) {
1200  datan->SetUserClass({kvs}, checkCompilation);
1201  if (datan->IsUserClassValid())
1203  else {
1204  // compilation failed. abort processing.
1205  delete ia;
1206  ia = 0;
1208  if (WarningBox("Compilation failed", "Please correct mistakes in user analysis class", kTRUE)) EditUserClassFiles();
1209  return;
1210  }
1211  }
1212  else {
1213  delete ia;
1214  ia = 0;
1216  WarningBox("No User Class", "Please enter the user analysis class name.");
1217  return;
1218  }
1219  }
1220  else if (strcmp(task->GetUserBaseClass(), "")) {
1221  //task with default "user" class (i.e. UserClass=no but UserClass.BaseClass!="")
1222  datan->SetUserClass({task->GetUserBaseClass()}, kFALSE);
1223  }
1224  Long64_t nbEventRead = (Long64_t)teNbToRead->GetIntNumber();
1225  // if in batch and nbEventRead>0, ask confirmation
1226  if (IsBatch() && nbEventRead) {
1227  if (!WarningBox("Read all events in batch mode?",
1228  "This will submit batch jobs which will not read all events.\nAre you sure that is what you want?",
1229  kTRUE)) {
1230  delete ia;
1231  ia = 0;
1232  return;
1233  }
1234  }
1235  // check batch parameters have been set
1236  if (IsBatch()
1237  && (!fBatchParameters.GetNpar() // never set
1238  // previously set with MultiJobsMode turned off (perhaps to read a single run), whereas we now have many runs to read
1239  || (fBatchParameters.HasBoolParameter("MultiJobsMode") && !fBatchParameters.GetBoolValue("MultiJobsMode") && listOfRuns.GetNValues() > 1))
1240  ) {
1241  if (!SetBatchParameters()) return; //abort analysis if user pressed cancel
1242  }
1244  SetResource("RunsList", listOfRuns.AsString());
1245  SetResource("UserClassOptions", teUserOptions->GetText());
1246  SetResource("NbEventsToRead", Form("%.0f", teNbToRead->GetNumber()));
1248 
1249  // submit jobs for each selected system
1250  for (auto it : listofSelectedSystems) {
1251  auto sys = (KVDBSystem*)it;
1252 
1253  // build up runfile list for system
1254  run_index_list sys_run_list;
1255  for (auto it_r : sys->GetRuns()) {
1256  // keep all system runfiles in user's selection
1257  auto runfiles_for_run = dynamic_cast<KVDBRun*>(it_r)->GetRunIndexList();
1258  sys_run_list += runfiles_for_run && listOfRuns;
1259  }
1260  if (sys_run_list) {
1261  if (IsBatch()) {
1262  gBatchSystem->Clear();
1264  datan->SetBatchSystem(gBatchSystem);
1265  }
1266  else {
1267  datan->SetBatchSystem(nullptr);
1268  }
1269  datan->SetRuns(sys_run_list, false);
1270  datan->Run();
1271  }
1272  }
1273 
1274  gSystem->SetIncludePath(oriIncludePath.Data());
1275 }
1276 
1277 
1278 
1280 
1282 {
1284  return e->GetText()->GetString();
1285  }
1286  else {
1287  return "";
1288  }
1289 }
1290 
1291 
1292 
1294 
1296 {
1298  return e->GetText()->GetString();
1299  }
1300  else {
1301  return "";
1302  }
1303 }
1304 
1305 
1306 
1308 
1310 {
1312  return e->GetText()->GetString();
1313  }
1314  else {
1315  return "";
1316  }
1317 }
1318 
1319 
1320 
1322 
1324 {
1325  if (noSystems) return "";
1327  if (sys)
1328  return sys->GetName();
1329  else
1330  return "";
1331 }
1332 
1333 
1334 
1335 
1337 
1339 {
1340  return listOfRuns.AsString();
1341 }
1342 
1343 
1344 
1346 
1348 {
1349  TGLBEntry* e = 0;
1350  if ((e = cbRepository->FindEntry(r))) {
1351  Int_t i = e->EntryId();
1352 #ifdef __WITHOUT_TGCOMBOBOX_SELECT_BOOL_T
1353  cbRepository->Select(i);
1354 #else
1355  cbRepository->Select(i, kFALSE);
1356 #endif
1357  SetDataSetList(r);
1358  }
1359  else {
1360  SetDataSet();
1361  }
1362 }
1363 
1364 
1365 
1367 
1369 {
1370  if (r.IsNull()) {
1371  //remove all datasets because no repository has been chosen yet
1372 #ifdef __WITHOUT_TGCOMBOBOX_REMOVEALL
1374 #else
1375  cbDataSet->RemoveAll();
1376 #endif
1377  cbDataSet->Select(-1);
1378  SetResource("Repository", "");
1379  SetTask();
1380  }
1381  else {
1382  TGLBEntry* e = 0;
1383  if ((e = cbDataSet->FindEntry(r))) {
1384  Int_t i = e->EntryId();
1385 #ifdef __WITHOUT_TGCOMBOBOX_SELECT_BOOL_T
1386  cbDataSet->Select(i);
1387 #else
1388  cbDataSet->Select(i, kFALSE);
1389 #endif
1390  SetTaskList(r);
1391  }
1392  else {
1393  SetTask();
1394  }
1395  }
1396 }
1397 
1398 
1399 
1401 
1403 {
1404  if (r.IsNull()) {
1405  //remove all tasks from list because no dataset chosen yet
1406 #ifdef __WITHOUT_TGCOMBOBOX_REMOVEALL
1407  RemoveAll(cbTask);
1408 #else
1409  cbTask->RemoveAll();
1410 #endif
1411  cbTask->Select(-1);
1412  SetResource("DataSet", "");
1413  SetSystem();
1414  }
1415  else {
1416  TGLBEntry* e = 0;
1417  if ((e = cbTask->FindEntry(r))) {
1418  Int_t i = e->EntryId();
1419 #ifdef __WITHOUT_TGCOMBOBOX_SELECT_BOOL_T
1420  cbTask->Select(i);
1421 #else
1422  cbTask->Select(i, kFALSE);
1423 #endif
1424  SetSystemList(i);
1425  }
1426  else {
1427  SetSystem();
1428  }
1429  }
1430 }
1431 
1432 
1433 
1435 
1437 {
1438  if (r.IsNull()) {
1439  //remove all systems from list because no task chosen yet
1440  lvSystems->RemoveAll();
1441  SetResource("Task", "");
1442  //empty list of analysis classes and disable it
1444  SetRuns();
1445  lvRuns->RemoveAll();
1446  list_of_runs.Clear();
1447  }
1448  else {
1451  }
1452 }
1453 
1454 
1455 
1461 
1463 {
1464  //KVDBSystem* system = (KVDBSystem*)lvSystems->GetLastSelectedObject();
1465  //if (system == lastSelectedSystem) return;
1466  //lastSelectedSystem = system;
1467  //GetDataAnalyser()->SetSystem(system);
1470  lastSelectedSystem = nullptr;
1471  else
1473  SetRunsList();
1474 }
1475 
1476 
1477 
1479 
1481 {
1482  if (r.IsNull()) {
1484  SetResource("Trigger", "All");
1485  SetResource("RunsList", "");
1486  }
1487  else {
1489  if (listOfRuns.GetNValues()) {
1491  SetResource("RunsList", listOfRuns.AsString());
1492  }
1494  }
1495 }
1496 
1497 
1498 
1502 
1504 {
1505  // Set the resource KVDataAnalysisLauncher.Batch according
1506  // to whether button 'Batch' is down or up
1507 
1508  if (IsBatch()) withBatch->SetText("BatchMode: On");
1509  else withBatch->SetText("BatchMode: Off");
1510  GUIenv->SetValue("KVDataAnalysisLauncher.Batch", IsBatch());
1513 }
1514 
1515 
1516 
1520 
1522 {
1523  // Open dialog to set batch parameters for job
1524  // returns kFALSE if cancel is pressed
1525 
1527  // use saved values of batch parameters
1528  fBatchParameters.SetFromEnv(GUIenv, "KVDataAnalysisLauncher");
1529  Bool_t cancel;
1530  // make sure runlist is set in analyser (controls multijobs mode)
1531  GetDataAnalyser()->SetDataSet(gDataSet);
1534  if (!cancel) {
1535  // update saved batch parameter resources
1536  fBatchParameters.WriteToEnv(GUIenv, "KVDataAnalysisLauncher");
1538  }
1539  return !cancel;
1540 }
1541 
1542 
1543 
1544 
1547 
1549 {
1550  // Set the User's libraries
1551  TString ori = fUserLibraries.Data();
1552  new KVGFileList(fUserLibraries, "User's Libraries",
1553  gClient->GetRoot(), this);
1554  GUIenv->SetValue("KVDataAnalysisLauncher.UserLibraries", fUserLibraries.Data());
1557 }
1558 
1559 
1560 
1563 
1565 {
1566  // Set the User's includes
1567  TString ori = fUserIncludes.Data();
1568  new KVGDirectoryList(fUserIncludes, "User's Includes",
1569  gClient->GetRoot(), this);
1570  GUIenv->SetValue("KVDataAnalysisLauncher.UserIncludes", fUserIncludes.Data());
1573 }
1574 
1575 
1576 
1577 
1583 
1584 Bool_t KVDataAnalysisLauncher::WarningBox(const char* title, const char* msg, Bool_t confirm)
1585 {
1586  // Warning box in case of problems
1587  // if confirm=kTRUE we ask for a yes/no answer from the user:
1588  // if 'yes' is pressed, we return kTRUE, if 'no', kFALSE.
1589  // by default, only a 'dismiss' button is shown, and this method always returns kTRUE.
1590 
1591  Bool_t reply = kTRUE;
1592  if (!confirm)
1593  new TGMsgBox(gClient->GetRoot(), this, title, msg, kMBIconExclamation);
1594  else {
1595  Int_t ret_code = 0;
1596  new TGMsgBox(gClient->GetRoot(), this, title, msg, kMBIconExclamation, kMBYes | kMBNo, &ret_code);
1597  reply = (ret_code & kMBYes);
1598  }
1599  return reply;
1600 }
1601 
1602 
1603 
1604 #ifdef __WITHOUT_TGCOMBOBOX_REMOVEALL
1605 
1608 
1610 {
1611  //replaces functionality of TGComboBox::RemoveAll for ROOT versions < 5.11/02
1612 
1613  Int_t n = box->GetListBox()->GetNumberOfEntries();
1614  if (n) box->RemoveEntries(0, n - 1);
1615  if (box->GetSelectedEntry()) {
1616  ((TGTextLBEntry*)box->GetSelectedEntry())->SetTitle("");
1617  fClient->NeedRedraw(box->GetSelectedEntry());
1618  }
1619  else {
1620  box->GetTextEntry()->SetTitle("");
1621  fClient->NeedRedraw(box->GetTextEntry());
1622  }
1623 }
1624 
1626 
1627 
1630 {
1631  //replaces functionality of TGListBox::RemoveAll for ROOT versions < 5.11/02
1632 
1633  Int_t n = box->GetNumberOfEntries();
1634  if (n) box->RemoveEntries(0, n - 1);
1635  if (box->GetSelectedEntry()) {
1636  ((TGTextLBEntry*)box->GetSelectedEntry())->SetTitle("");
1637  fClient->NeedRedraw(box->GetSelectedEntry());
1638  }
1639 }
1640 
1641 #endif
1642 
1643 
1644 
1675 
1676 void KVDataAnalysisLauncher::SetResource(const TString& name, const TString& value)
1677 {
1678  // Handles resource file ".KVDataAnalysisGUIrc"
1679  // We store the current state of the interface using the following resource names:
1680  //
1681  // Repository KVDataAnalysisLauncher.Repository
1682  // DataSet KVDataAnalysisLauncher.DataSet
1683  // Task KVDataAnalysisLauncher.Task
1684  // System KVDataAnalysisLauncher.System
1685  // Trigger KVDataAnalysisLauncher.Trigger
1686  // RunsList KVDataAnalysisLauncher.RunsList
1687  // UserClass KVDataAnalysisLauncher.UserClass
1688  // KVDataSelector KVDataAnalysisLauncher.KVDataSelector
1689  // NbEventsToRead KVDataAnalysisLauncher.NbEventsToRead
1690  //
1691  // We also keep a "memory" of all selected configurations using the following
1692  // resource names:
1693  //
1694  // DataSet KVDataAnalysisLauncher.DataSet.[repository]
1695  // Task KVDataAnalysisLauncher.Task.[repository].[dataset]
1696  // System KVDataAnalysisLauncher.System.[repository].[dataset].[task]
1697  // Trigger KVDataAnalysisLauncher.Trigger.[repository].[dataset].[task].[system]
1698  // RunsList KVDataAnalysisLauncher.RunsList.[repository].[dataset].[task].[system].[trigger]
1699  // UserClass KVDataAnalysisLauncher.UserClass.[repository].[dataset].[task].[system].[trigger]
1700  // KVDataSelector KVDataAnalysisLauncher.KVDataSelector.[repository].[dataset].[task].[system].[trigger]
1701  // NbEventsToRead KVDataAnalysisLauncher.NbEventsToRead.[repository].[dataset].[task].[system].[trigger]
1702  //
1703  // N.B. [task]: it is the NAME of the task which is used in the resource name.
1704  // N.B.2. [system]: it is the name given by SystemBatchName() which is used in the resource name.
1705  // N.B.3. [trigger]: for the resource name we take "M > 4", "M>=8" "All" etc. and replace all ' ', '>' or '=' by ''
1706  // to give "M4", "M8", "All", etc.
1707 
1708  TString res, ful_res;
1709 
1710  BuildResourceName(name, res, ful_res);
1711 
1712  // save current value of resource
1713  GUIenv->SetValue(res.Data(), value);
1714 
1715  // save resource for future use if possible
1716  if (ful_res.Length()) GUIenv->SetValue(ful_res.Data(), value);
1717 
1719 }
1720 
1721 
1722 
1723 
1728 
1730 {
1731  // Handles resource file ".KVDataAnalysisGUIrc"
1732  //
1733  // We return the current value of the resource "name"
1734 
1735  TString res = name;
1736  res.Prepend("KVDataAnalysisLauncher.");
1737  return GUIenv->GetValue(res.Data(), defaultvalue);
1738 }
1739 
1740 
1741 
1742 
1755 
1757 {
1758  // Handles resource file ".KVDataAnalysisGUIrc"
1759  //
1760  // We look for a stored value of the resource "name" corresponding to the current
1761  // values of all the resources which come before "name" in the list :
1762  // Repository
1763  // DataSet
1764  // Task
1765  // These values are stored in resources with names like:
1766  // KVDataAnalysisLauncher.[name].[repository].[dataset]...
1767  //
1768  // If no stored value is found, the defaultvalue is returned
1769 
1770  TString res, ful_res;
1771 
1772  BuildResourceName(name, res, ful_res);
1773 
1774  if (!ful_res.Length()) {
1775  return GUIenv->GetValue(res.Data(), defaultvalue);
1776  }
1777 
1778  return GUIenv->GetValue(ful_res.Data(), defaultvalue);
1779 }
1780 
1781 
1782 
1783 
1786 
1788 {
1789  // Get the system name for the batch name
1790 
1791  TString tmp = GetSystem();
1792  if (tmp == "All") return GetSystem();
1793  return GetDataAnalyser()->SystemBatchName();
1794 }
1795 
1796 
1797 
1798 
1825 
1826 void KVDataAnalysisLauncher::BuildResourceName(const TString& name, TString& cur_res, TString& saved_res)
1827 {
1828  // Build the full resource names for storing DataSet, Task, etc.
1829  //
1830  // We store the current state of the interface using the following resource names:
1831  //
1832  // "name" "cur_res"
1833  // Repository KVDataAnalysisLauncher.Repository
1834  // DataSet KVDataAnalysisLauncher.DataSet
1835  // Task KVDataAnalysisLauncher.Task
1836  // UserClass KVDataAnalysisLauncher.UserClass
1837  // UserClassOptions KVDataAnalysisLauncher.UserClassOptions
1838  // NbEventsToRead KVDataAnalysisLauncher.NbEventsToRead
1839  //
1840  // We also keep a "memory" of all selected configurations using the following
1841  // resource names:
1842  //
1843  // "name" "saved_res"
1844  // DataSet KVDataAnalysisLauncher.DataSet.[repository]
1845  // Task KVDataAnalysisLauncher.Task.[repository].[dataset]
1846  //
1847  // N.B. [task]: it is the NAME of the task which is used in the resource name.
1848  //
1849  // If name = "Repository", saved_res="" as we do not save it.
1850  // If the resource cannot be saved because one of the resources that is needed to form the
1851  // full resource name has not been set, saved_res="".
1852 
1853  //Resource name for current value
1854  cur_res = name;
1855  cur_res.Prepend("KVDataAnalysisLauncher.");
1856 
1857  //Build full name for save
1858  Int_t index = -1;
1859  saved_res = "";
1860  // look for resource name in list ResourceNames
1861  TObject* resource = 0;
1862  if ((resource = ResourceNames.FindObject(name))) {
1863  //get index in resource table
1864  index = ResourceNames.IndexOf(resource);
1865  }
1866 
1867  if (index == 0) { // resource name = "Repository"; nothing more to do
1868  return;
1869  }
1870 
1871  if (index == -1) index = NbResNames; // force loop to end of list
1872 
1873  // resource name is written in format KVDataAnalysisLauncher.[name].[repository]....
1874  // where the suffixed resource values are all those in the list before the named resource
1875  // i.e. for name = "Task" we write the resource KVDataAnalysisLauncher.Task.[repository].[dataset]
1876 
1877  saved_res = cur_res;
1878  TIter next_res(&ResourceNames);
1879  Int_t i = 0;
1880  Bool_t ok = kTRUE;
1881 
1882  while ((resource = next_res()) && (i++ < index)) {
1883 
1884  TString tmp(GetResource(resource->GetName()));
1885  TString res;
1886  if (tmp == "") {
1887  // one of required resources is not set - none of following resources will be set either
1888  // we cannot save this resource
1889  ok = kFALSE;
1890  break;
1891  }
1892  if (!strcmp(resource->GetName(), "Task") && gDataSet) {
1893  // translate title to name for task
1894  KVDataAnalysisTask* tsk = gDataSet->GetAnalysisTask(tmp.Data());
1895  if (tsk) res.Form(".%s", tsk->GetName());
1896  }
1897  else {
1898  res = GetResource(resource->GetName()).Prepend(".");
1899  }
1900  saved_res += res;
1901  }
1902  if (name == "UserClassOptions") {
1903  if (GetResource("UserClass", "").Length())
1904  saved_res += GetResource("UserClass", "").Prepend(".");
1905  else ok = kFALSE;
1906  }
1907 
1908  if (!ok) saved_res = "";
1909 }
1910 
1911 
1912 
1913 
1921 
1923 {
1924  // Look at files in working directory & deduce list of user analysis classes.
1925  // We look for any file ending in '.h'. If we can find a corresponding '.cpp' or '.C' or '.cxx',
1926  // we consider that it is a user analysis class. This list is used to fill the "User Class"
1927  // drop-down list.
1928  // We add "[NEW]" at the end of the list: if selected, this will generate a new user analysis
1929  // class for the currently selected data & analysis task
1930 
1931  TSystemDirectory dir("LocDir", ".");
1932  unique_ptr<TList> lf(dir.GetListOfFiles());
1933  if (!lf.get()) return;
1934  UserClassNames->Clear();
1935  //loop over file names
1936  TIter next(lf.get());
1937  while (TObject* file = next()) {
1938 
1939  // fill list with all '.h' files
1940  TString tmp(file->GetName());
1941  if (tmp.EndsWith(".h")) {
1942  //strip '.h' from filename
1943  tmp.Remove(tmp.Index(".h"));
1944  UserClassNames->Add(new TNamed(tmp.Data(), tmp.Data()));
1945  }
1946 
1947  }
1948 
1949  // now check that implementation files exist for all '.h' we found
1950  TIter next_cl(UserClassNames);
1951  KVString imp, dec;
1952  while (TNamed* clh = (TNamed*)next_cl()) {
1953  if (!KVBase::FindClassSourceFiles(clh->GetName(), imp, dec)) clh->SetName("_INVALID_");
1954  }
1955  // remove all invalid class names
1956  while (TObject* obj = UserClassNames->FindObject("_INVALID_")) {
1957  UserClassNames->Remove(obj);
1958  delete obj;
1959  }
1960  // add [NEW] to list
1961  UserClassNames->Add(new TNamed("[NEW]", "[NEW]"));
1962 }
1963 
1964 
1965 
1966 
1969 
1971 {
1972  // Sets the list of all available user classes in the drop down list
1973 
1974 #ifdef __WITHOUT_TGCOMBOBOX_REMOVEALL
1976 #else
1978 #endif
1979  cbUserClass->Select(-1);
1980 
1981  Int_t nbcl = UserClassNames->GetEntries();
1982  Int_t i = 0;
1983  cbUserClass->AddEntry("", i++);
1984  while (i < nbcl + 1) {
1985  cbUserClass->AddEntry(UserClassNames->At(i - 1)->GetName(), i);
1986  i++;
1987  }
1988  cbUserClass->Layout();
1989 }
1990 
1991 
1992 
1993 
1997 
1999 {
2000  // Called when a user class is selected in the combo box.
2001  // Updates batch name if 'auto batch name' is selected.
2002 
2003  if (class_name == "[NEW]") {
2005  return;
2006  }
2007 
2008  // save resource
2009  SetResource("UserClassOptions", teUserOptions->GetText());
2010  SetResource("UserClass", class_name);
2011  teUserOptions->SetText(GetSavedResource("UserClassOptions", ""));
2012  SetResource("UserClassOptions", teUserOptions->GetText());
2013  if (strcmp("", class_name)) {
2016  }
2017  else btEditClass->SetEnabled(kFALSE);
2019 }
2020 
2021 
2022 
2029 
2031 {
2032  // called when user selects [NEW] in user class list
2033  // we generate a new analysis class for currently selected data & task
2034  // the source files are opened in the $EDITOR
2035  // the new class is selected for the analysis
2036 
2037  // Get name of new class
2038  TString classname;
2039  Bool_t ok;
2040  new KVInputDialog(this, "Enter name of new analysis class", &classname, &ok, "Enter name of new analysis class");
2041  // check new classname is not name of existing class
2042  KVString impfile, decfile;
2043  if (KVBase::FindClassSourceFiles(classname, impfile, decfile)) {
2044  ok = ok && WarningBox("Replacing existing class",
2045  Form("%s is the name of an existing class defined in [%s,%s].\nDo you want to overwrite this class?\n(All existing code will be lost)",
2046  classname.Data(), decfile.Data(), impfile.Data()),
2047  kTRUE);
2048  }
2049  if (ok) {
2050  gDataSet->MakeAnalysisClass(GetTask(), classname);
2052  }
2053  SetUserClassList();
2054  if (ok) {
2055  SetUserClass(classname);
2057  }
2058 }
2059 
2060 
2061 
2062 
2067 
2069 {
2070  // Sets selected user class in combo box according to e.g. a previously stored resource value.
2071  // We update the resource corresponding to the current state of the interface.
2072 
2073  // look for user class in list
2074  TGLBEntry* e = cbUserClass->FindEntry(class_name);
2075 
2076  if (e) {
2077  Int_t i = e->EntryId();
2078 #ifdef __WITHOUT_TGCOMBOBOX_SELECT_BOOL_T
2079  cbUserClass->Select(i);
2080 #else
2081  cbUserClass->Select(i, kFALSE);
2082 #endif
2083  // save current user class options
2084  // save current user class
2085  SetResource("UserClass", class_name);
2086  teUserOptions->SetText(GetSavedResource("UserClassOptions", ""));
2088  }
2089 
2090  else
2091  // unknown user class
2092  {
2093  cbUserClass->Select(-1);
2094  SetResource("UserClass", "");
2095 
2097  }
2099 }
2100 
2101 
2102 
2103 
2106 
2108 {
2109  // Returns currently selected user class name
2110 
2112  return e->GetText()->GetString();
2113  }
2114  else {
2115  return "";
2116  }
2117 }
2118 
2119 
2120 
2121 
2124 
2126 {
2127  // Remove all entries from user class combo box & disable text entry
2128 
2129 #ifdef __WITHOUT_TGCOMBOBOX_REMOVEALL
2131 #else
2133 #endif
2134  cbUserClass->Select(-1);
2137 }
2138 
2139 
2140 
2141 
2146 
2148 {
2149  // Reenable user class combo box & text entry,
2150  // fill list with all known user classes & select the one corresponding
2151  // to the current environment
2152 
2153 
2154  SetUserClassList();
2155  SetUserClass(GetSavedResource("UserClass", ""));
2158 }
2159 
2160 
2161 
2166 
2168 {
2169  // If environment variable $EDITOR is set, and if the currently selected
2170  // user class has available source files, we open them in the
2171  // user's favourite editor
2172 
2173  TString editor = gSystem->Getenv("EDITOR");
2174  if (editor == "") return;
2175  TString uclass = GetUserClass();
2176  if (uclass == "") return;
2177  KVString imp, dec;
2178  if (!KVBase::FindClassSourceFiles(uclass, imp, dec)) return;
2179  gSystem->Exec(Form("%s %s %s &", editor.Data(), imp.Data(), dec.Data()));
2180 }
2181 
2182 
2183 
2188 
2190 {
2191  // For analysis tasks which perform data conversions (raw -> recon, dst -> recon, ...)
2192  // clicking on this button will select all of the runs of the currently selected system(s)
2193  // which have not yet been converted.
2194 
2196  DeselectAll();
2197  if (stage_sel) {
2198  lvRuns->ActivateItemsWithColumnData("Run/Index", stage_sel);
2200  }
2201 }
2202 
2203 
2204 
2212 
2214 {
2215  // Called when 'Stage selection' button is pressed, for conversion jobs
2216  // which generate 'target' files from 'source' files.
2217  //
2218  // Open small GUI for user to choose:
2219  // - stage selection (i.e. select all 'source' files for which no 'target' file exists)
2220  // - date selection (i.e. select all 'source ' files for which 'target' file is outside given date range)
2221 
2222  if (fStageSelections.IsEmpty()) {
2223  fStageSelections.SetValue("Missing", true);
2224  fStageSelections.SetValue("Date", false);
2225  fStageSelections.SetValue(" - earliest", KVDatime().AsSQLString());
2226  fStageSelections.SetValue(" - latest", KVDatime().AsSQLString());
2227  }
2228  Bool_t cancel = false;
2229  auto param_gui = new KVNameValueListGUI(this, &fStageSelections, &cancel);
2230  param_gui->MutuallyExclusive({"Missing", "Date"});
2231  param_gui->EnableDependingOnBool(" - earliest", "Date");
2232  param_gui->EnableDependingOnBool(" - latest", "Date");
2233  param_gui->DisplayDialog();
2234  if (!cancel) {
2235  if (fStageSelections.GetBoolValue("Date")) {
2236  std::optional<KVDatime> Dmin, Dmax;
2237  if (!fStageSelections.GetTStringValue(" - earliest").IsWhitespace())
2238  Dmin = KVDatime(fStageSelections.GetTStringValue(" - earliest"), KVDatime::kSQL);
2239  if (!fStageSelections.GetTStringValue(" - latest").IsWhitespace())
2241  auto stage_sel = gDataSet->GetRunList_DateSelection(output_type, listofSelectedSystems, Dmin, Dmax);
2242  DeselectAll();
2243  if (stage_sel) {
2244  lvRuns->ActivateItemsWithColumnData("Run/Index", stage_sel);
2246  }
2247  }
2248  else if (fStageSelections.GetBoolValue("Missing")) {
2250  }
2251  }
2252 }
2253 
2254 
2255 
2258 
2260 {
2261  // Update available runs for current selected task (=datatype)
2262 
2263  gDataSet->UpdateAvailableRuns(source_type);
2264  // this will cause system list to be refilled in accordance with new available runfiles
2265  SetTask(GetTask());
2266 }
2267 
2268 
2269 
2270 
2275 
2277 {
2278  // Called when user presses "Runlist" button.
2279  // Open dialogue box in which a runlist can be entered.
2280  // The runs in the runlist will be selected.
2281 
2282  TString runs = listOfRuns.AsString();
2283  Bool_t ok = kFALSE;
2284  new KVInputDialog(this, "Enter list of runs", &runs, &ok);
2285  if (ok) {
2286  DeselectAll();
2287  SetRuns(runs.Data());
2288  }
2289 }
2290 
2291 
2292 
2293 
2298 
2300 {
2301  // Called when the selected runs in TGListView lvRuns change.
2302  // We update the run_index_list listOfRuns according to the current selection
2303  // we modify the limits of the 'runs per job' widget
2304 
2305  listOfRuns.Clear();
2306  auto novolist = lvRuns->GetSelectedObjects();
2307  if (novolist.GetEntries() > 0) {
2308  TIter nxt(&novolist);
2309  KVRunFile* s = 0;
2310  while ((s = (KVRunFile*)nxt())) listOfRuns.Add(s->GetRunIndex());
2311  }
2312 
2313  SetResource("RunsList", listOfRuns.AsString());
2314  if (listOfRuns.GetNValues())
2315  selectedRuns->SetText(Form("%d Selected Run%s : %s",
2317  listOfRuns.GetNValues() > 1 ? "s" : "",
2318  listOfRuns.AsString(MAX_LENGTH_SELECTED_RUNS).Data()));
2319  else
2320  selectedRuns->SetText(" ");
2322 }
2323 
2324 
2325 
2326 
2329 
2331 {
2332  // Empty displayed list of selected runs
2333  listOfRuns.Clear();
2334  SetResource("RunsList", "");
2335  selectedRuns->SetText(" ");
2337 }
2338 
2339 
int Int_t
unsigned int UInt_t
kVerticalFrame
kHorizontalFrame
ROOT::R::TRInterface & r
#define e(i)
bool Bool_t
char Char_t
constexpr Bool_t kFALSE
constexpr Bool_t kTRUE
R__EXTERN TEnv * gEnv
kEnvUser
kButtonDown
kButtonUp
#define gClient
kFDOpen
kLHintsRight
kLHintsExpandY
kLHintsLeft
kLHintsCenterY
kLHintsCenterX
kLHintsTop
kLHintsExpandX
kMBNo
kMBYes
kMBIconExclamation
kTextLeft
kTextBottom
kTextRight
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t sel
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize MapSubwindows
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize fs
char name[80]
char * Form(const char *fmt,...)
char * StrDup(const char *str)
R__EXTERN TSystem * gSystem
kS_IFDIR
virtual const Char_t * GetType() const
Definition: KVBase.h:176
static Bool_t FindClassSourceFiles(const KVString &class_name, KVString &imp_file, KVString &dec_file, const KVString &dir_name=".")
Definition: KVBase.cpp:1088
KVBatchSystem * GetDefaultBatchSystem() const
KVBatchSystem * GetBatchSystem(const Char_t *name)
Get batch system by name.
Utility GUI used for setting batch system parameters.
void Clear(Option_t *opt="") override
void cd()
Make this the default batch system.
virtual void SetBatchSystemParameters(const KVNameValueList &)
Use the parameters in the list to set all relevant parameters for batch system.
virtual void GetBatchSystemParameterList(KVNameValueList &)
Description of an experimental run in database ,,.
Definition: KVDBRun.h:41
Database class used to store information on different colliding systems studied during an experiment....
Definition: KVDBSystem.h:51
virtual void Run()
Check all task variables, then run analyser.
void SetBatchSystem(KVBatchSystem *bs)
void SetUserClassOptions(const Char_t *o="")
void SetUserLibraries(const Char_t *libs=0)
void SetAnalysisTask(KVDataAnalysisTask *at)
void SetUserClass(const UserClass &kvs, Bool_t check=kTRUE)
static KVDataAnalyser * GetAnalyser(const Char_t *plugin)
void SetUserIncludes(const Char_t *incDirs=0)
Bool_t IsUserClassValid() const
void SetNbEventToRead(Long64_t nb=0)
GUI for running data analysis tasks.
KVList ResourceNames
used by Get/SetResource
TString GetUserClass()
Returns currently selected user class name.
TList * UserClassNames
list of user classes present in working directory
void SetUserClassList()
Sets the list of all available user classes in the drop down list.
void SetRepositoryList(void)
Sets the list of all possible repositories in the repository combo box.
void DeselectAll(void)
Deselect all runs currently in the displayed list of runs.
void SetSystem(const TString &s="")
void Process(void)
Run the analysis task.
void SetTaskList(const TString &s)
void SetDataSet(const TString &ds="")
void SetUserClass(const Char_t *)
void UpdateAvailableRuns()
Update available runs for current selected task (=datatype)
Int_t NbResNames
number of names in list
void DisableUserClassList()
Remove all entries from user class combo box & disable text entry.
void SetUserIncludes(void)
Set the User's includes.
void SetTask(const TString &t="")
TString GetResource(const TString &name, const TString &defaultvalue="")
TString SystemBatchName()
Get the system name for the batch name.
void SetDataSetList(const TString &repository)
Sets the list of all available data sets in the data sets combo box.
void BuildResourceName(const TString &name, TString &, TString &)
void UserClassSelected(const TString &)
void ClearListOfSelectedRuns()
Empty displayed list of selected runs.
TString GetSavedResource(const TString &name, const TString &defaultvalue="")
Bool_t WarningBox(const char *title="Warning", const char *msg="Warning", Bool_t confirm=kFALSE)
void SelectAll(void)
Select all runs currently in the displayed list of runs.
KVDataSetAnalyser * GetDataAnalyser(KVDataAnalysisTask *task=0)
void SetResource(const TString &name, const TString &value)
void SetRuns(const TString &s="")
void SetUserLibraries(void)
Set the User's libraries.
TEnv * GUIenv
Declaration des boutons de la fenetre principale.
void SetRepository(const TString &r="")
Define and manage data analysis tasks.
KVString GetOutputDataType() const
virtual Bool_t WithUserClass() const
virtual const Char_t * GetDataAnalyser() const
virtual const Char_t * GetUserBaseClass() const
virtual const Char_t * GetPrereq() const
Manages access to one or more data repositories.
KVDataRepository * GetRepository(const Char_t *name) const
const TList * GetListOfRepositories() const
virtual Bool_t IsRemote() const
Returns kTRUE for remote repositories, kFALSE for local repositories.
virtual Bool_t IsConnected()
Always returns kTRUE for local repositories.
Pilots user analysis of experimental data.
void SetDataSet(KVDataSet *ds)
void SetRuns(const run_index_list &nl, Bool_t check=kTRUE)
void SetSystem(KVDBSystem *syst)
Set the System used in the analysis.
TString SystemBatchName() const
void SetFullRunList(const run_index_list &nl)
virtual Int_t GetNavailable() const
KVDataSet * GetDataSet(Int_t) const
Return pointer to DataSet using index in list of all datasets, index>=0.
virtual KVDataSet * GetAvailableDataSet(Int_t) const
run_index_list GetRunList(const Char_t *data_type, const KVDBSystem *sys=0) const
Definition: KVDataSet.cpp:1814
run_index_list GetRunList_DateSelection(const TString &type, const KVUnownedList &systems, std::optional< KVDatime > min_date=std::nullopt, std::optional< KVDatime > max_date=std::nullopt)
Definition: KVDataSet.cpp:1218
KVDataAnalysisTask * GetAnalysisTask(Int_t) const
Definition: KVDataSet.cpp:573
ValType GetDataSetEnv(const Char_t *type, const ValType &defval) const
Definition: KVDataSet.h:269
KVList GetListOfAvailableRunFilesForSystem(const TString &datatype, KVDBSystem *systol)
Definition: KVDataSet.cpp:628
virtual Int_t GetNtasks() const
Definition: KVDataSet.cpp:558
run_index_list GetRunList_StageSelection(const TString &other_type, const TString &base_type, KVDBSystem *sys=0, Bool_t OnlyCol=kFALSE)
Definition: KVDataSet.cpp:1272
void cd() const
Definition: KVDataSet.cpp:767
void UpdateAvailableRuns(const KVString &type)
Definition: KVDataSet.cpp:1086
bool MakeAnalysisClass(const Char_t *task, const Char_t *classname)
Definition: KVDataSet.cpp:1952
KVUnownedList GetListOfAvailableSystems(const TString &datatype)
Definition: KVDataSet.cpp:588
Extension of TDatime to handle various useful date formats.
Definition: KVDatime.h:33
@ kSQL
Definition: KVDatime.h:44
run_index_list SetRunIndexListFromString(const TString &) const
Definition: KVExpDB.cpp:733
virtual KVSeqCollection * GetSystems() const
Definition: KVExpDB.h:156
Directory dialogue box for KVDataAnalysisLauncher.
void Init(const TString &fileList, const TString &title) override
init window
KVGDirectoryList(const TString &st, const TString &titre="File list", const TGWindow *p=0, const TGWindow *main=0, Bool_t ok=kTRUE)
Createur.
TString GetFileFromDialog(void) override
Gets the file name from a TGFileDialog.
Bool_t CanAdd(const TString &s) override
tells whether the file in ths string fn can be added to the list box
File dialogue box for KVDataAnalysisLauncher.
KVGFileList(const TString &st, const TString &titre="File list", const TGWindow *p=0, const TGWindow *main=0, Bool_t ok=kTRUE)
Createur.
TGTextEntry * teFileName
void RemoveFiles()
Remove all the selected files from the TGListBox.
TGTextButton * boutRem
~KVGFileList()
Destructeur.
virtual TString GetFileFromDialog()
Gets the file name from a TGFileDialog.
void Done()
build the file list string from the content of the TGListBox
virtual void Init(const TString &fileList, const TString &title)
Init window.
TGTextButton * boutAllRem
void RemoveAllFiles()
Remove all the files from the TGListBox.
TGTextButton * boutAdd
virtual Bool_t CanAdd(const TString &s)
tells whether the file in ths string fn can be added to the list box
TGListBox * lbFileList
General purpose dialog box asking for some input in the form of a string.
Definition: KVInputDialog.h:24
Enhanced version of ROOT TGListView widget.
Definition: KVListView.h:146
virtual void SelectAll()
Definition: KVListView.h:185
virtual void UnSelectAll()
Definition: KVListView.h:189
void ActivateItemsWithColumnData(const Char_t *colname, const KVNumberList &data, Bool_t activate=kTRUE)
Definition: KVListView.h:230
virtual void Display(const TCollection *l)
Definition: KVListView.h:173
KVUnownedList GetSelectedObjects() const
Definition: KVListView.h:252
TObject * GetLastSelectedObject() const
Definition: KVListView.h:238
void ActivateItemWithColumnData(const Char_t *colname, const Char_t *data, Bool_t activate=kTRUE)
Definition: KVListView.h:218
virtual void RemoveAll()
Definition: KVListView.h:193
GUI for setting KVNameValueList parameters.
void SetValue(const Char_t *name, value_type value)
void SetFromEnv(TEnv *tenv, const TString &prefix="")
Int_t GetNpar() const
return the number of stored parameters
Bool_t IsEmpty() const
Bool_t HasBoolParameter(const Char_t *name) const
Bool_t GetBoolValue(const Char_t *name) const
TString GetTStringValue(const Char_t *name) const
void WriteToEnv(TEnv *tenv, const TString &prefix="")
Description of an individual data file in an experimental dataset.
Definition: KVRunFile.h:19
TObject * FindObject(const char *name) const override
Int_t GetSize() const override
void Clear(Option_t *option="") override
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
Definition: KVString.h:73
void Begin(TString delim) const
Definition: KVString.cpp:565
Bool_t End() const
Definition: KVString.cpp:634
KVString Next(Bool_t strip_whitespace=kFALSE) const
Definition: KVString.cpp:695
virtual void AddAll(const TCollection *col)
virtual Int_t GetEntries() const
virtual void SetOwner(Bool_t enable=kTRUE)
virtual Bool_t IsEmpty() const
virtual const char * GetValue(const char *name, const char *dflt) const
virtual void SetValue(const char *name, const char *value, EEnvLevel level=kEnvChange, const char *type=nullptr)
virtual void SaveLevel(EEnvLevel level)
static TClass * Class()
virtual void SetToolTipText(const char *text, Long_t delayms=400)
virtual void SetEnabled(Bool_t e=kTRUE)
void WaitFor(TGWindow *w)
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
virtual Int_t GetSelected() const
void Layout() override
void RemoveAll() override
virtual TGLBEntry * GetSelectedEntry() const
virtual void Select(Int_t id, Bool_t emit=kTRUE)
virtual void SetEnabled(Bool_t on=kTRUE)
virtual TGLBEntry * FindEntry(const char *s) const
virtual void AddEntry(const char *s, Int_t id)
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
void MapSubwindows() override
void Layout() override
virtual void RemoveAll()
char * fFilename
const char ** fFileTypes
char * fIniDir
virtual void Resize(TGDimension size)
void MapRaised() override
void SetTextJustify(Int_t tmode)
void SetText(const char *newText)
virtual void RemoveEntry(Int_t id=-1)
virtual void AddEntry(const char *s, Int_t id)
void Layout() override
virtual TGLBEntry * GetEntry(Int_t id) const
virtual void GetSelectedEntries(TList *selected)
virtual void RemoveEntries(Int_t from_ID, Int_t to_ID)
virtual TGLBEntry * FindEntry(const char *s) const
virtual void CloseWindow()
virtual void SetIntNumber(Long_t val, Bool_t emit=kTRUE)
virtual Long_t GetIntNumber() const
virtual Double_t GetNumber() const
TGClient * fClient
virtual void SetText(const TString &new_label)
const char * GetText() const
void SetEnabled(Bool_t flag=kTRUE)
virtual void SetText(const char *text, Bool_t emit=kTRUE)
void Clear(Option_t *option="") override
TObject * FindObject(const char *name) const override
void Add(TObject *obj) override
TObject * Remove(const TObjLinkPtr_t &lnk)
TObject * At(Int_t idx) const override
const char * GetName() const override
const char * GetTitle() const override
static TClass * Class()
virtual const char * GetName() const
virtual void Warning(const char *method, const char *msgfmt,...) const
virtual void Info(const char *method, const char *msgfmt,...) const
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
virtual Int_t IndexOf(const TObject *obj) const
Ssiz_t Length() const
int CompareTo(const char *cs, ECaseCompare cmp=kExact) const
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
const char * Data() const
Bool_t IsNull() const
TString & Prepend(char c, Ssiz_t rep=1)
Bool_t IsWhitespace() const
void Form(const char *fmt,...)
TString & Remove(EStripType s, char c)
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
virtual TList * GetListOfFiles() const
virtual void Unload(const char *module)
virtual const char * Getenv(const char *env)
virtual const char * GetIncludePath()
virtual Int_t Exec(const char *shellcmd)
virtual void SetIncludePath(const char *includePath)
virtual int GetPathInfo(const char *path, FileStat_t &buf)
virtual const char * HostName()
virtual char * ExpandPathName(const char *path)
virtual Bool_t ProcessEvents()
List of runfiles specified by run number and file index ,.
TString AsString(Int_t maxlen=0) const
Int_t GetNValues() const
void Add(const run_index_t &r)
long long Long64_t
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
int main(int argc, char **argv)
const Int_t n
ClassImp(TPyArg)