Jpp 19.3.0-rc.1
the software that should make you happy
Loading...
Searching...
No Matches
JDATABASE Namespace Reference

Auxiliary classes and methods for database I/O. More...

Namespaces

namespace  APIV2
 
namespace  PBS
 Namespace for predefined PBS values.
 

Classes

struct  getSelector
 Template definition for getting table specific selector. More...
 
struct  getSelector< T, APIV2::JCalibration_t, true >
 Template specialisation for getting table specific selector. More...
 
struct  getSelector< T, APIV2::JRunCalibration, true >
 Template specialisation for getting table specific selector. More...
 
struct  getSelector< T, JAHRS, true >
 Template specialisation for getting table specific selector. More...
 
struct  getSelector< T, JAHRSDetectorCalibration, true >
 Template specialisation for getting table specific selector. More...
 
struct  getSelector< T, JAllParams, true >
 Template specialisation for getting table specific selector. More...
 
struct  getSelector< T, JCLBID, true >
 Template specialisation for getting table specific selector. More...
 
struct  getSelector< T, JCLBMap, true >
 Template specialisation for getting table specific selector. More...
 
struct  getSelector< T, JDatalogNumbers, true >
 Template specialisation for getting table specific selector. More...
 
struct  getSelector< T, JDetCalibrations, true >
 Template specialisation for getting table specific selector. More...
 
struct  getSelector< T, JDetectorIntegration, true >
 Template specialisation for getting table specific selector. More...
 
struct  getSelector< T, JDetectors, true >
 Template specialisation for getting table specific selector. More...
 
struct  getSelector< T, JPersons, true >
 Template specialisation for getting table specific selector. More...
 
struct  getSelector< T, JPMTHVRunSettings, true >
 Template specialisation for getting table specific selector. More...
 
struct  getSelector< T, JPMTHVSettings, true >
 Template specialisation for getting table specific selector. More...
 
struct  getSelector< T, JRunQuality, true >
 Template specialisation for getting table specific selector. More...
 
struct  getSelector< T, JRuns, true >
 Template specialisation for getting table specific selector. More...
 
struct  getSelector< T, JRunsetupParams, true >
 Template specialisation for getting table specific selector. More...
 
struct  getSelector< T, JRunSummaryNumbers, true >
 Template specialisation for getting table specific selector. More...
 
struct  getSelector< T, JToAshort, true >
 Template specialisation for getting table specific selector. More...
 
struct  getSelector< T, JUPI, true >
 Template specialisation for getting table specific selector. More...
 
struct  getSelector< T, JVendorHV, true >
 Template specialisation for getting table specific selector. More...
 
struct  JAHRS
 
struct  JAHRSCalibration
 
struct  JAHRSCalibration_t
 Auxiliary class to map module identifier to AHRS calibration. More...
 
struct  JAHRSCalibrationComparator
 Auxiliary data structure for sorting of AHRS calibrations. More...
 
struct  JAHRSCalibrationValidity
 Auxiliary data structure to check validity of AHRS calibration data. More...
 
struct  JAHRSDetectorCalibration
 
struct  JAHRSValidity
 Auxiliary data structure to check validity of AHRS data. More...
 
struct  JAllParams
 
struct  JCLBID
 
struct  JCLBIDHelper
 Auxiliary class for mapping UPI of central-logic board to module identifier. More...
 
struct  JCLBMap
 
class  JDatabaseObjectIterator
 Object iteration from database. More...
 
struct  JDatabaseObjectIterator< JTypeList< JHead_t, JNullType > >
 Terminator class of recursive JDatabaseObjectIterator class. More...
 
struct  JDatabaseObjectIterator< JTypeList< JHead_t, JTail_t > >
 Implementation of object iterator for multiple data types. More...
 
struct  JDatalog
 
struct  JDatalogNumbers
 
struct  JDateAndTime_t
 Date and time. More...
 
struct  JDateAndTimeUS_t
 Date and time. More...
 
struct  JDatim_t
 Auxiliairy data structure for date and time. More...
 
class  JDB
 Auxiliary class for connection to data base. More...
 
struct  JDBReader
 Auxiliary class to read object with ROOT dictionary from database. More...
 
struct  JDBString
 Wrapper class to read string until end-of-line. More...
 
struct  JDBTestTypesTuneHV
 Table listing HV-tuning database test types. More...
 
struct  JDBToolkit
 Wrapper data structure for initialisation of fuction objects. More...
 
struct  JDetCalibrations
 
struct  JDetectorIntegration
 
struct  JDetectorIntegration_t
 Detector integration. More...
 
struct  JDetectors
 
struct  JDetectorsHelper
 Auxiliary class for mapping serial number and object identifier of detectors. More...
 
struct  JGetPBSSequences
 Auxiliary class to get PBS sequences as a function of PBS. More...
 
struct  JLocation_t
 Auxiliary data structure for location of product in detector. More...
 
struct  JMACAddress
 MAC address. More...
 
struct  JNullResultSet
 Auxiliary class for invalid result set. More...
 
struct  JPBS_t
 Product breakdown structure (PBS). More...
 
struct  JPBSSequence
 Auxiliary data structure for a sequence of PBS values. More...
 
struct  JPBSSequences
 Auxiliary data structure for set of PBS sequences. More...
 
struct  JPersons
 
struct  JPMTBestHVSettings
 
class  JPMTHV
 Auxiliary class for PMT HVs. More...
 
struct  JPMTHVRunSettings
 
struct  JPMTHVSettings
 
class  JPMTRunsetupParams
 Auxiliary class for PMT run setup parameters. More...
 
class  JPMTThreshold
 Auxiliary class for PMT thresholds. More...
 
struct  JPMTValue
 Auxiliary data structure for fallback order of PMT data. More...
 
struct  JProductIntegration
 
struct  JProductIntegration_t
 Auxiliary class for product integration data. More...
 
struct  JProductRouter
 Auxiliary class to map UPI to location in detector. More...
 
