Jpp  16.0.0-rc.1
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  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  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 UPI of product to serial number. 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  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  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
 
typedef JTOOLS::JRange< JDate_tJPeriod_t
 Type definition of period. More...
 
typedef JEEP::JTime<':'> JTime_t
 

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...
 
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...
 
std::vector< std::string > getGITTags (const TRegexp &regexp, const JGITTags_t::key_type &date)
 Get selection of GIT tags. 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

Definition at line 15 of file JDate_t.hh.

Type definition of period.

Definition at line 38 of file JDetectorIntegration_t.hh.

Definition at line 15 of file JTime_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 source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
Definition: JCanberra.sh:42
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: JCalibratePMT.sh:7
const Server& JDATABASE::getServer ( const std::string &  server)
inline

Get server by name.

Parameters
serverserver name
Returns
server

Definition at line 81 of file JDB.hh.

82  {
83  for (const auto& element : LIST_OF_SERVERS) {
84  if (element.first == server) {
85  return element.second;
86  }
87  }
88 
89  THROW(JDatabaseException, "Invalid server name " << server);
90  }
static std::vector< std::pair< JServer, Server > > LIST_OF_SERVERS
Named list of available database servers.
Definition: JDB.hh:66
#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 98 of file JDB.hh.

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

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

Get private cookie.

Returns
cookie

Definition at line 146 of file JDB.hh.

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

Get public cookie.

Returns
cookie

Definition at line 159 of file JDB.hh.

160  {
161  return getenv("DBCOOKIE");
162  }
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 347 of file JDB.hh.

348  {
349  if (in >> static_cast<std::string&>(server)) {
350  JDB::setServer(getServer(server));
351  }
352 
353  return in;
354  }
const Server & getServer(const std::string &server)
Get server by name.
Definition: JDB.hh:81
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 source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
Definition: JCanberra.sh:42
template<class JTable_t >
const char* JDATABASE::getTable ( )
inline

Get table name.

Returns
table name

Definition at line 363 of file JDB.hh.

364  {
365  return JTable_t::getName();
366  }
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 376 of file JDB.hh.

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

Get column names.

Returns
column names

Definition at line 403 of file JDB.hh.

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

Get result set.

Parameters
queryquery / table name
Returns
result set

Definition at line 432 of file JDB.hh.

433  {
434  return JDB::get()->StreamDS(query.c_str(), std::vector<Selector>());
435  }
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 445 of file JDB.hh.

446  {
447  return JDB::get()->StreamDS(query.c_str(), selection);
448  }
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 365 of file JDBToolkit.hh.

366  {
367  return JDetectorsHelper::helper;
368  }
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 378 of file JDBToolkit.hh.

379  {
380  return JDetectorsHelper::helper(detid, JType<T>());
381  }
std::string JDATABASE::getDetector ( const int  id)
inline

Get detector identifier.

Parameters
idserial number
Returns
object identifier

Definition at line 402 of file JDBToolkit.hh.

403  {
404  return JDetectorsHelper::helper(id);
405  }
JCLBIDHelper& JDATABASE::getCLBID ( )
inline

Auxiliary function for helper object initialisation.

Returns
helper

Definition at line 413 of file JDBToolkit.hh.

414  {
415  return JCLBIDHelper::helper;
416  }
int JDATABASE::getCLBID ( const JUPI_t upi)
inline

Get module identifier.

Parameters
upiUPI
Returns
module identifier

Definition at line 425 of file JDBToolkit.hh.

426  {
427  return JCLBIDHelper::helper(upi);
428  }
JCLBIDHelper& JDATABASE::getCLBUPI ( )
inline

Auxiliary function for helper object initialisation.

Returns
helper

Definition at line 436 of file JDBToolkit.hh.

437  {
438  return JCLBIDHelper::helper;
439  }
JUPI_t JDATABASE::getCLBUPI ( const int  id)
inline

Get UPI.

Parameters
idmodule identifier
Returns
UPI

Definition at line 448 of file JDBToolkit.hh.

449  {
450  return JCLBIDHelper::helper(id);
451  }
JUPIHelper& JDATABASE::getUPI ( )
inline

Auxiliary function for helper object initialisation.

Returns
helper

Definition at line 459 of file JDBToolkit.hh.

460  {
461  return JUPIHelper::helper;
462  }
JUPI_t JDATABASE::getUPI ( const JPBS_t pbs,
const int  number 
)
inline

Get UPI.

Parameters
pbsPBS
numberserial number
Returns
UPI

Definition at line 472 of file JDBToolkit.hh.

473  {
474  return JUPIHelper::helper(pbs, number);
475  }
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 48 of file JDetectorIntegration_t.hh.

49  {
50  return out << "(" << object.getLowerLimit() << "," << object.getUpperLimit() << ")";
51  }
std::vector<std::string> JDATABASE::getGITTags ( const TRegexp &  regexp,
const JGITTags_t::key_type &  date 
)
inline

Get selection of GIT tags.

Parameters
regexpregular expression
datedate corresponding to oldest version
Returns
GIT tags

Definition at line 34 of file JDB/JGITTags.hh.

35  {
36  using namespace JPP;
37 
39 
40  const JGITTags_t tags = JEEP::getGITTags();
41 
42  for (JGITTags_t::const_reverse_iterator i = tags.rbegin(); i.base() != tags.lower_bound(date); ++i) {
43  if (TString(i->second.c_str()).Contains(regexp)) {
44  buffer.push_back(getGITVersion(i->second));
45  }
46  }
47 
48  return buffer;
49  }
std::multimap< JDate<'-'>, std::string > JGITTags_t
Type definition of dated GIT tags.
std::string getGITVersion(const std::string &tag)
Get GIT version for given GIT tag.
const JGITTags_t & getGITTags()
Get GIT dated tags.
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 253 of file JPBS_t.hh.

254  {
255  return (pbs == PBS::DETECTOR);
256  }
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 265 of file JPBS_t.hh.

266  {
267  return (pbs == PBS::DETECTION_UNIT);
268  }
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 277 of file JPBS_t.hh.

278  {
279  return (pbs == PBS::DOM);
280  }
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 289 of file JPBS_t.hh.

290  {
291  return (pbs == PBS::BASE ||
292  pbs == PBS::BASE_CONTAINER);
293  }
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 171 of file JRunQuality.hh.

173  {
174  if (first.detector == second.detector)
175  return first.run < second.run;
176  else
177  return first.detector < second.detector;
178  }
int detector
detector identifier
Definition: JRunQuality.hh:121
int run
run number
Definition: JRunQuality.hh:122
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 66 of file JDB.hh.

const char JDATABASE::PREFIX_COOKIE = '_'
static

Cookie prefix.

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

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

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