| 1 | #include "DMM/MCParticle.h"
 | 
|---|
| 2 | 
 | 
|---|
| 3 | 
 | 
|---|
| 4 | MEMPHYS::DMM::MCParticle::MCParticle(MEMPHYS::DMM::IDataServices& aService)   
 | 
|---|
| 5 |   :MEMPHYS::DMM::Particle(aService)
 | 
|---|
| 6 |   ,m_isPrimary(false)
 | 
|---|
| 7 |   ,m_startTime(0.)
 | 
|---|
| 8 | {
 | 
|---|
| 9 |   std::cout << "Create MCParticle("<<this<<")"<<std::endl;
 | 
|---|
| 10 | }//Ctor
 | 
|---|
| 11 | //----------------------------------------------------------
 | 
|---|
| 12 | MEMPHYS::DMM::MCParticle::MCParticle(const MEMPHYS::DMM::MCParticle& aMCParticle)
 | 
|---|
| 13 |   :MEMPHYS::DMM::Particle(aMCParticle)
 | 
|---|
| 14 |   ,m_isPrimary(aMCParticle.m_isPrimary)
 | 
|---|
| 15 |   ,m_startTime(aMCParticle.m_startTime)
 | 
|---|
| 16 | {
 | 
|---|
| 17 |   std::cout << "Copy Create MCParticle("<<this<<") from ("<< &aMCParticle <<")" <<std::endl;
 | 
|---|
| 18 | }//CCtor
 | 
|---|
| 19 | //----------------------------------------------------------
 | 
|---|
| 20 | MEMPHYS::DMM::MCParticle& MEMPHYS::DMM::MCParticle::operator=(const MEMPHYS::DMM::MCParticle& aMCParticle) {
 | 
|---|
| 21 |   std::cout << "Assign ("<<&aMCParticle<<") to (" << this << ")" <<std::endl;
 | 
|---|
| 22 |   if (&aMCParticle != this) {
 | 
|---|
| 23 |     MEMPHYS::DMM::Particle::operator=(aMCParticle);
 | 
|---|
| 24 |     m_isPrimary = aMCParticle.m_isPrimary;
 | 
|---|
| 25 |     m_startTime = aMCParticle.m_startTime;
 | 
|---|
| 26 |   }
 | 
|---|
| 27 |   return *this;
 | 
|---|
| 28 | }//op=
 | 
|---|
| 29 | //----------------------------------------------------------
 | 
|---|
| 30 | void* MEMPHYS::DMM::MCParticle::cast(const std::string& aClass) const {
 | 
|---|
| 31 |   if(aClass=="Slash::Store::IStorable") {
 | 
|---|
| 32 |     return (void*)static_cast<const Slash::Store::IStorable*>(this);
 | 
|---|
| 33 |   } else if(aClass=="MEMPHYS::DMM::MCParticle") {
 | 
|---|
| 34 |     return (void*)static_cast<const MEMPHYS::DMM::MCParticle*>(this);
 | 
|---|
| 35 |   } else if(aClass=="MEMPHYS:DMM::Particle") {
 | 
|---|
| 36 |     return (void*)static_cast<const MEMPHYS::DMM::Particle*>(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::MCParticle::visit(Slash::Store::IConstVisitor&) const {
 | 
|---|
| 45 |   return true;
 | 
|---|
| 46 | }//visit
 | 
|---|
| 47 | //----------------------------------------------------------
 | 
|---|
| 48 | bool MEMPHYS::DMM::MCParticle::read(Slash::Store::IVisitor&) {
 | 
|---|
| 49 |   return true;
 | 
|---|
| 50 | }//read
 | 
|---|
| 51 | //----------------------------------------------------------
 | 
|---|
| 52 | void MEMPHYS::DMM::MCParticle::dump(std::ostream& f,
 | 
|---|
| 53 |                                const std::string& option) {
 | 
|---|
| 54 |   MEMPHYS::DMM::Particle::dump(f,option);
 | 
|---|
| 55 |   if(m_isPrimary) {
 | 
|---|
| 56 |     f << " primary particle ";
 | 
|---|
| 57 |   } else {
 | 
|---|
| 58 |     f << " non-primary particle ";
 | 
|---|
| 59 |   }
 | 
|---|
| 60 |   f << " Start time " << m_startTime
 | 
|---|
| 61 |     << std::endl;
 | 
|---|
| 62 | }//dump 
 | 
|---|
| 63 | 
 | 
|---|
| 64 | 
 | 
|---|