75 transmitters_container transmitters;
76 hydrophones_container hydrophones;
79 disable_container disable;
86 JParser<> zap(
"Application to fit position calibration model to acoustic data.");
88 zap[
'f'] =
make_field(inputFile,
"output of JAcousticEventBuilder[.sh]");
90 zap[
'n'] =
make_field(numberOfEvents) = JLimit::max();
98 zap[
'u'] =
make_field(unify,
"unify weighing of pings");
101 "Precede name of data structure by a '+' or '-' "
102 "to add or remove data types in the output, respectively."
104 zap[
'D'] =
make_field(Tmax_s,
"deadtime [s]") = 100.0e-3;
109 catch(
const exception &error) {
110 FATAL(error.what() << endl);
130 for (JDetector::const_iterator i =
detector.begin(); i !=
detector.end(); ++i) {
131 receivers[i->getID()] = i->getLocation();
134 for (tripods_container::const_iterator i =
tripods.begin(); i !=
tripods.end(); ++i) {
135 emitters[i->getID()] =
JEmitter(i->getID(),
136 i->getUTMPosition() -
detector.getUTMPosition());
139 for (transmitters_container::const_iterator i = transmitters.begin(); i != transmitters.end(); ++i) {
141 emitters[i->getID()] =
JEmitter(i->getID(),
144 catch(
const exception&) {
165 TH1D h0(
"chi2/NDF", NULL, 50000, 0.0, 1000.0);
166 TH1D h1(
"h1", NULL, 51, -0.5, 50.5);
167 TH1D hn(
"hn", NULL, 100, 0.0, 6.0);
171 range.getLength() + 1,
range.getLowerLimit() - 0.5,
range.getUpperLimit() + 0.5));
175 range.getLength() + 1,
range.getLowerLimit() - 0.5,
range.getUpperLimit() + 0.5));
177 for (Int_t i = 1; i <= HA->GetXaxis()->GetNbins(); ++i) {
178 HA->GetXaxis()->SetBinLabel(i,
MAKE_CSTRING(geometry.at(i-1).first));
179 HB->GetXaxis()->SetBinLabel(i,
MAKE_CSTRING(geometry.at(i-1).first));
187 for (
const string& file_name : inputFile) {
197 else if (oid != evt->
getOID())
198 FATAL(
"Invalid detector identifier " << evt->
getOID() <<
" != " << oid << endl);
201 zmap[evt->begin()->getToE()] = file_name;
210 inputFile.push_back(i->second);
223 catch(
const exception&) {}
225 int counter[] = { 0, 0 };
227 typedef deque<JEvent> buffer_type;
229 for (buffer_type zbuf; inputFile.hasNext(); ) {
231 STATUS(inputFile.getFilename() <<
'\r');
DEBUG(endl);
235 for (
const string file_name = inputFile.getFilename(); inputFile.hasNext() && file_name == inputFile.getFilename(); ) {
237 const JEvent* evt = inputFile.next();
239 if (!evt->empty() && emitters.has(evt->
getID())) {
240 zbuf.push_back(*evt);
244 sort(zbuf.begin(), zbuf.end());
246 for (buffer_type::iterator p = zbuf.begin(), q; p != zbuf.end(); p = q) {
248 for (q = p; ++q != zbuf.end() && q->begin()->getToE() <= p->rbegin()->getToE() +
parameters.Tmax_s; ) {}
250 if (q == zbuf.end()) {
252 if (inputFile.hasNext()) {
254 zbuf.erase(zbuf.begin(), p);
262 for (buffer_type::iterator __q = p, __p = __q++; __p != q && __q != q; __p = __q++) {
264 if (__q->begin()->getToE() < __p->rbegin()->getToE() + Tmax_s) {
268 for (__p = __q++; __p != q && __q != q; __p = __q++) {
270 if (__q->begin()->getToE() < __p->rbegin()->getToE() + Tmax_s)
286 for (buffer_type::const_iterator i = p; i != q; ++i) {
287 numberOfPings[i->getID()] += 1;
291 DEBUG(
"Number of pings " << setw(2) << i->first <<
' ' << setw(3) << i->second << endl);
294 int minimum_number_of_pings = numeric_limits<int>::max();
297 minimum_number_of_pings = min(minimum_number_of_pings, i->second);
303 for (buffer_type::iterator evt = p; evt != q; ++evt) {
305 sort(evt->begin(), evt->end(),
compare);
310 const double signal = (unify ? (double) minimum_number_of_pings / (
double) numberOfPings[evt->getID()] : 1.0);
312 for (
JEvent::const_iterator i = evt->begin(); i != __end; ++i) {
317 if (receivers.has(i->getID()) && geometry.hasLocation(receivers[i->getID()]) && i->getQ() >=
parameters.Qmin) {
321 receivers[i->getID()],
324 buffer.insert(evt->
getID());
332 for (data_type::const_iterator hit = data.begin(); hit != data.end(); ++hit) {
333 HA[hit->getID()]->Fill(geometry.getIndex(hit->getString()), hit->getFloor(), 1.0);
338 const auto result = katoomba(data.begin(), data.end());
340 for (data_type::const_iterator hit =
result.begin; hit !=
result.end; ++hit) {
341 HB[hit->getID()]->Fill(geometry.getIndex(hit->getString()), hit->getFloor(), 1.0);
346 cout <<
"result:" <<
' '
350 for (data_type::const_iterator hit =
result.begin; hit !=
result.end; ++hit) {
351 cout <<
"hit: " << *hit <<
' ' <<
FIXED(9,3) << katoomba.evaluator(
result.value, *hit) << endl;
355 hn.Fill(
log10(katoomba.gandalf.numberOfIterations));
366 range.getLowerLimit(),
367 range.getUpperLimit(),
376 if (selection.is_valid<
JEvent>()) {
378 for (buffer_type::iterator i = p; i != q; ++i) {
384 for (JEvent::iterator hit = out.begin(); hit != out.end(); ++hit) {
407 STATUS(
"Number of events written / rejected: " << counter[0] <<
" / " << counter[1] << endl);
Worker class for fit function of acoustic model.
Utility class to parse command line options.
double getValue(const JScale_t scale)
Get numerical value corresponding to scale.
JComparator< JResult_t T::*, JComparison::lt > make_comparator(JResult_t T::*member)
Helper method to create comparator between values of data member.
static JDetectorMechanics getMechanics
Function object to get string mechanics.
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
Auxiliary class for ROOT class selection.
JEvt getEvt(const JHead &header, const JModel &model)
Get event.
*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.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Auxiliary data structure for floating point format specification.
V(JDAQEvent-JTriggerReprocessor)*1.0/(JDAQEvent+1.0e-10)
floor_range getRangeOfFloors(const JDetector &detector)
Get range of floors.
size_t getNumberOfEmitters(T __begin, T __end)
Get number of emitters.
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.
Auxiliary class to manage set of compatible ROOT objects (e.g. histograms) using unique keys...
Auxiliary wrapper for I/O of container with optional comment (see JComment).
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
set_variable E_E log10(E_{fit}/E_{#mu})"
const std::string & getOID() const
Get detector identifier.
const array_type< JValue_t > & make_array(const JValue_t(&array)[N])
Method to create array of values.
JPosition3D getPosition(const Vec &pos)
Get position.
static struct JACOUSTICS::@4 compare
Auxiliary data structure to sort transmissions.
JTreeWriter object output.
static const JStringCounter getNumberOfStrings
Function object to count unique strings.
Implementation for depth dependend velocity of sound.
z range($ZMAX-$ZMIN)< $MINIMAL_DZ." fi fi typeset -Z 4 STRING typeset -Z 2 FLOOR JPlot1D -f $
JTreeWriter< T > & getTreeWriter()
Get TreeWriter.
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.
Custom probability density function of time-of-arrival.
const JLimit & getLimit() const
Get limit.
do echo n Creating graphics for string $STRING for((FLOOR=$FIRST_FLOOR;$FLOOR<=$LAST_FLOOR;FLOOR+=1))
do set_variable DETECTOR_TXT $WORKDIR detector
int getID() const
Get identifier.
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Acoustic transmission identifier.
Template definition of fit function of acoustic model.
#define DEBUG(A)
Message macros.