struct  JQueries
 Auxiliary method to get list of table names. More...
 
struct  JRun_t
 Auxiliary class for detector/run comparisons. More...
 
struct  JRunQuality
 Auxiliary data structure for data quality. More...
 
struct  JRuns
 
struct  JRunsetup_t
 Auxiliary data structure for run setup information. More...
 
struct  JRunsetupParams
 
struct  JRunsetups
 Auxiliary class for run setup evaluation. More...
 
struct  JRunSummaryNumbers
 
class  JSelector
 Auxiliary class for specifying selection of database data. More...
 
struct  JServer
 Wrapper class for server name. More...
 
struct  JSonDictionary
 Assignment. More...
 
struct  JSonHelper
 Auxiliary base class for JSon I/O based on ROOT dictionary. More...
 
struct  JSonIO
 Assigment interface. More...
 
struct  JSonIO_t
 Assigment implementation. More...
 
struct  JToAshort
 
struct  JUPI
 
struct  JUPI_t
 Universal product identifier (UPI). More...
 
struct  JUPIHelper
 Auxiliary class for mapping PBS and serial number of product to UPI. More...
 
struct  JVendorHV
 

Typedefs

typedef JEEP::JDate<'/'> JDate_t
 type defintion of date according database format
 
typedef JEEP::JTime<':'> JTime_t
 type defintion of time according database format
 
typedef JEEP::JVersion JDBAPIVersion
 
typedef JTOOLS::JRange< JDate_tJPeriod_t
 Type definition of period.
 

Functions

std::istream & operator>> (std::istream &in, JAHRSCalibration &calibration)
 Read AHRS calibration from input stream.
 
std::ostream & operator<< (std::ostream &out, const JAHRSCalibration &calibration)
 Write AHRS calibration to output stream.
 
int getVersion (const std::string &version)
 Get numerical value of AHRS calibration version.
 
const Server & getServer (const std::string &server)
 Get server by name.
 
std::vector< JServergetServernames ()
 Get list of names of available database servers.
 
const Server & getServer ()
 Get default server.
 
const char * getPrivateCookie ()
 Get private cookie.
 
const char * getPublicCookie ()
 Get public cookie.
 
std::istream & operator>> (std::istream &in, JServer &server)
 Read server name from input stream.
 
template<class JTable_t >
const char * getTable ()
 Get table name.
 
template<class JTable_t , class JType_t >
const char * getColumn (JType_t JTable_t::*data_member)
 Get column name.
 
template<class JTable_t >
std::vector< std::string > getColumns ()
 Get column names.
 
ResultSet & getResultSet (const std::string &query)
 Get result set.
 
ResultSet & getResultSet (const std::string &query, const std::vector< Selector > &selection)
 Get result set.
 
void get_json (json &js, const std::string &query)
 Get json.
 
void get_json (json &js, const std::string &query, const std::vector< Selector > &selection)
 Get json.
 
template<class T >
bool operator>> (const std::vector< Selector > &selection, T &object)
 Read object with ROOT dictionary from selector.
 
template<class T >
bool operator>> (ResultSet &rs, T &object)
 Read object with ROOT dictionary from result set.
 
template<class JElement_t , class JAllocator_t >
bool operator>> (ResultSet &rs, std::vector< JElement_t, JAllocator_t > &buffer)
 Read multiple objects with ROOT dictionary from result set.
 
JDetectorsHelpergetDetector ()
 Auxiliary function for helper object initialisation.
 
template<class T >
getDetector (const std::string &detid)
 Get detector identifier or serial number, depending on template data type.
 
int getDetector (const std::string &detid)
 Get detector serial number.
 
std::string getDetector (const int id)
 Get detector identifier.
 
JCLBIDHelpergetCLBID ()
 Auxiliary function for helper object initialisation.
 
int getCLBID (const JUPI_t &upi)
 Get module identifier.
 
JCLBIDHelpergetCLBUPI ()
 Auxiliary function for helper object initialisation.
 
JUPI_t getCLBUPI (const int id)
 Get UPI.
 
JUPIHelpergetUPI ()
 Auxiliary function for helper object initialisation.
 
JUPI_t getUPI (const JPBS_t &pbs, const int number)
 Get UPI.
 
std::ostream & operator<< (std::ostream &out, const JPeriod_t &object)
 Write period to output stream.
 
bool is_detector (const JPBS_t &pbs)
 Test if given PBS corresponds to a detector.
 
bool is_string (const JPBS_t &pbs)
 Test if given PBS corresponds to a string.
 
bool is_optical_module (const JPBS_t &pbs)
 Test if given PBS corresponds to a optical module.
 
bool is_base_module (const JPBS_t &pbs)
 Test if given PBS corresponds to a base module.
 
bool operator< (const JRunQuality &first, const JRunQuality &second)
 Less-than operator.
 
bool operator< (const JRuns &first, const JRuns &second)
 Less-than operator.
 
const Selector::RelOp & getOperand (const int index)
 Get operand.
 
void to_json (json &js, const JDBString &object)
 Convert database string to JSon.
 
void from_json (const json &js, JDBString &object)
 Convert JSon to database string.
 
JTreeParameters getTreeParameters (const JType< JDetectors > &type)
 
JTreeParameters getTreeParameters (const JType< JRuns > &type)
 
JTreeParameters getTreeParameters (const JType< JDatalogNumbers > &type)
 
JTreeParameters getTreeParameters (const JType< JDatalog > &type)
 
JTreeParameters getTreeParameters (const JType< JVendorHV > &type)
 
JTreeParameters getTreeParameters (const JType< JAHRS > &type)
 
JTreeParameters getTreeParameters (const JType< JAHRSCalibration > &type)
 
JTreeParameters getTreeParameters (const JType< JAllParams > &type)
 
JTreeParameters getTreeParameters (const JType< JPMTHVSettings > &type)
 
JTreeParameters getTreeParameters (const JType< JPMTHVRunSettings > &type)
 
JTreeParameters getTreeParameters (const JType< JPMTBestHVSettings > &type)
 
