Jpp  16.0.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
JEditMechanics.cc File Reference

Auxiliary program to modify mechanical model data of detector string. More...

#include <iostream>
#include <iomanip>
#include <map>
#include "JAcoustics/JMechanics.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 mechanical model data of detector string.

Syntax:

    -M "<string number>     (set) a b"
Author
mdejong

Definition in file JEditMechanics.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 92 of file JEditMechanics.cc.

93 {
94  using namespace std;
95  using namespace JPP;
96 
97  typedef JContainer< map<int, JMechanics> > container_type;
98 
99  string file_name;
100  vector<JModifier> mod;
101  int debug;
102 
103  try {
104 
105  JParser<> zap("Auxiliary program to modify mechanical model data of detector string.");
106 
107  zap['f'] = make_field(file_name, "mechanics file");
108  zap['M'] = make_field(mod, "mechanics modifier") = JPARSER::initialised();
109  zap['d'] = make_field(debug) = 1;
110 
111  zap(argc, argv);
112  }
113  catch(const exception &error) {
114  FATAL(error.what() << endl);
115  }
116 
117  container_type data;
118 
119  data.load(file_name.c_str());
120 
121  data.comment.add(JMeta(argc, argv));
122 
123  for (vector<JModifier>::const_iterator i = mod.begin(); i != mod.end(); ++i) {
124 
125  DEBUG("Modifier" << ' '
126  << "(" << FILL(2,'0') << i->id << FILL() << ")" << ' '
127  << "action" << ' ' << i->mechanics << endl);
128 
129  JMechanics mechanics;
130 
131  container_type::iterator p = data.find(i->id);
132 
133  if (p != data.end()) {
134  mechanics = p->second;
135  }
136 
137  if (!i->apply(mechanics))
138  ERROR("No valid action: " << *i << endl);
139  else
140  data[i->id] = mechanics;
141  }
142 
143  data.store(file_name.c_str());
144 }
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 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
Auxiliary data structure for parameters of mechanical model.
Definition: JMechanics.hh:39