src
RecoTracker
DeDx
interface
GenericTruncatedAverageDeDxEstimator.h
Go to the documentation of this file.
1
#ifndef RecoTrackerDeDx_GenericTruncatedAverageDeDxEstimator_h
2
#define RecoTrackerDeDx_GenericTruncatedAverageDeDxEstimator_h
3
4
#include "
RecoTracker/DeDx/interface/BaseDeDxEstimator.h
"
5
#include "
RecoTracker/DeDx/interface/DeDxTools.h
"
6
#include "
DataFormats/TrackReco/interface/DeDxHit.h
"
7
#include <numeric>
8
9
class
GenericTruncatedAverageDeDxEstimator
:
public
BaseDeDxEstimator
{
10
public
:
11
GenericTruncatedAverageDeDxEstimator
(
const
edm::ParameterSet
& iConfig) {
12
fraction_
= iConfig.
getParameter
<
double
>(
"fraction"
);
13
expo_
= iConfig.
getParameter
<
double
>(
"exponent"
);
14
truncate_
= iConfig.
getParameter
<
bool
>(
"truncate"
);
15
}
16
17
std::pair<float, float>
dedx
(
const
reco::DeDxHitCollection
& Hits)
override
{
18
int
first
= 0,
last
= Hits.size();
19
if
(
truncate_
) {
20
if
(
fraction_
> 0) {
// truncate high charge ones
21
last
-=
int
(Hits.size() *
fraction_
);
22
}
else
if
(
fraction_
< 0) {
23
first
+=
int
(Hits.size() * (-
fraction_
));
24
}
25
}
26
double
sumdedx = 0;
27
for
(
int
i
=
first
;
i
<
last
;
i
++) {
28
sumdedx +=
pow
(Hits[
i
].
charge
(),
expo_
);
29
}
30
double
avrdedx = (
last
-
first
) ?
pow
(sumdedx / (
last
-
first
), 1.0 /
expo_
) : 0.0;
31
return
std::make_pair(avrdedx, -1);
32
}
33
34
private
:
35
float
fraction_
,
expo_
;
36
bool
truncate_
;
37
};
38
39
#endif
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition:
ParameterSet.h:303
mps_fire.i
i
Definition:
mps_fire.py:429
reco::DeDxHitCollection
std::vector< DeDxHit > DeDxHitCollection
Definition:
DeDxHit.h:41
conifer::pow
constexpr int pow(int x)
Definition:
conifer.h:24
GenericTruncatedAverageDeDxEstimator::GenericTruncatedAverageDeDxEstimator
GenericTruncatedAverageDeDxEstimator(const edm::ParameterSet &iConfig)
Definition:
GenericTruncatedAverageDeDxEstimator.h:11
GenericTruncatedAverageDeDxEstimator::truncate_
bool truncate_
Definition:
GenericTruncatedAverageDeDxEstimator.h:36
BaseDeDxEstimator.h
createfilelist.int
int
Definition:
createfilelist.py:10
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition:
ALCARECOTkAlJpsiMuMu_cff.py:47
dqmdumpme.last
last
Definition:
dqmdumpme.py:56
GenericTruncatedAverageDeDxEstimator::expo_
float expo_
Definition:
GenericTruncatedAverageDeDxEstimator.h:35
DeDxHit.h
DeDxTools.h
GenericTruncatedAverageDeDxEstimator
Definition:
GenericTruncatedAverageDeDxEstimator.h:9
GenericTruncatedAverageDeDxEstimator::fraction_
float fraction_
Definition:
GenericTruncatedAverageDeDxEstimator.h:35
dqmdumpme.first
first
Definition:
dqmdumpme.py:55
edm::ParameterSet
Definition:
ParameterSet.h:47
GenericTruncatedAverageDeDxEstimator::dedx
std::pair< float, float > dedx(const reco::DeDxHitCollection &Hits) override
Definition:
GenericTruncatedAverageDeDxEstimator.h:17
BaseDeDxEstimator
Definition:
BaseDeDxEstimator.h:7
Generated for CMSSW Reference Manual by
1.8.14