JTreeParameters getTreeParameters (const JType< JProductIntegration > &type)
 
JTreeParameters getTreeParameters (const JType< JCLBMap > &type)
 
JTreeParameters getTreeParameters (const JType< JPersons > &type)
 
JTreeParameters getTreeParameters (const JType< JToAshort > &type)
 
JTreeParameters getTreeParameters (const JType< JRunSummaryNumbers > &type)
 
JTreeParameters getTreeParameters (const JType< JRunQuality > &type)
 
JTreeParameters getTreeParameters (const JType< JRunsetupParams > &type)
 
JTreeParameters getTreeParameters (const JType< JCLBID > &type)
 
JTreeParameters getTreeParameters (const JType< JUPI > &type)
 
template<class JTypelist_t >
const std::vector< std::string > & getQueries ()
 Get list of possible queries.
 

Variables

static const JVersion APIV2_VERSION (2, 1, 0)
 
static std::vector< std::pair< JServer, Server > > LIST_OF_SERVERS
 Named list of available database servers.
 
static const char PREFIX_COOKIE = '_'
 Cookie prefix.
 
static const std::string PREFIX_DATAFILTER = "DAQ_triggerParameters"
 This string is prepended to every parameter in the database output for the corresponding process.
 
static const std::string PREFIX_ADF = "DAQ_ADF"
 
static const std::string SPECIAL_CHARACTERS = "!@#$%^&*()-+=[]{};:'\"\\|,.<>/?"
 Special characters.
 
JDBTestTypesTuneHV getDBTestTypeTuneHV
 Function object for looking up the HV-tuning database test type corresponding to a specific version number.
 
static JDBTestTypesTuneHVgetDBVersionTuneHV = getDBTestTypeTuneHV
 Function object for looking up the HV-tuning database version number corresponding to a specific test type.
 
static JGetPBSSequences getPBSSequences
 Function object to get PBS sequences as a function of PBS.
 
const char *const OPTICS_t = "OPTICS"
 sub-system of PMT
 
const char *const PMT_THRESHOLD_t = "PMT_THRESHOLD"
 parameter name of PMT threshold
 
const char *const PMT_HV_t = "PMT_HIGHVOLT"
 parameter name of PMT high voltage
 
static const Selector::RelOp *const OPERAND []
 Available operands.
 
static const int NUMBER_OF_OPERANDS = sizeof(OPERAND) / sizeof(OPERAND[0])
 Number of available operands.
 

Detailed Description

Auxiliary classes and methods for database I/O.

Author
mdejong
mdejong, bjung

Typedef Documentation

◆ JDate_t

type defintion of date according database format

Definition at line 24 of file JDate_t.hh.

◆ JTime_t

type defintion of time according database format

Definition at line 25 of file JDate_t.hh.

◆ JDBAPIVersion

Definition at line 33 of file JDBSupportkit.hh.

◆ JPeriod_t

Type definition of period.

Definition at line 41 of file JDetectorIntegration_t.hh.

Function Documentation

◆ operator>>() [1/5]

std::istream & JDATABASE::operator>> ( std::istream & in,
JAHRSCalibration & calibration )
inline

Read AHRS calibration from input stream.

Parameters
ininput stream
calibrationAHRS calibration
Returns
input stream

Definition at line 26 of file JAHRSCalibrationToolkit.hh.

27 {
28 using namespace std;
29 using namespace JPP;
30
31 in >> calibration.ACC_OFFSET_X
32 >> calibration.ACC_OFFSET_Y
33 >> calibration.ACC_OFFSET_Z;
34
35 in >> calibration.ACC_ROT_XX >> calibration.ACC_ROT_XY >> calibration.ACC_ROT_XZ;
36 in >> calibration.ACC_ROT_YX >> calibration.ACC_ROT_YY >> calibration.ACC_ROT_YZ;
37 in >> calibration.ACC_ROT_ZX >> calibration.ACC_ROT_ZY >> calibration.ACC_ROT_ZZ;
38
39 in >> calibration.MAG_XMIN
40 >> calibration.MAG_YMIN
41 >> calibration.MAG_ZMIN;
42
43 in >> calibration.MAG_XMAX
44 >> calibration.MAG_YMAX
45 >> calibration.MAG_ZMAX;
46
47 in >> calibration.MAG_ROT_XX >> calibration.MAG_ROT_XY >> calibration.MAG_ROT_XZ;
48 in >> calibration.MAG_ROT_YX >> calibration.MAG_ROT_YY >> calibration.MAG_ROT_YZ;
49 in >> calibration.MAG_ROT_ZX >> calibration.MAG_ROT_ZY >> calibration.MAG_ROT_ZZ;
50
51 return in;
52 }
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Calibration.
Definition JHead.hh:330

◆ operator<<() [1/2]

std::ostream & JDATABASE::operator<< ( std::ostream & out,
const JAHRSCalibration & calibration )
inline

Write AHRS calibration to output stream.

Parameters
outoutput stream
calibrationAHRS calibration
Returns
output stream

Definition at line 62 of file JAHRSCalibrationToolkit.hh.

