CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
RZLine Class Reference

#include <RZLine.h>

Classes

struct  ErrZ2_tag
 

Public Member Functions

float chi2 () const
 
float cotTheta () const
 
float covii () const
 
float covsi () const
 
float covss () const
 
float intercept () const
 
template<typename P , typename E , typename B >
 RZLine (const P &points, const E &errors, const B &isBarrel)
 
template<size_t N>
 RZLine (const std::array< float, N > &r, const std::array< float, N > &z, const std::array< float, N > &errZ)
 
 RZLine (const std::vector< float > &r, const std::vector< float > &z, const std::vector< float > &errZ)
 
template<typename T >
 RZLine (const T &r, const T &z, const T &errZ2, ErrZ2_tag)
 

Private Member Functions

template<typename R , typename Z , typename E >
void calculate (const R &r, const Z &z, const E &errZ2)
 
template<typename T >
T sqr (T t)
 

Private Attributes

float chi2_
 
float cotTheta_
 
float covii_
 
float covsi_
 
float covss_
 
float intercept_
 

Detailed Description

Definition at line 12 of file RZLine.h.

Constructor & Destructor Documentation

◆ RZLine() [1/4]

template<typename P , typename E , typename B >
RZLine::RZLine ( const P points,
const E &  errors,
const B &  isBarrel 
)
inline

Constructor for containers of GlobalPoint, GlobalError, and bool

Template Parameters
PContainer of GlobalPoint
EContainer of GlobalError
BContainer of bool

Container can be e.g. std::vector, std::array, or DynArray.

Although for std::array use this constructor could be specialized to use std::array instead of DynArray for temporary storage.

Definition at line 29 of file RZLine.h.

29  {
30  const size_t n = points.size();
31  declareDynArray(float, n, r);
32  declareDynArray(float, n, z);
33  declareDynArray(float, n, errZ2);
34  for (size_t i = 0; i < n; ++i) {
35  const GlobalPoint& p = points[i];
36  r[i] = p.perp();
37  z[i] = p.z();
38  }
39 
40  float simpleCot2 = sqr((z[n - 1] - z[0]) / (r[n - 1] - r[0]));
41  for (size_t i = 0; i < n; ++i) {
42  errZ2[i] = (isBarrel[i]) ? errors[i].czz() : errors[i].rerr(points[i]) * simpleCot2;
43  }
44 
45  calculate(r, z, errZ2);
46  }

References calculate(), declareDynArray, mps_fire::i, PixelPluginsPhase0_cfi::isBarrel, dqmiodumpmetadata::n, AlCaHLTBitMon_ParallelJobs::p, HLT_FULL_cff::points, alignCSCRings::r, sqr(), and z.

◆ RZLine() [2/4]

RZLine::RZLine ( const std::vector< float > &  r,
const std::vector< float > &  z,
const std::vector< float > &  errZ 
)
inline

Constructor for std::vector of r, z, and z standard deviation

Definition at line 51 of file RZLine.h.

51  {
52  const size_t n = errZ.size();
53  declareDynArray(float, n, errZ2);
54  for (size_t i = 0; i < n; ++i)
55  errZ2[i] = sqr(errZ[i]);
56  calculate(r, z, errZ2);
57  }

References calculate(), declareDynArray, fftjetvertexadder_cfi::errZ, mps_fire::i, dqmiodumpmetadata::n, alignCSCRings::r, sqr(), and z.

◆ RZLine() [3/4]

template<size_t N>
RZLine::RZLine ( const std::array< float, N > &  r,
const std::array< float, N > &  z,
const std::array< float, N > &  errZ 
)
inline

Constructor for std::array of r, z, and z standard deviation

Definition at line 63 of file RZLine.h.

63  {
64  std::array<float, N> errZ2;
65  for (size_t i = 0; i < N; ++i)
66  errZ2[i] = sqr(errZ[i]);
67  calculate(r, z, errZ2);
68  }

References calculate(), fftjetvertexadder_cfi::errZ, mps_fire::i, N, alignCSCRings::r, sqr(), and z.

◆ RZLine() [4/4]

template<typename T >
RZLine::RZLine ( const T r,
const T z,
const T errZ2,
ErrZ2_tag   
)
inline

Constructor for container of r, z, and z variance

Template Parameters
TContainer of float

Container can be e.g. std::vector, std::array, or DynArray.

The ErrZ2_tag parameter is used to distinguish this constructor from other 3-parameter constructors.

Passing variance is useful in cases where it is already available to avoid making a square of a square root.

Definition at line 84 of file RZLine.h.

84  {
85  calculate(r, z, errZ2);
86  }

References calculate(), alignCSCRings::r, and z.

