1063 std::vector<Trk::VxCascadeInfo*>
result;
1065 std::vector<const xAOD::TrackParticle*> tracksJX;
1068 if (tracksJX.size() != massesJX.size()) {
1069 ATH_MSG_ERROR(
"Problems with JX input: number of tracks or track mass inputs is not correct!");
1075 std::vector<const xAOD::TrackParticle*> tracksV0;
1079 std::vector<const xAOD::TrackParticle*> tracksJpsi{tracksJX[0], tracksJX[1]};
1080 std::vector<const xAOD::TrackParticle*> tracksX;
1084 std::vector<double> massesV0;
1095 TLorentzVector p4_moth, p4_v0,
tmp;
1101 for(
int it=0;
it<V0_helper.nRefTrks();
it++) {
1102 p4_moth += V0_helper.refTrk(
it,massesV0[
it]);
1103 p4_v0 += V0_helper.refTrk(
it,massesV0[
it]);
1127 std::vector<float> trk_px;
1128 std::vector<float> trk_py;
1129 std::vector<float> trk_pz;
1135 std::unique_ptr<Trk::IVKalState> state =
m_iVertexFitter->makeState();
1141 std::vector<Trk::VertexID> vrtList;
1150 vrtList.push_back(vID1);
1159 vrtList.push_back(vID2);
1161 std::vector<const xAOD::TrackParticle*>
tp;
1162 std::vector<double> tp_masses;
1177 std::vector<Trk::VertexID> cnstV;
1184 std::vector<Trk::VertexID> cnstV;
1190 std::vector<Trk::VertexID> cnstV;
1196 std::unique_ptr<Trk::VxCascadeInfo> fit_result = std::unique_ptr<Trk::VxCascadeInfo>(
m_iVertexFitter->fitCascade(*state) );
1200 if(
v->nTrackParticles()==0) {
1201 std::vector<ElementLink<xAOD::TrackParticleContainer> > nullLinkVector;
1202 v->setTrackParticleLinks(nullLinkVector);
1212 double chi2DOF = fit_result->
fitChi2()/fit_result->
nDoF();
1215 const std::vector<std::vector<TLorentzVector> > &moms = fit_result->
getParticleMoms();
1216 const std::vector<xAOD::Vertex*> &cascadeVertices = fit_result->
vertices();
1217 size_t iMoth = cascadeVertices.size()-1;
1218 double lxy_SV1 =
m_CascadeTools->lxy(moms[0],cascadeVertices[0],cascadeVertices[iMoth]);
1220 chi2_V1_decor(*cascadeVertices[0]) = V0vtx->
chiSquared();
1221 ndof_V1_decor(*cascadeVertices[0]) = V0vtx->
numberDoF();
1223 type_V1_decor(*cascadeVertices[0]) =
"Lambda";
1226 type_V1_decor(*cascadeVertices[0]) =
"Lambdabar";
1229 type_V1_decor(*cascadeVertices[0]) =
"Ks";
1231 mDec_gfit(*cascadeVertices[0]) = mAcc_gfit.isAvailable(*V0vtx) ? mAcc_gfit(*V0vtx) : 0;
1232 mDec_gmass(*cascadeVertices[0]) = mAcc_gmass.isAvailable(*V0vtx) ? mAcc_gmass(*V0vtx) : -1;
1233 mDec_gmasserr(*cascadeVertices[0]) = mAcc_gmasserr.isAvailable(*V0vtx) ? mAcc_gmasserr(*V0vtx) : -1;
1234 mDec_gchisq(*cascadeVertices[0]) = mAcc_gchisq.isAvailable(*V0vtx) ? mAcc_gchisq(*V0vtx) : 999999;
1235 mDec_gndof(*cascadeVertices[0]) = mAcc_gndof.isAvailable(*V0vtx) ? mAcc_gndof(*V0vtx) : 0;
1236 mDec_gprob(*cascadeVertices[0]) = mAcc_gprob.isAvailable(*V0vtx) ? mAcc_gprob(*V0vtx) : -1;
1237 trk_px.clear(); trk_py.clear(); trk_pz.clear();
1238 trk_px.reserve(V0_helper.nRefTrks());
1239 trk_py.reserve(V0_helper.nRefTrks());
1240 trk_pz.reserve(V0_helper.nRefTrks());
1241 for(
auto&& vec3 : V0_helper.refTrks()) {
1242 trk_px.push_back( vec3.Px() );
1243 trk_py.push_back( vec3.Py() );
1244 trk_pz.push_back( vec3.Pz() );
1246 trk_pxDeco(*cascadeVertices[0]) = trk_px;
1247 trk_pyDeco(*cascadeVertices[0]) = trk_py;
1248 trk_pzDeco(*cascadeVertices[0]) = trk_pz;
1250 result.push_back( fit_result.release() );
1255 std::vector<double> massesJXExtra = massesJX;
1262 if(
std::find(tracksJX.cbegin(),tracksJX.cend(),tpExtra) != tracksJX.cend())
continue;
1263 if(
std::find(tracksV0.cbegin(),tracksV0.cend(),tpExtra) != tracksV0.cend())
continue;
1269 std::vector<const xAOD::TrackParticle*> tracksJXExtra = tracksJX;
1270 tracksJXExtra.push_back(tpExtra);
1273 std::unique_ptr<Trk::IVKalState> state =
m_iVertexFitter->makeState();
1279 std::vector<Trk::VertexID> vrtList;
1288 vrtList.push_back(vID1);
1292 vID2 =
m_iVertexFitter->nextVertex(tracksJXExtra,massesJXExtra,*state);
1293 vrtList.push_back(vID2);
1295 std::vector<const xAOD::TrackParticle*>
tp;
1296 std::vector<double> tp_masses;
1308 vID2 =
m_iVertexFitter->nextVertex(tracksJXExtra,massesJXExtra,vrtList,*state);
1312 std::vector<Trk::VertexID> cnstV;
1318 std::vector<Trk::VertexID> cnstV;
1324 std::vector<Trk::VertexID> cnstV;
1330 std::unique_ptr<Trk::VxCascadeInfo> fit_result = std::unique_ptr<Trk::VxCascadeInfo>(
m_iVertexFitter->fitCascade(*state) );
1334 if(
v->nTrackParticles()==0) {
1335 std::vector<ElementLink<xAOD::TrackParticleContainer> > nullLinkVector;
1336 v->setTrackParticleLinks(nullLinkVector);
1346 double chi2DOF = fit_result->
fitChi2()/fit_result->
nDoF();
1348 const std::vector<std::vector<TLorentzVector> > &moms = fit_result->
getParticleMoms();
1349 const std::vector<xAOD::Vertex*> &cascadeVertices = fit_result->
vertices();
1350 size_t iMoth = cascadeVertices.size()-1;
1351 double lxy_SV1 =
m_CascadeTools->lxy(moms[0],cascadeVertices[0],cascadeVertices[iMoth]);
1353 chi2_V1_decor(*cascadeVertices[0]) = V0vtx->
chiSquared();
1354 ndof_V1_decor(*cascadeVertices[0]) = V0vtx->
numberDoF();
1356 type_V1_decor(*cascadeVertices[0]) =
"Lambda";
1359 type_V1_decor(*cascadeVertices[0]) =
"Lambdabar";
1362 type_V1_decor(*cascadeVertices[0]) =
"Ks";
1364 mDec_gfit(*cascadeVertices[0]) = mAcc_gfit.isAvailable(*V0vtx) ? mAcc_gfit(*V0vtx) : 0;
1365 mDec_gmass(*cascadeVertices[0]) = mAcc_gmass.isAvailable(*V0vtx) ? mAcc_gmass(*V0vtx) : -1;
1366 mDec_gmasserr(*cascadeVertices[0]) = mAcc_gmasserr.isAvailable(*V0vtx) ? mAcc_gmasserr(*V0vtx) : -1;
1367 mDec_gchisq(*cascadeVertices[0]) = mAcc_gchisq.isAvailable(*V0vtx) ? mAcc_gchisq(*V0vtx) : 999999;
1368 mDec_gndof(*cascadeVertices[0]) = mAcc_gndof.isAvailable(*V0vtx) ? mAcc_gndof(*V0vtx) : 0;
1369 mDec_gprob(*cascadeVertices[0]) = mAcc_gprob.isAvailable(*V0vtx) ? mAcc_gprob(*V0vtx) : -1;
1370 trk_px.clear(); trk_py.clear(); trk_pz.clear();
1371 trk_px.reserve(V0_helper.nRefTrks());
1372 trk_py.reserve(V0_helper.nRefTrks());
1373 trk_pz.reserve(V0_helper.nRefTrks());
1374 for(
auto&& vec3 : V0_helper.refTrks()) {
1375 trk_px.push_back( vec3.Px() );
1376 trk_py.push_back( vec3.Py() );
1377 trk_pz.push_back( vec3.Pz() );
1379 trk_pxDeco(*cascadeVertices[0]) = trk_px;
1380 trk_pyDeco(*cascadeVertices[0]) = trk_py;
1381 trk_pzDeco(*cascadeVertices[0]) = trk_pz;
1383 result.push_back( fit_result.release() );
1389 std::vector<const xAOD::TrackParticle*> tracksPlus;
1390 std::vector<const xAOD::TrackParticle*> tracksMinus;
1395 if(
std::find(tracksJX.cbegin(),tracksJX.cend(),tpExtra) != tracksJX.cend())
continue;
1396 if(
std::find(tracksV0.cbegin(),tracksV0.cend(),tpExtra) != tracksV0.cend())
continue;
1397 if(tpExtra->charge()>0) {
1398 tracksPlus.push_back(tpExtra);
1401 tracksMinus.push_back(tpExtra);
1406 TLorentzVector p4_ExtraTrk1, p4_ExtraTrk2;
1413 if((p4_moth+p4_ExtraTrk1+p4_ExtraTrk2).M() <
m_MassLower || (p4_moth+p4_ExtraTrk1+p4_ExtraTrk2).M() >
m_MassUpper)
continue;
1415 if(etac.V0vtx) etacCandidates.push_back(etac);
1420 std::vector<double> massesJXExtra = massesJX;
1424 for(
auto&& etac : etacCandidates.vector()) {
1425 std::vector<const xAOD::TrackParticle*> tracksExtra{etac.extraTrack1, etac.extraTrack2};
1426 std::vector<const xAOD::TrackParticle*> tracksJXExtra = tracksJX;
1427 tracksJXExtra.push_back(etac.extraTrack1);
1428 tracksJXExtra.push_back(etac.extraTrack2);
1431 std::unique_ptr<Trk::IVKalState> state =
m_iVertexFitter->makeState();
1437 std::vector<Trk::VertexID> vrtList;
1446 vrtList.push_back(vID1);
1450 vID2 =
m_iVertexFitter->nextVertex(tracksJXExtra,massesJXExtra,*state);
1451 vrtList.push_back(vID2);
1453 std::vector<const xAOD::TrackParticle*>
tp;
1454 std::vector<double> tp_masses;
1466 vID2 =
m_iVertexFitter->nextVertex(tracksJXExtra,massesJXExtra,vrtList,*state);
1470 std::vector<Trk::VertexID> cnstV;
1476 std::vector<Trk::VertexID> cnstV;
1482 std::vector<Trk::VertexID> cnstV;
1488 std::vector<Trk::VertexID> cnstV{vID1};
1494 std::unique_ptr<Trk::VxCascadeInfo> fit_result = std::unique_ptr<Trk::VxCascadeInfo>(
m_iVertexFitter->fitCascade(*state) );
1498 if(
v->nTrackParticles()==0) {
1499 std::vector<ElementLink<xAOD::TrackParticleContainer> > nullLinkVector;
1500 v->setTrackParticleLinks(nullLinkVector);
1510 double chi2DOF = fit_result->
fitChi2()/fit_result->
nDoF();
1512 const std::vector<std::vector<TLorentzVector> > &moms = fit_result->
getParticleMoms();
1513 const std::vector<xAOD::Vertex*> &cascadeVertices = fit_result->
vertices();
1514 size_t iMoth = cascadeVertices.size()-1;
1515 double lxy_SV1 =
m_CascadeTools->lxy(moms[0],cascadeVertices[0],cascadeVertices[iMoth]);
1517 chi2_V1_decor(*cascadeVertices[0]) = V0vtx->
chiSquared();
1518 ndof_V1_decor(*cascadeVertices[0]) = V0vtx->
numberDoF();
1520 type_V1_decor(*cascadeVertices[0]) =
"Lambda";
1523 type_V1_decor(*cascadeVertices[0]) =
"Lambdabar";
1526 type_V1_decor(*cascadeVertices[0]) =
"Ks";
1528 mDec_gfit(*cascadeVertices[0]) = mAcc_gfit.isAvailable(*V0vtx) ? mAcc_gfit(*V0vtx) : 0;
1529 mDec_gmass(*cascadeVertices[0]) = mAcc_gmass.isAvailable(*V0vtx) ? mAcc_gmass(*V0vtx) : -1;
1530 mDec_gmasserr(*cascadeVertices[0]) = mAcc_gmasserr.isAvailable(*V0vtx) ? mAcc_gmasserr(*V0vtx) : -1;
1531 mDec_gchisq(*cascadeVertices[0]) = mAcc_gchisq.isAvailable(*V0vtx) ? mAcc_gchisq(*V0vtx) : 999999;
1532 mDec_gndof(*cascadeVertices[0]) = mAcc_gndof.isAvailable(*V0vtx) ? mAcc_gndof(*V0vtx) : 0;
1533 mDec_gprob(*cascadeVertices[0]) = mAcc_gprob.isAvailable(*V0vtx) ? mAcc_gprob(*V0vtx) : -1;
1534 trk_px.clear(); trk_py.clear(); trk_pz.clear();
1535 trk_px.reserve(V0_helper.nRefTrks());
1536 trk_py.reserve(V0_helper.nRefTrks());
1537 trk_pz.reserve(V0_helper.nRefTrks());
1538 for(
auto&& vec3 : V0_helper.refTrks()) {
1539 trk_px.push_back( vec3.Px() );
1540 trk_py.push_back( vec3.Py() );
1541 trk_pz.push_back( vec3.Pz() );
1543 trk_pxDeco(*cascadeVertices[0]) = trk_px;
1544 trk_pyDeco(*cascadeVertices[0]) = trk_py;
1545 trk_pzDeco(*cascadeVertices[0]) = trk_pz;
1547 result.push_back( fit_result.release() );
1553 std::vector<const xAOD::TrackParticle*> tracksPlus;
1554 std::vector<const xAOD::TrackParticle*> tracksMinus;
1557 if( tpExtra->pt() < minTrkPt )
continue;
1560 if(
std::find(tracksJX.cbegin(),tracksJX.cend(),tpExtra) != tracksJX.cend())
continue;
1561 if(
std::find(tracksV0.cbegin(),tracksV0.cend(),tpExtra) != tracksV0.cend())
continue;
1562 if(tpExtra->charge()>0) {
1563 tracksPlus.push_back(tpExtra);
1566 tracksMinus.push_back(tpExtra);
1572 TLorentzVector p4_ExtraTrk1, p4_ExtraTrk2, p4_ExtraTrk3;
1576 for(
auto tp2Itr=tracksMinus.cbegin(); tp2Itr!=tracksMinus.cend(); ++tp2Itr) {
1578 for(
auto tp3Itr=tp2Itr+1; tp3Itr!=tracksMinus.cend(); ++tp3Itr) {
1585 if((p4_moth+p4_ExtraTrk1+p4_ExtraTrk2+p4_ExtraTrk3).M() <
m_MassLower || (p4_moth+p4_ExtraTrk1+p4_ExtraTrk2+p4_ExtraTrk3).M() >
m_MassUpper)
continue;
1587 if(Dpm.extraTrack1) DpmCandidates.push_back(Dpm);
1589 if(Dstpm.extraTrack1) DstpmCandidates.push_back(Dstpm);
1597 for(
auto tp2Itr=tracksPlus.cbegin(); tp2Itr!=tracksPlus.cend(); ++tp2Itr) {
1599 for(
auto tp3Itr=tp2Itr+1; tp3Itr!=tracksPlus.cend(); ++tp3Itr) {
1606 if((p4_moth+p4_ExtraTrk1+p4_ExtraTrk2+p4_ExtraTrk3).M() <
m_MassLower || (p4_moth+p4_ExtraTrk1+p4_ExtraTrk2+p4_ExtraTrk3).M() >
m_MassUpper)
continue;
1608 if(Dpm.extraTrack1) DpmCandidates.push_back(Dpm);
1610 if(Dstpm.extraTrack1) DstpmCandidates.push_back(Dstpm);
1618 for(
auto&& Dpm : DpmCandidates.vector()) {
1619 std::vector<const xAOD::TrackParticle*> tracksExtra{Dpm.extraTrack1,Dpm.extraTrack2,Dpm.extraTrack3};
1622 std::unique_ptr<Trk::IVKalState> state =
m_iVertexFitter->makeState();
1628 std::vector<Trk::VertexID> vrtList;
1637 vrtList.push_back(vID1);
1645 vrtList.push_back(vID2);
1654 std::vector<Trk::VertexID> cnstV;
1660 std::vector<Trk::VertexID> cnstV;
1666 std::vector<Trk::VertexID> cnstV;
1672 std::unique_ptr<Trk::VxCascadeInfo> fit_result = std::unique_ptr<Trk::VxCascadeInfo>(
m_iVertexFitter->fitCascade(*state) );
1676 if(
v->nTrackParticles()==0) {
1677 std::vector<ElementLink<xAOD::TrackParticleContainer> > nullLinkVector;
1678 v->setTrackParticleLinks(nullLinkVector);
1688 double chi2DOF = fit_result->
fitChi2()/fit_result->
nDoF();
1690 const std::vector<std::vector<TLorentzVector> > &moms = fit_result->
getParticleMoms();
1691 const std::vector<xAOD::Vertex*> &cascadeVertices = fit_result->
vertices();
1692 size_t iMoth = cascadeVertices.size()-1;
1693 double lxy_SV1 =
m_CascadeTools->lxy(moms[0],cascadeVertices[0],cascadeVertices[iMoth]);
1694 double lxy_SV2 =
m_CascadeTools->lxy(moms[1],cascadeVertices[1],cascadeVertices[iMoth]);
1696 chi2_V1_decor(*cascadeVertices[0]) = V0vtx->
chiSquared();
1697 ndof_V1_decor(*cascadeVertices[0]) = V0vtx->
numberDoF();
1699 type_V1_decor(*cascadeVertices[0]) =
"Lambda";
1702 type_V1_decor(*cascadeVertices[0]) =
"Lambdabar";
1705 type_V1_decor(*cascadeVertices[0]) =
"Ks";
1707 mDec_gfit(*cascadeVertices[0]) = mAcc_gfit.isAvailable(*V0vtx) ? mAcc_gfit(*V0vtx) : 0;
1708 mDec_gmass(*cascadeVertices[0]) = mAcc_gmass.isAvailable(*V0vtx) ? mAcc_gmass(*V0vtx) : -1;
1709 mDec_gmasserr(*cascadeVertices[0]) = mAcc_gmasserr.isAvailable(*V0vtx) ? mAcc_gmasserr(*V0vtx) : -1;
1710 mDec_gchisq(*cascadeVertices[0]) = mAcc_gchisq.isAvailable(*V0vtx) ? mAcc_gchisq(*V0vtx) : 999999;
1711 mDec_gndof(*cascadeVertices[0]) = mAcc_gndof.isAvailable(*V0vtx) ? mAcc_gndof(*V0vtx) : 0;
1712 mDec_gprob(*cascadeVertices[0]) = mAcc_gprob.isAvailable(*V0vtx) ? mAcc_gprob(*V0vtx) : -1;
1713 trk_px.clear(); trk_py.clear(); trk_pz.clear();
1714 trk_px.reserve(V0_helper.nRefTrks());
1715 trk_py.reserve(V0_helper.nRefTrks());
1716 trk_pz.reserve(V0_helper.nRefTrks());
1717 for(
auto&& vec3 : V0_helper.refTrks()) {
1718 trk_px.push_back( vec3.Px() );
1719 trk_py.push_back( vec3.Py() );
1720 trk_pz.push_back( vec3.Pz() );
1722 trk_pxDeco(*cascadeVertices[0]) = trk_px;
1723 trk_pyDeco(*cascadeVertices[0]) = trk_py;
1724 trk_pzDeco(*cascadeVertices[0]) = trk_pz;
1726 result.push_back( fit_result.release() );
1731 std::vector<double> massesJXExtra = massesJX;
1735 for(
auto&& Dstpm : DstpmCandidates.vector()) {
1736 std::vector<const xAOD::TrackParticle*> tracksExtra12{Dstpm.extraTrack1,Dstpm.extraTrack2};
1737 std::vector<const xAOD::TrackParticle*> tracksJXExtra = tracksJX;
1738 tracksJXExtra.push_back(Dstpm.extraTrack3);
1741 std::unique_ptr<Trk::IVKalState> state =
m_iVertexFitter->makeState();
1747 std::vector<Trk::VertexID> vrtList;
1756 vrtList.push_back(vID1);
1762 vID2 =
m_iVertexFitter->nextVertex(tracksExtra12,massesExtra12,*state);
1764 vrtList.push_back(vID2);
1770 vID3 =
m_iVertexFitter->nextVertex(tracksJXExtra,massesJXExtra,vrtList,*state);
1773 std::vector<Trk::VertexID> cnstV;
1779 std::vector<Trk::VertexID> cnstV;
1785 std::vector<Trk::VertexID> cnstV;
1791 std::vector<Trk::VertexID> cnstV{vID2};
1792 std::vector<const xAOD::TrackParticle*> tracksExtra3{Dstpm.extraTrack3};
1798 std::unique_ptr<Trk::VxCascadeInfo> fit_result = std::unique_ptr<Trk::VxCascadeInfo>(
m_iVertexFitter->fitCascade(*state) );
1802 if(
v->nTrackParticles()==0) {
1803 std::vector<ElementLink<xAOD::TrackParticleContainer> > nullLinkVector;
1804 v->setTrackParticleLinks(nullLinkVector);
1814 double chi2DOF = fit_result->
fitChi2()/fit_result->
nDoF();
1816 const std::vector<std::vector<TLorentzVector> > &moms = fit_result->
getParticleMoms();
1817 const std::vector<xAOD::Vertex*> &cascadeVertices = fit_result->
vertices();
1818 size_t iMoth = cascadeVertices.size()-1;
1819 double lxy_SV1 =
m_CascadeTools->lxy(moms[0],cascadeVertices[0],cascadeVertices[iMoth]);
1820 double lxy_SV2 =
m_CascadeTools->lxy(moms[1],cascadeVertices[1],cascadeVertices[iMoth]);
1822 chi2_V1_decor(*cascadeVertices[0]) = V0vtx->
chiSquared();
1823 ndof_V1_decor(*cascadeVertices[0]) = V0vtx->
numberDoF();
1825 type_V1_decor(*cascadeVertices[0]) =
"Lambda";
1828 type_V1_decor(*cascadeVertices[0]) =
"Lambdabar";
1831 type_V1_decor(*cascadeVertices[0]) =
"Ks";
1833 mDec_gfit(*cascadeVertices[0]) = mAcc_gfit.isAvailable(*V0vtx) ? mAcc_gfit(*V0vtx) : 0;
1834 mDec_gmass(*cascadeVertices[0]) = mAcc_gmass.isAvailable(*V0vtx) ? mAcc_gmass(*V0vtx) : -1;
1835 mDec_gmasserr(*cascadeVertices[0]) = mAcc_gmasserr.isAvailable(*V0vtx) ? mAcc_gmasserr(*V0vtx) : -1;
1836 mDec_gchisq(*cascadeVertices[0]) = mAcc_gchisq.isAvailable(*V0vtx) ? mAcc_gchisq(*V0vtx) : 999999;
1837 mDec_gndof(*cascadeVertices[0]) = mAcc_gndof.isAvailable(*V0vtx) ? mAcc_gndof(*V0vtx) : 0;
1838 mDec_gprob(*cascadeVertices[0]) = mAcc_gprob.isAvailable(*V0vtx) ? mAcc_gprob(*V0vtx) : -1;
1839 trk_px.clear(); trk_py.clear(); trk_pz.clear();
1840 trk_px.reserve(V0_helper.nRefTrks());
1841 trk_py.reserve(V0_helper.nRefTrks());
1842 trk_pz.reserve(V0_helper.nRefTrks());
1843 for(
auto&& vec3 : V0_helper.refTrks()) {
1844 trk_px.push_back( vec3.Px() );
1845 trk_py.push_back( vec3.Py() );
1846 trk_pz.push_back( vec3.Pz() );
1848 trk_pxDeco(*cascadeVertices[0]) = trk_px;
1849 trk_pyDeco(*cascadeVertices[0]) = trk_py;
1850 trk_pzDeco(*cascadeVertices[0]) = trk_pz;
1852 result.push_back( fit_result.release() );