G4OpBoundaryProcess : thin photocathode + anti-reflective coating transfer-matrix method A,R,T,D calculation

G4OpBoundaryProcess with thin photocathode/anti-reflective coating transfer-matrix method A,R,T,E calculation

Simon C Blyth, IHEP, CAS — Geant4 Technical Forum : Boundary Process Customization — 15 Feb 2024


Custom4 : Custom Boundary Multi-Layer Thin Film (A,R,T)+E TMM Calc

Custom4/Custom4_README.png

https://github.com/simoncblyth/customgeant4/


FewPMT_demo.png

Natural 2 volume PMT geometry : HAMA and NNVT


G4OpBoundaryProcess : customized for JUNO PMT Optical Model (POM)

Custom Boundary Process : Advantages

Old FastSim POM 4 Solid, 4 LV, 4 PV
Custom Boundary POM 2 Solid, 2 LV, 2 PV

Disadvantages

Advantages far outweigh disadvantages
  • JUNOSW MERGED May 25, 2023

https://github.com/simoncblyth/customgeant4/


C4OpBoundaryProcess::PostStepDoIt : 3-way (A,R,T) Customization

G4OpBoundaryProcess unless OpticalSurfaceNam[0] == '@'/'#'

if( OpticalSurfaceName0 == '@' || OpticalSurfaceName0 == '#' )
{
    if( m_custom_art->local_z(aTrack) < 0. ) // Lower hemi : Standard
    {
        m_custom_status = 'Z' ;
    }
    else if( OpticalSurfaceName0 == '@') // MultiFilm ART POM
    {
        m_custom_status = 'Y' ;
        m_custom_art->doIt(aTrack, aStep) ;

        type = dielectric_dielectric ;
        theModel = glisur ;
        theFinish = polished ;
    }
    else if( OpticalSurfaceName0 == '#' ) // Traditional POM
    {
        m_custom_status = '-' ;

        type = dielectric_metal ;
        theModel = glisur ;
        theReflectivity = 0. ;
        theTransmittance = 0. ;
        theEfficiency = 1. ;
    }
}

DielectricDielectric expects 2-way (theReflectivity,theTransmittance) => so C4CustomART.h rescales 3-way (A,R,T)

(theAbsorption,theReflectivity,theTransmittance) <= (A, R/(1-A), T/(1-A))


custom4/C4CustomART.h : include into C4OpBoundaryProcess.cc

#include "C4IPMTAccessor.h"
#include "C4MultiLayrStack.h"
#include "C4Touchable.h"

struct C4CustomART {
    const C4IPMTAccessor* accessor ; 
    G4double& theAbsorption ;   // doIt sets these
    G4double& theReflectivity ;
    G4double& theTransmittance ;
    G4double& theEfficiency ;

    const G4ThreeVector& theGlobalPoint ;
    const G4ThreeVector& OldMomentum ;
    const G4ThreeVector& OldPolarization ;
    const G4ThreeVector& theRecoveredNormal ;
    const G4double& thePhotonMomentum ;

    C4CustomART(
        const C4IPMTAccessor* accessor,
        G4double& theAbsorption,
        G4double& theReflectivity,
        G4double& theTransmittance,
        G4double& theEfficiency,
        const G4ThreeVector& theGlobalPoint,
        const G4ThreeVector& OldMomentum,
        const G4ThreeVector& OldPolarization,
        const G4ThreeVector& theRecoveredNormal,
        const G4double& thePhotonMomentum
    );
    double local_z( const G4Track& aTrack );
    void doIt(const G4Track& aTrack, const G4Step& aStep ); 
};

https://github.com/simoncblyth/customgeant4/blob/main/C4CustomART.h


Low dependency access to PMT data from anywhere

Full PMT access from Custom4 + Opticks without Svc : How ?

  1. Add PMTSimParamData "core" to PMTSimParamSvc
    • consistent by design from any source file/DB/Frontier/...
  2. Add PMTAccessor impl. of protocol base C4IPMTAccessor
    • header only impl + serialization => PMT data anywhere
    • => liberate PMT data from monolith

SimSvc/PMTSimParamSvc/PMTSimParamSvc/PMTAccessor.h

