Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Public Member Functions | Private Attributes | List of all members
DerivationFramework::PFlowAugmentationTool Class Reference

#include <PFlowAugmentationTool.h>

Inheritance diagram for DerivationFramework::PFlowAugmentationTool:
Collaboration diagram for DerivationFramework::PFlowAugmentationTool:

Public Member Functions

 PFlowAugmentationTool (const std::string &t, const std::string &n, const IInterface *p)
 
StatusCode initialize ()
 
StatusCode finalize ()
 
virtual StatusCode addBranches () const
 

Private Attributes

ToolHandle< CP::IWeightPFOToolm_weightPFOTool
 
SG::ReadHandleKey< xAOD::VertexContainerm_vertexContainer_key {this, "VertexContainer", "PrimaryVertices", "Input vertex container"}
 Retrieval tool. More...
 
SG::ReadHandleKey< xAOD::FlowElementContainerm_pfoContainer_key {this, "GlobalChargedParticleFlowObjects", "GlobalChargedParticleFlowObjects", "Input charged PFO"}
 
SG::WriteDecorHandleKey< xAOD::FlowElementContainerm_corrP4_ptKey {this, "m_corrP4_ptKey", "GlobalChargedParticleFlowObjects.DFCommonPFlow_CaloCorrectedPt", "Decoration for weighted charged PFO pt"}
 
SG::WriteDecorHandleKey< xAOD::FlowElementContainerm_z0Key {this, "m_z0Key", "GlobalChargedParticleFlowObjects.DFCommonPFlow_z0", "Decoration for track z0"}
 
SG::WriteDecorHandleKey< xAOD::FlowElementContainerm_vzKey {this, "m_vzKey","GlobalChargedParticleFlowObjects.DFCommonPFlow_vz", "Decoration for track vz"}
 
SG::WriteDecorHandleKey< xAOD::FlowElementContainerm_d0Key {this, "m_d0Key","GlobalChargedParticleFlowObjects.DFCommonPFlow_d0", "Decoration for track d0"}
 
SG::WriteDecorHandleKey< xAOD::FlowElementContainerm_thetaKey {this, "m_thetaKey","GlobalChargedParticleFlowObjects.DFCommonPFlow_theta", "Decoration for track theta"}
 
SG::WriteDecorHandleKey< xAOD::FlowElementContainerm_envWeightKey {this, "m_envWeightKey","GlobalChargedParticleFlowObjects.DFCommonPFlow_envWeight", "Decoration for weight for dense environments"}
 

Detailed Description

Definition at line 29 of file PFlowAugmentationTool.h.

Constructor & Destructor Documentation

◆ PFlowAugmentationTool()

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

Definition at line 17 of file PFlowAugmentationTool.cxx.

19  :
20  base_class(t,n,p),
21  m_weightPFOTool("CP::WeightPFOTool/WeightPFOTool")
22  {
23  declareProperty("WeightPFOTool", m_weightPFOTool );
24  }

Member Function Documentation

◆ addBranches()

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

Definition at line 46 of file PFlowAugmentationTool.cxx.

