287 typedef JParallelFileScanner_t::multi_pointer_type multi_pointer_type;
293 JLimit_t& numberOfEvents = inputFile.getLimit();
295 JCalibration_t calibrationFile;
299 bool overwriteDetector;
301 int number_of_iterations = 1000;
302 int number_of_extra_steps = 0;
317 JParser<> zap(
"Program to determine inter-string time calibration.");
323 zap[
'n'] =
make_field(numberOfEvents) = JLimit::max();
326 zap[
'A'] =
make_field(overwriteDetector,
"overwrite detector file provided through '-a' with fitted time offsets.");
329 zap[
'N'] =
make_field(threads,
"number of threads") = 1;
334 catch(
const exception& error) {
335 FATAL(error.what() << endl);
348 unique_ptr<JDynamics> dynamics;
354 dynamics->load(calibrationFile);
356 catch(
const exception& error) {
357 if (!calibrationFile.empty()) {
364 NOTICE(
"Reading PDFs... " << flush);
371 JRegressor_t::T_ns.setRange(parameters.
TMin_ns, parameters.
TMax_ns);
372 JRegressor_t::Vmax_npe = parameters.
VMax_npe;
373 JRegressor_t::MAXIMUM_ITERATIONS = parameters.
NMax;
389 for (JParallelFileScanner_t in(*i); (skip -= in.skip(skip)) == 0 && in.hasNext() && counter != numberOfEvents; ++counter) {
391 STATUS(
"event: " << setw(10) << counter <<
'\r');
DEBUG(endl);
393 multi_pointer_type ps = in.next();
398 summary.update(*tev);
401 dynamics->update(*tev);
408 buildL0(*tev, router,
true, back_inserter(dataL0));
429 JHitW0 hit(*i, summary.getRate(i->getPMTIdentifier()));
434 buffer.push_back(hit);
442 buffer_type::const_iterator __end = unique(buffer.begin(), buffer.end(), equal_to<JDAQPMTIdentifier>());
448 for (buffer_type::const_iterator hit = buffer.begin(); hit != __end; ++hit) {
450 const JModule& module = router.getModule(hit->getModuleID());
472 const double chi2 = fit(perth);
474 STATUS(
"result: " <<
FIXED(12,6) << chi2 <<
' ' << setw(6) << fit.numberOfIterations << endl);
476 for (
size_t i = 0; i != fit.size(); ++i) {
486 if (overwriteDetector) {
492 for (
size_t i = 0; i != fit.size(); ++i) {
503 for (JDetector::iterator module =
detector.begin(); module !=
detector.end(); ++module) {
505 if (!module->empty()) {
517 NOTICE(
"Store calibration data on file " << detectorFile << endl);
#define DEBUG(A)
Message macros.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
#define MAKE_STRING(A)
Make string.
#define gmake_property(A)
macros to convert (template) parameter to JPropertiesElement object
void addT0(const double t0)
Add time offset.
int getString() const
Get string number.
Router for direct addressing of module data in detector data structure.
Data structure for a composite optical module.
const JPMT & getPMT(const int index) const
Get PMT.
Utility class to parse parameter values.
Data structure for set of track fit results.
Data structure for track fit results with history and optional associated values.
const std::vector< double > & getW() const
Get associated values.
double getT() const
Get time.
bool hasW(const int i) const
Check availability of value.
Data structure for fit of straight line paralel to z-axis.
Utility class to parse command line options.
Auxiliary class for a hit with background rate value.
General purpose class for object reading from a list of file names.
General purpose class for parallel reading of objects from a single file or multiple files.
File router for fast addressing of summary data.
Template specialisation of L0 builder for JHitL0 data type.
static const int JSTART_LENGTH_METRES
distance between first and last hits in metres from JStart.cc
JDirection3D getDirection(const Vec &dir)
Get direction.
JPosition3D getPosition(const Vec &pos)
Get position.
std::set< int > getStringIDs(const JDetector &detector)
Get list of strings identifiers.
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.
JTOOLS::JRange< double > JZRange
const array_type< JValue_t > & get_values(const std::map< JKey_t, JValue_t, JComparator_t, JAllocator_t > &data)
Method to create array of values of map.
std::iterator_traits< T >::value_type getAverage(T __begin, T __end)
Get average.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
std::map< int, buffer_type > map_type
string -> hits
Long64_t counter_type
Type definition for counter.
KM3NeT DAQ data structures and auxiliaries.
static const int NUMBER_OF_PMTS
Total number of PMTs in module.
Auxiliary data structure for sequence of same character.
Auxiliary data structure for floating point format specification.
Data structure for measured coincidence rates of all pairs of PMTs in optical module.
Dynamic detector calibration.
Template specialisation of class JModel to match hit with muon trajectory along z-axis.
Auxiliary data structure for editable parameter.
Template data structure for storage for PDF tables.
Auxiliary class for recursive type list generation.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Data structure for fit parameters.
double TTS_ns
transition-time spread [ns]
double TMin_ns
minimal time w.r.t. Cherenkov hypothesis [ns]
double roadWidth_m
road width [m]
double TMax_ns
maximal time w.r.t. Cherenkov hypothesis [ns]
double VMax_npe
maximum number of of photo-electrons
double ZMax_m
maximal z-positon [m]
double ZMin_m
minimal z-positon [m]
int NMax
maximum number of iterations
double R_Hz
default rate [Hz]
Auxiliary data structure for chi2 function object.
Auxiliary class to edit time offset of data per string.
double t0
time offset [ns]
Auxiliary class for defining the range of iterations of objects.
Auxiliary data structure for sorting of hits.