65 inline bool compare(
const JHitL0& first,
const JHitL0& second)
67 if (std::equal_to<KM3NETDAQ::JDAQPMTIdentifier>()(first, second))
68 return std::less<JTRIGGER::JHit>()(first, second);
70 return std::less<KM3NETDAQ::JDAQPMTIdentifier>()(first, second);
81 int main(
int argc,
char **argv)
85 using namespace KM3NETDAQ;
88 typedef JParallelFileScanner_t::multi_pointer_type multi_pointer_type;
91 JParallelFileScanner_t inputFile;
98 size_t numberOfPrefits;
105 JParser<> zap(
"Program to perform PDF fit of muon trajectory to data.");
110 zap[
'n'] =
make_field(numberOfEvents) = JLimit::max();
112 zap[
'R'] =
make_field(roadWidth_m) = numeric_limits<double>::max();
121 catch(
const exception& error) {
122 FATAL(error.what() << endl);
150 JRegressor_t::T_ns.setRange(-50.0, +450.0);
151 JRegressor_t::Vmax_npe = 10.0;
152 JRegressor_t::MAXIMUM_ITERATIONS = 10000;
154 const double Rmax_m = 100.0;
157 JRegressor_t fit(pdfFile, TTS_ns);
161 fit.parameters.resize(5);
163 fit.parameters[0] = JLine3Z::pX();
164 fit.parameters[1] = JLine3Z::pY();
165 fit.parameters[2] = JLine3Z::pT();
166 fit.parameters[3] = JLine3Z::pDX();
167 fit.parameters[4] = JLine3Z::pDY();
169 if (fit.getRmax() < roadWidth_m) {
171 roadWidth_m = fit.getRmax();
173 WARNING(
"Set road width to [m] " << roadWidth_m << endl);
181 while (inputFile.hasNext()) {
183 STATUS(
"event: " << setw(10) << inputFile.getCounter() <<
'\r');
DEBUG(endl);
185 multi_pointer_type ps = inputFile.next();
193 JEvt::iterator __end = evt->end();
195 if (numberOfPrefits > 0) {
196 advance(__end = evt->begin(), min(numberOfPrefits, evt->size()));
199 partial_sort(evt->begin(), __end, evt->end(),
qualitySorter);
204 buildL0(*tev, moduleRouter,
true, back_inserter(dataL0));
207 if (dataL0.size() >= fit.parameters.size()) {
209 for (JEvt::const_iterator track = evt->begin(); track != __end; ++track) {
221 for (JDataL0_t::const_iterator i = dataL0.begin(); i != dataL0.end(); ++i) {
231 if (tz.getDistance(hit) <= Rmax_m) {
239 sort(data.begin(), data.end(), compare);
241 JDataW0_t::iterator __end = unique(data.begin(), data.end(), equal_to<JDAQPMTIdentifier>());
246 for (JDetector::const_iterator module =
detector.begin(); module !=
detector.end(); ++module) {
252 if (tz.getDistance(pos) <= Rmax_m) {
254 for (
unsigned int i = 0; i != module->size(); ++i) {
258 JPMT pmt(module->getPMT(i));
262 buffer.push_back(
JPMTW0(pmt, R_Hz, top.count(
id)));
269 const int NDF = distance(data.begin(), __end) - fit.parameters.size();
275 if (track->getE() > 0.1)
276 fit.E_GeV = track->getE();
280 const double chi2 = fit(
JLine3Z(tz), data.begin(), __end);
282 fit(fit.value, data.begin(), __end, buffer.begin(), buffer.end());
293 fit.error.getDY() * fit.error.getDY()));
Data regression method for JFIT::JLine3Z.
Utility class to parse command line options.
General purpose data regression method.
number of iterations from JGandalf.cc
Template specialisation of L0 builder for JHitL0 data type.
const JDAQPMTIdentifier & getPMTIdentifier() const
Get PMT identifier.
Auxiliary class for handling PMT geometry, rate and response.
Recording of objects on file according a format that follows from the file name extension.
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.
Data structure for detector geometry and calibration.
angular resolution [rad] from JGandalf.cc
Various implementations of functional maps.
JFit getFit(const JHistory &history, const JTrack3D &track, const double Q, const int NDF, const double energy=0.0, const int status=0)
Get fit.
Basic data structure for L0 hit.
Definition of fit parameters from various applications.
Basic data structure for time and time over threshold information of hit.
Auxiliary class for defining the range of iterations of objects.
JAxis3D & rotate(const JRotation3D &R)
Rotate axis.
control parameter from JGandalf.cc
#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...
Data structure for PMT geometry and calibration.
Auxiliary class for a hit with background rate value.
angular resolution [rad] from JGandalf.cc
void load(const JString &file_name, JDetector &detector)
Load detector from input file.
General purpose messaging.
counter_type advance(counter_type &counter, const counter_type value, const counter_type limit=std::numeric_limits< counter_type >::max())
Advance counter.
Scanning of objects from multiple files according a format that follows from the extension of each fi...
Direct access to module in detector data structure.
number of hits from JGandalf.cc
double getQuality(const double chi2, const int NDF)
Get quality of fit.
Data structure for set of track fit results.
Regressor function object for JLine3Z fit using JGandalf minimiser.
General purpose class for object reading from a list of file names.
Utility class to parse command line options.
Data structure for L0 hit.
ROOT TTree parameter settings.
Data structure for fit of straight line paralel to z-axis.
bool qualitySorter(const JFIT::JFit &first, const JFIT::JFit &second)
Comparison of fit results.
JDirection3D getDirection(const Vec &v)
Get direction.
Data structure for position in three dimensions.
const JLimit & getLimit() const
Get limit.
JPosition3D & rotate(const JRotation3D &R)
Rotate.
#define DEBUG(A)
Message macros.
JPosition3D getPosition(const Vec &v)
Get position.
int main(int argc, char *argv[])