Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4MCTSimParticle Class Reference

#include <G4MCTSimParticle.hh>

Public Member Functions

 G4MCTSimParticle ()
 
 G4MCTSimParticle (std::string aname, int apcode, int atid, int ptid, const G4LorentzVector &p)
 
 G4MCTSimParticle (std::string aname, int apcode, int atid, int ptid, const G4LorentzVector &p, const G4MCTSimVertex *v)
 
virtual ~G4MCTSimParticle ()
 
 G4MCTSimParticle (const G4MCTSimParticle &right)
 
const G4MCTSimParticleoperator= (const G4MCTSimParticle &right)
 
void SetParentParticle (const G4MCTSimParticle *p)
 
G4MCTSimParticleGetParentParticle () const
 
void SetParticleName (std::string aname)
 
const std::string & GetParticleName () const
 
void SetPdgID (int id)
 
int GetPdgID () const
 
void SetTrackID (int id)
 
int GetTrackID () const
 
void SetParentTrackID (int id)
 
int GetParentTrackID () const
 
void SetPrimaryFlag (G4bool q)
 
G4bool GetPrimaryFlag () const
 
void SetMomentumAtVertex (const G4LorentzVector &p)
 
const G4LorentzVectorGetMomentumAtVertex () const
 
void SetVertex (const G4MCTSimVertex *v)
 
G4MCTSimVertexGetVertex () const
 
void SetStoreFlag (G4bool q)
 
G4bool GetStoreFlag () const
 
int AssociateParticle (G4MCTSimParticle *p)
 
int GetNofAssociatedParticles () const
 
G4MCTSimParticleGetAssociatedParticle (int i) const
 
int GetTreeLevel () const
 
void SetStoreFlagToParentTree (G4bool q=true)
 
void Print (std::ostream &ostr=std::cout, G4bool qrevorder=false) const
 
void PrintSingle (std::ostream &ostr=std::cout) const
 

Protected Attributes

G4MCTSimParticleparentParticle
 
std::vector< G4MCTSimParticle * > associatedParticleList
 
std::string name
 
int pdgID
 
int trackID
 
int parentTrackID
 
G4bool primaryFlag
 
G4LorentzVector momentumAtVertex
 
G4MCTSimVertexvertex
 
G4bool storeFlag
 

Detailed Description

Definition at line 48 of file G4MCTSimParticle.hh.

Constructor & Destructor Documentation

◆ G4MCTSimParticle() [1/4]

G4MCTSimParticle::G4MCTSimParticle ( )

Definition at line 47 of file G4MCTSimParticle.cc.

48 : parentParticle(0), pdgID(0),
50 primaryFlag(false),
51 vertex(0), storeFlag(false)
52/////////////////////////////////
53{
54}
G4MCTSimParticle * parentParticle
G4MCTSimVertex * vertex

◆ G4MCTSimParticle() [2/4]

G4MCTSimParticle::G4MCTSimParticle ( std::string  aname,
int  apcode,
int  atid,
int  ptid,
const G4LorentzVector p 
)

Definition at line 57 of file G4MCTSimParticle.cc.

60 : parentParticle(0),
61 name(aname), pdgID(apcode),
62 trackID(atid), parentTrackID(ptid),
64 vertex(0), storeFlag(false)
65///////////////////////////////////////////////////////////////
66{
67}
G4LorentzVector momentumAtVertex

◆ G4MCTSimParticle() [3/4]

G4MCTSimParticle::G4MCTSimParticle ( std::string  aname,
int  apcode,
int  atid,
int  ptid,
const G4LorentzVector p,
const G4MCTSimVertex v 
)

Definition at line 70 of file G4MCTSimParticle.cc.

74 : parentParticle(0),
75 name(aname), pdgID(apcode),
76 trackID(atid), parentTrackID(ptid),
78 vertex(const_cast<G4MCTSimVertex*>(v)), storeFlag(false)
79///////////////////////////////////////////////////////////////
80{
81}

◆ ~G4MCTSimParticle()

G4MCTSimParticle::~G4MCTSimParticle ( )
virtual

