Jpp  17.3.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JSon/JSupport.hh
Go to the documentation of this file.
1 #ifndef __JSON__JSUPPORT__
2 #define __JSON__JSUPPORT__
3 
4 #include <string>
5 #include <vector>
6 
7 #include "JSon/JSon.hh"
8 
9 
10 /**
11  * \file
12  * JSon definitions and auxiliaries.
13  *
14  * \author mdejong, bjung, acreusot
15  */
16 
17 namespace JSON {}
18 namespace JPP { using namespace JSON; }
19 
20 /**
21  * Auxiliary classes and methods for detector calibration.
22  */
23 namespace JSON {
24 
25  static const std::string TCAL = "tcal"; //!< PMT time offsets
26  static const std::string PCAL = "pcal"; //!< (optical|base) module positions
27  static const std::string RCAL = "rcal"; //!< (optical|base) module orientations
28  static const std::string ACAL = "acal"; //!< acoustic time offsets (piezo sensor or hydrophone)
29  static const std::string CCAL = "ccal"; //!< compass alignment (a.k.a.\ quaternion calibration)
30  static const std::string SCAL = "scal"; //!< (module|PMT) status
31 
32  static const std::string PMT_T0_CALIBRATION_t = "PMT_T0_CALIBRATION"; //!< PMT time offsets
33  static const std::string DOM_POSITION_CALIBRATION_t = "DOM_POSITION_CALIBRATION"; //!< (optical|base) module positions
34  static const std::string DOM_ROTATION_CALIBRATION_t = "DOM_ROTATION_CALIBRATION"; //!< (optical|base) module orientations
35  static const std::string ACOUSTIC_T0_CALIBRATION_t = "ACOUSTIC_T0_CALIBRATION"; //!< acoustic time offsets (piezo sensor or hydrophone)
36  static const std::string COMPASS_CALIBRATION_t = "COMPASS_CALIBRATION"; //!< compass alignment (a.k.a.\ quaternion calibration)
37  static const std::string STATUS_CALIBRATION_t = "STATUS_CALIBRATION"; //!< (module|PMT) status
38 
39  // Meta data
40  static const std::string User_t = "User";
41  static const std::string Location_t = "Location";
42  static const std::string Time_t = "Time";
43  static const std::string Start_t = "Start";
44  static const std::string End_t = "End";
45  static const std::string Comment_t = "Comment";
46  static const std::string Encoding_t = "Encoding";
47  static const std::string Input_t = "Inputs";
48  static const std::string Error_t = "Error";
49  static const std::string Message_t = "Message";
50  static const std::string Code_t = "Code";
51  static const std::string Provenance_t = "Provenance";
52  static const std::string Info_t = "Info";
53  static const std::string Configuration_t = "Configuration";
54  static const std::string Arguments_t = "Arguments";
55  static const std::string Inputs_t = "Inputs";
56  static const std::string UUID_t = "UUID";
57  static const std::string APIVersion_t = "APIVersion";
58  static const std::string Result_t = "Result";
59  static const std::string OK_t = "OK";
60  static const std::string Fail_t = "FAIL";
61 
62  // Type specifiers
63  static const std::string Type_t = "Type";
64  static const std::string Test_t = "Test";
65  static const std::string Tests_t = "Tests";
66  static const std::string Data_t = "Data";
67  static const std::string URL_t = "URL";
68  static const std::string Name_t = "Name";
69  static const std::string Unit_t = "Unit";
70  static const std::string Values_t = "Values";
71  static const std::string Parameters_t = "Parameters";
72  static const std::string RunNumber_t = "RUN_NUMBER";
73 
74  // Calibration types
75  static const std::string PMTT0s_t = "PMTT0s";
76  static const std::string DOMPositions_t = "DOMPositions";
77  static const std::string DOMRotations_t = "DOMRotations";
78  static const std::string DOMAcousticT0_t = "DOMAcousticT0s";
79  static const std::string DOMCompassRotations_t = "DOMCompassRotations";
80  static const std::string DOMStatusInfo_t = "DOMStatusInfo";
81  static const std::string BasePositions_t = "BasePositions";
82  static const std::string BaseAcousticT0_t = "BaseAcousticT0s";
83  static const std::string BaseCompassRotations_t = "BaseCompassRotations";
84  static const std::string BaseStatusInfo_t = "BaseStatusInfo";
85 
86  // Module map of PMT addresses
87  static const std::string DOMMap_t = "DOMMap";
88 
89  // HV tuning types
90  static const std::string PMTThreshold_t = "PMT_Threshold";
91  static const std::string PMTStatusInfo_t = "PMTStatusInfo";
92  static const std::string PMTSupplyVoltage_t = "PMT_Supply_Voltage";
93  static const std::string PMTGain_t = "PMT_Gain";
94 
95  // Identifiers
96  static const std::string UPI_t = "UPI";
97  static const std::string PBS_t = "PBS";
98  static const std::string Variant_t = "Variant";
99  static const std::string DetOID_t = "DetOID";
100  static const std::string DetID_t = "DetID";
101  static const std::string PMTSerial_t = "Serial";
102  static const std::string DOMSerial_t = "DOMSerial";
103  static const std::string DOMId_t = "DOMId";
104  static const std::string Id_t = "Id";
105 
106  // Variable names
107  static const std::string T0_t = "T0";
108  static const std::string PX_t = "PX";
109  static const std::string PY_t = "PY";
110  static const std::string PZ_t = "PZ";
111  static const std::string Q0_t = "Q0";
112  static const std::string QX_t = "QX";
113  static const std::string QY_t = "QY";
114  static const std::string QZ_t = "QZ";
115  static const std::string STATUS_t = "Status";
116 
117  // Units
118  static const std::string Unitless_t = "-";
119  static const std::string Volt_t = "V";
120 
121 
122  /**
123  * Check validity of JSon data.
124  *
125  * \param js JSon data
126  * \return true if valid; else false
127  */
128  inline bool is_valid(const json& js)
129  {
130  return (js.contains(Error_t) && js[Error_t][Code_t] == OK_t);
131  }
132 }
133 
134 #endif
static const std::string Arguments_t
static const std::string Volt_t
static const std::string Start_t
static const std::string Location_t
static const std::string DOMStatusInfo_t
static const std::string STATUS_t
static const std::string Code_t
static const std::string Encoding_t
static const std::string ACAL
acoustic time offsets (piezo sensor or hydrophone)
static const std::string STATUS_CALIBRATION_t
(module|PMT) status
static const std::string Input_t
static const std::string Name_t
static const std::string CCAL
compass alignment (a.k.a. quaternion calibration)
bool is_valid(const json &js)
Check validity of JSon data.
static const std::string DOM_ROTATION_CALIBRATION_t
(optical|base) module orientations
static const std::string PMTT0s_t
static const std::string Error_t
static const std::string Parameters_t
static const std::string QX_t
static const std::string Inputs_t
static const std::string T0_t
static const std::string QZ_t
static const std::string BaseStatusInfo_t
static const std::string Unit_t
static const std::string DOMId_t
static const std::string Id_t
static const std::string PBS_t
static const std::string Time_t
static const std::string UPI_t
static const std::string Values_t
static const std::string TCAL
PMT time offsets.
static const std::string Comment_t
static const std::string DOMSerial_t
static const std::string APIVersion_t
static const std::string RunNumber_t
static const std::string PZ_t
static const std::string DOMMap_t
static const std::string Configuration_t
static const std::string Test_t
static const std::string Q0_t
static const std::string Unitless_t
static const std::string PMT_T0_CALIBRATION_t
PMT time offsets.
static const std::string COMPASS_CALIBRATION_t
compass alignment (a.k.a. quaternion calibration)
then awk string
static const std::string DOMPositions_t
static const std::string PMTThreshold_t
static const std::string PX_t
static const std::string End_t
static const std::string Variant_t
static const std::string Result_t
static const std::string RCAL
(optical|base) module orientations
static const std::string Info_t
static const std::string PMTSerial_t
static const std::string DOMCompassRotations_t
static const std::string DOM_POSITION_CALIBRATION_t
(optical|base) module positions
static const std::string Message_t
static const std::string PMTGain_t
static const std::string DetOID_t
static const std::string Data_t
static const std::string SCAL
(module|PMT) status
nlohmann::json json
static const std::string BasePositions_t
static const std::string PY_t
static const std::string DOMRotations_t
static const std::string Type_t
static const std::string Provenance_t
static const std::string BaseCompassRotations_t
static const std::string PMTSupplyVoltage_t
static const std::string PMTStatusInfo_t
static const std::string PCAL
(optical|base) module positions
static const std::string ACOUSTIC_T0_CALIBRATION_t
acoustic time offsets (piezo sensor or hydrophone)
static const std::string UUID_t
static const std::string DetID_t
static const std::string Tests_t
static const std::string URL_t
static const std::string QY_t
static const std::string DOMAcousticT0_t
static const std::string BaseAcousticT0_t
static const std::string OK_t
static const std::string Fail_t
static const std::string User_t