KaliVeda  1.12/06
Heavy-Ion Analysis Toolkit
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
KVBase Class Reference

Base class for KaliVeda framework.

This is the base class for many classes in the KaliVeda framework. Each KVBase object has:

When objects are accessed through a TObject/TNamed base pointer, it is possible to test whether an object is derived from KVBase, using the bit KVBase::kIsKaliVedaObject:

TObject* ob = (address of some object);
@ kIsKaliVedaObject
Definition: KVBase.h:156
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const

This class also provides a number of general utilities, often as static (stand-alone) methods.

KaliVeda build/installation information

The static methods

Base class for KaliVeda framework.
Definition: KVBase.h:135
static const Char_t * GetKVBuildDate()
Returns KaliVeda build date.
Definition: KVBase.cpp:863
static const Char_t * GetKVBuildUser()
Returns username of person who performed build.
Definition: KVBase.cpp:850
static const Char_t * GetKVSourceDir()
Returns top-level directory of source tree used for build.
Definition: KVBase.cpp:901
static const Char_t * GetKVBuildType()
Returns KaliVeda build type (cmake build: Release, Debug, RelWithDebInfo, ...)
Definition: KVBase.cpp:888
static const Char_t * GetKVVersion()
Returns KaliVeda version string.
Definition: KVBase.cpp:837

give info on the sources, when and where they were built, and by whom.

Initialisation

The entire KaliVeda framework is initialised by the static method KVBase::InitEnvironment()

Finding/opening files

Static methods for easily locating and/or opening files within the KaliVeda installation tree are given:

static Bool_t SearchAndOpenKVFile(const Char_t *name, std::ifstream &file, const Char_t *kvsubdir="", KVLockfile *locks=0)
Definition: KVBase.cpp:601
static Bool_t SearchKVFile(const Char_t *name, TString &fullpath, const Char_t *kvsubdir="")
Definition: KVBase.cpp:541

Note that in the second case, two methods exist: one for reading, the other for writing the (ascii) files. A global function for searching files is also defined:

Bool_t SearchFile(const Char_t* name, TString& fullpath, int ndirs, ...)
Bool_t SearchFile(const Char_t *name, TString &fullpath, int ndirs,...)
Search for file in an arbitrary number of locations, return kTRUE if file found and put full path to ...
Definition: KVBase.cpp:489
char Char_t
bool Bool_t

This will search for a file in an arbitrary number of locations, return kTRUE if file is found and put full path to file in 'fullpath':

The remaining arguments are the names of 'ndirs' paths to search in,

Finding class source files

Source files for a class can be found using static method

static Bool_t FindClassSourceFiles(const Char_t *class_name, KVString &imp_file, KVString &dec_file, const Char_t *dir_name=".")
Definition: KVBase.cpp:1065

It will look for appropriately-named files corresponding to the header and implementation file of a class, testing several popular suffixes in each case.

Finding executables

To find an executable in the current user's 'PATH' (or elsewhere), use static method

static Bool_t FindExecutable(TString &exec, const Char_t *path="$(PATH)")
Definition: KVBase.cpp:964

Temporary files

The static methods

static void OpenTempFile(TString &base, std::ofstream &fp)
Definition: KVBase.cpp:790
static void GetTempFileName(TString &base)
Definition: KVBase.cpp:811

can generate and handle uniquely-named temporary (ascii) files.

Backing-up files

The static method

static void BackupFileWithDate(const Char_t *path)
Definition: KVBase.cpp:716

can be used to create a dated backup of an existing file before it is replaced with a new version.

Handling plugins

As plugins are extensively used in the KaliVeda framework, a few utilities for handling them are defined. They are static methods

static const Char_t * GetPluginURI(const Char_t *base, const Char_t *plugin)
Definition: KVBase.cpp:1140
static TPluginHandler * LoadPlugin(const Char_t *base, const Char_t *uri="0")
Definition: KVBase.cpp:756
Examples
base_kvbase.C.

Definition at line 135 of file KVBase.h.

Public Types

enum  EKaliVedaBits { kIsKaliVedaObject = BIT(23) }
 
- Public Types inherited from TObject
enum  EDeprecatedStatusBits
 
enum  EStatusBits
 

Public Member Functions

 KVBase ()
 Default constructor. More...
 
 KVBase (const Char_t *name, const Char_t *title="")
 Ctor for object with given name and type. More...
 
 KVBase (const KVBase &)
 copy ctor More...
 
virtual ~ KVBase ()
 
virtual void Clear (Option_t *opt="")
 Clear object properties : name, type/title, number, label. More...
 
virtual void Copy (TObject &) const
 Make a copy of this object. More...
 
const Char_tGetLabel () const
 
UInt_t GetNumber () const
 
UInt_t GetNumberOfObjects () const
 
virtual TObjectGetObject () const
 
const Char_tGetType () const
 
Bool_t HasLabel () const
 
virtual Bool_t IsCalled (const Char_t *name) const
 
Bool_t IsLabelled (const Char_t *l) const
 
