BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
TMDCTsf Class Reference

A class to represent a Track Finder Segment(TSF). More...

#include <TMDCTsf.h>

Public Member Functions

 TMDCTsf (unsigned sl)
 Constructor of fixed shape.
virtual ~TMDCTsf ()
 Destructor.
void dump (const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
 dumps debug information.
AList< TSegmentsegments (const AList< TMLink > &links)
 finds segments.
AList< TSegmentcreateTsf (unsigned) const
void solveLeftRight (void)
 solves left-right ambiguityies.
 TMDCTsf (unsigned sl)
 Constructor of fixed shape.
virtual ~TMDCTsf ()
 Destructor.
void dump (const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
 dumps debug information.
AList< TSegmentsegments (const AList< TMLink > &links)
 finds segments.
AList< TSegmentcreateTsf (unsigned) const
void solveLeftRight (void)
 solves left-right ambiguityies.
 TMDCTsf (unsigned sl)
 Constructor of fixed shape.
virtual ~TMDCTsf ()
 Destructor.
void dump (const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
 dumps debug information.
AList< TSegmentsegments (const AList< TMLink > &links)
 finds segments.
AList< TSegmentcreateTsf (unsigned) const
void solveLeftRight (void)
 solves left-right ambiguityies.

Detailed Description

A class to represent a Track Finder Segment(TSF).

Definition at line 35 of file InstallArea/x86_64-el9-gcc13-dbg/include/TrkReco/TMDCTsf.h.

Constructor & Destructor Documentation

◆ TMDCTsf() [1/3]

TMDCTsf::TMDCTsf ( unsigned sl)

Constructor of fixed shape.

Constructor for user defined shape.

Definition at line 62 of file TMDCTsf.cxx.

62: _sl( sl ), _angle( 0.8 ) {}

◆ ~TMDCTsf() [1/3]

TMDCTsf::~TMDCTsf ( )
virtual

Destructor.

Definition at line 64 of file TMDCTsf.cxx.

64{}

◆ TMDCTsf() [2/3]

TMDCTsf::TMDCTsf ( unsigned sl)

Constructor of fixed shape.

Constructor for user defined shape.

◆ ~TMDCTsf() [2/3]

virtual TMDCTsf::~TMDCTsf ( )
virtual

Destructor.

◆ TMDCTsf() [3/3]

TMDCTsf::TMDCTsf ( unsigned sl)

Constructor of fixed shape.

Constructor for user defined shape.

◆ ~TMDCTsf() [3/3]

virtual TMDCTsf::~TMDCTsf ( )
virtual

Destructor.

Member Function Documentation

◆ createTsf() [1/3]

AList< TSegment > TMDCTsf::createTsf ( unsigned seedlayer) const

Definition at line 321 of file TMDCTsf.cxx.

321 {
322 if ( _cdc == 0 ) _cdc = TMDC::getTMDC();
323
324 AList<TMLink> seeds;
325 AList<TMLink> exhits;
326 AList<TSegment> list;
327
328 unsigned n = _all.length();
329 if ( n < 3 ) return list;
330 if ( seedlayer == 1 && _sl == 10 ) return list;
331
332 for ( unsigned i = 0; i < n; ++i )
333 {
334 TMLink* ll = _all[i];
335 // if (ll->wire()->localLayerId() == seedlayer && ll->tsfTag() == 0) seeds.append(ll);
336 if ( ll->wire()->localLayerId() == seedlayer ) seeds.append( ll );
337 if ( ll->wire()->localLayerId() > seedlayer ) exhits.append( ll );
338 } // get seeds and exhits.
339
340 for ( unsigned i = 0; i < seeds.length(); ++i )
341 {
342 AList<TMLink> forSegment;
343 TMLink* seed = seeds[i];
344 unsigned lId = seed->wire()->layerId();
345 int local = (int)seed->wire()->localId();
346 // cout<<"lId: "<<lId<<" loId: "<<local<<endl;
347 float phi0 = _cdc->layer( lId )->offset();
348 int nWir = (int)_cdc->layer( lId )->nWires();
349 float phi = phi0 + local * 2 * M_PI / nWir; // phi angle of seed.
350 // double angle = alpha(sl, seed);
351 forSegment.append( seed );
352
353 // for check
354 int hitsOnLayer[3] = { 0, 0, 0 };
355
356 for ( unsigned m = 0; m < exhits.length(); ++m )
357 {
358 TMLink* l = exhits[m];
359 unsigned lLayer = l->wire()->localLayerId();
360 unsigned tmpId = l->wire()->layerId();
361 int tmpLocal = l->wire()->localId();
362 float phi0tmp = _cdc->layer( tmpId )->offset();
363 int nWirtmp = (int)_cdc->layer( tmpId )->nWires();
364 int localOffset =
365 (int)( ( phi - phi0tmp ) / ( 2 * M_PI / nWirtmp ) ); // get the corresponding localId
366 // of exhits.
367
368 int diff = abs( tmpLocal - localOffset );
369
370 if ( diff > nWirtmp / 2 ) diff = nWirtmp - diff;
371 // cout<<"lId: "<<tmpId<<" loId: "<<tmpLocal<<" diff wire: "<<diff
372 //<<" cal value = "<<fabs(acos((l->position() -
373 // seed->position()).unit().dot(-seed->position().unit())))<<endl;
374 if ( diff > lLayer + 2 ) continue; // check in natural phase..
375
376 // double DRIFT = l->cDrift();
377 // const HepPoint3D dirZ(0.0, 0.0, 1.0);
378 // HepPoint3D pos1 = l->positionD() - DRIFT *
379 // dirZ.cross(l->positionD().unit()); HepPoint3D pos2 = l->positionD() + DRIFT *
380 // dirZ.cross(l->positionD().unit()); if (fabs(acos((pos1 -
381 // seed->position()).unit().dot(-seed->position().unit()))) < _angle
382 // || fabs(acos((pos2 -
383 // seed->position()).unit().dot(-seed->position().unit()))) < _angle) {
384 if ( fabs( acos( ( l->position() - seed->position() )
385 .unit()
386 .dot( -seed->position().unit() ) ) ) < _angle )
387 {
388 forSegment.append( l );
389 ++hitsOnLayer[lLayer - 1 - seedlayer];
390 }
391 }
392
393 // check
394 int fireLayers = 0;
395 for ( unsigned j = 0; j < 3; ++j )
396 {
397 if ( hitsOnLayer[j] > 0 ) ++fireLayers;
398 }
399 if ( fireLayers < 2 ) { continue; }
400 list.append( new TSegment( forSegment ) );
401 }
402 return list;
403}
const Int_t n
#define M_PI
Definition TConstant.h:4
unsigned localLayerId(void) const
returns local layer id in a super layer.
unsigned localId(void) const
returns local id in a wire layer.
unsigned layerId(void) const
returns layer id.
static TMDC * getTMDC(void)
Definition TMDC.cxx:84

Referenced by segments().

◆ createTsf() [2/3]

AList< TSegment > TMDCTsf::createTsf ( unsigned ) const

◆ createTsf() [3/3]

AList< TSegment > TMDCTsf::createTsf ( unsigned ) const

◆ dump() [1/3]

void TMDCTsf::dump ( const std::string & message = std::string( "" ),
const std::string & prefix = std::string( "" ) ) const

dumps debug information.

Definition at line 66 of file TMDCTsf.cxx.

66 {
67 std::cout << pre;
68 std::cout << "tsf : " << _wires.length() << " : ";
69 for ( unsigned i = 0; i < _wires.length(); i++ )
70 {
71 TMDCWire* w = _wires[i];
72 std::cout << w->layerId() << "-" << w->localId() << ", ";
73 }
74 std::cout << std::endl;
75}
double w

◆ dump() [2/3]

void TMDCTsf::dump ( const std::string & message = std::string(""),
const std::string & prefix = std::string("") ) const

dumps debug information.

◆ dump() [3/3]

void TMDCTsf::dump ( const std::string & message = std::string(""),
const std::string & prefix = std::string("") ) const

dumps debug information.

◆ segments() [1/3]

AList< TSegment > TMDCTsf::segments ( const AList< TMLink > & links)

finds segments.

Definition at line 190 of file TMDCTsf.cxx.

190 {
191 _all.removeAll();
192 _all.append( links );
193
194 AList<TMLink> seeds1;
195 AList<TMLink> seeds2;
196 for ( int i = 0; i < _all.length(); ++i )
197 {
198 if ( _all[i]->wire()->localLayerId() == 0 ) seeds1.append( _all[i] );
199 else if ( _all[i]->wire()->localLayerId() == 1 ) seeds2.append( _all[i] );
200 else continue;
201 }
202 AList<TSegment> list = createTsf( 0 ); // get 1234 tsf.
203 unsigned n = list.length();
204 AList<TSegment> splitted;
205 AList<TMLink> seedNeighbors;
206 for ( unsigned i = 0; i < n; ++i )
207 {
208 seedNeighbors.removeAll();
209 TSegment* c = list[i];
210
211 // append seed's neighbors
212 for ( int j = 0; j < c->links().length(); ++j )
213 {
214 if ( c->links()[j]->wire()->localLayerId() > 0 ) continue;
215 unsigned seedId = c->links()[j]->wire()->localId();
216 for ( int k = 0; k < seeds1.length(); ++k )
217 {
218 if ( seeds1[k]->wire()->localIdForPlus() + 1 == seedId ||
219 seeds1[k]->wire()->localIdForMinus() - 1 == seedId )
220 seedNeighbors.append( seeds1[k] );
221 }
222 break;
223 }
224
225 AList<TSegment> newClusters = c->splitTsf( seedNeighbors );
226 // cout<<"newClusters.length = "<<newClusters.length()<<endl;
227 splitted.append( c ); // remove the segment created by TMDCTsf here!!!
228 if ( newClusters.length() == 0 ) continue;
229 list.append( newClusters );
230 }
231 list.remove( splitted );
232 HepAListDeleteAll( splitted );
233 // cout<<"sl = "<<_sl<<" list1234 = "<<list.length()<<endl;
234
235 AList<TSegment> list2 = createTsf( 1 ); // get 234 tsf.
236 n = list2.length();
237 AList<TSegment> splitted2;
238
239 for ( unsigned i = 0; i < n; ++i )
240 {
241 seedNeighbors.removeAll();
242 TSegment* c = list2[i];
243
244 // append seed's neighbors
245 for ( int j = 0; j < c->links().length(); ++j )
246 {
247 if ( c->links()[j]->wire()->localLayerId() != 1 ) continue;
248 unsigned seedId = c->links()[j]->wire()->localId();
249 for ( int k = 0; k < seeds2.length(); ++k )
250 {
251 if ( seeds2[k]->wire()->localIdForPlus() + 1 == seedId ||
252 seeds2[k]->wire()->localIdForMinus() - 1 == seedId )
253 seedNeighbors.append( seeds2[k] );
254 }
255 break;
256 }
257
258 AList<TSegment> newClusters2 = c->splitTsf( seedNeighbors );
259 // cout<<"newClusters2.length = "<<newClusters2.length()<<endl;
260 splitted2.append( c );
261 if ( newClusters2.length() == 0 ) continue;
262 list2.append( newClusters2 );
263 }
264 list2.remove( splitted2 );
265 HepAListDeleteAll( splitted2 );
266 // cout<<"sl = "<<_sl<<" list234 = "<<list2.length()<<endl;
267
268 list.append( list2 );
269
270 // check segment, remove the multi segs.
271 AList<TSegment> badList;
272 for ( int i = 0; i < list.length(); ++i )
273 {
274 for ( int j = i + 1; j < list.length(); ++j )
275 {
276 AList<TMLink> links = list[j]->links();
277 AList<TMLink> multiLinks;
278 for ( int k = 0; k < links.length(); ++k )
279 {
280 TMLink& l = *links[k];
281 if ( list[i]->links().hasMember( l ) ) multiLinks.append( l );
282 }
283 if ( multiLinks.length() < 2 ) continue;
284 unsigned minLength = links.length();
285 if ( links.length() > list[i]->links().length() ) minLength = list[i]->links().length();
286 if ( minLength - multiLinks.length() > 1 ) continue;
287 int nHits[4] = { 0 }; // in each layer.
288 int multiLayers = 0;
289 for ( int k = 0; k < multiLinks.length(); ++k )
290 ++nHits[multiLinks[k]->hit()->wire()->localLayerId()];
291 for ( int k = 0; k < 4; ++k )
292 if ( nHits[k] > 0 ) ++multiLayers;
293 if ( multiLayers >= 2 && ( links.length() > list[i]->links().length() ) )
294 badList.append( list[i] );
295 else if ( multiLayers >= 2 ) badList.append( list[j] );
296 else continue;
297 }
298 }
299 list.remove( badList );
300
301 // reset links in badList.
302 for ( int i = 0; i < badList.length(); ++i )
303 {
304 AList<TMLink> bads = badList[i]->links();
305 for ( int j = 0; j < bads.length(); ++j )
306 {
307 unsigned n = bads[j]->tsfTag();
308 if ( n == 0 ) continue;
309 else
310 {
311 --n;
312 bads[j]->tsfTag( n );
313 }
314 }
315 }
316 HepAListDeleteAll( badList );
317
318 return list;
319}
AList< TSegment > createTsf(unsigned) const
Definition TMDCTsf.cxx:321
AList< TSegment > splitTsf(AList< TMLink > &)
const AList< TMLink > & links(unsigned mask=0) const

◆ segments() [2/3]

AList< TSegment > TMDCTsf::segments ( const AList< TMLink > & links)

finds segments.

◆ segments() [3/3]

AList< TSegment > TMDCTsf::segments ( const AList< TMLink > & links)

finds segments.

◆ solveLeftRight() [1/3]

void TMDCTsf::solveLeftRight ( void )

solves left-right ambiguityies.

Definition at line 114 of file TMDCTsf.cxx.

114 {
115 //...For debug...
116 // this->dump();
117
118 // TMDCWire * innerWire = _wires[0];
119 // TMDCWireHit * innerHit = innerWire->hit();
120
121 // unsigned outerMostLayer = _wires.last()->layerId();
122 // unsigned i = _wires.length();
123 // while (_wires[--i]->layerId() == outerMostLayer) {
124 // TMDCWireHit * outerHit = _wires[i]->hit();
125 // if (! outerHit) continue;
126
127 // //...Find four lines by two hit points...
128 // // AList<TMDCLine> lines = innerHit->lines(outerHit);
129 // // AList<TMDCLine> lines; // = innerHit->lines(outerHit);
130
131 // //...Line loop...
132 // for (unsigned ii = 0; ii < 4; ii++) {
133 // TMDCLine * l = lines[ii];
134
135 // //...For debug...
136 // // l->dump();
137
138 // //...Find hits on this line...
139 // unsigned j = i;
140 // while (TMDCWire * w = _wires[--j]) {
141
142 // //...Check condition...
143 // if (w == innerWire) break;
144 // if (w->layerId() == outerMostLayer) continue;
145 // TMDCWireHit * hit = w->hit();
146 // if (! hit) continue;
147
148 // //...Append this hit...
149 // l->appendHit(hit);
150
151 // //...Obtain distance of closest approach...
152 // double distance = l->distance(* l->closest().last());
153
154 // //...Cal. tolerable distance...
155 // unsigned leftRight = * (l->leftRight().last());
156 // double tolerable = 5. * hit->dDistance(leftRight);
157
158 // //...Is this OK?...
159 // if (distance > tolerable) {
160 // l->removeLastHit();
161 // continue;
162 // }
163
164 // //...For debug...
165 // // hit->dump("", " ");
166 // // std::cout << "distance = " << distance << std::endl;
167 // }
168
169 // //...Check # of hits on this line
170 // if (l->hits().length() > 2) {
171 // unsigned i = 0;
172 // while (TMDCWireHit * h = (l->hits())[i]) {
173 // unsigned leftRight = * (l->leftRight())[i];
174 // unsigned newState = h->state() | (1 << leftRight);
175 // h->state(newState);
176 // ++i;
177
178 // //...For debug...
179 // // h->dump("", " ");
180 // }
181 // }
182
183 // //...Delete line here...
184 // delete l;
185 // }
186 // }
187}

◆ solveLeftRight() [2/3]

void TMDCTsf::solveLeftRight ( void )

solves left-right ambiguityies.

◆ solveLeftRight() [3/3]

void TMDCTsf::solveLeftRight ( void )

solves left-right ambiguityies.


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