Jpp
18.2.1-ARCA-DF-PATCH
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
examples
JAcoustics
JGeometry.cc
Go to the documentation of this file.
1
#include <iostream>
2
#include <iomanip>
3
#include <fstream>
4
5
#include "
JTools/JGrid.hh
"
6
#include "
JAcoustics/JGeometry.hh
"
7
#include "
JAcoustics/JModel.hh
"
8
9
#include "
Jeep/JParser.hh
"
10
#include "
Jeep/JMessage.hh
"
11
12
13
/**
14
* Example application for acoustics geometry.
15
*/
16
int
main
(
int
argc,
char
**argv)
17
{
18
using namespace
std;
19
using namespace
JPP;
20
21
typedef
JGrid<double>
grid_type;
22
23
JMODEL::JString
parameters
;
24
JMechanics
mechanics;
25
grid_type grid;
26
string
outputFile
;
27
int
debug
;
28
29
try
{
30
31
JParser<>
zap(
"Example application for acoustics geometry."
);
32
33
zap[
'S'
] =
make_field
(
parameters
) =
JPARSER::initialised
();
34
zap[
'M'
] =
make_field
(mechanics) =
JPARSER::initialised
();
35
zap[
'G'
] =
make_field
(grid);
36
zap[
'o'
] =
make_field
(
outputFile
) =
""
;
37
zap[
'd'
] =
make_field
(
debug
) = 3;
38
39
zap(argc, argv);
40
}
41
catch
(
const
exception &error) {
42
FATAL
(error.what() << endl);
43
}
44
45
46
// build string
47
48
const
double
x0 = 0.0;
49
const
double
y0 = 0.0;
50
const
double
z0 = 0.0;
51
52
JGEOMETRY::JString
string
(
JPosition3D
(x0, y0, z0), mechanics);
53
54
string
.has_hydrophone =
true
;
55
56
string
[0] =
JGEOMETRY::JFloor
(z0);
57
58
for
(
int
i
= 1;
i
<= grid.getSize(); ++
i
) {
59
string
[
i
] =
JGEOMETRY::JFloor
(z0 + grid.getX(
i
- 1));
60
}
61
62
cout <<
"tilt: "
63
<<
FIXED
(6,3) <<
parameters
.tx <<
' '
64
<<
FIXED
(6,3) <<
parameters
.ty << endl;
65
66
cout <<
" "
<<
' '
67
<<
" x "
<<
' '
68
<<
" y "
<<
' '
69
<<
" z "
<<
' '
70
<<
" dx "
<<
' '
71
<<
" dy "
<<
' '
72
<<
" dz "
<< endl;
73
74
for
(
int
i
= 1;
i
<= grid.getSize(); ++
i
) {
75
76
const
JPosition3D
pos[] = {
77
string
.
getPosition
(
parameters
,
i
- 1),
78
string
.
getPosition
(
parameters
,
i
)
79
};
80
81
cout << setw(2) <<
i
<<
' '
82
<<
FIXED
(7,3) << pos[1].
getX
() <<
' '
83
<<
FIXED
(7,3) << pos[1].
getY
() <<
' '
84
<<
FIXED
(7,3) << pos[1].
getZ
() <<
' '
85
<<
FIXED
(7,3) << pos[1].
getX
() - pos[0].
getX
() <<
' '
86
<<
FIXED
(7,3) << pos[1].
getY
() - pos[0].
getY
() <<
' '
87
<<
FIXED
(7,3) << pos[1].
getZ
() - pos[0].
getZ
() << endl;
88
}
89
90
if
(
outputFile
!=
""
) {
91
92
ofstream out(
outputFile
.c_str());
93
94
for
(
int
i
= 1;
i
<= grid.getSize(); ++
i
) {
95
96
const
JPosition3D
pos =
string
.
getPosition
(
parameters
,
i
);
97
98
out <<
FIXED
(7,3) << pos.
getX
() <<
' '
<<
FIXED
(7,3) << pos.
getZ
() << endl;
99
}
100
101
out.close();
102
}
103
}
JPARSER::JParser
Utility class to parse command line options.
Definition:
JParser.hh:1514
main
int main(int argc, char *argv[])
Definition:
Main.cc:15
JGeometry.hh
Acoustic geometries.
parameters
*fatal Wrong number of arguments esac JCookie sh typeset Z DETECTOR typeset Z SOURCE_RUN typeset Z TARGET_RUN set_variable PARAMETERS_FILE $WORKDIR parameters
Definition:
diff-Tuna.sh:38
JPARSER::initialised
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition:
JParser.hh:83
JACOUSTICS::JGEOMETRY::JString
String geometry.
Definition:
JGeometry.hh:122
FIXED
Auxiliary data structure for floating point format specification.
Definition:
JManip.hh:446
outputFile
string outputFile
Definition:
JDAQTimesliceSelector.cc:37
i
then rm i
Definition:
JEvtReweightMupageParameterScan.sh:309
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition:
JParser.hh:1989
string
then awk string
Definition:
pre-calibration.sh:45
JGrid.hh
JGEOMETRY3D::JVector3D::getY
double getY() const
Get y position.
Definition:
JVector3D.hh:104
JGEOMETRY3D::JPosition3D::getPosition
const JPosition3D & getPosition() const
Get position.
Definition:
JPosition3D.hh:130
JACOUSTICS::JMODEL::JString
String parameters.
Definition:
JAcoustics/JModel.hh:58
JMessage.hh
General purpose messaging.
FATAL
#define FATAL(A)
Definition:
JMessage.hh:67
JParser.hh
Utility class to parse command line options.
JTOOLS::JGrid< double >
JGEOMETRY3D::JVector3D::getX
double getX() const
Get x position.
Definition:
JVector3D.hh:94
JGEOMETRY3D::JPosition3D
Data structure for position in three dimensions.
Definition:
JPosition3D.hh:36
JModel.hh
Model for fit to acoutsics data.
JGEOMETRY3D::JVector3D::getZ
double getZ() const
Get z position.
Definition:
JVector3D.hh:115
JACOUSTICS::JGEOMETRY::JFloor
Floor geometry.
Definition:
JGeometry.hh:59
debug
int debug
debug level
Definition:
archive-put-wiki-detectors.sh:92
JACOUSTICS::JMechanics
Auxiliary data structure for parameters of mechanical model.
Definition:
JMechanics.hh:41
Generated by
1.8.5