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):
10 
11 // Local include(s):
13 #include "PhotonAccessors_v1.h"
14 
15 #include <stdexcept>
16 
17 namespace xAOD {
18 
20  : Egamma_v1() {
21 
22  }
23 
25  makePrivateStore(ph);
26  }
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 
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() ) {
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 
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 
129  if( ! acc ) return false;
130  // Set the value:
131  ( *acc )( *this ) = value;
132  return true;
133  }
135 
136 
137 } // 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:37
ParticleConstants::photonMassInMeV
constexpr double photonMassInMeV
various mass-less particles
Definition: ParticleConstants.h:136
xAOD::Photon_v1::rapidity
virtual double rapidity() const override final
The true rapidity (y) of the particle.
Definition: Photon_v1.cxx:51
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
xAOD::Photon_v1::m
virtual double m() const override final
The invariant mass of the particle.
Definition: Photon_v1.cxx:42
SG::Accessor
Helper class to provide type-safe access to aux data.
Definition: Control/AthContainers/AthContainers/Accessor.h:68
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:124
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::e
virtual double e() const override final
The total energy of the particle.
Definition: Photon_v1.cxx:46
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:74
isValid
bool isValid(const T &p)
Av: we implement here an ATLAS-sepcific convention: all particles which are 99xxxxx are fine.
Definition: AtlasPID.h:878
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.
ParticleConstants.h
xAOD::Egamma_v1::operator=
Egamma_v1 & operator=(const Egamma_v1 &eg)
Assignment Operator. Using the assignment of SG::AuxElement.
Definition: Egamma_v1.cxx:54
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:94
xAOD::Photon_v1::Photon_v1
Photon_v1()
Default constructor.
Definition: Photon_v1.cxx:19
CalibDbCompareRT.dummy
dummy
Definition: CalibDbCompareRT.py:59
xAOD::EgammaParameters::VertexCaloMatchType
VertexCaloMatchType
Definition: EgammaEnums.h:240
AthenaPoolTestRead.acc
acc
Definition: AthenaPoolTestRead.py:16
SG::AuxElement::makePrivateStore
void makePrivateStore()
Create a new (empty) private store for this object.
Definition: AuxElement.cxx:192
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:28
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...
xAOD::Egamma_v1::pt
virtual double pt() const override final
The transverse momentum ( ) of the particle.
Definition: Egamma_v1.cxx:66
SG::ConstAccessor< T, AuxAllocator_t< T > >::isAvailable
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
xAOD::Egamma_v1::eta
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
Definition: Egamma_v1.cxx:71
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:61
xAOD::AUXSTORE_OBJECT_SETTER_AND_GETTER
AUXSTORE_OBJECT_SETTER_AND_GETTER(CaloRings_v1, RingSetLinks, ringSetLinks, setRingSetLinks) unsigned CaloRings_v1
Definition: CaloRings_v1.cxx:27