|
ATLAS Offline Software
|
Go to the documentation of this file.
29 const IInterface*
p) :
30 AthAlgTool(
t,
n,
p), m_vertexEstimator(
"InDet::VertexPointEstimator"), m_iVertexFitter(
"Trk::TrkVKalVrtFitter"),
33 m_v0Tools(
"Trk::V0Tools"),
34 m_pvRefitter(
"Analysis::PrimaryVertexRefitter", this),
36 m_vertexFittingWithPV(false),
39 m_useAdditionalTrack(false)
42 declareInterface<DerivationFramework::IAugmentationTool>(
this);
89 return StatusCode::FAILURE;
96 if(
m_VKVFitter==
nullptr)
return StatusCode::FAILURE;
105 return StatusCode::SUCCESS;
110 const EventContext& ctx = Gaudi::Hive::currentContext();
112 ATH_CHECK(vtxContainer.
record(std::make_unique<xAOD::VertexContainer>(), std::make_unique<xAOD::VertexAuxContainer>()));
137 for(
size_t i =0;
i<Ntracks;
i++)
140 if(trackN >=
v->nTrackParticles())
143 return StatusCode::FAILURE;
145 fitpair[
i] =
v->trackParticle(trackN);
151 for (
auto trkItr=importedTrackCollection->
cbegin(); trkItr!=importedTrackCollection->
cend(); ++trkItr) {
153 fitpair.back() =
nullptr;
162 fitAndStore(vtxContainer.
ptr(),
v,InVtxContainer.cptr(),fitpair,importedTrackCollection.
cptr(),pvContainer.
cptr());
167 fitAndStore(vtxContainer.
ptr(),
v,InVtxContainer.cptr(),fitpair,importedTrackCollection.
cptr(),pvContainer.
cptr());
184 ATH_CHECK(refPvContainer.
record(std::make_unique<xAOD::VertexContainer>(), std::make_unique<xAOD::VertexAuxContainer>()));
186 if(vtxContainer->
size() >0){
196 std::vector<const xAOD::TrackParticleContainer*> trackCols;
199 trackCols.push_back(handle.
cptr());
201 if(not trackCols.empty()){
205 }
catch(std::runtime_error
const&
e){
207 return StatusCode::FAILURE;
211 return StatusCode::SUCCESS;
217 const std::vector<const xAOD::TrackParticle*> &
inputTracks,
221 std::unique_ptr<xAOD::Vertex>
ptr(
fit(
inputTracks, importedTrackCollection,
nullptr));
224 double chi2DOF =
ptr->chiSquared()/
ptr->numberDoF();
227 if(!chi2CutPassed) {
ATH_MSG_DEBUG(
"Chi Cut failed!");
return; }
232 double bMass = bMomentum.M();
234 if(!passesCuts)
return;
238 std::vector<const xAOD::Vertex*> thePreceding;
239 thePreceding.push_back(
v);
243 if (!closestRefPV.
get())
return;
244 std::unique_ptr<xAOD::Vertex> ptrPV(
fit(
inputTracks, importedTrackCollection, closestRefPV.
get()));
250 if(!chi2CutPassed) {
ATH_MSG_DEBUG(
"Chi Cut failed!");
return; }
255 double bMass = bMomentumPV.M();
257 if(!passesCuts)
return;
261 vtxContainer->
push_back(ptrPV.release());
288 pv->position().z(), *state);
304 if (errorcode != 0) {startingPoint(0) = 0.0; startingPoint(1) = 0.0; startingPoint(2) = 0.0;}
309 std::vector<ElementLink<DataVector<xAOD::TrackParticle> > > newLinkVector;
314 newLinkVector.push_back( mylink );
SG::WriteHandleKey< xAOD::VertexContainer > m_refPVContainerName
static Analysis::CleanUpVertex ClosestRefPV(xAOD::BPhysHelper &, const xAOD::VertexContainer *, const Analysis::PrimaryVertexRefitter *)
std::vector< int > m_TrackIndices
TVector3 totalP()
: Returns total 3-momentum calculated from the refitted tracks
const xAOD::Vertex * get() const
SG::WriteHandleKey< xAOD::VertexContainer > m_OutputContainerName
xAOD::Vertex * fit(const std::vector< const xAOD::TrackParticle * > &inputTracks, const xAOD::TrackParticleContainer *importedTrackCollection, const xAOD::Vertex *pv) const
virtual void setVertexForConstraint(const xAOD::Vertex &, IVKalState &istate) const override final
virtual void setCovVrtForConstraint(double XX, double XY, double YY, double XZ, double YZ, double ZZ, IVKalState &istate) const override final
@ z
global position (cartesian)
virtual StatusCode addBranches() const override
Pass the thinning service
bool passed(DecisionID id, const DecisionIDContainer &idSet)
checks if required decision ID is in the set of IDs in the container
const_pointer_type cptr()
Dereference the pointer.
bool m_vertexFittingWithPV
bool m_useAdditionalTrack
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Dummy class used to allow special convertors to be called for surfaces owned by a detector element.
const TrackParticleLinks_t & trackParticleLinks() const
Get all the particles associated with the vertex.
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfo_key
std::vector< std::string > m_hypoNames
SG::ReadHandleKey< xAOD::VertexContainer > m_inputContainerName
bool pass() const
get the pass flag for this hypothesis
const_iterator cend() const noexcept
Return a const_iterator pointing past the end of the collection.
Trk::TrkVKalVrtFitter * m_VKVFitter
static bool isContainedIn(const xAOD::TrackParticle *, const std::vector< const xAOD::TrackParticle * > &)
bool setPrecedingVertices(const std::vector< const xAOD::Vertex * > &vertices, const xAOD::VertexContainer *vertexContainer)
Sets links to preceding vertices.
ToolHandle< InDet::VertexPointEstimator > m_vertexEstimator
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_trackContainer
virtual void setMassForConstraint(double Mass, IVKalState &istate) const override final
ToolHandle< Analysis::PrimaryVertexRefitter > m_pvRefitter
SG::ReadHandleKeyArray< xAOD::TrackParticleContainer > m_RelinkContainers
std::vector< double > m_trkMasses
std::vector< int > m_indices
::StatusCode StatusCode
StatusCode definition for legacy code.
pointer_type ptr()
Dereference the pointer.
: B-physcis xAOD helpers.
virtual StatusCode initialize() override
virtual void setCnstType(int, IVKalState &istate) const override final
void setTrackParticleLinks(const TrackParticleLinks_t &trackParticles)
Set all track particle links at once.
ToolHandle< Trk::V0Tools > m_v0Tools
ReVertex(const std::string &t, const std::string &n, const IInterface *p)
void clearTracks()
Remove all tracks from the vertex.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
ElementLink implementation for ROOT usage.
static void RelinkVertexTracks(const std::vector< const xAOD::TrackParticleContainer * > &trkcols, xAOD::Vertex *vtx)
bool setStorableObject(BaseConstReference data, bool replace=false, IProxyDict *sg=0)
Set link to point to a new container (storable).
value_type push_back(value_type pElem)
Add an element to the end of the collection.
Eigen::Matrix< double, 3, 1 > Vector3D
float numberDoF() const
Returns the number of degrees of freedom of the vertex fit as float.
bool setRefTrks(std::vector< float > px, std::vector< float > py, std::vector< float > pz)
Sets refitted track momenta.
float chiSquared() const
Returns the of the vertex fit as float.
Class describing a Vertex.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
const_iterator cbegin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
SG::ReadHandleKey< xAOD::VertexContainer > m_pvContainerName
void fitAndStore(xAOD::VertexContainer *vtxContainer, const xAOD::Vertex *v, const xAOD::VertexContainer *InVtxContainer, const std::vector< const xAOD::TrackParticle * > &inputTracks, const xAOD::TrackParticleContainer *importedTrackCollection, const xAOD::VertexContainer *pvContainer) const
Class describing a TrackParticle.
virtual xAOD::Vertex * fit(const std::vector< const TrackParameters * > &perigeeList, const Amg::Vector3D &startingPoint) const override final
Interface for MeasuredPerigee with starting point.
ToolHandle< Trk::IVertexFitter > m_iVertexFitter
SG::ReadHandleKeyArray< xAOD::VertexContainer > m_CollectionsToCheck
size_type size() const noexcept
Returns the number of elements in the collection.
virtual void setMassInputParticles(const std::vector< double > &, IVKalState &istate) const override final
virtual std::unique_ptr< IVKalState > makeState(const EventContext &ctx) const override final