Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
JEditHydrophone.cc File Reference

Auxiliary program to modify hydrophone configuration. 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 modify hydrophone configuration.

Syntax:

    -S "<string number>         (set|add|sub) x y z"
    -S "<string number>         (rot) phi"

For option rot, the angle phi refers to an anti-clockwise rotation around the z-axis.
The rotation angle is defined in radians.

Author
mdejong

Definition in file JEditHydrophone.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 173 of file JEditHydrophone.cc.

174 {
175  using namespace std;
176  using namespace JPP;
177 
178  typedef JContainer< vector<JHydrophone> > hydrophones_container;
179 
180  string hydrophoneFile;
181  vector<JModifier> mod;
182  int debug;
183 
184  try {
185 
186  JParser<> zap("Auxiliary program to modify hydrophone configuration.");
187 
188  zap['f'] = make_field(hydrophoneFile, "hydrophone file");
189  zap['S'] = make_field(mod, "hydrophone modifier") = JPARSER::initialised();
190  zap['d'] = make_field(debug) = 1;
191 
192  zap(argc, argv);
193  }
194  catch(const exception &error) {
195  FATAL(error.what() << endl);
196  }
197 
198  hydrophones_container hydrophones;
199 
200  hydrophones.load(hydrophoneFile.c_str());
201 
202  hydrophones.comment.add(JMeta(argc, argv));
203 
204  for (vector<JModifier>::const_iterator i = mod.begin(); i != mod.end(); ++i) {
205 
206  for (hydrophones_container::iterator hydrophone = hydrophones.begin(); hydrophone != hydrophones.end(); ++hydrophone) {
207 
208  if (hydrophone->getString() == i->id) {
209 
210  DEBUG("Modifier" << ' '
211  << "(" << FILL(4,'0') << hydrophone->getString() << "," << FILL(2,'0') << hydrophone->getFloor() << FILL() << ")" << ' '
212  << "action" << ' ' << i->action << JEEPZ() << i->data << endl);
213 
214  if (!i->apply(*hydrophone)) {
215  ERROR("No valid action: " << *i << endl);
216  }
217  }
218  }
219  }
220 
221  hydrophones.store(hydrophoneFile.c_str());
222 }
Auxiliary class for ROOT I/O of application specific meta data.
Definition: JMeta.hh:70
Utility class to parse command line options.
Definition: JParser.hh:1500
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition: JParser.hh:66
Auxiliary wrapper for I/O of container with optional comment (see JComment).
Definition: JContainer.hh:39
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1961
#define ERROR(A)
Definition: JMessage.hh:66
int debug
debug level
Definition: JSirene.cc:63
Auxiliary data structure for streaming of STL containers.
Definition: JPrint.hh:65
Auxiliary data structure for sequence of same character.
Definition: JManip.hh:327
#define FATAL(A)
Definition: JMessage.hh:67
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62