49 namespace JACOUSTICS {
95 public JClonable< JMatch<hit_type>, JMatch3D>
142 public JClonable< JMatch<hit_type>, JMatch1D>
153 JMatch1D(
const double V,
const double Rmax_m,
const double Zmax_m,
const double Tmax_s) :
186 return fabs(first.
getZ() - second.
getZ()) <= Zmax_m;
259 const double t0 = root.
getToA() *
V -
u->getLength();
263 for (
T p = __begin; p != __end; ++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;
315 int main(
int argc,
char **argv)
326 int factoryLimit = 100000;
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");
376 catch(
const exception &error) {
377 FATAL(error.what() << endl);
393 const double v0 =
V(cylinder.getZmax());
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);
449 while (inputFile.hasNext()) {
451 if (inputFile.getCounter()%1000 == 0) {
452 STATUS(
"counter: " << setw(8) << inputFile.getCounter() <<
'\r' << flush);
DEBUG(endl);
455 const JToA* p = inputFile.next();
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; }
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;
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) {
hit_type(const JPosition3D &position, const JTransmission &transmission)
Constructor.
Data structure for angles in three dimensions.
Utility class to parse command line options.
Q(UTCMax_s-UTCMin_s)-livetime_s
int main(int argc, char *argv[])
JMatch1D(const double V, const double Rmax_m, const double Zmax_m, const double Tmax_s)
Constructor.
JComparator< JResult_t T::*, JComparison::lt > make_comparator(JResult_t T::*member)
Helper method to create comparator between values of data member.
void print(std::ostream &out, const JEvent &event)
Print event.
JBinder2nd< JHit_t > JBind2nd(const JMatch< JHit_t > &match, const JHit_t &second)
Auxiliary method to create JBinder2nd object.
Algorithms for hit clustering and sorting.
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
#define gmake_property(A)
macros to convert (template) parameter to JPropertiesElement object
General purpose class for hash map of unique elements.
ROOT TTree parameter settings.
1D match criterion for acoustic signals.
Match of two events considering overlap in time.
Recording of objects on file according a format that follows from the file name extension.
virtual bool operator()(const hit_type &first, const hit_type &second) const override
Match operator.
Utility class to parse parameter values.
then usage else fatal Wrong number of arguments fi JCookie sh eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O CAN eval JPrintDetector a $DETECTOR O SUMMARY source JAcousticsToolkit sh expand_array RUNS for KEY in sound_velocity waveform
then usage $script< input file >[option] nPossible options count
int32_t WAVEFORMID
DOM unique identifeir.
*fatal Wrong number of arguments esac JCookie sh typeset Z DETECTOR typeset Z SOURCE_RUN typeset Z TARGET_RUN set_variable PARAMETERS_FILE $WORKDIR parameters
#define MAKE_CSTRING(A)
Make C-string.
JCheck(const JHistogram_t &X, const JHistogram_t &Y, const JHistogram_t &Z, const double V, const double Tmax_s, const int Nmin)
Constructor.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Time-of-arrival data from acoustic piezo sensor or hydrophone.
Direction set covering (part of) solid angle.
Function object interface for hit matching.
then fatal Wrong number of arguments fi set_variable STRING $argv[1] set_variable DETECTORXY_TXT $WORKDIR $DETECTORXY_TXT tail read X Y CHI2 RMS printf optimum n $X $Y $CHI2 $RMS awk v Y
Auxiliary data structure for floating point format specification.
3D match criterion for acoustic signals.
double getDistance(const JVector3D &pos) const
Get distance to point.
Data structure for detector geometry and calibration.
do JPlot2D f $WORKDIR canberra[${EMITTER}\] root
std::vector< JHitW0 > buffer_type
hits
Utility class to parse parameter values.
then echo The file $DIR KM3NeT_00000001_00000000 root already please rename or remove it first
double getDistance(const JFirst_t &first, const JSecond_t &second)
Get distance between objects.
Auxiliary data structure for final check on event.
Auxiliary class for defining the range of iterations of objects.
static const JSoundVelocity getSoundVelocity(1541.0,-17.0e-3,-2000.0)
Function object for velocity of sound.
Base class for match operations for cluster and hit-preprocessing methods.
I/O formatting auxiliaries.
Data structure for vector in three dimensions.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
int32_t RUN
detector identifier
do set_variable OUTPUT_DIRECTORY $WORKDIR T
virtual bool operator()(const hit_type &first, const hit_type &second) const override
Match operator.
Template class for object cloning.
uint32_t QUALITYFACTOR
The ticks (16ns) part of the DAQ frame timestamp.
static const double PI
Mathematical constants.
const JPosition3D & getPosition() const
Get position.
bool is_valid() const
Check validity.
double TOA_S() const
Time of Arrival, expressed in seconds relative to Unix epoch (1 January 1970 00:00:00 UTC) ...
General purpose messaging.
uint32_t QUALITYNORMALISATION
A measure of how good the waveform match was to the signal.
Implementation for depth dependend velocity of sound.
Scanning of objects from multiple files according a format that follows from the extension of each fi...
double getT(const double t_s) const
Get corrected time.
then JCookie sh JDataQuality D $DETECTOR_ID R
then usage $script[energy[distance[z of PMT]]] fi case set_variable z
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
General purpose class for object reading from a list of file names.
Utility class to parse command line options.
hit_type()
Default constructor.
JPosition3D getPiezoPosition()
Get relative position of piezo in optical module.
double getToA() const
Get calibrated time of arrival.
no fit printf nominal n $STRING awk v X
do set_variable MODULE getModule a $WORKDIR detector_a datx L $STRING JEditDetector a $WORKDIR detector_a datx M $MODULE setz o $WORKDIR detector_a datx JEditDetector a $WORKDIR detector_b datx M $MODULE setz o $WORKDIR detector_b datx done echo Output stored at $WORKDIR detector_a datx and $WORKDIR tripod_a txt JDrawDetector2D a $WORKDIR detector_a datx a $WORKDIR detector_b datx L BL o detector $FORMAT $BATCH JDrawDetector2D T $WORKDIR tripod_a txt T $WORKDIR tripod_b txt L BL o tripod $FORMAT $BATCH JCompareDetector a $WORKDIR detector_a datx b $WORKDIR detector_b datx o $WORKDIR abc root &dev null for KEY in X Y Z
std::vector< JVector3D > U
const JLimit & getLimit() const
Get limit.
Data structure for position in three dimensions.
uint32_t DOMID
DAQ run number.
do set_variable DETECTOR_TXT $WORKDIR detector
JSoundVelocity & set(const double z0)
Set depth.
do echo Generating $dir eval D
double getZ() const
Get z position.
static struct JTRIGGER::clusterize clusterize
JMatch3D(const double V, const double Dmax_m, const double Tmax_s)
Constructor.
bool operator()(const hit_type &root, T __begin, T __end) const
Check event.
JAbstractHistogram< double > JHistogram_t
Type definition for scan along axis.
#define DEBUG(A)
Message macros.