25int main(
int argc, 
char **argv)
 
   37    JParser<> zap(
"Auxiliary program to decompose detector to separate calibrations.");
 
   39    zap[
'a'] = 
make_field(detectorFile, 
"detector file");
 
   41                          "(optionally contains wild card \'" << FILENAME_WILDCARD << 
"\')");
 
   42    zap[
'p'] = 
make_field(precision,    
"precision for match with reference module") = 1.0e-5;
 
   47  catch(
const exception &error) {
 
   48    FATAL(error.what() << endl);
 
   61  if (!hasDetectorAddressMap(
detector.getID())) {
 
   62    FATAL(
"No detector address map for detector identier " << 
detector.getID() << endl);
 
   70  for (JDetector::const_iterator module = 
detector.begin(); module != 
detector.end(); ++module) {
 
   72    if (module->getFloor() != 0) {
 
   80      if (!JModule::compare(buffer, *module, precision)) {
 
   81        FATAL(
"Module " << setw(10) <<  module->getID() << 
" at location " << getLabel(module->getLocation()) << 
" incompatible with " << (demo.
get(module->getID()) == demo.
getDefaultModuleAddressMap() ? 
"default" : 
"custom") << 
" reference." << endl);
 
   87  const json error  = { {Message_t,   
""            },
 
   89                        {Arguments_t, json::array() } };
 
   96  js[Error_t]                              = 
json(error); 
 
  101    for (JDetector::const_iterator module = 
detector.begin(); module != 
detector.end(); ++module) {
 
  102      for (JModule::const_iterator pmt = module->begin(); pmt != module->end(); ++pmt) {
 
  108    js[Data_t][N][PMTT0s_t]                = 
json(data);    
 
  112      store(setWildCard(
outputFile.c_str(), TCAL), js);
 
  124    for (JDetector::const_iterator module = 
detector.begin(); module != 
detector.end(); ++module) {
 
  126      const JModule& buffer = demo.
getModule(module->getID(), module->getLocation());
 
  129        data[0].push_back(
JModulePosition_t(module->getID(), getPosition(buffer, *module)));
 
  131        data[1].push_back(
JModulePosition_t(module->getID(), getPosition(buffer, *module)));
 
  135    js[Data_t][N][BasePositions_t]         = 
json(data[0]);
 
  136    js[Data_t][N][DOMPositions_t]          = 
json(data[1]);
 
  140      store(setWildCard(
outputFile.c_str(), PCAL), js);
 
  152    for (JDetector::const_iterator module = 
detector.begin(); module != 
detector.end(); ++module) {
 
  154      const JModule& buffer = demo.
getModule(module->getID(), module->getLocation());
 
  156      if (module->getFloor() != 0) {
 
  157        data.push_back(
JModuleRotation_t(module->getID(), getRotation(buffer, *module)));
 
  162    js[Data_t][N][DOMRotations_t]          = 
json(data);    
 
  166      store(setWildCard(
outputFile.c_str(), RCAL), js);
 
  178    for (JDetector::const_iterator module = 
detector.begin(); module != 
detector.end(); ++module) {
 
  180      if (module->getFloor() == 0)
 
  187    js[Data_t][N][BaseAcousticT0_t]        = 
json(data[0]);    
 
  188    js[Data_t][N][DOMAcousticT0_t]         = 
json(data[1]);    
 
  192      store(setWildCard(
outputFile.c_str(), ACAL), js);
 
  204    for (JDetector::const_iterator module = 
detector.begin(); module != 
detector.end(); ++module) {
 
  205      if (module->getFloor() == 0)
 
  212    js[Data_t][N][BaseCompassRotations_t]  = 
json(data[0]);    
 
  213    js[Data_t][N][DOMCompassRotations_t]   = 
json(data[1]);    
 
  217      store(setWildCard(
outputFile.c_str(), CCAL), js);
 
  232      for (JDetector::const_iterator module = 
detector.begin(); module != 
detector.end(); ++module) {
 
  233        for (JModule::const_iterator pmt = module->begin(); pmt != module->end(); ++pmt) {
 
  234          data.push_back(
JPMTStatus_t(pmt->getID(), pmt->getStatus()));
 
  238      js[Data_t][N][PMTStatusInfo_t ]      = 
json(data);
 
  243      for (JDetector::const_iterator module = 
detector.begin(); module != 
detector.end(); ++module) {
 
  244        if (module->getFloor() == 0)
 
  245          data[0].push_back(
JModuleStatus_t(module->getID(), module->getStatus()));
 
  247          data[1].push_back(
JModuleStatus_t(module->getID(), module->getStatus()));
 
  250      js[Data_t][N][BaseStatusInfo_t]      = 
json(data[0]);
 
  251      js[Data_t][N][DOMStatusInfo_t]       = 
json(data[1]);
 
  256      store(setWildCard(
outputFile.c_str(), SCAL), js);