ATLAS Offline Software
Loading...
Searching...
No Matches
JetTrackMomentsTool.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
5// JetTrackMomentsTool.h
6
7#ifndef JETMOMENTTOOLS_JETTRACKMOMENTSTOOL_H
8#define JETMOMENTTOOLS_JETTRACKMOMENTSTOOL_H
9
23
24#include "AsgTools/ToolHandle.h"
25#include "AsgTools/AsgTool.h"
32
34#include "xAODTracking/Vertex.h"
36
37#include <vector>
38#include <string>
39
40
42 virtual public IJetDecorator {
44
45public:
46
47 // Constructor from tool name
48 JetTrackMomentsTool(const std::string& name);
49
50 // Initialization.
51 StatusCode initialize() override;
52
53 // Calls getTrackMoments and puts the results in the jet
54 virtual StatusCode decorate(const xAOD::JetContainer& jets) const override;
55
56private:
57
58 // Configurable parameters
59 Gaudi::Property<std::string> m_jetContainerName{this, "JetContainer", "", "SG key for input jet container"};
60 Gaudi::Property<std::string> m_assocTracksName{this, "AssociatedTracks", "", "Name of associated tracks collection"};
61 Gaudi::Property<std::string> m_suffix{this, "MomentSuffix", "", "Suffix for track moment decorations"};
62 Gaudi::Property<std::vector<float> > m_minTrackPt{this, "TrackMinPtCuts", {}, "Vector of track pt cuts"};
63 Gaudi::Property<bool> m_doPFlowMoments{this, "DoPFlowMoments", false, "Calculate PFlow Object track moments?"};
64
65 ToolHandle<InDet::IInDetTrackSelectionTool> m_htsel{this, "TrackSelector", "", "track selection tool"};
66
67 SG::ReadHandleKey<xAOD::VertexContainer> m_vertexContainer_key{this, "VertexContainer", "", "SG key for vertex container"};
68 SG::ReadHandleKey<jet::TrackVertexAssociation> m_tva_key{this, "TrackVertexAssociation", "", "SG key for track-vertex association"};
69
70 SG::WriteDecorHandleKeyArray<xAOD::JetContainer> m_keysNumTrk{this, "NumTrkDecorKeys", {}, "SG keys for NumTrk decoration (not to be configured manually!)"};
71 SG::WriteDecorHandleKeyArray<xAOD::JetContainer> m_keysSumPtTrk{this, "SumPtTrkDecorKeys", {}, "SG keys for SumPtTrk decoration (not to be configured manually!)"};
72 SG::WriteDecorHandleKeyArray<xAOD::JetContainer> m_keysTrkWidth{this, "TrackWidthDecorKeys", {}, "SG keys for TrackWidth decoration (not to be configured manually!)"};
73 SG::WriteDecorHandleKeyArray<xAOD::JetContainer> m_keysNumCPFO{this, "NumChargedPFODecorKeys", {}, "SG keys for NumChargedPFO decoration (not to be configured manually!)"};
74 SG::WriteDecorHandleKeyArray<xAOD::JetContainer> m_keysSumPtCPFO{this, "SumPtChargedPFODecorKeys", {}, "SG keys for SumPtChargedPFO decoration (not to be configured manually!)"};
75 SG::WriteDecorHandleKeyArray<xAOD::JetContainer> m_keysCPFOWidth{this, "ChargedPFOWidthDecorKeys", {}, "SG keys for ChargedPFO Width decoration (not to be configured manually!)"};
76
77 // Private struct to make it unambiguous what each value is (rather than a vector)
78 // Doubles for calculation for now - will be written as float in the aux store
79 struct TrackMomentStruct { int numTrk; double sumPtTrk; double trackWidth; };
80
81 // Local method to calculate NumTrk, SumPtTrk, and TrackWidth for all vertices
82 const std::vector<TrackMomentStruct>
83 getTrackMoments(const xAOD::Jet& jet, const xAOD::VertexContainer* vertices,
84 const float minTrackPt, const std::vector<const xAOD::TrackParticle*>& tracks,
85 const jet::TrackVertexAssociation* tva) const;
86
87 // Local method to calculate NumTrk, SumPtTrk, and TrackWidth for one vertex
89 getTrackMoments(const xAOD::Jet&, const xAOD::Vertex* vertex, const float minTrackPt,
90 const std::vector<const xAOD::TrackParticle*>& tracks,
91 const jet::TrackVertexAssociation* tva) const;
92
93 // Parse the float to get a moment base name
94 const std::string getMomentBaseName(const float minTrackPt) const;
95
96};
97
98#endif
99
#define ASG_TOOL_CLASS(CLASSNAME, INT1)
Property holding a SG store/key/clid from which a ReadHandle is made.
Interface for adding a decoration to a jet container.
SG::ReadHandleKey< xAOD::VertexContainer > m_vertexContainer_key
SG::WriteDecorHandleKeyArray< xAOD::JetContainer > m_keysSumPtCPFO
virtual StatusCode decorate(const xAOD::JetContainer &jets) const override
Decorate a jet collection without otherwise modifying it.
SG::WriteDecorHandleKeyArray< xAOD::JetContainer > m_keysTrkWidth
Gaudi::Property< std::string > m_jetContainerName
const std::vector< TrackMomentStruct > getTrackMoments(const xAOD::Jet &jet, const xAOD::VertexContainer *vertices, const float minTrackPt, const std::vector< const xAOD::TrackParticle * > &tracks, const jet::TrackVertexAssociation *tva) const
StatusCode initialize() override
Dummy implementation of the initialisation function.
Gaudi::Property< std::string > m_assocTracksName
JetTrackMomentsTool(const std::string &name)
SG::WriteDecorHandleKeyArray< xAOD::JetContainer > m_keysNumTrk
SG::ReadHandleKey< jet::TrackVertexAssociation > m_tva_key
ToolHandle< InDet::IInDetTrackSelectionTool > m_htsel
SG::WriteDecorHandleKeyArray< xAOD::JetContainer > m_keysNumCPFO
SG::WriteDecorHandleKeyArray< xAOD::JetContainer > m_keysCPFOWidth
Gaudi::Property< bool > m_doPFlowMoments
SG::WriteDecorHandleKeyArray< xAOD::JetContainer > m_keysSumPtTrk
Gaudi::Property< std::vector< float > > m_minTrackPt
Gaudi::Property< std::string > m_suffix
const std::string getMomentBaseName(const float minTrackPt) const
Property holding a SG store/key/clid from which a ReadHandle is made.
Base class for the dual-use tool implementation classes.
Definition AsgTool.h:47
Class to hold N-to-one aassociations between tracks and vertices.
DecorHandleKeyArray< WriteDecorHandle< T, S >, WriteDecorHandleKey< T >, Gaudi::DataHandle::Writer > WriteDecorHandleKeyArray
Jet_v1 Jet
Definition of the current "jet version".
VertexContainer_v1 VertexContainer
Definition of the current "Vertex container version".
Vertex_v1 Vertex
Define the latest version of the vertex class.
JetContainer_v1 JetContainer
Definition of the current "jet container version".