47  {
48 
49  // Get the vertex.
50  const xAOD::Vertex* pv(0);
51 
52  auto vertexContainer = SG::makeHandle (m_vertexContainer_key);
53  if (!vertexContainer.isValid()){
54  ATH_MSG_WARNING("Invalid xAOD::VertexContainer datahandle"
55  << m_vertexContainer_key.key());
56  return StatusCode::FAILURE;
57  }
58  auto pvcont = vertexContainer.cptr();
59  if ( pvcont == 0 || pvcont->size()==0 ) {
60  ATH_MSG_WARNING(" Failed to retrieve PrimaryVertices collection" );
61  return StatusCode::FAILURE;
62  }
63  for (const auto vx : *pvcont) {
64  if (vx->vertexType() == xAOD::VxType::PriVtx) {
65  pv = vx;
66  break;
67  }//If we have a vertex of type primary vertex
68  }//iterate over the vertices and check their type
69 
70  // Use NoVtx as fall-back in case no PV is found, but the events should be rejected by the user
71  // If there is no such then mark all CPFOs as unmatched
72  if (pv == nullptr) {
73  ATH_MSG_DEBUG("Could not find a primary vertex in this event" );
74  for (auto theVertex : *pvcont) {
75  if (xAOD::VxType::NoVtx == theVertex->vertexType() ) {
76  pv = theVertex;
77  break;
78  }
79  }
80  if (nullptr == pv) {
81  ATH_MSG_WARNING("Found neither PriVtx nor NoVtx in this event" );
82  }
83  }
84 
91 
92  auto pfoContainer = SG::makeHandle (m_pfoContainer_key);
93  if (!pfoContainer.isValid()){
94  ATH_MSG_WARNING("Invalid xAOD::PFOContainer datahandle"
95  << m_pfoContainer_key.key());
96  return StatusCode::FAILURE;
97  }
98  auto cpfos = pfoContainer.cptr();
99 
100  for ( const xAOD::FlowElement* cpfo : *cpfos ) {
101  if ( cpfo == 0 ) {
102  ATH_MSG_WARNING("Have NULL pointer to charged PFO");
103  continue;
104  }
105  const xAOD::TrackParticle* ptrk = dynamic_cast<const xAOD::TrackParticle*>(cpfo->chargedObject(0));
106  if ( ptrk == 0 ) {
107  ATH_MSG_WARNING("Skipping charged PFO with null track pointer.");
108  continue;
109  }
110 
111  // decorate the track properties
112  dec_z0(*cpfo) = ptrk->z0();
113  dec_vz(*cpfo) = ptrk->vz();
114  dec_d0(*cpfo) = ptrk->d0();
115  dec_theta(*cpfo) = ptrk->theta();
116 
117  //find the weights from the tool
118  float weight = 1.0;
119  const static SG::AuxElement::ConstAccessor<int> accIsInDE("IsInDenseEnvironment");
120  if(accIsInDE.isAvailable(*cpfo)){
121  ATH_CHECK( m_weightPFOTool->fillWeight( *cpfo, weight ) );
122  }
123 
124  // decorate the computed variables
125  dec_corrP4_pt(*cpfo) = weight*cpfo->pt();
126  dec_envWeight(*cpfo) = weight;
127  }
128 
129  return StatusCode::SUCCESS;
130  }

◆ finalize()

StatusCode DerivationFramework::PFlowAugmentationTool::finalize ( )

Definition at line 41 of file PFlowAugmentationTool.cxx.

42  {
43  return StatusCode::SUCCESS;
44  }

◆ initialize()

StatusCode DerivationFramework::PFlowAugmentationTool::initialize ( )

Definition at line 26 of file PFlowAugmentationTool.cxx.

27  {
28 
29  ATH_CHECK(m_vertexContainer_key.initialize());
30  ATH_CHECK(m_pfoContainer_key.initialize());
31  ATH_CHECK(m_corrP4_ptKey.initialize());
32  ATH_CHECK(m_z0Key.initialize());
33  ATH_CHECK(m_vzKey.initialize());
34  ATH_CHECK(m_d0Key.initialize());
35  ATH_CHECK(m_thetaKey.initialize());
36  ATH_CHECK(m_envWeightKey.initialize());
37 
38  return StatusCode::SUCCESS;
39  }

Member Data Documentation

◆ m_corrP4_ptKey

SG::WriteDecorHandleKey<xAOD::FlowElementContainer> DerivationFramework::PFlowAugmentationTool::m_corrP4_ptKey {this, "m_corrP4_ptKey", "GlobalChargedParticleFlowObjects.DFCommonPFlow_CaloCorrectedPt", "Decoration for weighted charged PFO pt"}
private

Definition at line 44 of file PFlowAugmentationTool.h.

◆ m_d0Key

SG::WriteDecorHandleKey<xAOD::FlowElementContainer> DerivationFramework::PFlowAugmentationTool::m_d0Key {this, "m_d0Key","GlobalChargedParticleFlowObjects.DFCommonPFlow_d0", "Decoration for track d0"}
private

Definition at line 47 of file PFlowAugmentationTool.h.

◆ m_envWeightKey

SG::WriteDecorHandleKey<xAOD::FlowElementContainer> DerivationFramework::PFlowAugmentationTool::m_envWeightKey {this, "m_envWeightKey","GlobalChargedParticleFlowObjects.DFCommonPFlow_envWeight", "Decoration for weight for dense environments"}
private

Definition at line 49 of file PFlowAugmentationTool.h.

◆ m_pfoContainer_key

SG::ReadHandleKey<xAOD::FlowElementContainer> DerivationFramework::PFlowAugmentationTool::m_pfoContainer_key {this, "GlobalChargedParticleFlowObjects", "GlobalChargedParticleFlowObjects", "Input charged PFO"}
private

Definition at line 42 of file PFlowAugmentationTool.h.

◆ m_thetaKey

