73 JParser<> zap(
"Auxiliary program to compose detector from separate calibrations.");
76 zap[
'f'] =
make_field(inputFile,
"detector calibration files in JSON format "\
77 "(wild card \'" <<
FILENAME_WILDCARD <<
"\' will be replaced by corresponding calibration set)");
83 catch(
const exception &error) {
98 FATAL(
"No detector address map for detector identier " <<
detector.getID() <<
endl);
120 operator int()
const {
return value; }
122 status_type& operator=(
const int value)
142 for (
const auto& file_name : inputFile) {
154 buffer = { file_name };
156 for (
const auto& file_name : buffer) {
160 json::const_iterator data;
166 for (
size_t i = 0; i != data->size(); ++i) {
170 if (data->at(i).contains(
DetID_t)) {
176 if (data->at(i).contains(
PMTT0s_t)) {
197 JModule&
module = detector.getModule(moduleRouter.getAddress(element.getID()));
199 module.set(element.getPosition());
201 pcal[
module.getID()] = DEFINED;
212 JModule&
module = detector.getModule(moduleRouter.getAddress(element.getID()));
214 module.set(element.getPosition());
216 pcal[
module.getID()] = DEFINED;
227 JModule&
module = detector.getModule(moduleRouter.getAddress(element.getID()));
231 if (
module.size() != buffer.size()) {
232 FATAL(
"Module size " <<
module.size() <<
" != " << buffer.size() <<
endl);
237 for (
size_t i = 0; i !=
module.size(); ++i) {
238 module.getPMT(i).setAxis(buffer.getPMT(i).getAxis());
241 module.rotate(element.getQuaternion());
243 module.setPosition(module.getCenter());
246 rcal[
module.getID()] = DEFINED;
257 JModule&
module = detector.getModule(moduleRouter.getAddress(element.getID()));
259 module.setCalibration(element.getCalibration());
261 acal[
module.getID()] = DEFINED;
272 JModule&
module = detector.getModule(moduleRouter.getAddress(element.getID()));
274 module.setCalibration(element.getCalibration());
276 acal[
module.getID()] = DEFINED;
287 JModule&
module = detector.getModule(moduleRouter.getAddress(element.getID()));
289 module.setQuaternion(element.getQuaternion());
291 ccal[
module.getID()] = DEFINED;
302 JModule&
module = detector.getModule(moduleRouter.getAddress(element.getID()));
304 module.setQuaternion(element.getQuaternion());
306 ccal[
module.getID()] = DEFINED;
332 JModule&
module = detector.getModule(moduleRouter.getAddress(element.getID()));
334 module.setStatus(element.getStatus());
336 scal[1][
module.getID()] = DEFINED;
347 JModule&
module = detector.getModule(moduleRouter.getAddress(element.getID()));
349 module.setStatus(element.getStatus());
351 scal[1][
module.getID()] = DEFINED;
369 for (JModule::const_iterator pmt =
module->begin(); pmt !=
module->end(); ++pmt) {
370 if (
tcal [pmt->getID()] !=
DEFINED) {
ERROR(
"PMT " <<
setw(8) << pmt->getID() <<
" no time calibration." <<
endl); }
371 if (
scal[0][pmt->getID()] !=
DEFINED) {
ERROR(
"PMT " <<
setw(8) << pmt->getID() <<
" no status calibration." <<
endl); }
int main(int argc, char **argv)
Data structure for detector geometry and calibration.
General purpose messaging.
Direct access to module in detector data structure.
Direct access to PMT in detector data structure.
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
I/O formatting auxiliaries.
#define MAKE_STRING(A)
Make string.
void setCalibration(const JCalibration &cal)
Set calibration.
Router for direct addressing of module data in detector data structure.
bool hasModule(const JObjectID &id) const
Has module.
Data structure for a composite optical module.
Router for direct addressing of PMT data in detector data structure.
Data structure for PMT geometry, calibration and status.
Data structure for position in three dimensions.
int getID() const
Get identifier.
Template definition of a multi-dimensional oscillation probability interpolation table.
void from_json(const json &js, JDBString &object)
Convert JSon to database string.
std::string getLabel(const JLocation &location)
Get module label for monitoring and other applications.
JDetectorBuilder & getDetectorBuilder()
Get detector builder.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
void store(const std::string &file_name, const JDetector &detector)
Store detector to output file.
bool hasDetectorAddressMap(const int id)
Check if detector address map is available.
std::string setWildCard(const std::string &file_name, const std::string &value)
Get file name by setting wild card to given value.
bool hasWildCard(const std::string &file_name)
Check presence of wild card.
static const char FILENAME_WILDCARD
wild card character for file name substitution
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
std::map< int, buffer_type > map_type
identifier -> hits
static const std::string BasePositions_t
static const std::string BaseStatusInfo_t
static const std::string BaseAcousticT0_t
static const std::string TCAL
PMT time offsets.
bool is_valid(const json &js)
Check validity of JSon data.
static const std::string ValidThrough_t
static const std::string PMTT0s_t
static const std::string PCAL
(optical|base) module positions
static const std::string DOMPositions_t
static const std::string SCAL
(module|PMT) status
static const std::string DetID_t
static const std::string RCAL
optical module orientations
static const std::string BaseCompassRotations_t
static const std::string Data_t
static const std::string PMTStatusInfo_t
static const std::string DOMRotations_t
static const std::string ACAL
acoustic time offsets (piezo sensor or hydrophone)
static const std::string DOMAcousticT0_t
static const std::string CCAL
compass alignment (a.k.a. quaternion calibration)
static const std::string DOMStatusInfo_t
static const std::string DOMCompassRotations_t
static const std::string Comment_t
static const std::string ValidFrom_t
Auxiliary interface for building detector.
void setStatus(const JStatus &status)
Set status.
Auxiliary class to load json data from file.
Auxiliary class for date and time.
time_t getTime() const
time