ATLAS Offline Software
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

virtual StatusCode initialize () override final
 
virtual StatusCode addBranches (const EventContext &ctx) const override final
 

Private Attributes

ToolHandle< CP::IPhotonPointingToolm_photonPointingTool
 PhotonPointingTool. 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", m_vertexContainer, "", "" }
 
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.

Member Function Documentation

◆ addBranches()

StatusCode DerivationFramework::PhotonVertexSelectionWrapper::addBranches ( const EventContext &  ctx) const
finaloverridevirtual

Definition at line 33 of file PhotonVertexSelectionWrapper.cxx.

34 {
35  // retrieve the input containers
38 
39  // Update calo pointing auxdata for photons
40  if (m_photonPointingTool->updatePointingAuxdata(*photons).isFailure()) {
41  ATH_MSG_ERROR("Couldn't update photon calo pointing auxdata");
42  return StatusCode::FAILURE;
43  }
44 
45  // create the decorators
51  bool isMomentum_available = vtxPt.isAvailable();
52  bool isSumPt_available = vtxSumPt.isAvailable();
53  bool isSumPt2_available = vtxSumPt2.isAvailable();
54  bool found_PV = false;
55 
56  // Loop over vertices and update auxdata
57  for (const auto *vertex : *vertices) {
58 
59  float pt = -999.;
60  float eta = -999.;
61  float phi = -999.;
62  float sumPt = -999.;
63  float sumPt2 = -999.;
64 
65  if(vertex->vertexType() == xAOD::VxType::VertexType::PriVtx or
66  vertex->vertexType() == xAOD::VxType::VertexType::PileUp){
67 
68  found_PV = true;
69  // Get momentum vector of vertex and add it as a decoration
70  TLorentzVector vmom = xAOD::PVHelpers::getVertexMomentum(vertex, isMomentum_available);
71  pt = sqrt(vmom.Px() * vmom.Px() + vmom.Py() * vmom.Py());
72  if(pt>0.){
73  eta = asinh(vmom.Pz() / pt);
74  phi = acos(vmom.Px() / pt); // in [0,Pi]
75  }
76  // Calculate additional quantities
77  sumPt = xAOD::PVHelpers::getVertexSumPt(vertex, 1, isSumPt_available);
78  sumPt2 = xAOD::PVHelpers::getVertexSumPt(vertex, 2, isSumPt2_available);
79 
80  }
81 
82  // write decorations
83  if(!isMomentum_available){
84  vtxPt(*vertex) = pt;
85  vtxEta(*vertex) = eta;
86  vtxPhi(*vertex) = phi;
87  }
88  if(!isSumPt_available) vtxSumPt(*vertex) = sumPt;
89  // For events where no PV is reconstructed, beamspot is saved and isSumPt2_available = False
90  // Need to also check found_PV to avoid modifying locked store
91  if(!isSumPt2_available && found_PV) vtxSumPt2(*vertex) = sumPt2;
92 
93  } // end loop o vertices
94 
95  return StatusCode::SUCCESS;
96 }

◆ initialize()

StatusCode DerivationFramework::PhotonVertexSelectionWrapper::initialize ( )
finaloverridevirtual

Definition at line 12 of file PhotonVertexSelectionWrapper.cxx.

13 {
14  ATH_MSG_DEBUG("Initializing " << name() << "...");
15  ATH_CHECK(m_photonPointingTool.retrieve());
16  ATH_MSG_DEBUG("Retrieved tool " << m_photonPointingTool);
17 
18  ATH_CHECK(m_photonContainer.initialize());
19  ATH_CHECK(m_vertexContainer.initialize());
20 
21  ATH_CHECK(m_vtxPt.initialize());
22  ATH_CHECK(m_vtxEta.initialize());
23  ATH_CHECK(m_vtxPhi.initialize());
24  ATH_CHECK(m_vtxSumPt.initialize());
25  ATH_CHECK(m_vtxSumPt2.initialize());
26 
27  ATH_MSG_DEBUG("Initialization successful");
28 
29  return StatusCode::SUCCESS;
30 }

Member Data Documentation

◆ 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 49 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 41 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 57 of file PhotonVertexSelectionWrapper.h.

◆ m_vtxEta

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

Definition at line 67 of file PhotonVertexSelectionWrapper.h.

◆ m_vtxPhi

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

Definition at line 71 of file PhotonVertexSelectionWrapper.h.

◆ m_vtxPt

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

Definition at line 66 of file PhotonVertexSelectionWrapper.h.

◆ m_vtxSumPt

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

Definition at line 75 of file PhotonVertexSelectionWrapper.h.

◆ m_vtxSumPt2

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

Definition at line 79 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:57
test_pyathena.pt
pt
Definition: test_pyathena.py:11
DerivationFramework::PhotonVertexSelectionWrapper::m_vtxPt
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_vtxPt
Definition: PhotonVertexSelectionWrapper.h:66
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:41
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
python.Dumpers.asinh
def asinh(x)
helper methods ---------------------------------------------------------—
Definition: Dumpers.py:88
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:79
DerivationFramework::PhotonVertexSelectionWrapper::m_vtxSumPt
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_vtxSumPt
Definition: PhotonVertexSelectionWrapper.h:75
DerivationFramework::PhotonVertexSelectionWrapper::m_vtxPhi
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_vtxPhi
Definition: PhotonVertexSelectionWrapper.h:71
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:49
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:67