SG::WriteDecorHandleKey<xAOD::FlowElementContainer> DerivationFramework::PFlowAugmentationTool::m_thetaKey {this, "m_thetaKey","GlobalChargedParticleFlowObjects.DFCommonPFlow_theta", "Decoration for track theta"}
private

Definition at line 48 of file PFlowAugmentationTool.h.

◆ m_vertexContainer_key

SG::ReadHandleKey<xAOD::VertexContainer> DerivationFramework::PFlowAugmentationTool::m_vertexContainer_key {this, "VertexContainer", "PrimaryVertices", "Input vertex container"}
private

Retrieval tool.

Definition at line 41 of file PFlowAugmentationTool.h.

◆ m_vzKey

SG::WriteDecorHandleKey<xAOD::FlowElementContainer> DerivationFramework::PFlowAugmentationTool::m_vzKey {this, "m_vzKey","GlobalChargedParticleFlowObjects.DFCommonPFlow_vz", "Decoration for track vz"}
private

Definition at line 46 of file PFlowAugmentationTool.h.

◆ m_weightPFOTool

ToolHandle<CP::IWeightPFOTool> DerivationFramework::PFlowAugmentationTool::m_weightPFOTool
private

Definition at line 39 of file PFlowAugmentationTool.h.

◆ m_z0Key

SG::WriteDecorHandleKey<xAOD::FlowElementContainer> DerivationFramework::PFlowAugmentationTool::m_z0Key {this, "m_z0Key", "GlobalChargedParticleFlowObjects.DFCommonPFlow_z0", "Decoration for track z0"}
private

Definition at line 45 of file PFlowAugmentationTool.h.


The documentation for this class was generated from the following files:
DerivationFramework::PFlowAugmentationTool::m_z0Key
SG::WriteDecorHandleKey< xAOD::FlowElementContainer > m_z0Key
Definition: PFlowAugmentationTool.h:45
DerivationFramework::PFlowAugmentationTool::m_pfoContainer_key
SG::ReadHandleKey< xAOD::FlowElementContainer > m_pfoContainer_key
Definition: PFlowAugmentationTool.h:42
xAOD::TrackParticle_v1::vz
float vz() const
The z origin for the parameters.
DerivationFramework::PFlowAugmentationTool::m_thetaKey
SG::WriteDecorHandleKey< xAOD::FlowElementContainer > m_thetaKey
Definition: PFlowAugmentationTool.h:48
xAOD::TrackParticle_v1::z0
float z0() const
Returns the parameter.
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:55
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
DerivationFramework::PFlowAugmentationTool::m_corrP4_ptKey
SG::WriteDecorHandleKey< xAOD::FlowElementContainer > m_corrP4_ptKey
Definition: PFlowAugmentationTool.h:44
xAOD::VxType::NoVtx
@ NoVtx
Dummy vertex. TrackParticle was not used in vertex fit.
Definition: TrackingPrimitives.h:571
xAOD::TrackParticle_v1::d0
float d0() const
Returns the parameter.
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:189
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:274
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
beamspotman.n
n
Definition: beamspotman.py:731
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
xAOD::VxType::PriVtx
@ PriVtx
Primary vertex.
Definition: TrackingPrimitives.h:572
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
DerivationFramework::PFlowAugmentationTool::m_weightPFOTool
ToolHandle< CP::IWeightPFOTool > m_weightPFOTool
Definition: PFlowAugmentationTool.h:39
DerivationFramework::PFlowAugmentationTool::m_d0Key
SG::WriteDecorHandleKey< xAOD::FlowElementContainer > m_d0Key
Definition: PFlowAugmentationTool.h:47
DerivationFramework::PFlowAugmentationTool::m_vertexContainer_key
SG::ReadHandleKey< xAOD::VertexContainer > m_vertexContainer_key
Retrieval tool.
Definition: PFlowAugmentationTool.h:41
DerivationFramework::PFlowAugmentationTool::m_envWeightKey
SG::WriteDecorHandleKey< xAOD::FlowElementContainer > m_envWeightKey
Definition: PFlowAugmentationTool.h:49
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.changerun.pv
pv
Definition: changerun.py:81
DerivationFramework::PFlowAugmentationTool::m_vzKey
SG::WriteDecorHandleKey< xAOD::FlowElementContainer > m_vzKey
Definition: PFlowAugmentationTool.h:46
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
xAOD::TrackParticle_v1::theta
float theta() const
Returns the parameter, which has range 0 to .
xAOD::FlowElement_v1
A detector object made of other lower level object(s)
Definition: FlowElement_v1.h:25