Jpp
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
examples
JReconstruction
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 "
JReconstruction/JEvtToolkit.hh
"
10
#include "
JReconstruction/JEnergyCorrection.hh
"
11
#include "
JROOT/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:1500
main
int main(int argc, char *argv[])
Definition:
Main.cc:15
JEnergyCorrection.hh
JManager.hh
Dynamic ROOT object management.
outputFile
string outputFile
Definition:
JDAQTimesliceSelector.cc:37
std::vector
Definition:
JSTDTypes.hh:12
JROOT::JManager
Auxiliary class to manage set of compatible ROOT objects (e.g. histograms) using unique keys...
Definition:
JManager.hh:43
JFIT::JEnergyCorrection
Auxiliary class for correction of energy determined by JEnergy.cc.
Definition:
JEnergyCorrection.hh:39
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition:
JParser.hh:1961
JMATH::pow
T pow(const T &x, const double y)
Power .
Definition:
JMath.hh:98
JROOT::JManager::Write
void Write(TDirectory &out, const bool wm=false)
Write objects to file.
Definition:
JManager.hh:295
debug
int debug
debug level
Definition:
JSirene.cc:63
JMessage.hh
General purpose messaging.
FATAL
#define FATAL(A)
Definition:
JMessage.hh:67
JParser.hh
Utility class to parse command line options.
JEvtToolkit.hh
E
then usage $script[input file[working directory[option]]] nWhere option can be E
Definition:
JMuonPostfit.sh:37
DEBUG
#define DEBUG(A)
Message macros.
Definition:
JMessage.hh:62
Generated by
1.8.5