ATLAS Offline Software
Loading...
Searching...
No Matches
DerivationFramework::DStarSelectionTool Class Reference

#include <DStarSelectionTool.h>

Inheritance diagram for DerivationFramework::DStarSelectionTool:
Collaboration diagram for DerivationFramework::DStarSelectionTool:

Public Member Functions

StatusCode initialize () override
virtual StatusCode addBranches (const EventContext &ctx) const override

Private Attributes

SG::ReadHandleKey< xAOD::VertexContainerm_inputVtxContainerName {this, "InputVtxContainerName", ""}
Gaudi::Property< double > m_deltaMassMax {this,"DeltaMassMax" ,200.,"invariant mass difference range"}
SG::ReadHandleKey< xAOD::TrackParticleContainerm_trackKey {this, "TrackContainer", "InDetTrackParticles"}
SG::WriteDecorHandleKey< xAOD::TrackParticleContainerm_trackDecoKey { this, "PassTrackDstarKey", m_trackKey, "trackPassDstar"}
SG::WriteDecorHandleKey< xAOD::VertexContainerm_vertexDecoKey { this, "PassVertexDstarKey", m_inputVtxContainerName, "passed_Dstar"}
const double m_pionMass = ParticleConstants::chargedPionMassInMeV
const double m_kaonMass = ParticleConstants::chargedKaonMassInMeV
std::string m_hypoName
 name of the mass hypothesis prefix for decorations

Detailed Description

Definition at line 33 of file DStarSelectionTool.h.

Member Function Documentation

◆ addBranches()

StatusCode DerivationFramework::DStarSelectionTool::addBranches ( const EventContext & ctx) const
overridevirtual

Definition at line 39 of file DStarSelectionTool.cxx.

39 {
40
41 // Track container
42 const xAOD::TrackParticleContainer* trackParticleContainer{nullptr};
43 ATH_CHECK(SG::get(trackParticleContainer, m_trackKey, ctx));
44
45 // Vertex container
46 const xAOD::VertexContainer* D0Container{nullptr};
47 ATH_CHECK(SG::get(D0Container, m_inputVtxContainerName, ctx));
48
49 // Mask for track / vertex skimming
50 std::vector<char> track_pass_map(trackParticleContainer->size());
51 std::vector<char> vertex_pass_map(D0Container->size());
52
53 // Loop over D0 candidate vertices
54 for(const xAOD::Vertex* vertex: *D0Container) {
55
56 // Check vertex passes loose D0 cuts defined in python
57
58 bool passed_D0_or_D0b = (flag_D0(*vertex) || flag_D0b(*vertex));
59
60 // Only consider vertices which have passed D0 mass window for
61 // matching to soft pion canddiates
62 if(!passed_D0_or_D0b) continue;
63
64 const xAOD::TrackParticle* track1 = vertex->trackParticle(0);
65 const xAOD::TrackParticle* track2 = vertex->trackParticle(1);
66
67 if(!track1) { ATH_MSG_WARNING("Could not find track at D0 vertex (index 0)"); continue; }
68 if(!track2) { ATH_MSG_WARNING("Could not find track at D0 vertex (index 1)"); continue; }
69
70 // Re-fitted D0 track 4-vectors
71
72 const std::vector<float>& reFit_Px = acc_reFit_Px(*vertex);
73 const std::vector<float>& reFit_Py = acc_reFit_Py(*vertex);
74 const std::vector<float>& reFit_Pz = acc_reFit_Pz(*vertex);
75
76 TLorentzVector track1_pion, track1_kaon;
77 track1_pion.SetXYZM(reFit_Px.at(0),reFit_Py.at(0),reFit_Pz.at(0),m_pionMass);
78 track1_kaon.SetXYZM(reFit_Px.at(0),reFit_Py.at(0),reFit_Pz.at(0),m_kaonMass);
79
80 TLorentzVector track2_pion, track2_kaon;
81 track2_pion.SetXYZM(reFit_Px.at(1),reFit_Py.at(1),reFit_Pz.at(1),m_pionMass);
82 track2_kaon.SetXYZM(reFit_Px.at(1),reFit_Py.at(1),reFit_Pz.at(1),m_kaonMass);
83
84 // Consider both D0 and D0bar hypotheses (irrespective of charges)
85 TLorentzVector D0_hypo1 = track1_pion + track2_kaon;
86 TLorentzVector D0_hypo2 = track1_kaon + track2_pion;
87
88 bool passed_Dstar = false;
89
90 // Loop over tracks
91 for(const xAOD::TrackParticle* track3: *trackParticleContainer) {
92
93 // Avoid duplicates
94 if( track1->index() == track3->index() ) continue;
95 if( track2->index() == track3->index() ) continue;
96
97 TLorentzVector track3_pion= track3->p4();
98
99 const double deltaM_hypo1 = (D0_hypo1 + track3_pion).M() - D0_hypo1.M();
100 const double deltaM_hypo2 = (D0_hypo2 + track3_pion).M() - D0_hypo2.M();
101
102 // Selection of loose D*+ ->pi+ + D0 candidates based on mass difference
103 // Keep both "right" and "wrong" charge combinations
104 if( deltaM_hypo1 < m_deltaMassMax || deltaM_hypo2 < m_deltaMassMax ) {
105
106 passed_Dstar = true;
107
108 // Mark all tracks as being part of a D*+ -> D0 + pi+ (+c.c.) candidate
109 track_pass_map[track1->index()] = true;
110 track_pass_map[track2->index()] = true;
111 track_pass_map[track3->index()] = true;
112
113 }
114
115 } // Loop over tracks
116
117 // Adjust mask if we'd like to retain this vertex
118 if(passed_Dstar) {
119 vertex_pass_map[vertex->index()] = true;
120 }
121
122 } // Loop over D0 candidate vertices
123
124 // Decorate tracks with skim decision flag
125
126 SG::WriteDecorHandle<xAOD::TrackParticleContainer, int> flagTrackPass(m_trackDecoKey,ctx);
127 // Loop over tracks
128 for(const xAOD::TrackParticle* track:*trackParticleContainer) {
129
130 flagTrackPass(*track) = track_pass_map[track->index()] ; // Mark track to keep/drop during skimming
131
132 } // Loop over tracks
133
134 // Decorate vertex for skimming decision (Char used for compatability for BPhys skim/slim tools)
135 SG::WriteDecorHandle<xAOD::VertexContainer, Char_t> flagVertexPass(m_vertexDecoKey,ctx);
136
137 // Loop over D0 candidate vertices
138 for(const xAOD::Vertex* vertex: *D0Container) {
139
140 // Mark vertex to keep during skimming, based on earlier decision
141 flagVertexPass(*vertex) = vertex_pass_map[vertex->index()];
142
143 } // Loop over D0 candidate vertices
144
145 return StatusCode::SUCCESS;
146}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
size_type size() const noexcept
Returns the number of elements in the collection.
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_vertexDecoKey
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_trackKey
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_trackDecoKey
SG::ReadHandleKey< xAOD::VertexContainer > m_inputVtxContainerName
size_t index() const
Return the index of this element within its container.
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
VertexContainer_v1 VertexContainer
Definition of the current "Vertex container version".
Vertex_v1 Vertex
Define the latest version of the vertex class.
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".

