59 namespace JRECONSTRUCTION {
106 virtual void apply(
const double step)
override
108 for (data_type::iterator evt =
data.begin(); evt !=
data.end(); ++evt) {
110 map_type::iterator p = evt->data.find(
id);
112 if (p != evt->data.end()) {
113 for (buffer_type::iterator hit = p->second.begin(); hit != p->second.end(); ++hit) {
154 for (
size_t i = 0;
i <
ns; ++
i) {
156 thread worker([
this, storage]() {
160 regressor.parameters.resize(5);
174 unique_lock<mutex> lock(
in);
188 for (map_type::const_iterator p = evt->
data.begin(); p != evt->
data.end(); ++p) {
189 copy(p->second.begin(), p->second.end(), back_inserter(data));
195 const double chi2 = regressor(value, data.begin(), data.end());
198 unique_lock<mutex> lock(
out);
205 workers.emplace_back(std::move(worker));
218 unique_lock<mutex> lock(
in);
237 std::condition_variable
cv;
277 int main(
int argc,
char **argv)
281 using namespace KM3NETDAQ;
284 typedef JParallelFileScanner_t::multi_pointer_type multi_pointer_type;
292 JCalibration_t calibrationFile;
296 bool overwriteDetector;
298 int number_of_iterations = 1000;
299 int number_of_extra_steps = 0;
314 JParser<> zap(
"Program to determine inter-string time calibration.");
320 zap[
'n'] =
make_field(numberOfEvents) = JLimit::max();
323 zap[
'A'] =
make_field(overwriteDetector,
"overwrite detector file provided through '-a' with fitted time offsets.");
326 zap[
'N'] =
make_field(threads,
"number of threads") = 1;
331 catch(
const exception& error) {
332 FATAL(error.what() << endl);
345 unique_ptr<JDynamics> dynamics;
351 dynamics->load(calibrationFile);
353 catch(
const exception& error) {
354 if (!calibrationFile.empty()) {
365 NOTICE(
"Reading PDFs... " << flush);
374 JRegressor_t::MAXIMUM_ITERATIONS =
parameters.NMax;
390 for (JParallelFileScanner_t
in(*
i); (skip -=
in.skip(skip)) == 0 &&
in.hasNext() && counter != numberOfEvents; ++counter) {
392 STATUS(
"event: " << setw(10) << counter <<
'\r');
DEBUG(endl);
394 multi_pointer_type ps =
in.next();
402 dynamics->update(*tev);
409 buildL0(*tev, router,
true, back_inserter(dataL0));
435 buffer.push_back(hit);
443 buffer_type::const_iterator __end = unique(buffer.begin(), buffer.end(), equal_to<JDAQPMTIdentifier>());
449 for (buffer_type::const_iterator hit = buffer.begin(); hit != __end; ++hit) {
451 const JModule& module = router.getModule(hit->getModuleID());
473 const double chi2 = fit(perth);
477 for (
size_t i = 0;
i != fit.size(); ++
i) {
487 if (overwriteDetector) {
495 for (
size_t i = 0;
i != fit.size(); ++
i) {
501 calibration[p->
id] = p->
t0;
507 t0 /= calibration.size();
509 for (JDetector::iterator module =
detector.begin(); module !=
detector.end(); ++module) {
511 if (!module->empty()) {
515 if (p != calibration.end()) {
517 module->getPMT(pmt).addT0(p->second - t0);
523 NOTICE(
"Store calibration data on file " << detectorFile << endl);
Data regression method for JFIT::JLine3Z.
Template definition of a data regressor of given model.
Utility class to parse command line options.
JPerth(const JRegressorStorage_t &storage, const data_type &data, const size_t ns)
Constructor.
int main(int argc, char *argv[])
ROOT TTree parameter settings of various packages.
Auxiliary data structure for chi2 function object.
std::vector< event_type > data_type
static JTOOLS::JQuantile Q
Data structure for a composite optical module.
const JRegressorStorage_t & storage
std::map< int, buffer_type > map_type
string -> hits
Template specialisation of L0 builder for JHitL0 data type.
#define gmake_property(A)
macros to convert (template) parameter to JPropertiesElement object
void update(const JDAQHeader &header)
Update router.
Router for direct addressing of module data in detector data structure.
std::set< int > getStringIDs(const JDetector &detector)
Get list of strings identifiers.
double getRate() const
Get default rate.
Utility class to parse parameter values.
*fatal Wrong number of arguments esac JCookie sh typeset Z DETECTOR typeset Z SOURCE_RUN typeset Z TARGET_RUN set_variable PARAMETERS_FILE $WORKDIR parameters
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.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Data structure for fit of straight line in positive z-direction.
static parameter_type pT()
Long64_t counter_type
Type definition for counter.
Auxiliary data structure for floating point format specification.
Template data structure for storage for PDF tables.
std::condition_variable cv
Data structure for detector geometry and calibration.
Auxiliary class to edit time offset of data per string.
static struct JTRIGGER::JHitL0::compare compare
std::vector< JHitW0 > buffer_type
hits
Utility class to parse parameter values.
JFIT::JRegressor< JFIT::JLine3Z, JFIT::JGandalf > JRegressor_t
#define MAKE_STRING(A)
Make string.
Auxiliary data structure to store data and fit in memory.
Basic data structure for L0 hit.
Data structure for track fit results with history and optional associated values. ...
Auxiliary class for defining the range of iterations of objects.
static parameter_type pDX()
JStringEditor(data_type &data, const int id)
Constructor.
virtual const pointer_type & next()=0
Get next element.
JAxis3D & rotate(const JRotation3D &R)
Rotate axis.
bool hasW(const int i) const
Check availability of value.
Thread pool for fits to data.
Auxiliary class for recursive type list generation.
double getT() const
Get time.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Parallel scanning of objects from a single file or multiple files according a format that follows fro...
void store(const std::string &file_name, const JDetector &detector)
Store detector to output file.
JDirection3D getDirection(const JFit &fit)
Get direction.
virtual bool hasNext()=0
Check availability of next element.
Dynamic detector calibration.
File router for fast addressing of summary data.
Auxiliary data structure for fit parameter.
std::vector< std::thread > workers
static parameter_type pY()
Data structure for fit parameters.
General purpose messaging.
static parameter_type pDY()
Auxiliary data structure for sequence of same character.
Scanning of objects from multiple files according a format that follows from the extension of each fi...
JLANG::JSTDObjectReader< const event_type > input_type
Direct access to module in detector data structure.
Auxiliary data structure for editable parameter.
static parameter_type pX()
Dynamic detector calibration.
then JCookie sh JDataQuality D $DETECTOR_ID R
Auxiliary class for a hit with background rate value.
int getString() const
Get string number.
virtual void apply(const double step) override
Apply step.
static const int JSTART_LENGTH_METRES
distance between first and last hits in metres from JStart.cc
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
Data structure for set of track fit results.
Auxiliary class to define a range between two values.
General purpose class for object reading from a list of file names.
Utility class to parse command line options.
JFIT::JRegressorStorage< JFIT::JLine3Z, JFIT::JGandalf > JRegressorStorage_t
double t0
time offset [ns]
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
Data structure for measured coincidence rates of all pairs of PMTs in optical module.
Data structure for fit of straight line paralel to z-axis.
void copy(const Head &from, JHead &to)
Copy header from from to to.
size_t numberOfIterations
JPosition3D getPosition(const JFit &fit)
Get position.
const JLimit & getLimit() const
Get limit.
do set_variable DETECTOR_TXT $WORKDIR detector
static const int NUMBER_OF_PMTS
Total number of PMTs in module.
const std::vector< double > & getW() const
Get associated values.
JTOOLS::JRange< double > JZRange
double operator()(const int option) const
Get chi2.
#define DEBUG(A)
Message macros.