63 constexpr float errConst = std::numeric_limits<float>::lowest();
81 const std::vector<const xAOD::Vertex*> &PVlist,
82 const size_t PV_minNTracks)
const {
85 lowZ=std::numeric_limits<std::size_t>::max();
88 size_t size = PVlist.size();
89 double lowA0zcalc = fabs(
m_v0Tools->a0z (Obj.
vtx(), PVlist[0]));
90 for(
size_t i =1; i<size; i++) {
91 if ( PVlist[i]->nTrackParticles() >= PV_minNTracks ) {
93 if(a0z < lowA0zcalc) {
104 int DoVertexType,
const bool SetOrignal)
const {
105 const bool doPt = (DoVertexType & 1) != 0;
106 const bool doA0 = (DoVertexType & 2) != 0;
107 const bool doZ0 = (DoVertexType & 4) != 0;
108 const bool doZ0BA = (DoVertexType & 8) != 0;
111 for(; vtxItr!=vtxContainer->
end(); ++vtxItr) {
143 const bool doPt = (DoVertexType & 1) != 0;
144 const bool doA0 = (DoVertexType & 2) != 0;
145 const bool doZ0 = (DoVertexType & 4) != 0;
146 const bool doZ0BA = (DoVertexType & 8) != 0;
148 for(; vtxItr!=vtxContainer->
end(); ++vtxItr) {
183 const std::vector<const xAOD::Vertex*> GoodPVs =
GetGoodPV(pvContainer);
186 if(GoodPVs.empty() ==
false) {
188 const bool doPt = (DoVertexType & 1) != 0;
189 const bool doA0 = (DoVertexType & 2) != 0;
190 const bool doZ0 = (DoVertexType & 4) != 0;
191 const bool doZ0BA = (DoVertexType & 8) != 0;
194 for(; vtxItr!=vtxContainer->
end(); ++vtxItr) {
221 if ( lowZBA < GoodPVs.size() ) {
233 if(pvContainer->
empty())
return StatusCode::FAILURE;
237 return StatusCode::SUCCESS;
251 std::vector<const xAOD::Vertex*> goodPrimaryVertices =
GetGoodPV(pvContainer);
259 if(goodPrimaryVertices.empty() ==
false) {
261 size_t pVmax =std::min(in_PV_max, goodPrimaryVertices.size());
262 std::vector<const xAOD::Vertex*> refPVvertexes;
263 std::vector<xAOD::Vertex*> refPVvertexes_toDelete;
264 std::vector<int> exitCode;
265 refPVvertexes.reserve(pVmax);
266 refPVvertexes_toDelete.reserve(pVmax);
267 exitCode.reserve(pVmax);
269 bool doPt = (DoVertexType & 1) != 0;
270 bool doA0 = (DoVertexType & 2) != 0;
271 bool doZ0 = (DoVertexType & 4) != 0;
272 bool doZ0BA = (DoVertexType & 8) != 0;
275 for(; vtxItr!=vtxContainer->
end(); ++vtxItr) {
282 for(
size_t i =0; i < pVmax ; i++) {
287 exitCode.push_back(exit);
289 if(refPV ==
nullptr){
290 refPVvertexes.push_back(oldPV);
291 refPVvertexes_toDelete.push_back(
nullptr);
293 refPVvertexes.push_back(refPV);
294 refPVvertexes_toDelete.push_back(refPV);
301 size_t lowA0 = doA0 ?
305 size_t lowZBA = doZ0BA ?
326 (refPVvertexes_toDelete.at(highPtindex)) ? refPvContainer : pvContainer;
327 if(ParentContainer == refPvContainer)
328 refPvContainer->
push_back(refPVvertexes_toDelete.at(highPtindex));
337 (refPVvertexes_toDelete.at(lowA0)) ? refPvContainer : pvContainer;
338 if(ParentContainer == refPvContainer && highPtindex!=lowA0)
339 refPvContainer->
push_back(refPVvertexes_toDelete.at(lowA0));
351 (refPVvertexes_toDelete.at(lowZ)) ? refPvContainer : pvContainer;
352 if(ParentContainer == refPvContainer && highPtindex!=lowZ && lowZ!=lowA0)
353 refPvContainer->
push_back(refPVvertexes_toDelete.at(lowZ));
362 if ( lowZBA < pVmax ) {
364 (refPVvertexes_toDelete.at(lowZBA)) ?
365 refPvContainer : pvContainer;
366 if (ParentContainer == refPvContainer && highPtindex!=lowZBA
367 && lowZBA!=lowA0 && lowZBA != lowZ) {
369 refPvContainer->
push_back(refPVvertexes_toDelete.at(lowZBA));
374 vtx.
setOrigPv(goodPrimaryVertices[lowZBA], pvContainer,
389 if(doPt) refPVvertexes_toDelete[highPtindex] =
nullptr;
390 if(doA0) refPVvertexes_toDelete[lowA0] =
nullptr;
391 if(doZ0) refPVvertexes_toDelete[lowZ] =
nullptr;
392 if(doZ0BA && lowZBA < pVmax) refPVvertexes_toDelete[lowZBA] =
nullptr;
398 refPVvertexes.clear();
399 refPVvertexes_toDelete.clear();
405 if(pvContainer->
empty())
return StatusCode::FAILURE;
410 return StatusCode::SUCCESS;
415 for(
size_t i =0; i<PVlist.size(); i++) {
418 ATH_MSG_ERROR(
"High Pt Primary vertex not found - this should not happen");
419 return std::numeric_limits<std::size_t>::max();
423 const std::vector<const xAOD::Vertex*> &PVlist,
424 const size_t PV_minNTracks)
const {
427 lowA0=std::numeric_limits<std::size_t>::max();
430 size_t size = PVlist.size();
432 for(
size_t i =1; i<size; i++) {
433 if ( PVlist[i]->nTrackParticles() >= PV_minNTracks ) {
448 std::vector<const xAOD::Vertex*> goodPrimaryVertices;
449 goodPrimaryVertices.reserve(pvContainer->
size());
451 for (
auto ptr = pvContainer->
begin(); ptr!= pvContainer->
end(); ++ptr) {
452 VertexType thistype = (*ptr)->vertexType();
453 if ( thistype == Pileupvtx || thistype == Pvtx ) {
454 goodPrimaryVertices.push_back(*ptr);
459 return goodPrimaryVertices;
476 static const Amg::Vector3D defaultBS(-10000.,-10000.,-10000.);
484 const std::vector<const xAOD::Vertex*> &PVlist,
485 const size_t PV_minNTracks)
const {
487 size_t ilowZ0BA = std::numeric_limits<std::size_t>::max();
488 double lowZ0BAcalc = std::numeric_limits<double>::max();
489 for (
size_t i = 0; i<PVlist.size(); ++i) {
490 if ( PVlist[i]->nTrackParticles() >= PV_minNTracks ) {
491 double z0BA =
m_v0Tools->a0(obj.vtx(), PVlist[i]);
492 if (z0BA < lowZ0BAcalc) {
516 TVector3 totP(obj.totalP());
519 if ( pT.mag2() > 0 ) {
523 xDOCA = xSV - pSV*pT.dot(xT)/pT.mag2();
533 std::vector<ElementLink<DataVector<xAOD::TrackParticle> > > newLinkVector;
535 for(
unsigned int i=0; i< trkprtl.size(); i++)
539 newLinkVector.push_back( mylink );
#define ATH_MSG_WARNING(x)
: B-physics xAOD helpers.
#define BPHYS_CHECK(EXP)
Useful CHECK macro.
std::vector< size_t > vec
xAOD::Vertex * refitVertex(const xAOD::Vertex *vertex, const xAOD::Vertex *excludeVertex, bool ReturnCopy=true, int *exitcode=nullptr) const
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
const T * at(size_type n) const
Access an element, as an rvalue.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
DataModel_detail::iterator< DataVector > iterator
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
bool empty() const noexcept
Returns true if the collection is empty.
ElementLink implementation for ROOT usage.
bool setStorableObject(BaseConstReference data, bool replace=false, IProxyDict *sg=0)
Set link to point to a new container (storable).
bool setPtErr(const float val)
Set pT error.
float setZ0(const float val, const pv_type vertexType=BPhysHelper::PV_MIN_A0)
longitudinal impact parameter
bool setLxyErr(const float val, const pv_type vertexType=BPhysHelper::PV_MIN_A0)
its error
bool setLxy(const float val, const pv_type vertexType=BPhysHelper::PV_MIN_A0)
Set the transverse decay distance and its error measured between the refitted primary vertex of type ...
float setZ0Err(const float val, const pv_type vertexType=BPhysHelper::PV_MIN_A0)
longitudinal impact parameter error
const xAOD::Vertex * vtx() const
Getter method for the cached xAOD::Vertex.
float setA0(const float val, const pv_type vertexType=BPhysHelper::PV_MIN_A0)
Set the 3D and transverse impact parameters and their error.
bool setPv(const xAOD::Vertex *pv, const xAOD::VertexContainer *vertexContainer, const pv_type vertexType=BPhysHelper::PV_MIN_A0)
Set the refitted collision vertex of type pv_type.
pv_type
: Enum type of the PV
float setA0Err(const float val, const pv_type vertexType=BPhysHelper::PV_MIN_A0)
3D impact parameter error
bool setRefitPVStatus(int code, const pv_type vertexType=BPhysHelper::PV_MIN_A0)
Set the exitCode of the refitter for vertex of type pv_type.
float setA0xyErr(const float val, const pv_type vertexType=BPhysHelper::PV_MIN_A0)
transverse impact parameter error
float setA0xy(const float val, const pv_type vertexType=BPhysHelper::PV_MIN_A0)
transverse impact parameter
bool setOrigPv(const xAOD::Vertex *pv, const xAOD::VertexContainer *vertexContainer, const pv_type vertexType=BPhysHelper::PV_MIN_A0)
Set the original collision vertex of type pv_type.
bool setLxyz(const float val, const pv_type vertexType=BPhysHelper::PV_MIN_A0)
decay distance
bool setLxyzErr(const float val, const pv_type vertexType=BPhysHelper::PV_MIN_A0)
its error
void setTrackParticleLinks(const TrackParticleLinks_t &trackParticles)
Set all track particle links at once.
void clearTracks()
Remove all tracks from the vertex.
const TrackParticleLinks_t & trackParticleLinks() const
Get all the particles associated with the vertex.
Eigen::Matrix< double, 3, 1 > Vector3D
EventInfo_v1 EventInfo
Definition of the latest event info version.
VertexContainer_v1 VertexContainer
Definition of the current "Vertex container version".
Vertex_v1 Vertex
Define the latest version of the vertex class.
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".