Jpp  17.3.2
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Namespaces | Classes | Typedefs | Functions | Variables
JDATABASE Namespace Reference

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

Namespaces

 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  JCalibration_t
 
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  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  JDBAPIVersion
 Auxiliary data structure for I/O of database API versions. 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  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
 
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  JRunCalibration_t
 
struct  JRunCalibration
 
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, JCalibration_t, true >
 Template specialisation for getting table specific selector. More...
 
struct  getSelector< T, 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 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::stringgetColumns ()
 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 to_json (json &js, const std::string &query)
 Get result set. More...
 
void to_json (json &js, const std::string &query, const std::vector< Selector > &selection)
 Get result set. 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 >
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...
 
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 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

type defintion of date according database format

Definition at line 24 of file JDate_t.hh.

type defintion of time according database format

Definition at line 25 of file JDate_t.hh.

Type definition of period.

Definition at line 41 of file JDetectorIntegration_t.hh.

Function Documentation

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  }
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Definition: JCanberra.sh:46
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:446
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  }
version
Definition: JEditTuneHV.sh:5
const Server& JDATABASE::getServer ( const std::string server)
inline

Get server by name.

Parameters
serverserver name
Returns
server

Definition at line 84 of file JDB.hh.

85  {
86  for (const auto& element : LIST_OF_SERVERS) {
87  if (element.first == server) {
88  return element.second;
89  }
90  }
91 
92  THROW(JDatabaseException, "Invalid server name " << server);
93  }
static std::vector< std::pair< JServer, Server > > LIST_OF_SERVERS
Named list of available database servers.
Definition: JDB.hh:69
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:696
std::vector<JServer> JDATABASE::getServernames ( )
inline

Get list of names of available database servers.

Returns
server names

Definition at line 101 of file JDB.hh.

102  {
103  std::vector<JServer> buffer;
104 
105  const char* const server = getenv("DATABASE_SERVER");
106 
107  if (server != NULL) {
108  buffer.push_back(server);
109  }
110 
111  for (const auto& element : LIST_OF_SERVERS) {
112  if (std::find(buffer.begin(), buffer.end(), element.first) == buffer.end()) {
113  buffer.push_back(element.first);
114  }
115  }
116 
117  return buffer;
118  }
static std::vector< std::pair< JServer, Server > > LIST_OF_SERVERS
Named list of available database servers.
Definition: JDB.hh:69
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 131 of file JDB.hh.

132  {
133  const char* const server = getenv("DATABASE_SERVER");
134 
135  if (server != NULL)
136  return getServer(server);
137  else if (!LIST_OF_SERVERS.empty())
138  return LIST_OF_SERVERS[0].second;
139  else
140  return Server::Default;
141  }
static std::vector< std::pair< JServer, Server > > LIST_OF_SERVERS
Named list of available database servers.
Definition: JDB.hh:69
const Server & getServer(const std::string &server)
Get server by name.
Definition: JDB.hh:84
const char* JDATABASE::getPrivateCookie ( )
inline

Get private cookie.

Returns
cookie

Definition at line 149 of file JDB.hh.

150  {
151  const char* home = getenv("HOME");
152 
153  return MAKE_CSTRING((home != NULL ? home : ".") << "/" << ".km3netdb_cookie");
154  }
#define MAKE_CSTRING(A)
Make C-string.
Definition: JPrint.hh:136
const char* JDATABASE::getPublicCookie ( )
inline

Get public cookie.

Returns
cookie

Definition at line 162 of file JDB.hh.

163  {
164  return getenv("DBCOOKIE");
165  }
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 350 of file JDB.hh.

351  {
352  if (in >> static_cast<std::string&>(server)) {
353  JDB::setServer(getServer(server));
354  }
355 
356  return in;
357  }
const Server & getServer(const std::string &server)
Get server by name.
Definition: JDB.hh:84
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Definition: JCanberra.sh:46
template<class JTable_t >
const char* JDATABASE::getTable ( )
inline

Get table name.

Returns
table name

Definition at line 366 of file JDB.hh.

367  {
368  return JTable_t::getName();
369  }
const char * getName()
Get ROOT name of given data type.
Definition: JRootToolkit.hh:57
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 379 of file JDB.hh.