virtual Bool_t IsType (const Char_t *typ) const
 
virtual void List ()
 
KVBaseoperator= (const KVBase &)
 copy assignment operator More...
 
virtual void Print (Option_t *option="") const
 
Double_t ProtectedGetX (const TF1 *func, Double_t val, int &status, Double_t xmin=0.0, Double_t xmax=0.0) const
 
void SetLabel (const Char_t *lab)
 
virtual void SetNumber (UInt_t num)
 
virtual void SetType (const Char_t *str)
 
- Public Member Functions inherited from TNamed
 TNamed ()
 
 TNamed (const char *name, const char *title)
 
 TNamed (const TNamed &named)
 
 TNamed (const TString &name, const TString &title)
 
virtual ~TNamed ()
 
virtual TObjectClone (const char *newname="") const
 
virtual Int_t Compare (const TObject *obj) const
 
virtual void FillBuffer (char *&buffer)
 
virtual const char * GetName () const
 
virtual const char * GetTitle () const
 
virtual ULong_t Hash () const
 
virtual Bool_t IsSortable () const
 
virtual void ls (Option_t *option="") const
 
TNamedoperator= (const TNamed &rhs)
 
virtual void SetName (const char *name)
 
virtual void SetNameTitle (const char *name, const char *title)
 
virtual void SetTitle (const char *title="")
 
virtual Int_t Sizeof () const
 
- Public Member Functions inherited from TObject
 TObject ()
 
 TObject (const TObject &object)
 
virtual ~TObject ()
 
void AbstractMethod (const char *method) const
 
virtual void AppendPad (Option_t *option="")
 
virtual void Browse (TBrowser *b)
 
ULong_t CheckedHash ()
 
virtual const char * ClassName () const
 
virtual void Delete (Option_t *option="")
 
virtual Int_t DistancetoPrimitive (Int_t px, Int_t py)
 
virtual void Draw (Option_t *option="")
 
virtual void DrawClass () const
 
virtual TObjectDrawClone (Option_t *option="") const
 
virtual void Dump () const
 
virtual void Error (const char *method, const char *msgfmt,...) const
 
virtual void Execute (const char *method, const char *params, Int_t *error=0)
 
virtual void Execute (TMethod *method, TObjArray *params, Int_t *error=0)
 
virtual void ExecuteEvent (Int_t event, Int_t px, Int_t py)
 
virtual void Fatal (const char *method, const char *msgfmt,...) const
 
virtual TObjectFindObject (const char *name) const
 
virtual TObjectFindObject (const TObject *obj) const
 
virtual Option_tGetDrawOption () const
 
virtual const char * GetIconName () const
 
virtual char * GetObjectInfo (Int_t px, Int_t py) const
 
virtual Option_tGetOption () const
 
virtual UInt_t GetUniqueID () const
 
virtual Bool_t HandleTimer (TTimer *timer)
 
Bool_t HasInconsistentHash () const
 
virtual void Info (const char *method, const char *msgfmt,...) const
 
virtual Bool_t InheritsFrom (const char *classname) const
 
virtual Bool_t InheritsFrom (const TClass *cl) const
 
virtual void Inspect () const
 
void InvertBit (UInt_t f)
 
virtual Bool_t IsEqual (const TObject *obj) const
 
virtual Bool_t IsFolder () const
 
R__ALWAYS_INLINE Bool_t IsOnHeap () const
 
R__ALWAYS_INLINE Bool_t IsZombie () const
 
void MayNotUse (const char *method) const
 
virtual Bool_t Notify ()
 
void Obsolete (const char *method, const char *asOfVers, const char *removedFromVers) const
 
void operator delete (void *ptr)
 
void operator delete[] (void *ptr)
 
voidoperator new (size_t sz)
 
voidoperator new (size_t sz, void *vp)
 
voidoperator new[] (size_t sz)
 
voidoperator new[] (size_t sz, void *vp)
 
TObjectoperator= (const TObject &rhs)
 
virtual void Paint (Option_t *option="")
 
virtual void Pop ()
 
virtual Int_t Read (const char *name)
 
virtual void RecursiveRemove (TObject *obj)
 
void ResetBit (UInt_t f)
 
virtual void SaveAs (const char *filename="", Option_t *option="") const
 
virtual void SavePrimitive (std::ostream &out, Option_t *option="")
 
void SetBit (UInt_t f)
 
void SetBit (UInt_t f, Bool_t set)
 
virtual void SetDrawOption (Option_t *option="")
 
virtual void SetUniqueID (UInt_t uid)
 
virtual void SysError (const char *method, const char *msgfmt,...) const
 
R__ALWAYS_INLINE Bool_t TestBit (UInt_t f) const
 
Int_t TestBits (UInt_t f) const
 
virtual void UseCurrentStyle ()
 
virtual void Warning (const char *method, const char *msgfmt,...) const
 
virtual Int_t Write (const char *name=0, Int_t option=0, Int_t bufsize=0)
 
virtual Int_t Write (const char *name=0, Int_t option=0, Int_t bufsize=0) const
 

