Jpp
pmt_effective_area_update
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));
53
54
string
[0] =
JGEOMETRY::JFloor
(z0);
55
56
for
(
int
i = 1; i <= grid.getSize(); ++i) {
57
string
[i] =
JGEOMETRY::JFloor
(z0 + grid.getX(i - 1));
58
}
59
60
string
.mechanics = mechanics;
61
string
.has_hydrophone =
true
;
62
63
for
(
int
i = 1; i <= grid.getSize(); ++i) {
64
65
const
JPosition3D
pos[] = {
66
string
.
getPosition
(
parameters
, i - 1),
67
string
.
getPosition
(
parameters
, i)
68
};
69
70
cout << setw(2) << i <<
' '
71
<<
FIXED
(7,3) << pos[1].
getX
() <<
' '
72
<<
FIXED
(7,3) << pos[1].
getY
() <<
' '
73
<<
FIXED
(7,3) << pos[1].
getZ
() <<
' '
74
<<
FIXED
(7,3) << pos[1].
getX
() - pos[0].
getX
() <<
' '
75
<<
FIXED
(7,3) << pos[1].
getY
() - pos[0].
getY
() << endl;
76
}
77
78
if
(
outputFile
!=
""
) {
79
80
ofstream out(
outputFile
.c_str());
81
82
for
(
int
i = 1; i <= grid.getSize(); ++i) {
83
84
const
JPosition3D
pos =
string
.
getPosition
(
parameters
, i);
85
86
out <<
FIXED
(7,3) << pos.
getX
() <<
' '
<<
FIXED
(7,3) << pos.
getZ
() << endl;
87
}
88
89
out.close();
90
}
91
}
JPARSER::JParser
Utility class to parse command line options.
Definition:
JParser.hh:1500
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:66
JACOUSTICS::JGEOMETRY::JString
String geometry.
Definition:
JGeometry.hh:121
FIXED
Auxiliary data structure for floating point format specification.
Definition:
JManip.hh:446
outputFile
string outputFile
Definition:
JDAQTimesliceSelector.cc:37
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition:
JParser.hh:1961
JGrid.hh
JGEOMETRY3D::JVector3D::getY
double getY() const
Get y position.
Definition:
JVector3D.hh:104
debug
int debug
debug level
Definition:
JSirene.cc:63
JGEOMETRY3D::JPosition3D::getPosition
const JPosition3D & getPosition() const
Get position.
Definition:
JPosition3D.hh:130
JACOUSTICS::JMODEL::JString
String parameters.
Definition:
JAcoustics/JModel.hh:47
JMessage.hh
General purpose messaging.
FATAL
#define FATAL(A)
Definition:
JMessage.hh:67
JParser.hh
Utility class to parse command line options.
JTOOLS::JGrid
Simple data structure for an abstract collection of equidistant abscissa values.
Definition:
JGrid.hh:32
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:58
JACOUSTICS::JMechanics
Auxiliary data structure for parameters of mechanical model.
Definition:
JMechanics.hh:39
Generated by
1.8.5