Import Geant4 6.2.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 10:56:29 +02:00
parent 1d812b78b1
commit e083ffb441
1415 changed files with 111223 additions and 21207 deletions
+2 -2
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4Event.cc,v 1.6 2003/09/09 20:09:18 asaim Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4Event.cc,v 1.8 2004/06/11 14:11:18 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// G4Event
+6 -4
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4EventManager.cc,v 1.19 2004/03/16 00:04:30 asaim Exp $
// GEANT4 tag $Name: geant4-06-01 $
// $Id: G4EventManager.cc,v 1.20 2004/05/26 17:08:33 asaim Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
//
@@ -46,7 +46,7 @@ G4EventManager* G4EventManager::GetEventManager()
G4EventManager::G4EventManager()
:currentEvent(0),trajectoryContainer(0),
verboseLevel(0),tracking(false)
verboseLevel(0),tracking(false),abortRequested(false)
{
if(fpEventManager)
{
@@ -145,7 +145,8 @@ void G4EventManager::DoProcessing(G4Event* anEvent)
}
#endif
StackTracks( transformer->GimmePrimaries( currentEvent, trackIDCounter ),true );
if(!abortRequested)
{ StackTracks( transformer->GimmePrimaries( currentEvent, trackIDCounter ),true ); }
#ifdef G4VERBOSE
if ( verboseLevel > 0 )
@@ -252,6 +253,7 @@ void G4EventManager::DoProcessing(G4Event* anEvent)
currentEvent = 0;
stateManager->SetNewState(G4State_GeomClosed);
abortRequested = false;
}
void G4EventManager::StackTracks(G4TrackVector *trackVector,G4bool IDhasAlreadySet)
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4HEPEvtParticle.cc,v 1.5 2003/05/21 20:52:53 asaim Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4HEPEvtParticle.cc,v 1.7 2004/06/11 14:11:19 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
+2 -2
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4PrimaryParticle.cc,v 1.11 2003/09/12 21:51:34 asaim Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4PrimaryParticle.cc,v 1.13 2004/06/11 14:11:19 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
#include "G4PrimaryParticle.hh"
+2 -2
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4PrimaryVertex.cc,v 1.7 2003/09/12 21:51:34 asaim Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4PrimaryVertex.cc,v 1.9 2004/06/11 14:11:19 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
#include "G4PrimaryVertex.hh"
+607
View File
@@ -0,0 +1,607 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
///////////////////////////////////////////////////////////////////////////////
//
// MODULE: G4SPSAngDistribution.cc
//
// Version: 1.0
// Date: 5/02/04
// Author: Fan Lei
// Organisation: QinetiQ ltd.
// Customer: ESA/ESTEC
//
///////////////////////////////////////////////////////////////////////////////
//
//
// CHANGE HISTORY
// --------------
//
//
// Version 1.0, 05/02/2004, Fan Lei, Created.
// Based on the G4GeneralParticleSource class in Geant4 v6.0
//
///////////////////////////////////////////////////////////////////////////////
//
#include "Randomize.hh"
//#include <math.h>
#include "G4SPSAngDistribution.hh"
G4SPSAngDistribution::G4SPSAngDistribution()
{
// Angular distribution Variables
G4ThreeVector zero;
particle_momentum_direction = G4ParticleMomentum(0,0,-1);
AngDistType = "planar";
AngRef1 = HepXHat;
AngRef2 = HepYHat;
AngRef3 = HepZHat;
MinTheta = 0.;
MaxTheta = pi;
MinPhi = 0.;
MaxPhi = twopi;
DR = 0.;
DX = 0.;
DY = 0.;
UserDistType = "NULL";
UserWRTSurface = true;
UserAngRef = false;
IPDFThetaExist = false;
IPDFPhiExist = false;
verbosityLevel = 0 ;
}
G4SPSAngDistribution::~G4SPSAngDistribution()
{}
//
void G4SPSAngDistribution::SetAngDistType(G4String atype)
{
if(atype != "iso" && atype != "cos" && atype != "user" && atype != "planar"
&& atype != "beam1d" && atype != "beam2d")
G4cout << "Error, distribution must be iso, cos, planar, beam1d, beam2d or user" << G4endl;
else
AngDistType = atype;
if (AngDistType == "cos") MaxTheta = pi/2. ;
if (AngDistType == "user") {
UDefThetaH = IPDFThetaH = ZeroPhysVector ;
IPDFThetaExist = false ;
UDefPhiH = IPDFPhiH = ZeroPhysVector ;
IPDFPhiExist = false ;
}
}
void G4SPSAngDistribution::DefineAngRefAxes(G4String refname, G4ThreeVector ref)
{
if(refname == "angref1")
AngRef1 = ref.unit(); // x'
else if(refname == "angref2")
AngRef2 = ref.unit(); // vector in x'y' plane
// User defines x' (AngRef1) and a vector in the x'y'
// plane (AngRef2). Then, AngRef1 x AngRef2 = AngRef3
// the z' vector. Then, AngRef3 x AngRef1 = AngRef2
// which will now be y'.
AngRef3 = AngRef1.cross(AngRef2); // z'
AngRef2 = AngRef3.cross(AngRef1); // y'
UserAngRef = true ;
if(verbosityLevel == 2)
{
G4cout << "Angular distribution rotation axes " << AngRef1 << " " << AngRef2 << " " << AngRef3 << G4endl;
}
}
void G4SPSAngDistribution::SetMinTheta(G4double mint)
{
MinTheta = mint;
}
void G4SPSAngDistribution::SetMinPhi(G4double minp)
{
MinPhi = minp;
}
void G4SPSAngDistribution::SetMaxTheta(G4double maxt)
{
MaxTheta = maxt;
}
void G4SPSAngDistribution::SetMaxPhi(G4double maxp)
{
MaxPhi = maxp;
}
void G4SPSAngDistribution::SetBeamSigmaInAngR(G4double r)
{
DR = r;
}
void G4SPSAngDistribution::SetBeamSigmaInAngX(G4double r)
{
DX = r;
}
void G4SPSAngDistribution::SetBeamSigmaInAngY(G4double r)
{
DY = r;
}
void G4SPSAngDistribution::UserDefAngTheta(G4ThreeVector input)
{
if(UserDistType == "NULL") UserDistType = "theta";
if(UserDistType == "phi") UserDistType = "both";
G4double thi, val;
thi = input.x();
val = input.y();
if(verbosityLevel >= 1)
G4cout << "In UserDefAngTheta" << G4endl;
UDefThetaH.InsertValues(thi, val);
}
void G4SPSAngDistribution::UserDefAngPhi(G4ThreeVector input)
{
if(UserDistType == "NULL") UserDistType = "phi";
if(UserDistType == "theta") UserDistType = "both";
G4double phhi, val;
phhi = input.x();
val = input.y();
if(verbosityLevel >= 1)
G4cout << "In UserDefAngPhi" << G4endl;
UDefPhiH.InsertValues(phhi, val);
}
void G4SPSAngDistribution::SetUserWRTSurface(G4bool wrtSurf)
{
// This is only applied in user mode?
// if UserWRTSurface = true then the user wants momenta with respect
// to the surface normals.
// When doing this theta has to be 0-90 only otherwise there will be
// errors, which currently are flagged anywhere.
UserWRTSurface = wrtSurf;
}
void G4SPSAngDistribution::SetUseUserAngAxis(G4bool userang)
{
// if UserAngRef = true the angular distribution is defined wrt
// the user defined co-ordinates
UserAngRef = userang;
}
void G4SPSAngDistribution::GenerateBeamFlux()
{
G4double theta, phi;
G4double px, py, pz;
if (AngDistType == "beam1d")
{
theta = G4RandGauss::shoot(0.0,DR);
phi = twopi * G4UniformRand();
}
else
{
px = G4RandGauss::shoot(0.0,DX);
py = G4RandGauss::shoot(0.0,DY);
theta = sqrt (px*px + py*py);
if (theta != 0.) {
phi = acos(px/theta);
if ( py < 0.) phi = -phi;
}
else
{
phi = 0.0;
}
}
px = -sin(theta) * cos(phi);
py = -sin(theta) * sin(phi);
pz = -cos(theta);
G4double finx, finy, finz ;
finx = px, finy =py, finz =pz;
if (UserAngRef){
// Apply Angular Rotation Matrix
// x * AngRef1, y * AngRef2 and z * AngRef3
finx = (px * AngRef1.x()) + (py * AngRef2.x()) + (pz * AngRef3.x());
finy = (px * AngRef1.y()) + (py * AngRef2.y()) + (pz * AngRef3.y());
finz = (px * AngRef1.z()) + (py * AngRef2.z()) + (pz * AngRef3.z());
G4double ResMag = sqrt((finx*finx) + (finy*finy) + (finz*finz));
finx = finx/ResMag;
finy = finy/ResMag;
finz = finz/ResMag;
}
particle_momentum_direction.setX(finx);
particle_momentum_direction.setY(finy);
particle_momentum_direction.setZ(finz);
// particle_momentum_direction now holds unit momentum vector.
if(verbosityLevel >= 1)
G4cout << "Generating beam vector: " << particle_momentum_direction << G4endl;
}
void G4SPSAngDistribution::GenerateIsotropicFlux()
{
// generates isotropic flux.
// No vectors are needed.
G4double rndm, rndm2;
G4double px, py, pz;
//
G4double sintheta, sinphi,costheta,cosphi;
rndm = angRndm->GenRandTheta();
costheta = cos(MinTheta) - rndm * (cos(MinTheta) - cos(MaxTheta));
sintheta = sqrt(1. - costheta*costheta);
rndm2 = angRndm->GenRandPhi();
Phi = MinPhi + (MaxPhi - MinPhi) * rndm2;
sinphi = sin(Phi);
cosphi = cos(Phi);
px = -sintheta * cosphi;
py = -sintheta * sinphi;
pz = -costheta;
// for volume and ponit source use mother or user defined co-ordinates
// for plane and surface source user surface-normal or userdefined co-ordinates
//
G4double finx, finy, finz;
if (posDist->SourcePosType == "Point" || posDist->SourcePosType == "Volume") {
if (UserAngRef){
// Apply Rotation Matrix
// x * AngRef1, y * AngRef2 and z * AngRef3
finx = (px * AngRef1.x()) + (py * AngRef2.x()) + (pz * AngRef3.x());
finy = (px * AngRef1.y()) + (py * AngRef2.y()) + (pz * AngRef3.y());
finz = (px * AngRef1.z()) + (py * AngRef2.z()) + (pz * AngRef3.z());
} else {
finx = px;
finy = py;
finz = pz;
}
} else { // for plane and surface source
if (UserAngRef){
// Apply Rotation Matrix
// x * AngRef1, y * AngRef2 and z * AngRef3
finx = (px * AngRef1.x()) + (py * AngRef2.x()) + (pz * AngRef3.x());
finy = (px * AngRef1.y()) + (py * AngRef2.y()) + (pz * AngRef3.y());
finz = (px * AngRef1.z()) + (py * AngRef2.z()) + (pz * AngRef3.z());
} else {
finx = (px*posDist->SideRefVec1.x()) + (py*posDist->SideRefVec2.x()) + (pz*posDist->SideRefVec3.x());
finy = (px*posDist->SideRefVec1.y()) + (py*posDist->SideRefVec2.y()) + (pz*posDist->SideRefVec3.y());
finz = (px*posDist->SideRefVec1.z()) + (py*posDist->SideRefVec2.z()) + (pz*posDist->SideRefVec3.z());
}
}
G4double ResMag = sqrt((finx*finx) + (finy*finy) + (finz*finz));
finx = finx/ResMag;
finy = finy/ResMag;
finz = finz/ResMag;
particle_momentum_direction.setX(finx);
particle_momentum_direction.setY(finy);
particle_momentum_direction.setZ(finz);
// particle_momentum_direction now holds unit momentum vector.
if(verbosityLevel >= 1)
G4cout << "Generating isotropic vector: " << particle_momentum_direction << G4endl;
}
void G4SPSAngDistribution::GenerateCosineLawFlux()
{
// Method to generate flux distributed with a cosine law
G4double px, py, pz;
G4double rndm, rndm2;
//
G4double sintheta, sinphi,costheta,cosphi;
rndm = angRndm->GenRandTheta();
sintheta = sqrt( rndm * (sin(MaxTheta)*sin(MaxTheta) - sin(MinTheta)*sin(MinTheta) )
+sin(MinTheta)*sin(MinTheta) );
costheta = sqrt(1. -sintheta*sintheta);
rndm2 = angRndm->GenRandPhi();
Phi = MinPhi + (MaxPhi - MinPhi) * rndm2;
sinphi = sin(Phi);
cosphi = cos(Phi);
px = -sintheta * cosphi;
py = -sintheta * sinphi;
pz = -costheta;
// for volume and ponit source use mother or user defined co-ordinates
// for plane and surface source user surface-normal or userdefined co-ordinates
//
G4double finx, finy, finz;
if (posDist->SourcePosType == "Point" || posDist->SourcePosType == "Volume") {
if (UserAngRef){
// Apply Rotation Matrix
finx = (px * AngRef1.x()) + (py * AngRef2.x()) + (pz * AngRef3.x());
finy = (px * AngRef1.y()) + (py * AngRef2.y()) + (pz * AngRef3.y());
finz = (px * AngRef1.z()) + (py * AngRef2.z()) + (pz * AngRef3.z());
} else {
finx = px;
finy = py;
finz = pz;
}
} else { // for plane and surface source
if (UserAngRef){
// Apply Rotation Matrix
finx = (px * AngRef1.x()) + (py * AngRef2.x()) + (pz * AngRef3.x());
finy = (px * AngRef1.y()) + (py * AngRef2.y()) + (pz * AngRef3.y());
finz = (px * AngRef1.z()) + (py * AngRef2.z()) + (pz * AngRef3.z());
} else {
finx = (px*posDist->SideRefVec1.x()) + (py*posDist->SideRefVec2.x()) + (pz*posDist->SideRefVec3.x());
finy = (px*posDist->SideRefVec1.y()) + (py*posDist->SideRefVec2.y()) + (pz*posDist->SideRefVec3.y());
finz = (px*posDist->SideRefVec1.z()) + (py*posDist->SideRefVec2.z()) + (pz*posDist->SideRefVec3.z());
}
}
G4double ResMag = sqrt((finx*finx) + (finy*finy) + (finz*finz));
finx = finx/ResMag;
finy = finy/ResMag;
finz = finz/ResMag;
particle_momentum_direction.setX(finx);
particle_momentum_direction.setY(finy);
particle_momentum_direction.setZ(finz);
// particle_momentum_direction now contains unit momentum vector.
if(verbosityLevel >= 1)
{
G4cout << "Resultant cosine-law unit momentum vector " << particle_momentum_direction << G4endl;
}
}
void G4SPSAngDistribution::GeneratePlanarFlux()
{
// particle_momentum_direction now contains unit momentum vector.
// nothing need be done here as the m-directions have been set directly
// under this option
if(verbosityLevel >= 1)
{
G4cout << "Resultant Planar wave momentum vector " << particle_momentum_direction << G4endl;
}
}
void G4SPSAngDistribution::GenerateUserDefFlux()
{
G4double rndm, px, py, pz, pmag;
if(UserDistType == "NULL")
G4cout << "Error: UserDistType undefined" << G4endl;
else if(UserDistType == "theta") {
Theta = 10.;
while(Theta > MaxTheta || Theta < MinTheta)
Theta = GenerateUserDefTheta();
Phi = 10.;
while(Phi > MaxPhi || Phi < MinPhi) {
rndm = angRndm->GenRandPhi();
Phi = twopi * rndm;
}
}
else if(UserDistType == "phi") {
Theta = 10.;
while(Theta > MaxTheta || Theta < MinTheta)
{
rndm = angRndm->GenRandTheta();
Theta = acos(1. - (2. * rndm));
}
Phi = 10.;
while(Phi > MaxPhi || Phi < MinPhi)
Phi = GenerateUserDefPhi();
}
else if(UserDistType == "both")
{
Theta = 10.;
while(Theta > MaxTheta || Theta < MinTheta)
Theta = GenerateUserDefTheta();
Phi = 10.;
while(Phi > MaxPhi || Phi < MinPhi)
Phi = GenerateUserDefPhi();
}
px = -sin(Theta) * cos(Phi);
py = -sin(Theta) * sin(Phi);
pz = -cos(Theta);
pmag = sqrt((px*px) + (py*py) + (pz*pz));
if(!UserWRTSurface) {
G4double finx, finy, finz;
if (UserAngRef) {
// Apply Rotation Matrix
// x * AngRef1, y * AngRef2 and z * AngRef3
finx = (px * AngRef1.x()) + (py * AngRef2.x()) + (pz * AngRef3.x());
finy = (px * AngRef1.y()) + (py * AngRef2.y()) + (pz * AngRef3.y());
finz = (px * AngRef1.z()) + (py * AngRef2.z()) + (pz * AngRef3.z());
} else { // use mother co-ordinates
finx = px;
finy = py;
finz = pz;
}
G4double ResMag = sqrt((finx*finx) + (finy*finy) + (finz*finz));
finx = finx/ResMag;
finy = finy/ResMag;
finz = finz/ResMag;
particle_momentum_direction.setX(finx);
particle_momentum_direction.setY(finy);
particle_momentum_direction.setZ(finz);
}
else { // UserWRTSurface = true
G4double pxh = px/pmag;
G4double pyh = py/pmag;
G4double pzh = pz/pmag;
if(verbosityLevel > 1) {
G4cout <<"SideRefVecs " <<posDist->SideRefVec1<<posDist->SideRefVec2<<posDist->SideRefVec3<<G4endl;
G4cout <<"Raw Unit vector "<<pxh<<","<<pyh<<","<<pzh<<G4endl;
}
G4double resultx = (pxh*posDist->SideRefVec1.x()) + (pyh*posDist->SideRefVec2.x()) +
(pzh*posDist->SideRefVec3.x());
G4double resulty = (pxh*posDist->SideRefVec1.y()) + (pyh*posDist->SideRefVec2.y()) +
(pzh*posDist->SideRefVec3.y());
G4double resultz = (pxh*posDist->SideRefVec1.z()) + (pyh*posDist->SideRefVec2.z()) +
(pzh*posDist->SideRefVec3.z());
G4double ResMag = sqrt((resultx*resultx) + (resulty*resulty) + (resultz*resultz));
resultx = resultx/ResMag;
resulty = resulty/ResMag;
resultz = resultz/ResMag;
particle_momentum_direction.setX(resultx);
particle_momentum_direction.setY(resulty);
particle_momentum_direction.setZ(resultz);
}
// particle_momentum_direction now contains unit momentum vector.
if(verbosityLevel > 0 )
{
G4cout << "Final User Defined momentum vector " << particle_momentum_direction << G4endl;
}
}
G4double G4SPSAngDistribution::GenerateUserDefTheta()
{
// Create cumulative histogram if not already done so. Then use RandFlat
//::shoot to generate the output Theta value.
if(UserDistType == "NULL" || UserDistType == "phi")
{
// No user defined theta distribution
G4cout << "Error ***********************" << G4endl;
G4cout << "UserDistType = " << UserDistType << G4endl;
return (0.);
}
else
{
// UserDistType = theta or both and so a theta distribution
// is defined. This should be integrated if not already done.
if(IPDFThetaExist == false)
{
// IPDF has not been created, so create it
G4double bins[1024],vals[1024], sum;
G4int ii;
G4int maxbin = G4int(UDefThetaH.GetVectorLength());
bins[0] = UDefThetaH.GetLowEdgeEnergy(size_t(0));
vals[0] = UDefThetaH(size_t(0));
sum = vals[0];
for(ii=1;ii<maxbin;ii++)
{
bins[ii] = UDefThetaH.GetLowEdgeEnergy(size_t(ii));
vals[ii] = UDefThetaH(size_t(ii)) + vals[ii-1];
sum = sum + UDefThetaH(size_t(ii));
}
for(ii=0;ii<maxbin;ii++)
{
vals[ii] = vals[ii]/sum;
IPDFThetaH.InsertValues(bins[ii], vals[ii]);
}
// Make IPDFThetaExist = true
IPDFThetaExist = true;
}
// IPDF has been create so carry on
G4double rndm = G4UniformRand();
return(IPDFThetaH.GetEnergy(rndm));
}
}
G4double G4SPSAngDistribution::GenerateUserDefPhi()
{
// Create cumulative histogram if not already done so. Then use RandFlat
//::shoot to generate the output Theta value.
if(UserDistType == "NULL" || UserDistType == "theta")
{
// No user defined phi distribution
G4cout << "Error ***********************" << G4endl;
G4cout << "UserDistType = " << UserDistType << G4endl;
return(0.);
}
else
{
// UserDistType = phi or both and so a phi distribution
// is defined. This should be integrated if not already done.
if(IPDFPhiExist == false)
{
// IPDF has not been created, so create it
G4double bins[1024],vals[1024], sum;
G4int ii;
G4int maxbin = G4int(UDefPhiH.GetVectorLength());
bins[0] = UDefPhiH.GetLowEdgeEnergy(size_t(0));
vals[0] = UDefPhiH(size_t(0));
sum = vals[0];
for(ii=1;ii<maxbin;ii++)
{
bins[ii] = UDefPhiH.GetLowEdgeEnergy(size_t(ii));
vals[ii] = UDefPhiH(size_t(ii)) + vals[ii-1];
sum = sum + UDefPhiH(size_t(ii));
}
for(ii=0;ii<maxbin;ii++)
{
vals[ii] = vals[ii]/sum;
IPDFPhiH.InsertValues(bins[ii], vals[ii]);
}
// Make IPDFPhiExist = true
IPDFPhiExist = true;
}
// IPDF has been create so carry on
G4double rndm = G4UniformRand();
return(IPDFPhiH.GetEnergy(rndm));
}
}
//
void G4SPSAngDistribution::ReSetHist(G4String atype)
{
if (atype == "theta") {
UDefThetaH = IPDFThetaH = ZeroPhysVector ;
IPDFThetaExist = false ;}
else if (atype == "phi"){
UDefPhiH = IPDFPhiH = ZeroPhysVector ;
IPDFPhiExist = false ;}
else {
G4cout << "Error, histtype not accepted " << G4endl;
}
}
G4ParticleMomentum G4SPSAngDistribution::GenerateOne()
{
// Angular stuff
if(AngDistType == "iso")
GenerateIsotropicFlux();
else if(AngDistType == "cos")
GenerateCosineLawFlux();
else if(AngDistType == "planar")
GeneratePlanarFlux();
else if(AngDistType == "beam1d" || AngDistType == "beam2d" )
GenerateBeamFlux();
else if(AngDistType == "user")
GenerateUserDefFlux();
else
G4cout << "Error: AngDistType has unusual value" << G4endl;
return particle_momentum_direction;
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+565
View File
@@ -0,0 +1,565 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
///////////////////////////////////////////////////////////////////////////////
//
// MODULE: G4SPSRandomGenerator.cc
//
// Version: 1.0
// Date: 5/02/04
// Author: Fan Lei
// Organisation: QinetiQ ltd.
// Customer: ESA/ESTEC
//
///////////////////////////////////////////////////////////////////////////////
//
// CHANGE HISTORY
// --------------
//
//
// Version 1.0, 05/02/2004, Fan Lei, Created.
// Based on the G4GeneralParticleSource class in Geant4 v6.0
//
///////////////////////////////////////////////////////////////////////////////
//
#include "G4PrimaryParticle.hh"
#include "G4Event.hh"
#include "Randomize.hh"
#include <math.h>
#include "G4TransportationManager.hh"
#include "G4VPhysicalVolume.hh"
#include "G4PhysicalVolumeStore.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "G4IonTable.hh"
#include "G4Ions.hh"
#include "G4TrackingManager.hh"
#include "G4Track.hh"
#include "G4SPSRandomGenerator.hh"
//G4SPSRandomGenerator* G4SPSRandomGenerator::instance = 0;
G4SPSRandomGenerator::G4SPSRandomGenerator()
{
// Initialise all variables
// Bias variables
XBias = false;
IPDFXBias = false;
YBias = false;
IPDFYBias = false;
ZBias = false;
IPDFZBias = false;
ThetaBias = false;
IPDFThetaBias = false;
PhiBias = false;
IPDFPhiBias = false;
EnergyBias = false;
IPDFEnergyBias = false;
bweights[0] = bweights[1] = bweights[2] = bweights[3] = bweights[4] = bweights[5] = 1. ;
verbosityLevel = 0 ;
}
G4SPSRandomGenerator::~G4SPSRandomGenerator()
{}
//G4SPSRandomGenerator* G4SPSRandomGenerator::getInstance ()
//{
// if (instance == 0) instance = new G4SPSRandomGenerator();
// return instance;
//}
// Biasing methods
void G4SPSRandomGenerator::SetXBias(G4ThreeVector input)
{
G4double ehi, val;
ehi = input.x();
val = input.y();
XBiasH.InsertValues(ehi, val);
XBias = true;
}
void G4SPSRandomGenerator::SetYBias(G4ThreeVector input)
{
G4double ehi, val;
ehi = input.x();
val = input.y();
YBiasH.InsertValues(ehi, val);
YBias = true;
}
void G4SPSRandomGenerator::SetZBias(G4ThreeVector input)
{
G4double ehi, val;
ehi = input.x();
val = input.y();
ZBiasH.InsertValues(ehi, val);
ZBias = true;
}
void G4SPSRandomGenerator::SetThetaBias(G4ThreeVector input)
{
G4double ehi, val;
ehi = input.x();
val = input.y();
ThetaBiasH.InsertValues(ehi, val);
ThetaBias = true;
}
void G4SPSRandomGenerator::SetPhiBias(G4ThreeVector input)
{
G4double ehi, val;
ehi = input.x();
val = input.y();
PhiBiasH.InsertValues(ehi, val);
PhiBias = true;
}
void G4SPSRandomGenerator::SetEnergyBias(G4ThreeVector input)
{
G4double ehi, val;
ehi = input.x();
val = input.y();
EnergyBiasH.InsertValues(ehi, val);
EnergyBias = true;
}
void G4SPSRandomGenerator::ReSetHist(G4String atype)
{
if ( atype == "biasx") {
XBias = false ;
IPDFXBias = false;
XBiasH = IPDFXBiasH = ZeroPhysVector ;}
else if ( atype == "biasy") {
YBias = false ;
IPDFYBias = false;
YBiasH = IPDFYBiasH = ZeroPhysVector ;}
else if ( atype == "biasz") {
ZBias = false ;
IPDFZBias = false;
ZBiasH = IPDFZBiasH = ZeroPhysVector ;}
else if ( atype == "biast") {
ThetaBias = false ;
IPDFThetaBias = false;
ThetaBiasH = IPDFThetaBiasH = ZeroPhysVector ;}
else if ( atype == "biasp") {
PhiBias = false ;
IPDFPhiBias = false;
PhiBiasH = IPDFPhiBiasH = ZeroPhysVector ;}
else if ( atype == "biase") {
EnergyBias = false ;
IPDFEnergyBias = false;
EnergyBiasH = IPDFEnergyBiasH = ZeroPhysVector ;}
else {
G4cout << "Error, histtype not accepted " << G4endl;
}
}
G4double G4SPSRandomGenerator::GenRandX()
{
if(verbosityLevel >= 1)
G4cout << "In GenRandX" << G4endl;
if(XBias == false)
{
// X is not biased
G4double rndm = G4UniformRand();
return(rndm);
}
else
{
// X is biased
if(IPDFXBias == false)
{
// IPDF has not been created, so create it
G4double bins[1024],vals[1024], sum;
G4int ii;
G4int maxbin = G4int(XBiasH.GetVectorLength());
bins[0] = XBiasH.GetLowEdgeEnergy(size_t(0));
vals[0] = XBiasH(size_t(0));
sum = vals[0];
for(ii=1;ii<maxbin;ii++)
{
bins[ii] = XBiasH.GetLowEdgeEnergy(size_t(ii));
vals[ii] = XBiasH(size_t(ii)) + vals[ii-1];
sum = sum + XBiasH(size_t(ii));
}
for(ii=0;ii<maxbin;ii++)
{
vals[ii] = vals[ii]/sum;
IPDFXBiasH.InsertValues(bins[ii], vals[ii]);
}
// Make IPDFXBias = true
IPDFXBias = true;
}
// IPDF has been create so carry on
G4double rndm = G4UniformRand();
// Calculate the weighting: Find the bin that the determined
// rndm is in and the weigthing will be the difference in the
// natural probability (from the x-axis) divided by the
// difference in the biased probability (the area).
size_t numberOfBin = IPDFXBiasH.GetVectorLength();
G4int biasn1 = 0;
G4int biasn2 = numberOfBin/2;
G4int biasn3 = numberOfBin - 1;
while (biasn1 != biasn3 - 1) {
if (rndm > IPDFXBiasH(biasn2))
biasn1 = biasn2;
else
biasn3 = biasn2;
biasn2 = biasn1 + (biasn3 - biasn1 + 1)/2;
}
// retrieve the areas and then the x-axis values
bweights[0] = IPDFXBiasH(biasn2) - IPDFXBiasH(biasn2 - 1);
G4double xaxisl = IPDFXBiasH.GetLowEdgeEnergy(size_t(biasn2-1));
G4double xaxisu = IPDFXBiasH.GetLowEdgeEnergy(size_t(biasn2));
G4double NatProb = xaxisu - xaxisl;
//G4cout << "X Bin weight " << bweights[0] << " " << rndm << G4endl;
//G4cout << "lower and upper xaxis vals "<<xaxisl<<" "<<xaxisu<<G4endl;
bweights[0] = NatProb/bweights[0];
if(verbosityLevel >= 1)
G4cout << "X bin weight " << bweights[0] << " " << rndm << G4endl;
return(IPDFXBiasH.GetEnergy(rndm));
}
}
G4double G4SPSRandomGenerator::GenRandY()
{
if(verbosityLevel >= 1)
G4cout << "In GenRandY" << G4endl;
if(YBias == false)
{
// Y is not biased
G4double rndm = G4UniformRand();
return(rndm);
}
else
{
// Y is biased
if(IPDFYBias == false)
{
// IPDF has not been created, so create it
G4double bins[1024],vals[1024], sum;
G4int ii;
G4int maxbin = G4int(YBiasH.GetVectorLength());
bins[0] = YBiasH.GetLowEdgeEnergy(size_t(0));
vals[0] = YBiasH(size_t(0));
sum = vals[0];
for(ii=1;ii<maxbin;ii++)
{
bins[ii] = YBiasH.GetLowEdgeEnergy(size_t(ii));
vals[ii] = YBiasH(size_t(ii)) + vals[ii-1];
sum = sum + YBiasH(size_t(ii));
}
for(ii=0;ii<maxbin;ii++)
{
vals[ii] = vals[ii]/sum;
IPDFYBiasH.InsertValues(bins[ii], vals[ii]);
}
// Make IPDFYBias = true
IPDFYBias = true;
}
// IPDF has been create so carry on
G4double rndm = G4UniformRand();
size_t numberOfBin = IPDFYBiasH.GetVectorLength();
G4int biasn1 = 0;
G4int biasn2 = numberOfBin/2;
G4int biasn3 = numberOfBin - 1;
while (biasn1 != biasn3 - 1) {
if (rndm > IPDFYBiasH(biasn2))
biasn1 = biasn2;
else
biasn3 = biasn2;
biasn2 = biasn1 + (biasn3 - biasn1 + 1)/2;
}
bweights[1] = IPDFYBiasH(biasn2) - IPDFYBiasH(biasn2 - 1);
G4double xaxisl = IPDFYBiasH.GetLowEdgeEnergy(size_t(biasn2-1));
G4double xaxisu = IPDFYBiasH.GetLowEdgeEnergy(size_t(biasn2));
G4double NatProb = xaxisu - xaxisl;
bweights[1] = NatProb/bweights[1];
if(verbosityLevel >= 1)
G4cout << "Y bin weight " << bweights[1] << " " << rndm << G4endl;
return(IPDFYBiasH.GetEnergy(rndm));
}
}
G4double G4SPSRandomGenerator::GenRandZ()
{
if(verbosityLevel >= 1)
G4cout << "In GenRandZ" << G4endl;
if(ZBias == false)
{
// Z is not biased
G4double rndm = G4UniformRand();
return(rndm);
}
else
{
// Z is biased
if(IPDFZBias == false)
{
// IPDF has not been created, so create it
G4double bins[1024],vals[1024], sum;
G4int ii;
G4int maxbin = G4int(ZBiasH.GetVectorLength());
bins[0] = ZBiasH.GetLowEdgeEnergy(size_t(0));
vals[0] = ZBiasH(size_t(0));
sum = vals[0];
for(ii=1;ii<maxbin;ii++)
{
bins[ii] = ZBiasH.GetLowEdgeEnergy(size_t(ii));
vals[ii] = ZBiasH(size_t(ii)) + vals[ii-1];
sum = sum + ZBiasH(size_t(ii));
}
for(ii=0;ii<maxbin;ii++)
{
vals[ii] = vals[ii]/sum;
IPDFZBiasH.InsertValues(bins[ii], vals[ii]);
}
// Make IPDFZBias = true
IPDFZBias = true;
}
// IPDF has been create so carry on
G4double rndm = G4UniformRand();
// size_t weight_bin_no = IPDFZBiasH.FindValueBinLocation(rndm);
size_t numberOfBin = IPDFZBiasH.GetVectorLength();
G4int biasn1 = 0;
G4int biasn2 = numberOfBin/2;
G4int biasn3 = numberOfBin - 1;
while (biasn1 != biasn3 - 1) {
if (rndm > IPDFZBiasH(biasn2))
biasn1 = biasn2;
else
biasn3 = biasn2;
biasn2 = biasn1 + (biasn3 - biasn1 + 1)/2;
}
bweights[2] = IPDFZBiasH(biasn2) - IPDFZBiasH(biasn2 - 1);
G4double xaxisl = IPDFZBiasH.GetLowEdgeEnergy(size_t(biasn2-1));
G4double xaxisu = IPDFZBiasH.GetLowEdgeEnergy(size_t(biasn2));
G4double NatProb = xaxisu - xaxisl;
bweights[2] = NatProb/bweights[2];
if(verbosityLevel >= 1)
G4cout << "Z bin weight " << bweights[2] << " " << rndm << G4endl;
return(IPDFZBiasH.GetEnergy(rndm));
}
}
G4double G4SPSRandomGenerator::GenRandTheta()
{
if(verbosityLevel >= 1)
{
G4cout << "In GenRandTheta" << G4endl;
G4cout << "Verbosity " << verbosityLevel << G4endl;
}
if(ThetaBias == false)
{
// Theta is not biased
G4double rndm = G4UniformRand();
return(rndm);
}
else
{
// Theta is biased
if(IPDFThetaBias == false)
{
// IPDF has not been created, so create it
G4double bins[1024],vals[1024], sum;
G4int ii;
G4int maxbin = G4int(ThetaBiasH.GetVectorLength());
bins[0] = ThetaBiasH.GetLowEdgeEnergy(size_t(0));
vals[0] = ThetaBiasH(size_t(0));
sum = vals[0];
for(ii=1;ii<maxbin;ii++)
{
bins[ii] = ThetaBiasH.GetLowEdgeEnergy(size_t(ii));
vals[ii] = ThetaBiasH(size_t(ii)) + vals[ii-1];
sum = sum + ThetaBiasH(size_t(ii));
}
for(ii=0;ii<maxbin;ii++)
{
vals[ii] = vals[ii]/sum;
IPDFThetaBiasH.InsertValues(bins[ii], vals[ii]);
}
// Make IPDFThetaBias = true
IPDFThetaBias = true;
}
// IPDF has been create so carry on
G4double rndm = G4UniformRand();
// size_t weight_bin_no = IPDFThetaBiasH.FindValueBinLocation(rndm);
size_t numberOfBin = IPDFThetaBiasH.GetVectorLength();
G4int biasn1 = 0;
G4int biasn2 = numberOfBin/2;
G4int biasn3 = numberOfBin - 1;
while (biasn1 != biasn3 - 1) {
if (rndm > IPDFThetaBiasH(biasn2))
biasn1 = biasn2;
else
biasn3 = biasn2;
biasn2 = biasn1 + (biasn3 - biasn1 + 1)/2;
}
bweights[3] = IPDFThetaBiasH(biasn2) - IPDFThetaBiasH(biasn2 - 1);
G4double xaxisl = IPDFThetaBiasH.GetLowEdgeEnergy(size_t(biasn2-1));
G4double xaxisu = IPDFThetaBiasH.GetLowEdgeEnergy(size_t(biasn2));
G4double NatProb = xaxisu - xaxisl;
bweights[3] = NatProb/bweights[3];
if(verbosityLevel >= 1)
G4cout << "Theta bin weight " << bweights[3] << " " << rndm << G4endl;
return(IPDFThetaBiasH.GetEnergy(rndm));
}
}
G4double G4SPSRandomGenerator::GenRandPhi()
{
if(verbosityLevel >= 1)
G4cout << "In GenRandPhi" << G4endl;
if(PhiBias == false)
{
// Phi is not biased
G4double rndm = G4UniformRand();
return(rndm);
}
else
{
// Phi is biased
if(IPDFPhiBias == false)
{
// IPDF has not been created, so create it
G4double bins[1024],vals[1024], sum;
G4int ii;
G4int maxbin = G4int(PhiBiasH.GetVectorLength());
bins[0] = PhiBiasH.GetLowEdgeEnergy(size_t(0));
vals[0] = PhiBiasH(size_t(0));
sum = vals[0];
for(ii=1;ii<maxbin;ii++)
{
bins[ii] = PhiBiasH.GetLowEdgeEnergy(size_t(ii));
vals[ii] = PhiBiasH(size_t(ii)) + vals[ii-1];
sum = sum + PhiBiasH(size_t(ii));
}
for(ii=0;ii<maxbin;ii++)
{
vals[ii] = vals[ii]/sum;
IPDFPhiBiasH.InsertValues(bins[ii], vals[ii]);
}
// Make IPDFPhiBias = true
IPDFPhiBias = true;
}
// IPDF has been create so carry on
G4double rndm = G4UniformRand();
// size_t weight_bin_no = IPDFPhiBiasH.FindValueBinLocation(rndm);
size_t numberOfBin = IPDFPhiBiasH.GetVectorLength();
G4int biasn1 = 0;
G4int biasn2 = numberOfBin/2;
G4int biasn3 = numberOfBin - 1;
while (biasn1 != biasn3 - 1) {
if (rndm > IPDFPhiBiasH(biasn2))
biasn1 = biasn2;
else
biasn3 = biasn2;
biasn2 = biasn1 + (biasn3 - biasn1 + 1)/2;
}
bweights[4] = IPDFPhiBiasH(biasn2) - IPDFPhiBiasH(biasn2 - 1);
G4double xaxisl = IPDFPhiBiasH.GetLowEdgeEnergy(size_t(biasn2-1));
G4double xaxisu = IPDFPhiBiasH.GetLowEdgeEnergy(size_t(biasn2));
G4double NatProb = xaxisu - xaxisl;
bweights[4] = NatProb/bweights[4];
if(verbosityLevel >= 1)
G4cout << "Phi bin weight " << bweights[4] << " " << rndm << G4endl;
return(IPDFPhiBiasH.GetEnergy(rndm));
}
}
G4double G4SPSRandomGenerator::GenRandEnergy()
{
if(verbosityLevel >= 1)
G4cout << "In GenRandEnergy" << G4endl;
if(EnergyBias == false)
{
// Energy is not biased
G4double rndm = G4UniformRand();
return(rndm);
}
else {
// ENERGY is biased
if(IPDFEnergyBias == false) {
// IPDF has not been created, so create it
G4double bins[1024],vals[1024], sum;
G4int ii;
G4int maxbin = G4int(EnergyBiasH.GetVectorLength());
bins[0] = EnergyBiasH.GetLowEdgeEnergy(size_t(0));
vals[0] = EnergyBiasH(size_t(0));
sum = vals[0];
for(ii=1;ii<maxbin;ii++) {
bins[ii] = EnergyBiasH.GetLowEdgeEnergy(size_t(ii));
vals[ii] = EnergyBiasH(size_t(ii)) + vals[ii-1];
sum = sum + EnergyBiasH(size_t(ii));
}
for(ii=0;ii<maxbin;ii++) {
vals[ii] = vals[ii]/sum;
IPDFEnergyBiasH.InsertValues(bins[ii], vals[ii]);
}
// Make IPDFEnergyBias = true
IPDFEnergyBias = true;
}
// IPDF has been create so carry on
G4double rndm = G4UniformRand();
// size_t weight_bin_no = IPDFEnergyBiasH.FindValueBinLocation(rndm);
size_t numberOfBin = IPDFEnergyBiasH.GetVectorLength();
G4int biasn1 = 0;
G4int biasn2 = numberOfBin/2;
G4int biasn3 = numberOfBin - 1;
while (biasn1 != biasn3 - 1) {
if (rndm > IPDFEnergyBiasH(biasn2))
biasn1 = biasn2;
else
biasn3 = biasn2;
biasn2 = biasn1 + (biasn3 - biasn1 + 1)/2;
}
bweights[5] = IPDFEnergyBiasH(biasn2) - IPDFEnergyBiasH(biasn2 - 1);
G4double xaxisl = IPDFEnergyBiasH.GetLowEdgeEnergy(size_t(biasn2-1));
G4double xaxisu = IPDFEnergyBiasH.GetLowEdgeEnergy(size_t(biasn2));
G4double NatProb = xaxisu - xaxisl;
bweights[5] = NatProb/bweights[5];
if(verbosityLevel >= 1)
G4cout << "Energy bin weight " << bweights[5] << " " << rndm << G4endl;
return(IPDFEnergyBiasH.GetEnergy(rndm));
}
}
+165
View File
@@ -0,0 +1,165 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
///////////////////////////////////////////////////////////////////////////////
//
// MODULE: G4SingleParticleSource.hh
//
// Version: 1.0
// Date: 5/02/04
// Author: Fan Lei
// Organisation: QinetiQ ltd.
// Customer: ESA/ESTEC
//
///////////////////////////////////////////////////////////////////////////////
//
// CHANGE HISTORY
// --------------
//
// Version 1.0, 05/02/2004, Fan Lei, Created.
// Based on the G4GeneralParticleSource class in Geant4 v6.0
//
///////////////////////////////////////////////////////////////////////////////
//
#include "G4PrimaryParticle.hh"
#include "G4Event.hh"
#include "Randomize.hh"
#include <math.h>
#include "G4ParticleTable.hh"
#include "G4Geantino.hh"
#include "G4ParticleDefinition.hh"
#include "G4IonTable.hh"
#include "G4Ions.hh"
#include "G4TrackingManager.hh"
#include "G4Track.hh"
#include "G4SingleParticleSource.hh"
G4SingleParticleSource::G4SingleParticleSource()
{
// Initialise all variables
// Position distribution Variables
NumberOfParticlesToBeGenerated = 1;
particle_definition = G4Geantino::GeantinoDefinition();
G4ThreeVector zero;
particle_momentum_direction = G4ParticleMomentum(1,0,0);
particle_energy = 1.0*MeV;
particle_position = zero;
particle_time = 0.0;
particle_polarization = zero;
particle_charge = 0.0;
particle_weight = 1.0;
biasRndm = new G4SPSRandomGenerator();
posGenerator = new G4SPSPosDistribution();
posGenerator->SetBiasRndm(biasRndm);
angGenerator = new G4SPSAngDistribution();
angGenerator->SetPosDistribution(posGenerator);
angGenerator->SetBiasRndm(biasRndm);
eneGenerator = new G4SPSEneDistribution();
eneGenerator->SetBiasRndm(biasRndm);
// verbosity
verbosityLevel = 0;
}
G4SingleParticleSource::~G4SingleParticleSource()
{}
void G4SingleParticleSource::SetVerbosity(int vL)
{
verbosityLevel = vL;
posGenerator->SetVerbosity(vL);
angGenerator->SetVerbosity(vL);
eneGenerator->SetVerbosity(vL);
G4cout << "Verbosity Set to: " << verbosityLevel << G4endl;
}
void G4SingleParticleSource::SetParticleDefinition
(G4ParticleDefinition* aParticleDefinition)
{
particle_definition = aParticleDefinition;
particle_charge = particle_definition->GetPDGCharge();
}
void G4SingleParticleSource::GeneratePrimaryVertex(G4Event *evt)
{
if(particle_definition==NULL) return;
// Position stuff
particle_position = posGenerator->GenerateOne();
// Angular stuff
particle_momentum_direction = angGenerator->GenerateOne();
// Energy stuff
particle_energy = eneGenerator->GenerateOne(particle_definition);
// create a new vertex
G4PrimaryVertex* vertex = new G4PrimaryVertex(particle_position,particle_time);
if(verbosityLevel >= 2)
G4cout << "Creating primaries and assigning to vertex" << G4endl;
// create new primaries and set them to the vertex
G4double mass = particle_definition->GetPDGMass();
G4double energy = particle_energy + mass;
G4double pmom = sqrt(energy*energy-mass*mass);
G4double px = pmom*particle_momentum_direction.x();
G4double py = pmom*particle_momentum_direction.y();
G4double pz = pmom*particle_momentum_direction.z();
if(verbosityLevel > 1){
G4cout << "Particle name: "<<particle_definition->GetParticleName() << G4endl;
G4cout << " Energy: "<<particle_energy << G4endl;
G4cout << " Position: "<<particle_position<< G4endl;
G4cout << " Direction: "<<particle_momentum_direction << G4endl;
G4cout << " NumberOfParticlesToBeGenerated: "<<NumberOfParticlesToBeGenerated << G4endl;
}
for( G4int i=0; i<NumberOfParticlesToBeGenerated; i++ )
{
G4PrimaryParticle* particle =
new G4PrimaryParticle(particle_definition,px,py,pz);
particle->SetMass( mass );
particle->SetCharge( particle_charge );
particle->SetPolarization(particle_polarization.x(),
particle_polarization.y(),
particle_polarization.z());
vertex->SetPrimary( particle );
// Set bweight equal to the multiple of all non-zero weights
particle_weight = biasRndm->GetBiasWeight();
// now pass it to the primary vertex
vertex->SetWeight(particle_weight);
}
evt->AddPrimaryVertex( vertex );
if(verbosityLevel > 1)
G4cout << " Primary Vetex generated !"<< G4endl;
}
+2 -2
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4StackedTrack.cc,v 1.6 2003/05/21 20:52:54 asaim Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4StackedTrack.cc,v 1.8 2004/06/11 14:11:20 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
// Last Modification : 02/Feb/96 M.Asai
+2 -2
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4TrajectoryContainer.cc,v 1.2 2002/10/06 11:46:48 asaim Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4TrajectoryContainer.cc,v 1.4 2004/06/11 14:11:21 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
#include "G4TrajectoryContainer.hh"