64 using namespace KM3NETDAQ;
67 typedef JParallelFileScanner_t::multi_pointer_type multi_pointer_type;
70 JParallelFileScanner_t inputFile;
77 size_t numberOfPrefits;
84 JParser<> zap(
"Program to perform fit of muon path to data.");
89 zap[
'n'] =
make_field(numberOfEvents) = JLimit::max();
91 zap[
'R'] =
make_field(roadWidth_m) = numeric_limits<double>::max();
100 catch(
const exception& error) {
101 FATAL(error.what() << endl);
127 JRegressor_t::T_ns.setRange(-50.0, +50.0);
128 JRegressor_t::Vmax_npe = 10.0;
129 JRegressor_t::MAXIMUM_ITERATIONS = 10000;
131 JRegressor_t fit(pdfFile, TTS_ns);
133 for (
int i = 0; i != JRegressor_t::NUMBER_OF_PDFS; ++i) {
134 fit.npe[i].transform(JRegressor_t::JNPE_t::transformer_type::getDefaultTransformer());
139 fit.parameters.resize(4);
142 fit.parameters[1] = JLine3Z::pY();
143 fit.parameters[2] = JLine3Z::pDX();
144 fit.parameters[3] = JLine3Z::pDY();
146 if (fit.getRmax() < roadWidth_m) {
148 roadWidth_m = fit.getRmax();
150 WARNING(
"Set road width to [m] " << roadWidth_m << endl);
153 const double Rmax_m = 100.0;
154 const double Tmax_ns = 10.0;
161 while (inputFile.hasNext()) {
163 STATUS(
"event: " << setw(10) << inputFile.getCounter() <<
'\r');
DEBUG(endl);
165 multi_pointer_type ps = inputFile.next();
178 buildL0(*tev, router,
true, back_inserter(dataL0));
181 for (JEvt::const_iterator track = cp.begin(); track != cp.end(); ++track) {
193 for (JDataL0_t::const_iterator i = dataL0.begin(); i != dataL0.end(); ++i) {
201 top.insert(hit.getPMTIdentifier());
203 const double t1 = hit.getT() - tz.getT(hit);
205 if (tz.getDistance(hit) <= Rmax_m && t1 >= -Tmax_ns && t1 <= +Tmax_ns) {
214 for (JDetector::const_iterator module =
detector.begin(); module !=
detector.end(); ++module) {
220 if (tz.getDistance(pos) <= roadWidth_m &&
Z(pos.getZ() - tz.getDistance(pos) /
getTanThetaC())) {
222 for (
unsigned int i = 0; i != module->size(); ++i) {
226 JPMT pmt(module->getPMT(i));
230 buffer.push_back(
JPMTW0(pmt, R_Hz, top.count(
id)));
236 const int NDF = buffer.size() - fit.parameters.size();
242 if (track->getE() > 0.1)
243 fit.E_GeV = track->getE();
247 const double chi2 = fit(
JLine3Z(tz), buffer.begin(), buffer.end());
255 out.rbegin()->setW(track->getW());
Utility class to parse command line options.
static const int JMUONPATH
double getQuality(const double chi2, const int NDF)
Get quality of fit.
Template specialisation of L0 builder for JHitL0 data type.
Auxiliary class for handling PMT geometry, rate and response.
Router for direct addressing of module data in detector data structure.
General purpose class for parallel reading of objects from a single file or multiple files...
Template specialisation of class JModel to match hit with muon trajectory along z-axis.
Data structure for fit of straight line in positive z-direction.
bool qualitySorter(const JFit &first, const JFit &second)
Comparison of fit results.
Auxiliary class for defining the range of iterations of objects.
JAxis3D & rotate(const JRotation3D &R)
Rotate axis.
JDirection3D getDirection(const Vec &dir)
Get direction.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Data structure for PMT geometry, calibration and status.
JPosition3D getPosition(const Vec &pos)
Get position.
then usage $script[distance] fi case set_variable R
Auxiliary class for a hit with background rate value.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
JFit getFit(const int id, const JMODEL::JString &string)
Get fit parameters of string.
Regressor function object for JLine3Z fit using JGandalf minimiser.
Data structure for fit of straight line paralel to z-axis.
double getTanThetaC()
Get average tangent of Cherenkov angle of water corresponding to group velocity.
do set_variable MODULE getModule a $WORKDIR detector_a datx L $STRING JEditDetector a $WORKDIR detector_a datx M $MODULE setz o $WORKDIR detector_a datx JEditDetector a $WORKDIR detector_b datx M $MODULE setz o $WORKDIR detector_b datx done echo Output stored at $WORKDIR detector_a datx and $WORKDIR tripod_a txt JDrawDetector2D a $WORKDIR detector_a datx a $WORKDIR detector_b datx L BL o detector $FORMAT $BATCH JDrawDetector2D T $WORKDIR tripod_a txt T $WORKDIR tripod_b txt L BL o tripod $FORMAT $BATCH JCompareDetector a $WORKDIR detector_a datx b $WORKDIR detector_b datx o $WORKDIR abc root &dev null for KEY in X Y Z
Object reading from a list of files.
Data structure for position in three dimensions.
const JLimit & getLimit() const
Get limit.
do set_variable DETECTOR_TXT $WORKDIR detector
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
JPosition3D & rotate(const JRotation3D &R)
Rotate.
#define DEBUG(A)
Message macros.