97 std::vector<Trk::VxCascadeInfo*> cascadeinfoContainer;
98 constexpr
int topoN = 2;
99 std::array<xAOD::VertexContainer*, topoN> Vtxwritehandles;
100 std::array<xAOD::VertexAuxContainer*, topoN> Vtxwritehandlesaux;
103 for(
int i =0;
i<topoN;
i++){
106 Vtxwritehandles[
i]->setStore(Vtxwritehandlesaux[
i]);
119 if (pvContainer->size()==0){
120 ATH_MSG_WARNING(
"You have no primary vertices: " << pvContainer->size());
121 return StatusCode::RECOVERABLE;
123 primaryVertex = (*pvContainer)[0];
140 refPvContainer->setStore(refPvAuxContainer);
150 return StatusCode::FAILURE;
198 ATH_MSG_DEBUG(
"cascadeinfoContainer size " << cascadeinfoContainer.size());
233 const std::vector<xAOD::Vertex*> &cascadeVertices =
x->vertices();
235 if(cascadeVertices.size()!=topoN)
ATH_MSG_ERROR(
"Incorrect number of vertices");
236 if(cascadeVertices[0] ==
nullptr || cascadeVertices[1] ==
nullptr)
ATH_MSG_ERROR(
"Error null vertex");
238 for(
int i =0;
i<topoN;
i++) Vtxwritehandles[
i]->push_back(cascadeVertices[
i]);
240 x->setSVOwnership(
false);
241 const auto mainVertex = cascadeVertices[1];
243 const std::vector< std::vector<TLorentzVector> > &moms =
x->getParticleMoms();
247 std::vector<const xAOD::Vertex*> verticestoLink;
248 verticestoLink.push_back(cascadeVertices[0]);
249 if(Vtxwritehandles[1] ==
nullptr)
ATH_MSG_ERROR(
"Vtxwritehandles[1] is null");
255 typedef std::vector<const xAOD::Muon*>
MuonBag;
256 MuonBag selectedMuons; selectedMuons.clear();
260 if (muonTrk == cascadeVertices[1]->trackParticle(0)) selectedMuons.push_back(
mu);
270 auto muItr = selectedMuons.begin();
271 for(; muItr != selectedMuons.end(); muItr++) {
274 muLink.setElement(*muItr);
278 if( !muLink.isValid() )
continue;
281 preMuLinks.push_back( muLink );
286 MuonsLinksDecor(*cascadeVertices[1]) = preMuLinks;
292 const xAOD::Vertex* dxVertex = BPhysPVCascadeTools::FindVertex<3>(dxContainer, cascadeVertices[0]);
293 ATH_MSG_DEBUG(
"1 pt D_(s)+/Lambda_c+ tracks " << cascadeVertices[1]->trackParticle(0)->
pt()<<
", "
294 << cascadeVertices[0]->trackParticle(0)->
pt()<<
", "<< cascadeVertices[0]->trackParticle(1)->
pt()<<
", "
295 << cascadeVertices[0]->trackParticle(2)->
pt());
299 std::vector<const xAOD::Vertex*> dxVerticestoLink;
300 if (dxVertex) dxVerticestoLink.push_back(dxVertex);
303 ATH_MSG_ERROR(
"Error decorating with D_(s)+/Lambda_c+ vertices");
314 std::vector<double> massesMu;
316 std::vector<double> massesDx;
325 std::vector<double> Masses;
346 PtErr_decor(*mainVertex) =
m_CascadeTools->pTError(moms[1],
x->getCovariance()[1]);
348 chi2_decor(*mainVertex) =
x->fitChi2();
349 ndof_decor(*mainVertex) =
x->nDoF();
350 Dx_chi2_svdecor(*mainVertex) = cascadeVertices[0]->chiSquared();
351 Dx_ndof_svdecor(*mainVertex) = cascadeVertices[0]->numberDoF();
354 float muM = 0., mupt = 0., mueta = 0.;
355 if (selectedMuons.size()==1) {
356 TLorentzVector p4_mu1;
357 p4_mu1.SetPtEtaPhiM(selectedMuons.at(0)->pt(),
358 selectedMuons.at(0)->eta(),
362 mueta = p4_mu1.Eta();
364 MuMass_decor(*mainVertex) = muM;
365 MuPt_decor(*mainVertex) = mupt;
366 MuEta_decor(*mainVertex) = mueta;
367 ChargeMu_decor(*mainVertex) = selectedMuons.at(0)->charge();
368 MuChi2_decor(*mainVertex) = cascadeVertices[1]->trackParticle(0)->chiSquared();
369 MunDoF_decor(*mainVertex) = cascadeVertices[1]->trackParticle(0)->numberDoF();
372 std::vector< Trk::VxTrackAtVertex > trkAtB = cascadeVertices[1]->vxTrackAtVertex();
373 MuChi2B_decor(*mainVertex) = trkAtB.at(0).trackQuality().chiSquared();
374 MunDoFB_decor(*mainVertex) = trkAtB.at(0).trackQuality().numberDoF();
379 float massKX1X2 = 0.;
380 float RapidityKX1X2 = 0.;
382 TLorentzVector p4_h1, p4_h2, p4_h3;
408 massKX1 = (p4_h1 + p4_h2).M();
409 massKX1X2 = (p4_h1 + p4_h2 + p4_h3).M();
410 RapidityKX1X2 = (p4_h1 + p4_h2 + p4_h3).Rapidity();
412 massKX1_svdecor(*mainVertex) = massKX1;
413 massKX1X2_svdecor(*mainVertex) = massKX1X2;
414 RapidityKX1X2_svdecor(*mainVertex) = RapidityKX1X2;
423 Mass_svdecor(*mainVertex) =
m_CascadeTools->invariantMass(moms[0]);
424 MassErr_svdecor(*mainVertex) =
m_CascadeTools->invariantMassError(moms[0],
x->getCovariance()[0]);
426 PtErr_svdecor(*mainVertex) =
m_CascadeTools->pTError(moms[0],
x->getCovariance()[0]);
427 Lxy_svdecor(*mainVertex) =
m_CascadeTools->lxy(moms[0],cascadeVertices[0],cascadeVertices[1]);
428 LxyErr_svdecor(*mainVertex) =
m_CascadeTools->lxyError(moms[0],
x->getCovariance()[0],cascadeVertices[0],cascadeVertices[1]);
429 Tau_svdecor(*mainVertex) =
m_CascadeTools->tau(moms[0],cascadeVertices[0],cascadeVertices[1]);
430 TauErr_svdecor(*mainVertex) =
m_CascadeTools->tauError(moms[0],
x->getCovariance()[0],cascadeVertices[0],cascadeVertices[1]);
434 <<
" chi2_1 " <<
m_V0Tools->chisq(cascadeVertices[0])
435 <<
" chi2_2 " <<
m_V0Tools->chisq(cascadeVertices[1])
439 <<
" error " <<
m_V0Tools->invariantMassError(cascadeVertices[0],massesDx)
440 <<
" mass_J " <<
m_V0Tools->invariantMass(cascadeVertices[1],massesMu)
441 <<
" error " <<
m_V0Tools->invariantMassError(cascadeVertices[1],massesMu));
445 double Mass_B_err =
m_CascadeTools->invariantMassError(moms[1],
x->getCovariance()[1]);
446 double Mass_D_err =
m_CascadeTools->invariantMassError(moms[0],
x->getCovariance()[0]);
448 ATH_MSG_DEBUG(
"Mass_B_err " << Mass_B_err <<
" Mass_D_err " << Mass_D_err);
450 double mprob_D =
m_CascadeTools->massProbability(mass_d,Mass_D,Mass_D_err);
451 ATH_MSG_DEBUG(
"mprob_B " << mprob_B <<
" mprob_D " << mprob_D);
454 <<
" Mass_d " <<
m_CascadeTools->invariantMass(moms[0],massesDx));
456 <<
" Mass_d_err " <<
m_CascadeTools->invariantMassError(moms[0],
x->getCovariance()[0],massesDx));
459 <<
" pt_dp " <<
m_V0Tools->pT(cascadeVertices[0]));
461 <<
" ptErr_d " <<
m_CascadeTools->pTError(moms[0],
x->getCovariance()[0])
462 <<
" ptErr_dp " <<
m_V0Tools->pTError(cascadeVertices[0]));
466 <<
" lxyErr_d " <<
m_CascadeTools->lxyError(moms[0],
x->getCovariance()[0],cascadeVertices[0],cascadeVertices[1])
467 <<
" lxyErr_dp " <<
m_V0Tools->lxyError(cascadeVertices[0],cascadeVertices[1]));
469 <<
" tau_dp " <<
m_V0Tools->tau(cascadeVertices[0],cascadeVertices[1],massesDx));
471 <<
" tau_d " <<
m_CascadeTools->tau(moms[0],cascadeVertices[0],cascadeVertices[1])
472 <<
" tau_D " <<
m_CascadeTools->tau(moms[0],cascadeVertices[0],cascadeVertices[1],mass_d));
474 <<
" tauErr_d " <<
m_CascadeTools->tauError(moms[0],
x->getCovariance()[0],cascadeVertices[0],cascadeVertices[1])
475 <<
" tauErr_dp " <<
m_V0Tools->tauError(cascadeVertices[0],cascadeVertices[1],massesDx));
477 <<
" TauErr_d " <<
m_CascadeTools->tauError(moms[0],
x->getCovariance()[0],cascadeVertices[0],cascadeVertices[1],mass_d)
478 <<
" TauErr_dp " <<
m_V0Tools->tauError(cascadeVertices[0],cascadeVertices[1],massesDx,mass_d));
480 ATH_MSG_DEBUG(
"CascadeTools main vert wrt PV " <<
" CascadeTools SV " <<
" V0Tools SV");
482 <<
", " <<
m_CascadeTools->a0z(moms[0],cascadeVertices[0],cascadeVertices[1])
483 <<
", " <<
m_V0Tools->a0z(cascadeVertices[0],cascadeVertices[1]));
485 <<
", " <<
m_CascadeTools->a0zError(moms[0],
x->getCovariance()[0],cascadeVertices[0],cascadeVertices[1])
486 <<
", " <<
m_V0Tools->a0zError(cascadeVertices[0],cascadeVertices[1]));
488 <<
", " <<
m_CascadeTools->a0xy(moms[0],cascadeVertices[0],cascadeVertices[1])
489 <<
", " <<
m_V0Tools->a0xy(cascadeVertices[0],cascadeVertices[1]));
491 <<
", " <<
m_CascadeTools->a0xyError(moms[0],
x->getCovariance()[0],cascadeVertices[0],cascadeVertices[1])
492 <<
", " <<
m_V0Tools->a0xyError(cascadeVertices[0],cascadeVertices[1]));
494 <<
", " <<
m_CascadeTools->a0(moms[0],cascadeVertices[0],cascadeVertices[1])
495 <<
", " <<
m_V0Tools->a0(cascadeVertices[0],cascadeVertices[1]));
497 <<
", " <<
m_CascadeTools->a0Error(moms[0],
x->getCovariance()[0],cascadeVertices[0],cascadeVertices[1])
498 <<
", " <<
m_V0Tools->a0Error(cascadeVertices[0],cascadeVertices[1]));
501 ATH_MSG_DEBUG(
"X0 " << primaryVertex->x() <<
" Y0 " << primaryVertex->y() <<
" Z0 " << primaryVertex->z());
504 ATH_MSG_DEBUG(
"Rxy0 wrt PV " <<
m_V0Tools->rxy(cascadeVertices[0],primaryVertex) <<
" RxyErr0 wrt PV " <<
m_V0Tools->rxyError(cascadeVertices[0],primaryVertex));
505 ATH_MSG_DEBUG(
"Rxy1 wrt PV " <<
m_V0Tools->rxy(cascadeVertices[1],primaryVertex) <<
" RxyErr1 wrt PV " <<
m_V0Tools->rxyError(cascadeVertices[1],primaryVertex));
506 ATH_MSG_DEBUG(
"number of covariance matrices " << (
x->getCovariance()).size());
512 for (
auto x : cascadeinfoContainer)
delete x;
514 return StatusCode::SUCCESS;