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::PhotonVertexSelectionWrapper Class Reference

#include <PhotonVertexSelectionWrapper.h>

Inheritance diagram for DerivationFramework::PhotonVertexSelectionWrapper:
Collaboration diagram for DerivationFramework::PhotonVertexSelectionWrapper:

Public Member Functions

 PhotonVertexSelectionWrapper (const std::string &t, const std::string &n, const IInterface *p)
 
StatusCode initialize () override final
 
virtual StatusCode addBranches () const override final
 

Private Attributes

ToolHandle< CP::IPhotonPointingToolm_photonPointingTool
 PhotonPointingTool. More...
 
std::string m_decPrefix
 Prefix for the decorations. More...
 
SG::ReadHandleKey< xAOD::PhotonContainerm_photonContainer
 Input photon container. More...
 
SG::ReadHandleKey< xAOD::VertexContainerm_vertexContainer
 Input primary vertex container. More...
 
SG::WriteDecorHandleKey< xAOD::VertexContainerm_vtxPt { this, "pt", "", "" }
 
SG::WriteDecorHandleKey< xAOD::VertexContainerm_vtxEta
 
SG::WriteDecorHandleKey< xAOD::VertexContainerm_vtxPhi
 
SG::WriteDecorHandleKey< xAOD::VertexContainerm_vtxSumPt
 
SG::WriteDecorHandleKey< xAOD::VertexContainerm_vtxSumPt2
 

Detailed Description

Definition at line 30 of file PhotonVertexSelectionWrapper.h.

Constructor & Destructor Documentation

◆ PhotonVertexSelectionWrapper()

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

Definition at line 11 of file PhotonVertexSelectionWrapper.cxx.

14  : base_class(t, n, p)
15  , m_decPrefix("")
16 {
17  declareProperty(
18  "DecorationPrefix", m_decPrefix, "Prefix for the decoration name");
19 }

Member Function Documentation

◆ addBranches()

StatusCode DerivationFramework::PhotonVertexSelectionWrapper::addBranches ( ) const
finaloverridevirtual

Definition at line 52 of file PhotonVertexSelectionWrapper.cxx.

53 {
54  // retrieve the input containers
55  const EventContext& ctx = Gaudi::Hive::currentContext();
58 
59  // Update calo pointing auxdata for photons
60  if (m_photonPointingTool->updatePointingAuxdata(*photons).isFailure()) {
61  ATH_MSG_ERROR("Couldn't update photon calo pointing auxdata");
62  return StatusCode::FAILURE;
63  }
64 
65  // create the decorators
71  bool isMomentum_available = vtxPt.isAvailable();
72  bool isSumPt_available = vtxSumPt.isAvailable();
73  bool isSumPt2_available = vtxSumPt2.isAvailable();
74  bool found_PV = false;
75 
76  // Loop over vertices and update auxdata
77  for (const auto *vertex : *vertices) {
78 
79  float pt = -999.;
80  float eta = -999.;
81  float phi = -999.;
82  float sumPt = -999.;
83  float sumPt2 = -999.;
84 
85  if(vertex->vertexType() == xAOD::VxType::VertexType::PriVtx or
86  vertex->vertexType() == xAOD::VxType::VertexType::PileUp){
87 
88  found_PV = true;
89  // Get momentum vector of vertex and add it as a decoration
90  TLorentzVector vmom = xAOD::PVHelpers::getVertexMomentum(vertex, isMomentum_available);
91  pt = sqrt(vmom.Px() * vmom.Px() + vmom.Py() * vmom.Py());
92  if(pt>0.){
93  eta = asinh(vmom.Pz() / pt);
94  phi = acos(vmom.Px() / pt); // in [0,Pi]
95  }
96  // Calculate additional quantities
97  sumPt = xAOD::PVHelpers::getVertexSumPt(vertex, 1, isSumPt_available);
98  sumPt2 = xAOD::PVHelpers::getVertexSumPt(vertex, 2, isSumPt2_available);
99 
100  }
101 
102  // write decorations
103  if(!isMomentum_available){
104  vtxPt(*vertex) = pt;
105  vtxEta(*vertex) = eta;
106  vtxPhi(*vertex) = phi;
107  }
108  if(!isSumPt_available) vtxSumPt(*vertex) = sumPt;
109  // For events where no PV is reconstructed, beamspot is saved and isSumPt2_available = False
110  // Need to also check found_PV to avoid modifying locked store
111  if(!isSumPt2_available && found_PV) vtxSumPt2(*vertex) = sumPt2;
112 
113  } // end loop o vertices
114 
115  return StatusCode::SUCCESS;
116 }

