BOSS 7.0.1
BESIII Offline Software System
Loading...
Searching...
No Matches
TTrackManager Class Reference

A manager of TTrack information to make outputs as MdcRec_trk. More...

#include <TTrackManager.h>

+ Inheritance diagram for TTrackManager:

Public Member Functions

 TTrackManager ()
 Constructor.
 
virtual ~TTrackManager ()
 Destructor.
 
void dump (const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
 dumps debug information.
 
std::string name (void) const
 returns name.
 
std::string version (void) const
 returns version.
 
const AList< TTrack > & allTracks (void) const
 returns a list of all reconstructed tracks including junks.
 
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 > & tracksFinal (void) const
 returns a list of tracks writen to MdcRec_trk.
 
void fittingFlag (unsigned)
 sets fitting flag.
 
double maxMomentum (double)
 sets the max. momentum.
 
int debugLevel (void) const
 returns/sets debug level.
 
int debugLevel (int)
 
float paraT0 (void) const
 
void clear (void)
 clears all internal information.
 
void append (AList< TTrack > &list)
 appends (2D) tracks. 'list' will be cleaned up.
 
void append2D (AList< TTrack > &list)
 
void refit (void)
 refits tracks.
 
void finish (void)
 finishes tracks.
 
void movePivot (void)
 moves pivot of tracks.
 
StatusCode determineT0 (unsigned level, unsigned nMaxTracks)
 determines T0 and refit all tracks.
 
void setCurlerFlags (void)
 tests for curlers.
 
void sortTracksByQuality (void)
 sorts tracks.
 
void sortTracksByPt (void)
 
void clearTables (void) const
 clears tables.
 
StatusCode makeTds (RecMdcTrackCol *trackList, RecMdcHitCol *hitList, int tkStat=1, int runge=0, int cal=0)
 stores track info. into TDS. by Zang Shilei
 
void saveTables (void)
 stores track info. into Panther table.
 
void saveMCTables (void) const
 stores MC track info. into Panther table.
 
void sortBanksByPt (void) const
 sorts RECMDC_TRK tables.
 
void treatCurler (MdcTrk &curl, MdcRec_trk_add &cdc, unsigned flag) const
 final decision for a curler.
 
void determineIP (void)
 determines IP.
 
void maskCurlHits (const AList< TMDCWireHit > &axial, const AList< TMDCWireHit > &stereo, const AList< TTrack > &tracks) const
 masks hits on found curl tracks.
 
void salvageAssociateHits (const AList< TMDCWireHit > &, float maxSigma2)
 salvages hits for dE/dx(not for track fitting).
 
TMLinkdivide (const TTrack &t, AList< TMLink > *l) const
 
TMLinkdivideByIp (const TTrack &t, AList< TMLink > *l) const
 
void removeHitsAcrossOverIp (AList< TMLink > &) const
 
TTrackclosest (const AList< TTrack > &, const TMDCWireHit &) const
 returns a track which is the closest to a hit.
 
void salvage (const AList< TMDCWireHit > &) const
 salvages remaining hits.
 
void mask (void) const
 masks hits out which are in tail of curly tracks.
 
void maskNormal (TTrack &) const
 
void maskCurl (TTrack &) const
 
void maskOut (TTrack &, const AList< TMLink > &) const
 
void maskMultiHits (TTrack &) const
 
void merge (void)
 
void sett0bes (double t0)
 
 TTrackManager ()
 Constructor.
 
virtual ~TTrackManager ()
 Destructor.
 
void dump (const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
 dumps debug information.
 
std::string name (void) const
 returns name.
 
std::string version (void) const
 returns version.
 
const AList< TTrack > & allTracks (void) const
 returns a list of all reconstructed tracks including junks.
 
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 > & tracksFinal (void) const
 returns a list of tracks writen to MdcRec_trk.
 
void fittingFlag (unsigned)
 sets fitting flag.
 
double maxMomentum (double)
 sets the max. momentum.
 
int debugLevel (void) const
 returns/sets debug level.
 
int debugLevel (int)
 
float paraT0 (void) const
 
void clear (void)
 clears all internal information.
 
void append (AList< TTrack > &list)
 appends (2D) tracks. 'list' will be cleaned up.
 
void append2D (AList< TTrack > &list)
 
void refit (void)
 refits tracks.
 
void finish (void)
 finishes tracks.
 
void movePivot (void)
 moves pivot of tracks.
 
StatusCode determineT0 (unsigned level, unsigned nMaxTracks)
 determines T0 and refit all tracks.
 
void setCurlerFlags (void)
 tests for curlers.
 
void sortTracksByQuality (void)
 sorts tracks.
 
void sortTracksByPt (void)
 
void clearTables (void) const
 clears tables.
 
StatusCode makeTds (RecMdcTrackCol *trackList, RecMdcHitCol *hitList, int tkStat=1, int runge=0, int cal=0)
 stores track info. into TDS. by Zang Shilei
 
void saveTables (void)
 stores track info. into Panther table.
 
void saveMCTables (void) const
 stores MC track info. into Panther table.
 
void sortBanksByPt (void) const
 sorts RECMDC_TRK tables.
 
void treatCurler (MdcTrk &curl, MdcRec_trk_add &cdc, unsigned flag) const
 final decision for a curler.
 
void determineIP (void)
 determines IP.
 
void maskCurlHits (const AList< TMDCWireHit > &axial, const AList< TMDCWireHit > &stereo, const AList< TTrack > &tracks) const
 masks hits on found curl tracks.
 
void salvageAssociateHits (const AList< TMDCWireHit > &, float maxSigma2)
 salvages hits for dE/dx(not for track fitting).
 
TMLinkdivide (const TTrack &t, AList< TMLink > *l) const
 
TMLinkdivideByIp (const TTrack &t, AList< TMLink > *l) const
 
void removeHitsAcrossOverIp (AList< TMLink > &) const
 
TTrackclosest (const AList< TTrack > &, const TMDCWireHit &) const
 returns a track which is the closest to a hit.
 
void salvage (const AList< TMDCWireHit > &) const
 salvages remaining hits.
 
void mask (void) const
 masks hits out which are in tail of curly tracks.
 
void maskNormal (TTrack &) const
 
void maskCurl (TTrack &) const
 
void maskOut (TTrack &, const AList< TMLink > &) const
 
void maskMultiHits (TTrack &) const
 
void merge (void)
 
void sett0bes (double t0)
 
- Public Member Functions inherited from TUpdater
 TUpdater ()
 Constructor.
 
virtual ~TUpdater ()
 Destructor.
 
void dump (const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
 dumps debug information.
 
virtual bool updated (void) const
 returns true if an object is updated.
 
virtual void update (void)
 updates an object.
 
virtual bool initialized (void) const
 returns true if an object is initialized.
 
virtual void initialize (void)
 initializes an object.
 
virtual void clear (void)
 clears an object.
 
 TUpdater ()
 Constructor.
 
virtual ~TUpdater ()
 Destructor.
 
void dump (const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
 dumps debug information.
 
virtual bool updated (void) const
 returns true if an object is updated.
 
virtual void update (void)
 updates an object.
 
virtual bool initialized (void) const
 returns true if an object is initialized.
 
virtual void initialize (void)
 initializes an object.
 
virtual void clear (void)
 clears an object.
 

Static Public Member Functions

static bool goodTrack (const TTrack &, bool track2D=false)
 checks goodness of a track.
 
static void maskBadHits (const AList< TTrack > &, float maxSigma2)
 masks hits with large chisq as associated hits. Pull in TMLink is used.
 
static bool goodTrack (const TTrack &, bool track2D=false)
 checks goodness of a track.
 
static void maskBadHits (const AList< TTrack > &, float maxSigma2)
 masks hits with large chisq as associated hits. Pull in TMLink is used.
 

Detailed Description

A manager of TTrack information to make outputs as MdcRec_trk.

Definition at line 44 of file InstallArea/include/TrkReco/TrkReco/TTrackManager.h.

Constructor & Destructor Documentation

◆ TTrackManager() [1/2]

TTrackManager::TTrackManager ( )

Constructor.

Definition at line 79 of file TTrackManager.cxx.

80: _maxMomentum(10.),
81 _sigmaCurlerMergeTest(sqrt(100.)),
82 _nCurlerMergeTest(4),
83 _debugLevel(0),
84 _fitter("TTrackManager Fitter"),
85 _cFitter("TTrackManager 2D Fitter"),
86 _s(0) {
87// BASF_Sharedmem->allocate("TrkMgrSum", sizeof(struct summary));
88
89 StatusCode scmgn = Gaudi::svcLocator()->service("MagneticFieldSvc",m_pmgnIMF);
90 if(scmgn!=StatusCode::SUCCESS) {
91 std::cout<< "ERROR: Unable to open Magnetic field service"<<std::endl;
92 }
93 // Get RawDataProviderSvc
94 IRawDataProviderSvc* irawDataProviderSvc;
95 StatusCode sc = Gaudi::svcLocator()->service("RawDataProviderSvc",irawDataProviderSvc);
96 m_rawDataProviderSvc = dynamic_cast<RawDataProviderSvc*> (irawDataProviderSvc);
97 if(sc!=StatusCode::SUCCESS) {
98 std::cout<< "ERROR: Unable to load RawDataProviderSvc"<<std::endl;
99 }
100}

◆ ~TTrackManager() [1/2]

TTrackManager::~TTrackManager ( )
virtual

Destructor.

Definition at line 102 of file TTrackManager.cxx.

102 {
103}

◆ TTrackManager() [2/2]

TTrackManager::TTrackManager ( )

Constructor.

◆ ~TTrackManager() [2/2]

virtual TTrackManager::~TTrackManager ( )
virtual

Destructor.

Member Function Documentation

◆ allTracks() [1/2]

const AList< TTrack > & TTrackManager::allTracks ( void  ) const
inline

returns a list of all reconstructed tracks including junks.

Definition at line 281 of file InstallArea/include/TrkReco/TrkReco/TTrackManager.h.

281 {
282 return _tracksAll;
283}

◆ allTracks() [2/2]

const AList< TTrack > & TTrackManager::allTracks ( void  ) const

returns a list of all reconstructed tracks including junks.

◆ append() [1/2]

void TTrackManager::append ( AList< TTrack > &  list)

appends (2D) tracks. 'list' will be cleaned up.

Definition at line 889 of file TTrackManager.cxx.

889 {
890 _tracksAll.append(list);
891 _tracks.append(selectGoodTracks(list));
892 list.removeAll();
893}

Referenced by TrkReco::execute().

◆ append() [2/2]

void TTrackManager::append ( AList< TTrack > &  list)

appends (2D) tracks. 'list' will be cleaned up.

◆ append2D() [1/2]

void TTrackManager::append2D ( AList< TTrack > &  list)

Definition at line 896 of file TTrackManager.cxx.

896 {
897 _tracksAll.append(list);
898 _tracks2D.append(selectGoodTracks(list, true));
899 _tracks2D.sort(SortByPt);
900 list.removeAll();
901}
int SortByPt(const void *a, const void *b)
Utility functions.
Definition: TTrack.cxx:2530

Referenced by TrkReco::execute().

◆ append2D() [2/2]

void TTrackManager::append2D ( AList< TTrack > &  list)

◆ clear() [1/2]

void TTrackManager::clear ( void  )
virtual

clears all internal information.

Reimplemented from TUpdater.

Definition at line 854 of file TTrackManager.cxx.

854 {
855 HepAListDeleteAll(_tracksAll);
856 _tracks.removeAll();
857 _tracks2D.removeAll();
858 _tracksFinal.removeAll();
859 HepAListDeleteAll(_associateHits);
860 static bool first = true;
861 if (first) {
862 first = false;
863 int size;
864 // _s = (struct summary *)
865 // BASF_Sharedmem->get_pointer(BASF_Sharedmem->get_id(),
866 // "TrkMgrSum",
867 // & size);
868 }
869}
Index first(Pair i)
Definition: EvtCyclic3.cc:195

Referenced by TrkReco::clear().

◆ clear() [2/2]

void TTrackManager::clear ( void  )
virtual

clears all internal information.

Reimplemented from TUpdater.

◆ clearTables() [1/2]

void TTrackManager::clearTables ( void  ) const

clears tables.

Definition at line 2515 of file TTrackManager.cxx.

2515 {
2516 // BsDelEnt(RECMDC_TRK, BBS_ID_ALL);
2517 // BsDelEnt(RECMDC_TRK_ADD, BBS_ID_ALL);
2518 // BsDelEnt(RECMDC_MCTRK, BBS_ID_ALL);
2519 // BsDelEnt(RECMDC_MCTRK2HEP, BBS_ID_ALL);
2520 unsigned n = MdcRecTrkCol::getMdcRecTrkCol()->size();
2521 for (unsigned i = 0; i < n; i++) delete &(*MdcRecTrkCol::getMdcRecTrkCol())[i];
2522
2524 for (unsigned i = 0; i < n; i++) delete &(*MdcRecTrkAddCol::getMdcRecTrkAddCol())[i];
2525
2527 for (unsigned i = 0; i < n; i++) delete &(*MdcRecMctrkCol::getMdcRecMctrkCol())[i];
2528
2530 for (unsigned i = 0; i < n; i++) delete &(*MdcRecMctrk2hepCol::getMdcRecMctrk2hepCol())[i];
2531
2532
2533 //...Clear track association...
2534 // unsigned n = BsCouTab(RECMDC_WIRHIT);
2536 for (unsigned i = 0; i < n; i++) {
2537 // reccdc_wirhit & h = * (reccdc_wirhit *)
2538 // BsGetEnt(RECMDC_WIRHIT, i + 1, BBS_No_Index);
2539 // h.m_trk = 0;
2541 h.trk = 0;
2542 }
2543 // n = BsCouTab(DATMDC_MCWIRHIT);
2545 for (unsigned i = 0; i < n; i++) {
2546 // datcdc_mcwirhit & h = * (datcdc_mcwirhit *)
2547 // BsGetEnt(DATMDC_MCWIRHIT, i + 1, BBS_No_Index);
2548 // h.m_trk = 0;
2550 h.trk = 0;
2551 }
2552}
const Int_t n
static vector< MdcDat_mcwirhit > * getMdcDatMcwirhitCol(void)
Definition: MdcTables.cxx:315
static vector< MdcRec_mctrk2hep > * getMdcRecMctrk2hepCol(void)
Definition: MdcTables.cxx:341
static vector< MdcRec_mctrk > * getMdcRecMctrkCol(void)
Definition: MdcTables.cxx:328
static vector< MdcRec_trk_add > * getMdcRecTrkAddCol(void)
Definition: MdcTables.cxx:356
static vector< MdcRec_trk > * getMdcRecTrkCol(void)
Definition: MdcTables.cxx:185
static vector< MdcRec_wirhit > * getMdcRecWirhitCol(void)
Definition: MdcTables.cxx:169

Referenced by TrkReco::clear().

◆ clearTables() [2/2]

void TTrackManager::clearTables ( void  ) const

clears tables.

◆ closest() [1/2]

TTrack * TTrackManager::closest ( const AList< TTrack > &  tracks,
const TMDCWireHit hit 
) const

returns a track which is the closest to a hit.

Definition at line 255 of file TTrackManager.cxx.

256 {
257
258 TMLink t;
259 t.hit(& hit);
260 unsigned n = tracks.length();
261 double minDistance = MAXDOUBLE;
262 TTrack * minTrk = NULL;
263
264 //...Loop over all tracks...
265 for (unsigned i = 0; i < n; i++) {
266 TTrack & trk = * tracks[i];
267 int err = trk.approach(t);
268 if (err < 0) continue;
269 if (minDistance > t.distance()) {
270 minDistance = t.distance();
271 minTrk = & trk;
272 }
273 }
274
275 return minTrk;
276}
const AList< TTrack > & tracks(void) const
returns a list of reconstructed tracks.
A class to represent a track in tracking.
int approach(TMLink &) const
calculates the closest approach to a wire in real space. Results are stored in TMLink....
Definition: TTrack.cxx:296
int t()
Definition: t.c:1

Referenced by salvage().

◆ closest() [2/2]

TTrack * TTrackManager::closest ( const AList< TTrack > &  ,
const TMDCWireHit  
) const

returns a track which is the closest to a hit.

◆ debugLevel() [1/4]

int TTrackManager::debugLevel ( int  a)
inline

Definition at line 299 of file InstallArea/include/TrkReco/TrkReco/TTrackManager.h.

299 {
300 return _debugLevel = a;
301}

◆ debugLevel() [2/4]

int TTrackManager::debugLevel ( int  )

◆ debugLevel() [3/4]

int TTrackManager::debugLevel ( void  ) const
inline

returns/sets debug level.

Definition at line 293 of file InstallArea/include/TrkReco/TrkReco/TTrackManager.h.

293 {
294 return _debugLevel;
295}

Referenced by TrkReco::initialize().

◆ debugLevel() [4/4]

int TTrackManager::debugLevel ( void  ) const

returns/sets debug level.

◆ determineIP() [1/2]

void TTrackManager::determineIP ( void  )

determines IP.

Definition at line 2614 of file TTrackManager.cxx.

2614 {
2615 static const HepVector3D InitialVertex(0., 0., 0.);
2616
2617 //...Track selection...
2618 // unsigned n = BsCouTab(RECTRK);
2619 unsigned n = MdcTrkCol::getMdcTrkCol()->size();
2621 for (unsigned i = 0; i < n; i++) {
2622 // const rectrk & t = * (rectrk *) BsGetEnt(RECTRK, i + 1, BBS_No_Index);
2623 const MdcTrk & t = (* MdcTrkCol::getMdcTrkCol())[i];
2624
2625 if (t.prekal == 0) continue;
2626 // const reccdc_trk_add & c = * (reccdc_trk_add *)
2627 // BsGetEnt(RECMDC_TRK_ADD, t.m_prekal, BBS_No_Index);
2628 const MdcRec_trk_add & c = * t.prekal->add;
2629
2630 //...Only good tracks...
2631 if (c.quality) continue;
2632
2633 //...Require SVD hits...
2634 // const rectrk_global & g = * (rectrk_global *) BsGetEnt(RECTRK_GLOBAL,
2635 // t.m_glob[2],
2636 // BBS_No_Index);
2637 const MdcTrk_global & g = * t.glob[2];
2638
2639 if (! & g) continue;
2640 if (g.nhits[3] < 2) continue;
2641 if (g.nhits[4] < 2) continue;
2642
2643 //...OK...
2644 // const rectrk_localz & z = * (rectrk_localz *) BsGetEnt(RECTRK_LOCALZ,
2645 // t.m_zero[2],
2646 // BBS_No_Index);
2647 MdcTrk_localz & z = * t.zero[2];
2648
2649 if (! & z) continue;
2650 // zList.append((rectrk_localz &) z);
2651 zList.append(z);
2652 }
2653 unsigned nZ = zList.length();
2654 if (nZ < 2) return;
2655
2656 //...Fitting...
2657 // kvertexfitter kvf;
2658 // kvf.initialVertex(initialVertex);
2659 // for (unsigned i = 0; i < nZ; i++) {
2660 // kvf.addTrack();
2661 // }
2662
2663}
static vector< MdcTrk > * getMdcTrkCol(void)
Definition: TrkTables.cxx:11

◆ determineIP() [2/2]

void TTrackManager::determineIP ( void  )

determines IP.

◆ determineT0() [1/2]

StatusCode TTrackManager::determineT0 ( unsigned  level,
unsigned  nMaxTracks 
)

determines T0 and refit all tracks.

Definition at line 1293 of file TTrackManager.cxx.

1293 {
1294#ifdef TRKRECO_DEBUG_DETAIL
1295 if (level == 0) {
1296 std::cout << "TTrackManager::determineT0 !!! called with level = 0";
1297 std::cout << std::endl;
1298 }
1299#endif
1300
1301 IMessageSvc *msgSvc;
1302 Gaudi::svcLocator()->service("MessageSvc", msgSvc);
1303 MsgStream log(msgSvc, "TTrackManager");
1304
1305 IDataProviderSvc* eventSvc = NULL;
1306 Gaudi::svcLocator()->service("EventDataSvc", eventSvc);
1307
1308 static bool first = true;
1309 static unsigned methode = 0;
1310 if (first) {
1311 first = false;
1312
1313 if (level == 1) {
1314 _cFitter.fit2D(true);
1315 }
1316 else if (level == 2) {
1317 // default setting
1318 }
1319 else if (level == 3) {
1320 // _cFitter.sag(true); //Liuqg
1321 }
1322 else if (level == 4) {
1323 // _cFitter.sag(true); //Liuqg
1324 _cFitter.propagation(true);
1325 }
1326 else if (level == 5) {
1327 // _cFitter.sag(true); //Liuqg
1328 _cFitter.propagation(true);
1329 _cFitter.tof(true);
1330 }
1331 else if (level == 6) {
1332 methode = 1;
1333 // _cFitter.sag(true); //Liuqg
1334 _cFitter.propagation(true);
1335 _cFitter.tof(true);
1336 }
1337 else if (level == 7) {
1338 methode = 2;
1339 // _cFitter.sag(true); //Liuqg
1340 _cFitter.propagation(true);
1341 _cFitter.tof(true);
1342 }
1343 }
1344
1345 unsigned n = _tracks.length();
1346 if (! n) return StatusCode::SUCCESS;
1347
1348 if (nMax == 0) nMax = n;
1349 if (n > nMax) n = nMax;
1350
1351 // float t0 = 0.;
1352 _t0 = 999.;
1353
1354 //read t0 from TDS
1355 float t0_sta = -1;
1356 float tev = 0;
1357 SmartDataPtr<RecEsTimeCol> aevtimeCol(eventSvc,"/Event/Recon/RecEsTimeCol");
1358 if (aevtimeCol) {
1359 RecEsTimeCol::iterator iter_evt = aevtimeCol->begin();
1360 t0_sta = (*iter_evt)->getStat();
1361 tev = (*iter_evt)->getTest();
1362 // cout<<"t0_sta: "<<t0_sta<<" tev: "<<tev<<endl;
1363 }else{
1364 log << MSG::WARNING << "Could not find RecEsTimeCol" << endreq;
1365 }
1366
1367 if (methode == 0) _t0 = T0(n);
1368
1369 else if (methode == 1) _t0 = T0Fit(n);
1370
1371 else if (methode ==2) { //revise method == 2 to BESIII environment. Liuqg
1372 if (t0_sta != 1) { //1: tof 11:tof after reco //no tof
1373 _t0 = T0Fit(n);
1374 //cout<<"t0: "<<_t0<<endl;
1375 }
1376 }
1377
1378 // std::cout << "reccdc_timing=" << BsCouTab(RECMDC_TIMING) << std::endl;
1379 /* else if (methode == 2 && BsCouTab(RECMDC_TIMING) != 0) {
1380 struct reccdc_timing * r0 = (struct reccdc_timing *)
1381 BsGetEnt(RECMDC_TIMING, BsCouTab(RECMDC_TIMING), BBS_No_Index);
1382 if (r0->m_quality == 102) {
1383 if (BsCouTab(BELLE_EVENT)) {
1384 struct belle_event * b0 = (struct belle_event *)
1385 BsGetEnt(BELLE_EVENT, 1, BBS_No_Index);
1386 if(1==b0->m_ExpMC) t0 = T0Fit(n);
1387 if(2==b0->m_ExpMC && r0->m_time !=0.) t0 = T0Fit(n);
1388 }
1389 }
1390 else if (r0->m_quality == 100) t0 = T0Fit(n);
1391 // std::cout << "quality=" << r0->m_quality << std::endl;
1392 }
1393 */
1394
1395 //...For debug...
1396 if (_debugLevel) {
1397 std::cout << "TTrackManager::determineT0 ... methode=" << methode;
1398 std::cout << ", T0 offset=" << - _t0;
1399 std::cout << ", # of tracks used=" << n << std::endl;
1400 }
1401
1402 //...store them... Liuqg
1403 float t0_rec = 999.;
1404 int t0_recSta = 8;
1405 if(fabs(_t0 + tev) < 4) t0_rec = 0;
1406 if(fabs(_t0 + tev - 8) < 4) t0_rec = 8;
1407 if(fabs(_t0 + tev - 16) < 4) t0_rec = 16;
1408 log << MSG::INFO << "beginning to make RecEsTimeCol" <<endreq;
1409 IDataManagerSvc *dataManSvc = dynamic_cast<IDataManagerSvc*> (eventSvc);
1410 DataObject *aEvTime;
1411 eventSvc->findObject("/Event/Recon/RecEsTimeCol",aEvTime);
1412 if(aEvTime!=NULL && t0_rec<25){
1413 dataManSvc->clearSubTree("/Event/Recon/RecEsTimeCol");
1414 eventSvc->unregisterObject("/Event/Recon/RecEsTimeCol");
1415 }
1416 if(t0_rec<25){
1417
1418 RecEsTimeCol *aEvTimeCol = new RecEsTimeCol;
1419 RecEsTime *aevtime = new RecEsTime;
1420 aevtime -> setTest(t0_rec);
1421 aevtime -> setStat(t0_recSta);
1422 aEvTimeCol->push_back(aevtime);
1423
1424 // register event time to TDS
1425 //check whether the t0 has been already registered
1426 StatusCode evtime = eventSvc->registerObject("/Event/Recon/RecEsTimeCol", aEvTimeCol);
1427
1428 if(evtime!=StatusCode::SUCCESS) {
1429 log << MSG::FATAL << "Could not register Event Start Time" << endreq;
1430 return( StatusCode::FAILURE);
1431 }
1432 }
1433 return( StatusCode::SUCCESS );
1434}
bool fit2D(void) const
sets/returns 2D flag.
bool tof(void) const
sets/returns propagation-delay correction flag.
bool propagation(void) const
sets/returns propagation-delay correction flag.

Referenced by TrkReco::execute().

◆ determineT0() [2/2]

StatusCode TTrackManager::determineT0 ( unsigned  level,
unsigned  nMaxTracks 
)

determines T0 and refit all tracks.

◆ divide() [1/2]

TMLink & TTrackManager::divide ( const TTrack t,
AList< TMLink > *  l 
) const

Definition at line 1028 of file TTrackManager.cxx.

1028 {
1029 TMLink & start = * OuterMost(t.links());
1030 const HepPoint3D & center = t.helix().center();
1031 const HepVector3D a = start.positionOnTrack() - center;
1032 for (unsigned j = 0; j < t.nLinks(); j++) {
1033 if (t[j] == & start) continue;
1034 TMLink & k = * t[j];
1035 const HepVector3D b = k.positionOnTrack() - center;
1036 if (a.cross(b).z() >= 0.) l[0].append(k);
1037 else l[1].append(k);
1038 }
1039
1040#ifdef TRKRECO_DEBUG_DETAIL
1041 std::cout << " outer link = " << start.hit()->wire()->name() << std::endl;
1042 std::cout << " nLinks of 0 = " << l[0].length() << std::endl;
1043 std::cout << " nLinks of 1 = " << l[1].length() << std::endl;
1044#endif
1045
1046 if (l[0].length() == 0 || l[1].length() == 0)
1047 return divideByIp(t, l);
1048
1049 return start;
1050}
const TMDCWire *const wire(void) const
returns a pointer to a TMDCWire.
std::string name(void) const
returns name.
TMLink & divideByIp(const TTrack &t, AList< TMLink > *l) const

◆ divide() [2/2]

TMLink & TTrackManager::divide ( const TTrack t,
AList< TMLink > *  l 
) const

◆ divideByIp() [1/2]

TMLink & TTrackManager::divideByIp ( const TTrack t,
AList< TMLink > *  l 
) const

Definition at line 1053 of file TTrackManager.cxx.

1053 {
1054 l[0].removeAll();
1055 l[1].removeAll();
1056
1057 const HepPoint3D & center = t.helix().center();
1058 const HepVector3D a = ORIGIN - center;
1059 for (unsigned j = 0; j < t.nLinks(); j++) {
1060 TMLink & k = * t[j];
1061 const HepVector3D b = k.positionOnTrack() - center;
1062 if (a.cross(b).z() >= 0.) l[0].append(k);
1063 else l[1].append(k);
1064 }
1065
1066 //...This is a dummy...
1067 TMLink & start = * OuterMost(t.links());
1068 return start;
1069}
const HepPoint3D ORIGIN
Constants.
Definition: TMDCUtil.cxx:47

Referenced by divide(), maskCurl(), and maskNormal().

◆ divideByIp() [2/2]

TMLink & TTrackManager::divideByIp ( const TTrack t,
AList< TMLink > *  l 
) const

◆ dump() [1/2]

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

dumps debug information.

Definition at line 111 of file TTrackManager.cxx.

111 {
112 bool def = (msg == "") ? true : false;
113/*
114 if (msg.find("summary") != std::string::npos || msg.find("detail") != std::string::npos) {
115 struct summary s;
116 // bzero((char*)& s, sizeof(struct summary));
117 memset((char*)& s, 0, sizeof(struct summary));
118 for (int i = 0; i < BASF_Sharedmem->nprocess(); i++) {
119 int size;
120 struct summary & r = * (struct summary *)
121 BASF_Sharedmem->get_pointer(i, "TrkMgrSum", & size);
122 s._nEvents += r._nEvents;
123 s._nTracks += r._nTracks;
124 s._nTracksAll += r._nTracksAll;
125 s._nTracks2D += r._nTracks2D;
126 s._nTracksFinal += r._nTracksFinal;
127 s._nSuperMoms += r._nSuperMoms;
128 s._nToBeMerged += r._nToBeMerged;
129 s._nToBeMergedMoreThanTwo += r._nToBeMergedMoreThanTwo;
130 }
131
132 std::cout << pre;
133 std::cout << "all events : " << s._nEvents << std::endl;
134 std::cout << pre;
135 std::cout << "all tracks : " << s._nTracksAll << std::endl;
136 std::cout << pre;
137 std::cout << " good tracks : " << s._nTracks << std::endl;
138 std::cout << pre;
139 std::cout << " 2D tracks : " << s._nTracks2D << std::endl;
140 std::cout << pre;
141 std::cout << " final tracks : " << s._nTracksFinal << std::endl;
142 std::cout << pre;
143 std::cout << " super mom. : " << s._nSuperMoms << std::endl;
144 std::cout << pre;
145 std::cout << " to be mreged : " << s._nToBeMerged << std::endl;
146 std::cout << pre;
147 std::cout << " to be mreged2: " << s._nToBeMergedMoreThanTwo
148 << std::endl;
149 }
150*/
151 if (def || msg.find("eventSummary") != std::string::npos || msg.find("detail") != std::string::npos) {
152 std::cout << pre
153 << "tracks reconstructed : " << _tracksAll.length()
154 << std::endl;
155 std::cout << pre
156 << "good tracks : " << _tracks.length()
157 << std::endl;
158 std::cout << pre
159 << "2D tracks : " << _tracks2D.length()
160 << std::endl;
161 std::cout << pre
162 << "Track list:" << std::endl;
163
164 std::string tab = pre;
165 std::string spc = " ";
166 for (unsigned i = 0; i < _tracksAll.length(); i++) {
167 std::cout << tab << TrackDump(* _tracksAll[i]) << std::endl;
168 if (msg.find("hits") != std::string::npos || msg.find("detail") != std::string::npos)
169 Dump(_tracksAll[i]->links(), "hits sort flag");
170 }
171 }
172}
std::string TrackDump(const TTrack &)
to dump a track.

◆ dump() [2/2]

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

dumps debug information.

◆ finish() [1/2]

void TTrackManager::finish ( void  )

finishes tracks.

Definition at line 872 of file TTrackManager.cxx.

872 {
873 refit();
874 movePivot();
875 if (_debugLevel > 1) {
876 std::cout << name() << " ... finishing" << std::endl;
877 // unsigned n = _tracksAll.length();
878 unsigned n = _tracks.length();
879 for (unsigned i = 0; i < n; i++) {
880 // TTrack & t = * _tracksAll[i];
881 TTrack & t = * _tracks[i];
882 std::cout << " " << t.name() << std::endl;
883 t.dump("hits mc track flag sort", " ");
884 }
885 }
886}
void movePivot(void)
moves pivot of tracks.
void refit(void)
refits tracks.
std::string name(void) const
returns name.

◆ finish() [2/2]

void TTrackManager::finish ( void  )

finishes tracks.

◆ fittingFlag() [1/2]

void TTrackManager::fittingFlag ( unsigned  a)
inline

sets fitting flag.

Definition at line 305 of file InstallArea/include/TrkReco/TrkReco/TTrackManager.h.

305 {
306 if (a & 1) _fitter.sag(true);
307 if (a & 2) _fitter.propagation(true);
308 if (a & 4) _fitter.tof(true);
309 if (a & 8) _fitter.freeT0(true);
310}
bool freeT0(void) const
sets/returns free T0 flag.
bool sag(void) const
sets/returns sag correction flag.

Referenced by TrkReco::initialize().

◆ fittingFlag() [2/2]

void TTrackManager::fittingFlag ( unsigned  )

sets fitting flag.

◆ goodTrack() [1/2]

bool TTrackManager::goodTrack ( const TTrack t,
bool  track2D = false 
)
static

checks goodness of a track.

Definition at line 3015 of file TTrackManager.cxx.

3015 {
3016
3017 //...Check number of hits...
3018 if (! checkNumberOfHits(t, track2D)) return false;
3019
3020 //...Check helix parameter...
3021 if (HelixHasNan(t.helix())) return false;
3022
3023 return true;
3024}
bool HelixHasNan(const Helix &)
Helix parameter validity.
Definition: TTrack.cxx:3934

◆ goodTrack() [2/2]

static bool TTrackManager::goodTrack ( const TTrack ,
bool  track2D = false 
)
static

checks goodness of a track.

◆ makeTds() [1/2]

StatusCode TTrackManager::makeTds ( RecMdcTrackCol trackList,
RecMdcHitCol hitList,
int  tkStat = 1,
int  runge = 0,
int  cal = 0 
)

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

Definition at line 281 of file TTrackManager.cxx.

281 { //yzhang change interface 2010-05-14
282 IMessageSvc *msgSvc;
283 Gaudi::svcLocator()->service("MessageSvc", msgSvc);
284
285 MsgStream log(msgSvc, "TrkReco");
286
287 IDataProviderSvc* eventSvc = NULL;
288 Gaudi::svcLocator()->service("EventDataSvc", eventSvc);
289
290#ifdef TRKRECO_DEBUG
291 if (eventSvc) {
292 log << MSG::INFO << "makeTds:event Svc has been found" << endreq;
293 } else {
294 log << MSG::FATAL << "makeTds:Could not find eventSvc" << endreq;
295 return StatusCode::FAILURE ;
296 }
297#endif
298//check whether Recon already registered
299// DataObject *aReconEvent;
300// eventSvc->findObject("/Event/Recon",aReconEvent);
301// if(!aReconEvent) {
302// ReconEvent* recevt = new ReconEvent;
303// StatusCode sc = eventSvc->registerObject("/Event/Recon",recevt );
304// if(sc!=StatusCode::SUCCESS) {
305// log << MSG::FATAL << "Could not register ReconEvent" <<endreq;
306// return( StatusCode::FAILURE);
307// }
308// }
309//
310// /// Unregister Tracks
311// IDataManagerSvc *dataManSvc;
312// if(doClear){//yzhang add, do NOT clear Tds when associate rec
313// dataManSvc= dynamic_cast<IDataManagerSvc*>(eventSvc);
314// DataObject *aTrackCol;
315// eventSvc->findObject("/Event/Recon/RecMdcTrackCol",aTrackCol);
316// if(aTrackCol != NULL) {
317// dataManSvc->clearSubTree("/Event/Recon/RecMdcTrackCol");
318// eventSvc->unregisterObject("/Event/Recon/RecMdcTrackCol");
319// }
320// DataObject *aRecHitCol;
321// eventSvc->findObject("/Event/Recon/RecMdcHitCol",aRecHitCol);
322// if(aRecHitCol != NULL) {
323// dataManSvc->clearSubTree("/Event/Recon/RecMdcHitCol");
324// eventSvc->unregisterObject("/Event/Recon/RecMdcHitCol");
325// }
326// }
327// /// Writing
328// RecMdcTrackCol* trkcol = new RecMdcTrackCol;
329// RecMdcHitCol* hitcol = new RecMdcHitCol;
330
331 unsigned n = _tracks.length();
332 int nTdsTk = trkcol->size();
333 for (int i =0; i < n; i++) {
334 RecMdcTrack* trk = new RecMdcTrack;
335 TTrack* t = _tracks[i];
336 int trackindex = i + nTdsTk;//for combination
337
338 HitRefVec hitrefvec;
339 AList<TMLink> hits = t->links();
340 float chisq=0;
341
342 HepPoint3D pos = t->helix().pivot();
343 int charge = -1;
344 HepVector m_a(5,0);
345 m_a = t->helix().a();
346 int statfinder=t->getFinderType();
347 if(abs(statfinder)>1000&&brunge)statfinder=103;
348 if(abs(statfinder)>1000&&!brunge)statfinder=3;
349 //be cautious
350 if(!brunge)m_a[2] = -m_a[2];
351 if(abs(m_a[1])>999)m_a[1]=0;
352 while(m_a[1]<0){m_a[1]+=2*pi;}
353 while(m_a[1]>2*pi){m_a[1]-=2*pi;}
354 /// added by Jike Wang
355 const double x0 = t->helix().pivot().x();
356 const double y0 = t->helix().pivot().y();
357
358 const double dr = m_a[0];
359 const double phi0 = m_a[1];
360 const double kappa = m_a[2];
361 const double dz = m_a[3];
362 const double tanl = m_a[4];
363
364 const double Bz = -1000*(m_pmgnIMF->getReferField());
365 const double alpha = 333.564095 / Bz;
366
367 const double cox = x0 + dr*cos(phi0) - alpha*cos(phi0)/kappa;
368 const double coy = y0 + dr*sin(phi0) - alpha*sin(phi0)/kappa;
369
370
371 unsigned nHits = t->links().length();
372 unsigned nStereos = 0;
373 unsigned firstLyr = 44;
374 unsigned lastLyr = 0;
375 for (unsigned j=0; j<nHits; j++){
376
377 TMLink * l = hits[j];
378
379 HepPoint3D ontrack = l->positionOnTrack();
380 HepPoint3D onwire = l->positionOnWire();
381 HepPoint3D dir(ontrack.y()-coy,cox-ontrack.x(),0);
382 double pos_phi=onwire.phi();
383 double dir_phi=dir.phi();
384 while(pos_phi>pi){pos_phi-=pi;}
385 while(pos_phi<0){pos_phi+=pi;}
386 while(dir_phi>pi){dir_phi-=pi;}
387 while(dir_phi<0){dir_phi+=pi;}
388 double entrangle=dir_phi-pos_phi;
389 while(entrangle>pi/2)entrangle-=pi;
390 while(entrangle<(-1)*pi/2)entrangle+=pi;
391
392 //jialk setFltLen to tds
393 int imass = 3;
394 float tl = t->helix().a()[4];
395 float f = sqrt(1. + tl * tl);
396 float s = fabs(t->helix().curv()) * fabs(l->dPhi()) * f;
397 float p = f / fabs(t->helix().a()[2]);
398 float Mass[5] = {0.000511,0.105,0.140,0.493677,0.98327};
399 double tof = s/29.98*sqrt(1.0+(Mass[imass-1]/p)*(Mass[imass-1]/p));
400
401 RecMdcHit* hit = new RecMdcHit;
402 hit->setId(l->hit()->reccdc()->id);
403// hit->setTrkId(i);
404 hit->setTrkId(trackindex); //for combination
405 hit->setDriftDistLeft(l->drift(0));
406 hit->setDriftDistRight(l->drift(1));
407 hit->setErrDriftDistLeft(l->dDrift(0));
408 hit->setErrDriftDistRight(l->dDrift(1));
409 hit->setChisqAdd(l->pull());
410 hit->setFlagLR(l->leftRight());
411 // hit->setStat(l->hit()->state());
412 hit->setStat(1);
413 // std::cout<<"state :"<< l->hit()->state() << std::endl;
414 hit->setAdc(l->hit()->reccdc()->adc);
415// hit->setTdc((l->hit()->reccdc()->tdc + t0bes)/0.09375); //jialk
416 hit->setTdc(l->hit()->reccdc()->timechannel);
417 hit->setFltLen(tof * 30);//jialk
418 // std::cout<<"tdc :"<< l->hit()->reccdc()->tdc <<" "<<"t0bes : "<< t0bes <<std::endl;
419 if(cal){hit->setDoca(l->distancenew());}
420 else{hit->setDoca(l->distance());}
421 hit->setZhit(l->positionOnTrack().z());
422
423 ///add by jialk: returns driftTime prop time correction & entra angle
424 hit->setEntra(entrangle);
425 hit->setDriftT(l->getDriftTime());
426
427
428 Identifier hitIdf = MdcID:: wire_id(l->wire()->layerId(),l->wire()->localId());
429 hit->setMdcId(hitIdf);
430 hitcol->push_back(hit);
431
432 SmartRef<RecMdcHit> refhit(hit);
433 hitrefvec.push_back(refhit);
434 chisq += l->pull();
435 if(l->wire()->stereo()) ++nStereos;
436 if(firstLyr > l->wire()->layerId()) firstLyr = l->wire()->layerId();
437 if(lastLyr < l->wire()->layerId()) lastLyr = l->wire()->layerId();
438 }
439
440
441 HepSymMatrix m_ea = t->helix().Ea();
442 double errorMat[15];
443 int k = 0;
444 for (int ie = 0 ; ie < 5 ; ie ++){
445 for (int je = ie ; je < 5 ; je ++) {
446 errorMat[k] = m_ea[ie][je];
447 k++;
448 }
449 }
450
451 trk->setTrackId(trackindex);
452 trk->setHelix(m_a);
453 trk->setPxy(t->pt());
454 trk->setPx(t->pt() * (-sin(t->helix().phi0())));
455 trk->setPy(t->pt() * cos(t->helix().phi0()));
456 trk->setPz(t->pz());
457 trk->setP(t->ptot());
458
459 //jialk
460 double theta = acos((t->pz())/t->ptot());
461 trk->setTheta(theta);
462
463 double poca_dr = t->helix().dr();
464 double poca_phi0 = t->helix().phi0();
465 trk->setPhi(poca_phi0);
466 HepPoint3D poca(pos.x()+poca_dr*cos(poca_phi0),
467 pos.y()+poca_dr*sin(poca_phi0),
468 pos.z()+t->helix().dz());
469 trk->setPoca(poca);
470 trk->setX(poca.x());
471 trk->setY(poca.y());
472 trk->setZ(poca.z());
473 trk->setR(sqrt(poca.x()*poca.x() + poca.y()*poca.y()));
474 trk->setPivot(pos);
475 trk->setVX0(pos.x());
476 trk->setVY0(pos.y());
477 trk->setVZ0(pos.z());
478
479 trk->setError(m_ea);
480// trk->setError(errorMat); //...............2
481
482// double poca_dr = t->helix().dr();
483// double poca_phi0 = t->helix().phi0();
484// HepPoint3D poca(poca_dr*cos(poca_phi0),poca_dr*sin(poca_phi0),t->helix().dz());
485// trk->setVX0(pos.x()+poca_dr*cos(poca_phi0));
486// trk->setVY0(pos.y()+poca_dr*sin(poca_phi0));
487// trk->setVZ0(pos.z()+t->helix().dz());
488// cout<<"pivot:("<<pos.x()<<","<<pos.y()<<","<<pos.z()<<")"<<endl;
489// cout<<"poca:("<<trk->getVX0()<<","<<trk->getVY0()<<","<<trk->getVZ0()<<")"<<endl;
490
491 trk->setChi2(chisq);
492 trk->setNdof(nHits-5);
493 if (t->quality() & TrackQuality2D) trk->setNdof(nHits-3);
494
495 TMLink * last = OuterMost(hits);
496 t->approach(*last);
497 trk->setFiTerm(last->dPhi());
498
499 trk->setNhits(nHits);
500 trk->setNster(nStereos);
501 trk->setStat(statfinder);//yzhang add stat: ConformalFinder=2, CurlFiner=3
502 //xuqn 2013-02-26
503 //trk->setCharge(int(t->charge())*(-1));
504 if(!brunge) trk->setCharge(int(t->charge())*(-1));
505 else trk->setCharge(t->charge());
506 trk->setVecHits(hitrefvec);
507 trk->setFirstLayer(firstLyr);
508 trk->setLastLayer(lastLyr);
509 //cout<<"first: "<<firstLyr<<" last: "<<lastLyr<<endl;
510 trkcol->push_back(trk);
511 }
512
513// StatusCode trksc;
514// trksc = eventSvc->registerObject("/Event/Recon/RecMdcTrackCol", trkcol);
515// if( trksc.isFailure() ) {
516// log << MSG::FATAL << "Could not register MdcTrack" << endreq;
517// return trksc;
518// }
519//
520// StatusCode hitsc = eventSvc->registerObject("/Event/Recon/RecMdcHitCol", hitcol);
521// if ( hitsc.isFailure() ) {
522// log << MSG::FATAL << "Could not register MdcRecHit" << endreq;
523// return hitsc;
524// }
525//log << MSG::INFO << "MdcTrackCol registered successfully!" <<endreq;
526
527 ///check the result:MdcTrackCol
528#ifdef TRKRECO_DEBUG
529 SmartDataPtr<RecMdcTrackCol> newtrkCol(eventSvc,"/Event/Recon/RecMdcTrackCol");
530 if (!newtrkCol) {
531 log << MSG::FATAL << "Could not find RecMdcTrackCol" << endreq;
532 return( StatusCode::FAILURE);
533 }
534 log << MSG::INFO << "Begin to check RecMdcTrackCol"<<endreq;
535 RecMdcTrackCol::iterator iter_trk = newtrkCol->begin();
536 for( ; iter_trk != newtrkCol->end(); iter_trk++){
537 const RecMdcTrack* tk = *iter_trk;
538 std::cout<< "//==== "<<name()<<" print RecMdcTrack No."<<tk->trackId()<<" :"<< std::endl;
539 cout <<" dr "<<tk->helix(0)
540 <<" phi0 "<<tk->helix(1)
541 <<" cpa "<<tk->helix(2)
542 <<" z0 "<<tk->helix(3)
543 <<" tanl "<<tk->helix(4)
544 <<endl;
545 bool printTrackDetail = true;
546 if(printTrackDetail){
547 std::cout<<" q "<<tk->charge()
548 <<" theta "<<tk->theta()
549 <<" phi "<<tk->phi()
550 <<" x0 "<<tk->x()
551 <<" y0 "<<tk->y()
552 <<" z0 "<<tk->z()
553 <<" r0 "<<tk->r()
554 <<endl;
555 std::cout <<" p "<<tk->p()
556 <<" pt "<<tk->pxy()
557 <<" pxyz("<<tk->px()
558 <<","<<tk->py()
559 <<","<<tk->pz()
560 <<")"<<endl;
561 std::cout<<" tkStat "<<tk->stat()
562 <<" chi2 "<<tk->chi2()
563 <<" ndof "<<tk->ndof()
564 <<" nhit "<<tk->getNhits()
565 <<" nst "<<tk->nster()
566 <<endl;
567 bool printErrMat = true;
568 if(printErrMat){
569 std::cout<< "errmat " << std::endl;
570 for (int i=0; i<15; i++){ std::cout<< " "<<tk->err(i); }
571 std::cout<< " " << std::endl;
572 }
573 }
574
575 bool printHit = true;
576 if(printHit){
577 int haveDigi[43][288];
578 bool printMcTk = true;
579 if(printMcTk) {
580 for(int ii=0;ii<43;ii++){
581 for(int jj=0;jj<43;jj++){
582 haveDigi[ii][jj]=-9999;
583 }
584 }
585 MdcDigiVec mdcDigiVec = m_rawDataProviderSvc->getMdcDigiVec();
586 MdcDigiCol::iterator iter = mdcDigiVec.begin();
587 std::cout<<name()<<"//==== "<<name()<<" print MdcDigiVec, nDigi="<<mdcDigiVec.size()<<" :"<<std::endl;
588 for (int iDigi=0;iter!= mdcDigiVec.end(); iter++,iDigi++ ) {
589 long l = MdcID::layer((*iter)->identify());
590 long w = MdcID::wire((*iter)->identify());
591 haveDigi[l][w]=(*iter)->getTrackIndex();
592 }
593 }
594
595 int nhits = tk->getVecHits().size();
596 std::cout<<"nHits=" <<nhits<< std::endl;
597 cout<<"No. ";
598 if(printMcTk) cout<<"mcTkId ";
599 cout<<"(layer,wire,lr) stat z"<<endl;
600 for(int ii=0; ii <nhits ; ii++){
601 Identifier id(tk->getVecHits()[ii]->getMdcId());
602 int layer = MdcID::layer(id);
603 int wire = MdcID::wire(id);
604 cout<<ii<<":";
605 if(printMcTk) { cout<<haveDigi[layer][wire]; }
606 cout<<" ("<<layer<<","<<wire
607 <<","<<tk->getVecHits()[ii]->getFlagLR()
608 <<") "<<tk->getVecHits()[ii]->getStat()
609 <<" "<<tk->getVecHits()[ii]->getZhit()<< " "<<std::endl;
610 }//end of hit list
611 std::cout << " "<< std::endl;
612 }
613 /*
614 std::cout << "retrieved MDC track:"
615 << "Track Id: " << (*iter_trk)->getTrkId()
616 << " Pivot: " << (*iter_trk)->getVX0() << " "
617 << (*iter_trk)->getVY0() << " " << (*iter_trk)->getVZ0()
618 << endl
619 << "Phi0: " << (*iter_trk)->getFi0() << " Error of Phi0 "
620 << (*iter_trk)->getError()(2,2) << endreq
621 << "kappa: " << (*iter_trk)->getCpa() << " Error of kappa "
622 << (*iter_trk)->getError()(3,3) << endreq
623 << "Tanl: " << (*iter_trk)->getTanl() << " Error of Tanl "
624 << (*iter_trk)->getError()(5,5) << endreq
625 << "Chisq of fit: "<< (*iter_trk)->getChisq()
626 << " Phi terminal: "<< (*iter_trk)->getFiTerm()
627 << endl
628 << "Number of hits: "<< (*iter_trk)->getNhits()
629 << " Number of stereo hits " << (*iter_trk)->getNster()
630 << endreq;
631
632 log << MSG::DEBUG << "hitList of this track:" << endreq;
633 std::vector<MdcRecHit*> gothits = (*iter_trk)->getVecHits();
634 std::vector<MdcRecHit*>::iterator it_gothit = gothits.begin();
635 for( ; it_gothit != gothits.end(); it_gothit++){
636 log << MSG::DEBUG << "hits Id: "<<(*it_gothit)->getId()
637 << " hits DDL&DDR " <<(*it_gothit)->getDriftDistLeft()
638 << " hits MDC IDentifier " <<(*it_gothit)->getMdcId()
639 << endreq
640 << " hits TDC " <<(*it_gothit)->getTdc()
641 << " hits ADC " <<(*it_gothit)->getAdc() << endreq;
642 }
643 */
644 }
645#endif
646 return StatusCode::SUCCESS;
647}
std::string cal
Definition: CalibModel.cxx:41
EvtStreamInputIterator< typename Generator::result_type > iter(Generator gen, int N=0)
const double alpha
XmlRpcServer s
Definition: HelloServer.cpp:11
double sin(const BesAngle a)
double cos(const BesAngle a)
SmartRefVector< RecMdcHit > HitRefVec
const HepSymMatrix err() const
void setError(double err[15])
void setHelix(double helix[5])
Definition: DstMdcTrack.cxx:98
void setPoca(double poca[3])
const HepVector helix() const
......
virtual double getReferField()=0
static Identifier wire_id(int wireType, int layer, int wire)
For a single wire.
Definition: MdcID.cxx:77
static int layer(const Identifier &id)
Values of different levels (failure returns 0)
Definition: MdcID.cxx:49
static int wire(const Identifier &id)
Definition: MdcID.cxx:54
struct MdcRec_wirhit * reccdc(void) const
returns a pointer to RECMDC_WIRHIT.
unsigned localId(void) const
returns local id in a wire layer.
unsigned layerId(void) const
returns layer id.
bool stereo(void) const
returns true if this wire is in a stereo layer.

Referenced by TrkReco::execute().

◆ makeTds() [2/2]

StatusCode TTrackManager::makeTds ( RecMdcTrackCol trackList,
RecMdcHitCol hitList,
int  tkStat = 1,
int  runge = 0,
int  cal = 0 
)

stores track info. into TDS. by Zang Shilei

◆ mask() [1/2]

void TTrackManager::mask ( void  ) const

masks hits out which are in tail of curly tracks.

Definition at line 947 of file TTrackManager.cxx.

947 {
948#ifdef TRKRECO_DEBUG_DETAIL
949 std::cout << name() << " ... masking" << std::endl;
950#endif
951
952 unsigned n = _tracks.length();
953 for (unsigned i = 0; i < n; i++) {
954 TTrack & t = * _tracks[i];
955
956 //...Skip if no core...
957 // This should not be happend...
958 if (! t.cores().length()) continue;
959
960 //...Counts # of hits per layer...
961 unsigned nHits[43];
962 NHits(t.cores(), nHits);
963
964 //...Check each layer...
965 bool needMask = false;
966 for (unsigned j = 0; j < 43; j++) {
967 if (nHits[j] > 1) {
968 AList<TMLink> linksInLayer = SameLayer(t.links(), j);
969 if (Width(linksInLayer) > 2) {
970 needMask = true;
971
972#ifdef TRKRECO_DEBUG_DETAIL
973 Dump(linksInLayer, "sort", " -->");
974#endif
975 break;
976 }
977 }
978 }
979 if (! needMask) continue;
980
981#ifdef TRKRECO_DEBUG_DETAIL
982 std::cout << " trk" << i << "(id is tmp) needs mask" << std::endl;
983 std::cout << " type = " << t.type() << std::endl;
984#endif
985
986 //...Switch by track type...
987 switch (t.type()) {
988 case TrackTypeNormal:
989 maskNormal(t);
991 break;
992 case TrackTypeCurl:
993 maskCurl(t);
995 break;
996 default:
997 break;
998 }
999
1000 //...Refit...
1001 // refit() ???
1002 _fitter.fit(t);
1003
1004#ifdef TRKRECO_DEBUG_DETAIL
1005 std::cout << " masking result : ";
1006 t.dump("detail sort", " ");
1007#endif
1008 }
1009}
void maskNormal(TTrack &) const
void maskMultiHits(TTrack &) const
void maskCurl(TTrack &) const

Referenced by TrkReco::execute().

◆ mask() [2/2]

void TTrackManager::mask ( void  ) const

masks hits out which are in tail of curly tracks.

◆ maskBadHits() [1/2]

void TTrackManager::maskBadHits ( const AList< TTrack > &  tracks,
float  maxSigma2 
)
static

masks hits with large chisq as associated hits. Pull in TMLink is used.

Definition at line 2487 of file TTrackManager.cxx.

2487 {
2488#ifdef TRKRECO_DEBUG
2489 std::cout << "... trkmgr::maskBadHits" << std::endl;
2490#endif
2491
2492 unsigned n = tracks.length();
2493 for (unsigned i = 0; i < n; i++) {
2494 TTrack & t = * tracks[i];
2495 bool toBeUpdated = false;
2496 const AList<TMLink> links = t.links();
2497 unsigned nHits = links.length();
2498 for (unsigned j = 0; j < nHits; j++) {
2499 if (links[j]->pull() > maxSigma2) {
2500 links[j]->hit()->state(links[j]->hit()->state() |
2502 toBeUpdated = true;
2503#ifdef TRKRECO_DEBUG
2504 std::cout << " " << t.name() << " : ";
2505 std::cout << links[j]->wire()->name() << "(pull=";
2506 std::cout << links[j]->pull() << ") is masked" << std::endl;
2507#endif
2508 }
2509 }
2510 if (toBeUpdated) t.update();
2511 }
2512}

Referenced by TConformalFinder::doit().

◆ maskBadHits() [2/2]

static void TTrackManager::maskBadHits ( const AList< TTrack > &  ,
float  maxSigma2 
)
static

masks hits with large chisq as associated hits. Pull in TMLink is used.

◆ maskCurl() [1/2]

void TTrackManager::maskCurl ( TTrack t) const

Definition at line 1237 of file TTrackManager.cxx.

1237 {
1238
1239 //...Divide into two tracks...
1240 AList<TMLink> l[2];
1241 TMLink & start = divideByIp(t, l);
1242 if (l[0].length() == 0) return;
1243 if (l[1].length() == 0) return;
1244
1245#ifdef TRKRECO_DEBUG_DETAIL
1246 std::cout << " curl : divided by IP" << std::endl;
1247 std::cout << " 0:";
1248 Dump(l[0], "flag sort");
1249 std::cout << " 1:";
1250 Dump(l[1], "flag sort");
1251 std::cout << std::endl;
1252#endif
1253
1254 //...Which should be masked out ?...
1255 unsigned maskSide = 2;
1256
1257 //...1. Check by # of super layers...
1258 if (NSuperLayers(l[0]) < NSuperLayers(l[1])) maskSide = 0;
1259 else if (NSuperLayers(l[0]) > NSuperLayers(l[1])) maskSide = 1;
1260#ifdef TRKRECO_DEBUG_DETAIL
1261 std::cout << " NSuperLayers 0, 1 = " << NSuperLayers(l[0]) << ", ";
1262 std::cout << NSuperLayers(l[1]) << std::endl;
1263#endif
1264 if (maskSide != 2) {
1265 maskOut(t, l[maskSide]);
1266 return;
1267 }
1268
1269 //...Make two tracks...
1270 TTrack * tt[2];
1271 tt[0] = new TTrack(t);
1272 tt[1] = new TTrack(t);
1273 tt[0]->remove(l[1]);
1274 tt[1]->remove(l[0]);
1275 _fitter.fit(* tt[0]);
1276 _fitter.fit(* tt[1]);
1277 Helix h0 = Helix(tt[0]->helix());
1278 Helix h1 = Helix(tt[1]->helix());
1279
1280 //...Check by z...
1281 h0.pivot(ORIGIN);
1282 h1.pivot(ORIGIN);
1283 if (fabs(h0.dz()) < fabs(h1.dz())) maskSide = 1;
1284 else maskSide = 0;
1285
1286 delete tt[0];
1287 delete tt[1];
1288 maskOut(t, l[maskSide]);
1289 return;
1290}
const HepPoint3D & pivot(void) const
returns pivot position.
void remove(TMLink &a)
removes a TMLink.
void maskOut(TTrack &, const AList< TMLink > &) const

Referenced by mask().

◆ maskCurl() [2/2]

void TTrackManager::maskCurl ( TTrack ) const

◆ maskCurlHits() [1/2]

void TTrackManager::maskCurlHits ( const AList< TMDCWireHit > &  axial,
const AList< TMDCWireHit > &  stereo,
const AList< TTrack > &  tracks 
) const

masks hits on found curl tracks.

Definition at line 175 of file TTrackManager.cxx.

177 {
178//...Coded by jtanaka...
179
180 int i = 0;
181 while(const TTrack *t = tracks[i++]){
182 int j = 0;
183 while(TMDCWireHit *a = axial[j++]){
184 double x = t->helix().center().x() - a->xyPosition().x();
185 double y = t->helix().center().y() - a->xyPosition().y();
186 double r = sqrt(x*x+y*y);
187 double R = fabs(t->helix().radius());
188 double q = t->helix().center().x()*a->xyPosition().y() -
189 t->helix().center().y()*a->xyPosition().x();
190 double qq = q*t->charge();
191 if(R-2. < r && r < R+2. && qq > 0.){
192 a->state(a->state() | WireHitUsed);
193 }
194 }
195 j = 0;
196 while(TMDCWireHit *s = stereo[j++]){
197 double x = t->helix().center().x() - s->xyPosition().x();
198 double y = t->helix().center().y() - s->xyPosition().y();
199 double r = sqrt(x*x+y*y);
200 double R = fabs(t->helix().radius());
201 double q = t->helix().center().x()*s->xyPosition().y() -
202 t->helix().center().y()*s->xyPosition().x();
203 double qq = q*t->charge();
204 if(R-2.5 < r && r < R+2.5 && qq > 0.){
205 s->state(s->state() | WireHitUsed);
206 }
207 }
208 }
209}
Double_t x[10]
****INTEGER imax DOUBLE PRECISION m_pi *DOUBLE PRECISION m_amfin DOUBLE PRECISION m_Chfin DOUBLE PRECISION m_Xenph DOUBLE PRECISION m_sinw2 DOUBLE PRECISION m_GFermi DOUBLE PRECISION m_MfinMin DOUBLE PRECISION m_ta2 INTEGER m_out INTEGER m_KeyFSR INTEGER m_KeyQCD *COMMON c_Semalib $ !copy of input $ !CMS energy $ !beam mass $ !final mass $ !beam charge $ !final charge $ !smallest final mass $ !Z mass $ !Z width $ !EW mixing angle $ !Gmu Fermi $ alphaQED at q
Definition: KKsem.h:33
complex_t R(double Q2, double M2, double G, double Mp2, double Mm2)
Definition: TUtil.h:27

Referenced by TrkReco::execute().

◆ maskCurlHits() [2/2]

void TTrackManager::maskCurlHits ( const AList< TMDCWireHit > &  axial,
const AList< TMDCWireHit > &  stereo,
const AList< TTrack > &  tracks 
) const

masks hits on found curl tracks.

◆ maskMultiHits() [1/2]

void TTrackManager::maskMultiHits ( TTrack t) const

Definition at line 1127 of file TTrackManager.cxx.

1127 {
1128#ifdef TRKRECO_DEBUG_DETAIL
1129 std::cout << "... masking multi-hits" << std::endl;
1130#endif
1131
1132 if (! t.cores().length()) return;
1133 AList<TMLink> cores = t.cores();
1134 unsigned n = cores.length();
1135 bool layerLimited = false;
1136 AList<TMLink> bads;
1137
1138 cores.sort(SortByWireId);
1139 for (unsigned i = 0; i < n; i++) {
1140 if (layerLimited) {
1141 bads.append(cores[i]);
1142 continue;
1143 }
1144 AList<TMLink> linksInLayer =
1145 SameLayer(cores, cores[i]->wire()->layerId());
1146 if (linksInLayer.length() > 3) {
1147 bads.append(cores[i]);
1148 layerLimited = true;
1149 }
1150 }
1151 maskOut(t, bads);
1152}

Referenced by mask().

◆ maskMultiHits() [2/2]

void TTrackManager::maskMultiHits ( TTrack ) const

◆ maskNormal() [1/2]

void TTrackManager::maskNormal ( TTrack t) const

Definition at line 1155 of file TTrackManager.cxx.

1155 {
1156
1157 //...Divide into two tracks...
1158 AList<TMLink> l[2];
1159 TMLink & start = divideByIp(t, l);
1160
1161#ifdef TRKRECO_DEBUG_DETAIL
1162 std::cout << " normal : divided by IP" << std::endl;
1163 std::cout << " 0=";
1164 for (unsigned j = 0; j < l[0].length(); j++) {
1165 std::cout << "," << l[0][j]->wire()->name();
1166 }
1167 std::cout << std::endl;
1168 std::cout << " 1=";
1169 for (unsigned j = 0; j < l[1].length(); j++) {
1170 std::cout << "," << l[1][j]->wire()->name();
1171 }
1172 std::cout << std::endl;
1173#endif
1174
1175 //...Which should be masked out ?...
1176 unsigned maskSide = 2;
1177
1178 //...1. Check by # of super layers...
1179 if (NSuperLayers(l[0]) < NSuperLayers(l[1])) maskSide = 0;
1180 else if (NSuperLayers(l[0]) > NSuperLayers(l[1])) maskSide = 1;
1181#ifdef TRKRECO_DEBUG_DETAIL
1182 std::cout << " NSuperLayers 0, 1 = " << NSuperLayers(l[0]) << ", ";
1183 std::cout << NSuperLayers(l[1]) << std::endl;
1184#endif
1185 if (maskSide != 2) {
1186 maskOut(t, l[maskSide]);
1187 return;
1188 }
1189
1190 //...2. Check by the inner-most layer...
1191 unsigned i0 = InnerMost(l[0])->wire()->layerId();
1192 unsigned i1 = InnerMost(l[1])->wire()->layerId();
1193 if (i0 < i1) maskSide = 1;
1194 else if (i0 > i1) maskSide = 0;
1195#ifdef TRKRECO_DEBUG_DETAIL
1196 std::cout << " i0, i1 = " << i0 << ", " << i1 << std::endl;
1197#endif
1198 if (maskSide != 2) {
1199 maskOut(t, l[maskSide]);
1200 return;
1201 }
1202
1203 //...3. Check by # of layers...
1204 if (NLayers(l[0]) < NLayers(l[1])) maskSide = 0;
1205 else if (NLayers(l[0]) > NLayers(l[1])) maskSide = 1;
1206#ifdef TRKRECO_DEBUG_DETAIL
1207 std::cout << " NLayers 0, 1 = " << NLayers(l[0]) << ", ";
1208 std::cout << NLayers(l[1]) << std::endl;
1209#endif
1210 if (maskSide != 2) {
1211 maskOut(t, l[maskSide]);
1212 return;
1213 }
1214
1215 //...4. Check by pt...
1216 if (maskSide == 2) {
1217 TTrack * tt[2];
1218 for (unsigned j = 0; j < 2; j++) {
1219 tt[j] = new TTrack(t);
1220 tt[j]->remove(l[j]);
1221 _fitter.fit(* tt[j]);
1222 }
1223 if (tt[1]->pt() > tt[0]->pt()) maskSide = 1;
1224 else maskSide = 0;
1225#ifdef TRKRECO_DEBUG_DETAIL
1226 std::cout << " pt 0 = " << tt[1]->pt() << std::endl;
1227 std::cout << " pt 1 = " << tt[0]->pt() << std::endl;
1228#endif
1229 delete tt[0];
1230 delete tt[1];
1231 }
1232 maskOut(t, l[maskSide]);
1233 return;
1234}
double pt(void) const
returns Pt.

Referenced by mask().

◆ maskNormal() [2/2]

void TTrackManager::maskNormal ( TTrack ) const

◆ maskOut() [1/2]

void TTrackManager::maskOut ( TTrack t,
const AList< TMLink > &  links 
) const

Definition at line 1112 of file TTrackManager.cxx.

1112 {
1113 unsigned n = links.length();
1114 if (! n) return;
1115 for (unsigned i = 0; i < n; i++) {
1116 const TMDCWireHit & hit = * links[i]->hit();
1117 hit.state(hit.state() | WireHitInvalidForFit);
1118 }
1119 t._fitted = false;
1120
1121#ifdef TRKRECO_DEBUG_DETAIL
1122 Dump(links, "detail", " TTrackManager::maskOut ... masking ");
1123#endif
1124}
unsigned state(void) const
returns state.

Referenced by maskCurl(), maskMultiHits(), and maskNormal().

◆ maskOut() [2/2]

void TTrackManager::maskOut ( TTrack ,
const AList< TMLink > &   
) const

◆ maxMomentum() [1/2]

double TTrackManager::maxMomentum ( double  a)
inline

sets the max. momentum.

Definition at line 287 of file InstallArea/include/TrkReco/TrkReco/TTrackManager.h.

287 {
288 return _maxMomentum = a;
289}

Referenced by TrkReco::initialize().

◆ maxMomentum() [2/2]

double TTrackManager::maxMomentum ( double  )

sets the max. momentum.

◆ merge() [1/2]

void TTrackManager::merge ( void  )

Definition at line 1547 of file TTrackManager.cxx.

1547 {
1548
1549 //...Merging...
1550 unsigned n = _tracks.length();
1551 //cout<<"tracks: "<<n<<endl;
1552 AList<TTrack> bads;
1553 unsigned * flagTrk = (unsigned *) malloc(n * sizeof(unsigned));
1554 for (unsigned i = 0; i < n; i++) flagTrk[i] = 0;
1555
1556 //...Search a track to be merged...
1557 for (unsigned i0 = 0; i0 < n; i0++) {
1558
1559 if (flagTrk[i0] != 0) continue;
1560 TTrack & t0 = * _tracks[i0];
1561 if (! (t0.pt() < 0.13)) continue;
1562
1563 unsigned Noverlap(0), Nall(0);
1564 float OverlapRatioMax(-999.);
1565 unsigned MaxID(0);
1566
1567 for (unsigned i1= 0 ; i1 < n; i1++) {
1568
1569 if (i0 == i1 || flagTrk[i1] != 0) continue;
1570 TTrack & t1 = * _tracks[i1];
1571 if (! (t1.pt() < 0.13)) continue;
1572 Nall = t1.links().length();
1573 if (! Nall) continue;
1574
1575 Noverlap = 0;
1576 for (unsigned j = 0; j < Nall; j++) {
1577 TMLink & l = * t1.links()[j];
1578 const TMDCWireHit & whit = * l.hit();
1579 double load(3.);//jialk original is 2
1580 if (whit.state() & WireHitStereo) load = 4.;//jialk original is 3
1581
1582 double x = t0.helix().center().x() - l.positionOnTrack().x();
1583 double y = t0.helix().center().y() - l.positionOnTrack().y();
1584 double r = sqrt(x * x + y * y);
1585 double R = fabs(t0.helix().radius());
1586
1587 if ((R - load) < r && r < (R + load)) Noverlap++;
1588 }
1589
1590 if (! Noverlap) continue;
1591 float tmpRatio = float(Noverlap) / float(Nall);
1592
1593 if (tmpRatio > OverlapRatioMax) {
1594 OverlapRatioMax = tmpRatio;
1595 MaxID = i1;
1596 }
1597 }
1598 //jialk caution original is 0.8
1599 if (OverlapRatioMax < 0.7) continue;
1600
1601 //...Mask should be done...
1602 unsigned MaskID[2] = {MaxID , i0};
1603 AList<TMLink> l[2];
1604
1605 for( unsigned j0=0;j0<2;j0++){
1606 for( unsigned j1=0;j1< _tracks[MaskID[j0]]->nLinks();j1++){
1607 TMLink &k = * _tracks[MaskID[j0]]->links()[j1];
1608 l[j0].append( k );
1609 }
1610 }
1611 // _tracks[i0]->links().append( _tracks[MaxID]->links() );
1612 // _tracks[MaxID]->links().append( _tracks[i0]->links ());
1613 _tracks[i0]->append(_tracks[MaxID]->links());
1614 _tracks[MaxID]->append(_tracks[i0]->links());
1615
1616#ifdef TRKRECO_DEBUG_DETAIL
1617 std::cout << " mask & merge " << std::endl;
1618 std::cout << " 0:";
1619 Dump(l[0], "flag sort");
1620 std::cout << " 1:";
1621 Dump(l[1], "flag sort");
1622 std::cout << std::endl;
1623#endif
1624
1625 //...Which should be masked out ?...
1626 unsigned maskSide = 2;
1627
1628#if 0
1629 //...0. Check by # of super layers... ( not applied now )
1630 unsigned super0 = NSuperLayers(l[0]);
1631 unsigned super1 = NSuperLayers(l[1]);
1632
1633 if( super0 < super1 ) maskSide = 0;
1634 else if ( super0 > super1 ) maskSide = 1;
1635
1636#ifdef TRKRECO_DEBUG_DETAIL
1637 std::cout << " NSuperLayers 0, 1 = " << NSuperLayers(l[0]) << ", ";
1638 std::cout << NSuperLayers(l[1]) << std::endl;
1639#endif
1640
1641 if (maskSide == 2) {
1642#endif
1643
1644 //...1. Check by the inner-most layer...
1645 unsigned inner0 = InnerMost(l[0])->wire()->layerId();
1646 unsigned inner1 = InnerMost(l[1])->wire()->layerId();
1647 if (inner0 < inner1 ) maskSide = 1;
1648 else if (inner0 > inner1) maskSide = 0;
1649
1650 if( maskSide == 2 ){
1651
1652 //...2. Check by dz
1653
1654 //...Make two tracks...
1655 TTrack * tt[2];
1656 tt[0] = new TTrack( *(_tracks[MaskID[0]]));
1657 tt[1] = new TTrack( *(_tracks[MaskID[1]]));
1658 _fitter.fit(* tt[0]);
1659 _fitter.fit(* tt[1]);
1660 Helix h0 = Helix(tt[0]->helix());
1661 Helix h1 = Helix(tt[1]->helix());
1662
1663 //...Check dz...
1664 h0.pivot(ORIGIN);
1665 h1.pivot(ORIGIN);
1666 if (fabs(h0.dz()) < fabs(h1.dz())) maskSide = 1;
1667 else maskSide = 0;
1668
1669 delete tt[0];
1670 delete tt[1];
1671 }
1672#if 0
1673 }
1674#endif
1675 bads.append(_tracks[MaskID[maskSide]]);
1676 flagTrk[MaskID[maskSide]] = 1;
1677 }
1678
1679 //cout<<"bads: "<<bads.length()<<endl;
1680 _tracks.remove(bads);
1681
1682 //***** Masking *****
1683 n = _tracks.length();
1684
1685 for( unsigned i=0;i<n;i++){
1686 TTrack & t = * _tracks[i];
1687 for( unsigned j=0;j<t.links().length();j++){
1688 TMLink & l = * t.links()[j];
1689 const TMDCWireHit & whit = * l.hit();
1690
1691 if( !(whit.state() & WireHitFittingValid) ) continue;
1692
1693 // within half circle or not?
1694 double q = t.helix().center().x() * l.positionOnTrack().y() -
1695 t.helix().center().y() * l.positionOnTrack().x();
1696 double qq = q *t.charge();
1697
1698 if( qq > 0 ) whit.state(whit.state() & ~WireHitInvalidForFit);
1699 else whit.state(whit.state() | WireHitInvalidForFit);
1700 }
1701 }
1702
1703 free(flagTrk);
1704}
const HepPoint3D & center(void) const
returns position of helix center(z = 0.);
double radius(void) const
returns radious of helix.
const AList< TMLink > & links(unsigned mask=0) const
returns a list of masked TMLinks assigned to this track. 'mask' will be applied if mask is not 0.
Definition: TTrackBase.cxx:297
const Helix & helix(void) const
returns helix parameter.

Referenced by TrkReco::execute().

◆ merge() [2/2]

void TTrackManager::merge ( void  )

◆ movePivot() [1/2]

void TTrackManager::movePivot ( void  )

moves pivot of tracks.

Definition at line 843 of file TTrackManager.cxx.

843 {
844 unsigned n = _tracksAll.length();
845 // unsigned n = _tracks.length();
846 for (unsigned i = 0; i < n; i++) {
847 if (_tracksAll[i]->nLinks()) _tracksAll[i]->movePivot();
848 // if (_tracks[i]->nLinks()) _tracks[i]->movePivot();
849 }
850 nameTracks();
851}

Referenced by finish().

◆ movePivot() [2/2]

void TTrackManager::movePivot ( void  )

moves pivot of tracks.

◆ name() [1/2]

std::string TTrackManager::name ( void  ) const
inline

returns name.

Definition at line 263 of file InstallArea/include/TrkReco/TrkReco/TTrackManager.h.

263 {
264 return std::string("Track Manager");
265}

Referenced by finish(), makeTds(), mask(), refit(), and salvage().

◆ name() [2/2]

std::string TTrackManager::name ( void  ) const

returns name.

◆ paraT0() [1/2]

float TTrackManager::paraT0 ( void  ) const
inline

Definition at line 320 of file InstallArea/include/TrkReco/TrkReco/TTrackManager.h.

320 {
321 return _t0;
322}

Referenced by TrkReco::execute().

◆ paraT0() [2/2]

float TTrackManager::paraT0 ( void  ) const

◆ refit() [1/2]

void TTrackManager::refit ( void  )

refits tracks.

Definition at line 904 of file TTrackManager.cxx.

904 {
905#ifdef TRKRECO_DEBUG_DETAIL
906 std::cout << name() << " ... refitting" << std::endl;
907#endif
908 unsigned n = _tracks.length();
909 AList<TTrack> bads;
910 for (unsigned i = 0; i < n; i++) {
911 TTrack & t = * _tracks[i];
912 int err;
913 err = _fitter.fit(t);
914 if (err < 0) {
915 bads.append(t);
916#ifdef TRKRECO_DEBUG_DETAIL
917 std::cout << " " << t.name();
918 std::cout << " rejected because of fitting failure" << std::endl;
919#endif
920 continue;
921 }
922 t.refine(30. * 10.);
923 err = _fitter.fit(t);
924 if (err < 0) {
925 bads.append(t);
926#ifdef TRKRECO_DEBUG_DETAIL
927 std::cout << " " << t.name();
928 std::cout << " rejected because of fitting failure" << std::endl;
929#endif
930 continue;
931 }
932 t.refine(30. * 1.);
933 err = _fitter.fit(t);
934 if (err < 0) {
935 bads.append(t);
936#ifdef TRKRECO_DEBUG_DETAIL
937 std::cout << " " << t.name();
938 std::cout << " rejected because of fitting failure" << std::endl;
939#endif
940 continue;
941 }
942 }
943 _tracks.remove(bads);
944}

Referenced by finish().

◆ refit() [2/2]

void TTrackManager::refit ( void  )

refits tracks.

◆ removeHitsAcrossOverIp() [1/2]

void TTrackManager::removeHitsAcrossOverIp ( AList< TMLink > &  l) const

Definition at line 1072 of file TTrackManager.cxx.

1072 {
1073
1074 //...Calculate average phi...
1075 unsigned n = l.length();
1076 float phiSum = 0.;
1077 for (unsigned i = 0; i < n; i++) {
1078 const TMDCWire & w = * l[i]->hit()->wire();
1079 unsigned j = w.localId();
1080 unsigned nWire = w.layer()->nWires();
1081
1082 float phi = (float) j / (float) nWire;
1083 phiSum += phi;
1084 }
1085 float average = phiSum / (float) n;
1086
1088 for (unsigned i = 0; i < n; i++) {
1089 const TMDCWire & w = * l[i]->hit()->wire();
1090 unsigned j = w.localId();
1091 unsigned nWire = w.layer()->nWires();
1092
1093 float phi = (float) j / (float) nWire;
1094 float dif = fabs(phi - average);
1095 if (dif > 0.5) dif = 1. - dif;
1096
1097 if (dif > 0.3) cross.append(l[i]);
1098 }
1099 l.remove(cross);
1100
1101#ifdef TRKRECO_DEBUG_DETAIL
1102 std::cout << " Cross over IP reduction : ";
1103 for (unsigned i = 0; i < cross.length(); i++) {
1104 std::cout << cross[i]->wire()->name() << ",";
1105 }
1106 std::cout << std::endl;
1107#endif
1108}
EvtVector3R cross(const EvtVector3R &p1, const EvtVector3R &p2)
Definition: EvtVector3R.cc:84
unsigned nWires(void) const
returns # of wires.
A class to represent a wire in MDC.
const TMDCLayer *const layer(void) const
returns a pointer to a layer.

◆ removeHitsAcrossOverIp() [2/2]

void TTrackManager::removeHitsAcrossOverIp ( AList< TMLink > &  ) const

◆ salvage() [1/2]

void TTrackManager::salvage ( const AList< TMDCWireHit > &  hits) const

salvages remaining hits.

Definition at line 212 of file TTrackManager.cxx.

212 {
213
214#ifdef TRKRECO_DEBUG_DETAIL
215 std::cout << name() << " ... salvaging" << std::endl;
216 std::cout << " # of given hits=" << hits.length() << std::endl;
217#endif
218
219 //...Check arguments...
220 unsigned nTracks = _tracks.length();
221 if (nTracks == 0) return;
222 unsigned nHits = hits.length();
223 if (nHits == 0) return;
224
225 //...Hit loop...
226 for (unsigned i = 0; i < nHits; i++) {
227 TMDCWireHit & h = * hits[i];
228
229 //...Already used?...
230 if (h.state() & WireHitUsed) continue;
231#ifdef TRKRECO_DEBUG_DETAIL
232 std::cout << " checking " << h.wire()->name() << std::endl;
233#endif
234
235 //...Select the closest track to a hit...
236 TTrack * best = closest(_tracks, h);
237#ifdef TRKRECO_DEBUG_DETAIL
238 if (! best) {
239 std::cout << " no track candidate returned";
240 std::cout << "by TTrackManager::closest" << std::endl;
241 }
242#endif
243 if (! best) continue;
244
245 //...Try to append this hit...
246 AList<TMLink> link;
247 link.append(new TMLink(0, & h));
248 best->appendByApproach(link, 30.);
249 // best->assign(WireHitConformalFinder);
251 }
252}
void appendByApproach(AList< TMLink > &list, double maxSigma)
appends TMLinks by approach. 'list' is an input. Unappended TMLinks will be removed from 'list' when ...
Definition: TTrackBase.cxx:101
TTrack * closest(const AList< TTrack > &, const TMDCWireHit &) const
returns a track which is the closest to a hit.
unsigned finder(void) const
sets/returns finder.

Referenced by TrkReco::execute().

◆ salvage() [2/2]

void TTrackManager::salvage ( const AList< TMDCWireHit > &  ) const

salvages remaining hits.

◆ salvageAssociateHits() [1/2]

void TTrackManager::salvageAssociateHits ( const AList< TMDCWireHit > &  hits,
float  maxSigma2 
)

salvages hits for dE/dx(not for track fitting).

Definition at line 2378 of file TTrackManager.cxx.

2379 {
2380 //#define TRKRECO_DEBUG
2381 //#define TRKRECO_DEBUG_DETAIL
2382
2383#ifdef TRKRECO_DEBUG
2384 std::cout << "... trkmgr::salvaging associate hits" << std::endl;
2385 std::cout << " # of given hits=" << hits.length() << std::endl;
2386#endif
2387
2388 //...Check arguments...
2389 unsigned nTracks = _tracks.length();
2390 if (nTracks == 0) return;
2391 unsigned nHits = hits.length();
2392 if (nHits == 0) return;
2393
2394 static const TPoint2D o(0., 0.);
2395
2396 //...Hit loop...
2397 for (unsigned i = 0; i < nHits; i++) {
2398 TMDCWireHit & h = * hits[i];
2399
2400 //...Already used?...
2401 if (h.state() & WireHitUsed) continue;
2402#ifdef TRKRECO_DEBUG_DETAIL
2403 std::cout << " checking " << h.wire()->name();
2404#endif
2405
2406 //...Track loop...
2407 AList<TMLink> toBeDeleted;
2408 TMLink * best = NULL;
2409 TTrack * bestTrack = NULL;
2410 for (unsigned j = 0; j < nTracks; j++) {
2411 TTrack & t = * _tracks[j];
2412
2413 //...Pre-selection...
2414 TPoint2D c = t.center();
2415 TPoint2D co = - c;
2416 TPoint2D x = h.wire()->xyPosition();
2417
2418#ifdef TRKRECO_DEBUG_DETAIL
2419 std::cout << " : c= " << co.cross(x - c) * t.charge();
2420 std::cout << ", d=" << fabs((x - c).mag() - fabs(t.radius()));
2421#endif
2422
2423 if (co.cross(x - c) * t.charge() > 0.)
2424 continue;
2425 if (fabs((x - c).mag() - fabs(t.radius())) > 5.)
2426 continue;
2427
2428 //...Try to append this hit...
2429 TMLink & link = * new TMLink(0, & h);
2430 int err = t.approach(link);
2431 if (err < 0) {
2432#ifdef TRKRECO_DEBUG_DETAIL
2433 std::cout << " : " << t.name() << " approach failure";
2434#endif
2435 toBeDeleted.append(link);
2436 continue;
2437 }
2438
2439 //...Calculate sigma...
2440 float distance = link.distance();
2441 float diff = fabs(distance - link.hit()->drift());
2442 float sigma = diff / link.hit()->dDrift();
2443 link.pull(sigma * sigma);
2444
2445#ifdef TRKRECO_DEBUG_DETAIL
2446 std::cout << " : " << t.name() << " pull = " << link.pull();
2447#endif
2448 if (link.pull() > maxSigma2) {
2449 toBeDeleted.append(link);
2450 continue;
2451 }
2452
2453 if (best) {
2454 if (best->pull() > link.pull()) {
2455 toBeDeleted.append(best);
2456 best = & link;
2457 bestTrack = & t;
2458 }
2459 else {
2460 toBeDeleted.append(link);
2461 }
2462 }
2463 else {
2464 best = & link;
2465 bestTrack = & t;
2466 }
2467 }
2468
2469 if (best) {
2470 bestTrack->append(* best);
2471 best->hit()->state(best->hit()->state() | WireHitInvalidForFit);
2472 _associateHits.append(best);
2473#ifdef TRKRECO_DEBUG
2474 std::cout << " " << best->hit()->wire()->name();
2475 std::cout << " -> " << bestTrack->name() << std::endl;
2476#endif
2477 }
2478 HepAListDeleteAll(toBeDeleted);
2479
2480#ifdef TRKRECO_DEBUG_DETAIL
2481 std::cout << std::endl;
2482#endif
2483 }
2484}
float dDrift(unsigned) const
returns drift distance error.
float drift(unsigned) const
returns drift distance.
const HepPoint3D & xyPosition(void) const
returns middle position of a wire. z componet is 0.
A class to represent a point in 2D.
double cross(const TPoint2D &) const
void append(TMLink &)
appends a TMLink.
Definition: TTrackBase.cxx:362
const std::string & name(void) const
returns/sets name.

◆ salvageAssociateHits() [2/2]

void TTrackManager::salvageAssociateHits ( const AList< TMDCWireHit > &  ,
float  maxSigma2 
)

salvages hits for dE/dx(not for track fitting).

◆ saveMCTables() [1/2]

void TTrackManager::saveMCTables ( void  ) const

stores MC track info. into Panther table.

Definition at line 797 of file TTrackManager.cxx.

797 {
798 unsigned n = _tracksFinal.length();
799 for (unsigned i = 0; i < n; i++) {
800 const TTrack & t = * _tracksFinal[i];
801
802 // struct reccdc_trk * r;
803 // r = (struct reccdc_trk *) BsGetEnt(RECMDC_TRK, i + 1, BBS_No_Index);
805
806 //...Set type...
807
808 //...Hit loop...
809 const AList<TMLink> & hits = t.finalHits();
810 unsigned nHits = hits.length();
811 for (unsigned j = 0; j < nHits; j++) {
812 TMLink * l = hits[j];
813 MdcRec_wirhit * h = l->hit()->reccdc();
814 MdcDat_mcwirhit * m = l->hit()->mc()->datcdc();
815 m->trk = r;
816 // struct reccdc_mctrk2hep * c;
817 // c = (struct reccdc_mctrk2hep *) BsNewEnt(RECMDC_MCTRK2HEP);
820 c->wir = h;
821 c->trk = r;
822 c->hep = l->hit()->mc()->hep()->gen();
823 }
824
825 const TTrackMC * const mc = t.mc();
826 // struct reccdc_mctrk * m;
827 // m = (struct reccdc_mctrk *) BsNewEnt(RECMDC_MCTRK);
828 // // MdcRec_mctrk* m = &(*MdcRecMctrkCol::getMdcRecMctrkCol())[0];
829 MdcRec_mctrk* m = new MdcRec_mctrk;
830 MdcRecMctrkCol::getMdcRecMctrkCol()->push_back(*m);
831 m->wirFrac = mc->wireFraction();
832 m->wirFracHep = mc->wireFractionHEP();
833 m->charge = mc->charge();
834 m->ptFrac = mc->ptFraction();
835 m->pzFrac = mc->pzFraction();
836 m->quality = mc->quality();
837 if (mc->hep()) m->hep = mc->hep()->gen();
838 else m->hep = 0;
839 }
840}
const TTrackHEP *const hep(void) const
returns a pointer to a GEN_HEPEVT.
MdcDat_mcwirhit * datcdc(void) const
returns a pointer to DATMDC_MCWIRHIT.
const TMDCWireHitMC *const mc(void) const
returns a pointer to TMDCWireHitMC.
const Gen_hepevt * gen(void) const
returns a pointer to Gen_hepevt.
A class to have MC information of TTrack.
double wireFractionHEP(void) const
returns wire fraction(F2).
const TTrackHEP *const hep(void) const
returns a pointer to TTrackHEP.
unsigned quality(void) const
returns quality.
bool charge(void) const
returns charge matching.
double ptFraction(void) const
returns pt fraction.
double pzFraction(void) const
returns pz fraction.
double wireFraction(void) const
returns wire fraction(F1).

◆ saveMCTables() [2/2]

void TTrackManager::saveMCTables ( void  ) const

stores MC track info. into Panther table.

◆ saveTables() [1/2]

void TTrackManager::saveTables ( void  )

stores track info. into Panther table.

Definition at line 652 of file TTrackManager.cxx.

652 {
653#ifdef TRKRECO_DEBUG
654 std::cout << "TTrackManager::saveTables ... # 3D tracks=" << _tracks.length()
655 << ", # 2D tracks=" << _tracks2D.length()
656 << ", all tracks=" << _tracksAll.length() << std::endl;
657#endif
658
659 //...For 3D tracks...
660 AList<TTrack> badTracks;
661 unsigned n = _tracks.length();
662 unsigned * id = (unsigned *) malloc(n * sizeof(unsigned));
663 // bzero((char *) id, n * sizeof(unsigned));
664 memset((char *) id, 0, n * sizeof(unsigned));
665 for (unsigned i = 0; i < n; i++) {
666 TTrack & t = * _tracks[i];
667 if (! t.nLinks()) {
668 badTracks.append((TTrack &) t);
669 continue;
670 }
671
672 //...Copy track parameters...
673 MdcRec_trk * r = 0;
674 MdcRec_trk_add * a = 0;
675 int err = copyTrack(t, & r, & a);
676 if (err) {
677 badTracks.append(t);
678 continue;
679 }
680 _tracksFinal.append(t);
681
682 //...Type and quality...
683 id[i] = r->id;
684 r->stat = t.state();
685 a->kind = t.type();
686 a->decision = t.finder();
687 a->stat = t.fitting();
688 // if (a->m_kind == TrackTypeCosmic) {
689 // a->m_quality = TrackQualityCosmic;
690 // }
691 // if (t.daughter() && (_tracks.index(t.daughter()) >= 0))
692 // a->m_daughter = _tracks.index(t.daughter()) + 1;
693
694 }
695
696 //...Daughter treatment...
697 for (unsigned i = 0; i < n; i++) {
698
699#ifdef TRKRECO_DEBUG_DETAIL
700 std::cout << "id[" << i << "]=" << id[i] << std::endl;
701#endif
702 if (! (id[i])) continue;
703 if (! (_tracks[i]->daughter())) continue;
704
705 int dId = _tracks.index(_tracks[i]->daughter());
706
707#ifdef TRKRECO_DEBUG_DETAIL
708 std::cout << " dId=" << dId;
709 if (dId >= 0) std::cout << ", id[dId]=" << id[dId];
710 std::cout << std::endl;
711#endif
712
713 if (dId >= 0) {
714 if (id[dId]) {
715 // reccdc_trk_add * a = (reccdc_trk_add *)
716 // BsGetEnt(RECMDC_TRK_ADD, id[i], BBS_No_Index);
717 // a->m_daughter = id[dId];
719 }
720 }
721 }
722 free(id);
723
724 //...Remove bad tracks...
725 _tracks.remove(badTracks);
726 badTracks.removeAll();
727
728 //...For 2D tracks...
729 n = _tracks2D.length();
730 for (unsigned i = 0; i < n; i++) {
731 TTrack & t = * _tracks2D[i];
732
733 //...Copy track parameters...
734 MdcRec_trk * r = 0;
735 MdcRec_trk_add * a = 0;
736 int err = copyTrack(t, & r, & a);
737 if (err) {
738#ifdef TRKRECO_DEBUG
739 std::cout << "TTrackManager::saveTables !!! bad 2D tracks found"
740 << " : err=" << err << std::endl
741 << TrackDump(t) << std::endl;
742#endif
743 badTracks.append(t);
744 continue;
745 }
746 _tracksFinal.append(t);
747
748 //...Reset helix parameter...
749 // r->m_helix[3] = 0.;
750 // r->m_helix[4] = 0.;
751 // r->m_nhits -= r->m_nster;
752 // r->m_nster = 0;
753
754 //...Table filling...
755 r->stat = t.state();
756 a->kind = t.type();
757 a->decision = t.finder();
758 // a->m_quality = t.quality();
760 a->stat = t.fitting();
761
762#ifdef TRKRECO_DEBUG
763 if ((r->ndf == 0) && (r->chiSq > 0.)) {
764 std::cout << "TTrackManager::saveTables !!! chisq>0 with ndf=0."
765 << std::endl
766 << " Here is a track dump"
767 << " " << TrackDump(t) << std::endl;
768 t.dump("detail");
769 }
770 if ((r->ndf > 0) && (r->chiSq == 0.)) {
771 std::cout << "TTrackManager::saveTables !!! chisq=0 with ndf>0."
772 << std::endl
773 << " Here is a track dump"
774 << " " << TrackDump(t) << std::endl;
775 t.dump("detail");
776 }
777
778 if (r->ndf == 0)
779 std::cout << "TTrackManager::saveTables ... ndf = 0" << std::endl
780 << " " << TrackDump(t) << std::endl;
781 if (r->chiSq == 0.)
782 std::cout << "TTrackManager::saveTables ... chisq = 0" << std::endl
783 << " " << TrackDump(t) << std::endl;
784#endif
785 }
786 _tracks2D.remove(badTracks);
787
788 //...Statistics...
789 ++_s->_nEvents;
790 _s->_nTracks += _tracks.length();
791 _s->_nTracksAll += _tracksAll.length();
792 _s->_nTracks2D += _tracks2D.length();
793 _s->_nTracksFinal += _tracksFinal.length();
794}

◆ saveTables() [2/2]

void TTrackManager::saveTables ( void  )

stores track info. into Panther table.

◆ setCurlerFlags() [1/2]

void TTrackManager::setCurlerFlags ( void  )

tests for curlers.

Definition at line 2341 of file TTrackManager.cxx.

2341 {
2342 unsigned n = _tracks.length();
2343 if (n < 2) return;
2344
2345 for (unsigned i = 0; i < n - 1; i++) {
2346 TTrack & t0 = * _tracks[i];
2347 if (t0.type() != TrackTypeCurl) continue;
2348 float c0 = t0.charge();
2349
2350 for (unsigned j = i + 1; j < n; j++) {
2351 TTrack & t1 = * _tracks[j];
2352 float c1 = t1.charge();
2353 if (c0 * c1 > 0.) continue;
2354 if (t1.type() != TrackTypeCurl) continue;
2355
2356 bool toBeMerged = false;
2357 unsigned n0 = t0.testByApproach(t1.cores(), _sigmaCurlerMergeTest);
2358 if (n0 > _nCurlerMergeTest) toBeMerged = true;
2359 if (! toBeMerged) {
2360 unsigned n1 = t1.testByApproach(t0.cores(),
2361 _sigmaCurlerMergeTest);
2362 if (n1 > _nCurlerMergeTest) toBeMerged = true;
2363 }
2364
2365 if (toBeMerged) {
2366 // ++_s->_nToBeMerged;
2367 if ((t0.daughter()) || (t1.daughter()))
2368 ++_s->_nToBeMergedMoreThanTwo;
2369 t0.daughter(& t1);
2370 t1.daughter(& t0);
2371
2372 }
2373 }
2374 }
2375}
int n1
Definition: SD0Tag.cxx:54
unsigned testByApproach(const TMLink &list, double sigma) const
returns # of good hits to be appended.
Definition: TTrackBase.cxx:255
const AList< TMLink > & cores(unsigned mask=0) const
returns a list of masked TMLinks for fit. 'mask' will be applied if mask is not 0.
Definition: TTrackBase.cxx:317
unsigned type(void) const
returns type. Definition is depending on an object type.
double charge(void) const
returns charge.

◆ setCurlerFlags() [2/2]

void TTrackManager::setCurlerFlags ( void  )

tests for curlers.

◆ sett0bes() [1/2]

void TTrackManager::sett0bes ( double  t0)
inline

Definition at line 211 of file InstallArea/include/TrkReco/TrkReco/TTrackManager.h.

211 {
212 t0bes = t0;
213 }

Referenced by TrkReco::execute().

◆ sett0bes() [2/2]

void TTrackManager::sett0bes ( double  t0)
inline

Definition at line 211 of file Reconstruction/TrkReco/TrkReco-00-08-59-patch4-slc6tag/TrkReco/TTrackManager.h.

211 {
212 t0bes = t0;
213 }

◆ sortBanksByPt() [1/2]

void TTrackManager::sortBanksByPt ( void  ) const

sorts RECMDC_TRK tables.

Definition at line 2012 of file TTrackManager.cxx.

2012 {
2013#ifdef TRKRECO_DEBUG_DETAIL
2014 std::cout << "trkmgr::sortBanksByPt : # of tracks="
2015 // << BsCouTab(RECMDC_TRK_ADD) << std::endl;
2016 << MdcRecTrkAddCol::getMdcRecTrkAddCol()->size() << std::endl;
2017#endif
2018
2019 // unsigned n = BsCouTab(RECMDC_TRK_ADD);
2020 unsigned n = MdcRecTrkAddCol::getMdcRecTrkAddCol()->size();
2021 if (n < 2) return;
2022
2023 //...Sort RECMDC...
2024 unsigned * id = (unsigned *) malloc(n * sizeof(unsigned));
2025 for (unsigned i = 0; i < n; i++) id[i] = i;
2026 for (unsigned i = 0; i < n - 1; i++) {
2027 // reccdc_trk & cdc0 =
2028 // * (reccdc_trk *) BsGetEnt(RECMDC_TRK,
2029 // i + 1,
2030 // BBS_No_Index);
2031 // reccdc_trk_add & add0 =
2032 // * (reccdc_trk_add *) BsGetEnt(RECMDC_TRK_ADD,
2033 // i + 1,
2034 // BBS_No_Index);
2035 // reccdc_mctrk & mc0 =
2036 // * (reccdc_mctrk *) BsGetEnt(RECMDC_MCTRK,
2037 // i + 1,
2038 // BBS_No_Index);
2039 MdcRec_trk & cdc0 = (* MdcRecTrkCol::getMdcRecTrkCol())[i];
2042
2043 float bestPt = 1. / fabs(cdc0.helix[2]);
2044 unsigned bestQuality = add0.quality;
2045 for (unsigned j = i + 1; j < n; j++) {
2046 // reccdc_trk & cdc1 =
2047 // * (reccdc_trk *) BsGetEnt(RECMDC_TRK,
2048 // j + 1,
2049 // BBS_No_Index);
2050 // reccdc_trk_add & add1 =
2051 // * (reccdc_trk_add *) BsGetEnt(RECMDC_TRK_ADD,
2052 // j + 1,
2053 // BBS_No_Index);
2054 // reccdc_mctrk & mc1 =
2055 // * (reccdc_mctrk *) BsGetEnt(RECMDC_MCTRK,
2056 // j + 1,
2057 // BBS_No_Index);
2058 MdcRec_trk & cdc1 = (* MdcRecTrkCol::getMdcRecTrkCol())[j];
2061
2062 float pt = 1. / fabs(cdc1.helix[2]);
2063#ifdef TRKRECO_DEBUG_DETAIL
2064 std::cout << "i,j=" << i << "," << j
2065 << " : quality i,j=" << bestQuality << ","
2066 << add1.quality << std::endl;
2067#endif
2068 unsigned quality = add1.quality;
2069 if (quality > bestQuality) continue;
2070 else if (quality < bestQuality) {
2071 bestQuality = quality;
2072 bestPt = pt;
2073 swapReccdc(cdc0, add0, mc0, cdc1, add1, mc1);
2074 unsigned tmp = id[i];
2075 id[i] = id[j];
2076 id[j] = tmp;
2077#ifdef TRKRECO_DEBUG_DETAIL
2078 std::cout << "swapped" << std::endl;
2079#endif
2080 continue;
2081 }
2082#ifdef TRKRECO_DEBUG_DETAIL
2083 std::cout << "i,j=" << i << "," << j
2084 << " : pt i,j=" << bestPt << "," << pt << std::endl;
2085#endif
2086 if (pt > bestPt) {
2087#ifdef TRKRECO_DEBUG_DETAIL
2088 std::cout << "swapping ... " << & cdc0 << "," << & add0 << ","
2089 << & mc0 << " <-> " << & cdc1 << "," << & add1 << ","
2090 << & mc1 << std::endl;
2091#endif
2092 bestQuality = quality;
2093 bestPt = pt;
2094 swapReccdc(cdc0, add0, mc0, cdc1, add1, mc1);
2095 unsigned tmp = id[i];
2096 id[i] = id[j];
2097 id[j] = tmp;
2098#ifdef TRKRECO_DEBUG_DETAIL
2099 std::cout << "swapped" << std::endl;
2100#endif
2101 }
2102 }
2103 }
2104#ifdef TRKRECO_DEBUG_DETAIL
2105 std::cout << "trkmgr::sortBanksByPt : first phase finished" << std::endl;
2106#endif
2107
2108 tagReccdc(id, n);
2109 free(id);
2110
2111#ifdef TRKRECO_DEBUG_DETAIL
2112 std::cout << "trkmgr::sortBanksByPt : second phase finished" << std::endl;
2113#endif
2114
2115#if 0
2116 //...Sort RECTRK...
2117 n = BsCouTab(RECTRK);
2118 id = (unsigned *) malloc(n * sizeof(unsigned));
2119 for (unsigned i = 0; i < n; i++) id[i] = i;
2120 if (n > 1) {
2121 unsigned i = 0;
2122 while (i < n - 1) {
2123 rectrk & t = * (rectrk *) BsGetEnt(RECTRK, i + 1, BBS_No_Index);
2124 if (t.m_prekal == (i + 1)) {
2125 ++i;
2126 continue;
2127 }
2128
2129 rectrk & s = * (rectrk *) BsGetEnt(RECTRK,
2130 t.m_prekal,
2131 BBS_No_Index);
2132
2133 swapRectrk(t, s);
2134 unsigned tmp = id[i];
2135 id[i] = id[s.m_ID - 1];
2136 id[s.m_ID - 1] = tmp;
2137
2138 //std::cout << "swap " << i + 1 << " and " << s.m_ID << std::endl;
2139
2140 reccdc_trk_add & a =
2141 * (reccdc_trk_add *) BsGetEnt(RECMDC_TRK_ADD,
2142 t.m_prekal,
2143 BBS_No_Index);
2144 reccdc_trk_add & b =
2145 * (reccdc_trk_add *) BsGetEnt(RECMDC_TRK_ADD,
2146 s.m_prekal,
2147 BBS_No_Index);
2148 a.m_rectrk = t.m_ID;
2149 b.m_rectrk = s.m_ID;
2150 }
2151 }
2152#else
2153 /*
2154 // jtanaka 000925 -->
2155 n = BsCouTab(RECTRK);
2156 id = (unsigned *) malloc(n * sizeof(unsigned));
2157 for (unsigned i = 0; i < n; i++) id[i] = i;
2158 int foundId = 0;
2159 while(foundId != n){
2160 rectrk & t = * (rectrk *) BsGetEnt(RECTRK, foundId + 1, BBS_No_Index);
2161 int minPrekal = t.m_prekal;
2162 int exchangeId = foundId;
2163 for(int i=foundId+1;i<n;++i){
2164 rectrk & s = * (rectrk *) BsGetEnt(RECTRK, i + 1, BBS_No_Index);
2165 if(s.m_prekal < minPrekal){
2166 minPrekal = s.m_prekal;
2167 exchangeId = i;
2168 }
2169 }
2170 if(exchangeId != foundId){
2171 rectrk & s = * (rectrk *) BsGetEnt(RECTRK,
2172 exchangeId + 1,
2173 BBS_No_Index);
2174
2175 swapRectrk(t, s);
2176 unsigned tmp = id[t.m_ID - 1];
2177 id[t.m_ID - 1] = id[s.m_ID - 1];
2178 id[s.m_ID - 1] = tmp;
2179
2180 reccdc_trk_add & a =
2181 * (reccdc_trk_add *) BsGetEnt(RECMDC_TRK_ADD,
2182 t.m_prekal,
2183 BBS_No_Index);
2184 reccdc_trk_add & b =
2185 * (reccdc_trk_add *) BsGetEnt(RECMDC_TRK_ADD,
2186 s.m_prekal,
2187 BBS_No_Index);
2188 a.m_rectrk = t.m_ID;
2189 b.m_rectrk = s.m_ID;
2190 }
2191 ++foundId;
2192 }
2193 // <-- jtanaka 000925
2194 */
2195#endif
2196
2197 tagRectrk(id, n);
2198 free(id);
2199}

◆ sortBanksByPt() [2/2]

void TTrackManager::sortBanksByPt ( void  ) const

sorts RECMDC_TRK tables.

◆ sortTracksByPt() [1/2]

void TTrackManager::sortTracksByPt ( void  )

Definition at line 1883 of file TTrackManager.cxx.

1883 {
1884#ifdef TRKRECO_DEBUG_DETAIL
1885 std::cout << "trkmgr::sortTracksByPt : # of tracks="
1886 << _tracks.length() << std::endl;
1887#endif
1888
1889 unsigned n = _tracks.length();
1890 if (n < 2) return;
1891
1892 for (unsigned i = 0; i < n - 1; i++) {
1893 TTrack & t0 = * _tracks[i];
1894 float bestPt = t0.pt();
1895 for (unsigned j = i + 1; j < n; j++) {
1896 TTrack & t1 = * _tracks[j];
1897 float pt = t1.pt();
1898#ifdef TRKRECO_DEBUG_DETAIL
1899 std::cout << "i,j=" << i << "," << j
1900 << " : pt i,j=" << bestPt << "," << pt << std::endl;
1901#endif
1902 if (pt > bestPt) {
1903 bestPt = pt;
1904 _tracks.swap(i, j);
1905 }
1906 }
1907 }
1908}

◆ sortTracksByPt() [2/2]

void TTrackManager::sortTracksByPt ( void  )

◆ sortTracksByQuality() [1/2]

void TTrackManager::sortTracksByQuality ( void  )

sorts tracks.

Definition at line 1862 of file TTrackManager.cxx.

1862 {
1863 unsigned n = _tracks.length();
1864 if (n < 2) return;
1865
1866 for (unsigned i = 0; i < n - 1; i++) {
1867 TTrack & t0 = * _tracks[i];
1868 float bestRChisq = HUGE_VAL;
1869 if (t0.ndf() > 0) bestRChisq = t0.chi2() / t0.ndf();
1870 for (unsigned j = i + 1; j < n; j++) {
1871 TTrack & t1 = * _tracks[j];
1872 float rChisq = HUGE_VAL;
1873 if (t1.ndf() > 0) rChisq = t1.chi2() / t1.ndf();
1874 if (rChisq < bestRChisq) {
1875 bestRChisq = rChisq;
1876 _tracks.swap(i, j);
1877 }
1878 }
1879 }
1880}
unsigned ndf(void) const
returns NDF.
double chi2(void) const
returns chi2.

◆ sortTracksByQuality() [2/2]

void TTrackManager::sortTracksByQuality ( void  )

sorts tracks.

◆ tracks() [1/2]

const AList< TTrack > & TTrackManager::tracks ( void  ) const
inline

returns a list of reconstructed tracks.

Definition at line 269 of file InstallArea/include/TrkReco/TrkReco/TTrackManager.h.

269 {
270 return _tracks;
271}

Referenced by closest(), TrkReco::execute(), maskBadHits(), and maskCurlHits().

◆ tracks() [2/2]

const AList< TTrack > & TTrackManager::tracks ( void  ) const

returns a list of reconstructed tracks.

◆ tracks2D() [1/2]

const AList< TTrack > & TTrackManager::tracks2D ( void  ) const
inline

returns a list of 2D tracks.

Definition at line 275 of file InstallArea/include/TrkReco/TrkReco/TTrackManager.h.

275 {
276 return _tracks2D;
277}

◆ tracks2D() [2/2]

const AList< TTrack > & TTrackManager::tracks2D ( void  ) const

returns a list of 2D tracks.

◆ tracksFinal() [1/2]

const AList< TTrack > & TTrackManager::tracksFinal ( void  ) const
inline

returns a list of tracks writen to MdcRec_trk.

Definition at line 314 of file InstallArea/include/TrkReco/TrkReco/TTrackManager.h.

314 {
315 return _tracksFinal;
316}

Referenced by TrkReco::tracks().

◆ tracksFinal() [2/2]

const AList< TTrack > & TTrackManager::tracksFinal ( void  ) const

returns a list of tracks writen to MdcRec_trk.

◆ treatCurler() [1/2]

void TTrackManager::treatCurler ( MdcTrk curl,
MdcRec_trk_add cdc,
unsigned  flag 
) const

final decision for a curler.

Definition at line 1911 of file TTrackManager.cxx.

1913 {
1914 //...Originally coded by j.tanaka...
1915
1916 //...Check inputs...
1917 if (trk1.zero[2] == 0) return;
1918 if (cdc1.daughter == 0) return;
1919
1920 //...The other side...
1921 // reccdc_trk_add & cdc2 = * (reccdc_trk_add *) BsGetEnt(RECMDC_TRK_ADD,
1922 // cdc1.m_daughter,
1923 // BBS_No_Index);
1924 // MdcRec_trk_add & cdc2 = (*MdcRecTrkAddCol::getMdcRecTrkAddCol())[cdc1.daughter.id];
1925 MdcRec_trk_add & cdc2 = * cdc1.daughter->add;
1926
1927 if (cdc2.daughter == 0) return;
1928 if (cdc2.rectrk == 0) return;
1929 // rectrk & trk2 = * (rectrk *) BsGetEnt(RECTRK, cdc2.m_rectrk, BBS_No_Index);
1930 MdcTrk & trk2 = * cdc2.rectrk;
1931
1932 if (trk2.zero[2] == 0) return;
1933
1934 //...Obtain RECTRK_LOCALZ...
1935 // rectrk_localz & z1 = * (rectrk_localz *) BsGetEnt(RECTRK_LOCALZ,
1936 // trk1.m_zero[2],
1937 // BBS_No_Index);
1938 // rectrk_localz & z2 = * (rectrk_localz *) BsGetEnt(RECTRK_LOCALZ,
1939 // trk2.m_zero[2],
1940 // BBS_No_Index);
1941 MdcTrk_localz & z1 = * trk1.zero[2];
1942 MdcTrk_localz & z2 = * trk2.zero[2];
1943
1944 //...Pointer to mother and daughter...
1945 MdcRec_trk_add * mother = & cdc1;
1946 MdcRec_trk_add * daughter = & cdc2;
1947
1948 // //...By dr...
1949 // if (flag == 1) {
1950 // float dr1 = fabs(z1.m_helix[0]);
1951 // float dr2 = fabs(z2.m_helix[0]);
1952 // if (dr1 > dr2) {
1953 // mother = & cdc2;
1954 // daughter = & cdc1;
1955 // }
1956 // }
1957
1958 // //...By dz...
1959 // else {
1960 // float dz1 = fabs(z1.m_helix[3]);
1961 // float dz2 = fabs(z2.m_helix[3]);
1962 // if (dz1 > dz2) {
1963 // mother = & cdc2;
1964 // daughter = & cdc1;
1965 // }
1966 // }
1967
1968 //...By dz + dr...
1969 if(flag == 3){
1970 float dz1 = fabs(z1.helix[3]);
1971 float dz2 = fabs(z2.helix[3]);
1972 if (fabs(dz1 - dz2) < 2.) flag = 1;
1973 else flag = 2;
1974 }
1975
1976 //...By dr...
1977 if(flag == 1){
1978 float dr1 = fabs(z1.helix[0]);
1979 float dr2 = fabs(z2.helix[0]);
1980 if (dr1 > dr2) {
1981 mother = & cdc2;
1982 daughter = & cdc1;
1983 }
1984 }
1985
1986 //...By dz...
1987 else if(flag == 2){
1988 float dz1 = fabs(z1.helix[3]);
1989 float dz2 = fabs(z2.helix[3]);
1990 if (dz1 > dz2) {
1991 mother = & cdc2;
1992 daughter = & cdc1;
1993 }
1994 }
1995
1996 //...Update information...
1997 mother->quality &= (~ TrackQualityOutsideCurler);
1998 mother->likelihood[0] = 1.;
1999 mother->decision |= TrackTrackManager;
2000 //zsl
2001 mother->daughter = daughter->body;
2002 mother->mother = 0;
2003 //zsl end;
2005 daughter->likelihood[0] = 0.;
2006 daughter->mother = mother->body;
2007 daughter->daughter = 0;
2008 daughter->decision |= TrackTrackManager;
2009}

◆ treatCurler() [2/2]

void TTrackManager::treatCurler ( MdcTrk curl,
MdcRec_trk_add cdc,
unsigned  flag 
) const

final decision for a curler.

◆ version() [1/2]

std::string TTrackManager::version ( void  ) const

returns version.

Definition at line 106 of file TTrackManager.cxx.

106 {
107 return std::string("2.27");
108}

◆ version() [2/2]

std::string TTrackManager::version ( void  ) const

returns version.


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