98 public JClonable< JMatch<hit_type>, JMatch3D>
127 const double dt = fabs(first.
getToA() - second.
getToA());
173 return static_cast<const JEvent&
>(*this);
184 return static_cast<const JVertex3D&
>(*this);
262 return static_cast<const JVertex3D&
>(*this);
289 const double factor = 1.0) :
293 this->push_back(center);
295 if (RMax_m > 0.0 && Xv_m > 0.0) {
296 for (
double x = 0.5*Xv_m; x <= RMax_m; x += Xv_m) {
297 for (
double y = 0.5*Xv_m; y <= RMax_m; y += Xv_m) {
298 if (x*x + y*y <= RMax_m*RMax_m) {
322 const double t0 = vx.
getT();
327 for (T p = __begin; p != __end; ++p) {
331 if (fabs(t1 - t0) <=
Tmax_s) {
357 double q0 =
root.getQ();
359 for (T p = __begin; p != __end; ++p) {
363 if (fabs(t1 - t0) <=
Tmax_s) {
387 for (const_iterator i = this->cbegin(); i != this->cend(); ++i) {
393 double q0 =
root.getQ();
395 for (T p = __begin; p != __end && n0 +
distance(p, __end) >= numberOfHits && n0 +
distance(p, __end) >= vertex.
N; ++p) {
399 if (fabs(t1 - t0) <=
Tmax_s) {
430 for (
const auto& i : evt) {
462 JLimit_t& numberOfEvents = inputFile.getLimit();
464 int factoryLimit = 10000;
465 double TMaxExtra_s = 500.0e-6;
471 double fraction = 0.75;
496 JParser<> zap(
"Main program to trigger acoustic data.");
498 zap[
'f'] =
make_field(inputFile,
"output of JToA");
500 zap[
'@'] =
make_field(properties,
"trigger parameters");
503 zap[
'a'] =
make_field(detectorFile,
"detector file");
505 zap[
'p'] =
make_field(precision,
"precision time-of-arrival") = 1.0e-6;
511 catch(
const exception &error) {
512 FATAL(error.what() << endl);
533 const JMatch3D match(V0, TMaxExtra_s);
539 for (JDetector::const_iterator i =
detector.begin(); i !=
detector.end(); ++i) {
543 if (i->getFloor() == 0) {
550 catch(
const exception&) {
555 receivers[i->getID()] =
JReceiver(i->getID(),
556 i->getPosition() + pos,
557 i->getT0() * 1.0e-9);
587 static double TOA_s = numeric_limits<double>::max();
595 JToA* parameters = inputFile.
next();
598 FATAL(
"Invalid detector identifier " << parameters->
DETID <<
" != " <<
detector.getID() << endl);
601 if (receivers.
has(parameters->
DOMID)) {
603 ids.insert(parameters->
DOMID);
606 const double toa_s = parameters->
TOA_S();
616 receiver.
getT(toa_s),
617 receiver.
getT(toa_s));
628 parameters.
numberOfHits = (int) (ids.size() * fraction);
645 buffer_type::iterator __end = unique(receiver->second.begin(), receiver->second.end(),
JTransmission::equals(precision));
649 for (buffer_type::const_iterator p = receiver->second.begin(); p != __end; ++p) {
650 if (p->getQ() >= parameters.
Q * (parameters.
Q <= 1.0 ? p->getW() : 1.0)) {
665 TH1D* h1 = M1[i->first];
666 TH1D* h2 = M2[i->first];
667 TH1D* h3 = M3[i->first];
668 TH1D* h4 = M4[i->first];
669 TH1D* h5 = M5[i->first];
671 for (buffer_type::const_iterator p = data.begin(); p != data.end(); ++p) {
673 if (
distance(data.cbegin(), p)%100 == 0) {
674 STATUS(
"processed: " << setw(3) << i->first <<
' ' <<
FIXED(9,3) << p->getToA() - data.begin()->getToA() <<
" [s]" <<
'\r' << flush);
DEBUG(endl);
677 buffer_type::const_iterator q = p;
679 while (++q != data.end() && q->getToA() - p->getToA() <= parameters.
TMax_s) {}
693 buffer_type::iterator
root = buffer.begin();
694 buffer_type::iterator __p = buffer.begin();
695 buffer_type::iterator __q = buffer.begin();
702 for (buffer_type::const_iterator i = p; ++i != q; ) {
735 if (!out[1].empty()) {
737 if (out[0].empty()) {
741 }
else if (overlap2D(out[0],out[1])) {
743 out[0].
merge(out[1]);
747 const double t1 = out[0].begin()->getToA();
751 << setw(3) << i->first <<
' '
752 <<
FIXED(9,3) << t1 - t0 <<
" [s]" <<
' '
753 << setw(4) << out[0].size() <<
' '
759 h5->Fill(out[0].size());
761 queue.push_back(out[0]);
771 if (!out[0].empty()) {
773 queue.push_back(out[0]);
779 if (!queue.empty()) {
783 void operator=(
const double t0) { this->t0 = t0; }
785 operator double()
const {
return this->t0; }
792 sort(queue.begin(), queue.end());
801 while (++q != queue.end() && overlap1D(*p,*q)) {
807 const double t0 = ts[r->getID()];
808 const double t1 = r->begin()->getToA();
811 << setw(3) << r->getID() <<
' '
812 <<
FIXED(9,3) << t1 - t0 <<
" [s]" <<
' '
813 << setw(4) << r->size() <<
' '
815 << r->getPosition() << endl);
829 for (
const auto M : { &M1, &M2, &M3, &M4, &M5 }){
830 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.
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 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 class for defining the range of iterations of objects.
static counter_type max()
Get maximum counter value.