Jpp
18.2.1
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
getModuleStatus.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/JModuleRouter.hh
"
8
#include "
JDetector/JModuleStatus.hh
"
9
10
#include "
JLang/JVectorize.hh
"
11
12
#include "
Jeep/JParser.hh
"
13
#include "
Jeep/JMessage.hh
"
14
15
16
/**
17
* \file
18
*
19
* Auxiliary program to print module status for a given module identifier.
20
* \author mdejong
21
*/
22
int
main
(
int
argc,
char
**argv)
23
{
24
using namespace
std;
25
using namespace
JPP;
26
27
string
detectorFile;
28
JModuleIdentifier
id;
29
string
key;
30
int
debug
;
31
32
try
{
33
34
JParser<>
zap(
"Auxiliary program to print module status for a given module identifier."
35
"\nInteractive mode in absence of option -M <module identifier>."
);
36
37
zap[
'a'
] =
make_field
(detectorFile,
"Detector file"
);
38
zap[
'M'
] =
make_field
(
id
,
"module identifier"
) =
JModuleIdentifier
();
39
zap[
'k'
] =
make_field
(key,
"key"
) =
""
,
get_keys
(
getModuleStatusBit
);
40
zap[
'd'
] =
make_field
(
debug
) = 1;
41
42
zap(argc, argv);
43
}
44
catch
(
const
exception &error) {
45
FATAL
(error.what() << endl);
46
}
47
48
49
JDetector
detector
;
50
51
try
{
52
load
(detectorFile,
detector
);
53
}
54
catch
(
const
JException& error) {
55
FATAL
(error);
56
}
57
58
const
JModuleRouter router(
detector
);
59
60
if
(
id
!=
JModuleIdentifier
()) {
61
62
if
(router.hasModule(
id
)) {
63
if
(key ==
""
)
64
print
(cout, router.getModule(
id
).getStatus(),
putModuleStatusBit
);
65
else
66
cout << router.getModule(
id
).has(
getModuleStatusBit
(key));
67
}
68
69
}
else
{
70
71
while
(cin >>
id
&&
id
!=
JModuleIdentifier
()) {
72
73
if
(router.hasModule(
id
)) {
74
if
(key ==
""
)
75
print
(cout, router.getModule(
id
).getStatus(),
putModuleStatusBit
);
76
else
77
cout << router.getModule(
id
).has(
getModuleStatusBit
(key));
78
}
79
}
80
}
81
}
JPARSER::JParser
Utility class to parse command line options.
Definition:
JParser.hh:1514
main
int main(int argc, char *argv[])
Definition:
Main.cc:15
JDETECTOR::getModuleStatusBit
static const JGetModuleStatusBit getModuleStatusBit
Function object to map key to module status bit.
Definition:
JModuleStatus.hh:64
JDetector.hh
Data structure for detector geometry and calibration.
JDETECTOR::JModuleIdentifier
JLANG::JObjectID JModuleIdentifier
Definition:
JModuleIdentifier.hh:16
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition:
JParser.hh:1989
JDETECTOR::putModuleStatusBit
static const JPutModuleStatusBit putModuleStatusBit(getModuleStatusBit)
Function object to map module status bit to key.
JModuleStatus.hh
JVectorize.hh
Auxiliary methods to convert data members or return values of member methods of a set of objects to a...
print
print
Definition:
JConvertDusj.sh:44
JMessage.hh
General purpose messaging.
FATAL
#define FATAL(A)
Definition:
JMessage.hh:67
JModuleRouter.hh
Direct access to module in detector data structure.
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
JLANG::get_keys
const array_type< JKey_t > & get_keys(const std::map< JKey_t, JValue_t, JComparator_t, JAllocator_t > &data)
Method to create array of keys of map.
Definition:
JVectorize.hh:139
debug
int debug
debug level
Definition:
archive-put-wiki-detectors.sh:92
Generated by
1.8.5