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 38 of file DStarSelectionTool.cxx.

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

28 {
29 ATH_MSG_DEBUG("in initialize()");
30 ATH_CHECK(m_trackKey.initialize());
32 ATH_CHECK(m_trackDecoKey.initialize());
33 ATH_CHECK(m_vertexDecoKey.initialize());
34 return StatusCode::SUCCESS;
35
36}
#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: