19 return StatusCode::SUCCESS;
29 std::vector<SG::WriteHandle<MuonCombined::InDetCandidateToTagMap> > tagMaps =
m_combTagMaps.makeHandles(ctx);
30 std::vector<MuonCombined::InDetCandidateToTagMap*> maps;
31 for (
auto&
h : tagMaps) {
32 ATH_CHECK(
h.record(std::make_unique<MuonCombined::InDetCandidateToTagMap>()));
33 maps.push_back(
h.ptr());
42 if (inDetCandidates->
empty() || muonCandidates->
empty()) {
43 ATH_MSG_DEBUG(__func__<<
"() "<<__LINE__<<
" - InDetCandidates "<<inDetCandidates->
size()
44 <<
", MuonCandidates: "<<muonCandidates->
size()<<
"... One of them is empty");
45 return StatusCode::SUCCESS;
49 const Trk::Track& muonTrack = muonCandidate->extrapolatedTrack() ?
50 *muonCandidate->extrapolatedTrack() :
51 muonCandidate->muonSpectrometerTrack();
54 std::vector<const InDetCandidate*> associatedIdCandidates{};
55 associatedIdCandidates.reserve(inDetCandidates->
size());
56 std::copy_if(inDetCandidates->
begin(),inDetCandidates->
end(), std::back_inserter(associatedIdCandidates),
58 return pass_prematching(*muonCandidate, *assocMe);
62 if (associatedIdCandidates.empty()) {
65 ATH_MSG_DEBUG(
"Associated ID candidates " << associatedIdCandidates.size());
69 tool->combine(*muonCandidate, associatedIdCandidates, *tagMaps.at(
count), muidCombTracks.
ptr(), muidMETracks.
ptr(), ctx);
73 return StatusCode::SUCCESS;
81 if (!ms_trk && !msoe_trk) {
99 if (id_trk && !id_extension)
m_alignUncertTool->get_track_state_measures(id_trk, id_exit, dummy, dummy, dummy);
100 if (ms_trk)
m_alignUncertTool->get_track_state_measures(ms_trk, dummy, dummy, dummy, ms_entrance);
101 if (msoe_trk)
m_alignUncertTool->get_track_state_measures(msoe_trk, dummy, dummy, dummy, msoe_entrance);
103 if (!msoe_entrance) msoe_entrance = ms_entrance;
104 if (!ms_entrance) ms_entrance = msoe_entrance;
108 if ((!id_exit && !id_extension) || !ms_entrance) {
111 if (!id_trk)
ATH_MSG_WARNING(
"Trk::Track not found for InDetTrack candidate!");
118 const double deltaEta = std::abs(muon_p3.eta() - idtr_p3.eta());
121 const double muonPt = muon_p3.perp();
122 const double indetPt = idtr_p3.perp();
123 const double ptBal = muonPt > 0. ? std::abs(muonPt - indetPt) / muonPt : 1.;
128 const Amg::Vector3D ms_en_pos = ms_entrance->trackParameters()->position();
129 const Amg::Vector3D msoe_en_pos = msoe_entrance->trackParameters()->position();
132 const double deltaEta = std::abs(id_ex_pos.eta() - ms_en_pos.eta());
135 const double deltaEtaMSOE = std::abs(id_ex_pos.eta() - msoe_en_pos.eta());
146 const double muonPt = muonPars->
momentum().perp();
148 const double ptBal = muonPt > 0. ? std::abs(muonPt - indetPt) / muonPt : 1.;
Scalar deltaPhi(const MatrixBase< Derived > &vec) const
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
DataVector< MuonCombined::InDetCandidate > InDetCandidateCollection
This typedef represents a collection of InDetCandidate objects.
DataVector< MuonCombined::MuonCandidate > MuonCandidateCollection
This typedef represents a collection of MuonCandidate objects.
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.
PublicToolHandle< Muon::MuonEDMPrinterTool > m_printer
PublicToolHandle< Muon::IMuonAlignmentUncertTool > m_alignUncertTool
Use this tool to retrieve the last and first measurments of the ID and MS, respectively.
SG::ReadHandleKey< MuonCandidateCollection > m_muonCandidateCollectionName
SG::WriteHandleKey< TrackCollection > m_muidMETracks
StatusCode execute(const EventContext &ctx) const override
SG::ReadHandleKey< InDetCandidateCollection > m_indetCandidateCollectionName
Gaudi::Property< float > m_deltaPhiPreSelection
SG::WriteHandleKey< TrackCollection > m_muidCombinedTracks
SG::WriteHandleKeyArray< MuonCombined::InDetCandidateToTagMap > m_combTagMaps
bool pass_prematching(const MuonCombined::MuonCandidate &muonCandidate, const MuonCombined::InDetCandidate &idCandidate) const
Checks whether the Id & the muon candidate are compatible to attempt a combination of the two as a si...
Gaudi::Property< float > m_ptBalance
StatusCode initialize() override
ToolHandleArray< MuonCombined::IMuonCombinedTagTool > m_muonCombinedTagTools
Gaudi::Property< float > m_deltaEtaPreSelection
const Trk::CaloExtension * getCaloExtension() const
const xAOD::TrackParticle & indetTrackParticle() const
access TrackParticle
const Trk::Track & muonSpectrometerTrack() const
access spectrometer track, always there
const Trk::Track * extrapolatedTrack() const
access extrapolated track, can be zero if back extrapolation failed
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
pointer_type ptr()
Dereference the pointer.
Tracking class to hold the extrapolation through calorimeter Layers Both the caloEntryLayerIntersecti...
const TrackParameters * muonEntryLayerIntersection() const
access to intersection with the muon entry layer return nullptr if the intersection failed
const Amg::Vector3D & momentum() const
Access method for the momentum.
const Amg::Vector3D & position() const
Access method for the position.
represents the track state (measurement, material, fit parameters and quality) at a surface.
const TrackParameters * trackParameters() const
return ptr to trackparameters const overload
const Trk::Perigee & perigeeParameters() const
Returns the Trk::MeasuredPerigee track parameters.
const Trk::Track * track() const
Returns a pointer (which can be NULL) to the Trk::Track which was used to make this TrackParticle.
virtual double pt() const override final
The transverse momentum ( ) of the particle.
int count(std::string s, const std::string ®x)
count how many occurances of a regx are in a string
Eigen::Matrix< double, 3, 1 > Vector3D
The MuonTagToSegMap is an auxillary construct that links the MuonSegments associated with a combined ...
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
ParametersBase< TrackParametersDim, Charged > TrackParameters
double deltaPhi(double phiA, double phiB)
delta Phi in range [-pi,pi[