1 #ifndef RecoTracker_MkFitCore_interface_Hit_h
2 #define RecoTracker_MkFitCore_interface_Hit_h
29 inline float getRad2(
float x,
float y) {
return x * x + y * y; }
31 inline float getInvRad2(
float x,
float y) {
return 1.0f / (x * x + y * y); }
33 inline float getPhi(
float x,
float y) {
return std::atan2(y, x); }
35 inline float getTheta(
float r,
float z) {
return std::atan2(r, z); }
41 inline float getEta(
float x,
float y,
float z) {
48 inline float getRadErr2(
float x,
float y,
float exx,
float eyy,
float exy) {
49 return (x * x * exx + y * y * eyy + 2.0
f * x * y * exy) /
getRad2(x, y);
52 inline float getInvRadErr2(
float x,
float y,
float exx,
float eyy,
float exy) {
53 return (x * x * exx + y * y * eyy + 2.0
f * x * y * exy) /
cube(
getRad2(x, y));
56 inline float getPhiErr2(
float x,
float y,
float exx,
float eyy,
float exy) {
57 const float rad2 =
getRad2(x, y);
58 return (y * y * exx + x * x * eyy - 2.0
f * x * y * exy) / (rad2 * rad2);
62 float x,
float y,
float z,
float exx,
float eyy,
float ezz,
float exy,
float exz,
float eyz) {
63 const float rad2 =
getRad2(x, y);
65 const float hypot2 = rad2 + z * z;
66 const float dthetadx = x * z / (rad * hypot2);
67 const float dthetady = y * z / (rad * hypot2);
68 const float dthetadz = -rad / hypot2;
69 return dthetadx * dthetadx * exx + dthetady * dthetady * eyy + dthetadz * dthetadz * ezz +
70 2.0f * dthetadx * dthetady * exy + 2.0f * dthetadx * dthetadz * exz + 2.0f * dthetady * dthetadz * eyz;
73 inline float getEtaErr2(
float x,
float y,
float z,
float exx,
float eyy,
float ezz,
float exy,
float exz,
float eyz) {
74 const float rad2 =
getRad2(x, y);
75 const float detadx = -x / (rad2 *
std::sqrt(1 + rad2 / (z * z)));
76 const float detady = -y / (rad2 *
std::sqrt(1 + rad2 / (z * z)));
77 const float detadz = 1.0f / (z *
std::sqrt(1 + rad2 / (z * z)));
78 return detadx * detadx * exx + detady * detady * eyy + detadz * detadz * ezz + 2.0f * detadx * detady * exy +
79 2.0f * detadx * detadz * exz + 2.0f * detady * detadz * eyz;
82 inline float getPxPxErr2(
float ipt,
float phi,
float vipt,
float vphi) {
83 const float iipt2 = 1.0f / (ipt * ipt);
86 return iipt2 * (iipt2 * cosP * cosP * vipt + sinP * sinP * vphi);
89 inline float getPyPyErr2(
float ipt,
float phi,
float vipt,
float vphi) {
90 const float iipt2 = 1.0f / (ipt * ipt);
93 return iipt2 * (iipt2 * sinP * sinP * vipt + cosP * cosP * vphi);
97 const float iipt2 = 1.0f / (ipt * ipt);
98 const float cotT = 1.0f /
std::tan(theta);
99 const float cscT = 1.0f /
std::sin(theta);
100 return iipt2 * (iipt2 * cotT * cotT * vipt + cscT * cscT * cscT * cscT * vtheta);
125 for (
int i = 0;
i < 6; ++
i)
131 for (
int i = 0;
i < 6; ++
i)
132 result.Array()[
i] =
err_[
i];
242 typedef std::vector<Hit>
HitVec;
269 float x = 0,
y = 0,
z = 0;
275 BeamSpot(
float ix,
float iy,
float iz,
float is,
float ibx,
float iby,
float idxdz,
float idydz)
float squashPhiMinimal(float phi)
static std::vector< std::string > checklist log
unsigned int get_charge_pcm() const
uint16_t *__restrict__ id
void setupAsStrip(unsigned int id, int cpcm, int rows)
float getThetaErr2(float x, float y, float z, float exx, float eyy, float ezz, float exy, float exz, float eyz)
unsigned int detid_in_layer
Sin< T >::type sin(const T &t)
bool operator<(const HitOnTrack o) const
Geom::Theta< T > theta() const
ROOT::Math::SVector< float, 3 > SVector3
unsigned int spanRows() const
float getTheta(float r, float z)
float getEta(float r, float z)
std::vector< MCHitInfo > MCHitInfoVec
float getInvRad2(float x, float y)
const SVector3 & parameters() const
const float * errArray() const
static unsigned int maxChargePerCM()
float getInvRadErr2(float x, float y, float exx, float eyy, float exy)
float getRadErr2(float x, float y, float exx, float eyy, float exy)
float squashPhiGeneral(float phi)
int mcTrackID(const MCHitInfoVec &globalMCHitInfo) const
void setupAsPixel(unsigned int id, int rows, int cols)
float getPxPxErr2(float ipt, float phi, float vipt, float vphi)
const MeasurementState & measurementState() const
static unsigned int maxSpan()
void set_charge_pcm(int cpcm)
const float * posArray() const
float getEtaErr2(float x, float y, float z, float exx, float eyy, float ezz, float exy, float exz, float eyz)
Cos< T >::type cos(const T &t)
float getRad2(float x, float y)
Tan< T >::type tan(const T &t)
const SMatrixSym33 error() const
float getHypot(float x, float y)
Hit(const SVector3 &position, const SMatrixSym33 &error, int mcHitID=-1)
static constexpr int kMinChargePerCM
unsigned int spanCols() const
std::vector< Hit > HitVec
int layer(const MCHitInfoVec &globalMCHitInfo) const
MeasurementState(const SVector3 &p, const SMatrixSym33 &e)
const SVector3 & position() const
SMatrixSym33 errors() const
BeamSpot(float ix, float iy, float iz, float is, float ibx, float iby, float idxdz, float idydz)
std::vector< DeadRegion > DeadVec
void print(std::string_view label, const MeasurementState &s)
float getPhi(float x, float y)
const SVector3 & parameters() const
std::vector< HitOnTrack > HoTVec
MCHitInfo(int track, int layer, int ithlayerhit, int mcHitID)
ROOT::Math::SVector< float, 6 > SVector6
unsigned int detIDinLayer() const
DeadRegion(float a1, float a2, float b1, float b2)
static constexpr float b2
ROOT::Math::SMatrix< float, 3, 3, ROOT::Math::MatRepSym< float, 3 > > SMatrixSym33
SVector3 & parameters_nc()
float getPyPyErr2(float ipt, float phi, float vipt, float vphi)
unsigned int chargePerCM() const
static unsigned int minChargePerCM()
float getPzPzErr2(float ipt, float theta, float vipt, float vtheta)
static constexpr float b1
float getPhiErr2(float x, float y, float exx, float eyy, float exy)
MeasurementState(const SVector3 &p, const SVector6 &e)