Problem 2379

Summary: World volume size messenger behaves differently depending upon when the absorber size is changed
Product: Examples/Extended Reporter: alexander.howard
Component: electromagnetic/TestEM5Assignee: Vladimir.Ivantchenko
Status: RESOLVED FIXED    
Severity: minor    
Priority: P4    
Version: 10.7   
Hardware: All   
OS: All   

Description alexander.howard 2021-06-04 15:13:32 CEST
The World Volume messenger fails to set the change the size of the world if the chosen value is smaller than the default absorber and the command is issued before changing the absorber size.

For example:

/testem/det/setAbsThick 1.0 mm
/testem/det/setAbsYZ 10.0 mm
/testem/det/setWorldX 1.1 mm
/testem/det/setWorldYZ 15 mm

/run/initialize

Gives different results to:

/testem/det/setWorldX 1.1 mm
/testem/det/setWorldYZ 15 mm
/testem/det/setAbsThick 1.0 mm
/testem/det/setAbsYZ 10.0 mm

/run/initialize

The following method inside DetectorConstruction.cc is at fault:

void DetectorConstruction::ComputeGeomParameters()
{
  // Compute derived parameters of the calorimeter
  fXstartAbs = fXposAbs-0.5*fAbsorberThickness; 
  fXendAbs   = fXposAbs+0.5*fAbsorberThickness;

  G4double xmax = std::max(std::abs(fXstartAbs), std::abs(fXendAbs));
     
  // change world size by the flag or if the absorber is large 
  if (fDefaultWorld || 2*xmax >=  fWorldSizeX ||
      fAbsorberSizeYZ >= fWorldSizeYZ) 
    {
      fWorldSizeX = 3*xmax; 
      fWorldSizeYZ= 1.2*fAbsorberSizeYZ;
    }         
}

It gets triggered after the set world command, but is applying limits from the default absorber, unless absorber size is set first.

This could either be documented, or the world volume could be automatically set to 10% bigger than the absorber with a minimum of 2 mm bigger to accommodate back splash.
Comment 1 Vladimir.Ivantchenko 2021-12-03 12:37:34 CET
Hi Alex,

the example was fixed for 11.0.

Vladimir
Comment 2 Vladimir.Ivantchenko 2021-12-03 12:38:08 CET
Forget to say, thank you for the report!