Hi @ychen871027, you are right there was
return physWorld
at the end of the code, so I added it in the for cycle in this way
for (G4int k=0; k<5; k++) {
G4VPhysicalVolume* physWorld =
new G4PVPlacement(0, //no rotation
G4ThreeVector(), //at (0,0,0)
logicWorld, //its logical volume
"World", //its name
0, //its mother volume
false, //no boolean operation
k+1, //copy number
checkOverlaps); //overlaps checking
return physWorld;
}
But I fot this warning (it means theare are some paths not returning values!
The I saw there is one other function in which there is the G4VPhysicalVolume and it is
G4LogicalVolume* logicEnv =
new G4LogicalVolume(solidEnv, //its solid
env_mat, //its material
"Envelope"); //its name
new G4PVPlacement(0, //no rotation
G4ThreeVector(), //at (0,0,0)
logicEnv, //its logical volume
"Envelope", //its name
logicWorld, //its mother volume
false, //no boolean operation
0, //copy number
checkOverlaps); //overlaps checking
so I putted it in a for cycle too in this way
new G4Box("Envelope", //its name
0.5*env_sizeXY, 0.5*env_sizeXY, 0.5*env_sizeZ); //its size
G4LogicalVolume* logicEnv =
new G4LogicalVolume(solidEnv, //its solid
env_mat, //its material
"Envelope"); //its name
for (G4int j=0; j<5; j++) {
new G4PVPlacement(0, //no rotation
G4ThreeVector(), //at (0,0,0)
logicEnv, //its logical volume
"Envelope", //its name
logicWorld, //its mother volume
false, //no boolean operation
j+1, //copy number
checkOverlaps); //overlaps checking
}
But I also get a warning
I add the B1DetectorConstruction.c file
B1DetectorConstruction.cc (9.4 KB)