CGEM BOSS 6.6.5.h
BESIII Offline Software System
Loading...
Searching...
No Matches
TBuilderCosmic Class Reference

A class to build a cosmic track. More...

#include <TBuilderCosmic.h>

+ Inheritance diagram for TBuilderCosmic:

Public Member Functions

 TBuilderCosmic (const std::string &name, float salvageLevel)
 Constructor.
 
virtual ~TBuilderCosmic ()
 Destructor.
 
TTrackbuildStereo (TTrack &track, const AList< TMLink > &) const
 appends stereo hits to a track.
 
- Public Member Functions inherited from TBuilder0
 TBuilder0 (const std::string &name)
 Constructor.
 
 TBuilder0 (const std::string &name, float salvageLevel)
 Constructor with salvage level.
 
 TBuilder0 (const std::string &name, float stereoZ3, float stereoZ4, float stereoChisq3, float stereoChisq4, float stereoMaxSigma, unsigned fittingCorrections, float salvageLevel)
 Constructor with parameters.
 
virtual ~TBuilder0 ()
 Destructor.
 
const std::string & name (void) const
 returns name.
 
void dump (const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
 dumps debug information.
 
const TMSelectortrackSelector (void) const
 returns a track selector.
 
TTrackbuildRphi (const AList< TMLink > &) const
 builds a r/phi track from TMLinks or from Segments.
 
TTrackbuildStereo0 (TTrack &track, const AList< TMLink > &) const
 appends stereo hits to a track. (old version)
 
void appendClusters (TTrack &track, const AList< TMLink > &) const
 appends TMLinks in a list.
 
void salvage (TTrack &track, AList< TMLink > &list) const
 salvages links in a list. Used links will be removed from a list.
 
virtual int fit (TTrackBase &) const
 fits a track using a private fitter.
 
virtual const TMSelectortrackSelector (const TMSelector &)
 sets a track selector.
 

Additional Inherited Members

- Protected Attributes inherited from TBuilder0
TMSelector _circleSelector
 
TMSelector _trackSelector
 
TMSelector _lineSelector
 
float _stereoZ3
 
float _stereoZ4
 
float _stereoChisq3
 
float _stereoChisq4
 
float _stereoMaxSigma
 

Detailed Description

A class to build a cosmic track.

Definition at line 36 of file TBuilderCosmic.h.

Constructor & Destructor Documentation

◆ TBuilderCosmic()

TBuilderCosmic::TBuilderCosmic ( const std::string & name,
float salvageLevel )

Constructor.

Definition at line 24 of file TBuilderCosmic.cxx.

25: TBuilder0(name, salvageLevel), _fitter("TBuilderCosmic Fitter") {
26}
const std::string & name(void) const
returns name.
Definition TBuilder0.h:137
TBuilder0(const std::string &name)
Constructor.
Definition TBuilder0.cxx:31

◆ ~TBuilderCosmic()

TBuilderCosmic::~TBuilderCosmic ( )
virtual

Destructor.

Definition at line 28 of file TBuilderCosmic.cxx.

28 {
29}

Member Function Documentation

◆ buildStereo()

TTrack * TBuilderCosmic::buildStereo ( TTrack & track,
const AList< TMLink > & list ) const
virtual

appends stereo hits to a track.

Reimplemented from TBuilder0.

Definition at line 32 of file TBuilderCosmic.cxx.

32 {
33#ifdef TRKRECO_DEBUG_DETAIL
34 std::cout << name() << "(stereo) ... dump of stereo candidate hits" << std::endl;
35 AList<TMLink> tmp = list;
36 tmp.sort(SortByWireId);
37 std::cout << " ";
38 for (unsigned i = 0; i < tmp.length(); i++) {
39 TMLink * l = tmp[i];
40 std::cout << l->wire()->layerId() << "-";
41 std::cout << l->wire()->localId() << ",";
42 }
43 std::cout << std::endl;
44#endif
45
46 //...Check # of links...
47 if (list.length() < _lineSelector.nLinksStereo()) {
48#ifdef TRKRECO_DEBUG_DETAIL
49 std::cout << name() << "(stereo) ... rejected by nLinks(";
50 std::cout << list.length() << ") < ";
51 std::cout << _lineSelector.nLinks() << std::endl;
52#endif
53 return NULL;
54 }
55
56 //...Calculate s and z for every links...
57 unsigned n = list.length();
58 AList<TMLink> forLine;
59 for (unsigned i = 0; i < n; i++) {
60 TMLink * l = list[i];
61
62 //... Require Fitting vaildation
63 if(!(l->hit()->state()& WireHitFittingValid)) continue;
64
65 TMLink * t = new TMLink(* l);
66
67 //...Assuming wire position...
68 t->leftRight(2);
69 int err = track.szPosition(* t);
70 if (err) {
71 delete t;
72 continue;
73 }
74
75 //...Store the sz link...
76 t->link(l);
77 forLine.append(t);
78 }
79
80#ifdef TRKRECO_DEBUG_DETAIL
81 std::cout << name() << "(stereo) ... dump of sz links" << std::endl;
82 std::cout << " ";
83 tmp = forLine;
84 tmp.sort(SortByWireId);
85 for (unsigned i = 0; i < tmp.length(); i++) {
86 TMLink * l = tmp[i];
87 std::cout << l->wire()->layerId() << "-";
88 std::cout << l->wire()->localId() << ",";
89 }
90 std::cout << std::endl;
91#endif
92
93 //...Check # of sz links...
94 if (forLine.length() < _lineSelector.nLinksStereo()) {
95#ifdef TRKRECO_DEBUG_DETAIL
96 std::cout << name() << "(stereo) ... rejected by sz nLinks(";
97 std::cout << forLine.length() << ") < ";
98 std::cout << _lineSelector.nLinks() << std::endl;
99#endif
100 HepAListDeleteAll(forLine);
101 return NULL;
102 }
103
104 //...Make a line...
105 unsigned nLine = forLine.length();
106 TLine0 line(forLine);
107 int err = line.fit();
108
109 //...Linear fit...
110 if (err < 0) {
111#ifdef TRKRECO_DEBUG_DETAIL
112 std::cout << name() << "(stereo) ... linear fit failure. nLinks(";
113 std::cout << forLine.length() << ")" << std::endl;
114#endif
115 HepAListDeleteAll(forLine);
116 return NULL;
117 }
118
119#ifdef TRKRECO_DEBUG_DETAIL
120 std::cout << name() << "(stereo) ... dump of left-right" << std::endl;
121#endif
122
123 //...Decide Left or Right...
124 AList<TMLink> forNewLine;
125 for (unsigned i = 0; i < nLine; i++) {
126 TMLink * t = forLine[i];
127 TMLink * tl = new TMLink(* t);
128 TMLink * tr = new TMLink(* t);
129
132
133 int err = track.szPosition(* tl);
134 if (err) {
135 delete tl;
136 tl = NULL;
137 }
138 err = track.szPosition(* tr);
139 if (err) {
140 delete tr;
141 tr = NULL;
142 }
143 if ((tl == NULL) && (tr == NULL)) continue;
144
145 TMLink * best;
146 if (tl == NULL) best = tr;
147 else if (tr == NULL) best = tl;
148 else {
149 if (line.distance(* tl) < line.distance(* tr)) {
150 best = tl;
151 delete tr;
152 }
153 else {
154 best = tr;
155 delete tl;
156 }
157 }
158
159#ifdef TRKRECO_DEBUG_DETAIL
160 std::cout << " ";
161 std::cout << t->wire()->layerId() << "-";
162 std::cout << t->wire()->localId();
163 if (tl != NULL)
164 std::cout << ",left " << tl->position() << "," << line.distance(* tl);
165 if (tr != NULL)
166 std::cout << ",right " << tr->position() << "," << line.distance(* tr);
167 std::cout << std::endl;
168#endif
169
170 best->link(t->link());
171 forNewLine.append(best);
172 }
173
174 //...Check # of sz links...
175 if (forNewLine.length() < _lineSelector.nLinksStereo()) {
176#ifdef TRKRECO_DEBUG_DETAIL
177 std::cout << name() << "(stereo) ... rejected by lr nLinks(";
178 std::cout << forNewLine.length() << ") < ";
179 std::cout << _lineSelector.nLinks() << std::endl;
180#endif
181 HepAListDeleteAll(forLine);
182 HepAListDeleteAll(forNewLine);
183 return NULL;
184 }
185
186 //...Create new line...
187#ifdef TRKRECO_DEBUG_DETAIL
188 std::cout << name() << "(stereo) ... creating a new line" << std::endl;
189#endif
190 unsigned nNewLine = forNewLine.length();
191 TLine0 newLine(forNewLine);
192
193 //...Make a seed track again
194 err = newLine.fit();
195
196 //...Linear fit...
197 if (err < 0) {
198#ifdef TRKRECO_DEBUG_DETAIL
199 std::cout << name() << "(stereo) ... 2nd linear fit failure. nLinks(";
200 std::cout << forNewLine.length() << ")" << std::endl;
201#endif
202 HepAListDeleteAll(forLine);
203 HepAListDeleteAll(forNewLine);
204 return NULL;
205 }
206
207 //...Remove bad points...
208 AList<TMLink> bad;
209// newLine.refine(bad, 40.); //Liuqg, meaningless while without magnetic field
210// err = newLine.fit();
211// newLine.refine(bad, 20.);
212// err = newLine.fit();
213// newLine.refine(bad, 10.);
214// err = newLine.fit();
215
216 //...Linear fit again...
217 if (err < 0) {
218 HepAListDeleteAll(forLine);
219 HepAListDeleteAll(forNewLine);
220#ifdef TRKRECO_DEBUG_DETAIL
221 std::cout << " appendStereo cut ... new line 2nd linear fit failure. ";
222 std::cout << "# of links = " << n << "," << nLine;
223 std::cout << "," << nNewLine << std::endl;
224#endif
225 return NULL;
226 }
227
228 //...3D fit...
229 const AList<TMLink> & good = newLine.links();
230 unsigned nn = good.length();
231 for (unsigned i = 0; i < nn; i++) {
232 track.append(* good[i]->link());
233 }
234 Vector a(5);
235 a = track.helix().a();
236 a[3] = newLine.b();
237 a[4] = track.charge() * newLine.a();
238 track._helix->a(a);
239
240#ifdef LINE_COSMIC
241 T3DLine * Ltrack = new T3DLine(track);
242
243 //...Refine...
244 err = _fitter.fit(*Ltrack);
245 Ltrack->refine(bad, _trackSelector.maxSigma() * 30.);
246 err = _fitter.fit(*Ltrack);
247 Ltrack->refine(bad, _trackSelector.maxSigma() * 3.);
248 err = _fitter.fit(*Ltrack);
249// Ltrack->refine(bad, _trackSelector.maxSigma() * 0.21); //liuqg, for prelimilary test
250 track.refine(bad, _trackSelector.maxSigma());
251 err = _fitter.fit(*Ltrack);
252
253 //...Test it...
254/* if (! _trackSelector.select(*Ltrack)) {
255 HepAListDeleteAll(forLine);
256 HepAListDeleteAll(forNewLine);
257 delete Ltrack;
258 return NULL;
259 }
260*/
261 //...Termination...
262 HepAListDeleteAll(forLine);
263 HepAListDeleteAll(forNewLine);
264 track.removeLinks();
265 track.append(Ltrack->links());
266 Vector a1(5);
267 a1 = Ltrack->helix().a();
268 track._helix->a(a1);
269 delete Ltrack;
270 return & track;
271#endif
272
273 //...Refine...
274 err = _fitter.fit(track);
275 track.refine(bad, _trackSelector.maxSigma() * 30.);
276 err = _fitter.fit(track);
277 track.refine(bad, _trackSelector.maxSigma() * 3.);
278 err = _fitter.fit(track);
279 track.refine(bad, _trackSelector.maxSigma()); //liuqg, for prelimilary test
280// track.refine(bad, _trackSelector.maxSigma() * 0.21);
281 err = _fitter.fit(track);
282 //...Test it...
283 if (! _trackSelector.select(track)) {
284 HepAListDeleteAll(forLine);
285 HepAListDeleteAll(forNewLine);
286 return NULL;
287 }
288
289 //...Termination...
290 HepAListDeleteAll(forLine);
291 HepAListDeleteAll(forNewLine);
292 return & track;
293}
const Int_t n
#define WireHitFittingValid
Definition TMDCWireHit.h:29
#define WireHitLeft
Definition TMDCWireHit.h:21
#define WireHitRight
Definition TMDCWireHit.h:22
const HepVector & a(void) const
returns helix parameters.
A class to represent a track in tracking.
Definition T3DLine.h:50
Helix helix(void) const
approximated helix class
Definition T3DLine.cxx:120
TMSelector _trackSelector
Definition TBuilder0.h:107
TMSelector _lineSelector
Definition TBuilder0.h:110
int fit(TTrackBase &) const
A class to represent a track in tracking.
Definition TLine0.h:30
unsigned state(void) const
returns state.
unsigned localId(void) const
returns local id in a wire layer.
Definition TMDCWire.h:213
unsigned layerId(void) const
returns layer id.
Definition TMDCWire.h:219
unsigned nLinks(void) const
returns min. # of hits(TMLinks) requried.
Definition TMSelector.h:133
double maxSigma(void) const
returns max. sigma for each TMLink.
Definition TMSelector.h:201
unsigned nLinksStereo(void) const
returns min. # of stereo hits(TMLinks) requried.
Definition TMSelector.h:218
bool select(TTrackBase &) const
returns true if given track satisfys criteria after fitting.
virtual void refine(AList< TMLink > &list, double maxSigma)
removes bad points by pull. The bad points are removed from the track, and are returned in 'list'.
virtual void removeLinks(void)
void append(TMLink &)
appends a TMLink.
const AList< TMLink > & links(unsigned mask=0) const
returns a list of masked TMLinks assigned to this track. 'mask' will be applied if mask is not 0.
const Helix & helix(void) const
returns helix parameter.
Definition TTrack.h:477
int szPosition(TMLink &link) const
calculates arc length and z for a stereo hit.
Definition TTrack.cxx:3372
double charge(void) const
returns charge.
Definition TTrack.h:504
int t()
Definition t.c:1

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