EDepSimVertexInfo.cc
Go to the documentation of this file.
1 #include <G4PrimaryVertex.hh>
2 
3 #include "EDepSimVertexInfo.hh"
4 
6  : fInformationalVertex(NULL),
7  fInteractionNumber(0), fCrossSection(0.0), fDiffCrossSection(0.0),
8  fWeight(1.0), fProbability(1.0) {}
9 
11  if (fInformationalVertex != NULL) delete fInformationalVertex;
12 }
13 
14 const G4PrimaryVertex* EDepSim::VertexInfo::GetInformationalVertex(G4int i) const {
15  if (i == 0) {
16  return fInformationalVertex;
17  }
18  if (i<0) return NULL;
19  const G4PrimaryVertex* infoVertex = fInformationalVertex;
20  for (int j=0; j < i; j++) {
21  if (infoVertex == NULL) return NULL;
22  infoVertex = infoVertex->GetNext();
23  }
24  return infoVertex;
25 }
26 
27 void EDepSim::VertexInfo::AddInformationalVertex(G4PrimaryVertex* vtx) {
28  if (!fInformationalVertex) {
29  fInformationalVertex = vtx;
30  }
31  else {
32  fInformationalVertex->SetNext(vtx);
33  }
34 }
35 
37  int number = 0;
38  const G4PrimaryVertex* infoVertex = fInformationalVertex;
39  for (int j=0; j < 1000; j++) {
40  if (infoVertex == NULL) return number;
41  ++number;
42  infoVertex = infoVertex->GetNext();
43  }
44  return number;
45 }
virtual void AddInformationalVertex(G4PrimaryVertex *vtx)
Add an informational vertex to this event.
G4PrimaryVertex * fInformationalVertex
virtual int GetNumberOfInformationalVertex() const
Return the number of informational vertices.
virtual const G4PrimaryVertex * GetInformationalVertex(int i=0) const