Jpp
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
examples
JFit
JEnergyCorrection.cc
Go to the documentation of this file.
1
#include <string>
2
#include <iostream>
3
#include <iomanip>
4
5
#include "TROOT.h"
6
#include "TFile.h"
7
#include "TH1D.h"
8
9
#include "
JFit/JEvtToolkit.hh
"
10
#include "
JFit/JEnergyCorrection.hh
"
11
#include "
JGizmo/JManager.hh
"
12
13
#include "
Jeep/JParser.hh
"
14
#include "
Jeep/JMessage.hh
"
15
16
17
/**
18
* \file
19
*
20
* Example program to histogram energy corrections.
21
* \author mdejong
22
*/
23
int
main
(
int
argc,
char
**argv)
24
{
25
using namespace
std;
26
27
string
outputFile
;
28
vector<string>
energy_correction;
29
int
debug
;
30
31
try
{
32
33
JParser<>
zap(
"Example program to histogram energy corrections."
);
34
35
zap[
'o'
] =
make_field
(
outputFile
);
36
zap[
'E'
] =
make_field
(energy_correction);
37
zap[
'd'
] =
make_field
(
debug
) = 2;
38
39
zap(argc, argv);
40
}
41
catch
(
const
exception& error) {
42
FATAL
(error.what() << endl);
43
}
44
45
using namespace
JPP;
46
47
JManager<string, TH1D>
zmap(
new
TH1D(
"h[%]"
, NULL, 1000, +2.0, +7.0));
// [log(E)]
48
49
for
(
vector<string>::const_iterator
f1 = energy_correction.begin(); f1 != energy_correction.end(); ++f1) {
50
51
const
JEnergyCorrection fcn(*f1);
52
53
DEBUG
(
"Formula "
<< fcn << endl);
54
55
for
(
int
i = 1; i <= zmap[*f1]->GetNbinsX(); ++i) {
56
57
const
double
x = zmap[*f1]->GetBinCenter (i);
58
const
double
E = pow(10.0, x);
59
const
double
y = fcn(E) / E;
60
61
zmap[*f1]->SetBinContent(i, y);
62
}
63
}
64
65
zmap.
Write
(
outputFile
.c_str());
66
}
JPARSER::JParser
Utility class to parse command line options.
Definition:
JParser.hh:1410
JEvtToolkit.hh
JManager< string, TH1D >
JEnergyCorrection.hh
JManager.hh
Dynamic ROOT object management.
outputFile
string outputFile
Definition:
JDAQTimesliceSelector.cc:37
std::vector
Definition:
JSTDTypes.hh:12
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition:
JParser.hh:1836
debug
int debug
debug level
Definition:
JSirene.cc:59
JMessage.hh
General purpose messaging.
FATAL
#define FATAL(A)
Definition:
JMessage.hh:65
JParser.hh
Utility class to parse command line options.
JManager::Write
void Write(TFile &out)
Write histograms to file.
Definition:
JHistogramToolkit.hh:225
DEBUG
#define DEBUG(A)
Message macros.
Definition:
JMessage.hh:60
main
int main(int argc, char *argv[])
Definition:
Main.cpp:15
Generated by
1.8.5