11 #include <G4StateManager.hh> 12 #include <G4RunManager.hh> 13 #include <G4VPrimaryGenerator.hh> 14 #include <Randomize.hh> 33 for (
int finiteLoop = 0; finiteLoop<1000; ++finiteLoop) {
39 (*generator)->GeneratePrimaryVertex(anEvent);
44 <<
"Ran out of primaries will filling event.");
48 G4RunManager::GetRunManager()->AbortRun();
55 G4PrimaryVertex* theVertex =
56 new G4PrimaryVertex(G4ThreeVector(1
E+20, 1
E+20, 1
E+20),
58 anEvent->AddPrimaryVertex(theVertex);
60 G4ParticleTable* particleTable
61 = G4ParticleTable::GetParticleTable();
62 G4ParticleDefinition* def = particleTable->FindParticle(
"geantino");
63 G4PrimaryParticle* part
64 =
new G4PrimaryParticle(def,0.0, 0.0, 1.0);
65 theVertex->SetPrimary(part);
68 if (anEvent->GetNumberOfPrimaryVertex()>0)
break;
70 EDepSimError(
"EDepSim::UserPrimaryGeneratorAction::GeneratePrimaries():" 71 <<
" Event generated without any primary verticies.");
#define EDepSimLog(outStream)
EDepSim::UserPrimaryGeneratorMessenger * fMessenger
The messenger for this action.
UserPrimaryGeneratorAction(void)
EDepSim::PrimaryGenerator * CreateGenerator()
Create a new generator using the current generator factories.
virtual ~UserPrimaryGeneratorAction()
void AddGenerator(G4VPrimaryGenerator *generator)
#define EDepSimThrow(message)
Print an error message, and then throw an exception.
void ClearGenerators()
Clear the current list of generators.
virtual void GeneratePrimaries(G4Event *anEvent)
#define EDepSimError(outStream)
#define EDepSimWarn(outStream)
std::vector< G4VPrimaryGenerator * > fPrimaryGenerators