◆ initialize()

StatusCode DerivationFramework::PhotonVertexSelectionWrapper::initialize ( )
finaloverride

Definition at line 22 of file PhotonVertexSelectionWrapper.cxx.

23 {
24  ATH_MSG_DEBUG("Initializing " << name() << "...");
25  ATH_CHECK(m_photonPointingTool.retrieve());
26  ATH_MSG_DEBUG("Retrieved tool " << m_photonPointingTool);
27 
28  ATH_CHECK(m_photonContainer.initialize());
29  ATH_CHECK(m_vertexContainer.initialize());
30 
31  const std::string baseName = m_vertexContainer.key();
32  std::string prefix = "";
33  if(!m_decPrefix.empty()) prefix = m_decPrefix + "_";
34  m_vtxPt = baseName + "." + prefix + "pt";
35  m_vtxEta = baseName + "." + prefix + "eta";
36  m_vtxPhi = baseName + "." + prefix + "phi";
37  m_vtxSumPt = baseName + "." + prefix + "sumPt";
38  m_vtxSumPt2 = baseName + "." + prefix + "sumPt2";
39 
40  ATH_CHECK(m_vtxPt.initialize());
41  ATH_CHECK(m_vtxEta.initialize());
42  ATH_CHECK(m_vtxPhi.initialize());
43  ATH_CHECK(m_vtxSumPt.initialize());
44  ATH_CHECK(m_vtxSumPt2.initialize());
45 
46  ATH_MSG_DEBUG("Initialization successful");
47 
48  return StatusCode::SUCCESS;
49 }

Member Data Documentation

◆ m_decPrefix

std::string DerivationFramework::PhotonVertexSelectionWrapper::m_decPrefix
private

Prefix for the decorations.

Definition at line 50 of file PhotonVertexSelectionWrapper.h.

◆ m_photonContainer

SG::ReadHandleKey<xAOD::PhotonContainer> DerivationFramework::PhotonVertexSelectionWrapper::m_photonContainer
private
Initial value:
{
this,
"PhotonContainer",
"Photons",
"SG key of input photon container"
}

Input photon container.

Definition at line 53 of file PhotonVertexSelectionWrapper.h.

◆ m_photonPointingTool

ToolHandle<CP::IPhotonPointingTool> DerivationFramework::PhotonVertexSelectionWrapper::m_photonPointingTool
private
Initial value:
{
this,
"PhotonPointingTool",
"",
"Handle to the photon pointing tool"
}

PhotonPointingTool.

Definition at line 42 of file PhotonVertexSelectionWrapper.h.

◆ m_vertexContainer

SG::ReadHandleKey<xAOD::VertexContainer> DerivationFramework::PhotonVertexSelectionWrapper::m_vertexContainer
private
Initial value:
{
this,
"VertexContainer",
"PrimaryVertices",
"SG key of input vertex container"
}

Input primary vertex container.

Definition at line 61 of file PhotonVertexSelectionWrapper.h.

◆ m_vtxEta

SG::WriteDecorHandleKey<xAOD::VertexContainer> DerivationFramework::PhotonVertexSelectionWrapper::m_vtxEta
private
Initial value:
{ this,
"eta",
"",
"" }

Definition at line 71 of file PhotonVertexSelectionWrapper.h.

◆ m_vtxPhi

SG::WriteDecorHandleKey<xAOD::VertexContainer> DerivationFramework::PhotonVertexSelectionWrapper::m_vtxPhi
private
Initial value:
{ this,
"phi",
"",
"" }

