ATLAS Offline Software
Loading...
Searching...
No Matches
Rec::MuSAVtxFitterTool Class Reference

#include <MuSAVtxFitterTool.h>

Inheritance diagram for Rec::MuSAVtxFitterTool:
Collaboration diagram for Rec::MuSAVtxFitterTool:

Classes

struct  WrkVrt
 Represents a working vertex structure used in VKalVrt fitting. More...

Public Member Functions

 MuSAVtxFitterTool (const std::string &type, const std::string &name, const IInterface *parent)
 ~MuSAVtxFitterTool ()
virtual StatusCode initialize () override
std::unique_ptr< xAOD::TrackParticle > extrapolateMuSA (const xAOD::TrackParticle &trk, const xAOD::EventInfo &eventInfo, const EventContext &ctx) const
StatusCode doMuSAVtxFit (std::vector< MuSAVtxFitterTool::WrkVrt > &workVerticesContainer, const xAOD::MuonContainer &muonContainer, const xAOD::EventInfo &eventInfo, const EventContext &ctx) const
StatusCode doPostFitSelections (std::vector< MuSAVtxFitterTool::WrkVrt > &workVerticesContainer) const
StatusCode selectBestVertices (std::vector< MuSAVtxFitterTool::WrkVrt > &workVerticesContainer) const
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Static Public Member Functions

static const InterfaceID & interfaceID ()

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvc > StoreGateSvc_t

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

ToolHandle< Trk::ITrkVKalVrtFitter > m_vertexFitter
ToolHandle< Trk::IExtrapolator > m_extrapolator
DoubleProperty m_etaCutMSTP {this, "etaCutMSTP", 2.5, "Maximum |eta| of input MSTPs"}
DoubleProperty m_baseChi2Cut {this, "baseChi2Cut", 50., "Maximum allowed chi2 of saved vertices"}
Gaudi::Property< bool > m_doValidation {this, "doValidation", false, "Vertex every MSTP in input as part of validation process"}
Gaudi::Property< bool > m_doStacoRecovery {this, "doStacoRecovery", false, "Recover MS tracks from Staco-authored Combined muons with large MS-ID mismatch"}
DoubleProperty m_stacoMatchDeltaCut {this, "stacoMatchDeltaCut", 0.2, "dEta or dPhi threshold between MS and ID tracks for Staco recovery"}
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default).
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default).
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 23 of file MuSAVtxFitterTool.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 376 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ MuSAVtxFitterTool()

Rec::MuSAVtxFitterTool::MuSAVtxFitterTool ( const std::string & type,
const std::string & name,
const IInterface * parent )

Definition at line 19 of file MuSAVtxFitterTool.cxx.

19 :
20 AthAlgTool(type, name, parent)
21{
22 declareInterface<MuSAVtxFitterTool>(this);
23}
AthAlgTool()
Default constructor:

◆ ~MuSAVtxFitterTool()

Rec::MuSAVtxFitterTool::~MuSAVtxFitterTool ( )
default

Member Function Documentation

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ doMuSAVtxFit()

StatusCode Rec::MuSAVtxFitterTool::doMuSAVtxFit ( std::vector< MuSAVtxFitterTool::WrkVrt > & workVerticesContainer,
const xAOD::MuonContainer & muonContainer,
const xAOD::EventInfo & eventInfo,
const EventContext & ctx ) const

Definition at line 69 of file MuSAVtxFitterTool.cxx.

73{
74 ATH_MSG_DEBUG("MuSAVtxFitterTool::doMuSAVtxFit");
75
76 // first gather all SA muons that pass basic checks
77 // also recover Staco-authored Combined muons with large MS-ID mismatch if configured
78 // this is done to create parity between mc20 and mc23 reconstruction, where in mc20 STACO matching was much looser
79 // erroneously reducing the number of available SA muons compared to mc23
80 std::vector<const xAOD::Muon*> candidateSAmuons;
81 for (const auto muon : muonContainer) {
82
83 // Check if this is a Staco Combined muon eligible for recovery
84 bool isStacoRecovery = false;
85 if (m_doStacoRecovery &&
86 muon->muonType() == xAOD::Muon::MuonType::Combined &&
87 muon->author() == xAOD::Muon::Author::STACO) {
88
89 //we do not try to recover LRT Stacos to avoid more likely situations where we
90 //mistakenly "recover" an MS track with a real displaced ID track
91 static const SG::Accessor<char> acc_isLRT("isLRT");
92 if (acc_isLRT.isAvailable(*muon) && acc_isLRT(*muon)) {
93 ATH_MSG_DEBUG("Skipping recovering LRT Staco muon!");
94 continue;
95 }
96
97 // Check the deltaR between the MS and ID tracks to see if they are likely to be a mismatched pair that could be recovered as a SA muon
98 // the default thresholds reflect the criteria used in mc23 reconstruction but can be configured as needed
99 const xAOD::TrackParticle* msTrk = muon->trackParticle(xAOD::Muon::MuonSpectrometerTrackParticle);
100 const xAOD::TrackParticle* idTrk = muon->trackParticle(xAOD::Muon::InnerDetectorTrackParticle);
101 if (msTrk && idTrk) {
102 double dEta = std::abs(msTrk->eta() - idTrk->eta());
103 double dPhi = std::abs(msTrk->phi() - idTrk->phi());
104 if (dPhi > M_PI) dPhi = 2.0 * M_PI - dPhi;
105 if (dEta > m_stacoMatchDeltaCut || dPhi > m_stacoMatchDeltaCut) {
106 ATH_MSG_DEBUG("Recovering Staco Combined muon with dEta=" << dEta << " dPhi=" << dPhi);
107 isStacoRecovery = true;
108 }
109 }
110 }
111
112 if (muon->muonType()!= xAOD::Muon::MuonType::MuonStandAlone && !isStacoRecovery && !m_doValidation) {
113 continue;
114 }
115
116 const xAOD::TrackParticle* MuSAMSTP = muon->trackParticle(xAOD::Muon::MuonSpectrometerTrackParticle);
117 if (!MuSAMSTP) {
118 //In validation mode it is expected that some non muidco muons arrive here, so let's mute the warning
119 if(!m_doValidation) ATH_MSG_WARNING("Muon has no MSTP, check your input! "<<muon->muonType()<<", "<<muon->author());
120 continue;
121 }
122
123 // pre-fit cuts at "seeding" level go here
124 if (std::abs(MuSAMSTP->eta()) > m_etaCutMSTP) {
125 ATH_MSG_VERBOSE("Skipping SA muon with |eta| > 2.5!");
126 continue;
127 }
128 // SA muons can get saved with nonphysical pT values, checking prevents extrap crashes
129 if (MuSAMSTP->pt() > 13000000) {
130 ATH_MSG_DEBUG("Skipping SA muon with pT " << (MuSAMSTP->pt() / 1000.) << " GeV!");
131 continue;
132 }
133
134 // SA muons can also be saved in regions with 0 magnetic field, which can cause extrapolation crashes
135 float spectrometerFieldIntegral = 0.0;
136 muon->parameter(spectrometerFieldIntegral, xAOD::Muon::ParamDef::spectrometerFieldIntegral);
137 if (spectrometerFieldIntegral < 0.1) {
138 ATH_MSG_DEBUG("Skipping SA muon with spectrometerFieldIntegral " << spectrometerFieldIntegral << " T*m!");
139 continue;
140 }
141
142 candidateSAmuons.push_back(muon);
143 }
144
145 // bail out if we don't have at least two valid SA muons
146 if (candidateSAmuons.size() < 2) {
147 ATH_MSG_VERBOSE("Not enough standalone muons to fit a vertex!");
148 return StatusCode::SUCCESS;
149 }
150
151 // extrapolate SA muons only if we have enough candidates to form a vertex
152 std::vector<std::shared_ptr<xAOD::TrackParticle>> extrapolatedMuSATracks;
153 std::map<const xAOD::TrackParticle*, const xAOD::Muon*> muonToExtrapolatedTrackMap;
154 for (const auto muon : candidateSAmuons) {
155 const xAOD::TrackParticle* MuSAMSTP = muon->trackParticle(xAOD::Muon::MuonSpectrometerTrackParticle);
156 auto extrapolatedMuSATrack = extrapolateMuSA(*MuSAMSTP, eventInfo, ctx);
157 if (extrapolatedMuSATrack->definingParameters()[Trk::d0] > 8000) {
158 ATH_MSG_DEBUG("Failed to extrapolate MuSA track, skipping!");
159 continue;
160 }
161 //Convert unique_ptr to shared pointer to allow ownership complications later.
162 extrapolatedMuSATracks.emplace_back(extrapolatedMuSATrack.release());
163 muonToExtrapolatedTrackMap[extrapolatedMuSATracks.back().get()] = muon;
164 ATH_MSG_VERBOSE("Extrapolated MuSA track! Total extrapolated so far: " << extrapolatedMuSATracks.size());
165 }
166
167 if (extrapolatedMuSATracks.size() < 2) {
168 ATH_MSG_VERBOSE("Not enough extrapolated tracks to fit a vertex!");
169 return StatusCode::SUCCESS;
170 }
171
172 std::unique_ptr<Trk::IVKalState> state = m_vertexFitter->makeState(ctx);
173 std::vector<const xAOD::TrackParticle*> tracksToFit(2);
174 std::vector<const xAOD::NeutralParticle*> dummyNeutrals;
175 // Loop over all unique pairs.
176 for (unsigned int i = 0; i < extrapolatedMuSATracks.size(); i++) {
177 for (unsigned int j = i+1; j < extrapolatedMuSATracks.size(); j++) {
178 MuSAVtxFitterTool::WrkVrt MuSACandidate;
179 tracksToFit[0] = extrapolatedMuSATracks[i].get();
180 tracksToFit[1] = extrapolatedMuSATracks[j].get();
181 StatusCode res = m_vertexFitter->VKalVrtFit(tracksToFit, dummyNeutrals,
182 MuSACandidate.pos, MuSACandidate.mom,
183 MuSACandidate.charge, MuSACandidate.cov,
184 MuSACandidate.chi2PerTrk, MuSACandidate.trkAtVrt,
185 MuSACandidate.chi2, *state);
186 if (res.isSuccess()) {
187 ATH_MSG_DEBUG("MuSA vertex fit successful!");
188 MuSACandidate.newExtrapolatedTracks.push_back(extrapolatedMuSATracks[i]);
189 MuSACandidate.newExtrapolatedTracks.push_back(extrapolatedMuSATracks[j]);
190 MuSACandidate.muonCandidates = {
191 muonToExtrapolatedTrackMap[tracksToFit[0]],
192 muonToExtrapolatedTrackMap[tracksToFit[1]]
193 };
194 MuSACandidate.minOpAng = muonToExtrapolatedTrackMap[tracksToFit[0]]->p4().DeltaR(
195 muonToExtrapolatedTrackMap[tracksToFit[1]]->p4());
196 workVerticesContainer.emplace_back(std::move(MuSACandidate));
197 } else {
198 ATH_MSG_DEBUG("MuSA vertex fit failed!");
199 }
200 }
201 }
202 // NOTE: Any remaining extrapolated tracks in the vector will be cleaned up automatically when they go out of scope
203 // this means the logic may need to be revisited if we want to "recover" extrapolated tracks that were not used in any fit through another mechanism
204 return StatusCode::SUCCESS;
205}
#define M_PI
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_WARNING(x,...)
#define ATH_MSG_VERBOSE(x,...)
std::pair< std::vector< unsigned int >, bool > res
xAOD::MuonContainer * muonContainer
ToolHandle< Trk::ITrkVKalVrtFitter > m_vertexFitter
DoubleProperty m_stacoMatchDeltaCut
std::unique_ptr< xAOD::TrackParticle > extrapolateMuSA(const xAOD::TrackParticle &trk, const xAOD::EventInfo &eventInfo, const EventContext &ctx) const
Gaudi::Property< bool > m_doValidation
Gaudi::Property< bool > m_doStacoRecovery
virtual double phi() const override final
The azimuthal angle ( ) of the particle (has range to .).
virtual double pt() const override final
The transverse momentum ( ) of the particle.
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
::StatusCode StatusCode
StatusCode definition for legacy code.
@ spectrometerFieldIntegral
Discriminators and further variables.
bool dPhi(const xAOD::TauJet &tau, const xAOD::CaloVertexedTopoCluster &cluster, float &out)
bool dEta(const xAOD::TauJet &tau, const xAOD::CaloVertexedTopoCluster &cluster, float &out)
float j(const xAOD::IParticle &, const xAOD::TrackMeasurementValidation &hit, const Eigen::Matrix3d &jab_inv)
@ d0
Definition ParamDefs.h:63
TrackParticle_v1 TrackParticle
Reference the current persistent version:

