Jpp
17.0.0
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
JGizmo
JDrawDetector1D.cc
Go to the documentation of this file.
1
#include <string>
2
#include <iostream>
3
#include <limits>
4
#include <map>
5
6
#include "TROOT.h"
7
#include "TGraph.h"
8
#include "
JROOT/JGraph.hh
"
9
#include "
JROOT/JManager.hh
"
10
#include "
JDetector/JDetector.hh
"
11
#include "
JDetector/JDetectorToolkit.hh
"
12
#include "
Jeep/JParser.hh
"
13
#include "
Jeep/JMessage.hh
"
14
15
16
/**
17
* \file
18
* Auxiliary program to draw the string of detector.
19
* \author mdejong
20
*/
21
int
main
(
int
argc,
char
**argv)
22
{
23
using namespace
std;
24
using namespace
JPP;
25
26
string
detectorFile;
27
string
outputFile
;
28
double
step;
29
int
debug
;
30
31
try
{
32
33
JParser<>
zap(
"Auxiliary program to draw the strigs of detector."
);
34
35
zap[
'a'
] =
make_field
(detectorFile,
"detector file"
) =
JPARSER::initialised
();
36
zap[
'o'
] =
make_field
(
outputFile
,
"graphics output"
) =
"detector.root"
;
37
zap[
'z'
] =
make_field
(step) = 0.0;
38
zap[
'd'
] =
make_field
(
debug
) = 1;
39
40
zap(argc, argv);
41
}
42
catch
(
const
exception &error) {
43
FATAL
(error.what() << endl);
44
}
45
46
47
JDetector
detector
;
48
49
try
{
50
load
(detectorFile,
detector
);
51
}
52
catch
(
const
JException
& error) {
53
FATAL
(error);
54
}
55
56
map<int, JGraph_t>
H0;
57
map<int, double>
z0;
58
59
for
(JDetector::const_iterator module =
detector
.begin(); module !=
detector
.end(); ++module) {
60
if
(module->getFloor() == 1) {
61
if
(step != 0.0)
62
z0[module->getString()] = module->getZ();
63
else
64
z0[module->getString()] = 0.0;
65
}
66
}
67
68
for
(JDetector::const_iterator module =
detector
.begin(); module !=
detector
.end(); ++module) {
69
if
(module->getFloor() != 0) {
70
H0[module->getString()].put((Double_t) module->getFloor(), module->getZ() - (module->getFloor() - 1) * step - z0[module->getString()]);
71
}
72
}
73
74
TFile out(
outputFile
.c_str(),
"recreate"
);
75
76
for
(
map<int, JGraph_t>::const_iterator
i = H0.begin(); i != H0.end(); ++i) {
77
out <<
JGraph
(i->second,
MAKE_CSTRING
(
"G["
<< i->first <<
"].string"
));
78
}
79
80
out.Write();
81
out.Close();
82
83
}
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
std::map
Definition:
JSTDTypes.hh:16
JDETECTOR::JDetector
Detector data structure.
Definition:
JDetector.hh:89
MAKE_CSTRING
#define MAKE_CSTRING(A)
Make C-string.
Definition:
JPrint.hh:151
JPARSER::initialised
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition:
JParser.hh:66
JManager.hh
Dynamic ROOT object management.
JROOT::JGraph
Auxiliary data structure to build TGraph.
Definition:
JGraph.hh:42
outputFile
string outputFile
Definition:
JDAQTimesliceSelector.cc:37
JDetector.hh
Data structure for detector geometry and calibration.
JAANET::detector
Detector file.
Definition:
JHead.hh:224
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition:
JParser.hh:1961
debug
int debug
debug level
Definition:
JSirene.cc:66
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:478
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
JGraph.hh
Generated by
1.8.5