// $Header: /tmp/svngaudi/tmp.jEpFh25751/Gaudi/GaudiPoolDb/test/MyVertex.h,v 1.4 2005/01/28 09:28:19 mato Exp $ #ifndef GAUDIPOOLDB_TEST_MYVERTEX_H #define GAUDIPOOLDB_TEST_MYVERTEX_H // Include files #include "GaudiKernel/KeyedObject.h" #include "GaudiKernel/KeyedContainer.h" #include "GaudiKernel/SmartRefVector.h" #include "Event.h" // Forward declarations class MyTrack; // CLID definition static const CLID& CLID_MyVertex = 356; #ifdef __SCHEMA_CHANGE__ namespace MyHEP { class FloatPoint { public: /// The track momentum float m_x, m_y, m_z; FloatPoint () {} ~FloatPoint() {} }; } typedef MyHEP::FloatPoint MyHepPoint; #else class MyHepPoint { public: /// The track momentum float m_x, m_y, m_z; MyHepPoint () {} ~MyHepPoint() {} }; #endif /** @class MyVertex * * Simple class that represents a vertex for testing purposes * * @author Markus Frank */ class MyVertex : public KeyedObject { protected: /// The vertex location MyHepPoint m_v; /// Link to Top level event SmartRef m_event; /// Link to mother track SmartRef m_motherParticle; /// Links to all daughter particles SmartRefVector m_decayParticles; /// Vector of collisions this object belongs to SmartRefVector m_collisions; public: /// Standard constructor MyVertex(); /// Standard constructor MyVertex(float x, float y, float z); /// Standard Destructor virtual ~MyVertex(); /// Retrieve pointer to class definition structure virtual const CLID& clID() const { return MyVertex::classID(); } static const CLID& classID() { return CLID_MyVertex; } /// Accessors: Retrieve x-component of the track momentum float x() const { return m_v.m_x; } /// Accessors: Retrieve y-component of the track momentum float y() const { return m_v.m_y; } /// Accessors: Retrieve z-component of the track momentum float z() const { return m_v.m_z; } /// Accessors: Update x-component of the track momentum void setX(float x) { m_v.m_x = x; } /// Accessors: Update y-component of the track momentum void setY(float y) { m_v.m_y = y; } /// Accessors: Update z-component of the track momentum void setZ(float z) { m_v.m_z = z; } /// Access to the source track object (constant case) const Event* event() const { return m_event; } /// Access to event object void setEvent(Event* evt) { m_event = evt; } /// Mother track const MyTrack* motherParticle() const; /// Set mother track void setMotherParticle(MyTrack* mother); /// Access to decay particles const SmartRefVector& decayParticles() const; /// Add decay particle void addDecayParticle(MyTrack* track); /// Remove decay vertex void removeDecayParticle(MyTrack* vtx); /// Access to collisions const SmartRefVector& collisions() const; /// Add collision void addCollision(Collision* vtx); /// Remove collision void removeCollision(Collision* vtx); /// Serialize the object for writing virtual StreamBuffer& serialize( StreamBuffer& s ) const; /// Serialize the object for reading virtual StreamBuffer& serialize( StreamBuffer& s ); }; // Definition of all container types of MCParticle typedef KeyedContainer MyVertexVector; #include "MyTrack.h" /// Mother particle inline const MyTrack* MyVertex::motherParticle() const { return m_motherParticle; } /// Set origin vertex inline void MyVertex::setMotherParticle(MyTrack* mother) { m_motherParticle = mother; } /// Access to decay vertices inline const SmartRefVector& MyVertex::decayParticles() const { return m_decayParticles; } /// Add decay vertex inline void MyVertex::addDecayParticle(MyTrack* p) { m_decayParticles.push_back(SmartRef(p)); } /// Remove decay vertex inline void MyVertex::removeDecayParticle(MyTrack* p) { SmartRefVector::iterator i; for(i=m_decayParticles.begin(); i != m_decayParticles.end(); ++i) { if ( i->target() == p ) { m_decayParticles.erase(i); return; } } } /// Access to decay vertices inline const SmartRefVector& MyVertex::collisions() const { return m_collisions; } /// Add decay vertex inline void MyVertex::addCollision(Collision* c) { m_collisions.push_back(SmartRef(c)); } /// Remove decay vertex inline void MyVertex::removeCollision(Collision* c) { SmartRefVector::iterator i; for(i=m_collisions.begin(); i != m_collisions.end(); ++i) { if ( i->target() == c ) { m_collisions.erase(i); return; } } } #endif // GAUDIPOOLDB_TEST_MYTRACK_H