RecoTracker
DeDx
interface
UnbinnedFitDeDxEstimator.h
Go to the documentation of this file.
1
#ifndef RecoTrackerDeDx_UnbinnedFitDeDxEstimator_h
2
#define RecoTrackerDeDx_UnbinnedFitDeDxEstimator_h
3
4
#include "
DataFormats/TrackReco/interface/DeDxHit.h
"
5
#include "
RecoTracker/DeDx/interface/BaseDeDxEstimator.h
"
6
#include "
RecoTracker/DeDx/interface/DeDxTools.h
"
7
#include "
RecoTracker/DeDx/interface/UnbinnedLikelihoodFit.h
"
8
9
#include <TF1.h>
10
11
#include <iostream>
12
#include <vector>
13
14
class
UnbinnedFitDeDxEstimator
:
public
BaseDeDxEstimator
{
15
public
:
16
UnbinnedFitDeDxEstimator
(
const
edm::ParameterSet
& iConfig) {
17
fitter
.
setFunction
((
f1
=
new
TF1
(
"myLandau"
,
"TMath::Landau(x,[0],[1],1)"
, 0, 255)));
18
}
19
20
~UnbinnedFitDeDxEstimator
()
override
{
21
// clean up everything
22
delete
f1
;
23
}
24
25
std::pair<float, float>
dedx
(
const
reco::DeDxHitCollection
& Hits)
override
{
26
// if there is no hit, returns invalid.
27
if
(Hits.empty())
28
return
std::make_pair(-1, -1);
29
// sets the initial parameters
30
f1
->SetParameters(3.0, 0.3);
31
// fills a temporary array and performs the fit
32
uint32_t
i
= 0;
33
for
(reco::DeDxHitCollection::const_iterator
hit
= Hits.begin();
hit
!= Hits.end(); ++
hit
, ++
i
) {
34
data
[
i
] =
hit
->charge();
35
}
36
// fit !
37
fitter
.
fit
(Hits.size(),
data
);
38
// returns the mpv and its error
39
return
std::make_pair(
f1
->GetParameter(0),
f1
->GetParError(0));
40
}
41
42
// ----------member data ---------------------------
43
double
data
[50];
44
TF1
*
f1
;
45
UnbinnedLikelihoodFit
fitter
;
46
};
47
48
#endif
mps_fire.i
i
Definition:
mps_fire.py:355
UnbinnedLikelihoodFit.h
UnbinnedFitDeDxEstimator::f1
TF1 * f1
Definition:
UnbinnedFitDeDxEstimator.h:44
reco::DeDxHitCollection
std::vector< DeDxHit > DeDxHitCollection
Definition:
DeDxHit.h:41
UnbinnedFitDeDxEstimator::fitter
UnbinnedLikelihoodFit fitter
Definition:
UnbinnedFitDeDxEstimator.h:45
tools.TF1
TF1
Definition:
tools.py:23
DeDxHit.h
DeDxTools.h
UnbinnedFitDeDxEstimator::data
double data[50]
Definition:
UnbinnedFitDeDxEstimator.h:43
UnbinnedFitDeDxEstimator::~UnbinnedFitDeDxEstimator
~UnbinnedFitDeDxEstimator() override
Definition:
UnbinnedFitDeDxEstimator.h:20
BaseDeDxEstimator.h
edm::ParameterSet
Definition:
ParameterSet.h:36
UnbinnedLikelihoodFit::fit
int32_t fit(int32_t verbosity=-1)
Definition:
UnbinnedLikelihoodFit.cc:56
UnbinnedFitDeDxEstimator::UnbinnedFitDeDxEstimator
UnbinnedFitDeDxEstimator(const edm::ParameterSet &iConfig)
Definition:
UnbinnedFitDeDxEstimator.h:16
UnbinnedLikelihoodFit
Definition:
UnbinnedLikelihoodFit.h:24
BaseDeDxEstimator
Definition:
BaseDeDxEstimator.h:7
UnbinnedFitDeDxEstimator
Definition:
UnbinnedFitDeDxEstimator.h:14
UnbinnedFitDeDxEstimator::dedx
std::pair< float, float > dedx(const reco::DeDxHitCollection &Hits) override
Definition:
UnbinnedFitDeDxEstimator.h:25
UnbinnedLikelihoodFit::setFunction
void setFunction(TF1 *f)
Definition:
UnbinnedLikelihoodFit.cc:50
hit
Definition:
SiStripHitEffFromCalibTree.cc:88
Generated for CMSSW Reference Manual by
1.8.16