#include <TTrackManager.h>
Inheritance diagram for TTrackManager:
Public Member Functions | |
const AList< TTrack > & | allTracks (void) const |
returns a list of all reconstructed tracks including junks. | |
const AList< TTrack > & | allTracks (void) const |
returns a list of all reconstructed tracks including junks. | |
void | append (AList< TTrack > &list) |
appends (2D) tracks. 'list' will be cleaned up. | |
void | append (AList< TTrack > &list) |
appends (2D) tracks. 'list' will be cleaned up. | |
void | append2D (AList< TTrack > &list) |
void | append2D (AList< TTrack > &list) |
void | clear (void) |
clears all internal information. | |
void | clear (void) |
clears all internal information. | |
void | clearTables (void) const |
clears tables. | |
void | clearTables (void) const |
clears tables. | |
TTrack * | closest (const AList< TTrack > &, const TMDCWireHit &) const |
returns a track which is the closest to a hit. | |
TTrack * | closest (const AList< TTrack > &, const TMDCWireHit &) const |
returns a track which is the closest to a hit. | |
int | debugLevel (int) |
int | debugLevel (void) const |
returns/sets debug level. | |
int | debugLevel (int) |
int | debugLevel (void) const |
returns/sets debug level. | |
void | determineIP (void) |
determines IP. | |
void | determineIP (void) |
determines IP. | |
StatusCode | determineT0 (unsigned level, unsigned nMaxTracks) |
determines T0 and refit all tracks. | |
StatusCode | determineT0 (unsigned level, unsigned nMaxTracks) |
determines T0 and refit all tracks. | |
TMLink & | divide (const TTrack &t, AList< TMLink > *l) const |
TMLink & | divide (const TTrack &t, AList< TMLink > *l) const |
TMLink & | divideByIp (const TTrack &t, AList< TMLink > *l) const |
TMLink & | divideByIp (const TTrack &t, AList< TMLink > *l) const |
void | dump (const std::string &message=std::string(""), const std::string &prefix=std::string("")) const |
dumps debug information. | |
void | dump (const std::string &message=std::string(""), const std::string &prefix=std::string("")) const |
dumps debug information. | |
void | finish (void) |
finishes tracks. | |
void | finish (void) |
finishes tracks. | |
void | fittingFlag (unsigned) |
sets fitting flag. | |
void | fittingFlag (unsigned) |
sets fitting flag. | |
virtual void | initialize (void) |
initializes an object. | |
virtual void | initialize (void) |
initializes an object. | |
virtual bool | initialized (void) const |
returns true if an object is initialized. | |
virtual bool | initialized (void) const |
returns true if an object is initialized. | |
StatusCode | makeTds (RecMdcTrackCol *trackList, RecMdcHitCol *hitList, int tkStat=1) |
stores track info. into TDS. by Zang Shilei | |
StatusCode | makeTds (RecMdcTrackCol *trackList, RecMdcHitCol *hitList, int tkStat=1) |
stores track info. into TDS. by Zang Shilei | |
void | mask (void) const |
masks hits out which are in tail of curly tracks. | |
void | mask (void) const |
masks hits out which are in tail of curly tracks. | |
void | maskCurl (TTrack &) const |
void | maskCurl (TTrack &) const |
void | maskCurlHits (const AList< TMDCWireHit > &axial, const AList< TMDCWireHit > &stereo, const AList< TTrack > &tracks) const |
masks hits on found curl tracks. | |
void | maskCurlHits (const AList< TMDCWireHit > &axial, const AList< TMDCWireHit > &stereo, const AList< TTrack > &tracks) const |
masks hits on found curl tracks. | |
void | maskMultiHits (TTrack &) const |
void | maskMultiHits (TTrack &) const |
void | maskNormal (TTrack &) const |
void | maskNormal (TTrack &) const |
void | maskOut (TTrack &, const AList< TMLink > &) const |
void | maskOut (TTrack &, const AList< TMLink > &) const |
double | maxMomentum (double) |
sets the max. momentum. | |
double | maxMomentum (double) |
sets the max. momentum. | |
void | merge (void) |
void | merge (void) |
void | movePivot (void) |
moves pivot of tracks. | |
void | movePivot (void) |
moves pivot of tracks. | |
std::string | name (void) const |
returns name. | |
std::string | name (void) const |
returns name. | |
float | paraT0 (void) const |
float | paraT0 (void) const |
void | refit (void) |
refits tracks. | |
void | refit (void) |
refits tracks. | |
void | removeHitsAcrossOverIp (AList< TMLink > &) const |
void | removeHitsAcrossOverIp (AList< TMLink > &) const |
void | salvage (const AList< TMDCWireHit > &) const |
salvages remaining hits. | |
void | salvage (const AList< TMDCWireHit > &) const |
salvages remaining hits. | |
void | salvageAssociateHits (const AList< TMDCWireHit > &, float maxSigma2) |
salvages hits for dE/dx(not for track fitting). | |
void | salvageAssociateHits (const AList< TMDCWireHit > &, float maxSigma2) |
salvages hits for dE/dx(not for track fitting). | |
void | saveMCTables (void) const |
stores MC track info. into Panther table. | |
void | saveMCTables (void) const |
stores MC track info. into Panther table. | |
void | saveTables (void) |
stores track info. into Panther table. | |
void | saveTables (void) |
stores track info. into Panther table. | |
void | setCurlerFlags (void) |
tests for curlers. | |
void | setCurlerFlags (void) |
tests for curlers. | |
void | sett0bes (double t0) |
void | sett0bes (double t0) |
void | sortBanksByPt (void) const |
sorts RECMDC_TRK tables. | |
void | sortBanksByPt (void) const |
sorts RECMDC_TRK tables. | |
void | sortTracksByPt (void) |
void | sortTracksByPt (void) |
void | sortTracksByQuality (void) |
sorts tracks. | |
void | sortTracksByQuality (void) |
sorts tracks. | |
const AList< TTrack > & | tracks (void) const |
returns a list of reconstructed tracks. | |
const AList< TTrack > & | tracks (void) const |
returns a list of reconstructed tracks. | |
const AList< TTrack > & | tracks2D (void) const |
returns a list of 2D tracks. | |
const AList< TTrack > & | tracks2D (void) const |
returns a list of 2D tracks. | |
const AList< TTrack > & | tracksFinal (void) const |
returns a list of tracks writen to MdcRec_trk. | |
const AList< TTrack > & | tracksFinal (void) const |
returns a list of tracks writen to MdcRec_trk. | |
void | treatCurler (MdcTrk &curl, MdcRec_trk_add &cdc, unsigned flag) const |
final decision for a curler. | |
void | treatCurler (MdcTrk &curl, MdcRec_trk_add &cdc, unsigned flag) const |
final decision for a curler. | |
TTrackManager () | |
Constructor. | |
TTrackManager () | |
Constructor. | |
virtual void | update (void) |
updates an object. | |
virtual void | update (void) |
updates an object. | |
virtual bool | updated (void) const |
returns true if an object is updated. | |
virtual bool | updated (void) const |
returns true if an object is updated. | |
std::string | version (void) const |
returns version. | |
std::string | version (void) const |
returns version. | |
virtual | ~TTrackManager () |
Destructor. | |
virtual | ~TTrackManager () |
Destructor. | |
Static Public Member Functions | |
bool | goodTrack (const TTrack &, bool track2D=false) |
checks goodness of a track. | |
bool | goodTrack (const TTrack &, bool track2D=false) |
checks goodness of a track. | |
void | maskBadHits (const AList< TTrack > &, float maxSigma2) |
masks hits with large chisq as associated hits. Pull in TMLink is used. | |
void | maskBadHits (const AList< TTrack > &, float maxSigma2) |
masks hits with large chisq as associated hits. Pull in TMLink is used. | |
Private Member Functions | |
int | copyTrack (TTrack &t, MdcRec_trk **r, MdcRec_trk_add **a) const |
copies a track. Non-zero will be returned if error happens. | |
int | copyTrack (TTrack &t, MdcRec_trk **r, MdcRec_trk_add **a) const |
copies a track. Non-zero will be returned if error happens. | |
float | minimum (float y0, float y1, float y2) const |
float | minimum (float y0, float y1, float y2) const |
void | nameTracks (void) |
names tracks. | |
void | nameTracks (void) |
names tracks. | |
AList< TTrack > | selectGoodTracks (const AList< TTrack > &, bool track2D=false) const |
checks track quality. | |
AList< TTrack > | selectGoodTracks (const AList< TTrack > &, bool track2D=false) const |
checks track quality. | |
void | swapReccdc (MdcRec_trk &cdc0, MdcRec_trk_add &add0, MdcRec_mctrk &mc0, MdcRec_trk &cdc1, MdcRec_trk_add &add1, MdcRec_mctrk &mc1) const |
sorts banks. | |
void | swapReccdc (MdcRec_trk &cdc0, MdcRec_trk_add &add0, MdcRec_mctrk &mc0, MdcRec_trk &cdc1, MdcRec_trk_add &add1, MdcRec_mctrk &mc1) const |
sorts banks. | |
void | swapRectrk (MdcTrk &trk0, MdcTrk &tkr1) const |
void | swapRectrk (MdcTrk &trk0, MdcTrk &tkr1) const |
float | T0 (unsigned n) |
returns T0 by old methode(expensive). | |
float | T0 (unsigned n) |
returns T0 by old methode(expensive). | |
float | T0Fit (unsigned n) |
returns T0 by T0 fitting. | |
float | T0Fit (unsigned n) |
returns T0 by T0 fitting. | |
void | tagReccdc (unsigned *id, unsigned n) const |
void | tagReccdc (unsigned *id, unsigned n) const |
void | tagRectrk (unsigned *id, unsigned n) const |
void | tagRectrk (unsigned *id, unsigned n) const |
Static Private Member Functions | |
bool | checkNumberOfHits (const TTrack &, bool track2D=false) |
bool | checkNumberOfHits (const TTrack &, bool track2D=false) |
Private Attributes | |
AList< TMLink > | _associateHits |
AList< TMLink > | _associateHits |
THelixFitter | _cFitter |
int | _debugLevel |
THelixFitter | _fitter |
double | _maxMomentum |
unsigned | _nCurlerMergeTest |
summary * | _s |
summary * | _s |
double | _sigmaCurlerMergeTest |
float | _t0 |
AList< TTrack > | _tracks |
AList< TTrack > | _tracks |
AList< TTrack > | _tracks2D |
AList< TTrack > | _tracks2D |
AList< TTrack > | _tracksAll |
AList< TTrack > | _tracksAll |
AList< TTrack > | _tracksFinal |
AList< TTrack > | _tracksFinal |
double | t0bes |
|
Constructor.
00080 : _maxMomentum(10.), 00081 _sigmaCurlerMergeTest(sqrt(100.)), 00082 _nCurlerMergeTest(4), 00083 _debugLevel(0), 00084 _fitter("TTrackManager Fitter"), 00085 _cFitter("TTrackManager 2D Fitter"), 00086 _s(0) { 00087 // BASF_Sharedmem->allocate("TrkMgrSum", sizeof(struct summary)); 00088 }
|
|
Destructor.
00090 { 00091 }
|
|
Constructor.
|
|
Destructor.
|
|
returns a list of all reconstructed tracks including junks.
|
|
returns a list of all reconstructed tracks including junks.
00278 {
00279 return _tracksAll;
00280 }
|
|
appends (2D) tracks. 'list' will be cleaned up.
|
|
appends (2D) tracks. 'list' will be cleaned up.
00792 { 00793 _tracksAll.append(list); 00794 _tracks.append(selectGoodTracks(list)); 00795 list.removeAll(); 00796 }
|
|
|
|
00799 { 00800 _tracksAll.append(list); 00801 _tracks2D.append(selectGoodTracks(list, true)); 00802 _tracks2D.sort(SortByPt); 00803 list.removeAll(); 00804 }
|
|
|
|
02498 { 02499 const AList<TMLink> & cores = t.cores(); 02500 02501 if (track2D) { 02502 unsigned axialHits = NAxialHits(cores); 02503 if (axialHits < 3) return false; 02504 } 02505 else { 02506 unsigned allHits = cores.length(); 02507 if (allHits < 5) return false; 02508 unsigned stereoHits = NStereoHits(cores); 02509 if (stereoHits < 2) return false; 02510 unsigned axialHits = allHits - stereoHits; 02511 if (axialHits < 3) return false; 02512 } 02513 return true; 02514 }
|
|
clears all internal information.
Reimplemented from TUpdater. |
|
clears all internal information.
Reimplemented from TUpdater. 00757 { 00758 HepAListDeleteAll(_tracksAll); 00759 _tracks.removeAll(); 00760 _tracks2D.removeAll(); 00761 _tracksFinal.removeAll(); 00762 HepAListDeleteAll(_associateHits); 00763 static bool first = true; 00764 if (first) { 00765 first = false; 00766 int size; 00767 // _s = (struct summary *) 00768 // BASF_Sharedmem->get_pointer(BASF_Sharedmem->get_id(), 00769 // "TrkMgrSum", 00770 // & size); 00771 } 00772 }
|
|
clears tables.
|
|
clears tables.
02418 { 02419 // BsDelEnt(RECMDC_TRK, BBS_ID_ALL); 02420 // BsDelEnt(RECMDC_TRK_ADD, BBS_ID_ALL); 02421 // BsDelEnt(RECMDC_MCTRK, BBS_ID_ALL); 02422 // BsDelEnt(RECMDC_MCTRK2HEP, BBS_ID_ALL); 02423 unsigned n = MdcRecTrkCol::getMdcRecTrkCol()->size(); 02424 for (unsigned i = 0; i < n; i++) delete &(*MdcRecTrkCol::getMdcRecTrkCol())[i]; 02425 02426 n = MdcRecTrkAddCol::getMdcRecTrkAddCol()->size(); 02427 for (unsigned i = 0; i < n; i++) delete &(*MdcRecTrkAddCol::getMdcRecTrkAddCol())[i]; 02428 02429 n = MdcRecMctrkCol::getMdcRecMctrkCol()->size(); 02430 for (unsigned i = 0; i < n; i++) delete &(*MdcRecMctrkCol::getMdcRecMctrkCol())[i]; 02431 02432 n = MdcRecMctrk2hepCol::getMdcRecMctrk2hepCol()->size(); 02433 for (unsigned i = 0; i < n; i++) delete &(*MdcRecMctrk2hepCol::getMdcRecMctrk2hepCol())[i]; 02434 02435 02436 //...Clear track association... 02437 // unsigned n = BsCouTab(RECMDC_WIRHIT); 02438 n = MdcRecWirhitCol::getMdcRecWirhitCol()->size(); 02439 for (unsigned i = 0; i < n; i++) { 02440 // reccdc_wirhit & h = * (reccdc_wirhit *) 02441 // BsGetEnt(RECMDC_WIRHIT, i + 1, BBS_No_Index); 02442 // h.m_trk = 0; 02443 MdcRec_wirhit& h = (*MdcRecWirhitCol::getMdcRecWirhitCol())[i]; 02444 h.trk = 0; 02445 } 02446 // n = BsCouTab(DATMDC_MCWIRHIT); 02447 n = MdcDatMcwirhitCol::getMdcDatMcwirhitCol()->size(); 02448 for (unsigned i = 0; i < n; i++) { 02449 // datcdc_mcwirhit & h = * (datcdc_mcwirhit *) 02450 // BsGetEnt(DATMDC_MCWIRHIT, i + 1, BBS_No_Index); 02451 // h.m_trk = 0; 02452 MdcDat_mcwirhit& h = (*MdcDatMcwirhitCol::getMdcDatMcwirhitCol())[i]; 02453 h.trk = 0; 02454 } 02455 }
|
|
returns a track which is the closest to a hit.
|
|
returns a track which is the closest to a hit.
00244 { 00245 00246 TMLink t; 00247 t.hit(& hit); 00248 unsigned n = tracks.length(); 00249 double minDistance = MAXDOUBLE; 00250 TTrack * minTrk = NULL; 00251 00252 //...Loop over all tracks... 00253 for (unsigned i = 0; i < n; i++) { 00254 TTrack & trk = * tracks[i]; 00255 int err = trk.approach(t); 00256 if (err < 0) continue; 00257 if (minDistance > t.distance()) { 00258 minDistance = t.distance(); 00259 minTrk = & trk; 00260 } 00261 } 00262 00263 return minTrk; 00264 }
|
|
copies a track. Non-zero will be returned if error happens.
|
|
copies a track. Non-zero will be returned if error happens.
01613 { 01614 01615 static const unsigned GoodHitMask = (WireHitTimeValid | 01616 WireHitChargeValid | 01617 WireHitFindingValid | 01618 WireHitFittingValid); 01619 int err = 0; 01620 01621 //...Hit loop... 01622 #ifdef TRKRECO_DEBUG_DETAIL 01623 std::cout << " checking hits ... " << t.name() 01624 << " quality = " << t.quality(); 01625 std::cout << " : " << t.cores().length() << ", " << t.ndf() << " : "; 01626 unsigned nnn = 0; 01627 #endif 01628 unsigned j = 0; 01629 unsigned nClst = 0; 01630 unsigned nStereos = 0; 01631 unsigned nOccupied = 0; 01632 AList<TMLink> hits; 01633 AList<TMLink> badHits; 01634 unsigned n = t.links().length(); 01635 for (unsigned i = 0; i < n; i++) { 01636 TMLink * l = t.links()[i]; 01637 MdcRec_wirhit * h = l->hit()->reccdc(); 01638 01639 #ifdef TRKRECO_DEBUG_DETAIL 01640 if (h->trk) std::cout << l->wire()->name() << "(n/a),"; 01641 #endif 01642 01643 if (h->trk) { 01644 ++nOccupied; 01645 if (! (h->stat & WireHitInvalidForFit)) 01646 continue; 01647 } 01648 if ((l->hit()->state() & GoodHitMask) == GoodHitMask) { 01649 if (l->hit()->state() & WireHitInvalidForFit) { 01650 if (! (h->stat & WireHitInvalidForFit)) 01651 badHits.append(l); 01652 } 01653 else { 01654 hits.append(l); 01655 if (l->wire()->stereo()) ++nStereos; 01656 } 01657 } 01658 } 01659 t.finalHits(hits); 01660 #ifdef TRKRECO_DEBUG_DETAIL 01661 std::cout << std::endl; 01662 #endif 01663 01664 //...Check # of hits... 01665 if (t.quality() & TrackQuality2D) { 01666 if (hits.length() < 3) err = 3; 01667 if (nOccupied > 2) err = 4; 01668 } 01669 else { 01670 if (hits.length() < 5) err = 1; 01671 if (nStereos < 2) err = 2; 01672 } 01673 if (err) return err; 01674 01675 //...Create new tables... 01676 // * pr = (reccdc_trk *) BsNewEnt(RECMDC_TRK); 01677 // * pra = (reccdc_trk_add *) BsNewEnt(RECMDC_TRK_ADD); 01678 // reccdc_trk * r = * pr; 01679 // reccdc_trk_add * ra = * pra; 01680 * pr = new MdcRec_trk; 01681 * pra = new MdcRec_trk_add; 01682 MdcRec_trk* r = * pr; 01683 MdcRec_trk_add* ra = * pra; 01684 01685 //...Copy hit information... 01686 // const AList<TMLink> & cores = t.cores(); 01687 // const AList<TMLink> & links = t.links(); 01688 // unsigned allHits = cores.length(); 01689 // unsigned stereoHits = NStereoHits(cores); 01690 // r.m_chiSq = t.chi2(); 01691 // r.m_confl = t.confidenceLevel(); 01692 // r.m_ndf = t.ndf(); 01693 // r.m_nhits = allHits; 01694 // r.m_nster = stereoHits; 01695 float chisq = 0.; 01696 unsigned nHits = hits.length(); 01697 for (unsigned i = 0; i < nHits; i++) { 01698 TMLink * l = hits[i]; 01699 MdcRec_wirhit * h = hits[i]->hit()->reccdc(); 01700 h->trk = r; 01701 h->pChiSq = l->pull(); 01702 h->lr = l->leftRight(); 01703 //zsl if (l->usecathode() == 4) ++nClst; 01704 chisq += h->pChiSq; 01705 } 01706 r->chiSq = chisq; 01707 r->nhits = nHits; 01708 r->nster = nStereos; 01709 r->ndf = nHits - 5; 01710 if (t.quality() & TrackQuality2D) 01711 r->ndf = nHits - 3; 01712 01713 //...Bad hits... 01714 n = badHits.length(); 01715 for (unsigned i = 0; i < n; i++) { 01716 MdcRec_wirhit * h = badHits[i]->hit()->reccdc(); 01717 h->trk = r; 01718 h->stat |= WireHitInvalidForFit; 01719 } 01720 01721 //...Cathode... 01722 r->nclus = nClst; 01723 01724 //...Helix parameter... 01725 const Vector & a = t.helix().a(); 01726 const SymMatrix & ea = t.helix().Ea(); 01727 const HepPoint3D & x = t.helix().pivot(); 01728 r->helix[0] = a[0]; 01729 r->helix[1] = a[1]; 01730 r->helix[2] = a[2]; 01731 r->helix[3] = a[3]; 01732 r->helix[4] = a[4]; 01733 01734 r->pivot[0] = x.x(); 01735 r->pivot[1] = x.y(); 01736 r->pivot[2] = x.z(); 01737 01738 r->error[0] = ea[0][0]; 01739 r->error[1] = ea[1][0]; 01740 r->error[2] = ea[1][1]; 01741 r->error[3] = ea[2][0]; 01742 r->error[4] = ea[2][1]; 01743 r->error[5] = ea[2][2]; 01744 r->error[6] = ea[3][0]; 01745 r->error[7] = ea[3][1]; 01746 r->error[8] = ea[3][2]; 01747 r->error[9] = ea[3][3]; 01748 r->error[10] = ea[4][0]; 01749 r->error[11] = ea[4][1]; 01750 r->error[12] = ea[4][2]; 01751 r->error[13] = ea[4][3]; 01752 r->error[14] = ea[4][4]; 01753 01754 //...Get outer most hit(=termination point)... 01755 TMLink * last = OuterMost(hits); 01756 01757 //...Calculate phi of the termination point... 01758 t.approach(* last); 01759 r->fiTerm = last->dPhi(); 01760 01761 return err; 01762 }
|
|
|
|
returns/sets debug level.
|
|
00296 { 00297 return _debugLevel = a; 00298 }
|
|
returns/sets debug level.
00290 {
00291 return _debugLevel;
00292 }
|
|
determines IP.
|
|
determines IP.
02517 { 02518 static const HepVector3D InitialVertex(0., 0., 0.); 02519 02520 //...Track selection... 02521 // unsigned n = BsCouTab(RECTRK); 02522 unsigned n = MdcTrkCol::getMdcTrkCol()->size(); 02523 AList<MdcTrk_localz> zList; 02524 for (unsigned i = 0; i < n; i++) { 02525 // const rectrk & t = * (rectrk *) BsGetEnt(RECTRK, i + 1, BBS_No_Index); 02526 const MdcTrk & t = (* MdcTrkCol::getMdcTrkCol())[i]; 02527 02528 if (t.prekal == 0) continue; 02529 // const reccdc_trk_add & c = * (reccdc_trk_add *) 02530 // BsGetEnt(RECMDC_TRK_ADD, t.m_prekal, BBS_No_Index); 02531 const MdcRec_trk_add & c = * t.prekal->add; 02532 02533 //...Only good tracks... 02534 if (c.quality) continue; 02535 02536 //...Require SVD hits... 02537 // const rectrk_global & g = * (rectrk_global *) BsGetEnt(RECTRK_GLOBAL, 02538 // t.m_glob[2], 02539 // BBS_No_Index); 02540 const MdcTrk_global & g = * t.glob[2]; 02541 02542 if (! & g) continue; 02543 if (g.nhits[3] < 2) continue; 02544 if (g.nhits[4] < 2) continue; 02545 02546 //...OK... 02547 // const rectrk_localz & z = * (rectrk_localz *) BsGetEnt(RECTRK_LOCALZ, 02548 // t.m_zero[2], 02549 // BBS_No_Index); 02550 MdcTrk_localz & z = * t.zero[2]; 02551 02552 if (! & z) continue; 02553 // zList.append((rectrk_localz &) z); 02554 zList.append(z); 02555 } 02556 unsigned nZ = zList.length(); 02557 if (nZ < 2) return; 02558 02559 //...Fitting... 02560 // kvertexfitter kvf; 02561 // kvf.initialVertex(initialVertex); 02562 // for (unsigned i = 0; i < nZ; i++) { 02563 // kvf.addTrack(); 02564 // } 02565 02566 }
|
|
determines T0 and refit all tracks.
|
|
determines T0 and refit all tracks.
01196 { 01197 #ifdef TRKRECO_DEBUG_DETAIL 01198 if (level == 0) { 01199 std::cout << "TTrackManager::determineT0 !!! called with level = 0"; 01200 std::cout << std::endl; 01201 } 01202 #endif 01203 01204 IMessageSvc *msgSvc; 01205 Gaudi::svcLocator()->service("MessageSvc", msgSvc); 01206 MsgStream log(msgSvc, "TTrackManager"); 01207 01208 IDataProviderSvc* eventSvc = NULL; 01209 Gaudi::svcLocator()->service("EventDataSvc", eventSvc); 01210 01211 static bool first = true; 01212 static unsigned methode = 0; 01213 if (first) { 01214 first = false; 01215 01216 if (level == 1) { 01217 _cFitter.fit2D(true); 01218 } 01219 else if (level == 2) { 01220 // default setting 01221 } 01222 else if (level == 3) { 01223 // _cFitter.sag(true); //Liuqg 01224 } 01225 else if (level == 4) { 01226 // _cFitter.sag(true); //Liuqg 01227 _cFitter.propagation(true); 01228 } 01229 else if (level == 5) { 01230 // _cFitter.sag(true); //Liuqg 01231 _cFitter.propagation(true); 01232 _cFitter.tof(true); 01233 } 01234 else if (level == 6) { 01235 methode = 1; 01236 // _cFitter.sag(true); //Liuqg 01237 _cFitter.propagation(true); 01238 _cFitter.tof(true); 01239 } 01240 else if (level == 7) { 01241 methode = 2; 01242 // _cFitter.sag(true); //Liuqg 01243 _cFitter.propagation(true); 01244 _cFitter.tof(true); 01245 } 01246 } 01247 01248 unsigned n = _tracks.length(); 01249 if (! n) return StatusCode::SUCCESS; 01250 01251 if (nMax == 0) nMax = n; 01252 if (n > nMax) n = nMax; 01253 01254 // float t0 = 0.; 01255 _t0 = 999.; 01256 01257 //read t0 from TDS 01258 float t0_sta = -1; 01259 float tev = 0; 01260 SmartDataPtr<RecEsTimeCol> aevtimeCol(eventSvc,"/Event/Recon/RecEsTimeCol"); 01261 if (aevtimeCol) { 01262 RecEsTimeCol::iterator iter_evt = aevtimeCol->begin(); 01263 t0_sta = (*iter_evt)->getStat(); 01264 tev = (*iter_evt)->getTest(); 01265 // cout<<"t0_sta: "<<t0_sta<<" tev: "<<tev<<endl; 01266 }else{ 01267 log << MSG::WARNING << "Could not find RecEsTimeCol" << endreq; 01268 } 01269 01270 if (methode == 0) _t0 = T0(n); 01271 01272 else if (methode == 1) _t0 = T0Fit(n); 01273 01274 else if (methode ==2) { //revise method == 2 to BESIII environment. Liuqg 01275 if (t0_sta != 1) { //1: tof 11:tof after reco //no tof 01276 _t0 = T0Fit(n); 01277 //cout<<"t0: "<<_t0<<endl; 01278 } 01279 } 01280 01281 // std::cout << "reccdc_timing=" << BsCouTab(RECMDC_TIMING) << std::endl; 01282 /* else if (methode == 2 && BsCouTab(RECMDC_TIMING) != 0) { 01283 struct reccdc_timing * r0 = (struct reccdc_timing *) 01284 BsGetEnt(RECMDC_TIMING, BsCouTab(RECMDC_TIMING), BBS_No_Index); 01285 if (r0->m_quality == 102) { 01286 if (BsCouTab(BELLE_EVENT)) { 01287 struct belle_event * b0 = (struct belle_event *) 01288 BsGetEnt(BELLE_EVENT, 1, BBS_No_Index); 01289 if(1==b0->m_ExpMC) t0 = T0Fit(n); 01290 if(2==b0->m_ExpMC && r0->m_time !=0.) t0 = T0Fit(n); 01291 } 01292 } 01293 else if (r0->m_quality == 100) t0 = T0Fit(n); 01294 // std::cout << "quality=" << r0->m_quality << std::endl; 01295 } 01296 */ 01297 01298 //...For debug... 01299 if (_debugLevel) { 01300 std::cout << "TTrackManager::determineT0 ... methode=" << methode; 01301 std::cout << ", T0 offset=" << - _t0; 01302 std::cout << ", # of tracks used=" << n << std::endl; 01303 } 01304 01305 //...store them... Liuqg 01306 float t0_rec = 999.; 01307 int t0_recSta = 8; 01308 if(fabs(_t0 + tev) < 4) t0_rec = 0; 01309 if(fabs(_t0 + tev - 8) < 4) t0_rec = 8; 01310 if(fabs(_t0 + tev - 16) < 4) t0_rec = 16; 01311 log << MSG::INFO << "beginning to make RecEsTimeCol" <<endreq; 01312 IDataManagerSvc *dataManSvc = dynamic_cast<IDataManagerSvc*> (eventSvc); 01313 DataObject *aEvTime; 01314 eventSvc->findObject("/Event/Recon/RecEsTimeCol",aEvTime); 01315 if(aEvTime!=NULL && t0_rec<25){ 01316 dataManSvc->clearSubTree("/Event/Recon/RecEsTimeCol"); 01317 eventSvc->unregisterObject("/Event/Recon/RecEsTimeCol"); 01318 } 01319 if(t0_rec<25){ 01320 01321 RecEsTimeCol *aEvTimeCol = new RecEsTimeCol; 01322 RecEsTime *aevtime = new RecEsTime; 01323 aevtime -> setTest(t0_rec); 01324 aevtime -> setStat(t0_recSta); 01325 aEvTimeCol->push_back(aevtime); 01326 01327 // register event time to TDS 01328 //check whether the t0 has been already registered 01329 StatusCode evtime = eventSvc->registerObject("/Event/Recon/RecEsTimeCol", aEvTimeCol); 01330 01331 if(evtime!=StatusCode::SUCCESS) { 01332 log << MSG::FATAL << "Could not register Event Start Time" << endreq; 01333 return( StatusCode::FAILURE); 01334 } 01335 } 01336 return( StatusCode::SUCCESS ); 01337 }
|
|
|
|
00931 { 00932 TMLink & start = * OuterMost(t.links()); 00933 const HepPoint3D & center = t.helix().center(); 00934 const HepVector3D a = start.positionOnTrack() - center; 00935 for (unsigned j = 0; j < t.nLinks(); j++) { 00936 if (t[j] == & start) continue; 00937 TMLink & k = * t[j]; 00938 const HepVector3D b = k.positionOnTrack() - center; 00939 if (a.cross(b).z() >= 0.) l[0].append(k); 00940 else l[1].append(k); 00941 } 00942 00943 #ifdef TRKRECO_DEBUG_DETAIL 00944 std::cout << " outer link = " << start.hit()->wire()->name() << std::endl; 00945 std::cout << " nLinks of 0 = " << l[0].length() << std::endl; 00946 std::cout << " nLinks of 1 = " << l[1].length() << std::endl; 00947 #endif 00948 00949 if (l[0].length() == 0 || l[1].length() == 0) 00950 return divideByIp(t, l); 00951 00952 return start; 00953 }
|
|
|
|
00956 { 00957 l[0].removeAll(); 00958 l[1].removeAll(); 00959 00960 const HepPoint3D & center = t.helix().center(); 00961 const HepVector3D a = ORIGIN - center; 00962 for (unsigned j = 0; j < t.nLinks(); j++) { 00963 TMLink & k = * t[j]; 00964 const HepVector3D b = k.positionOnTrack() - center; 00965 if (a.cross(b).z() >= 0.) l[0].append(k); 00966 else l[1].append(k); 00967 } 00968 00969 //...This is a dummy... 00970 TMLink & start = * OuterMost(t.links()); 00971 return start; 00972 }
|
|
dumps debug information.
Reimplemented from TUpdater. |
|
dumps debug information.
Reimplemented from TUpdater. 00099 { 00100 bool def = (msg == "") ? true : false; 00101 /* 00102 if (msg.find("summary") != std::string::npos || msg.find("detail") != std::string::npos) { 00103 struct summary s; 00104 // bzero((char*)& s, sizeof(struct summary)); 00105 memset((char*)& s, 0, sizeof(struct summary)); 00106 for (int i = 0; i < BASF_Sharedmem->nprocess(); i++) { 00107 int size; 00108 struct summary & r = * (struct summary *) 00109 BASF_Sharedmem->get_pointer(i, "TrkMgrSum", & size); 00110 s._nEvents += r._nEvents; 00111 s._nTracks += r._nTracks; 00112 s._nTracksAll += r._nTracksAll; 00113 s._nTracks2D += r._nTracks2D; 00114 s._nTracksFinal += r._nTracksFinal; 00115 s._nSuperMoms += r._nSuperMoms; 00116 s._nToBeMerged += r._nToBeMerged; 00117 s._nToBeMergedMoreThanTwo += r._nToBeMergedMoreThanTwo; 00118 } 00119 00120 std::cout << pre; 00121 std::cout << "all events : " << s._nEvents << std::endl; 00122 std::cout << pre; 00123 std::cout << "all tracks : " << s._nTracksAll << std::endl; 00124 std::cout << pre; 00125 std::cout << " good tracks : " << s._nTracks << std::endl; 00126 std::cout << pre; 00127 std::cout << " 2D tracks : " << s._nTracks2D << std::endl; 00128 std::cout << pre; 00129 std::cout << " final tracks : " << s._nTracksFinal << std::endl; 00130 std::cout << pre; 00131 std::cout << " super mom. : " << s._nSuperMoms << std::endl; 00132 std::cout << pre; 00133 std::cout << " to be mreged : " << s._nToBeMerged << std::endl; 00134 std::cout << pre; 00135 std::cout << " to be mreged2: " << s._nToBeMergedMoreThanTwo 00136 << std::endl; 00137 } 00138 */ 00139 if (def || msg.find("eventSummary") != std::string::npos || msg.find("detail") != std::string::npos) { 00140 std::cout << pre 00141 << "tracks reconstructed : " << _tracksAll.length() 00142 << std::endl; 00143 std::cout << pre 00144 << "good tracks : " << _tracks.length() 00145 << std::endl; 00146 std::cout << pre 00147 << "2D tracks : " << _tracks2D.length() 00148 << std::endl; 00149 std::cout << pre 00150 << "Track list:" << std::endl; 00151 00152 std::string tab = pre; 00153 std::string spc = " "; 00154 for (unsigned i = 0; i < _tracksAll.length(); i++) { 00155 std::cout << tab << TrackDump(* _tracksAll[i]) << std::endl; 00156 if (msg.find("hits") != std::string::npos || msg.find("detail") != std::string::npos) 00157 Dump(_tracksAll[i]->links(), "hits sort flag"); 00158 } 00159 } 00160 }
|
|
finishes tracks.
|
|
finishes tracks.
00775 { 00776 refit(); 00777 movePivot(); 00778 if (_debugLevel > 1) { 00779 std::cout << name() << " ... finishing" << std::endl; 00780 // unsigned n = _tracksAll.length(); 00781 unsigned n = _tracks.length(); 00782 for (unsigned i = 0; i < n; i++) { 00783 // TTrack & t = * _tracksAll[i]; 00784 TTrack & t = * _tracks[i]; 00785 std::cout << " " << t.name() << std::endl; 00786 t.dump("hits mc track flag sort", " "); 00787 } 00788 } 00789 }
|
|
sets fitting flag.
|
|
sets fitting flag.
00302 { 00303 if (a & 1) _fitter.sag(true); 00304 if (a & 2) _fitter.propagation(true); 00305 if (a & 4) _fitter.tof(true); 00306 if (a & 8) _fitter.freeT0(true); 00307 }
|
|
checks goodness of a track.
|
|
checks goodness of a track.
02918 { 02919 02920 //...Check number of hits... 02921 if (! checkNumberOfHits(t, track2D)) return false; 02922 02923 //...Check helix parameter... 02924 if (HelixHasNan(t.helix())) return false; 02925 02926 return true; 02927 }
|
|
initializes an object.
|
|
initializes an object.
00082 {
00083 _init = true;
00084 }
|
|
returns true if an object is initialized.
|
|
returns true if an object is initialized.
00076 {
00077 return _init;
00078 }
|
|
stores track info. into TDS. by Zang Shilei
|
|
stores track info. into TDS. by Zang Shilei added by Jike Wang add by jialk: returns driftTime prop time correction & entra angle check the result:MdcTrackCol 00269 { //yzhang change interface 2010-05-14 00270 IMessageSvc *msgSvc; 00271 Gaudi::svcLocator()->service("MessageSvc", msgSvc); 00272 00273 MsgStream log(msgSvc, "TrkReco"); 00274 00275 IDataProviderSvc* eventSvc = NULL; 00276 Gaudi::svcLocator()->service("EventDataSvc", eventSvc); 00277 00278 #ifdef TRKRECO_DEBUG 00279 if (eventSvc) { 00280 log << MSG::INFO << "makeTds:event Svc has been found" << endreq; 00281 } else { 00282 log << MSG::FATAL << "makeTds:Could not find eventSvc" << endreq; 00283 return StatusCode::FAILURE ; 00284 } 00285 #endif 00286 //check whether Recon already registered 00287 // DataObject *aReconEvent; 00288 // eventSvc->findObject("/Event/Recon",aReconEvent); 00289 // if(!aReconEvent) { 00290 // ReconEvent* recevt = new ReconEvent; 00291 // StatusCode sc = eventSvc->registerObject("/Event/Recon",recevt ); 00292 // if(sc!=StatusCode::SUCCESS) { 00293 // log << MSG::FATAL << "Could not register ReconEvent" <<endreq; 00294 // return( StatusCode::FAILURE); 00295 // } 00296 // } 00297 // 00298 // /// Unregister Tracks 00299 // IDataManagerSvc *dataManSvc; 00300 // if(doClear){//yzhang add, do NOT clear Tds when associate rec 00301 // dataManSvc= dynamic_cast<IDataManagerSvc*>(eventSvc); 00302 // DataObject *aTrackCol; 00303 // eventSvc->findObject("/Event/Recon/RecMdcTrackCol",aTrackCol); 00304 // if(aTrackCol != NULL) { 00305 // dataManSvc->clearSubTree("/Event/Recon/RecMdcTrackCol"); 00306 // eventSvc->unregisterObject("/Event/Recon/RecMdcTrackCol"); 00307 // } 00308 // DataObject *aRecHitCol; 00309 // eventSvc->findObject("/Event/Recon/RecMdcHitCol",aRecHitCol); 00310 // if(aRecHitCol != NULL) { 00311 // dataManSvc->clearSubTree("/Event/Recon/RecMdcHitCol"); 00312 // eventSvc->unregisterObject("/Event/Recon/RecMdcHitCol"); 00313 // } 00314 // } 00315 // /// Writing 00316 // RecMdcTrackCol* trkcol = new RecMdcTrackCol; 00317 // RecMdcHitCol* hitcol = new RecMdcHitCol; 00318 00319 unsigned n = _tracks.length(); 00320 int nTdsTk = trkcol->size(); 00321 for (int i =0; i < n; i++) { 00322 RecMdcTrack* trk = new RecMdcTrack; 00323 TTrack* t = _tracks[i]; 00324 int trackindex = i + nTdsTk;//for combination 00325 // int trackindex = i; 00326 00327 HitRefVec hitrefvec; 00328 AList<TMLink> hits = t->links(); 00329 float chisq=0; 00330 00331 HepPoint3D pos = t->helix().pivot(); 00332 int charge = -1; 00333 HepVector m_a(5,0); 00334 m_a = t->helix().a(); 00335 //be cautious 00336 m_a[2] = -m_a[2]; 00337 while(m_a[1]<0){m_a[1]+=2*pi;} 00338 while(m_a[1]>2*pi){m_a[1]-=2*pi;} 00340 const double x0 = t->helix().pivot().x(); 00341 const double y0 = t->helix().pivot().y(); 00342 00343 const double dr = t->helix().a()[0]; 00344 const double phi0 = t->helix().a()[1]; 00345 const double kappa = t->helix().a()[2]; 00346 const double dz = t->helix().a()[3]; 00347 const double tanl = t->helix().a()[4]; 00348 00349 const double alpha = 333.564095; 00350 00351 const double cox = x0 + dr*cos(phi0) + alpha*cos(phi0)/kappa; 00352 const double coy = y0 + dr*sin(phi0) + alpha*sin(phi0)/kappa; 00353 00354 00355 unsigned nHits = t->links().length(); 00356 unsigned nStereos = 0; 00357 unsigned firstLyr = 44; 00358 unsigned lastLyr = 0; 00359 for (unsigned j=0; j<nHits; j++){ 00360 00361 TMLink * l = hits[j]; 00362 00363 HepPoint3D ontrack = l->positionOnTrack(); 00364 HepPoint3D onwire = l->positionOnWire(); 00365 HepPoint3D dir(ontrack.y()-coy,cox-ontrack.x(),0); 00366 double pos_phi=onwire.phi(); 00367 double dir_phi=dir.phi(); 00368 while(pos_phi>pi){pos_phi-=pi;} 00369 while(pos_phi<0){pos_phi+=pi;} 00370 while(dir_phi>pi){dir_phi-=pi;} 00371 while(dir_phi<0){dir_phi+=pi;} 00372 double entrangle=dir_phi-pos_phi; 00373 while(entrangle>pi/2)entrangle-=pi; 00374 while(entrangle<(-1)*pi/2)entrangle+=pi; 00375 00376 //jialk setFltLen to tds 00377 int imass = 3; 00378 float tl = t->helix().a()[4]; 00379 float f = sqrt(1. + tl * tl); 00380 float s = fabs(t->helix().curv()) * fabs(l->dPhi()) * f; 00381 float p = f / fabs(t->helix().a()[2]); 00382 float Mass[5] = {0.000511,0.105,0.140,0.493677,0.98327}; 00383 double tof = s/29.98*sqrt(1.0+(Mass[imass-1]/p)*(Mass[imass-1]/p)); 00384 00385 RecMdcHit* hit = new RecMdcHit; 00386 hit->setId(l->hit()->reccdc()->id); 00387 // hit->setTrkId(i); 00388 hit->setTrkId(trackindex); //for combination 00389 hit->setDriftDistLeft(l->drift(0)); 00390 hit->setDriftDistRight(l->drift(1)); 00391 hit->setErrDriftDistLeft(l->dDrift(0)); 00392 hit->setErrDriftDistRight(l->dDrift(1)); 00393 hit->setChisqAdd(l->pull()); 00394 hit->setFlagLR(l->leftRight()); 00395 // hit->setStat(l->hit()->state()); 00396 hit->setStat(1); 00397 // std::cout<<"state :"<< l->hit()->state() << std::endl; 00398 hit->setAdc(l->hit()->reccdc()->adc); 00399 hit->setTdc((l->hit()->reccdc()->tdc + t0bes)/0.09375); //jialk 00400 hit->setFltLen(tof * 30);//jialk 00401 // std::cout<<"tdc :"<< l->hit()->reccdc()->tdc <<" "<<"t0bes : "<< t0bes <<std::endl; 00402 00403 hit->setDoca(l->distance()); 00404 hit->setZhit(l->positionOnTrack().z()); 00405 00407 hit->setEntra(entrangle); 00408 hit->setDriftT(l->getDriftTime()); 00409 00410 00411 Identifier hitIdf = MdcID:: wire_id(l->wire()->layerId(),l->wire()->localId()); 00412 hit->setMdcId(hitIdf); 00413 hitcol->push_back(hit); 00414 00415 SmartRef<RecMdcHit> refhit(hit); 00416 hitrefvec.push_back(refhit); 00417 chisq += l->pull(); 00418 if(l->wire()->stereo()) ++nStereos; 00419 if(firstLyr > l->wire()->layerId()) firstLyr = l->wire()->layerId(); 00420 if(lastLyr < l->wire()->layerId()) lastLyr = l->wire()->layerId(); 00421 } 00422 00423 00424 HepSymMatrix m_ea = t->helix().Ea(); 00425 double errorMat[15]; 00426 int k = 0; 00427 for (int ie = 0 ; ie < 5 ; ie ++){ 00428 for (int je = ie ; je < 5 ; je ++) { 00429 errorMat[k] = m_ea[ie][je]; 00430 k++; 00431 } 00432 } 00433 00434 trk->setTrackId(trackindex); 00435 trk->setHelix(m_a); 00436 trk->setPxy(t->pt()); 00437 trk->setPx(t->pt() * (-sin(t->helix().phi0()))); 00438 trk->setPy(t->pt() * cos(t->helix().phi0())); 00439 trk->setPz(t->pz()); 00440 trk->setP(t->ptot()); 00441 00442 //jialk 00443 double theta = acos((t->pz())/t->ptot()); 00444 trk->setTheta(theta); 00445 00446 double poca_dr = t->helix().dr(); 00447 double poca_phi0 = t->helix().phi0(); 00448 trk->setPhi(poca_phi0); 00449 HepPoint3D poca(pos.x()+poca_dr*cos(poca_phi0), 00450 pos.y()+poca_dr*sin(poca_phi0), 00451 pos.z()+t->helix().dz()); 00452 trk->setPoca(poca); 00453 trk->setX(poca.x()); 00454 trk->setY(poca.y()); 00455 trk->setZ(poca.z()); 00456 trk->setR(sqrt(poca.x()*poca.x() + poca.y()*poca.y())); 00457 trk->setPivot(pos); 00458 trk->setVX0(pos.x()); 00459 trk->setVY0(pos.y()); 00460 trk->setVZ0(pos.z()); 00461 00462 trk->setError(m_ea); 00463 // trk->setError(errorMat); //...............2 00464 00465 // double poca_dr = t->helix().dr(); 00466 // double poca_phi0 = t->helix().phi0(); 00467 // HepPoint3D poca(poca_dr*cos(poca_phi0),poca_dr*sin(poca_phi0),t->helix().dz()); 00468 // trk->setVX0(pos.x()+poca_dr*cos(poca_phi0)); 00469 // trk->setVY0(pos.y()+poca_dr*sin(poca_phi0)); 00470 // trk->setVZ0(pos.z()+t->helix().dz()); 00471 // cout<<"pivot:("<<pos.x()<<","<<pos.y()<<","<<pos.z()<<")"<<endl; 00472 // cout<<"poca:("<<trk->getVX0()<<","<<trk->getVY0()<<","<<trk->getVZ0()<<")"<<endl; 00473 00474 trk->setChi2(chisq); 00475 trk->setNdof(nHits-5); 00476 if (t->quality() & TrackQuality2D) trk->setNdof(nHits-3); 00477 00478 TMLink * last = OuterMost(hits); 00479 t->approach(*last); 00480 trk->setFiTerm(last->dPhi()); 00481 00482 trk->setNhits(nHits); 00483 trk->setNster(nStereos); 00484 trk->setStat(tkStat);//yzhang add stat: ConformalFinder=2, CurlFiner=3 00485 trk->setCharge(int(t->charge())*(-1)); 00486 trk->setVecHits(hitrefvec); 00487 trk->setFirstLayer(firstLyr); 00488 trk->setLastLayer(lastLyr); 00489 //cout<<"first: "<<firstLyr<<" last: "<<lastLyr<<endl; 00490 trkcol->push_back(trk); 00491 } 00492 00493 // StatusCode trksc; 00494 // trksc = eventSvc->registerObject("/Event/Recon/RecMdcTrackCol", trkcol); 00495 // if( trksc.isFailure() ) { 00496 // log << MSG::FATAL << "Could not register MdcTrack" << endreq; 00497 // return trksc; 00498 // } 00499 // 00500 // StatusCode hitsc = eventSvc->registerObject("/Event/Recon/RecMdcHitCol", hitcol); 00501 // if ( hitsc.isFailure() ) { 00502 // log << MSG::FATAL << "Could not register MdcRecHit" << endreq; 00503 // return hitsc; 00504 // } 00505 //log << MSG::INFO << "MdcTrackCol registered successfully!" <<endreq; 00506 00508 /* 00509 SmartDataPtr<MdcTrackCol> newtrkCol(eventSvc,"/Event/Recon/MdcTrackCol"); 00510 if (!newtrkCol) { 00511 log << MSG::FATAL << "Could not find MdcTrackCol" << endreq; 00512 return( StatusCode::FAILURE); 00513 } 00514 log << MSG::INFO << "Begin to check MdcTrackCol"<<endreq; 00515 MdcTrackCol::iterator iter_trk = newtrkCol->begin(); 00516 for( ; iter_trk != newtrkCol->end(); iter_trk++){ 00517 log << MSG::DEBUG << "retrieved MDC track:" 00518 << "Track Id: " << (*iter_trk)->getId() 00519 << " Pivot: " << (*iter_trk)->getX0() << " " 00520 << (*iter_trk)->getY0() << " " << (*iter_trk)->getZ0() 00521 << endreq 00522 << "Phi0: " << (*iter_trk)->getFi0() << " Error of Phi0 " 00523 << (*iter_trk)->getError()(2,2) << endreq 00524 << "kappa: " << (*iter_trk)->getCpa() << " Error of kappa " 00525 << (*iter_trk)->getError()(3,3) << endreq 00526 << "Tanl: " << (*iter_trk)->getTanl() << " Error of Tanl " 00527 << (*iter_trk)->getError()(5,5) << endreq 00528 << "Chisq of fit: "<< (*iter_trk)->getChisq() 00529 << " Phi terminal: "<< (*iter_trk)->getFiTerm() 00530 << endreq 00531 << "Number of hits: "<< (*iter_trk)->getNhits() 00532 << " Number of stereo hits " << (*iter_trk)->getNster() 00533 << endreq; 00534 00535 log << MSG::DEBUG << "hitList of this track:" << endreq; 00536 std::vector<MdcRecHit*> gothits = (*iter_trk)->getVecHits(); 00537 std::vector<MdcRecHit*>::iterator it_gothit = gothits.begin(); 00538 for( ; it_gothit != gothits.end(); it_gothit++){ 00539 log << MSG::DEBUG << "hits Id: "<<(*it_gothit)->getId() 00540 << " hits DDL&DDR " <<(*it_gothit)->getDriftDistLeft() 00541 << " hits MDC IDentifier " <<(*it_gothit)->getMdcId() 00542 << endreq 00543 << " hits TDC " <<(*it_gothit)->getTdc() 00544 << " hits ADC " <<(*it_gothit)->getAdc() << endreq; 00545 } 00546 00547 } 00548 */ 00549 return StatusCode::SUCCESS; 00550 }
|
|
masks hits out which are in tail of curly tracks.
|
|
masks hits out which are in tail of curly tracks.
00850 { 00851 #ifdef TRKRECO_DEBUG_DETAIL 00852 std::cout << name() << " ... masking" << std::endl; 00853 #endif 00854 00855 unsigned n = _tracks.length(); 00856 for (unsigned i = 0; i < n; i++) { 00857 TTrack & t = * _tracks[i]; 00858 00859 //...Skip if no core... 00860 // This should not be happend... 00861 if (! t.cores().length()) continue; 00862 00863 //...Counts # of hits per layer... 00864 unsigned nHits[43]; 00865 NHits(t.cores(), nHits); 00866 00867 //...Check each layer... 00868 bool needMask = false; 00869 for (unsigned j = 0; j < 43; j++) { 00870 if (nHits[j] > 1) { 00871 AList<TMLink> linksInLayer = SameLayer(t.links(), j); 00872 if (Width(linksInLayer) > 2) { 00873 needMask = true; 00874 00875 #ifdef TRKRECO_DEBUG_DETAIL 00876 Dump(linksInLayer, "sort", " -->"); 00877 #endif 00878 break; 00879 } 00880 } 00881 } 00882 if (! needMask) continue; 00883 00884 #ifdef TRKRECO_DEBUG_DETAIL 00885 std::cout << " trk" << i << "(id is tmp) needs mask" << std::endl; 00886 std::cout << " type = " << t.type() << std::endl; 00887 #endif 00888 00889 //...Switch by track type... 00890 switch (t.type()) { 00891 case TrackTypeNormal: 00892 maskNormal(t); 00893 maskMultiHits(t); 00894 break; 00895 case TrackTypeCurl: 00896 maskCurl(t); 00897 maskMultiHits(t); 00898 break; 00899 default: 00900 break; 00901 } 00902 00903 //...Refit... 00904 // refit() ??? 00905 _fitter.fit(t); 00906 00907 #ifdef TRKRECO_DEBUG_DETAIL 00908 std::cout << " masking result : "; 00909 t.dump("detail sort", " "); 00910 #endif 00911 } 00912 }
|
|
masks hits with large chisq as associated hits. Pull in TMLink is used.
|
|
masks hits with large chisq as associated hits. Pull in TMLink is used.
02390 { 02391 #ifdef TRKRECO_DEBUG 02392 std::cout << "... trkmgr::maskBadHits" << std::endl; 02393 #endif 02394 02395 unsigned n = tracks.length(); 02396 for (unsigned i = 0; i < n; i++) { 02397 TTrack & t = * tracks[i]; 02398 bool toBeUpdated = false; 02399 const AList<TMLink> links = t.links(); 02400 unsigned nHits = links.length(); 02401 for (unsigned j = 0; j < nHits; j++) { 02402 if (links[j]->pull() > maxSigma2) { 02403 links[j]->hit()->state(links[j]->hit()->state() | 02404 WireHitInvalidForFit); 02405 toBeUpdated = true; 02406 #ifdef TRKRECO_DEBUG 02407 std::cout << " " << t.name() << " : "; 02408 std::cout << links[j]->wire()->name() << "(pull="; 02409 std::cout << links[j]->pull() << ") is masked" << std::endl; 02410 #endif 02411 } 02412 } 02413 if (toBeUpdated) t.update(); 02414 } 02415 }
|
|
|
|
01140 { 01141 01142 //...Divide into two tracks... 01143 AList<TMLink> l[2]; 01144 TMLink & start = divideByIp(t, l); 01145 if (l[0].length() == 0) return; 01146 if (l[1].length() == 0) return; 01147 01148 #ifdef TRKRECO_DEBUG_DETAIL 01149 std::cout << " curl : divided by IP" << std::endl; 01150 std::cout << " 0:"; 01151 Dump(l[0], "flag sort"); 01152 std::cout << " 1:"; 01153 Dump(l[1], "flag sort"); 01154 std::cout << std::endl; 01155 #endif 01156 01157 //...Which should be masked out ?... 01158 unsigned maskSide = 2; 01159 01160 //...1. Check by # of super layers... 01161 if (NSuperLayers(l[0]) < NSuperLayers(l[1])) maskSide = 0; 01162 else if (NSuperLayers(l[0]) > NSuperLayers(l[1])) maskSide = 1; 01163 #ifdef TRKRECO_DEBUG_DETAIL 01164 std::cout << " NSuperLayers 0, 1 = " << NSuperLayers(l[0]) << ", "; 01165 std::cout << NSuperLayers(l[1]) << std::endl; 01166 #endif 01167 if (maskSide != 2) { 01168 maskOut(t, l[maskSide]); 01169 return; 01170 } 01171 01172 //...Make two tracks... 01173 TTrack * tt[2]; 01174 tt[0] = new TTrack(t); 01175 tt[1] = new TTrack(t); 01176 tt[0]->remove(l[1]); 01177 tt[1]->remove(l[0]); 01178 _fitter.fit(* tt[0]); 01179 _fitter.fit(* tt[1]); 01180 Helix h0 = Helix(tt[0]->helix()); 01181 Helix h1 = Helix(tt[1]->helix()); 01182 01183 //...Check by z... 01184 h0.pivot(ORIGIN); 01185 h1.pivot(ORIGIN); 01186 if (fabs(h0.dz()) < fabs(h1.dz())) maskSide = 1; 01187 else maskSide = 0; 01188 01189 delete tt[0]; 01190 delete tt[1]; 01191 maskOut(t, l[maskSide]); 01192 return; 01193 }
|
|
masks hits on found curl tracks.
|
|
masks hits on found curl tracks.
00165 { 00166 //...Coded by jtanaka... 00167 00168 int i = 0; 00169 while(const TTrack *t = tracks[i++]){ 00170 int j = 0; 00171 while(TMDCWireHit *a = axial[j++]){ 00172 double x = t->helix().center().x() - a->xyPosition().x(); 00173 double y = t->helix().center().y() - a->xyPosition().y(); 00174 double r = sqrt(x*x+y*y); 00175 double R = fabs(t->helix().radius()); 00176 double q = t->helix().center().x()*a->xyPosition().y() - 00177 t->helix().center().y()*a->xyPosition().x(); 00178 double qq = q*t->charge(); 00179 if(R-2. < r && r < R+2. && qq > 0.){ 00180 a->state(a->state() | WireHitUsed); 00181 } 00182 } 00183 j = 0; 00184 while(TMDCWireHit *s = stereo[j++]){ 00185 double x = t->helix().center().x() - s->xyPosition().x(); 00186 double y = t->helix().center().y() - s->xyPosition().y(); 00187 double r = sqrt(x*x+y*y); 00188 double R = fabs(t->helix().radius()); 00189 double q = t->helix().center().x()*s->xyPosition().y() - 00190 t->helix().center().y()*s->xyPosition().x(); 00191 double qq = q*t->charge(); 00192 if(R-2.5 < r && r < R+2.5 && qq > 0.){ 00193 s->state(s->state() | WireHitUsed); 00194 } 00195 } 00196 } 00197 }
|
|
|
|
01030 { 01031 #ifdef TRKRECO_DEBUG_DETAIL 01032 std::cout << "... masking multi-hits" << std::endl; 01033 #endif 01034 01035 if (! t.cores().length()) return; 01036 AList<TMLink> cores = t.cores(); 01037 unsigned n = cores.length(); 01038 bool layerLimited = false; 01039 AList<TMLink> bads; 01040 01041 cores.sort(SortByWireId); 01042 for (unsigned i = 0; i < n; i++) { 01043 if (layerLimited) { 01044 bads.append(cores[i]); 01045 continue; 01046 } 01047 AList<TMLink> linksInLayer = 01048 SameLayer(cores, cores[i]->wire()->layerId()); 01049 if (linksInLayer.length() > 3) { 01050 bads.append(cores[i]); 01051 layerLimited = true; 01052 } 01053 } 01054 maskOut(t, bads); 01055 }
|
|
|
|
01058 { 01059 01060 //...Divide into two tracks... 01061 AList<TMLink> l[2]; 01062 TMLink & start = divideByIp(t, l); 01063 01064 #ifdef TRKRECO_DEBUG_DETAIL 01065 std::cout << " normal : divided by IP" << std::endl; 01066 std::cout << " 0="; 01067 for (unsigned j = 0; j < l[0].length(); j++) { 01068 std::cout << "," << l[0][j]->wire()->name(); 01069 } 01070 std::cout << std::endl; 01071 std::cout << " 1="; 01072 for (unsigned j = 0; j < l[1].length(); j++) { 01073 std::cout << "," << l[1][j]->wire()->name(); 01074 } 01075 std::cout << std::endl; 01076 #endif 01077 01078 //...Which should be masked out ?... 01079 unsigned maskSide = 2; 01080 01081 //...1. Check by # of super layers... 01082 if (NSuperLayers(l[0]) < NSuperLayers(l[1])) maskSide = 0; 01083 else if (NSuperLayers(l[0]) > NSuperLayers(l[1])) maskSide = 1; 01084 #ifdef TRKRECO_DEBUG_DETAIL 01085 std::cout << " NSuperLayers 0, 1 = " << NSuperLayers(l[0]) << ", "; 01086 std::cout << NSuperLayers(l[1]) << std::endl; 01087 #endif 01088 if (maskSide != 2) { 01089 maskOut(t, l[maskSide]); 01090 return; 01091 } 01092 01093 //...2. Check by the inner-most layer... 01094 unsigned i0 = InnerMost(l[0])->wire()->layerId(); 01095 unsigned i1 = InnerMost(l[1])->wire()->layerId(); 01096 if (i0 < i1) maskSide = 1; 01097 else if (i0 > i1) maskSide = 0; 01098 #ifdef TRKRECO_DEBUG_DETAIL 01099 std::cout << " i0, i1 = " << i0 << ", " << i1 << std::endl; 01100 #endif 01101 if (maskSide != 2) { 01102 maskOut(t, l[maskSide]); 01103 return; 01104 } 01105 01106 //...3. Check by # of layers... 01107 if (NLayers(l[0]) < NLayers(l[1])) maskSide = 0; 01108 else if (NLayers(l[0]) > NLayers(l[1])) maskSide = 1; 01109 #ifdef TRKRECO_DEBUG_DETAIL 01110 std::cout << " NLayers 0, 1 = " << NLayers(l[0]) << ", "; 01111 std::cout << NLayers(l[1]) << std::endl; 01112 #endif 01113 if (maskSide != 2) { 01114 maskOut(t, l[maskSide]); 01115 return; 01116 } 01117 01118 //...4. Check by pt... 01119 if (maskSide == 2) { 01120 TTrack * tt[2]; 01121 for (unsigned j = 0; j < 2; j++) { 01122 tt[j] = new TTrack(t); 01123 tt[j]->remove(l[j]); 01124 _fitter.fit(* tt[j]); 01125 } 01126 if (tt[1]->pt() > tt[0]->pt()) maskSide = 1; 01127 else maskSide = 0; 01128 #ifdef TRKRECO_DEBUG_DETAIL 01129 std::cout << " pt 0 = " << tt[1]->pt() << std::endl; 01130 std::cout << " pt 1 = " << tt[0]->pt() << std::endl; 01131 #endif 01132 delete tt[0]; 01133 delete tt[1]; 01134 } 01135 maskOut(t, l[maskSide]); 01136 return; 01137 }
|
|
|
|
01015 { 01016 unsigned n = links.length(); 01017 if (! n) return; 01018 for (unsigned i = 0; i < n; i++) { 01019 const TMDCWireHit & hit = * links[i]->hit(); 01020 hit.state(hit.state() | WireHitInvalidForFit); 01021 } 01022 t._fitted = false; 01023 01024 #ifdef TRKRECO_DEBUG_DETAIL 01025 Dump(links, "detail", " TTrackManager::maskOut ... masking "); 01026 #endif 01027 }
|
|
sets the max. momentum.
|
|
sets the max. momentum.
00284 { 00285 return _maxMomentum = a; 00286 }
|
|
|
|
01450 { 01451 01452 //...Merging... 01453 unsigned n = _tracks.length(); 01454 //cout<<"tracks: "<<n<<endl; 01455 AList<TTrack> bads; 01456 unsigned * flagTrk = (unsigned *) malloc(n * sizeof(unsigned)); 01457 for (unsigned i = 0; i < n; i++) flagTrk[i] = 0; 01458 01459 //...Search a track to be merged... 01460 for (unsigned i0 = 0; i0 < n; i0++) { 01461 01462 if (flagTrk[i0] != 0) continue; 01463 TTrack & t0 = * _tracks[i0]; 01464 if (! (t0.pt() < 0.13)) continue; 01465 01466 unsigned Noverlap(0), Nall(0); 01467 float OverlapRatioMax(-999.); 01468 unsigned MaxID(0); 01469 01470 for (unsigned i1= 0 ; i1 < n; i1++) { 01471 01472 if (i0 == i1 || flagTrk[i1] != 0) continue; 01473 TTrack & t1 = * _tracks[i1]; 01474 if (! (t1.pt() < 0.13)) continue; 01475 Nall = t1.links().length(); 01476 if (! Nall) continue; 01477 01478 Noverlap = 0; 01479 for (unsigned j = 0; j < Nall; j++) { 01480 TMLink & l = * t1.links()[j]; 01481 const TMDCWireHit & whit = * l.hit(); 01482 double load(3.);//jialk original is 2 01483 if (whit.state() & WireHitStereo) load = 4.;//jialk original is 3 01484 01485 double x = t0.helix().center().x() - l.positionOnTrack().x(); 01486 double y = t0.helix().center().y() - l.positionOnTrack().y(); 01487 double r = sqrt(x * x + y * y); 01488 double R = fabs(t0.helix().radius()); 01489 01490 if ((R - load) < r && r < (R + load)) Noverlap++; 01491 } 01492 01493 if (! Noverlap) continue; 01494 float tmpRatio = float(Noverlap) / float(Nall); 01495 01496 if (tmpRatio > OverlapRatioMax) { 01497 OverlapRatioMax = tmpRatio; 01498 MaxID = i1; 01499 } 01500 } 01501 //jialk caution original is 0.8 01502 if (OverlapRatioMax < 0.7) continue; 01503 01504 //...Mask should be done... 01505 unsigned MaskID[2] = {MaxID , i0}; 01506 AList<TMLink> l[2]; 01507 01508 for( unsigned j0=0;j0<2;j0++){ 01509 for( unsigned j1=0;j1< _tracks[MaskID[j0]]->nLinks();j1++){ 01510 TMLink &k = * _tracks[MaskID[j0]]->links()[j1]; 01511 l[j0].append( k ); 01512 } 01513 } 01514 // _tracks[i0]->links().append( _tracks[MaxID]->links() ); 01515 // _tracks[MaxID]->links().append( _tracks[i0]->links ()); 01516 _tracks[i0]->append(_tracks[MaxID]->links()); 01517 _tracks[MaxID]->append(_tracks[i0]->links()); 01518 01519 #ifdef TRKRECO_DEBUG_DETAIL 01520 std::cout << " mask & merge " << std::endl; 01521 std::cout << " 0:"; 01522 Dump(l[0], "flag sort"); 01523 std::cout << " 1:"; 01524 Dump(l[1], "flag sort"); 01525 std::cout << std::endl; 01526 #endif 01527 01528 //...Which should be masked out ?... 01529 unsigned maskSide = 2; 01530 01531 #if 0 01532 //...0. Check by # of super layers... ( not applied now ) 01533 unsigned super0 = NSuperLayers(l[0]); 01534 unsigned super1 = NSuperLayers(l[1]); 01535 01536 if( super0 < super1 ) maskSide = 0; 01537 else if ( super0 > super1 ) maskSide = 1; 01538 01539 #ifdef TRKRECO_DEBUG_DETAIL 01540 std::cout << " NSuperLayers 0, 1 = " << NSuperLayers(l[0]) << ", "; 01541 std::cout << NSuperLayers(l[1]) << std::endl; 01542 #endif 01543 01544 if (maskSide == 2) { 01545 #endif 01546 01547 //...1. Check by the inner-most layer... 01548 unsigned inner0 = InnerMost(l[0])->wire()->layerId(); 01549 unsigned inner1 = InnerMost(l[1])->wire()->layerId(); 01550 if (inner0 < inner1 ) maskSide = 1; 01551 else if (inner0 > inner1) maskSide = 0; 01552 01553 if( maskSide == 2 ){ 01554 01555 //...2. Check by dz 01556 01557 //...Make two tracks... 01558 TTrack * tt[2]; 01559 tt[0] = new TTrack( *(_tracks[MaskID[0]])); 01560 tt[1] = new TTrack( *(_tracks[MaskID[1]])); 01561 _fitter.fit(* tt[0]); 01562 _fitter.fit(* tt[1]); 01563 Helix h0 = Helix(tt[0]->helix()); 01564 Helix h1 = Helix(tt[1]->helix()); 01565 01566 //...Check dz... 01567 h0.pivot(ORIGIN); 01568 h1.pivot(ORIGIN); 01569 if (fabs(h0.dz()) < fabs(h1.dz())) maskSide = 1; 01570 else maskSide = 0; 01571 01572 delete tt[0]; 01573 delete tt[1]; 01574 } 01575 #if 0 01576 } 01577 #endif 01578 bads.append(_tracks[MaskID[maskSide]]); 01579 flagTrk[MaskID[maskSide]] = 1; 01580 } 01581 01582 //cout<<"bads: "<<bads.length()<<endl; 01583 _tracks.remove(bads); 01584 01585 //***** Masking ***** 01586 n = _tracks.length(); 01587 01588 for( unsigned i=0;i<n;i++){ 01589 TTrack & t = * _tracks[i]; 01590 for( unsigned j=0;j<t.links().length();j++){ 01591 TMLink & l = * t.links()[j]; 01592 const TMDCWireHit & whit = * l.hit(); 01593 01594 if( !(whit.state() & WireHitFittingValid) ) continue; 01595 01596 // within half circle or not? 01597 double q = t.helix().center().x() * l.positionOnTrack().y() - 01598 t.helix().center().y() * l.positionOnTrack().x(); 01599 double qq = q *t.charge(); 01600 01601 if( qq > 0 ) whit.state(whit.state() & ~WireHitInvalidForFit); 01602 else whit.state(whit.state() | WireHitInvalidForFit); 01603 } 01604 } 01605 01606 free(flagTrk); 01607 }
|
|
|
|
01443 { 01444 float xMin = X1 + 0.5 * STEP * (y0 - y2) / (y0 + y2 - 2. * y1); 01445 return xMin; 01446 }
|
|
moves pivot of tracks.
|
|
moves pivot of tracks.
00746 { 00747 unsigned n = _tracksAll.length(); 00748 // unsigned n = _tracks.length(); 00749 for (unsigned i = 0; i < n; i++) { 00750 if (_tracksAll[i]->nLinks()) _tracksAll[i]->movePivot(); 00751 // if (_tracks[i]->nLinks()) _tracks[i]->movePivot(); 00752 } 00753 nameTracks(); 00754 }
|
|
returns name.
|
|
returns name.
00260 { 00261 return std::string("Track Manager"); 00262 }
|
|
names tracks.
|
|
names tracks.
00915 { 00916 unsigned n = _tracks.length(); 00917 for (unsigned i = 0; i < n; i++) { 00918 TTrack & t = * _tracks[i]; 00919 t._name = "trk" + itostring(i) + "(" + t._name + ")"; 00920 } 00921 AList<TTrack> tmp = _tracksAll; 00922 tmp.remove(_tracks); 00923 unsigned n1 = tmp.length(); 00924 for (unsigned i = 0; i < n1; i++) { 00925 TTrack & t = * tmp[i]; 00926 t._name = "trk" + itostring(i + n) + "(" + t._name + ")"; 00927 } 00928 }
|
|
|
|
00317 {
00318 return _t0;
00319 }
|
|
refits tracks.
|
|
refits tracks.
00807 { 00808 #ifdef TRKRECO_DEBUG_DETAIL 00809 std::cout << name() << " ... refitting" << std::endl; 00810 #endif 00811 unsigned n = _tracks.length(); 00812 AList<TTrack> bads; 00813 for (unsigned i = 0; i < n; i++) { 00814 TTrack & t = * _tracks[i]; 00815 int err; 00816 err = _fitter.fit(t); 00817 if (err < 0) { 00818 bads.append(t); 00819 #ifdef TRKRECO_DEBUG_DETAIL 00820 std::cout << " " << t.name(); 00821 std::cout << " rejected because of fitting failure" << std::endl; 00822 #endif 00823 continue; 00824 } 00825 t.refine(30. * 10.); 00826 err = _fitter.fit(t); 00827 if (err < 0) { 00828 bads.append(t); 00829 #ifdef TRKRECO_DEBUG_DETAIL 00830 std::cout << " " << t.name(); 00831 std::cout << " rejected because of fitting failure" << std::endl; 00832 #endif 00833 continue; 00834 } 00835 t.refine(30. * 1.); 00836 err = _fitter.fit(t); 00837 if (err < 0) { 00838 bads.append(t); 00839 #ifdef TRKRECO_DEBUG_DETAIL 00840 std::cout << " " << t.name(); 00841 std::cout << " rejected because of fitting failure" << std::endl; 00842 #endif 00843 continue; 00844 } 00845 } 00846 _tracks.remove(bads); 00847 }
|
|
|
|
00975 { 00976 00977 //...Calculate average phi... 00978 unsigned n = l.length(); 00979 float phiSum = 0.; 00980 for (unsigned i = 0; i < n; i++) { 00981 const TMDCWire & w = * l[i]->hit()->wire(); 00982 unsigned j = w.localId(); 00983 unsigned nWire = w.layer()->nWires(); 00984 00985 float phi = (float) j / (float) nWire; 00986 phiSum += phi; 00987 } 00988 float average = phiSum / (float) n; 00989 00990 AList<TMLink> cross; 00991 for (unsigned i = 0; i < n; i++) { 00992 const TMDCWire & w = * l[i]->hit()->wire(); 00993 unsigned j = w.localId(); 00994 unsigned nWire = w.layer()->nWires(); 00995 00996 float phi = (float) j / (float) nWire; 00997 float dif = fabs(phi - average); 00998 if (dif > 0.5) dif = 1. - dif; 00999 01000 if (dif > 0.3) cross.append(l[i]); 01001 } 01002 l.remove(cross); 01003 01004 #ifdef TRKRECO_DEBUG_DETAIL 01005 std::cout << " Cross over IP reduction : "; 01006 for (unsigned i = 0; i < cross.length(); i++) { 01007 std::cout << cross[i]->wire()->name() << ","; 01008 } 01009 std::cout << std::endl; 01010 #endif 01011 }
|
|
salvages remaining hits.
|
|
salvages remaining hits.
00200 { 00201 00202 #ifdef TRKRECO_DEBUG_DETAIL 00203 std::cout << name() << " ... salvaging" << std::endl; 00204 std::cout << " # of given hits=" << hits.length() << std::endl; 00205 #endif 00206 00207 //...Check arguments... 00208 unsigned nTracks = _tracks.length(); 00209 if (nTracks == 0) return; 00210 unsigned nHits = hits.length(); 00211 if (nHits == 0) return; 00212 00213 //...Hit loop... 00214 for (unsigned i = 0; i < nHits; i++) { 00215 TMDCWireHit & h = * hits[i]; 00216 00217 //...Already used?... 00218 if (h.state() & WireHitUsed) continue; 00219 #ifdef TRKRECO_DEBUG_DETAIL 00220 std::cout << " checking " << h.wire()->name() << std::endl; 00221 #endif 00222 00223 //...Select the closest track to a hit... 00224 TTrack * best = closest(_tracks, h); 00225 #ifdef TRKRECO_DEBUG_DETAIL 00226 if (! best) { 00227 std::cout << " no track candidate returned"; 00228 std::cout << "by TTrackManager::closest" << std::endl; 00229 } 00230 #endif 00231 if (! best) continue; 00232 00233 //...Try to append this hit... 00234 AList<TMLink> link; 00235 link.append(new TMLink(0, & h)); 00236 best->appendByApproach(link, 30.); 00237 // best->assign(WireHitConformalFinder); 00238 best->finder(TrackTrackManager); 00239 } 00240 }
|
|
salvages hits for dE/dx(not for track fitting).
|
|
salvages hits for dE/dx(not for track fitting).
02282 { 02283 //#define TRKRECO_DEBUG 02284 //#define TRKRECO_DEBUG_DETAIL 02285 02286 #ifdef TRKRECO_DEBUG 02287 std::cout << "... trkmgr::salvaging associate hits" << std::endl; 02288 std::cout << " # of given hits=" << hits.length() << std::endl; 02289 #endif 02290 02291 //...Check arguments... 02292 unsigned nTracks = _tracks.length(); 02293 if (nTracks == 0) return; 02294 unsigned nHits = hits.length(); 02295 if (nHits == 0) return; 02296 02297 static const TPoint2D o(0., 0.); 02298 02299 //...Hit loop... 02300 for (unsigned i = 0; i < nHits; i++) { 02301 TMDCWireHit & h = * hits[i]; 02302 02303 //...Already used?... 02304 if (h.state() & WireHitUsed) continue; 02305 #ifdef TRKRECO_DEBUG_DETAIL 02306 std::cout << " checking " << h.wire()->name(); 02307 #endif 02308 02309 //...Track loop... 02310 AList<TMLink> toBeDeleted; 02311 TMLink * best = NULL; 02312 TTrack * bestTrack = NULL; 02313 for (unsigned j = 0; j < nTracks; j++) { 02314 TTrack & t = * _tracks[j]; 02315 02316 //...Pre-selection... 02317 TPoint2D c = t.center(); 02318 TPoint2D co = - c; 02319 TPoint2D x = h.wire()->xyPosition(); 02320 02321 #ifdef TRKRECO_DEBUG_DETAIL 02322 std::cout << " : c= " << co.cross(x - c) * t.charge(); 02323 std::cout << ", d=" << fabs((x - c).mag() - fabs(t.radius())); 02324 #endif 02325 02326 if (co.cross(x - c) * t.charge() > 0.) 02327 continue; 02328 if (fabs((x - c).mag() - fabs(t.radius())) > 5.) 02329 continue; 02330 02331 //...Try to append this hit... 02332 TMLink & link = * new TMLink(0, & h); 02333 int err = t.approach(link); 02334 if (err < 0) { 02335 #ifdef TRKRECO_DEBUG_DETAIL 02336 std::cout << " : " << t.name() << " approach failure"; 02337 #endif 02338 toBeDeleted.append(link); 02339 continue; 02340 } 02341 02342 //...Calculate sigma... 02343 float distance = link.distance(); 02344 float diff = fabs(distance - link.hit()->drift()); 02345 float sigma = diff / link.hit()->dDrift(); 02346 link.pull(sigma * sigma); 02347 02348 #ifdef TRKRECO_DEBUG_DETAIL 02349 std::cout << " : " << t.name() << " pull = " << link.pull(); 02350 #endif 02351 if (link.pull() > maxSigma2) { 02352 toBeDeleted.append(link); 02353 continue; 02354 } 02355 02356 if (best) { 02357 if (best->pull() > link.pull()) { 02358 toBeDeleted.append(best); 02359 best = & link; 02360 bestTrack = & t; 02361 } 02362 else { 02363 toBeDeleted.append(link); 02364 } 02365 } 02366 else { 02367 best = & link; 02368 bestTrack = & t; 02369 } 02370 } 02371 02372 if (best) { 02373 bestTrack->append(* best); 02374 best->hit()->state(best->hit()->state() | WireHitInvalidForFit); 02375 _associateHits.append(best); 02376 #ifdef TRKRECO_DEBUG 02377 std::cout << " " << best->hit()->wire()->name(); 02378 std::cout << " -> " << bestTrack->name() << std::endl; 02379 #endif 02380 } 02381 HepAListDeleteAll(toBeDeleted); 02382 02383 #ifdef TRKRECO_DEBUG_DETAIL 02384 std::cout << std::endl; 02385 #endif 02386 } 02387 }
|
|
stores MC track info. into Panther table.
|
|
stores MC track info. into Panther table.
00700 { 00701 unsigned n = _tracksFinal.length(); 00702 for (unsigned i = 0; i < n; i++) { 00703 const TTrack & t = * _tracksFinal[i]; 00704 00705 // struct reccdc_trk * r; 00706 // r = (struct reccdc_trk *) BsGetEnt(RECMDC_TRK, i + 1, BBS_No_Index); 00707 MdcRec_trk* r = &(*MdcRecTrkCol::getMdcRecTrkCol())[i]; 00708 00709 //...Set type... 00710 00711 //...Hit loop... 00712 const AList<TMLink> & hits = t.finalHits(); 00713 unsigned nHits = hits.length(); 00714 for (unsigned j = 0; j < nHits; j++) { 00715 TMLink * l = hits[j]; 00716 MdcRec_wirhit * h = l->hit()->reccdc(); 00717 MdcDat_mcwirhit * m = l->hit()->mc()->datcdc(); 00718 m->trk = r; 00719 // struct reccdc_mctrk2hep * c; 00720 // c = (struct reccdc_mctrk2hep *) BsNewEnt(RECMDC_MCTRK2HEP); 00721 MdcRec_mctrk2hep* c = new MdcRec_mctrk2hep; 00722 MdcRecMctrk2hepCol::getMdcRecMctrk2hepCol()->push_back(*c); 00723 c->wir = h; 00724 c->trk = r; 00725 c->hep = l->hit()->mc()->hep()->gen(); 00726 } 00727 00728 const TTrackMC * const mc = t.mc(); 00729 // struct reccdc_mctrk * m; 00730 // m = (struct reccdc_mctrk *) BsNewEnt(RECMDC_MCTRK); 00731 // // MdcRec_mctrk* m = &(*MdcRecMctrkCol::getMdcRecMctrkCol())[0]; 00732 MdcRec_mctrk* m = new MdcRec_mctrk; 00733 MdcRecMctrkCol::getMdcRecMctrkCol()->push_back(*m); 00734 m->wirFrac = mc->wireFraction(); 00735 m->wirFracHep = mc->wireFractionHEP(); 00736 m->charge = mc->charge(); 00737 m->ptFrac = mc->ptFraction(); 00738 m->pzFrac = mc->pzFraction(); 00739 m->quality = mc->quality(); 00740 if (mc->hep()) m->hep = mc->hep()->gen(); 00741 else m->hep = 0; 00742 } 00743 }
|
|
stores track info. into Panther table.
|
|
stores track info. into Panther table.
00555 { 00556 #ifdef TRKRECO_DEBUG 00557 std::cout << "TTrackManager::saveTables ... # 3D tracks=" << _tracks.length() 00558 << ", # 2D tracks=" << _tracks2D.length() 00559 << ", all tracks=" << _tracksAll.length() << std::endl; 00560 #endif 00561 00562 //...For 3D tracks... 00563 AList<TTrack> badTracks; 00564 unsigned n = _tracks.length(); 00565 unsigned * id = (unsigned *) malloc(n * sizeof(unsigned)); 00566 // bzero((char *) id, n * sizeof(unsigned)); 00567 memset((char *) id, 0, n * sizeof(unsigned)); 00568 for (unsigned i = 0; i < n; i++) { 00569 TTrack & t = * _tracks[i]; 00570 if (! t.nLinks()) { 00571 badTracks.append((TTrack &) t); 00572 continue; 00573 } 00574 00575 //...Copy track parameters... 00576 MdcRec_trk * r = 0; 00577 MdcRec_trk_add * a = 0; 00578 int err = copyTrack(t, & r, & a); 00579 if (err) { 00580 badTracks.append(t); 00581 continue; 00582 } 00583 _tracksFinal.append(t); 00584 00585 //...Type and quality... 00586 id[i] = r->id; 00587 r->stat = t.state(); 00588 a->kind = t.type(); 00589 a->decision = t.finder(); 00590 a->stat = t.fitting(); 00591 // if (a->m_kind == TrackTypeCosmic) { 00592 // a->m_quality = TrackQualityCosmic; 00593 // } 00594 // if (t.daughter() && (_tracks.index(t.daughter()) >= 0)) 00595 // a->m_daughter = _tracks.index(t.daughter()) + 1; 00596 00597 } 00598 00599 //...Daughter treatment... 00600 for (unsigned i = 0; i < n; i++) { 00601 00602 #ifdef TRKRECO_DEBUG_DETAIL 00603 std::cout << "id[" << i << "]=" << id[i] << std::endl; 00604 #endif 00605 if (! (id[i])) continue; 00606 if (! (_tracks[i]->daughter())) continue; 00607 00608 int dId = _tracks.index(_tracks[i]->daughter()); 00609 00610 #ifdef TRKRECO_DEBUG_DETAIL 00611 std::cout << " dId=" << dId; 00612 if (dId >= 0) std::cout << ", id[dId]=" << id[dId]; 00613 std::cout << std::endl; 00614 #endif 00615 00616 if (dId >= 0) { 00617 if (id[dId]) { 00618 // reccdc_trk_add * a = (reccdc_trk_add *) 00619 // BsGetEnt(RECMDC_TRK_ADD, id[i], BBS_No_Index); 00620 // a->m_daughter = id[dId]; 00621 MdcRec_trk_add* a = &(*MdcRecTrkAddCol::getMdcRecTrkAddCol())[i]; 00622 } 00623 } 00624 } 00625 free(id); 00626 00627 //...Remove bad tracks... 00628 _tracks.remove(badTracks); 00629 badTracks.removeAll(); 00630 00631 //...For 2D tracks... 00632 n = _tracks2D.length(); 00633 for (unsigned i = 0; i < n; i++) { 00634 TTrack & t = * _tracks2D[i]; 00635 00636 //...Copy track parameters... 00637 MdcRec_trk * r = 0; 00638 MdcRec_trk_add * a = 0; 00639 int err = copyTrack(t, & r, & a); 00640 if (err) { 00641 #ifdef TRKRECO_DEBUG 00642 std::cout << "TTrackManager::saveTables !!! bad 2D tracks found" 00643 << " : err=" << err << std::endl 00644 << TrackDump(t) << std::endl; 00645 #endif 00646 badTracks.append(t); 00647 continue; 00648 } 00649 _tracksFinal.append(t); 00650 00651 //...Reset helix parameter... 00652 // r->m_helix[3] = 0.; 00653 // r->m_helix[4] = 0.; 00654 // r->m_nhits -= r->m_nster; 00655 // r->m_nster = 0; 00656 00657 //...Table filling... 00658 r->stat = t.state(); 00659 a->kind = t.type(); 00660 a->decision = t.finder(); 00661 // a->m_quality = t.quality(); 00662 a->quality = TrackQuality2D; 00663 a->stat = t.fitting(); 00664 00665 #ifdef TRKRECO_DEBUG 00666 if ((r->ndf == 0) && (r->chiSq > 0.)) { 00667 std::cout << "TTrackManager::saveTables !!! chisq>0 with ndf=0." 00668 << std::endl 00669 << " Here is a track dump" 00670 << " " << TrackDump(t) << std::endl; 00671 t.dump("detail"); 00672 } 00673 if ((r->ndf > 0) && (r->chiSq == 0.)) { 00674 std::cout << "TTrackManager::saveTables !!! chisq=0 with ndf>0." 00675 << std::endl 00676 << " Here is a track dump" 00677 << " " << TrackDump(t) << std::endl; 00678 t.dump("detail"); 00679 } 00680 00681 if (r->ndf == 0) 00682 std::cout << "TTrackManager::saveTables ... ndf = 0" << std::endl 00683 << " " << TrackDump(t) << std::endl; 00684 if (r->chiSq == 0.) 00685 std::cout << "TTrackManager::saveTables ... chisq = 0" << std::endl 00686 << " " << TrackDump(t) << std::endl; 00687 #endif 00688 } 00689 _tracks2D.remove(badTracks); 00690 00691 //...Statistics... 00692 ++_s->_nEvents; 00693 _s->_nTracks += _tracks.length(); 00694 _s->_nTracksAll += _tracksAll.length(); 00695 _s->_nTracks2D += _tracks2D.length(); 00696 _s->_nTracksFinal += _tracksFinal.length(); 00697 }
|
|
checks track quality.
|
|
checks track quality.
02459 { 02460 AList<TTrack> goodTracks; 02461 unsigned n = list.length(); 02462 for (unsigned i = 0; i < n; i++) { 02463 const TTrack & t = * list[i]; 02464 if (! goodTrack(t, track2D)) continue; 02465 02466 //...Remove super momentum... 02467 if (_maxMomentum > 0.) { 02468 if (t.ptot() > _maxMomentum) { 02469 // ++_s->_nSuperMoms; 02470 continue; 02471 } 02472 } 02473 02474 goodTracks.append((TTrack &) t); 02475 } 02476 02477 if (_debugLevel) { 02478 if (list.length() != goodTracks.length()) { 02479 std::cout << "TTrackManager::selectGoodTracks ... bad tracks found" 02480 << std::endl 02481 << " # of bad tracks = " 02482 << list.length() - goodTracks.length() 02483 << " : 2D flag = " << track2D << std::endl; 02484 AList<TTrack> tmp; 02485 tmp.append(list); 02486 tmp.remove(goodTracks); 02487 std::cout << " Track dump" << std::endl; 02488 for (unsigned i = 0; i < tmp.length(); i++) { 02489 std::cout << " " << TrackDump(* tmp[i]) << std::endl; 02490 } 02491 } 02492 } 02493 02494 return goodTracks; 02495 }
|
|
tests for curlers.
|
|
tests for curlers.
02244 { 02245 unsigned n = _tracks.length(); 02246 if (n < 2) return; 02247 02248 for (unsigned i = 0; i < n - 1; i++) { 02249 TTrack & t0 = * _tracks[i]; 02250 if (t0.type() != TrackTypeCurl) continue; 02251 float c0 = t0.charge(); 02252 02253 for (unsigned j = i + 1; j < n; j++) { 02254 TTrack & t1 = * _tracks[j]; 02255 float c1 = t1.charge(); 02256 if (c0 * c1 > 0.) continue; 02257 if (t1.type() != TrackTypeCurl) continue; 02258 02259 bool toBeMerged = false; 02260 unsigned n0 = t0.testByApproach(t1.cores(), _sigmaCurlerMergeTest); 02261 if (n0 > _nCurlerMergeTest) toBeMerged = true; 02262 if (! toBeMerged) { 02263 unsigned n1 = t1.testByApproach(t0.cores(), 02264 _sigmaCurlerMergeTest); 02265 if (n1 > _nCurlerMergeTest) toBeMerged = true; 02266 } 02267 02268 if (toBeMerged) { 02269 // ++_s->_nToBeMerged; 02270 if ((t0.daughter()) || (t1.daughter())) 02271 ++_s->_nToBeMergedMoreThanTwo; 02272 t0.daughter(& t1); 02273 t1.daughter(& t0); 02274 02275 } 02276 } 02277 } 02278 }
|
|
00210 { 00211 t0bes = t0; 00212 }
|
|
00210 { 00211 t0bes = t0; 00212 }
|
|
sorts RECMDC_TRK tables.
|
|
sorts RECMDC_TRK tables.
01915 { 01916 #ifdef TRKRECO_DEBUG_DETAIL 01917 std::cout << "trkmgr::sortBanksByPt : # of tracks=" 01918 // << BsCouTab(RECMDC_TRK_ADD) << std::endl; 01919 << MdcRecTrkAddCol::getMdcRecTrkAddCol()->size() << std::endl; 01920 #endif 01921 01922 // unsigned n = BsCouTab(RECMDC_TRK_ADD); 01923 unsigned n = MdcRecTrkAddCol::getMdcRecTrkAddCol()->size(); 01924 if (n < 2) return; 01925 01926 //...Sort RECMDC... 01927 unsigned * id = (unsigned *) malloc(n * sizeof(unsigned)); 01928 for (unsigned i = 0; i < n; i++) id[i] = i; 01929 for (unsigned i = 0; i < n - 1; i++) { 01930 // reccdc_trk & cdc0 = 01931 // * (reccdc_trk *) BsGetEnt(RECMDC_TRK, 01932 // i + 1, 01933 // BBS_No_Index); 01934 // reccdc_trk_add & add0 = 01935 // * (reccdc_trk_add *) BsGetEnt(RECMDC_TRK_ADD, 01936 // i + 1, 01937 // BBS_No_Index); 01938 // reccdc_mctrk & mc0 = 01939 // * (reccdc_mctrk *) BsGetEnt(RECMDC_MCTRK, 01940 // i + 1, 01941 // BBS_No_Index); 01942 MdcRec_trk & cdc0 = (* MdcRecTrkCol::getMdcRecTrkCol())[i]; 01943 MdcRec_trk_add & add0 = (* MdcRecTrkAddCol::getMdcRecTrkAddCol())[i]; 01944 MdcRec_mctrk & mc0 = (* MdcRecMctrkCol::getMdcRecMctrkCol())[i]; 01945 01946 float bestPt = 1. / fabs(cdc0.helix[2]); 01947 unsigned bestQuality = add0.quality; 01948 for (unsigned j = i + 1; j < n; j++) { 01949 // reccdc_trk & cdc1 = 01950 // * (reccdc_trk *) BsGetEnt(RECMDC_TRK, 01951 // j + 1, 01952 // BBS_No_Index); 01953 // reccdc_trk_add & add1 = 01954 // * (reccdc_trk_add *) BsGetEnt(RECMDC_TRK_ADD, 01955 // j + 1, 01956 // BBS_No_Index); 01957 // reccdc_mctrk & mc1 = 01958 // * (reccdc_mctrk *) BsGetEnt(RECMDC_MCTRK, 01959 // j + 1, 01960 // BBS_No_Index); 01961 MdcRec_trk & cdc1 = (* MdcRecTrkCol::getMdcRecTrkCol())[j]; 01962 MdcRec_trk_add & add1 = (* MdcRecTrkAddCol::getMdcRecTrkAddCol())[j]; 01963 MdcRec_mctrk & mc1 = (* MdcRecMctrkCol::getMdcRecMctrkCol())[j]; 01964 01965 float pt = 1. / fabs(cdc1.helix[2]); 01966 #ifdef TRKRECO_DEBUG_DETAIL 01967 std::cout << "i,j=" << i << "," << j 01968 << " : quality i,j=" << bestQuality << "," 01969 << add1.quality << std::endl; 01970 #endif 01971 unsigned quality = add1.quality; 01972 if (quality > bestQuality) continue; 01973 else if (quality < bestQuality) { 01974 bestQuality = quality; 01975 bestPt = pt; 01976 swapReccdc(cdc0, add0, mc0, cdc1, add1, mc1); 01977 unsigned tmp = id[i]; 01978 id[i] = id[j]; 01979 id[j] = tmp; 01980 #ifdef TRKRECO_DEBUG_DETAIL 01981 std::cout << "swapped" << std::endl; 01982 #endif 01983 continue; 01984 } 01985 #ifdef TRKRECO_DEBUG_DETAIL 01986 std::cout << "i,j=" << i << "," << j 01987 << " : pt i,j=" << bestPt << "," << pt << std::endl; 01988 #endif 01989 if (pt > bestPt) { 01990 #ifdef TRKRECO_DEBUG_DETAIL 01991 std::cout << "swapping ... " << & cdc0 << "," << & add0 << "," 01992 << & mc0 << " <-> " << & cdc1 << "," << & add1 << "," 01993 << & mc1 << std::endl; 01994 #endif 01995 bestQuality = quality; 01996 bestPt = pt; 01997 swapReccdc(cdc0, add0, mc0, cdc1, add1, mc1); 01998 unsigned tmp = id[i]; 01999 id[i] = id[j]; 02000 id[j] = tmp; 02001 #ifdef TRKRECO_DEBUG_DETAIL 02002 std::cout << "swapped" << std::endl; 02003 #endif 02004 } 02005 } 02006 } 02007 #ifdef TRKRECO_DEBUG_DETAIL 02008 std::cout << "trkmgr::sortBanksByPt : first phase finished" << std::endl; 02009 #endif 02010 02011 tagReccdc(id, n); 02012 free(id); 02013 02014 #ifdef TRKRECO_DEBUG_DETAIL 02015 std::cout << "trkmgr::sortBanksByPt : second phase finished" << std::endl; 02016 #endif 02017 02018 #if 0 02019 //...Sort RECTRK... 02020 n = BsCouTab(RECTRK); 02021 id = (unsigned *) malloc(n * sizeof(unsigned)); 02022 for (unsigned i = 0; i < n; i++) id[i] = i; 02023 if (n > 1) { 02024 unsigned i = 0; 02025 while (i < n - 1) { 02026 rectrk & t = * (rectrk *) BsGetEnt(RECTRK, i + 1, BBS_No_Index); 02027 if (t.m_prekal == (i + 1)) { 02028 ++i; 02029 continue; 02030 } 02031 02032 rectrk & s = * (rectrk *) BsGetEnt(RECTRK, 02033 t.m_prekal, 02034 BBS_No_Index); 02035 02036 swapRectrk(t, s); 02037 unsigned tmp = id[i]; 02038 id[i] = id[s.m_ID - 1]; 02039 id[s.m_ID - 1] = tmp; 02040 02041 //std::cout << "swap " << i + 1 << " and " << s.m_ID << std::endl; 02042 02043 reccdc_trk_add & a = 02044 * (reccdc_trk_add *) BsGetEnt(RECMDC_TRK_ADD, 02045 t.m_prekal, 02046 BBS_No_Index); 02047 reccdc_trk_add & b = 02048 * (reccdc_trk_add *) BsGetEnt(RECMDC_TRK_ADD, 02049 s.m_prekal, 02050 BBS_No_Index); 02051 a.m_rectrk = t.m_ID; 02052 b.m_rectrk = s.m_ID; 02053 } 02054 } 02055 #else 02056 /* 02057 // jtanaka 000925 --> 02058 n = BsCouTab(RECTRK); 02059 id = (unsigned *) malloc(n * sizeof(unsigned)); 02060 for (unsigned i = 0; i < n; i++) id[i] = i; 02061 int foundId = 0; 02062 while(foundId != n){ 02063 rectrk & t = * (rectrk *) BsGetEnt(RECTRK, foundId + 1, BBS_No_Index); 02064 int minPrekal = t.m_prekal; 02065 int exchangeId = foundId; 02066 for(int i=foundId+1;i<n;++i){ 02067 rectrk & s = * (rectrk *) BsGetEnt(RECTRK, i + 1, BBS_No_Index); 02068 if(s.m_prekal < minPrekal){ 02069 minPrekal = s.m_prekal; 02070 exchangeId = i; 02071 } 02072 } 02073 if(exchangeId != foundId){ 02074 rectrk & s = * (rectrk *) BsGetEnt(RECTRK, 02075 exchangeId + 1, 02076 BBS_No_Index); 02077 02078 swapRectrk(t, s); 02079 unsigned tmp = id[t.m_ID - 1]; 02080 id[t.m_ID - 1] = id[s.m_ID - 1]; 02081 id[s.m_ID - 1] = tmp; 02082 02083 reccdc_trk_add & a = 02084 * (reccdc_trk_add *) BsGetEnt(RECMDC_TRK_ADD, 02085 t.m_prekal, 02086 BBS_No_Index); 02087 reccdc_trk_add & b = 02088 * (reccdc_trk_add *) BsGetEnt(RECMDC_TRK_ADD, 02089 s.m_prekal, 02090 BBS_No_Index); 02091 a.m_rectrk = t.m_ID; 02092 b.m_rectrk = s.m_ID; 02093 } 02094 ++foundId; 02095 } 02096 // <-- jtanaka 000925 02097 */ 02098 #endif 02099 02100 tagRectrk(id, n); 02101 free(id); 02102 }
|
|
|
|
01786 { 01787 #ifdef TRKRECO_DEBUG_DETAIL 01788 std::cout << "trkmgr::sortTracksByPt : # of tracks=" 01789 << _tracks.length() << std::endl; 01790 #endif 01791 01792 unsigned n = _tracks.length(); 01793 if (n < 2) return; 01794 01795 for (unsigned i = 0; i < n - 1; i++) { 01796 TTrack & t0 = * _tracks[i]; 01797 float bestPt = t0.pt(); 01798 for (unsigned j = i + 1; j < n; j++) { 01799 TTrack & t1 = * _tracks[j]; 01800 float pt = t1.pt(); 01801 #ifdef TRKRECO_DEBUG_DETAIL 01802 std::cout << "i,j=" << i << "," << j 01803 << " : pt i,j=" << bestPt << "," << pt << std::endl; 01804 #endif 01805 if (pt > bestPt) { 01806 bestPt = pt; 01807 _tracks.swap(i, j); 01808 } 01809 } 01810 } 01811 }
|
|
sorts tracks.
|
|
sorts tracks.
01765 { 01766 unsigned n = _tracks.length(); 01767 if (n < 2) return; 01768 01769 for (unsigned i = 0; i < n - 1; i++) { 01770 TTrack & t0 = * _tracks[i]; 01771 float bestRChisq = HUGE_VAL; 01772 if (t0.ndf() > 0) bestRChisq = t0.chi2() / t0.ndf(); 01773 for (unsigned j = i + 1; j < n; j++) { 01774 TTrack & t1 = * _tracks[j]; 01775 float rChisq = HUGE_VAL; 01776 if (t1.ndf() > 0) rChisq = t1.chi2() / t1.ndf(); 01777 if (rChisq < bestRChisq) { 01778 bestRChisq = rChisq; 01779 _tracks.swap(i, j); 01780 } 01781 } 01782 } 01783 }
|
|
sorts banks.
|
|
sorts banks.
02110 { 02111 #define RECMDC_ACTUAL_SIZE 124 02112 #define RECMDCADD_ACTUAL_SIZE 40 02113 #define RECMDCMC_ACTUAL_SIZE 28 02114 02115 static bool first = true; 02116 static void * swapRegion; 02117 if (first) { 02118 first = false; 02119 swapRegion = malloc(RECMDC_ACTUAL_SIZE); 02120 } 02121 02122 void * s0 = & cdc0.helix[0]; 02123 void * s1 = & cdc1.helix[0]; 02124 memcpy(swapRegion, s0, RECMDC_ACTUAL_SIZE); 02125 memcpy(s0, s1, RECMDC_ACTUAL_SIZE); 02126 memcpy(s1, swapRegion, RECMDC_ACTUAL_SIZE); 02127 02128 s0 = & add0.quality; 02129 s1 = & add1.quality; 02130 memcpy(swapRegion, s0, RECMDCADD_ACTUAL_SIZE); 02131 memcpy(s0, s1, RECMDCADD_ACTUAL_SIZE); 02132 memcpy(s1, swapRegion, RECMDCADD_ACTUAL_SIZE); 02133 02134 if ((& mc0) && (& mc1)) { 02135 s0 = & mc0.hep; 02136 s1 = & mc1.hep; 02137 memcpy(swapRegion, s0, RECMDCMC_ACTUAL_SIZE); 02138 memcpy(s0, s1, RECMDCMC_ACTUAL_SIZE); 02139 memcpy(s1, swapRegion, RECMDCMC_ACTUAL_SIZE); 02140 } 02141 }
|
|
|
|
02145 { 02146 #define RECTRK_ACTUAL_SIZE 84 02147 02148 static bool first = true; 02149 static void * swapRegion; 02150 if (first) { 02151 first = false; 02152 swapRegion = malloc(RECTRK_ACTUAL_SIZE); 02153 } 02154 02155 void * s0 = & rec0.glob[0]; 02156 void * s1 = & rec1.glob[0]; 02157 memcpy(swapRegion, s0, RECTRK_ACTUAL_SIZE); 02158 memcpy(s0, s1, RECTRK_ACTUAL_SIZE); 02159 memcpy(s1, swapRegion, RECTRK_ACTUAL_SIZE); 02160 }
|
|
returns T0 by old methode(expensive).
|
|
returns T0 by old methode(expensive).
01340 { 01341 01342 #define X0 -10. 01343 #define X1 0. 01344 #define X2 10. 01345 #define STEP 10. 01346 01347 //...Determine T0 for each track... 01348 float t0Sum = 0.; 01349 for (unsigned i = 0; i < n; i++) { 01350 TTrack & t = * _tracks[i]; 01351 float y[3]; 01352 for (unsigned j = 0; j < 3; j++) { 01353 float offset = X0 + j * STEP; 01354 _cFitter.fit(t, offset); 01355 y[j] = t.chi2(); 01356 } 01357 t0Sum += minimum(y[0], y[1], y[2]); 01358 } 01359 float t0 = t0Sum / (float) n; 01360 if (isnan(t0)) t0 = 0.; 01361 01362 //...Fit with T0 correction... 01363 n = _tracks.length(); 01364 for (unsigned i = 0; i < n; i++) { 01365 TTrack & t = * _tracks[i]; 01366 _cFitter.fit(t, t0); 01367 } 01368 01369 //...Store it... 01370 // reccdc_timing * t = (reccdc_timing *) BsNewEnt(RECMDC_TIMING); 01371 /* MdcRec_timing* t = new MdcRec_timing; 01372 MdcRecTimingCol::getMdcRecTimingCol()->push_back(*t); 01373 t->time = - t0; 01374 t->quality = 11; 01375 */ 01376 return - t0; 01377 }
|
|
returns T0 by T0 fitting.
|
|
returns T0 by T0 fitting.
01380 { 01381 01382 float tev_err; 01383 float tev_sum0= 0.; 01384 float tev_sum = 0.; 01385 float tev_sum2= 0.; 01386 float w_sum = 0.; 01387 01388 //sort in order of pt 01389 // std::cout << "length=" << _tracks.length() << std::endl; 01390 const int cn=_tracks.length(); 01391 float* sort = new float[cn]; 01392 float ptmax_pre=1.e10; 01393 for (unsigned i = 0; i < cn; i++) { 01394 float ptmax=-999.; 01395 int jmax; 01396 for (unsigned j = 0; j < cn; j++) { 01397 TTrack & tj = * _tracks[j]; 01398 float pt = fabs(1./tj.helix().a()[2]); 01399 if( pt < ptmax_pre && pt > ptmax) { 01400 ptmax = pt; 01401 jmax = j; 01402 } 01403 sort[i]=jmax; 01404 } 01405 ptmax_pre=ptmax; 01406 } 01407 01408 for (unsigned i = 0; i < n; i++) { 01409 //srtbypt TTrack & t = * _tracks[i]; 01410 TTrack & t = * _tracks[sort[i]]; 01411 //float pt = fabs(1./t.helix().a()[2]); 01412 //std::cout << "pt=" << pt << endl; 01413 float tev = 0.; 01414 _cFitter.fit(t, tev, tev_err); 01415 // std::cout << "tev,tev_err=" <<tev<< " "<<tev_err<<endl; 01416 float w = 1. / tev_err / tev_err; 01417 tev_sum += w * tev; 01418 w_sum += w; 01419 // tev_sum0 += tev; 01420 // tev_sum2 += tev * tev; 01421 } 01422 01423 delete [] sort; 01424 01425 float tev_mean = tev_sum / w_sum; 01426 // float tev_err_a = 1. / sqrt(w_sum); 01427 // float tev_err_b = (tev_sum2 - tev_sum0 * tev_sum0 / (n + 1)) / n; 01428 // tev_err_b = sqrt(tev_err_b); 01429 // std::cout << "comp,t0,mean tev,err ="<<t0<<" "<<tev_mean<<" "<<tev_err_a<<" "<<tev_err_b<<std::endl; 01430 if (isnan(tev_mean)) tev_mean = 0.; 01431 01432 //...Store it... 01433 // reccdc_timing * tt = (reccdc_timing *) BsNewEnt(RECMDC_TIMING); 01434 // MdcRec_timing* tt = new MdcRec_timing; 01435 // MdcRecTimingCol::getMdcRecTimingCol()->push_back(*tt); 01436 // tt->time = tev_mean; 01437 // tt->quality = 151; 01438 01439 return - tev_mean; 01440 }
|
|
|
|
02163 { 02164 /* 02165 unsigned * id = (unsigned *) malloc(nTrk * sizeof(unsigned)); 02166 for (unsigned i = 0; i < nTrk; i++) 02167 id[id0[i]] = i; 02168 02169 #ifdef TRKRECO_DEBUG_DETAIL 02170 for (unsigned i = 0; i < nTrk; i++) 02171 std::cout << "id0 " << i << " ... " << id0[i] << std::endl; 02172 for (unsigned i = 0; i < nTrk; i++) 02173 std::cout << "id " << i << " ... " << id[i] << std::endl; 02174 #endif 02175 // unsigned n = BsCouTab(RECMDC_TRK_ADD); 02176 // unsigned n = MdcRecTrkAddCol::getMdcRecTrkAddCol()->size(); 02177 02178 // for (unsigned i = 0; i < n; i++) { 02179 // reccdc_trk_add & w = * (reccdc_trk_add *) BsGetEnt(RECMDC_TRK_ADD, 02180 // i + 1, 02181 // BBS_No_Index); 02182 // MdcRec_trk_add & w = (* MdcRecTrkAddCol::getMdcRecTrkAddCol())[i]; 02183 // if (w.mother) w.mother = id[w.mother - 1] + 1; 02184 // if (w.daughter) w.daughter = id[w.daughter - 1] + 1; 02185 // } 02186 02187 #ifdef TRKRECO_DEBUG_DETAIL 02188 std::cout << "TTrackManager::tagReccdc ... RECMDC_TRK_ADD done" << std::endl; 02189 #endif 02190 02191 n = BsCouTab(RECMDC_WIRHIT); 02192 for (unsigned i = 0; i < n; i++) { 02193 reccdc_wirhit & w = * (reccdc_wirhit *) BsGetEnt(RECMDC_WIRHIT, 02194 i + 1, 02195 BBS_No_Index); 02196 if (w.m_trk == 0) continue; 02197 w.m_trk = id[w.m_trk - 1] + 1; 02198 } 02199 02200 #ifdef TRKRECO_DEBUG_DETAIL 02201 std::cout << "TTrackManager::tagReccdc ... RECMDC_WIRHIT done" << std::endl; 02202 #endif 02203 02204 n = BsCouTab(DATMDC_MCWIRHIT); 02205 for (unsigned i = 0; i < n; i++) { 02206 datcdc_mcwirhit & m = 02207 * (datcdc_mcwirhit *) BsGetEnt(DATMDC_MCWIRHIT,i + 1,BBS_No_Index); 02208 if (m.m_trk == 0) continue; 02209 m.m_trk = id[m.m_trk - 1] + 1; 02210 } 02211 02212 #ifdef TRKRECO_DEBUG_DETAIL 02213 std::cout << "TTrackManager::tagReccdc ... DATMDC_MCWIRHIT done" << std::endl; 02214 #endif 02215 02216 n = BsCouTab(RECTRK); 02217 for (unsigned i = 0; i < n; i++) { 02218 rectrk & r = * (rectrk *) BsGetEnt(RECTRK, i + 1, BBS_No_Index); 02219 if (r.m_prekal == 0) continue; 02220 r.m_prekal = id[r.m_prekal - 1] + 1; 02221 } 02222 02223 #ifdef TRKRECO_DEBUG_DETAIL 02224 std::cout << "TTrackManager::tagReccdc ... RECTRK done" << std::endl; 02225 #endif 02226 02227 // jtanaka 02228 n = BsCouTab(RECMDC_SVD_TRK); 02229 for (unsigned i = 0; i < n; i++) { 02230 reccdc_svd_trk & r = * (reccdc_svd_trk *) BsGetEnt(RECMDC_SVD_TRK, i + 1, BBS_No_Index); 02231 if (r.m_cdc_trk == 0) continue; 02232 r.m_cdc_trk = id[r.m_cdc_trk - 1] + 1; 02233 } 02234 02235 #ifdef TRKRECO_DEBUG_DETAIL 02236 std::cout << "TTrackManager::tagReccdc ... RECMDC_SVD_TRK done" << std::endl; 02237 #endif 02238 02239 free(id); 02240 */ 02241 }
|
|
|
|
02569 { 02570 /* 02571 unsigned * id = (unsigned *) malloc(nTrk * sizeof(unsigned)); 02572 for (unsigned i = 0; i < nTrk; i++) 02573 id[id0[i]] = i; 02574 02575 // for (unsigned i = 0; i < nTrk; i++) 02576 // std::cout << "id0 " << i << " ... " << id0[i] << std::endl; 02577 // for (unsigned i = 0; i < nTrk; i++) 02578 // std::cout << "id " << i << " ... " << id[i] << std::endl; 02579 // BsShwDat(RECTRK_TOF); 02580 02581 unsigned n = BsCouTab(RECTRK_TOF); 02582 for (unsigned i = 0; i < n; i++) { 02583 rectrk_tof & t = * (rectrk_tof *) BsGetEnt(RECTRK_TOF, 02584 i + 1, 02585 BBS_No_Index); 02586 if (t.m_rectrk) t.m_rectrk = id[t.m_rectrk - 1] + 1; 02587 } 02588 02589 // BsShwDat(RECTRK_TOF); 02590 02591 // jtanaka 02592 n = BsCouTab(RECSVD_HIT); 02593 for (unsigned i = 0; i < n; i++) { 02594 recsvd_hit & t = * (recsvd_hit *) BsGetEnt(RECSVD_HIT, 02595 i + 1, 02596 BBS_No_Index); 02597 if (t.m_trk) t.m_trk = id[t.m_trk - 1] + 1; 02598 } 02599 02600 free(id); 02601 */ 02602 }
|
|
returns a list of reconstructed tracks.
|
|
returns a list of reconstructed tracks.
00266 {
00267 return _tracks;
00268 }
|
|
returns a list of 2D tracks.
|
|
returns a list of 2D tracks.
00272 {
00273 return _tracks2D;
00274 }
|
|
returns a list of tracks writen to MdcRec_trk.
|
|
returns a list of tracks writen to MdcRec_trk.
00311 {
00312 return _tracksFinal;
00313 }
|
|
final decision for a curler.
|
|
final decision for a curler.
01816 { 01817 //...Originally coded by j.tanaka... 01818 01819 //...Check inputs... 01820 if (trk1.zero[2] == 0) return; 01821 if (cdc1.daughter == 0) return; 01822 01823 //...The other side... 01824 // reccdc_trk_add & cdc2 = * (reccdc_trk_add *) BsGetEnt(RECMDC_TRK_ADD, 01825 // cdc1.m_daughter, 01826 // BBS_No_Index); 01827 // MdcRec_trk_add & cdc2 = (*MdcRecTrkAddCol::getMdcRecTrkAddCol())[cdc1.daughter.id]; 01828 MdcRec_trk_add & cdc2 = * cdc1.daughter->add; 01829 01830 if (cdc2.daughter == 0) return; 01831 if (cdc2.rectrk == 0) return; 01832 // rectrk & trk2 = * (rectrk *) BsGetEnt(RECTRK, cdc2.m_rectrk, BBS_No_Index); 01833 MdcTrk & trk2 = * cdc2.rectrk; 01834 01835 if (trk2.zero[2] == 0) return; 01836 01837 //...Obtain RECTRK_LOCALZ... 01838 // rectrk_localz & z1 = * (rectrk_localz *) BsGetEnt(RECTRK_LOCALZ, 01839 // trk1.m_zero[2], 01840 // BBS_No_Index); 01841 // rectrk_localz & z2 = * (rectrk_localz *) BsGetEnt(RECTRK_LOCALZ, 01842 // trk2.m_zero[2], 01843 // BBS_No_Index); 01844 MdcTrk_localz & z1 = * trk1.zero[2]; 01845 MdcTrk_localz & z2 = * trk2.zero[2]; 01846 01847 //...Pointer to mother and daughter... 01848 MdcRec_trk_add * mother = & cdc1; 01849 MdcRec_trk_add * daughter = & cdc2; 01850 01851 // //...By dr... 01852 // if (flag == 1) { 01853 // float dr1 = fabs(z1.m_helix[0]); 01854 // float dr2 = fabs(z2.m_helix[0]); 01855 // if (dr1 > dr2) { 01856 // mother = & cdc2; 01857 // daughter = & cdc1; 01858 // } 01859 // } 01860 01861 // //...By dz... 01862 // else { 01863 // float dz1 = fabs(z1.m_helix[3]); 01864 // float dz2 = fabs(z2.m_helix[3]); 01865 // if (dz1 > dz2) { 01866 // mother = & cdc2; 01867 // daughter = & cdc1; 01868 // } 01869 // } 01870 01871 //...By dz + dr... 01872 if(flag == 3){ 01873 float dz1 = fabs(z1.helix[3]); 01874 float dz2 = fabs(z2.helix[3]); 01875 if (fabs(dz1 - dz2) < 2.) flag = 1; 01876 else flag = 2; 01877 } 01878 01879 //...By dr... 01880 if(flag == 1){ 01881 float dr1 = fabs(z1.helix[0]); 01882 float dr2 = fabs(z2.helix[0]); 01883 if (dr1 > dr2) { 01884 mother = & cdc2; 01885 daughter = & cdc1; 01886 } 01887 } 01888 01889 //...By dz... 01890 else if(flag == 2){ 01891 float dz1 = fabs(z1.helix[3]); 01892 float dz2 = fabs(z2.helix[3]); 01893 if (dz1 > dz2) { 01894 mother = & cdc2; 01895 daughter = & cdc1; 01896 } 01897 } 01898 01899 //...Update information... 01900 mother->quality &= (~ TrackQualityOutsideCurler); 01901 mother->likelihood[0] = 1.; 01902 mother->decision |= TrackTrackManager; 01903 //zsl 01904 mother->daughter = daughter->body; 01905 mother->mother = 0; 01906 //zsl end; 01907 daughter->quality |= TrackQualityOutsideCurler; 01908 daughter->likelihood[0] = 0.; 01909 daughter->mother = mother->body; 01910 daughter->daughter = 0; 01911 daughter->decision |= TrackTrackManager; 01912 }
|
|
updates an object.
|
|
updates an object.
00037 { 00038 if (updated()) return; 00039 00040 /* 00041 struct belle_event * ev = 00042 (struct belle_event *) BsGetEnt(BELLE_EVENT, 1, BBS_No_Index); 00043 00044 //...No BELLE_EVENT ???... 00045 if (! ev) return; 00046 00047 _expN = ev->m_ExpNo; 00048 _runN = ev->m_RunNo; 00049 _evtN = ev->m_EvtNo; 00050 */ 00051 _expN = 1; 00052 _runN = 1; 00053 _evtN = 1; 00054 }
|
|
returns true if an object is updated.
|
|
returns true if an object is updated.
00057 { 00058 /* 00059 struct belle_event * ev = 00060 (struct belle_event *) BsGetEnt(BELLE_EVENT, 1, BBS_No_Index); 00061 00062 //...No BELLE_EVENT ???... 00063 if (! ev) return false; 00064 00065 //...Same event?... 00066 if (_expN == ev->m_ExpNo && 00067 _runN == ev->m_RunNo && 00068 _evtN == ev->m_EvtNo) return true; 00069 */ 00070 00071 if (_expN == 1 && 00072 _runN == 1 && 00073 _evtN == 1) return true; 00074 00075 return false; 00076 }
|
|
returns version.
|
|
returns version.
00094 { 00095 return std::string("2.27"); 00096 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|