Jpp
18.0.0-rc.4
the software that should make you happy
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
software
JDetector
JConvertDetectorFormat.cc
Go to the documentation of this file.
1
#include <string>
2
3
#include "
JDetector/JDetector.hh
"
4
#include "
JDetector/JDetectorToolkit.hh
"
5
#include "
JSupport/JMeta.hh
"
6
7
#include "
Jeep/JParser.hh
"
8
#include "
Jeep/JMessage.hh
"
9
10
11
/**
12
* \file
13
*
14
* Auxiliary program to convert format of detector files.
15
*
16
* The following combinations of file name extensions are supported:
17
* <table>
18
* <tr><th> input </th><th> output </th></tr>
19
* <tr><td> detx </td><td> detx </td></tr>
20
* <tr><td> detx </td><td> datx </td></tr>
21
* <tr><td> detx </td><td> gdml </td></tr>
22
* <tr><td> datx </td><td> detx </td></tr>
23
* <tr><td> datx </td><td> datx </td></tr>
24
* <tr><td> datx </td><td> gdml </td></tr>
25
* <tr><td> det </td><td> detx </td></tr>
26
* <tr><td> det </td><td> datx </td></tr>
27
* <tr><td> det </td><td> gdml </td></tr>
28
* </table>
29
*
30
* Note that if the output file name is the same as the input file name,
31
* the original file will be overwritten.
32
* \author rbruijn
33
*/
34
int
main
(
int
argc,
char
**argv)
35
{
36
37
using namespace
std;
38
using namespace
JPP;
39
40
string
detectorFile;
41
string
outputFile
;
42
string
variant;
43
bool
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
62
JDetector
detector
;
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
79
detector
.comment.add(JMeta(argc,argv));
80
81
try
{
82
store
(
outputFile
,
detector
);
83
}
84
catch
(
const
JException& error) {
85
FATAL
(error);
86
}
87
}
JPARSER::JParser
Utility class to parse command line options.
Definition:
JParser.hh:1514
main
int main(int argc, char *argv[])
Definition:
Main.cc:15
outputFile
string outputFile
Definition:
JDAQTimesliceSelector.cc:37
JDetector.hh
Data structure for detector geometry and calibration.
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition:
JParser.hh:1989
JDETECTOR::store
void store(const std::string &file_name, const JDetector &detector)
Store detector to output file.
Definition:
JDetectorToolkit.hh:578
JMeta.hh
ROOT I/O of application specific meta data.
JMessage.hh
General purpose messaging.
FATAL
#define FATAL(A)
Definition:
JMessage.hh:67
JDETECTOR::load
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
Definition:
JDetectorToolkit.hh:485
JParser.hh
Utility class to parse command line options.
JDetectorToolkit.hh
detector
do set_variable DETECTOR_TXT $WORKDIR detector
Definition:
detector-XY:fit1d.sh:38
debug
int debug
debug level
Definition:
archive-put-wiki-detectors.sh:92
Generated by
1.8.5