54{
57
62
64 JLimit_t& numberOfEvents = inputFile.getLimit();
71 int id;
74 string option;
77
78 try {
79
80 JParser<> zap(
"Example program to plot acoustic fit results.");
81
83
85
86 zap[
'f'] =
make_field(inputFile,
"input file (output of JKatoomba[.sh])");
95 zap[
'E'] =
make_field(
id,
"emitter identifier (-1 = all)") = -1;
98 zap[
'O'] =
make_field(option,
"ROOT fit option, see TH1::Fit.") =
"LS";
101
103 }
104 catch(const exception &error) {
106 }
107
108
110
112
113 try {
115 }
118 }
119
122
123 for (JDetector::const_iterator i =
detector.begin(); i !=
detector.end(); ++i) {
124 receivers[i->getID()] = i->getLocation();
125 }
126
127 for (tripods_container::const_iterator i = tripods.begin(); i != tripods.end(); ++i) {
129 i->getUTMPosition() -
detector.getUTMPosition());
130 }
131
132 for (transmitters_container::const_iterator i = transmitters.begin(); i != transmitters.end(); ++i) {
133 try {
135 }
136 catch(const exception&) {}
137 }
138
140
142
143
145
148 if (id == i->first || id == -1) {
150 }
151 }
152 }
153
155
157
158 JTreeScanner_t::iterator p = in.begin();
159
160 while (inputFile.hasNext()) {
161
163
164 const JEvt* evt = inputFile.next();
166
168
169 for ( ; p != in.end() && p-> begin()->getToA() < evt->
UNIXTimeStart - 0.5; ++p) {}
170
171 JTreeScanner_t::iterator q = p;
172
173 for ( ; q != in.end() && q->rbegin()->getToA() <= evt->
UNIXTimeStop + 0.5; ++q) {}
174
176
177 for (JTreeScanner_t::iterator i = p; i != q; ++i) {
178
179 if (id == i->getID() || id == -1) {
180
182
184
185 for (JEvent::const_iterator
hit = i->begin();
hit != i->end(); ++
hit) {
186
187 if (receivers.has(
hit->getID()) && geometry.hasLocation(receivers[
hit->getID()])) {
188
191
193
194 if (geometry .has(location.
getString()) &&
196
198 const JMODEL ::JString& parameters =
model.string[location.
getString()];
200
203 const double toa =
hit->getToE() + D *
Vi;
204
206 }
207 }
208 }
209 }
210 }
211 }
212 }
213
214 p = q;
215 }
217
218
220
224
228
230 HA->GetXaxis()->SetBinLabel(i,
MAKE_CSTRING(geometry.at(i-1).first));
231 HB->GetXaxis()->SetBinLabel(i,
MAKE_CSTRING(geometry.at(i-1).first));
232 }
233
235
236 TF1 f1("f1", "[0]*exp(-0.5*(x-[1])*(x-[1])/([2]*[2]))");
237
239
241
243
245
247
249
250 h1->GetQuantiles(Q.size(), X.data(), Q.data());
251
252 f1.SetParameter(0, h1->GetMaximum());
253 f1.SetParameter(1, X[1]);
254 f1.SetParameter(2, 0.5*(X[2] - X[0]));
255
256 f1.SetParError(0, 0.1);
257 f1.SetParError(1, 1.0e-6);
258 f1.SetParError(2, 1.0e-6);
259
260 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]));
261
263
264 ERROR(
"Invalid TFitResultPtr " << h1->GetName() <<
endl);
265
266 } else {
267
268 HA[i->first.tx]->Fill(geometry.getIndex(location.
getString()), location.
getFloor(), f1.GetParameter(1) * 1.0e3);
269 HB[i->first.tx]->Fill(geometry.getIndex(location.
getString()), location.
getFloor(), f1.GetParameter(2) * 1.0e3);
270 }
271
272 } else {
273
275 }
276 }
277
278
280
281 out <<
H2 <<
HA << HB;
282
283 out.Write();
284 out.Close();
285}
#define DEBUG(A)
Message macros.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
#define MAKE_CSTRING(A)
Make C-string.
#define gmake_property(A)
macros to convert (template) parameter to JPropertiesElement object
Logical location of module.
const JLocation & getLocation() const
Get location.
int getFloor() const
Get floor number.
int getString() const
Get string number.
Router for direct addressing of module data in detector data structure.
Utility class to parse parameter values.
Data structure for position in three dimensions.
const JPosition3D & getPosition() const
Get position.
double getDistance(const JVector3D &pos) const
Get distance to point.
double getZ() const
Get z position.
Template definition of a multi-dimensional oscillation probability interpolation table.
Auxiliary class to manage set of compatible ROOT objects (e.g. histograms) using unique keys.
Base class for JTreeScanner.
JContainer< std::vector< JTripod > > tripods_container
JContainer< std::vector< JTransmitter > > transmitters_container
JContainer< std::vector< JHydrophone > > hydrophones_container
static const JSoundVelocity getSoundVelocity(1541.0, -17.0e-3, -2000.0)
Function object for velocity of sound.
static JDetectorMechanics getMechanics
Function object to get string mechanics.
JModel getModel(const JEvt &evt)
Get model.
floor_range getRangeOfFloors(const JDetector &detector)
Get range of floors.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
static const JStringCounter getNumberOfStrings
Function object to count unique strings.
void model(JModel_t &value)
Auxiliary function to constrain model during fit.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
double UNIXTimeStop
stop time
double UNIXTimeStart
start time
Model for fit to acoustics data.
Implementation for depth dependend velocity of sound.
JSoundVelocity & set(const double z0)
Set depth.
virtual double getInverseVelocity(const double D_m, const double z1, const double z2) const override
Get inverse velocity of sound.
Acoustic transmission identifier.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Auxiliary class for defining the range of iterations of objects.
static counter_type max()
Get maximum counter value.