97 public JClonable< JMatch<hit_type>, JMatch3D>
126 const double dt = fabs(first.
getToA() - second.
getToA());
186 if (!this->empty()) {
188 for (const_iterator i = this->begin(); i != this->end(); ++i) {
210 return out << setw(3) <<
object.getID() <<
' '
211 <<
FIXED(9,3) <<
object.getT() -
TOA_s <<
" [s]" <<
' '
212 << setw(4) <<
object.size() <<
' '
213 <<
FIXED(9,2) <<
object.getQ() <<
' '
214 <<
object.getPosition();
314 const double factor = 1.0) :
320 if (RMax_m > 0.0 && Xv_m > 0.0) {
321 for (
double x = 0.5*Xv_m; x <= RMax_m; x += Xv_m) {
322 for (
double y = 0.5*Xv_m; y <= RMax_m; y += Xv_m) {
323 if (x*x + y*y <= RMax_m*RMax_m) {
347 const double t0 = vx.
getT();
351 for (T p = __begin; p != __end; ++p) {
355 if (fabs(t1 - t0) <=
Tmax_s) {
379 for (const_iterator i = this->cbegin(); i != this->cend(); ++i) {
386 double q0 =
root.getQ();
388 for (T p = __begin; p != __end && n0 +
distance(p, __end) >= numberOfHits && n0 +
distance(p, __end) >= vertex.
N; ++p) {
390 const double d1 = p0.
getDistance(p->getPosition());
391 const double t1 = p->getToA() -
V.
getTime(d1, p0.
getZ(), p->getZ());
393 if (fabs(t1 - t0) <=
Tmax_s) {
433 JLimit_t& numberOfEvents = inputFile.getLimit();
435 int factoryLimit = 10000;
436 double TMaxExtra_s = 500.0e-6;
442 double fraction = 0.75;
469 JParser<> zap(
"Main program to trigger acoustic data.");
471 zap[
'f'] =
make_field(inputFile,
"output of JToA");
473 zap[
'@'] =
make_field(properties,
"trigger parameters");
476 zap[
'a'] =
make_field(detectorFile,
"detector file");
478 zap[
'p'] =
make_field(precision,
"precision time-of-arrival") = 1.0e-6;
484 catch(
const exception &error) {
485 FATAL(error.what() << endl);
507 const JVelo Velo(V0, RMax_m, Xv_m*grid, factor);
508 const JVelo velo(V0, RMax_m/grid, Xv_m, factor);
510 const JMatch3D match(V0, TMaxExtra_s);
516 for (JDetector::const_iterator i =
detector.begin(); i !=
detector.end(); ++i) {
520 if (i->getFloor() == 0) {
527 catch(
const exception&) {
532 receivers[i->getID()] =
JReceiver(i->getID(),
533 i->getPosition() + pos,
534 i->getT0() * 1.0e-9);
569 JToA* parameters = inputFile.
next();
572 FATAL(
"Invalid detector identifier " << parameters->
DETID <<
" != " <<
detector.getID() << endl);
575 if (receivers.
has(parameters->
DOMID)) {
577 ids.insert(parameters->
DOMID);
580 const double toa_s = parameters->
TOA_S();
590 receiver.
getT(toa_s),
591 receiver.
getT(toa_s));
602 parameters.
numberOfHits = (int) (ids.size() * fraction);
611 STATUS(
"processing: " << setw(3) << i->first << endl);
621 buffer_type::iterator __end = unique(receiver->second.begin(), receiver->second.end(),
JTransmission::equals(precision));
625 for (buffer_type::const_iterator p = receiver->second.begin(); p != __end; ++p) {
626 if (p->getQ() >= parameters.
Q * (parameters.
Q <= 1.0 ? p->getW() : 1.0)) {
639 TH1D* h1 = M1[i->first];
640 TH1D* h2 = M2[i->first];
641 TH1D* h3 = M3[i->first];
642 TH1D* h4 = M4[i->first];
643 TH1D* h5 = M5[i->first];
645 for (buffer_type::const_iterator p = data.begin(); p != data.end(); ++p) {
647 buffer_type::const_iterator q = p;
649 while (++q != data.end() && q->getToA() - p->getToA() <= parameters.
TMax_s) {}
663 buffer_type::iterator
root = buffer.begin();
664 buffer_type::iterator __p = buffer.begin();
665 buffer_type::iterator __q = buffer.begin();
672 for (buffer_type::const_iterator i = p; ++i != q; ) {
710 if (!out[1].empty()) {
712 if (out[0].empty()) {
716 }
else if (overlap2D(out[0],out[1])) {
718 out[0].
merge(out[1]);
722 STATUS(
"trigger: " << out[0] << endl);
724 h5->Fill(out[0].size());
726 queue.push_back(out[0]);
736 if (!out[0].empty()) {
738 queue.push_back(out[0]);
744 if (!queue.empty()) {
746 sort(queue.begin(), queue.end());
757 for ( ; q != queue.end() && overlap1D(*p,*q); ++q) {
759 STATUS(
"| " << *q << endl);
761 if (q->getQ() > i->getQ()) {
766 STATUS(
"event: " << *i << endl);
770 G2[i->getID()].put(i->getX(), i->getY());
780 for (
const auto M : { &M1, &M2, &M3, &M4, &M5 }){
781 for (
const auto& i : *M) {
int main(int argc, char **argv)
ROOT TTree parameter settings.
Acoustic trigger parameters.
Algorithms for hit clustering and sorting.
Data structure for detector geometry and calibration.
Recording of objects on file according a format that follows from the file name extension.
General purpose class for hash map of unique elements.
Data structure for hydrophone.
Dynamic ROOT object management.
Base class for match operations for cluster and hit-preprocessing methods.
General purpose messaging.
#define DEBUG(A)
Message macros.
Scanning of objects from multiple files according a format that follows from the extension of each fi...
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
I/O formatting auxiliaries.
#define MAKE_CSTRING(A)
Make C-string.
Utility class to parse parameter values.
#define gmake_property(A)
macros to convert (template) parameter to JPropertiesElement object
3D match criterion for acoustic signals.
const JAbstractSoundVelocity & V
virtual bool operator()(const hit_type &first, const hit_type &second) const override
Match operator.
JMatch3D(const JAbstractSoundVelocity &V, const double Tmax_s=0.0)
Constructor.
int getString() const
Get string number.
Utility class to parse parameter values.
double getY() const
Get y position.
double getX() const
Get x position.
Data structure for position in three dimensions.
const JPosition3D & getPosition() const
Get position.
Data structure for vector in three dimensions.
double getDistance(const JVector3D &pos) const
Get distance to point.
double getZ() const
Get z position.
double getT(const JVector3D &pos) const
Get arrival time of Cherenkov light at given position.
const JVertex3D & getVertex() const
Get vertex.
int getID() const
Get identifier.
Utility class to parse command line options.
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.
virtual bool hasNext() override
Check availability of next element.
virtual const pointer_type & next() override
Get next element.
Function object interface for hit matching.
JVertex3D getVertex(const Trk &track)
Get vertex.
JPosition3D getPosition(const Vec &pos)
Get position.
Auxiliary classes and methods for acoustic position calibration.
int getWaveformID(int id)
Get waveform identifier.
JContainer< std::vector< JHydrophone > > hydrophones_container
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.
JComparator< JResult_t T::*, JComparison::lt > make_comparator(JResult_t T::*member)
Helper method to create comparator between values of data member.
double getDistance(const JFirst_t &first, const JSecond_t &second)
Get distance between objects.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
std::vector< JHitW0 > buffer_type
hits
JHitIterator_t clusterize(JHitIterator_t __begin, JHitIterator_t __end, const JMatch_t &match, const int Nmin=1)
Partition data according given binary match operator.
Auxiliary data structure for sequence of same character.
Auxiliary data structure for floating point format specification.
Interface for depth dependend velocity of sound.
virtual double getTime(const double D_m, const double z1, const double z2) const =0
Get propagation time of sound.
int getCounter() const
Get counter.
Match of two events considering overlap in time and position.
JEventOverlap(const double Tmax_s, const double Dmax_m=std::numeric_limits< double >::max())
Constructor.
bool operator()(const event_type &first, const event_type &second) const
Match criterion.
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)
Auxiliary class to compare transmissions.
Auxiliary class to compare transmissions.
double getToA() const
Get calibrated time of arrival.
double Q
minimal quality if larger than one; else minimal normalised quality
double TMax_s
maximal difference between times of emission [s]
int numberOfHits
minimal number of hits to trigger event
int operator()(const JVertex3D &vx, T __begin, T __end) const
Check vertex.
vertex_type operator()(const JPosition3D &position, const hit_type &root, T __begin, T __end, const int numberOfHits=0) const
Locate vertex around given position.
const JAbstractSoundVelocity & V
JVelo(const JAbstractSoundVelocity &V, const double RMax_m, const double Xv_m, const double factor=1.0)
Constructor.
double getQ() const
Get average quality.
event_type()
Default constructor.
event_type(const JEvent &event)
Copy constructor.
friend std::ostream & operator<<(std::ostream &out, const event_type &object)
Write event to output stream.
static double TOA_s
start time of data
event_type(const JVertex3D &vertex, const JEvent &event)
Constructor.
Transmission with position.
hit_type()
Default constructor.
hit_type(const JPosition3D &position, const JTransmission &transmission)
Constructor.
vertex_type()
Default constructor.
vertex_type(const JVector3D &p0, const double t0, const int n0, const double q0)
Constructor.
Auxiliary wrapper for I/O of container with optional comment (see JComment).
Template class for object cloning.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Auxiliary data structure to build TGraph.
Auxiliary class for defining the range of iterations of objects.
static counter_type max()
Get maximum counter value.