Definition at line 75 of file PhotonVertexSelectionWrapper.h.

◆ m_vtxPt

SG::WriteDecorHandleKey<xAOD::VertexContainer> DerivationFramework::PhotonVertexSelectionWrapper::m_vtxPt { this, "pt", "", "" }
private

Definition at line 70 of file PhotonVertexSelectionWrapper.h.

◆ m_vtxSumPt

SG::WriteDecorHandleKey<xAOD::VertexContainer> DerivationFramework::PhotonVertexSelectionWrapper::m_vtxSumPt
private
Initial value:
{ this,
"sumPt",
"",
"" }

Definition at line 79 of file PhotonVertexSelectionWrapper.h.

◆ m_vtxSumPt2

SG::WriteDecorHandleKey<xAOD::VertexContainer> DerivationFramework::PhotonVertexSelectionWrapper::m_vtxSumPt2
private
Initial value:
{ this,
"sumPt2",
"",
"" }

Definition at line 83 of file PhotonVertexSelectionWrapper.h.


The documentation for this class was generated from the following files:
xAOD::PVHelpers::getVertexSumPt
float getVertexSumPt(const xAOD::Vertex *vertex, int power=1, bool useAux=true)
Loop over track particles associated with vertex and return scalar sum of pT^power in GeV (from auxda...
Definition: PhotonVertexHelpers.cxx:214
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:67
DerivationFramework::PhotonVertexSelectionWrapper::m_vertexContainer
SG::ReadHandleKey< xAOD::VertexContainer > m_vertexContainer
Input primary vertex container.
Definition: PhotonVertexSelectionWrapper.h:61
test_pyathena.pt
pt
Definition: test_pyathena.py:11
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
DerivationFramework::PhotonVertexSelectionWrapper::m_vtxPt
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_vtxPt
Definition: PhotonVertexSelectionWrapper.h:70
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
DerivationFramework::PhotonVertexSelectionWrapper::m_photonPointingTool
ToolHandle< CP::IPhotonPointingTool > m_photonPointingTool
PhotonPointingTool.
Definition: PhotonVertexSelectionWrapper.h:42
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
checkCorrelInHIST.prefix
dictionary prefix
Definition: checkCorrelInHIST.py:391
DerivationFramework::PhotonVertexSelectionWrapper::m_decPrefix
std::string m_decPrefix
Prefix for the decorations.
Definition: PhotonVertexSelectionWrapper.h:50
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
python.Dumpers.asinh
def asinh(x)
helper methods ---------------------------------------------------------—
Definition: Dumpers.py:89
xAOD::PVHelpers::getVertexMomentum
TLorentzVector getVertexMomentum(const xAOD::Vertex *vertex, bool useAux=true, const std::string &derivationPrefix="")
Return vector sum of tracks associated with vertex (from auxdata if available and useAux = true)
Definition: PhotonVertexHelpers.cxx:174
DerivationFramework::PhotonVertexSelectionWrapper::m_vtxSumPt2
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_vtxSumPt2
Definition: PhotonVertexSelectionWrapper.h:83
DerivationFramework::PhotonVertexSelectionWrapper::m_vtxSumPt
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_vtxSumPt
Definition: PhotonVertexSelectionWrapper.h:79
DerivationFramework::PhotonVertexSelectionWrapper::m_vtxPhi
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_vtxPhi
Definition: PhotonVertexSelectionWrapper.h:75
xAOD::VxType::PileUp
@ PileUp
Pile-up vertex.
Definition: TrackingPrimitives.h:574
DerivationFramework::PhotonVertexSelectionWrapper::m_photonContainer
SG::ReadHandleKey< xAOD::PhotonContainer > m_photonContainer
Input photon container.
Definition: PhotonVertexSelectionWrapper.h:53
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
Trk::vertex
@ vertex
Definition: MeasurementType.h:21
DerivationFramework::PhotonVertexSelectionWrapper::m_vtxEta
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_vtxEta
Definition: PhotonVertexSelectionWrapper.h:71