REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
Loading...
Searching...
No Matches
TRestDataBase Class Reference

Detailed Description

Definition at line 82 of file TRestDataBase.h.

Public Member Functions

virtual DBTable exec (std::string cmd)
 return a table from query std::string cmd
virtual int get_lastrun ()
 get the latest run id in database
virtual void Initialize ()
 default: read the dataURL file
virtual void print (std::string cmd)
 print the table after query std::string cmd
virtual DBEntry query_data (DBEntry info)
virtual DBEntry query_run (int runnumber)
virtual DBFile query_run_file (int runnumber, int fileid)
 return file of certain file id in certain run
virtual std::vector< DBFile > query_run_files (int runnumber)
 return all the files of the run
virtual std::vector< int > search_run (DBEntry info)
 search runs according to the run info. return a list of run numbers
virtual std::vector< int > search_run_with_file (std::string filepattern)
 search runs according to the file name. return a list of run numbers
virtual int set_data (DBEntry info, bool overwrite=true)
 add/update a new record of metadata in database
virtual int set_run (DBEntry info, bool overwrite=true)
 add/update a run, with run info as struct DBEntry. returns the added run id
virtual int set_runfile (int runnumber, std::string filename)
 add/update a runfile to the specified run
virtual void test ()
 test function
 TRestDataBase ()
 default constructor, setting fConnectionString according to the env
 ~TRestDataBase ()
 destructor

Protected Attributes

std::string fConnectionString
std::vector< DBEntry > fDataEntries

Constructor & Destructor Documentation

◆ TRestDataBase()

TRestDataBase::TRestDataBase ( )

default constructor, setting fConnectionString according to the env

Definition at line 146 of file TRestDataBase.cxx.

◆ ~TRestDataBase()

TRestDataBase::~TRestDataBase ( )
inline

destructor

Definition at line 91 of file TRestDataBase.h.

Member Function Documentation

◆ exec()

virtual DBTable TRestDataBase::exec ( std::string cmd)
inlinevirtual

return a table from query std::string cmd

Definition at line 100 of file TRestDataBase.h.

◆ get_lastrun()

int TRestDataBase::get_lastrun ( )
virtual

get the latest run id in database

get the latest run in database

Get the latest run in database, by reading the file: $REST_USER_PATH/runNumber. Note that this file saves run number of the next run. So it returns The run number -1.

Definition at line 160 of file TRestDataBase.cxx.

◆ Initialize()

void TRestDataBase::Initialize ( )
virtual

default: read the dataURL file

Definition at line 72 of file TRestDataBase.cxx.

◆ print()

virtual void TRestDataBase::print ( std::string cmd)
inlinevirtual

print the table after query std::string cmd

Definition at line 98 of file TRestDataBase.h.

◆ query_data()

DBEntry TRestDataBase::query_data ( DBEntry _info)
virtual

metadata management interface ////////////////////// return the piece of data in fMetadataEntries

The following specification of DBEntry's content means to match any: id <= 0, type == "" ,usr == "" ,tag == "" ,description == "" ,version == "". If all of them mean any, it will return a blank list.

Definition at line 236 of file TRestDataBase.cxx.

◆ query_run()

virtual DBEntry TRestDataBase::query_run ( int runnumber)
inlinevirtual

run number management interface ////////////////////// return the run number of the run. If not exist, return 0

Definition at line 104 of file TRestDataBase.h.

◆ query_run_file()

virtual DBFile TRestDataBase::query_run_file ( int runnumber,
int fileid )
inlinevirtual

return file of certain file id in certain run

Definition at line 106 of file TRestDataBase.h.

◆ query_run_files()

virtual std::vector< DBFile > TRestDataBase::query_run_files ( int runnumber)
inlinevirtual

return all the files of the run

Definition at line 108 of file TRestDataBase.h.

◆ search_run()

virtual std::vector< int > TRestDataBase::search_run ( DBEntry info)
inlinevirtual

search runs according to the run info. return a list of run numbers

Definition at line 111 of file TRestDataBase.h.

◆ search_run_with_file()

virtual std::vector< int > TRestDataBase::search_run_with_file ( std::string filepattern)
inlinevirtual

search runs according to the file name. return a list of run numbers

Definition at line 113 of file TRestDataBase.h.

◆ set_data()

virtual int TRestDataBase::set_data ( DBEntry info,
bool overwrite = true )
inlinevirtual

add/update a new record of metadata in database

Definition at line 127 of file TRestDataBase.h.

◆ set_run()

int TRestDataBase::set_run ( DBEntry info,
bool overwrite = true )
virtual

add/update a run, with run info as struct DBEntry. returns the added run id

add a new run, with run info as struct DBEntry. returns the added run id

runs are added according to info.id of input DBEntry object: -1 --> do not add 0 --> append a new run in run list >0 --> directly use this run number, overwrite existing

It will write to the file: $REST_USER_PATH/runNumber is writable. The number written will be the next run number

The method in derived class shall follow this rule.

Definition at line 199 of file TRestDataBase.cxx.

◆ set_runfile()

virtual int TRestDataBase::set_runfile ( int runnumber,
std::string filename )
inlinevirtual

add/update a runfile to the specified run

Definition at line 121 of file TRestDataBase.h.

◆ test()

virtual void TRestDataBase::test ( )
inlinevirtual

test function

Definition at line 96 of file TRestDataBase.h.

Field Documentation

◆ fConnectionString

std::string TRestDataBase::fConnectionString
protected

Definition at line 85 of file TRestDataBase.h.

◆ fDataEntries

std::vector<DBEntry> TRestDataBase::fDataEntries
protected

Definition at line 84 of file TRestDataBase.h.


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