| 1 | #include "DMM/Particle.h"
 | 
|---|
| 2 | 
 | 
|---|
| 3 | 
 | 
|---|
| 4 | MEMPHYS::DMM::Particle::Particle(MEMPHYS::DMM::IDataServices& aService)   
 | 
|---|
| 5 |   :MEMPHYS::DMM::BaseData(aService)
 | 
|---|
| 6 |   ,m_PDGId(0)
 | 
|---|
| 7 |   ,m_momentum()
 | 
|---|
| 8 |   ,m_prodPoint()
 | 
|---|
| 9 |   ,m_endPoint()
 | 
|---|
| 10 | {
 | 
|---|
| 11 |   std::cout << "Create Particle("<<this<<")"<<std::endl;
 | 
|---|
| 12 | }//Ctor
 | 
|---|
| 13 | //----------------------------------------------------------
 | 
|---|
| 14 | MEMPHYS::DMM::Particle::Particle(const MEMPHYS::DMM::Particle& aParticle)
 | 
|---|
| 15 |   :MEMPHYS::DMM::BaseData(aParticle)
 | 
|---|
| 16 |   ,m_PDGId(aParticle.m_PDGId)
 | 
|---|
| 17 |   ,m_momentum(aParticle.m_momentum)
 | 
|---|
| 18 |   ,m_prodPoint(aParticle.m_prodPoint)
 | 
|---|
| 19 |   ,m_endPoint(aParticle.m_endPoint)
 | 
|---|
| 20 | {
 | 
|---|
| 21 |   std::cout << "Copy Create Particle("<<this<<") from ("<< &aParticle <<")" <<std::endl;
 | 
|---|
| 22 | }//CCtor
 | 
|---|
| 23 | //----------------------------------------------------------
 | 
|---|
| 24 | MEMPHYS::DMM::Particle& MEMPHYS::DMM::Particle::operator=(const MEMPHYS::DMM::Particle& aParticle) {
 | 
|---|
| 25 |   std::cout << "Assign ("<<&aParticle<<") to (" << this << ")" <<std::endl;
 | 
|---|
| 26 |   if (&aParticle != this) {
 | 
|---|
| 27 |     m_PDGId = aParticle.m_PDGId;
 | 
|---|
| 28 |     m_momentum = aParticle.m_momentum;
 | 
|---|
| 29 |     m_prodPoint = aParticle.m_prodPoint;
 | 
|---|
| 30 |     m_endPoint = aParticle.m_endPoint;
 | 
|---|
| 31 |   }
 | 
|---|
| 32 |   return *this;
 | 
|---|
| 33 | }//op=
 | 
|---|
| 34 | //----------------------------------------------------------
 | 
|---|
| 35 | void* MEMPHYS::DMM::Particle::cast(const std::string& aClass) const {
 | 
|---|
| 36 |   if(aClass=="Slash::Store::IStorable") {
 | 
|---|
| 37 |     return (void*)static_cast<const Slash::Store::IStorable*>(this);
 | 
|---|
| 38 |   } else if(aClass=="MEMPHYS::DMM::Particle") {
 | 
|---|
| 39 |     return (void*)static_cast<const MEMPHYS::DMM::Particle*>(this);
 | 
|---|
| 40 |   } else if(aClass=="MEMPHYS:DMM::BaseData") {
 | 
|---|
| 41 |     return (void*)static_cast<const MEMPHYS::DMM::BaseData*>(this);
 | 
|---|
| 42 |   } else {
 | 
|---|
| 43 |     return 0;
 | 
|---|
| 44 |   }  
 | 
|---|
| 45 | }//cast
 | 
|---|
| 46 | //----------------------------------------------------------
 | 
|---|
| 47 | bool  MEMPHYS::DMM::Particle::visit(Slash::Store::IConstVisitor&) const {
 | 
|---|
| 48 |   return true;
 | 
|---|
| 49 | }//visit
 | 
|---|
| 50 | //----------------------------------------------------------
 | 
|---|
| 51 | bool MEMPHYS::DMM::Particle::read(Slash::Store::IVisitor&) {
 | 
|---|
| 52 |   return true;
 | 
|---|
| 53 | }//read
 | 
|---|
| 54 | //----------------------------------------------------------
 | 
|---|
| 55 | void MEMPHYS::DMM::Particle::dump(std::ostream& f,
 | 
|---|
| 56 |                                const std::string& option) {
 | 
|---|
| 57 |   MEMPHYS::DMM::BaseData::dump(f,option);
 | 
|---|
| 58 |   f << " PDG code " << m_PDGId
 | 
|---|
| 59 |     << " mass " << m_momentum[4] << ", "
 | 
|---|
| 60 |     << " Etot " << m_momentum[3] << "\n "
 | 
|---|
| 61 |     << "(px,py,pz) " 
 | 
|---|
| 62 |     << m_momentum[0] << ", "
 | 
|---|
| 63 |     << m_momentum[1] << ", "
 | 
|---|
| 64 |     << m_momentum[2] << ", "
 | 
|---|
| 65 |     << std::endl;
 | 
|---|
| 66 |   f << " Production Point: ";
 | 
|---|
| 67 |   m_prodPoint->dump(f,option);
 | 
|---|
| 68 |   if (!m_endPoint) {
 | 
|---|
| 69 |     f << " End/Decay Point: ";
 | 
|---|
| 70 |     m_endPoint->dump(f,option);
 | 
|---|
| 71 |   }
 | 
|---|
| 72 | }//dump 
 | 
|---|
| 73 | 
 | 
|---|
| 74 | 
 | 
|---|