294 string detectorFile_a;
295 string detectorFile_b;
296 bool overwriteDetector;
305 JParser<> zap(
"Auxiliary program to align two detectors.");
307 zap[
'a'] =
make_field(detectorFile_a,
"detector - subject to alignment (option -A)");
308 zap[
'b'] =
make_field(detectorFile_b,
"detector - reference for alignment");
309 zap[
'A'] =
make_field(overwriteDetector,
"overwrite detector file provided through '-a' with modified positions.");
310 zap[
'T'] =
make_field(tripodFile,
"tripods") =
"";
312 zap[
'O'] =
make_field(option,
"keep strings vertical");
318 catch(
const exception &error) {
319 FATAL(error.what() << endl);
323 if (overwriteDetector) {
324 if (tripodFile ==
"") {
325 FATAL(
"No tripod file.");
334 load(detectorFile_a, detector_a);
341 load(detectorFile_b, detector_b);
348 const JFit_t fit(detector_b, sigma_m, option, range);
352 for (JDetector::const_iterator module = detector_a.begin(); module != detector_a.end(); ++module) {
353 if (fit.hasModule(module->getID())) {
354 data.push_back(*module);
366 simplex.
step.resize(6);
368 simplex.
step[0] =
JModel_t(0.01, 0.00, 0.00, 0.0, 0.0, 0.0);
369 simplex.
step[1] =
JModel_t(0.00, 0.01, 0.00, 0.0, 0.0, 0.0);
370 simplex.
step[2] =
JModel_t(0.00, 0.00, 0.01, 0.0, 0.0, 0.0);
371 simplex.
step[3] =
JModel_t(0.00, 0.00, 0.00, 5.0e-4, 0.0, 0.0);
372 simplex.
step[4] =
JModel_t(0.00, 0.00, 0.00, 0.0, 1.0e-4, 0.0);
373 simplex.
step[5] =
JModel_t(0.00, 0.00, 0.00, 0.0, 0.0, 1.0e-4);
375 const double chi2 = simplex(fit,
data.begin(),
data.end());
378 cout <<
"chi2/NDF " <<
FIXED(7,3) << chi2 <<
'/' << (detector_a.size() - simplex.
step.size()) << endl;
380 cout <<
"model:" << endl;
382 cout <<
"x " <<
FIXED(7,3) << simplex.
value.x << endl;
383 cout <<
"y " <<
FIXED(7,3) << simplex.
value.y << endl;
384 cout <<
"z " <<
FIXED(7,3) << simplex.
value.z << endl;
385 cout <<
"phi " <<
FIXED(9,5) << simplex.
value.phi << endl;
386 cout <<
"Tx " <<
FIXED(9,5) << simplex.
value.tx << endl;
387 cout <<
"Ty " <<
FIXED(9,5) << simplex.
value.ty << endl;
390 if (overwriteDetector) {
392 NOTICE(
"Store alignment data on files " << detectorFile_a <<
" and " << tripodFile << endl);
396 for (JDetector::iterator module = detector_a.begin(); module != detector_a.end(); ++module) {
401 module->
add(p2 -
p1);
405 store(detectorFile_a, detector_a);
413 tripods.
load(tripodFile.c_str());
422 tripod->
add(p2 -
p1);
425 tripods.
store(tripodFile.c_str());
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Simple fit method based on Powell's algorithm, see reference: Numerical Recipes in C++,...
std::vector< JModel_t > step
Data structure for position in three dimensions.
const JPosition3D & getPosition() const
Get position.
JVector3D & add(const JVector3D &vector)
Add vector.
Utility class to parse command line options.
const JUTMPosition & getUTMPosition() const
Get UTM position.
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.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary data structure for floating point format specification.
Type definition of range.
Auxiliary wrapper for I/O of container with optional comment (see JComment).
void store(const char *file_name) const
Store to output file.
void load(const char *file_name)
Load from input file.