![Logo](../../ATLAS-Logo-Square-Blue-RGB.png) |
ATLAS Offline Software
|
Go to the documentation of this file.
41 using FitWeight = std::pair<float, float>;
46 const std::vector<ElementLink<xAOD::VertexContainer>>& AMVFVertices = vtxDeco(*trk);
47 const std::vector<float>& AMVFWeights = wgtDeco(*trk);
51 for (std::size_t
i = 0;
i < AMVFVertices.size();
i++) {
52 if (!AMVFVertices.at(
i).isValid())
continue;
53 if (leading < 0) leading =
i;
54 if (vtx == *(AMVFVertices.at(
i))) return ::FitWeight(AMVFWeights.at(
i), AMVFWeights.at(leading));
58 return ::FitWeight(-1., (leading < 0) ? -1. : AMVFWeights.at(leading));
66 return std::abs(trk->
d0());
82 const AMVFVerticesAcc& vtxDeco,
const AMVFWeightsAcc& wgtDeco)
const
84 FitWeight
weight = fitWeight(trk, vtx, vtxDeco, wgtDeco);
85 return ((
weight.second > 0.) ? (
weight.first > 0.) : (absDzSinTheta(trk, vtx) < 3.0));
94 const AMVFVerticesAcc&,
const AMVFWeightsAcc&)
const
96 return (absD0(trk) < 2.0 && absDzSinTheta(trk, vtx) < 3.0);
101 :
public WorkingPoint
105 const AMVFVerticesAcc&,
const AMVFWeightsAcc&)
const
107 return (absD0(trk) < 0.5 && absDzSinTheta(trk, vtx) < 0.5);
112 :
public WorkingPoint
116 const AMVFVerticesAcc&,
const AMVFWeightsAcc&)
const
118 return (absD0Sig(trk,
evt) < 5.0 && absDzSinTheta(trk, vtx) < 0.5);
123 :
public WorkingPoint
127 const AMVFVerticesAcc&,
const AMVFWeightsAcc&)
const
129 return (absD0Sig(trk,
evt) < 3.0 && absDzSinTheta(trk, vtx) < 0.5);
134 :
public WorkingPoint
138 const AMVFVerticesAcc& vtxDeco,
const AMVFWeightsAcc& wgtDeco)
const
140 return (fitWeight(trk, vtx, vtxDeco, wgtDeco).
first > 0.03);
144 #define NONPROMPT_D0SIG(CLASSNAME, RADIAL_CUT) \
146 : public WorkingPoint \
149 virtual bool apply(const xAOD::TrackParticle* trk, const xAOD::Vertex* vtx, const xAOD::EventInfo* evt, \
150 const AMVFVerticesAcc& vtxDeco, const AMVFWeightsAcc& wgtDeco) const \
152 return (absD0(trk) < RADIAL_CUT && ((absD0Sig(trk, evt) < 3.0) ? (fitWeight(trk, vtx, vtxDeco, wgtDeco).first > 0.03) : (absDzSinTheta(trk, vtx) < RADIAL_CUT))); \
160 class Prompt_MaxWeight
161 : public WorkingPoint
165 const AMVFVerticesAcc& vtxDeco,
const AMVFWeightsAcc& wgtDeco)
const
167 FitWeight
weight = fitWeight(trk, vtx, vtxDeco, wgtDeco);
172 #define NONPROMPT_MAXWEIGHT(CLASSNAME, RADIAL_CUT) \
174 : public WorkingPoint \
177 virtual bool apply(const xAOD::TrackParticle* trk, const xAOD::Vertex* vtx, const xAOD::EventInfo*, \
178 const AMVFVerticesAcc& vtxDeco, const AMVFWeightsAcc& wgtDeco) const \
180 FitWeight weight = fitWeight(trk, vtx, vtxDeco, wgtDeco); \
181 return ((weight.second > 0.) ? (weight.first >= weight.second) : (absD0(trk) < RADIAL_CUT && absDzSinTheta(trk, vtx) < RADIAL_CUT)); \
191 : public WorkingPoint
194 Custom(
const float d0_cut,
const bool use_d0sig,
const float d0sig_cut,
const float dzSinTheta_cut,
const bool doUsedInFit) {
196 m_use_d0sig = use_d0sig;
197 m_d0sig_cut = d0sig_cut;
198 m_dzSinTheta_cut = dzSinTheta_cut;
199 m_doUsedInFit = doUsedInFit;
202 const AMVFVerticesAcc& vtxDeco,
const AMVFWeightsAcc& wgtDeco)
const
206 FitWeight
weight = fitWeight(trk, vtx, vtxDeco, wgtDeco);
210 else if (
weight.second > 0.) {
220 if (m_d0sig_cut >= 0 && absD0Sig(trk,
evt) > m_d0sig_cut)
return false;
224 if (m_d0_cut >= 0 && absD0(trk) > m_d0_cut)
return false;
226 return m_dzSinTheta_cut < 0 || absDzSinTheta(trk, vtx) <= m_dzSinTheta_cut;
232 float m_dzSinTheta_cut;
244 #define IF_WORKING_POINT(WORKING_POINT, DO_USED_IN_FIT, REQUIRE_PRI_VTX) \
245 if (m_wp == #WORKING_POINT) { \
246 m_applicator = std::unique_ptr<CP::TrackVertexAssociationTool::WorkingPoint>(new ::WORKING_POINT()); \
247 m_doUsedInFit = DO_USED_IN_FIT; \
248 m_requirePriVtx = REQUIRE_PRI_VTX; \
253 static const std::set<std::string> run_2_wps = {
"Loose",
"Nominal",
"Tight",
"Electron",
"Muon",
"Old_Loose",
"Old_Nominal",
"Old_Tight",
"Old_Electron",
"Old_Muon"};
255 if (run_2_wps.count(
wp)) {
256 std::string
prefix =
"Old_";
258 ATH_MSG_WARNING(
"WorkingPoint '" <<
m_wp <<
"' corresponds to a Run 2 working point and is not recommended.");
261 ATH_MSG_WARNING(
"WorkingPoint '" <<
m_wp <<
"' corresponds to a Run 2 working point and is not recommended - remapping to 'Old_" <<
m_wp <<
"' (same definition, however).");
262 wp.insert(0,
"Old_");
281 else if (
m_wp ==
"Custom") {
282 m_applicator = std::unique_ptr<CP::TrackVertexAssociationTool::WorkingPoint>(
286 ATH_MSG_ERROR(
"Invalid TVA working point '" <<
m_wp <<
"' - for a custom configuration, please provide 'Custom' for the 'WorkingPoint' property.");
287 return StatusCode::FAILURE;
290 if (
m_wp ==
"Custom") {
291 ATH_MSG_INFO(
"TVA working point 'Custom' provided - tool properties are initialized to default values unless explicitly set by the user.");
294 ATH_MSG_INFO(
"TVA working point '" <<
m_wp <<
"' provided - tool properties have been configured accordingly.");
322 return StatusCode::SUCCESS;
327 ATH_MSG_DEBUG(
"In TrackVertexAssociationTool::isCompatible function.");
332 const EventContext& ctx = Gaudi::Hive::currentContext();
334 if (!
evt.isValid()) {
335 throw std::runtime_error(
"ERROR in CP::TrackVertexAssociationTool::isCompatible : could not retrieve xAOD::EventInfo!");
340 throw std::runtime_error(
"ERROR in CP::TrackVertexAssociationTool::isCompatible : hardscatter vertex link is not valid!");
386 const EventContext& ctx = Gaudi::Hive::currentContext();
398 throw std::runtime_error(
"ERROR in CP::TrackVertexAssociationTool::isMatch : could not retrieve xAOD::EventInfo!");
411 template <
typename U,
typename V>
416 for (
const auto&
vertex : vx_list) {
419 trktovxlist.reserve(trk_list.size());
420 for (
const auto&
track : trk_list) {
422 trktovxlist.push_back(
track);
425 trktovxmap[
vertex] = trktovxlist;
431 template <
typename T>
435 float dzSinTheta{0.};
439 for (
const auto&
vertex : vx_list) {
448 dzSinTheta = ::absDzSinTheta(&trk,
vertex);
449 if (dzSinTheta < min_dz) {
459 if (!bestMatchVertex) {
460 ATH_MSG_DEBUG(
"Could not find any matched vertex for this track!");
463 return bestMatchVertex;
466 template <
typename T,
typename U>
472 for (
const auto&
vertex : vx_list) {
475 trktovxlist.reserve(trk_list.size());
476 trktovxmap[
vertex] = trktovxlist;
479 for (
const auto&
track : trk_list) {
481 if (vx_match) trktovxmap[vx_match].push_back(
track);
bool toContainedElement(BaseConstReference data, ElementType element, IProxyDict *sg=0)
Set from element pointer and a reference to the container (storable)
float vz() const
The z origin for the parameters.
double d0significance(const xAOD::TrackParticle *tp, double d0_uncert_beam_spot_2)
float z0() const
Returns the parameter.
std::map< const xAOD::Vertex *, xAOD::TrackVertexAssociationList > TrackVertexAssociationMap
const std::string & key() const
Return the StoreGate ID for the referenced object.
Select isolated Photons, Electrons and Muons.
VxType::VertexType vertexType() const
The type of the vertex.
@ NoVtx
Dummy vertex. TrackParticle was not used in vertex fit.
bool isValid() const
Test to see if the link can be dereferenced.
float d0() const
Returns the parameter.
Handle class for reading a decoration on an object.
::StatusCode StatusCode
StatusCode definition for legacy code.
const_pointer_type get() const
Dereference the pointer, but don't cache anything.
float z() const
Returns the z position.
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::vector< const xAOD::TrackParticle * > TrackVertexAssociationList
Class describing the basic event information.
Class describing a Vertex.
#define ATH_MSG_WARNING(x)
Class describing a TrackParticle.
float theta() const
Returns the parameter, which has range 0 to .