19 return StatusCode::SUCCESS;
29 return StatusCode::FAILURE;
35 return StatusCode::FAILURE;
38 auto outputMuons = std::make_unique<xAOD::MuonContainer>();
39 auto outputMuonsAux = std::make_unique<xAOD::MuonAuxContainer>();
41 outputMuons->setStore (outputMuonsAux.get());
46 double track_charge=0.0;
48 std::vector<const xAOD::Muon*> matchedMuons;
55 if (nPixHits > 0)
continue;
58 TVector3 track_vector;
59 track_vector.SetPtEtaPhi(t->pt(), t->eta(), t->phi());
62 track_charge=t->charge();
66 float min_mu_charge=0.0;
69 for (muItr = inputMuons->begin(); muItr != inputMuons->end(); ++muItr){
71 if (m.muonType() != xAOD::Muon::MuonType::MuonStandAlone)
continue;
72 if (std::find(matchedMuons.begin(), matchedMuons.end(), *muItr) != matchedMuons.end())
continue;
76 mu_vector.SetPtEtaPhi(m.pt(), m.eta(), m.phi());
78 float mu_dR=mu_vector.DeltaR(track_vector);
83 min_mu_charge=mu_charge;
88 matchedMuons.push_back(*muMatchItr);
91 outputMuons->push_back(zeroPixelHitMuon);
92 zeroPixelHitMuon->
setP4(muon_match.
pt(),track_eta,track_phi);
93 zeroPixelHitMuon->
setCharge(min_mu_charge);
95 zeroPixelHitMuon->
setMuonType((xAOD::Muon::MuonType)10);
97 zeroPixelHitMuon->
setTrackParticleLink(xAOD::Muon::TrackParticleType::InnerDetectorTrackParticle, link);
104 CHECK( outputMuonsHandle.
record (std::move(outputMuons), std::move (outputMuonsAux)) );
108 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define CHECK(...)
Evaluate an expression and check for errors.
An algorithm that can be simultaneously executed in multiple threads.
DataModel_detail::const_iterator< DataVector > const_iterator
ElementLink implementation for ROOT usage.
RecoverZeroPixelHitMuons(const std::string &name, ISvcLocator *pSvcLocator)
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_inputTrackContainerKey
virtual StatusCode initialize() override
virtual StatusCode execute(const EventContext &context) const override
Gaudi::Property< float > m_matchingDeltaR
SG::WriteHandleKey< xAOD::MuonContainer > m_outputMuonContainerKey
SG::ReadHandleKey< xAOD::MuonContainer > m_inputMuonContainerKey
virtual bool isValid() override final
Can the handle be successfully dereferenced?
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
void setTrackParticleLink(TrackParticleType type, const ElementLink< TrackParticleContainer > &link)
Set method for TrackParticle links.
virtual double pt() const override
The transverse momentum ( ) of the particle.
void setMuonType(MuonType type)
void setP4(double pt, double eta, double phi)
Set method for IParticle values.
void setCharge(float charge)
Set the charge (must be the same as primaryTrackParticle() ).
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Muon_v1 Muon
Reference the current persistent version:
@ numberOfPixelHits
these are the pixel hits, including the b-layer [unit8_t].