◆ doPostFitSelections()

StatusCode Rec::MuSAVtxFitterTool::doPostFitSelections ( std::vector< MuSAVtxFitterTool::WrkVrt > & workVerticesContainer) const

Definition at line 207 of file MuSAVtxFitterTool.cxx.

207 {
208 ATH_MSG_DEBUG("MuSAVtxFitterTool::doPostFitSelections");
209 //minimal method for post-fit selections
210 for (auto& workVertex : workVerticesContainer) {
211 if (workVertex.chi2 > m_baseChi2Cut) {
212 ATH_MSG_DEBUG("SA vertex chi2 too high, removing from consideration");
213 workVertex.isGood = false; // isGood flag has no specific utility here yet, but may be used in the future for more sophisticated recovery/reassembly
214 }
215 }
216
217 //remove any vertices marked as bad
218 workVerticesContainer.erase(std::remove_if(workVerticesContainer.begin(), workVerticesContainer.end(),
219 [](const MuSAVtxFitterTool::WrkVrt& vtx) { return !vtx.isGood; }), workVerticesContainer.end());
220
221 return StatusCode::SUCCESS;
222}
DataModel_detail::iterator< DVL > remove_if(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end, Predicate pred)
Specialization of remove_if for DataVector/List.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ extrapolateMuSA()