Member Function Documentation

◆ calculate()

template<typename R , typename Z , typename E >
void RZLine::calculate ( const R &  r,
const Z &  z,
const E &  errZ2 
)
inlineprivate

Definition at line 98 of file RZLine.h.

98  {
99  const size_t n = r.size();
100  linearFit(r.data(), z.data(), n, errZ2.data(), cotTheta_, intercept_, covss_, covii_, covsi_);
101  chi2_ = 0.f;
102  for (size_t i = 0; i < n; ++i) {
103  chi2_ += sqr(((z[i] - intercept_) - cotTheta_ * r[i])) / errZ2[i];
104  }
105  }

References chi2_, cotTheta_, covii_, covsi_, covss_, mps_fire::i, intercept_, linearFit(), dqmiodumpmetadata::n, alignCSCRings::r, sqr(), and z.

Referenced by RZLine().

◆ chi2()

float RZLine::chi2 ( void  ) const
inline

◆ cotTheta()

float RZLine::cotTheta ( ) const
inline

Definition at line 88 of file RZLine.h.

88 { return cotTheta_; }

References cotTheta_.

Referenced by PixelFitterByConformalMappingAndLine::run().

◆ covii()

float RZLine::covii ( ) const
inline

Definition at line 91 of file RZLine.h.

91 { return covii_; }

References covii_.

Referenced by PixelFitterByConformalMappingAndLine::run().

◆ covsi()

float RZLine::covsi ( ) const
inline

Definition at line 92 of file RZLine.h.

92 { return covsi_; }

References covsi_.

◆ covss()

float RZLine::covss ( ) const
inline

Definition at line 90 of file RZLine.h.

90 { return covss_; }

References covss_.

Referenced by PixelFitterByConformalMappingAndLine::run().

◆ intercept()

float RZLine::intercept ( ) const
inline

Definition at line 89 of file RZLine.h.

89 { return intercept_; }

References intercept_.

Referenced by PixelFitterByConformalMappingAndLine::run().

◆ sqr()

template<typename T >
T RZLine::sqr ( T  t)
inlineprivate

Definition at line 108 of file RZLine.h.

108  {
109  return t * t;
110  }

References submitPVValidationJobs::t.

Referenced by calculate(), and RZLine().

Member Data Documentation

◆ chi2_

float RZLine::chi2_
private

Definition at line 117 of file RZLine.h.

Referenced by calculate(), and chi2().

◆ cotTheta_

float RZLine::cotTheta_
private

Definition at line 112 of file RZLine.h.

Referenced by calculate(), and cotTheta().

◆ covii_

float RZLine::covii_
private

Definition at line 115 of file RZLine.h.

Referenced by calculate(), and covii().

◆ covsi_

float RZLine::covsi_
private

Definition at line 116 of file RZLine.h.

Referenced by calculate(), and covsi().

◆ covss_

float RZLine::covss_
private

Definition at line 114 of file RZLine.h.

Referenced by calculate(), and covss().

◆ intercept_

float RZLine::intercept_
private

Definition at line 113 of file RZLine.h.

Referenced by calculate(), and intercept().

fftjetvertexadder_cfi.errZ
errZ
Definition: fftjetvertexadder_cfi.py:39
mps_fire.i
i
Definition: mps_fire.py:428
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
HLT_FULL_cff.points
points
Definition: HLT_FULL_cff.py:21453
RZLine::calculate
void calculate(const R &r, const Z &z, const E &errZ2)
Definition: RZLine.h:98
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
RZLine::sqr
T sqr(T t)
Definition: RZLine.h:108
errors
Definition: errors.py:1
RZLine::cotTheta_
float cotTheta_
Definition: RZLine.h:112
linearFit
void linearFit(T const *__restrict__ x, T const *__restrict__ y, int ndat, T const *__restrict__ sigy2, T &slope, T &intercept, T &covss, T &covii, T &covsi)
Definition: LinearFit.h:29
DDAxes::z
RZLine::covsi_
float covsi_
Definition: RZLine.h:116
N
#define N
Definition: blowfish.cc:9
declareDynArray
#define declareDynArray(T, n, x)
Definition: DynArray.h:91
Point3DBase< float, GlobalTag >
PixelPluginsPhase0_cfi.isBarrel
isBarrel
Definition: PixelPluginsPhase0_cfi.py:17
RZLine::covii_
float covii_
Definition: RZLine.h:115
alignCSCRings.r
r
Definition: alignCSCRings.py:93
RZLine::intercept_
float intercept_
Definition: RZLine.h:113
RZLine::chi2_
float chi2_
Definition: RZLine.h:117
RZLine::covss_
float covss_
Definition: RZLine.h:114
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644