Definition at line 84 of file G4MCTSimParticle.cc.

86{
88}
std::vector< G4MCTSimParticle * > associatedParticleList

◆ G4MCTSimParticle() [4/4]

G4MCTSimParticle::G4MCTSimParticle ( const G4MCTSimParticle right)
inline

Definition at line 116 of file G4MCTSimParticle.hh.

117{
118 *this= right;
119}

Member Function Documentation

◆ AssociateParticle()

int G4MCTSimParticle::AssociateParticle ( G4MCTSimParticle p)

Definition at line 91 of file G4MCTSimParticle.cc.

93{
94 associatedParticleList.push_back(p);
95 p-> SetParentParticle(this);
96 return associatedParticleList.size();
97}
void SetParentParticle(const G4MCTSimParticle *p)

◆ GetAssociatedParticle()

G4MCTSimParticle * G4MCTSimParticle::GetAssociatedParticle ( int  i) const

Definition at line 107 of file G4MCTSimParticle.cc.

109{
110 int size= associatedParticleList.size();
111 if(i>=0 && i< size) return associatedParticleList[i];
112 else return 0;
113}

◆ GetMomentumAtVertex()

const G4LorentzVector & G4MCTSimParticle::GetMomentumAtVertex ( ) const
inline

Definition at line 171 of file G4MCTSimParticle.hh.

172{ return momentumAtVertex; }

◆ GetNofAssociatedParticles()

int G4MCTSimParticle::GetNofAssociatedParticles ( ) const

Definition at line 100 of file G4MCTSimParticle.cc.

102{
103 return associatedParticleList.size();
104}

◆ GetParentParticle()

G4MCTSimParticle * G4MCTSimParticle::GetParentParticle ( ) const
inline

Definition at line 141 of file G4MCTSimParticle.hh.

142{ return parentParticle; }

Referenced by GetTreeLevel().

◆ GetParentTrackID()

int G4MCTSimParticle::GetParentTrackID ( ) const
inline

Definition at line 165 of file G4MCTSimParticle.hh.

166{ return parentTrackID; }

◆ GetParticleName()

const std::string & G4MCTSimParticle::GetParticleName ( ) const
inline

Definition at line 147 of file G4MCTSimParticle.hh.

148{ return name; }

◆ GetPdgID()

int G4MCTSimParticle::GetPdgID ( ) const
inline

Definition at line 152 of file G4MCTSimParticle.hh.

152{ return pdgID; }

◆ GetPrimaryFlag()

G4bool G4MCTSimParticle::GetPrimaryFlag ( ) const
inline

Definition at line 160 of file G4MCTSimParticle.hh.

160{ return primaryFlag; }

◆ GetStoreFlag()

G4bool G4MCTSimParticle::GetStoreFlag ( ) const
inline

Definition at line 182 of file G4MCTSimParticle.hh.

182{ return storeFlag; }

◆ GetTrackID()

int G4MCTSimParticle::GetTrackID ( ) const
inline

Definition at line 156 of file G4MCTSimParticle.hh.

156{ return trackID; }

Referenced by G4MCTSimVertex::AddOutParticle().

◆ GetTreeLevel()

int G4MCTSimParticle::GetTreeLevel ( ) const

Definition at line 116 of file G4MCTSimParticle.cc.

118{
119 const G4MCTSimParticle* p= this;
120 int nlevel;
121 for(nlevel=1;;nlevel++) {
122 p= p-> GetParentParticle();
123 if(p==0) return nlevel;
124 }
125}
G4MCTSimParticle * GetParentParticle() const

◆ GetVertex()

G4MCTSimVertex * G4MCTSimParticle::GetVertex ( ) const
inline

Definition at line 177 of file G4MCTSimParticle.hh.

178{ return vertex; }

◆ operator=()

const G4MCTSimParticle & G4MCTSimParticle::operator= ( const G4MCTSimParticle right)
inline

Definition at line 122 of file G4MCTSimParticle.hh.

