61{
64
69
72 string detectorFile;
73 JLimit_t& numberOfEvents = inputFile.getLimit();
79 disable_container disable;
82 bool squash;
83 Long64_t autoflush;
85
86 try {
87
88 JParser<> zap(
"Application to fit position calibration model to acoustic data.");
89
90 zap[
'f'] =
make_field(inputFile,
"output of JAcousticEventBuilder[.sh]");
102 "Precede name of data structure by a '+' or '-' "
103 "to add or remove data types in the output, respectively."
106 zap[
'q'] =
make_field(squash,
"squash meta data");
109
110 zap(argc, argv);
111 }
112 catch(const exception &error) {
113 FATAL(error.what() << endl);
114 }
115
116
118
119 try {
121 }
124 }
125
127
130
131 for (JDetector::const_iterator i =
detector.begin(); i !=
detector.end(); ++i) {
132 receivers[i->getID()] = i->getLocation();
133 }
134
135 for (tripods_container::const_iterator i = tripods.begin(); i != tripods.end(); ++i) {
136 emitters[i->getID()] =
JEmitter(i->getID(), i->getUTMPosition() -
detector.getUTMPosition());
137 }
138
139 for (transmitters_container::const_iterator i = transmitters.begin(); i != transmitters.end(); ++i) {
140 try {
141 emitters[i->getID()] =
JEmitter(i->getID(), i->getPosition() +
detector.getModule(i->getLocation()).getPosition());
142 }
143 catch(const exception&) {}
144 }
145
147
150
153
155
157
158 TH1D h0("chi2/NDF", NULL, 50000, 0.0, 1000.0);
159 TH1D h1("h1", NULL, 51, -0.5, 50.5);
160 TH1D hn("hn", NULL, 100, 0.0, 6.0);
161
165
169
170 for (Int_t i = 1; i <= HA->GetXaxis()->GetNbins(); ++i) {
171 HA->GetXaxis()->SetBinLabel(i,
MAKE_CSTRING(geometry.at(i-1).first));
172 HB->GetXaxis()->SetBinLabel(i,
MAKE_CSTRING(geometry.at(i-1).first));
173 }
174
175 if (inputFile.size() > 1u) {
176
178
179 for (const string& file_name : inputFile) {
180
182
184
185 const JEvent* evt = in.next();
186
189 }
190
191 if (!evt->empty()) {
192 zmap[evt->begin()->getToE()] = file_name;
193 }
194 }
195 }
197
198 inputFile.clear();
199
201 inputFile.push_back(i->second);
202 }
203 }
204
206
209
210 try {
213 }
214 catch(const exception&) {}
215
216 int counter[] = { 0, 0 };
217
219
221
222 STATUS(inputFile.getFilename() <<
'\r');
DEBUG(endl);
223
224
225
226 for (const string file_name = inputFile.getFilename(); inputFile.hasNext() && file_name == inputFile.getFilename(); ) {
227
228 const JEvent* evt = inputFile.next();
229
230 if (!evt->empty() && emitters.
has(evt->
getID())) {
231 if (utc(evt->begin()->getToA()) && utc(evt->rbegin()->getToA())) {
232 zbuf.push_back(*evt);
233 }
234 }
235 }
236
237 sort(zbuf.begin(), zbuf.end());
238
239 for (buffer_type::iterator p = zbuf.begin(), q; p != zbuf.end(); p = q) {
240
241 for (q = p; ++q != zbuf.end() && q->begin()->getToE() <= p->rbegin()->getToE() + parameters.
Tmax_s; ) {}
242
243 if (q == zbuf.end()) {
244
245 if (inputFile.hasNext()) {
246
247 zbuf.erase(zbuf.begin(), p);
248
249 break;
250 }
251 }
252
254
256
258
260
262
263 for (buffer_type::iterator evt = p; evt != q; ++evt) {
264
266
268
271
272 for (JEvent::const_iterator i = evt->begin(); i != __end; ++i) {
273
276
277 if (receivers.
has(i->getID()) && geometry.hasLocation(receivers[i->getID()]) && i->getQ() >= parameters.
Qmin * (parameters.
Qmin <= 1.0 ? i->getW() : 1.0)) {
278
281 receivers[i->getID()],
282 i->getToA(),
284 weight));
285 }
286 }
287 }
288 }
289
291
292 for (data_type::const_iterator hit =
data.begin(); hit !=
data.end(); ++hit) {
293 HA[hit->getID()]->Fill(geometry.getIndex(hit->getString()), hit->getFloor(), 1.0);
294 }
295
296
297
299
300 for (data_type::const_iterator hit =
result.begin; hit !=
result.end; ++hit) {
301 HB[hit->getID()]->Fill(geometry.getIndex(hit->getString()), hit->getFloor(), 1.0);
302 }
303
305
306 cout << "result:" << ' '
309
310 for (data_type::const_iterator hit =
result.begin; hit !=
result.end; ++hit) {
311 cout <<
"hit: " << *hit <<
' ' <<
FIXED(9,3) << katoomba.evaluator(
result.value, *hit) << endl;
312 }
313 }
314
315 hn.Fill(log10(katoomba.gandalf.numberOfIterations));
317
318
319
322
330 katoomba.gandalf.numberOfIterations),
332
334
336
337 for (buffer_type::iterator i = p; i != q; ++i) {
338
340
342
343 for (JEvent::iterator hit = out.begin(); hit != out.end(); ++hit) {
344 hit->setToE(toe);
345 }
346
347 if (!out.empty()) {
349 }
350 }
351 }
352
353 counter[0] += 1;
354
355 } else {
356
358
359 counter[1] += 1;
360 }
361
362 } else {
363
365
366 counter[1] += 1;
367 }
368 }
369 }
370 }
372
373 STATUS(
"Number of events written / rejected: " << counter[0] <<
" / " << counter[1] << endl);
374
375 if (!squash) {
376
378
380 }
381
385
388
390}
#define DEBUG(A)
Message macros.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
#define MAKE_CSTRING(A)
Make C-string.
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
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.
double getWeight(T __begin, T __end)
Get total weight of data points.
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.
static JDetectorMechanics getMechanics
Function object to get string mechanics.
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
Auxiliary data structure for floating point format specification.
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.