72 int numberOfEntries = 21;
77 JParser<> zap(
"Example program to plot acoustic fit results.");
83 zap[
'f'] =
make_field(inputFile,
"input file (output of JKatoomba[.sh])");
84 zap[
'n'] =
make_field(numberOfEvents) = JLimit::max();
92 zap[
'E'] =
make_field(
id,
"emitter identifier (-1 = all)") = -1;
94 zap[
'O'] =
make_field(option,
"ROOT fit option, see TH1::Fit.") =
"LS";
100 catch(
const exception &error) {
101 FATAL(error.what() << endl);
120 receivers[
i->getID()] =
i->getLocation();
123 for (tripods_container::const_iterator
i =
tripods.begin();
i !=
tripods.end(); ++
i) {
125 i->getUTMPosition() -
detector.getUTMPosition());
135 for (JDetector::const_iterator module =
detector.begin(); module !=
detector.end(); ++module) {
136 for (tripods_container::const_iterator
i =
tripods.begin();
i !=
tripods.end(); ++
i) {
137 if (
id ==
i->getID() ||
id == -1) {
147 JTreeScanner_t::iterator p =
in.begin();
149 while (inputFile.hasNext()) {
151 STATUS(
"event: " << setw(10) << inputFile.getCounter() <<
'\r');
DEBUG(endl);
153 const JEvt* evt = inputFile.next();
156 DEBUG(
"model" << endl << model << endl);
158 for ( ; p !=
in.end() && p-> begin()->getToA() < evt->
UNIXTimeStart - 0.5; ++p) {}
160 JTreeScanner_t::iterator q = p;
162 for ( ; q !=
in.end() && q->rbegin()->getToA() <= evt->
UNIXTimeStop + 0.5; ++q) {}
166 for (JTreeScanner_t::iterator
i = p;
i != q; ++
i) {
168 if (
id ==
i->getID() ||
id == -1) {
170 if (emitters.has(
i->getID())) {
172 const JEmitter& emitter = emitters[
i->getID()];
174 for (JEvent::const_iterator hit =
i->begin(); hit !=
i->end(); ++hit) {
176 if (receivers.has(hit->getID())) {
181 const JLocation& location = receivers[hit->getID()];
183 if (geometry .has(location.
getString()) &&
191 const double Vi =
V.getInverseVelocity(D, emitter.
getZ(), position.
getZ());
192 const double toa = hit->getToE() + D * Vi;
212 range.getLength() + 1,
range.getLowerLimit() - 0.5,
range.getUpperLimit() + 0.5));
216 range.getLength() + 1,
range.getLowerLimit() - 0.5,
range.getUpperLimit() + 0.5));
218 for (Int_t
i = 1;
i <= HA->GetXaxis()->GetNbins(); ++
i) {
219 HA->GetXaxis()->SetBinLabel(
i,
MAKE_CSTRING(geometry.at(
i-1).first));
220 HB->GetXaxis()->SetBinLabel(
i,
MAKE_CSTRING(geometry.at(
i-1).first));
225 TF1
f1(
"f1",
"[0]*exp(-0.5*(x-[1])*(x-[1])/([2]*[2]))");
233 if (h1->GetEntries() >= numberOfEntries) {
237 h1->GetQuantiles(
Q.size(),
X.data(),
Q.data());
239 f1.SetParameter(0, h1->GetMaximum());
240 f1.SetParameter(1,
X[1]);
241 f1.SetParameter(2, 0.5*(
X[2] -
X[0]));
243 TFitResultPtr
result = h1->Fit(&
f1, option.c_str(),
"same",
X[1] - 5.0 * (
X[2] -
X[0]),
X[1] + 5.0 * (
X[2] -
X[0]));
245 if (result.Get() == NULL) {
247 ERROR(
"Invalid TFitResultPtr " << h1->GetName() << endl);
253 HA[
i->first.tx]->Fill(geometry.getIndex(location.
getString()), location.
getFloor(),
f1.GetParameter(1) * 1.0e3);
254 HB[
i->first.tx]->Fill(geometry.getIndex(location.
getString()), location.
getFloor(),
f1.GetParameter(2) * 1.0e3);
262 out << H2 << HA << HB;
JModel getModel(const JEvt &evt)
Get model.
Utility class to parse command line options.
Q(UTCMax_s-UTCMin_s)-livetime_s
int getFloor() const
Get floor number.
JContainer< std::vector< JTransmitter > > transmitters_container
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.
#define gmake_property(A)
macros to convert (template) parameter to JPropertiesElement object
Router for direct addressing of module data in detector data structure.
Utility class to parse parameter values.
*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)...
V(JDAQEvent-JTriggerReprocessor)*1.0/(JDAQEvent+1.0e-10)
double getDistance(const JVector3D &pos) const
Get distance to point.
floor_range getRangeOfFloors(const JDetector &detector)
Get range of floors.
Template definition for direct access of elements in ROOT TChain.
const JPolynome f1(1.0, 2.0, 3.0)
Function.
Model for fit to acoustics data.
double UNIXTimeStop
stop time
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...
JContainer< std::vector< JHydrophone > > hydrophones_container
Logical location of module.
const JLocation & getLocation() const
Get location.
Auxiliary wrapper for I/O of container with optional comment (see JComment).
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
JContainer< std::set< JTransmission_t > > disable_container
const JPosition3D & getPosition() const
Get position.
JContainer< std::vector< JTripod > > tripods_container
static const JStringCounter getNumberOfStrings
Function object to count unique strings.
Implementation for depth dependend velocity of sound.
Base class for JTreeScanner.
JACOUSTICS::JModel::string_type string
z range($ZMAX-$ZMIN)< $MINIMAL_DZ." fi fi typeset -Z 4 STRING typeset -Z 2 FLOOR JPlot1D -f $
int getString() const
Get string number.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
double UNIXTimeStart
start time
General purpose class for object reading from a list of file names.
no fit printf nominal n $STRING awk v X
Data structure for position in three dimensions.
const JLimit & getLimit() const
Get limit.
do set_variable DETECTOR_TXT $WORKDIR detector
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.
do echo Generating $dir eval D
double getZ() const
Get z position.
#define DEBUG(A)
Message macros.