123{
125 associatedParticleList= right.associatedParticleList; // shallow copy
126
127 name= right.name;
128 pdgID= right.pdgID;
129 trackID= right.trackID;
133 vertex= right.vertex;
134
135 return *this;
136}

◆ Print()

void G4MCTSimParticle::Print ( std::ostream &  ostr = std::cout,
G4bool  qrevorder = false 
) const

Definition at line 194 of file G4MCTSimParticle.cc.

196{
197 PrintSingle(ostr);
198
199 // recursively print associated particles
200 if (!qrevorder) { // parent -> child
201 SimParticleList::const_iterator itr;
202 for(itr= associatedParticleList.begin();
203 itr!= associatedParticleList.end(); ++itr) {
204 (*itr)-> Print(ostr);
205 }
206 } else { // child -> parent
207 if(parentParticle) parentParticle-> Print(ostr, true);
208 }
209}
void Print(std::ostream &ostr=std::cout, G4bool qrevorder=false) const
void PrintSingle(std::ostream &ostr=std::cout) const

◆ PrintSingle()

void G4MCTSimParticle::PrintSingle ( std::ostream &  ostr = std::cout) const

Definition at line 139 of file G4MCTSimParticle.cc.

141{
142 std::ostringstream os;
143 char cqp=' ';
144 if(storeFlag) cqp='+';
145 os << cqp << trackID << '\0';
146 std::string stid(os.str());
147 ostr << std::setw(6) << stid;
148 //ostr << std::setw(4) << trackID;
149
150 if(primaryFlag) ostr << "*";
151 else ostr << " ";
152 ostr << "<" << std::setw(5) << parentTrackID;
153 ostr.setf(std::ios::fixed);
154 ostr << ": P("
155 << std::setw(7) << std::setprecision(3) << momentumAtVertex.x()/GeV
156 << "," << std::setw(7) << std::setprecision(3)
157 << momentumAtVertex.y()/GeV
158 << "," << std::setw(7) << std::setprecision(3)
159 << momentumAtVertex.z()/GeV
160 << "," << std::setw(7) << std::setprecision(3)
161 << momentumAtVertex.e()/GeV << ") @";
162 ostr << name << "(" << pdgID << ")";
163
164 if(vertex) {
165 ostr << " %" << vertex-> GetCreatorProcessName() << G4endl;
166
167 std::ostringstream osv;
168 char cqv=' ';
169 if(vertex->GetStoreFlag()) cqv='+';
170 osv << cqv << vertex-> GetID() << '\0';
171 std::string svid(osv.str());
172 ostr << " " << std::setw(6) << svid;
173 //ostr << " " << std::setw(4) << vertex-> GetID();
174 ostr.unsetf(std::ios::fixed);
175 ostr.setf(std::ios::scientific|std::ios::right|std::ios::showpoint);
176 ostr << "- X(" << std::setw(9) << std::setprecision(2)
177 << vertex-> GetPosition().x()/mm
178 << "," << std::setw(9) << std::setprecision(2)
179 << vertex-> GetPosition().y()/mm
180 << "," << std::setw(9) << std::setprecision(2)
181 << vertex-> GetPosition().z()/mm
182 << "," << std::setw(9) << std::setprecision(2)
183 << vertex-> GetTime()/ns << ")";
184 ostr.unsetf(std::ios::scientific);
185
186 ostr << " @" << vertex-> GetVolumeName()
187 << "-" << vertex-> GetVolumeNumber();
188 }
189 ostr << G4endl;
190
191}
#define G4endl
Definition: G4ios.hh:52
G4bool GetStoreFlag() const
#define ns
Definition: xmlparse.cc:597

◆ SetMomentumAtVertex()

void G4MCTSimParticle::SetMomentumAtVertex ( const G4LorentzVector p)
inline

Definition at line 168 of file G4MCTSimParticle.hh.

169{ momentumAtVertex= p; }

◆ SetParentParticle()

void G4MCTSimParticle::SetParentParticle ( const G4MCTSimParticle p)
inline

Definition at line 138 of file G4MCTSimParticle.hh.

