81 if(generatorName==
"tester")
83 G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
84 G4ParticleDefinition* particle
85 = particleTable->FindParticle(particleName);
86 particleGun->SetParticleDefinition(particle);
87 particleGun->SetParticlePosition(G4ThreeVector(posX,posY,posZ));
88 particleGun->SetParticleTime(648*
ns);
91 for(G4int i=0; i<nParticle; i++)
93 G4double pMag = pMomentum;
95 if(deltaP>0.)pMag = pMomentum - deltaP*(1.0 - 2.0*G4UniformRand());
98 G4double
costheta = minCos +(maxCos - minCos)*G4UniformRand();
100 G4double phi = phiStart+(phiEnd-phiStart)*G4UniformRand();
104 G4ParticleMomentum aMomentum;
105 aMomentum[0] = pMag*sintheta*
cos(phi);
106 aMomentum[1] = pMag*sintheta*
sin(phi);
109 particleGun->SetParticleMomentum(aMomentum);
110 particleGun->GeneratePrimaryVertex(anEvent);
113 else if(generatorName==
"cosmic")
115 G4cout<<
"generatorName: "<<generatorName<<G4endl;
116 G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
117 G4ParticleDefinition* particle
118 = particleTable->FindParticle(particleName);
119 G4cout<<
"particleName: "<<particleName<<G4endl;
121 particleGun->SetParticleDefinition(particle);
122 particleGun->SetParticlePosition(G4ThreeVector(posX,posY,posZ));
134 G4double pMag = h1->GetRandom()*GeV;
135 G4cout<<
"pMag: "<<pMag<<G4endl;
141 G4double theta =(Double_t)h2->GetRandom();
142 G4cout<<
"theta: "<<theta<<G4endl;
149 G4double phi = (Double_t)h3->GetRandom();
150 G4cout<<
"phi: "<<phi<<G4endl;
164 G4ParticleMomentum aMomentum;
165 aMomentum[0] = pMag*sintheta*
cos(phi);
166 aMomentum[1] = pMag*sintheta*
sin(phi);
169 particleGun->SetParticleMomentum(aMomentum);
170 particleGun->GeneratePrimaryVertex(anEvent);
173 else if(generatorName==
"genbes")
175 G4cout<<
"genbes called"<<G4endl;
179 HEPEvt=
new G4HEPEvtInterface(genbesName);
181 HEPEvt->SetParticleTime(648*
ns);
182 HEPEvt->GeneratePrimaryVertex(anEvent);