CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
StripCPEfromTrackAngle.cc
Go to the documentation of this file.
4 
5 #include "vdt/vdtMath.h"
6 
7 float StripCPEfromTrackAngle::stripErrorSquared(const unsigned N, const float uProj, const SiStripDetId::SubDetector loc ) const {
8  if( loc == SiStripDetId::UNKNOWN)
9  throw cms::Exception("StripCPEfromTrackAngle::stripErrorSquared", "Incompatible sub-detector.");
10 
11  auto fun = [&] (float x) -> float { return mLC_P[0]*x*vdt::fast_expf(-x*mLC_P[1])+mLC_P[2];};
12  auto uerr = (N <= 4) ? fun(uProj) : mHC_P[loc-3][0]+float(N)*mHC_P[loc-3][1];
13  return uerr*uerr;
14 }
15 
16 float StripCPEfromTrackAngle::legacyStripErrorSquared(const unsigned N, const float uProj) const {
17  if( (float(N)-uProj) > 3.5f )
18  return float(N*N)/12.f;
19  else {
20  static constexpr float P1=-0.339;
21  static constexpr float P2=0.90;
22  static constexpr float P3=0.279;
23  const float uerr = P1*uProj*vdt::fast_expf(-uProj*P2)+P3;
24  return uerr*uerr;
25  }
26 }
27 
29 localParameters( const SiStripCluster& cluster, const GeomDetUnit& det, const LocalTrajectoryParameters& ltp) const {
30 
31  StripCPE::Param const & p = param(det);
32  SiStripDetId ssdid = SiStripDetId( det.geographicalId() );
33 
34  LocalVector track = ltp.momentum();
35  track *=
36  (track.z()<0) ? std::abs(p.thickness/track.z()) :
37  (track.z()>0) ? -std::abs(p.thickness/track.z()) :
38  p.maxLength/track.mag() ;
39 
40  const unsigned N = cluster.amplitudes().size();
41  const float fullProjection = p.coveredStrips( track+p.drift, ltp.position());
42  float uerr2;
43  if (useLegacyError) {
44  uerr2 = legacyStripErrorSquared(N,std::abs(fullProjection));
45  } else if (maxChgOneMIP < 0.0) {
46  uerr2 = cluster.isMerged() ? legacyStripErrorSquared(N,std::abs(fullProjection)) : stripErrorSquared( N, std::abs(fullProjection),ssdid.subDetector() );
47  } else {
48  float dQdx = siStripClusterTools::chargePerCM(ssdid, cluster, ltp);
49  uerr2 = dQdx > maxChgOneMIP ? legacyStripErrorSquared(N,std::abs(fullProjection)) : stripErrorSquared( N, std::abs(fullProjection),ssdid.subDetector() );
50  }
51  const float strip = cluster.barycenter() - 0.5f*(1.f-p.backplanecorrection) * fullProjection
52  + 0.5f*p.coveredStrips(track, ltp.position());
53 
54  return std::make_pair( p.topology->localPosition(strip, ltp.vector()),
55  p.topology->localError(strip, uerr2, ltp.vector()) );
56 }
57 
float legacyStripErrorSquared(const unsigned N, const float uProj) const
bool isMerged() const
LocalPoint position() const
Local x and y position coordinates.
float thickness
Definition: StripCPE.h:45
StripTopology const * topology
Definition: StripCPE.h:43
float chargePerCM(DetId detid, Iter a, Iter b)
float backplanecorrection
Definition: StripCPE.h:47
#define constexpr
AlgebraicVector5 vector() const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:77
float barycenter() const
double f[11][100]
LocalVector momentum() const
Momentum vector in the local frame.
float coveredStrips(const LocalVector &, const LocalPoint &) const
Definition: StripCPE.cc:76
StripClusterParameterEstimator::LocalValues localParameters(const SiStripCluster &, const GeomDetUnit &, const LocalTrajectoryParameters &) const
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:17
SubDetector subDetector() const
Definition: SiStripDetId.h:114
#define N
Definition: blowfish.cc:9
std::pair< LocalPoint, LocalError > LocalValues
virtual LocalError localError(float strip, float stripErr2) const =0
float maxLength
Definition: StripCPE.h:45
Param const & param(const GeomDetUnit &det) const
Definition: StripCPE.h:51
float fast_expf(float x)
LocalVector drift
Definition: StripCPE.h:44
virtual LocalPoint localPosition(float strip) const =0
Definition: DDAxes.h:10
const std::vector< uint8_t > & amplitudes() const
float stripErrorSquared(const unsigned N, const float uProj, const SiStripDetId::SubDetector loc) const