Jpp  15.0.0-rc.2
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
JEditTripod.cc File Reference

Auxiliary program to modify tripod configuration. More...

#include <iostream>
#include <iomanip>
#include <vector>
#include "TRandom3.h"
#include "JDetector/JTripod.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 tripod configuration.

Syntax:

    -T "<tripod identifier>     (set|add|sub) east north z"
Author
mdejong

Definition in file JEditTripod.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 120 of file JEditTripod.cc.

121 {
122  using namespace std;
123  using namespace JPP;
124 
125  typedef JContainer< vector<JTripod> > container_type;
126 
127  string file_name;
128  vector<JModifier> mod;
129  int debug;
130 
131  try {
132 
133  JParser<> zap("Auxiliary program to modify tripod configuration.");
134 
135  zap['f'] = make_field(file_name, "tripod file");
136  zap['T'] = make_field(mod, "tripod modifier") = JPARSER::initialised();
137  zap['d'] = make_field(debug) = 1;
138 
139  zap(argc, argv);
140  }
141  catch(const exception &error) {
142  FATAL(error.what() << endl);
143  }
144 
145  gRandom->SetSeed(0);
146 
147  container_type data;
148 
149  data.load(file_name.c_str());
150 
151  data.comment.add(JMeta(argc, argv));
152 
153  for (vector<JModifier>::const_iterator i = mod.begin(); i != mod.end(); ++i) {
154 
155  for (container_type::iterator target = data.begin(); target != data.end(); ++target) {
156 
157  if (target->getID() == i->id || i->id == WILDCARD) {
158 
159  DEBUG("Modifier" << ' '
160  << "(" << FILL(2,'0') << target->getID() << FILL() << ")" << ' '
161  << "action" << ' ' << i->pos << endl);
162 
163  if (!i->apply(*target)) {
164  ERROR("No valid action: " << *i << endl);
165  }
166  }
167  }
168  }
169 
170  data.store(file_name.c_str());
171 }
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 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