62int main(
int argc,
char **argv)
69 typedef JParallelFileScanner_t::multi_pointer_type multi_pointer_type;
73 JParallelFileScanner_t inputFile;
77 JCalibration_t calibrationFile;
82 histogram_type calibrate;
90 JParser<> zap(
"Program to perform detector calibration using reconstructed muon trajectories.");
99 zap[
'c'] =
make_field(calibrate,
"histogram for time calibration.");
107 catch(
const exception& error) {
108 FATAL(error.what() << endl);
112 if (!calibrate.is_valid()) {
113 FATAL(
"Invalid calibration data " << calibrate << endl);
129 unique_ptr<JDynamics> dynamics;
131 if (!calibrationFile.empty()) {
137 dynamics->load(calibrationFile);
139 catch(
const exception& error) {
151 FATAL(
"No valid target; check option -R" << endl);
169 TH2D ha(
"ha", NULL, 256, -0.5, 255.5,
170 calibrate.getNumberOfBins(), calibrate.getLowerLimit(), calibrate.getUpperLimit());
172 TProfile hb(
"hb", NULL, 256, -0.5, 255.5);
174 TProfile hr(
"hr", NULL, 60, 0.0, 150.0);
176 TH2D h2(
"h2", NULL, rpm->
getN(), -0.5, rpm->
getN() - 0.5,
177 calibrate.getNumberOfBins(), calibrate.getLowerLimit(), calibrate.getUpperLimit());
179 JManager_t
g1(
new TProfile(
"%", NULL, rpm->
getN(), -0.5, rpm->
getN() - 0.5, -1.0, +1.0));
182 while (inputFile.hasNext()) {
184 STATUS(
"event: " << setw(10) << inputFile.getCounter() <<
'\r');
DEBUG(endl);
186 multi_pointer_type ps = inputFile.next();
194 dynamics->update(*tev);
201 buildL0(*tev, router,
true, back_inserter(dataL0));
203 for (JFIT::JEvt::const_iterator track = in->begin(); track != in->end(); ++track) {
219 for (JDataL0_t::const_iterator i = dataL0.begin(); i != dataL0.end(); ++i) {
225 const int type = wip.
getType();
226 const double QE = wip.
QE;
227 const double R_Hz = summary.
getRate(i->getPMTIdentifier(), parameters.
R_Hz);
229 JHitW0 hit(*i, type, QE, R_Hz);
242 JDataW0_t::iterator __end = unique(data.begin(), data.end(), equal_to<JDAQPMTIdentifier>());
247 if (track->getE() > 0.1)
248 fit.JRegressor_t::E_GeV = track->getE();
250 fit.JRegressor_t::E_GeV = parameters.
E_GeV;
254 for (JDataW0_t::const_iterator hit = data.begin(); hit != __end; ++hit) {
255 buffer.insert(rpm->
getIndex(hit->getModuleID()));
260 for (
const int index : buffer) {
262 JDataW0_t::iterator q = partition(data.begin(), __end, [rpm, index](
const JHitW0& hit) { return rpm->getIndex(hit.getModuleID()) != index; });
264 if (
distance(data.begin(), q) - fit.parameters.size() > 0) {
266 fit(ta, data.begin(), q);
268 for (JDataW0_t::const_iterator hit = q; hit != __end; ++hit) {
270 const double t1 = fit.value.getT(hit->
getPosition());
271 JTrack3D gradient = fit(fit.value, *hit).gradient;
278 hr.Fill(fit.value.getDistance(*hit), gradient.
getT());
280 h2.Fill(index, hit->
getT() - t1);
282 g1[
"T"]->Fill(index, gradient.
getT());
283 g1[
"X"]->Fill(index, gradient.
getX());
284 g1[
"Y"]->Fill(index, gradient.
getY());
285 g1[
"Z"]->Fill(index, gradient.
getZ());
int main(int argc, char **argv)
Data structure for detector geometry and calibration.
Dynamic detector calibration.
Basic data structure for L0 hit.
Dynamic ROOT object management.
General purpose messaging.
#define DEBUG(A)
Message macros.
Direct access to module in detector data structure.
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
Double_t g1(const Double_t x)
Function.
ROOT TTree parameter settings of various packages.
Router for direct addressing of module data in detector data structure.
Auxiliary class for map of PMT parameters.
const JPMTParameters & getPMTParameters(const JPMTIdentifier &id) const
Get PMT parameters.
Data structure for PMT parameters.
double QE
relative quantum efficiency
int getType() const
Get type for for time-slewing correction.
Data structure for set of track fit results.
void select(const JSelector_t &selector)
Select fits.
Data structure for fit of straight line paralel to z-axis.
Data structure for fit of straight line in positive z-direction.
JAxis3D & rotate_back(const JRotation3D &R)
Rotate back axis.
JAxis3D & rotate(const JRotation3D &R)
Rotate axis.
JPosition3D & rotate(const JRotation3D &R)
Rotate.
const JPosition3D & getPosition() const
Get position.
double getT(const JVector3D &pos) const
Get arrival time of Cherenkov light at given position.
double getY() const
Get y position.
double getZ() const
Get z position.
double getX() const
Get x position.
Utility class to parse command line options.
Auxiliary class for a hit with background rate value.
double getT() const
Get calibrated time of hit.
Auxiliary class to manage set of compatible ROOT objects (e.g. histograms) using unique keys.
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 JDAQPMTIdentifier &id) const
Get rate.
double getT1() const
Get leading edge of hit.
double getToT() const
Get calibrated time over threshold of hit.
static const int JSTART_LENGTH_METRES
distance between projected positions on the track of optical modules for which the response does not ...
JDirection3D getDirection(const Vec &dir)
Get direction.
JPosition3D getPosition(const Vec &pos)
Get position.
static const std::string string_t
string
JTOOLS::JRange< double > JTimeRange
Type definition for time range (unit [s]).
const char *const module_t
routing by module
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
JTOOLS::JRange< double > JZRange
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
bool qualitySorter(const JFit &first, const JFit &second)
Comparison of fit results.
bool putObject(TDirectory &dir, const TObject &object)
Write object to ROOT directory.
KM3NeT DAQ data structures and auxiliaries.
Interface for routing module identifier to index and vice versa.
virtual int getIndex(const int id) const =0
Get index.
virtual size_t getN() const =0
Get number of indices.
Dynamic detector calibration.
Auxiliary class to match data points with given model.
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 ZMax_m
maximal z-positon [m]
double ZMin_m
minimal z-positon [m]
double R_Hz
default rate [Hz]
size_t numberOfPrefits
number of prefits
Wrapper class to make final fit of muon trajectory.
Auxiliary class for defining the range of iterations of objects.
const JLimit & getLimit() const
Get limit.
static counter_type max()
Get maximum counter value.
Auxiliary data structure for sorting of hits.