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)
66  : stats_t<float>(x(), scaling_squared * x.error2());
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; }
Vector3DBase< float, LocalTag >
reco::InverseCrosstalkMatrix::unfold
static std::vector< stats_t< float > > unfold(const SiStripCluster &q, const float x)
Definition: CrosstalkInversion.cc:7
StripCPEgeometric::WrappedCluster
Definition: StripCPEgeometric.h:33
mps_fire.i
i
Definition: mps_fire.py:428
StripCPEgeometric::WrappedCluster::smallerEdgeStrip
stats_t< float > smallerEdgeStrip() const
Definition: StripCPEgeometric.cc:149
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11713
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
StripCPEgeometric::WrappedCluster::eta
stats_t< float > eta() const
Definition: StripCPEgeometric.cc:139
StripCPEgeometric::WrappedCluster::WrappedCluster
WrappedCluster(const std::vector< stats_t< float > > &)
Definition: StripCPEgeometric.cc:99
GeomDet
Definition: GeomDet.h:27
StripCPEgeometric::WrappedCluster::addSuppressedEdgeStrip
void addSuppressedEdgeStrip()
Definition: StripCPEgeometric.cc:102
min
T min(T a, T b)
Definition: MathUtil.h:58
StripCPEgeometric::geometric_position
stats_t< float > geometric_position(const WrappedCluster &, const stats_t< float > &) const
Definition: StripCPEgeometric.cc:62
StripCPEgeometric::WrappedCluster::centroid
stats_t< float > centroid() const
Definition: StripCPEgeometric.cc:128
digitizers_cfi.strip
strip
Definition: digitizers_cfi.py:19
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
pos
Definition: PixelAliasList.h:18
StripCPEgeometric::ambiguousSize
bool ambiguousSize(const WrappedCluster &, const stats_t< float > &) const
Definition: StripCPEgeometric.cc:95
StripCPEgeometric::WrappedCluster::N
uint16_t N
Definition: StripCPEgeometric.h:46
Validation_hcalonly_cfi.sign
sign
Definition: Validation_hcalonly_cfi.py:32
DDAxes::x
StripCPEgeometric::offset_from_firstStrip
stats_t< float > offset_from_firstStrip(const std::vector< stats_t< float > > &, const stats_t< float > &) const
Definition: StripCPEgeometric.cc:36
StripCPE::param
Param const & param(const GeomDetUnit &det) const
Definition: StripCPE.h:81
StripCPEgeometric.h
StripTopology.h
dqmdumpme.first
first
Definition: dqmdumpme.py:55
hcaldqm::utilities::sumQ
double sumQ(DIGI const &digi, double ped, int i=0, int j=3)
Definition: Utilities.h:126
stats_t
Definition: ErrorPropogationTypes.h:38
class-composition.Q
Q
Definition: class-composition.py:82
SiStripCluster::firstStrip
uint16_t firstStrip() const
Definition: SiStripCluster.h:47
LocalTrajectoryParameters
Definition: LocalTrajectoryParameters.h:25
StripCPE::xtalk1
std::vector< float > xtalk1
Definition: StripCPE.h:78
stats_t::error2
T error2() const
Definition: ErrorPropogationTypes.h:107
dqmdumpme.last
last
Definition: dqmdumpme.py:56
StripCPEgeometric::WrappedCluster::maxProjection
stats_t< float > maxProjection() const
Definition: StripCPEgeometric.cc:145
LocalTrajectoryParameters::position
LocalPoint position() const
Local x and y position coordinates.
Definition: LocalTrajectoryParameters.h:85
StripCPEgeometric::scaling_squared
const float scaling_squared
Definition: StripCPEgeometric.h:30
PVValHelper::eta
Definition: PVValidationHelpers.h:69
stats_t::from_relative_uncertainty2
static stats_t from_relative_uncertainty2(T q, T re2)
Definition: ErrorPropogationTypes.h:57
N
#define N
Definition: blowfish.cc:9
StripCPEgeometric::localParameters
StripClusterParameterEstimator::LocalValues localParameters(const SiStripCluster &, const GeomDetUnit &, const LocalTrajectoryParameters &) const override
Definition: StripCPEgeometric.cc:6
LocalTrajectoryParameters::vector
AlgebraicVector5 vector() const
Definition: LocalTrajectoryParameters.h:120
Point3DBase< float, LocalTag >
StripCPEgeometric::WrappedCluster::dropSmallerEdgeStrip
void dropSmallerEdgeStrip()
Definition: StripCPEgeometric.cc:114
StripCPEgeometric::WrappedCluster::sumQ
stats_t< float > sumQ() const
Definition: StripCPEgeometric.cc:135
amptDefault_cfi.proj
proj
Definition: amptDefault_cfi.py:13
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
StripCPEgeometric::WrappedCluster::deformed
bool deformed() const
Definition: StripCPEgeometric.cc:141
StripCPE::Param
Definition: StripCPE.h:33
StripCPEgeometric::tan_diffusion_angle
const float tan_diffusion_angle
Definition: StripCPEgeometric.h:30
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
StripCPEgeometric::minimum_uncertainty_squared
const float minimum_uncertainty_squared
Definition: StripCPEgeometric.h:30
LocalTrajectoryParameters::momentum
LocalVector momentum() const
Momentum vector in the local frame.
Definition: LocalTrajectoryParameters.h:88
StripCPEgeometric::WrappedCluster::sign
int sign() const
Definition: StripCPEgeometric.cc:151
StripCPEgeometric::maybe_noise_threshold
const float maybe_noise_threshold
Definition: StripCPEgeometric.h:30
StripCPEgeometric::useNMinusOne
bool useNMinusOne(const WrappedCluster &, const stats_t< float > &) const
Definition: StripCPEgeometric.cc:73
StripCPEgeometric::useNPlusOne
bool useNPlusOne(const WrappedCluster &, const stats_t< float > &) const
Definition: StripCPEgeometric.cc:69
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
StripCPEgeometric::noise_threshold
const float noise_threshold
Definition: StripCPEgeometric.h:30
StripClusterParameterEstimator::LocalValues
std::pair< LocalPoint, LocalError > LocalValues
Definition: StripClusterParameterEstimator.h:27
StripCPEgeometric::WrappedCluster::middle
float middle() const
Definition: StripCPEgeometric.cc:126
CrosstalkInversion.h
StripCPEgeometric::thickness_rel_err2
const float thickness_rel_err2
Definition: StripCPEgeometric.h:30
SiStripCluster
Definition: SiStripCluster.h:9
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443