Jpp  master_rocky
the software that should make you happy
Namespaces | Classes | Typedefs | Functions | Variables
JDATABASE Namespace Reference

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

Namespaces

 APIV2
 
 PBS
 Namespace for predefined PBS values.
 

Classes

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

Typedefs

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

Functions

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

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

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).
Definition: JSTDTypes.hh:14
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 90 of file JDB.hh.

91  {
92  for (const auto& element : LIST_OF_SERVERS) {
93  if (element.first == server) {
94  return element.second;
95  }
96  }
97 
98  THROW(JDatabaseException, "Invalid server name " << server);
99  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:712
Database exception.
Definition: JException.hh:684
static std::vector< std::pair< JServer, Server > > LIST_OF_SERVERS
Named list of available database servers.
Definition: JDB.hh:75

◆ getServernames()

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

Get list of names of available database servers.

Returns
server names

Definition at line 107 of file JDB.hh.

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

◆ 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 137 of file JDB.hh.

138  {
139  const char* const server = getenv("DATABASE_SERVER");
140 
141  if (server != NULL)
142  return getServer(server);
143  else if (!LIST_OF_SERVERS.empty())
144  return LIST_OF_SERVERS[0].second;
145  else
146  return Server::Default;
147  }
const Server & getServer()
Get default server.
Definition: JDB.hh:137

◆ getPrivateCookie()

const char* JDATABASE::getPrivateCookie ( )
inline

Get private cookie.

Returns
cookie

Definition at line 155 of file JDB.hh.

156  {
157  const char* home = getenv("HOME");
158 
159  return MAKE_CSTRING((home != NULL ? home : ".") << "/" << ".km3netdb_cookie");
160  }
#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 168 of file JDB.hh.

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

◆ 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 356 of file JDB.hh.

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

◆ getTable()

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

Get table name.

Returns
table name

Definition at line 372 of file JDB.hh.

373  {
374  return JTable_t::getName();
375  }
const char * getName()
Get ROOT name of given data type.
Definition: JRootToolkit.hh:62

◆ 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 385 of file JDB.hh.

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

◆ getColumns()

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

Get column names.

Returns
column names

Definition at line 410 of file JDB.hh.

411  {
412  using namespace JPP;
413 
415 
416  TClass* rc = dynamic_cast<TClass*>(TDictionary::GetDictionary(typeid(JTable_t)));
417 
418  if (rc != NULL) {
419 
420  for (std::unique_ptr<TIterator> i(rc->GetListOfDataMembers()->MakeIterator()); const TDataMember* p = (const TDataMember*) i->Next(); ) {
421  if (JRootClass::is_class(*p)) {
422  buffer.push_back(p->GetName());
423  }
424  }
425  }
426 
427  return buffer;
428  }
static bool is_class(const char *const name)
Check name of class against ROOT classes.
Definition: JRootClass.hh:50

◆ getResultSet() [1/2]

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

Get result set.

Parameters
queryquery / table name
Returns
result set

Definition at line 437 of file JDB.hh.

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

◆ 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 450 of file JDB.hh.

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

◆ 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 462 of file JDB.hh.

463  {
464  *(JDB::get()->APIv2Select(APIV2_VERSION.toString().c_str(), query.c_str(), std::vector<Selector>())) >> js;
465  }
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 475 of file JDB.hh.

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

◆ 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 
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
std::string to_upper(const std::string &value)
Convert all character to upper case.
T & getInstance(const T &object)
Get static instance from temporary object.
Definition: JObject.hh:75
bool is_valid() const
Check validity of this addressable class.
Definition: JRootClass.hh:471
JRootAddressableClass find(const char *const name) const
Find addressable base class or data member with given name within current class.
Definition: JRootClass.hh:483
ROOT class for reading object.
Definition: JRootClass.hh:544

◆ 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/3]

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/3]

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

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

Get detector serial number.

Parameters
detidobject identifier or serial number
Returns
object identifier or serial number
Parameters
detidobject identifier
Returns
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/3]

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  }
static const JPBS_t DETECTOR(0)
PBS of detector

◆ 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  }
static const JPBS_t DETECTION_UNIT(3)
PBS of detection unit

◆ 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  }
static const JPBS_t DOM(3, 4)
PBS of optical module

◆ 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  }
static const JPBS_t BASE(3, 2)
PBS of detection unit base
static const JPBS_t BASE_CONTAINER(3, 2, 2)
PBS of detection unit base container

◆ 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
Definition: JRunQuality.hh:143

◆ 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.
Definition: JException.hh:108
static const int NUMBER_OF_OPERANDS
Number of available operands.
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 46 of file JSonSupportkit.hh.

47  {
48  js = json(static_cast<const std::string&>(object));
49  }
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 58 of file JSonSupportkit.hh.

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

◆ 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  }

◆ 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  }

Variable Documentation

◆ APIV2_VERSION

const JVersion JDATABASE::APIV2_VERSION(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 75 of file JDB.hh.

◆ PREFIX_COOKIE

const char JDATABASE::PREFIX_COOKIE = '_'
static

Cookie prefix.

Definition at line 177 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 183 of file JDB.hh.

◆ PREFIX_ADF

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

Definition at line 184 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.

◆ 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.