#include "C4IPMTAccessor.h"
struct PMTAccessor : public C4IPMTAccessor
{
    PMTAccessor(const PMTSimParamData* data);
    int    get_num_lpmt() const ;
    double get_pmtid_qe( int pmtid, double energy ) const ;
    ...

Pure virtual protocol base : Custom4/C4IPMTAccessor.h

struct C4IPMTAccessor   // only standard types in API
{
    virtual int    get_num_lpmt() const = 0 ;
    virtual double get_pmtid_qe( int pmtid, double energy ) const = 0 ;
    virtual double get_qescale( int pmtid ) const = 0 ;
    ...

Consistent PMT data access : JUNOSW + Opticks + Custom4


CUDA equivalent of C4CustomART::doIt : With Full LPMT info

JSW:PMTSimParamSvc
fills PMTSimParamData from file/DB/frontier/...
JSW:PMTSimParamData (added in MR 126)
data "core" of PMTSimParamSvc
JSW:_PMTSimParamData (added in MR 126)
serialize PMTSimParamData into Opticks NPFold.h/NP.hh
sysrap/SPMT.h
_PMTSimParamData NPFold => summary arrays
qudarap/QPMT.hh
  • upload PMT summary arrays to GPU
  • QProp.hh/qprop.h interpolation setup (RINDEX,KINDEX)
  • instanciates qpmt.h instance and uploads
qudarap/qpmt.h
  • provides PMT info, TMM calc to qsim.h
  • includes Custom4 : C4MultiLayrStack.h
  • qpmt::get_lpmtid_ARTE

https://bitbucket.org/simoncblyth/opticks/src/master/qudarap/qpmt.h


LayrTest__R12860_QPMT_Test.png


LayrTest__R12860_Aspa.png


LayrTest__R12860_Rspa.png


LayrTest__R12860_Tspa.png


Comparing AOI scans : j/Layr/LayrTest.sh

CFLayrTest
 a :              LayrTest : scan__R12860__cpu_thr_double
 b :              LayrTest : scan__R12860__cpu_thr_float
 c :              LayrTest : scan__R12860__gpu_thr_double
 d :              LayrTest : scan__R12860__gpu_thr_float
 e :             SPMT_test : sscan
 f :              QPMTTest : qscan
 g :         QPMT_MockTest : qscan
 h :             QPMT_Test : qscan

## tab, rst = ts.cf_table(tt, pmtcat, excl=excl) # excl 0.05
## rst
+------------------------------+----------+----------+----------+----------+----------+----------+----------+----------+
|          R12860 art\comp 0.05|     a:ctd|     b:ctf|     c:gtd|     d:gtf|        e:|        f:|        g:|        h:|
+==============================+==========+==========+==========+==========+==========+==========+==========+==========+
|                         a:ctd|         0| 4.829e-05| 1.066e-14| 4.829e-05| 8.644e-05| 3.422e-05| 4.255e-05| 3.685e-05|
+------------------------------+----------+----------+----------+----------+----------+----------+----------+----------+
|                         b:ctf| 9.317e-07|         0| 4.829e-05| 5.722e-06| 4.578e-05|  5.15e-05|  5.15e-05| 5.531e-05|
+------------------------------+----------+----------+----------+----------+----------+----------+----------+----------+
|                         c:gtd| 1.582e-15| 9.317e-07|         0| 4.829e-05| 8.644e-05| 3.422e-05| 4.255e-05| 3.685e-05|
+------------------------------+----------+----------+----------+----------+----------+----------+----------+----------+
|                         d:gtf| 7.958e-07| 8.792e-07| 7.958e-07|         0| 4.196e-05| 5.341e-05| 5.722e-05| 5.913e-05|
+------------------------------+----------+----------+----------+----------+----------+----------+----------+----------+
|                            e:| 2.956e-06| 3.159e-06| 2.956e-06|  3.07e-06|         0| 5.341e-05|  5.15e-05| 4.959e-05|
+------------------------------+----------+----------+----------+----------+----------+----------+----------+----------+
|                            f:| 3.094e-06| 3.338e-06| 3.094e-06| 3.159e-06| 1.192e-06|         0| 1.335e-05| 9.537e-06|
+------------------------------+----------+----------+----------+----------+----------+----------+----------+----------+
|                            g:| 2.956e-06| 3.159e-06| 2.956e-06|  3.07e-06| 7.451e-07| 1.103e-06|         0| 7.629e-06|
+------------------------------+----------+----------+----------+----------+----------+----------+----------+----------+
|                            h:| 2.907e-06| 3.248e-06| 2.907e-06| 2.921e-06| 7.451e-07| 8.941e-07| 8.419e-07|         0|
+------------------------------+----------+----------+----------+----------+----------+----------+----------+----------+

Largest differences between ART (9, 900, 4, 4) from various tests (float,double,GPU,CPU,mock-CPU,standalone...)