Jpp  15.0.1-rc.1-highQE
the software that should make you happy
 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 163 of file JEditHydrophone.cc.

164 {
165  using namespace std;
166  using namespace JPP;
167 
168  typedef JContainer< vector<JHydrophone> > container_type;
169 
170  string file_name;
171  vector<JModifier> mod;
172  int debug;
173 
174  try {
175 
176  JParser<> zap("Auxiliary program to modify hydrophone configuration.");
177 
178  zap['f'] = make_field(file_name, "hydrophone file");
179  zap['S'] = make_field(mod, "hydrophone modifier") = JPARSER::initialised();
180  zap['d'] = make_field(debug) = 1;
181 
182  zap(argc, argv);
183  }
184  catch(const exception &error) {
185  FATAL(error.what() << endl);
186  }
187 
188  container_type data;
189 
190  data.load(file_name.c_str());
191 
192  data.comment.add(JMeta(argc, argv));
193 
194  for (vector<JModifier>::const_iterator i = mod.begin(); i != mod.end(); ++i) {
195 
196  for (container_type::iterator target = data.begin(); target != data.end(); ++target) {
197 
198  if (target->getString() == i->id) {
199 
200  DEBUG("Modifier" << ' '
201  << "(" << FILL(4,'0') << target->getString() << "," << FILL(2,'0') << target->getFloor() << FILL() << ")" << ' '
202  << "action" << ' ' << i->action << JEEPZ() << i->data << endl);
203 
204  if (!i->apply(*target)) {
205  ERROR("No valid action: " << *i << endl);
206  }
207  }
208  }
209  }
210 
211  data.store(file_name.c_str());
212 }
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
Target.
Definition: JHead.hh:268
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:328
#define FATAL(A)
Definition: JMessage.hh:67
then usage $script< input_file >< detector_file > fi set_variable OUTPUT_DIR set_variable SELECTOR JDAQTimesliceL1 set_variable DEBUG case set_variable DEBUG