139{ parentParticle= const_cast<G4MCTSimParticle*>(p); }

Referenced by AssociateParticle().

◆ SetParentTrackID()

void G4MCTSimParticle::SetParentTrackID ( int  id)
inline

Definition at line 162 of file G4MCTSimParticle.hh.

163{ parentTrackID= id; }

◆ SetParticleName()

void G4MCTSimParticle::SetParticleName ( std::string  aname)
inline

Definition at line 144 of file G4MCTSimParticle.hh.

145{ name= aname; }

◆ SetPdgID()

void G4MCTSimParticle::SetPdgID ( int  id)
inline

Definition at line 150 of file G4MCTSimParticle.hh.

150{ pdgID= id; }

◆ SetPrimaryFlag()

void G4MCTSimParticle::SetPrimaryFlag ( G4bool  q)
inline

Definition at line 158 of file G4MCTSimParticle.hh.

158{ primaryFlag= q; }

◆ SetStoreFlag()

void G4MCTSimParticle::SetStoreFlag ( G4bool  q)
inline

Definition at line 180 of file G4MCTSimParticle.hh.

180{ storeFlag= q; }

Referenced by SetStoreFlagToParentTree().

◆ SetStoreFlagToParentTree()

void G4MCTSimParticle::SetStoreFlagToParentTree ( G4bool  q = true)

Definition at line 128 of file G4MCTSimParticle.cc.

130{
131 storeFlag=q;
132 if(vertex) vertex-> SetStoreFlag(q);
133 if(primaryFlag) return;
135}
void SetStoreFlagToParentTree(G4bool q=true)
void SetStoreFlag(G4bool q)

Referenced by SetStoreFlagToParentTree().

◆ SetTrackID()

void G4MCTSimParticle::SetTrackID ( int  id)
inline

Definition at line 154 of file G4MCTSimParticle.hh.

154{ trackID= id; }

◆ SetVertex()

void G4MCTSimParticle::SetVertex ( const G4MCTSimVertex v)
inline

Definition at line 174 of file G4MCTSimParticle.hh.

175{ vertex= const_cast<G4MCTSimVertex*>(v); }

Member Data Documentation

◆ associatedParticleList

std::vector<G4MCTSimParticle*> G4MCTSimParticle::associatedParticleList
protected

◆ momentumAtVertex

G4LorentzVector G4MCTSimParticle::momentumAtVertex
protected

Definition at line 58 of file G4MCTSimParticle.hh.

Referenced by GetMomentumAtVertex(), operator=(), and SetMomentumAtVertex().

◆ name

std::string G4MCTSimParticle::name
protected

Definition at line 53 of file G4MCTSimParticle.hh.

Referenced by GetParticleName(), operator=(), and SetParticleName().

◆ parentParticle

G4MCTSimParticle* G4MCTSimParticle::parentParticle
protected

◆ parentTrackID

int G4MCTSimParticle::parentTrackID
protected

Definition at line 56 of file G4MCTSimParticle.hh.

Referenced by GetParentTrackID(), operator=(), and SetParentTrackID().

◆ pdgID

int G4MCTSimParticle::pdgID
protected

Definition at line 54 of file G4MCTSimParticle.hh.

Referenced by GetPdgID(), operator=(), and SetPdgID().

◆ primaryFlag

G4bool G4MCTSimParticle::primaryFlag
protected

◆ storeFlag

G4bool G4MCTSimParticle::storeFlag
protected

Definition at line 60 of file G4MCTSimParticle.hh.

Referenced by GetStoreFlag(), SetStoreFlag(), and SetStoreFlagToParentTree().

◆ trackID

int G4MCTSimParticle::trackID
protected

Definition at line 55 of file G4MCTSimParticle.hh.

Referenced by GetTrackID(), operator=(), and SetTrackID().

◆ vertex

G4MCTSimVertex* G4MCTSimParticle::vertex
protected

Definition at line 59 of file G4MCTSimParticle.hh.

Referenced by GetVertex(), operator=(), SetStoreFlagToParentTree(), and SetVertex().


The documentation for this class was generated from the following files: