11 #include "HepPDT/ParticleDataTable.hh"
25 typedef std::vector<const xAOD::TrackParticle*>
TrackBag;
29 return ptr ?
ptr->mass() : 0.;
63 return StatusCode::SUCCESS;
69 std::vector<Trk::VxCascadeInfo*> cascadeinfoContainer;
70 constexpr
int topoN = 3;
71 std::array<xAOD::VertexContainer*, topoN> Vtxwritehandles;
72 std::array<xAOD::VertexAuxContainer*, topoN> Vtxwritehandlesaux;
75 for(
int i =0;
i<topoN;
i++){
78 Vtxwritehandles[
i]->setStore(Vtxwritehandlesaux[
i]);
91 if (pvContainer->
size()==0){
93 return StatusCode::RECOVERABLE;
95 primaryVertex = (*pvContainer)[0];
112 refPvContainer->setStore(refPvAuxContainer);
161 ATH_MSG_DEBUG(
"cascadeinfoContainer size " << cascadeinfoContainer.size());
177 return StatusCode::FAILURE;
198 const std::vector<xAOD::Vertex*> &cascadeVertices =
x->vertices();
199 if(cascadeVertices.size()!=topoN)
201 if(cascadeVertices[0] ==
nullptr || cascadeVertices[1] ==
nullptr || cascadeVertices[2] ==
nullptr)
ATH_MSG_ERROR(
"Error null vertex");
203 for(
int i =0;
i<topoN;
i++) Vtxwritehandles[
i]->push_back(cascadeVertices[
i]);
205 x->setSVOwnership(
false);
206 const auto mainVertex = cascadeVertices[2];
207 const std::vector< std::vector<TLorentzVector> > &moms =
x->getParticleMoms();
210 std::vector<const xAOD::Vertex*> verticestoLink;
211 verticestoLink.push_back(cascadeVertices[0]);
213 if(Vtxwritehandles[2] ==
nullptr)
ATH_MSG_ERROR(
"Vtxwritehandles[2] is null");
217 verticestoLink.clear();
218 verticestoLink.push_back(cascadeVertices[1]);
223 const xAOD::Vertex* jpsipiVertex = BPhysPVCascadeTools::FindVertex<3>(jpsipiContainer, cascadeVertices[2]);
224 ATH_MSG_DEBUG(
"1 pt Jpsi+pi tracks " << cascadeVertices[2]->trackParticle(0)->
pt() <<
", " << cascadeVertices[2]->trackParticle(1)->
pt() <<
", " << cascadeVertices[2]->trackParticle(2)->
pt());
228 const xAOD::Vertex* d0Vertex = BPhysPVCascadeTools::FindVertex<2>(d0Container, cascadeVertices[1]);;
229 ATH_MSG_DEBUG(
"1 pt D0 tracks " << cascadeVertices[1]->trackParticle(0)->
pt() <<
", " << cascadeVertices[1]->trackParticle(1)->
pt());
233 const xAOD::Vertex* k0Vertex = BPhysPVCascadeTools::FindVertex<2>(k0Container, cascadeVertices[0]);;
234 ATH_MSG_DEBUG(
"1 pt K_S0 tracks " << cascadeVertices[0]->trackParticle(0)->
pt() <<
", " << cascadeVertices[0]->trackParticle(1)->
pt());
238 std::vector<const xAOD::Vertex*> jpsipiVerticestoLink;
239 if (jpsipiVertex) jpsipiVerticestoLink.push_back(jpsipiVertex);
244 std::vector<const xAOD::Vertex*> d0VerticestoLink;
245 if (d0Vertex) d0VerticestoLink.push_back(d0Vertex);
250 std::vector<const xAOD::Vertex*> k0VerticestoLink;
251 if (k0Vertex) k0VerticestoLink.push_back(k0Vertex);
264 std::vector<double> massesJpsipi;
268 std::vector<double> massesD0;
276 std::vector<double> massesK0;
279 std::vector<double> Masses;
301 PtErr_decor(*mainVertex) =
m_CascadeTools->pTError(moms[2],
x->getCovariance()[2]);
303 chi2_decor(*mainVertex) =
x->fitChi2();
304 ndof_decor(*mainVertex) =
x->nDoF();
308 TLorentzVector p4_mu1, p4_mu2;
315 massMumu = (p4_mu1 + p4_mu2).M();
317 MassMumu_decor(*mainVertex) = massMumu;
321 TLorentzVector p4_ka, p4_pi;
337 massKpi = (p4_ka + p4_pi).M();
339 MassKpi_svdecor(*mainVertex) = massKpi;
343 TLorentzVector p4_pip, p4_pim;
350 massPipi = (p4_pip + p4_pim).M();
352 MassPipi_sv2decor(*mainVertex) = massPipi;
354 MassJpsi_decor(*mainVertex) = (moms[2][0] + moms[2][1]).M();
355 MassPiD0_decor(*mainVertex) = (moms[2][2] + moms[2][4]).M();
356 MassPiD0K0_decor(*mainVertex) = (moms[2][2] + moms[2][4] + moms[2][3]).M();
363 Mass_svdecor(*mainVertex) =
m_CascadeTools->invariantMass(moms[1]);
364 MassErr_svdecor(*mainVertex) =
m_CascadeTools->invariantMassError(moms[1],
x->getCovariance()[1]);
366 PtErr_svdecor(*mainVertex) =
m_CascadeTools->pTError(moms[1],
x->getCovariance()[1]);
367 Lxy_svdecor(*mainVertex) =
m_CascadeTools->lxy(moms[1],cascadeVertices[1],cascadeVertices[2]);
368 LxyErr_svdecor(*mainVertex) =
m_CascadeTools->lxyError(moms[1],
x->getCovariance()[1],cascadeVertices[1],cascadeVertices[2]);
369 Tau_svdecor(*mainVertex) =
m_CascadeTools->tau(moms[1],cascadeVertices[1],cascadeVertices[2]);
370 TauErr_svdecor(*mainVertex) =
m_CascadeTools->tauError(moms[1],
x->getCovariance()[1],cascadeVertices[1],cascadeVertices[2]);
374 Mass_sv2decor(*mainVertex) =
m_CascadeTools->invariantMass(moms[0]);
375 MassErr_sv2decor(*mainVertex) =
m_CascadeTools->invariantMassError(moms[0],
x->getCovariance()[0]);
377 PtErr_sv2decor(*mainVertex) =
m_CascadeTools->pTError(moms[0],
x->getCovariance()[0]);
378 Lxy_sv2decor(*mainVertex) =
m_CascadeTools->lxy(moms[0],cascadeVertices[0],cascadeVertices[2]);
379 LxyErr_sv2decor(*mainVertex) =
m_CascadeTools->lxyError(moms[0],
x->getCovariance()[0],cascadeVertices[0],cascadeVertices[2]);
380 Tau_sv2decor(*mainVertex) =
m_CascadeTools->tau(moms[0],cascadeVertices[0],cascadeVertices[2]);
381 TauErr_sv2decor(*mainVertex) =
m_CascadeTools->tauError(moms[0],
x->getCovariance()[0],cascadeVertices[0],cascadeVertices[2]);
385 <<
" chi2_1 " <<
m_V0Tools->chisq(cascadeVertices[0])
386 <<
" chi2_2 " <<
m_V0Tools->chisq(cascadeVertices[1])
387 <<
" chi2_3 " <<
m_V0Tools->chisq(cascadeVertices[2])
391 <<
" error " <<
m_V0Tools->invariantMassError(cascadeVertices[0],massesK0)
392 <<
" mass_d0 " <<
m_V0Tools->invariantMass(cascadeVertices[1],massesD0)
393 <<
" error " <<
m_V0Tools->invariantMassError(cascadeVertices[1],massesD0)
394 <<
" mass_J " <<
m_V0Tools->invariantMass(cascadeVertices[2],massesJpsipi)
395 <<
" error " <<
m_V0Tools->invariantMassError(cascadeVertices[2],massesJpsipi));
400 double Mass_B_err =
m_CascadeTools->invariantMassError(moms[2],
x->getCovariance()[2]);
401 double Mass_D0_err =
m_CascadeTools->invariantMassError(moms[1],
x->getCovariance()[1]);
402 double Mass_K0_err =
m_CascadeTools->invariantMassError(moms[0],
x->getCovariance()[0]);
403 ATH_MSG_DEBUG(
"Mass_B " << Mass_B <<
" Mass_D0 " << Mass_D0 <<
" Mass_K0 " << Mass_K0);
404 ATH_MSG_DEBUG(
"Mass_B_err " << Mass_B_err <<
" Mass_D0_err " << Mass_D0_err <<
" Mass_K0_err " << Mass_K0_err);
406 double mprob_D0 =
m_CascadeTools->massProbability(mass_d0,Mass_D0,Mass_D0_err);
407 double mprob_K0 =
m_CascadeTools->massProbability(mass_k0,Mass_K0,Mass_K0_err);
408 ATH_MSG_DEBUG(
"mprob_B " << mprob_B <<
" mprob_D0 " << mprob_D0 <<
" mprob_K0 " << mprob_K0);
412 <<
" Mass_k0 " <<
m_CascadeTools->invariantMass(moms[0],massesD0));
414 <<
" Mass_d0_err " <<
m_CascadeTools->invariantMassError(moms[1],
x->getCovariance()[1],massesD0)
415 <<
" Mass_k0_err " <<
m_CascadeTools->invariantMassError(moms[0],
x->getCovariance()[0],massesK0));
418 <<
" pt_d0 " <<
m_V0Tools->pT(cascadeVertices[1])
420 <<
" pt_k0 " <<
m_V0Tools->pT(cascadeVertices[0]));
422 <<
" ptErr_d " <<
m_CascadeTools->pTError(moms[1],
x->getCovariance()[1])
423 <<
" ptErr_d0 " <<
m_V0Tools->pTError(cascadeVertices[1])
424 <<
" ptErr_k " <<
m_CascadeTools->pTError(moms[0],
x->getCovariance()[0])
425 <<
" ptErr_k0 " <<
m_V0Tools->pTError(cascadeVertices[0]));
426 ATH_MSG_DEBUG(
"lxy_B " <<
m_V0Tools->lxy(cascadeVertices[2],primaryVertex) <<
" lxy_D " <<
m_V0Tools->lxy(cascadeVertices[1],cascadeVertices[2]) <<
" lxy_K " <<
m_V0Tools->lxy(cascadeVertices[0],cascadeVertices[2]));
429 <<
" lxyErr_d " <<
m_CascadeTools->lxyError(moms[1],
x->getCovariance()[1],cascadeVertices[1],cascadeVertices[2])
430 <<
" lxyErr_d0 " <<
m_V0Tools->lxyError(cascadeVertices[1],cascadeVertices[2])
431 <<
" lxyErr_k " <<
m_CascadeTools->lxyError(moms[0],
x->getCovariance()[0],cascadeVertices[0],cascadeVertices[2])
432 <<
" lxyErr_k0 " <<
m_V0Tools->lxyError(cascadeVertices[0],cascadeVertices[2]));
434 <<
" tau_d0 " <<
m_V0Tools->tau(cascadeVertices[1],cascadeVertices[2],massesD0)
435 <<
" tau_k0 " <<
m_V0Tools->tau(cascadeVertices[0],cascadeVertices[2],massesK0));
437 <<
" tau_d " <<
m_CascadeTools->tau(moms[1],cascadeVertices[1],cascadeVertices[2])
438 <<
" tau_D " <<
m_CascadeTools->tau(moms[1],cascadeVertices[1],cascadeVertices[2],mass_d0)
439 <<
" tau_k " <<
m_CascadeTools->tau(moms[0],cascadeVertices[0],cascadeVertices[2])
440 <<
" tau_K " <<
m_CascadeTools->tau(moms[0],cascadeVertices[0],cascadeVertices[2],mass_k0));
442 <<
" tauErr_d " <<
m_CascadeTools->tauError(moms[1],
x->getCovariance()[1],cascadeVertices[1],cascadeVertices[2])
443 <<
" tauErr_d0 " <<
m_V0Tools->tauError(cascadeVertices[1],cascadeVertices[2],massesD0)
444 <<
" tauErr_k " <<
m_CascadeTools->tauError(moms[0],
x->getCovariance()[0],cascadeVertices[0],cascadeVertices[2])
445 <<
" tauErr_k0 " <<
m_V0Tools->tauError(cascadeVertices[0],cascadeVertices[2],massesK0));
447 <<
" TauErr_d " <<
m_CascadeTools->tauError(moms[1],
x->getCovariance()[1],cascadeVertices[1],cascadeVertices[2],mass_d0)
448 <<
" TauErr_d0 " <<
m_V0Tools->tauError(cascadeVertices[1],cascadeVertices[2],massesD0,mass_d0)
449 <<
" TauErr_k " <<
m_CascadeTools->tauError(moms[0],
x->getCovariance()[0],cascadeVertices[0],cascadeVertices[2],mass_k0)
450 <<
" TauErr_k0 " <<
m_V0Tools->tauError(cascadeVertices[0],cascadeVertices[2],massesD0,mass_k0));
452 ATH_MSG_DEBUG(
"CascadeTools main vert wrt PV " <<
" CascadeTools SV " <<
" V0Tools SV");
454 <<
", " <<
m_CascadeTools->a0z(moms[1],cascadeVertices[1],cascadeVertices[2])
455 <<
", " <<
m_CascadeTools->a0z(moms[0],cascadeVertices[0],cascadeVertices[2])
456 <<
", " <<
m_V0Tools->a0z(cascadeVertices[1],cascadeVertices[2])
457 <<
", " <<
m_V0Tools->a0z(cascadeVertices[0],cascadeVertices[2]));
459 <<
", " <<
m_CascadeTools->a0zError(moms[1],
x->getCovariance()[1],cascadeVertices[1],cascadeVertices[2])
460 <<
", " <<
m_CascadeTools->a0zError(moms[0],
x->getCovariance()[0],cascadeVertices[0],cascadeVertices[2])
461 <<
", " <<
m_V0Tools->a0zError(cascadeVertices[1],cascadeVertices[2])
462 <<
", " <<
m_V0Tools->a0zError(cascadeVertices[0],cascadeVertices[2]));
464 <<
", " <<
m_CascadeTools->a0xy(moms[1],cascadeVertices[1],cascadeVertices[2])
465 <<
", " <<
m_CascadeTools->a0xy(moms[0],cascadeVertices[0],cascadeVertices[2])
466 <<
", " <<
m_V0Tools->a0xy(cascadeVertices[1],cascadeVertices[2])
467 <<
", " <<
m_V0Tools->a0xy(cascadeVertices[0],cascadeVertices[2]));
469 <<
", " <<
m_CascadeTools->a0xyError(moms[1],
x->getCovariance()[1],cascadeVertices[1],cascadeVertices[2])
470 <<
", " <<
m_CascadeTools->a0xyError(moms[0],
x->getCovariance()[0],cascadeVertices[0],cascadeVertices[2])
471 <<
", " <<
m_V0Tools->a0xyError(cascadeVertices[1],cascadeVertices[2])
472 <<
", " <<
m_V0Tools->a0xyError(cascadeVertices[0],cascadeVertices[2]));
474 <<
", " <<
m_CascadeTools->a0(moms[1],cascadeVertices[1],cascadeVertices[2])
475 <<
", " <<
m_CascadeTools->a0(moms[0],cascadeVertices[0],cascadeVertices[2])
476 <<
", " <<
m_V0Tools->a0(cascadeVertices[1],cascadeVertices[2])
477 <<
", " <<
m_V0Tools->a0(cascadeVertices[0],cascadeVertices[2]));
479 <<
", " <<
m_CascadeTools->a0Error(moms[1],
x->getCovariance()[1],cascadeVertices[1],cascadeVertices[2])
480 <<
", " <<
m_CascadeTools->a0Error(moms[0],
x->getCovariance()[0],cascadeVertices[0],cascadeVertices[2])
481 <<
", " <<
m_V0Tools->a0Error(cascadeVertices[1],cascadeVertices[2])
482 <<
", " <<
m_V0Tools->a0Error(cascadeVertices[0],cascadeVertices[2]));
486 ATH_MSG_DEBUG(
"X0 " << primaryVertex->
x() <<
" Y0 " << primaryVertex->
y() <<
" Z0 " << primaryVertex->
z());
490 ATH_MSG_DEBUG(
"Rxy0 wrt PV " <<
m_V0Tools->rxy(cascadeVertices[0],primaryVertex) <<
" RxyErr0 wrt PV " <<
m_V0Tools->rxyError(cascadeVertices[0],primaryVertex));
491 ATH_MSG_DEBUG(
"Rxy1 wrt PV " <<
m_V0Tools->rxy(cascadeVertices[1],primaryVertex) <<
" RxyErr1 wrt PV " <<
m_V0Tools->rxyError(cascadeVertices[1],primaryVertex));
492 ATH_MSG_DEBUG(
"Rxy2 wrt PV " <<
m_V0Tools->rxy(cascadeVertices[2],primaryVertex) <<
" RxyErr2 wrt PV " <<
m_V0Tools->rxyError(cascadeVertices[2],primaryVertex));
493 ATH_MSG_DEBUG(
"number of covariance matrices " << (
x->getCovariance()).size());
498 for (
auto x : cascadeinfoContainer)
delete x;
500 return StatusCode::SUCCESS;
505 m_vertexContainerKey(
""),
506 m_vertexD0ContainerKey(
""),
507 m_vertexK0ContainerKey(
""),
508 m_cascadeOutputsKeys{
"JpsiPlusDs1CascadeVtx1",
"JpsiPlusDs1CascadeVtx2",
"JpsiPlusDs1CascadeVtx3" },
509 m_VxPrimaryCandidateName(
"PrimaryVertices"),
510 m_jpsiMassLower(0.0),
511 m_jpsiMassUpper(10000.0),
512 m_jpsipiMassLower(0.0),
513 m_jpsipiMassUpper(10000.0),
515 m_D0MassUpper(10000.0),
517 m_K0MassUpper(10000.0),
519 m_DstMassUpper(10000.0),
521 m_MassUpper(20000.0),
525 m_vtx0Daug1MassHypo(-1),
526 m_vtx0Daug2MassHypo(-1),
527 m_vtx0Daug3MassHypo(-1),
528 m_vtx1Daug1MassHypo(-1),
529 m_vtx1Daug2MassHypo(-1),
530 m_vtx2Daug1MassHypo(-1),
531 m_vtx2Daug2MassHypo(-1),
532 m_particleDataTable(
nullptr),
539 m_iVertexFitter(
"Trk::TrkVKalVrtFitter"),
540 m_pvRefitter(
"Analysis::PrimaryVertexRefitter"),
541 m_V0Tools(
"Trk::V0Tools"),
542 m_CascadeTools(
"DerivationFramework::CascadeTools")
544 declareProperty(
"JpsipiVertices", m_vertexContainerKey);
545 declareProperty(
"D0Vertices", m_vertexD0ContainerKey);
546 declareProperty(
"K0Vertices", m_vertexK0ContainerKey);
547 declareProperty(
"VxPrimaryCandidateName", m_VxPrimaryCandidateName);
548 declareProperty(
"RefPVContainerName", m_refPVContainerName =
"RefittedPrimaryVertices");
549 declareProperty(
"JpsiMassLowerCut", m_jpsiMassLower);
550 declareProperty(
"JpsiMassUpperCut", m_jpsiMassUpper);
551 declareProperty(
"JpsipiMassLowerCut", m_jpsipiMassLower);
552 declareProperty(
"JpsipiMassUpperCut", m_jpsipiMassUpper);
553 declareProperty(
"D0MassLowerCut", m_D0MassLower);
554 declareProperty(
"D0MassUpperCut", m_D0MassUpper);
555 declareProperty(
"K0MassLowerCut", m_K0MassLower);
556 declareProperty(
"K0MassUpperCut", m_K0MassUpper);
557 declareProperty(
"DstMassLowerCut", m_DstMassLower);
558 declareProperty(
"DstMassUpperCut", m_DstMassUpper);
559 declareProperty(
"MassLowerCut", m_MassLower);
560 declareProperty(
"MassUpperCut", m_MassUpper);
561 declareProperty(
"HypothesisName", m_hypoName =
"Bc");
562 declareProperty(
"Vtx0MassHypo", m_vtx0MassHypo);
563 declareProperty(
"Vtx1MassHypo", m_vtx1MassHypo);
564 declareProperty(
"Vtx2MassHypo", m_vtx2MassHypo);
565 declareProperty(
"Vtx0Daug1MassHypo", m_vtx0Daug1MassHypo);
566 declareProperty(
"Vtx0Daug2MassHypo", m_vtx0Daug2MassHypo);
567 declareProperty(
"Vtx0Daug3MassHypo", m_vtx0Daug3MassHypo);
568 declareProperty(
"Vtx1Daug1MassHypo", m_vtx1Daug1MassHypo);
569 declareProperty(
"Vtx1Daug2MassHypo", m_vtx1Daug2MassHypo);
570 declareProperty(
"Vtx2Daug1MassHypo", m_vtx2Daug1MassHypo);
571 declareProperty(
"Vtx2Daug2MassHypo", m_vtx2Daug2MassHypo);
572 declareProperty(
"JpsiMass", m_mass_jpsi);
573 declareProperty(
"DxHypothesis", m_Dx_pid);
574 declareProperty(
"ApplyD0MassConstraint", m_constrD0);
575 declareProperty(
"ApplyK0MassConstraint", m_constrK0);
576 declareProperty(
"ApplyJpsiMassConstraint", m_constrJpsi);
577 declareProperty(
"Chi2Cut", m_chi2cut);
578 declareProperty(
"RefitPV", m_refitPV =
true);
579 declareProperty(
"MaxnPV", m_PV_max = 999);
580 declareProperty(
"MinNTracksInPV", m_PV_minNTracks = 0);
581 declareProperty(
"DoVertexType", m_DoVertexType = 7);
582 declareProperty(
"TrkVertexFitterTool", m_iVertexFitter);
583 declareProperty(
"PVRefitter", m_pvRefitter);
584 declareProperty(
"V0Tools", m_V0Tools);
585 declareProperty(
"CascadeTools", m_CascadeTools);
586 declareProperty(
"CascadeVertexCollections", m_cascadeOutputsKeys);
594 assert(cascadeinfoContainer!=
nullptr);
614 std::vector<const xAOD::TrackParticle*> tracksJpsipi;
615 std::vector<const xAOD::TrackParticle*> tracksJpsi;
616 std::vector<const xAOD::TrackParticle*> tracksD0;
617 std::vector<const xAOD::TrackParticle*> tracksK0;
618 std::vector<const xAOD::TrackParticle*> tracksBc;
619 std::vector<double> massesJpsipi;
623 std::vector<double> massesD0;
626 std::vector<double> massesD0b;
629 std::vector<double> massesK0;
632 std::vector<double> Masses;
640 std::vector<const xAOD::Vertex*> selectedJpsipiCandidates;
641 for(
auto vxcItr=jpsipiContainer->
cbegin(); vxcItr!=jpsipiContainer->
cend(); ++vxcItr) {
647 if(!flagAcc1(*vtx))
continue;
651 TLorentzVector p4Mup_in, p4Mum_in;
652 p4Mup_in.SetPtEtaPhiM((*vxcItr)->trackParticle(0)->pt(),
653 (*vxcItr)->trackParticle(0)->eta(),
655 p4Mum_in.SetPtEtaPhiM((*vxcItr)->trackParticle(1)->pt(),
656 (*vxcItr)->trackParticle(1)->eta(),
658 double mass_Jpsi = (p4Mup_in + p4Mum_in).M();
661 ATH_MSG_DEBUG(
" Original Jpsi candidate rejected by the mass cut: mass = "
667 double mass_Jpsipi =
m_V0Tools->invariantMass(*vxcItr, massesJpsipi);
670 ATH_MSG_DEBUG(
" Original Jpsipi candidate rejected by the mass cut: mass = "
675 selectedJpsipiCandidates.push_back(*vxcItr);
677 if(selectedJpsipiCandidates.size()<1)
return StatusCode::SUCCESS;
680 std::vector<const xAOD::Vertex*> selectedD0Candidates;
681 for(
auto vxcItr=d0Container->
cbegin(); vxcItr!=d0Container->
cend(); ++vxcItr) {
690 if(!flagAcc1(*vtx)) isD0 =
false;
693 if(!flagAcc2(*vtx)) isD0b =
false;
695 if(!(isD0||isD0b))
continue;
698 if ((*vxcItr)->trackParticle(0)->charge() != 1 || (*vxcItr)->trackParticle(1)->charge() != -1) {
699 ATH_MSG_DEBUG(
" Original D0/D0-bar candidate rejected by the charge requirement: "
700 << (*vxcItr)->trackParticle(0)->charge() <<
", " << (*vxcItr)->trackParticle(1)->charge() );
705 double mass_D0 =
m_V0Tools->invariantMass(*vxcItr,massesD0);
706 double mass_D0b =
m_V0Tools->invariantMass(*vxcItr,massesD0b);
707 ATH_MSG_DEBUG(
"D0 mass " << mass_D0 <<
", D0b mass "<<mass_D0b);
709 ATH_MSG_DEBUG(
" Original D0 candidate rejected by the mass cut: mass = "
715 selectedD0Candidates.push_back(*vxcItr);
717 if(selectedD0Candidates.size()<1)
return StatusCode::SUCCESS;
720 std::vector<const xAOD::Vertex*> selectedK0Candidates;
721 for(
auto vxcItr=k0Container->
cbegin(); vxcItr!=k0Container->
cend(); ++vxcItr) {
727 if(!flagAcc1(*vtx))
continue;
731 double mass_K0 =
m_V0Tools->invariantMass(*vxcItr, massesK0);
734 ATH_MSG_DEBUG(
" Original K_S0 candidate rejected by the mass cut: mass = "
739 selectedK0Candidates.push_back(*vxcItr);
741 if(selectedK0Candidates.size()<1)
return StatusCode::SUCCESS;
745 for(
auto jpsipiItr=selectedJpsipiCandidates.cbegin(); jpsipiItr!=selectedJpsipiCandidates.cend(); ++jpsipiItr) {
747 size_t jpsipiTrkNum = (*jpsipiItr)->nTrackParticles();
748 tracksJpsipi.clear();
750 for(
unsigned int it=0;
it<jpsipiTrkNum;
it++) tracksJpsipi.push_back((*jpsipiItr)->trackParticle(
it));
751 for(
unsigned int it=0;
it<jpsipiTrkNum-1;
it++) tracksJpsi.push_back((*jpsipiItr)->trackParticle(
it));
753 if (tracksJpsipi.size() != 3 || massesJpsipi.size() != 3 ) {
758 if(abs(
m_Dx_pid)==421 && (*jpsipiItr)->trackParticle(2)->charge()==-1) tagD0 =
false;
760 TLorentzVector p4_pi1;
761 p4_pi1.SetPtEtaPhiM((*jpsipiItr)->trackParticle(2)->pt(),
762 (*jpsipiItr)->trackParticle(2)->eta(),
766 for(
auto d0Itr=selectedD0Candidates.cbegin(); d0Itr!=selectedD0Candidates.cend(); ++d0Itr) {
769 if(
std::find(tracksJpsipi.cbegin(), tracksJpsipi.cend(), (*d0Itr)->trackParticle(0)) != tracksJpsipi.cend())
continue;
770 if(
std::find(tracksJpsipi.cbegin(), tracksJpsipi.cend(), (*d0Itr)->trackParticle(1)) != tracksJpsipi.cend())
continue;
772 TLorentzVector p4_ka, p4_pi2;
774 p4_pi2.SetPtEtaPhiM((*d0Itr)->trackParticle(0)->pt(),
775 (*d0Itr)->trackParticle(0)->eta(),
777 p4_ka.SetPtEtaPhiM( (*d0Itr)->trackParticle(1)->pt(),
778 (*d0Itr)->trackParticle(1)->eta(),
781 p4_pi2.SetPtEtaPhiM((*d0Itr)->trackParticle(1)->pt(),
782 (*d0Itr)->trackParticle(1)->eta(),
784 p4_ka.SetPtEtaPhiM( (*d0Itr)->trackParticle(0)->pt(),
785 (*d0Itr)->trackParticle(0)->eta(),
789 double mass_Dst= (p4_pi1 + p4_ka + p4_pi2).M();
792 ATH_MSG_DEBUG(
" Original D*+/- candidate rejected by the mass cut: mass = "
797 size_t d0TrkNum = (*d0Itr)->nTrackParticles();
799 for(
unsigned int it=0;
it<d0TrkNum;
it++) tracksD0.push_back((*d0Itr)->trackParticle(
it));
800 if (tracksD0.size() != 2 || massesD0.size() != 2 ) {
805 for(
auto k0Itr=selectedK0Candidates.cbegin(); k0Itr!=selectedK0Candidates.cend(); ++k0Itr) {
808 if(
std::find(tracksJpsipi.cbegin(), tracksJpsipi.cend(), (*k0Itr)->trackParticle(0)) != tracksJpsipi.cend())
continue;
809 if(
std::find(tracksJpsipi.cbegin(), tracksJpsipi.cend(), (*k0Itr)->trackParticle(1)) != tracksJpsipi.cend())
continue;
810 if(
std::find(tracksD0.cbegin(), tracksD0.cend(), (*k0Itr)->trackParticle(0)) != tracksD0.cend())
continue;
811 if(
std::find(tracksD0.cbegin(), tracksD0.cend(), (*k0Itr)->trackParticle(1)) != tracksD0.cend())
continue;
813 size_t k0TrkNum = (*k0Itr)->nTrackParticles();
815 for(
unsigned int it=0;
it<k0TrkNum;
it++) tracksK0.push_back((*k0Itr)->trackParticle(
it));
816 if (tracksK0.size() != 2 || massesK0.size() != 2 ) {
820 ATH_MSG_DEBUG(
"using tracks" << tracksJpsipi[0] <<
", " << tracksJpsipi[1] <<
", " << tracksJpsipi[2] <<
", " << tracksD0[0] <<
", " << tracksD0[1] <<
", " << tracksK0[0] <<
", " << tracksK0[1]);
823 for(
unsigned int it=0;
it<jpsipiTrkNum;
it++) tracksBc.push_back((*jpsipiItr)->trackParticle(
it));
824 for(
unsigned int it=0;
it<d0TrkNum;
it++) tracksBc.push_back((*d0Itr)->trackParticle(
it));
825 for(
unsigned int it=0;
it<k0TrkNum;
it++) tracksBc.push_back((*k0Itr)->trackParticle(
it));
836 std::vector<Trk::VertexID> vrtList;
840 vK0ID =
m_iVertexFitter->startVertex(tracksK0,massesK0, *state, mass_k0);
844 vrtList.push_back(vK0ID);
848 if(tagD0) vD0ID =
m_iVertexFitter->nextVertex(tracksD0,massesD0, *state, mass_d0);
849 else vD0ID =
m_iVertexFitter->nextVertex(tracksD0,massesD0b, *state, mass_d0);
851 if(tagD0) vD0ID =
m_iVertexFitter->nextVertex(tracksD0,massesD0, *state);
854 vrtList.push_back(vD0ID);
858 std::vector<Trk::VertexID> cnstV;
873 << ((
result->vertices())[0])->trackParticle(1) <<
", "
874 << ((
result->vertices())[1])->trackParticle(0) <<
", "
875 << ((
result->vertices())[1])->trackParticle(1) <<
", "
876 << ((
result->vertices())[2])->trackParticle(0) <<
", "
877 << ((
result->vertices())[2])->trackParticle(1) <<
", "
878 << ((
result->vertices())[2])->trackParticle(2));
880 result->setSVOwnership(
true);
887 const std::vector< std::vector<TLorentzVector> > &moms =
result->getParticleMoms();
891 cascadeinfoContainer->push_back(
result.release());
905 ATH_MSG_DEBUG(
"cascadeinfoContainer size " << cascadeinfoContainer->size());
907 return StatusCode::SUCCESS;