62 std::vector<Trk::VxCascadeInfo*> cascadeinfoContainer;
63 constexpr
int topoN = 2;
64 std::array<xAOD::VertexContainer*, topoN> Vtxwritehandles;
65 std::array<xAOD::VertexAuxContainer*, topoN> Vtxwritehandlesaux;
68 for(
int i =0;
i<topoN;
i++){
71 Vtxwritehandles[
i]->setStore(Vtxwritehandlesaux[
i]);
84 if (pvContainer->size()==0){
85 ATH_MSG_WARNING(
"You have no primary vertices: " << pvContainer->size());
86 return StatusCode::RECOVERABLE;
88 primaryVertex = (*pvContainer)[0];
105 refPvContainer->setStore(refPvAuxContainer);
140 ATH_MSG_DEBUG(
"cascadeinfoContainer size " << cascadeinfoContainer.size());
152 return StatusCode::FAILURE;
173 const std::vector<xAOD::Vertex*> &cascadeVertices =
x->vertices();
174 if(cascadeVertices.size()!=topoN)
176 if(cascadeVertices[0] ==
nullptr || cascadeVertices[1] ==
nullptr)
ATH_MSG_ERROR(
"Error null vertex");
178 for(
int i =0;
i<topoN;
i++) Vtxwritehandles[
i]->push_back(cascadeVertices[
i]);
180 x->setSVOwnership(
false);
181 const auto mainVertex = cascadeVertices[1];
182 const std::vector< std::vector<TLorentzVector> > &moms =
x->getParticleMoms();
185 std::vector<const xAOD::Vertex*> verticestoLink;
186 verticestoLink.push_back(cascadeVertices[0]);
187 if(Vtxwritehandles[1] ==
nullptr)
ATH_MSG_ERROR(
"Vtxwritehandles[1] is null");
192 const xAOD::Vertex* jpsipiVertex = BPhysPVCascadeTools::FindVertex<3>(jpsipiContainer, cascadeVertices[1]);
193 ATH_MSG_DEBUG(
"1 pt Jpsi+pi tracks " << cascadeVertices[1]->trackParticle(0)->
pt() <<
", " << cascadeVertices[1]->trackParticle(1)->
pt() <<
", " << cascadeVertices[1]->trackParticle(2)->
pt());
197 const xAOD::Vertex* d0Vertex = BPhysPVCascadeTools::FindVertex<2>(d0Container, cascadeVertices[0]);;
198 ATH_MSG_DEBUG(
"1 pt D0 tracks " << cascadeVertices[0]->trackParticle(0)->
pt() <<
", " << cascadeVertices[0]->trackParticle(1)->
pt());
202 std::vector<const xAOD::Vertex*> jpsipiVerticestoLink;
203 if (jpsipiVertex) jpsipiVerticestoLink.push_back(jpsipiVertex);
208 std::vector<const xAOD::Vertex*> d0VerticestoLink;
209 if (d0Vertex) d0VerticestoLink.push_back(d0Vertex);
221 std::vector<double> massesJpsipi;
225 std::vector<double> massesD0;
233 std::vector<double> Masses;
255 PtErr_decor(*mainVertex) =
m_CascadeTools->pTError(moms[1],
x->getCovariance()[1]);
257 chi2_decor(*mainVertex) =
x->fitChi2();
258 ndof_decor(*mainVertex) =
x->nDoF();
262 TLorentzVector p4_mu1, p4_mu2;
269 massMumu = (p4_mu1 + p4_mu2).M();
271 MassMumu_decor(*mainVertex) = massMumu;
275 TLorentzVector p4_ka, p4_pi;
291 massKpi = (p4_ka + p4_pi).M();
293 MassKpi_svdecor(*mainVertex) = massKpi;
294 MassJpsi_decor(*mainVertex) = (moms[1][0] + moms[1][1]).M();
295 MassPiD0_decor(*mainVertex) = (moms[1][2] + moms[1][3]).M();
303 Mass_svdecor(*mainVertex) =
m_CascadeTools->invariantMass(moms[0]);
304 MassErr_svdecor(*mainVertex) =
m_CascadeTools->invariantMassError(moms[0],
x->getCovariance()[0]);
306 PtErr_svdecor(*mainVertex) =
m_CascadeTools->pTError(moms[0],
x->getCovariance()[0]);
307 Lxy_svdecor(*mainVertex) =
m_CascadeTools->lxy(moms[0],cascadeVertices[0],cascadeVertices[1]);
308 LxyErr_svdecor(*mainVertex) =
m_CascadeTools->lxyError(moms[0],
x->getCovariance()[0],cascadeVertices[0],cascadeVertices[1]);
309 Tau_svdecor(*mainVertex) =
m_CascadeTools->tau(moms[0],cascadeVertices[0],cascadeVertices[1]);
310 TauErr_svdecor(*mainVertex) =
m_CascadeTools->tauError(moms[0],
x->getCovariance()[0],cascadeVertices[0],cascadeVertices[1]);
314 <<
" chi2_1 " <<
m_V0Tools->chisq(cascadeVertices[0])
315 <<
" chi2_2 " <<
m_V0Tools->chisq(cascadeVertices[1])
319 <<
" error " <<
m_V0Tools->invariantMassError(cascadeVertices[0],massesD0)
320 <<
" mass_J " <<
m_V0Tools->invariantMass(cascadeVertices[1],massesJpsipi)
321 <<
" error " <<
m_V0Tools->invariantMassError(cascadeVertices[1],massesJpsipi));
325 double Mass_B_err =
m_CascadeTools->invariantMassError(moms[1],
x->getCovariance()[1]);
326 double Mass_D0_err =
m_CascadeTools->invariantMassError(moms[0],
x->getCovariance()[0]);
327 ATH_MSG_DEBUG(
"Mass_B " << Mass_B <<
" Mass_D0 " << Mass_D0);
328 ATH_MSG_DEBUG(
"Mass_B_err " << Mass_B_err <<
" Mass_D0_err " << Mass_D0_err);
330 double mprob_D0 =
m_CascadeTools->massProbability(mass_d0,Mass_D0,Mass_D0_err);
331 ATH_MSG_DEBUG(
"mprob_B " << mprob_B <<
" mprob_D0 " << mprob_D0);
334 <<
" Mass_d0 " <<
m_CascadeTools->invariantMass(moms[0],massesD0));
336 <<
" Mass_d0_err " <<
m_CascadeTools->invariantMassError(moms[0],
x->getCovariance()[0],massesD0));
339 <<
" pt_d0 " <<
m_V0Tools->pT(cascadeVertices[0]));
341 <<
" ptErr_d " <<
m_CascadeTools->pTError(moms[0],
x->getCovariance()[0])
342 <<
" ptErr_d0 " <<
m_V0Tools->pTError(cascadeVertices[0]));
346 <<
" lxyErr_d " <<
m_CascadeTools->lxyError(moms[0],
x->getCovariance()[0],cascadeVertices[0],cascadeVertices[1])
347 <<
" lxyErr_d0 " <<
m_V0Tools->lxyError(cascadeVertices[0],cascadeVertices[1]));
349 <<
" tau_d0 " <<
m_V0Tools->tau(cascadeVertices[0],cascadeVertices[1],massesD0));
351 <<
" tau_d " <<
m_CascadeTools->tau(moms[0],cascadeVertices[0],cascadeVertices[1])
352 <<
" tau_D " <<
m_CascadeTools->tau(moms[0],cascadeVertices[0],cascadeVertices[1],mass_d0));
354 <<
" tauErr_d " <<
m_CascadeTools->tauError(moms[0],
x->getCovariance()[0],cascadeVertices[0],cascadeVertices[1])
355 <<
" tauErr_d0 " <<
m_V0Tools->tauError(cascadeVertices[0],cascadeVertices[1],massesD0));
357 <<
" TauErr_d " <<
m_CascadeTools->tauError(moms[0],
x->getCovariance()[0],cascadeVertices[0],cascadeVertices[1],mass_d0)
358 <<
" TauErr_d0 " <<
m_V0Tools->tauError(cascadeVertices[0],cascadeVertices[1],massesD0,mass_d0));
360 ATH_MSG_DEBUG(
"CascadeTools main vert wrt PV " <<
" CascadeTools SV " <<
" V0Tools SV");
362 <<
", " <<
m_CascadeTools->a0z(moms[0],cascadeVertices[0],cascadeVertices[1])
363 <<
", " <<
m_V0Tools->a0z(cascadeVertices[0],cascadeVertices[1]));
365 <<
", " <<
m_CascadeTools->a0zError(moms[0],
x->getCovariance()[0],cascadeVertices[0],cascadeVertices[1])
366 <<
", " <<
m_V0Tools->a0zError(cascadeVertices[0],cascadeVertices[1]));
368 <<
", " <<
m_CascadeTools->a0xy(moms[0],cascadeVertices[0],cascadeVertices[1])
369 <<
", " <<
m_V0Tools->a0xy(cascadeVertices[0],cascadeVertices[1]));
371 <<
", " <<
m_CascadeTools->a0xyError(moms[0],
x->getCovariance()[0],cascadeVertices[0],cascadeVertices[1])
372 <<
", " <<
m_V0Tools->a0xyError(cascadeVertices[0],cascadeVertices[1]));
374 <<
", " <<
m_CascadeTools->a0(moms[0],cascadeVertices[0],cascadeVertices[1])
375 <<
", " <<
m_V0Tools->a0(cascadeVertices[0],cascadeVertices[1]));
377 <<
", " <<
m_CascadeTools->a0Error(moms[0],
x->getCovariance()[0],cascadeVertices[0],cascadeVertices[1])
378 <<
", " <<
m_V0Tools->a0Error(cascadeVertices[0],cascadeVertices[1]));
381 ATH_MSG_DEBUG(
"X0 " << primaryVertex->x() <<
" Y0 " << primaryVertex->y() <<
" Z0 " << primaryVertex->z());
384 ATH_MSG_DEBUG(
"Rxy0 wrt PV " <<
m_V0Tools->rxy(cascadeVertices[0],primaryVertex) <<
" RxyErr0 wrt PV " <<
m_V0Tools->rxyError(cascadeVertices[0],primaryVertex));
385 ATH_MSG_DEBUG(
"Rxy1 wrt PV " <<
m_V0Tools->rxy(cascadeVertices[1],primaryVertex) <<
" RxyErr1 wrt PV " <<
m_V0Tools->rxyError(cascadeVertices[1],primaryVertex));
386 ATH_MSG_DEBUG(
"number of covariance matrices " << (
x->getCovariance()).size());
391 for (
auto x : cascadeinfoContainer)
delete x;
393 return StatusCode::SUCCESS;