63 {
64 using namespace std;
65 using namespace JPP;
66
67 out << FIXED(9,6) << calibration.ACC_OFFSET_X << ' '
68 << FIXED(9,6) << calibration.ACC_OFFSET_Y << ' '
69 << FIXED(9,6) << calibration.ACC_OFFSET_Z << ' ';
70
71 out << FIXED(9,6) << calibration.ACC_ROT_XX << ' ' << FIXED(9,6) << calibration.ACC_ROT_XY << ' ' << FIXED(9,6) << calibration.ACC_ROT_XZ << ' ';
72 out << FIXED(9,6) << calibration.ACC_ROT_YX << ' ' << FIXED(9,6) << calibration.ACC_ROT_YY << ' ' << FIXED(9,6) << calibration.ACC_ROT_YZ << ' ';
73 out << FIXED(9,6) << calibration.ACC_ROT_ZX << ' ' << FIXED(9,6) << calibration.ACC_ROT_ZY << ' ' << FIXED(9,6) << calibration.ACC_ROT_ZZ << ' ';
74
75 out << FIXED(9,6) << calibration.MAG_XMIN << ' '
76 << FIXED(9,6) << calibration.MAG_YMIN << ' '
77 << FIXED(9,6) << calibration.MAG_ZMIN << ' ';
78
79 out << FIXED(9,6) << calibration.MAG_XMAX << ' '
80 << FIXED(9,6) << calibration.MAG_YMAX << ' '
81 << FIXED(9,6) << calibration.MAG_ZMAX << ' ';
82
83 out << FIXED(9,6) << calibration.MAG_ROT_XX << ' ' << FIXED(9,6) << calibration.MAG_ROT_XY << ' ' << FIXED(9,6) << calibration.MAG_ROT_XZ << ' ';
84 out << FIXED(9,6) << calibration.MAG_ROT_YX << ' ' << FIXED(9,6) << calibration.MAG_ROT_YY << ' ' << FIXED(9,6) << calibration.MAG_ROT_YZ << ' ';
85 out << FIXED(9,6) << calibration.MAG_ROT_ZX << ' ' << FIXED(9,6) << calibration.MAG_ROT_ZY << ' ' << FIXED(9,6) << calibration.MAG_ROT_ZZ << ' ';
86
87 return out;
88 }
Auxiliary data structure for floating point format specification.
Definition JManip.hh:448

◆ getVersion()

int JDATABASE::getVersion ( const std::string & version)
inline

Get numerical value of AHRS calibration version.

Parameters
versionversion
Returns
version

Definition at line 97 of file JAHRSCalibrationToolkit.hh.

98 {
99 using namespace std;
100 using namespace JPP;
101
102 size_t pos = version.find_last_of("vV");
103
104 if (pos != string::npos)
105 return to_value<int>(version.substr(pos+1));
106 else
107 return -1;
108 }

◆ getServer() [1/2]

const Server & JDATABASE::getServer ( const std::string & server)
inline

Get server by name.

Parameters
serverserver name
Returns
server

Definition at line 91 of file JDB.hh.

92 {
93 for (const auto& element : LIST_OF_SERVERS) {
94 if (element.first == server) {
95 return element.second;
96 }
97 }
98
99 THROW(JDatabaseException, "Invalid server name " << server);
100 }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.

◆ getServernames()

std::vector< JServer > JDATABASE::getServernames ( )
inline

Get list of names of available database servers.

Returns
server names

Definition at line 108 of file JDB.hh.

109 {
111
112 const char* const server = getenv("DATABASE_SERVER");
113
114 if (server != NULL) {
115 buffer.push_back(server);
116 }
117
118 for (const auto& element : LIST_OF_SERVERS) {
119 if (std::find(buffer.begin(), buffer.end(), element.first) == buffer.end()) {
120 buffer.push_back(element.first);
121 }
122 }
123
124 return buffer;
125 }

◆ getServer() [2/2]

const Server & JDATABASE::getServer ( )
inline

Get default server.

The default server is defined by:

  1. named server from environment variable DATABASE_SERVER; else
  2. first server in LIST_OF_SERVERS if not empty; else
  3. default server Server::Default;
Returns
server

Definition at line 138 of file JDB.hh.

139 {
140 const char* const server = getenv("DATABASE_SERVER");
141
142 if (server != NULL)
143 return getServer(server);
144 else if (!LIST_OF_SERVERS.empty())
145 return LIST_OF_SERVERS[0].second;
146 else
147 return Server::Default;
148 }
const Server & getServer(const std::string &server)
Get server by name.
Definition JDB.hh:91
static std::vector< std::pair< JServer, Server > > LIST_OF_SERVERS
Named list of available database servers.
Definition JDB.hh:76

◆ getPrivateCookie()

const char * JDATABASE::getPrivateCookie ( )
inline

Get private cookie.

Returns
cookie

Definition at line 156 of file JDB.hh.

157 {
158 const char* home = getenv("HOME");
159
160 return MAKE_CSTRING((home != NULL ? home : ".") << "/" << ".km3netdb_cookie");
161 }
#define MAKE_CSTRING(A)
Make C-string.
Definition JPrint.hh:72

◆ getPublicCookie()

const char * JDATABASE::getPublicCookie ( )
inline

Get public cookie.

Returns
cookie

Definition at line 169 of file JDB.hh.

170 {
171 return getenv("DBCOOKIE");
172 }

◆ operator>>() [2/5]

std::istream & JDATABASE::operator>> ( std::istream & in,
JServer & server )
inline

Read server name from input stream.

This operation will accordingly set the database server, if possible.

Parameters
ininput stream
serverserver
Returns
input stream

Definition at line 357 of file JDB.hh.

358 {
359 if (in >> static_cast<std::string&>(server)) {
360 JDB::setServer(getServer(server));
361 }
362
363 return in;
364 }

◆ getTable()

template<class JTable_t >
const char * JDATABASE::getTable ( )
inline

Get table name.

Returns
table name

Definition at line 373 of file JDB.hh.

374 {
375 return JTable_t::getName();
376 }

◆ getColumn()

template<class JTable_t , class JType_t >
const char * JDATABASE::getColumn ( JType_t JTable_t::* data_member)
inline

Get column name.

Parameters
data_memberdata member
Returns
column name

Definition at line 386 of file JDB.hh.

387 {
388 JTable_t* pc = NULL;
389 TClass* rc = dynamic_cast<TClass*>(TDictionary::GetDictionary(typeid(JTable_t)));
390
391 if (rc != NULL) {
392
393 for( std::unique_ptr<TIterator> i(rc->GetListOfDataMembers()->MakeIterator()); const TDataMember* p = (const TDataMember*) i->Next(); ) {
394
395 if (p->GetOffset() == (char*) &(pc->*data_member) - (char*) pc) {
396 return p->GetName();
397 }
398 }
399 }
400
401 return NULL;
402 }

