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

Auxiliary program to convert format of detector files. More...

#include <string>
#include "JDetector/JDetector.hh"
#include "JDetector/JDetectorToolkit.hh"
#include "JSupport/JMeta.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 convert format of detector files.

The following combinations of file name extensions are supported:

input output
detx detx
detx dat
detx gdml
dat detx
dat dat
dat gdml
det detx
det dat
det gdml

Note that if the output file name is the same as the input file name, the original file will be overwritten.

Author
rbruijn

Definition in file JConvertDetectorFormat.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 34 of file JConvertDetectorFormat.cc.

35 {
36 
37  using namespace std;
38  using namespace JPP;
39 
40  string detectorFile;
41  string outputFile;
42  string variant;
43  JCounter squash;
44  int debug;
45 
46  try {
47 
48  JParser<> zap("Auxiliary program to convert format of detector files.");
49 
50  zap['a'] = make_field(detectorFile);
51  zap['o'] = make_field(outputFile);
52  zap['V'] = make_field(variant, "\"\" maintains version") = getDetectorVersions<string>(), "";
53  zap['q'] = make_field(squash, "squash meta data");
54  zap['d'] = make_field(debug, "debug level") = 2;
55 
56  zap(argc, argv);
57  }
58  catch(const exception &error) {
59  FATAL(error.what() << endl);
60  }
61 
63 
64  try {
65  load(detectorFile, detector);
66  }
67  catch(const JException& error) {
68  FATAL(error);
69  }
70 
71  if (variant != "") {
72  detector.setVersion(variant);
73  }
74 
75  if (squash) {
76  detector.comment.clear();
77  }
78  if (squash < 2) {
79  detector.comment.add(JMeta(argc,argv));
80  }
81 
82  try {
84  }
85  catch(const JException& error) {
86  FATAL(error);
87  }
88 }
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:1517
General exception.
Definition: JException.hh:23
Acoustic counter.
Detector data structure.
Definition: JDetector.hh:89
string outputFile
Detector file.
Definition: JHead.hh:226
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1993
void store(const std::string &file_name, const JDetector &detector)
Store detector to output file.
#define FATAL(A)
Definition: JMessage.hh:67
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
do set_variable DETECTOR_TXT $WORKDIR detector
int debug
debug level