27 static const int WILDCARD = -1;
29 static const std::string set_t =
"set";
30 static const std::string add_t =
"add";
31 static const std::string sub_t =
"sub";
32 static const std::string setx_t =
"setx";
33 static const std::string sety_t =
"sety";
34 static const std::string setz_t =
"setz";
35 static const std::string addx_t =
"addx";
36 static const std::string addy_t =
"addy";
37 static const std::string addz_t =
"addz";
38 static const std::string subx_t =
"subx";
39 static const std::string suby_t =
"suby";
40 static const std::string subz_t =
"subz";
42 static const std::string rand_t =
"rand";
43 static const std::string randset_t = rand_t + set_t;
44 static const std::string randadd_t = rand_t + add_t;
45 static const std::string randsub_t = rand_t + sub_t;
65 return (action !=
"" && !
data.empty());
74 bool apply(
JTripod& tripod)
const
76 switch (
data.size()) {
79 return apply(tripod, action, data[0]);
82 return apply(tripod, action,
JUTMPosition(data[0], data[1], data[2]));
98 static bool apply(
JTripod& tripod,
const std::string& action,
const double value)
100 if (action == setx_t)
102 else if (action == addx_t)
104 else if (action == subx_t)
106 else if (action == sety_t)
108 else if (action == addy_t)
110 else if (action == suby_t)
112 else if (action == setz_t)
114 else if (action == addz_t)
116 else if (action == subz_t)
137 gRandom->Gaus(0.0, pos.
getUTMZ()));
141 else if (action == add_t)
143 else if (action == sub_t)
145 else if (action == randset_t)
147 else if (action == randadd_t)
149 else if (action == randsub_t)
165 friend inline std::istream&
operator>>(std::istream& in, JModifier& modifier)
167 if (in >> modifier.id >> modifier.action) {
169 modifier.data.clear();
171 for (
double x; in >>
x; ) {
172 modifier.data.push_back(x);
175 in.clear(std::ios_base::eofbit);
189 friend inline std::ostream&
operator<<(std::ostream& out,
const JModifier& modifier)
193 out << modifier.action;
195 for (std::vector<double>::const_iterator i = modifier.data.begin(); i != modifier.data.end(); ++i) {
250 JParser<> zap(
"Auxiliary program to modify tripod configuration.");
252 zap[
'f'] =
make_field(inputFile,
"tripod input file");
258 zap[
'q'] =
make_field(squash,
"squash meta data");
263 catch(
const exception &error) {
264 FATAL(error.what() << endl);
270 if (!rm.empty() && !keep.empty()) {
271 FATAL(
"Use either option -K or -D." << endl);
276 if (inputFile !=
"") {
278 data.load(inputFile.c_str());
280 catch(
const exception& error) {
286 data.comment.clear();
289 data.comment.add(
JMeta(argc, argv));
291 for (vector<JTripod>::const_iterator i = add.begin(); i != add.end(); ++i) {
295 for (vector<JModifier>::const_iterator i = mod.begin(); i != mod.end(); ++i) {
297 for (container_type::iterator
target = data.begin();
target != data.end(); ++
target) {
299 if (
target->getID() == i->id || i->id == WILDCARD) {
301 DEBUG(
"Modifier" <<
' '
303 << i->action <<
' ' <<
JEEPZ() << i->data << endl);
306 ERROR(
"No valid action: " << *i << endl);
313 for (container_type::iterator
target = data.begin();
target != data.end(); ) {
314 if (rm.count(
target->getID()) != 0)
322 for (container_type::iterator
target = data.begin();
target != data.end(); ) {
323 if (keep.count(
target->getID()) == 0)
int main(int argc, char **argv)
General purpose messaging.
#define DEBUG(A)
Message macros.
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
I/O formatting auxiliaries.
Data structure for tripod.
Data structure for tripod.
Utility class to parse command line options.
Data structure for UTM position.
double getUTMNorth() const
Get UTM north.
double getUTMEast() const
Get UTM east.
double getUTMZ() const
Get UTM Z.
JUTMPosition & add(const JUTMPosition &pos)
Add UTM position.
JUTMPosition & sub(const JUTMPosition &pos)
Subtract UTM position.
void setUTMPosition(const JUTMPosition &position)
Set UTM position.
std::istream & operator>>(std::istream &in, JAHRSCalibration &calibration)
Read AHRS calibration from input stream.
std::ostream & operator<<(std::ostream &out, const JAHRSCalibration &calibration)
Write AHRS calibration to output stream.
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).
bool is_valid(const json &js)
Check validity of JSon data.
Auxiliary data structure for sequence of same character.
Auxiliary wrapper for I/O of container with optional comment (see JComment).
Auxiliary data structure for streaming of STL containers.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...