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

◆ 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: