KaliVeda  1.13/01
Heavy-Ion Analysis Toolkit
KVSimDirGUI.cpp
Go to the documentation of this file.
1 //Created by KVClassFactory on Wed Jul 18 11:55:11 2012
2 //Author: John Frankland,,,
3 
4 #include "KVUnownedList.h"
5 #include "KVSimDirGUI.h"
6 #include "KVDataSetManager.h"
7 #include "KVBatchSystemManager.h"
8 #include "KVDataSet.h"
9 #include "KVDBSystem.h"
10 #include "KVDBRun.h"
11 #include "KVSimFile.h"
12 #include "KVFileDialog.h"
13 #include "KVInputDialog.h"
14 #include "KV2Body.h"
15 #include "TGLabel.h"
16 #include "TGButtonGroup.h"
17 #include "TGMsgBox.h"
18 #include "TSystem.h"
19 #include "TChain.h"
20 #include <KVDataAnalyser.h>
21 #include <KVSimDirFilterAnalyser.h>
22 #include <KVSimReader.h>
23 #include <iostream>
24 using namespace std;
25 
27 #include "KVDropDownDialog.h"
28 
30 
31 #ifdef WITH_RSQLITE
32 
35 
37 {
38  // Add a new dataset table for the given KVSimDir object
39 
40  TString ds_table_name = Form("Table_%d", ds_table_number);
41  KVSQLite::table DStable(ds_table_name);
42  DStable.add_primary_key("Id");
43  DStable.add_column("FileName", KVSQLite::column_type::TEXT);
44  DStable.add_column("TreeInfo", KVSQLite::column_type::TEXT);
45  DStable.add_column("Filtered", KVSQLite::column_type::INTEGER);
46  DStable.add_column("Events", KVSQLite::column_type::INTEGER);
47  DStable.add_column("DataSet", KVSQLite::column_type::TEXT);
48  DStable.add_column("System", KVSQLite::column_type::TEXT);
50  DStable.add_column("GeoType", KVSQLite::column_type::TEXT);
51  DStable.add_column("TreeName", KVSQLite::column_type::TEXT);
52  DStable.add_column("BranchName", KVSQLite::column_type::TEXT);
53  DStable.add_column("OrigFile", KVSQLite::column_type::TEXT);
54  DStable.add_column("FiltType", KVSQLite::column_type::TEXT);
55  DStable.add_column("Gemini", KVSQLite::column_type::INTEGER);
56  DStable.add_column("GemDecayPerEvent", KVSQLite::column_type::INTEGER);
57  fConfigDB.add_table(DStable);
58  // update name of dataset table in main table
59  fConfigDB["Datasets"]["Table"] = ds_table_name;
60  fConfigDB.update("Datasets", "Table", Form("Name=\"%s\"", sd->GetName()));
61  return ds_table_name;
62 }
63 
64 
65 
67 
69 {
70  fConfigDB.prepare_data_insertion(ds_table_name);
71  KVSQLite::table& dstable = fConfigDB[ds_table_name];
72  if (sd->GetSimDataList()->GetEntries()) {
73  TIter it1(sd->GetSimDataList());
74  KVSimFile* sf = nullptr;
75  while ((sf = (KVSimFile*)it1())) {
76  dstable["Id"].set_null();
77  dstable["FileName"] = sf->GetName();
78  dstable["TreeInfo"] = sf->GetTitle();
79  dstable["Filtered"] = 0;
80  dstable["Events"] = (Int_t)sf->GetEvents();
81  dstable["TreeName"] = sf->GetTreeName();
82  dstable["BranchName"] = sf->GetBranchName();
83  fConfigDB.insert_data_row();
84  }
85  }
86  if (sd->GetFiltDataList()->GetEntries()) {
87  TIter it1(sd->GetFiltDataList());
88  KVSimFile* sf = nullptr;
89  while ((sf = (KVSimFile*)it1())) {
90  dstable["Id"].set_null();
91  dstable["FileName"] = sf->GetName();
92  dstable["TreeInfo"] = sf->GetTitle();
93  dstable["Filtered"] = 1;
94  dstable["Events"] = (Int_t)sf->GetEvents();
95  dstable["TreeName"] = sf->GetTreeName();
96  dstable["BranchName"] = sf->GetBranchName();
97  dstable["DataSet"] = sf->GetDataSet();
98  dstable["System"] = sf->GetSystem();
99  dstable["Run"] = sf->GetRun();
100  dstable["GeoType"] = sf->GetGeometry();
101  dstable["FiltType"] = sf->GetFilterType();
102  dstable["OrigFile"] = sf->GetOriginalFile();
103  dstable["Gemini"] = sf->IsGemini();
104  dstable["GemDecayPerEvent"] = sf->GetGemDecayPerEvent();
105  fConfigDB.insert_data_row();
106  }
107  }
108  fConfigDB.end_data_insertion();
109 }
110 
111 #endif
112 
113 
117 
119  : fGuirc(".kvsimdirguirc")
120 #ifdef WITH_RSQLITE
121  , fConfigDB(gSystem->ExpandPathName("$(HOME)/.kvsimdirguidb"))
122 #endif
123 {
124  // Default constructor
125  // main frame
126 
127  fSelectedSimDir = nullptr;
128  fWithPROOF = kFALSE;
129 
130  // make Aclic create all *.so *.d files in separate temporary directories
131  //this is to avoid problems with KVParticleCondition when using PROOF
133 
134  MainFrame = new TGMainFrame(gClient->GetRoot(), 10, 10, kMainFrame | kVerticalFrame);
135  MainFrame->SetName("KaliVedaSim GUI");
136  MainFrame->SetWindowName("KaliVedaSim GUI");
137  MainFrame->Connect("CloseWindow()", "KVSimDirGUI", this, "Exit()");
138 
140 
141  TGCompositeFrame* vf = new TGVerticalFrame(hftop, 200, 500, kVerticalFrame);
142  // sim dir buttons
143  TGCompositeFrame* hf = new TGHorizontalFrame(vf, 10, 10, kHorizontalFrame);
144  BaddDir = new TGPictureButton(hf, gClient->GetPicture("package_add.xpm"));
145  hf->AddFrame(BaddDir, new TGLayoutHints(kLHintsLeft | kLHintsTop, 3, 2, 2, 2));
146  BaddDir->Resize(40, 40);
147  BaddDir->SetToolTipText("Add directory");
148  BaddDir->Connect("Clicked()", "KVSimDirGUI", this, "AddSimDir()");
149  BimpSim = new TGPictureButton(hf, gClient->GetPicture("bld_text.xpm"));
150  hf->AddFrame(BimpSim, new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 2, 2));
151  BimpSim->Resize(40, 40);
152  BimpSim->SetToolTipText("Import simulation");
153  BimpSim->Connect("Clicked()", "KVSimDirGUI", this, "ImportSimulation()");
154  BremDir = new TGPictureButton(hf, gClient->GetPicture("package_delete.xpm"));
155  hf->AddFrame(BremDir, new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 2, 2));
156  BremDir->Resize(40, 40);
157  BremDir->SetToolTipText("Remove directory");
158  BremDir->Connect("Clicked()", "KVSimDirGUI", this, "RemSimDir()");
159  BrefreshDir = new TGPictureButton(hf, gClient->GetPicture("refresh2.xpm"));
160  hf->AddFrame(BrefreshDir, new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 2, 2));
161  BrefreshDir->Resize(40, 40);
162  BrefreshDir->SetToolTipText("Update");
163  BrefreshDir->Connect("Clicked()", "KVSimDirGUI", this, "RefreshSimDir()");
167 
168  vf->AddFrame(hf, new TGLayoutHints(kLHintsTop | kLHintsLeft, 2, 2, 2, 2));
169 
170  // canvas widget
171  fDirListCanvas = new TGCanvas(vf, 172, 400);
172  // canvas viewport
174  // list tree
176 
177  popen = gClient->GetPicture("package_add.xpm");
178  pclose = gClient->GetPicture("package_add.xpm");
179 
183  fDirListTree->Connect("Clicked(TGListTreeItem*,Int_t)", "KVSimDirGUI", this, "SelectSimDir(TGListTreeItem*,Int_t)");
187 
188  hftop->AddFrame(vf, new TGLayoutHints(kLHintsExpandY | kLHintsTop, 2, 2, 2, 2));
189 
190  /* lists of data in simdir */
191  vf = new TGVerticalFrame(hftop, 600, 500, kVerticalFrame);
192  TGGroupFrame* group = new TGGroupFrame(vf, "Simulations");
193  fLVsimData = new KVListView(KVSimFile::Class(), group, 550, 200);
195  fLVsimData->SetDataColumn(0, "Name");
196  fLVsimData->SetDataColumn(1, "Info", "GetTitle");
197  fLVsimData->SetDataColumn(2, "Events");
200  group->AddFrame(fLVsimData, new TGLayoutHints(kLHintsTop | kLHintsExpandX | kLHintsExpandY, 5, 5, 10, 10));
202  group = new TGGroupFrame(vf, "Filtered Simulations");
203  fLVfiltData = new KVListView(KVSimFile::Class(), group, 550, 200);
205  fLVfiltData->SetDataColumn(0, "Simulation", "GetOriginalFile");
206  fLVfiltData->SetDataColumn(1, "DataSet");
207  fLVfiltData->SetDataColumn(2, "System");
208  fLVfiltData->SetDataColumn(3, "Run");
209  fLVfiltData->SetDataColumn(4, "Gemini", "IsGemini");
210  fLVfiltData->SetDataColumn(5, "Decay/event", "GetGemDecayPerEvent");
211  fLVfiltData->SetDataColumn(6, "FilterType");
212  fLVfiltData->SetDataColumn(7, "Events");
215  group->AddFrame(fLVfiltData, new TGLayoutHints(kLHintsTop | kLHintsExpandX | kLHintsExpandY, 5, 5, 10, 10));
217 
218  hftop->AddFrame(vf, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 10, 10, 10, 10));
219  MainFrame->AddFrame(hftop, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 1, 1, 1, 1));
220 
222  /* Analysis Tab */
223  fAnalTab = fAnalysisTabs->AddTab("Data Analysis");
225  vf = new TGVerticalFrame(fAnalTab, 600, 200, kVerticalFrame);
226  hf = new TGHorizontalFrame(vf, 10, 10, kHorizontalFrame);
227  TGLabel* lab = new TGLabel(hf, "Analysis class : ");
228  hf->AddFrame(lab, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 2, 2, 2, 2));
232  TGPictureButton* change_class = new TGPictureButton(hf, gClient->GetPicture("bld_open.png"));
234  change_class->SetToolTipText("Change class");
235  change_class->Connect("Clicked()", "KVSimDirGUI", this, "SelectAnalysisClass()");
236  hf->AddFrame(change_class, new TGLayoutHints(kLHintsCenterY | kLHintsRight, 2, 2, 2, 2));
237  vf->AddFrame(hf, new TGLayoutHints(kLHintsTop | kLHintsExpandY, 2, 2, 2, 2));
238  hf = new TGHorizontalFrame(vf, 10, 10, kHorizontalFrame);
239 
240  TGTextButton* new_anal_class = new TGTextButton(hf, "New simulated analysis class");
241  new_anal_class->Connect("Clicked()", "KVSimDirGUI", this, "NewSimulatedAnalysisClass()");
242  hf->AddFrame(new_anal_class, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 2, 10));
243  TGTextButton* new_filt_class = new TGTextButton(hf, "New filtered analysis class");
244  new_filt_class->Connect("Clicked()", "KVSimDirGUI", this, "NewFilteredAnalysisClass()");
245  hf->AddFrame(new_filt_class, new TGLayoutHints(kLHintsLeft | kLHintsCenterY));
246 
247  vf->AddFrame(hf, new TGLayoutHints(kLHintsTop | kLHintsExpandY, 2, 2, 2, 2));
248  // fCBAllEvents->Connect("Toggled(Bool_t)", "KVSimDirGUI", this, "EnableEventNumberEntry(Bool_t)");
249  // fCBAllEvents->SetState(kButtonDown, kTRUE);
250 
252 
253  /* Filter Tab */
254  fFiltTab = fAnalysisTabs->AddTab("Filtering");
256  vf = new TGHorizontalFrame(fFiltTab, 600, 200, kHorizontalFrame);
257 
258 
259  /*system and dataset*/
260  hf = new TGGroupFrame(vf, "Experimental condition", kVerticalFrame);
261  // new TGGroupFrame()
262  // lab = new TGLabel(hf, "Experimental conditions : ");
263  // hf->AddFrame(lab, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 2, 2, 2, 2));
264 
265  TGCompositeFrame* tmpf = new TGHorizontalFrame(hf, 600, 200, kHorizontalFrame);
266  fCBdataset = new TGComboBox(tmpf);
267  if (!gDataSetManager) {
269  dsm->Init();
270  }
271  // fill list of datasets
272  Int_t ndatasets = gDataSetManager->GetNtotal();
273  fCBdataset->AddEntry("Choose dataset...", 0);
274  for (int i = 1; i <= ndatasets; i++) {
276  }
277  fCBdataset->Layout();
278  fCBdataset->Resize(200, 20);
279  fCBdataset->Select(0, kFALSE);
280  tmpf->AddFrame(fCBdataset, new TGLayoutHints(kLHintsLeft | kLHintsTop, 10, 2, 2, 2));
281  fCBdataset->Connect("Selected(const char*)", "KVSimDirGUI", this, "SelectDataSet(const char*)");
282  hf->AddFrame(tmpf, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 0, 0));
283 
284  tmpf = new TGHorizontalFrame(hf, 600, 200, kHorizontalFrame);
285  fCBsystem = new TGComboBox(tmpf);
286  fCBsystem->AddEntry("Choose system...", 0);
287  fCBsystem->Layout();
288  fCBsystem->Resize(200, 20);
289  fCBsystem->Select(0, kFALSE);
290  tmpf->AddFrame(fCBsystem, new TGLayoutHints(kLHintsLeft | kLHintsTop, 10, 2, 2, 2));
291  fCBsystem->Connect("Selected(const char*)", "KVSimDirGUI", this, "SelectSystem(const char*)");
292 
293  fTESystem = new TGTextEntry(tmpf, new TGTextBuffer(200));
295  fTESystem->SetToolTipText("[Projectile_Symbol]+[Target_Symbol]@[Incident_Energy]MeV/A (ex: 129Xe+119Sn@50.0MeV/A)");
296  tmpf->AddFrame(fTESystem, new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 2, 2, 2, 2));
297  fTESystem->Connect("TextChanged(const char*)", "KVSimDirGUI", this, "UpdateSystemText(const char*)");
298 
299  hf->AddFrame(tmpf, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 0, 0));
300 
301  tmpf = new TGHorizontalFrame(hf, 600, 200, kHorizontalFrame);
302  fCBrun = new TGComboBox(tmpf);
303  fCBrun->AddEntry("Choose run...", 0);
304  fCBrun->Layout();
305  fCBrun->Resize(200, 20);
306  fCBrun->Select(0, kFALSE);
307  tmpf->AddFrame(fCBrun, new TGLayoutHints(kLHintsLeft | kLHintsTop, 10, 2, 2, 2));
308  fCBrun->Connect("Selected(const char*)", "KVSimDirGUI", this, "SelectRun(const char*)");
309 
310  // fTERunNumber = new TGTextEntry(tmpf, new TGTextBuffer(200));
311  // fTERunNumber->Resize(200, fTERunNumber->GetDefaultHeight());
312  // tmpf->AddFrame(fTERunNumber, new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 2, 2, 2, 2));
313  hf->AddFrame(tmpf, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 0, 0));
314 
315  vf->AddFrame(hf, new TGLayoutHints(kLHintsTop | kLHintsLeft, 2, 2, 10, 2));
316 
317 
318  hf = new TGHorizontalFrame(vf, 10, 10, kHorizontalFrame);
319 
320  TGButtonGroup* bgroup = new TGButtonGroup(hf, "Filter type");
321  TGRadioButton* radiob = new TGRadioButton(bgroup, "Geometric");
322  radiob = new TGRadioButton(bgroup, "Geometry+Thresholds");
323 // radiob->SetState(kButtonDown);
324  radiob = new TGRadioButton(bgroup, "Full");
325  radiob->SetState(kButtonDown);
326  bgroup->Connect("Clicked(Int_t)", "KVSimDirGUI", this, "FilterType(Int_t)");
328 // fFilterType = kFTSeuils;
329  hf->AddFrame(bgroup, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandY, 2, 2, 2, 2));
330 
331  TGVerticalFrame* vf1 = new TGVerticalFrame(hf, 30, 30);
332  bgroup = new TGButtonGroup(vf1, "Options");
333  phi_rotation_check = new TGCheckButton(bgroup, "Random phi");
334  phi_rotation_check->Connect("Toggled(Bool_t)", "KVSimDirGUI", this, "SetRandomPhi(Bool_t)");
335  phi_rotation_check->SetToolTipText("Random rotation around beam axis before detection");
336  fRandomPhi = kTRUE;
338 #ifdef WITH_GEMINI
339  gemini_decay = new TGCheckButton(bgroup, "Gemini++ decay");
340  gemini_decay->Connect("Toggled(Bool_t)", "KVSimDirGUI", this, "SetGeminiDecay(Bool_t)");
341  gemini_decay->SetToolTipText("Use Gemini++ to calculate statistical decay before detection");
343  //
344  TGHorizontalFrame* hhf = new TGHorizontalFrame(vf1, 20);
345  TGLabel* gemini_label = new TGLabel(hhf, "Decays/evt.:");
346  hhf->AddFrame(gemini_label, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 5, 2, 2, 2));
348  gemini_decays->GetNumberEntry()->SetToolTipText("Number of times to decay each event with Gemini++");
351  //
352  TGHorizontalFrame* hhhf = new TGHorizontalFrame(vf1, 20);
353  gemini_add_rot_energy = new TGCheckButton(hhhf, "Add rotational energy");
354  gemini_add_rot_energy->Connect("Toggled(Bool_t)", "KVSimDirGUI", this, "SetGeminiDecayAddRotEnergy(Bool_t)");
355  gemini_add_rot_energy->SetToolTipText("Add the rotational energy to the excitation energy for each nucleus");
356  //gemini_add_rot_energy->SetState(kButtonDown);
359  //
360 #endif
361  fGemDecay = kFALSE;
363  fGeoType = kGTROOT;
364  vf1->AddFrame(bgroup, new TGLayoutHints(kLHintsTop, 1, 1, 1, 5));
365 #ifdef WITH_GEMINI
366  vf1->AddFrame(hhf, new TGLayoutHints(kLHintsBottom, 2, 2, 2, 2));
367  vf1->AddFrame(hhhf, new TGLayoutHints(kLHintsBottom, 3, 3, 2, 4));
368 #endif
369  hf->AddFrame(vf1, new TGLayoutHints(kLHintsLeft, 2, 2, 2, 2));
370 
371  bgroup = new TGButtonGroup(hf, "Kinematics");
372  radiob = new TGRadioButton(bgroup, "CM");
373  radiob->SetState(kButtonDown);
374  radiob = new TGRadioButton(bgroup, "Lab");
375  radiob = new TGRadioButton(bgroup, "Projectile");
376  bgroup->Connect("Clicked(Int_t)", "KVSimDirGUI", this, "Kinematics(Int_t)");
377  fKine = kKCM;
378  hf->AddFrame(bgroup, new TGLayoutHints(kLHintsTop | kLHintsLeft, 20, 2, 2, 2));
379  // proof_analysis_filt = new TGPictureButton(hf, gClient->GetPicture("proof_base.xpm"));
380  // proof_analysis_filt->Connect("Pressed()", "KVSimDirGUI", this, "EnableProof()");
381  // proof_analysis_filt->Connect("Released()", "KVSimDirGUI", this, "DisableProof()");
382  // proof_analysis_filt->SetToolTipText("Enable PROOF");
383  // proof_analysis_filt->Resize(40, 40);
384  // proof_analysis_filt->AllowStayDown(kTRUE);
385  // hf->AddFrame(proof_analysis_filt, new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 250, 2, 2, 2));
386  // launch_analysis = new TGPictureButton(hf, gClient->GetPicture("query_submit.xpm"));
388  // launch_analysis->Connect("Clicked()", "KVSimDirGUI", this, "Run()");
389  // launch_analysis->SetToolTipText("Run filter");
390  // launch_analysis->Resize(40, 40);
391  // hf->AddFrame(launch_analysis, new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 5, 2, 2, 2));
392  vf->AddFrame(hf, new TGLayoutHints(kLHintsTop | kLHintsLeft, 2, 2, 10, 2));
393 
394  // hf = new TGHorizontalFrame(vf, 10, 10, kHorizontalFrame);
395  // lab= new TGLabel(hf, "Output directory : ");
396  // hf->AddFrame(lab, new TGLayoutHints(kLHintsLeft|kLHintsCenterY, 2,2,2,2));
397  // fTEOutputDir = new TGTextEntry(hf, new TGTextBuffer(256));
398  // fTEOutputDir->SetText(gSystem->pwd());
399  // fTEOutputDir->Resize(650, fTEOutputDir->GetDefaultHeight());
400  // hf->AddFrame(fTEOutputDir, new TGLayoutHints(kLHintsCenterY|kLHintsLeft, 2,2,2,2));
401  // change_class = new TGPictureButton(hf,gClient->GetPicture("bld_open.png"));
402  // change_class->Resize(fTEOutputDir->GetDefaultHeight(),fTEOutputDir->GetDefaultHeight());
403  // change_class->SetToolTipText("Change directory");
404  // change_class->Connect("Clicked()", "KVSimDirGUI", this, "ChangeOutputDirectory()");
405  // hf->AddFrame(change_class,new TGLayoutHints(kLHintsCenterY|kLHintsLeft, 2,2,2,2));
406  // vf->AddFrame(hf, new TGLayoutHints(kLHintsTop|kLHintsExpandY,2,2,2,2));
407 
409 
413 
415 
416 
417 
418  vf = new TGVerticalFrame(MainFrame, 600, 200, kVerticalFrame);
419  hf = new TGHorizontalFrame(vf, 600, 200, kHorizontalFrame);
420 
421  lab = new TGLabel(hf, "Events : ");
422  hf->AddFrame(lab, new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 2, 2, 2, 2));
423  fCBAllEvents = new TGCheckButton(hf, "all");
427  fCBAllEvents->Connect("Toggled(Bool_t)", "KVSimDirGUI", this, "EnableEventNumberEntry(Bool_t)");
429 
430 
431  proof_analysis = new TGPictureButton(hf, gClient->GetPicture("proof_base.xpm"));
432  proof_analysis->Connect("Pressed()", "KVSimDirGUI", this, "EnableProof()");
433  proof_analysis->Connect("Released()", "KVSimDirGUI", this, "DisableProof()");
437  proof_analysis->Resize(40, 40);
439 
440  TGPictureButton* launch_analysis = new TGPictureButton(hf, gClient->GetPicture("query_submit.xpm"));
441  launch_analysis->Connect("Clicked()", "KVSimDirGUI", this, "Run()");
442  launch_analysis->SetToolTipText("Run analysis/filter");
443  launch_analysis->Resize(40, 40);
444 
445  hf->AddFrame(launch_analysis, new TGLayoutHints(kLHintsCenterY | kLHintsRight, 5, 2, 2, 2));
447 
448  vf->AddFrame(hf, new TGLayoutHints(kLHintsExpandX | kLHintsTop, 0, 0, 0, 0));
449  MainFrame->AddFrame(vf, new TGLayoutHints(kLHintsExpandX | kLHintsTop, 10, 10, 15, 10));
450 
451 
453  kMWMFuncAll,
456 
458  MainFrame->MapWindow();
459  // MainFrame->Resize(200,500);
460 #ifdef WITH_RSQLITE
461  // define tables in DB if not already done
462  bool sqlite_conversion = false;
464  sqlite_conversion = true;
465  KVSQLite::table datasets("Datasets");
466  datasets.add_primary_key("Id");
467  datasets.add_column("Name", "TEXT");
468  datasets.add_column("Directory", "TEXT");
469  datasets.add_column("Table", "TEXT");
470  fConfigDB.add_table(datasets);
471  }
472  if (!sqlite_conversion) {
473  // use existing sqlite database to reconstruct simdirs
475  FillTreeList();
476  return;
477  }
478 #endif
479  // use .guirc to fill the list of sim dirs
480  KVString simdirs = fGuirc.GetValue("SimDirs", "");
481  if (simdirs != "") {
482 #ifdef WITH_RSQLITE
483  if (sqlite_conversion) {
484  // we are converting from the old TEnv back end to sqlite
485  // need to fill table of Datasets
486  fConfigDB.prepare_data_insertion("Datasets");
487  }
488  int ds_table = 0;
489 #endif
490  simdirs.Begin(" ");
491  while (!simdirs.End()) {
492  KVString simdir = simdirs.Next();
493  KVString simdirectory = fGuirc.GetValue(Form("%s.Directory", simdir.Data()), "");
494  KVSimDir* sd = new KVSimDir(simdir, simdirectory);
495 #ifdef WITH_RSQLITE
496  if (sqlite_conversion) {
497  fConfigDB["Datasets"]["Name"] = simdir;
498  fConfigDB["Datasets"]["Directory"] = simdirectory;
500  }
501 #endif
502  sd->AnalyseDirectory();
503  fListOfDirs.Add(sd);
504  }
505 #ifdef WITH_RSQLITE
506  if (sqlite_conversion) {
508  TIter itdir(&fListOfDirs);
509  KVSimDir* sd = nullptr;
510  while ((sd = (KVSimDir*)itdir())) {
511  // add table for dataset
512  TString ds_table_name = AddTableForDataSet(sd, ds_table);
513  // fill table with infos
514  FillDataSetTableWithInfos(ds_table_name, sd);
515  ++ds_table;
516  }
517  }
518 #endif
519  FillTreeList();
520  }
521 }
522 
523 
524 
525 
532 
534 {
535  // Copy constructor
536  // This ctor is used to make a copy of an existing object (for example
537  // when a method returns an object), and it is always a good idea to
538  // implement it.
539  // If your class allocates memory in its constructor(s) then it is ESSENTIAL :-)
540 
541  obj.Copy(*this);
542 }
543 
544 
545 
548 
550 {
551  // Destructor
552 }
553 
554 
555 
556 
564 
565 void KVSimDirGUI::Copy(TObject& obj) const
566 {
567  // This method copies the current state of 'this' object into 'obj'
568  // You should add here any member variables, for example:
569  // (supposing a member variable KVSimDirGUI::fToto)
570  // CastedObj.fToto = fToto;
571  // or
572  // CastedObj.SetToto( GetToto() );
573 
574  KVBase::Copy(obj);
575  //KVSimDirGUI& CastedObj = (KVSimDirGUI&)obj;
576 }
577 
578 
579 
581 
583 {
584  EmptyTreeList();
585  TIter next(&fListOfDirs);
586  TObject* o;
587  while ((o = next())) {
588  TGListTreeItem* item0 = fDirListTree->AddItem(NULL, o->GetName());
589  item0->SetPictures(popen, pclose);
590  fDirListTree->CloseItem(item0);
591  }
592 }
593 
594 
595 
597 
599 {
601  while (first) {
604  }
608 }
609 
610 
611 
613 
615 {
616  static TString dir(".");
617  TGFileInfo fi;
618  fi.fIniDir = StrDup(dir);
619  new KVFileDialog(gClient->GetDefaultRoot(), MainFrame, kKVFDDirectory, &fi);
620  if (fi.fFilename) {
621  TString simdirname;
622  Bool_t ok;
623  TString quest;
624  quest.Form("Enter name for dataset %s", fi.fIniDir);
625  new KVInputDialog(MainFrame, quest, &simdirname, &ok);
626  simdirname.ReplaceAll(" ", "_"); //no spaces in name
627  if (ok) {
628  KVSimDir* sd = new KVSimDir(simdirname, fi.fIniDir);
629  sd->AnalyseDirectory();
630  fListOfDirs.Add(sd);
631  FillTreeList();
634  // add to guirc file
635  TString simdirs = fGuirc.GetValue("SimDirs", "");
636  if (simdirs != "") simdirs += " ";
637  simdirs += simdirname;
638  fGuirc.SetValue("SimDirs", simdirs);
639  fGuirc.SetValue(Form("%s.Directory", simdirname.Data()), sd->GetDirectory());
641 #ifdef WITH_RSQLITE
642  //update database
643  int ds_table_num = 0;
644  if (fConfigDB.count("Datasets")) {
645  // get name/number of last dataset table
646  KVNameValueList table_names = fConfigDB.get_name_value_list("Datasets", "Name", "Table");
647  sscanf(table_names.GetParameter(table_names.GetNpar() - 1)->GetString(),
648  "Table_%d", &ds_table_num);
649  ++ds_table_num;
650  }
651  fConfigDB.prepare_data_insertion("Datasets");
652  fConfigDB["Datasets"]["Id"].set_null();
653  fConfigDB["Datasets"]["Name"] = simdirname;
654  fConfigDB["Datasets"]["Directory"] = sd->GetDirectory();
657  TString table_name = AddTableForDataSet(sd, ds_table_num);
658  FillDataSetTableWithInfos(table_name, sd);
659 #endif
660  }
661  }
662  dir = fi.fIniDir;
663 }
664 
665 
666 
668 
670 {
671  if (!fSelectedSimDir) return;
675 #ifdef WITH_RSQLITE
676  fConfigDB.select_data("Datasets", "Table", Form("Name=\"%s\"", fSelectedSimDir->GetName()));
677  TString ds_table_name;
678  while (fConfigDB.get_next_result()) ds_table_name = fConfigDB["Datasets"]["Table"].get_data<TString>();
679  fConfigDB.clear_table(ds_table_name);
681 #endif
682 }
683 
684 
685 
687 
689 {
690  if (!fSelectedSimDir) return;
692  // there is no way of removing a name-value pair from a TEnv!!
693  fGuirc.SetValue(Form("%s.Directory", fSelectedSimDir->GetName()), "");
694 #ifdef WITH_RSQLITE
695  // remove from datasets table
696  fConfigDB.select_data("Datasets", "Table", Form("Name=\"%s\"", fSelectedSimDir->GetName()));
697  TString ds_table_name;
698  while (fConfigDB.get_next_result()) ds_table_name = fConfigDB["Datasets"]["Table"].get_data<TString>();
699  fConfigDB.delete_data("Datasets", Form("Name=\"%s\"", fSelectedSimDir->GetName()));
700  // and delete table with dataset data
701 #endif
702  delete fSelectedSimDir;
703  fSelectedSimDir = nullptr;
704  FillTreeList();
707  // update guirc file
708  TString simdirs = "";
709  TIter next(&fListOfDirs);
710  KVSimDir* togo;
711  while ((togo = (KVSimDir*)next())) {
712  if (simdirs != "") simdirs += " ";
713  simdirs += togo->GetName();
714  fGuirc.SetValue(Form("%s.Directory", togo->GetName()), togo->GetDirectory());
715  }
716  fGuirc.SetValue("SimDirs", simdirs);
718 }
719 
720 
721 
723 
725 {
727  if (fSelectedSimDir) {
730  BremDir->SetEnabled();
731  BimpSim->SetEnabled();
733  }
734  else {
738  }
739 }
740 
741 
742 
744 
746 {
747  static TString dir(".");
748  const char* filetypes[] = {
749  "Class header files", "*.h",
750  0, 0
751  };
752  TGFileInfo fi;
753  fi.fIniDir = StrDup(dir);
754  fi.fFileTypes = filetypes;
755  new KVFileDialog(gClient->GetDefaultRoot(), MainFrame, kKVFDOpen, &fi);
756  if (fi.fFilename) {
758  Int_t idot = fAnalClassName.Index(".");
759  if (idot < 0) return;
760  fAnalClassName.Remove(idot, 2);
763  fAnalClassDir = fi.fIniDir;
764  cout << "Found class header " << gSystem->BaseName(fAnalClassHeader) << " and implementation "
765  << gSystem->BaseName(fAnalClassImp) << " in " << fAnalClassDir << endl;
766  }
767  }
768  dir = fi.fIniDir;
769 }
770 
771 
772 
774 
776 {
778 }
779 
780 
781 
783 
784 void KVSimDirGUI::SelectDataSet(const char* name)
785 {
786  KVDataSet* ds = gDataSetManager->GetDataSet(name);
787  if (ds) {
788  fDataset = name;
789  fSystem = "";
790  fRun = "";
791  ds->cd();
792  // use ROOT geometry if available
793  if (ds->GetDataSetEnv("KVMultiDetArray.ROOTGeometry", kTRUE)) {
794  GeoType(kGTROOT);
795  }
796  else {
798  }
799  KVSeqCollection* systems = 0;
800  if (gExpDB) systems = gExpDB->GetSystems();
801  fCBsystem->RemoveAll();
802  fCBsystem->AddEntry("Choose system...", 0);
803  if (systems) {
804  TIter next(systems);
805  KVDBSystem* sys;
806  int i = 1;
807  while ((sys = (KVDBSystem*)next())) {
808  fCBsystem->AddEntry(sys->GetName(), i++);
809  }
810  }
811  fCBsystem->Layout();
812  fCBsystem->Select(0, kFALSE);
813  fCBrun->RemoveAll();
814  fCBrun->AddEntry("Choose run...", 0);
815  fCBrun->Layout();
816  fCBrun->Select(0, kFALSE);
817  }
818 }
819 
820 
821 
823 
824 void KVSimDirGUI::SelectSystem(const char* sysname)
825 {
826  KVDBSystem* sys = gExpDB->GetSystem(sysname);
827  if (sys) {
828  fSystem = sysname;
829  fRun = "";
830  auto runs = sys->GetRuns();
831  KVDBRun* dbr;
832  TIter next(runs);
833  int i = 1;
834  fCBrun->RemoveAll();
835  fCBrun->AddEntry("Choose run...", 0);
836  while ((dbr = (KVDBRun*)next())) {
837  fCBrun->AddEntry(Form("%4d", dbr->GetNumber()), i++);
838  }
839  fCBrun->Layout();
840  fCBrun->Select(0, kFALSE);
841  fTESystem->SetText(sysname);
842  }
843 }
844 
845 
846 
849 
851 {
852  // called every time the text changes
853  fSystem = s;
854 }
855 
856 
857 
859 
860 void KVSimDirGUI::SelectRun(const char* run)
861 {
862  fRun = run;
863  fRun.Remove(TString::kBoth, ' ');
864  if (!fRun.IsDigit()) fRun = "";
865 }
866 
867 
868 
871 
873 {
874  // Called when "Process" button is pressed to launch the analysis
875 
876  if (fAnalysisTabs->GetCurrent() == 0) RunAnalysis("tree");
877  else if (fAnalysisTabs->GetCurrent() == 1) {
878  if (fDataset == "") { // Make sure a dataset has been chosen
879  new TGMsgBox(gClient->GetRoot(), MainFrame, "KVSimDirGUI::Run", "First choose the dataset which describes the geometry!", kMBIconExclamation);
880  return;
881  }
882  RunAnalysis("filter");
883  }
884 }
885 
886 
887 // void KVSimDirGUI::ChangeOutputDirectory()
888 // {
889 // static TString dir(".");
890 // TGFileInfo fi;
891 // fi.fIniDir = StrDup(dir);
892 // new KVFileDialog(gClient->GetDefaultRoot(), MainFrame, kKVFDDirectory, &fi);
893 // if (fi.fFilename) {
894 // fTEOutputDir->SetText(fi.fIniDir);
895 // }
896 // dir = fi.fIniDir;
897 // }
898 
899 
901 
903 {
904  unique_ptr<TList> selected_sim_runs(fLVsimData->GetSelectedObjects());
905  unique_ptr<TList> selected_filt_runs(fLVfiltData->GetSelectedObjects());
906  TList* runs_to_analyse(nullptr);
907  TList* aux_runs_to_analyse(nullptr);
908  TString analysis_task;
909  if (type == "tree") { // analysis of simulated or filtered events
910  if (!selected_sim_runs->GetEntries() && !selected_filt_runs->GetEntries()) {
911  new TGMsgBox(gClient->GetRoot(), MainFrame, "KVSimDirGUI::RunAnalysis", "Choose one or more simulated or filtered data files!", kMBIconExclamation);
912  return;
913  }
914  // if (selected_sim_runs->GetEntries() && selected_filt_runs->GetEntries()) {
915  // new TGMsgBox(gClient->GetRoot(), MainFrame, "KVSimDirGUI::RunAnalysis", "Choose EITHER simulated or filtered data files!", kMBIconExclamation);
916  // return;
917  // }
918  if (fAnalClassHeader == "" || fAnalClassImp == "") {
919  new TGMsgBox(gClient->GetRoot(), MainFrame, "KVSimDirGUI::RunAnalysis", "Choose a valid analysis class!", kMBIconExclamation);
920  return;
921  }
922  if (selected_sim_runs->GetEntries()) {
923  if (selected_filt_runs->GetEntries()) {
924  // if both simulated & filtered events are selected, we assume the user wants to analyse filtered
925  // data while having access to the original non-filtered data as an auxiliary/"friend" tree
926  runs_to_analyse = selected_filt_runs.get();
927  analysis_task = "analysis filtered";
928  aux_runs_to_analyse = selected_sim_runs.get();
929  }
930  else {
931  runs_to_analyse = selected_sim_runs.get();
932  analysis_task = "analysis simulated";
933  }
934  }
935  else {
936  runs_to_analyse = selected_filt_runs.get();
937  analysis_task = "analysis filtered";
938  }
939  }
940  else {
941  // filtering
942  if (selected_filt_runs->GetEntries()) {
943  new TGMsgBox(gClient->GetRoot(), MainFrame, "KVSimDirGUI::RunFilter", "Only simulated events can be filtered!", kMBIconExclamation);
944  return;
945  }
946  if (!selected_sim_runs->GetEntries()) {
947  new TGMsgBox(gClient->GetRoot(), MainFrame, "KVSimDirGUI::RunFilter", "Choose a simulated data file to filter!", kMBIconExclamation);
948  return;
949  }
950  runs_to_analyse = selected_sim_runs.get();
951  analysis_task = "filter simulated";
952  }
953  KVDataAnalysisTask* anTask = gDataSetManager->GetAnalysisTaskAny(analysis_task);
956  gDataAnalyser->SetFileList(runs_to_analyse);
957  if (aux_runs_to_analyse) gDataAnalyser->SetAuxFileList(aux_runs_to_analyse);
958  if (anTask->WithUserClass()) {
961  new TGMsgBox(gClient->GetRoot(), MainFrame, "KVSimDirGUI::RunAnalysis", "Compilation failed. Correct mistakes and try again!", kMBIconExclamation);
962  }
963  }
964  else if (strcmp(anTask->GetUserBaseClass(), ""))
965  gDataAnalyser->SetUserClass(anTask->GetUserBaseClass(), kFALSE);//task with default "user" class
966  Bool_t all_events = fCBAllEvents->IsDown();
967  if (!all_events)
969  else
971  Bool_t cancel_batch_job = kFALSE;
972  if (type == "filter") {
973  // set extra infos in kvsimdiranalyser for auto jobname
974  KVSimDirAnalyser* simda = dynamic_cast<KVSimDirAnalyser*>(gDataAnalyser);
976  simda->SetSystemForFilter(fSystem);
977  }
978  if (fWithPROOF) {
979  gBatchSystem->Clear();
980  KVNameValueList batchParams;
982  new KVBatchSystemParametersGUI(MainFrame, &batchParams, gDataAnalyser, &cancel_batch_job);
983  if (!cancel_batch_job) {
986  }
987  }
988  fCancelJob = kFALSE;
989  if (type == "filter") SetFilterOptions();
990  if (!cancel_batch_job && !fCancelJob) gDataAnalyser->Run();
991  selected_filt_runs.reset(nullptr);
992  selected_sim_runs.reset(nullptr);
993  RefreshSimDir();
994 }
995 
996 
997 
999 
1001 {
1002  TString geometry;
1003  if (fGeoType == kGTROOT) geometry = "ROOT";
1004  else geometry = "KV";
1005  TString kinema;
1006  if (fKine == kKCM) kinema = "cm";
1007  else if (fKine == kKProj) kinema = "proj";
1008  else kinema = "lab";
1009  TString filter;
1010  switch (fFilterType) {
1011  case kFTGeo:
1012  filter = "Geo";
1013  break;
1014  case kFTSeuils:
1015  filter = "GeoThresh";
1016  break;
1017  case kFTFull:
1018  filter = "Full";
1019  }
1020 
1021  // check system - only for ad hoc systems
1022  KVDBSystem* sys = (gExpDB ? gExpDB->GetSystem(fSystem) : nullptr);
1023  if (!sys) {
1024  KV2Body cd(fSystem.Data());
1025  // check valid ad hoc system given by user
1026  if (cd.IsZombie()) {
1027  Error("SetFilterOptions", "Please check the format of the ad hoc system name you gave");
1028  WarningBox("Bad System", "Please check the format of the ad hoc system name you gave", kFALSE);
1029  fCancelJob = kTRUE;
1030  return;
1031  }
1032  cd.CalculateKinematics();
1033  cd.Print();
1034  }
1035 
1036  TString options;
1037  options = Form("Dataset=%s,", fDataset.Data());
1038  options += Form("System=%s,", fSystem.Data());
1039  options += Form("Geometry=%s,", geometry.Data());
1040  options += Form("Filter=%s,", filter.Data());
1041  options += Form("Kinematics=%s", kinema.Data());
1042  if (fRun != "") {
1043  TString r;
1044  r.Form(",Run=%s", fRun.Data());
1045  options += r;
1046  }
1047  if (!fRandomPhi) options += ",PhiRot=no";
1048  if (fGemDecay) {
1049  options += ",Gemini=yes";
1050  options += Form(",GemDecayPerEvent=%d", (Int_t)gemini_decays->GetNumber());
1051 
1052  if (fGemAddRotEner) options += Form(",GemAddRotEner=yes");
1053  else options += Form(",GemAddRotEner=no");
1054  }
1055 
1057 }
1058 
1059 
1060 
1063 
1065 {
1066  // Import simulation data from currently selected directory
1067 
1068  const char* filetypes[] = {
1069  "All files", "*.*",
1070  0, 0
1071  };
1072  TGFileInfo fi;
1074  fi.fFileTypes = filetypes;
1075  fi.SetMultipleSelection(true);
1076 
1077  new KVFileDialog(gClient->GetDefaultRoot(), MainFrame, kKVFDOpen, &fi);
1078 
1079  bool one_file = (!fi.fMultipleSelection && fi.fFilename);
1080  bool many_files = (fi.fMultipleSelection && fi.fFileNamesList);//may only be one
1081  if (one_file || many_files) {
1082  // set up list of KVSimReader plugins
1083  KVString plugins = KVBase::GetListOfPlugins("KVSimReader");
1084  KVString choices;
1085  plugins.Begin(" ");
1086  while (!plugins.End()) {
1087  // get URI corresponding to plugin
1088  KVString uri = KVBase::GetPluginURI("KVSimReader", plugins.Next());
1089  if (choices.Length()) choices += " ";
1090  choices += uri;
1091  }
1092  // get model from user
1093  TString model;
1094  Bool_t ok;
1095  new KVDropDownDialog(MainFrame, "Choose the simulation model and type of events", choices, 0, &model, &ok);
1096  if (ok) {
1097 
1098  if (one_file) {
1099  unique_ptr<KVSimReader> SR(KVSimReader::MakeSimReader(model));
1100  SR->SetOutputDirectory(fSelectedSimDir->GetDirectory());
1101  SR->ConvertAndSaveEventsInFile(fi.fFilename);
1102  }
1103  else {
1104  if (fi.fFileNamesList->GetEntries() == 1) {
1105  unique_ptr<KVSimReader> SR(KVSimReader::MakeSimReader(model));
1106  SR->SetOutputDirectory(fSelectedSimDir->GetDirectory());
1107  SR->ConvertAndSaveEventsInFile(fi.fFileNamesList->First()->GetName());
1108  }
1109  else {
1110  TIter it(fi.fFileNamesList);
1111  TObject* o;
1112  int i = 1;
1113  while ((o = it())) {
1114  unique_ptr<KVSimReader> SR(KVSimReader::MakeSimReader(model));
1115  SR->SetMultiFiles();
1116  SR->SetFileIndex(i++);
1117  SR->SetOutputDirectory(fSelectedSimDir->GetDirectory());
1118  SR->ConvertAndSaveEventsInFile(o->GetName());
1119  }
1120  }
1121  }
1122 
1123  RefreshSimDir();
1124  }
1125  }
1126  else if (fi.fMultipleSelection && fi.fFileNamesList) {
1127  fi.fFileNamesList->ls();
1128  }
1129 }
1130 
1131 
1132 
1135 
1137 {
1138  // Get name of new class
1139  TString classname;
1140  Bool_t ok;
1141  new KVInputDialog(MainFrame, "Enter name of new analysis class", &classname, &ok, "Enter name of new analysis class");
1142  // check new classname is not name of existing class
1143  KVString impfile, decfile;
1144  if (KVBase::FindClassSourceFiles(classname, impfile, decfile)) {
1145  ok = ok && WarningBox("Replacing existing class",
1146  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)",
1147  classname.Data(), decfile.Data(), impfile.Data()),
1148  kTRUE);
1149  }
1150  if (ok) {
1151  KVSimDirFilterAnalyser::Make(classname);
1152  }
1153 }
1154 
1155 
1156 
1159 
1161 {
1162  // Get name of new class
1163  TString classname;
1164  Bool_t ok;
1165  new KVInputDialog(MainFrame, "Enter name of new analysis class", &classname, &ok, "Enter name of new analysis class");
1166  // check new classname is not name of existing class
1167  KVString impfile, decfile;
1168  if (KVBase::FindClassSourceFiles(classname, impfile, decfile)) {
1169  ok = ok && WarningBox("Replacing existing class",
1170  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)",
1171  classname.Data(), decfile.Data(), impfile.Data()),
1172  kTRUE);
1173  }
1174  if (ok) {
1175  KVSimDirAnalyser::Make(classname);
1176  }
1177 }
1178 
1179 
1180 
1186 
1187 Bool_t KVSimDirGUI::WarningBox(const char* title, const char* msg, Bool_t confirm)
1188 {
1189  // Warning box in case of problems
1190  // if confirm=kTRUE we ask for a yes/no answer from the user:
1191  // if 'yes' is pressed, we return kTRUE, if 'no', kFALSE.
1192  // by default, only a 'dismiss' button is shown, and this method always returns kTRUE.
1193 
1194  Bool_t reply = kTRUE;
1195  if (!confirm)
1196  new TGMsgBox(gClient->GetRoot(), MainFrame, title, msg, kMBIconExclamation);
1197  else {
1198  Int_t ret_code = 0;
1199  new TGMsgBox(gClient->GetRoot(), MainFrame, title, msg, kMBIconExclamation, kMBYes | kMBNo, &ret_code);
1200  reply = (ret_code & kMBYes);
1201  }
1202  return reply;
1203 }
1204 
1205 
1206 #ifdef WITH_RSQLITE
1207 
1210 
1212 {
1213  // Rebuild all KVSimDir/KVSimFile objects from information in sqlite DB
1214 
1215  fConfigDB.select_data("Datasets");
1216  KVNameValueList tables;
1217  while (fConfigDB.get_next_result()) {
1218  fListOfDirs.Add(new KVSimDir(fConfigDB["Datasets"]["Name"].get_data<TString>(),
1219  fConfigDB["Datasets"]["Directory"].get_data<TString>()));
1220  tables.SetValue(fConfigDB["Datasets"]["Name"].get_data<TString>(),
1221  fConfigDB["Datasets"]["Table"].get_data<TString>());
1222  }
1223  for (int i = 0; i < tables.GetNpar(); ++i) {
1225  fConfigDB.select_data(tables.GetValue<TString>(i));
1226  KVSQLite::table& dstable = fConfigDB[tables.GetValue<TString>(i)];
1227  while (fConfigDB.get_next_result()) {
1228  if (dstable["Filtered"].get_data<int>()) {
1229  // filtered/reconstructed data
1230  KVSimFile* f = new KVSimFile(
1231  sd,
1232  dstable["FileName"].get_data<TString>(), dstable["TreeInfo"].get_data<TString>(),
1233  dstable["Events"].get_data<int>(), dstable["TreeName"].get_data<TString>(),
1234  dstable["BranchName"].get_data<TString>(), dstable["DataSet"].get_data<TString>(),
1235  dstable["System"].get_data<TString>(), dstable["Run"].get_data<int>(),
1236  dstable["GeoType"].get_data<TString>(), dstable["OrigFile"].get_data<TString>(),
1237  dstable["FiltType"].get_data<TString>()
1238  );
1239  f->SetGemini(dstable["Gemini"].get_data<bool>());
1240  if (f->IsGemini()) f->SetGemDecayPerEvent(dstable["GemDecayPerEvent"].get_data<int>());
1241  sd->AddFiltData(f);
1242  }
1243  else {
1244  // simulation data
1245  KVSimFile* f = new KVSimFile(
1246  sd,
1247  dstable["FileName"].get_data<TString>(), dstable["TreeInfo"].get_data<TString>(),
1248  dstable["Events"].get_data<int>(), dstable["TreeName"].get_data<TString>(),
1249  dstable["BranchName"].get_data<TString>());
1250  sd->AddSimData(f);
1251  }
1252  }
1253  }
1254 }
1255 
1256 #endif
1257 
int Int_t
kVerticalFrame
kHorizontalFrame
kMainFrame
KVBatchSystemManager * gBatchSystemManager
KVBatchSystem * gBatchSystem
KVDataAnalyser * gDataAnalyser
KVDataSetManager * gDataSetManager
KVExpDB * gExpDB
Definition: KVExpDB.cpp:13
@ kKVFDOpen
Definition: KVFileDialog.h:32
@ kKVFDDirectory
Definition: KVFileDialog.h:33
ClassImp(KVPartitionList) void KVPartitionList
Initialisation.
ROOT::R::TRInterface & r
#define f(i)
const Bool_t kFALSE
bool Bool_t
const Bool_t kTRUE
kEnvUser
kButtonDown
kButtonUp
#define gClient
kMWMFuncAll
kMWMDecorAll
kMWMInputModeless
kLHintsRight
kLHintsExpandY
kLHintsLeft
kLHintsCenterY
kLHintsBottom
kLHintsTop
kLHintsExpandX
kMBNo
kMBYes
kMBIconExclamation
int type
int quest[100]
char * Form(const char *fmt,...)
char * StrDup(const char *str)
R__EXTERN TSystem * gSystem
Relativistic binary kinematics calculator.
Definition: KV2Body.h:165
void Print(Option_t *opt="") const
Definition: KV2Body.cpp:814
void CalculateKinematics()
Definition: KV2Body.cpp:678
Base class for KaliVeda framework.
Definition: KVBase.h:141
static Bool_t FindClassSourceFiles(const Char_t *class_name, KVString &imp_file, KVString &dec_file, const Char_t *dir_name=".")
Definition: KVBase.cpp:1102
static const Char_t * GetListOfPlugins(const Char_t *base)
Definition: KVBase.cpp:1260
static const Char_t * GetPluginURI(const Char_t *base, const Char_t *plugin)
Definition: KVBase.cpp:1177
virtual void Copy(TObject &) const
Make a copy of this object.
Definition: KVBase.cpp:394
Handles list of all available batch systems for processing non-interactive data analysis tasks.
KVBatchSystem * GetDefaultBatchSystem() const
Utility GUI used for setting batch system parameters.
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 &)
virtual void Clear(Option_t *opt="")
virtual Int_t GetNumber() const
Definition: KVDBRecord.h:72
Description of an experimental run in database ,.
Definition: KVDBRun.h:35
Database class used to store information on different colliding systems studied during an experiment.
Definition: KVDBSystem.h:51
KVUnownedList * GetRuns() const
Returns a sorted list of all the runs associated with this system.
Definition: KVDBSystem.h:116
virtual void Run()
Check all task variables, then run analyser.
virtual void SetAuxFileList(TList *)
void SetBatchSystem(KVBatchSystem *bs)
void SetUserClassOptions(const Char_t *o="")
void SetUserClass(const Char_t *kvs, Bool_t check=kTRUE)
void SetAnalysisTask(KVDataAnalysisTask *at)
virtual void SetFileList(TList *)
static KVDataAnalyser * GetAnalyser(const Char_t *plugin)
Bool_t IsUserClassValid() const
void SetNbEventToRead(Long64_t nb=0)
Define and manage data analysis tasks.
virtual Bool_t WithUserClass() const
virtual const Char_t * GetDataAnalyser() const
virtual const Char_t * GetUserBaseClass() const
Manage all datasets contained in a given data repository.
virtual Bool_t Init(KVDataRepository *=0)
virtual Int_t GetNtotal() const
KVDataAnalysisTask * GetAnalysisTaskAny(const Char_t *keywords) const
KVDataSet * GetDataSet(Int_t) const
Return pointer to DataSet using index in list of all datasets, index>=0.
Manage an experimental dataset corresponding to a given experiment or campaign.
Definition: KVDataSet.h:207
const Char_t * GetDataSetEnv(const Char_t *type, const Char_t *defval="") const
Definition: KVDataSet.cpp:758
void cd() const
Definition: KVDataSet.cpp:736
Ask user to choose between several options in a drop-down list.
virtual KVDBSystem * GetSystem(const Char_t *system) const
Definition: KVExpDB.h:84
virtual KVSeqCollection * GetSystems() const
Definition: KVExpDB.h:88
Modified version of TGFileDialog file selection dialog.
Definition: KVFileDialog.h:48
General purpose dialog box asking for some input in the form of a string.
Definition: KVInputDialog.h:23
Enhanced version of ROOT TGListView widget.
Definition: KVListView.h:145
virtual void ActivateSortButtons()
Definition: KVListView.cpp:72
virtual void SetDataColumns(Int_t ncolumns)
Definition: KVListView.cpp:91
virtual void Display(const TCollection *l)
Definition: KVListView.h:172
TList * GetSelectedObjects() const
Definition: KVListView.h:244
virtual void RemoveAll()
Definition: KVListView.h:189
void AllowContextMenu(Bool_t on=kTRUE)
Definition: KVListView.h:282
virtual void SetDataColumn(Int_t index, const Char_t *name, const Char_t *method="", Int_t mode=kTextCenterX)
Definition: KVListView.cpp:106
Handles lists of named parameters with different types, a list of KVNamedParameter objects.
KVNamedParameter * GetParameter(Int_t idx) const
return the parameter object with index idx
void SetValue(const Char_t *name, value_type value)
Int_t GetNpar() const
return the number of stored parameters
value_type GetValue(const Char_t *name) const
const Char_t * GetString() const
int get_number_of_tables() const
Definition: SQLiteDB.h:430
int count(const TString &table, const TString &column="*", const TString &selection="", bool distinct=false) const
Definition: SQLiteDB.cpp:739
void delete_data(const TString &table, const TString &selection="")
Definition: SQLiteDB.cpp:834
void insert_data_row()
Definition: SQLiteDB.cpp:393
void end_data_insertion()
Definition: SQLiteDB.cpp:433
bool select_data(const TString &tables, const TString &columns="*", const TString &selection="", bool distinct=false, const TString &anything_else="") const
Definition: SQLiteDB.cpp:493
KVNameValueList get_name_value_list(const TString &table, const TString &name_column, const TString &value_column, const TString &selection="", const TString &anything_else="")
Definition: SQLiteDB.cpp:675
bool get_next_result() const
Definition: SQLiteDB.cpp:595
void add_table(const table &)
Definition: SQLiteDB.cpp:219
bool prepare_data_insertion(const TString &)
Definition: SQLiteDB.cpp:269
void clear_table(const TString &name)
Delete all data from table.
Definition: SQLiteDB.cpp:723
const column & add_primary_key(const TString &name)
Definition: SQLiteDB.cpp:1152
column & add_column(const KVSQLite::column &c)
Definition: SQLiteDB.cpp:1115
KaliVeda extensions to ROOT collection classes.
virtual void Add(TObject *obj)
virtual TObject * Remove(TObject *obj)
Remove object from list.
virtual TObject * FindObject(const char *name) const
Class piloting analyses of simulated data.
void SetDataSetForFilter(const TString &f)
void SetSystemForFilter(const TString &f)
static void Make(const Char_t *kvsname="MySimulatedAnalysis")
Generate a new simulated analysis selector class.
static void Make(const Char_t *kvsname="MyFilteredAnalysis")
Generate a new filtered analysis selector class.
GUI for analysing and filtering simulated data.
Definition: KVSimDirGUI.h:35
TGPictureButton * BremDir
Definition: KVSimDirGUI.h:45
void SelectDataSet(const char *)
void ReconstructSimDirsFromDB()
Rebuild all KVSimDir/KVSimFile objects from information in sqlite DB.
void NewFilteredAnalysisClass()
Get name of new class.
TGCheckButton * gemini_add_rot_energy
Definition: KVSimDirGUI.h:80
Bool_t fGemAddRotEner
Definition: KVSimDirGUI.h:81
TGCompositeFrame * fAnalTab
analysis tab
Definition: KVSimDirGUI.h:58
KVSQLite::database fConfigDB
Definition: KVSimDirGUI.h:104
void RemSimDir()
TGComboBox * fCBrun
Definition: KVSimDirGUI.h:71
TGComboBox * fCBdataset
Definition: KVSimDirGUI.h:69
TGTextEntry * fTESystem
Definition: KVSimDirGUI.h:61
void EmptyTreeList()
void RefreshSimDir()
void SelectAnalysisClass()
KVString fRun
Definition: KVSimDirGUI.h:74
TGCompositeFrame * fFiltTab
filter tab
Definition: KVSimDirGUI.h:59
Bool_t fGemDecay
Definition: KVSimDirGUI.h:78
void UpdateSystemText(const char *)
called every time the text changes
void SetFilterOptions()
void AddSimDir()
TGCheckButton * fCBAllEvents
Definition: KVSimDirGUI.h:66
virtual ~KVSimDirGUI()
Destructor.
void NewSimulatedAnalysisClass()
Get name of new class.
KVList fListOfDirs
Definition: KVSimDirGUI.h:38
TGMainFrame * MainFrame
Definition: KVSimDirGUI.h:41
TGCheckButton * gemini_decay
Definition: KVSimDirGUI.h:77
TGViewPort * fDirListViewPort
Definition: KVSimDirGUI.h:49
TGNumberEntry * fNENumberEvents
Definition: KVSimDirGUI.h:67
KVString fAnalClassName
Definition: KVSimDirGUI.h:62
void SelectSystem(const char *)
void FillTreeList()
Int_t fFilterType
Definition: KVSimDirGUI.h:96
TGComboBox * fCBsystem
Definition: KVSimDirGUI.h:70
KVSimDir * fSelectedSimDir
Definition: KVSimDirGUI.h:39
void Copy(TObject &) const
TGTab * fAnalysisTabs
Definition: KVSimDirGUI.h:57
KVString fSystem
Definition: KVSimDirGUI.h:73
TGListTree * fDirListTree
Definition: KVSimDirGUI.h:50
TGCanvas * fDirListCanvas
Definition: KVSimDirGUI.h:48
const TGPicture * pclose
used for list tree items
Definition: KVSimDirGUI.h:52
const TGPicture * popen
used for list tree items
Definition: KVSimDirGUI.h:51
KVString fAnalClassHeader
Definition: KVSimDirGUI.h:63
KVListView * fLVfiltData
Definition: KVSimDirGUI.h:55
void Run()
void ChangeOutputDirectory();
void FillDataSetTableWithInfos(TString ds_table_name, KVSimDir *sd)
Definition: KVSimDirGUI.cpp:68
TGPictureButton * proof_analysis
TGTextEntry* fTEOutputDir;.
Definition: KVSimDirGUI.h:100
KVString fAnalClassImp
Definition: KVSimDirGUI.h:64
TGNumberEntry * gemini_decays
Definition: KVSimDirGUI.h:79
TGCheckButton * phi_rotation_check
Definition: KVSimDirGUI.h:75
Int_t fKine
Definition: KVSimDirGUI.h:98
KVString fAnalClassDir
Definition: KVSimDirGUI.h:65
void EnableEventNumberEntry(Bool_t)
Int_t fGeoType
Definition: KVSimDirGUI.h:97
void RunAnalysis(const TString &type)
Bool_t WarningBox(const char *title, const char *msg, Bool_t confirm)
TGPictureButton * BaddDir
Definition: KVSimDirGUI.h:43
Bool_t fWithPROOF
=kTRUE when running with PROOF-lite
Definition: KVSimDirGUI.h:106
void GeoType(Int_t i)
Definition: KVSimDirGUI.h:145
Bool_t fCancelJob
if job parameters are not valid
Definition: KVSimDirGUI.h:107
Bool_t fRandomPhi
Definition: KVSimDirGUI.h:76
KVListView * fLVsimData
Definition: KVSimDirGUI.h:54
TGPictureButton * BimpSim
Definition: KVSimDirGUI.h:44
TGPictureButton * BrefreshDir
Definition: KVSimDirGUI.h:46
TGTextEntry * fTEAnalysisClassFileName
Definition: KVSimDirGUI.h:60
void SelectSimDir(TGListTreeItem *, Int_t)
TString AddTableForDataSet(KVSimDir *sd, int ds_table_number)
Add a new dataset table for the given KVSimDir object.
Definition: KVSimDirGUI.cpp:36
void ImportSimulation()
Import simulation data from currently selected directory.
KVString fDataset
Definition: KVSimDirGUI.h:72
void SelectRun(const char *)
Handle directory containing simulated and/or filtered simulated data ,.
Definition: KVSimDir.h:43
virtual const KVList * GetFiltDataList() const
Definition: KVSimDir.h:72
void AddSimData(KVSimFile *)
Definition: KVSimDir.cpp:263
virtual void AnalyseDirectory()
Definition: KVSimDir.cpp:126
virtual const KVList * GetSimDataList() const
Definition: KVSimDir.h:68
void AddFiltData(KVSimFile *)
Definition: KVSimDir.cpp:272
virtual const Char_t * GetDirectory() const
Definition: KVSimDir.h:60
Handle file containing simulated and/or filtered simulated data ,.
Definition: KVSimFile.h:18
const Char_t * GetSystem() const
Definition: KVSimFile.h:80
const Char_t * GetBranchName() const
Definition: KVSimFile.h:107
const Char_t * GetOriginalFile() const
Definition: KVSimFile.h:112
Int_t GetRun() const
Definition: KVSimFile.h:90
const Char_t * GetFilterType() const
Definition: KVSimFile.h:85
Bool_t IsGemini() const
Definition: KVSimFile.h:48
const Char_t * GetGeometry() const
Definition: KVSimFile.h:95
const Char_t * GetDataSet() const
Definition: KVSimFile.h:75
Long64_t GetEvents() const
Definition: KVSimFile.h:70
const Char_t * GetTreeName() const
Definition: KVSimFile.h:102
Int_t GetGemDecayPerEvent() const
Definition: KVSimFile.h:60
static KVSimReader * MakeSimReader(const char *model_uri)
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
Definition: KVString.h:72
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 ls(Option_t *option="") const
virtual Int_t GetEntries() 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)
virtual void SetToolTipText(const char *text, Long_t delayms=400)
virtual void AllowStayDown(Bool_t a)
virtual void SetEnabled(Bool_t e=kTRUE)
virtual void SetContainer(TGFrame *f)
virtual void MapSubwindows()
TGViewPort * GetViewPort() const
virtual void SetDisabledAndSelected(Bool_t)
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
virtual Bool_t IsDown() const
virtual void RemoveAll()
virtual void Select(Int_t id, Bool_t emit=kTRUE)
virtual void AddEntry(const char *s, Int_t id)
virtual void Layout()
virtual void SetLayoutManager(TGLayoutManager *l)
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
virtual UInt_t GetDefaultWidth() const
virtual void ChangeOptions(UInt_t options)
virtual TGDimension GetDefaultSize() const
virtual void MapSubwindows()
TList * fFileNamesList
char * fFilename
void SetMultipleSelection(Bool_t option)
const char ** fFileTypes
char * fIniDir
Bool_t fMultipleSelection
virtual UInt_t GetDefaultHeight() const
virtual void Resize(TGDimension size)
virtual void MapWindow()
virtual void Layout()=0
virtual const char * GetText() const=0
virtual void SetPictures(const TGPicture *, const TGPicture *)
TGListTreeItem * GetFirstItem() const
Int_t DeleteItem(TGListTreeItem *item)
void AddItem(const char *string)
void CloseItem(TGListTreeItem *item)
void SetMWMHints(UInt_t value, UInt_t funcs, UInt_t input)
void SetWindowName(const char *name=0)
TGNumberEntryField * GetNumberEntry() const
virtual void SetState(Bool_t enable=kTRUE)
virtual Double_t GetNumber() const
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
virtual TGCompositeFrame * AddTab(const char *text)
virtual TGLayoutManager * GetLayoutManager() const
Int_t GetCurrent() const
virtual void SetToolTipText(const char *text, Long_t delayms=500)
virtual void SetText(const char *text, Bool_t emit=kTRUE)
virtual void SetName(const char *name)
virtual TObject * First() const
virtual const char * GetName() const
virtual const char * GetTitle() const
virtual const char * GetName() const
R__ALWAYS_INLINE Bool_t IsZombie() const
virtual void Error(const char *method, const char *msgfmt,...) const
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Ssiz_t Length() const
Bool_t IsDigit() const
const char * Data() const
TString & Remove(EStripType s, char c)
TString & ReplaceAll(const char *s1, const char *s2)
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
virtual const char * BaseName(const char *pathname)
virtual void SetBuildDir(const char *build_dir, Bool_t isflat=kFALSE)
virtual const char * TempDirectory() const
long long Long64_t
const long double s
Definition: KVUnits.h:94