Static Public Member Functions

static Bool_t AreEqual (Double_t x, Double_t y, Long64_t maxdif=1)
 Comparison between two 64-bit floating-point values. More...
 
static void BackupFileWithDate (const Char_t *path)
 
static void CombineFiles (const Char_t *file1, const Char_t *file2, const Char_t *newfilename, Bool_t keep=kTRUE)
 
static void Deprecated (const char *method, const char *advice)
 
static Bool_t FindClassSourceFiles (const Char_t *class_name, KVString &imp_file, KVString &dec_file, const Char_t *dir_name=".")
 
static Bool_t FindExecutable (TString &exec, const Char_t *path="$(PATH)")
 
static const Char_tFindFile (const Char_t *search, TString &wfil)
 
static const Char_tGetBINDIRFilePath (const Char_t *namefile="")
 
static const Char_tGetDATABASEFilePath ()
 
static const Char_tGetDATADIRFilePath (const Char_t *namefile="")
 
static Bool_t GetDataSetEnv (const Char_t *dataset, const Char_t *type, Bool_t defval)
 
static const Char_tGetDataSetEnv (const Char_t *dataset, const Char_t *type, const Char_t *defval)
 
static Double_t GetDataSetEnv (const Char_t *dataset, const Char_t *type, Double_t defval)
 
static const Char_tGetETCDIRFilePath (const Char_t *namefile="")
 
static const Char_tGetExampleFilePath (const Char_t *library, const Char_t *namefile)
 Return full path to example file for given library (="KVMultiDet", "BackTrack", etc.) More...
 
static const Char_tGetINCDIRFilePath (const Char_t *namefile="")
 
static const Char_tGetKVBuildDate ()
 Returns KaliVeda build date. More...
 
static const Char_tGetKVBuildDir ()
 Returns top-level directory used for build. More...
 
static const Char_tGetKVBuildTime ()
 Returns KaliVeda build date. More...
 
static const Char_tGetKVBuildType ()
 Returns KaliVeda build type (cmake build: Release, Debug, RelWithDebInfo, ...) More...
 
static const Char_tGetKVBuildUser ()
 Returns username of person who performed build. More...
 
static const Char_tGetKVSourceDir ()
 Returns top-level directory of source tree used for build. More...
 
static const Char_tGetKVVersion ()
 Returns KaliVeda version string. More...
 
static const Char_tGetLIBDIRFilePath (const Char_t *namefile="")
 
static const Char_tGetListOfPlugins (const Char_t *base)
 
static const Char_tGetListOfPluginURIs (const Char_t *base)
 
static const Char_tGetPluginURI (const Char_t *base, const Char_t *plugin)
 
static void GetTempFileName (TString &base)
 
static const Char_tGetTEMPLATEDIRFilePath (const Char_t *namefile="")
 
static const Char_tGetWORKDIRFilePath (const Char_t *namefile="")
 
static const Char_tgitBranch ()
 Returns git branch of sources. More...
 
static const Char_tgitCommit ()
 Returns last git commit of sources. More...
 
static void InitEnvironment ()
 
static bool is_gnuinstall ()
 
static Bool_t IsThisAPlugin (const TString &uri, TString &base)
 
static TPluginHandlerLoadPlugin (const Char_t *base, const Char_t *uri="0")
 
static Bool_t OpenContextMenu (const char *method, TObject *obj, const char *alt_method_name="")
 
static void OpenTempFile (TString &base, std::ofstream &fp)
 
static void PrintSplashScreen ()
 Prints welcome message and infos on version etc. More...
 
static Bool_t SearchAndOpenKVFile (const Char_t *name, std::ifstream &file, const Char_t *kvsubdir="", KVLockfile *locks=0)
 
static Bool_t SearchAndOpenKVFile (const Char_t *name, std::ofstream &file, const Char_t *kvsubdir="", KVLockfile *locks=0)
 
static Bool_t SearchKVFile (const Char_t *name, TString &fullpath, const Char_t *kvsubdir="")
 
static const Char_tWorkingDirectory ()
 
- Static Public Member Functions inherited from TObject
static Longptr_t GetDtorOnly ()
 
static Bool_t GetObjectStat ()
 
static void SetDtorOnly (void *obj)
 
static void SetObjectStat (Bool_t stat)
 

Protected Attributes

TString fLabel
 label for the object More...
 
- Protected Attributes inherited from TNamed
TString fName
 
TString fTitle
 
- Protected Attributes inherited from TObject
 kOnlyPrepStep
 

Private Member Functions

void init ()
 Default initialisation. More...
 

Static Private Member Functions

static void ReadConfigFiles ()
 
static void ReadGUIMimeTypes ()
 

Private Attributes

UInt_t fNumber
 for numbering objects More...
 

Static Private Attributes

static Bool_t fEnvIsInit = kFALSE
 set when environment is initialised More...
 
static UInt_t fNbObj = 0
 Total number of KaliVeda objects (actually counts number of calls to default ctor) More...
 
