ATLAS Offline Software
Loading...
Searching...
No Matches
Photon_v1.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3*/
4
5// $Id: Photon_v1.cxx 741489 2016-04-20 01:30:34Z christos $
6
7// EDM include(s):
10
11// Local include(s):
13#include "PhotonAccessors_v1.h"
14
15#include <stdexcept>
16
17namespace xAOD {
18
20 : Egamma_v1() {
21
22 }
23
27
29
30 if (this != &ph){ // protect against invalid self-assignment
31 this->Egamma_v1::operator=( ph );
32 }
33 // by convention, always return *this
34 return *this;
35 }
36
37 Type::ObjectType Photon_v1::type() const {
38
39 return Type::Photon;
40 }
41
42 double Photon_v1::m() const {
44 }
45
46 double Photon_v1::e() const {
47 // for a massless particle E = pT * cosh(eta)
48 return pt() * std::cosh(eta());
49 }
50
51 double Photon_v1::rapidity() const {
52 // massless rapidity is the same as pseudorapidity
53 return eta();
54 }
55
57 //
58 // Implementation of the vertex handling functions
59 //
60
61 const xAOD::Vertex* Photon_v1::vertex( size_t index ) const {
62
63 if( index >= nVertices() ) {
64 return nullptr;
65 }
66 const VxELVec_t& links = vertexLinks();
67 if( ! links[ index ].isValid() ) {
68 return nullptr;
69 }
70 return *( links[ index ] );
71 }
72
74 Photon_v1::vertexLink( size_t index ) const {
75
76 if( index >= nVertices() ) {
77 static const ElementLink< VertexContainer > dummy;
78 return dummy;
79 }
80 return vertexLinks()[ index ];
81 }
82
84 vertexLinks, setVertexLinks )
85
86 size_t xAOD::Photon_v1::nVertices() const {
87
89 vertexAcc( "vertexLinks" );
90
91 if( vertexAcc.isAvailable( *this ) ) {
92 return vertexAcc( *this ).size();
93 }
94 return 0;
95 }
96
97 //
99
101 //Implementation of the summary value accessor functions
102
103 bool Photon_v1::vertexCaloMatchValue( float& value, const EgammaParameters::VertexCaloMatchType information ) const {
104
106 if( ! acc ) {
107 return false;
108 }
109 if(! acc->isAvailable( *this) ) {
110 return false;
111 }
112 // Retrieve the value:
113 value = ( *acc )( *this );
114 return true;
115 }
116
118
119 const xAOD::Photon_v1::Accessor< float >* acc = vertexCaloMatchAccessorV1( information );
120 if(! acc ) throw std::runtime_error( "Unknown/Unavailable Vertex to Calo Match type requested" );
121 // Retrieve the value:
122 return ( *acc )( *this );
123 }
124
125 bool Photon_v1::setVertexCaloMatchValue( const float value,
126 const EgammaParameters::VertexCaloMatchType information ) {
127
128 const xAOD::Photon_v1::Accessor< float >* acc = vertexCaloMatchAccessorV1( information );
129 if( ! acc ) return false;
130 // Set the value:
131 ( *acc )( *this ) = value;
132 return true;
133 }
134
135
136
137} // namespace xAOD
bool isValid(const T &p)
Av: we implement here an ATLAS-sepcific convention: all particles which are 99xxxxx are fine.
Definition AtlasPID.h:878
#define AUXSTORE_OBJECT_SETTER_AND_GETTER(CL, TYPE, NAME, SETTER)
Macro creating the accessors of complex auxiliary properties.
A number of constexpr particle constants to avoid hardcoding them directly in various places.
void makePrivateStore()
Create a new (empty) private store for this object.
SG::Accessor< T, ALLOC > Accessor
Definition AuxElement.h:572
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
virtual double pt() const override final
The transverse momentum ( ) of the particle.
Definition Egamma_v1.cxx:66
Egamma_v1()
Default constructor.
Definition Egamma_v1.cxx:48
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
Definition Egamma_v1.cxx:71
Egamma_v1 & operator=(const Egamma_v1 &eg)
Assignment Operator. Using the assignment of SG::AuxElement.
Definition Egamma_v1.cxx:54
virtual Type::ObjectType type() const override final
The type of the object as a simple enumeration.
Definition Photon_v1.cxx:37
const ElementLink< VertexContainer > & vertexLink(size_t index=0) const
ElementLink to the xAOD::vertex/es that match the electron candidate.
Definition Photon_v1.cxx:74
bool setVertexCaloMatchValue(const float value, const EgammaParameters::VertexCaloMatchType information)
Set method for CaloMatch values.
std::vector< ElementLink< VertexContainer > > VxELVec_t
Helper type definition.
Definition Photon_v1.h:94
Photon_v1 & operator=(const Photon_v1 &el)
Assignment Operator. Ends up using the assignment of AuxElement for the store.
Definition Photon_v1.cxx:28
const VxELVec_t & vertexLinks() const
Get all vertex links.
virtual double e() const override final
The total energy of the particle.
Definition Photon_v1.cxx:46
virtual double m() const override final
The invariant mass of the particle.
Definition Photon_v1.cxx:42
bool vertexCaloMatchValue(float &value, const EgammaParameters::VertexCaloMatchType information) const
Accessor to vertex to Calo Match Values If 'information' is stored in this xAOD::Egamma and is of the...
size_t nVertices() const
Return the number xAOD::Vertex/vertices that match the photon candidate.
virtual double rapidity() const override final
The true rapidity (y) of the particle.
Definition Photon_v1.cxx:51
Photon_v1()
Default constructor.
Definition Photon_v1.cxx:19
const xAOD::Vertex * vertex(size_t index=0) const
Pointer to the xAOD::Vertex/es that match the photon candidate.
Definition Photon_v1.cxx:61
constexpr double photonMassInMeV
various mass-less particles
Definition index.py:1
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Vertex_v1 Vertex
Define the latest version of the vertex class.
const SG::AuxElement::Accessor< float > * vertexCaloMatchAccessorV1(xAOD::EgammaParameters::VertexCaloMatchType type)
Helper function for managing Egamma Accessor objects.
static const SG::AuxElement::Accessor< ElementLink< IParticleContainer > > acc("originalObjectLink")
Object used for setting/getting the dynamic decoration in question.