RecoLocalTracker
SiStripRecHitConverter
src
CrosstalkInversion.cc
Go to the documentation of this file.
1
#include "
RecoLocalTracker/SiStripRecHitConverter/interface/CrosstalkInversion.h
"
2
#include "
DataFormats/SiStripCluster/interface/SiStripCluster.h
"
3
#include "
FWCore/Utilities/interface/isFinite.h
"
4
5
namespace
reco
{
6
7
std::vector<stats_t<float> >
InverseCrosstalkMatrix::unfold
(
const
SiStripCluster
& clus,
const
float
x) {
8
auto
const
&
q
= clus.
amplitudes
();
9
const
stats_t<float>
suppressed(-5, 100);
10
const
stats_t<float>
saturated(254, 400);
11
#define STATS(value) ((value < 254) ? stats_t<float>(value) : saturated)
12
13
const
unsigned
N
=
q
.size();
14
std::vector<stats_t<float> >
Q
(
N
+ 2,
stats_t<float>
(0));
15
Q
[0] =
Q
[
N
+ 1] = suppressed;
16
17
if
(
N
== 1)
//optimize N==1
18
Q
[1] =
STATS
(
q
[0]) / (1 - 2 * x);
19
else
if
(
N
== 2) {
//optimize N==2
20
const
double
A
= 1 - 2 * x;
21
const
stats_t<float>
q0
=
STATS
(
q
[0]);
22
const
stats_t<float>
q1
=
STATS
(
q
[1]);
23
Q
[1] = (
A
*
q0
- x *
q1
) / (
A
*
A
- x * x);
24
Q
[2] = (
A
*
q1
- x *
q0
) / (
A
*
A
- x * x);
25
}
else
{
//general case
26
const
InverseCrosstalkMatrix
inverse(
N
, x);
27
for
(
unsigned
i
= 0;
i
< (
N
+ 1) / 2;
i
++) {
28
for
(
unsigned
j
=
i
;
j
<
N
-
i
;
j
++) {
29
const
float
Cij = inverse(
i
+ 1,
j
+ 1);
30
Q
[
i
+ 1] += Cij *
STATS
(
q
[
j
]);
31
if
(
i
!=
j
)
32
Q
[
j
+ 1] += Cij *
STATS
(
q
[
i
]);
33
if
(
N
!=
i
+
j
+ 1) {
34
Q
[
N
-
i
] += Cij *
STATS
(
q
[
N
-
j
- 1]);
35
if
(
i
!=
j
)
36
Q
[
N
-
j
] += Cij *
STATS
(
q
[
N
-
i
- 1]);
37
}
38
}
39
}
40
}
41
#undef STATS
42
return
Q
;
43
}
44
45
InverseCrosstalkMatrix::InverseCrosstalkMatrix
(
const
unsigned
N
,
const
float
x)
46
:
N
(x > 0 ?
N
: 0),
47
sq(
sqrt
(-x * 4 + 1)),
48
lambdaP(1 + (1 + sq) / (-x * 2)),
49
lambdaM(1 + (1 - sq) / (-x * 2)),
50
denominator
(sq * (
pow
(lambdaP,
N
+ 1) -
pow
(lambdaM,
N
+ 1))) {}
51
52
float
InverseCrosstalkMatrix::operator()
(
const
unsigned
i
,
const
unsigned
j
)
const
{
53
return
N
== 0 ||
edm::isNotFinite
(
denominator
) ?
i
==
j
:
i
>=
j
?
element
(
i
,
j
) :
element
(
j
,
i
);
54
}
55
56
inline
float
InverseCrosstalkMatrix::element
(
const
unsigned
i
,
const
unsigned
j
)
const
{
57
return
(
pow
(
lambdaM
,
N
+ 1 -
i
) -
pow
(
lambdaP
,
N
+ 1 -
i
)) * (
pow
(
lambdaM
,
j
) -
pow
(
lambdaP
,
j
)) /
denominator
;
58
}
59
60
}
// namespace reco
reco::InverseCrosstalkMatrix::unfold
static std::vector< stats_t< float > > unfold(const SiStripCluster &q, const float x)
Definition:
CrosstalkInversion.cc:7
mps_fire.i
i
Definition:
mps_fire.py:428
STATS
#define STATS(value)
edm::isNotFinite
constexpr bool isNotFinite(T x)
Definition:
isFinite.h:9
reco::InverseCrosstalkMatrix::operator()
float operator()(const unsigned i, const unsigned j) const
Definition:
CrosstalkInversion.cc:52
reco::InverseCrosstalkMatrix
Definition:
CrosstalkInversion.h:13
reco
fixed size matrix
Definition:
AlignmentAlgorithmBase.h:45
stats_t
Definition:
ErrorPropogationTypes.h:38
class-composition.Q
Q
Definition:
class-composition.py:82
reco::InverseCrosstalkMatrix::N
const unsigned N
Definition:
CrosstalkInversion.h:20
mathSSE::sqrt
T sqrt(T t)
Definition:
SSEVec.h:19
N
#define N
Definition:
blowfish.cc:9
reco::InverseCrosstalkMatrix::lambdaP
const double lambdaP
Definition:
CrosstalkInversion.h:21
reco::InverseCrosstalkMatrix::InverseCrosstalkMatrix
InverseCrosstalkMatrix(const unsigned N, const float x)
Definition:
CrosstalkInversion.cc:45
q1
double q1[4]
Definition:
TauolaWrapper.h:87
SiStripCluster.h
A
reco::InverseCrosstalkMatrix::lambdaM
const double lambdaM
Definition:
CrosstalkInversion.h:21
submitPVResolutionJobs.q
q
Definition:
submitPVResolutionJobs.py:84
SiStripCluster::amplitudes
SiStripCluster const & amplitudes() const
Definition:
SiStripCluster.h:68
reco::InverseCrosstalkMatrix::denominator
const double denominator
Definition:
CrosstalkInversion.h:21
HLTTauDQMOffline_cfi.denominator
denominator
Definition:
HLTTauDQMOffline_cfi.py:180
isFinite.h
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition:
Power.h:29
dqmiolumiharvest.j
j
Definition:
dqmiolumiharvest.py:66
CrosstalkInversion.h
SiStripCluster
Definition:
SiStripCluster.h:8
reco::InverseCrosstalkMatrix::element
float element(const unsigned, const unsigned) const
Definition:
CrosstalkInversion.cc:56
SiStripMonitorCluster_cfi.q0
q0
Definition:
SiStripMonitorCluster_cfi.py:241
Generated for CMSSW Reference Manual by
1.8.16