110     virtual void apply(
const double step)
 override 
  112       for (data_type::iterator evt = 
data.begin(); evt != 
data.end(); ++evt) {
 
  114         map_type::iterator p = evt->data.find(
id);
 
  116         if (p != evt->data.end()) {
 
  117           for (buffer_type::iterator hit = p->second.begin(); hit != p->second.end(); ++hit) {
 
  118             static_cast<JHit&
>(*hit) = 
JHit(hit->getT1() + step, hit->getToT());
 
  158       for (
size_t i = 0; i < 
ns; ++i) {
 
  160         thread worker([
this, storage]() {
 
  164           regressor.parameters.resize(5);
 
  178               unique_lock<mutex> lock(
in);
 
  192               for (map_type::const_iterator p = evt->
data.begin(); p != evt->
data.end(); ++p) {
 
  193                 copy(p->second.begin(), p->second.end(), back_inserter(
data));
 
  199             const double chi2 = regressor(value, 
data.begin(), 
data.end());
 
  202               unique_lock<mutex> lock(
out);
 
  209         workers.emplace_back(std::move(worker));
 
  222         unique_lock<mutex> lock(
in);
 
  241     std::condition_variable   
cv;
 
  281 int main(
int argc, 
char **argv)
 
  288   typedef JParallelFileScanner_t::multi_pointer_type               multi_pointer_type;
 
  294   JLimit_t&                numberOfEvents = inputFile.getLimit();
 
  296   JCalibration_t           calibrationFile;
 
  300   bool                     overwriteDetector;
 
  303   int                      number_of_iterations    =  1000;
 
  304   int                      number_of_extra_steps   =     0;
 
  310   const int DEFAULT_ID = -1;
 
  321     JParser<> zap(
"Program to determine inter-string time calibration.");
 
  327     zap[
'n'] = 
make_field(numberOfEvents)      = JLimit::max();
 
  330     zap[
'A'] = 
make_field(overwriteDetector, 
"overwrite detector file provided through '-a' with fitted time offsets.");
 
  334     zap[
'N'] = 
make_field(threads,           
"number of threads")                                = 1;
 
  339   catch(
const exception& error) {
 
  340     FATAL(error.what() << endl);
 
  344   if (strings.empty() == modules.empty()) {
 
  345     FATAL(
"Set either strings (option -S) or modules (option -M)." << endl);
 
  357   unique_ptr<JDynamics> dynamics;
 
  363     dynamics->load(calibrationFile);
 
  365   catch(
const exception& error) {
 
  366     if (!calibrationFile.empty()) {
 
  373   NOTICE(
"Reading PDFs... " << flush);
 
  380   JRegressor_t::T_ns.setRange(parameters.
TMin_ns, parameters.
TMax_ns);
 
  381   JRegressor_t::Vmax_npe           = parameters.
VMax_npe;
 
  382   JRegressor_t::MAXIMUM_ITERATIONS = parameters.
NMax;
 
  398     for (JParallelFileScanner_t 
in(*i); (skip -= 
in.skip(skip)) == 0 && 
in.hasNext() && counter != numberOfEvents; ++counter) {
 
  400       STATUS(
"event: " << setw(10) << counter << 
'\r'); 
DEBUG(endl);
 
  402       multi_pointer_type ps  = 
in.next();
 
  410         dynamics->update(*tev);
 
  417         buildL0(*tev, router, 
true, back_inserter(dataL0));
 
  443             buffer.push_back(hit);
 
  451         buffer_type::const_iterator __end = unique(buffer.begin(), buffer.end(), equal_to<JDAQPMTIdentifier>());
 
  457         for (buffer_type::const_iterator hit = buffer.begin(); hit != __end; ++hit) {
 
  461           if (!strings.empty()) { 
map[module.
getString()].push_back(*hit); }
 
  462           if (!modules.empty()) { 
map[module.
getID()]    .push_back(*hit); }
 
  484   const double   chi2  = fit(perth);
 
  488   for (
size_t i = 0; i != fit.size(); ++i) {
 
  492       if (p != NULL) { 
STATUS(fit[i].name << 
' ' << 
FIXED(9,3) << p->
t0 << 
" [ns]" << endl); }
 
  497   if (overwriteDetector) {
 
  503     for (
size_t i = 0; i != fit.size(); ++i) {
 
  514     for (JDetector::iterator module = 
detector.begin(); module != 
detector.end(); ++module) {
 
  516       if (!module->empty()) {
 
  519                                               !modules.empty() ? 
calibration.find(module->getID())     :
 
  523             module->getPMT(pmt).addT0(p->second - t0);
 
  529     NOTICE(
"Store calibration data on file " << detectorFile << endl);
 
Data structure for detector geometry and calibration.
 
Dynamic detector calibration.
 
Basic data structure for L0 hit.
 
Data regression method for JFIT::JLine3Z.
 
Base class for data structures with artithmetic capabilities.
 
General purpose messaging.
 
#define DEBUG(A)
Message macros.
 
Direct access to module in detector data structure.
 
Scanning of objects from multiple files according a format that follows from the extension of each fi...
 
Parallel scanning of objects from a single file or multiple files according a format that follows fro...
 
Utility class to parse command line options.
 
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
 
int main(int argc, char **argv)
 
#define MAKE_STRING(A)
Make string.
 
Utility class to parse parameter values.
 
#define gmake_property(A)
macros to convert (template) parameter to JPropertiesElement object
 
Auxiliary class to define a range between two values.
 
ROOT TTree parameter settings of various packages.
 
Auxiliary methods to convert data members or return values of member methods of a set of objects to a...
 
int getString() const
Get string number.
 
Router for direct addressing of module data in detector data structure.
 
const JModule & getModule(const JObjectID &id) const
Get module parameters.
 
Data structure for a composite optical module.
 
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.
 
static parameter_type pY()
 
static parameter_type pX()
 
static parameter_type pT()
 
Data structure for fit of straight line in positive z-direction.
 
static parameter_type pDY()
 
static parameter_type pDX()
 
JAxis3D & rotate(const JRotation3D &R)
Rotate axis.
 
int getID() const
Get identifier.
 
virtual const pointer_type & next()=0
Get next element.
 
virtual bool hasNext()=0
Check availability of next element.
 
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.
 
void update(const JDAQHeader &header)
Update router.
 
double getRate() const
Get default rate.
 
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
 
void copy(const Head &from, JHead &to)
Copy header from from to to.
 
std::set< int > getStringIDs(const JDetector &detector)
Get list of strings identifiers.
 
std::set< int > getModuleIDs(const JDetector &detector, const bool option=false)
Get list of modules 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::vector< JHitW0 > buffer_type
hits
 
JPosition3D getPosition(const JFit &fit)
Get position.
 
JLANG::JSTDObjectReader< const event_type > input_type
 
std::vector< event_type > data_type
 
JDirection3D getDirection(const JFit &fit)
Get direction.
 
JFIT::JRegressor< JFIT::JLine3Z, JFIT::JGandalf > JRegressor_t
 
JFIT::JRegressorStorage< JFIT::JLine3Z, JFIT::JGandalf > JRegressorStorage_t
 
std::map< int, buffer_type > map_type
identifier -> 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.
 
size_t numberOfIterations
 
Template specialisation of class JModel to match hit with muon trajectory along z-axis.
 
Auxiliary data structure for editable parameter.
 
Auxiliary data structure for fit parameter.
 
Template data structure for storage for PDF tables.
 
Template definition of a data regressor of given model.
 
Auxiliary class for recursive type list generation.
 
Auxiliary data structure for average.
 
void put(const double x)
Put value.
 
double getMean() const
Get mean value.
 
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
 
Auxiliary class for editing time offset.
 
double t0
time offset [ns]
 
JEditor(data_type &data, const int id)
Constructor.
 
virtual void apply(const double step) override
Apply step.
 
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.
 
const JRegressorStorage_t & storage
 
double operator()(const int option) const
Get chi2.
 
Thread pool for fits to data.
 
JPerth(const JRegressorStorage_t &storage, const data_type &data, const size_t ns)
Constructor.
 
std::vector< std::thread > workers
 
std::condition_variable cv
 
static JMATH::JQuantile_t Q
 
Auxiliary data structure to store data and fit in memory.
 
Auxiliary class for defining the range of iterations of objects.
 
Auxiliary data structure for sorting of hits.