ATLAS Offline Software
JetTrackMomentsTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 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 
45 public:
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 
56 private:
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<IJetTrackSelector> m_htsel{this, "TrackSelector", "", "Track selector 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 
WriteDecorHandleKeyArray.h
asg::AsgTool
Base class for the dual-use tool implementation classes.
Definition: AsgTool.h:47
PropertyWrapper.h
JetTrackMomentsTool::m_vertexContainer_key
SG::ReadHandleKey< xAOD::VertexContainer > m_vertexContainer_key
Definition: JetTrackMomentsTool.h:67
JetTrackMomentsTool::m_assocTracksName
Gaudi::Property< std::string > m_assocTracksName
Definition: JetTrackMomentsTool.h:60
IJetDecorator
Interface for adding a decoration to a jet container.
Definition: IJetDecorator.h:21
JetTrackMomentsTool::TrackMomentStruct::numTrk
int numTrk
Definition: JetTrackMomentsTool.h:79
SG::HandleKeyArray
Definition: StoreGate/StoreGate/HandleKeyArray.h:38
SG::ReadHandleKey
Property holding a SG store/key/clid from which a ReadHandle is made.
Definition: StoreGate/StoreGate/ReadHandleKey.h:39
JetTrackMomentsTool::getMomentBaseName
const std::string getMomentBaseName(const float minTrackPt) const
Definition: JetTrackMomentsTool.cxx:251
JetTrackMomentsTool::m_suffix
Gaudi::Property< std::string > m_suffix
Definition: JetTrackMomentsTool.h:61
IJetDecorator.h
JetTrackMomentsTool::m_minTrackPt
Gaudi::Property< std::vector< float > > m_minTrackPt
Definition: JetTrackMomentsTool.h:62
JetTrackMomentsTool::m_keysTrkWidth
SG::WriteDecorHandleKeyArray< xAOD::JetContainer > m_keysTrkWidth
Definition: JetTrackMomentsTool.h:72
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
JetTrackMomentsTool::decorate
virtual StatusCode decorate(const xAOD::JetContainer &jets) const override
Decorate a jet collection without otherwise modifying it.
Definition: JetTrackMomentsTool.cxx:64
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
jet::TrackVertexAssociation
Class to hold N-to-one aassociations between tracks and vertices.
Definition: TrackVertexAssociation.h:23
ReadHandleKey.h
Property holding a SG store/key/clid from which a ReadHandle is made.
JetTrackMomentsTool::initialize
StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition: JetTrackMomentsTool.cxx:21
JetTrackMomentsTool::m_jetContainerName
Gaudi::Property< std::string > m_jetContainerName
Definition: JetTrackMomentsTool.h:59
JetTrackMomentsTool::JetTrackMomentsTool
JetTrackMomentsTool(const std::string &name)
Definition: JetTrackMomentsTool.cxx:13
TrackVertexAssociation.h
JetTrackMomentsTool::m_keysNumCPFO
SG::WriteDecorHandleKeyArray< xAOD::JetContainer > m_keysNumCPFO
Definition: JetTrackMomentsTool.h:73
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
Vertex.h
JetTrackMomentsTool::getTrackMoments
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
Definition: JetTrackMomentsTool.cxx:186
JetTrackMomentsTool::m_htsel
ToolHandle< IJetTrackSelector > m_htsel
Definition: JetTrackMomentsTool.h:65
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
IJetTrackSelector.h
JetTrackMomentsTool::m_keysSumPtTrk
SG::WriteDecorHandleKeyArray< xAOD::JetContainer > m_keysSumPtTrk
Definition: JetTrackMomentsTool.h:71
JetTrackMomentsTool::TrackMomentStruct::sumPtTrk
double sumPtTrk
Definition: JetTrackMomentsTool.h:79
JetTrackMomentsTool
Steven Schramm February 2014.
Definition: JetTrackMomentsTool.h:42
TrackParticle.h
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
Trk::vertex
@ vertex
Definition: MeasurementType.h:21
VertexContainer.h
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
JetTrackMomentsTool::m_doPFlowMoments
Gaudi::Property< bool > m_doPFlowMoments
Definition: JetTrackMomentsTool.h:63
JetTrackMomentsTool::TrackMomentStruct::trackWidth
double trackWidth
Definition: JetTrackMomentsTool.h:79
ASG_TOOL_CLASS
#define ASG_TOOL_CLASS(CLASSNAME, INT1)
Definition: AsgToolMacros.h:68
JetTrackMomentsTool::m_tva_key
SG::ReadHandleKey< jet::TrackVertexAssociation > m_tva_key
Definition: JetTrackMomentsTool.h:68
defineDB.jets
list jets
Definition: JetTagCalibration/share/defineDB.py:24
ToolHandle.h
AsgTool.h
JetTrackMomentsTool::m_keysNumTrk
SG::WriteDecorHandleKeyArray< xAOD::JetContainer > m_keysNumTrk
Definition: JetTrackMomentsTool.h:70
JetTrackMomentsTool::m_keysSumPtCPFO
SG::WriteDecorHandleKeyArray< xAOD::JetContainer > m_keysSumPtCPFO
Definition: JetTrackMomentsTool.h:74
JetTrackMomentsTool::m_keysCPFOWidth
SG::WriteDecorHandleKeyArray< xAOD::JetContainer > m_keysCPFOWidth
Definition: JetTrackMomentsTool.h:75
JetTrackMomentsTool::TrackMomentStruct
Definition: JetTrackMomentsTool.h:79