◆ initialize()

StatusCode DerivationFramework::DStarSelectionTool::initialize ( )
override

Definition at line 29 of file DStarSelectionTool.cxx.

29 {
30 ATH_MSG_DEBUG("in initialize()");
31 ATH_CHECK(m_trackKey.initialize());
33 ATH_CHECK(m_trackDecoKey.initialize());
34 ATH_CHECK(m_vertexDecoKey.initialize());
35 return StatusCode::SUCCESS;
36
37}
#define ATH_MSG_DEBUG(x)

Member Data Documentation

◆ m_deltaMassMax

Gaudi::Property<double> DerivationFramework::DStarSelectionTool::m_deltaMassMax {this,"DeltaMassMax" ,200.,"invariant mass difference range"}
private

Definition at line 44 of file DStarSelectionTool.h.

44{this,"DeltaMassMax" ,200.,"invariant mass difference range"};

◆ m_hypoName

std::string DerivationFramework::DStarSelectionTool::m_hypoName
private

name of the mass hypothesis prefix for decorations

Definition at line 51 of file DStarSelectionTool.h.

◆ m_inputVtxContainerName

SG::ReadHandleKey<xAOD::VertexContainer> DerivationFramework::DStarSelectionTool::m_inputVtxContainerName {this, "InputVtxContainerName", ""}
private

Definition at line 43 of file DStarSelectionTool.h.

43{this, "InputVtxContainerName", ""};

◆ m_kaonMass

const double DerivationFramework::DStarSelectionTool::m_kaonMass = ParticleConstants::chargedKaonMassInMeV
private

Definition at line 50 of file DStarSelectionTool.h.

◆ m_pionMass

const double DerivationFramework::DStarSelectionTool::m_pionMass = ParticleConstants::chargedPionMassInMeV
private

Definition at line 49 of file DStarSelectionTool.h.

◆ m_trackDecoKey

SG::WriteDecorHandleKey<xAOD::TrackParticleContainer> DerivationFramework::DStarSelectionTool::m_trackDecoKey { this, "PassTrackDstarKey", m_trackKey, "trackPassDstar"}
private

Definition at line 46 of file DStarSelectionTool.h.

46{ this, "PassTrackDstarKey", m_trackKey, "trackPassDstar"};

◆ m_trackKey

SG::ReadHandleKey<xAOD::TrackParticleContainer> DerivationFramework::DStarSelectionTool::m_trackKey {this, "TrackContainer", "InDetTrackParticles"}
private

Definition at line 45 of file DStarSelectionTool.h.

45{this, "TrackContainer", "InDetTrackParticles"};

◆ m_vertexDecoKey

SG::WriteDecorHandleKey<xAOD::VertexContainer> DerivationFramework::DStarSelectionTool::m_vertexDecoKey { this, "PassVertexDstarKey", m_inputVtxContainerName, "passed_Dstar"}
private

Definition at line 47 of file DStarSelectionTool.h.

47{ this, "PassVertexDstarKey", m_inputVtxContainerName, "passed_Dstar"};

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