static TString fWorkingDirectory = "$(HOME)/.kaliveda"
 user working directory for e.g. database files More...
 

Additional Inherited Members

- Public Attributes inherited from TObject
 kBitMask
 
 kCanDelete
 
 kCannotPick
 
 kHasUUID
 
 kInconsistent
 
 kInvalidObject
 
 kIsOnHeap
 
 kIsReferenced
 
 kMustCleanup
 
 kNoContextMenu
 
 kNotDeleted
 
 kObjInCanvas
 
 kOverwrite
 
 kSingleKey
 
 kWriteDelete
 
 kZombie
 
- Protected Member Functions inherited from TObject
virtual void DoError (int level, const char *location, const char *fmt, va_list va) const
 
void MakeZombie ()
 

#include <KVBase.h>

Inheritance diagram for KVBase:
Inheritance graph
[legend]

Member Enumeration Documentation

◆ EKaliVedaBits

Enumerator
kIsKaliVedaObject 

Definition at line 155 of file KVBase.h.

Constructor & Destructor Documentation

◆ KVBase() [1/3]

KVBase::KVBase ( )

Default constructor.

Definition at line 320 of file KVBase.cpp.

◆ KVBase() [2/3]

KVBase::KVBase ( const Char_t name,
const Char_t title = "" 
)

Ctor for object with given name and type.

Definition at line 331 of file KVBase.cpp.

◆ KVBase() [3/3]

KVBase::KVBase ( const KVBase obj)

copy ctor

Definition at line 342 of file KVBase.cpp.

◆ ~ KVBase()

virtual KVBase::~ KVBase ( )
virtual

Member Function Documentation

◆ AreEqual()

Bool_t KVBase::AreEqual ( Double_t  A,
Double_t  B,
Long64_t  maxdif = 1 
)
static

Comparison between two 64-bit floating-point values.

Returns kTRUE if the integer representations of the two values are within maxdif of each other. By default maxdif=1, which means that we consider that x==y if the difference between them is no greater than the precision of Double_t variables, i.e. 4.94065645841246544e-324

Based on the function AlmostEqual2sComplement(float, float, int) by Bruce Dawson http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm

Definition at line 1405 of file KVBase.cpp.

◆ BackupFileWithDate()

void KVBase::BackupFileWithDate ( const Char_t path)
static

path gives the full path (can include environment variables, special symbols) to a file which will be renamed with an extension containing the current date and time (in SQL format).

Example:

KVBase::BackupFileWithDate("$(HOME)/toto.txt")

The file toto.txt will be renamed toto.txt.2007-05-02_16:22:37

Definition at line 716 of file KVBase.cpp.

◆ Clear()

void KVBase::Clear ( Option_t opt = "")
virtual

Clear object properties : name, type/title, number, label.

Reimplemented from TNamed.

Reimplemented in KVTarget, KVMaterial, KVIDGridManager, KVIdentificationResult, KVGeoStrucElement, KVDetector, KVMultiDetArray, KVExpSetUp, KVEvent, KVBatchSystem, KVAutoFit, KV_CCIN2P3_Slurm, KV_CCIN2P3_GE, KVFAZIADetector, KVGeoDNTrajectory, KVACQParam, and KVFileReader.

Definition at line 383 of file KVBase.cpp.

◆ CombineFiles()

void KVBase::CombineFiles ( const Char_t file1,
const Char_t file2,
const Char_t newfilename,
Bool_t  keep = kTRUE 
)
static

STATIC method which allows to combine the contents of two ROOT files (file1 and file2) into a new ROOT file (newfilename). All objects from the two files will be written in the new file.

if keep=kFALSE, the two files will be deleted after the operation

Definition at line 1490 of file KVBase.cpp.

◆ Copy()

void KVBase::Copy ( TObject obj) const
virtual

◆ Deprecated()

void KVBase::Deprecated ( const char *  where,
const char *  advice 
)
static

Print a message to indicate when the called method is deprecated and give advice how to do better

Don't call directly: use the macro Deprecate(advice) which will automatically fill in the method name (see KVMacros.h)

Definition at line 1697 of file KVBase.cpp.

◆ FindClassSourceFiles()

Bool_t KVBase::FindClassSourceFiles ( const Char_t class_name,
KVString imp_file,
KVString dec_file,
const Char_t dir_name = "." 
)
static

Look for the source files corresponding to class_name i.e. taking class_name as a base, we look for one of

class_name.C,class_name.cpp,class_name.cxx

and one of

class_name.h,class_name.hh,class_name.H

By default we look in the current working directory, unless argument dir_name is given

If found, the names of the two files are written in imp_file and dec_file

Definition at line 1065 of file KVBase.cpp.

◆ FindExecutable()

Bool_t KVBase::FindExecutable ( TString exec,
const Char_t path = "$(PATH)" 
)
static

By default, FindExecutable(exec) will look for the executable named by exec in the directories contained in the environment variable PATH. You can override this by giving your own search path as second argument (remember to write environment variables as $(PATH), for cross-platform compatibility).

If exec is not found, and if it does not end with .exe, we look for exec.exe This is for compatibility with Windows/cygwin environments.

If the executable is found, returns kTRUE and exec then holds full path to executable. Returns kFALSE if exec not found in paths.

If exec is an absolute pathname, we return kTRUE if the file exists (we do not use path).

Examples
base_kvbase.C.

Definition at line 964 of file KVBase.cpp.

◆ FindFile()

const Char_t * KVBase::FindFile ( const Char_t search,
TString wfil 
)
static

Backwards compatible fix for TSystem::FindFile which only exists from ROOT version 5.12/00 onwards. Use this method as a replacement for gSystem->FindFile (same arguments)

Definition at line 1023 of file KVBase.cpp.

◆ GetBINDIRFilePath()

const Char_t * KVBase::GetBINDIRFilePath ( const Char_t namefile = "")
static

Definition at line 118 of file KVBase.cpp.

◆ GetDATABASEFilePath()

const Char_t * KVBase::GetDATABASEFilePath ( )
static

Definition at line 92 of file KVBase.cpp.

◆ GetDATADIRFilePath()

const Char_t * KVBase::GetDATADIRFilePath ( const Char_t namefile = "")
static

Definition at line 74 of file KVBase.cpp.

◆ GetDataSetEnv() [1/3]

Bool_t KVBase::GetDataSetEnv ( const Char_t dataset,
const Char_t type,
Bool_t  defval 
)
static

Static method to interrogate dataset-specific variables in configuration Will look for gEnv->GetValue "dataset.type" then simply "type" if no dataset-specific value is found. If neither resource is defined, return the "defval" default value

Definition at line 1623 of file KVBase.cpp.

◆ GetDataSetEnv() [2/3]

const Char_t * KVBase::GetDataSetEnv ( const Char_t dataset,
const Char_t type,
const Char_t defval 
)
static

Static method to interrogate dataset-specific variables in configuration Will look for gEnv->GetValue "dataset.type" then simply "type" if no dataset-specific value is found. If neither resource is defined, return the "defval" default value (="" by default)

Definition at line 1582 of file KVBase.cpp.

◆ GetDataSetEnv() [3/3]

Double_t KVBase::GetDataSetEnv ( const Char_t dataset,
const Char_t type,
Double_t  defval 
)
static

Static method to interrogate dataset-specific variables in configuration Will look for gEnv->GetValue "dataset.type" then simply "type" if no dataset-specific value is found. If neither resource is defined, return the "defval" default value

Definition at line 1602 of file KVBase.cpp.

◆ GetETCDIRFilePath()

const Char_t * KVBase::GetETCDIRFilePath ( const Char_t namefile = "")
static

Definition at line 65 of file KVBase.cpp.

◆ GetExampleFilePath()

const Char_t * KVBase::GetExampleFilePath ( const Char_t library,
const Char_t namefile 
)
static

Return full path to example file for given library (="KVMultiDet", "BackTrack", etc.)

Definition at line 1540 of file KVBase.cpp.

◆ GetINCDIRFilePath()

const Char_t * KVBase::GetINCDIRFilePath ( const Char_t namefile = "")
static

Definition at line 109 of file KVBase.cpp.

◆ GetKVBuildDate()

const Char_t * KVBase::GetKVBuildDate ( )
static

Returns KaliVeda build date.

Definition at line 863 of file KVBase.cpp.

◆ GetKVBuildDir()

const Char_t * KVBase::GetKVBuildDir ( )
static

Returns top-level directory used for build.

Definition at line 914 of file KVBase.cpp.

◆ GetKVBuildTime()

const Char_t * KVBase::GetKVBuildTime ( )
static

Returns KaliVeda build date.

Definition at line 875 of file KVBase.cpp.

◆ GetKVBuildType()

const Char_t * KVBase::GetKVBuildType ( )
static

Returns KaliVeda build type (cmake build: Release, Debug, RelWithDebInfo, ...)

Definition at line 888 of file KVBase.cpp.

◆ GetKVBuildUser()

const Char_t * KVBase::GetKVBuildUser ( )
static

Returns username of person who performed build.

Definition at line 850 of file KVBase.cpp.

◆ GetKVSourceDir()

const Char_t * KVBase::GetKVSourceDir ( )
static

Returns top-level directory of source tree used for build.

Definition at line 901 of file KVBase.cpp.

◆ GetKVVersion()

const Char_t * KVBase::GetKVVersion ( )
static

Returns KaliVeda version string.

Definition at line 837 of file KVBase.cpp.

◆ GetLabel()

const Char_t* KVBase::GetLabel ( ) const
inline

Definition at line 192 of file KVBase.h.

◆ GetLIBDIRFilePath()

const Char_t * KVBase::GetLIBDIRFilePath ( const Char_t namefile = "")
static

Definition at line 100 of file KVBase.cpp.

◆ GetListOfPlugins()

const Char_t * KVBase::GetListOfPlugins ( const Char_t base)
static

Return whitespace-separated list of all plugin classes defined for the given base class.

E.g. if plugins exist for BaseClass:

