Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4MCTSimParticle Class Reference

#include <G4MCTSimParticle.hh>

Collaboration diagram for G4MCTSimParticle:

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::G4MCTSimParticle ( )

Definition at line 47 of file G4MCTSimParticle.cc.

48  : parentParticle(0), pdgID(0),
49  trackID(0), parentTrackID(0),
50  primaryFlag(false),
51  vertex(0), storeFlag(false)
53 {
54 }
G4MCTSimParticle * parentParticle
G4MCTSimVertex * vertex
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),
63  primaryFlag(false),momentumAtVertex(p),
64  vertex(0), storeFlag(false)
66 {
67 }
G4MCTSimParticle * parentParticle
G4LorentzVector momentumAtVertex
G4MCTSimVertex * vertex
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),
77  primaryFlag(false),momentumAtVertex(p),
78  vertex(const_cast<G4MCTSimVertex*>(v)), storeFlag(false)
80 {
81 }
G4MCTSimParticle * parentParticle
G4LorentzVector momentumAtVertex
G4MCTSimVertex * vertex
G4MCTSimParticle::~G4MCTSimParticle ( )
virtual

Definition at line 84 of file G4MCTSimParticle.cc.

86 {
87  associatedParticleList.clear();
88 }
std::vector< G4MCTSimParticle * > associatedParticleList
G4MCTSimParticle::G4MCTSimParticle ( const G4MCTSimParticle right)
inline

Definition at line 116 of file G4MCTSimParticle.hh.

117 {
118  *this= right;
119 }

Member Function Documentation

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)
std::vector< G4MCTSimParticle * > associatedParticleList

Here is the call graph for this function:

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 }
std::vector< G4MCTSimParticle * > associatedParticleList
const G4LorentzVector & G4MCTSimParticle::GetMomentumAtVertex ( ) const
inline

Definition at line 171 of file G4MCTSimParticle.hh.

172 { return momentumAtVertex; }
G4LorentzVector momentumAtVertex
int G4MCTSimParticle::GetNofAssociatedParticles ( ) const

Definition at line 100 of file G4MCTSimParticle.cc.

102 {
103  return associatedParticleList.size();
104 }
std::vector< G4MCTSimParticle * > associatedParticleList
G4MCTSimParticle * G4MCTSimParticle::GetParentParticle ( ) const
inline

Definition at line 141 of file G4MCTSimParticle.hh.

142 { return parentParticle; }
G4MCTSimParticle * parentParticle

Here is the caller graph for this function:

int G4MCTSimParticle::GetParentTrackID ( ) const
inline

Definition at line 165 of file G4MCTSimParticle.hh.

166 { return parentTrackID; }
const std::string & G4MCTSimParticle::GetParticleName ( ) const
inline

Definition at line 147 of file G4MCTSimParticle.hh.

148 { return name; }
int G4MCTSimParticle::GetPdgID ( ) const
inline

Definition at line 152 of file G4MCTSimParticle.hh.

152 { return pdgID; }
G4bool G4MCTSimParticle::GetPrimaryFlag ( ) const
inline

Definition at line 160 of file G4MCTSimParticle.hh.

160 { return primaryFlag; }
G4bool G4MCTSimParticle::GetStoreFlag ( ) const
inline

Definition at line 182 of file G4MCTSimParticle.hh.

182 { return storeFlag; }
int G4MCTSimParticle::GetTrackID ( ) const
inline

Definition at line 156 of file G4MCTSimParticle.hh.

156 { return trackID; }

Here is the caller graph for this function:

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 }
const char * p
Definition: xmltok.h:285
G4MCTSimParticle * GetParentParticle() const

Here is the call graph for this function:

G4MCTSimVertex * G4MCTSimParticle::GetVertex ( ) const
inline

Definition at line 177 of file G4MCTSimParticle.hh.

