FastSimulation
Utilities
interface
HistogramGenerator.h
Go to the documentation of this file.
1
#ifndef HistogramGenerator_H
2
#define HistogramGenerator_H
3
#include "
FastSimulation/Utilities/interface/BaseNumericalRandomGenerator.h
"
4
5
#include "TH1.h"
6
11
class
RandomEngine;
12
class
TAxis;
13
14
class
HistogramGenerator
:
public
BaseNumericalRandomGenerator
{
15
public
:
17
HistogramGenerator
(TH1*
histo
)
18
:
BaseNumericalRandomGenerator
(
histo
->GetXaxis()->GetXmin(),
histo
->GetXaxis()->GetXmax(), 100000, 3),
19
myHisto
(
histo
),
20
theXaxis
(
histo
->GetXaxis()),
21
nbins
(
histo
->GetXaxis()->GetNbins()) {
22
// std::cout << "Old xmin/xmax = " << xmin << " " << xmax << std::endl;
23
// Drop lowest and highest empty bins
24
double
du = (
xmax
-
xmin
) / (
float
)
nbins
;
25
// Restrict xmin to meaningful values
26
while
(
function
(
xmin
) <= 0.)
27
xmin
+= du;
28
// Restrict xmax to meaningful values
29
while
(
function
(
xmax
) <= 0.)
30
xmax
-= du;
31
32
if
(
xmin
!=
histo
->GetXaxis()->GetXmin())
33
xmin
-= du;
34
if
(
xmax
!=
histo
->GetXaxis()->GetXmax())
35
xmax
+= du;
36
37
// std::cout << "New xmin/xmax = " << xmin << " " << xmax << std::endl;
38
39
// std::cout <<" Init " << std::endl;
40
initialize
();
41
}
42
44
~HistogramGenerator
()
override
{}
45
47
double
function
(
double
x
)
override
{
return
ersatzt
(
x
); }
48
49
private
:
51
TH1*
myHisto
;
52
54
TAxis*
theXaxis
;
55
57
int
nbins
;
58
60
double
ersatzt
(
double
x
);
61
};
62
#endif
HistogramGenerator::myHisto
TH1 * myHisto
Pointer to the histogram.
Definition:
HistogramGenerator.h:51
HistogramGenerator::HistogramGenerator
HistogramGenerator(TH1 *histo)
Constructor : initialization of the Random Generator.
Definition:
HistogramGenerator.h:17
timingPdfMaker.histo
histo
Definition:
timingPdfMaker.py:278
DDAxes::x
BaseNumericalRandomGenerator::initialize
void initialize()
The initialization (numerical integarion, inversion)
Definition:
BaseNumericalRandomGenerator.cc:13
BaseNumericalRandomGenerator::xmin
double xmin
Definition:
BaseNumericalRandomGenerator.h:60
BaseNumericalRandomGenerator.h
HistogramGenerator::ersatzt
double ersatzt(double x)
Gamma Function.
Definition:
HistogramGenerator.cc:5
HistogramGenerator::nbins
int nbins
n bins
Definition:
HistogramGenerator.h:57
HistogramGenerator::~HistogramGenerator
~HistogramGenerator() override
Default destructor.
Definition:
HistogramGenerator.h:44
BaseNumericalRandomGenerator::xmax
double xmax
Definition:
BaseNumericalRandomGenerator.h:60
HistogramGenerator::theXaxis
TAxis * theXaxis
the axis
Definition:
HistogramGenerator.h:54
BaseNumericalRandomGenerator
Definition:
BaseNumericalRandomGenerator.h:27
HistogramGenerator
Definition:
HistogramGenerator.h:14
Generated for CMSSW Reference Manual by
1.8.16