60 int main(
int argc,
char **argv)
85 JParser<> zap(
"Application to fit position calibration model to acoustic data.");
87 zap[
'f'] =
make_field(inputFile,
"output of JAcousticEventBuilder[.sh]");
89 zap[
'n'] =
make_field(numberOfEvents) = JLimit::max();
99 "Precede name of data structure by a '+' or '-' "
100 "to add or remove data types in the output, respectively."
106 catch(
const exception &error) {
107 FATAL(error.what() << endl);
126 receivers[
i->getID()] =
i->getLocation();
129 for (tripods_container::const_iterator
i =
tripods.begin();
i !=
tripods.end(); ++
i) {
130 emitters[
i->getID()] =
JEmitter(
i->getID(),
i->getUTMPosition() -
detector.getUTMPosition());
133 for (transmitters_container::const_iterator
i = transmitters.begin();
i != transmitters.end(); ++
i) {
137 catch(
const exception&) {}
152 TH1D h0(
"chi2/NDF", NULL, 50000, 0.0, 1000.0);
153 TH1D h1(
"h1", NULL, 51, -0.5, 50.5);
154 TH1D hn(
"hn", NULL, 100, 0.0, 6.0);
158 range.getLength() + 1,
range.getLowerLimit() - 0.5,
range.getUpperLimit() + 0.5));
162 range.getLength() + 1,
range.getLowerLimit() - 0.5,
range.getUpperLimit() + 0.5));
164 for (Int_t
i = 1;
i <= HA->GetXaxis()->GetNbins(); ++
i) {
165 HA->GetXaxis()->SetBinLabel(
i,
MAKE_CSTRING(geometry.at(
i-1).first));
166 HB->GetXaxis()->SetBinLabel(
i,
MAKE_CSTRING(geometry.at(
i-1).first));
171 if (inputFile.size() > 1
u) {
175 for (
const string& file_name : inputFile) {
185 else if (oid != evt->
getOID())
186 FATAL(
"Invalid detector identifier " << evt->
getOID() <<
" != " << oid << endl);
189 zmap[evt->begin()->getToE()] = file_name;
198 inputFile.push_back(
i->second);
212 catch(
const exception&) {}
214 int counter[] = { 0, 0 };
216 typedef deque<JEvent> buffer_type;
218 for (buffer_type zbuf; inputFile.hasNext(); ) {
220 STATUS(inputFile.getFilename() <<
'\r');
DEBUG(endl);
224 for (
const string file_name = inputFile.getFilename(); inputFile.hasNext() && file_name == inputFile.getFilename(); ) {
226 const JEvent* evt = inputFile.next();
228 if (!evt->empty() && emitters.has(evt->
getID())) {
229 zbuf.push_back(*evt);
233 sort(zbuf.begin(), zbuf.end());
235 for (buffer_type::iterator p = zbuf.begin(), q; p != zbuf.end(); p = q) {
237 for (q = p; ++q != zbuf.end() && q->begin()->getToE() <= p->rbegin()->getToE() +
parameters.Tmax_s; ) {}
239 if (q == zbuf.end()) {
241 if (inputFile.hasNext()) {
243 zbuf.erase(zbuf.begin(), p);
260 for (buffer_type::iterator evt = p; evt != q; ++evt) {
266 const JEmitter& emitter = emitters [evt->getID()];
267 const double weight =
getWeight(evt->getID());
269 for (JEvent::const_iterator
i = evt->begin();
i != __end; ++
i) {
276 data.push_back(
JHit(emitter,
278 receivers[
i->getID()],
283 buffer.insert(evt->getID());
291 for (data_type::const_iterator hit = data.begin(); hit != data.end(); ++hit) {
292 HA[hit->getID()]->Fill(geometry.
getIndex(hit->getString()), hit->getFloor(), 1.0);
297 const auto result = katoomba(data.begin(), data.end());
299 for (data_type::const_iterator hit =
result.begin; hit !=
result.end; ++hit) {
300 HB[hit->getID()]->Fill(geometry.
getIndex(hit->getString()), hit->getFloor(), 1.0);
305 cout <<
"result:" <<
' '
309 for (data_type::const_iterator hit =
result.begin; hit !=
result.end; ++hit) {
333 if (selection.is_valid<
JEvent>()) {
335 for (buffer_type::iterator
i = p;
i != q; ++
i) {
341 for (JEvent::iterator hit = out.begin(); hit != out.end(); ++hit) {
364 STATUS(
"Number of events written / rejected: " << counter[0] <<
" / " << counter[1] << endl);
Fit function of acoustic model.
Utility class to parse command line options.
int main(int argc, char *argv[])
JComparator< JResult_t T::*, JComparison::lt > make_comparator(JResult_t T::*member)
Helper method to create comparator between values of data member.
double getWeight(T __begin, T __end)
Get total weight of data points.
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.
Auxiliary data structure to unify weights of acoustics data according to the number of pings per emit...
General purpose class for hash map of unique elements.
ROOT TTree parameter settings.
Recording of objects on file according a format that follows from the file name extension.
Auxiliary class for ROOT class selection.
*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)...
Dynamic ROOT object management.
Auxiliary data structure for floating point format specification.
V(JDAQEvent-JTriggerReprocessor)*1.0/(JDAQEvent+1.0e-10)
floor_range getRangeOfFloors(const JDetector &detector)
Get range of floors.
Data structure for detector geometry and calibration.
Global fit of prameterised detector geometry to acoustics data.
Data structure for hydrophone.
size_t getNumberOfEmitters(T __begin, T __end)
Get number of emitters.
Scanning of objects from a single file according a format that follows from the extension of each fil...
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
Data structure for transmitter.
Auxiliary wrapper for I/O of container with optional comment (see JComment).
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
set_variable E_E log10(E_{fit}/E_{#mu})"
JContainer< std::set< JTransmission_t > > disable_container
const std::string & getOID() const
Get detector identifier.
JPosition3D getPosition(const Vec &pos)
Get position.
JTreeWriter object output.
JContainer< std::vector< JTripod > > tripods_container
General purpose messaging.
static const JStringCounter getNumberOfStrings
Function object to count unique strings.
Implementation for depth dependend velocity of sound.
Scanning of objects from multiple files according a format that follows from the extension of each fi...
z range($ZMAX-$ZMIN)< $MINIMAL_DZ." fi fi typeset -Z 4 STRING typeset -Z 2 FLOOR JPlot1D -f $
JTreeWriter< T > & getTreeWriter()
Get TreeWriter.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
Auxiliary class to define a range between two values.
General purpose class for object reading from a list of file names.
Utility class to parse command line options.
Acoustic transmission identifier.
JEvt getEvt(const JHead &header, const JModel &model)
Get event.
bool hasLocation(const JLocation &location) const
Check if this detector has given location.
Object reading from a list of files.
const JLimit & getLimit() const
Get limit.
JKatoomba< JGandalf > gandalf
do set_variable DETECTOR_TXT $WORKDIR detector
int getID() const
Get emitter identifier.
Data structure for tripod.
std::vector< JHit > data_type
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.
JKatoomba< JAbstractMinimiser > evaluator
Template definition of fit function of acoustic model.
#define DEBUG(A)
Message macros.
Data structure for optical module.