DDSim Use Cases and Tips

Running in different Geant4 UI modes

If you are not planning to run in batch mode but instead would like to have access to the various Geant4 user interface session types ( Qt, GAG, tcsh, csh ), you will need to provide the relevant command line argument to ddsim:

ddsim --compactFile <path to compact.xml> --runType shell
The geometry will be created but the simulation will not start by itself. Instead, you will have access to a Csh-like terminal. By default, however, Geant4 may launch a Qt-based GUI with a command line, a console output panel, a panel with the list of available commands and some other features. If this is the case and you prefer not to have the Qt interface, you should do the following before running ddsim:
export G4UI_USE_TCSH=1
you will now have a text-based Csh-like console with access to the Geant4 modules available. Type help to see a list of commands. Type exit to quit the program. Avoid using Ctrl+C since it rarely works as intended, especially in Qt-mode.

Defining regions in DD4hep

One can easily define regions and assign them to Subdetectors in the DD4hep compact files. Regions can be used to set limits for simulation, for reconstruction and other things like material scans (see below). By convention, we define regions in the main compact xml, for example look at $lcgeo_DIR/CLIC/compact/CLIC_o2_v03/CLIC_o2_v03.xml:
    <limits>
   <limitset name="cal_limits">
            <limit name="step_length_max" particles="*" value="5.0" unit="mm" />
        </limitset>
   <limitset name="SiTrackerBarrelRegionLimitSet">
            <limit name="step_length_max" particles="*" value="5.0" unit="mm" />
            <limit name="track_length_max" particles="*" value="5.0" unit="mm" />
            <limit name="time_max" particles="*" value="5.0" unit="ns" />
            <limit name="ekin_min" particles="*" value="0.01" unit="MeV" />
            <limit name="range_min" particles="*" value="5.0" unit="mm" />
        </limitset>
    </limits>
    <regions>
        <region name="SiTrackerBarrelRegion" eunit="MeV" lunit="mm" cut="0.001" threshold="0.001">
            <limitsetref name="SiTrackerBarrelRegionLimitSet"/>
   </region>
        <region name="CalorimeterRegion" eunit="MeV" lunit="mm" cut="0.001" threshold="0.001">
            <limitsetref name="cal_limits"/>
   </region>

   </regions>
Notice for example the CalorimeterRegion. It refers to a limitest defined at the block above, but limits are not explicitly required for all applications of regions. The region now has to be applied to the detectors that it concerns. For example, it is reasonable to expect that the CalorimeterRegion should be applied to all the calorimeters, namely ECalBarell, ECalEndcap, ECalPlug, HCalBarrel, HCalEndcap, HCalRings, LCal, and BeamCal. This has to be done to every detector individually in their respective compact xml file inside the tag. For example, in $lcgeo_DIR/CLIC/compact/CLIC_o2_v03/HCalBarrel_o1_v01_01.xml:
        <detector id="DetID_HCAL_Barrel" name="HCalBarrel" type="GenericCalBarrel_o1_v01" readout="HCalBarrelCollection" vis="HCALVis" calorimeterType="HAD_BARREL" gap="0.*cm" material="Steel235" region="CalorimeterRegion">
...

Performing a material scan with DDSim

It is trivial to perform a material scan for a loaded geometry model in ddsim, using the Geant4 /control/matScan/ commands. For more details use help in the Geant4 UI. For performing a material scan of the entire detector, with the default binnings in θ and φ, you simply have to do:

Idle> /control/matScan/scan 
You will get a text dump of several lines for each θ and φ bin, with φ-averages for each θ bin. One can simply copy the text in a text file which can be manipulated with grep / awk and ultimately root or excel.

The power of defining regions in DD4hep (see above) becomes evident if one wants to scan a particular region or a specific subdetector in the model. Assuming you have a region defined named CalorimeterRegion, simply doing

Idle> /control/matScan/region CalorimeterRegion   
Idle> /control/matScan/scan 
the scan sums will be restricted only to that region. Notice that if the region name you enter does not exist, you will get an error message which conveniently lists the available defined region names:
Idle> /control/matScan/region Calo

-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : GeomMgt1001
      issued by : G4RegionStore::GetRegion()
Region NOT found in store !
        Region Calo NOT found in store !
        Returning NULL pointer.
*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------

Region <Calo> not found. Command ignored.
Defined regions are : 
 DefaultRegionForTheWorld DefaultRegionForParallelWorld CalorimeterRegion SiTrackerBarrelRegion

-- NikiforosNikiforou - 2015-09-30

Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r2 - 2015-11-16 - NikiforosNikiforou
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    CLIC All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2021 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback