Belle II Software development
BKLMTrackFinder Class Reference

track finding procedure More...

#include <BKLMTrackFinder.h>

Public Member Functions

 BKLMTrackFinder ()
 Default constructor.
 
 BKLMTrackFinder (BKLMTrackFitter *fitter)
 The track finder requires a track fitter.
 
 ~BKLMTrackFinder ()
 Destructor.
 
void registerFitter (BKLMTrackFitter *fitter)
 Register a fitter if not constructed with one.
 
bool filter (const std::list< KLMHit2d * > &seed, std::list< KLMHit2d * > &hits, std::list< KLMHit2d * > &track)
 find associated hits and do fit.
 
void setGlobalFit (bool localOrGlobal)
 set the fitting mode, local system or global system
 

Protected Attributes

BKLMTrackFitterm_Fitter
 pointer to the fitter
 
bool m_globalFit
 do fit in the local system or global system false: local sys; true: global sys.
 

Detailed Description

track finding procedure

Definition at line 25 of file BKLMTrackFinder.h.

Constructor & Destructor Documentation

◆ BKLMTrackFinder() [1/2]

Default constructor.

Definition at line 22 of file BKLMTrackFinder.cc.

23{
24}

◆ BKLMTrackFinder() [2/2]

BKLMTrackFinder ( BKLMTrackFitter fitter)
explicit

The track finder requires a track fitter.

Definition at line 26 of file BKLMTrackFinder.cc.

26 :
27 m_Fitter(fitter),
28 m_globalFit(false)
29{
30}
bool m_globalFit
do fit in the local system or global system false: local sys; true: global sys.
BKLMTrackFitter * m_Fitter
pointer to the fitter

◆ ~BKLMTrackFinder()

Destructor.

Definition at line 33 of file BKLMTrackFinder.cc.

34{
35}

Member Function Documentation

◆ filter()

bool filter ( const std::list< KLMHit2d * > &  seed,
std::list< KLMHit2d * > &  hits,
std::list< KLMHit2d * > &  track 
)

find associated hits and do fit.

find associated hits and do fit

Definition at line 45 of file BKLMTrackFinder.cc.

48{
49 track = seed;
50
51 if (m_Fitter == 0) {
52 B2ERROR("BKLMTrackFinder: Fitter not registered");
53 return (false);
54 }
55
56 m_Fitter->fit(track);//fit seed
57
58 for (KLMHit2d* hit2d : hits) {
59 if (hit2d->getSubdetector() != KLMElementNumbers::c_BKLM)
60 continue;
61
62 // Prevent duplicate hits or hits on same layer
63 // no duplicate hit is already guaranteed and now we allow hits on same layer so the following is commented out
64 // bool skip = false;
65 // for (j = track.begin(); j != track.end(); ++j) {
66 // if ((*j)->getLayer() == (*i)->getLayer())
67 // skip = true;
68 // }
69 // if (skip == true)
70 // continue;
71
72 if (hit2d->isOnStaTrack() == false) {
73 double error, sigma;
74 if (m_globalFit)
75 m_Fitter->globalDistanceToHit(hit2d, error, sigma);
76 else m_Fitter->distanceToHit(hit2d, error, sigma);
77 //B2INFO("BKLMTrackFinder" << " Error: " << error << " Sigma: " << sigma);
78 if (sigma < 5.0) {
79 track.push_back(hit2d);
80 }
81 }
82 }
83
84 if (track.size() < 3)
85 return false;
86
87 // Fit with new hits
88 double chisqr = m_Fitter->fit(track);
89 B2DEBUG(20, "BKLMTrackFinder:" << "ChiSqr: " << chisqr);
90
91 // Do this the hard way to count each layer separately.
92 std::list<int> hitLayers;
93 for (KLMHit2d* hit2d : track) {
94 hitLayers.push_back(hit2d->getLayer());
95 }
96 hitLayers.sort();
97 hitLayers.unique();
98
99 int layers = (*(--hitLayers.end()) - * (hitLayers.begin()));
100 int noHits = hitLayers.size();
101
102 if (noHits >= 4 && double(noHits) / double(layers) >= 0.75) {
103 return true;
104 } else {
105 return false;
106 }
107}
double fit(std::list< KLMHit2d * > &listTrackPoint)
do fit and returns chi square of the fit.
double globalDistanceToHit(KLMHit2d *hit, double &error, double &sigma)
Distance from track to a hit in the global system.
double distanceToHit(KLMHit2d *hit, double &error, double &sigma)
Distance from track to a hit in the plane of the module.
KLM 2d hit.
Definition: KLMHit2d.h:33

◆ registerFitter()

void registerFitter ( BKLMTrackFitter fitter)

Register a fitter if not constructed with one.

Definition at line 38 of file BKLMTrackFinder.cc.

39{
40 m_Fitter = fitter;
42}
void setGlobalFit(bool localOrGlobal)
set the fitting mode, local system or global system

◆ setGlobalFit()

void setGlobalFit ( bool  localOrGlobal)
inline

set the fitting mode, local system or global system

Definition at line 47 of file BKLMTrackFinder.h.

48 {
49 m_globalFit = localOrGlobal;
50 }

Member Data Documentation

◆ m_Fitter

BKLMTrackFitter* m_Fitter
protected

pointer to the fitter

Definition at line 55 of file BKLMTrackFinder.h.

◆ m_globalFit

bool m_globalFit
protected

do fit in the local system or global system false: local sys; true: global sys.

Definition at line 58 of file BKLMTrackFinder.h.


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