4#include "KVUnownedList.h"
5#include "KVSimDirGUI.h"
6#include "KVDataSetManager.h"
7#include "KVBatchSystemManager.h"
12#include "KVFileDialog.h"
13#include "KVInputDialog.h"
19#include <KVDataAnalyser.h>
20#include <KVSimDirFilterAnalyser.h>
21#include <KVSimReader.h>
25#include "KVBatchSystemParametersGUI.h"
26#include "KVDropDownDialog.h"
39 TString ds_table_name =
Form(
"Table_%d", ds_table_number);
58 fConfigDB[
"Datasets"][
"Table"] = ds_table_name;
75 dstable[
"Id"].set_null();
76 dstable[
"FileName"] = sf->
GetName();
77 dstable[
"TreeInfo"] = sf->
GetTitle();
78 dstable[
"Filtered"] = 0;
89 dstable[
"Id"].set_null();
90 dstable[
"FileName"] = sf->
GetName();
91 dstable[
"TreeInfo"] = sf->
GetTitle();
92 dstable[
"Filtered"] = 1;
98 dstable[
"Run"] = sf->
GetRun();
118 : fGuirc(
".kvsimdirguirc")
120 , fConfigDB(
gSystem->ExpandPathName(
"$(HOME)/.kvsimdirguidb"))
147 BaddDir->
Connect(
"Clicked()",
"KVSimDirGUI",
this,
"AddSimDir()");
152 BimpSim->
Connect(
"Clicked()",
"KVSimDirGUI",
this,
"ImportSimulation()");
157 BremDir->
Connect(
"Clicked()",
"KVSimDirGUI",
this,
"RemSimDir()");
182 fDirListTree->
Connect(
"Clicked(TGListTreeItem*,Int_t)",
"KVSimDirGUI",
this,
"SelectSimDir(TGListTreeItem*,Int_t)");
234 change_class->
Connect(
"Clicked()",
"KVSimDirGUI",
this,
"SelectAnalysisClass()");
240 new_anal_class->
Connect(
"Clicked()",
"KVSimDirGUI",
this,
"NewSimulatedAnalysisClass()");
243 new_filt_class->
Connect(
"Clicked()",
"KVSimDirGUI",
this,
"NewFilteredAnalysisClass()");
266 if (!gDataSetManager) {
273 for (
int i = 1; i <= ndatasets; i++) {
281 fCBdataset->
Connect(
"Selected(const char*)",
"KVSimDirGUI",
this,
"SelectDataSet(const char*)");
283 auto text_label =
new TGLabel(tmpf,
"[determines detection setup i.e. detector array geometry]");
295 fCBsystem->
Connect(
"Selected(const char*)",
"KVSimDirGUI",
this,
"SelectSystem(const char*)");
297 text_label =
new TGLabel(tmpf,
"[system + run number determine...");
309 fCBrun->
Connect(
"Selected(const char*)",
"KVSimDirGUI",
this,
"SelectRun(const char*)");
311 text_label =
new TGLabel(tmpf,
"...run-specific parameters (which id, calibs are set/working, gas pressures, ...)]");
327 fTESystem->
SetToolTipText(
"[Projectile_Symbol]+[Target_Symbol]@[Incident_Energy]MeV/A (ex: 129Xe+119Sn@50.0MeV/A)");
329 fTESystem->
Connect(
"TextChanged(const char*)",
"KVSimDirGUI",
this,
"UpdateSystemText(const char*)");
341 radiob->
SetToolTipText(
"Use geometrical filter: no thresholds; only deadzones");
343 radiob->
SetToolTipText(
"Use geometry + theoretical thresholds for detection/identification, nominal performances of all detectors/identifications");
346 radiob->
SetToolTipText(
"As Geo+Thresh, but detectors/identifications/calibrations which work depend on the run number (as for experiment)");
348 bgroup->
Connect(
"Clicked(Int_t)",
"KVSimDirGUI",
this,
"FilterType(Int_t)");
395 radiob->
SetToolTipText(
"Simulation in CM frame: will be transformed to lab frame for detection");
398 radiob->
SetToolTipText(
"Simulation in lab frame: no kinematical transformation");
400 radiob->
SetToolTipText(
"Simulation in projectile frame: will be transformed to lab frame for detection");
401 bgroup->
Connect(
"Clicked(Int_t)",
"KVSimDirGUI",
this,
"Kinematics(Int_t)");
446 lab =
new TGLabel(hf,
"Events : ");
452 fCBAllEvents->
Connect(
"Toggled(Bool_t)",
"KVSimDirGUI",
this,
"EnableEventNumberEntry(Bool_t)");
466 launch_analysis->
Connect(
"Clicked()",
"KVSimDirGUI",
this,
"Run()");
468 launch_analysis->
Resize(40, 40);
487 bool sqlite_conversion =
false;
489 sqlite_conversion =
true;
497 if (!sqlite_conversion) {
508 if (sqlite_conversion) {
516 while (!simdirs.
End()) {
521 if (sqlite_conversion) {
523 fConfigDB[
"Datasets"][
"Directory"] = simdirectory;
531 if (sqlite_conversion) {
612 while ((o = next())) {
661 if (simdirs !=
"") simdirs +=
" ";
662 simdirs += simdirname;
668 int ds_table_num = 0;
673 "Table_%d", &ds_table_num);
678 fConfigDB[
"Datasets"][
"Name"] = simdirname;
736 while ((togo = (
KVSimDir*)next())) {
737 if (simdirs !=
"") simdirs +=
" ";
773 const char* filetypes[] = {
774 "Class header files",
"*.h",
784 if (idot < 0)
return;
861 while ((dbr = (
KVDBRun*)next())) {
931 TList* runs_to_analyse(
nullptr);
932 TList* aux_runs_to_analyse(
nullptr);
934 if (
type ==
"tree") {
935 if (!selected_sim_runs->GetEntries() && !selected_filt_runs->GetEntries()) {
947 if (selected_sim_runs->GetEntries()) {
948 if (selected_filt_runs->GetEntries()) {
951 runs_to_analyse = selected_filt_runs.get();
952 analysis_task =
"analysis filtered";
953 aux_runs_to_analyse = selected_sim_runs.get();
956 runs_to_analyse = selected_sim_runs.get();
957 analysis_task =
"analysis simulated";
961 runs_to_analyse = selected_filt_runs.get();
962 analysis_task =
"analysis filtered";
967 if (selected_filt_runs->GetEntries()) {
971 if (!selected_sim_runs->GetEntries()) {
975 runs_to_analyse = selected_sim_runs.get();
976 analysis_task =
"filter simulated";
982 if (aux_runs_to_analyse) gDataAnalyser->
SetAuxFileList(aux_runs_to_analyse);
997 if (
type ==
"filter") {
1005 Error(
"SetFilterOptions",
"Please check the format of the ad hoc system name you gave");
1006 WarningBox(
"Bad System",
"Please check the format of the ad hoc system name you gave",
kFALSE);
1022 gBatchSystem->
Clear();
1026 if (!cancel_batch_job) {
1035 selected_filt_runs.reset(
nullptr);
1036 selected_sim_runs.reset(
nullptr);
1052 else kinema =
"lab";
1059 filter =
"GeoThresh";
1068 else if (kinema !=
"lab") {
1071 "KVSimDirGUI::SetFilterOptions",
1072 Form(
"Cannot transform kinematics from %s to lab without a defined reaction (system)!", kinema.
Data()),
1078 options +=
Form(
"Filter=%s,", filter.
Data());
1079 options +=
Form(
"Kinematics=%s", kinema.
Data());
1088 "KVSimDirGUI::SetFilterOptions",
1089 Form(
"To use 'FULL' (run-dependent) filter requires either a run number or a system from the dataset!"),
1096 options +=
",Gemini=yes";
1104 std::cout << options << std::endl;
1116 const char* filetypes[] = {
1129 if (one_file || many_files) {
1134 while (!plugins.
End()) {
1137 if (choices.
Length()) choices +=
" ";
1149 SR->ConvertAndSaveEventsInFile(fi.
fFilename);
1161 while ((o = it())) {
1163 SR->SetMultiFiles();
1164 SR->SetFileIndex(i++);
1166 SR->ConvertAndSaveEventsInFile(o->
GetName());
1189 new KVInputDialog(
MainFrame,
"Enter name of new analysis class", &classname, &ok,
"Enter name of new analysis class");
1193 ok = ok &&
WarningBox(
"Replacing existing class",
1194 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)",
1213 new KVInputDialog(
MainFrame,
"Enter name of new analysis class", &classname, &ok,
"Enter name of new analysis class");
1217 ok = ok &&
WarningBox(
"Replacing existing class",
1218 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)",
1248 reply = (ret_code &
kMBYes);
1267 fConfigDB[
"Datasets"][
"Directory"].get_data<TString>()));
1269 fConfigDB[
"Datasets"][
"Table"].get_data<TString>());
1271 for (
int i = 0; i < tables.
GetNpar(); ++i) {
1276 if (dstable[
"Filtered"].get_data<int>()) {
1280 dstable[
"FileName"].get_data<TString>(), dstable[
"TreeInfo"].get_data<TString>(),
1281 dstable[
"Events"].get_data<int>(), dstable[
"TreeName"].get_data<TString>(),
1282 dstable[
"BranchName"].get_data<TString>(), dstable[
"DataSet"].get_data<TString>(),
1283 dstable[
"System"].get_data<TString>(), dstable[
"Run"].get_data<int>(),
1284 dstable[
"GeoType"].get_data<TString>(), dstable[
"OrigFile"].get_data<TString>(),
1285 dstable[
"FiltType"].get_data<TString>()
1287 f->SetGemini(dstable[
"Gemini"].get_data<bool>());
1288 if (
f->IsGemini())
f->SetGemDecayPerEvent(dstable[
"GemDecayPerEvent"].get_data<int>());
1295 dstable[
"FileName"].get_data<TString>(), dstable[
"TreeInfo"].get_data<TString>(),
1296 dstable[
"Events"].get_data<int>(), dstable[
"TreeName"].get_data<TString>(),
1297 dstable[
"BranchName"].get_data<TString>());
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void on
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 Atom_t Atom_t Time_t type
char * Form(const char *fmt,...)
char * StrDup(const char *str)
R__EXTERN TSystem * gSystem
Relativistic binary kinematics calculator.
void Print(Option_t *opt="") const
void CalculateKinematics()
Base class for KaliVeda framework.
static Bool_t FindClassSourceFiles(const Char_t *class_name, KVString &imp_file, KVString &dec_file, const Char_t *dir_name=".")
static const Char_t * GetListOfPlugins(const Char_t *base)
static const Char_t * GetPluginURI(const Char_t *base, const Char_t *plugin)
virtual void Copy(TObject &) const
Make a copy of this object.
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
Description of an experimental run in database ,,.
Database class used to store information on different colliding systems studied during an experiment....
KVUnownedList * GetRuns() const
Returns a sorted list of all the runs associated with this system.
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 const Char_t * GetDataAnalyser() const
virtual const Char_t * GetUserBaseClass() const
virtual Bool_t WithUserClass() 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.
const Char_t * GetDataSetEnv(const Char_t *type, const Char_t *defval="") const
Ask user to choose between several options in a drop-down list.
virtual KVSeqCollection * GetSystems() const
virtual KVDBSystem * GetSystem(const Char_t *system) const
Modified version of TGFileDialog file selection dialog.
Enhanced version of ROOT TGListView widget.
virtual void ActivateSortButtons()
virtual void SetDataColumns(Int_t ncolumns)
virtual void Display(const TCollection *l)
void AllowContextMenu(Bool_t on=kTRUE)
TList * GetSelectedObjects() const
virtual void SetDataColumn(Int_t index, const Char_t *name, const Char_t *method="", Int_t mode=kTextCenterX)
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
int count(const TString &table, const TString &column="*", const TString &selection="", bool distinct=false) const
bool update(const TString &table, const TString &columns, const TString &selection="")
void delete_data(const TString &table, const TString &selection="")
void end_data_insertion()
bool select_data(const TString &tables, const TString &columns="*", const TString &selection="", bool distinct=false, const TString &anything_else="") const
KVNameValueList get_name_value_list(const TString &table, const TString &name_column, const TString &value_column, const TString &selection="", const TString &anything_else="")
bool get_next_result() const
void add_table(const table &)
bool prepare_data_insertion(const TString &)
void clear_table(const TString &name)
Delete all data from table.
const column & add_primary_key(const TString &name)
column & add_column(const KVSQLite::column &c)
KaliVeda extensions to ROOT collection classes.
virtual TObject * FindObject(const char *name) const
virtual void Add(TObject *obj)
virtual TObject * Remove(TObject *obj)
Remove object from list.
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.
TGPictureButton * BremDir
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
TGCompositeFrame * fAnalTab
analysis tab
KVSQLite::database fConfigDB
void SelectAnalysisClass()
TGCompositeFrame * fFiltTab
filter tab
void UpdateSystemText(const char *)
called every time the text changes
TGCheckButton * fCBAllEvents
virtual ~KVSimDirGUI()
Destructor.
TGCheckButton * custom_kinematics_check
void NewSimulatedAnalysisClass()
Get name of new class.
TGCheckButton * gemini_decay
TGViewPort * fDirListViewPort
TGNumberEntry * fNENumberEvents
void SelectSystem(const char *)
KVSimDir * fSelectedSimDir
void Copy(TObject &) const
KVString fReactionKinematics
TGListTree * fDirListTree
TGCanvas * fDirListCanvas
const TGPicture * pclose
used for list tree items
const TGPicture * popen
used for list tree items
KVString fAnalClassHeader
void Run()
void ChangeOutputDirectory();
void FillDataSetTableWithInfos(TString ds_table_name, KVSimDir *sd)
TGPictureButton * proof_analysis
TGTextEntry* fTEOutputDir;.
TGNumberEntry * gemini_decays
TGCheckButton * phi_rotation_check
void EnableEventNumberEntry(Bool_t)
void RunAnalysis(const TString &type)
Bool_t WarningBox(const char *title, const char *msg, Bool_t confirm)
TGPictureButton * BaddDir
Bool_t fWithPROOF
=kTRUE when running with PROOF-lite
Bool_t fCancelJob
if job parameters are not valid
TGPictureButton * BimpSim
TGPictureButton * BrefreshDir
TGTextEntry * fTEAnalysisClassFileName
void SelectSimDir(TGListTreeItem *, Int_t)
TString AddTableForDataSet(KVSimDir *sd, int ds_table_number)
Add a new dataset table for the given KVSimDir object.
void ImportSimulation()
Import simulation data from currently selected directory.
void SelectRun(const char *)
Handle directory containing simulated and/or filtered simulated data ,.
virtual const Char_t * GetDirectory() const
virtual const KVList * GetFiltDataList() const
void AddSimData(KVSimFile *)
virtual void AnalyseDirectory()
virtual const KVList * GetSimDataList() const
void AddFiltData(KVSimFile *)
Handle file containing simulated and/or filtered simulated data ,.
const Char_t * GetTreeName() const
const Char_t * GetGeometry() const
const Char_t * GetFilterType() const
const Char_t * GetSystem() const
const Char_t * GetDataSet() const
Long64_t GetEvents() const
const Char_t * GetBranchName() const
const Char_t * GetOriginalFile() const
Int_t GetGemDecayPerEvent() const
static KVSimReader * MakeSimReader(const char *model_uri)
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
void Begin(TString delim) const
KVString Next(Bool_t strip_whitespace=kFALSE) const
void ls(Option_t *option="") const override
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 SetContainer(TGFrame *f)
TGViewPort * GetViewPort() const
void MapSubwindows() override
void RemoveAll() override
virtual void Select(Int_t id, Bool_t emit=kTRUE)
virtual void AddEntry(const char *s, Int_t id)
TGDimension GetDefaultSize() const override
virtual void SetLayoutManager(TGLayoutManager *l)
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
UInt_t GetDefaultWidth() const override
void MapSubwindows() override
void ChangeOptions(UInt_t options) override
void SetMultipleSelection(Bool_t option)
Bool_t fMultipleSelection
virtual UInt_t GetDefaultHeight() const
virtual void Resize(TGDimension size)
void MapWindow() override
virtual const char * GetText() const=0
virtual void SetPictures(const TGPicture *, const TGPicture *)
Int_t DeleteItem(TGListTreeItem *item)
TGListTreeItem * GetFirstItem() const
void AddItem(const char *string)
void CloseItem(TGListTreeItem *item)
void SetWindowName(const char *name=nullptr) override
void SetMWMHints(UInt_t value, UInt_t funcs, UInt_t input)
TGNumberEntryField * GetNumberEntry() const
virtual void SetState(Bool_t enable=kTRUE)
virtual Double_t GetNumber() const
virtual TGCompositeFrame * AddTab(const char *text)
TGLayoutManager * GetLayoutManager() const override
void SetEnabled(Bool_t flag=kTRUE)
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)
TObject * First() const override
const char * GetName() const override
const char * GetTitle() const override
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)
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