00001
00002
00003 #include <iostream>
00004 #include "GlastEvent/MonteCarlo/McVertex.h"
00005 #include "GlastEvent/Utilities/CLHEPStreams.h"
00006
00007
00008
00009
00010
00011
00012
00013 using namespace GlastEvent;
00014
00016 StreamBuffer& McVertex::serialize( StreamBuffer& s ) const
00017 {
00018 int tmp = m_vertexType;
00019 ContainedObject::serialize(s);
00020 return s
00021 << m_subEvtID
00022 << m_initialPosition
00023 << m_finalPosition
00024 << m_timeOfFlight
00025 << tmp
00026 << m_initialFourMomentum
00027 << m_finalFourMomentum
00028 << m_mcParticle(this)
00029 << m_motherMcParticle(this)
00030 << m_daughterMcParticles(this);
00031 }
00032
00034 StreamBuffer& McVertex::serialize( StreamBuffer& s )
00035 {
00036 int tmp;
00037 ContainedObject::serialize(s);
00038 s
00039 >> m_subEvtID
00040 >> m_initialPosition
00041 >> m_finalPosition
00042 >> m_timeOfFlight
00043 >> tmp
00044 >> m_initialFourMomentum
00045 >> m_finalFourMomentum
00046 >> m_mcParticle(this)
00047 >> m_motherMcParticle(this)
00048 >> m_daughterMcParticles(this);
00049
00050 m_vertexType = originType(tmp);
00051 return s;
00052 }
00053
00055 std::ostream& McVertex::fillStream( std::ostream& s ) const
00056 {
00057 s << "class McVertex"
00058 << " (SubEvent:" << m_subEvtID << ")"
00059 << " :"
00060 << "\n initialPosition (x, y, z) = ( "
00061 << GlastEventFloatFormat( GlastEvent::width, GlastEvent::precision )
00062 << m_initialPosition.x() << ", "
00063 << GlastEventFloatFormat( GlastEvent::width, GlastEvent::precision )
00064 << m_initialPosition.y() << ", "
00065 << GlastEventFloatFormat( GlastEvent::width, GlastEvent::precision )
00066 << m_initialPosition.z() << " )"
00067 << "\n finalPosition (x, y, z) = ( "
00068 << GlastEventFloatFormat( GlastEvent::width, GlastEvent::precision )
00069 << m_finalPosition.x() << ", "
00070 << GlastEventFloatFormat( GlastEvent::width, GlastEvent::precision )
00071 << m_finalPosition.y() << ", "
00072 << GlastEventFloatFormat( GlastEvent::width, GlastEvent::precision )
00073 << m_finalPosition.z() << " )"
00074 << "\n Time of flight = "
00075 << GlastEventFloatFormat( GlastEvent::width, GlastEvent::precision )
00076 << m_timeOfFlight
00077 << "\n Initial 4-momentum (px, py, pz, E) = ( "
00078 << GlastEventFloatFormat( GlastEvent::width, GlastEvent::precision )
00079 << m_initialFourMomentum.px() << ", "
00080 << GlastEventFloatFormat( GlastEvent::width, GlastEvent::precision )
00081 << m_initialFourMomentum.py() << ", "
00082 << GlastEventFloatFormat( GlastEvent::width, GlastEvent::precision )
00083 << m_initialFourMomentum.pz() << ", "
00084 << GlastEventFloatFormat( GlastEvent::width, GlastEvent::precision )
00085 << m_initialFourMomentum.e() << " )"
00086 << "\n Final 4-momentum (px, py, pz, E) = ( "
00087 << GlastEventFloatFormat( GlastEvent::width, GlastEvent::precision )
00088 << m_finalFourMomentum.px() << ", "
00089 << GlastEventFloatFormat( GlastEvent::width, GlastEvent::precision )
00090 << m_finalFourMomentum.py() << ", "
00091 << GlastEventFloatFormat( GlastEvent::width, GlastEvent::precision )
00092 << m_finalFourMomentum.pz() << ", "
00093 << GlastEventFloatFormat( GlastEvent::width, GlastEvent::precision )
00094 << m_finalFourMomentum.e() << " )"
00095 << "\n Vertex Type = " << int(m_vertexType)
00096 << "\n Pair McParticle = " << m_mcParticle(this)
00097 << "\n Mother McParticle = " << m_motherMcParticle(this)
00098 << "\n Daughter McParticles = ";
00099 SmartRefVector<McParticle>::const_iterator it;
00100 for (it = m_daughterMcParticles.begin(); it != m_daughterMcParticles.end(); it++){
00101 s << *it << "\n ";
00102 }
00103 return s;
00104 }
00105
00106
00108 const HepPoint3D& McVertex::initialPosition () const
00109 {
00110 return m_initialPosition;
00111 }
00113 HepPoint3D& McVertex::initialPosition ()
00114 {
00115 return m_initialPosition;
00116 }
00118 void McVertex::setInitialPosition (const HepPoint3D& value)
00119 {
00120 m_initialPosition = value;
00121 }
00122
00124 const HepPoint3D& McVertex::finalPosition () const
00125 {
00126 return m_finalPosition;
00127 }
00129 HepPoint3D& McVertex::finalPosition ()
00130 {
00131 return m_finalPosition;
00132 }
00134 void McVertex::setFinalPosition (const HepPoint3D& value)
00135 {
00136 m_finalPosition = value;
00137 }
00138
00140 double McVertex::timeOfFlight () const
00141 {
00142 return m_timeOfFlight;
00143 }
00145 void McVertex::setTimeOfFlight (double value)
00146 {
00147 m_timeOfFlight = value;
00148 }
00150 McVertex::originType McVertex::vertexType () const
00151 {
00152 return m_vertexType;
00153 }
00155 void McVertex::setVertexType (McVertex::originType value)
00156 {
00157 m_vertexType = value;
00158 }
00159
00160
00162 const HepLorentzVector& McVertex::initialFourMomentum() const
00163 {
00164 return m_initialFourMomentum;
00165 }
00167 HepLorentzVector& McVertex::initialFourMomentum()
00168 {
00169 return m_initialFourMomentum;
00170 }
00172 void McVertex::setInitialFourMomentum( const HepLorentzVector& value )
00173 {
00174 m_initialFourMomentum = value;
00175 }
00176
00177
00179 const HepLorentzVector& McVertex::finalFourMomentum() const
00180 {
00181 return m_finalFourMomentum;
00182 }
00184 HepLorentzVector& McVertex::finalFourMomentum()
00185 {
00186 return m_finalFourMomentum;
00187 }
00189 void McVertex::setFinalFourMomentum( const HepLorentzVector& value )
00190 {
00191 m_finalFourMomentum = value;
00192 }
00193
00194
00196 const McParticle* McVertex::mcParticle() const
00197 {
00198 return m_mcParticle;
00199 }
00200 McParticle* McVertex::mcParticle()
00201 {
00202 return m_mcParticle;
00203 }
00205 void McVertex::setMcParticle( McParticle* value )
00206 {
00207 m_mcParticle = value;
00208 }
00209 void McVertex::setMcParticle( SmartRef<McParticle> value )
00210 {
00211 m_mcParticle = value;
00212 }
00213
00214
00216 const McParticle* McVertex::motherMcParticle() const
00217 {
00218 return m_motherMcParticle;
00219 }
00220 McParticle* McVertex::motherMcParticle()
00221 {
00222 return m_motherMcParticle;
00223 }
00224
00226 void McVertex::setMotherMcParticle( McParticle* value )
00227 {
00228 m_motherMcParticle = value;
00229 }
00230 void McVertex::setMotherMcParticle( SmartRef<McParticle> value )
00231 {
00232 m_motherMcParticle = value;
00233 }
00234
00236 const SmartRefVector<McParticle>& McVertex::daughterMcParticles() const
00237 {
00238 return m_daughterMcParticles;
00239 }
00240 SmartRefVector<McParticle>& McVertex::daughterMcParticles()
00241 {
00242 return m_daughterMcParticles;
00243 }
00244
00246 void McVertex::setDaughterMcParticles( const SmartRefVector<McParticle>& value )
00247 {
00248 m_daughterMcParticles = value;
00249 }
00250
00252 void McVertex::removeDaughterMcParticles()
00253 {
00254 m_daughterMcParticles.clear();
00255 }
00256
00259 void McVertex::addDaughterMcParticle( McParticle* value )
00260 {
00261 m_daughterMcParticles.push_back(value);
00262 }
00263 void McVertex::addDaughterMcParticle( SmartRef<McParticle> value )
00264 {
00265 m_daughterMcParticles.push_back(value);
00266 }
00267
00268
00270 short McVertex::subEvtID() const
00271 {
00272 return m_subEvtID;
00273 }
00275 void McVertex::setSubEvtID( short value )
00276 {
00277 m_subEvtID = value;
00278 }