Belle II Software development
BKLMTrackFitter.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9/* Own header. */
10#include <klm/bklm/modules/bklmTracking/BKLMTrackFitter.h>
11
12/* KLM headers. */
13#include <klm/bklm/geometry/GeometryPar.h>
14#include <klm/bklm/geometry/Module.h>
15
16/* Basf2 headers. */
17#include <framework/logging/Logger.h>
18#include <framework/utilities/MathHelpers.h>
19
20/* CLHEP headers. */
21#include <CLHEP/Matrix/DiagMatrix.h>
22#include <CLHEP/Matrix/Matrix.h>
23
24/* C++ headers. */
25#include <cfloat>
26
27using namespace CLHEP;
28using namespace Belle2;
29using namespace Belle2::bklm;
30
32enum { VX = 0, VY = 1, VZ = 2 };
33
35enum { AY = 0, BY = 1, AZ = 2, BZ = 3 };
36
38enum { MY = 0, MZ = 1 };
39
42 m_Valid(false),
43 m_Good(false),
44 m_Chi2(0.0),
45 m_NumHit(0),
46 m_globalFit(false),
47 m_SectorPar(4, 0),
48 m_SectorErr(4, 0),
49 m_GlobalPar(4, 0),
50 m_GlobalErr(4, 0),
51 m_GeoPar(nullptr)
52{
53}
54
59
61double BKLMTrackFitter::fit(std::list<KLMHit2d* >& listHitSector)
62{
63
64 // We can only do fit if there are at least two hits
65 if (listHitSector.size() < 2) {
66 m_Valid = false;
67 m_Good = false;
68 return (false);
69 }
70
71 HepVector eta(2, 0); // ( a, b ) in y = a + bx
72 HepSymMatrix error(2, 0);
73 HepVector gloEta(2, 0); // ( a, b ) in y = a + bx in global system
74 HepSymMatrix gloError(2, 0);
75 m_Chi2 = 0;
76
77 // Create temporary vector and matrix... so size can be set.
78 HepVector sectorPar(4, 0);
79 HepSymMatrix sectorErr(4, 0);
80 HepVector globalPar(4, 0);
81 HepSymMatrix globalErr(4, 0);
82
83 if (m_globalFit) {
84 m_Chi2 = fit1dTrack(listHitSector, eta, error, VY, VX);
85 globalPar.sub(1, eta);
86 globalErr.sub(1, error);
87 } else {
88 m_Chi2 = fit1dSectorTrack(listHitSector, eta, error, VY, VX);
89 sectorPar.sub(1, eta);
90 sectorErr.sub(1, error);
91 }
92
93 if (m_globalFit) {
94 m_Chi2 += fit1dTrack(listHitSector, eta, error, VY, VZ);
95 globalPar.sub(3, eta);
96 globalErr.sub(3, error);
97 } else {
98 m_Chi2 += fit1dSectorTrack(listHitSector, eta, error, VZ, VX);
99 sectorPar.sub(3, eta);
100 sectorErr.sub(3, error);
101 }
102
103 if (!m_globalFit) {
104 //transfer to the global system, choose two arbitrary points on track within in the sector jpionts on this track
105 const Belle2::bklm::Module* refMod = m_GeoPar->findModule((*listHitSector.begin())->getSection(),
106 (*listHitSector.begin())->getSector(), 1);
107
108 Hep3Vector p1(0, 0, 0); Hep3Vector p2(0, 0, 0);
109 double x1 = 5; // sector localX
110 double x2 = 10;
111 double y1 = sectorPar[0] + sectorPar[1] * x1;
112 double y2 = sectorPar[0] + sectorPar[1] * x2;
113 double z1 = sectorPar[2] + sectorPar[3] * x1;
114 double z2 = sectorPar[2] + sectorPar[3] * x2;
115 p1.setX(x1); p1.setY(y1); p1.setZ(z1);
116 p2.setX(x2); p2.setY(y2); p2.setZ(z2);
117 Hep3Vector gl1 = refMod->localToGlobal(p1);
118 Hep3Vector gl2 = refMod->localToGlobal(p2);
119
120 //transfer the trackParameters to global system y = p0 + p1 * x and z= p2 + p3*x
121 if (gl2[0] != gl1[0]) {
122 globalPar[1] = (gl2[1] - gl1[1]) / (gl2[0] - gl1[0]);
123 globalPar[0] = gl1[1] - globalPar[1] * gl1[0];
124 globalPar[3] = (gl2[2] - gl1[2]) / (gl2[0] - gl1[0]);
125 globalPar[2] = gl1[2] - globalPar[3] * gl1[0];
126 globalErr = sectorErr;
127 } else {
128 globalPar[1] = DBL_MAX;
129 globalPar[0] = DBL_MAX;
130 globalPar[3] = DBL_MAX;
131 globalPar[2] = DBL_MAX;
132 globalErr = sectorErr; //?
133 }
134 } else { //transfer to the local system, can not do. One global track might go through two different sectors.
135 }
136
137 m_Chi2 /= 2.0;
138
139 m_SectorPar = sectorPar;
140 m_SectorErr = sectorErr;
141 m_GlobalPar = globalPar;
142 m_GlobalErr = globalErr;
143
144 m_Valid = true;
145 m_Good = false;
146 m_NumHit = listHitSector.size();
147 if (m_Chi2 <= 20.0) {
148 m_Good = true;
149 }
150
151 return (m_Chi2);
152
153}
154
157 double& error,
158 double& sigma)
159{
160
161 double x, y, z, dy, dz;
162
163 if (!m_Valid) {
164 error = DBL_MAX;
165 sigma = DBL_MAX;
166 return DBL_MAX;
167 }
168
170 const Belle2::bklm::Module* refMod = m_GeoPar->findModule(hit->getSection(), hit->getSector(), 1);
171 const Belle2::bklm::Module* corMod = m_GeoPar->findModule(hit->getSection(), hit->getSector(), hit->getLayer());
172
173 CLHEP::Hep3Vector globalPos(hit->getPositionX(), hit->getPositionY(), hit->getPositionZ());
174
175 //+++ local coordinates of the hit
176 CLHEP::Hep3Vector local = refMod->globalToLocal(globalPos);
177
178 x = local[0] ;
179
180 y = m_SectorPar[ AY ] + x * m_SectorPar[ BY ];
181 z = m_SectorPar[ AZ ] + x * m_SectorPar[ BZ ];
182
183 dy = y - local[1];
184 dz = z - local[2];
185
186 double distance = sqrt(dy * dy + dz * dz);
187
188 // Error is composed of four parts: error due to tracking, y and z;
189 // and error in hit, y and z. We know the latter two, got to find
190 // the first two. We could calculate this from simple equations or
191 // using matrices. I choose the later because it is extendable.
192 HepMatrix errors(2, 2, 0); // Matrix for errors
193 HepMatrix A(2, 4, 0); // Matrix for derivatives
194
195 // Derivatives of y (z) = a + bx with respect to a and b.
196 A[ MY ][ AY ] = 1.0;
197 A[ MY ][ BY ] = x;
198 A[ MZ ][ AZ ] = 1.0;
199 A[ MZ ][ BZ ] = x;
200
201 errors = A * m_SectorErr * A.T();
202
203 double hit_localPhiErr = corMod->getPhiStripWidth() / sqrt(12);
204 double hit_localZErr = corMod->getZStripWidth() / sqrt(12);
205
206 if (hit->inRPC()) {
207 //+++ scale localErr based on measured-in-Belle resolution
208 int nStrips = hit->getPhiStripMax() - hit->getPhiStripMin() + 1;
209 double dn = nStrips - 1.5;
210 double factor = std::pow((0.9 + 0.4 * dn * dn), 1.5) * 0.60;//measured-in-Belle resolution
211 hit_localPhiErr = hit_localPhiErr * sqrt(factor);
212
213 nStrips = hit->getZStripMax() - hit->getZStripMin() + 1;
214 dn = nStrips - 1.5;
215 factor = std::pow((0.9 + 0.4 * dn * dn), 1.5) * 0.55;//measured-in-Belle resolution
216 hit_localZErr = hit_localZErr * sqrt(factor);
217 }
218
219 error = sqrt(errors[ MY ][ MY ] +
220 errors[ MZ ][ MZ ] +
221 square(hit_localPhiErr) +
222 square(hit_localZErr));
223
224 if (error != 0.0) {
225 sigma = distance / error;
226 } else {
227 sigma = DBL_MAX;
228 }
229
230 return (distance);
231}
232
235 double& error,
236 double& sigma)
237{
238
239 if (!m_Valid) {
240 error = DBL_MAX;
241 sigma = DBL_MAX;
242 return DBL_MAX;
243 }
244
245 //in global fit, we have two functions y = a + b*x and y = c + d*z
246 double x_mea = hit->getPositionX();
247 double y_mea = hit->getPositionY();
248 double z_mea = hit->getPositionZ();
249
250 double x_pre = (y_mea - m_GlobalPar[ AY ]) / m_GlobalPar[ BY ]; //y_mea has uncertainties actually
251 double z_pre = (y_mea - m_GlobalPar[ AZ ]) / m_GlobalPar[ BZ ];
252
253 double dx = x_pre - x_mea;
254 double dz = z_pre - z_mea;
255
256 double distance = sqrt(dx * dx + dz * dz);
257
258 // Error is composed of four parts: error due to tracking;
259 // and error in hit, y, x or y, z.
260 HepMatrix errors(2, 2, 0); // Matrix for errors
261 HepMatrix A(2, 4, 0); // Matrix for derivatives
262
263 // Derivatives of x (z) = y/b - a/b with respect to a and b.
264 A[ MY ][ AY ] = -1. / m_GlobalPar[BY];
265 A[ MY ][ BY ] = -1 * (y_mea - m_GlobalPar[ AY ]) / (m_GlobalPar[ BY ] * m_GlobalPar[ BY ]);
266 A[ MZ ][ AZ ] = -1. / m_GlobalPar[ BZ ];
267 A[ MZ ][ BZ ] = -1 * (y_mea - m_GlobalPar[ AZ ]) / (m_GlobalPar[ BZ ] * m_GlobalPar[ BZ ]);
268
269 //error from trackPar is inclueded, error from y_mea is not included
270 errors = A * m_GlobalErr * A.T();
271
272 //here get the resolustion of a hit, repeated several times, ugly. should we store this in KLMHit2d object ?
273 const Belle2::bklm::Module* corMod = m_GeoPar->findModule(hit->getSection(), hit->getSector(), hit->getLayer());
274 double hit_localPhiErr = corMod->getPhiStripWidth() / sqrt(12);
275 double hit_localZErr = corMod->getZStripWidth() / sqrt(12);
276
277 if (hit->inRPC()) {
278 //+++ scale localErr based on measured-in-Belle resolution
279 int nStrips = hit->getPhiStripMax() - hit->getPhiStripMin() + 1;
280 double dn = nStrips - 1.5;
281 double factor = std::pow((0.9 + 0.4 * dn * dn), 1.5) * 0.60;//measured-in-Belle resolution
282 hit_localPhiErr = hit_localPhiErr * sqrt(factor);
283
284 nStrips = hit->getZStripMax() - hit->getZStripMin() + 1;
285 dn = nStrips - 1.5;
286 factor = std::pow((0.9 + 0.4 * dn * dn), 1.5) * 0.55;//measured-in-Belle resolution
287 hit_localZErr = hit_localZErr * sqrt(factor);
288 }
289
290 Hep3Vector globalOrigin = corMod->getGlobalOrigin();
291 double sinphi = globalOrigin[1] / globalOrigin.mag();
292 double cosphi = globalOrigin[0] / globalOrigin.mag();
293
294 HepMatrix globalHitErr(3, 3, 0);
295 globalHitErr[0][0] = square(hit_localPhiErr * sinphi); //x
296 globalHitErr[0][1] = (hit_localPhiErr * sinphi) * (hit_localPhiErr * cosphi);
297 globalHitErr[0][2] = 0;
298 globalHitErr[1][1] = square(hit_localPhiErr * cosphi);;
299 globalHitErr[1][0] = (hit_localPhiErr * sinphi) * (hit_localPhiErr * cosphi);
300 globalHitErr[1][2] = 0;
301 globalHitErr[2][2] = square(hit_localZErr);
302 globalHitErr[2][0] = 0;
303 globalHitErr[2][1] = 0;
304
305 //HepMatrix B(2, 2, 0); // Matrix for derivatives
306
307 // Derivatives of x (z) = y/b - a/b with respect to y.
308 //B[ MY ][ AY ] = 1./m_GlobalPar[BY];
309 //B[ MZ ][ BY ] = 1./m_GlobalPar[BZ] ;
310 //double errors_b[0] = B[ MY ][ AY ]*globalHitErr[1][1];
311 //double errors_b[1] = B[ MZ ][ BY ]*globalHitErr[1][1];
312
313 HepMatrix error_mea(2, 2, 0);
314 error = sqrt(errors[ MY ][ MY ] +
315 errors[ MZ ][ MZ ] +
316 //errors_b[0] + errors_b[1] + //error of prediced point due to error of inPos (y_mea)
317 globalHitErr[0][0] +
318 globalHitErr[1][1] + //y_mea error is correlated to the error of predicted point, but we didn't consider that part in errors
319 globalHitErr[2][2]); //we ignore y_mea error?
320
321 if (error != 0.0) {
322 sigma = distance / error;
323 } else {
324 sigma = DBL_MAX;
325 }
326
327 return (distance);
328}
329
330
332double BKLMTrackFitter::fit1dSectorTrack(std::list< KLMHit2d* > hitList,
333 HepVector& eta,
334 HepSymMatrix& error,
335 int depDir, int indDir)
336{
337
338// Fit d = a + bi, where d is dependent direction and i is independent
339 Hep3Vector localHitPos;
340 HepMatrix localHitErr(3, 3, 0);
341
342 double indPos = 0;
343 double depPos = 0;
344
345 // Matrix based solution
346
347 int noPoints = hitList.size();
348
349 // Derivative of y = a + bx, with respect to a and b evaluated at x.
350 HepMatrix A(noPoints, 2, 0);
351
352 // Measured data points.
353 HepVector y(noPoints, 0);
354
355 // Inverse of covariance (error) matrix, also known as the weight matrix.
356 // In plain English: V_y_inverse_nn = 1 / (error of nth measurement)^2
357 HepDiagMatrix V_y_inverse(noPoints, 0);
358 //HepSymMatrix V_y_inverse(noPoints, 0);
359
360 // Error or correlation matrix for coefficients (2x2 matrices)
361 HepSymMatrix V_A, V_A_inverse;
362
363 int section = (*hitList.begin())->getSection();
364 int sector = (*hitList.begin())->getSector();
365
367 const Belle2::bklm::Module* refMod = m_GeoPar->findModule(section, sector, 1);
368
369 int n = 0;
370 for (KLMHit2d* hit : hitList) {
371
372 if (hit->getSection() != section || hit->getSector() != sector) {
373 continue;
374 }
375
376 // m_GeoPar = GeometryPar::instance();
377 //const Belle2::bklm::Module* refMod = m_GeoPar->findModule(hit->getSection(), hit->getSector(), 1);
378 const Belle2::bklm::Module* corMod = m_GeoPar->findModule(hit->getSection(), hit->getSector(), hit->getLayer());
379
380 CLHEP::Hep3Vector globalPos;
381 globalPos[0] = hit->getPositionX();
382 globalPos[1] = hit->getPositionY();
383 globalPos[2] = hit->getPositionZ();
384
385 localHitPos = refMod->globalToLocal(globalPos);
386 double hit_localPhiErr = corMod->getPhiStripWidth() / sqrt(12);
387 double hit_localZErr = corMod->getZStripWidth() / sqrt(12);
388
389 if (hit->inRPC()) {
390 //+++ scale localErr based on measured-in-Belle resolution
391 int nStrips = hit->getPhiStripMax() - hit->getPhiStripMin() + 1;
392 double dn = nStrips - 1.5;
393 double factor = std::pow((0.9 + 0.4 * dn * dn), 1.5) * 0.60;//measured-in-Belle resolution
394 hit_localPhiErr = hit_localPhiErr * sqrt(factor);
395
396 nStrips = hit->getZStripMax() - hit->getZStripMin() + 1;
397 dn = nStrips - 1.5;
398 factor = std::pow((0.9 + 0.4 * dn * dn), 1.5) * 0.55;//measured-in-Belle resolution
399 hit_localZErr = hit_localZErr * sqrt(factor);
400 }
401
402 localHitErr[0][0] = 0.0; //x
403 localHitErr[0][1] = 0;
404 localHitErr[0][2] = 0;
405 localHitErr[1][1] = hit_localPhiErr;
406 localHitErr[1][0] = 0;
407 localHitErr[1][2] = 0;
408 localHitErr[2][2] = hit_localZErr;
409 localHitErr[2][0] = 0;
410 localHitErr[2][1] = 0;
411
412 switch (indDir) {
413
414 case VX:
415 indPos = localHitPos.x();
416 break;
417
418 case VY:
419 indPos = localHitPos.y();
420 break;
421
422 case VZ:
423 indPos = localHitPos.z();
424 break;
425
426 default:
427 B2DEBUG(20, "error in klm_trackSectorFit: illegal direction");
428
429 }
430
431 switch (depDir) {
432
433 case VX:
434 depPos = localHitPos.x();
435 break;
436
437 case VY:
438 depPos = localHitPos.y();
439 break;
440
441 case VZ:
442 depPos = localHitPos.z();
443 break;
444
445 default:
446 B2DEBUG(20, "error in klm_trackSectorFit: illegal direction");
447
448 }
449
450
451 A[ n ][ 0 ] = 1;
452 A[ n ][ 1 ] = indPos;
453
454 y[ n ] = depPos;
455
456 if (localHitErr[ depDir ][ depDir ] > 0.0) {
457 V_y_inverse[ n ][ n ] = 1.0 / localHitErr[ depDir ][ depDir ];
458 } else {
459 V_y_inverse[ n ][ n ] = DBL_MAX;
460 }
461 ++n;//n is the index of measured points/hits
462 }
463
464 V_A_inverse = V_y_inverse.similarityT(A);
465
466 int ierr = 0;
467 V_A = V_A_inverse.inverse(ierr);
468
469 eta = V_A * A.T() * V_y_inverse * y;
470 error = V_A;
471
472// Calculate residuals:
473 HepMatrix residual = y - A * eta;
474 HepMatrix chisqr = residual.T() * V_y_inverse * residual;
475
476 return (chisqr.trace());
477
478}
479
481double BKLMTrackFitter::fit1dTrack(std::list< KLMHit2d* > hitList,
482 HepVector& eta,
483 HepSymMatrix& error,
484 int depDir, int indDir)
485{
486// Fit d = a + bi, where d is dependent direction and i is independent
487// in global system we assume y = a + b*x and y = c + d*z different from local fit
488
489 HepMatrix globalHitErr(3, 3, 0);
490
491 double indPos = 0;
492 double depPos = 0;
493
494 // Matrix based solution
495 int noPoints = hitList.size();
496
497 // Derivative of y = a + bx, with respect to a and b evaluated at x.
498 HepMatrix A(noPoints, 2, 0);
499
500 // Measured data points.
501 HepVector y(noPoints, 0);
502
503 // Inverse of covariance (error) matrix, also known as the weight matrix.
504 // In plain English: V_y_inverse_nn = 1 / (error of nth measurement)^2
505 HepDiagMatrix V_y_inverse(noPoints, 0);
506
507 // Error or correlation matrix for coefficients (2x2 matrices)
508 HepSymMatrix V_A, V_A_inverse;
509
511 const Belle2::bklm::Module* corMod;
512
513 int n = 0;
514 for (KLMHit2d* hit : hitList) {
515
516 // m_GeoPar = GeometryPar::instance();
517 //const Belle2::bklm::Module* refMod = m_GeoPar->findModule(hit->getSection(), hit->getSector(), 1);
518 corMod = m_GeoPar->findModule(hit->getSection(), hit->getSector(), hit->getLayer());
519
520 CLHEP::Hep3Vector globalPos;
521 globalPos[0] = hit->getPositionX();
522 globalPos[1] = hit->getPositionY();
523 globalPos[2] = hit->getPositionZ();
524
525 //localHitPos = refMod->globalToLocal(globalPos);
526 double hit_localPhiErr = corMod->getPhiStripWidth() / sqrt(12);
527 double hit_localZErr = corMod->getZStripWidth() / sqrt(12);
528
529 if (hit->inRPC()) {
530 //+++ scale localErr based on measured-in-Belle resolution
531 int nStrips = hit->getPhiStripMax() - hit->getPhiStripMin() + 1;
532 double dn = nStrips - 1.5;
533 double factor = std::pow((0.9 + 0.4 * dn * dn), 1.5) * 0.60;//measured-in-Belle resolution
534 hit_localPhiErr = hit_localPhiErr * sqrt(factor);
535
536 nStrips = hit->getZStripMax() - hit->getZStripMin() + 1;
537 dn = nStrips - 1.5;
538 factor = std::pow((0.9 + 0.4 * dn * dn), 1.5) * 0.55;//measured-in-Belle resolution
539 hit_localZErr = hit_localZErr * sqrt(factor);
540 }
541
542 Hep3Vector globalOrigin = corMod->getGlobalOrigin();
543 double sinphi = globalOrigin[1] / globalOrigin.mag();
544 double cosphi = globalOrigin[0] / globalOrigin.mag();
545
546 globalHitErr[0][0] = square(hit_localPhiErr * sinphi); //x
547 globalHitErr[0][1] = (hit_localPhiErr * sinphi) * (hit_localPhiErr * cosphi);
548 globalHitErr[0][2] = 0;
549 globalHitErr[1][1] = square(hit_localPhiErr * cosphi);;
550 globalHitErr[1][0] = (hit_localPhiErr * sinphi) * (hit_localPhiErr * cosphi);
551 globalHitErr[1][2] = 0;
552 globalHitErr[2][2] = square(hit_localZErr);;
553 globalHitErr[2][0] = 0;
554 globalHitErr[2][1] = 0;
555
556 switch (indDir) {
557
558 case VX:
559 indPos = globalPos.x();
560 break;
561
562 case VY:
563 indPos = globalPos.y();
564 break;
565
566 case VZ:
567 indPos = globalPos.z();
568 break;
569
570 default:
571 B2DEBUG(20, "error in bklm trackFit: illegal direction");
572
573 }
574
575 switch (depDir) {
576
577 case VX:
578 depPos = globalPos.x();
579 break;
580
581 case VY:
582 depPos = globalPos.y();
583 break;
584
585 case VZ:
586 depPos = globalPos.z();
587 break;
588
589 default:
590 B2DEBUG(20, "error in bklm trackFit: illegal direction");
591
592 }
593
594
595 A[ n ][ 0 ] = 1;
596 A[ n ][ 1 ] = indPos;
597
598 y[ n ] = depPos;
599
600 double error_raw = globalHitErr[indDir][indDir] + globalHitErr[depDir][depDir];
601 //double correlate_ = 2.0*globalHitErr[indDir][depDir]; //?
602 //double weight= error_raw - correlate_;
603 double weight = error_raw;
604 if (weight > 0) {
605 V_y_inverse[ n ][ n ] = 1.0 / weight;
606 } else {
607 V_y_inverse[ n ][ n ] = DBL_MAX;
608 }
609 ++n;//n is the index of measured points/hits
610 }
611
612 //HepMatrix AT = A.T();
613 //HepMatrix tmp = AT*V_y_inverse;
614 //V_A_inverse = tmp*A;
615 V_A_inverse = V_y_inverse.similarityT(A);
616
617 int ierr = 0;
618 V_A = V_A_inverse.inverse(ierr);
619
620 eta = V_A * A.T() * V_y_inverse * y;
621 error = V_A;
622
623// Calculate residuals:
624 HepMatrix residual = y - A * eta;
625 HepMatrix chisqr = residual.T() * V_y_inverse * residual;
626
627 return (chisqr.trace());
628
629}
double fit(std::list< KLMHit2d * > &listTrackPoint)
do fit and returns chi square of the fit.
float m_Chi2
Chi square of fit.
double fit1dTrack(std::list< KLMHit2d * > hitList, CLHEP::HepVector &eta, CLHEP::HepSymMatrix &error, int depDir, int indDir)
do fit in the global system
int m_NumHit
the number of hits on this track
double globalDistanceToHit(KLMHit2d *hit, double &error, double &sigma)
Distance from track to a hit in the global system.
BKLMTrackFitter()
Default constructor.
double distanceToHit(KLMHit2d *hit, double &error, double &sigma)
Distance from track to a hit in the plane of the module.
CLHEP::HepSymMatrix m_GlobalErr
track params errors in global system
CLHEP::HepVector m_GlobalPar
track params in global system
bklm::GeometryPar * m_GeoPar
pointer to GeometryPar singleton
double fit1dSectorTrack(std::list< KLMHit2d * > hitList, CLHEP::HepVector &eta, CLHEP::HepSymMatrix &error, int depDir, int indDir)
do fit in the y-x plane or z-x plane
CLHEP::HepVector m_SectorPar
track params in the sector local system
CLHEP::HepSymMatrix m_SectorErr
track params errors in the sector local system
bool m_Valid
Is fit valid.
bool m_globalFit
do fit in the local system or global system false: local sys; true: global sys.
KLM 2d hit.
Definition KLMHit2d.h:33
bool inRPC() const
Determine whether this 2D hit is in RPC or scintillator.
Definition KLMHit2d.h:185
int getLayer() const
Get layer number.
Definition KLMHit2d.h:132
int getZStripMax() const
Get last strip number for z plane.
Definition KLMHit2d.h:202
int getSection() const
Get section number.
Definition KLMHit2d.h:96
float getPositionZ() const
Get hit global position z coordinate.
Definition KLMHit2d.h:306
int getSector() const
Get sector number.
Definition KLMHit2d.h:114
float getPositionX() const
Get hit global position x coordinate.
Definition KLMHit2d.h:288
int getPhiStripMin() const
Get strip number for phi plane.
Definition KLMHit2d.h:218
int getZStripMin() const
Get strip number for z plane.
Definition KLMHit2d.h:194
int getPhiStripMax() const
Get last strip number for phi plane.
Definition KLMHit2d.h:226
float getPositionY() const
Get hit global position y coordinate.
Definition KLMHit2d.h:297
static GeometryPar * instance(void)
Static method to get a reference to the singleton GeometryPar instance.
Define the geometry of a BKLM module Each sector [octant] contains Modules.
Definition Module.h:76
const CLHEP::Hep3Vector globalToLocal(const CLHEP::Hep3Vector &v, bool reco=false) const
Transform space-point within this module from global to local coordinates.
Definition Module.cc:339
double getPhiStripWidth() const
Get phi-strip width.
Definition Module.h:137
const CLHEP::Hep3Vector getGlobalOrigin() const
Return the position (in global coordinates) of this module's sensitive-volume origin.
Definition Module.h:285
const CLHEP::Hep3Vector localToGlobal(const CLHEP::Hep3Vector &v, bool reco=false) const
Transform space-point within this module from local to global coordinates.
Definition Module.cc:326
double getZStripWidth() const
Get z-strip width.
Definition Module.h:155
constexpr T square(const T &x)
Calculate the square of the input.
Definition MathHelpers.h:21
double sqrt(double a)
sqrt for double
Definition beamHelpers.h:28
Abstract base class for different kinds of events.