Title: LCSim Workshop IV
1LC Detector Simulation with SLIC and LCDD
Jeremy McCormick, Ron Cassell for SLAC
Simulations Group
2Talk Overview
- Geometry Requirements
- Framework Diagram and Outline
- GDML/LCDD geometry system
- LCDD XML format examples
- Compact XML format example
- LCDD Visualizations
- SLIC simulations package
- Diagnostic Histograms
- Installation
- Plans
- Resources
3Geometry System Requirements
- represent all current detector designs including
testbeams and full detectors - ideal format
- human-readable and editable
- machine friendly
- encapsulate the core Geant4 geometry classes
- solids, materials, logical volumes, physical
volumes - include other essential Geant4 classes for DD
- regions, sensitive detectors, visualization,
fields - volume readout
- unique volume identification using bit-packed
IDs - virtual volume segmentation, i.e. cells, for
calorimeters - avoid C hard coding of geometries or DD
formats with only partial Geant4 support - package a separate geometry subsystem from the
simulator with minimal dependencies - System should be easy to use, yet flexible and
powerful.
4LCD Simulations Framework Diagram
Xerces
CLHEP
Not all connections shown.
uses
GDML
Geant4
org.lcsim
LCPhys
reads
Compact XML
LCDD
SLIC
LCIO
reads / writes
reads
reads
reads
LCIO Events
Stdhep Events
LCDD XML
writes
Geom Converter
5Packages
- LCIO widely adopted ILC IO package
- StdHep binary event format read by Willy
Langevelds lStdHep interface
6Benefits of an XML-Based System
- human readable and editable comparable to HTML
and other markups - quick development cycle
- no recompilation for geometry changes
- constant values easily tweaked
- validating parser quickly identifies errors
- highly structured enforces consistency across
disparate data sources - portable easy to import/export/exchange
- transformable map to/from databases, flat
files, Excel spreadsheets, etc. - high quality, standardized tools in C and Java
- self-descriptive with schemas (XSD)
- natural representation of structured
hierarchies, i.e. detector geometries - Internet access not required to utilize
- editing/display tools relatively easy to
implement
7GDML
- C binding to Geant4
- constants
- materials
- solids
- structure logical and physical volumes
- XML technology
- SAX parsing fast! ? parsing/loading of 15k line
LCDD file in 1.5 seconds - XML Schema (XSD) extensable types
- currently supported by
- Geant4 primary binding
- GraXML Viewer no constants, only doubles
- ROOT VMC, import/export
- org.lcsim reco framework geometry converter
from compact to LCDD format - LCDD reads
- Momo writes
8LCDD
- extension of GDML package to complete Geant4
binding for DD GDML - GDML volume element has additional elements but
no additional changes to format except this. - LCDDParser / LCDDDetectorConstruction usable in
any Geant4 simulator - additional elements
- header / meta info
- ID dictionary
- physical volume identifiers
- mapping of individual volume IDs and
segmentations to full, 32 / 64-bit IDs - sensitive detectors
- calorimeter / tracker types
- virtual segmentation of volumes for readout
- reference to an IDing scheme
- regions
- visualization attributes
- fields
- embedded GDML element for geometry description
9LCDD XML Structure
ltlcddgt ltheadergt lt/headergt ltiddictgt
lt/iddictgt ltsensitive_detectorsgt
lt/sensitive_detectorsgt ltregionsgt
lt/regionsgt ltdisplaygt lt/displaygt ltgdmlgt
lt/gdmlgt ltfieldsgt lt/fieldsgt lt/lcddgt
10Sensitive Detectors
Example
- Sensitive detectors can be of type calorimeter
or tracker, which determines type of LCIO hit. - hits_collection is name of LCIO collection.
- cut on energy with ecut
- set verbose level
- idspecref for the ID scheme (none is okay)
- Specific type of segmentation, e.g.
projective_cylinder, divides the associated
volume into virtual cells using ntheta and nphi
as parameters.
ltsensitive_detectorsgt ltcalorimeter
name"EcalBarrSD"
hits_collection"EcalBarrHits"
ecut"0.0" eunit"MeV"
verbose"0"gt ltidspecref
ref"CalId" /gt ltprojective_cylinder
ntheta"840"
nphi"1680" /gt lt/calorimetergt lttracker
name"VtxBarrSD"
hits_collection"VtxBarrHits"
ecut"0.0" eunit"MeV"
verbose"0"gt ltidspecref ref"TrkId"
/gt lt/trackergt lt/sensitive_detectorsgt
11ID Dictionary
Example
- IDs for calorimeter and tracker hits contained
in iddict - idfield defines a single, logical ID such as a
layer number. - label can reference a named physvolid or a
segmentation field - signed or unsigned
- creates a vector which is packed into the LCIO
hit - named idspec referenced in the
sensitive_detector element to assign an ID scheme
to a specific SD
ltiddictgt ltidspec name"CalId" length"64"gt
lt!-- lowest level vol id --gt ltidfield
label"layer" start"0"
length"7" signed"false"
/gt lt!-- subdet level ids --gt ltidfield
label"sys" start"7"
length"3" signed"false" /gt
lt!-- more ids here --gt lt/iddictgt
12Regions
Example
- corresponds to G4Region and G4UserRegionInformati
on - set whether secondaries are stored with
store_secondaries - set Geant4 range cut using cut
- set energy threshhold for secondary storage with
threshhold - provides the concept of a tracking region, which
is crucial to our method for creating and
processing the MCParticles
ltregionsgt ltregion name"EcalRegion"
store_secondaries"false"
cut"1.0" lunit"mm"
threshold"0.0" eunit"MeV" /gt
ltregion name"TrackingRegion"
store_secondaries"true"
cut"10.0" lunit"mm"
threshold"1.0" eunit"MeV"
/gt lt/regionsgt
13Visualization
Example
- vis_attributes element implements all settings
in class G4VisAttributes. - attached to a logical volume via a reference
- settable
- visibility
- daughters visible
- line style
- wireframe or solid
- color
ltdisplaygt ltvis_attributes name"EcalVis"
visible"true"
show_daughters"true"
line_style"unbroken"
drawing_style"wireframe"gt ltcolor
R"0.0" G"1.0"
B"1.0" alpha"1.0"
/gt lt/vis_attributesgt lt/displaygt
14Fields
Example
- solenoid implements the virtual type field
- similar to LCDG4s handling of fields
- global_field defines the top level field handler
for the application using a fieldref. - can use constants from gdmls define block
- plan to allow fields maps
ltfieldsgt ltsolenoid name"GlobalSolenoid"
inner_field"solenoid_inner_field"
outer_field"solenoid_outer_field"
zmin"solenoid_zmin"
zmax"solenoid_zmax"
inner_radius"solenoid_rmin"
outer_radius"solenoid_rmax"
funit"tesla" lunit"mm"/gt
ltglobal_fieldgt ltfieldref ref"GlobalSolenoid"
/gt lt/global_fieldgt lt/fieldsgt
15Extended GDML volume Element
Example
- It all comes together here.
- Red elements extend the GDML volume type.
- Any number of physvolid elements are allowed on
the physvol child tag. - sdref is a named sensitive detector from the
sensitive_detectors section. - regionref points to a named region within
regions. - vis_attributesref is a named vis_attributes
element from display. - Note This example is contrived to show all
extension elements.
ltvolume name"ecal_barr"gt ltmaterialref
ref"Air" /gt ltsolidref ref"ecal_barr_tube"
/gt ltphysvolgt ltvolumeref ref"ecal_barr_lay0
" /gt ltpositionref ref"identity_pos" /gt
ltrotationref ref"identity_rot" /gt ltphysvolid
namelayer value0 lt/physvolgt ltsdref
refEcalSD /gt ltregionref ref"EcalRegion" /gt
ltvis_attributesref ref"EcalVis"/gt lt/volumegt
16Compact Description
Example
- Verbosity of GDML means hand coding can be
tedious (but certainly possible!). - Compact XML description provides higher level
format for conversion to LCDD. - detector systemmatics
- package GeomConverter in SLAC CVS
- also used in lcsim.org reconstruction package
- gross parameters rather than individual
volumes, etc. - detectors, layers, slices
- dimensions inner, outer radii
ltdetector id"2" name"EMBarrel"
type"CylindricalCalorimeter"
readout"EcalBarrHits"gt
ltdimensions inner_r "127.0cm"
outer_z "179.25cm" /gt ltlayer
repeat"30"gt ltslice material "Tungsten"
width "0.25cm" /gt ltslice
material "G10" width
"0.068cm" /gt ltslice material "Silicon"
width "0.032cm"
sensitive "yes" /gt ltslice material
"Air" width "0.025cm" /gt
lt/layergt lt/detectorgt
17Example Geometries
- all found in SLIC_BASE/examples
- subsequent paths relative to this
- run macros for them in SLIC_BASE/macros
- Geant4 visualization system
- DAWN, OpenGL, WIRED/HepRep
- No custom C code for any of the geometries!
18SDJan03 Reprise
19SiDFeb05 Detector Envelopes
- ./sid/SiDEnvelope.lcdd
- toy example without real materials or layer
structure - polyhedra for calorimeter envelopes
- illustrates possibility of modelling realistic
detector designs with corners - add trapezoid-shaped readout modules with box
layers
Hcal
Muon
trackers
Ecal
Coil
20Octagonal Calorimeter Barrel
- 2 GeV pion
- storing calorimeter-type hits in a region where
secondaries are created - magnetic field
- Geant4 range cut settable by region, especially
useful for tweaking secondary / shower physics. - Range cut is 10 mm here vs. Geant4s 1 mm
default.
21Testbeam
- 2 GeV pion
- geometry similar to Mokkas TB03 model
- store_secondaries is ON for viewing detailed
shower structure.
22MDI - BDS
Machine Detector Interface and Beam Delivery
System
polycones
boolean solids
Visualized with dawn and dawncut.
23SLIC
- authored by Jeremy McCormick and Ron Cassell
- simulator hub package
- Geant4
- LCDD for the geometry description
- LCIO for IO
- command interface
- full command line interface maps to
- macro command set (G4UIcommands)
- tweak LCIO behavior / flags with macros
- MCParticle handling
- based on refactored LCS
- ideas and code from LCDG4 (LcioHelper), Mokka
(PhysicsListFactory), LCS (EndOfEventAction)
Thanks, guys! - additional resource directories
- analysis code in analysis/
- geometry examples in LCDD format within
examples/ - scripts/ and macros/ with helpful utilities
24Geant4 Macro Interface
Example
- aims for simplicity and completeness
- LCDD has its own command directory created in
that package. - commands for LCIO customization
- Example does not show all possible commands.
- execute in several ways
- slic macro_name (like Mokka)
- slic m mac1 m mac2
- slic n (interactive mode)
/lcdd/setURI ./examples/sdjan03/SDJan03.lcdd /phys
ics_list/select LHEP /stdhep/setFile
stdhep_inputfile /lcio/path lcio_files /lcio/filen
ame output_file /control/execute
user_settings.mac /stdhep/skipEvents
100 /run/initialize /run/beamOn /control/interacti
ve
25Command Line Interface
- macro-based commandline interface
- Each switch maps to a Geant4/SLIC/LCDD macro
command for consistency. - arguments
- input and output files
- macro exec with switch -m
- run events
- skip events
- interactive mode
- initialize
- Ordering can be important, e.g. simulator
initialization and multiple macro execution.
Example
slic -g ./examples/sdjan03/SDJan03.lcdd -l
LHEP -i stdhep_inputfile -p
lcio_files -o output_file -m
user_settings.mac -s 100 -z
-r 1 -n
26MCParticle Handling Overview
- based on refactored EndOfEventAction from LCS
- use track information and then trajectories to
keep the track parentage intact during the
simulation - The actual construction of the MCParticle tree
is done in post event processing using the
trajectory object where possible and also
information from the initial, input MCParticles
and associated G4PrimaryParticles. - Track ID is the main unique identifier.
- Current LCIO status codes are all fully
implemented and have been certified against
single and complex event inputs.
HEPEVT Record
Initial LCIO MCParticle
G4PrimaryParticle
G4Track
G4TrackInformation
Trajectory
Final LCIO MCParticle
27Diagnostic Histograms
- Java analysis codes in SLIC_BASE/analysis
- authored by Ron Cassell
- JAS3, AIDA, LCIO
- All use the LCDD reimplementation of SDJan03
(LCDG4, LCS). - MCParticle plots
- Zpole
- hadronic
- 10k events
- 1 entry / MCParticle to show hit associations
- sampling fractions
- Ecal 1.2
- Hcal 6
- Status Code and R vs. Z plots
- Muons
- 1-10 GeV, 2-176 theta, all phi
28R vs. Z histo
29MCParticles EM Energy histo
10k Zpole hadronic (plot cutoff at 100k
MCParticles)
30MCParticles Charged Had E histo
31MCParticles Neutral Had E histo
32LCIO Hit Status Codes histo
- Status Codes
- CreatedInSimulation
- Backscatter
- VtxNotEndpOfParent
- DecayedInTracker
- DecayedInCal
- LeftDetector
- Stopped
6
5
3
1
7
4
2
33Framework Installation
- first install
- CLHEP
- Geant4
- LCIO
- Xerces
- keep env vars G4INSTALL, CLHEP_BASE_DIR, LCIO,
XERCESCROOT, etc. - install SLIC
- export CVSROOTpserveranonymous_at_cvs.freehep.org
/cvs/lcd - cvs co slic
- cd slic
- export SLIC_BASEpwd
- ./scripts/build.sh
- The script walks user through setup of GDML,
LCDD, LCPhys and SLIC. - Please let me know if it works for you!
34Plans
- remaining items on the LCDD / SLIC TODO list
(SLIC_BASE/doc/sim_TODO.rtf) - event samples
- comparison and mutual certification of LCIO
output with Mokka and LCDG4 - promote SLIC at ILC simulation sites
- assistance for setup and usage
- user feedback for feature requests
- materials library
- compact converter support realistic models
- possible LCDD detector-based full detectors
SiD, D09, GLD/LDC, - LCDD geometry navigator in Java
- geometry construction tools editor, viewer
- contribute to GDML project
35Resources
- SLIC Homepage
- http//www.lcsim.org/software/slic
- LCDD Homepage
- http//www.lcsim.org/software/lcdd
- GDML Homepage
- http//gdml.web.cern.ch/GDML/
- LinearCollider.org forum
- http//forum.linearcollider.org/
- ILC Confluence Wiki
- http//confluence.slac.stanford.edu/display/ilc/Ho
me