| 1 | #include "DMM/Vertex.h"
 | 
|---|
| 2 | 
 | 
|---|
| 3 | 
 | 
|---|
| 4 | MEMPHYS::DMM::Vertex::Vertex(MEMPHYS::DMM::IDataServices& aService)   
 | 
|---|
| 5 |   :MEMPHYS::DMM::BaseData(aService)
 | 
|---|
| 6 |   ,m_position()
 | 
|---|
| 7 |   ,m_incomingPart()
 | 
|---|
| 8 |   ,m_outgoingParts()
 | 
|---|
| 9 | {
 | 
|---|
| 10 |   std::cout << "Create Vertex("<<this<<")"<<std::endl;
 | 
|---|
| 11 | }//Ctor
 | 
|---|
| 12 | //----------------------------------------------------------
 | 
|---|
| 13 | MEMPHYS::DMM::Vertex::Vertex(const MEMPHYS::DMM::Vertex& aVertex)
 | 
|---|
| 14 |   :MEMPHYS::DMM::BaseData(aVertex)
 | 
|---|
| 15 |   ,m_position(aVertex.m_position)
 | 
|---|
| 16 |   ,m_incomingPart(aVertex.m_incomingPart)
 | 
|---|
| 17 |   ,m_outgoingParts(aVertex.m_outgoingParts)
 | 
|---|
| 18 | {
 | 
|---|
| 19 |   std::cout << "Copy Create Vertex("<<this<<") from ("<< &aVertex <<")" <<std::endl;
 | 
|---|
| 20 | }//CCtor
 | 
|---|
| 21 | //----------------------------------------------------------
 | 
|---|
| 22 | MEMPHYS::DMM::Vertex& MEMPHYS::DMM::Vertex::operator=(const MEMPHYS::DMM::Vertex& aVertex) {
 | 
|---|
| 23 |   std::cout << "Assign ("<<&aVertex<<") to (" << this << ")" <<std::endl;
 | 
|---|
| 24 |   if (&aVertex != this) {
 | 
|---|
| 25 |     m_position = aVertex.m_position;
 | 
|---|
| 26 |     m_incomingPart = aVertex.m_incomingPart;
 | 
|---|
| 27 |     m_outgoingParts = aVertex.m_outgoingParts;
 | 
|---|
| 28 |   }
 | 
|---|
| 29 |   return *this;
 | 
|---|
| 30 | }//op=
 | 
|---|
| 31 | //----------------------------------------------------------
 | 
|---|
| 32 | void* MEMPHYS::DMM::Vertex::cast(const std::string& aClass) const {
 | 
|---|
| 33 |   if(aClass=="Slash::Store::IStorable") {
 | 
|---|
| 34 |     return (void*)static_cast<const Slash::Store::IStorable*>(this);
 | 
|---|
| 35 |   } else if(aClass=="MEMPHYS::DMM::Vertex") {
 | 
|---|
| 36 |     return (void*)static_cast<const MEMPHYS::DMM::Vertex*>(this);
 | 
|---|
| 37 |   } else if(aClass=="MEMPHYS:DMM::BaseData") {
 | 
|---|
| 38 |     return (void*)static_cast<const MEMPHYS::DMM::BaseData*>(this);
 | 
|---|
| 39 |   } else {
 | 
|---|
| 40 |     return 0;
 | 
|---|
| 41 |   }  
 | 
|---|
| 42 | }//cast
 | 
|---|
| 43 | //----------------------------------------------------------
 | 
|---|
| 44 | bool  MEMPHYS::DMM::Vertex::visit(Slash::Store::IConstVisitor&) const {
 | 
|---|
| 45 |   return true;
 | 
|---|
| 46 | }//visit
 | 
|---|
| 47 | //----------------------------------------------------------
 | 
|---|
| 48 | bool MEMPHYS::DMM::Vertex::read(Slash::Store::IVisitor&) {
 | 
|---|
| 49 |   return true;
 | 
|---|
| 50 | }//read
 | 
|---|
| 51 | //----------------------------------------------------------
 | 
|---|
| 52 | void MEMPHYS::DMM::Vertex::dump(std::ostream& f,
 | 
|---|
| 53 |                                const std::string& option) {
 | 
|---|
| 54 |   MEMPHYS::DMM::BaseData::dump(f,option);
 | 
|---|
| 55 |   m_position->dump(f,option);
 | 
|---|
| 56 |   if(!m_incomingPart) {
 | 
|---|
| 57 |     f << "Incoming Particle" << std::endl;
 | 
|---|
| 58 |     m_incomingPart->dump(f,option);
 | 
|---|
| 59 |   } else {
 | 
|---|
| 60 |     f << "Primary vertex" << std::endl;
 | 
|---|
| 61 |   }
 | 
|---|
| 62 |   if (!m_outgoingParts.empty()) {
 | 
|---|
| 63 |     Particle::VecOfSharedPtr::iterator ip;
 | 
|---|
| 64 |     f << m_outgoingParts.size() << " Outgoing Particles" << std::endl;
 | 
|---|
| 65 |     for (ip = m_outgoingParts.begin(); ip != m_outgoingParts.end(); ++ip ) {
 | 
|---|
| 66 |       (*ip)->dump(f,option);
 | 
|---|
| 67 |     }
 | 
|---|
| 68 |   } else {
 | 
|---|
| 69 |     f << "No outgoing particles" << std::endl;
 | 
|---|
| 70 |   }
 | 
|---|
| 71 | }//dump 
 | 
|---|
| 72 | 
 | 
|---|
| 73 | 
 | 
|---|