ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
DerivationFramework::TrackParametersAtPV Class Reference

#include <TrackParametersAtPV.h>

Inheritance diagram for DerivationFramework::TrackParametersAtPV:
Collaboration diagram for DerivationFramework::TrackParametersAtPV:

Public Member Functions

 TrackParametersAtPV (const std::string &t, const std::string &n, const IInterface *p)
 Constructor with parameters. More...
 
 ~TrackParametersAtPV ()
 Destructor. More...
 
StatusCode initialize ()
 
StatusCode finalize ()
 
virtual StatusCode addBranches () const
 Check that the current event passes this filter. More...
 

Private Attributes

SG::ReadHandleKey< xAOD::TrackParticleContainerm_collTrackKey { this, "TrackParticleContainerName", "InDetTrackParticles", ""}
 
SG::ReadHandleKey< xAOD::VertexContainerm_collVertexKey { this, "VertexContainerName", "PrimaryVertices", ""}
 
SG::WriteHandleKey< std::vector< float > > m_trackZ0PVKey { this, "Z0SGEntryName", "", "" }
 

Detailed Description

the code used in this implementation is kindly stolen from: atlasoff:: ISF/ISF_Core/ISF_Tools

Author
James Catmore -at- cern.ch

Definition at line 35 of file TrackParametersAtPV.h.

Constructor & Destructor Documentation

◆ TrackParametersAtPV()

DerivationFramework::TrackParametersAtPV::TrackParametersAtPV ( const std::string &  t,
const std::string &  n,
const IInterface *  p 
)

Constructor with parameters.

Definition at line 16 of file TrackParametersAtPV.cxx.

18  :
19  base_class(t,n,p)
20  {
21  }

◆ ~TrackParametersAtPV()

DerivationFramework::TrackParametersAtPV::~TrackParametersAtPV ( )
default

Destructor.

Member Function Documentation

◆ addBranches()

StatusCode DerivationFramework::TrackParametersAtPV::addBranches ( ) const
virtual

Check that the current event passes this filter.

Definition at line 53 of file TrackParametersAtPV.cxx.

54 {
55  const EventContext& ctx = Gaudi::Hive::currentContext();
57  ATH_CHECK(track_z0_PV.record(std::make_unique< std::vector<float> >()));
58 
59  // Get Primary vertex
61  if(!vertices.isValid()) {
62  ATH_MSG_ERROR ("Couldn't retrieve VertexContainer with key: " << m_collVertexKey.key());
63  return StatusCode::FAILURE;
64  }
65 
66  const xAOD::Vertex* pv(nullptr);
67  for (const xAOD::Vertex* vx : *vertices) {
68  if (vx->vertexType() == xAOD::VxType::PriVtx) {
69  pv = vx;
70  break;
71  }
72  }
73 
74  // Get the track container
76  if(!tracks.isValid()) {
77  ATH_MSG_ERROR ("Couldn't retrieve TrackParticleContainer with key: " << m_collTrackKey.key());
78  return StatusCode::FAILURE;
79  }
80 
81  // Get track z0 w.r.t PV
82  for (const auto *trackIt : *tracks) {
83  if (pv) {
84  float z0wrtPV = trackIt->z0() + trackIt->vz() - pv->z();
85  track_z0_PV->push_back(z0wrtPV);
86 
87  } else {
88  track_z0_PV->push_back(999.);
89  }
90  }
91 
92  return StatusCode::SUCCESS;
93 }

◆ finalize()

StatusCode DerivationFramework::TrackParametersAtPV::finalize ( )

Definition at line 46 of file TrackParametersAtPV.cxx.

47 {
48  ATH_MSG_VERBOSE("finalize() ...");
49  return StatusCode::SUCCESS;
50 }

◆ initialize()

StatusCode DerivationFramework::TrackParametersAtPV::initialize ( )

Definition at line 27 of file TrackParametersAtPV.cxx.

28 {
29  if (m_collTrackKey.key().empty() || m_collVertexKey.key().empty()) {
30  ATH_MSG_ERROR("No selection variables for the TrackParametersAtPV tool!");
31  return StatusCode::FAILURE;
32  }
34  ATH_CHECK( m_collVertexKey.initialize() );
35 
36  if (m_trackZ0PVKey.key().empty()) {
37  ATH_MSG_ERROR("No Store Gate Keys for the TrackParametersAtPV tool!");
38  return StatusCode::FAILURE;
39  }
41 
42  ATH_MSG_VERBOSE("initialize() ...");
43  return StatusCode::SUCCESS;
44 }

Member Data Documentation

◆ m_collTrackKey

SG::ReadHandleKey<xAOD::TrackParticleContainer> DerivationFramework::TrackParametersAtPV::m_collTrackKey { this, "TrackParticleContainerName", "InDetTrackParticles", ""}
private

Definition at line 52 of file TrackParametersAtPV.h.

◆ m_collVertexKey

SG::ReadHandleKey<xAOD::VertexContainer> DerivationFramework::TrackParametersAtPV::m_collVertexKey { this, "VertexContainerName", "PrimaryVertices", ""}
private

Definition at line 54 of file TrackParametersAtPV.h.

◆ m_trackZ0PVKey

SG::WriteHandleKey< std::vector<float> > DerivationFramework::TrackParametersAtPV::m_trackZ0PVKey { this, "Z0SGEntryName", "", "" }
private

Definition at line 57 of file TrackParametersAtPV.h.


The documentation for this class was generated from the following files:
make_unique
std::unique_ptr< T > make_unique(Args &&... args)
Definition: SkimmingToolEXOT5.cxx:23
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:67
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
beamspotman.n
n
Definition: beamspotman.py:731
xAOD::VxType::PriVtx
@ PriVtx
Primary vertex.
Definition: TrackingPrimitives.h:572
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
Utils::z0wrtPV
double z0wrtPV(const xAOD::TrackParticle *trk, const xAOD::Vertex *vtx)
Provide the trk DCA w.r.t. the PV.
Definition: Trigger/TrigMonitoring/TrigMinBiasMonitoring/src/Utils.cxx:8
DerivationFramework::TrackParametersAtPV::m_collVertexKey
SG::ReadHandleKey< xAOD::VertexContainer > m_collVertexKey
Definition: TrackParametersAtPV.h:55
DerivationFramework::TrackParametersAtPV::m_trackZ0PVKey
SG::WriteHandleKey< std::vector< float > > m_trackZ0PVKey
Definition: TrackParametersAtPV.h:58
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:73
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
DerivationFramework::TrackParametersAtPV::m_collTrackKey
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_collTrackKey
Definition: TrackParametersAtPV.h:53
python.changerun.pv
pv
Definition: changerun.py:81