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 #pragma once
12 
16 #include <GaudiTestSuite/Event.h>
17 #include <GaudiTestSuite/MyTrack.h>
18 
19 namespace Gaudi {
20  namespace TestSuite {
21  // Forward declarations
22  // class MyTrack;
23 
24  // CLID definition
25  static const CLID& CLID_MyVertex = 1356;
26 
33  class GAUDI_API MyVertex : public KeyedObject<int> {
34  protected:
36  float m_x, m_y, m_z;
45 
46  public:
48  MyVertex();
50  MyVertex( float x, float y, float z );
52  ~MyVertex() override;
54  const CLID& clID() const override { return classID(); }
55  static const CLID& classID() { return CLID_MyVertex; }
57  float x() const { return m_x; }
59  float y() const { return m_y; }
61  float z() const { return m_z; }
63  void setX( float x ) { m_x = x; }
65  void setY( float y ) { m_y = y; }
67  void setZ( float z ) { m_z = z; }
68 
70  const Event* event() const { return m_event; }
72  void setEvent( Event* evt ) { m_event = evt; }
74  const MyTrack* motherParticle() const;
75 
77  void setMotherParticle( MyTrack* mother );
78 
80  const SmartRefVector<MyTrack>& decayParticles() const;
81 
83  void addDecayParticle( MyTrack* track );
84 
86  void removeDecayParticle( MyTrack* vtx );
87 
89  const SmartRefVector<Collision>& collisions() const;
90 
92  void addCollision( Collision* vtx );
93 
95  void removeCollision( Collision* vtx );
96 
98  StreamBuffer& serialize( StreamBuffer& s ) const override;
100  StreamBuffer& serialize( StreamBuffer& s ) override;
101  };
102 
103  // Definition of all container types of MCParticle
105 
107  inline const MyTrack* MyVertex::motherParticle() const { return m_motherParticle; }
108 
110  inline void MyVertex::setMotherParticle( MyTrack* mother ) { m_motherParticle = mother; }
111 
114 
116  inline void MyVertex::addDecayParticle( MyTrack* p ) { m_decayParticles.push_back( SmartRef<MyTrack>( p ) ); }
117 
121  for ( i = m_decayParticles.begin(); i != m_decayParticles.end(); ++i ) {
122  if ( i->target() == p ) {
123  m_decayParticles.erase( i );
124  return;
125  }
126  }
127  }
128 
131 
134 
138  for ( i = m_collisions.begin(); i != m_collisions.end(); ++i ) {
139  if ( i->target() == c ) {
140  m_collisions.erase( i );
141  return;
142  }
143  }
144  }
145  } // namespace TestSuite
146 } // namespace Gaudi
IOTest.evt
evt
Definition: IOTest.py:107
Event.h
SmartRefVector
Kernel objects: SmartRefVector.
Definition: SmartRefVector.h:79
Gaudi::TestSuite::MyVertex::decayParticles
const SmartRefVector< MyTrack > & decayParticles() const
Access to decay particles.
Definition: MyVertex.h:113
Gaudi::TestSuite::MyVertex::setEvent
void setEvent(Event *evt)
Access to event object.
Definition: MyVertex.h:72
MyTrack.h
Gaudi::TestSuite::MyVertex
Definition: MyVertex.h:33
gaudirun.s
string s
Definition: gaudirun.py:346
TestSuite
#define TestSuite
Definition: MakeAndConsume.cpp:658
Gaudi::TestSuite::MyVertex::setX
void setX(float x)
Accessors: Update x-component of the track momentum.
Definition: MyVertex.h:63
Gaudi::TestSuite::MyVertex::addDecayParticle
void addDecayParticle(MyTrack *track)
Add decay particle.
Definition: MyVertex.h:116
Gaudi::TestSuite::MyTrack
Definition: MyTrack.h:45
SmartRefVector.h
Gaudi::TestSuite::MyVertex::m_z
float m_z
Definition: MyVertex.h:36
Gaudi::TestSuite::MyVertex::collisions
const SmartRefVector< Collision > & collisions() const
Access to collisions.
Definition: MyVertex.h:130
KeyedObject.h
gaudirun.c
c
Definition: gaudirun.py:525
Gaudi::TestSuite::MyVertex::m_event
SmartRef< Event > m_event
Link to Top level event.
Definition: MyVertex.h:38
KeyedContainer.h
Gaudi::TestSuite::MyVertex::event
const Event * event() const
Access to the source track object (constant case)
Definition: MyVertex.h:70
Gaudi::TestSuite::MyVertex::setMotherParticle
void setMotherParticle(MyTrack *mother)
Set mother track.
Definition: MyVertex.h:110
Gaudi::TestSuite::Collision
Definition: Collision.h:26
Gaudi::TestSuite::Event
Definition: Event.h:37
StreamBuffer
Definition: StreamBuffer.h:52
Gaudi::TestSuite::MyVertex::y
float y() const
Accessors: Retrieve y-component of the track momentum.
Definition: MyVertex.h:59
Gaudi::TestSuite::MyVertex::classID
static const CLID & classID()
Definition: MyVertex.h:55
Gaudi::TestSuite::MyVertex::z
float z() const
Accessors: Retrieve z-component of the track momentum.
Definition: MyVertex.h:61
Gaudi::TestSuite::MyVertex::clID
const CLID & clID() const override
Retrieve pointer to class definition structure.
Definition: MyVertex.h:54
KeyedContainer
template class KeyedContainer, KeyedContainer.h
Definition: KeyedContainer.h:74
Gaudi::TestSuite::MyVertex::motherParticle
const MyTrack * motherParticle() const
Mother track.
Definition: MyVertex.h:107
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
Gaudi::TestSuite::MyVertex::m_motherParticle
SmartRef< MyTrack > m_motherParticle
Link to mother track.
Definition: MyVertex.h:40
Gaudi::TestSuite::MyVertex::m_collisions
SmartRefVector< Collision > m_collisions
Vector of collisions this object belongs to.
Definition: MyVertex.h:44
Gaudi::TestSuite::MyVertex::removeCollision
void removeCollision(Collision *vtx)
Remove collision.
Definition: MyVertex.h:136
Gaudi::TestSuite::MyVertex::x
float x() const
Accessors: Retrieve x-component of the track momentum.
Definition: MyVertex.h:57
Gaudi::TestSuite::MyVertexVector
KeyedContainer< MyVertex > MyVertexVector
Definition: MyVertex.h:104
Gaudi::TestSuite::MyVertex::removeDecayParticle
void removeDecayParticle(MyTrack *vtx)
Remove decay vertex.
Definition: MyVertex.h:119
Gaudi::TestSuite::MyVertex::setY
void setY(float y)
Accessors: Update y-component of the track momentum.
Definition: MyVertex.h:65
Gaudi::TestSuite::MyVertex::addCollision
void addCollision(Collision *vtx)
Add collision.
Definition: MyVertex.h:133
SmartRef
Kernel objects: SmartRef.
Definition: SmartRef.h:76
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:81
Gaudi::TestSuite::MyVertex::m_decayParticles
SmartRefVector< MyTrack > m_decayParticles
Links to all daughter particles.
Definition: MyVertex.h:42
Gaudi::TestSuite::MyVertex::setZ
void setZ(float z)
Accessors: Update z-component of the track momentum.
Definition: MyVertex.h:67