ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
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 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 More...
 

Detailed Description

Definition at line 33 of file DStarSelectionTool.h.

Member Function Documentation

◆ addBranches()

StatusCode DerivationFramework::DStarSelectionTool::addBranches ( ) const
overridevirtual

Definition at line 39 of file DStarSelectionTool.cxx.

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

◆ initialize()

StatusCode DerivationFramework::DStarSelectionTool::initialize ( )
override

Definition at line 29 of file DStarSelectionTool.cxx.

29  {
30  ATH_MSG_DEBUG("in initialize()");
32  ATH_CHECK(m_inputVtxContainerName.initialize());
34  ATH_CHECK(m_vertexDecoKey.initialize());
35  return StatusCode::SUCCESS;
36 
37 }

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.

◆ 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.

◆ 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.

◆ m_trackKey

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

Definition at line 45 of file DStarSelectionTool.h.

◆ 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.


The documentation for this class was generated from the following files:
DerivationFramework::DStarSelectionTool::m_deltaMassMax
Gaudi::Property< double > m_deltaMassMax
Definition: DStarSelectionTool.h:44
DerivationFramework::DStarSelectionTool::m_trackKey
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_trackKey
Definition: DStarSelectionTool.h:45
DerivationFramework::DStarSelectionTool::m_inputVtxContainerName
SG::ReadHandleKey< xAOD::VertexContainer > m_inputVtxContainerName
Definition: DStarSelectionTool.h:43
SG::get
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
Definition: ReadCondHandle.h:287
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
SG::WriteDecorHandle
Handle class for adding a decoration to an object.
Definition: StoreGate/StoreGate/WriteDecorHandle.h:100
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
SG::AuxElement::index
size_t index() const
Return the index of this element within its container.
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
DerivationFramework::DStarSelectionTool::m_kaonMass
const double m_kaonMass
Definition: DStarSelectionTool.h:50
DerivationFramework::DStarSelectionTool::m_trackDecoKey
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_trackDecoKey
Definition: DStarSelectionTool.h:46
Trk::vertex
@ vertex
Definition: MeasurementType.h:21
SG::WriteDecorHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
DerivationFramework::DStarSelectionTool::m_pionMass
const double m_pionMass
Definition: DStarSelectionTool.h:49
xAOD::track
@ track
Definition: TrackingPrimitives.h:513
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
DerivationFramework::DStarSelectionTool::m_vertexDecoKey
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_vertexDecoKey
Definition: DStarSelectionTool.h:47