KaliVeda
Toolkit for HIC analysis
KVSimDirGUI.h
1 
4 #ifndef __KVSIMDIRGUI_H
5 #define __KVSIMDIRGUI_H
6 #include "TSystem.h"
7 #include "KVBase.h"
8 #include "KVList.h"
9 #include "TGListTree.h"
10 #include "TGFrame.h"
11 #include "TGTab.h"
12 #include "TEnv.h"
13 #include "KVDataSetManager.h"
14 #include "TGTextEntry.h"
15 #include "TGNumberEntry.h"
16 #include "TGButton.h"
17 #include "TGComboBox.h"
18 #include <TGLabel.h>
19 #include <TGMenu.h>
20 #include <TGStatusBar.h>
21 #include "RQ_OBJECT.h"
22 #include "TApplication.h"
23 #include "KVListView.h"
24 #include "KVSimDir.h"
25 #include "KVInputDialog.h"
26 #include "KVDataAnalyser.h"
27 #ifdef WITH_RSQLITE
28 #include "SQLiteDB.h"
29 #endif
30 class TChain;
31 
168 class KVSimDirGUI : public KVBase {
169  RQ_OBJECT("KVSimDirGUI")
170 
171  KVList fListOfDirs;
172  KVSimDir* fSelectedSimDir;
173 
174  TGMainFrame* MainFrame;
175  TGStatusBar* fStatusBar;
176  /* picture buttons for managing directories */
177  TGPictureButton* BaddDir;
178  TGPictureButton* BimpSim;
179  TGPictureButton* BremDir;
180  TGPictureButton* BrefreshDir;
181  /* list tree for managing directories */
182  TGCanvas* fDirListCanvas;
183  TGViewPort* fDirListViewPort;
184  TGListTree* fDirListTree;
185  const TGPicture* popen;
186  const TGPicture* pclose;
187  /* lists of data */
188  KVListView* fLVsimData;
189  KVListView* fLVfiltData;
190  KVDataAnalyser::UserClass fAnalClass;
191  TGCheckButton* fCBAllEvents;
192  TGNumberEntry* fNENumberEvents;
193  KVString fDataset;
194  KVString fSystem, fReactionKinematics;
195  Int_t fRun = 0;
196  KVString fDataQualityAudit;
197  KVString fExtensibleIDs;
198  Bool_t fCustomKinematics = false;
199  Bool_t fRandomPhi = false;
200  Bool_t fGemDecay = false;
201  Bool_t fGemAddRotEner = false;
202  Int_t fGemDecayPerEvent = 1;
203  enum {
204  kFTGeo = 1,
205  kFTSeuils,
206  kFTFull
207  };
208  enum {
209  kGTKaliVeda = 1,
210  kGTROOT
211  };
212  enum {
213  kKCM = 1,
214  kKLab,
215  kKProj
216  };
217  Int_t fFilterType;
218  Int_t fGeoType;
219  Int_t fKine;
221  TGPictureButton* proof_analysis;
222  TGPictureButton* proof_analysis_ana;
223  TEnv fGuirc;
224 #ifdef WITH_RSQLITE
225  KVSQLite::database fConfigDB;
226 #endif
227  Bool_t fWithPROOF;
228  Bool_t fCancelJob;
229  Bool_t fFilterMode{false}, fAnalysisMode{true};
230 protected:
231  void SetFilterOptions();
232 #ifdef WITH_RSQLITE
233  TString AddTableForDataSet(KVSimDir* sd, int ds_table_number);
234  void FillDataSetTableWithInfos(TString ds_table_name, KVSimDir* sd);
235  void ReconstructSimDirsFromDB();
236 #endif
237 
238 public:
239  struct menu_struct {
243 
245 
246  struct mode_struct {
249  TString type = "mode_struct";
251  enum items {
253  filter
254  };
255  void handle_me(Int_t i)
256  {
257  switch (i) {
258  case analysis:
259  if (!_parent_gui->IsAnalysisMode()) {
262  }
263  break;
264  case filter:
265  if (!_parent_gui->IsFilterMode()) {
268  }
269  }
270  }
271  };
273 
277  TString type = "analysis_struct";
280  enum items {
284  };
285  void handle_me(Int_t i)
286  {
287  switch (i) {
290  break;
293  break;
296  break;
297  }
298  }
299  };
301 
302  struct filter_struct {
305  TString type = "filter_struct";
315  int last_run;
316  int last_dqa = 0;
317  struct DQA_entry {
318  std::string name;
320  };
321 
322  std::map<int, DQA_entry> DQA_map;
323  enum items {
337  no_run_number = 2000
338  };
339  void handle_me(Int_t i)
340  {
341  static int last_checked_dqa = 0;
342 
343  if (i < first_dataset) {
345  if (i >= geometric_filter && i <= full_filter) {
348  }
349  else if (i >= kine_CM && i <= kine_proj) {
350  _parent_gui->Kinematics(i - kine_CM + 1);
352  }
353  else if (i == random_phi) {
355  _parent_gui->SetRandomPhi(false);
357  }
358  else {
359  _parent_gui->SetRandomPhi(true);
361  }
362  }
363  else if (i == use_gemini) {
365  _parent_gui->SetGeminiDecay(false);
369  }
370  else {
374  }
375  }
376  else if (i == add_rot_energy) {
380  }
381  else {
384  }
385  }
386  }
387  else if (i < ad_hoc_reaction) {
389  geometry->RCheckEntry(i, first_dataset, first_dataset + ndatasets);
391  _parent_gui->SelectDataSet(gDataSetManager->GetDataSet(i - first_dataset)->GetName());
392  }
393  else if (i < data_quality_audits) {
395  switch (i) {
396  case ad_hoc_reaction: {
397  bool ok_pressed = true;
398  TString answer = "[Projectile]+[Target]@[Energy]MeV/A";
399  new KVInputDialog(_parent_gui->MainFrame,
400  "Enter ad hoc reaction:",
401  &answer, &ok_pressed,
402  "example: 129Xe+119Sn@50.0MeV/A");
403  if (ok_pressed) {
405  _parent_gui->fReactionKinematics = answer;
407  }
408  break;
409  }
410  default:
412  _parent_gui->fReactionKinematics = ""; //remove any previous ad hoc reaction kinematics
414  }
416  }
417  else if (i < id_extensions) {
419  if (last_checked_dqa) DQA_map[last_checked_dqa].menu->UnCheckEntry(last_checked_dqa);
420  DQA_map[i].menu->CheckEntry(i);
421  last_checked_dqa = i;
422  _parent_gui->fDataQualityAudit = DQA_map[i].name;
424  }
425  else if (i < no_run_number) {
429  else
431  }
432  else if (i >= no_run_number) { // run number
433  _parent_gui->fRun = i - no_run_number;
435  }
436 
438  }
439  };
441 
442  TGPopupMenu* add_popup(const char* name, TGPopupMenu* parent)
443  {
444  auto pop = new TGPopupMenu(gClient->GetDefaultRoot());
445  parent->AddPopup(name, pop);
446  return pop;
447  }
448  TGPopupMenu* add_popup(const char* name)
449  {
450  return menu_bar->AddPopup(name);
451  }
452  template<typename menu_type>
453  void handle_menu(menu_type& m)
454  {
455  m.menu->Connect("Activated(Int_t)", Form("KVSimDirGUI::menu_struct::%s", m.type.Data()), &m, "handle_me(Int_t)");
456  }
457  };
460  {
461  fFilterMode = true;
462  fAnalysisMode = false;
463  menus.menu_bar->RemovePopup("Analysis");
464  menus.menu_bar->AddPopup("&Filtering", menus.filter.menu, &menus.layout);
465  menus.menu_bar->Layout();
467  }
468  bool IsFilterMode() const
469  {
470  return fFilterMode;
471  }
473  {
474  fFilterMode = false;
475  fAnalysisMode = true;
476  menus.menu_bar->RemovePopup("Filtering");
478  menus.menu_bar->Layout();
480  }
481  bool IsAnalysisMode() const
482  {
483  return fAnalysisMode;
484  }
485 
486  KVSimDirGUI();
487 
488  void Exit()
489  {
491  }
492 
493  void AddSimDir();
494  void RemSimDir();
495  void RefreshSimDir();
496  void FillTreeList();
497  void EmptyTreeList();
499 
501  void SelectAnalysisClass();
502  void RunAnalysis(const TString& type);
503 
504  void SelectDataSet(const char*);
505  void SelectSystem(const char*);
506  void SelectDataQualityAudit();
507  void UpdateSystemText(const char*);
509  {
510  fFilterType = i;
511  }
512  void GeoType(Int_t i)
513  {
514  fGeoType = i;
515  }
517  {
518  fKine = i;
519  }
521  {
522  fCustomKinematics = on;
523  }
525  {
526  fRandomPhi = on;
527  }
529  {
530  fGemDecay = on;
531  }
533  {
534  fGemAddRotEner = on;
535  }
537  {
538  fGemDecayPerEvent = N;
539  }
540 
542  void Run();
543  void EnableProof()
544  {
546  fWithPROOF = kTRUE;
551  proof_analysis->SetDown(kTRUE);
557  }
559  {
561  fWithPROOF = kFALSE;
563  proof_analysis->SetDown(kFALSE);
566  }
567 
568  void ImportSimulation();
571  Bool_t WarningBox(const char* title, const char* msg, Bool_t confirm);
572 
573  void SetFilterStatusBar();
574  void SetAnalysisStatusBar();
575 
576  ClassDefOverride(KVSimDirGUI, 0) //GUI for simulated data
577  TString GetKinematicsString();
579  void AddAuxDir(TGListTreeItem* simdir, Int_t);
580 private:
581  void fill_dqa_menus_for_dataset(const KVDataSet* ds);
582 };
583 
584 #endif
int Int_t
#define RQ_OBJECT(sender_class)
bool Bool_t
constexpr Bool_t kFALSE
constexpr Bool_t kTRUE
R__EXTERN TApplication * gApplication
#define gClient
#define N
kLHintsLeft
kLHintsTop
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void on
char name[80]
char * Form(const char *fmt,...)
R__EXTERN TSystem * gSystem
Base class for KaliVeda framework.
Definition: KVBase.h:140
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:146
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:147
Extended TList class which owns its objects by default.
Definition: KVList.h:22
Interface to ROOT SQLite database backend.
Definition: SQLiteDB.h:473
GUI for analysing and filtering simulated data.
Definition: KVSimDirGUI.h:168
void SelectDataSet(const char *)
void NewFilteredAnalysisClass()
Get name of new class.
void RemSimDir()
void EmptyTreeList()
void EnableProof()
Definition: KVSimDirGUI.h:543
void RefreshSimDir()
void SelectAnalysisClass()
void SetGeminiDecayAddRotEnergy(Bool_t on)
Definition: KVSimDirGUI.h:532
void FilterType(Int_t i)
Definition: KVSimDirGUI.h:508
void UpdateSystemText(const char *)
bool IsAnalysisMode() const
Definition: KVSimDirGUI.h:481
void AddSimDir()
void NewSimulatedAnalysisClass()
Get name of new class.
void SetAnalysisStatusBar()
void SelectSystem(const char *)
void SetCustomKinematics(Bool_t on)
Definition: KVSimDirGUI.h:520
menu_struct menus
Definition: KVSimDirGUI.h:458
void DisableProof()
Definition: KVSimDirGUI.h:558
void FillTreeList()
void SetFilterMode()
Definition: KVSimDirGUI.h:459
bool IsFilterMode() const
Definition: KVSimDirGUI.h:468
void SelectDataQualityAudit()
void AddAuxDir(TGListTreeItem *simdir, Int_t)
void SetRandomPhi(Bool_t on)
Definition: KVSimDirGUI.h:524
void SetFilterStatusBar()
void SetAnalysisMode()
Definition: KVSimDirGUI.h:472
void SetGeminiDecayPerEvent(Int_t N)
Definition: KVSimDirGUI.h:536
void Exit()
Definition: KVSimDirGUI.h:488
void Run()
void ChangeOutputDirectory();
void EnableEventNumberEntry(Bool_t)
TString GetFilterTypeString()
void RunAnalysis(const TString &type)
Bool_t WarningBox(const char *title, const char *msg, Bool_t confirm)
void SetGeminiDecay(Bool_t on)
Definition: KVSimDirGUI.h:528
void GeoType(Int_t i)
Definition: KVSimDirGUI.h:512
ClassDefOverride(KVSimDirGUI, 0) TString GetKinematicsString()
void Kinematics(Int_t i)
Definition: KVSimDirGUI.h:516
void SelectSimDir(TGListTreeItem *, Int_t)
void ImportSimulation()
Import simulation data from currently selected directory.
Handle directory containing simulated and/or filtered simulated data ,.
Definition: KVSimDir.h:46
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
Definition: KVString.h:73
virtual void Terminate(Int_t status=0)
virtual void SetDown(Bool_t on=kTRUE, Bool_t emit=kFALSE)
virtual TGPopupMenu * RemovePopup(const char *s)
virtual void AddPopup(const char *s, TGPopupMenu *menu, TGLayoutHints *l, TGPopupMenu *before=nullptr)
void Layout() override
const char * GetName() const override
virtual Bool_t IsEntryChecked(Int_t id)
virtual TGMenuEntry * GetEntry(const char *s)
virtual void CheckEntry(Int_t id)
virtual void DisableEntry(Int_t id)
virtual void EnableEntry(Int_t id)
virtual void UnCheckEntry(Int_t id)
virtual void RCheckEntry(Int_t id, Int_t IDfirst, Int_t IDlast)
virtual void AddPopup(const char *s, TGPopupMenu *popup, TGMenuEntry *before=nullptr, const TGPicture *p=nullptr)
const char * GetName() const override
virtual Bool_t ProcessEvents()
Definition: KVSimDirGUI.h:317
std::string name
Definition: KVSimDirGUI.h:318
TGPopupMenu * menu
Definition: KVSimDirGUI.h:319
std::map< int, DQA_entry > DQA_map
Definition: KVSimDirGUI.h:322
void handle_menu(menu_type &m)
Definition: KVSimDirGUI.h:453
menu_struct(KVSimDirGUI *s)
Definition: KVSimDirGUI.h:242
KVSimDirGUI * _parent_gui
Definition: KVSimDirGUI.h:241
TGPopupMenu * add_popup(const char *name, TGPopupMenu *parent)
Definition: KVSimDirGUI.h:442
TGPopupMenu * add_popup(const char *name)
Definition: KVSimDirGUI.h:448
analysis_struct analysis
Definition: KVSimDirGUI.h:300
TMarker m