The Gaudi Framework  master (37c0b60a)
MyTrack.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 
18 #include <GaudiTestSuite/Event.h>
19 
20 namespace Gaudi {
21  namespace TestSuite {
22 
23  // Forward declarations
24  class MyVertex;
25  template <class T>
27 
28  // CLID definition
29  static const CLID& CLID_MyTrack = 1355;
30 
38  // class MyTrack : public ContainedObject {
40 #ifdef __PLAIN_GAUDI
41  : public ContainedObject
42 #else
43  : public KeyedObject<int>
44 #endif
45  {
46  friend class GaudiObjectHandler<MyTrack>;
47 
48  public:
49  // ======================================================================
56 #ifdef __PLAIN_GAUDI
59 #else
62 #endif
63  // ======================================================================
64  protected:
66  float m_px, m_py, m_pz;
73 
74  public:
76  MyTrack();
78  MyTrack( float x, float y, float z );
79  MyTrack( const MyTrack& t );
81  ~MyTrack() override;
83  const CLID& clID() const override { return classID(); }
84  static const CLID& classID() { return CLID_MyTrack; }
86  float px() const { return m_px; }
88  float py() const { return m_py; }
90  float pz() const { return m_pz; }
92  void setPx( float px ) { m_px = px; }
94  void setPy( float py ) { m_py = py; }
96  void setPz( float pz ) { m_pz = pz; }
97 
99  const Event* event() const { return m_event; }
101  void setEvent( Event* evt ) { m_event = evt; }
103  const MyVertex* originVertex() const;
104 
106  void setOriginVertex( MyVertex* origin );
107 
109  const SmartRefVector<MyVertex>& decayVertices() const;
110 
112  void addDecayVertex( MyVertex* vtx );
113 
115  void removeDecayVertex( MyVertex* vtx );
116 
118  StreamBuffer& serialize( StreamBuffer& s ) const override;
120  StreamBuffer& serialize( StreamBuffer& s ) override;
121  };
122 
123 // Definition of all container types of MCParticle
124 #ifdef __PLAIN_GAUDI
126 #else
128 #endif
129  } // namespace TestSuite
130 } // namespace Gaudi
131 
132 #include "MyVertex.h"
133 
134 namespace Gaudi {
135  namespace TestSuite {
136 
138  inline const MyVertex* MyTrack::originVertex() const { return m_originVertex; }
139 
141  inline void MyTrack::setOriginVertex( MyVertex* origin ) { m_originVertex = origin; }
142 
145 
147  inline void MyTrack::addDecayVertex( MyVertex* vtx ) { m_decayVertices.push_back( SmartRef<MyVertex>( vtx ) ); }
148 
150  inline void MyTrack::removeDecayVertex( MyVertex* vtx ) {
152  for ( i = m_decayVertices.begin(); i != m_decayVertices.end(); ++i ) {
153  if ( i->target() == vtx ) {
154  m_decayVertices.erase( i );
155  return;
156  }
157  }
158  }
159 
162 #ifdef __PLAIN_GAUDI
164 #else
166 #endif
167  return s << m_event( this ) << m_originVertex( this ) << m_decayVertices( this ) << m_px << m_py << m_pz;
168  }
169 
172 #ifdef __PLAIN_GAUDI
174 #else
176 #endif
177  return s >> m_event( this ) >> m_originVertex( this ) >> m_decayVertices( this ) >> m_px >> m_py >> m_pz;
178  }
179  } // namespace TestSuite
180 } // namespace Gaudi
IOTest.evt
evt
Definition: IOTest.py:107
Event.h
Gaudi::TestSuite::MyTrack::m_py
float m_py
Definition: MyTrack.h:66
KeyedObject::serialize
StreamBuffer & serialize(StreamBuffer &s) const override
Serialize the object for writing.
Definition: KeyedObject.h:143
Gaudi::TestSuite::MyTrack::event
const Event * event() const
Access to the source track object (constant case)
Definition: MyTrack.h:99
ObjectVector
Definition: ContainedObject.h:22
SmartRefVector
Kernel objects: SmartRefVector.
Definition: SmartRefVector.h:79
Gaudi::TestSuite::MyTrack::px
float px() const
Accessors: Retrieve x-component of the track momentum.
Definition: MyTrack.h:86
Gaudi::TestSuite::MyTrack::m_pz
float m_pz
Definition: MyTrack.h:66
Gaudi::TestSuite::MyVertex
Definition: MyVertex.h:33
gaudirun.s
string s
Definition: gaudirun.py:346
TestSuite
#define TestSuite
Definition: MakeAndConsume.cpp:658
std::vector
STL class.
Gaudi::TestSuite::MyTrack
Definition: MyTrack.h:45
SmartRefVector.h
KeyedContainer.h
Gaudi::TestSuite::Event
Definition: Event.h:37
Gaudi::TestSuite::MyTrack::originVertex
const MyVertex * originVertex() const
Origin vertex.
Definition: MyTrack.h:138
Gaudi::TestSuite::MyTrack::setOriginVertex
void setOriginVertex(MyVertex *origin)
Set origin vertex.
Definition: MyTrack.h:141
StreamBuffer
Definition: StreamBuffer.h:52
bug_34121.t
t
Definition: bug_34121.py:31
Gaudi::TestSuite::GaudiObjectHandler
Definition: MyTrack.h:26
Gaudi::TestSuite::MyTrack::setPz
void setPz(float pz)
Accessors: Update z-component of the track momentum.
Definition: MyTrack.h:96
ObjectVector.h
Gaudi::TestSuite::MyTrack::pz
float pz() const
Accessors: Retrieve z-component of the track momentum.
Definition: MyTrack.h:90
SharedObjectsContainer
Definition: SharedObjectsContainer.h:39
KeyedContainer
template class KeyedContainer, KeyedContainer.h
Definition: KeyedContainer.h:74
Gaudi::TestSuite::MyTrack::Vector
std::vector< MyTrack * > Vector
the type of plain vector
Definition: MyTrack.h:51
CLID
unsigned int CLID
Class ID definition.
Definition: ClassID.h:18
KeyedObject
Definition of the templated KeyedObject class.
Definition: KeyedObject.h:39
Gaudi::TestSuite::MyTrack::setPy
void setPy(float py)
Accessors: Update y-component of the track momentum.
Definition: MyTrack.h:94
Gaudi::TestSuite::MyTrack::clID
const CLID & clID() const override
Retrieve pointer to class definition structure.
Definition: MyTrack.h:83
Gaudi::TestSuite::MyTrack::classID
static const CLID & classID()
Definition: MyTrack.h:84
Gaudi
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
Definition: __init__.py:1
SharedObjectsContainer.h
Gaudi::TestSuite::MyTrack::setEvent
void setEvent(Event *evt)
Access to event object.
Definition: MyTrack.h:101
Gaudi::TestSuite::MyTrack::m_decayVertices
SmartRefVector< MyVertex > m_decayVertices
Links to all decay vertices.
Definition: MyTrack.h:72
Gaudi::TestSuite::MyTrack::decayVertices
const SmartRefVector< MyVertex > & decayVertices() const
Access to decay vertices.
Definition: MyTrack.h:144
Gaudi::TestSuite::MyTrack::m_event
SmartRef< Event > m_event
Link to Top level event.
Definition: MyTrack.h:68
MyVertex.h
Gaudi::TestSuite::MyTrackVector
KeyedContainer< MyTrack > MyTrackVector
Definition: MyTrack.h:127
Gaudi::TestSuite::MyTrack::m_originVertex
SmartRef< MyVertex > m_originVertex
Link to origin vertex.
Definition: MyTrack.h:70
Gaudi::TestSuite::MyTrack::ConstVector
std::vector< const MyTrack * > ConstVector
the type of vector of const-pointers
Definition: MyTrack.h:53
Gaudi::TestSuite::MyTrack::addDecayVertex
void addDecayVertex(MyVertex *vtx)
Add decay vertex.
Definition: MyTrack.h:147
SmartRef
Kernel objects: SmartRef.
Definition: SmartRef.h:76
Gaudi::TestSuite::MyTrack::Selection
SharedObjectsContainer< MyTrack > Selection
the type of selection
Definition: MyTrack.h:55
Gaudi::TestSuite::MyTrack::py
float py() const
Accessors: Retrieve y-component of the track momentum.
Definition: MyTrack.h:88
Gaudi::TestSuite::MyTrack::m_px
float m_px
The track momentum.
Definition: MyTrack.h:66
ContainedObject.h
Gaudi::TestSuite::MyTrack::serialize
StreamBuffer & serialize(StreamBuffer &s) const override
Serialize the object for writing.
Definition: MyTrack.h:161
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:81
ContainedObject
Definition: ContainedObject.h:41
Gaudi::TestSuite::MyTrack::removeDecayVertex
void removeDecayVertex(MyVertex *vtx)
Remove decay vertex.
Definition: MyTrack.h:150
Gaudi::TestSuite::MyTrack::setPx
void setPx(float px)
Accessors: Update x-component of the track momentum.
Definition: MyTrack.h:92
ContainedObject::serialize
virtual StreamBuffer & serialize(StreamBuffer &s) const
Serialize the object for writing.
Definition: ContainedObject.h:70