38 static const time_t UTC_INVALID_S = -1;
43 static const int RUN_INVALID = -1;
52 inline json getJSon(
const std::string& key,
const time_t utc_s)
54 if (utc_s != UTC_INVALID_S)
73 int main(
int argc,
char **argv)
78 typedef JRange<time_t> JRange_t;
93 JParser<> zap(
"Auxiliary program to decompose detector to separate calibrations.");
99 zap[
'a'] =
make_field(detectorFile,
"detector file");
104 &JCalibrationType::nick_name));
105 zap[
'V'] =
make_field(validity,
"validity range UTC [s], e.g. \"<UTC min> <UTC max>\"") = JRange_t(UTC_INVALID_S, UTC_INVALID_S);
106 zap[
'r'] =
make_field(
range,
"run range e.g. \"<first run> <last run>\"") = JRange_t(RUN_INVALID, RUN_INVALID);
107 zap[
'p'] =
make_field(precision,
"precision for match with reference module") = 1.0e-5;
112 catch(
const exception &error) {
113 FATAL(error.what() << endl);
123 catch(
const JException& error) {
128 FATAL(
"No detector address map for detector identier " <<
detector.getID() << endl);
144 for (JPersons
object; rs >> object; ) {
153 for (JDetectors
object; rs >> object; ) {
154 locid =
object.LOCATIONID;
161 if (
range.getLowerLimit() != RUN_INVALID && validity.getLowerLimit() == UTC_INVALID_S) {
165 for (JRuns
object; rs >> object; ) {
166 validity.setLowerLimit(
object.UNIXJOBSTART / 1000);
172 if (
range.getUpperLimit() != RUN_INVALID && validity.getUpperLimit() == UTC_INVALID_S) {
176 for (JRuns
object; rs >> object; ) {
177 validity.setUpperLimit(
object.UNIXJOBEND / 1000);
183 catch(
const exception& error) {
184 FATAL(error.what() << endl);
190 for (JDetector::const_iterator module =
detector.begin(); module !=
detector.end(); ++module) {
192 if (module->getFloor() != 0) {
194 JModule buffer = demo.getModule(module->getID(), module->getLocation());
200 if (!JModule::compare(buffer, *module, precision)) {
202 for (
size_t i = 0;
i != module->size(); ++
i) {
203 DEBUG(
"PMT " << setw(2) <<
i <<
' '
209 FATAL(
"Module " << setw(10) << module->getID() <<
' ' << module->getLocation() <<
" incompatible with reference." << endl);
219 {
EndTime_t, JDateAndTime(
true).toString() },
237 for (JDetector::const_iterator module =
detector.begin(); module !=
detector.end(); ++module) {
238 for (JModule::const_iterator pmt = module->begin(); pmt != module->end(); ++pmt) {
239 data.push_back(JPMTCalibration_t(pmt->getID(),
getCalibration(JCalibration(), *pmt)));
253 for (JDetector::const_iterator module =
detector.begin(); module !=
detector.end(); ++module) {
255 const JModule& buffer = demo.getModule(module->getID(), module->getLocation());
257 if (buffer.getFloor() == 0)
258 data[0].push_back(JModulePosition_t(module->getID(),
getPosition(buffer, *module)));
260 data[1].push_back(JModulePosition_t(module->getID(),
getPosition(buffer, *module)));
274 for (JDetector::const_iterator module =
detector.begin(); module !=
detector.end(); ++module) {
276 const JModule& buffer = demo.getModule(module->getID(), module->getLocation());
278 if (module->getFloor() != 0) {
279 data.push_back(JModuleRotation_t(module->getID(),
getRotation(buffer, *module)));
293 for (JDetector::const_iterator module =
detector.begin(); module !=
detector.end(); ++module) {
295 if (module->getFloor() == 0)
296 data[0].push_back(JModuleCalibration_t(module->getID(), module->getT0()));
298 data[1].push_back(JModuleCalibration_t(module->getID(), module->getT0()));
312 for (JDetector::const_iterator module =
detector.begin(); module !=
detector.end(); ++module) {
313 if (module->getFloor() == 0)
314 data[0].push_back(JCompassRotation_t(module->getID(), module->getQuaternion()));
316 data[1].push_back(JCompassRotation_t(module->getID(), module->getQuaternion()));
333 for (JDetector::const_iterator module =
detector.begin(); module !=
detector.end(); ++module) {
334 for (JModule::const_iterator pmt = module->begin(); pmt != module->end(); ++pmt) {
335 data.push_back(JPMTStatus_t(pmt->getID(), pmt->getStatus()));
344 for (JDetector::const_iterator module =
detector.begin(); module !=
detector.end(); ++module) {
345 if (module->getFloor() == 0)
346 data[0].push_back(JModuleStatus_t(module->getID(), module->getStatus()));
348 data[1].push_back(JModuleStatus_t(module->getID(), module->getStatus()));
static const std::string Arguments_t
Utility class to parse command line options.
int main(int argc, char *argv[])
static const std::string DOMStatusInfo_t
static const std::string Code_t
static const std::string UserId_t
static const std::string EndTime_t
static const std::string ACAL
acoustic time offsets (piezo sensor or hydrophone)
double getDot(const JNeutrinoDirection &first, const JNeutrinoDirection &second)
Dot product.
static const std::string CCAL
compass alignment (a.k.a. quaternion calibration)
std::string toString() const
Get ASCII formatted date and time.
static const std::string PMTT0s_t
bool hasDetectorAddressMap(const int id)
Check if detector address map is available.
static const std::string Error_t
std::vector< JModuleRotation_t > JModuleRotation
Module rotation.
static JRotation getRotation
Function object to get rotation matrix to go from first to second module.
JCalibration getCalibration(const JCalibration &first, const JCalibration &second)
Get calibration to go from first to second calibration.
Auxiliary data structure for floating point format specification.
Data structure for detector geometry and calibration.
static const std::string BaseStatusInfo_t
std::vector< JCompassRotation_t > JCompassRotation
Compass rotation.
static const std::string ValidFrom_t
static const std::string TCAL
PMT time offsets.
static const std::string Comment_t
static const std::string ValidThrough_t
I/O formatting auxiliaries.
JDirection3D getDirection(const Vec &dir)
Get direction.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
const array_type< JValue_t > & make_array(const JValue_t(&array)[N])
Method to create array of values.
void store(const std::string &file_name, const JDetector &detector)
Store detector to output file.
JPosition3D getPosition(const Vec &pos)
Get position.
static const std::string StartTime_t
static const std::string DOMPositions_t
static const double PI
Mathematical constants.
Auxiliary data structure for streaming of STL containers.
JSon definitions and auxiliaries.
Auxiliary methods to convert data members or return values of member methods of a set of objects to a...
static const std::string RCAL
optical module orientations
General purpose messaging.
static const std::string DOMCompassRotations_t
static const std::string Message_t
static const std::string DetOID_t
std::string setWildCard(const std::string &file_name, const std::string &value)
Get file name by setting wild card to given value.
z range($ZMAX-$ZMIN)< $MINIMAL_DZ." fi fi typeset -Z 4 STRING typeset -Z 2 FLOOR JPlot1D -f $
std::vector< JModuleStatus_t > JModuleStatus
Module status.
then JCookie sh JDataQuality D $DETECTOR_ID R
static const std::string Data_t
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
Auxiliary class to define a range between two values.
Auxiliary class for date and time.
Utility class to parse command line options.
static const std::string SCAL
(module|PMT) status
std::vector< JPMTStatus_t > JPMTStatus
PMT status.
static const std::string BasePositions_t
ResultSet & getResultSet(const std::string &query)
Get result set.
static const std::string DOMRotations_t
std::vector< JServer > getServernames()
Get list of names of available database servers.
static const std::string LocationId_t
const char * getName()
Get ROOT name of given data type.
static const std::string BaseCompassRotations_t
std::vector< JModulePosition_t > JModulePosition
Module position.
do set_variable DETECTOR_TXT $WORKDIR detector
static const std::string PMTStatusInfo_t
static const std::string PCAL
(optical|base) module positions
JDetectorBuilder & getDetectorBuilder()
Get detector builder.
static const char FILENAME_WILDCARD
wild card character for file name substitution
JSON::getCalibrationType getCalibrationType
static const std::string DOMAcousticT0_t
std::vector< JPMTCalibration_t > JPMTCalibration
PMT time calibration.
static const std::string TypeId_t
static const std::string BaseAcousticT0_t
std::vector< JModuleCalibration_t > JModuleCalibration
Module time calibration.
static const std::string OK_t
#define DEBUG(A)
Message macros.
bool hasWildCard(const std::string &file_name)
Check presence of wild card.