68 std::vector<Trk::VxCascadeInfo*> cascadeinfoContainer;
69 constexpr
int topoN = 2;
70 std::array<xAOD::VertexContainer*, topoN> Vtxwritehandles;
71 std::array<xAOD::VertexAuxContainer*, topoN> Vtxwritehandlesaux;
74 for(
int i =0;
i<topoN;
i++){
77 Vtxwritehandles[
i]->setStore(Vtxwritehandlesaux[
i]);
90 if (pvContainer->size()==0){
91 ATH_MSG_WARNING(
"You have no primary vertices: " << pvContainer->size());
92 return StatusCode::RECOVERABLE;
94 primaryVertex = (*pvContainer)[0];
111 refPvContainer->setStore(refPvAuxContainer);
145 ATH_MSG_DEBUG(
"cascadeinfoContainer size " << cascadeinfoContainer.size());
157 return StatusCode::FAILURE;
178 const std::vector<xAOD::Vertex*> &cascadeVertices =
x->vertices();
179 if(cascadeVertices.size()!=topoN)
181 if(cascadeVertices[0] ==
nullptr || cascadeVertices[1] ==
nullptr)
ATH_MSG_ERROR(
"Error null vertex");
183 for(
int i =0;
i<topoN;
i++) Vtxwritehandles[
i]->push_back(cascadeVertices[
i]);
185 x->setSVOwnership(
false);
186 const auto mainVertex = cascadeVertices[1];
187 const std::vector< std::vector<TLorentzVector> > &moms =
x->getParticleMoms();
190 std::vector<const xAOD::Vertex*> verticestoLink;
191 verticestoLink.push_back(cascadeVertices[0]);
192 if(Vtxwritehandles[1] ==
nullptr)
ATH_MSG_ERROR(
"Vtxwritehandles[1] is null");
197 const xAOD::Vertex* jpsiVertex = BPhysPVCascadeTools::FindVertex<2>(jpsiContainer, cascadeVertices[1]);
198 ATH_MSG_DEBUG(
"1 pt Jpsi tracks " << cascadeVertices[1]->trackParticle(0)->
pt() <<
", " << cascadeVertices[1]->trackParticle(1)->
pt());
202 const xAOD::Vertex* dxVertex = BPhysPVCascadeTools::FindVertex<3>(dxContainer, cascadeVertices[0]);;
203 ATH_MSG_DEBUG(
"1 pt D_(s)+ tracks " << cascadeVertices[0]->trackParticle(0)->
pt() <<
", " << cascadeVertices[0]->trackParticle(1)->
pt() <<
", " << cascadeVertices[0]->trackParticle(2)->
pt());
207 std::vector<const xAOD::Vertex*> jpsiVerticestoLink;
208 if (jpsiVertex) jpsiVerticestoLink.push_back(jpsiVertex);
213 std::vector<const xAOD::Vertex*> dxVerticestoLink;
214 if (dxVertex) dxVerticestoLink.push_back(dxVertex);
226 std::vector<double> massesJpsi;
229 std::vector<double> massesDx;
238 std::vector<double> Masses;
260 PtErr_decor(*mainVertex) =
m_CascadeTools->pTError(moms[1],
x->getCovariance()[1]);
262 chi2_decor(*mainVertex) =
x->fitChi2();
263 ndof_decor(*mainVertex) =
x->nDoF();
267 TLorentzVector p4_mu1, p4_mu2;
274 massMumu = (p4_mu1 + p4_mu2).M();
276 MassMumu_decor(*mainVertex) = massMumu;
278 float massKX = 0., massKXpi = 0.;
280 TLorentzVector p4_h1, p4_h2, p4_h3;
299 massKX = (p4_h1 + p4_h2).M();
300 massKXpi = (p4_h1 + p4_h2 + p4_h3).M();
302 MassKX_svdecor(*mainVertex) = massKX;
303 MassKXpi_svdecor(*mainVertex) = massKXpi;
311 Mass_svdecor(*mainVertex) =
m_CascadeTools->invariantMass(moms[0]);
312 MassErr_svdecor(*mainVertex) =
m_CascadeTools->invariantMassError(moms[0],
x->getCovariance()[0]);
314 PtErr_svdecor(*mainVertex) =
m_CascadeTools->pTError(moms[0],
x->getCovariance()[0]);
315 Lxy_svdecor(*mainVertex) =
m_CascadeTools->lxy(moms[0],cascadeVertices[0],cascadeVertices[1]);
316 LxyErr_svdecor(*mainVertex) =
m_CascadeTools->lxyError(moms[0],
x->getCovariance()[0],cascadeVertices[0],cascadeVertices[1]);
317 Tau_svdecor(*mainVertex) =
m_CascadeTools->tau(moms[0],cascadeVertices[0],cascadeVertices[1]);
318 TauErr_svdecor(*mainVertex) =
m_CascadeTools->tauError(moms[0],
x->getCovariance()[0],cascadeVertices[0],cascadeVertices[1]);
322 <<
" chi2_1 " <<
m_V0Tools->chisq(cascadeVertices[0])
323 <<
" chi2_2 " <<
m_V0Tools->chisq(cascadeVertices[1])
327 <<
" error " <<
m_V0Tools->invariantMassError(cascadeVertices[0],massesDx)
328 <<
" mass_J " <<
m_V0Tools->invariantMass(cascadeVertices[1],massesJpsi)
329 <<
" error " <<
m_V0Tools->invariantMassError(cascadeVertices[1],massesJpsi));
333 double Mass_B_err =
m_CascadeTools->invariantMassError(moms[1],
x->getCovariance()[1]);
334 double Mass_D_err =
m_CascadeTools->invariantMassError(moms[0],
x->getCovariance()[0]);
336 ATH_MSG_DEBUG(
"Mass_B_err " << Mass_B_err <<
" Mass_D_err " << Mass_D_err);
338 double mprob_D =
m_CascadeTools->massProbability(mass_d,Mass_D,Mass_D_err);
339 ATH_MSG_DEBUG(
"mprob_B " << mprob_B <<
" mprob_D " << mprob_D);
342 <<
" Mass_d " <<
m_CascadeTools->invariantMass(moms[0],massesDx));
344 <<
" Mass_d_err " <<
m_CascadeTools->invariantMassError(moms[0],
x->getCovariance()[0],massesDx));
347 <<
" pt_dp " <<
m_V0Tools->pT(cascadeVertices[0]));
349 <<
" ptErr_d " <<
m_CascadeTools->pTError(moms[0],
x->getCovariance()[0])
350 <<
" ptErr_dp " <<
m_V0Tools->pTError(cascadeVertices[0]));
354 <<
" lxyErr_d " <<
m_CascadeTools->lxyError(moms[0],
x->getCovariance()[0],cascadeVertices[0],cascadeVertices[1])
355 <<
" lxyErr_dp " <<
m_V0Tools->lxyError(cascadeVertices[0],cascadeVertices[1]));
357 <<
" tau_dp " <<
m_V0Tools->tau(cascadeVertices[0],cascadeVertices[1],massesDx));
359 <<
" tau_d " <<
m_CascadeTools->tau(moms[0],cascadeVertices[0],cascadeVertices[1])
360 <<
" tau_D " <<
m_CascadeTools->tau(moms[0],cascadeVertices[0],cascadeVertices[1],mass_d));
362 <<
" tauErr_d " <<
m_CascadeTools->tauError(moms[0],
x->getCovariance()[0],cascadeVertices[0],cascadeVertices[1])
363 <<
" tauErr_dp " <<
m_V0Tools->tauError(cascadeVertices[0],cascadeVertices[1],massesDx));
365 <<
" TauErr_d " <<
m_CascadeTools->tauError(moms[0],
x->getCovariance()[0],cascadeVertices[0],cascadeVertices[1],mass_d)
366 <<
" TauErr_dp " <<
m_V0Tools->tauError(cascadeVertices[0],cascadeVertices[1],massesDx,mass_d));
368 ATH_MSG_DEBUG(
"CascadeTools main vert wrt PV " <<
" CascadeTools SV " <<
" V0Tools SV");
370 <<
", " <<
m_CascadeTools->a0z(moms[0],cascadeVertices[0],cascadeVertices[1])
371 <<
", " <<
m_V0Tools->a0z(cascadeVertices[0],cascadeVertices[1]));
373 <<
", " <<
m_CascadeTools->a0zError(moms[0],
x->getCovariance()[0],cascadeVertices[0],cascadeVertices[1])
374 <<
", " <<
m_V0Tools->a0zError(cascadeVertices[0],cascadeVertices[1]));
376 <<
", " <<
m_CascadeTools->a0xy(moms[0],cascadeVertices[0],cascadeVertices[1])
377 <<
", " <<
m_V0Tools->a0xy(cascadeVertices[0],cascadeVertices[1]));
379 <<
", " <<
m_CascadeTools->a0xyError(moms[0],
x->getCovariance()[0],cascadeVertices[0],cascadeVertices[1])
380 <<
", " <<
m_V0Tools->a0xyError(cascadeVertices[0],cascadeVertices[1]));
382 <<
", " <<
m_CascadeTools->a0(moms[0],cascadeVertices[0],cascadeVertices[1])
383 <<
", " <<
m_V0Tools->a0(cascadeVertices[0],cascadeVertices[1]));
385 <<
", " <<
m_CascadeTools->a0Error(moms[0],
x->getCovariance()[0],cascadeVertices[0],cascadeVertices[1])
386 <<
", " <<
m_V0Tools->a0Error(cascadeVertices[0],cascadeVertices[1]));
389 ATH_MSG_DEBUG(
"X0 " << primaryVertex->x() <<
" Y0 " << primaryVertex->y() <<
" Z0 " << primaryVertex->z());
392 ATH_MSG_DEBUG(
"Rxy0 wrt PV " <<
m_V0Tools->rxy(cascadeVertices[0],primaryVertex) <<
" RxyErr0 wrt PV " <<
m_V0Tools->rxyError(cascadeVertices[0],primaryVertex));
393 ATH_MSG_DEBUG(
"Rxy1 wrt PV " <<
m_V0Tools->rxy(cascadeVertices[1],primaryVertex) <<
" RxyErr1 wrt PV " <<
m_V0Tools->rxyError(cascadeVertices[1],primaryVertex));
394 ATH_MSG_DEBUG(
"number of covariance matrices " << (
x->getCovariance()).size());
399 for (
auto x : cascadeinfoContainer)
delete x;
401 return StatusCode::SUCCESS;