CMS 3D CMS Logo

StripCPEgeometric.cc
Go to the documentation of this file.
4 #include <numeric>
5 
7  const SiStripCluster& cluster, const GeomDetUnit& det, const LocalTrajectoryParameters& ltp) const {
8  StripCPE::Param const& p = param(det);
9 
10  const LocalPoint& pos = ltp.position();
11  LocalVector track = ltp.momentum();
12  track *= (track.z() < 0) ? fabs(p.thickness / track.z())
13  : (track.z() > 0) ? -fabs(p.thickness / track.z()) : p.maxLength / track.mag();
14 
15  const float fullProjection = p.coveredStrips(track + p.drift, pos);
16  stats_t<float> projection;
17  {
18  const float absProj = fabs(fullProjection);
19  const float minProj = 2 * p.thickness * tan_diffusion_angle / p.topology->localPitch(pos);
20  const float projection_rel_err2 = thickness_rel_err2 + p.pitch_rel_err2;
21  projection = stats_t<float>::from_relative_uncertainty2(std::max(absProj, minProj), projection_rel_err2);
22  }
23 
24  const std::vector<stats_t<float> > Q =
25  reco::InverseCrosstalkMatrix::unfold(cluster, xtalk1[static_cast<int>(p.moduleGeom)]);
26  const stats_t<float> strip = cluster.firstStrip() + offset_from_firstStrip(Q, projection);
27 
28  const float corrected =
29  strip() - 0.5 * (1 - p.backplanecorrection) * fullProjection + 0.5 * p.coveredStrips(track, ltp.position());
30  const float error2 = std::max(strip.error2(), minimum_uncertainty_squared);
31 
32  return std::make_pair(p.topology->localPosition(corrected, ltp.vector()),
33  p.topology->localError(corrected, error2, ltp.vector()));
34 }
35 
37  const stats_t<float>& proj) const {
38  WrappedCluster wc(Q);
39  if (useNPlusOne(wc, proj))
41  else
42  while (useNMinusOne(wc, proj))
44 
45  if (proj() < wc.N - 2)
46  return stats_t<float>(wc.middle(), pow(wc.N - proj(), 2) / 12.);
47  if (wc.deformed())
48  return stats_t<float>(wc.centroid()(), 1 / 12.);
49  if (proj > wc.maxProjection())
50  return stats_t<float>(wc.centroid()(), 1 / 12.);
51 
52  if (ambiguousSize(wc, proj)) {
53  const stats_t<float> probably = geometric_position(wc, proj);
55  const stats_t<float> maybe = geometric_position(wc, proj);
56  return stats_t<float>(probably(),
57  std::max(probably.error2(), float(maybe.error2() + pow(probably() - maybe(), 2) / 12)));
58  }
59  return geometric_position(wc, proj);
60 }
61 
63  const stats_t<float>& proj) const {
64  const stats_t<float> x = wc.middle() + 0.5 * proj * wc.eta();
65  return wc.N == 1 ? stats_t<float>(x(), pow(1 - 0.82 * proj(), 2) / 12)
67 }
68 
69 inline bool StripCPEgeometric::useNPlusOne(const WrappedCluster& wc, const stats_t<float>& proj) const {
70  return wc.maxProjection() < proj && proj() < wc.N + 1;
71 }
72 
73 inline bool StripCPEgeometric::useNMinusOne(const WrappedCluster& wc, const stats_t<float>& proj) const {
74  if (proj() > wc.N - 1)
75  return false;
76  if (wc.smallerEdgeStrip() < 0)
77  return true;
78  if (proj() < wc.N - 3)
79  return false;
80  if (proj() < wc.N - 2)
81  return true;
82  if (wc.eta().sigmaFrom(0) < 3)
83  return false;
84 
85  WrappedCluster wcTest(wc);
86  wcTest.dropSmallerEdgeStrip();
87  if (proj >= wcTest.maxProjection())
88  return false;
89  if (wc.sign() * wc.eta()() > 1. / (wc.N - 1))
90  return true;
91 
92  return wc.smallerEdgeStrip().sigmaFrom(0) < noise_threshold;
93 }
94 
96  return proj() < wc.N - 1 && wc.smallerEdgeStrip()() > 0 && wc.smallerEdgeStrip().sigmaFrom(0) < maybe_noise_threshold;
97 }
98 
100  : N(Q.size() - 2), clusterFirst(Q.begin() + 1), first(clusterFirst) {}
101 
103  if (eta().sigmaFrom(0) < 1) {
104  first--;
105  N += 2;
106  } else if (*first > last()) {
107  first--;
108  N += 1;
109  } else {
110  N += 1;
111  }
112 }
113 
115  if (*first < last()) {
116  first++;
117  N -= 1;
118  } else if (last() < *first) {
119  N -= 1;
120  } else {
121  first++;
122  N -= 2;
123  }
124 }
125 
126 inline float StripCPEgeometric::WrappedCluster::middle() const { return (first - clusterFirst) + N / 2.; }
127 
129  stats_t<float> sumXQ(0);
130  for (std::vector<stats_t<float> >::const_iterator i = first; i < first + N; i++)
131  sumXQ += (i - clusterFirst) * (*i);
132  return sumXQ / sumQ() + 0.5;
133 }
134 
136  return accumulate(first, first + N, stats_t<float>(0));
137 }
138 
140 
142  return N > 2 && std::max((*first)(), last()()) > accumulate(first + 1, first + N - 1, stats_t<float>(0))() / (N - 2);
143 }
144 
146  return N * (1 + sign() * eta()).inverse();
147 }
148 
150 
151 inline int StripCPEgeometric::WrappedCluster::sign() const { return (*first < last()) ? 1 : -1; }
std::pair< LocalPoint, LocalError > LocalValues
size
Write out results.
StripClusterParameterEstimator::LocalValues localParameters(const SiStripCluster &, const GeomDetUnit &, const LocalTrajectoryParameters &) const override
WrappedCluster(const std::vector< stats_t< float > > &)
float pitch_rel_err2
Definition: StripCPE.h:37
LocalPoint position() const
Local x and y position coordinates.
float thickness
Definition: StripCPE.h:37
virtual LocalError localError(float strip, float stripErr2) const =0
StripTopology const * topology
Definition: StripCPE.h:35
stats_t< float > smallerEdgeStrip() const
const float scaling_squared
T error2() const
uint16_t firstStrip() const
float backplanecorrection
Definition: StripCPE.h:39
stats_t< float > centroid() const
AlgebraicVector5 vector() const
stats_t< float > geometric_position(const WrappedCluster &, const stats_t< float > &) const
std::vector< float > xtalk1
Definition: StripCPE.h:78
T mag() const
Definition: PV3DBase.h:64
virtual LocalPoint localPosition(float strip) const =0
static stats_t from_relative_uncertainty2(T q, T re2)
T z() const
Definition: PV3DBase.h:61
stats_t< float > sumQ() const
stats_t< float > offset_from_firstStrip(const std::vector< stats_t< float > > &, const stats_t< float > &) const
static std::vector< stats_t< float > > unfold(const SiStripCluster &q, const float x)
LocalVector momentum() const
Momentum vector in the local frame.
T min(T a, T b)
Definition: MathUtil.h:58
float coveredStrips(const LocalVector &, const LocalPoint &) const
Definition: StripCPE.cc:77
const float maybe_noise_threshold
#define N
Definition: blowfish.cc:9
bool useNPlusOne(const WrappedCluster &, const stats_t< float > &) const
virtual float localPitch(const LocalPoint &) const =0
const float minimum_uncertainty_squared
bool ambiguousSize(const WrappedCluster &, const stats_t< float > &) const
const float tan_diffusion_angle
#define begin
Definition: vmac.h:32
float maxLength
Definition: StripCPE.h:37
Param const & param(const GeomDetUnit &det) const
Definition: StripCPE.h:81
LocalVector drift
Definition: StripCPE.h:36
SiStripModuleGeometry moduleGeom
Definition: StripCPE.h:40
const float thickness_rel_err2
const stats_t< float > & last() const
const float noise_threshold
stats_t< float > maxProjection() const
std::vector< stats_t< float > >::const_iterator first
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:30
std::vector< stats_t< float > >::const_iterator clusterFirst
bool useNMinusOne(const WrappedCluster &, const stats_t< float > &) const