33 {
34
35 std::unique_ptr<std::vector<float> > track_z0_PV(new std::vector<float>());
36
37
38 SG::WriteDecorHandle< xAOD::TrackParticleContainer, float > decorator(
m_exampleDecorKey, ctx);
39
40
41
43 if (!vertices.isValid()) {
44 ATH_MSG_ERROR (
"Couldn't retrieve VertexContainer with key PrimaryVertices");
45 return StatusCode::FAILURE;
46 }
47
52 break;
53 }
54 }
55
56
58 if (!tracks.isValid()) {
59 ATH_MSG_ERROR (
"Couldn't retrieve TrackParticleContainer with key InDetTrackParticles");
60 return StatusCode::FAILURE;
61 }
62
63
64 for (const auto *trackParticle : *tracks) {
65 if (pv) {
66 float z0wrtPV = trackParticle->z0() + trackParticle->vz() -
pv->z();
67 track_z0_PV->push_back(z0wrtPV);
68 decorator(*trackParticle) =
z0wrtPV;
69 } else {
70 track_z0_PV->push_back(999.);
71 decorator(*trackParticle) = 999.;
72 }
73 }
74
75
76 SG::WriteHandle<std::vector<float> > decision(
m_decisionKey, ctx);
77 if (!decision.isValid()) {
78 ATH_MSG_ERROR(
"Tool is attempting to write StoreGate keys which already exists. Please use a different key");
79 return StatusCode::FAILURE;
80 } else {
81 decision = std::move(track_z0_PV);
82 }
83
84 return StatusCode::SUCCESS;
85 }
double z0wrtPV(const xAOD::TrackParticle *trk, const xAOD::Vertex *vtx)
Provide the trk DCA w.r.t. the PV.
Vertex_v1 Vertex
Define the latest version of the vertex class.