Jpp test-rotations-new
the software that should make you happy
Loading...
Searching...
No Matches
JMergeHydrophone.cc File Reference

Auxiliary program to merge hydrophone files. More...

#include <iostream>
#include <iomanip>
#include <vector>
#include "JDetector/JHydrophone.hh"
#include "JSupport/JMeta.hh"
#include "Jeep/JContainer.hh"
#include "Jeep/JPrint.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Auxiliary program to merge hydrophone files.

Author
mdejong

Definition in file JMergeHydrophone.cc.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 22 of file JMergeHydrophone.cc.

23{
24 using namespace std;
25 using namespace JPP;
26
27 typedef JContainer< vector<JHydrophone> > container_type;
28
29 vector<string> inputFile;
30 string outputFile;
31 int debug;
32
33 try {
34
35 JParser<> zap("Auxiliary program to merge hydrophone files.");
36
37 zap['f'] = make_field(inputFile, "hydrophone input file");
38 zap['o'] = make_field(outputFile, "hydrophone output file");
39 zap['d'] = make_field(debug, "debug level") = 2;
40
41 zap(argc, argv);
42 }
43 catch(const exception &error) {
44 FATAL(error.what() << endl);
45 }
46
47 container_type data;
48
49 data.comment.add(JMeta(argc, argv));
50
51 for (vector<string>::const_iterator i = inputFile.begin(); i != inputFile.end(); ++i) {
52
53 container_type buffer;
54
55 try {
56 load(*i, buffer);
57 }
58 catch(const JException& error) {
59 FATAL(error);
60 }
61
62 if (data.empty())
63 data = buffer;
64 else
65 copy(buffer.begin(), buffer.end(), back_inserter(data));
66 }
67
68 data.store(outputFile.c_str());
69}
string outputFile
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:72
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
General exception.
Definition JException.hh:24
Utility class to parse command line options.
Definition JParser.hh:1698
void copy(const Head &from, JHead &to)
Copy header from from to to.
Definition JHead.cc:163
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary wrapper for I/O of container with optional comment (see JComment).
Definition JContainer.hh:42
Auxiliary class for ROOT I/O of application specific meta data.
Definition JMeta.hh:72