spradlin / WCSim

The WCSim GEANT4 application
0 stars 0 forks source link

Examining IWCD geometries #32

Open spradlin opened 1 year ago

spradlin commented 1 year ago

There is an open discussion on the MR for IWCD geometries https://github.com/WCSim/WCSim/pull/355. Some points with which i might be able to help:

  1. The geometries trip one of the IMPOSSIBLE GEOMETRY checks,
  2. There are overlaps found in the new geometries when built and run with the cmake option WCSim_Geometry_Overlaps_CHECK.

Note that the current changes to src/WCSimConstructCylinder.cc are only additions of logical skin surfaces, which cannot have introduced new overlaps. My guess is that there are some dimension definitions based on assumptions that are different from their use in the geometry construction.

I am working in docker container. My starting point is a copy of the branch https://github.com/kmtsui/WCSim/tree/IWCD/update_geom that has been rebased to the current head of https://github.com/WCSim/WCSim/tree/develop.

spradlin commented 1 year ago

Overlaps

I am seeing three overlaps reported by the GEANT4 overlap check for the IWCD_mPMT geometry:

Checking overlaps for volume WCPMTsupport2 ...
-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : GeomVol1002
      issued by : G4PVPlacement::CheckOverlaps()
Overlap with mother volume !
          Overlap is detected for volume WCPMTsupport2
          with its mother volume WCPMT 
          at mother local point (31.2945,-32.9422,311.235), overlapping by at least: 32.5279 um 
NOTE: Reached maximum fixed number -1- of overlaps reports for this volume !
*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------
Checking overlaps for volume WCTopCapBlackSheet ...
-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : GeomVol1002
      issued by : G4PVPlacement::CheckOverlaps()
Overlap with mother volume !
          Overlap is detected for volume WCTopCapBlackSheet
          with its mother volume WCTopCapPolygon
          at mother local point (-508.473,-3520,0.913103), overlapping by at least: 86.8967 um
NOTE: Reached maximum fixed number -1- of overlaps reports for this volume !
*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------
Checking overlaps for volume WCBotCapBlackSheet ...
-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : GeomVol1002
      issued by : G4PVPlacement::CheckOverlaps()
Overlap with mother volume !
          Overlap is detected for volume WCBotCapBlackSheet
          with its mother volume WCBotCapPolygon
          at mother local point (-3663.97,49.7096,-0.988959), overlapping by at least: 7.80696 um 
NOTE: Reached maximum fixed number -1- of overlaps reports for this volume !
*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------
spradlin commented 1 year ago

Impossible Geometry messages

I am seeing impossible geometry messages for the IWCD_mPMT geometry in for each endcap blacksheet:

IMPOSSIBLE GEOMETRY:  z profile array of WCTopCapBlackSheet should  be monotonic.  Computed values:
    capBlackSheetZ[0] = 20
                 Z[1] = 0
                 Z[2] = 0
                 Z[3] = 1
IMPOSSIBLE GEOMETRY:  z profile array of WCBotCapBlackSheet should  be monotonic.  Computed values:
    capBlackSheetZ[0] = -20
                 Z[1] = 0
                 Z[2] = 0
                 Z[3] = -1

These are likely related to/the cause of two of the geometry overlaps.

spradlin commented 1 year ago

Endcap blacksheet arithmetic

The context of the IMPOSSIBLE GEOMETRY failure is WCSimConstructCylinder.cc L1842-L1860:

  1842    G4double capBlackSheetZ[4] = {-WCBlackSheetThickness*zflip, 0., 0.,
  1843                                                                  (WCBarrelPMTOffset - (WCIDRadius-innerAnnulusRadius)) *zflip};
    :
  1851    if(capBlackSheetZ[0] * capBlackSheetZ[3] > 0.) {
  1852      G4cerr << "IMPOSSIBLE GEOMETRY:  z profile array of " << capbsname
  1853             << " should  be monotonic.  Computed values:"
    :
  1860    }

For the IWCD_mPMT geometry, WCSimDetectorConstruction::WCBlackSheetThickness is set to 2.0cm (20mm) in WCSimDetectorConfigs.cc L1256. There shouldn't be any proble with that. The problem is that (WCBarrelPMTOffset - (WCIDRadius-innerAnnulusRadius)) is negative. That is, WCBarrelPMTOffset is too small to accommodate both the clearance required for the endcap PMTs and the bevel that mates with the barrel.

The value of 1mm is suggestive. There are some 1mm fudge factors in there that might be throwing the arithmetic off.

Continuing with the arithmetic, track down the terms.

WCBarrelPMTOffset

It is set in WCSimDetectorConfigs.cc to the value of mPMT_vessel_tot_height, which is a local variable computed as

  1237          G4double mPMT_vessel_tot_height = mPMT_vessel_radius + mPMT_vessel_cyl_height;

WCIDRadius

It's just WCSimDetectorConstruction::WCIDDiameter/2, where WCSimDetectorConstruction::WCIDDiameter is set in WCSimDetectorConfigs.cc.

innerAnnulusRadius

Because the IWCD_mPMT has hybrid=false, so we are in one of the two situations in WCSimConstructCylinder.cc L106-L109:

   106          if(mPMT_vessel_cyl_height + mPMT_vessel_radius < 1.*mm)
   107            innerAnnulusRadius = WCIDRadius - WCPMTExposeHeight -1.*mm;
   108          else
   109            innerAnnulusRadius = WCIDRadius - (mPMT_vessel_cyl_height + mPMT_vessel_radius) -1.*mm;

From WCSimDetectorConfigs.cc,

  1222          mPMT_vessel_cyl_height = 38.*CLHEP::mm;    //option A, option B would be 277 mm
  1223          mPMT_vessel_radius_curv = 342.*CLHEP::mm;  //needs to include the vessel thickness, as we construct from outside inwards.
  1224          mPMT_vessel_radius = 254.*CLHEP::mm;

so the second clause is what is used.

Arithmetic

WCIDRadius - innerAnnulusRadius = (mPMT_vessel_cyl_height + mPMT_vessel_radius)  + 1.*mm

WCBarrelPMTOffset = mPMT_vessel_radius + mPMT_vessel_cyl_height

(WCBarrelPMTOffset - (WCIDRadius-innerAnnulusRadius)) = -1mm

Proposed fix

Add the 1mm fudge factor to WCBarrelPMTOffset.

In my testing, this does nullify the IMPOSSIBLE GEOMETRY warnings and fixes both endcap blacksheet overlaps.

spradlin commented 1 year ago

Visualization of WCPMT

Looking at the WCPMT assembly in the IWCD_mPMT geometry to look into the overlap of the WCPMTsupport2 volume with its containing volume.

IWCD_mPMT_pmt_0000

The four sub-volumes shown in image above:

  1. Transparent red: The containing volume WCPMT. All other subvolumes should be within it.
  2. Transparent yellow: The support volume WCPMTsupport2.
  3. Solid green: The PMT glass face volume IWCD_mPMT-glassFaceWCPMT
  4. Solid blue: The reflector volume reflectorWCPMT

It looks like the radius of WCPMTsupport2 might be greater than that of WCPMT by a small amount.

spradlin commented 1 year ago

Well, there's your problem

Ugh, the dimensions of WCPMTsupport2 are hardcoded.

The comments above the hardcoded values appear to define relations from which the values can be derived from configuration variables. Will need to check and update.

Ugh, there are hardcoded magic numbers throughout the PMT reflector construction. This will take some effort to understand and properly generalize.