Jpp
18.3.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
JPhysics
JGeane.cc
Go to the documentation of this file.
1
#include <string>
2
#include <iostream>
3
4
#include "TROOT.h"
5
#include "TFile.h"
6
#include "TH1D.h"
7
#include "TH2D.h"
8
9
#include "
JPhysics/JGeane.hh
"
10
11
#include "
Jeep/JParser.hh
"
12
#include "
Jeep/JMessage.hh
"
13
14
15
/**
16
* \file
17
*
18
* Example program to histogram muon energy loss.
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
int
debug
;
28
29
try
{
30
31
JParser<>
zap(
"Example program to histogram muon energy loss."
);
32
33
zap[
'o'
] =
make_field
(
outputFile
) =
"geane.root"
;
34
zap[
'd'
] =
make_field
(
debug
) = 2;
35
36
zap(argc, argv);
37
}
38
catch
(
const
exception &error) {
39
FATAL
(error.what() << endl);
40
}
41
42
43
TFile out(
outputFile
.c_str(),
"recreate"
);
44
45
TH1D h1(
"h1"
, NULL, 900, -1.0, +8.0);
46
TH2D h2(
"h2"
, NULL, 90, -1.0, +8.0, 100, 0.0, 5.0);
47
48
for
(
int
i
= 1;
i
<= h1.GetNbinsX(); ++
i
) {
49
50
const
double
x
= h1.GetBinCenter(
i
);
51
const
double
E
=
pow
(10.0, x);
52
53
h1.Fill(x,
gWater
(E));
54
}
55
56
for
(
int
ix = 1; ix <= h2.GetXaxis()->GetNbins(); ++ix) {
57
for
(
int
iy = 1; iy <= h2.GetYaxis()->GetNbins(); ++iy) {
58
59
const
double
x
= h2.GetXaxis()->GetBinCenter(ix);
60
const
double
y
= h2.GetYaxis()->GetBinCenter(iy);
61
62
const
double
E
=
pow
(10.0, x);
63
const
double
dx =
pow
(10.0, y);
64
65
h2.Fill(x, y,
gWater
(E, dx));
66
}
67
}
68
69
out.Write();
70
out.Close();
71
}
JPARSER::JParser
Utility class to parse command line options.
Definition:
JParser.hh:1514
main
int main(int argc, char *argv[])
Definition:
Main.cc:15
E
then usage $script< input file >[option[primary[working directory]]] nWhere option can be E
Definition:
JMuonPostfit.sh:40
JGeane.hh
Energy loss of muon.
JPHYSICS::gWater
static const JGeaneWater gWater
Function object for energy loss of muon in sea water.
Definition:
JGeane.hh:381
outputFile
string outputFile
Definition:
JDAQTimesliceSelector.cc:37
i
then rm i
Definition:
JEvtReweightMupageParameterScan.sh:309
makedeclinationtable.x
tuple x
Definition:
makedeclinationtable.py:44
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition:
JParser.hh:1989
JMATH::pow
T pow(const T &x, const double y)
Power .
Definition:
JMath.hh:97
makedeclinationtable.y
tuple y
Definition:
makedeclinationtable.py:51
JMessage.hh
General purpose messaging.
FATAL
#define FATAL(A)
Definition:
JMessage.hh:67
JParser.hh
Utility class to parse command line options.
debug
int debug
debug level
Definition:
archive-put-wiki-detectors.sh:92
Generated by
1.8.5