10 #include "evt/Head.hh"
68 int main(
int argc,
char **argv)
72 using namespace KM3NETDAQ;
74 typedef JParallelFileScanner< JTypeList<JDAQEvent, JEvt> > JParallelFileScanner_t;
75 typedef JParallelFileScanner_t::multi_pointer_type multi_pointer_type;
78 JParallelFileScanner_t inputFile;
86 size_t numberOfPrefits;
93 JParser<> zap(
"Program to perform PDF fit of muon trajectory to data.");
98 zap[
'n'] =
make_field(numberOfEvents) = JLimit::max();
100 zap[
'R'] =
make_field(roadWidth_m) = numeric_limits<double>::max();
104 zap[
's'] =
make_field(start) = JStart(1.0e-3, 1.0e-2);
110 catch(
const exception& error) {
111 FATAL(error.what() << endl);
122 load(detectorFile, detector);
124 catch(
const JException& error) {
128 const JModuleRouter moduleRouter(detector);
131 const JBuildL0<JHitL0> buildL0;
134 typedef JRegressor<JEnergy> JRegressor_t;
137 JRegressor_t::T_ns = T_ns;
140 JRegressor_t fit(pdfFile);
142 if (fit.getRmax() < roadWidth_m) {
143 roadWidth_m = fit.getRmax();
151 while (inputFile.hasNext()) {
153 STATUS(
"event: " << setw(10) << inputFile.getCounter() <<
'\r');
DEBUG(endl);
155 multi_pointer_type ps = inputFile.next();
161 JEvt::iterator __end = evt->
end();
164 __end = partition(evt->begin(), __end, JHistory::is_not_event(
JMUONSTART));
167 if (evt->begin() != __end) {
169 copy(evt->begin(), __end, back_inserter(out));
171 if (numberOfPrefits > 0) {
172 advance(__end = evt->begin(), min(numberOfPrefits, out.size()));
175 partial_sort(evt->begin(), __end, evt->end(),
qualitySorter);
177 __end = partition(evt->begin(), __end, JHistory::is_event(evt->begin()->getHistory()));
182 buildL0(*tev, moduleRouter,
true, back_inserter(dataL0));
185 for (JEvt::iterator track = evt->begin(); track != __end; ++track) {
189 const JModel<JLine1Z> match(tz, roadWidth_m, T_ns);
194 for (JDataL0_t::const_iterator i = dataL0.begin(); i != dataL0.end(); ++i) {
201 top.insert(hit.getModuleIdentifier());
208 const JDetectorSubset_t subdetector(detector,
getAxis(*track), roadWidth_m);
210 for (JDetector::const_iterator module = subdetector.begin(); module != subdetector.end(); ++module) {
212 size_t count = top.count(module->getID());
215 data.push_back(JNPEHit(fit.getNPE(*module, rates_Hz), count));
223 double npe_total = 0.0;
233 if (track_start == data. end()) { track_start = data. begin(); }
234 if (track_end == data.rend()) { track_end = data.rbegin(); }
236 Zmin = track_start->getZ();
237 Zmax = track_end ->getZ();
241 if (i->getZ() <= 0.0) {
245 npe_total += i->getYA();
252 FIXED(6,4) << i->getY0() <<
' ' <<
253 FIXED(6,4) << i->getYA() <<
' ' <<
254 setw(1) << i->getN() <<
' ' <<
255 FIXED(6,4) << i->getP() << endl);
258 DEBUG(
" --> " <<
FIXED(6,1) << Zmin <<
' ' <<
FIXED(6,1) << Zmax << endl);
281 JSingleFileScanner<JRemove<typelist, JEvt>::typelist> io(inputFile);
Utility class to parse command line options.
JComparator< JResult_t T::*, JComparison::lt > make_comparator(JResult_t T::*member)
Helper method to create comparator between values of data member.
Auxiliary method to locate start and end point of muon trajectory.
Recording of objects on file according a format that follows from the file name extension.
Auxiliary data structure for floating point format specification.
Data structure for detector geometry and calibration.
Various implementations of functional maps.
Basic data structure for L0 hit.
JLimit JLimit_t
Type definition of limit.
Definition of fit parameters from various applications.
Basic data structure for time and time over threshold information of hit.
Auxiliary class to extract a subset of optical modules from a detector.
const_iterator< T > end() const
Get end of data.
I/O formatting auxiliaries.
T & getInstance(const T &object)
Get static instance from temporary object.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
JAxis3D getAxis(const Trk &track)
Get axis.
Parallel scanning of objects from a single file or multiple files according a format that follows fro...
void load(const JString &file_name, JDetector &detector)
Load detector from input file.
true vertex position along track [m] from JCopy.cc
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 photo-electrons up to the barycentre from JStart.cc
Reduced data structure for L1 hit.
Utility class to parse command line options.
ROOT TTree parameter settings.
bool qualitySorter(const JFIT::JFit &first, const JFIT::JFit &second)
Comparison of fit results.
distance between first and last hits in metres from JStart.cc
void copy(const Head &from, JHead &to)
Copy header from from to to.
JDirection3D getDirection(const Vec &v)
Get direction.
const JLimit & getLimit() const
Get limit.
Data regression method for JFIT::JEnergy.
number of photo-electrons along the whole track from JStart.cc
JPosition3D & rotate(const JRotation3D &R)
Rotate.
Maximum likelihood estimator (M-estimators).
#define DEBUG(A)
Message macros.
JPosition3D getPosition(const Vec &v)
Get position.
int main(int argc, char *argv[])