15# if defined(__EXTENSIONS__)
18# define __EXTENSIONS__
22#elif defined(__GNUC__)
23# if defined(_XOPEN_SOURCE)
32#define TTRACKMANAGER_INLINE_DEFINE_HERE
38#include "CLHEP/String/Strings.h"
40#include "TrkReco/TrkReco.h"
41#include "TrkReco/TMDCWireHit.h"
42#include "TrkReco/TMDCWireHitMC.h"
43#include "TrkReco/TTrack.h"
44#include "TrkReco/TTrackMC.h"
45#include "TrkReco/TTrackHEP.h"
46#include "TrkReco/TTrackManager.h"
47#include "MdcTables/MdcTables.h"
48#include "MdcTables/TrkTables.h"
50#include "GaudiKernel/MsgStream.h"
51#include "GaudiKernel/AlgFactory.h"
52#include "GaudiKernel/ISvcLocator.h"
53#include "GaudiKernel/IMessageSvc.h"
54#include "GaudiKernel/IDataProviderSvc.h"
55#include "GaudiKernel/IDataManagerSvc.h"
56#include "GaudiKernel/SmartDataPtr.h"
57#include "GaudiKernel/IDataProviderSvc.h"
58#include "GaudiKernel/PropertyMgr.h"
59#include "GaudiKernel/IJobOptionsSvc.h"
60#include "GaudiKernel/Bootstrap.h"
61#include "GaudiKernel/StatusCode.h"
63#include "GaudiKernel/ContainedObject.h"
64#include "GaudiKernel/SmartRef.h"
65#include "GaudiKernel/SmartRefVector.h"
66#include "GaudiKernel/ObjectVector.h"
67#include "EventModel/EventModel.h"
69#include "EvTimeEvent/RecEsTime.h"
72#include "Identifier/Identifier.h"
73#include "Identifier/MdcID.h"
81 _sigmaCurlerMergeTest(sqrt(100.)),
84 _fitter(
"TTrackManager Fitter"),
85 _cFitter(
"TTrackManager 2D Fitter"),
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;
95 StatusCode sc = Gaudi::svcLocator()->service(
"RawDataProviderSvc",irawDataProviderSvc);
97 if(sc!=StatusCode::SUCCESS) {
98 std::cout<<
"ERROR: Unable to load RawDataProviderSvc"<<std::endl;
107 return std::string(
"2.27");
112 bool def = (msg ==
"") ?
true :
false;
151 if (def || msg.find(
"eventSummary") != std::string::npos || msg.find(
"detail") != std::string::npos) {
153 <<
"tracks reconstructed : " << _tracksAll.length()
156 <<
"good tracks : " << _tracks.length()
159 <<
"2D tracks : " << _tracks2D.length()
162 <<
"Track list:" << std::endl;
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");
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.){
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.){
214#ifdef TRKRECO_DEBUG_DETAIL
215 std::cout <<
name() <<
" ... salvaging" << std::endl;
216 std::cout <<
" # of given hits=" << hits.length() << std::endl;
220 unsigned nTracks = _tracks.length();
221 if (nTracks == 0)
return;
222 unsigned nHits = hits.length();
223 if (nHits == 0)
return;
226 for (
unsigned i = 0; i < nHits; i++) {
231#ifdef TRKRECO_DEBUG_DETAIL
232 std::cout <<
" checking " << h.
wire()->
name() << std::endl;
237#ifdef TRKRECO_DEBUG_DETAIL
239 std::cout <<
" no track candidate returned";
240 std::cout <<
"by TTrackManager::closest" << std::endl;
243 if (! best)
continue;
247 link.append(
new TMLink(0, & h));
261 double minDistance = MAXDOUBLE;
265 for (
unsigned i = 0; i <
n; i++) {
268 if (err < 0)
continue;
269 if (minDistance >
t.distance()) {
270 minDistance =
t.distance();
283 Gaudi::svcLocator()->service(
"MessageSvc",
msgSvc);
285 MsgStream log(
msgSvc,
"TrkReco");
287 IDataProviderSvc* eventSvc = NULL;
288 Gaudi::svcLocator()->service(
"EventDataSvc", eventSvc);
292 log << MSG::INFO <<
"makeTds:event Svc has been found" << endreq;
294 log << MSG::FATAL <<
"makeTds:Could not find eventSvc" << endreq;
295 return StatusCode::FAILURE ;
331 unsigned n = _tracks.length();
332 int nTdsTk = trkcol->size();
333 for (
int i =0; i <
n; i++) {
336 int trackindex = i + nTdsTk;
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;
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;}
355 const double x0 =
t->helix().pivot().x();
356 const double y0 =
t->helix().pivot().y();
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];
365 const double alpha = 333.564095 / Bz;
367 const double cox = x0 + dr*
cos(phi0) -
alpha*
cos(phi0)/kappa;
368 const double coy = y0 + dr*
sin(phi0) -
alpha*
sin(phi0)/kappa;
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++){
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;
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));
430 hitcol->push_back(hit);
432 SmartRef<RecMdcHit> refhit(hit);
433 hitrefvec.push_back(refhit);
437 if(lastLyr < l->wire()->layerId()) lastLyr = l->
wire()->
layerId();
441 HepSymMatrix m_ea =
t->helix().Ea();
444 for (
int ie = 0 ; ie < 5 ; ie ++){
445 for (
int je = ie ; je < 5 ; je ++) {
446 errorMat[k] = m_ea[ie][je];
454 trk->
setPx(
t->pt() * (-
sin(
t->helix().phi0())));
457 trk->
setP(
t->ptot());
460 double theta = acos((
t->pz())/
t->ptot());
463 double poca_dr =
t->helix().dr();
464 double poca_phi0 =
t->helix().phi0();
467 pos.y()+poca_dr*
sin(poca_phi0),
468 pos.z()+
t->helix().dz());
473 trk->
setR(sqrt(poca.x()*poca.x() + poca.y()*poca.y()));
504 if(!brunge) trk->
setCharge(
int(
t->charge())*(-1));
510 trkcol->push_back(trk);
529 SmartDataPtr<RecMdcTrackCol> newtrkCol(eventSvc,
"/Event/Recon/RecMdcTrackCol");
531 log << MSG::FATAL <<
"Could not find RecMdcTrackCol" << endreq;
532 return( StatusCode::FAILURE);
534 log << MSG::INFO <<
"Begin to check RecMdcTrackCol"<<endreq;
535 RecMdcTrackCol::iterator iter_trk = newtrkCol->begin();
536 for( ; iter_trk != newtrkCol->end(); 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)
545 bool printTrackDetail =
true;
546 if(printTrackDetail){
547 std::cout<<
" q "<<tk->
charge()
548 <<
" theta "<<tk->
theta()
555 std::cout <<
" p "<<tk->
p()
561 std::cout<<
" tkStat "<<tk->
stat()
562 <<
" chi2 "<<tk->
chi2()
563 <<
" ndof "<<tk->
ndof()
565 <<
" nst "<<tk->
nster()
567 bool printErrMat =
true;
569 std::cout<<
"errmat " << std::endl;
570 for (
int i=0; i<15; i++){ std::cout<<
" "<<tk->
err(i); }
571 std::cout<<
" " << std::endl;
575 bool printHit =
true;
577 int haveDigi[43][288];
578 bool printMcTk =
true;
580 for(
int ii=0;ii<43;ii++){
581 for(
int jj=0;jj<43;jj++){
582 haveDigi[ii][jj]=-9999;
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++ ) {
591 haveDigi[l][w]=(*iter)->getTrackIndex();
596 std::cout<<
"nHits=" <<nhits<< std::endl;
598 if(printMcTk) cout<<
"mcTkId ";
599 cout<<
"(layer,wire,lr) stat z"<<endl;
600 for(
int ii=0; ii <nhits ; ii++){
605 if(printMcTk) { cout<<haveDigi[layer][wire]; }
606 cout<<
" ("<<layer<<
","<<wire
609 <<
" "<<tk->
getVecHits()[ii]->getZhit()<<
" "<<std::endl;
611 std::cout <<
" "<< std::endl;
646 return StatusCode::SUCCESS;
654 std::cout <<
"TTrackManager::saveTables ... # 3D tracks=" << _tracks.length()
655 <<
", # 2D tracks=" << _tracks2D.length()
656 <<
", all tracks=" << _tracksAll.length() << std::endl;
661 unsigned n = _tracks.length();
662 unsigned *
id = (
unsigned *) malloc(
n *
sizeof(
unsigned));
664 memset((
char *)
id, 0,
n *
sizeof(
unsigned));
665 for (
unsigned i = 0; i <
n; i++) {
668 badTracks.append((
TTrack &)
t);
675 int err = copyTrack(
t, & r, & a);
680 _tracksFinal.append(
t);
687 a->
stat =
t.fitting();
697 for (
unsigned i = 0; i <
n; i++) {
699#ifdef TRKRECO_DEBUG_DETAIL
700 std::cout <<
"id[" << i <<
"]=" <<
id[i] << std::endl;
702 if (! (
id[i]))
continue;
703 if (! (_tracks[i]->daughter()))
continue;
705 int dId = _tracks.index(_tracks[i]->daughter());
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;
725 _tracks.remove(badTracks);
726 badTracks.removeAll();
729 n = _tracks2D.length();
730 for (
unsigned i = 0; i <
n; i++) {
736 int err = copyTrack(
t, & r, & a);
739 std::cout <<
"TTrackManager::saveTables !!! bad 2D tracks found"
740 <<
" : err=" << err << std::endl
746 _tracksFinal.append(
t);
760 a->
stat =
t.fitting();
763 if ((r->
ndf == 0) && (r->
chiSq > 0.)) {
764 std::cout <<
"TTrackManager::saveTables !!! chisq>0 with ndf=0."
766 <<
" Here is a track dump"
770 if ((r->
ndf > 0) && (r->
chiSq == 0.)) {
771 std::cout <<
"TTrackManager::saveTables !!! chisq=0 with ndf>0."
773 <<
" Here is a track dump"
779 std::cout <<
"TTrackManager::saveTables ... ndf = 0" << std::endl
782 std::cout <<
"TTrackManager::saveTables ... chisq = 0" << std::endl
786 _tracks2D.remove(badTracks);
790 _s->_nTracks += _tracks.length();
791 _s->_nTracksAll += _tracksAll.length();
792 _s->_nTracks2D += _tracks2D.length();
793 _s->_nTracksFinal += _tracksFinal.length();
798 unsigned n = _tracksFinal.length();
799 for (
unsigned i = 0; i <
n; i++) {
800 const TTrack &
t = * _tracksFinal[i];
810 unsigned nHits = hits.length();
811 for (
unsigned j = 0; j < nHits; j++) {
844 unsigned n = _tracksAll.length();
846 for (
unsigned i = 0; i <
n; i++) {
847 if (_tracksAll[i]->nLinks()) _tracksAll[i]->movePivot();
855 HepAListDeleteAll(_tracksAll);
857 _tracks2D.removeAll();
858 _tracksFinal.removeAll();
859 HepAListDeleteAll(_associateHits);
860 static bool first =
true;
875 if (_debugLevel > 1) {
876 std::cout <<
name() <<
" ... finishing" << std::endl;
878 unsigned n = _tracks.length();
879 for (
unsigned i = 0; i <
n; i++) {
882 std::cout <<
" " <<
t.name() << std::endl;
883 t.dump(
"hits mc track flag sort",
" ");
890 _tracksAll.append(list);
891 _tracks.append(selectGoodTracks(list));
897 _tracksAll.append(list);
898 _tracks2D.append(selectGoodTracks(list,
true));
905#ifdef TRKRECO_DEBUG_DETAIL
906 std::cout <<
name() <<
" ... refitting" << std::endl;
908 unsigned n = _tracks.length();
910 for (
unsigned i = 0; i <
n; i++) {
913 err = _fitter.
fit(
t);
916#ifdef TRKRECO_DEBUG_DETAIL
917 std::cout <<
" " <<
t.name();
918 std::cout <<
" rejected because of fitting failure" << std::endl;
923 err = _fitter.
fit(
t);
926#ifdef TRKRECO_DEBUG_DETAIL
927 std::cout <<
" " <<
t.name();
928 std::cout <<
" rejected because of fitting failure" << std::endl;
933 err = _fitter.
fit(
t);
936#ifdef TRKRECO_DEBUG_DETAIL
937 std::cout <<
" " <<
t.name();
938 std::cout <<
" rejected because of fitting failure" << std::endl;
943 _tracks.remove(bads);
948#ifdef TRKRECO_DEBUG_DETAIL
949 std::cout <<
name() <<
" ... masking" << std::endl;
952 unsigned n = _tracks.length();
953 for (
unsigned i = 0; i <
n; i++) {
958 if (!
t.cores().length())
continue;
965 bool needMask =
false;
966 for (
unsigned j = 0; j < 43; j++) {
969 if (
Width(linksInLayer) > 2) {
972#ifdef TRKRECO_DEBUG_DETAIL
973 Dump(linksInLayer,
"sort",
" -->");
979 if (! needMask)
continue;
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;
1004#ifdef TRKRECO_DEBUG_DETAIL
1005 std::cout <<
" masking result : ";
1006 t.dump(
"detail sort",
" ");
1012TTrackManager::nameTracks(
void) {
1013 unsigned n = _tracks.length();
1014 for (
unsigned i = 0; i <
n; i++) {
1016 t._name =
"trk" + itostring(i) +
"(" +
t._name +
")";
1019 tmp.remove(_tracks);
1020 unsigned n1 = tmp.length();
1021 for (
unsigned i = 0; i <
n1; i++) {
1023 t._name =
"trk" + itostring(i +
n) +
"(" +
t._name +
")";
1032 for (
unsigned j = 0; j <
t.nLinks(); j++) {
1033 if (
t[j] == & start)
continue;
1036 if (a.cross(b).z() >= 0.) l[0].append(k);
1037 else l[1].append(k);
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;
1046 if (l[0].length() == 0 || l[1].length() == 0)
1059 for (
unsigned j = 0; j <
t.nLinks(); j++) {
1062 if (a.cross(b).z() >= 0.) l[0].append(k);
1063 else l[1].append(k);
1075 unsigned n = l.length();
1077 for (
unsigned i = 0; i <
n; i++) {
1078 const TMDCWire & w = * l[i]->hit()->wire();
1082 float phi = (float) j / (
float) nWire;
1085 float average = phiSum / (float)
n;
1088 for (
unsigned i = 0; i <
n; i++) {
1089 const TMDCWire & w = * l[i]->hit()->wire();
1093 float phi = (float) j / (
float) nWire;
1094 float dif = fabs(phi - average);
1095 if (dif > 0.5) dif = 1. - dif;
1097 if (dif > 0.3)
cross.append(l[i]);
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() <<
",";
1106 std::cout << std::endl;
1113 unsigned n = links.length();
1115 for (
unsigned i = 0; i <
n; i++) {
1121#ifdef TRKRECO_DEBUG_DETAIL
1122 Dump(links,
"detail",
" TTrackManager::maskOut ... masking ");
1128#ifdef TRKRECO_DEBUG_DETAIL
1129 std::cout <<
"... masking multi-hits" << std::endl;
1132 if (!
t.cores().length())
return;
1134 unsigned n = cores.length();
1135 bool layerLimited =
false;
1139 for (
unsigned i = 0; i <
n; i++) {
1141 bads.append(cores[i]);
1145 SameLayer(cores, cores[i]->wire()->layerId());
1146 if (linksInLayer.length() > 3) {
1147 bads.append(cores[i]);
1148 layerLimited =
true;
1161#ifdef TRKRECO_DEBUG_DETAIL
1162 std::cout <<
" normal : divided by IP" << std::endl;
1164 for (
unsigned j = 0; j < l[0].length(); j++) {
1165 std::cout <<
"," << l[0][j]->wire()->name();
1167 std::cout << std::endl;
1169 for (
unsigned j = 0; j < l[1].length(); j++) {
1170 std::cout <<
"," << l[1][j]->wire()->name();
1172 std::cout << std::endl;
1176 unsigned maskSide = 2;
1181#ifdef TRKRECO_DEBUG_DETAIL
1182 std::cout <<
" NSuperLayers 0, 1 = " <<
NSuperLayers(l[0]) <<
", ";
1185 if (maskSide != 2) {
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;
1198 if (maskSide != 2) {
1206#ifdef TRKRECO_DEBUG_DETAIL
1207 std::cout <<
" NLayers 0, 1 = " <<
NLayers(l[0]) <<
", ";
1208 std::cout <<
NLayers(l[1]) << std::endl;
1210 if (maskSide != 2) {
1216 if (maskSide == 2) {
1218 for (
unsigned j = 0; j < 2; j++) {
1221 _fitter.
fit(* tt[j]);
1223 if (tt[1]->pt() > tt[0]->pt()) maskSide = 1;
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;
1242 if (l[0].length() == 0)
return;
1243 if (l[1].length() == 0)
return;
1245#ifdef TRKRECO_DEBUG_DETAIL
1246 std::cout <<
" curl : divided by IP" << std::endl;
1248 Dump(l[0],
"flag sort");
1250 Dump(l[1],
"flag sort");
1251 std::cout << std::endl;
1255 unsigned maskSide = 2;
1260#ifdef TRKRECO_DEBUG_DETAIL
1261 std::cout <<
" NSuperLayers 0, 1 = " <<
NSuperLayers(l[0]) <<
", ";
1264 if (maskSide != 2) {
1275 _fitter.
fit(* tt[0]);
1276 _fitter.
fit(* tt[1]);
1283 if (fabs(h0.
dz()) < fabs(h1.
dz())) maskSide = 1;
1294#ifdef TRKRECO_DEBUG_DETAIL
1296 std::cout <<
"TTrackManager::determineT0 !!! called with level = 0";
1297 std::cout << std::endl;
1302 Gaudi::svcLocator()->service(
"MessageSvc",
msgSvc);
1303 MsgStream log(
msgSvc,
"TTrackManager");
1305 IDataProviderSvc* eventSvc = NULL;
1306 Gaudi::svcLocator()->service(
"EventDataSvc", eventSvc);
1308 static bool first =
true;
1309 static unsigned methode = 0;
1314 _cFitter.
fit2D(
true);
1316 else if (level == 2) {
1319 else if (level == 3) {
1322 else if (level == 4) {
1326 else if (level == 5) {
1331 else if (level == 6) {
1337 else if (level == 7) {
1345 unsigned n = _tracks.length();
1346 if (!
n)
return StatusCode::SUCCESS;
1348 if (nMax == 0) nMax =
n;
1349 if (
n > nMax)
n = nMax;
1357 SmartDataPtr<RecEsTimeCol> aevtimeCol(eventSvc,
"/Event/Recon/RecEsTimeCol");
1359 RecEsTimeCol::iterator iter_evt = aevtimeCol->begin();
1360 t0_sta = (*iter_evt)->getStat();
1361 tev = (*iter_evt)->getTest();
1364 log << MSG::WARNING <<
"Could not find RecEsTimeCol" << endreq;
1367 if (methode == 0) _t0 = T0(
n);
1369 else if (methode == 1) _t0 = T0Fit(
n);
1371 else if (methode ==2) {
1397 std::cout <<
"TTrackManager::determineT0 ... methode=" << methode;
1398 std::cout <<
", T0 offset=" << - _t0;
1399 std::cout <<
", # of tracks used=" <<
n << std::endl;
1403 float t0_rec = 999.;
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");
1420 aevtime -> setTest(t0_rec);
1421 aevtime -> setStat(t0_recSta);
1422 aEvTimeCol->push_back(aevtime);
1426 StatusCode evtime = eventSvc->registerObject(
"/Event/Recon/RecEsTimeCol", aEvTimeCol);
1428 if(evtime!=StatusCode::SUCCESS) {
1429 log << MSG::FATAL <<
"Could not register Event Start Time" << endreq;
1430 return( StatusCode::FAILURE);
1433 return( StatusCode::SUCCESS );
1437TTrackManager::T0(
unsigned n) {
1446 for (
unsigned i = 0; i <
n; i++) {
1449 for (
unsigned j = 0; j < 3; j++) {
1450 float offset =
X0 + j *
STEP;
1451 _cFitter.
fit(
t, offset);
1454 t0Sum += minimum(y[0], y[1], y[2]);
1456 float t0 = t0Sum / (float)
n;
1457 if (isnan(t0)) t0 = 0.;
1460 n = _tracks.length();
1461 for (
unsigned i = 0; i <
n; i++) {
1463 _cFitter.
fit(
t, t0);
1477TTrackManager::T0Fit(
unsigned n) {
1487 const int cn=_tracks.length();
1488 float* sort =
new float[cn];
1489 float ptmax_pre=1.e10;
1490 for (
unsigned i = 0; i < cn; i++) {
1493 for (
unsigned j = 0; j < cn; j++) {
1494 TTrack & tj = * _tracks[j];
1495 float pt = fabs(1./tj.
helix().
a()[2]);
1496 if( pt < ptmax_pre && pt > ptmax) {
1505 for (
unsigned i = 0; i <
n; i++) {
1507 TTrack &
t = * _tracks[sort[i]];
1511 _cFitter.
fit(
t, tev, tev_err);
1513 float w = 1. / tev_err / tev_err;
1522 float tev_mean = tev_sum / w_sum;
1527 if (isnan(tev_mean)) tev_mean = 0.;
1540TTrackManager::minimum(
float y0,
float y1,
float y2)
const {
1541 float xMin =
X1 + 0.5 *
STEP * (y0 - y2) / (y0 + y2 - 2. * y1);
1550 unsigned n = _tracks.length();
1553 unsigned * flagTrk = (
unsigned *) malloc(
n *
sizeof(
unsigned));
1554 for (
unsigned i = 0; i <
n; i++) flagTrk[i] = 0;
1557 for (
unsigned i0 = 0; i0 <
n; i0++) {
1559 if (flagTrk[i0] != 0)
continue;
1560 TTrack & t0 = * _tracks[i0];
1561 if (! (t0.
pt() < 0.13))
continue;
1563 unsigned Noverlap(0), Nall(0);
1564 float OverlapRatioMax(-999.);
1567 for (
unsigned i1= 0 ; i1 <
n; i1++) {
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;
1576 for (
unsigned j = 0; j < Nall; j++) {
1584 double r = sqrt(
x *
x + y * y);
1587 if ((R - load) < r && r < (R + load)) Noverlap++;
1590 if (! Noverlap)
continue;
1591 float tmpRatio = float(Noverlap) / float(Nall);
1593 if (tmpRatio > OverlapRatioMax) {
1594 OverlapRatioMax = tmpRatio;
1599 if (OverlapRatioMax < 0.7)
continue;
1602 unsigned MaskID[2] = {MaxID , i0};
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];
1613 _tracks[i0]->append(_tracks[MaxID]->links());
1614 _tracks[MaxID]->append(_tracks[i0]->links());
1616#ifdef TRKRECO_DEBUG_DETAIL
1617 std::cout <<
" mask & merge " << std::endl;
1619 Dump(l[0],
"flag sort");
1621 Dump(l[1],
"flag sort");
1622 std::cout << std::endl;
1626 unsigned maskSide = 2;
1633 if( super0 < super1 ) maskSide = 0;
1634 else if ( super0 > super1 ) maskSide = 1;
1636#ifdef TRKRECO_DEBUG_DETAIL
1637 std::cout <<
" NSuperLayers 0, 1 = " <<
NSuperLayers(l[0]) <<
", ";
1641 if (maskSide == 2) {
1647 if (inner0 < inner1 ) maskSide = 1;
1648 else if (inner0 > inner1) maskSide = 0;
1650 if( maskSide == 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]);
1666 if (fabs(h0.
dz()) < fabs(h1.
dz())) maskSide = 1;
1675 bads.append(_tracks[MaskID[maskSide]]);
1676 flagTrk[MaskID[maskSide]] = 1;
1680 _tracks.remove(bads);
1683 n = _tracks.length();
1685 for(
unsigned i=0;i<
n;i++){
1687 for(
unsigned j=0;j<
t.links().length();j++){
1696 double qq =
q *
t.charge();
1708TTrackManager::copyTrack(
TTrack &
t,
1719#ifdef TRKRECO_DEBUG_DETAIL
1720 std::cout <<
" checking hits ... " <<
t.name()
1721 <<
" quality = " <<
t.quality();
1722 std::cout <<
" : " <<
t.cores().length() <<
", " <<
t.ndf() <<
" : ";
1727 unsigned nStereos = 0;
1728 unsigned nOccupied = 0;
1731 unsigned n =
t.links().length();
1732 for (
unsigned i = 0; i <
n; i++) {
1736#ifdef TRKRECO_DEBUG_DETAIL
1737 if (h->
trk) std::cout << l->
wire()->
name() <<
"(n/a),";
1745 if ((l->
hit()->
state() & GoodHitMask) == GoodHitMask) {
1757#ifdef TRKRECO_DEBUG_DETAIL
1758 std::cout << std::endl;
1763 if (hits.length() < 3) err = 3;
1764 if (nOccupied > 2) err = 4;
1767 if (hits.length() < 5) err = 1;
1768 if (nStereos < 2) err = 2;
1770 if (err)
return err;
1793 unsigned nHits = hits.length();
1794 for (
unsigned i = 0; i < nHits; i++) {
1805 r->
nster = nStereos;
1811 n = badHits.length();
1812 for (
unsigned i = 0; i <
n; i++) {
1822 const Vector & a =
t.helix().a();
1835 r->
error[0] = ea[0][0];
1836 r->
error[1] = ea[1][0];
1837 r->
error[2] = ea[1][1];
1838 r->
error[3] = ea[2][0];
1839 r->
error[4] = ea[2][1];
1840 r->
error[5] = ea[2][2];
1841 r->
error[6] = ea[3][0];
1842 r->
error[7] = ea[3][1];
1843 r->
error[8] = ea[3][2];
1844 r->
error[9] = ea[3][3];
1845 r->
error[10] = ea[4][0];
1846 r->
error[11] = ea[4][1];
1847 r->
error[12] = ea[4][2];
1848 r->
error[13] = ea[4][3];
1849 r->
error[14] = ea[4][4];
1863 unsigned n = _tracks.length();
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;
1884#ifdef TRKRECO_DEBUG_DETAIL
1885 std::cout <<
"trkmgr::sortTracksByPt : # of tracks="
1886 << _tracks.length() << std::endl;
1889 unsigned n = _tracks.length();
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];
1898#ifdef TRKRECO_DEBUG_DETAIL
1899 std::cout <<
"i,j=" << i <<
"," << j
1900 <<
" : pt i,j=" << bestPt <<
"," << pt << std::endl;
1913 unsigned flag)
const {
1917 if (trk1.
zero[2] == 0)
return;
1928 if (cdc2.
rectrk == 0)
return;
1932 if (trk2.
zero[2] == 0)
return;
1970 float dz1 = fabs(z1.
helix[3]);
1971 float dz2 = fabs(z2.
helix[3]);
1972 if (fabs(dz1 - dz2) < 2.)
flag = 1;
1978 float dr1 = fabs(z1.
helix[0]);
1979 float dr2 = fabs(z2.
helix[0]);
1988 float dz1 = fabs(z1.
helix[3]);
1989 float dz2 = fabs(z2.
helix[3]);
1997 mother->
quality &= (~ TrackQualityOutsideCurler);
2013#ifdef TRKRECO_DEBUG_DETAIL
2014 std::cout <<
"trkmgr::sortBanksByPt : # of tracks="
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++) {
2043 float bestPt = 1. / fabs(cdc0.
helix[2]);
2044 unsigned bestQuality = add0.
quality;
2045 for (
unsigned j = i + 1; j <
n; j++) {
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 <<
","
2068 unsigned quality = add1.
quality;
2069 if (quality > bestQuality)
continue;
2070 else if (quality < bestQuality) {
2071 bestQuality = quality;
2073 swapReccdc(cdc0, add0, mc0, cdc1, add1, mc1);
2074 unsigned tmp =
id[i];
2077#ifdef TRKRECO_DEBUG_DETAIL
2078 std::cout <<
"swapped" << std::endl;
2082#ifdef TRKRECO_DEBUG_DETAIL
2083 std::cout <<
"i,j=" << i <<
"," << j
2084 <<
" : pt i,j=" << bestPt <<
"," << pt << std::endl;
2087#ifdef TRKRECO_DEBUG_DETAIL
2088 std::cout <<
"swapping ... " << & cdc0 <<
"," << & add0 <<
","
2089 << & mc0 <<
" <-> " << & cdc1 <<
"," << & add1 <<
","
2090 << & mc1 << std::endl;
2092 bestQuality = quality;
2094 swapReccdc(cdc0, add0, mc0, cdc1, add1, mc1);
2095 unsigned tmp =
id[i];
2098#ifdef TRKRECO_DEBUG_DETAIL
2099 std::cout <<
"swapped" << std::endl;
2104#ifdef TRKRECO_DEBUG_DETAIL
2105 std::cout <<
"trkmgr::sortBanksByPt : first phase finished" << std::endl;
2111#ifdef TRKRECO_DEBUG_DETAIL
2112 std::cout <<
"trkmgr::sortBanksByPt : second phase finished" << std::endl;
2117 n = BsCouTab(RECTRK);
2118 id = (
unsigned *) malloc(
n *
sizeof(
unsigned));
2119 for (
unsigned i = 0; i <
n; i++)
id[i] = i;
2123 rectrk &
t = * (rectrk *) BsGetEnt(RECTRK, i + 1, BBS_No_Index);
2124 if (
t.m_prekal == (i + 1)) {
2129 rectrk &
s = * (rectrk *) BsGetEnt(RECTRK,
2134 unsigned tmp =
id[i];
2135 id[i] =
id[
s.m_ID - 1];
2136 id[
s.m_ID - 1] = tmp;
2140 reccdc_trk_add & a =
2141 * (reccdc_trk_add *) BsGetEnt(RECMDC_TRK_ADD,
2144 reccdc_trk_add & b =
2145 * (reccdc_trk_add *) BsGetEnt(RECMDC_TRK_ADD,
2148 a.m_rectrk =
t.m_ID;
2149 b.m_rectrk =
s.m_ID;
2208#define RECMDC_ACTUAL_SIZE 124
2209#define RECMDCADD_ACTUAL_SIZE 40
2210#define RECMDCMC_ACTUAL_SIZE 28
2212 static bool first =
true;
2213 static void * swapRegion;
2219 void * s0 = & cdc0.
helix[0];
2220 void * s1 = & cdc1.
helix[0];
2231 if ((& mc0) && (& mc1)) {
2241TTrackManager::swapRectrk(
MdcTrk & rec0,
2243#define RECTRK_ACTUAL_SIZE 84
2245 static bool first =
true;
2246 static void * swapRegion;
2252 void * s0 = & rec0.
glob[0];
2253 void * s1 = & rec1.
glob[0];
2260TTrackManager::tagReccdc(
unsigned * id0,
unsigned nTrk)
const {
2342 unsigned n = _tracks.length();
2345 for (
unsigned i = 0; i <
n - 1; i++) {
2346 TTrack & t0 = * _tracks[i];
2350 for (
unsigned j = i + 1; j <
n; j++) {
2351 TTrack & t1 = * _tracks[j];
2353 if (c0 * c1 > 0.)
continue;
2356 bool toBeMerged =
false;
2358 if (n0 > _nCurlerMergeTest) toBeMerged =
true;
2361 _sigmaCurlerMergeTest);
2362 if (
n1 > _nCurlerMergeTest) toBeMerged =
true;
2368 ++_s->_nToBeMergedMoreThanTwo;
2384 std::cout <<
"... trkmgr::salvaging associate hits" << std::endl;
2385 std::cout <<
" # of given hits=" << hits.length() << std::endl;
2389 unsigned nTracks = _tracks.length();
2390 if (nTracks == 0)
return;
2391 unsigned nHits = hits.length();
2392 if (nHits == 0)
return;
2397 for (
unsigned i = 0; i < nHits; i++) {
2402#ifdef TRKRECO_DEBUG_DETAIL
2403 std::cout <<
" checking " << h.
wire()->
name();
2409 TTrack * bestTrack = NULL;
2410 for (
unsigned j = 0; j < nTracks; j++) {
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()));
2423 if (co.
cross(
x - c) *
t.charge() > 0.)
2425 if (fabs((
x - c).mag() - fabs(
t.radius())) > 5.)
2430 int err =
t.approach(link);
2432#ifdef TRKRECO_DEBUG_DETAIL
2433 std::cout <<
" : " <<
t.name() <<
" approach failure";
2435 toBeDeleted.append(link);
2441 float diff = fabs(distance - link.
hit()->
drift());
2442 float sigma = diff / link.
hit()->
dDrift();
2443 link.
pull(sigma * sigma);
2445#ifdef TRKRECO_DEBUG_DETAIL
2446 std::cout <<
" : " <<
t.name() <<
" pull = " << link.
pull();
2448 if (link.
pull() > maxSigma2) {
2449 toBeDeleted.append(link);
2455 toBeDeleted.append(best);
2460 toBeDeleted.append(link);
2470 bestTrack->
append(* best);
2472 _associateHits.append(best);
2475 std::cout <<
" -> " << bestTrack->
name() << std::endl;
2478 HepAListDeleteAll(toBeDeleted);
2480#ifdef TRKRECO_DEBUG_DETAIL
2481 std::cout << std::endl;
2489 std::cout <<
"... trkmgr::maskBadHits" << std::endl;
2493 for (
unsigned i = 0; i <
n; i++) {
2495 bool toBeUpdated =
false;
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() |
2504 std::cout <<
" " <<
t.name() <<
" : ";
2505 std::cout << links[j]->wire()->name() <<
"(pull=";
2506 std::cout << links[j]->pull() <<
") is masked" << std::endl;
2510 if (toBeUpdated)
t.update();
2536 for (
unsigned i = 0; i <
n; i++) {
2545 for (
unsigned i = 0; i <
n; i++) {
2556 bool track2D)
const {
2558 unsigned n = list.length();
2559 for (
unsigned i = 0; i <
n; i++) {
2564 if (_maxMomentum > 0.) {
2565 if (
t.ptot() > _maxMomentum) {
2571 goodTracks.append((
TTrack &)
t);
2575 if (list.length() != goodTracks.length()) {
2576 std::cout <<
"TTrackManager::selectGoodTracks ... bad tracks found"
2578 <<
" # of bad tracks = "
2579 << list.length() - goodTracks.length()
2580 <<
" : 2D flag = " << track2D << std::endl;
2583 tmp.remove(goodTracks);
2584 std::cout <<
" Track dump" << std::endl;
2585 for (
unsigned i = 0; i < tmp.length(); i++) {
2586 std::cout <<
" " <<
TrackDump(* tmp[i]) << std::endl;
2595TTrackManager::checkNumberOfHits(
const TTrack &
t,
bool track2D) {
2600 if (axialHits < 3)
return false;
2603 unsigned allHits = cores.length();
2604 if (allHits < 5)
return false;
2606 if (stereoHits < 2)
return false;
2607 unsigned axialHits = allHits - stereoHits;
2608 if (axialHits < 3)
return false;
2615 static const HepVector3D InitialVertex(0., 0., 0.);
2621 for (
unsigned i = 0; i <
n; i++) {
2625 if (
t.prekal == 0)
continue;
2639 if (! & g)
continue;
2640 if (g.
nhits[3] < 2)
continue;
2641 if (g.
nhits[4] < 2)
continue;
2649 if (! & z)
continue;
2653 unsigned nZ = zList.length();
2666TTrackManager::tagRectrk(
unsigned * id0,
unsigned nTrk)
const {
3018 if (! checkNumberOfHits(
t, track2D))
return false;
ObjectVector< RecEsTime > RecEsTimeCol
std::vector< MdcDigi * > MdcDigiVec
EvtVector3R cross(const EvtVector3R &p1, const EvtVector3R &p2)
double sin(const BesAngle a)
double cos(const BesAngle a)
ObjectVector< RecMdcHit > RecMdcHitCol
ObjectVector< RecMdcTrack > RecMdcTrackCol
SmartRefVector< RecMdcHit > HitRefVec
CLHEP::HepSymMatrix SymMatrix
const HepPoint3D ORIGIN
Constants.
#define WireHitChargeValid
#define WireHitFindingValid
#define WireHitFittingValid
#define WireHitInvalidForFit
void Dump(const CAList< TMLink > &links, const std::string &message=std::string(""), const std::string &prefix=std::string(""))
dumps TMLinks.
unsigned NAxialHits(const AList< TMLink > &links)
returns # of axial hits.
unsigned Width(const AList< TMLink > &)
returns width(wire cell unit) of given AList<TMLink>. This function assumes that all TMLink's are in ...
void NHits(const AList< TMLink > &links, unsigned nHits[50])
returns # of hits per layer.
TMLink * OuterMost(const AList< TMLink > &links)
unsigned NLayers(const AList< TMLink > &links)
returns # of layers.
TMLink * InnerMost(const AList< TMLink > &links)
returns the inner(outer)-most link.
unsigned NSuperLayers(const AList< TMLink > &links)
returns # of layers.
unsigned NStereoHits(const AList< TMLink > &links)
returns # of stereo hits.
AList< TMLink > SameLayer(const AList< TMLink > &list, const TMLink &a)
returns links which are in the same layer as 'a' or 'id'.
int SortByWireId(const void *a, const void *b)
Sorter.
bool HelixHasNan(const Helix &)
Helix parameter validity.
std::string TrackDump(const TTrack &)
to dump a track.
#define TrackTrackManager
#define TrackQualityOutsideCurler
int SortByPt(const void *a, const void *b)
Utility functions.
****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
#define RECMDCADD_ACTUAL_SIZE
#define RECMDCMC_ACTUAL_SIZE
#define RECTRK_ACTUAL_SIZE
#define RECMDC_ACTUAL_SIZE
const double theta() const
void setFirstLayer(const int id)
void setPxy(const double pxy)
void setTrackId(const int trackId)
void setPy(const double py)
const HepSymMatrix err() const
void setZ(const double z)
void setNster(const int ns)
void setX(const double x)
void setError(double err[15])
void setNdof(const int ndof)
const double chi2() const
void setTheta(const double theta)
void setStat(const int stat)
const int trackId() const
void setP(const double p)
void setHelix(double helix[5])
void setPoca(double poca[3])
void setR(const double r)
void setCharge(const int charge)
void setLastLayer(const int id)
const HepVector helix() const
......
void setY(const double y)
void setChi2(const double chi)
void setPhi(const double phi)
void setPz(const double pz)
void setPx(const double px)
const HepPoint3D & center(void) const
returns position of helix center(z = 0.);
double radius(void) const
returns radious of helix.
const HepVector & a(void) const
returns helix parameters.
const HepPoint3D & pivot(void) const
returns pivot position.
virtual double getReferField()=0
static vector< MdcDat_mcwirhit > * getMdcDatMcwirhitCol(void)
static Identifier wire_id(int wireType, int layer, int wire)
For a single wire.
static int layer(const Identifier &id)
Values of different levels (failure returns 0)
static int wire(const Identifier &id)
static vector< MdcRec_mctrk2hep > * getMdcRecMctrk2hepCol(void)
static vector< MdcRec_mctrk > * getMdcRecMctrkCol(void)
static vector< MdcRec_trk_add > * getMdcRecTrkAddCol(void)
static vector< MdcRec_trk > * getMdcRecTrkCol(void)
static vector< MdcRec_wirhit > * getMdcRecWirhitCol(void)
static vector< MdcTrk > * getMdcTrkCol(void)
MdcDigiVec & getMdcDigiVec(uint32_t control=0)
void setMdcId(Identifier mdcid)
void setErrDriftDistRight(double erddr)
void setFltLen(double fltLen)
void setErrDriftDistLeft(double erddl)
void setDriftDistLeft(double ddl)
void setDoca(double doca)
void setChisqAdd(double pChisq)
void setZhit(double zhit)
void setDriftT(double driftT)
void setDriftDistRight(double ddr)
void setEntra(double entra)
const HitRefVec getVecHits(void) const
void setPivot(const HepPoint3D &pivot)
const int getNhits() const
void setVecHits(HitRefVec vechits)
void setFiTerm(double fiterm)
bool fit2D(void) const
sets/returns 2D flag.
bool tof(void) const
sets/returns propagation-delay correction flag.
int fit(TTrackBase &) const
bool propagation(void) const
sets/returns propagation-delay correction flag.
unsigned nWires(void) const
returns # of wires.
const TTrackHEP *const hep(void) const
returns a pointer to a GEN_HEPEVT.
MdcDat_mcwirhit * datcdc(void) const
returns a pointer to DATMDC_MCWIRHIT.
struct MdcRec_wirhit * reccdc(void) const
returns a pointer to RECMDC_WIRHIT.
unsigned state(void) const
returns state.
float dDrift(unsigned) const
returns drift distance error.
float drift(unsigned) const
returns drift distance.
const TMDCWire *const wire(void) const
returns a pointer to a TMDCWire.
const TMDCWireHitMC *const mc(void) const
returns a pointer to TMDCWireHitMC.
A class to represent a wire in MDC.
const TMDCLayer *const layer(void) const
returns a pointer to a layer.
unsigned localId(void) const
returns local id in a wire layer.
unsigned layerId(void) const
returns layer id.
const HepPoint3D & xyPosition(void) const
returns middle position of a wire. z componet is 0.
bool stereo(void) const
returns true if this wire is in a stereo layer.
std::string name(void) const
returns name.
A class to relate TMDCWireHit and TTrack objects.
double distance(void) const
returns distance between point on wire and on track.
const HepPoint3D & positionOnWire(void) const
returns the closest point on wire to a track.
double distancenew(void) const
const HepPoint3D & positionOnTrack(void) const
returns the closest point on track to wire.
double getDriftTime(void)
unsigned leftRight(void) const
returns left-right. 0:left, 1:right, 2:wire
const TMDCWireHit * hit(void) const
returns a pointer to a hit.
float dDrift(void) const
returns/sets drift distance error.
double dPhi(void) const
returns dPhi to the closest point.
double pull(void) const
returns pull.
float drift(void) const
returns/sets drift distance.
const TMDCWire *const wire(void) const
returns a pointer to a wire.
A class to represent a point in 2D.
double cross(const TPoint2D &) const
unsigned testByApproach(const TMLink &list, double sigma) const
returns # of good hits to be appended.
void append(TMLink &)
appends a TMLink.
const AList< TMLink > & links(unsigned mask=0) const
returns a list of masked TMLinks assigned to this track. 'mask' will be applied if mask is not 0.
void remove(TMLink &a)
removes a TMLink.
void appendByApproach(AList< TMLink > &list, double maxSigma)
appends TMLinks by approach. 'list' is an input. Unappended TMLinks will be removed from 'list' when ...
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.
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).
void movePivot(void)
moves pivot of tracks.
void append2D(AList< TTrack > &list)
void maskOut(TTrack &, const AList< TMLink > &) const
void removeHitsAcrossOverIp(AList< TMLink > &) const
static void maskBadHits(const AList< TTrack > &, float maxSigma2)
masks hits with large chisq as associated hits. Pull in TMLink is used.
void clearTables(void) const
clears tables.
void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
dumps debug information.
void maskNormal(TTrack &) const
virtual ~TTrackManager()
Destructor.
void finish(void)
finishes tracks.
TTrack * closest(const AList< TTrack > &, const TMDCWireHit &) const
returns a track which is the closest to a hit.
void append(AList< TTrack > &list)
appends (2D) tracks. 'list' will be cleaned up.
void saveTables(void)
stores track info. into Panther table.
std::string version(void) const
returns version.
void salvageAssociateHits(const AList< TMDCWireHit > &, float maxSigma2)
salvages hits for dE/dx(not for track fitting).
void refit(void)
refits tracks.
TMLink & divide(const TTrack &t, AList< TMLink > *l) const
StatusCode makeTds(RecMdcTrackCol *trackList, RecMdcHitCol *hitList, int tkStat=1, int runge=0, int cal=0)
stores track info. into TDS. by Zang Shilei
void setCurlerFlags(void)
tests for curlers.
void maskMultiHits(TTrack &) const
void determineIP(void)
determines IP.
static bool goodTrack(const TTrack &, bool track2D=false)
checks goodness of a track.
const AList< TTrack > & tracks(void) const
returns a list of reconstructed tracks.
std::string name(void) const
returns name.
TTrackManager()
Constructor.
void maskCurl(TTrack &) const
void saveMCTables(void) const
stores MC track info. into Panther table.
void mask(void) const
masks hits out which are in tail of curly tracks.
TMLink & divideByIp(const TTrack &t, AList< TMLink > *l) const
void sortBanksByPt(void) const
sorts RECMDC_TRK tables.
void sortTracksByQuality(void)
sorts tracks.
void treatCurler(MdcTrk &curl, MdcRec_trk_add &cdc, unsigned flag) const
final decision for a curler.
void maskCurlHits(const AList< TMDCWireHit > &axial, const AList< TMDCWireHit > &stereo, const AList< TTrack > &tracks) const
masks hits on found curl tracks.
StatusCode determineT0(unsigned level, unsigned nMaxTracks)
determines T0 and refit all tracks.
void salvage(const AList< TMDCWireHit > &) const
salvages remaining hits.
void clear(void)
clears all internal information.
void sortTracksByPt(void)
A class to represent a track in tracking.
const Helix & helix(void) const
returns helix parameter.
unsigned ndf(void) const
returns NDF.
const std::string & name(void) const
returns/sets name.
TTrack * daughter(void) const
unsigned finder(void) const
sets/returns finder.
unsigned type(void) const
returns type. Definition is depending on an object type.
double pt(void) const
returns Pt.
int approach(TMLink &) const
calculates the closest approach to a wire in real space. Results are stored in TMLink....
double chi2(void) const
returns chi2.
double charge(void) const
returns charge.