26 m_correctTrkTracks(false),
27 m_radius(
radius), m_selectPdgId(selectPdgId), m_selectParentPdgId(selectParentPdgId) {
40 if (
p==
nullptr )
return nullptr;
42 if (
p->absPdgId()==pdg_id ) {
49 if (
vertex->nIncomingParticles() < 1 ) {
52 for(
unsigned ip = 0;
ip <
vertex->nIncomingParticles();
ip++ ) {
53 auto* in =
vertex->incomingParticle(
ip);
74 if (
p==
nullptr )
return nullptr;
76 for (
size_t i=
ids.size() ;
i-- ; ) {
77 if (
p->absPdgId()==
ids[
i] )
return p;
81 if (
vertex ==
nullptr )
return nullptr;
83 if (
vertex->nIncomingParticles()<1 )
return nullptr;
85 for(
unsigned ip = 0;
ip <
vertex->nIncomingParticles();
ip++ ) {
86 auto* in =
vertex->incomingParticle(
ip);
89 for (
size_t i=
ids.size() ;
i-- ; ) {
121 double phi =
track->param()->phi0();
122 double z0 =
track->param()->z0();
123 double pT =
track->param()->pT();
124 double d0 =
track->param()->a0();
126 double deta =
track->param()->eeta();
127 double dphi =
track->param()->ephi0();
128 double dz0 =
track->param()->ez0();
129 double dpT =
track->param()->epT();
130 double dd0 =
track->param()->ea0();
135 int algoid =
track->algorithmId();
137 int nBlayerHits = (
track->HitPattern() & 0x1);
139 int nSctHits = 2 *
track->NSCT_SpacePoints();
140 int nStrawHits =
track->NStrawHits();
141 int nTrHits =
track->NTRHits();
145 bool expectBL =
false;
147 unsigned long id = (
unsigned long)
track;
149 unsigned hitPattern =
track->HitPattern();
150 unsigned multiPattern = 0;
156 int match_barcode = -1;
160 if (trackTruth!=0 && trackTruth->
nrMatches() > 0) {
168 deta, dphi, dz0, dd0, dpT,
171 hitPattern, multiPattern,
172 algoid, truth, -1, match_barcode,
192 while ( trackitr!=trackend ) {
204 static const int hpmap[20] = { 0, 1, 2, 7, 8, 9, 3, 4, 5, 6, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 };
208 #ifdef TRKPARAMETERS_MEASUREDPERIGEE_H
215 double pT = measPer->pT();
216 double eta = measPer->eta();
219 double d0 = measPer->parameters()[
Trk::d0];
227 #ifdef TRKPARAMETERS_MEASUREDPERIGEE_H
241 #ifdef TRKPARAMETERS_MEASUREDPERIGEE_H
247 double dz0 = std::sqrt((*measPer->covariance())(
Trk::z0,
Trk::z0));
248 double dd0 = std::sqrt((*measPer->covariance())(
Trk::d0,
Trk::d0));
256 double dpt2 = (
p*
p*sintheta)*(
p*
p*sintheta)*dqovp*dqovp + (
p*costheta)*(
p*costheta)*dtheta*dtheta - 2*(
p*
p*sintheta)*(
p*costheta)*covthetaOvP;
258 if ( dpt2>0 ) dpT = std::sqrt( dpt2 );
272 bool expectBL =
false;
281 unsigned long id = (
unsigned long)
track;
283 for (
int ih=0 ; ih<20 ; ih++ ) {
294 std::string dumpinfo =
track->info().dumpInfo();
296 int trackAuthor = -1;
298 if ( dumpinfo.find(
"TRTStandalone")!=std::string::npos) trackAuthor = 2;
299 else if ( dumpinfo.find(
"TRTSeededTrackFinder")!=std::string::npos) trackAuthor = 1;
300 else trackAuthor = 0;
304 std::cout <<
"\t\t\tSUTT TP track"
311 <<
"\tNtrt=" << nTrHits
312 <<
"\tNstr=" << nStrawHits
313 <<
"\tauthor=" << trackAuthor
320 deta, dphi, dz0, dd0, dpT,
322 nStrawHits, nTrHits, bitmap, 0,
323 trackAuthor,
false, -1, -1,
347 while ( trackitr!=trackend ) {
366 while ( trackitr!=trackend ) {
392 std::vector<double> xpos(Nx,0);
393 std::vector<double> ypos(Ny,0);
396 std::vector<int> xn(Nx,0);
397 std::vector<int> yn(Ny,0);
402 double deltax = 3.0/Nx;
403 double deltay = 3.0/Ny;
410 for ( ; trackitr!=trackend ; ++trackitr ) {
418 double xp[3] = {
track->prodVtx()->x(),
track->prodVtx()->y(),
track->prodVtx()->z() };
422 int ix = xp[0]/deltax + xoffset;
423 int iy = xp[1]/deltay + yoffset;
425 if ( ix<0 || ix>=Nx || iy<0 || iy>=Nx )
continue;
440 for (
size_t i=0 ;
i<xpos.size() ;
i++ ) {
441 if ( xn[
i]>xn[imx] ) imx =
i;
442 if ( yn[
i]>yn[imy] ) imy =
i;
448 if ( xn[imx]>1 ) x0 = xpos[imx]/xn[imx];
449 if ( yn[imy]>1 ) y0 = ypos[imy]/yn[imy];
467 for ( ; trackitr!=trackend; ++trackitr) {
471 double q = (*trackitr)->charge();
475 if (
q==-999 )
q = ptype.
charge( (*trackitr)->pdgId() );
482 bool gotPdgId =
true;
486 bool gotParentPdgId =
true;
491 if ( gotParentPdgId && gotPdgId )
selectTrack( *trackitr, x0, y0);
532 if (
t == 0 )
return false;
552 double pT = measPer->
pt();
553 double eta = measPer->
eta();
554 double phi = measPer->
phi();
558 double q =
track->charge();
566 if (
q==0 )
return 0;
575 if ( !
track->hasProdVtx() )
return false;
580 double xb[3] = { xp[0]-x0, xp[1]-y0, measPer->
prodVtx()->
z() };
581 double xd[3] = { 0, 0, 0 };
583 if (
track->hasDecayVtx() ) {
584 xd[0] =
track->decayVtx()->x();
585 xd[1] =
track->decayVtx()->y();
586 xd[2] =
track->decayVtx()->z();
589 double rp = std::sqrt( xp[0]*xp[0] + xp[1]*xp[1] );
590 double rd = std::sqrt(
xd[0]*
xd[0] +
xd[1]*
xd[1] );
598 bool final_state =
false;
611 const double inner_radius =
m_radius;
612 const double outer_radius =
m_radius;
614 if ( (
track->hasProdVtx() &&
rp<=inner_radius ) &&
615 ( !
track->hasDecayVtx() || rd>outer_radius ) ) final_state =
true;
617 if ( !final_state )
return false;
635 bool expectBL =
false;
643 unsigned long id = (
unsigned long)
track;
647 int trackAuthor =
track->pdgId();
651 std::cout <<
"\t\t\tSUTT TP track"
657 <<
"\tauthor=" << trackAuthor
658 <<
"\tVTX x " << xp[0]<<
"\ty " << xp[1] <<
"\tz " << xp[2]
665 deta, dphi, dz0, dd0, dpT,
667 nStrawHits, nTrtHits, bitmap, 0,
668 trackAuthor,
false,
barcode, -1,
691 unsigned long id = (
unsigned long)(
track.get());
693 unsigned long id = (
unsigned long)
track;
702 if (
track==0 )
return 0;
712 double xp[3] = { 0, 0, 0 };
714 if (
track->genParticle()->production_vertex() ) {
715 xp[0] =
track->genParticle()->production_vertex()->position().x();
716 xp[1] =
track->genParticle()->production_vertex()->position().y();
717 xp[2] =
track->genParticle()->production_vertex()->position().z();
725 double xd[3] = { 0, 0, 0 };
727 if (
track->genParticle()->end_vertex() ) {
728 xd[0] =
track->genParticle()->end_vertex()->position().x();
729 xd[1] =
track->genParticle()->end_vertex()->position().y();
730 xd[2] =
track->genParticle()->end_vertex()->position().z();
733 double rp = std::sqrt( xp[0]*xp[0] + xp[1]*xp[1] );
734 double rd = std::sqrt(
xd[0]*
xd[0] +
xd[1]*
xd[1] );
737 bool final_state =
false;
750 const double inner_radius =
m_radius;
751 const double outer_radius =
m_radius;
752 if ( (
track->genParticle()->production_vertex() &&
rp<=inner_radius ) &&
753 (
track->genParticle()->end_vertex()==0 || rd>outer_radius ) ) final_state =
true;
756 if ( !final_state )
return 0;
769 double q =
track->charge();
777 if (
q==0 )
return 0;
827 unsigned long id = (
unsigned long)
track;
828 if ( tid!=0 )
id = tid;
867 static const int hpmap[20] = { 0, 1, 2, 7, 8, 9, 3, 4, 5, 6, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 };
874 #ifdef TRKPARAMETERS_MEASUREDPERIGEE_H
898 double charge = startPerigee->charge();
899 double eta = startPerigee->eta();
901 double z0 = startPerigee->parameters()[
Trk::z0];
902 double d0 = startPerigee->parameters()[
Trk::d0];
904 double pT = (1./qOverPt);
906 if ( charge<0 && pT>0 )
pT *= -1;
907 if ( charge<0 && p>0 )
p *= -1;
911 #ifdef TRKPARAMETERS_MEASUREDPERIGEE_H
926 double dz0 = std::sqrt((*measPer->covariance())(
Trk::z0,
Trk::z0));
927 double dd0 = std::sqrt((*measPer->covariance())(
Trk::d0,
Trk::d0));
940 double dpT2 = (
p*
p*sintheta)*(
p*
p*sintheta)*dqovp*dqovp + (
p*costheta)*(
p*costheta)*dtheta*dtheta - 2*(
p*
p*sintheta)*(
p*costheta)*covthetaOvP;
942 if ( dpT2>0 ) dpT = std::sqrt( dpT2 );
961 bool expectBL =
false;
965 std::cerr <<
"Could not create TrackSummary - Track will likely fail hits requirements" << std::endl;
975 for (
int ih=0 ; ih<20 ; ih++ ) {
980 unsigned long id = (
unsigned long)
track;
985 if(quality==0) std::cerr <<
"Could not create FitQuality - Track will likely fail hits requirements" << std::endl;
991 int trackAuthor = -1;
1003 if ((
track->info().dumpInfo()).
find(
"TRTStandalone") != std::string::npos) trackAuthor = 2;
1004 else if ((
track->info().dumpInfo()).
find(
"TRTSeededTrackFinder") != std::string::npos) trackAuthor = 1;
1005 else trackAuthor = 0;
1009 std::cout <<
"\t\t\tSUTT TP track"
1016 <<
"\tNtrt=" << nTrHits
1017 <<
"\tNstr=" << nStrawHits
1018 <<
"\tauthor=" << trackAuthor
1023 deta, dphi, dz0, dd0, dpT,
1025 nStrawHits, nTrHits, bitmap, 0,
1026 trackAuthor,
false, -1, -1,
1050 while ( trackitr!=trackend ) {
1071 double pT = measPer->
pt();
1072 double eta = measPer->
eta();
1074 double z0 = measPer->
z0() + measPer->
vz();
1075 double d0 = measPer->
d0();
1084 if ( measPer->
qOverP()==0 )
throw std::runtime_error(
"probable corrupted track - this should never happen" );
1085 double p = 1/measPer->
qOverP();
1109 double dpt2 = (
p*
p*sintheta)*(
p*
p*sintheta)*dqovp*dqovp + (
p*costheta)*(
p*costheta)*dtheta*dtheta - 2*(
p*
p*sintheta)*(
p*costheta)*covthetaOvP;
1111 if ( dpt2>0 ) dpT = std::sqrt( dpt2 );
1120 int nBlayerHits = 2*sum_nBlayerHits;
1128 int nSctHits = sum_nSctHits;
1132 int nStrawHits = sum_nStrawHits;
1136 int nTrtHits = sum_nTrtHits;
1141 bool expectBL = ( sum_expectBL ? true : false );
1155 nSctHits += 1000*sum_sctholes;
1164 double dof =
track->numberDoF();
1166 unsigned long id = (
unsigned long)
track;
1168 unsigned bitmap =
track->hitPattern();
1172 double xbeam =
track->vx();
1173 double ybeam =
track->vy();
1178 int trackAuthor = 0;
1181 std::bitset<xAOD::NumberOfTrackRecoInfo> patternrec =
track->patternRecoInfo();
1184 for (
unsigned ipr=patternrec.size() ; ipr-- ; ) {
1185 if ( patternrec[ipr] ) {
1187 trackAuthor |= (ipr >> 16);
1205 std::cout <<
"\t\t\tSUTT TP track"
1215 <<
"\tauthor=" << trackAuthor
1216 <<
"\tVTX x " <<
track->vx() <<
"\ty " <<
track->vy() <<
"\tz " <<
track->vz()
1223 deta, dphi, dz0, dd0, dpT,
1225 nStrawHits, nTrtHits, bitmap, 0,
1226 trackAuthor,
false, -1, -1,
1248 while ( trackitr!=trackend ) {
1261 while ( trackitr!=trackend ) {
1277 double&
d0,
double& dd0,