Project

General

Profile

larg4

Introduction

larg4 is the replacement for larsim/LArG4. larg4 is based on artg4tk (see also the artg4tk wiki: Artg4tk). artg4tk provides a general interface between Geant4 and art. It started with artg4 which was developed by the g-2 experiment. artg4tk was extended to make it usable as a general framework for generic detector R&D where the detector and physics configurations can easily be changed at run-time by modifying the gdml detector description file and/or the fcl file. As will be described later we extended the Geometry Description Markup Language (GDML). artg4tk makes use of the latest Geant4 developments like the physics list factory and physics constructors. The larg4 repository contains the components that depend on the various components of larsoft and povides sensitive detectors that are used by the LArTPC community. This sensitive detectors are SimEnergyDepositSD, LArPhotonSD and AuxDetSD. In addition the MCTruthEventAction_service ParticleListAction_service have been ported so they can be used by larg4Main_module. The core of artg4tk just depends on art and Geant4 and therefore can be used independently. artg4tk provides a library of predefined sensitive detectors: e.g. TrackerSD, PhotonDetectorSD, CalorimeterSD, dual read out calorimeterSD, etc.. for more details about these see the artg4tk wiki: (Artg4tk) This sensitive detectors are enabled by assigning them to a logical volume in the gdml file. larg4 only does the Geant4 simulation! Digitization and detector response like the drift of electrons and optical photon lookup are independent modules which act on data objects added to the event by larg4 like SimEnergyDeposit, AuxdetHit and PhotonHit. This way it is e.g. easy to plug in different models handling the correlations between ionization and Scintillation (e.g. Nest) or to switch the drift model.

Defining the physics

This is described in the artg4tk Wiki: Artg4tk

GDML

Introduction and Extensions

We use the Geometry Description Markup Language (GDML):
  • to define geometry, material properties, optical properties etc.
  • we make use of formulae and loops to keep the gdml file compact and human readable
  • to assign optical surfaces
We use two ways of extending gdml:
  1. making use of the gdml <auxiliary> tag:
    • to assign sensitive detectors of predefined type to logical volumes. This will automatically trigger the creation and filling of the appropriate hit collections that are then written out in the art event stream. The combination of the logical volume name and the copy number assigned when placing a copy of the logical volume provides a unique ID that can be used for channel mapping.
    • to assign electric fields.
    • to assign step limits to specific volumes. This is e.g. important to match the Geant4 step length to the readout pitch of a liquid Ar TPC.
  2. extending the xml schema:

Changes to the experimental gdml files

The gdml subdirectory of the larg4 repository provides example gdml files that demonstrate the use of gdml and the extensions we are using. E.g. the file lArDet_split.gdml shown below shows a detector setup. We have added comments to the file to point out where we make use of extensions. In the larg4 repository we only include examples relevant to LAr TPCs the general artg4tk repository contains many more examples.

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE gdml [ 
<!ENTITY materials SYSTEM "materials.xml">
]>
<!-- below we insert the schema to demonstrate a simple extension of the gdml schema which allows to select visualization properties like color and visualization to gdml -->
<gdml_simple_extension xmlns:gdml_simple_extension="http://www.example.org" 
                       xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"          
                       xs:noNamespaceSchemaLocation="SimpleExtension.xsd"> 

    <extension>
        <color name="magenta"     R="0.0"  G="1.0"  B="0.0"  A="1.0" />
        <color name="green"       R="0.0"  G="1.0"  B="0.0"  A="1.0" />
        <color name="red"         R="1.0"  G="0.0"  B="0.0"  A="1.0" />
        <color name="blue"        R="0.0"  G="0.0"  B="1.0"  A="1.0" />
        <color name="yellow"      R="1.0"  G="1.0"  B="0.0"  A="1.0" />    
    </extension>

 <!-- the content of the materials.xml file will be included here. This file summarizes the material and optical properties of liquid Ar. -->
 &materials; 

    <solids>
        <box name="WorldBox" lunit="cm" x="100" y="100" z="410"/>
        <box name="CalorimeterCell"  lunit="mm" x="cellsize" y="cellsize" z="cellsize"/>
        <tube name="Cryostat"  lunit="cm" z="100.0" rmax="40." deltaphi="TWOPI" aunit="rad" />
        <tube name="ArgonVolume"  lunit="cm" z="99.0" rmax="39.5" deltaphi="TWOPI" aunit="rad" />
        <box name="PhotoBox"  lunit="cm" x="10.0" y="0.03" z="90.0"/>
        <box name="PaddleBox"  lunit="cm" x="20.0" y="5." z=".5"/>
        <box name="TPCVolume"  lunit="cm" x="40" y="40" z="90"/>
        <tube name="t1000"  lunit="cm" z="90.0" rmax="0.01" deltaphi="TWOPI" aunit="rad" />
        <opticalsurface name="surf" model="glisur" finish="polished" type="dielectric_metal" value="1.0">
            <property name="REFLECTIVITY" ref="REFLECTIVITY" />
        </opticalsurface>
    </solids>
    <structure>
<!--
 the line 
 <auxiliary auxtype="SensDet" auxvalue="Calorimeter"/>
declares that we want to attach a sensitive detector of type Calorimeter to the logical volume CalorimeterVolume. The volume represent one cell of the calorimeter we will be constructing later on. All physical copies (calorimeter cells will be sensitive and will produce CalorimeterHits that are added to the event. 
The volumes will be visualized as red wire frames.  
-->
        <volume name="CalorimeterVolume">
            <materialref ref="PbF2"/>
            <solidref ref="CalorimeterCell"/>
            <auxiliary auxtype="SensDet" auxvalue="Calorimeter"/>
            <colorref ref="red"/> 
        </volume>
 <!-- this are the scintilator paddles defining the beam. We are attaching  AuxDet sensitive detectors and each paddle is shown in solid blue-->  
        <volume name="Paddle">
            <materialref ref="G4_PLEXIGLASS"/>
            <solidref ref="PaddleBox"/>
            <auxiliary auxtype="SensDet" auxvalue="AuxDet"/>
            <auxiliary auxtype="Solid" auxvalue="True"/>
            <colorref ref="blue"/>    
        </volume> 
<!-- in the following we define a Sense wire and then use loops and formula to define a plane made of sense wires-->
        <volume name="SenseWire">
            <materialref ref="G4_W"/>
            <solidref ref="t1000"/>
            <colorref ref="green"/> 
        </volume>   
        <volume name="volTPCActiveInner">
            <materialref ref="LAr"/>
            <solidref ref="TPCVolume"/>
            <loop for="i" from="0" to="num" step="1">
                <physvol name="psenseWireVolume">
                    <volumeref ref="SenseWire"/>
                    <position name="posijk"  unit="mm" x="-200.0+(i+1)*5." y="-199.8" z="0"/>
                </physvol>
            </loop>
<!-- In the following we declare that we want to assign a sensitive detector of type SimEnergyDeposit to the active liquid Ar TPC volume. To match 
the Geant4 steps to the TPC read out pitch we set the step limit in this volume to 100 microns. 
The electric field  while set is not used later. 
The volume will be shown as a blue wire frame.  --> 
            <auxiliary auxtype="SensDet" auxvalue="SimEnergyDeposit"/>
            <auxiliary auxtype="StepLimit" auxvalue="0.01"/>
            <auxiliary auxtype="Efield" auxvalue="1000."/>
            <colorref ref="blue"/>
        </volume>
<!-- In the following we declare that we want to assign a sensitive detector of type PhotonDetector to the volume. 
The volume will be shown as a red solid.  --> 
        <volume name="volPhotodetector">
            <materialref ref="Silicon"/>
            <solidref ref="PhotoBox"/>
            <auxiliary auxtype="SensDet" auxvalue="PhotonDetector"/>
            <auxiliary auxtype="Solid" auxvalue="True"/>
            <colorref ref="red"/> 
        </volume>
        <volume name="volArgon">
            <materialref ref="LAr"/>
            <solidref ref="ArgonVolume"/>
            <physvol name="pCalorimeterVolume">
                <volumeref ref="volTPCActiveInner"/>
                <position name="Calpos" x="0" y="0" z="0"/>
            </physvol>
            <physvol name="pvolPhotodetector">
                <volumeref ref="volPhotodetector"/>
                <position name="photondetectorpos" unit="mm" x="0" y="391." z="0"/>
            </physvol>
        </volume>
        <volume name="volCryostat">
            <materialref ref="Iron"/>
            <solidref ref="Cryostat"/>
            <physvol name="pArgonVolume">
                <volumeref ref="volArgon"/>
                <position name="Argonpos" x="0" y="0" z="0"/>
            </physvol>
            <colorref ref="yellow"/> 
        </volume>
        <volume name="TOP">
            <materialref ref="G4_AIR"/>
            <solidref ref="WorldBox"/>
            <physvol name="pCryostatVolume" copynumber="0">
                <volumeref ref="volCryostat"/>
                <position name="Cryopos" x="0" y="0" z="0"/>
            </physvol>
            <physvol name="pPaddle1" copynumber="1">
                <volumeref ref="Paddle"/>
                <position name="Paddlepos1" unit="cm" x="0" y="0" z="-70."/>
            </physvol>
            <physvol name="pPaddle2" copynumber="2">
                <volumeref ref="Paddle"/>
                <position name="Paddlepos3" unit="cm" x="0" y="0" z="-71."/>
                <rotation name="rotatebyz3" z="HALFPI"/>
            </physvol>
            <physvol name="pPaddle3" copynumber="3">
                <volumeref ref="Paddle"/>
                <position name="Paddlepos2" unit="cm" x="0" y="0" z="70."/>
            </physvol>
            <physvol name="pPaddle4" copynumber="4">
                <volumeref ref="Paddle"/>
                <position name="Paddlepos4" unit="cm" x="0" y="0" z="71."/>
                <rotation name="rotatebyz4" z="HALFPI"/>
            </physvol>
<!--In the following we build a crystal calorimeter consisting of cubes. We use formulae to place the physical volumes and the copy number together 
with the name of the logical volume represents a unique ID that can be used for specific channel mapping-->
            <loop for="ii" from="0" to="cell" step="1">
                <loop for="jj" from="0" to="cell" step="1">
                    <loop for="kk" from="0" to="cell" step="1">
                        <physvol name="CaloCell" copynumber="ii+(jj*(cell+1))+kk*((cell+1)*(cell+1))" >
                            <volumeref ref="CalorimeterVolume"/>
                            <position name="posijk" unit="mm" x="spacing*(ii-cell/2)" y="spacing*(jj-cell/2)" z="1100+spacing*(kk-cell/2)"/>
                        </physvol>
                    </loop>
                </loop>
            </loop>
        </volume>
        <bordersurface name="bordersrf" surfaceproperty="surf" >
            <physvolref ref="pArgonVolume"/>
            <physvolref ref="pCryostatVolume"/>
        </bordersurface> 
    </structure>
    <setup version="1.0" name="Default">
        <world ref="TOP"/>
    </setup>
</gdml>

Defining material and optical properties

Below we show the file materials.xml that is included in the xml file. This file will collect all optical and material properties relevant to liquid Argon as used by Geant4. Currently a few properties are still missing like the rayleigh scattering length or the properties of the wavelength shifting material. For an optical process to work two things have to happen: the process has to be enabled and configured via the fcl file and the relevant properties for the material have to be set in the gdml file. As an example: to produce Cerenkov light in a medium we have to enable and configure the Geant4 Cerenkov process and the refraction index of the Cerenkov radiator material has to be set.

    <define>
        <constant name="TWOPI" value="2.*pi"/>
        <constant name="HALFPI" value="pi/2."/>
        <variable name="i" value="0"/>
        <constant name="num" value="77"/>
        <constant name="scale" value="2."/>
        <matrix name="SY"  coldim="1" values="51282/MeV" />
        <matrix name="RS"  coldim="1" values="1.0" />
        <matrix name="FTC" coldim="1" values="7.*ns" />
        <matrix name="STC" coldim="1" values="1400.*ns" />
        <matrix name="YR"  coldim="1" values="0.75" /> 
        <matrix name="ArINDEX" coldim="2" values="6.7*eV 1.5
                                                 7.1*eV 1.5 
                                                 7.4*eV 1.5  
                                                 7.7*eV 1.5 
                                                 7.9*eV 1.5 
                                                 8.1*eV 1.5          
                                                 8.4*eV 1.5 
                                                 8.5*eV 1.5 
                                                 8.6*eV 1.5 
                                                 8.8*eV 1.5 
                                                 9.0*eV 1.5 
                                                 9.1*eV 1.5 
                                                 9.4*eV 1.5 
                                                 9.8*eV 1.5 
                                                 10.4*eV 1.5"/>
        <matrix name="REFLECTIVITY" coldim="2" values="6.7*eV 0.8
                                                 7.1*eV 0.8 
                                                 7.4*eV 0.8  
                                                 7.7*eV 0.8 
                                                 7.9*eV 0.8 
                                                 8.1*eV 0.8          
                                                 8.4*eV 0.8 
                                                 8.5*eV 0.8 
                                                 8.6*eV 0.8 
                                                 8.8*eV 0.8 
                                                 9.0*eV 0.8 
                                                 9.1*eV 0.8 
                                                 9.4*eV 0.8 
                                                 9.8*eV 0.8 
                                                 10.4*eV 0.8"/>
        <matrix name="SCINT" coldim="2" values="6.7*eV 0.04
                                                 7.1*eV 0.12 
                                                 7.4*eV 0.27 
                                                 7.7*eV 0.44 
                                                 7.9*eV 0.62
                                                 8.1*eV 0.80          
                                                 8.4*eV 0.91 
                                                 8.5*eV 0.92 
                                                 8.6*eV 0.85 
                                                 8.8*eV 0.70
                                                 9.0*eV 0.50 
                                                 9.1*eV 0.31 
                                                 9.4*eV 0.13 
                                                 9.8*eV 0.04 
                                                10.4*eV 0.01"/>
        <variable name="ii" value="0"/>
        <variable name="jj" value="0"/>
        <variable name="kk" value="0"/>
        <constant name="cell" value="5"/>
        <constant name="cellsize" value="5.0*cm"/>
        <constant name="spacing" value="5.0*cm"/>
        <matrix name="RINDEX" coldim="2" values="1.56258*eV 1.74822
                           1.59515*eV 1.74941
                           1.63606*eV 1.75
                           1.67667*eV 1.75178
                                               1.71167*eV 1.75296
                                               1.76698*eV 1.75474
                           1.80023*eV 1.75593
                           1.84655*eV 1.7583
                           1.9016*eV  1.7583 
                           1.95004*eV 1.76067
                           1.99407*eV 1.76244
                           2.03291*eV 1.76422
                           2.07329*eV 1.76422
                           2.12313*eV 1.766
                           2.155*eV   1.76778
                           2.20466*eV 1.76955
                           2.25223*eV 1.77192
                           2.30652*eV 1.7737
                           2.36837*eV 1.77666
                           2.43363*eV 1.77903
                           2.48095*eV 1.78081
                           2.54136*eV 1.78437
                           2.58717*eV 1.78614
                           2.65907*eV 1.78911
                           2.73508*eV 1.79266
                           2.80182*eV 1.79563
                           2.85761*eV 1.79977
                           2.93054*eV 1.80451
                           2.99162*eV 1.80925
                           3.04721*eV 1.8134
                           3.0799*eV  1.81696
                           3.1133*eV  1.82051
                           3.16479*eV 1.82525
                           3.20902*eV 1.83059
                           3.25449*eV 1.83533
                           3.30128*eV 1.84007
                           3.34944*eV 1.8454
                           3.39901*eV 1.85192
                           3.43974*eV 1.85725
                           3.49205*eV 1.86258
                           3.53505*eV 1.86673
                           3.57914*eV 1.87206
                           3.6358*eV  1.87799
                           3.68244*eV 1.8851
                           3.7303*eV  1.89102
                           3.79189*eV 1.89873
                           3.84266*eV 1.90465
                           3.90805*eV 1.90999
                           3.94837*eV 1.91473
                           3.97571*eV 1.92065
                           4.04576*eV 1.92658
                           4.07447*eV 1.93191
                           4.14807*eV 1.93665
                           4.19353*eV 1.94198
                           4.25569*eV 1.94672
                           4.33605*eV 1.95206
                           4.43657*eV 1.95798
                           4.50622*eV 1.96628
                           4.63351*eV 1.9722
                           4.76822*eV 1.97694
                           4.86931*eV 1.98109"/>
    </define>

    <materials>
        <material name="LAr" formula="LAr">
            <property name="RINDEX" ref="ArINDEX"/>
            <property name="SLOWCOMPONENT" ref="SCINT"/>
            <property name="SCINTILLATIONYIELD" ref="SY" />
            <property name="RESOLUTIONSCALE" ref="RS" />
            <property name="SLOWTIMECONSTANT" ref="STC" />
            <property name="YIELDRATIO" ref="YR" />
            <D value="1.40" unit="g/cm3"/>
            <fraction n="1.0000" ref="G4_Ar"/>
        </material>
        <material name="Iron" formula="Iron">
            <property name="RINDEX" ref="ArINDEX"/>
            <D value="4.0" unit="g/cm3"/>
            <fraction n="1.0000" ref="G4_Fe"/>
        </material>
        <material name="Silicon" formula="Si">
            <property name="RINDEX" ref="ArINDEX"/>
            <D value="2.33" unit="g/cm3"/>
            <fraction n="1.0000" ref="G4_Si"/>
        </material>
        <element name="Oxygen"   formula="O"  Z="8.">  
            <atom value="16.0"/>   
        </element>
        <element name="Nitrogen" formula="N"  Z="7.">  
            <atom value="14.01"/>  
        </element>
        <element name="Fluorine" formula="F"  Z="9.">  
            <atom value="18.9984032"/>  
        </element>
        <element name="Lead"     formula="Pb" Z="82."> 
            <atom value="207.20"/> 
        </element>
        <material name="PbF2">
            <property name="RINDEX" ref="RINDEX"/>
            <D value="7.77" unit="g/cm3"/>
            <composite n="1" ref="Lead"/>
            <composite n="2" ref="Fluorine"/>
        </material>
    </materials>

Finally the picture below shows a visualization of the detector setup defined in lArDet_split.gdml

Changes to Geant4

The goal of the project was to completely depend on tools provided by Geant4 and incorporate the latest developments of the Geant4 toolkit. We use the provided interfaces and worked with the Geant4 team to make them available if missing. We have a good collaboration with the Geant4 team to ensure that the requirements of the neutrino community are met. In the following we list some of the changes:

  • Developing the Geant4 Physics List factory by Robert Hatcher. At run time the factory gives access to all reference physics lists, electromagnetic options, physics constructors and processes provided by Geant4. Of particular interest for a liquid Ar TPC are access to optical physics, the ability to assign step limits to specific volumes (important to match the Geant 4 step length to the readout pitch of a liquid Ar TPC) and the ability to assign limits (time, energy) for tracking neutrons. It also allows to select a new physics list provided by the user.
  • The new optical physics constructor gives access to all optical processes which are Cerenkov, Scintillation, Transition Radiation, Rayleigh and Mie scattering, refraction and reflection at medium boundaries, bulk absorption and wavelength shifting. One just has to enable the process in the fcl files and provide the necessary optical properties in the gdml file. The constructor also gives us access to the full ray tracing capabilities of Geant4. In addition the constructor allows to configure the optical processes in a way relevant to liquid Argon TPC simulation e.g. we now have access to the number of produced optical photons without putting them on the stack. (P. Gumplinger, me)
  • we created a validation suite to check various processes relevant to neutrino physics e.g.:
    • Checked and fixed various cross sections relevant to the neutrino experiments. We added the relevant data to the Geant4 validation database: DoSSiER https://g4devel.fnal.gov:8181/Welcome.xhtml.
    • Fixed bug in Bertini cascade leading to stopped kaons being dropped.
    • Fixed bugs in Cerenkov/scintillation physics (there was no reset when entering material without optical properties.)
  • Included liquid Argon application lArTest in regular Geant4 profiling.
    • Optimized access to material properties (10% CPU improvement) (Soon, me)

Building and running an example

In the following we show how to build and run a larg4 example. In this example we just run the Geant4 simulation and a module which analyzes the SimEnergyDeposit in the event. Later on drift of electrons and photon lookup will be added to arrive at a more complete example.

mkdir larg4_dev 
cd  larg4_dev 
source /cvmfs/fermilab.opensciencegrid.org/products/larsoft/setup
setup mrb
export MRB_PROJECT=larg4
mrb newDev -v v08_11_00 -q e19:prof
source localProducts_larg4_v08_11_00_e19_prof/setup
cd srcs
mrb gitCheckout --repo-type github --fork larg4
cd $MRB_BUILDDIR
mrbsetenv
mrb b -j 4
setup nurandom  -qe19:prof v1_04_00
setup larsim -qe19:prof v08_19_02
lar -c testlarg4.fcl

The contents of the fcl file testlarg4.fcl is listed below:


//#include "seedservice.fcl" 
#no experiment specific configurations because SingleGen is detector agnostic

standard_singlep:
{
 module_type:           "SingleGen" 
 ParticleSelectionMode: "all"       # 0 = use full list, 1 =  randomly select a single listed particle
 PadOutVectors:        false        # false: require all vectors to be same length
                                    # true:  pad out if a vector is size one    
 PDG:                   [ 13 ]      # list of pdg codes for particles to make
 P0:                    [ 6. ]      # central value of momentum for each particle
 SigmaP:                [ 0. ]      # variation about the central value 
 PDist:                 "Gaussian"  # 0 - uniform, 1 - gaussian distribution                               
 X0:                    [ 0. ]     # in cm in world coordinates, ie x = 0 is at the wire plane          
                                    # and increases away from the wire plane                             
 Y0:                    [ 0. ]      # in cm in world coordinates, ie y = 0 is at the center of the TPC   
 Z0:                    [ -130. ]   # in cm in world coordinates, ie z = 0 is at the upstream edge of    
                                    # the TPC and increases with the beam direction                      
 T0:                    [ 0. ]      # starting time
 SigmaX:                [ 0. ]      # variation in the starting x position
 SigmaY:                [ 0. ]      # variation in the starting y position                            
 SigmaZ:                [ 0.0 ]     # variation in the starting z position                            
 SigmaT:                [ 0.0 ]     # variation in the starting time
 PosDist:               "uniform"   # 0 - uniform, 1 - gaussian
 TDist:                 "uniform"   # 0 - uniform, 1 - gaussian         
 Theta0XZ:              [ 0. ]      #angle in XZ plane (degrees)                                         
 Theta0YZ:              [ 0. ]      #angle in YZ plane (degrees)                                         
 SigmaThetaXZ:          [ 0. ]      #in degrees                                                          
 SigmaThetaYZ:          [ 0. ]      #in degrees                                                          
 AngleDist:             "Gaussian"  # 0 - uniform, 1 - gaussian
}

process_name:processA
source: {
  module_type: EmptyEvent
  maxEvents:  1000
}
services: {
  message : {
     debugModules : ["*"]
     suppressInfo : []    
     destinations : {
       LogToConsole : {
         type : "cout" 
         threshold : "DEBUG" 
         categories : {
           default : { limit : 50 }
         }
       }
     }
  }
  TFileService :
  {
    fileName      : "testlarg4.root" 
  }

    DetectorHolder: {}
    ActionHolder: {}
    RandomNumberGenerator: {}
    NuRandomService:{service_type: "NuRandomService" 
      endOfJobSummary: true
      policy: "random" 
}

    PhysicsListHolder: {} 
    PhysicsList: { 
    PhysicsListName: "FTFP_BERT" 
    DumpList: false    
      enableCerenkov: false
      enableScintillation: false
    ScintillationByParticleType: false
      enableAbsorption: false   
      enableRayleigh: false     
      enableMieHG: false       
      enableBoundary: false    
      enableWLS: false
}

    // Detector(s) for the simulation
    LArG4Detector : 
    {
    category: "world" 
    gdmlFileName_ : "lArDet_split.gdml" 
    }   

//    writeGdml: {
//      name: "writeGdml" 
//      gdmlFileName:"output.gdml"    
//    }

    ExampleGeneralAction: {
      name: "exampleGeneral" 
    }
MCTruthEventAction: {service_type: "MCTruthEventActionService"}
ParticleListAction: {service_type: "ParticleListActionService"}
}

outputs: {
out1: {
  module_type: RootOutput   
  fileName: "Testingout.root" 
  }
}

physics: {
  producers: {
   generator: @local::standard_singlep
    larg4Main: {  
      module_type: larg4Main
      enableVisualization: false
      macroPath: ".:./macros" 
      visMacro: "vis.mac" 
      //afterEvent: pause
    }

  }
  analyzers: {
   CheckSimEnergyDeposit: {   module_type: CheckSimEnergyDeposit
          hist_dir: "HistoDir" 
          }
   CheckMCParticle: {   module_type: CheckMCParticle
          hist_dir: "HistoDir2" 
          }
  CheckAuxDetHit: {   module_type: CheckAuxDetHit
          hist_dir: "HistoDir3" 
          }

}

  path1: [ generator,larg4Main ]
  stream1:  [ out1,CheckSimEnergyDeposit,CheckMCParticle,CheckAuxDetHit]

  trigger_paths: [ path1 ]
  end_paths: [ stream1 ]
}

Looking at the result

The produced Hit collections

If we look at the output file with the root TBrowser:

 root Testingout.root

we get the picture below. We see that Hit collections were created for all logical volumes to which we attached sensitive detectors. The name of the Hit collections clearly describe what kind of collection we are dealing with, which process produced it and what sensitive logical volume is responsible. E.g:
sim::SimEnergyDeposits_larg4Main_LArG4DetectorServicevolTPCActiveInner_processA
can be deciphered in the following way:
sim::SimEnergyDeposits : collection of SimEnergyDeposits
larg4Main : name of the module
LArG4DetectorService : name of the service
volTPCActiveInner : name of the sensitive logical Volume.

The SimEnergyDeposits

We also run the analyzer CheckSimEnergyDeposit which loops over the SimEnergyDeposits and creates some histograms.

root testlarg4.root

Below we show one example plot that shows the length of the Geant4 steps for charged particles in the active liquid Argon volume. We can clearly see the effect of the step limiter which in this case limits the steps of charged particles in the active liquid Argon volume to 100 microns.

geant 4 step length

The next plot shows the energy deposited by a relativistic muon in 1 cm of liquid Argon. The step limit is set to 100 microns. We see a landau distribution which is not the case when the step length is not adjusted to the sampling size.

The AuxDetHits

We also run the analyzer CheckAuxDetHit which loops over the AuxDetHits and creates some histograms.
The next plot shows the energy deposited by a relativistic muon in 1cm plastic paddle (no step limiter necessary). As expected we see a landau distribution

muon landau distribution in scintilator paddles

The MCParticles
single particle momentum

ProtoDUNE-SP example

An example for switching from larsim/LArG4 to the refactored larg4 using ProtoDUNE-SP can be found in this wiki: Migrating_to_the_refactored_larg4