95 public JClonable< JMatch<hit_type>, JMatch3D>
142 public JClonable< JMatch<hit_type>, JMatch1D>
222 for (double y = Y.getLowerLimit(); y < Y.getUpperLimit() + 0.5*Y.getBinWidth(); y += Y.getBinWidth()) {
223 for (double z = Z.getLowerLimit(); z < Z.getUpperLimit() + 0.5*Z.getBinWidth(); z += Z.getBinWidth()) {
224 U.push_back(JVector3D(x,y,z));
256 for (vector<JVector3D>::const_iterator u = U.begin(); u != U.end(); ++u) {
259 const double t0 =
root.getToA() * V - u->getLength();
263 for (T p = __begin; p != __end; ++p) {
265 const double t1 = p->getToA() * V - p0.
getDistance(*p);
267 if (fabs(t1 - t0) <= Dmax_m) {
269 }
else if (
n +
distance(p,__end) == Nmin) {
300 out <<
"event: " << setw(6) <<
event.getCounter() <<
' ' <<
FIXED(12,2) << 0.5 * (
event.begin()->getToA() + event.rbegin()->getToA()) <<
" [s] " << setw(4) <<
event.size() << endl;
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.");
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);
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) {
495 if (
distance(data.cbegin(),p)%10000 == 0) {
498 const chrono::steady_clock::time_point t1 = chrono::steady_clock::now();
501 <<
FIXED(5,1) << (
double) (100 *
distance(data.cbegin(),p)) / (
double) data.size() <<
"%" <<
' '
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));
574 trigger_counter += 1;
590 trigger_counter += 1;
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) {
ROOT TTree parameter settings.
Algorithms for hit clustering and sorting.
int main(int argc, char **argv)
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.
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
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
1D match criterion for acoustic signals.
virtual bool operator()(const hit_type &first, const hit_type &second) const override
Match operator.
JMatch1D(const double V, const double Rmax_m, const double Zmax_m, const double Tmax_s)
Constructor.
3D match criterion for acoustic signals.
const JAbstractSoundVelocity & V
JMatch3D(const double V, const double Dmax_m, const double Tmax_s)
Constructor.
virtual bool operator()(const hit_type &first, const hit_type &second) const override
Match operator.
Utility class to parse parameter values.
double getY() const
Get y position.
double getX() const
Get x position.
Data structure for angles in three dimensions.
double getZmin() const
Get minimal z position.
double getZmax() const
Get maximal z position.
Direction set covering (part of) solid angle.
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.
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.
Function object interface for hit matching.
Auxiliary classes and methods for acoustic position calibration.
static const JSoundVelocity getSoundVelocity(1541.0, -17.0e-3, -2000.0)
Function object for velocity of sound.
JAbstractHistogram< double > JHistogram_t
Type definition for scan along axis.
std::ostream & print(std::ostream &out, const JTestSummary &summary, const char delimiter=' ', const bool useColors=true)
Print test summary.
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.
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
JBinder2nd< JHit_t > JBind2nd(const JMatch< JHit_t > &match, const JHit_t &second)
Auxiliary method to create JBinder2nd object.
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.
Auxiliary data structure for final check on event.
JCheck(const JHistogram_t &X, const JHistogram_t &Y, const JHistogram_t &Z, const double V, const double Tmax_s, const int Nmin)
Constructor.
bool operator()(const hit_type &root, T __begin, T __end) const
Check event.
std::vector< JVector3D > U
bool is_valid() const
Check validity.
int getCounter() const
Get counter.
Match of two events considering overlap in time and position.
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)
double getToA() const
Get calibrated time of arrival.
hit_type()
Default constructor.
hit_type(const JPosition3D &position, const JTransmission &transmission)
Constructor.
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.