195 const double sigma_m,
206 center.setPosition(
JPosition3D(center.getX(), center.getY(), 0.0));
250 const double tx = model.tx;
251 const double tz = sqrt((1.0 + tx) * (1.0 - tx));
259 const double ty = model.ty;
260 const double tz = sqrt((1.0 + ty) * (1.0 - ty));
288 int main(
int argc,
char **argv)
293 string detectorFile_a;
294 string detectorFile_b;
295 bool overwriteDetector;
304 JParser<> zap(
"Auxiliary program to align two detectors.");
306 zap[
'a'] =
make_field(detectorFile_a,
"detector - subject to alignment (option -A)");
307 zap[
'b'] =
make_field(detectorFile_b,
"detector - reference for alignment");
308 zap[
'A'] =
make_field(overwriteDetector,
"overwrite detector file provided through '-a' with modified positions.");
309 zap[
'T'] =
make_field(tripodFile,
"tripods") =
"";
311 zap[
'O'] =
make_field(option,
"keep strings vertical");
317 catch(
const exception &error) {
318 FATAL(error.what() << endl);
322 if (overwriteDetector) {
323 if (tripodFile ==
"") {
324 FATAL(
"No tripod file.");
333 load(detectorFile_a, detector_a);
340 load(detectorFile_b, detector_b);
347 const JFit_t fit(detector_b, sigma_m, option, range);
351 for (JDetector::const_iterator module = detector_a.begin(); module != detector_a.end(); ++module) {
352 if (fit.hasModule(module->
getID()) && module->
getFloor() != 0) {
353 data.push_back(*module);
365 simplex.step.resize(6);
367 simplex.step[0] =
JModel_t(0.01, 0.00, 0.00, 0.0, 0.0, 0.0);
368 simplex.step[1] =
JModel_t(0.00, 0.01, 0.00, 0.0, 0.0, 0.0);
369 simplex.step[2] =
JModel_t(0.00, 0.00, 0.01, 0.0, 0.0, 0.0);
370 simplex.step[3] =
JModel_t(0.00, 0.00, 0.00, 5.0e-4, 0.0, 0.0);
371 simplex.step[4] =
JModel_t(0.00, 0.00, 0.00, 0.0, 1.0e-4, 0.0);
372 simplex.step[5] =
JModel_t(0.00, 0.00, 0.00, 0.0, 0.0, 1.0e-4);
374 const double chi2 = simplex(fit, data.begin(), data.end());
376 cout <<
"Number of iterations " << simplex.numberOfIterations << endl;
377 cout <<
"chi2/NDF " <<
FIXED(7,3) <<
chi2 <<
'/' << (detector_a.size() - simplex.step.size()) << endl;
379 cout <<
"model:" << endl;
381 cout <<
"x " <<
FIXED(7,3) << simplex.value.x << endl;
382 cout <<
"y " <<
FIXED(7,3) << simplex.value.y << endl;
383 cout <<
"z " <<
FIXED(7,3) << simplex.value.z << endl;
384 cout <<
"phi " <<
FIXED(9,5) << simplex.value.phi << endl;
385 cout <<
"Tx " <<
FIXED(9,5) << simplex.value.tx << endl;
386 cout <<
"Ty " <<
FIXED(9,5) << simplex.value.ty << endl;
389 if (overwriteDetector) {
391 NOTICE(
"Store alignment data on files " << detectorFile_a <<
" and " << tripodFile << endl);
393 detector_a.comment.add(
JMeta(argc,argv));
395 for (JDetector::iterator module = detector_a.begin(); module != detector_a.end(); ++module) {
398 const JPosition3D p2 = fit.getPosition(simplex.value, p1);
400 module->
add(p2 - p1);
404 store(detectorFile_a, detector_a);
412 tripods.
load(tripodFile.c_str());
418 const JPosition3D p1 = tripod->getUTMPosition() - detector_a.getUTMPosition();
419 const JPosition3D p2 = fit.getPosition(simplex.value, p1);
421 tripod->add(p2 - p1);
424 tripods.
store(tripodFile.c_str());
Utility class to parse command line options.
int main(int argc, char *argv[])
Auxiliary base class for aritmetic operations of derived class types.
int getFloor() const
Get floor number.
JModel_t & negate()
Negate model.
Data structure for a composite optical module.
JModel_t & add(const JModel_t &model)
Add model.
Router for direct addressing of module data in detector data structure.
double getDistanceSquared(const JVector3D &pos) const
Get squared of distance to point.
std::iterator_traits< T >::value_type getAverage(T __begin, T __end)
Get average.
JModel_t & mul(const double factor)
Scale model.
Auxiliary data structure for floating point format specification.
Data structure for detector geometry and calibration.
Type definition of range.
Auxiliary wrapper for I/O of container with optional comment (see JComment).
#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.
int getID() const
Get identifier.
void store(const std::string &file_name, const JDetector &detector)
Store detector to output file.
JPosition3D getPosition(const Vec &pos)
Get position.
double getY() const
Get y position.
JModel_t & sub(const JModel_t &model)
Subtract model.
const JPosition3D & getPosition() const
Get position.
General purpose messaging.
void load(const char *file_name)
Load from input file.
Direct access to module in detector data structure.
z range($ZMAX-$ZMIN)< $MINIMAL_DZ." fi fi typeset -Z 4 STRING typeset -Z 2 FLOOR JPlot1D -f $
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
Auxiliary class to define a range between two values.
Simple fit method based on Powell's algorithm, see reference: Numerical Recipes in C++...
Utility class to parse command line options.
void store(const char *file_name) const
Store to output file.
then if[[!-f $DETECTOR]] then JDetector sh $DETECTOR fi cat $WORKDIR trigger_parameters txt<< EOFtrigger3DMuon.enabled=1;trigger3DMuon.numberOfHits=5;trigger3DMuon.gridAngle_deg=1;ctMin=0.0;TMaxLocal_ns=15.0;EOF set_variable TRIGGEREFFICIENCY_TRIGGERED_EVENTS_ONLY INPUT_FILES=() for((i=1;$i<=$NUMBER_OF_RUNS;++i));do JSirene.sh $DETECTOR $JPP_DATA/genhen.km3net_wpd_V2_0.evt.gz $WORKDIR/sirene_ ${i}.root JTriggerEfficiency.sh $DETECTOR $DETECTOR $WORKDIR/sirene_ ${i}.root $WORKDIR/trigger_efficiency_ ${i}.root $WORKDIR/trigger_parameters.txt $JPP_DATA/PMT_parameters.txt INPUT_FILES+=($WORKDIR/trigger_efficiency_ ${i}.root) done for ANGLE_DEG in $ANGLES_DEG[*];do set_variable SIGMA_NS 3.0 set_variable OUTLIERS 3 set_variable OUTPUT_FILE $WORKDIR/matrix\[${ANGLE_DEG}\deg\].root $JPP_DIR/examples/JReconstruction-f"$INPUT_FILES[*]"-o $OUTPUT_FILE-S ${SIGMA_NS}-A ${ANGLE_DEG}-O ${OUTLIERS}-d ${DEBUG}--!fiif[[$OPTION=="plot"]];then if((0));then for H1 in h0 h1;do JPlot1D-f"$WORKDIR/matrix["${^ANGLES_DEG}" deg].root:${H1}"-y"1 2e3"-Y-L TR-T""-\^"number of events [a.u.]"-> o chi2
double getX() const
Get x position.
JModel_t & div(const double factor)
Scale model.
Base class for data structures with artithmetic capabilities.
JFit_t
Enumeration for fit algorithms.
Data structure for position in three dimensions.
Data structure for tripod.
JPosition3D & rotate(const JRotation3D &R)
Rotate.
double getZ() const
Get z position.
const JModule & getModule(const JDetector &detector, const JModuleLocation &location)
find module with a given string and floor number
JModule & add(const JVector3D &pos)
Add position.