ATLAS Offline Software
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):
9 
10 // Local include(s):
12 #include "PhotonAccessors_v1.h"
13 
14 #include <stdexcept>
15 
16 namespace xAOD {
17 
19  : Egamma_v1() {
20 
21  }
22 
24  makePrivateStore(ph);
25  }
26 
28 
29  if (this != &ph){ // protect against invalid self-assignment
30  this->Egamma_v1::operator=( ph );
31  }
32  // by convention, always return *this
33  return *this;
34  }
35 
37 
38  return Type::Photon;
39  }
40 
42  //
43  // Implementation of the vertex handling functions
44  //
45 
46  const xAOD::Vertex* Photon_v1::vertex( size_t index ) const {
47 
48  if( index >= nVertices() ) {
49  return nullptr;
50  }
51  const VxELVec_t& links = vertexLinks();
52  if( ! links[ index ].isValid() ) {
53  return nullptr;
54  }
55  return *( links[ index ] );
56  }
57 
59  Photon_v1::vertexLink( size_t index ) const {
60 
61  if( index >= nVertices() ) {
63  return dummy;
64  }
65  return vertexLinks()[ index ];
66  }
67 
69  vertexLinks, setVertexLinks )
70 
71  size_t xAOD::Photon_v1::nVertices() const {
72 
74  vertexAcc( "vertexLinks" );
75 
76  if( vertexAcc.isAvailable( *this ) ) {
77  return vertexAcc( *this ).size();
78  }
79  return 0;
80  }
81 
82  //
84 
86  //Implementation of the summary value accessor functions
87 
88  bool Photon_v1::vertexCaloMatchValue( float& value, const EgammaParameters::VertexCaloMatchType information ) const {
89 
91  if( ! acc ) {
92  return false;
93  }
94  if(! acc->isAvailable( *this) ) {
95  return false;
96  }
97  // Retrieve the value:
98  value = ( *acc )( *this );
99  return true;
100  }
101 
103 
105  if(! acc ) throw std::runtime_error( "Unknown/Unavailable Vertex to Calo Match type requested" );
106  // Retrieve the value:
107  return ( *acc )( *this );
108  }
109 
110  bool Photon_v1::setVertexCaloMatchValue( const float value,
111  const EgammaParameters::VertexCaloMatchType information ) {
112 
114  if( ! acc ) return false;
115  // Set the value:
116  ( *acc )( *this ) = value;
117  return true;
118  }
120 
121 
122 } // namespace xAOD
xAOD::Photon_v1::type
virtual Type::ObjectType type() const override final
The type of the object as a simple enumeration.
Definition: Photon_v1.cxx:36
xAOD::Photon_v1::nVertices
size_t nVertices() const
Return the number xAOD::Vertex/vertices that match the photon candidate.
xAOD::vertexCaloMatchAccessorV1
const SG::AuxElement::Accessor< float > * vertexCaloMatchAccessorV1(xAOD::EgammaParameters::VertexCaloMatchType type)
Helper function for managing Egamma Accessor objects.
Definition: PhotonAccessors_v1.cxx:25
SG::Accessor
Helper class to provide type-safe access to aux data.
Definition: Control/AthContainers/AthContainers/Accessor.h:66
AuxStoreAccessorMacros.h
index
Definition: index.py:1
xAOD::Photon_v1::setVertexCaloMatchValue
bool setVertexCaloMatchValue(const float value, const EgammaParameters::VertexCaloMatchType information)
Set method for CaloMatch values.
athena.value
value
Definition: athena.py:122
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition: ICaloAffectedTool.h:24
xAOD::Egamma_v1
Definition: Egamma_v1.h:56
xAOD::Photon_v1::vertexLink
const ElementLink< VertexContainer > & vertexLink(size_t index=0) const
ElementLink to the xAOD::vertex/es that match the electron candidate.
Definition: Photon_v1.cxx:59
isValid
bool isValid(const T &p)
Definition: AtlasPID.h:214
SG::IAuxElement::index
size_t index() const
Return the index of this element within its container.
xAOD::Photon_v1::vertexLinks
const VxELVec_t & vertexLinks() const
Get all vertex links.
xAOD::Egamma_v1::operator=
Egamma_v1 & operator=(const Egamma_v1 &eg)
Assignment Operator. Using the assignment of SG::AuxElement.
Definition: Egamma_v1.cxx:53
DMTest::links
links
Definition: CLinks_v1.cxx:22
xAOD::Photon_v1::VxELVec_t
std::vector< ElementLink< VertexContainer > > VxELVec_t
Helper type definition.
Definition: Photon_v1.h:78
xAOD::Photon_v1::Photon_v1
Photon_v1()
Default constructor.
Definition: Photon_v1.cxx:18
xAOD::EgammaParameters::VertexCaloMatchType
VertexCaloMatchType
Definition: EgammaEnums.h:239
AthenaPoolTestRead.acc
acc
Definition: AthenaPoolTestRead.py:16
python.xAODType.dummy
dummy
Definition: xAODType.py:4
SG::AuxElement::makePrivateStore
void makePrivateStore()
Create a new (empty) private store for this object.
Definition: AuxElement.cxx:172
xAOD::Photon
Photon_v1 Photon
Definition of the current "egamma version".
Definition: Event/xAOD/xAODEgamma/xAODEgamma/Photon.h:17
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
xAOD::Photon_v1
Definition: Photon_v1.h:37
PhotonAccessors_v1.h
xAOD::Photon_v1::operator=
Photon_v1 & operator=(const Photon_v1 &el)
Assignment Operator. Ends up using the assignment of AuxElement for the store.
Definition: Photon_v1.cxx:27
xAOD::Photon_v1::vertexCaloMatchValue
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...
SG::ConstAccessor< T, AuxAllocator_t< T > >::isAvailable
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
Photon_v1.h
xAODType::ObjectType
ObjectType
Type of objects that have a representation in the xAOD EDM.
Definition: ObjectType.h:32
xAOD::Photon_v1::vertex
const xAOD::Vertex * vertex(size_t index=0) const
Pointer to the xAOD::Vertex/es that match the photon candidate.
Definition: Photon_v1.cxx:46
xAOD::AUXSTORE_OBJECT_SETTER_AND_GETTER
AUXSTORE_OBJECT_SETTER_AND_GETTER(CaloRings_v1, RingSetLinks, ringSetLinks, setRingSetLinks) unsigned CaloRings_v1
Definition: CaloRings_v1.cxx:27