◆ getColumns()

template<class JTable_t >
std::vector< std::string > JDATABASE::getColumns ( )
inline

Get column names.

Returns
column names

Definition at line 411 of file JDB.hh.

412 {
413 using namespace JPP;
414
416
417 TClass* rc = dynamic_cast<TClass*>(TDictionary::GetDictionary(typeid(JTable_t)));
418
419 if (rc != NULL) {
420
421 for (std::unique_ptr<TIterator> i(rc->GetListOfDataMembers()->MakeIterator()); const TDataMember* p = (const TDataMember*) i->Next(); ) {
422 if (JRoot::is_class(*p)) {
423 buffer.push_back(p->GetName());
424 }
425 }
426 }
427
428 return buffer;
429 }

◆ getResultSet() [1/2]

ResultSet & JDATABASE::getResultSet ( const std::string & query)
inline

Get result set.

Parameters
queryquery / table name
Returns
result set

Definition at line 438 of file JDB.hh.

439 {
440 return JDB::get()->StreamDS(query.c_str(), std::vector<Selector>());
441 }

◆ getResultSet() [2/2]

ResultSet & JDATABASE::getResultSet ( const std::string & query,
const std::vector< Selector > & selection )
inline

Get result set.

Parameters
queryquery / table name
selectionselection
Returns
result set

Definition at line 451 of file JDB.hh.

452 {
453 return JDB::get()->StreamDS(query.c_str(), selection);
454 }

◆ get_json() [1/2]

void JDATABASE::get_json ( json & js,
const std::string & query )
inline

Get json.

Parameters
jsjson
queryquery / table name

Definition at line 463 of file JDB.hh.

464 {
465 *(JDB::get()->APIv2Select(APIV2_VERSION.toString().c_str(), query.c_str(), std::vector<Selector>())) >> js;
466 }
static const JVersion APIV2_VERSION(2, 1, 0)
std::string toString() const
Convert version to string.

◆ get_json() [2/2]

void JDATABASE::get_json ( json & js,
const std::string & query,
const std::vector< Selector > & selection )
inline

Get json.

Parameters
jsjson
queryquery / table name
selectionselection

Definition at line 476 of file JDB.hh.

477 {
478 *(JDB::get()->APIv2Select(APIV2_VERSION.toString().c_str(), query.c_str(), selection)) >> js;
479 }

◆ operator>>() [3/5]

template<class T >
bool JDATABASE::operator>> ( const std::vector< Selector > & selection,
T & object )
inline

Read object with ROOT dictionary from selector.

Parameters
selectionselection
objectobject
Returns
true if read; else false

Definition at line 49 of file JDBReader.hh.

50 {
51 using namespace std;
52 using namespace JPP;
53
54 JRootReader reader(null, JEquationParameters(), JDBDictionary::getInstance());
55
56 JRootReadableClass cls(object);
57
58 for (vector<Selector>::const_iterator i = selection.begin(); i != selection.end(); ++i) {
59
60 string parameter = to_upper(i->Name);
61
62 for (string::const_iterator i = SPECIAL_CHARACTERS.begin(); i != SPECIAL_CHARACTERS.end(); ++i) {
63 for (string::size_type pos; (pos = parameter.find(*i)) != string::npos; ) {
64 parameter.erase(pos);
65 }
66 }
67
68 JRootReadableClass abc = cls.find(parameter.c_str());
69
70 if (abc.is_valid()) {
71
72 JRedirectString redirect(reader, i->Value);
73
74 reader.getObject(abc);
75 }
76 }
77
78 return true;
79 }
Simple data structure to support I/O of equations (see class JLANG::JEquation).
This class can be used to temporarily redirect an input stream to an input string.
Implementation for ASCII input of objects with ROOT dictionary.
static const std::string SPECIAL_CHARACTERS
Special characters.
Definition JDBReader.hh:38
bool is_valid() const
Check validity of this addressable class.
JRootAddressableClass find(const char *const name) const
Find addressable base class or data member with given name within current class.
ROOT class for reading into object.

◆ operator>>() [4/5]

template<class T >
bool JDATABASE::operator>> ( ResultSet & rs,
T & object )
inline

Read object with ROOT dictionary from result set.

Parameters
rsresult set
objectobject
Returns
true if read; else false

Definition at line 188 of file JDBReader.hh.

189 {
191
192 if (rs.Next()) {
193
194 object = reader(rs);
195
196 return true;
197 }
198
199 return false;
200 }
Auxiliary class to read object with ROOT dictionary from database.
Definition JDBReader.hh:97

◆ operator>>() [5/5]

template<class JElement_t , class JAllocator_t >
bool JDATABASE::operator>> ( ResultSet & rs,
std::vector< JElement_t, JAllocator_t > & buffer )
inline

Read multiple objects with ROOT dictionary from result set.

Parameters
rsresult set
buffercontainer of objects with ROOT dictionary
Returns
true if read; else false

Definition at line 211 of file JDBReader.hh.

212 {
213 for (JElement_t object; rs >> object; ) {
214 buffer.push_back(object);
215 }
216
217 return true;
218 }

◆ getDetector() [1/4]

JDetectorsHelper & JDATABASE::getDetector ( )
inline

Auxiliary function for helper object initialisation.

Returns
helper object

Definition at line 378 of file JDBToolkit.hh.

379 {
380 return JDetectorsHelper::helper;
381 }

◆ getDetector() [2/4]

template<class T >
T JDATABASE::getDetector ( const std::string & detid)
inline

Get detector identifier or serial number, depending on template data type.

Parameters
detidobject identifier or serial number
Returns
object identifier or serial number

Definition at line 391 of file JDBToolkit.hh.

392 {
393 return JDetectorsHelper::helper(detid, JType<T>());
394 }
Auxiliary class for a type holder.
Definition JType.hh:19

◆ getDetector() [3/4]

int JDATABASE::getDetector ( const std::string & detid)
inline

Get detector serial number.

Parameters
detidobject identifier
Returns
serial number

Definition at line 403 of file JDBToolkit.hh.

404 {
405 return JDetectorsHelper::helper(detid);
406 }

◆ getDetector() [4/4]

std::string JDATABASE::getDetector ( const int id)
inline

Get detector identifier.

Parameters
idserial number
Returns
object identifier

Definition at line 415 of file JDBToolkit.hh.

416 {
417 return JDetectorsHelper::helper(id);
418 }

◆ getCLBID() [1/2]

JCLBIDHelper & JDATABASE::getCLBID ( )
inline

Auxiliary function for helper object initialisation.

Returns
helper

Definition at line 426 of file JDBToolkit.hh.

427 {
428 return JCLBIDHelper::helper;
429 }

◆ getCLBID() [2/2]

int JDATABASE::getCLBID ( const JUPI_t & upi)
inline

Get module identifier.

Parameters
upiUPI
Returns
module identifier

Definition at line 438 of file JDBToolkit.hh.

439 {
440 return JCLBIDHelper::helper(upi);
441 }

◆ getCLBUPI() [1/2]

JCLBIDHelper & JDATABASE::getCLBUPI ( )
inline

Auxiliary function for helper object initialisation.

Returns
helper

Definition at line 449 of file JDBToolkit.hh.

450 {
451 return JCLBIDHelper::helper;
452 }

◆ getCLBUPI() [2/2]

JUPI_t JDATABASE::getCLBUPI ( const int id)
inline

Get UPI.

Parameters
idmodule identifier
Returns
UPI

Definition at line 461 of file JDBToolkit.hh.

462 {
463 return JCLBIDHelper::helper(id);
464 }

◆ getUPI() [1/2]

JUPIHelper & JDATABASE::getUPI ( )
inline

Auxiliary function for helper object initialisation.

Returns
helper

Definition at line 472 of file JDBToolkit.hh.

473 {
474 return JUPIHelper::helper;
475 }

◆ getUPI() [2/2]

JUPI_t JDATABASE::getUPI ( const JPBS_t & pbs,
const int number )
inline

Get UPI.

Parameters
pbsPBS
numberserial number
Returns
UPI

Definition at line 485 of file JDBToolkit.hh.

486 {
487 return JUPIHelper::helper(pbs, number);
488 }

◆ operator<<() [2/2]

std::ostream & JDATABASE::operator<< ( std::ostream & out,
const JPeriod_t & object )
inline

Write period to output stream.

Parameters
outoutput stream
objectperiod
Returns
output stream

Definition at line 51 of file JDetectorIntegration_t.hh.

52 {
53 return out << "(" << object.getLowerLimit() << "," << object.getUpperLimit() << ")";
54 }

◆ is_detector()

bool JDATABASE::is_detector ( const JPBS_t & pbs)
inline

Test if given PBS corresponds to a detector.

Parameters
pbsPBS
Returns
true if detector; else false

Definition at line 255 of file JPBS_t.hh.

256 {
257 return (pbs == PBS::DETECTOR);
258 }

◆ is_string()

bool JDATABASE::is_string ( const JPBS_t & pbs)
inline

Test if given PBS corresponds to a string.

Parameters
pbsPBS
Returns
true if string; else false

Definition at line 267 of file JPBS_t.hh.

268 {
269 return (pbs == PBS::DETECTION_UNIT);
270 }

◆ is_optical_module()

bool JDATABASE::is_optical_module ( const JPBS_t & pbs)
inline

Test if given PBS corresponds to a optical module.

Parameters
pbsPBS
Returns
true if optical module; else false

Definition at line 279 of file JPBS_t.hh.

280 {
281 return (pbs == PBS::DOM);
282 }

◆ is_base_module()

bool JDATABASE::is_base_module ( const JPBS_t & pbs)
inline

Test if given PBS corresponds to a base module.

Parameters
pbsPBS
Returns
true if base module; else false

Definition at line 291 of file JPBS_t.hh.

292 {
293 return (pbs == PBS::BASE ||
294 pbs == PBS::BASE_CONTAINER);
295 }

◆ operator<() [1/2]

bool JDATABASE::operator< ( const JRunQuality & first,
const JRunQuality & second )
inline

Less-than operator.

Parameters
firstfirst run quality
secondsecond run quality
Returns
true if first run quality less than second; else false

Definition at line 199 of file JRunQuality.hh.

201 {
202 if (first.detector == second.detector)
203 return first.run < second.run;
204 else
205 return first.detector < second.detector;
206 }
int detector
detector identifier

◆ operator<() [2/2]

bool JDATABASE::operator< ( const JRuns & first,
const JRuns & second )
inline

Less-than operator.

Parameters
firstfirst run
secondsecond run
Returns
true if first run less than second; else false

Definition at line 58 of file JRuns.hh.

60 {
61 if (first.DETID == second.DETID)
62 return first.RUN < second.RUN;
63 else
64 return first.DETID < second.DETID;
65 }
int DETID
constraint
Definition JRuns.hh:22

◆ getOperand()

const Selector::RelOp & JDATABASE::getOperand ( const int index)
inline

Get operand.

Parameters
indexindex
Returns
operand

Definition at line 56 of file JDB/JSelector.hh.

57 {
58 if (index >= 0 && index <= NUMBER_OF_OPERANDS)
59 return *OPERAND[index];
60 else
61 THROW(JIndexOutOfRange, "Invalid index " << index);
62 }
Exception for accessing an index in a collection that is outside of its range.
static const Selector::RelOp *const OPERAND[]
Available operands.

◆ to_json()

void JDATABASE::to_json ( json & js,
const JDBString & object )
inline

Convert database string to JSon.

Parameters
jsjson
objectdatabase string

Definition at line 47 of file JSonSupportkit.hh.

48 {
49 js = json(static_cast<const std::string&>(object));
50 }
nlohmann::json json

◆ from_json()

void JDATABASE::from_json ( const json & js,
JDBString & object )
inline

