Belle II Software development
AlignableEKLMRecoHit Class Reference

Alignable EKLM hit. More...

#include <AlignableEKLMRecoHit.h>

Inheritance diagram for AlignableEKLMRecoHit:

Public Member Functions

 AlignableEKLMRecoHit ()
 Constructor.
 
 AlignableEKLMRecoHit (const EKLMAlignmentHit *hit, const genfit::TrackCandHit *trackCandHit)
 Constructor.
 
 ~AlignableEKLMRecoHit ()
 Destructor.
 
virtual std::pair< std::vector< int >, TMatrixD > globalDerivatives (const genfit::StateOnPlane *sop) override
 Labels and derivatives of residuals (local measurement coordinates) w.r.t.
 
genfit::AbsMeasurement * clone () const override
 Clone.
 

Private Member Functions

 ClassDefOverride (AlignableEKLMRecoHit, 2)
 Needed to make objects storable.
 

Private Attributes

int m_Section
 Section number.
 
int m_Sector
 Sector number.
 
int m_Layer
 Layer number.
 
uint16_t m_KLMModule
 KLM module number.
 
uint16_t m_Segment
 Segment number.
 
B2Vector3D m_StripV
 V direction.
 

Detailed Description

Alignable EKLM hit.

Definition at line 29 of file AlignableEKLMRecoHit.h.

Constructor & Destructor Documentation

◆ AlignableEKLMRecoHit() [1/2]

Constructor.

Definition at line 24 of file AlignableEKLMRecoHit.cc.

25{
26}

◆ AlignableEKLMRecoHit() [2/2]

AlignableEKLMRecoHit ( const EKLMAlignmentHit hit,
const genfit::TrackCandHit *  trackCandHit 
)

Constructor.

Definition at line 28 of file AlignableEKLMRecoHit.cc.

29 :
30 genfit::PlanarMeasurement(1)
31{
32 (void)trackCandHit;
33 int digit, plane, segment, strip;
34 const HepGeom::Transform3D* t;
35 CLHEP::HepRotation r;
36 CLHEP::Hep3Vector origin;
37 CLHEP::Hep3Vector u(1, 0, 0);
38 CLHEP::Hep3Vector v(0, 1, 0);
39 B2Vector3D origin2, u2, v2;
41 const KLMElementNumbers* elementNumbers = &(KLMElementNumbers::Instance());
42 const EKLMElementNumbers* eklmElementNumbers =
44 const EKLM::TransformDataGlobalAligned* transformData =
46 RelationVector<KLMHit2d> hit2ds = hit->getRelationsTo<KLMHit2d>();
47 if (hit2ds.size() != 1)
48 B2FATAL("Incorrect number of related KLMHit2ds.");
49 RelationVector<KLMDigit> eklmDigits = hit2ds[0]->getRelationsTo<KLMDigit>();
50 if (eklmDigits.size() != 2)
51 B2FATAL("Incorrect number of related KLMDigits.");
52 digit = hit->getDigitIdentifier();
53 m_Section = eklmDigits[digit]->getSection();
54 m_Layer = eklmDigits[digit]->getLayer();
55 m_Sector = eklmDigits[digit]->getSector();
56 plane = eklmDigits[digit]->getPlane();
57 segment = (eklmDigits[digit]->getStrip() - 1) /
58 eklmElementNumbers->getNStripsSegment() + 1;
59 strip = (segment - 1) * eklmElementNumbers->getNStripsSegment() + 1;
61 m_Segment = eklmElementNumbers->segmentNumber(
62 m_Section, m_Layer, m_Sector, plane, segment);
63 t = transformData->getStripTransform(
64 m_Section, m_Layer, m_Sector, plane, strip);
65 origin = t->getTranslation();
66 origin2.SetX(origin.x() / CLHEP::cm * Unit::cm);
67 origin2.SetY(origin.y() / CLHEP::cm * Unit::cm);
68 origin2.SetZ(origin.z() / CLHEP::cm * Unit::cm);
69 r = t->getRotation();
70 u = r * u;
71 v = r * v;
72 u2.SetX(u.x());
73 u2.SetY(u.y());
74 u2.SetZ(u.z());
75 v2.SetX(v.x());
76 v2.SetY(v.y());
77 v2.SetZ(v.z());
78 t = transformData->getSectorTransform(m_Section, m_Layer, m_Sector);
79 r = t->getRotation().inverse();
80 v = r * v;
81 m_StripV.SetX(v.unit().x());
82 m_StripV.SetY(v.unit().y());
83 genfit::SharedPlanePtr detPlane(new genfit::DetPlane(origin2, u2, v2, 0));
84 setPlane(detPlane, m_Segment);
85 rawHitCoords_[0] = geoDat->getStripGeometry()->getWidth() *
86 ((eklmDigits[digit]->getStrip() - 1) %
87 eklmElementNumbers->getNStripsSegment()) / CLHEP::cm * Unit::cm;
88 rawHitCov_[0][0] = pow(geoDat->getStripGeometry()->getWidth() /
89 CLHEP::cm * Unit::cm, 2) / 12;
90 setStripV();
91}
uint16_t m_Segment
Segment number.
B2Vector3D m_StripV
V direction.
uint16_t m_KLMModule
KLM module number.
void SetX(DataType x)
set X/1st-coordinate
Definition: B2Vector3.h:457
void SetZ(DataType z)
set Z/3rd-coordinate
Definition: B2Vector3.h:461
void SetY(DataType y)
set Y/2nd-coordinate
Definition: B2Vector3.h:459
EKLM element numbers.
static const EKLMElementNumbers & Instance()
Instantiation.
static constexpr int getNStripsSegment()
Get number of strips in a segment.
int segmentNumber(int section, int layer, int sector, int plane, int segment) const
Get segment number.
double getWidth() const
Get width.
const StripGeometry * getStripGeometry() const
Get strip geometry data.
EKLM geometry data.
Definition: GeometryData.h:38
static const GeometryData & Instance(enum DataSource dataSource=c_Database, const GearDir *gearDir=nullptr)
Instantiation.
Definition: GeometryData.cc:33
Transformation data (global, aligned): singleton version.
static const TransformDataGlobalAligned & Instance()
Instantiation.
const HepGeom::Transform3D * getStripTransform(int section, int layer, int sector, int plane, int strip) const
Get strip transformation.
const HepGeom::Transform3D * getSectorTransform(int section, int layer, int sector) const
Get sector transformation.
KLM digit (class representing a digitized hit in RPCs or scintillators).
Definition: KLMDigit.h:29
KLM element numbers.
static const KLMElementNumbers & Instance()
Instantiation.
KLMModuleNumber moduleNumberEKLM(int section, int sector, int layer) const
Get module number for EKLM.
KLM 2d hit.
Definition: KLMHit2d.h:33
Class for type safe access to objects that are referred to in relations.
size_t size() const
Get number of relations.
static const double cm
Standard units with the value = 1.
Definition: Unit.h:47
const std::vector< double > v2
MATLAB generated random vector.

◆ ~AlignableEKLMRecoHit()

Destructor.

Definition at line 93 of file AlignableEKLMRecoHit.cc.

94{
95}

Member Function Documentation

◆ clone()

genfit::AbsMeasurement * clone ( ) const
override

Clone.

Definition at line 141 of file AlignableEKLMRecoHit.cc.

142{
143 return new AlignableEKLMRecoHit(*this);
144}

◆ globalDerivatives()

std::pair< std::vector< int >, TMatrixD > globalDerivatives ( const genfit::StateOnPlane *  sop)
overridevirtual

Labels and derivatives of residuals (local measurement coordinates) w.r.t.

alignment/calibration parameters Matrix "G" of derivatives valid for given prediction of track state:

G(i, j) = d_residual_i/d_parameter_j

For 2D measurement (u,v):

G = ( du/da du/db du/dc ... ) ( dv/da dv/db dv/dc ... )

for calibration parameters a, b, c.

For 1D measurement:

G = ( 0 0 0 ... ) ( dv/da dv/db dv/dc ... ) for V-strip,

G = ( du/da du/db du/dc ... ) ( 0 0 0 ... ) for U-strip,

Measurements with more dimensions (slopes, curvature) should provide full 4-5Dx(n params) matrix (state as (q/p, u', v', u, v) or (u', v', u, v))

Parameters
sopPredicted state of the track as linearization point around which derivatives of alignment/calibration parameters shall be computed
Returns
pair<vector<int>, TMatrixD> With matrix with number of rows = dimension of residual, number of columns = number of parameters. number of columns must match vector<int>.size().

Definition at line 97 of file AlignableEKLMRecoHit.cc.

98{
99 std::vector<int> labGlobal;
100 labGlobal.push_back(GlobalLabel::construct<EKLMAlignment>(m_KLMModule, KLMAlignmentData::c_DeltaU)); // dx
101 labGlobal.push_back(GlobalLabel::construct<EKLMAlignment>(m_KLMModule, KLMAlignmentData::c_DeltaV)); // dy
102 labGlobal.push_back(GlobalLabel::construct<EKLMAlignment>(m_KLMModule, KLMAlignmentData::c_DeltaGamma)); // drot
103
104 /* Local parameters. */
105 const double dalpha = 0;
106 const double dxs = 0;
107 const double dys = 0;
108 const double sinda = sin(dalpha);
109 const double cosda = cos(dalpha);
110 /* Local position in sector coordinates. */
111 HepGeom::Point3D<double> globalPos;
112 HepGeom::Transform3D t;
113 const EKLM::TransformDataGlobalAligned* transformData =
115 t = (*transformData->getSectorTransform(m_Section, m_Layer, m_Sector)).inverse();
116 globalPos.setX(sop->getPos().X() / Unit::cm * CLHEP::cm);
117 globalPos.setY(sop->getPos().Y() / Unit::cm * CLHEP::cm);
118 globalPos.setZ(sop->getPos().Z() / Unit::cm * CLHEP::cm);
119 globalPos = t * globalPos;
120 double x = globalPos.x() / CLHEP::cm * Unit::cm;
121 double y = globalPos.y() / CLHEP::cm * Unit::cm;
122 /*
123 * Matrix of global derivatives of local coordinate (second dimension is
124 * added because of resizing in GblFitterInfo::constructGblPoint()) by
125 * variations of the detector element position.
126 * The sign is inverted to match the convention for other detectors.
127 */
128 TMatrixD derGlobal(2, 3);
129 derGlobal(0, 0) = 0;
130 derGlobal(0, 1) = 0;
131 derGlobal(0, 2) = 0;
132 derGlobal(1, 0) = cosda * m_StripV.X() - sinda * m_StripV.Y();
133 derGlobal(1, 1) = sinda * m_StripV.X() + cosda * m_StripV.Y();
134 derGlobal(1, 2) =
135 -((x - dxs) * (-sinda * m_StripV.X() - cosda * m_StripV.Y()) +
136 (y - dys) * (cosda * m_StripV.X() - sinda * m_StripV.Y()));
137 return alignment::GlobalDerivatives(labGlobal, derGlobal);
138
139}
DataType X() const
access variable X (= .at(0) without boundary check)
Definition: B2Vector3.h:431
DataType Y() const
access variable Y (= .at(1) without boundary check)
Definition: B2Vector3.h:433
@ c_DeltaU
Shift in U (EKLM: local X).
@ c_DeltaGamma
Rotation in gamma (EKLM: rotation in local plane).
@ c_DeltaV
Shift in V (EKLM: local Y).

Member Data Documentation

◆ m_KLMModule

uint16_t m_KLMModule
private

KLM module number.

Definition at line 100 of file AlignableEKLMRecoHit.h.

◆ m_Layer

int m_Layer
private

Layer number.

Definition at line 97 of file AlignableEKLMRecoHit.h.

◆ m_Section

int m_Section
private

Section number.

Definition at line 91 of file AlignableEKLMRecoHit.h.

◆ m_Sector

int m_Sector
private

Sector number.

Definition at line 94 of file AlignableEKLMRecoHit.h.

◆ m_Segment

uint16_t m_Segment
private

Segment number.

Definition at line 103 of file AlignableEKLMRecoHit.h.

◆ m_StripV

B2Vector3D m_StripV
private

V direction.

Definition at line 106 of file AlignableEKLMRecoHit.h.


The documentation for this class was generated from the following files: