Jpp
18.3.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
JReconstruction
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/JeepToolkit.hh
"
14
#include "
Jeep/JParser.hh
"
15
#include "
Jeep/JMessage.hh
"
16
17
18
/**
19
* \file
20
*
21
* Example program to histogram energy corrections.
22
* \author mdejong
23
*/
24
int
main
(
int
argc,
char
**argv)
25
{
26
using namespace
std;
27
using namespace
JPP;
28
29
string
outputFile
;
30
vector<string>
energy_correction;
31
int
debug
;
32
33
try
{
34
35
JParser<>
zap(
"Example program to histogram energy corrections."
);
36
37
zap[
'o'
] =
make_field
(
outputFile
);
38
zap[
'E'
] =
make_field
(energy_correction);
39
zap[
'd'
] =
make_field
(
debug
) = 2;
40
41
zap(argc, argv);
42
}
43
catch
(
const
exception& error) {
44
FATAL
(error.what() << endl);
45
}
46
47
48
JManager<string, TH1D> zmap(
new
TH1D(
"h[%]"
, NULL, 1000, +2.0, +7.0));
// [log(E)]
49
50
for
(
vector<string>::const_iterator
f1
= energy_correction.begin();
f1
!= energy_correction.end(); ++
f1
) {
51
52
const
JEnergyCorrection fcn(*
f1
);
53
54
DEBUG
(
getFilename
(*
f1
) << endl << fcn << endl);
55
56
for
(
int
i
= 1;
i
<= zmap->GetNbinsX(); ++
i
) {
57
58
const
double
x
= zmap->GetBinCenter (
i
);
59
const
double
E
=
pow
(10.0, x);
60
const
double
y
= fcn(E) /
E
;
61
62
zmap[
getFilename
(*
f1
)]->SetBinContent(
i
, y);
63
}
64
}
65
66
zmap.Write(
outputFile
.c_str());
67
}
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
JEnergyCorrection.hh
JManager.hh
Dynamic ROOT object management.
outputFile
string outputFile
Definition:
JDAQTimesliceSelector.cc:37
std::vector
Definition:
JSTDTypes.hh:12
GAUSS_LEGENDRE::f1
const JPolynome f1(1.0, 2.0, 3.0)
Function.
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
JeepToolkit.hh
Auxiliary methods for handling file names, type names and environment.
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.
JEvtToolkit.hh
JEEP::getFilename
std::string getFilename(const std::string &file_name)
Get file name part, i.e. part after last JEEP::PATHNAME_SEPARATOR if any.
Definition:
JeepToolkit.hh:128
debug
int debug
debug level
Definition:
archive-put-wiki-detectors.sh:92
DEBUG
#define DEBUG(A)
Message macros.
Definition:
JMessage.hh:62
Generated by
1.8.5