26{
   29 
   30  string        detectorFile;
   32  double        precision;
   34 
   35  try {
   36 
   37    JParser<> zap(
"Auxiliary program to decompose detector to separate calibrations.");
 
   38 
   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;
 
   44 
   45    zap(argc, argv);
   46  }
   47  catch(const exception &error) {
   48    FATAL(error.what() << endl);
 
   49  }
   50 
   51 
   53 
   54  try {
   56  }
   59  }
   60 
   62    FATAL(
"No detector address map for detector identier " << 
detector.getID() << endl);
 
   63  }
   64 
   66 
   67 
   68  
   69 
   70  for (JDetector::const_iterator module = 
detector.begin(); module != 
detector.end(); ++module) {
 
   71 
   72    if (module->getFloor() != 0) {
   73 
   75 
   77 
   79 
   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);
 
   82      }
   83    }
   84  }
   85 
   86 
   87  const json error  = { {Message_t,   
""            },
 
   88                        {Code_t,      OK_t          },
   89                        {Arguments_t, json::array() } };
   90 
   91 
   93  size_t N  =  0;                          
   94 
   96  js[Error_t]                              = 
json(error); 
 
   97 
   98  {
  100 
  101    for (JDetector::const_iterator module = 
detector.begin(); module != 
detector.end(); ++module) {
 
  102      for (JModule::const_iterator pmt = module->begin(); pmt != module->end(); ++pmt) {
  104      }
  105    }
  106 
  108    js[Data_t][N][PMTT0s_t]                = 
json(data);    
 
  109 
  111 
  113 
  114      js[Data_t].clear();
  115 
  116    } else {
  117 
  118      N += 1;
  119    }
  120  }
  121  {
  123 
  124    for (JDetector::const_iterator module = 
detector.begin(); module != 
detector.end(); ++module) {
 
  125 
  126      const JModule& buffer = demo.
getModule(module->getID(), module->getLocation());
 
  127 
  130      else
  132    }
  133 
  135    js[Data_t][N][BasePositions_t]         = 
json(data[0]);
 
  136    js[Data_t][N][DOMPositions_t]          = 
json(data[1]);
 
  137 
  139 
  141 
  142      js[Data_t].clear();
  143 
  144    } else {
  145 
  146      N += 1;
  147    }
  148  }
  149  {
  151 
  152    for (JDetector::const_iterator module = 
detector.begin(); module != 
detector.end(); ++module) {
 
  153 
  154      const JModule& buffer = demo.
getModule(module->getID(), module->getLocation());
 
  155 
  156      if (module->getFloor() != 0) {
  158      }
  159    }
  160 
  162    js[Data_t][N][DOMRotations_t]          = 
json(data);    
 
  163 
  165 
  167 
  168      js[Data_t].clear();
  169 
  170    } else {
  171 
  172      N += 1;
  173    }
  174  }
  175  {
  177 
  178    for (JDetector::const_iterator module = 
detector.begin(); module != 
detector.end(); ++module) {
 
  179 
  180      if (module->getFloor() == 0)
  182      else
  184    }
  185 
  187    js[Data_t][N][BaseAcousticT0_t]        = 
json(data[0]);    
 
  188    js[Data_t][N][DOMAcousticT0_t]         = 
json(data[1]);    
 
  189 
  191 
  193 
  194      js[Data_t].clear();
  195 
  196    } else {
  197 
  198      N += 1;
  199    }
  200  }
  201  {
  203 
  204    for (JDetector::const_iterator module = 
detector.begin(); module != 
detector.end(); ++module) {
 
  205      if (module->getFloor() == 0)
  207      else
  209    }
  210 
  212    js[Data_t][N][BaseCompassRotations_t]  = 
json(data[0]);    
 
  213    js[Data_t][N][DOMCompassRotations_t]   = 
json(data[1]);    
 
  214 
  216 
  218 
  219      js[Data_t].clear();
  220 
  221    } else {
  222 
  223      N += 1;
  224    }
  225  }
  226  {
  228 
  229    {
  231 
  232      for (JDetector::const_iterator module = 
detector.begin(); module != 
detector.end(); ++module) {
 
  233        for (JModule::const_iterator pmt = module->begin(); pmt != module->end(); ++pmt) {
  235        }
  236      }
  237 
  238      js[Data_t][N][PMTStatusInfo_t ]      = 
json(data);
 
  239    }
  240    {
  242 
  243      for (JDetector::const_iterator module = 
detector.begin(); module != 
detector.end(); ++module) {
 
  244        if (module->getFloor() == 0)
  246        else
  248      }
  249 
  250      js[Data_t][N][BaseStatusInfo_t]      = 
json(data[0]);
 
  251      js[Data_t][N][DOMStatusInfo_t]       = 
json(data[1]);
 
  252    }
  253 
  255 
  257 
  258      js[Data_t].clear();
  259 
  260    } else {
  261 
  262      N += 1;
  263    }
  264  }
  265 
  266 
  269  }
  270 
  271  return 0;
  272}
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
 
Data structure for time calibration.
 
const JModuleAddressMap & get(const int id) const
Get module address map.
 
virtual const JModuleAddressMap & getDefaultModuleAddressMap() const =0
Get default module address map.
 
int getFloor() const
Get floor number.
 
Data structure for a composite optical module.
 
void rotate(const JRotation3D &R)
Rotate module.
 
Utility class to parse command line options.
 
JPosition3D getPosition(const Vec &pos)
Get position.
 
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.
 
JCalibration getCalibration(const JCalibration &first, const JCalibration &second)
Get calibration to go from first to second calibration.
 
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.
 
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
 
Auxiliary data structure for compass rotation.
 
Auxiliary interface for building detector.
 
const JModule & getModule(const int id=-1, const JLocation &location=JLocation()) const
Get module.
 
Auxiliary data structure for module time calibration.
 
Auxiliary data structure for module position.
 
Auxiliary data structure for module rotation.
 
Auxiliary data structure for module status.
 
Auxiliary data structure for PMT time calibration.
 
Auxiliary data structure for PMT status.