380  {
381  JTable_t* pc = NULL;
382  TClass* rc = dynamic_cast<TClass*>(TDictionary::GetDictionary(typeid(JTable_t)));
383 
384  if (rc != NULL) {
385 
386  for( std::unique_ptr<TIterator> i(rc->GetListOfDataMembers()->MakeIterator()); const TDataMember* p = (const TDataMember*) i->Next(); ) {
387 
388  if (p->GetOffset() == (char*) &(pc->*data_member) - (char*) pc) {
389  return p->GetName();
390  }
391  }
392  }
393 
394  return NULL;
395  }
template<class JTable_t >
std::vector<std::string> JDATABASE::getColumns ( )
inline

Get column names.

Returns
column names

Definition at line 404 of file JDB.hh.

405  {
406  using namespace JPP;
407 
409 
410  TClass* rc = dynamic_cast<TClass*>(TDictionary::GetDictionary(typeid(JTable_t)));
411 
412  if (rc != NULL) {
413 
414  for (std::unique_ptr<TIterator> i(rc->GetListOfDataMembers()->MakeIterator()); const TDataMember* p = (const TDataMember*) i->Next(); ) {
415  if (JRootClass::is_class(*p)) {
416  buffer.push_back(p->GetName());
417  }
418  }
419  }
420 
421  return buffer;
422  }
static bool is_class(const char *const name)
Check name of class against ROOT classes.
Definition: JRootClass.hh:50
ResultSet& JDATABASE::getResultSet ( const std::string query)
inline

Get result set.

Parameters
queryquery / table name
Returns
result set

Definition at line 431 of file JDB.hh.

432  {
433  return JDB::get()->StreamDS(query.c_str(), std::vector<Selector>());
434  }
T get(const JHead &header)
Get object from header.
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 444 of file JDB.hh.

445  {
446  return JDB::get()->StreamDS(query.c_str(), selection);
447  }
T get(const JHead &header)
Get object from header.
void JDATABASE::to_json ( json js,
const std::string query 
)
inline

Get result set.

Parameters
jsjson
queryquery / table name

Definition at line 456 of file JDB.hh.

457  {
458  *(JDB::get()->APIv2Select(query.c_str(), std::vector<Selector>())) >> js;
459  }
T get(const JHead &header)
Get object from header.
void JDATABASE::to_json ( json js,
const std::string query,
const std::vector< Selector > &  selection 
)
inline

Get result set.

Parameters
jsjson
queryquery / table name
selectionselection

Definition at line 469 of file JDB.hh.

470  {
471  *(JDB::get()->APIv2Select(query.c_str(), selection)) >> js;
472  }
T get(const JHead &header)
Get object from header.
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  }
T & getInstance(const T &object)
Get static instance from temporary object.
Definition: JObject.hh:75
std::string to_upper(const std::string &value)
Convert all character to upper case.
static const std::string SPECIAL_CHARACTERS
Special characters.
Definition: JDBReader.hh:38
esac $JPP_BIN JLogger sh $LOGGER until pgrep JGetMessage</dev/null > dev null
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  }
T & getInstance(const T &object)
Get static instance from temporary object.
Definition: JObject.hh:75
Auxiliary class to read object with ROOT dictionary from database.
Definition: JDBReader.hh:94
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  }
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  }
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  }
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  }
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  }
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  }
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  }
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  }
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  }
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  }
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  }
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  }
set_variable DETECTOR
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
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
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
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 191 of file JRunQuality.hh.

193  {
194  if (first.detector == second.detector)
195  return first.run < second.run;
196  else
197  return first.detector < second.detector;
198  }
int detector
detector identifier
Definition: JRunQuality.hh:138
int run
run number
Definition: JRunQuality.hh:139
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
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  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:696
static const int NUMBER_OF_OPERANDS
Number of available operands.
static const Selector::RelOp *const OPERAND[]
Available operands.
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  }
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  }
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  }
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  }
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  }
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  }
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  }
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  }
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  }
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  }
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  }
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  }
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  }
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  }
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  }
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  }
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  }
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  }
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  }
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  }
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

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

const char JDATABASE::PREFIX_COOKIE = '_'
static

Cookie prefix.

Definition at line 171 of file JDB.hh.

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

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

Definition at line 178 of file JDB.hh.

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

Special characters.

Definition at line 38 of file JDBReader.hh.

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.

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 253 of file JDBSupportkit.hh.

JGetPBSSequences JDATABASE::getPBSSequences
static

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

Definition at line 276 of file JPBSSequence.hh.

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

sub-system of PMT

Definition at line 27 of file JPMTRunsetupParams.hh.

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

parameter name of PMT threshold

Definition at line 28 of file JPMTRunsetupParams.hh.

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

parameter name of PMT high voltage

Definition at line 29 of file JPMTRunsetupParams.hh.

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.

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.