64 hydrophones_container hydrophones;
66 disable_container disable;
72 JParser<> zap(
"Example program to plot acoustic fit results.");
74 zap[
'f'] =
make_field(inputFile,
"input file (output of JKatoomba)");
75 zap[
'n'] =
make_field(numberOfEvents) = JLimit::max();
82 zap[
'E'] =
make_field(
id,
"emitter identifier (-1 = all)") = -1;
84 zap[
'O'] =
make_field(option,
"ROOT fit option, see TH1::Fit.") =
"LS";
89 catch(
const exception &error) {
90 FATAL(error.what() << endl);
108 for (JDetector::const_iterator i =
detector.begin(); i !=
detector.end(); ++i) {
109 receivers[i->getID()] = i->getLocation();
112 for (tripods_container::const_iterator i =
tripods.begin(); i !=
tripods.end(); ++i) {
113 emitters[i->getID()] =
JEmitter(i->getID(),
114 i->getUTMPosition() -
detector.getUTMPosition());
129 JTreeScanner_t::iterator p =
in.begin();
131 while (inputFile.hasNext()) {
133 STATUS(
"event: " << setw(10) << inputFile.getCounter() <<
'\r');
DEBUG(endl);
135 const JEvt* evt = inputFile.next();
138 DEBUG(
"model" << endl << model << endl);
140 for ( ; p !=
in.end() && p-> begin()->getToA() < evt->
UNIXTimeStart - 0.5; ++p) {}
142 JTreeScanner_t::iterator q = p;
144 for ( ; q !=
in.end() && q->rbegin()->getToA() <= evt->
UNIXTimeStop + 0.5; ++q) {}
148 for (JTreeScanner_t::iterator i = p; i != q; ++i) {
150 if (
id == i->getID() ||
id == -1) {
152 if (emitters.has(i->getID())) {
154 const JEmitter& emitter = emitters[i->getID()];
156 for (JEvent::const_iterator hit = i->begin(); hit != i->end(); ++hit) {
158 if (receivers.has(hit->getID())) {
163 const JLocation& location = receivers[hit->getID()];
165 if (geometry .has(location.
getString()) &&
173 const double Vi =
V.getInverseVelocity(D, emitter.
getZ(), position.
getZ());
174 const double toa = hit->getToE() + D * Vi;
176 H2[
JTransmission_t(i->getID(), hit->getID())]->Fill(hit->getToA() - toa);
194 range.getLength() + 1,
range.getLowerLimit() - 0.5,
range.getUpperLimit() + 0.5));
198 range.getLength() + 1,
range.getLowerLimit() - 0.5,
range.getUpperLimit() + 0.5));
200 for (Int_t i = 1; i <= HA->GetXaxis()->GetNbins(); ++i) {
201 HA->GetXaxis()->SetBinLabel(i,
MAKE_CSTRING(geometry.at(i-1).first));
202 HB->GetXaxis()->SetBinLabel(i,
MAKE_CSTRING(geometry.at(i-1).first));
207 TF1 f1(
"f1",
"[0]*exp(-0.5*(x-[1])*(x-[1])/([2]*[2]))");
217 h1->GetQuantiles(
Q.size(),
X.data(),
Q.data());
219 f1.SetParameter(0, h1->GetMaximum());
220 f1.SetParameter(1,
X[1]);
221 f1.SetParameter(2, 0.5*(
X[2] -
X[0]));
223 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]));
225 if (result.Get() == NULL) {
227 ERROR(
"Invalid TFitResultPtr " << h1->GetName() << endl);
233 HA[i->first.tx]->Fill(geometry.getIndex(location.
getString()), location.
getFloor(), f1.GetParameter(1) * 1.0e3);
234 HB[i->first.tx]->Fill(geometry.getIndex(location.
getString()), location.
getFloor(), f1.GetParameter(2) * 1.0e3);
241 out << H2 << HA << HB;
Utility class to parse command line options.
Q(UTCMax_s-UTCMin_s)-livetime_s
JModel getModel(const JEvt &evt)
Get model.
int getFloor() const
Get floor number.
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.
Router for direct addressing of module data in detector data structure.
*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.
then for HISTOGRAM in h0 h1
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.
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...
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
then break fi done getCenter read X Y Z let X
const JPosition3D & getPosition() const
Get position.
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.
then usage $script< input_file >< detector_file > fi set_variable OUTPUT_DIR set_variable SELECTOR JDAQTimesliceL1 set_variable DEBUG case set_variable DEBUG
Data structure for position in three dimensions.
const JLimit & getLimit() const
Get limit.
then fatal Not enough tripods
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 source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
Acoustic transmission identifier.
do echo Generating $dir eval D
double getZ() const
Get z position.