38{
42
45 JLimit_t& numberOfEvents = inputFile.getLimit();
47 double Tmax_s = 300.0;
48 size_t Nmin = 3;
50
51 try {
52
54
57
58 JParser<> zap(
"Example program to process DAQ and acoustic events.");
59
66
67 zap(argc, argv);
68 }
69 catch(const exception &error) {
70 FATAL(error.what() << endl);
71 }
72
73
74 TH1D h1("h1", NULL, 101, -0.5, +100.5);
75 TH1D hn("hn", NULL, 101, -0.5, +100.5);
76 TH1D ht("ht", NULL, 100, -1.0e3, +1.0e3);
77
78
80
82
84
85 for (JTreeScanner_t::iterator p = in.begin(), q; p != in.end(); p = q) {
86
87 STATUS(
"event " <<
FIXED(20,6) << p->begin()->getToE() <<
'\r');
DEBUG(endl);
88
89 for (q = p; ++q != in.end() && q->begin()->getToE() <= p->rbegin()->getToE() + Tmax_s; ) {}
90
93
95
96 double range = 0.0;
97
98 for (JTreeScanner_t::iterator i = p; i != q; ++i) {
99 if (i->rbegin()->getToE() - p->begin()->getToE() > range) {
100 range = i->rbegin()->getToE() - p->begin()->getToE();
101 }
102 }
103
104 data[p->begin()->getToE()] = range;
105 }
106 }
108
109
111
114
116
118
119 double t1 = (p !=
data.end() ? p->first : 0.0);
120
121 if (p !=
data.begin()) {
122
123 --p;
124
125 if (fabs(t1 - t0) > fabs(p->first - t0)) { t1 = p->first; }
126 if (fabs(t1 - t0) > fabs(p->first + p->second - t0)) { t1 = p->first + p->second; }
127 }
128
129 ht.Fill(t0 - t1);
130 }
132
133
135
136 out << h1 << hn << ht;
137
138 out.Write();
139 out.Close();
140}
#define DEBUG(A)
Message macros.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
#define gmake_property(A)
macros to convert (template) parameter to JPropertiesElement object
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
Utility class to parse parameter values.
Utility class to parse command line options.
General purpose class for object reading from a list of file names.
virtual bool hasNext() override
Check availability of next element.
virtual const pointer_type & next() override
Get next element.
Base class for JTreeScanner.
Template definition for direct access of elements in ROOT TChain.
double getUNIXTime(const KM3NETDAQ::JDAQChronometer &chronometer)
Get UNIX time of given DAQ object.
size_t getNumberOfEmitters(T __begin, T __end)
Get number of emitters.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
KM3NeT DAQ data structures and auxiliaries.
Auxiliary data structure for floating point format specification.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Auxiliary class for defining the range of iterations of objects.
static counter_type max()
Get maximum counter value.