61{
64
69
72 string detectorFile;
73 JLimit_t& numberOfEvents = inputFile.getLimit();
80 disable_container disable;
83 bool squash;
84 Long64_t autoflush;
86
87 try {
88
89 JParser<> zap(
"Application to fit position calibration model to acoustic data.");
90
91 zap[
'f'] =
make_field(inputFile,
"output of JAcousticEventBuilder[.sh]");
103 "Precede name of data structure by a '+' or '-' "
104 "to add or remove data types in the output, respectively."
107 zap[
'q'] =
make_field(squash,
"squash meta data");
110
111 zap(argc, argv);
112 }
113 catch(const exception &error) {
114 FATAL(error.what() << endl);
115 }
116
117
119
120 try {
122 }
125 }
126
128
131
132 for (JDetector::const_iterator i =
detector.begin(); i !=
detector.end(); ++i) {
133 receivers[i->getID()] = i->getLocation();
134 }
135
136 for (tripods_container::const_iterator i = tripods.begin(); i != tripods.end(); ++i) {
137 emitters[i->getID()] =
JEmitter(i->getID(), i->getUTMPosition() -
detector.getUTMPosition());
138 }
139
140 for (transmitters_container::const_iterator i = transmitters.begin(); i != transmitters.end(); ++i) {
141 try {
142 emitters[i->getID()] =
JEmitter(i->getID(), i->getPosition() +
detector.getModule(i->getLocation()).getPosition());
143 }
144 catch(const exception&) {}
145 }
146
148
151
154
156
158
159 TH1D h0("chi2/NDF", NULL, 50000, 0.0, 1000.0);
160 TH1D h1("h1", NULL, 51, -0.5, 50.5);
161 TH1D hn("hn", NULL, 100, 0.0, 6.0);
162
166
170
171 for (Int_t i = 1; i <= HA->GetXaxis()->GetNbins(); ++i) {
172 HA->GetXaxis()->SetBinLabel(i,
MAKE_CSTRING(geometry.at(i-1).first));
173 HB->GetXaxis()->SetBinLabel(i,
MAKE_CSTRING(geometry.at(i-1).first));
174 }
175
176 if (inputFile.size() > 1u) {
177
179
180 for (const string& file_name : inputFile) {
181
183
185
186 const JEvent* evt = in.next();
187
190 }
191
192 if (!evt->empty()) {
193 zmap[evt->begin()->getToE()] = file_name;
194 }
195 }
196 }
198
199 inputFile.clear();
200
202 inputFile.push_back(i->second);
203 }
204 }
205
207
211
212 try {
215 }
216 catch(const exception&) {}
217
218 int counter[] = { 0, 0 };
219
221
223
224 STATUS(inputFile.getFilename() <<
'\r');
DEBUG(endl);
225
226
227
228 for (const string file_name = inputFile.getFilename(); inputFile.hasNext() && file_name == inputFile.getFilename(); ) {
229
230 const JEvent* evt = inputFile.next();
231
232 if (!evt->empty() && emitters.
has(evt->
getID())) {
233 if (utc(evt->begin()->getToA()) && utc(evt->rbegin()->getToA())) {
234 zbuf.push_back(*evt);
235 }
236 }
237 }
238
239 sort(zbuf.begin(), zbuf.end());
240
241 for (buffer_type::iterator p = zbuf.begin(), q; p != zbuf.end(); p = q) {
242
243 for (q = p; ++q != zbuf.end() && q->begin()->getToE() <= p->rbegin()->getToE() + parameters.
Tmax_s; ) {}
244
245 if (q == zbuf.end()) {
246
247 if (inputFile.hasNext()) {
248
249 zbuf.erase(zbuf.begin(), p);
250
251 break;
252 }
253 }
254
256
258
260
262
264
265 for (buffer_type::iterator evt = p; evt != q; ++evt) {
266
268
270
273
274 for (JEvent::const_iterator i = evt->begin(); i != __end; ++i) {
275
278
279 if (receivers.
has(i->getID()) && geometry.hasLocation(receivers[i->getID()]) && i->getQ() >= parameters.
Qmin * (parameters.
Qmin <= 1.0 ? i->getW() : 1.0)) {
280
283 receivers[i->getID()],
284 i->getToA(),
286 weight));
287 }
288 }
289 }
290 }
291
293
294 for (data_type::const_iterator hit =
data.begin(); hit !=
data.end(); ++hit) {
295 HA[hit->getID()]->Fill(geometry.getIndex(hit->getString()), hit->getFloor(), 1.0);
296 }
297
298
299
301
302 for (data_type::const_iterator hit =
result.begin; hit !=
result.end; ++hit) {
303 HB[hit->getID()]->Fill(geometry.getIndex(hit->getString()), hit->getFloor(), 1.0);
304 }
305
307
308 cout << "result:" << ' '
311
312 for (data_type::const_iterator hit =
result.begin; hit !=
result.end; ++hit) {
313 cout <<
"hit: " << *hit <<
' ' <<
FIXED(9,3) << katoomba.evaluator(
result.value, *hit) << endl;
314 }
315 }
316
317 hn.Fill(log10(katoomba.gandalf.numberOfIterations));
319
320
321
324
332 katoomba.gandalf.numberOfIterations),
334
336
338
339 for (buffer_type::iterator i = p; i != q; ++i) {
340
342
344
345 for (JEvent::iterator hit = out.begin(); hit != out.end(); ++hit) {
346 hit->setToE(toe);
347 }
348
349 if (!out.empty()) {
351 }
352 }
353 }
354
355 counter[0] += 1;
356
357 } else {
358
360
361 counter[1] += 1;
362 }
363
364 } else {
365
367
368 counter[1] += 1;
369 }
370 }
371 }
372 }
374
375 STATUS(
"Number of events written / rejected: " << counter[0] <<
" / " << counter[1] << endl);
376
377 if (!squash) {
378
380
382 }
383
387
390
392}
#define DEBUG(A)
Message macros.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
#define MAKE_CSTRING(A)
Make C-string.
Utility class to parse command line options.
Auxiliary class to manage set of compatible ROOT objects (e.g. histograms) using unique keys.
JTreeWriter object output.
JTreeWriter< T > & getTreeWriter()
Get TreeWriter.
General purpose class for object reading from a list of file names.
Object reading from a list of files.
virtual bool hasNext() override
Check availability of next element.
size_t getMinimumNumberOfEmitters(T __begin, T __end)
Get minimum number of emitters for any string in data.
JContainer< std::vector< JTripod > > tripods_container
JContainer< std::vector< JTransmitter > > transmitters_container
JContainer< std::vector< JHydrophone > > hydrophones_container
size_t getNumberOfEmitters(T __begin, T __end)
Get number of emitters.
static const JSoundVelocity getSoundVelocity(1541.0, -17.0e-3, -2000.0)
Function object for velocity of sound.
JEvt getEvt(const JHead &header, const JModel &model)
Get event.
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.
JComparator< JResult_t T::*, JComparison::lt > make_comparator(JResult_t T::*member)
Helper method to create comparator between values of data member.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
std::vector< JHitW0 > buffer_type
hits
std::vector< event_type > data_type
JRECONSTRUCTION::JWeight getWeight
Auxiliary data structure for floating point format specification.
Auxiliary data structure for mechanical model parameters with commented data.
int getID() const
Get emitter identifier.
const int getDetectorID() const
Get detector identifier.
double Qmin
minimal quality transmission
double deadTime_s
dead time between events [s]
size_t Nmin
minimum number of emitters
double sigma_s
time-of-arrival resolution [s]
double Tmax_s
time window to combine events [s]
double chi2perNDF
maximal chi2/NDF to store event
Global fit of prameterised detector geometry to acoustics data.
Template definition of fit function of acoustic model.
Implementation for depth dependend velocity of sound.
JSoundVelocity & set(const double z0)
Set depth.
Acoustic transmission identifier.
int getID() const
Get identifier.
Auxiliary data structure to unify weights of acoustics data according to the number of pings per emit...
Data structure for measured coincidence rates of all pairs of PMTs in optical module.
Auxiliary wrapper for I/O of container with optional comment (see JComment).
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Auxiliary class for ROOT class selection.
bool is_valid() const
Get status of given data type.
Auxiliary class for defining the range of iterations of objects.
static counter_type max()
Get maximum counter value.