178 { return vertex; }
G4MCTSimVertex * vertex
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;
131  primaryFlag= right.primaryFlag;
133  vertex= right.vertex;
134 
135  return *this;
136 }
const XML_Char * name
Definition: expat.h:151
G4MCTSimParticle * parentParticle
G4LorentzVector momentumAtVertex
G4MCTSimVertex * vertex
std::vector< G4MCTSimParticle * > associatedParticleList
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 PrintSingle(std::ostream &ostr=std::cout) const
void Print(std::ostream &ostr=std::cout, G4bool qrevorder=false) const
G4MCTSimParticle * parentParticle
std::vector< G4MCTSimParticle * > associatedParticleList
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 }
const XML_Char * name
Definition: expat.h:151
static constexpr double mm
Definition: G4SIunits.hh:115
G4bool GetStoreFlag() const
G4LorentzVector momentumAtVertex
G4MCTSimVertex * vertex
static constexpr double GeV
Definition: G4SIunits.hh:217
#define G4endl
Definition: G4ios.hh:61
#define ns
Definition: xmlparse.cc:614
void G4MCTSimParticle::SetMomentumAtVertex ( const G4LorentzVector p)
inline

Definition at line 168 of file G4MCTSimParticle.hh.

169 { momentumAtVertex= p; }
const char * p
Definition: xmltok.h:285
G4LorentzVector momentumAtVertex
void G4MCTSimParticle::SetParentParticle ( const G4MCTSimParticle p)
inline

Definition at line 138 of file G4MCTSimParticle.hh.

139 { parentParticle= const_cast<G4MCTSimParticle*>(p); }
const char * p
Definition: xmltok.h:285
G4MCTSimParticle * parentParticle

Here is the caller graph for this function:

void G4MCTSimParticle::SetParentTrackID ( int  id)
inline

Definition at line 162 of file G4MCTSimParticle.hh.

163 { parentTrackID= id; }
void G4MCTSimParticle::SetParticleName ( std::string  aname)
inline

Definition at line 144 of file G4MCTSimParticle.hh.

145 { name= aname; }
const XML_Char * name
Definition: expat.h:151
void G4MCTSimParticle::SetPdgID ( int  id)
inline

Definition at line 150 of file G4MCTSimParticle.hh.

150 { pdgID= id; }
void G4MCTSimParticle::SetPrimaryFlag ( G4bool  q)
inline

Definition at line 158 of file G4MCTSimParticle.hh.

158 { primaryFlag= q; }
void G4MCTSimParticle::SetStoreFlag ( G4bool  q)
inline

Definition at line 180 of file G4MCTSimParticle.hh.

180 { storeFlag= q; }

Here is the caller graph for this function:

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 SetStoreFlag(G4bool q)
void SetStoreFlagToParentTree(G4bool q=true)
G4MCTSimParticle * parentParticle
G4MCTSimVertex * vertex

Here is the call graph for this function:

void G4MCTSimParticle::SetTrackID ( int  id)
inline

Definition at line 154 of file G4MCTSimParticle.hh.

154 { trackID= id; }
void G4MCTSimParticle::SetVertex ( const G4MCTSimVertex v)
inline

Definition at line 174 of file G4MCTSimParticle.hh.

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

Member Data Documentation

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

Definition at line 51 of file G4MCTSimParticle.hh.

G4LorentzVector G4MCTSimParticle::momentumAtVertex
protected

Definition at line 58 of file G4MCTSimParticle.hh.

std::string G4MCTSimParticle::name
protected

Definition at line 53 of file G4MCTSimParticle.hh.

G4MCTSimParticle* G4MCTSimParticle::parentParticle
protected

Definition at line 50 of file G4MCTSimParticle.hh.

int G4MCTSimParticle::parentTrackID
protected

Definition at line 56 of file G4MCTSimParticle.hh.

int G4MCTSimParticle::pdgID
protected

Definition at line 54 of file G4MCTSimParticle.hh.

G4bool G4MCTSimParticle::primaryFlag
protected

Definition at line 57 of file G4MCTSimParticle.hh.

G4bool G4MCTSimParticle::storeFlag
protected

Definition at line 60 of file G4MCTSimParticle.hh.

int G4MCTSimParticle::trackID
protected

Definition at line 55 of file G4MCTSimParticle.hh.

G4MCTSimVertex* G4MCTSimParticle::vertex
protected

Definition at line 59 of file G4MCTSimParticle.hh.


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