65 std::vector<Trk::VxCascadeInfo*> cascadeinfoContainer;
66 constexpr
int topoN = 2;
67 std::array<xAOD::VertexContainer*, topoN> Vtxwritehandles;
68 std::array<xAOD::VertexAuxContainer*, topoN> Vtxwritehandlesaux;
71 for(
int i =0;
i<topoN;
i++){
74 Vtxwritehandles[
i]->setStore(Vtxwritehandlesaux[
i]);
87 if (pvContainer->size()==0){
88 ATH_MSG_WARNING(
"You have no primary vertices: " << pvContainer->size());
89 return StatusCode::RECOVERABLE;
91 primaryVertex = (*pvContainer)[0];
108 refPvContainer->setStore(refPvAuxContainer);
118 return StatusCode::FAILURE;
187 const std::vector<xAOD::Vertex*> &cascadeVertices =
x->vertices();
188 if(cascadeVertices.size()!=topoN)
190 if(cascadeVertices[0] ==
nullptr || cascadeVertices[1] ==
nullptr)
ATH_MSG_ERROR(
"Error null vertex");
192 for(
int i =0;
i<topoN;
i++) Vtxwritehandles[
i]->push_back(cascadeVertices[
i]);
194 x->setSVOwnership(
false);
195 const auto mainVertex = cascadeVertices[1];
196 const std::vector< std::vector<TLorentzVector> > &moms =
x->getParticleMoms();
199 std::vector<const xAOD::Vertex*> verticestoLink;
200 verticestoLink.push_back(cascadeVertices[0]);
201 if(Vtxwritehandles[1] ==
nullptr)
ATH_MSG_ERROR(
"Vtxwritehandles[1] is null");
206 const xAOD::Vertex* MuPiVertex = BPhysPVCascadeTools::FindVertex<2>(MuPiContainer, cascadeVertices[1]);
207 ATH_MSG_DEBUG(
"1 pt mu+pi_soft tracks " << cascadeVertices[1]->trackParticle(0)->
pt() <<
", " << cascadeVertices[1]->trackParticle(1)->
pt());
211 const xAOD::Vertex* d0Vertex = BPhysPVCascadeTools::FindVertex<2>(d0Container, cascadeVertices[0]);;
212 ATH_MSG_DEBUG(
"1 pt D0 tracks " << cascadeVertices[0]->trackParticle(0)->
pt() <<
", " << cascadeVertices[0]->trackParticle(1)->
pt());
216 std::vector<const xAOD::Vertex*> MuPiVerticestoLink;
217 if (MuPiVertex) MuPiVerticestoLink.push_back(MuPiVertex);
222 std::vector<const xAOD::Vertex*> d0VerticestoLink;
223 if (d0Vertex) d0VerticestoLink.push_back(d0Vertex);
235 std::vector<double> massesMuPi;
238 std::vector<double> massesD0;
246 std::vector<double> Masses;
268 PtErr_decor(*mainVertex) =
m_CascadeTools->pTError(moms[1],
x->getCovariance()[1]);
270 chi2_decor(*mainVertex) =
x->fitChi2();
271 ndof_decor(*mainVertex) =
x->nDoF();
272 Chi2Mu_decor(*mainVertex) = cascadeVertices[1]->trackParticle(0)->chiSquared();
273 nDoFMu_decor(*mainVertex) = cascadeVertices[1]->trackParticle(0)->numberDoF();
276 std::vector< Trk::VxTrackAtVertex > trkAtB = cascadeVertices[1]->vxTrackAtVertex();
277 MuChi2B_decor(*mainVertex) = trkAtB.at(0).trackQuality().chiSquared();
278 MunDoFB_decor(*mainVertex) = trkAtB.at(0).trackQuality().numberDoF();
282 TLorentzVector p4_mu1, p4_pi_s;
289 massMuPi = (p4_mu1 + p4_pi_s).M();
293 massMuPi_decor(*mainVertex) = massMuPi;
297 TLorentzVector p4_ka, p4_pi;
320 MassMuPiAft_decor(*mainVertex) = (moms[1][0] + moms[1][1]).M();
321 MassPiD0_decor(*mainVertex) = (moms[1][1] + moms[0][0] + moms[0][1]).M();
322 MassKpi_svdecor(*mainVertex) = (moms[0][0] + moms[0][1]).M();
323 MassMuPiPiK_decor(*mainVertex) =
m_CascadeTools->invariantMass(moms[1]);
329 Mass_svdecor(*mainVertex) =
m_CascadeTools->invariantMass(moms[0]);
330 MassErr_svdecor(*mainVertex) =
m_CascadeTools->invariantMassError(moms[0],
x->getCovariance()[0]);
332 PtErr_svdecor(*mainVertex) =
m_CascadeTools->pTError(moms[0],
x->getCovariance()[0]);
333 Lxy_svdecor(*mainVertex) =
m_CascadeTools->lxy(moms[0],cascadeVertices[0],cascadeVertices[1]);
334 LxyErr_svdecor(*mainVertex) =
m_CascadeTools->lxyError(moms[0],
x->getCovariance()[0],cascadeVertices[0],cascadeVertices[1]);
335 Tau_svdecor(*mainVertex) =
m_CascadeTools->tau(moms[0],cascadeVertices[0],cascadeVertices[1]);
336 TauErr_svdecor(*mainVertex) =
m_CascadeTools->tauError(moms[0],
x->getCovariance()[0],cascadeVertices[0],cascadeVertices[1]);
341 <<
" chi2_1 " <<
m_V0Tools->chisq(cascadeVertices[0])
342 <<
" chi2_2 " <<
m_V0Tools->chisq(cascadeVertices[1])
346 <<
" error " <<
m_V0Tools->invariantMassError(cascadeVertices[0],massesD0)
347 <<
" mass_J " <<
m_V0Tools->invariantMass(cascadeVertices[1],massesMuPi)
348 <<
" error " <<
m_V0Tools->invariantMassError(cascadeVertices[1],massesMuPi));
352 double Mass_B_err =
m_CascadeTools->invariantMassError(moms[1],
x->getCovariance()[1]);
353 double Mass_D0_err =
m_CascadeTools->invariantMassError(moms[0],
x->getCovariance()[0]);
354 ATH_MSG_DEBUG(
"Mass_B " << Mass_B <<
" Mass_D0 " << Mass_D0);
355 ATH_MSG_DEBUG(
"Mass_B_err " << Mass_B_err <<
" Mass_D0_err " << Mass_D0_err);
357 double mprob_D0 =
m_CascadeTools->massProbability(mass_d0,Mass_D0,Mass_D0_err);
358 ATH_MSG_DEBUG(
"mprob_B " << mprob_B <<
" mprob_D0 " << mprob_D0);
361 <<
" Mass_d0 " <<
m_CascadeTools->invariantMass(moms[0],massesD0));
363 <<
" Mass_d0_err " <<
m_CascadeTools->invariantMassError(moms[0],
x->getCovariance()[0],massesD0));
366 <<
" pt_d0 " <<
m_V0Tools->pT(cascadeVertices[0]));
368 <<
" ptErr_d " <<
m_CascadeTools->pTError(moms[0],
x->getCovariance()[0])
369 <<
" ptErr_d0 " <<
m_V0Tools->pTError(cascadeVertices[0]));
373 <<
" lxyErr_d " <<
m_CascadeTools->lxyError(moms[0],
x->getCovariance()[0],cascadeVertices[0],cascadeVertices[1])
374 <<
" lxyErr_d0 " <<
m_V0Tools->lxyError(cascadeVertices[0],cascadeVertices[1]));
376 <<
" tau_d0 " <<
m_V0Tools->tau(cascadeVertices[0],cascadeVertices[1],massesD0));
378 <<
" tau_d " <<
m_CascadeTools->tau(moms[0],cascadeVertices[0],cascadeVertices[1])
379 <<
" tau_D " <<
m_CascadeTools->tau(moms[0],cascadeVertices[0],cascadeVertices[1],mass_d0));
381 <<
" tauErr_d " <<
m_CascadeTools->tauError(moms[0],
x->getCovariance()[0],cascadeVertices[0],cascadeVertices[1])
382 <<
" tauErr_d0 " <<
m_V0Tools->tauError(cascadeVertices[0],cascadeVertices[1],massesD0));
384 <<
" TauErr_d " <<
m_CascadeTools->tauError(moms[0],
x->getCovariance()[0],cascadeVertices[0],cascadeVertices[1],mass_d0)
385 <<
" TauErr_d0 " <<
m_V0Tools->tauError(cascadeVertices[0],cascadeVertices[1],massesD0,mass_d0));
387 ATH_MSG_DEBUG(
"CascadeTools main vert wrt PV " <<
" CascadeTools SV " <<
" V0Tools SV");
389 <<
", " <<
m_CascadeTools->a0z(moms[0],cascadeVertices[0],cascadeVertices[1])
390 <<
", " <<
m_V0Tools->a0z(cascadeVertices[0],cascadeVertices[1]));
392 <<
", " <<
m_CascadeTools->a0zError(moms[0],
x->getCovariance()[0],cascadeVertices[0],cascadeVertices[1])
393 <<
", " <<
m_V0Tools->a0zError(cascadeVertices[0],cascadeVertices[1]));
395 <<
", " <<
m_CascadeTools->a0xy(moms[0],cascadeVertices[0],cascadeVertices[1])
396 <<
", " <<
m_V0Tools->a0xy(cascadeVertices[0],cascadeVertices[1]));
398 <<
", " <<
m_CascadeTools->a0xyError(moms[0],
x->getCovariance()[0],cascadeVertices[0],cascadeVertices[1])
399 <<
", " <<
m_V0Tools->a0xyError(cascadeVertices[0],cascadeVertices[1]));
401 <<
", " <<
m_CascadeTools->a0(moms[0],cascadeVertices[0],cascadeVertices[1])
402 <<
", " <<
m_V0Tools->a0(cascadeVertices[0],cascadeVertices[1]));
404 <<
", " <<
m_CascadeTools->a0Error(moms[0],
x->getCovariance()[0],cascadeVertices[0],cascadeVertices[1])
405 <<
", " <<
m_V0Tools->a0Error(cascadeVertices[0],cascadeVertices[1]));
408 ATH_MSG_DEBUG(
"X0 " << primaryVertex->x() <<
" Y0 " << primaryVertex->y() <<
" Z0 " << primaryVertex->z());
411 ATH_MSG_DEBUG(
"Rxy0 wrt PV " <<
m_V0Tools->rxy(cascadeVertices[0],primaryVertex) <<
" RxyErr0 wrt PV " <<
m_V0Tools->rxyError(cascadeVertices[0],primaryVertex));
412 ATH_MSG_DEBUG(
"Rxy1 wrt PV " <<
m_V0Tools->rxy(cascadeVertices[1],primaryVertex) <<
" RxyErr1 wrt PV " <<
m_V0Tools->rxyError(cascadeVertices[1],primaryVertex));
413 ATH_MSG_DEBUG(
"number of covariance matrices " << (
x->getCovariance()).size());
418 for (
auto x : cascadeinfoContainer)
delete x;
420 return StatusCode::SUCCESS;