The Gaudi Framework  master (37c0b60a)
MyVertex.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2024 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
11 #ifndef GAUDIPOOLDB_TEST_MYVERTEX_H
12 #define GAUDIPOOLDB_TEST_MYVERTEX_H
13 
14 // Include files
18 
19 #include <GaudiExamples/Event.h>
20 #include <GaudiExamples/MyTrack.h>
21 
22 namespace Gaudi {
23  namespace Examples {
24  // Forward declarations
25  // class MyTrack;
26 
27  // CLID definition
28  static const CLID& CLID_MyVertex = 356;
29 
36  class GAUDI_API MyVertex : public KeyedObject<int> {
37  protected:
39  float m_x, m_y, m_z;
48 
49  public:
51  MyVertex();
53  MyVertex( float x, float y, float z );
55  ~MyVertex() override;
57  const CLID& clID() const override { return classID(); }
58  static const CLID& classID() { return CLID_MyVertex; }
60  float x() const { return m_x; }
62  float y() const { return m_y; }
64  float z() const { return m_z; }
66  void setX( float x ) { m_x = x; }
68  void setY( float y ) { m_y = y; }
70  void setZ( float z ) { m_z = z; }
71 
73  const Event* event() const { return m_event; }
75  void setEvent( Event* evt ) { m_event = evt; }
77  const MyTrack* motherParticle() const;
78 
80  void setMotherParticle( MyTrack* mother );
81 
83  const SmartRefVector<MyTrack>& decayParticles() const;
84 
86  void addDecayParticle( MyTrack* track );
87 
89  void removeDecayParticle( MyTrack* vtx );
90 
92  const SmartRefVector<Collision>& collisions() const;
93 
95  void addCollision( Collision* vtx );
96 
98  void removeCollision( Collision* vtx );
99 
101  StreamBuffer& serialize( StreamBuffer& s ) const override;
103  StreamBuffer& serialize( StreamBuffer& s ) override;
104  };
105 
106  // Definition of all container types of MCParticle
108 
110  inline const MyTrack* MyVertex::motherParticle() const { return m_motherParticle; }
111 
113  inline void MyVertex::setMotherParticle( MyTrack* mother ) { m_motherParticle = mother; }
114 
117 
119  inline void MyVertex::addDecayParticle( MyTrack* p ) { m_decayParticles.push_back( SmartRef<MyTrack>( p ) ); }
120 
124  for ( i = m_decayParticles.begin(); i != m_decayParticles.end(); ++i ) {
125  if ( i->target() == p ) {
126  m_decayParticles.erase( i );
127  return;
128  }
129  }
130  }
131 
134 
137 
141  for ( i = m_collisions.begin(); i != m_collisions.end(); ++i ) {
142  if ( i->target() == c ) {
143  m_collisions.erase( i );
144  return;
145  }
146  }
147  }
148  } // namespace Examples
149 } // namespace Gaudi
150 
151 #endif // GAUDIPOOLDB_TEST_MYTRACK_H
IOTest.evt
evt
Definition: IOTest.py:107
Gaudi::Examples::MyVertex::clID
const CLID & clID() const override
Retrieve pointer to class definition structure.
Definition: MyVertex.h:57
SmartRefVector
Kernel objects: SmartRefVector.
Definition: SmartRefVector.h:79
Gaudi::Examples::MyVertex::setEvent
void setEvent(Event *evt)
Access to event object.
Definition: MyVertex.h:75
Gaudi::Examples::MyVertex::addDecayParticle
void addDecayParticle(MyTrack *track)
Add decay particle.
Definition: MyVertex.h:119
Gaudi::Examples::MyVertex::removeDecayParticle
void removeDecayParticle(MyTrack *vtx)
Remove decay vertex.
Definition: MyVertex.h:122
gaudirun.s
string s
Definition: gaudirun.py:346
Gaudi::Examples::MyVertex::y
float y() const
Accessors: Retrieve y-component of the track momentum.
Definition: MyVertex.h:62
Gaudi::Examples::MyVertex::m_z
float m_z
Definition: MyVertex.h:39
SmartRefVector.h
Gaudi::Examples::MyVertex::motherParticle
const MyTrack * motherParticle() const
Mother track.
Definition: MyVertex.h:110
KeyedObject.h
gaudirun.c
c
Definition: gaudirun.py:525
KeyedContainer.h
Gaudi::Examples::MyVertex::m_motherParticle
SmartRef< MyTrack > m_motherParticle
Link to mother track.
Definition: MyVertex.h:43
Gaudi::Examples::MyVertex::setX
void setX(float x)
Accessors: Update x-component of the track momentum.
Definition: MyVertex.h:66
MyTrack.h
StreamBuffer
Definition: StreamBuffer.h:52
Gaudi::Examples::MyVertex::classID
static const CLID & classID()
Definition: MyVertex.h:58
Gaudi::Examples::MyVertex::m_decayParticles
SmartRefVector< MyTrack > m_decayParticles
Links to all daughter particles.
Definition: MyVertex.h:45
Gaudi::Examples::MyVertex::addCollision
void addCollision(Collision *vtx)
Add collision.
Definition: MyVertex.h:136
Gaudi::Examples::MyVertex::decayParticles
const SmartRefVector< MyTrack > & decayParticles() const
Access to decay particles.
Definition: MyVertex.h:116
Gaudi::Examples::MyVertex::collisions
const SmartRefVector< Collision > & collisions() const
Access to collisions.
Definition: MyVertex.h:133
Gaudi::Examples::MyVertex::setZ
void setZ(float z)
Accessors: Update z-component of the track momentum.
Definition: MyVertex.h:70
Gaudi::Examples::MyVertex::m_collisions
SmartRefVector< Collision > m_collisions
Vector of collisions this object belongs to.
Definition: MyVertex.h:47
Gaudi::Examples::Event
Definition: Event.h:39
Gaudi::Examples::Collision
Definition: Collision.h:28
KeyedContainer
template class KeyedContainer, KeyedContainer.h
Definition: KeyedContainer.h:74
CLID
unsigned int CLID
Class ID definition.
Definition: ClassID.h:18
KeyedObject
Definition of the templated KeyedObject class.
Definition: KeyedObject.h:39
Gaudi
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
Definition: __init__.py:1
Event.h
Gaudi::Examples::MyVertex::z
float z() const
Accessors: Retrieve z-component of the track momentum.
Definition: MyVertex.h:64
Gaudi::Examples::MyVertex::x
float x() const
Accessors: Retrieve x-component of the track momentum.
Definition: MyVertex.h:60
Gaudi::Examples::MyVertex::event
const Event * event() const
Access to the source track object (constant case)
Definition: MyVertex.h:73
Gaudi::Examples::MyTrack
Definition: MyTrack.h:53
Gaudi::Examples::MyVertex::setMotherParticle
void setMotherParticle(MyTrack *mother)
Set mother track.
Definition: MyVertex.h:113
Gaudi::Examples::MyVertex::m_event
SmartRef< Event > m_event
Link to Top level event.
Definition: MyVertex.h:41
SmartRef
Kernel objects: SmartRef.
Definition: SmartRef.h:76
Gaudi::Examples::MyVertex
Definition: MyVertex.h:36
Gaudi::Examples::MyVertex::setY
void setY(float y)
Accessors: Update y-component of the track momentum.
Definition: MyVertex.h:68
Gaudi::Examples::MyVertex::removeCollision
void removeCollision(Collision *vtx)
Remove collision.
Definition: MyVertex.h:139
Gaudi::Examples::MyVertexVector
KeyedContainer< MyVertex > MyVertexVector
Definition: MyVertex.h:107
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:81