Plugin.BaseClass: URI PluginClass PluginLibrary "PluginClassConstructor(arguments)" +Plugin.BaseClass: URI2 PluginClass2 PluginLibrary2 "PluginClass2Constructor(arguments)"

then KVBase::GetListOfPlugins("BaseClass") will return "PluginClass PluginClass2"

Most of the code is copied from TPluginManager::LoadHandlersFromEnv

Definition at line 1223 of file KVBase.cpp.

◆ GetListOfPluginURIs()

const Char_t * KVBase::GetListOfPluginURIs ( const Char_t base)
static

For a given base class, return a whitespace-separated list of plugin identifiers which are known/defined. E.g. if plugins exist for BaseClass:

Plugin.BaseClass: URI PluginClass PluginLibrary "PluginClassConstructor(arguments)" +Plugin.BaseClass: URI2 PluginClass2 PluginLibrary2 "PluginClass2Constructor(arguments)"

then KVBase::GetListOfPluginURIs("BaseClass") will return "URI URI2"

Definition at line 1290 of file KVBase.cpp.

◆ GetNumber()

UInt_t KVBase::GetNumber ( ) const
inline

Definition at line 213 of file KVBase.h.

◆ GetNumberOfObjects()

UInt_t KVBase::GetNumberOfObjects ( ) const
inline

Definition at line 217 of file KVBase.h.

◆ GetObject()

TObject * KVBase::GetObject ( ) const
virtual

Dummy method (returns NULL). This method may be used in 'container' classes used with KVListView. In order to open the context menu of the 'contained' object, GetLabel() should return the real class of the object, and this method should return its address. Then call KVListView::SetUseObjLabelAsRealClass(kTRUE).

Reimplemented in KVHistogram.

Definition at line 1523 of file KVBase.cpp.

◆ GetPluginURI()

const Char_t * KVBase::GetPluginURI ( const Char_t base,
const Char_t derived 
)
static

Inverse of gPluginMgr->FindHandler(const Char_t* base, const Char_t* uri)

Given a base class base and a derived class derived, we search gEnv to find the URI corresponding to this plugin.

Example: given a plugin such as

Plugin.KVIDTelescope: ^PHOS$ KVIDPhoswich KVIndra "KVIDPhoswich()"
Identification in Phoswich telescopes of INDRA.
Definition: KVIDPhoswich.h:28

then calling KVBase::GetPluginURI("KVIDTelescope", "KVIDPhoswich") will return "PHOS".

Most of the code is copied from TPluginManager::LoadHandlersFromEnv

Definition at line 1140 of file KVBase.cpp.

◆ GetTempFileName()

void KVBase::GetTempFileName ( TString base)
static

When called with base="toto.dat", the returned value of 'base' is "/full/path/to/temp/dir/toto.dat15930693" i.e. the full path to a file in the system temp directory (gSystem->TempDirectory) appended with the current time as returned by gSystem->Now() in order to make its name unique

Definition at line 811 of file KVBase.cpp.

◆ GetTEMPLATEDIRFilePath()

const Char_t * KVBase::GetTEMPLATEDIRFilePath ( const Char_t namefile = "")
static

Definition at line 83 of file KVBase.cpp.

◆ GetType()

const Char_t* KVBase::GetType ( ) const
inline

Definition at line 170 of file KVBase.h.

◆ GetWORKDIRFilePath()

const Char_t * KVBase::GetWORKDIRFilePath ( const Char_t namefile = "")
static

Definition at line 127 of file KVBase.cpp.

◆ gitBranch()

const Char_t * KVBase::gitBranch ( )
static

Returns git branch of sources.

Definition at line 927 of file KVBase.cpp.

◆ gitCommit()

const Char_t * KVBase::gitCommit ( )
static

Returns last git commit of sources.

Definition at line 939 of file KVBase.cpp.

◆ HasLabel()

Bool_t KVBase::HasLabel ( ) const
inline

Definition at line 196 of file KVBase.h.

◆ init()

void KVBase::init ( void  )
private

Default initialisation.

Definition at line 138 of file KVBase.cpp.

◆ InitEnvironment()

void KVBase::InitEnvironment ( )
static

STATIC method to Initialise KaliVeda environment Reads config files in $(pkgdatadir)/etc and sets up environment (data repositories, datasets, etc. etc.). Adds directory where kaliveda shared libs are installed to the dynamic path - for finding and loading plugins. Resets the gRandom random number sequence using a clock-based seed (i.e. random sequences do not repeat).

Normally, the first object created which inherits from KVBase will perform this initialisation; if you need to set up the environment before creating a KVBase object, or if you just want to be absolutely sure that the environment has been initialised, you can call this method.

Note for GNU-style installations

If KaliVeda is built with the cmake option -Dgnuinstall=yes then each user will have a working directory which will be used to store any files generated by KaliVeda at runtime.

By default the location of user's working directory is set to

$(HOME)/.kaliveda

but can be changed with variable

KaliVeda.WorkingDirectory: [directory]