Convert JSon to database string.

Parameters
jsjson
objectdatabase string

Definition at line 59 of file JSonSupportkit.hh.

60 {
61 static_cast<std::string&>(object) = js.get<std::string>();
62 }

◆ getTreeParameters() [1/20]

JTreeParameters JDATABASE::getTreeParameters ( const JType< JDetectors > & type)
inline
Parameters
typedata type
Returns
TTree parameters

Definition at line 30 of file JDB/JSupport.hh.

31 {
32 return JTreeParameters("DB_DETECTORS", "db_detectors", "", 2);
33 }
Data structure for TTree parameters.

◆ getTreeParameters() [2/20]

JTreeParameters JDATABASE::getTreeParameters ( const JType< JRuns > & type)
inline
Parameters
typedata type
Returns
TTree parameters

Definition at line 39 of file JDB/JSupport.hh.

40 {
41 return JTreeParameters("DB_RUNS", "db_runs", "", 2);
42 }

◆ getTreeParameters() [3/20]

JTreeParameters JDATABASE::getTreeParameters ( const JType< JDatalogNumbers > & type)
inline
Parameters
typedata type
Returns
TTree parameters

Definition at line 48 of file JDB/JSupport.hh.

49 {
50 return JTreeParameters("DATALOGNUMBERS", "", "datalognumbers", 2);
51 }

◆ getTreeParameters() [4/20]

JTreeParameters JDATABASE::getTreeParameters ( const JType< JDatalog > & type)
inline
Parameters
typedata type
Returns
TTree parameters

Definition at line 57 of file JDB/JSupport.hh.

58 {
59 return JTreeParameters("DATALOG", "", "datalog", 2);
60 }

◆ getTreeParameters() [5/20]

JTreeParameters JDATABASE::getTreeParameters ( const JType< JVendorHV > & type)
inline
Parameters
typedata type
Returns
TTree parameters

Definition at line 66 of file JDB/JSupport.hh.

67 {
68 return JTreeParameters("VENDOR_HV", "vendor_hv", "", 2);
69 }

◆ getTreeParameters() [6/20]

JTreeParameters JDATABASE::getTreeParameters ( const JType< JAHRS > & type)
inline
Parameters
typedata type
Returns
TTree parameters

Definition at line 75 of file JDB/JSupport.hh.

76 {
77 return JTreeParameters("AHRS", "ahrs", "", 2);
78 }

◆ getTreeParameters() [7/20]

JTreeParameters JDATABASE::getTreeParameters ( const JType< JAHRSCalibration > & type)
inline
Parameters
typedata type
Returns
TTree parameters

Definition at line 84 of file JDB/JSupport.hh.

85 {
86 return JTreeParameters("AHRSCALIB", "ahrscalib", "", 2);
87 }

◆ getTreeParameters() [8/20]

JTreeParameters JDATABASE::getTreeParameters ( const JType< JAllParams > & type)
inline
Parameters
typedata type
Returns
TTree parameters

Definition at line 93 of file JDB/JSupport.hh.

94 {
95 return JTreeParameters("DB_ALLPARAMS", "db_allparams", "", 2);
96 }

◆ getTreeParameters() [9/20]

JTreeParameters JDATABASE::getTreeParameters ( const JType< JPMTHVSettings > & type)
inline
Parameters
typedata type
Returns
TTree parameters

Definition at line 102 of file JDB/JSupport.hh.

103 {
104 return JTreeParameters("HV_SETTINGS", "hv_settings", "", 2);
105 }

◆ getTreeParameters() [10/20]

JTreeParameters JDATABASE::getTreeParameters ( const JType< JPMTHVRunSettings > & type)
inline
Parameters
typedata type
Returns
TTree parameters

Definition at line 111 of file JDB/JSupport.hh.

112 {
113 return JTreeParameters("HV_RUN_SETTINGS", "hv_run_settings", "", 2);
114 }

◆ getTreeParameters() [11/20]

JTreeParameters JDATABASE::getTreeParameters ( const JType< JPMTBestHVSettings > & type)
inline
Parameters
typedata type
Returns
TTree parameters

Definition at line 120 of file JDB/JSupport.hh.

121 {
122 return JTreeParameters("BEST_HV_SETTINGS", "best_hv_settings", "", 2);
123 }

◆ getTreeParameters() [12/20]

JTreeParameters JDATABASE::getTreeParameters ( const JType< JProductIntegration > & type)
inline
Parameters
typedata type
Returns
TTree parameters

Definition at line 129 of file JDB/JSupport.hh.

130 {
131 return JTreeParameters("INTEGRATION", "integration", "", 2);
132 }

◆ getTreeParameters() [13/20]

JTreeParameters JDATABASE::getTreeParameters ( const JType< JCLBMap > & type)
inline
Parameters
typedata type
Returns
TTree parameters

Definition at line 138 of file JDB/JSupport.hh.

139 {
140 return JTreeParameters("CLBMAP", "clbmap", "", 2);
141 }

◆ getTreeParameters() [14/20]

JTreeParameters JDATABASE::getTreeParameters ( const JType< JPersons > & type)
inline
Parameters
typedata type
Returns
TTree parameters

Definition at line 147 of file JDB/JSupport.hh.

148 {
149 return JTreeParameters("PERSONS", "persons", "", 2);
150 }

◆ getTreeParameters() [15/20]

JTreeParameters JDATABASE::getTreeParameters ( const JType< JToAshort > & type)
inline
Parameters
typedata type
Returns
TTree parameters

Definition at line 156 of file JDB/JSupport.hh.

157 {
158 return JTreeParameters("DB_TOASHORT", "db_toashort", "", 2);
159 }

◆ getTreeParameters() [16/20]

JTreeParameters JDATABASE::getTreeParameters ( const JType< JRunSummaryNumbers > & type)
inline
Parameters
typedata type
Returns
TTree parameters

Definition at line 165 of file JDB/JSupport.hh.

