95 transmitters_container transmitters;
96 hydrophones_container hydrophones;
100 disable_container disable;
105 JParser<> zap(
"Application to fit position calibration model to acoustic data.");
107 zap[
'f'] =
make_field(inputFile,
"output of JAcousticEventBuilder[.sh]");
109 zap[
'n'] =
make_field(numberOfEvents) = JLimit::max();
118 zap[
'u'] =
make_field(unify,
"unify weighing of pings");
124 catch(
const exception &error) {
125 FATAL(error.what() << endl);
145 for (JDetector::const_iterator i =
detector.begin(); i !=
detector.end(); ++i) {
146 receivers[i->getID()] = i->getLocation();
149 for (tripods_container::const_iterator i =
tripods.begin(); i !=
tripods.end(); ++i) {
150 emitters[i->getID()] =
JEmitter(i->getID(),
151 i->getUTMPosition() -
detector.getUTMPosition());
154 for (transmitters_container::const_iterator i = transmitters.begin(); i != transmitters.end(); ++i) {
156 emitters[i->getID()] =
JEmitter(i->getID(),
159 catch(
const exception&) {
179 simplex.debug =
debug;
180 gandalf.debug =
debug;
187 TH1D h0(
"chi2/NDF", NULL, 50000, 0.0, 1000.0);
188 TH1D h1(
"h1", NULL, 51, -0.5, 50.5);
189 TH1D hn(
"hn", NULL, 100, 0.0, 6.0);
193 range.getLength() + 1,
range.getLowerLimit() - 0.5,
range.getUpperLimit() + 0.5));
197 range.getLength() + 1,
range.getLowerLimit() - 0.5,
range.getUpperLimit() + 0.5));
199 for (Int_t i = 1; i <= HA->GetXaxis()->GetNbins(); ++i) {
200 HA->GetXaxis()->SetBinLabel(i,
MAKE_CSTRING(geometry.at(i-1).first));
201 HB->GetXaxis()->SetBinLabel(i,
MAKE_CSTRING(geometry.at(i-1).first));
209 for (
const string& file_name : inputFile) {
219 else if (oid != evt->
getOID())
220 FATAL(
"Invalid detector identifier " << evt->
getOID() <<
" != " << oid << endl);
223 zmap[evt->begin()->getToE()] = file_name;
232 inputFile.push_back(i->second);
242 int counter[] = { 0, 0 };
244 typedef deque<JEvent> buffer_type;
246 for (buffer_type zbuf; inputFile.hasNext(); ) {
248 STATUS(inputFile.getFilename() <<
'\r');
DEBUG(endl);
252 for (
const string file_name = inputFile.getFilename(); inputFile.hasNext() && file_name == inputFile.getFilename(); ) {
254 const JEvent* evt = inputFile.next();
256 if (emitters.has(evt->
getID())) {
257 zbuf.push_back(*evt);
261 sort(zbuf.begin(), zbuf.end());
263 for (buffer_type::iterator p = zbuf.begin(), q; p != zbuf.end(); p = q) {
265 for (q = p; ++q != zbuf.end() && q->begin()->getToE() <= p->rbegin()->getToE() +
parameters.Tmax_s; ) {}
267 if (q == zbuf.end()) {
269 if (inputFile.hasNext()) {
271 zbuf.erase(zbuf.begin(), p);
283 for (buffer_type::const_iterator i = p; i != q; ++i) {
284 numberOfPings[i->getID()] += 1;
288 DEBUG(
"Number of pings " << setw(2) << i->first <<
' ' << setw(3) << i->second << endl);
291 int minimum_number_of_pings = numeric_limits<int>::max();
294 minimum_number_of_pings = min(minimum_number_of_pings, i->second);
299 for (buffer_type::iterator i = p; i != q; ++i) {
302 const JEmitter& emitter = emitters[i->getID()];
304 const double signal = (unify ? (double) minimum_number_of_pings / (
double) numberOfPings[i->getID()] : 1.0);
310 for (
JEvent::const_iterator hit = i->begin(); hit != i->end(); ++hit) {
313 buffer[hit->getID()].push_back(*hit);
319 if (receivers.has(ps->first) && geometry.hasLocation(receivers[ps->first])) {
323 if (ps->second.begin()->getQ() >=
parameters.Qmin) {
327 receivers[ps->first],
338 double chi2 = evaluator(result, data.begin(), data.end());
339 double ndf = getWeight(data.begin(), data.end()) - result.
getN();
341 DEBUG(
"prefit:" <<
' '
342 <<
FIXED(12,3) << chi2 <<
'/' <<
FIXED(6,1) << ndf << endl
346 DEBUG(
"hit: " << *hit <<
' ' <<
FIXED(9,3) << evaluator(result, *hit) << endl);
350 HA[hit->getID()]->Fill(geometry.getIndex(hit->getString()), hit->getFloor(), 1.0);
358 double chi2_old = evaluator(result, data.begin(), data.end());
368 const double x = fabs(hit->getValue() - estimator.getToA(result, *hit)) / hit->sigma;
378 DEBUG(
"Remove outlier " << out->getEKey() <<
' ' << out->getLocation() <<
' ' <<
FIXED(12,3) << xmax <<
"?" << flush);
382 iter_swap(out, --__end);
384 result = estimator(data.begin(), __end);
386 double chi2_new = evaluator(result, data.begin(), __end);
390 DEBUG(
" yes " <<
FIXED(12,3) << (chi2_old - chi2_new) << endl);
400 DEBUG(
" no " << endl);
402 result = estimator(data.begin(), ++__end);
409 chi2 = evaluator(result, data.begin(), data.end());
410 ndf = getWeight(data.begin(), data.end()) - result.
getN();
412 DEBUG(
"prefit:" <<
' '
413 <<
FIXED(12,3) << chi2 <<
'/' <<
FIXED(6,1) << ndf << endl
417 DEBUG(
"hit: " << *hit <<
' ' <<
FIXED(9,3) << evaluator(result, *hit) << endl);
422 HB[hit->getID()]->Fill(geometry.getIndex(hit->getString()), hit->getFloor(), 1.0);
426 chi2 = numeric_limits<double>::max();
432 result = estimator(data.begin(), data.end());
433 chi2 = evaluator(result, data.begin(), data.end());
442 chi2 = simplex(data.begin(), data.end()) / simplex.estimator->getRho(1.0);
443 result = simplex.value;
445 hn.Fill(
log10(simplex.numberOfIterations));
452 chi2 = gandalf(data.begin(), data.end()) / gandalf.estimator->getRho(1.0);
453 result = gandalf.value;
455 hn.Fill(
log10(gandalf.numberOfIterations));
462 ndf = getWeight(data.begin(), data.end()) - result.
getN();
464 DEBUG(
"result:" <<
' '
465 <<
FIXED(12,3) << chi2 <<
'/' <<
FIXED(6,1) << ndf << endl
469 DEBUG(
"hit: " << *hit <<
' ' <<
FIXED(9,3) << evaluator(result, *hit) << endl);
480 data.rbegin()->getValue(),
489 for (buffer_type::iterator i = p; i != q; ++i) {
495 for (JEvent::iterator hit = out.begin(); hit != out.end(); ++hit) {
506 WARNING(endl <<
"Event not written: " <<
FIXED(12,3) << chi2 <<
'/' <<
FIXED(6,1) << ndf << endl);
515 STATUS(
"Number of events written / rejected: " << counter[0] <<
" / " << counter[1] << endl);
Utility class to parse command line options.
size_t getN() const
Get number of fit parameters.
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.
Template specialisation of fit function of acoustic model based on linear approximation.
Template specialisation of fit function of acoustic model based on JSimplex minimiser.
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.
Model for fit to acoustics data.
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.
Template specialisation of fit function of acoustic model based on JGandalf minimiser.
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.
JPosition3D getPosition(const Vec &pos)
Get position.
double getQ(const double D_m, const double f_kHz, const double d_m)
Get relative quality for given frequency at given distance.
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 $
JACOUSTICS::JModel::emitter_type emitter
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.
Template specialisation of fit function of acoustic model based on JAbstractMinimiser minimiser...
then if[[!-f $DETECTOR]] then JDetector sh $DETECTOR fi cat $WORKDIR trigger_parameters txt<< EOFtrigger3DMuon.enabled=1;trigger3DMuon.numberOfHits=5;trigger3DMuon.gridAngle_deg=1;ctMin=0.0;TMaxLocal_ns=15.0;EOF set_variable TRIGGEREFFICIENCY_TRIGGERED_EVENTS_ONLY INPUT_FILES=() for((i=1;$i<=$NUMBER_OF_RUNS;++i));do JSirene.sh $DETECTOR $JPP_DATA/genhen.km3net_wpd_V2_0.evt.gz $WORKDIR/sirene_ ${i}.root JTriggerEfficiency.sh $DETECTOR $DETECTOR $WORKDIR/sirene_ ${i}.root $WORKDIR/trigger_efficiency_ ${i}.root $WORKDIR/trigger_parameters.txt $JPP_DATA/PMT_parameters.txt INPUT_FILES+=($WORKDIR/trigger_efficiency_ ${i}.root) done for ANGLE_DEG in $ANGLES_DEG[*];do set_variable SIGMA_NS 3.0 set_variable OUTLIERS 3 set_variable OUTPUT_FILE $WORKDIR/matrix\[${ANGLE_DEG}\deg\].root $JPP_DIR/examples/JReconstruction-f"$INPUT_FILES[*]"-o $OUTPUT_FILE-S ${SIGMA_NS}-A ${ANGLE_DEG}-O ${OUTLIERS}-d ${DEBUG}--!fiif[[$OPTION=="plot"]];then if((0));then for H1 in h0 h1;do JPlot1D-f"$WORKDIR/matrix["${^ANGLES_DEG}" deg].root:${H1}"-y"1 2e3"-Y-L TR-T""-\^"number of events [a.u.]"-> o chi2
Custom probability density function of time-of-arrival.
const JLimit & getLimit() const
Get limit.
JMEstimator * getMEstimator(const int type)
Get M-Estimator.
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.