in configuration file .kvrootrc. [directory] must be an absolute pathname, but can use shell variables like $(HOME).

Definition at line 181 of file KVBase.cpp.

◆ is_gnuinstall()

static bool KVBase::is_gnuinstall ( )
inlinestatic

return true if built with option -Dgnuinstall=yes i.e. GNU-style installation directories, any generated files stored in user's working directory i.e. not in installation path

Definition at line 266 of file KVBase.h.

◆ IsCalled()

virtual Bool_t KVBase::IsCalled ( const Char_t name) const
inlinevirtual

Returns true if object has given name (test value returned by GetName())

Definition at line 183 of file KVBase.h.

◆ IsLabelled()

Bool_t KVBase::IsLabelled ( const Char_t l) const
inline

return true if object label is "l"

Definition at line 200 of file KVBase.h.

◆ IsThisAPlugin()

Bool_t KVBase::IsThisAPlugin ( const TString uri,
TString base 
)
static

Returns kTRUE if 'uri' is the name of a defined plugin, in which case 'base' is the name of the base class extended by this plugin.

Most of the code is copied from TPluginManager::LoadHandlersFromEnv

Definition at line 1320 of file KVBase.cpp.

◆ IsType()

virtual Bool_t KVBase::IsType ( const Char_t typ) const
inlinevirtual

Returns true if GetType() returns the given type name

Definition at line 178 of file KVBase.h.

◆ List()

virtual void KVBase::List ( )
inlinevirtual

Definition at line 206 of file KVBase.h.

◆ LoadPlugin()

TPluginHandler * KVBase::LoadPlugin ( const Char_t base,
const Char_t uri = "0" 
)
static

Load plugin library in order to extend capabilities of base class "base", depending on the given uri (these arguments are used to call TPluginManager::FindHandler). Returns pointer to TPluginHandler. Returns 0 in case of problems. does plugin exist for given name ?

Definition at line 756 of file KVBase.cpp.

◆ OpenContextMenu()

Bool_t KVBase::OpenContextMenu ( const char *  method,
TObject obj,
const char *  alt_method_name = "" 
)
static

Open context menu for given method of object *obj. By default title of menu is 'obj->ClassName()::method' You can give an alternative method name in 'alt_method_name' Returns kFALSE if the given method is not defined for the class of object in question.

WARNING: even if this method returns kTRUE, this is no guarantee that the method has indeed been executed. The user may have pressed the 'Cancel' button...

Definition at line 1458 of file KVBase.cpp.

◆ OpenTempFile()

void KVBase::OpenTempFile ( TString base,
std::ofstream &  fp 
)
static

Opens a uniquely-named file in system temp directory (gSystem->TempDirectory) Name of file is "basexxxxxxxxxx" where "xxxxxxxxx" is current time as returned by gSystem->Now(). After opening file, 'base' contains full path to file.

Definition at line 790 of file KVBase.cpp.

◆ operator=()

KVBase & KVBase::operator= ( const KVBase other)

copy assignment operator

Definition at line 358 of file KVBase.cpp.

◆ Print()

void KVBase::Print ( Option_t option = "") const
virtual

◆ PrintSplashScreen()

void KVBase::PrintSplashScreen ( )
static

Prints welcome message and infos on version etc.

Definition at line 1556 of file KVBase.cpp.

◆ ProtectedGetX()

Double_t KVBase::ProtectedGetX ( const TF1 func,
Double_t  val,
int &  status,
Double_t  xmin = 0.0,
Double_t  xmax = 0.0 
) const

Since ROOT6, the TF1::GetX() method can no longer be used without precaution.

In ROOT5, if the value val was larger or smaller than the maximum or minimum value of the function (within its defined range) then TF1::GetX() would return X of the maximum or minimum, respectively.

In ROOT6, TF1::GetX() has been reimplemented so that, in the above case, it prints out 3 warning messages and returns a TMath::QuietNaN()! Therefore we provide this function in order to replicate the previous behaviour.

The status = 0 if the value is within the limits of the function. status = +1 if value is above the maximum, or status = -1 if value is below the minimum

When compiled with ROOT5, this method just calls TF1::GetX() (and status = 0 always).

Definition at line 1654 of file KVBase.cpp.

◆ ReadConfigFiles()

void KVBase::ReadConfigFiles ( )
staticprivate

Read all configuration files System config files are read first in the order they appear in file ${ETCDIR}/config.files Then we read any of the following files if they exist: ${HOME}/.kvrootrc ${PWD}/.kvrootrc

Definition at line 275 of file KVBase.cpp.

◆ ReadGUIMimeTypes()

void KVBase::ReadGUIMimeTypes ( )
staticprivate

Add to standard ROOT mime types some new ones defined in .kvrootrc for icons associated with graphs, runs, etc. by lines such as:

