Message: Very slow assignment of volumes not inside the world?? Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question Very slow assignment of volumes not inside the world?? 

Keywords: slow volume assigning when not in world
Forum: Geometry
Date: 31 Mar, 2007
From: Brad Oborn <>

Hi, I am assigning a large number (60000) of 1x1x1 mm voxels inside a larger box, which is inside the world.

for example:


G4int CopyNumber_SD_02 = 0; // The first copy number is zero//.

for ( G4int k=1; k<=10; k++) { // Cycle the Z-direction - 1 mm steps//. Z_SD_02_Vox[k]=initial_z_value_02 +(k-1)*0.1*cm;

for ( G4int j=1; j <= 10 ; j++ ){ // Cycle the Y-direction//. Y_SD_02_Vox[0] = -0.45*cm; Y_SD_02_Vox[j]=Y_SD_02_Vox[0]+(j-1)*0.1*cm;

for ( G4int i=1; i <= x_cycle_02 ; i++ ) { // Cycle the X-direction//. X_SD_02_Vox[i]=X_SD_02_Vox[0]+(i-1)*0.1*cm;

G4VPhysicalVolume* P_SD_02 = new G4PVPlacement(0, G4ThreeVector(X_SD_02_Vox[i],Y_SD_02_Vox[j],Z_SD_02_Vox[k]), 
							L_SD_02, "P_SD_02", SD_02_Logical_Mother, false, CopyNumber_SD_02);

CopyNumber_SD_02 = CopyNumber_SD_02+1;

} // End X-cycle//. } // End Y-cycle//. } // End Z-cycle//.


At run-time this process is very slow (~5 mins). If I change the mother volume of the small voxels to be the world then the process takes about 2 seconds.

Why is this process so slow if there are a large number of volumes not directly inside the world, or what am I doing wrong??

Thanks, Brad.

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 More: P.S. the problem is connected with CutsByRegion   (Brad Oborn - 01 Apr, 2007)
 Add Message Add Message
to: "Very slow assignment of volumes not inside the world??"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews

[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]