Jpp
18.2.0-rc.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
examples
JFFT
JSpectrum.cc
Go to the documentation of this file.
1
#include <string>
2
#include <iostream>
3
#include <fstream>
4
#include <iomanip>
5
#include <cmath>
6
7
#include "
JLang/gzstream.h
"
8
#include "
JMath/JConstants.hh
"
9
10
#include "
Jeep/JeepToolkit.hh
"
11
#include "
Jeep/JParser.hh
"
12
#include "
Jeep/JMessage.hh
"
13
14
15
/**
16
* \file
17
* Auxiliary program to generate spectrum for fast Fourier transformation.
18
*
19
* \author mdejong
20
*/
21
int
main
(
int
argc,
char
**argv)
22
{
23
using namespace
std;
24
using namespace
JPP;
25
26
string
outputFile
;
27
size_t
numberOfPoints
;
28
double
frequency;
29
double
binWidth;
30
int
debug
;
31
32
try
{
33
34
JParser<>
zap(
"Auxiliary program to generate spectrum for fast Fourier transformation."
);
35
36
zap[
'o'
] =
make_field
(
outputFile
) =
"waveform.txt"
;
37
zap[
'n'
] =
make_field
(
numberOfPoints
);
38
zap[
'F'
] =
make_field
(frequency);
39
zap[
'B'
] =
make_field
(binWidth);
40
zap[
'd'
] =
make_field
(
debug
) = 2;
41
42
zap(argc, argv);
43
}
44
catch
(
const
exception& error) {
45
FATAL
(error.what() << endl);
46
}
47
48
// output
49
50
ostream* out = open<ostream>(
outputFile
.c_str());
51
52
for
(
size_t
i
= 0;
i
!=
numberOfPoints
; ++
i
) {
53
54
const
double
x
=
i
* binWidth;
55
const
double
y
=
sin
(x * 2*
PI
* frequency);
56
57
*out <<
SCIENTIFIC
(9,6) << y << endl;
58
}
59
60
close
(out);
61
}
62
JPARSER::JParser
Utility class to parse command line options.
Definition:
JParser.hh:1514
main
int main(int argc, char *argv[])
Definition:
Main.cc:15
outputFile
string outputFile
Definition:
JDAQTimesliceSelector.cc:37
sin
then usage set_variable ACOUSTICS_WORKDIR $WORKDIR set_variable FORMULA sin([0]+2 *$PI *([1]+[2]*x)*x)" set_variable DY 1.0e-8 mkdir $WORKDIR for DETECTOR in $DETECTORS[*]
i
then rm i
Definition:
JEvtReweightMupageParameterScan.sh:309
makedeclinationtable.x
tuple x
Definition:
makedeclinationtable.py:44
JConstants.hh
Mathematical constants.
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition:
JParser.hh:1989
JEEP::close
void close(std::istream *pf)
Close file.
Definition:
JeepToolkit.hh:386
JeepToolkit.hh
Auxiliary methods for handling file names, type names and environment.
JMATH::PI
static const double PI
Mathematical constants.
Definition:
JMath/JConstants.hh:20
makedeclinationtable.y
tuple y
Definition:
makedeclinationtable.py:51
JMessage.hh
General purpose messaging.
FATAL
#define FATAL(A)
Definition:
JMessage.hh:67
gzstream.h
JParser.hh
Utility class to parse command line options.
numberOfPoints
int numberOfPoints
Definition:
JResultPDF.cc:22
SCIENTIFIC
Auxiliary data structure for floating point format specification.
Definition:
JManip.hh:484
debug
int debug
debug level
Definition:
archive-put-wiki-detectors.sh:92
Generated by
1.8.5