KaliVeda.GUI.MimeTypes : KVIDMap
KaliVeda.GUI.MimeTypes.KVIDMap.Icon : rootdb_t.xpm
+KaliVeda.GUI.MimeTypes : KVIDZAGrid
KaliVeda.GUI.MimeTypes.KVIDZAGrid.Icon : draw_t.xpm
Collection of graphical contours used for particle identification.
Definition: KVIDMap.h:21
KVIDMap()
Default constructor.
Definition: KVIDMap.cpp:18
Identification grid with lines corresponding to different nuclear isotopes (KVIDZALine)
Definition: KVIDZAGrid.h:65
KVIDZAGrid()
default ctor.
Definition: KVIDZAGrid.cpp:33

etc.

Definition at line 1360 of file KVBase.cpp.

◆ SearchAndOpenKVFile() [1/2]

Bool_t KVBase::SearchAndOpenKVFile ( const Char_t name,
std::ifstream &  file,
const Char_t kvsubdir = "",
KVLockfile locks = 0 
)
static

Search and open for READING a file:

search for ascii file (and open it, if found) in the following order: if 'name' = absolute path the function returns kTRUE if the file exists if name != absolute path:

  1. a. if 'kvsubdir'="" (default) look for file in directory
  1. b. if 'kvsubdir'!="" look for file in /'kvsubdir' if 'kvsubdir' is an absolute pathname, look in 'kvsubdir' if 'kvsubdir' is not an absolute pathname, look in '/kvsubdir'
  2. look for file with this name in user's home directory
  3. look for file with this name in working directory if the file is not found, kFALSE is returned. if file is found and can be opened, 'file' is then an ifstream connected to the open (ascii) file

LOCKFILE: If a KVLockfile pointer is given, we use it to get a lock on the file before opening it. If this lock is not successful, the file is not opened and we return an error message.

Definition at line 601 of file KVBase.cpp.

◆ SearchAndOpenKVFile() [2/2]

Bool_t KVBase::SearchAndOpenKVFile ( const Char_t name,
std::ofstream &  file,
const Char_t kvsubdir = "",
KVLockfile locks = 0 
)
static

Search and CREATE i.e. open for WRITING a file:

open for writing an ascii file in the location determined in the following way: if 'name' = absolute path we use the full path if name != absolute path:

  1. a. if 'kvsubdir'="" (default) file will be in directory
  1. b. if 'kvsubdir'!="": if 'kvsubdir' is an absolute pathname, file in 'kvsubdir' if 'kvsubdir' is not an absolute pathname, file will be in '/kvsubdir' if an existing file is found, a warning is printed and the existing file 'toto' is renamed "toto.date". where 'date' is created with TDatime::AsSQLDate file' is then an ofstream connected to the opened file

LOCKFILE: If a KVLockfile pointer is given, we use it to get a lock on the file before opening it. If this lock is not successful, the file is not opened and we return an error message.

Definition at line 658 of file KVBase.cpp.

◆ SearchKVFile()

Bool_t KVBase::SearchKVFile ( const Char_t name,
TString fullpath,
const Char_t kvsubdir = "" 
)
static

search for files in the following order: if 'name' = absolute path the function returns kTRUE if the file exists if name != absolute path:

  1. a. if 'kvsubdir'="" (default) look for file in directory
  1. b. if 'kvsubdir'!="": if 'kvsubdir' is an absolute pathname, look in 'kvsubdir' if 'kvsubdir' is not an absolute pathname, look in '/kvsubdir'
  2. look for file with this name in user's home directory
  3. look for file with this name in working directory in all cases the function returns kTRUE if the file was found. 'fullpath' then contains the absolute path to the file

Definition at line 541 of file KVBase.cpp.

◆ SetLabel()

void KVBase::SetLabel ( const Char_t lab)
inline
Examples
base_kvbase.C.

Definition at line 188 of file KVBase.h.

◆ SetNumber()

virtual void KVBase::SetNumber ( UInt_t  num)
inlinevirtual

Reimplemented in KVGroup.

Definition at line 209 of file KVBase.h.

◆ SetType()

virtual void KVBase::SetType ( const Char_t str)
inlinevirtual

Reimplemented in KVINDRADetector.

Definition at line 166 of file KVBase.h.

◆ WorkingDirectory()

static const Char_t* KVBase::WorkingDirectory ( )
inlinestatic

Definition at line 174 of file KVBase.h.

Member Data Documentation

◆ fEnvIsInit

Bool_t KVBase::fEnvIsInit = kFALSE
staticprivate

set when environment is initialised

Definition at line 144 of file KVBase.h.

◆ fLabel

TString KVBase::fLabel
protected

label for the object

Definition at line 141 of file KVBase.h.

◆ fNbObj

UInt_t KVBase::fNbObj = 0
staticprivate

Total number of KaliVeda objects (actually counts number of calls to default ctor)

Definition at line 138 of file KVBase.h.

◆ fNumber

UInt_t KVBase::fNumber
private

for numbering objects

Definition at line 139 of file KVBase.h.

◆ fWorkingDirectory

TString KVBase::fWorkingDirectory = "$(HOME)/.kaliveda"
staticprivate

user working directory for e.g. database files

Definition at line 145 of file KVBase.h.


The documentation for this class was generated from the following files: