BOSS 7.0.9
BESIII Offline Software System
Loading...
Searching...
No Matches
TMLink.cxx File Reference
#include "TrkReco/TMLink.h"
#include "TrkReco/TMDCWireHit.h"
#include "TrkReco/TMDCWireHitMC.h"
#include "TrkReco/TMDCUtil.h"
#include "TrkReco/TTrackHEP.h"
#include "CLHEP/Alist/ConstAList.h"

Go to the source code of this file.

Macros

#define MCC_MAX   1000
 

Functions

unsigned NLayers (const AList< TMLink > &list)
 returns # of layers.
 
void NHits (const AList< TMLink > &links, unsigned nHits[43])
 
void NHitsSuperLayer (const AList< TMLink > &links, unsigned nHits[11])
 returns # of hits per super layer.
 
void Dump (const CAList< TMLink > &links, const std::string &msg, const std::string &pre)
 dumps TMLinks.
 
void Dump (const TMLink &link, const std::string &msg, const std::string &pre)
 
unsigned NStereoHits (const AList< TMLink > &links)
 returns # of stereo hits.
 
unsigned NAxialHits (const AList< TMLink > &links)
 returns # of axial hits.
 
AList< TMLinkAxialHits (const AList< TMLink > &links)
 returns axial hits.
 
AList< TMLinkStereoHits (const AList< TMLink > &links)
 returns stereo hits.
 
TMLinkInnerMost (const AList< TMLink > &a)
 returns the inner(outer)-most link.
 
TMLinkOuterMost (const AList< TMLink > &a)
 
void SeparateCores (const AList< TMLink > &input, AList< TMLink > &cores, AList< TMLink > &nonCores)
 separate cores and non-cores.
 
AList< TMLinkCores (const AList< TMLink > &input)
 
int SortByWireId (const void *av, const void *bv)
 Sorter.
 
int SortByX (const void *av, const void *bv)
 
unsigned Width (const AList< TMLink > &list)
 returns width(wire cell unit) of given AList<TMLink>. This function assumes that all TMLink's are in the same super layer.
 
AList< TMLinkEdges (const AList< TMLink > &list)
 returns links which are edges. This function assumes that all TMLink's are in the same super layer.
 
AList< TMLinkSameLayer (const AList< TMLink > &list, const TMLink &a)
 returns links which are in the same layer as 'a' or 'id'.
 
AList< TMLinkSameSuperLayer (const AList< TMLink > &list, const TMLink &a)
 returns links which are in the same super layer as 'a' or 'id'.
 
AList< TMLinkSameLayer (const AList< TMLink > &list, unsigned id)
 
AList< TMLinkSameSuperLayer (const AList< TMLink > &list, unsigned id)
 
AList< TMLinkInOut (const AList< TMLink > &list)
 returns links which are in the inner most and outer most layer. This function assumes that all TMLink's are in the same super layer.
 
unsigned SuperLayer (const AList< TMLink > &list)
 returns super layer pattern.
 
unsigned SuperLayer (const AList< TMLink > &links, unsigned minN)
 
unsigned NSuperLayers (const AList< TMLink > &list)
 returns # of layers.
 
unsigned NSuperLayers (const AList< TMLink > &links, unsigned minN)
 
unsigned NMissingAxialSuperLayers (const AList< TMLink > &links)
 
const TTrackHEPLinks2HEP (const AList< TMLink > &links)
 returns TTrackHEP
 

Macro Definition Documentation

◆ MCC_MAX

#define MCC_MAX   1000

Function Documentation

◆ AxialHits()

AList< TMLink > AxialHits ( const AList< TMLink > &  links)

returns axial hits.

Definition at line 314 of file TMLink.cxx.

314 {
316 unsigned n = links.length();
317 for (unsigned i = 0; i < n; i++) {
318 if (links[i]->wire()->axial())
319 a.append(links[i]);
320 }
321 return a;
322}
const Int_t n

◆ Cores()

AList< TMLink > Cores ( const AList< TMLink > &  input)

Definition at line 381 of file TMLink.cxx.

381 {
383 unsigned n = input.length();
384 for (unsigned i = 0; i < n; i++) {
385 TMLink & t = * input[i];
386 const TMDCWireHit & h = * t.hit();
387 if (h.state() & WireHitFittingValid)
388 a.append(t);
389 }
390 return a;
391}
#define WireHitFittingValid
Definition: TMDCWireHit.h:29
TTree * t
Definition: binning.cxx:23
unsigned state(void) const
returns state.
Definition: TMDCWireHit.h:230

◆ Dump() [1/2]

void Dump ( const CAList< TMLink > &  links,
const std::string &  msg,
const std::string &  pre 
)

dumps TMLinks.

Definition at line 185 of file TMLink.cxx.

185 {
186 bool mc = (msg.find("mc") != std::string::npos);
187 bool pull = (msg.find("pull") != std::string::npos);
188 bool flag = (msg.find("flag") != std::string::npos);
189 bool sort = (msg.find("sort") != std::string::npos);
190 bool stereo = (msg.find("stereo") != std::string::npos);
191 bool detail = (msg.find("detail") != std::string::npos);
192 bool pos = (msg.find("position") != std::string::npos);
193 if (detail)
194 mc = pull = flag = sort = true;
195
196 CAList<TMLink> tmp = links;
197 if (sort)
198 tmp.sort(SortByWireId);
199 unsigned n = tmp.length();
200 unsigned nForFit = 0;
201#define MCC_MAX 1000
202 unsigned MCC0[MCC_MAX];
203 unsigned MCC1[MCC_MAX];
204 for (unsigned i = 0; i < MCC_MAX; i++) {
205 MCC0[i] = 0;
206 MCC1[i] = 0;
207 }
208 bool MCCOverFlow = false;
209
210 std::cout << pre;
211 for (unsigned i = 0; i < n; i++) {
212 const TMLink & l = * tmp[i];
213 std::cout << l.wire()->name();
214
215 double a = l.pull();
216 unsigned mcId = 0;
217 if (mc)
218 if (l.hit()->mc())
219 if (l.hit()->mc()->hep())
220 mcId = l.hit()->mc()->hep()->id();
221 if (pull) {
222 std::cout << "[" << a << "]";
223 }
224 if (mc) {
225 std::cout << "(" << mcId << ")";
226 if (mcId < MCC_MAX) {
227 ++MCC0[mcId];
228 if (l.hit()->state() & WireHitFittingValid) {
229 if (! (l.hit()->state() & WireHitInvalidForFit))
230 ++MCC1[mcId];
231 }
232 }
233 else {
234 MCCOverFlow = true;
235 }
236 }
237 if (flag) {
238 if (l.hit()->state() & WireHitFindingValid)
239 std::cout << "o";
240 if (l.hit()->state() & WireHitFittingValid) {
241 std::cout << "+";
242 if (! (l.hit()->state() & WireHitInvalidForFit))
243 ++nForFit;
244 }
245 if (l.hit()->state() & WireHitInvalidForFit)
246 std::cout << "x";
247 }
248 if (stereo) {
249 std::cout << "{" << l.leftRight() << "," << l.zStatus() << "}";
250 }
251 if (pos) {
252 std::cout << ",pos=" << l.position();
253 }
254 std::cout << ",";
255 }
256 std::cout << " " << n << " l(s)";
257 if (flag) std::cout << ", fv " << nForFit << " l(s)";
258 if (mc) {
259 unsigned nMC = 0;
260 std::cout << ", mc";
261 for (unsigned i = 0; i < MCC_MAX; i++) {
262 if (MCC0[i] > 0) {
263 ++nMC;
264 std::cout << i << ":" << MCC0[i] << ",";
265 }
266 }
267 std::cout << " total " << nMC << " contributions";
268 if (flag) {
269 nMC = 0;
270 std::cout << ", fv mc";
271 for (unsigned i = 0; i < MCC_MAX; i++) {
272 if (MCC1[i] > 0) {
273 ++nMC;
274 std::cout << i << ":" << MCC1[i] << ",";
275 }
276 }
277 std::cout << " total " << nMC << " contributions";
278 }
279
280 if (MCCOverFlow)
281 std::cout << "(counter overflow)";
282 }
283 std::cout << std::endl;
284}
#define WireHitFindingValid
Definition: TMDCWireHit.h:28
#define WireHitInvalidForFit
Definition: TMDCWireHit.h:55
Definition: TLine2D.h:22
const TTrackHEP *const hep(void) const
returns a pointer to a GEN_HEPEVT.
const TMDCWireHitMC *const mc(void) const
returns a pointer to TMDCWireHitMC.
Definition: TMDCWireHit.h:298
std::string name(void) const
returns name.
Definition: TMDCWire.h:412
unsigned id(void) const
returns an id started from 0.
Definition: TTrackHEP.h:122

Referenced by TBuilder0::buildRphi(), TBuilder::buildStereo(), TBuilder0::buildStereo(), TBuilder0::buildStereo0(), TTrackBase::dump(), TTrackManager::dump(), Dump(), TConformalFinder0::findSegments(), TTrackManager::mask(), TTrackManager::maskCurl(), TTrackManager::maskOut(), TTrackManager::merge(), TTrackBase::refine(), and TBuilder::salvage().

◆ Dump() [2/2]

void Dump ( const TMLink link,
const std::string &  msg,
const std::string &  pre 
)

Definition at line 287 of file TMLink.cxx.

287 {
288 CAList<TMLink> tmp;
289 tmp.append(link);
290 Dump(tmp, msg, pre);
291}

◆ Edges()

AList< TMLink > Edges ( const AList< TMLink > &  list)

returns links which are edges. This function assumes that all TMLink's are in the same super layer.

Definition at line 477 of file TMLink.cxx.

477 {
479
480 unsigned n = list.length();
481 if (n < 2) return a;
482 else if (n == 2) return list;
483
484 const TMDCWire * w = list[0]->wire();
485 unsigned nWires = w->layer()->nWires();
486 unsigned center = w->localId();
487
488 unsigned left = 0;
489 unsigned right = 0;
490 TMLink * leftL = list[0];
491 TMLink * rightL = list[0];
492 for (unsigned i = 1; i < n; i++) {
493 w = list[i]->wire();
494 unsigned id = w->localId();
495
496 unsigned distance0, distance1;
497 if (id > center) {
498 distance0 = id - center;
499 distance1 = nWires - distance0;
500 }
501 else {
502 distance1 = center - id;
503 distance0 = nWires - distance1;
504 }
505
506 if (distance0 < distance1) {
507 if (distance0 > right) {
508 right = distance0;
509 rightL = list[i];
510 }
511 }
512 else {
513 if (distance1 > left) {
514 left = distance1;
515 leftL = list[i];
516 }
517 }
518 }
519
520 a.append(leftL);
521 a.append(rightL);
522 return a;
523}
A class to represent a wire in MDC.
Definition: TMDCWire.h:55

◆ InnerMost()

TMLink * InnerMost ( const AList< TMLink > &  a)

returns the inner(outer)-most link.

Definition at line 336 of file TMLink.cxx.

336 {
337 unsigned n = a.length();
338 unsigned minId = 9999;
339 TMLink * t = 0;
340 for (unsigned i = 0; i < n; i++) {
341 unsigned id = a[i]->wire()->id();
342 if (id < minId) {
343 minId = id;
344 t = a[i];
345 }
346 }
347 return t;
348}

Referenced by TTrackManager::maskNormal(), and TTrackManager::merge().

◆ InOut()

AList< TMLink > InOut ( const AList< TMLink > &  list)

returns links which are in the inner most and outer most layer. This function assumes that all TMLink's are in the same super layer.

Definition at line 568 of file TMLink.cxx.

568 {
569 AList<TMLink> inners;
570 AList<TMLink> outers;
571 unsigned n = list.length();
572 unsigned innerMostLayer = 999;
573 unsigned outerMostLayer = 0;
574 for (unsigned i = 0; i < n; i++) {
575 unsigned id = list[i]->wire()->layerId();
576 if (id < innerMostLayer) innerMostLayer = id;
577 else if (id > outerMostLayer) outerMostLayer = id;
578 }
579 for (unsigned i = 0; i < n; i++) {
580 unsigned id = list[i]->wire()->layerId();
581 if (id == innerMostLayer) inners.append(list[i]);
582 else if (id == outerMostLayer) outers.append(list[i]);
583 }
584 inners.append(outers);
585 return inners;
586}

Referenced by TSegment::solveDualHits(), and TSegment0::solveDualHits().

◆ Links2HEP()

const TTrackHEP & Links2HEP ( const AList< TMLink > &  links)

returns TTrackHEP

Definition at line 662 of file TMLink.cxx.

662 {
663 const TTrackHEP * best = NULL;
664 const AList<TTrackHEP> & list = TTrackHEP::list();
665 unsigned nHep = list.length();
666
667 if (! nHep) return * best;
668
669 unsigned * N = (unsigned *) malloc(nHep * sizeof(unsigned));
670 for (unsigned i = 0; i < nHep; i++) N[i] = 0;
671
672 for (unsigned i = 0; i < links.length(); i++) {
673 const TMLink & l = * links[i];
674 const TTrackHEP & hep = * l.hit()->mc()->hep();
675 for (unsigned j = 0; j < nHep; j++)
676 if (list[j] == & hep)
677 ++N[j];
678 }
679
680 unsigned nMax = 0;
681 for (unsigned i = 0; i < nHep; i++) {
682 if (N[i] > nMax) {
683 best = list[i];
684 nMax = N[i];
685 }
686 }
687
688 return * best;
689}
#define NULL
A class to represent a GEN_HEPEVT particle in tracking.
Definition: TTrackHEP.h:37
static const AList< TTrackHEP > & list(void)
returns a list of TTrackHEP's.
Definition: TTrackHEP.cxx:72

◆ NAxialHits()

unsigned NAxialHits ( const AList< TMLink > &  links)

returns # of axial hits.

Definition at line 304 of file TMLink.cxx.

304 {
305 unsigned nLinks = links.length();
306 unsigned n = 0;
307 for (unsigned i = 0; i < nLinks; i++)
308 if (links[i]->wire()->axial())
309 ++n;
310 return n;
311}

◆ NHits()

void NHits ( const AList< TMLink > &  links,
unsigned  nHits[43] 
)

Definition at line 169 of file TMLink.cxx.

169 {
170 for (unsigned i = 0; i < 43; i++) nHits[i] = 0;
171 unsigned nLinks = links.length();
172 for (unsigned i = 0; i < nLinks; i++)
173 ++nHits[links[i]->wire()->layerId()];
174}

Referenced by BesMdcDigitizer::Digitize(), and TTrackManager::mask().

◆ NHitsSuperLayer()

void NHitsSuperLayer ( const AList< TMLink > &  links,
unsigned  nHits[11] 
)

returns # of hits per super layer.

Definition at line 177 of file TMLink.cxx.

177 {
178 for (unsigned i = 0; i < 11; i++) nHits[i] = 0;
179 unsigned nLinks = links.length();
180 for (unsigned i = 0; i < nLinks; i++)
181 ++nHits[links[i]->wire()->superLayerId()];
182}

Referenced by TrackLayerUsage().

◆ NLayers()

unsigned NLayers ( const AList< TMLink > &  list)

returns # of layers.

Definition at line 150 of file TMLink.cxx.

150 {
151 unsigned l0 = 0;
152 unsigned l1 = 0;
153 unsigned n = list.length();
154 for (unsigned i = 0; i < n; i++) {
155 unsigned id = list[i]->wire()->layerId();
156 if (id < 32) l0 |= (1 << id);
157 else l1 |= (1 << (id - 32));
158 }
159
160 unsigned l = 0;
161 for (unsigned i = 0; i < 32; i++) {
162 if (l0 & (1 << i)) ++l;
163 if (l1 & (1 << i)) ++l;
164 }
165 return l;
166}

Referenced by TBuilder0::buildRphi(), and TTrackManager::maskNormal().

◆ NMissingAxialSuperLayers()

unsigned NMissingAxialSuperLayers ( const AList< TMLink > &  links)

Definition at line 640 of file TMLink.cxx.

640 {
641 unsigned n = links.length();
642//Liuqg, change the following to BES. unsigned nHits[6] = {0, 0, 0, 0, 0, 0};
643 unsigned nHits[5] = {0, 0, 0, 0, 0};
644 for (unsigned i = 0; i < n; i++)
645 if (links[i]->wire()->axial())
646 ++nHits[links[i]->wire()->axialStereoLayerId() / 4];
647 unsigned j = 0;
648 while (nHits[j] == 0) ++j;
649 unsigned nMissing = 0;
650 unsigned nMax = 0;
651 for (unsigned i = j; i < 5; i++) {
652 if (nHits[i] == 0) ++nMissing;
653 else {
654 if (nMax < nMissing) nMax = nMissing;
655 nMissing = 0;
656 }
657 }
658 return nMax;
659}

◆ NStereoHits()

unsigned NStereoHits ( const AList< TMLink > &  links)

returns # of stereo hits.

Definition at line 294 of file TMLink.cxx.

294 {
295 unsigned nLinks = links.length();
296 unsigned n = 0;
297 for (unsigned i = 0; i < nLinks; i++)
298 if (links[i]->wire()->stereo())
299 ++n;
300 return n;
301}

Referenced by T3DLineFitter::fit(), TRungeFitter::fit(), and TrackInformation().

◆ NSuperLayers() [1/2]

unsigned NSuperLayers ( const AList< TMLink > &  links,
unsigned  minN 
)

Definition at line 627 of file TMLink.cxx.

627 {
628 unsigned n = links.length();
629 unsigned nHits[11] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
630 for (unsigned i = 0; i < n; i++)
631 ++nHits[links[i]->wire()->superLayerId()];
632 unsigned sl = 0;
633 for (unsigned i = 0; i < 11; i++)
634 if (nHits[i] >= minN)
635 ++sl;
636 return sl;
637}

◆ NSuperLayers() [2/2]

unsigned NSuperLayers ( const AList< TMLink > &  list)

returns # of layers.

Definition at line 611 of file TMLink.cxx.

611 {
612 unsigned l0 = 0;
613 unsigned n = list.length();
614 for (unsigned i = 0; i < n; i++) {
615 unsigned id = list[i]->wire()->superLayerId();
616 l0 |= (1 << id);
617 }
618
619 unsigned l = 0;
620 for (unsigned i = 0; i < 11; i++) {
621 if (l0 & (1 << i)) ++l;
622 }
623 return l;
624}

Referenced by TBuilder0::buildRphi(), TBuilder::initialLine(), TBuilder::initialLineOld(), TTrackManager::maskCurl(), TTrackManager::maskNormal(), TTrackManager::merge(), and TMSelector::preSelect().

◆ OuterMost()

TMLink * OuterMost ( const AList< TMLink > &  a)

Definition at line 351 of file TMLink.cxx.

351 {
352 unsigned n = a.length();
353 unsigned maxId = 0;
354 TMLink * t = 0;
355 for (unsigned i = 0; i < n; i++) {
356 unsigned id = a[i]->wire()->id();
357 if (id > maxId) {
358 maxId = id;
359 t = a[i];
360 }
361 }
362 return t;
363}

Referenced by TTrackManager::divide(), TTrackManager::divideByIp(), and TTrackManager::makeTds().

◆ SameLayer() [1/2]

AList< TMLink > SameLayer ( const AList< TMLink > &  list,
const TMLink a 
)

returns links which are in the same layer as 'a' or 'id'.

Definition at line 526 of file TMLink.cxx.

526 {
527 AList<TMLink> same;
528 unsigned id = a.wire()->layerId();
529 unsigned n = list.length();
530 for (unsigned i = 0; i < n; i++) {
531 if (list[i]->wire()->layerId() == id) same.append(list[i]);
532 }
533 return same;
534}
unsigned layerId(void) const
returns layer id.
Definition: TMDCWire.h:219

Referenced by TTrackManager::mask(), TTrackManager::maskMultiHits(), TSegment::solveDualHits(), TSegment0::solveDualHits(), and TSegment::width().

◆ SameLayer() [2/2]

AList< TMLink > SameLayer ( const AList< TMLink > &  list,
unsigned  id 
)

Definition at line 548 of file TMLink.cxx.

548 {
549 AList<TMLink> same;
550 unsigned n = list.length();
551 for (unsigned i = 0; i < n; i++) {
552 if (list[i]->wire()->layerId() == id) same.append(list[i]);
553 }
554 return same;
555}

◆ SameSuperLayer() [1/2]

AList< TMLink > SameSuperLayer ( const AList< TMLink > &  list,
const TMLink a 
)

returns links which are in the same super layer as 'a' or 'id'.

Definition at line 537 of file TMLink.cxx.

537 {
538 AList<TMLink> same;
539 unsigned id = a.wire()->superLayerId();
540 unsigned n = list.length();
541 for (unsigned i = 0; i < n; i++) {
542 if (list[i]->wire()->superLayerId() == id) same.append(list[i]);
543 }
544 return same;
545}
unsigned superLayerId(void) const
returns super layer id.
Definition: TMDCWire.h:225

Referenced by TBuilder0::buildRphi().

◆ SameSuperLayer() [2/2]

AList< TMLink > SameSuperLayer ( const AList< TMLink > &  list,
unsigned  id 
)

Definition at line 558 of file TMLink.cxx.

558 {
559 AList<TMLink> same;
560 unsigned n = list.length();
561 for (unsigned i = 0; i < n; i++) {
562 if (list[i]->wire()->superLayerId() == id) same.append(list[i]);
563 }
564 return same;
565}

◆ SeparateCores()

void SeparateCores ( const AList< TMLink > &  input,
AList< TMLink > &  cores,
AList< TMLink > &  nonCores 
)

separate cores and non-cores.

Definition at line 366 of file TMLink.cxx.

368 {
369 unsigned n = input.length();
370 for (unsigned i = 0; i < n; i++) {
371 TMLink & t = * input[i];
372 const TMDCWireHit & h = * t.hit();
373 if (h.state() & WireHitFittingValid)
374 cores.append(t);
375 else
376 nonCores.append(t);
377 }
378}

Referenced by TBuilder::buildRphi(), and TBuilder::buildStereo().

◆ SortByWireId()

int SortByWireId ( const void *  av,
const void *  bv 
)

Sorter.

Definition at line 411 of file TMLink.cxx.

411 {
412 const TMLink ** a((const TMLink**)av);
413 const TMLink ** b((const TMLink**)bv);
414 if ((* a)->wire()->id() > (* b)->wire()->id()) return 1;
415 else if
416 ((* a)->wire()->id() == (* b)->wire()->id()) return 0;
417 else return -1;
418}
const double b
Definition: slope.cxx:9

Referenced by TBuilderCosmic::buildStereo(), Dump(), TTrackManager::maskMultiHits(), TLine0::refine(), TMLine::refine(), TSegment::TSegment(), and TSegment0::TSegment0().

◆ SortByX()

int SortByX ( const void *  av,
const void *  bv 
)

Definition at line 421 of file TMLink.cxx.

421 {
422 const TMLink ** a((const TMLink**)av);
423 const TMLink ** b((const TMLink**)bv);
424 if ((* a)->position().x() > (* b)->position().x()) return 1;
425 else if ((* a)->position().x() == (* b)->position().x()) return 0;
426 else return -1;
427}

◆ StereoHits()

AList< TMLink > StereoHits ( const AList< TMLink > &  links)

returns stereo hits.

Definition at line 325 of file TMLink.cxx.

325 {
327 unsigned n = links.length();
328 for (unsigned i = 0; i < n; i++) {
329 if (! links[i]->wire()->axial())
330 a.append(links[i]);
331 }
332 return a;
333}

Referenced by TBuilder::buildStereo(), and TBuilder::buildStereoNew().

◆ SuperLayer() [1/2]

unsigned SuperLayer ( const AList< TMLink > &  links,
unsigned  minN 
)

Definition at line 598 of file TMLink.cxx.

598 {
599 unsigned n = links.length();
600 unsigned nHits[11] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
601 for (unsigned i = 0; i < n; i++)
602 ++nHits[links[i]->wire()->superLayerId()];
603 unsigned sl = 0;
604 for (unsigned i = 0; i < 11; i++)
605 if (nHits[i] >= minN)
606 sl |= (1 << i);
607 return sl;
608}

◆ SuperLayer() [2/2]

unsigned SuperLayer ( const AList< TMLink > &  list)

returns super layer pattern.

Definition at line 589 of file TMLink.cxx.

589 {
590 unsigned sl = 0;
591 unsigned n = list.length();
592 for (unsigned i = 0; i < n; i++)
593 sl |= (1 << (list[i]->wire()->superLayerId()));
594 return sl;
595}

Referenced by TBuilder0::buildRphi(), and MdcxFindTracks::process().

◆ Width()

unsigned Width ( const AList< TMLink > &  list)

returns width(wire cell unit) of given AList<TMLink>. This function assumes that all TMLink's are in the same super layer.

Definition at line 432 of file TMLink.cxx.

432 {
433 unsigned n = list.length();
434 if (n < 2) return n;
435
436 const TMDCWire * w = list[0]->wire();
437 unsigned nWires = w->layer()->nWires();
438 unsigned center = w->localId();
439
440#ifdef TRKRECO_DEBUG_DETAIL
441 unsigned sId = w->superLayerId();
442#endif
443
444 unsigned left = 0;
445 unsigned right = 0;
446 for (unsigned i = 1; i < n; i++) {
447 w = list[i]->wire();
448 unsigned id = w->localId();
449
450 unsigned distance0, distance1;
451 if (id > center) {
452 distance0 = id - center;
453 distance1 = nWires - distance0;
454 }
455 else {
456 distance1 = center - id;
457 distance0 = nWires - distance1;
458 }
459
460 if (distance0 < distance1) {
461 if (distance0 > right) right = distance0;
462 }
463 else {
464 if (distance1 > left) left = distance1;
465 }
466
467#ifdef TRKRECO_DEBUG_DETAIL
468 if (w->superLayerId() != sId)
469 std::cout << "::width !!! super layer assumption violation" << std::endl;
470#endif
471 }
472
473 return right + left + 1;
474}

Referenced by BesMucNoise::Initialize(), TTrackManager::mask(), TSegment::solveDualHits(), TSegment0::solveDualHits(), and TSegment::width().