46   static const int       WILDCARD         =  -1;          
 
   48   static const int       NUMBER_OF_PINGS  =  11;          
 
   49   static const JWaveform EMITTER_WAVEFORM(2.5e6,          
 
   60 int main(
int argc, 
char **argv)
 
   77   transmitters_container  transmitters;                         
 
   78   hydrophones_container   hydrophones;                          
 
   83   disable_container       disable;                              
 
   84   waveform_container      waveforms;                            
 
   88   numberOfPings[WILDCARD] = NUMBER_OF_PINGS;
 
   89   waveforms    [WILDCARD] = EMITTER_WAVEFORM;
 
   93     JParser<> zap(
"Example application to test fit of model to simulated acoustic data.");
 
  105     zap[
'u'] = 
make_field(unify,           
"unify weighing of pings");
 
  113   catch(
const exception &error) {
 
  114     FATAL(error.what() << endl);
 
  120   gRandom->SetSeed(seed);
 
  122   if (numberOfEvents <= 0) { 
FATAL(
"Invalid number of events " << numberOfEvents << endl); }
 
  135   for (tripods_container::const_iterator i = 
tripods.begin(); i != 
tripods.end(); ++i) {
 
  136     emitters.push_back(
JEmitter(i->getID(),
 
  137                                 i->getUTMPosition() - 
detector.getUTMPosition()));
 
  140   for (transmitters_container::const_iterator i = transmitters.begin(); i != transmitters.end(); ++i) {
 
  142       emitters.push_back(
JEmitter(i->getID(),
 
  145     catch(
const exception&) {
 
  150   if (
detector.empty()) { 
FATAL(
"No modules in detector." << endl); }
 
  151   if (emitters.empty()) { 
FATAL(
"No emitters in system." << endl); }
 
  156   const double D_m = -
detector.getUTMZ();                             
 
  180   TH1D h0(
"cpu",      NULL, 100, 1.0, 7.0);
 
  181   TH1D 
h1(
"chi2/NDF", NULL, 100, 0.0, 5.0);
 
  189   for (
int number_of_events = 0, 
count = 0; number_of_events != numberOfEvents; ++number_of_events) {
 
  191     STATUS(
"event: " << setw(10) << number_of_events << 
'\r'); 
DEBUG(endl);
 
  195     for (JDetector::const_iterator module = 
detector.begin(); module != 
detector.end(); ++module) {
 
  200                                                             gRandom->Uniform(-2.0e-2, +2.0e-2));
 
  204     DEBUG(
"Model" << endl << model << endl);
 
  208     for (JDetector::iterator module = 
detector.begin(); module != 
detector.end(); ++module) {
 
  217     int minimum_number_of_pings = numeric_limits<int>::max();
 
  220       minimum_number_of_pings = min(minimum_number_of_pings, 
getValue(numberOfPings, emitter->getID(), numberOfPings[WILDCARD]));
 
  227       const int number_of_pings = 
getValue(numberOfPings, emitter->getID(), numberOfPings[WILDCARD]);
 
  229       const double signal = (unify ? (double) minimum_number_of_pings / (
double) number_of_pings : 1.0);
 
  231       for (
int ping_counter = 0; ping_counter != number_of_pings; ++ping_counter) {
 
  235         const double toe_s = ping_counter * 10.0  +  gRandom->Uniform(-1.0, +1.0);
 
  239         for (JDetector::const_iterator module = 
detector.begin(); module != 
detector.end(); ++module) {
 
  241           if (disable.count(
JTransmission_t(emitter->getID(), module->getID())) == 0) {
 
  245               const JWaveform& waveform = 
getValue(waveforms, emitter->getID(), waveforms[WILDCARD]);
 
  247               const double d_m   = 
getDistance(module->getPosition(), emitter->getPosition());
 
  248               const double toa_s = toe_s + 
V.getTime(d_m, emitter->getZ(), module->getZ());
 
  249               const double Q     = waveform.
getQ(D_m, d_m);
 
  256                   t1_s = gRandom->Gaus(toa_s, 
parameters.sigma_s);
 
  263                                    module->getLocation(),
 
  266                 DEBUG(
"hit: " << hit << 
' ' << 
FIXED(7,1) << Q << endl);
 
  281     double chi2   = numeric_limits<double>::max();
 
  287       chi2   = evaluator(result, data.begin(), data.end());
 
  294       chi2   = simplex(data.begin(), data.end()) / simplex.
estimator->getRho(1.0);
 
  295       result = simplex.
value;
 
  302       chi2   = gandalf(data.begin(), data.end()) / gandalf.
estimator->getRho(1.0);
 
  303       result = gandalf.
value;
 
  315       W += hit->getWeight();
 
  318     const int ndf = data.size() - result.
getN();
 
  320     DEBUG(
"Final values"                      << endl
 
  321           << 
FIXED(9,3) << chi2 << 
'/' << ndf << endl
 
  325     h0.Fill(
log10((
double) timer.usec_wall));
 
  326     h1.Fill(chi2 / (
double) (W - result.
getN()));
 
  329       H2[i->first]->Fill((i->second.tx - result.
string [i->first].tx) * 1.0e3,   
 
  330                          (i->second.ty - result.
string [i->first].ty) * 1.0e3);  
 
  334       H1[i->first.getID()]->Fill(i->second.t1 - result.
emitter[i->first].t1);
 
static int debug
debug level (default is off). 
 
Utility class to parse command line options. 
 
size_t getN() const 
Get number of fit parameters. 
 
Q(UTCMax_s-UTCMin_s)-livetime_s
 
double getValue(const JScale_t scale)
Get numerical value corresponding to scale. 
 
int main(int argc, char *argv[])
 
Template specialisation of fit function of acoustic model based on linear approximation. 
 
Template specialisation of fit function of acoustic model based on JSimplex minimiser. 
 
*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
 
then for HISTOGRAM in h0 h1
 
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
 
Dynamic ROOT object management. 
 
Auxiliary data structure for floating point format specification. 
 
V(JDAQEvent-JTriggerReprocessor)*1.0/(JDAQEvent+1.0e-10)
 
Data structure for detector geometry and calibration. 
 
double getDistance(const JFirst_t &first, const JSecond_t &second)
Get distance between objects. 
 
Data structure for hydrophone. 
 
Model for fit to acoustics data. 
 
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...
 
Data structure for transmitter. 
 
JLANG::JSharedPointer< JMEstimator > estimator
M-Estimator function. 
 
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})"
 
static int debug
debug level 
 
Auxiliary class for CPU timing and usage. 
 
JPosition3D getPosition(const Vec &pos)
Get position. 
 
void Write(TDirectory &out, const bool wm=false)
Write objects to file. 
 
General purpose messaging. 
 
Implementation for depth dependend velocity of sound. 
 
JACOUSTICS::JModel::string_type string
 
JACOUSTICS::JModel::emitter_type emitter
 
void load(const std::string &file_name, JDetector &detector)
Load detector from input file. 
 
Simple fit method based on Powell's algorithm, see reference: Numerical Recipes in C++...
 
Utility class to parse command line options. 
 
Template specialisation of fit function of acoustic model based on JAbstractMinimiser minimiser...
 
Acoustic transmission identifier. 
 
JPosition3D getPosition() const 
Get position. 
 
bool hasLocation(const JLocation &location) const 
Check if this detector has given location. 
 
Custom probability density function of time-of-arrival. 
 
const JDetector & detector
detector 
 
Fit functions of acoustic model. 
 
JMEstimator * getMEstimator(const int type)
Get M-Estimator. 
 
do set_variable DETECTOR_TXT $WORKDIR detector
 
Data structure for tripod. 
 
Acoustic transmission identifier. 
 
#define DEBUG(A)
Message macros. 
 
Data structure for optical module.