|  | ATLAS Offline Software
    | 
 
 
 
Go to the documentation of this file.
   16 #include "GaudiKernel/ThreadLocalContext.h" 
   49         return StatusCode::FAILURE;
 
   71     return StatusCode::SUCCESS;
 
   87     return StatusCode::SUCCESS;
 
   93     const EventContext& ctx = Gaudi::Hive::currentContext();
 
  105         ATH_MSG_FATAL(
"execute - failed to find the InDetTrackParticles");
 
  106         return StatusCode::FAILURE;
 
  115     std::unique_ptr<xAOD::VertexContainer> refitVtxContainer = std::make_unique< xAOD::VertexContainer>();
 
  116     std::unique_ptr<xAOD::VertexAuxContainer> refitVtxContainerAux = std::make_unique< xAOD::VertexAuxContainer>();
 
  118     refitVtxContainer->setStore(refitVtxContainerAux.get());
 
  122         std::move(refitVtxContainer), std::move(refitVtxContainerAux)
 
  130     if (!h_leptonContainer.
isValid()){
 
  131         ATH_MSG_FATAL(
"execute - failed to find the lepton container");
 
  132         return StatusCode::FAILURE;
 
  138         return StatusCode::FAILURE;
 
  147         if(
vertex->vertexType() == 1) {
 
  153     if(!fittingInput.
priVtx) {
 
  154         ATH_MSG_INFO(
"Failed to find primary vertices - save empty containers");
 
  155         return StatusCode::SUCCESS;
 
  161     std::vector<const xAOD::TrackParticle *> priVtx_tracks;
 
  168             priVtx_tracks.push_back(
track);
 
  174         fittingInput, priVtx_tracks,
 
  179     if(!refittedPriVtx) {
 
  180         ATH_MSG_WARNING(
"Failed to refit primary vertex - save empty containers");
 
  181         return StatusCode::SUCCESS;
 
  196             << 
"\n\t\t\t  Size of lepton container:    " << leptonContainer.
size()
 
  197             << 
"\n-----------------------------------------------------------------");
 
  220             if(
muon->inDetTrackParticleLink().isValid()) {
 
  221                 tracklep = *(
muon->inDetTrackParticleLink());
 
  224                 ATH_MSG_DEBUG(
"PrimaryVertexReFitter::execute - skip muon without valid inDetTrackParticleLink()");
 
  230             ATH_MSG_WARNING(
"PrimaryVertexReFitter::execute - cannot find muon->inDetTrackParticleLink() nor electron->trackParticle()");
 
  240     h_refitVtxContainer->
push_back(std::move(refittedPriVtx));
 
  247     return StatusCode::SUCCESS;
 
  254     const std::vector<const xAOD::TrackParticle*> &tracks,
 
  263         ATH_MSG_WARNING(
"decorateLepWithReFitPrimaryVertex - invalid input primary vertex pointer");
 
  271     std::vector<const xAOD::TrackParticle*> priVtx_tracks_pass;
 
  272     bool isRefit = 
false;
 
  275         if(
track == tracklep) {
 
  277             ATH_MSG_DEBUG(
"decorateLepWithReFitPrimaryVertex -- lepton has been used, lepton pT =" << tracklep->
pt() << 
", track pT =" << 
track->pt());
 
  281         priVtx_tracks_pass.push_back(
track);
 
  285         ATH_MSG_DEBUG(
"decorateLepWithReFitPrimaryVertex -- Skip the primary vertex without lepton track");
 
  290     if(priVtx_tracks_pass.size() < 2) {
 
  291         ATH_MSG_DEBUG(
"decorateLepWithReFitPrimaryVertex -- Skip the primary vertex refitting: N tracks =" << priVtx_tracks_pass.size());
 
  296     std::unique_ptr<xAOD::Vertex> refittedVtxRMLep = m_vertexFitterTool->fitVertexWithSeed(
 
  297         input, priVtx_tracks_pass, input.priVtx->position(),
 
  300     if(refittedVtxRMLep) {
 
  301         ATH_MSG_DEBUG(
"decorateLepWithReFitPrimaryVertex -- save refitted non-prompt primary vertex with NTrack = " << refittedVtxRMLep->
nTrackParticles());
 
  303         if(input.refittedPriVtx) {
 
  304             (*m_distToRefittedPriVtx)    (*refittedVtxRMLep) = 
Prompt::getDistance(input.refittedPriVtx->position(), refittedVtxRMLep->position());
 
  306                 input.refittedPriVtx->position(),
 
  307                 refittedVtxRMLep->position(),
 
  308                 refittedVtxRMLep->covariance(),
 
  315         refitVtxContainer.
push_back(std::move(refittedVtxRMLep));
 
  
virtual double pt() const override final
The transverse momentum ( ) of the particle.
bool decorateLepWithReFitPrimaryVertex(const FittingInput &input, const xAOD::TrackParticle *tracklep, const std::vector< const xAOD::TrackParticle * > &tracks, xAOD::VertexContainer &refitVtxContainer)
size_t nTrackParticles() const
Get the number of tracks associated with this vertex.
ToolHandle< Prompt::VertexFittingTool > m_vertexFitterTool
SG::ReadHandleKey< xAOD::IParticleContainer > m_leptonContainerKey
virtual StatusCode finalize() override
SG::WriteHandleKey< xAOD::VertexContainer > m_reFitPrimaryVertexKey
const xAOD::TrackParticle * trackParticle(size_t index=0) const
Pointer to the xAOD::TrackParticle/s that match the electron candidate.
const Amg::Vector3D & position() const
Returns the 3-pos.
PrimaryVertexReFitter(const std::string &name, ISvcLocator *pSvcLocator)
Class providing the definition of the 4-vector interface.
std::string PrintResetStopWatch(TStopwatch &watch)
Gaudi::Property< std::string > m_normDistToRefittedPriVtxName
SG::WriteDecorHandleKey< xAOD::IParticleContainer > m_lepRefittedVtxWithoutLeptonLinkName
def timer(name, disabled=False)
@ kRefittedPriVtxWithoutLep
double getNormDist(const Amg::Vector3D &PrimVtx, const Amg::Vector3D &SecVtx, const std::vector< float > &ErrorMatrix, MsgStream &msg)
double getDistance(const xAOD::Vertex *vtx1, const xAOD::Vertex *vtx2)
Object reference supporting deferred reading from StoreGate.
::StatusCode StatusCode
StatusCode definition for legacy code.
Handle class for adding a decoration to an object.
Handle class for adding a decoration to an object.
virtual StatusCode initialize() override
const TrackParticle * trackParticle(size_t i) const
Get the pointer to a given track that was used in vertex reco.
Gaudi::Property< bool > m_printTime
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.
std::optional< accessorFloat_t > m_normdistToRefittedPriVtx
value_type push_back(value_type pElem)
Add an element to the end of the collection.
const xAOD::TrackParticle * getOriginalTrackParticleFromGSF(const xAOD::TrackParticle *trkPar)
Helper function for getting the "Original" Track Particle (i.e before GSF) via the GSF Track Particle...
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_inDetTracksKey
SG::ReadHandleKey< xAOD::VertexContainer > m_primaryVertexContainerKey
Class describing a Vertex.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
#define ATH_MSG_WARNING(x)
Gaudi::Property< std::string > m_distToRefittedPriVtxName
Class describing a TrackParticle.
size_type size() const noexcept
Returns the number of elements in the collection.
virtual StatusCode execute() override
std::optional< accessorFloat_t > m_distToRefittedPriVtx