Jpp
Functions
JConvertDetectorFormat.cc File Reference
#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

◆ main()

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  int debug;
44 
45  try {
46 
47  JParser<> zap("Auxiliary program to convert format of detector files.");
48 
49  zap['a'] = make_field(detectorFile);
50  zap['o'] = make_field(outputFile);
51  zap['V'] = make_field(variant) = "", getDetectorVersions<string>();
52  zap['d'] = make_field(debug) = 0;
53 
54  zap(argc, argv);
55  }
56  catch(const exception &error) {
57  FATAL(error.what() << endl);
58  }
59 
60  JDetector detector;
61 
62  try {
63  load(detectorFile, detector);
64  }
65  catch(const JException& error) {
66  FATAL(error);
67  }
68 
69  if (variant != "") {
70  detector.setVersion(variant);
71  }
72 
73  detector.comment.add(JMeta(argc,argv));
74 
75  try {
76  store(outputFile, detector);
77  }
78  catch(const JException& error) {
79  FATAL(error);
80  }
81 }
JDETECTOR::load
void load(const JString &file_name, JDetector &detector)
Load detector from input file.
Definition: JDetectorToolkit.hh:456
JPARSER::JParser
Utility class to parse command line options.
Definition: JParser.hh:1493
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JAAnetToolkit.hh:37
debug
int debug
debug level
Definition: JSirene.cc:59
JDETECTOR::store
void store(const JString &file_name, const JDetector &detector)
Store detector to output file.
Definition: JDetectorToolkit.hh:532
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1954
std
Definition: jaanetDictionary.h:36
FATAL
#define FATAL(A)
Definition: JMessage.hh:67
outputFile
string outputFile
Definition: JDAQTimesliceSelector.cc:37