Hi

I am using geant4 10.06.p02.

i want to divide a sphere into several shells with different radius.

i have used replica and G4VNestedParameterisation like i had used for Box before and it worked good.

this is my DetectorConstruction’s construct method :

G4NistManager* nist = G4NistManager::Instance();

G4Material* _world_mat = nist->FindOrBuildMaterial(“G4_Galactic”);

G4Material* _phantom_mat = nist->FindOrBuildMaterial(“G4_WATER”);

auto world_solid = new G4Box(“WORLD”,1

m,1m,1*m);auto world_logic = new G4LogicalVolume(world_solid,_world_mat,“World_logic”);

auto world_phy = new G4PVPlacement(0,G4ThreeVector(),world_logic,“World_PHYSI”,0,false,0,true);

auto sphere_solid = new G4Sphere(“sphere solid”,0,60

cm,0deg,360deg,0deg,180*deg);auto sphere_logic= new G4LogicalVolume(sphere_solid,_phantom_mat,“sphere logic”);

new G4PVPlacement(0,G4ThreeVector(0,0,0),sphere_logic,“sphere solid”,world_logic,false,0,true);

auto repSolidPhi = new G4Sphere("_SOLID",0,60

cm,0deg,36deg,0deg,180*deg);auto repLogicPhi= new G4LogicalVolume(repSolidPhi,_phantom_mat,"_LOGIC");

new G4PVReplica(“repZ”,repLogicPhi,sphere_logic,kPhi,10,36*deg);

auto repSolidR = new G4Sphere("_SOLID",0,6

cm,0deg,36deg,0deg,180*deg);auto repLogicR= new G4LogicalVolume(repSolidR,_phantom_mat,"_LOGIC");

std::vector<G4Material*> mat(2,_phantom_mat);

G4double dr=6*cm;

G4double dphi=36*deg;

G4double dtheta=180*deg;

Parameterisation* voxelpara = new Parameterisation(G4ThreeVector(dr,dphi,dtheta),(G4int)10,mat);

new G4PVParameterised(“voxel1”,repLogicR,repLogicPhi,kUndefined,(G4int)10,voxelpara);

and this is parameterization class :

Parameterisation::Parameterisation(const G4ThreeVector& voxelsize_sphere,G4int NZ_SPHERE,std::vector<G4Material*>& Mat):

G4VNestedParameterisation(),dr(voxelsize_sphere.x()),dphi(voxelsize_sphere.y()),dtheta(voxelsize_sphere.z()),nz_sphere(NZ_SPHERE),mat(Mat)

{

pz_cart.clear();

pz_sphere.clear();G4double z_sphere;

for(G4int i=0;i<nz_sphere;i++)

{

z_sphere=i*dr;

pz_sphere.push_back(z_sphere);}

}

Parameterisation::~Parameterisation(){pz_sphere.clear();pz_cart.clear();}

void Parameterisation::ComputeTransformation(const G4int copyNo,G4VPhysicalVolume* pv) const

{

G4ThreeVector origin(0,0,0/pz_cart[copyNo]/);

pv->SetTranslation(origin);

pv->SetRotation(0);

}

void Parameterisation::ComputeDimensions (G4Sphere& sphere,const G4int copyNo, const G4VPhysicalVolume*) const

{

sphere.SetInnerRadius(pz_sphere[copyNo]);

sphere.SetOuterRadius(pz_sphere[copyNo]+dr);

sphere.SetStartPhiAngle(0deg);deg);

sphere.SetDeltaPhiAngle(dphi);

sphere.SetStartThetaAngle(0

sphere.SetDeltaThetaAngle(dtheta);

}

i get this warning and it takes too long.

What is the problem?

is there any another way to divide a sphere into several shell for scoring ?