1060 std::vector<Trk::VxCascadeInfo*>
result;
1062 std::vector<const xAOD::TrackParticle*> tracksJX;
1065 if (tracksJX.size() != massesJX.size()) {
1066 ATH_MSG_ERROR(
"Problems with JX input: number of tracks or track mass inputs is not correct!");
1072 std::vector<const xAOD::TrackParticle*> tracksV0;
1076 std::vector<const xAOD::TrackParticle*> tracksJpsi{tracksJX[0], tracksJX[1]};
1077 std::vector<const xAOD::TrackParticle*> tracksX;
1081 std::vector<double> massesV0;
1092 TLorentzVector p4_moth, p4_v0,
tmp;
1098 for(
int it=0;
it<V0_helper.nRefTrks();
it++) {
1099 p4_moth += V0_helper.refTrk(
it,massesV0[
it]);
1100 p4_v0 += V0_helper.refTrk(
it,massesV0[
it]);
1124 std::vector<float> trk_px;
1125 std::vector<float> trk_py;
1126 std::vector<float> trk_pz;
1132 std::unique_ptr<Trk::IVKalState> state =
m_iVertexFitter->makeState();
1138 std::vector<Trk::VertexID> vrtList;
1147 vrtList.push_back(vID1);
1156 vrtList.push_back(vID2);
1158 std::vector<const xAOD::TrackParticle*>
tp;
1159 std::vector<double> tp_masses;
1174 std::vector<Trk::VertexID> cnstV;
1181 std::vector<Trk::VertexID> cnstV;
1187 std::vector<Trk::VertexID> cnstV;
1193 std::unique_ptr<Trk::VxCascadeInfo> fit_result = std::unique_ptr<Trk::VxCascadeInfo>(
m_iVertexFitter->fitCascade(*state) );
1197 if(
v->nTrackParticles()==0) {
1198 std::vector<ElementLink<xAOD::TrackParticleContainer> > nullLinkVector;
1199 v->setTrackParticleLinks(nullLinkVector);
1209 double chi2DOF = fit_result->
fitChi2()/fit_result->
nDoF();
1212 const std::vector<std::vector<TLorentzVector> > &moms = fit_result->
getParticleMoms();
1213 const std::vector<xAOD::Vertex*> &cascadeVertices = fit_result->
vertices();
1214 size_t iMoth = cascadeVertices.size()-1;
1215 double lxy_SV1 =
m_CascadeTools->lxy(moms[0],cascadeVertices[0],cascadeVertices[iMoth]);
1217 chi2_V1_decor(*cascadeVertices[0]) = V0vtx->
chiSquared();
1218 ndof_V1_decor(*cascadeVertices[0]) = V0vtx->
numberDoF();
1220 type_V1_decor(*cascadeVertices[0]) =
"Lambda";
1223 type_V1_decor(*cascadeVertices[0]) =
"Lambdabar";
1226 type_V1_decor(*cascadeVertices[0]) =
"Ks";
1228 mDec_gfit(*cascadeVertices[0]) = mAcc_gfit.isAvailable(*V0vtx) ? mAcc_gfit(*V0vtx) : 0;
1229 mDec_gmass(*cascadeVertices[0]) = mAcc_gmass.isAvailable(*V0vtx) ? mAcc_gmass(*V0vtx) : -1;
1230 mDec_gmasserr(*cascadeVertices[0]) = mAcc_gmasserr.isAvailable(*V0vtx) ? mAcc_gmasserr(*V0vtx) : -1;
1231 mDec_gchisq(*cascadeVertices[0]) = mAcc_gchisq.isAvailable(*V0vtx) ? mAcc_gchisq(*V0vtx) : 999999;
1232 mDec_gndof(*cascadeVertices[0]) = mAcc_gndof.isAvailable(*V0vtx) ? mAcc_gndof(*V0vtx) : 0;
1233 mDec_gprob(*cascadeVertices[0]) = mAcc_gprob.isAvailable(*V0vtx) ? mAcc_gprob(*V0vtx) : -1;
1234 trk_px.clear(); trk_py.clear(); trk_pz.clear();
1235 trk_px.reserve(V0_helper.nRefTrks());
1236 trk_py.reserve(V0_helper.nRefTrks());
1237 trk_pz.reserve(V0_helper.nRefTrks());
1238 for(
auto&& vec3 : V0_helper.refTrks()) {
1239 trk_px.push_back( vec3.Px() );
1240 trk_py.push_back( vec3.Py() );
1241 trk_pz.push_back( vec3.Pz() );
1243 trk_pxDeco(*cascadeVertices[0]) = trk_px;
1244 trk_pyDeco(*cascadeVertices[0]) = trk_py;
1245 trk_pzDeco(*cascadeVertices[0]) = trk_pz;
1247 result.push_back( fit_result.release() );
1252 std::vector<double> massesJXExtra = massesJX;
1259 if(
std::find(tracksJX.cbegin(),tracksJX.cend(),tpExtra) != tracksJX.cend())
continue;
1260 if(
std::find(tracksV0.cbegin(),tracksV0.cend(),tpExtra) != tracksV0.cend())
continue;
1266 std::vector<const xAOD::TrackParticle*> tracksJXExtra = tracksJX;
1267 tracksJXExtra.push_back(tpExtra);
1270 std::unique_ptr<Trk::IVKalState> state =
m_iVertexFitter->makeState();
1276 std::vector<Trk::VertexID> vrtList;
1285 vrtList.push_back(vID1);
1289 vID2 =
m_iVertexFitter->nextVertex(tracksJXExtra,massesJXExtra,*state);
1290 vrtList.push_back(vID2);
1292 std::vector<const xAOD::TrackParticle*>
tp;
1293 std::vector<double> tp_masses;
1305 vID2 =
m_iVertexFitter->nextVertex(tracksJXExtra,massesJXExtra,vrtList,*state);
1309 std::vector<Trk::VertexID> cnstV;
1315 std::vector<Trk::VertexID> cnstV;
1321 std::vector<Trk::VertexID> cnstV;
1327 std::unique_ptr<Trk::VxCascadeInfo> fit_result = std::unique_ptr<Trk::VxCascadeInfo>(
m_iVertexFitter->fitCascade(*state) );
1331 if(
v->nTrackParticles()==0) {
1332 std::vector<ElementLink<xAOD::TrackParticleContainer> > nullLinkVector;
1333 v->setTrackParticleLinks(nullLinkVector);
1343 double chi2DOF = fit_result->
fitChi2()/fit_result->
nDoF();
1345 const std::vector<std::vector<TLorentzVector> > &moms = fit_result->
getParticleMoms();
1346 const std::vector<xAOD::Vertex*> &cascadeVertices = fit_result->
vertices();
1347 size_t iMoth = cascadeVertices.size()-1;
1348 double lxy_SV1 =
m_CascadeTools->lxy(moms[0],cascadeVertices[0],cascadeVertices[iMoth]);
1350 chi2_V1_decor(*cascadeVertices[0]) = V0vtx->
chiSquared();
1351 ndof_V1_decor(*cascadeVertices[0]) = V0vtx->
numberDoF();
1353 type_V1_decor(*cascadeVertices[0]) =
"Lambda";
1356 type_V1_decor(*cascadeVertices[0]) =
"Lambdabar";
1359 type_V1_decor(*cascadeVertices[0]) =
"Ks";
1361 mDec_gfit(*cascadeVertices[0]) = mAcc_gfit.isAvailable(*V0vtx) ? mAcc_gfit(*V0vtx) : 0;
1362 mDec_gmass(*cascadeVertices[0]) = mAcc_gmass.isAvailable(*V0vtx) ? mAcc_gmass(*V0vtx) : -1;
1363 mDec_gmasserr(*cascadeVertices[0]) = mAcc_gmasserr.isAvailable(*V0vtx) ? mAcc_gmasserr(*V0vtx) : -1;
1364 mDec_gchisq(*cascadeVertices[0]) = mAcc_gchisq.isAvailable(*V0vtx) ? mAcc_gchisq(*V0vtx) : 999999;
1365 mDec_gndof(*cascadeVertices[0]) = mAcc_gndof.isAvailable(*V0vtx) ? mAcc_gndof(*V0vtx) : 0;
1366 mDec_gprob(*cascadeVertices[0]) = mAcc_gprob.isAvailable(*V0vtx) ? mAcc_gprob(*V0vtx) : -1;
1367 trk_px.clear(); trk_py.clear(); trk_pz.clear();
1368 trk_px.reserve(V0_helper.nRefTrks());
1369 trk_py.reserve(V0_helper.nRefTrks());
1370 trk_pz.reserve(V0_helper.nRefTrks());
1371 for(
auto&& vec3 : V0_helper.refTrks()) {
1372 trk_px.push_back( vec3.Px() );
1373 trk_py.push_back( vec3.Py() );
1374 trk_pz.push_back( vec3.Pz() );
1376 trk_pxDeco(*cascadeVertices[0]) = trk_px;
1377 trk_pyDeco(*cascadeVertices[0]) = trk_py;
1378 trk_pzDeco(*cascadeVertices[0]) = trk_pz;
1380 result.push_back( fit_result.release() );
1386 std::vector<const xAOD::TrackParticle*> tracksPlus;
1387 std::vector<const xAOD::TrackParticle*> tracksMinus;
1392 if(
std::find(tracksJX.cbegin(),tracksJX.cend(),tpExtra) != tracksJX.cend())
continue;
1393 if(
std::find(tracksV0.cbegin(),tracksV0.cend(),tpExtra) != tracksV0.cend())
continue;
1394 if(tpExtra->charge()>0) {
1395 tracksPlus.push_back(tpExtra);
1398 tracksMinus.push_back(tpExtra);
1403 TLorentzVector p4_ExtraTrk1, p4_ExtraTrk2;
1410 if((p4_moth+p4_ExtraTrk1+p4_ExtraTrk2).M() <
m_MassLower || (p4_moth+p4_ExtraTrk1+p4_ExtraTrk2).M() >
m_MassUpper)
continue;
1412 if(etac.V0vtx) etacCandidates.push_back(etac);
1417 std::vector<double> massesJXExtra = massesJX;
1421 for(
auto&& etac : etacCandidates.vector()) {
1422 std::vector<const xAOD::TrackParticle*> tracksExtra{etac.extraTrack1, etac.extraTrack2};
1423 std::vector<const xAOD::TrackParticle*> tracksJXExtra = tracksJX;
1424 tracksJXExtra.push_back(etac.extraTrack1);
1425 tracksJXExtra.push_back(etac.extraTrack2);
1428 std::unique_ptr<Trk::IVKalState> state =
m_iVertexFitter->makeState();
1434 std::vector<Trk::VertexID> vrtList;
1443 vrtList.push_back(vID1);
1447 vID2 =
m_iVertexFitter->nextVertex(tracksJXExtra,massesJXExtra,*state);
1448 vrtList.push_back(vID2);
1450 std::vector<const xAOD::TrackParticle*>
tp;
1451 std::vector<double> tp_masses;
1463 vID2 =
m_iVertexFitter->nextVertex(tracksJXExtra,massesJXExtra,vrtList,*state);
1467 std::vector<Trk::VertexID> cnstV;
1473 std::vector<Trk::VertexID> cnstV;
1479 std::vector<Trk::VertexID> cnstV;
1485 std::vector<Trk::VertexID> cnstV{vID1};
1491 std::unique_ptr<Trk::VxCascadeInfo> fit_result = std::unique_ptr<Trk::VxCascadeInfo>(
m_iVertexFitter->fitCascade(*state) );
1495 if(
v->nTrackParticles()==0) {
1496 std::vector<ElementLink<xAOD::TrackParticleContainer> > nullLinkVector;
1497 v->setTrackParticleLinks(nullLinkVector);
1507 double chi2DOF = fit_result->
fitChi2()/fit_result->
nDoF();
1509 const std::vector<std::vector<TLorentzVector> > &moms = fit_result->
getParticleMoms();
1510 const std::vector<xAOD::Vertex*> &cascadeVertices = fit_result->
vertices();
1511 size_t iMoth = cascadeVertices.size()-1;
1512 double lxy_SV1 =
m_CascadeTools->lxy(moms[0],cascadeVertices[0],cascadeVertices[iMoth]);
1514 chi2_V1_decor(*cascadeVertices[0]) = V0vtx->
chiSquared();
1515 ndof_V1_decor(*cascadeVertices[0]) = V0vtx->
numberDoF();
1517 type_V1_decor(*cascadeVertices[0]) =
"Lambda";
1520 type_V1_decor(*cascadeVertices[0]) =
"Lambdabar";
1523 type_V1_decor(*cascadeVertices[0]) =
"Ks";
1525 mDec_gfit(*cascadeVertices[0]) = mAcc_gfit.isAvailable(*V0vtx) ? mAcc_gfit(*V0vtx) : 0;
1526 mDec_gmass(*cascadeVertices[0]) = mAcc_gmass.isAvailable(*V0vtx) ? mAcc_gmass(*V0vtx) : -1;
1527 mDec_gmasserr(*cascadeVertices[0]) = mAcc_gmasserr.isAvailable(*V0vtx) ? mAcc_gmasserr(*V0vtx) : -1;
1528 mDec_gchisq(*cascadeVertices[0]) = mAcc_gchisq.isAvailable(*V0vtx) ? mAcc_gchisq(*V0vtx) : 999999;
1529 mDec_gndof(*cascadeVertices[0]) = mAcc_gndof.isAvailable(*V0vtx) ? mAcc_gndof(*V0vtx) : 0;
1530 mDec_gprob(*cascadeVertices[0]) = mAcc_gprob.isAvailable(*V0vtx) ? mAcc_gprob(*V0vtx) : -1;
1531 trk_px.clear(); trk_py.clear(); trk_pz.clear();
1532 trk_px.reserve(V0_helper.nRefTrks());
1533 trk_py.reserve(V0_helper.nRefTrks());
1534 trk_pz.reserve(V0_helper.nRefTrks());
1535 for(
auto&& vec3 : V0_helper.refTrks()) {
1536 trk_px.push_back( vec3.Px() );
1537 trk_py.push_back( vec3.Py() );
1538 trk_pz.push_back( vec3.Pz() );
1540 trk_pxDeco(*cascadeVertices[0]) = trk_px;
1541 trk_pyDeco(*cascadeVertices[0]) = trk_py;
1542 trk_pzDeco(*cascadeVertices[0]) = trk_pz;
1544 result.push_back( fit_result.release() );
1550 std::vector<const xAOD::TrackParticle*> tracksPlus;
1551 std::vector<const xAOD::TrackParticle*> tracksMinus;
1554 if( tpExtra->pt() < minTrkPt )
continue;
1557 if(
std::find(tracksJX.cbegin(),tracksJX.cend(),tpExtra) != tracksJX.cend())
continue;
1558 if(
std::find(tracksV0.cbegin(),tracksV0.cend(),tpExtra) != tracksV0.cend())
continue;
1559 if(tpExtra->charge()>0) {
1560 tracksPlus.push_back(tpExtra);
1563 tracksMinus.push_back(tpExtra);
1569 TLorentzVector p4_ExtraTrk1, p4_ExtraTrk2, p4_ExtraTrk3;
1573 for(
auto tp2Itr=tracksMinus.cbegin(); tp2Itr!=tracksMinus.cend(); ++tp2Itr) {
1575 for(
auto tp3Itr=tp2Itr+1; tp3Itr!=tracksMinus.cend(); ++tp3Itr) {
1582 if((p4_moth+p4_ExtraTrk1+p4_ExtraTrk2+p4_ExtraTrk3).M() <
m_MassLower || (p4_moth+p4_ExtraTrk1+p4_ExtraTrk2+p4_ExtraTrk3).M() >
m_MassUpper)
continue;
1584 if(Dpm.extraTrack1) DpmCandidates.push_back(Dpm);
1586 if(Dstpm.extraTrack1) DstpmCandidates.push_back(Dstpm);
1594 for(
auto tp2Itr=tracksPlus.cbegin(); tp2Itr!=tracksPlus.cend(); ++tp2Itr) {
1596 for(
auto tp3Itr=tp2Itr+1; tp3Itr!=tracksPlus.cend(); ++tp3Itr) {
1603 if((p4_moth+p4_ExtraTrk1+p4_ExtraTrk2+p4_ExtraTrk3).M() <
m_MassLower || (p4_moth+p4_ExtraTrk1+p4_ExtraTrk2+p4_ExtraTrk3).M() >
m_MassUpper)
continue;
1605 if(Dpm.extraTrack1) DpmCandidates.push_back(Dpm);
1607 if(Dstpm.extraTrack1) DstpmCandidates.push_back(Dstpm);
1615 for(
auto&& Dpm : DpmCandidates.vector()) {
1616 std::vector<const xAOD::TrackParticle*> tracksExtra{Dpm.extraTrack1,Dpm.extraTrack2,Dpm.extraTrack3};
1619 std::unique_ptr<Trk::IVKalState> state =
m_iVertexFitter->makeState();
1625 std::vector<Trk::VertexID> vrtList;
1634 vrtList.push_back(vID1);
1642 vrtList.push_back(vID2);
1651 std::vector<Trk::VertexID> cnstV;
1657 std::vector<Trk::VertexID> cnstV;
1663 std::vector<Trk::VertexID> cnstV;
1669 std::unique_ptr<Trk::VxCascadeInfo> fit_result = std::unique_ptr<Trk::VxCascadeInfo>(
m_iVertexFitter->fitCascade(*state) );
1673 if(
v->nTrackParticles()==0) {
1674 std::vector<ElementLink<xAOD::TrackParticleContainer> > nullLinkVector;
1675 v->setTrackParticleLinks(nullLinkVector);
1685 double chi2DOF = fit_result->
fitChi2()/fit_result->
nDoF();
1687 const std::vector<std::vector<TLorentzVector> > &moms = fit_result->
getParticleMoms();
1688 const std::vector<xAOD::Vertex*> &cascadeVertices = fit_result->
vertices();
1689 size_t iMoth = cascadeVertices.size()-1;
1690 double lxy_SV1 =
m_CascadeTools->lxy(moms[0],cascadeVertices[0],cascadeVertices[iMoth]);
1691 double lxy_SV2 =
m_CascadeTools->lxy(moms[1],cascadeVertices[1],cascadeVertices[iMoth]);
1693 chi2_V1_decor(*cascadeVertices[0]) = V0vtx->
chiSquared();
1694 ndof_V1_decor(*cascadeVertices[0]) = V0vtx->
numberDoF();
1696 type_V1_decor(*cascadeVertices[0]) =
"Lambda";
1699 type_V1_decor(*cascadeVertices[0]) =
"Lambdabar";
1702 type_V1_decor(*cascadeVertices[0]) =
"Ks";
1704 mDec_gfit(*cascadeVertices[0]) = mAcc_gfit.isAvailable(*V0vtx) ? mAcc_gfit(*V0vtx) : 0;
1705 mDec_gmass(*cascadeVertices[0]) = mAcc_gmass.isAvailable(*V0vtx) ? mAcc_gmass(*V0vtx) : -1;
1706 mDec_gmasserr(*cascadeVertices[0]) = mAcc_gmasserr.isAvailable(*V0vtx) ? mAcc_gmasserr(*V0vtx) : -1;
1707 mDec_gchisq(*cascadeVertices[0]) = mAcc_gchisq.isAvailable(*V0vtx) ? mAcc_gchisq(*V0vtx) : 999999;
1708 mDec_gndof(*cascadeVertices[0]) = mAcc_gndof.isAvailable(*V0vtx) ? mAcc_gndof(*V0vtx) : 0;
1709 mDec_gprob(*cascadeVertices[0]) = mAcc_gprob.isAvailable(*V0vtx) ? mAcc_gprob(*V0vtx) : -1;
1710 trk_px.clear(); trk_py.clear(); trk_pz.clear();
1711 trk_px.reserve(V0_helper.nRefTrks());
1712 trk_py.reserve(V0_helper.nRefTrks());
1713 trk_pz.reserve(V0_helper.nRefTrks());
1714 for(
auto&& vec3 : V0_helper.refTrks()) {
1715 trk_px.push_back( vec3.Px() );
1716 trk_py.push_back( vec3.Py() );
1717 trk_pz.push_back( vec3.Pz() );
1719 trk_pxDeco(*cascadeVertices[0]) = trk_px;
1720 trk_pyDeco(*cascadeVertices[0]) = trk_py;
1721 trk_pzDeco(*cascadeVertices[0]) = trk_pz;
1723 result.push_back( fit_result.release() );
1728 std::vector<double> massesJXExtra = massesJX;
1732 for(
auto&& Dstpm : DstpmCandidates.vector()) {
1733 std::vector<const xAOD::TrackParticle*> tracksExtra12{Dstpm.extraTrack1,Dstpm.extraTrack2};
1734 std::vector<const xAOD::TrackParticle*> tracksJXExtra = tracksJX;
1735 tracksJXExtra.push_back(Dstpm.extraTrack3);
1738 std::unique_ptr<Trk::IVKalState> state =
m_iVertexFitter->makeState();
1744 std::vector<Trk::VertexID> vrtList;
1753 vrtList.push_back(vID1);
1759 vID2 =
m_iVertexFitter->nextVertex(tracksExtra12,massesExtra12,*state);
1761 vrtList.push_back(vID2);
1767 vID3 =
m_iVertexFitter->nextVertex(tracksJXExtra,massesJXExtra,vrtList,*state);
1770 std::vector<Trk::VertexID> cnstV;
1776 std::vector<Trk::VertexID> cnstV;
1782 std::vector<Trk::VertexID> cnstV;
1788 std::vector<Trk::VertexID> cnstV{vID2};
1789 std::vector<const xAOD::TrackParticle*> tracksExtra3{Dstpm.extraTrack3};
1795 std::unique_ptr<Trk::VxCascadeInfo> fit_result = std::unique_ptr<Trk::VxCascadeInfo>(
m_iVertexFitter->fitCascade(*state) );
1799 if(
v->nTrackParticles()==0) {
1800 std::vector<ElementLink<xAOD::TrackParticleContainer> > nullLinkVector;
1801 v->setTrackParticleLinks(nullLinkVector);
1811 double chi2DOF = fit_result->
fitChi2()/fit_result->
nDoF();
1813 const std::vector<std::vector<TLorentzVector> > &moms = fit_result->
getParticleMoms();
1814 const std::vector<xAOD::Vertex*> &cascadeVertices = fit_result->
vertices();
1815 size_t iMoth = cascadeVertices.size()-1;
1816 double lxy_SV1 =
m_CascadeTools->lxy(moms[0],cascadeVertices[0],cascadeVertices[iMoth]);
1817 double lxy_SV2 =
m_CascadeTools->lxy(moms[1],cascadeVertices[1],cascadeVertices[iMoth]);
1819 chi2_V1_decor(*cascadeVertices[0]) = V0vtx->
chiSquared();
1820 ndof_V1_decor(*cascadeVertices[0]) = V0vtx->
numberDoF();
1822 type_V1_decor(*cascadeVertices[0]) =
"Lambda";
1825 type_V1_decor(*cascadeVertices[0]) =
"Lambdabar";
1828 type_V1_decor(*cascadeVertices[0]) =
"Ks";
1830 mDec_gfit(*cascadeVertices[0]) = mAcc_gfit.isAvailable(*V0vtx) ? mAcc_gfit(*V0vtx) : 0;
1831 mDec_gmass(*cascadeVertices[0]) = mAcc_gmass.isAvailable(*V0vtx) ? mAcc_gmass(*V0vtx) : -1;
1832 mDec_gmasserr(*cascadeVertices[0]) = mAcc_gmasserr.isAvailable(*V0vtx) ? mAcc_gmasserr(*V0vtx) : -1;
1833 mDec_gchisq(*cascadeVertices[0]) = mAcc_gchisq.isAvailable(*V0vtx) ? mAcc_gchisq(*V0vtx) : 999999;
1834 mDec_gndof(*cascadeVertices[0]) = mAcc_gndof.isAvailable(*V0vtx) ? mAcc_gndof(*V0vtx) : 0;
1835 mDec_gprob(*cascadeVertices[0]) = mAcc_gprob.isAvailable(*V0vtx) ? mAcc_gprob(*V0vtx) : -1;
1836 trk_px.clear(); trk_py.clear(); trk_pz.clear();
1837 trk_px.reserve(V0_helper.nRefTrks());
1838 trk_py.reserve(V0_helper.nRefTrks());
1839 trk_pz.reserve(V0_helper.nRefTrks());
1840 for(
auto&& vec3 : V0_helper.refTrks()) {
1841 trk_px.push_back( vec3.Px() );
1842 trk_py.push_back( vec3.Py() );
1843 trk_pz.push_back( vec3.Pz() );
1845 trk_pxDeco(*cascadeVertices[0]) = trk_px;
1846 trk_pyDeco(*cascadeVertices[0]) = trk_py;
1847 trk_pzDeco(*cascadeVertices[0]) = trk_pz;
1849 result.push_back( fit_result.release() );