166 {
167 return JTreeParameters("DB_RUNSUMMARYNUMBERS", "db_runsummarynumbers", "", 2);
168 }

◆ getTreeParameters() [17/20]

JTreeParameters JDATABASE::getTreeParameters ( const JType< JRunQuality > & type)
inline
Parameters
typedata type
Returns
TTree parameters

Definition at line 174 of file JDB/JSupport.hh.

175 {
176 return JTreeParameters("DB_RUNQUALITY", "db_runquality", "", 2);
177 }

◆ getTreeParameters() [18/20]

JTreeParameters JDATABASE::getTreeParameters ( const JType< JRunsetupParams > & type)
inline
Parameters
typedata type
Returns
TTree parameters

Definition at line 183 of file JDB/JSupport.hh.

184 {
185 return JTreeParameters("DB_RUNSETUPPARAMS", "db_runsetupparams", "", 2);
186 }

◆ getTreeParameters() [19/20]

JTreeParameters JDATABASE::getTreeParameters ( const JType< JCLBID > & type)
inline
Parameters
typedata type
Returns
TTree parameters

Definition at line 192 of file JDB/JSupport.hh.

193 {
194 return JTreeParameters("DB_CLBID", "db_clbid", "", 2);
195 }

◆ getTreeParameters() [20/20]

JTreeParameters JDATABASE::getTreeParameters ( const JType< JUPI > & type)
inline
Parameters
typedata type
Returns
TTree parameters

Definition at line 201 of file JDB/JSupport.hh.

202 {
203 return JTreeParameters("DB_UPI", "db_upi", "", 2);
204 }

◆ getQueries()

template<class JTypelist_t >
const std::vector< std::string > & JDATABASE::getQueries ( )
inline

Get list of possible queries.

Returns
list of possible queries

Definition at line 244 of file JDB/JSupport.hh.

245 {
246 static const JQueries<JTypelist_t> buffer;
247
248 return buffer;
249 }
Auxiliary method to get list of table names.

Variable Documentation

◆ APIV2_VERSION

const JVersion JDATABASE::APIV2_VERSION(2, 1, 0) ( 2 ,
1 ,
0  )
static

◆ LIST_OF_SERVERS

std::vector< std::pair<JServer, Server> > JDATABASE::LIST_OF_SERVERS
static
Initial value:
= {
{ "Default", Server::Default },
{ "Test", Server::Test },
{ "Lyon", Server::Lyon },
{ "Lyon2", Server::Lyon2 },
{ "Napoli", Server::Napoli }
}

Named list of available database servers.

Definition at line 76 of file JDB.hh.

76 {
77 { "Default", Server::Default },
78 { "Test", Server::Test },
79 { "Lyon", Server::Lyon },
80 { "Lyon2", Server::Lyon2 },
81 { "Napoli", Server::Napoli }
82 };

◆ PREFIX_COOKIE

const char JDATABASE::PREFIX_COOKIE = '_'
static

Cookie prefix.

Definition at line 178 of file JDB.hh.

◆ PREFIX_DATAFILTER

const std::string JDATABASE::PREFIX_DATAFILTER = "DAQ_triggerParameters"
static

This string is prepended to every parameter in the database output for the corresponding process.

Definition at line 184 of file JDB.hh.

◆ PREFIX_ADF

const std::string JDATABASE::PREFIX_ADF = "DAQ_ADF"
static

Definition at line 185 of file JDB.hh.

◆ SPECIAL_CHARACTERS

const std::string JDATABASE::SPECIAL_CHARACTERS = "!@#$%^&*()-+=[]{};:'\"\\|,.<>/?"
static

Special characters.

Definition at line 38 of file JDBReader.hh.

◆ getDBTestTypeTuneHV

JDBTestTypesTuneHV JDATABASE::getDBTestTypeTuneHV

Function object for looking up the HV-tuning database test type corresponding to a specific version number.

Definition at line 5 of file JDBSupportkit.cc.

◆ getDBVersionTuneHV

JDBTestTypesTuneHV& JDATABASE::getDBVersionTuneHV = getDBTestTypeTuneHV
static

Function object for looking up the HV-tuning database version number corresponding to a specific test type.

Definition at line 198 of file JDBSupportkit.hh.

◆ getPBSSequences

JGetPBSSequences JDATABASE::getPBSSequences
static

Function object to get PBS sequences as a function of PBS.

Definition at line 276 of file JPBSSequence.hh.

◆ OPTICS_t

const char* const JDATABASE::OPTICS_t = "OPTICS"

sub-system of PMT

Definition at line 29 of file JPMTRunsetupParams.hh.

◆ PMT_THRESHOLD_t

const char* const JDATABASE::PMT_THRESHOLD_t = "PMT_THRESHOLD"

parameter name of PMT threshold

Definition at line 30 of file JPMTRunsetupParams.hh.

◆ PMT_HV_t

const char* const JDATABASE::PMT_HV_t = "PMT_HIGHVOLT"

parameter name of PMT high voltage

Definition at line 31 of file JPMTRunsetupParams.hh.

◆ OPERAND

const Selector::RelOp* const JDATABASE::OPERAND[]
static
Initial value:
=
{
&Selector::RelOp::Equal,
&Selector::RelOp::Different,
&Selector::RelOp::Less,
&Selector::RelOp::LessEqual,
&Selector::RelOp::Greater,
&Selector::RelOp::GreaterEqual
}

Available operands.

Definition at line 33 of file JDB/JSelector.hh.

34 {
35 &Selector::RelOp::Equal,
36 &Selector::RelOp::Different,
37 &Selector::RelOp::Less,
38 &Selector::RelOp::LessEqual,
39 &Selector::RelOp::Greater,
40 &Selector::RelOp::GreaterEqual
41 };

◆ NUMBER_OF_OPERANDS

const int JDATABASE::NUMBER_OF_OPERANDS = sizeof(OPERAND) / sizeof(OPERAND[0])
static

Number of available operands.

Definition at line 47 of file JDB/JSelector.hh.