323 JLimit_t& numberOfEvents = inputFile.getLimit();
326 int factoryLimit = 100000;
327 int numberOfHits = 0;
330 double DMax_m = 500.0;
331 double ZMax_m = 200.0;
332 double TMaxExtra_s = 100.0e-6;
333 double TMaxVertex_s = 1.0e-2;
334 double gridAngle_deg = 10.0;
360 JParser<> zap(
"Main program to trigger acoustic data.");
363 zap[
'n'] =
make_field(numberOfEvents) = JLimit::max();
370 zap[
'a'] =
make_field(detectorFile,
"detector file");
371 zap[
'W'] =
make_field(waveform,
"waveform identifier");
376 catch(
const exception &error) {
377 FATAL(error.what() << endl);
393 const double v0 = V(cylinder.getZmax());
395 if (parameters.TMax_s < parameters.DMax_m / v0) {
397 parameters.TMax_s = parameters.DMax_m / v0;
399 NOTICE(
"Set maximal time [s] " <<
FIXED(7,3) << parameters.TMax_s << endl);
402 const JMatch3D match3D(v0, parameters.DMax_m, parameters.TMaxExtra_s);
403 const JMatch1D match1D(v0, parameters.DMax_m, parameters.ZMax_m, parameters.TMaxExtra_s);
407 const JCheck check(X, Y, Z, v0, parameters.TMaxVertex_s, parameters.numberOfHits);
415 const JPosition3D center(cylinder.getX(), cylinder.getY(), 0.5 * (cylinder.getZmin() + cylinder.getZmax()));
417 for (JDetector::const_iterator module =
detector.begin(); module !=
detector.end(); ++module) {
419 if (module->getFloor() != 0) {
421 receivers[module->getID()] =
JReceiver(module->getID(),
423 module->getT0() * 1.0e-9);
427 TH1D h0(
"h0", NULL, 21, -0.5, 20.5);
431 for (
size_t i = 2; i <= 5; ++i) {
432 M1[i] =
new TH1D(
MAKE_CSTRING(
"M[" << i <<
"]"), NULL, 1001, -0.5, 1000.5);
458 FATAL(
"Invalid detector identifier " << p->
DETID <<
" != " <<
detector.getID() << endl);
467 const double toa = p->
TOA_S();
489 const chrono::steady_clock::time_point t0 = chrono::steady_clock::now();
491 size_t trigger_counter = 0;
493 for (buffer_type::const_iterator p =
data.begin(), q = p; p !=
data.end(); ++p) {
498 const chrono::steady_clock::time_point t1 = chrono::steady_clock::now();
502 <<
FIXED(8,1) << p->getToA() <<
" [s]" <<
' '
503 << setw(6) << chrono::duration_cast<chrono::seconds>(t1 - t0).count() <<
" [s]" <<
' '
504 << setw(6) << trigger_counter << endl);
509 while (q !=
data.end() && q->getToA() - p->getToA() <= parameters.TMax_s) { ++q; }
511 if (
distance(p,q) >= parameters.numberOfHits) {
515 if (
distance(p,q) < parameters.factoryLimit) {
519 buffer_type::iterator
root = buffer.begin();
520 buffer_type::iterator __p = buffer.begin();
521 buffer_type::iterator __q = buffer.begin();
528 for (buffer_type::const_iterator i = p; ++i != q; ) {
529 if (match3D(*
root,*i)) {
548 const double W = 1.0 / (double) rotator.size();
552 for (buffer_type::iterator i =
root; i != __q; ++i) {
556 buffer_type::iterator __z = partition(__p, __q,
JBind2nd(match1D,*
root));
572 if (!check.is_valid() || check(*
root, __p, __z)) {
574 trigger_counter += 1;
578 out[1] =
JEvent(
detector.getID(), out[0].getCounter() + 1, waveform, p, q);
590 trigger_counter += 1;
592 out[1] =
JEvent(
detector.getID(), out[0].getCounter() + 1, waveform, p, q);
595 if (!out[1].empty()) {
597 if (out[0].empty()) {
601 }
else if (
overlap(out[0],out[1])) {
603 out[0].
merge(out[1]);
619 if (!out[0].empty()) {
629 for (TH1D* h1 : M1) {
#define DEBUG(A)
Message macros.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
#define MAKE_CSTRING(A)
Make C-string.
#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.
3D match criterion for acoustic signals.
Utility class to parse parameter values.
Data structure for angles in three dimensions.
Direction set covering (part of) solid angle.
Data structure for position in three dimensions.
const JPosition3D & getPosition() const
Get position.
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.
counter_type getCounter() const
Get counter.
virtual const pointer_type & next() override
Get next element.
void print(std::ostream &out, const JEvent &event)
Print event.
static const JSoundVelocity getSoundVelocity(1541.0, -17.0e-3, -2000.0)
Function object for velocity of sound.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
JPosition3D getPiezoPosition()
Get relative position of piezo in optical module.
JComparator< JResult_t T::*, JComparison::lt > make_comparator(JResult_t T::*member)
Helper method to create comparator between values of data member.
static const double PI
Mathematical constants.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
std::vector< JHitW0 > buffer_type
hits
JBinder2nd< JHit_t > JBind2nd(const JMatch< JHit_t > &match, const JHit_t &second)
Auxiliary method to create JBinder2nd object.
static const struct JTRIGGER::clusterize clusterize
Auxiliary data structure for floating point format specification.
Auxiliary data structure for final check on event.
Match of two events considering overlap in time.
void merge(const JEvent &event)
Merge event.
double getT(const double t_s) const
Get corrected time.
Implementation for depth dependend velocity of sound.
JSoundVelocity & set(const double z0)
Set depth.
Time-of-arrival data from acoustic piezo sensor or hydrophone.
uint32_t DOMID
DAQ run number.
uint32_t QUALITYFACTOR
The ticks (16ns) part of the DAQ frame timestamp.
uint32_t QUALITYNORMALISATION
A measure of how good the waveform match was to the signal.
int32_t WAVEFORMID
DOM unique identifeir.
int32_t RUN
detector identifier
double TOA_S() const
Time of Arrival, expressed in seconds relative to Unix epoch (1 January 1970 00:00:00 UTC)
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.