EDepSimCombinationGenerator.cc
Go to the documentation of this file.
1 #include <G4PrimaryVertex.hh>
2 #include <G4Event.hh>
3 
4 #include "EDepSimLog.hh"
5 #include "EDepSimException.hh"
7 
9  bool relative)
10  : fSource(src), fDestination(dest), fRelative(relative) { }
11 
13 
15 
16  if (fSource < 0 || fSource >= evt->GetNumberOfPrimaryVertex()) {
17  abort();
18  }
19 
20  if (fDestination < 0 || fDestination >= evt->GetNumberOfPrimaryVertex()) {
21  abort();
22  }
23 
24  G4ThreeVector src = evt->GetPrimaryVertex(fSource)->GetPosition();
25  double srcTime = evt->GetPrimaryVertex(fSource)->GetT0();
26 
27  if (fRelative) {
28  G4ThreeVector dest = evt->GetPrimaryVertex(fDestination)->GetPosition();
29  double destTime = evt->GetPrimaryVertex(fDestination)->GetT0();
30  src = src + dest;
31  srcTime = srcTime + destTime;
32  }
33 
34  evt->GetPrimaryVertex(fDestination)->SetPosition(src.x(),src.y(),src.z());
35  evt->GetPrimaryVertex(fDestination)->SetT0(srcTime);
36 
37 }
38 
40  return "combination";
41 }
int fSource
The index of the source vertex to copy from.
int fDestination
The index of the destination vertex to copy to.
virtual void GeneratePrimaryVertex(G4Event *evt)
G4String GetName()
Return the name of this generator.
static TemplateFilterFactory::AutoRegister< FilterRelative > fRelative("relative")
CombinationGenerator(int src, int dest, bool relative)
TCEvent evt
Definition: DataStructs.cxx:7