14 #include "TLorentzVector.h"
29 m_bvertextool(
"Rec::NewVrtSecInclusiveTool/SVTool",this)
42 return StatusCode::SUCCESS;
47 return StatusCode::SUCCESS;
54 std::vector<const xAOD::TrackParticle*> trkparticles(0);
61 for(
const auto *
tp : (*tp_cont)) trkparticles.push_back(
tp);
70 for (
const auto *
v : *pv_cont ) {
88 auto bVertexContainer = std::make_unique<xAOD::VertexContainer>();
89 auto bVertexAuxContainer = std::make_unique<xAOD::VertexAuxContainer>();
90 bVertexContainer->setStore(bVertexAuxContainer.get());
92 if(
pv && trkparticles.size()>2 ){
93 std::unique_ptr<Trk::VxSecVertexInfo> foundVrts =
m_bvertextool->findAllVertices(trkparticles,*
pv);
94 if(foundVrts && !foundVrts->
vertices().empty()){
95 const std::vector<xAOD::Vertex*> vtmp=foundVrts->
vertices();
96 double mindRSVPV=1.e3;
97 for(
const auto & iv : vtmp) {
99 for (
const auto *btsv : *btsv_cont ) mindRSVPV=
std::min(
Amg::deltaR(btsv->position()-
pv->position(),iv->position()-
pv->position()),mindRSVPV);
101 bVertexContainer->push_back(iv);
102 std::vector< Trk::VxTrackAtVertex > & vtrk = iv->vxTrackAtVertex();
103 TLorentzVector VSUM(0.,0.,0.,0.);
105 for(
auto &
it : vtrk){
109 double absP = 1./std::abs(mPer->parameters()[
Trk::qOverP]);
113 bvrtM(*iv) =VSUM.M();
114 bvrtPt(*iv) =VSUM.Pt();
115 bvrtEta(*iv)=VSUM.Eta();
116 bvrtPhi(*iv)=VSUM.Phi();
117 TVector3 SVmPV(iv->x()-
pv->x(),iv->y()-
pv->y(),iv->z()-
pv->z());
118 double mindRMOM=1.e3, mindRSV=1.e3;
120 for(
const auto *
jet : (*jet_cont)) {
121 mindRMOM=
std::min(VSUM.DeltaR(
jet->p4()),mindRMOM);
122 mindRSV =
std::min(SVmPV.DeltaR(
jet->p4().Vect()),mindRSV);
125 mindRBTagSV(*iv) =mindRSVPV;
126 mindRjetP(*iv) =mindRMOM;
127 mindRjetV(*iv) =mindRSV;
131 ATH_MSG_DEBUG(
"Found Vertices in this event: " << bVertexContainer->size());
134 for(
auto iv : (*bVertexContainer)){
135 std::vector< ElementLink< xAOD::TrackParticleContainer > > newLinkVec;
136 for(
auto &
it : iv->trackParticleLinks()){
139 newLinkVec.push_back(tmpLnk);
141 iv->setTrackParticleLinks(newLinkVec);
146 std::move(bVertexAuxContainer)) );
147 return StatusCode::SUCCESS;