std::unique_ptr< xAOD::TrackParticle > Rec::MuSAVtxFitterTool::extrapolateMuSA ( const xAOD::TrackParticle & trk,
const xAOD::EventInfo & eventInfo,
const EventContext & ctx ) const

Definition at line 43 of file MuSAVtxFitterTool.cxx.

43 {
44
45 Amg::Vector3D refPos(eventInfo.beamPosX(), eventInfo.beamPosY(), eventInfo.beamPosZ());
46 Trk::PerigeeSurface persurf(refPos);
47 Trk::PropDirection propagationDirection = Trk::oppositeMomentum;
48
49 auto newTrack = std::make_unique<xAOD::TrackParticle>();
50 newTrack->makePrivateStore();
51
52 auto perigee = trk.perigeeParameters();
53 auto entryPars = m_extrapolator->extrapolate(ctx, perigee, persurf, propagationDirection, false, Trk::muon);
54
55 if (!entryPars) {
56 ATH_MSG_WARNING("Failed to back extrapolate MSTP, returning dummy!");
57 // Return a dummy track that will fail downstream cuts (extrapolations can sometimes fail due to various non-pathological reasons -- SA muons are not always high quality objects)
58 newTrack->setDefiningParameters(1.e19, 1.e19, 1.e19, 1.e19, 0);
59 return newTrack;
60 }
61
62 newTrack->setDefiningParameters(entryPars->parameters()[Trk::d0], entryPars->parameters()[Trk::z0], entryPars->parameters()[Trk::phi], entryPars->parameters()[Trk::theta], entryPars->parameters()[Trk::qOverP]);
63 newTrack->setDefiningParametersCovMatrix(*entryPars->covariance());
64 newTrack->setParametersOrigin(eventInfo.beamPosX(), eventInfo.beamPosY(), eventInfo.beamPosZ());
65
66 return newTrack;
67}
ToolHandle< Trk::IExtrapolator > m_extrapolator
float beamPosX() const
X coordinate of the beam spot position.
float beamPosZ() const
Z coordinate of the beam spot position.
float beamPosY() const
Y coordinate of the beam spot position.
const Trk::Perigee & perigeeParameters() const
Returns the Trk::MeasuredPerigee track parameters.
Eigen::Matrix< double, 3, 1 > Vector3D
PropDirection
PropDirection, enum for direction of the propagation.
@ oppositeMomentum
@ theta
Definition ParamDefs.h:66
@ qOverP
perigee
Definition ParamDefs.h:67
@ phi
Definition ParamDefs.h:75
@ z0
Definition ParamDefs.h:64

◆ initialize()

StatusCode Rec::MuSAVtxFitterTool::initialize ( )
overridevirtual

Definition at line 27 of file MuSAVtxFitterTool.cxx.

28{
29
30 ATH_CHECK(m_vertexFitter.retrieve());
31 ATH_MSG_DEBUG("Retrieved tool " << m_vertexFitter);
32
33 ATH_CHECK(m_extrapolator.retrieve());
34 ATH_MSG_DEBUG("Retrieved tool " << m_extrapolator);
35
36
37 ATH_MSG_DEBUG("Initialization successful");
38
39 return StatusCode::SUCCESS;
40
41}
#define ATH_CHECK
Evaluate an expression and check for errors.

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ interfaceID()

const InterfaceID & Rec::MuSAVtxFitterTool::interfaceID ( )
inlinestatic

Definition at line 30 of file MuSAVtxFitterTool.h.

30{ return IID_MuSAVtxFitterTool;}
static const InterfaceID IID_MuSAVtxFitterTool("MuSAVtxFitterTool", 1, 0)

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 368 of file AthCommonDataStore.h.

369 {
370 h.renounce();
372 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 352 of file AthCommonDataStore.h.

352 {
354 }

◆ selectBestVertices()

StatusCode Rec::MuSAVtxFitterTool::selectBestVertices ( std::vector< MuSAVtxFitterTool::WrkVrt > & workVerticesContainer) const

Definition at line 224 of file MuSAVtxFitterTool.cxx.

225{
226 ATH_MSG_DEBUG("MuSAVtxFitterTool::selectBestVertices");
227 //the default logic will create vertices with all possible combinations of SA muons
228 //in rare cases this will cause two MuSA vertices in one event that re-use a muon (more likely in signal models with two or more LLP BSM decays)
229 //if this occurs we can select based on the highest chi2 and remove the poorer-quality vertex from consideration
230
231 //first check if a muon is re-used in multiple vertices
232
233 if (workVerticesContainer.size() < 2) {
234 ATH_MSG_VERBOSE("Only one MuSA vertex, no need to select best!");
235 return StatusCode::SUCCESS;
236 }
237
238 //sort all the vertices by chi2 starting with the lowest
239 std::sort(workVerticesContainer.begin(), workVerticesContainer.end(), [](const MuSAVtxFitterTool::WrkVrt& v1, const MuSAVtxFitterTool::WrkVrt& v2) { return v1.chi2 < v2.chi2; });
240 ATH_MSG_VERBOSE("Sorted vertices by chi2! Lowest chi2: " << workVerticesContainer.front().chi2 << " Highest chi2: " << workVerticesContainer.back().chi2);
241
242 //starting with the lowest chi2 vertex, check its muons and remove any other vertices that use the same muons
243 for (unsigned int i = 0; i < workVerticesContainer.size(); i++) {
244 auto& vertex = workVerticesContainer.at(i);
245 if (!vertex.isGood) {
246 continue; // skip vertices we've already marked as bad
247 }
248 for (unsigned int j = i+1; j < workVerticesContainer.size(); j++) {
249 auto& otherVertex = workVerticesContainer.at(j);
250 for (const auto& muon : vertex.muonCandidates) {
251 if (std::find(otherVertex.muonCandidates.begin(), otherVertex.muonCandidates.end(), muon) != otherVertex.muonCandidates.end()) {
252 //remove the other vertex
253 ATH_MSG_VERBOSE("Found a vertex re-using a muon with chi2: " << otherVertex.chi2 << " removing from consideration!");
254 otherVertex.isGood = false;
255 }
256 }
257 }
258 }
259
260 //remove any vertices marked as bad
261 workVerticesContainer.erase(std::remove_if(workVerticesContainer.begin(), workVerticesContainer.end(),
262 [](const MuSAVtxFitterTool::WrkVrt& vtx) { return !vtx.isGood; }), workVerticesContainer.end());
263
264 return StatusCode::SUCCESS;
265
266
267}
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, and AthCheckedComponent<::AthAlgTool >.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 298 of file AthCommonDataStore.h.

298 {
299 for (auto &a : m_vhka) {
301 for (auto k : keys) {
302 k->setOwner(this);
303 }
304 }
305 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_baseChi2Cut

DoubleProperty Rec::MuSAVtxFitterTool::m_baseChi2Cut {this, "baseChi2Cut", 50., "Maximum allowed chi2 of saved vertices"}
private

Definition at line 92 of file MuSAVtxFitterTool.h.

92{this, "baseChi2Cut", 50., "Maximum allowed chi2 of saved vertices"};

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default).

Definition at line 381 of file AthCommonDataStore.h.

◆ m_doStacoRecovery

Gaudi::Property<bool> Rec::MuSAVtxFitterTool::m_doStacoRecovery {this, "doStacoRecovery", false, "Recover MS tracks from Staco-authored Combined muons with large MS-ID mismatch"}
private

Definition at line 94 of file MuSAVtxFitterTool.h.

94{this, "doStacoRecovery", false, "Recover MS tracks from Staco-authored Combined muons with large MS-ID mismatch"};

◆ m_doValidation

Gaudi::Property<bool> Rec::MuSAVtxFitterTool::m_doValidation {this, "doValidation", false, "Vertex every MSTP in input as part of validation process"}
private

Definition at line 93 of file MuSAVtxFitterTool.h.

93{this, "doValidation", false, "Vertex every MSTP in input as part of validation process"};

◆ m_etaCutMSTP

DoubleProperty Rec::MuSAVtxFitterTool::m_etaCutMSTP {this, "etaCutMSTP", 2.5, "Maximum |eta| of input MSTPs"}
private

Definition at line 91 of file MuSAVtxFitterTool.h.

91{this, "etaCutMSTP", 2.5, "Maximum |eta| of input MSTPs"};

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default).

Definition at line 378 of file AthCommonDataStore.h.

◆ m_extrapolator

ToolHandle<Trk::IExtrapolator> Rec::MuSAVtxFitterTool::m_extrapolator
private
Initial value:
{
this,"Extrapolator","Trk::Extrapolator/AtlasExtrapolator","ATLAS Extrapolator tool"}

Definition at line 88 of file MuSAVtxFitterTool.h.

88 {
89 this,"Extrapolator","Trk::Extrapolator/AtlasExtrapolator","ATLAS Extrapolator tool"};

◆ m_stacoMatchDeltaCut

DoubleProperty Rec::MuSAVtxFitterTool::m_stacoMatchDeltaCut {this, "stacoMatchDeltaCut", 0.2, "dEta or dPhi threshold between MS and ID tracks for Staco recovery"}
private

Definition at line 95 of file MuSAVtxFitterTool.h.

95{this, "stacoMatchDeltaCut", 0.2, "dEta or dPhi threshold between MS and ID tracks for Staco recovery"};

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 387 of file AthCommonDataStore.h.

◆ m_vertexFitter

ToolHandle<Trk::ITrkVKalVrtFitter> Rec::MuSAVtxFitterTool::m_vertexFitter
private
Initial value:
{
this, "VertexFitterTool", "Trk::TrkVKalVrtFitter", "Vertex fitter tool"}

Definition at line 86 of file MuSAVtxFitterTool.h.

86 {
87 this, "VertexFitterTool", "Trk::TrkVKalVrtFitter", "Vertex fitter tool"};

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 386 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: