53 int main(
int argc, 
char **argv)
 
   66   tripods_container       tripods;                              
 
   67   hydrophones_container   hydrophones;                          
 
   75     JParser<> zap(
"Application to fit position calibration model to acoustic data.");
 
   77     zap[
'f'] = 
make_field(inputFile,       
"output of JAcousticEventBuilder[.sh]");
 
   79     zap[
'n'] = 
make_field(numberOfEvents)                                    = JLimit::max();
 
   87     zap[
'u'] = 
make_field(unique,          
"one ping per cycle");
 
   92   catch(
const exception &error) {
 
   93     FATAL(error.what() << endl);
 
  112   for (JDetector::const_iterator i = 
detector.begin(); i != 
detector.end(); ++i) {
 
  113     receivers[i->getID()] = i->getLocation();
 
  116   for (tripods_container::const_iterator i = tripods.begin(); i != tripods.end(); ++i) {
 
  117     emitters[i->getID()]  = 
JEmitter(i->getID(),
 
  118                                      i->getUTMPosition() - 
detector.getUTMPosition());
 
  136   simplex.debug = 
debug;
 
  137   gandalf.debug = 
debug;
 
  140     JKatoomba_t::setOption(
false);
 
  147   TH1D h0(
"chi2/NDF", NULL, 5000,  0.0,  100.0);
 
  157   for (Int_t i = 1; i <= HA->GetXaxis()->GetNbins(); ++i) {
 
  158     HA->GetXaxis()->SetBinLabel(i, 
MAKE_CSTRING(geometry.at(i-1).first));
 
  159     HB->GetXaxis()->SetBinLabel(i, 
MAKE_CSTRING(geometry.at(i-1).first));
 
  168   while (inputFile.hasNext()) {
 
  170     STATUS(
"input  " << setw(6) << inputFile.getCounter() << 
'\r'); 
DEBUG(endl);
 
  172     const JEvent* evt = inputFile.next();
 
  178     if (oid != evt->
getOID()) {                  
 
  179       FATAL(
"Invalid detector identifier " << evt->
getOID() << 
" != " << oid << endl);
 
  182     zbuf.push_back(*evt);
 
  186   sort(zbuf.begin(), zbuf.end());
 
  198     for (q = p; ++q != zbuf.end() && q->begin()->getToE() <= p->rbegin()->getToE() + 
parameters.Tmax_s; ) {}
 
  205         numberOfPings[i->getID()] += 1;
 
  208       int weight = numeric_limits<int>::max();
 
  211         DEBUG(
"Number of pings " << setw(2) << i->first << 
' ' << setw(3) << i->second << endl);
 
  215         if (i->second < weight) {
 
  225           const JEmitter& emitter = emitters[i->getID()];
 
  227           const double signal = (unique ? (double) weight / (
double) numberOfPings[i->getID()] : 1.0);
 
  233           for (JEvent::const_iterator hit = i->begin(); hit != i->end(); ++hit) {
 
  234             buffer[hit->getID()].push_back(*hit);
 
  239             if (receivers.has(ps->first) && geometry.
hasLocation(receivers[ps->first])) {
 
  245                                       receivers[ps->first],
 
  253         DEBUG(
"hit: " << *hit << endl);
 
  260       DEBUG(
"prefit:"                           << endl
 
  265         HA[hit->getID()]->Fill(geometry.
getIndex(hit->getString()), hit->getFloor(), 1.0);
 
  273         double chi2_old =  evaluator(result, data.begin(), data.end());
 
  283             const double x = fabs(hit->getValue() - estimator.getToA(result, *hit)) / hit->sigma;
 
  295             iter_swap(out, --__end);
 
  297             result = estimator(data.begin(), __end);
 
  299             double chi2_new =  evaluator(result, data.begin(), __end);
 
  303               DEBUG(
"Remove outlier " << __end->getLocation() << 
' ' << xmax << endl);
 
  318         DEBUG(
"hit: " << *hit << endl);
 
  321       DEBUG(
"prefit:"                           << endl
 
  325         HB[hit->getID()]->Fill(geometry.
getIndex(hit->getString()), hit->getFloor(), 1.0);
 
  329       double chi2 = numeric_limits<double>::max();
 
  335         result = estimator(data.begin(), data.end());
 
  336         chi2   = evaluator(result, data.begin(), data.end());
 
  343         chi2   = simplex(data.begin(), data.end()) / simplex.estimator->getRho(1.0);
 
  344         result = simplex.value;
 
  351         chi2   = gandalf(data.begin(), data.end()) / gandalf.estimator->getRho(1.0);
 
  352         result = gandalf.value;
 
  362         W += hit->getWeight();
 
  365       const int ndf = data.size() - result.
getN();
 
  367       DEBUG(
"result:"                           << endl
 
  368             << 
FIXED(9,3) << chi2 << 
'/' << ndf << endl
 
  371       h0.Fill(chi2 / (W - result.
getN()));
 
  375       const JEvt evt = 
getEvt(
JHead(oid, data.begin()->getValue(), data.rbegin()->getValue(), ndf, (W - result.
getN()), chi2), 
result);
 
  383         const double toe = result.
emitter[
JEKey(i->getID(), i->getCounter())].t1;
 
  385         for (JEvent::iterator hit = out.begin(); hit != out.end(); ++hit) {
 
Utility class to parse command line options. 
 
size_t getN() const 
Get number of fit parameters. 
 
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. 
 
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. 
 
General purpose class for hash map of unique elements. 
 
ROOT TTree parameter settings. 
 
Recording of objects on file according a format that follows from the file name extension. 
 
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)...
 
Dynamic ROOT object management. 
 
Auxiliary data structure for floating point format specification. 
 
Data structure for detector geometry and calibration. 
 
Data structure for hydrophone. 
 
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...
 
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 
 
const std::string & getOID() const 
Get detector identifier. 
 
int getNumberOfFloors(const JDetector &detector)
Get number of floors. 
 
General purpose messaging. 
 
static const JStringCounter getNumberOfStrings
Function object to count unique strings. 
 
Implementation for velocity of sound. 
 
Scanning of objects from multiple files according a format that follows from the extension of each fi...
 
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. 
 
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...
 
bool hasLocation(const JLocation &location) const 
Check if this detector has given location. 
 
Custom probability density function of time-of-arrival. 
 
const JLimit & getLimit() const 
Get limit. 
 
Fit functions of acoustic model. 
 
JMEstimator * getMEstimator(const int type)
Get M-Estimator. 
 
do set_variable DETECTOR_TXT $WORKDIR detector
 
Data structure for tripod. 
 
std::vector< double > weight
 
do if[[!-f $ACOUSTICS_WORKDIR/${KEY}.txt]]
 
#define DEBUG(A)
Message macros. 
 
Data structure for a composite optical module.