100 public JClonable< JMatch<hit_type>, JMatch3D>
129 const double dt = fabs(first.
getToA() - second.
getToA());
175 return static_cast<const JEvent&
>(*this);
186 return static_cast<const JVertex3D&
>(*this);
264 return static_cast<const JVertex3D&
>(*this);
291 const double factor = 1.0) :
295 this->push_back(center);
297 if (RMax_m > 0.0 && Xv_m > 0.0) {
298 for (
double x = 0.5*Xv_m; x <= RMax_m; x += Xv_m) {
299 for (
double y = 0.5*Xv_m; y <= RMax_m; y += Xv_m) {
300 if (x*x + y*y <= RMax_m*RMax_m) {
324 const double t0 = vx.
getT();
329 for (T p = __begin; p != __end; ++p) {
333 if (fabs(t1 - t0) <=
Tmax_s) {
359 double q0 =
root.getQ();
361 for (T p = __begin; p != __end; ++p) {
365 if (fabs(t1 - t0) <=
Tmax_s) {
389 for (const_iterator i = this->cbegin(); i != this->cend(); ++i) {
395 double q0 =
root.getQ();
397 for (T p = __begin; p != __end && n0 +
distance(p, __end) >= numberOfHits && n0 +
distance(p, __end) >= vertex.
N; ++p) {
401 if (fabs(t1 - t0) <=
Tmax_s) {
432 for (
const auto& i : evt) {
464 JLimit_t& numberOfEvents = inputFile.getLimit();
466 int factoryLimit = 10000;
467 double TMaxExtra_s = 500.0e-6;
473 double fraction = 0.75;
498 JParser<> zap(
"Main program to trigger acoustic data.");
500 zap[
'f'] =
make_field(inputFile,
"output of JToA");
502 zap[
'@'] =
make_field(properties,
"trigger parameters");
505 zap[
'a'] =
make_field(detectorFile,
"detector file");
507 zap[
'p'] =
make_field(precision,
"precision time-of-arrival") = 1.0e-6;
513 catch(
const exception &error) {
514 FATAL(error.what() << endl);
535 const JMatch3D match(V0, TMaxExtra_s);
541 for (JDetector::const_iterator i =
detector.begin(); i !=
detector.end(); ++i) {
545 if (i->getFloor() == 0) {
552 catch(
const exception&) {
557 receivers[i->getID()] =
JReceiver(i->getID(),
558 i->getPosition() + pos,
559 i->getT0() * 1.0e-9);
590 static double TOA_s = numeric_limits<double>::max();
598 JToA* parameters = inputFile.
next();
601 FATAL(
"Invalid detector identifier " << parameters->
DETID <<
" != " <<
detector.getID() << endl);
604 if (receivers.
has(parameters->
DOMID)) {
606 ids.insert(parameters->
DOMID);
609 const double toa_s = parameters->
TOA_S();
619 receiver.
getT(toa_s),
620 receiver.
getT(toa_s));
631 parameters.
numberOfHits = (int) (ids.size() * fraction);
648 buffer_type::iterator __end = unique(receiver->second.begin(), receiver->second.end(),
JTransmission::equals(precision));
652 for (buffer_type::const_iterator p = receiver->second.begin(); p != __end; ++p) {
653 if (p->getQ() >= parameters.
Q * (parameters.
Q <= 1.0 ? p->getW() : 1.0)) {
668 TH1D* h1 = M1[i->first];
669 TH1D* h2 = M2[i->first];
670 TH1D* h3 = M3[i->first];
671 TH1D* h4 = M4[i->first];
672 TH1D* h5 = M5[i->first];
674 for (buffer_type::const_iterator p = data.begin(); p != data.end(); ++p) {
676 if (
distance(data.cbegin(), p)%100 == 0) {
677 STATUS(
"processed: " << setw(3) << i->first <<
' ' <<
FIXED(9,3) << p->getToA() - data.begin()->getToA() <<
" [s]" <<
'\r' << flush);
DEBUG(endl);
680 buffer_type::const_iterator q = p;
682 while (++q != data.end() && q->getToA() - p->getToA() <= parameters.
TMax_s) {}
696 buffer_type::iterator
root = buffer.begin();
697 buffer_type::iterator __p = buffer.begin();
698 buffer_type::iterator __q = buffer.begin();
705 for (buffer_type::const_iterator i = p; ++i != q; ) {
738 if (!out[1].empty()) {
740 if (out[0].empty()) {
744 }
else if (overlap2D(out[0],out[1])) {
746 out[0].
merge(out[1]);
750 const double t1 = out[0].begin()->getToA();
754 << setw(3) << i->first <<
' '
755 <<
FIXED(9,3) << t1 - t0 <<
" [s]" <<
' '
756 << setw(4) << out[0].size() <<
' '
762 h5->Fill(out[0].size());
764 queue.push_back(out[0]);
774 if (!out[0].empty()) {
776 queue.push_back(out[0]);
782 if (!queue.empty()) {
786 void operator=(
const double t0) { this->t0 = t0; }
788 operator double()
const {
return this->t0; }
795 sort(queue.begin(), queue.end());
804 while (++q != queue.end() && overlap1D(*p,*q)) {
810 const double t0 = ts[r->getID()];
811 const double t1 = r->begin()->getToA();
814 << setw(3) << r->getID() <<
' '
815 <<
FIXED(9,3) << t1 - t0 <<
" [s]" <<
' '
816 << setw(4) << r->size() <<
' '
818 << r->getPosition() << endl);
826 G2[r->getID()].put(r->getX(), r->getY());
834 for (
const auto M : { &M1, &M2, &M3, &M4, &M5 }){
835 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
Auxiliary class to define a range between two values.
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.
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.
double getZmax() const
Get maximal z position.
Data structure for position in three dimensions.
const JPosition3D & getPosition() const
Get position.
Data structure for vector in three dimensions.
double getY() const
Get y position.
double getDistance(const JVector3D &pos) const
Get distance to point.
double getZ() const
Get z position.
double getX() const
Get x position.
double getT(const JVector3D &pos) const
Get arrival time of Cherenkov light at given position.
JVertex3D()
Default constructor.
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.
counter_type getCounter() const
Get counter.
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.
double getQuality(const JEvent &evt)
Get average quality.
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.
Implementation for depth independend velocity 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
Update vertex at given position.
const JAbstractSoundVelocity & V
JVelo(const JAbstractSoundVelocity &V, const JVector3D ¢er, const double RMax_m, const double Xv_m, const double factor=1.0)
Constructor.
vertex_type operator()(const hit_type &root, T __begin, T __end, const int numberOfHits=0) const
Locate vertex.
const JVertex3D & getVertex() const
Get vertex.
const JEvent & getEvent() const
Get event.
event_type(const JEvent &event, const JVertex3D &vertex=JVertex3D())
Constructor.
event_type()
Default constructor.
hit_type()
Default constructor.
hit_type(const JPosition3D &position, const JTransmission &transmission)
Constructor.
const JVertex3D & getVertex() const
Get vertex.
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.