76 std::vector<Trk::VxCascadeInfo*> cascadeinfoContainer;
77 constexpr
int topoN = 2;
78 std::array<xAOD::VertexContainer*, topoN> Vtxwritehandles;
79 std::array<xAOD::VertexAuxContainer*, topoN> Vtxwritehandlesaux;
82 for(
int i =0;
i<topoN;
i++){
85 Vtxwritehandles[
i]->setStore(Vtxwritehandlesaux[
i]);
98 if (pvContainer->size()==0){
99 ATH_MSG_WARNING(
"You have no primary vertices: " << pvContainer->size());
100 return StatusCode::RECOVERABLE;
102 primaryVertex = (*pvContainer)[0];
114 refPvContainer->setStore(refPvAuxContainer);
143 ATH_MSG_DEBUG(
"cascadeinfoContainer size " << cascadeinfoContainer.size());
155 return StatusCode::FAILURE;
176 const std::vector<xAOD::Vertex*> &cascadeVertices =
x->vertices();
177 if(cascadeVertices.size()!=topoN)
179 if(cascadeVertices[0] ==
nullptr || cascadeVertices[1] ==
nullptr)
ATH_MSG_ERROR(
"Error null vertex");
181 for(
int i =0;
i<topoN;
i++) Vtxwritehandles[
i]->push_back(cascadeVertices[
i]);
183 x->setSVOwnership(
false);
184 const auto mainVertex = cascadeVertices[1];
186 const std::vector< std::vector<TLorentzVector> > &moms =
x->getParticleMoms();
189 std::vector<const xAOD::Vertex*> verticestoLink;
190 verticestoLink.push_back(cascadeVertices[0]);
191 if(Vtxwritehandles[1] ==
nullptr)
ATH_MSG_ERROR(
"Vtxwritehandles[1] is null");
196 const xAOD::Vertex* jpsiVertex = BPhysPVCascadeTools::FindVertex<2>(jpsiContainer, cascadeVertices[1]);
197 ATH_MSG_DEBUG(
"1 pt Jpsi tracks " << cascadeVertices[1]->trackParticle(0)->
pt() <<
", " << cascadeVertices[1]->trackParticle(1)->
pt());
201 const xAOD::Vertex* v0Vertex = BPhysPVCascadeTools::FindVertex<2>(v0Container, cascadeVertices[0]);;
202 ATH_MSG_DEBUG(
"1 pt V0 tracks " << cascadeVertices[0]->trackParticle(0)->
pt() <<
", " << cascadeVertices[0]->trackParticle(1)->
pt());
206 std::vector<const xAOD::Vertex*> jpsiVerticestoLink;
207 if (jpsiVertex) jpsiVerticestoLink.push_back(jpsiVertex);
212 std::vector<const xAOD::Vertex*> v0VerticestoLink;
213 if (v0Vertex) v0VerticestoLink.push_back(v0Vertex);
221 std::vector<double> massesJpsi(2, mass_track);
222 std::vector<double> massesV0;
223 std::vector<double> Masses(2, mass_track);
258 PtErr_decor(*mainVertex) =
m_CascadeTools->pTError(moms[1],
x->getCovariance()[1]);
260 chi2_decor(*mainVertex) =
x->fitChi2();
261 ndof_decor(*mainVertex) =
x->nDoF();
268 Mass_svdecor(*mainVertex) =
m_CascadeTools->invariantMass(moms[0]);
269 MassErr_svdecor(*mainVertex) =
m_CascadeTools->invariantMassError(moms[0],
x->getCovariance()[0]);
271 PtErr_svdecor(*mainVertex) =
m_CascadeTools->pTError(moms[0],
x->getCovariance()[0]);
272 Lxy_svdecor(*mainVertex) =
m_CascadeTools->lxy(moms[0],cascadeVertices[0],cascadeVertices[1]);
273 LxyErr_svdecor(*mainVertex) =
m_CascadeTools->lxyError(moms[0],
x->getCovariance()[0],cascadeVertices[0],cascadeVertices[1]);
274 Tau_svdecor(*mainVertex) =
m_CascadeTools->tau(moms[0],cascadeVertices[0],cascadeVertices[1]);
275 TauErr_svdecor(*mainVertex) =
m_CascadeTools->tauError(moms[0],
x->getCovariance()[0],cascadeVertices[0],cascadeVertices[1]);
279 <<
" chi2_1 " <<
m_V0Tools->chisq(cascadeVertices[0])
280 <<
" chi2_2 " <<
m_V0Tools->chisq(cascadeVertices[1])
284 <<
" error " <<
m_V0Tools->invariantMassError(cascadeVertices[0],massesV0)
285 <<
" mass_J " <<
m_V0Tools->invariantMass(cascadeVertices[1],massesJpsi)
286 <<
" error " <<
m_V0Tools->invariantMassError(cascadeVertices[1],massesJpsi));
290 double Mass_B_err =
m_CascadeTools->invariantMassError(moms[1],
x->getCovariance()[1]);
291 double Mass_V0_err =
m_CascadeTools->invariantMassError(moms[0],
x->getCovariance()[0]);
292 ATH_MSG_DEBUG(
"Mass_B " << Mass_B <<
" Mass_V0 " << Mass_V0);
293 ATH_MSG_DEBUG(
"Mass_B_err " << Mass_B_err <<
" Mass_V0_err " << Mass_V0_err);
295 double mprob_V0 =
m_CascadeTools->massProbability(mass_v0,Mass_V0,Mass_V0_err);
296 ATH_MSG_DEBUG(
"mprob_B " << mprob_B <<
" mprob_V0 " << mprob_V0);
299 <<
" Mass_v0 " <<
m_CascadeTools->invariantMass(moms[0],massesV0));
301 <<
" Mass_v0_err " <<
m_CascadeTools->invariantMassError(moms[0],
x->getCovariance()[0],massesV0));
304 <<
" pt_v0 " <<
m_V0Tools->pT(cascadeVertices[0]));
306 <<
" ptErr_v " <<
m_CascadeTools->pTError(moms[0],
x->getCovariance()[0])
307 <<
" ptErr_v0 " <<
m_V0Tools->pTError(cascadeVertices[0]));
311 <<
" lxyErr_v " <<
m_CascadeTools->lxyError(moms[0],
x->getCovariance()[0],cascadeVertices[0],cascadeVertices[1])
312 <<
" lxyErr_v0 " <<
m_V0Tools->lxyError(cascadeVertices[0],cascadeVertices[1]));
314 <<
" tau_v0 " <<
m_V0Tools->tau(cascadeVertices[0],cascadeVertices[1],massesV0));
316 <<
" tau_v " <<
m_CascadeTools->tau(moms[0],cascadeVertices[0],cascadeVertices[1])
317 <<
" tau_V " <<
m_CascadeTools->tau(moms[0],cascadeVertices[0],cascadeVertices[1],mass_v0));
319 <<
" tauErr_v " <<
m_CascadeTools->tauError(moms[0],
x->getCovariance()[0],cascadeVertices[0],cascadeVertices[1])
320 <<
" tauErr_v0 " <<
m_V0Tools->tauError(cascadeVertices[0],cascadeVertices[1],massesV0));
322 <<
" TauErr_v " <<
m_CascadeTools->tauError(moms[0],
x->getCovariance()[0],cascadeVertices[0],cascadeVertices[1],mass_v0)
323 <<
" TauErr_v0 " <<
m_V0Tools->tauError(cascadeVertices[0],cascadeVertices[1],massesV0,mass_v0));
325 ATH_MSG_DEBUG(
"CascadeTools main vert wrt PV " <<
" CascadeTools SV " <<
" V0Tools SV");
327 <<
", " <<
m_CascadeTools->a0z(moms[0],cascadeVertices[0],cascadeVertices[1])
328 <<
", " <<
m_V0Tools->a0z(cascadeVertices[0],cascadeVertices[1]));
330 <<
", " <<
m_CascadeTools->a0zError(moms[0],
x->getCovariance()[0],cascadeVertices[0],cascadeVertices[1])
331 <<
", " <<
m_V0Tools->a0zError(cascadeVertices[0],cascadeVertices[1]));
333 <<
", " <<
m_CascadeTools->a0xy(moms[0],cascadeVertices[0],cascadeVertices[1])
334 <<
", " <<
m_V0Tools->a0xy(cascadeVertices[0],cascadeVertices[1]));
336 <<
", " <<
m_CascadeTools->a0xyError(moms[0],
x->getCovariance()[0],cascadeVertices[0],cascadeVertices[1])
337 <<
", " <<
m_V0Tools->a0xyError(cascadeVertices[0],cascadeVertices[1]));
339 <<
", " <<
m_CascadeTools->a0(moms[0],cascadeVertices[0],cascadeVertices[1])
340 <<
", " <<
m_V0Tools->a0(cascadeVertices[0],cascadeVertices[1]));
342 <<
", " <<
m_CascadeTools->a0Error(moms[0],
x->getCovariance()[0],cascadeVertices[0],cascadeVertices[1])
343 <<
", " <<
m_V0Tools->a0Error(cascadeVertices[0],cascadeVertices[1]));
346 ATH_MSG_DEBUG(
"X0 " << primaryVertex->x() <<
" Y0 " << primaryVertex->y() <<
" Z0 " << primaryVertex->z());
349 ATH_MSG_DEBUG(
"Rxy0 wrt PV " <<
m_V0Tools->rxy(cascadeVertices[0],primaryVertex) <<
" RxyErr0 wrt PV " <<
m_V0Tools->rxyError(cascadeVertices[0],primaryVertex));
350 ATH_MSG_DEBUG(
"Rxy1 wrt PV " <<
m_V0Tools->rxy(cascadeVertices[1],primaryVertex) <<
" RxyErr1 wrt PV " <<
m_V0Tools->rxyError(cascadeVertices[1],primaryVertex));
351 ATH_MSG_DEBUG(
"number of covariance matrices " << (
x->getCovariance()).size());
362 for (
auto x : cascadeinfoContainer)
delete x;
364 return StatusCode::SUCCESS;