49 namespace JACOUSTICS {
88 public JClonable< JMatch<hit_type>, JMatch3D>
118 const double dt = fabs(first.
getToA() - second.
getToA());
157 if (first .empty())
return false;
158 if (second.empty())
return false;
184 int main(
int argc,
char **argv)
196 int factoryLimit = 10000;
197 double TMaxExtra_s = 100.0e-6;
215 JParser<> zap(
"Main program to trigger acoustic data.");
217 zap[
'f'] =
make_field(inputFile,
"output of JConvertDB -q toashort");
218 zap[
'n'] =
make_field(numberOfEvents) = JLimit::max();
219 zap[
'@'] =
make_field(properties,
"trigger parameters");
222 zap[
'a'] =
make_field(detectorFile,
"detector file");
224 zap[
'p'] =
make_field(precision,
"precision time-of-arrival") = 1.0e-6;
230 catch(
const exception &error) {
231 FATAL(error.what() << endl);
258 if (
i->getFloor() == 0) {
265 catch(
const exception&) {
271 i->getPosition() + pos,
272 i->getT0() * 1.0e-9);
295 while (inputFile.hasNext()) {
297 if (inputFile.getCounter()%100000 == 0) {
298 STATUS(
"counter: " << setw(8) << inputFile.getCounter() <<
'\r' << flush);
DEBUG(endl);
304 oid = parameters->
DETID;
307 if (oid != parameters->
DETID) {
308 FATAL(
"Invalid detector identifier " << parameters->
DETID <<
" != " << oid << endl);
311 if (receivers.has(parameters->
DOMID)) {
324 catch(
const exception&) {}
339 buffer_type::iterator __end = unique(receiver->second.begin(), receiver->second.end(),
JTransmission::equals(precision));
343 for (buffer_type::const_iterator p = receiver->second.begin(); p != __end; ++p) {
354 int number_of_events = 0;
356 for (buffer_type::const_iterator p = data.begin(); p != data.end(); ++p) {
358 if (
distance(data.cbegin(),p)%1000 == 0) {
359 STATUS(
"processed[" <<
i->first <<
"]: " <<
FIXED(5,1) << (
double) (100 *
distance(data.cbegin(),p)) / (double) data.size() <<
"%" <<
'\r' << flush);
DEBUG(endl);
362 buffer_type::const_iterator q = p;
364 while (++q != data.end() && q->getToA() - p->getToA() <=
parameters.TMax_s) {}
370 buffer_type::iterator
root = buffer.begin();
371 buffer_type::iterator __p = buffer.begin();
372 buffer_type::iterator __q = buffer.begin();
379 for (buffer_type::const_iterator
i = p; ++
i != q; ) {
391 out[1] =
JEvent(oid, number_of_events,
i->first, root, __q);
397 out[1] =
JEvent(oid, number_of_events,
i->first, p, q);
400 if (out[0].empty()) {
404 }
else if (
overlap(out[0],out[1])) {
406 out[0].
merge(out[1]);
410 number_of_events += 1;
421 if (!out[0].empty()) {
423 number_of_events += 1;
428 STATUS(
"triggers[" <<
i->first <<
"]: " << setw(7) << number_of_events << endl);
hit_type(const JPosition3D &position, const JTransmission &transmission)
Constructor.
Utility class to parse command line options.
bool operator()(const JEvent &first, const JEvent &second) const
Match criterion.
JPredicate< JResult_t T::*, JComparison::eq > make_predicate(JResult_t T::*member, const JResult_t value)
Helper method to create predicate for data member.
int main(int argc, char *argv[])
JComparator< JResult_t T::*, JComparison::lt > make_comparator(JResult_t T::*member)
Helper method to create comparator between values of data member.
void merge(const JEvent &event)
Merge event.
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.
JVector3D getPosition(T __begin, T __end, const JPredicate< JTypename_t, JComparator_t > &predicate)
Get position from element in data which corresponds to given predicate.
#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.
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.
std::string DETID
constraint
*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
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Function object interface for hit matching.
Auxiliary data structure for floating point format specification.
3D match criterion for acoustic signals.
JMatch3D(const JSoundVelocity &V, const double Tmax_s=0.0)
Constructor.
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.
Data structure for hydrophone.
const JPolynome f1(1.0, 2.0, 3.0)
Function.
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.
JContainer< std::vector< JHydrophone > > hydrophones_container
Auxiliary wrapper for I/O of container with optional comment (see JComment).
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
const array_type< JValue_t > & make_array(const JValue_t(&array)[N])
Method to create array of values.
int getID() const
Get identifier.
Template class for object cloning.
ROOT TTree parameter settings.
const JPosition3D & getPosition() const
Get position.
General purpose messaging.
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.
z range($ZMAX-$ZMIN)< $MINIMAL_DZ." fi fi typeset -Z 4 STRING typeset -Z 2 FLOOR JPlot1D -f $
int getString() const
Get string number.
JRange< double > time_range
Type definition of time range.
virtual double getTime(const double D_m, const double z1, const double z2) const override
Get propagation time of sound.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
Acoustic trigger parameters.
Auxiliary class to define a range between two values.
General purpose class for object reading from a list of file names.
Utility class to parse command line options.
hit_type()
Default constructor.
double getToA() const
Get calibrated time of arrival.
Auxiliary class to compare transmissions.
const JLimit & getLimit() const
Get limit.
Data structure for position in three dimensions.
bool equals(const JFirst_t &first, const JSecond_t &second, const double precision=std::numeric_limits< double >::min())
Check equality.
JEventOverlap(const double Tmax_s=0.0)
Constructor.
static JEmitterID getEmitterID
Function object for emitter identification.
do set_variable DETECTOR_TXT $WORKDIR detector
JSoundVelocity & set(const double z0)
Set depth.
double getZ() const
Get z position.
int EMITTERID
waveform identifier
static struct JTRIGGER::clusterize clusterize
#define DEBUG(A)
Message macros.