Jpp
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
software
JDetector
JMergeDetector.cc
Go to the documentation of this file.
1
#include <string>
2
#include <iostream>
3
#include <iomanip>
4
5
#include "
JDetector/JDetector.hh
"
6
#include "
JDetector/JDetectorToolkit.hh
"
7
#include "
JDetector/JLocation.hh
"
8
9
#include "
Jeep/JParser.hh
"
10
#include "
Jeep/JMessage.hh
"
11
12
13
/**
14
* \file
15
*
16
* Auxiliary program to merge detector files.
17
*
18
* If the option
19
* <pre>
20
* -N [i]
21
* </pre>
22
* is used with a positive number the strings are renumbered starting from <tt>i</tt>.
23
* Each string gets a unique number based on the order of the detector files
24
* and its original index in its own detector file.
25
*
26
* \author mdejong
27
*/
28
int
main
(
int
argc,
char
**argv)
29
{
30
using namespace
std;
31
using namespace
JPP;
32
33
vector<string>
detectorFile;
34
string
outputFile
;
35
int
debug
;
36
37
try
{
38
39
JParser<>
zap(
"Auxiliary program to merge detector files."
);
40
41
zap[
'a'
] =
make_field
(detectorFile);
42
zap[
'o'
] =
make_field
(
outputFile
);
43
zap[
'd'
] =
make_field
(
debug
) = 1;
44
45
zap(argc, argv);
46
}
47
catch
(
const
exception &error) {
48
FATAL
(error.what() << endl);
49
}
50
51
52
JDetector
detector
;
53
54
for
(
vector<string>::const_iterator
i = detectorFile.begin(); i != detectorFile.end(); ++i) {
55
56
JDetector
buffer;
57
58
try
{
59
load
(*i, buffer);
60
}
61
catch
(
const
JException
& error) {
62
FATAL
(error);
63
}
64
65
if
(
detector
.empty())
66
detector
= buffer;
67
else
68
copy
(buffer.begin(), buffer.end(), back_inserter(
detector
));
69
}
70
71
try
{
72
store
(
outputFile
,
detector
);
73
}
74
catch
(
const
JException
& error) {
75
FATAL
(error);
76
}
77
}
JPARSER::JParser
Utility class to parse command line options.
Definition:
JParser.hh:1500
JLANG::JException
General exception.
Definition:
JException.hh:23
main
int main(int argc, char *argv[])
Definition:
Main.cc:15
JDETECTOR::JDetector
Detector data structure.
Definition:
JDetector.hh:80
outputFile
string outputFile
Definition:
JDAQTimesliceSelector.cc:37
JDetector.hh
Data structure for detector geometry and calibration.
std::vector
Definition:
JSTDTypes.hh:12
JAANET::detector
Detector file.
Definition:
JHead.hh:196
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition:
JParser.hh:1961
JDETECTOR::store
void store(const std::string &file_name, const JDetector &detector)
Store detector to output file.
Definition:
JDetectorToolkit.hh:521
debug
int debug
debug level
Definition:
JSirene.cc:63
JLocation.hh
Logical location of module.
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:445
JParser.hh
Utility class to parse command line options.
JDetectorToolkit.hh
JAANET::copy
void copy(const Head &from, JHead &to)
Copy header from from to to.
Definition:
JHead.cc:139
detector
do set_variable DETECTOR_TXT $WORKDIR detector
Definition:
detector-XY:fit1d.sh:37
Generated by
1.8.5