command line simulations

24
Command line simulations Håkan T. Johansson, Chalmers, Göteborg IEM-CSIC, December 2012

Upload: others

Post on 30-Jan-2022

11 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Command line simulations

Command line simulations

Håkan T. Johansson, Chalmers, Göteborg

IEM-CSIC, December 2012

Page 2: Command line simulations

Outline

Simulation flow overview

Interfacing with GEANT3/4

Digitisation

Versatile particle gun

Example

Vertex & hit dump

Wrapping up

Parametrised detectors

Page 3: Command line simulations

Same command line for GEANT3 & 4./land_geant3 ­­test=d=1cm,z0=2cm,type=plastic,out_col=0 \  ­­gun=T=1MeV,gamma,isotropic ­­events=1000000 | \  grep TSTDMP | sed ­e "s/.*://" > test3.txt

./land_geant4  . . .  > test4.txt

TTree t3, t4;t3.ReadFile("test3.txt","a");t4.ReadFile("test4.txt","a");TCanvas c1;c1­>Divide(1,2);c1­>cd(1);t3­>Draw("a>>h3(100,0,1.1)");c1­>cd(2);t4­>Draw("a>>h4(100,0,1.1)");

test3.txt:

    0.71876    0.05768    0.00663    0.68386    0.06915    0.79547    0.61802    0.69747    0.07892...

test4.txt:

    0.21737    0.77376    0.09234    0.08010    0.77861    0.60840    0.78068    0.64339    0.69145...

GEANT4

GEANT3

Page 4: Command line simulations

Data flow

Reconstruction flow: ↓

Simulation starts at thelevel where analysis ends;

Simulation flow: ↑

Flow ↑ until suitablehandover point:

(land02-speak:) SYNC level

ggland: wrap GEANT3/4

ggdigi: combine 'δE-hits'

Page 5: Command line simulations

GEANT: gives 'δE-hits' ( )

ggland & ggdigi

Read

th

i s w

ay

ggland: minimalistic interface

GEANT: particles & tracks

ggdigi: propagateδE-signals to readout,sum & discriminate

PMPM

SYNC level data (t,e) → land02

Non-existent

Moredetectorsneeded...

Unfinished

Page 6: Command line simulations

Finalise

ggland:Interfacing

with GEANT3/4

Setup,handle command-line

Materials

Solids

Initialise

Track particles(e-loss, reactions,creations, etc...)

Particle gun

Prepare gun

Objects

Step

Event- lo

op

(Record)

Sort,dump det. hits,

dump particle tree

Done

uginit()

gustep()

Particles

gutrev()

Next trackgutrak

uglast()

guout()

GEANT3/4library

gglandprogram

grun()

gsmixt()gstmed()

gsvolu()gspos()

gsvert()gskine()

ggdigi

GEANT4 has similar'mechanics', but moreflexible and C++.

Interface to GEANT3:6 user-defined functions(FORTRAN, easy to callFrom C).

Page 7: Command line simulations

ggdigi: Generic digitisation

Simulation generates list of energydeposits in volumes

Often many!Depends ondiscretization.

Propagation and CFD based onR3BConstantFraction.{h,cxx}By Johan Gill & Staffan Wranne

Analysis needs single data per readout channel (like real data)

PM

Digitiser propagates to readout:

● Time-delay t += d * veff

● Attenuation e *= exp (­d/latt.len.

)d

dd

tLE

t

e● Each hit contributes to readout pulse.

● Final time-signal after CFD (or LE) mimic

Page 8: Command line simulations

ggdigi: Generic digitisation II

PMd

dd

tLE

t

e

*** EVENT 5 ***# LAND 2 sections 3 hits 1/18: t1=   35.189 e1=   10.079 t2=   47.202 e2=   35.039 1/19: t1=   35.295 e1=    1.975 t2=   47.265 e2=    6.836

ggdigi: Separate process, same routine for all detectors!

Customised by:

● Relevant propagation coordinate● Speed of signal, e.g. v

eff of scintillation photons

● Attenuation length● (To handle Birk's law – light output saturation)

Page 9: Command line simulations

● Particle gun● Test volume● Crystal ball (geant3) Real data

Production-ready pieces

Bridge missing

Unfinished

gamma2

Workaround: hitgamma2

Comparisons(R3B Analysis Workshoptalk by Ronja)

Page 10: Command line simulations

Parametrised detectors

­­xb=help

rot{x,y,z}|x0|y0|z0               0 1|cm  Rotation | Location.r1                               25 cm    Inner radius.r2                               45 cm    Outer radius.right                             1       Right half (1­81,!77,!81).left                              1       Left half (83­162,!82).forward                           0       Forward crystal (81).backward                          0       Backward crystal (82).bottom                            0       Bottom crystal (77).all                               0       Enable all crystals.crystal                         NaI       Crystal material.

Detector volumes created by C code,by calling wrappers for GEANT3/4.

Dimensions and aspects variable controlled.Defaults give 'normal' detectors.Override on command line.

Existing:

­­land­­sciland­­xb­­csi­­cave­­boxcave­­test­­world

Page 11: Command line simulations

TEST volume­­test=help

rot{x,y,z}|x0|y0|z0     0 1|cm  Rotation | Location.d                       1 cm    Half width (if none of dx,dy,dz given).dx                      1 cm    Half width (x).dy                      1 cm    Half width (y).dz                      1 cm    Half width (z).dm                    nan g/cm2 Thickness (if none of dx,dy,dz given).dmx                   nan g/cm2 Thickness (x).dmy                   nan g/cm2 Thickness (y).dmz                   nan g/cm2 Thickness (z).out_col                ­1       Output column.  (Text dump.)stepprint               0       Debug printing from the step function.type            undefined       Test material.

dx

dz

dy

test3.txt:

    0.71876    0.05768    0.00663    0.68386    0.06915    0.79547    0.61802    0.69747    0.07892...

Material must be givenfor test volume:

­­list­materials

Energy sum per event.First column is 0.(Only non-0 events printed.)For ROOT's Ttree::ReadFile()

Page 12: Command line simulations

Multiple TEST volumes

./land_geant3 --test-0=d=0.5cm,z0=1cm,type=plastic,out_col=0 --test-1=d=0.5cm,z0=2cm,type=plastic,out_col=1 --test-2=d=0.5cm,z0=3cm,type=plastic,out_col=2 --gun=gamma,T=10MeV,dtheta=0.5pi --events=1000000 | grep TSTDMP | sed -e "s/.*://" > 3vols.txt

3vols.txt:

    2.26846    0.00000    0.00000    2.14312    1.33287    0.00000    0.95297    0.00000    0.00000    0.07750    0.00000    0.00000    0.27885    0.00000    0.00000    0.00000    1.23321    0.00000    0.53523    0.93503    0.00000    1.06333    0.00000    0.00000    0.00000    0.79065    0.00000    3.89404    1.62902    0.00000    0.14590    2.33030    1.07062    0.00000    0.00000    0.47722    0.00000    1.79729    2.36696    0.93408    0.00000    0.00000...

GEANT3

GEANT4

Page 13: Command line simulations

Instant .root-file

./land_geant4 --test=dx=125cm,dy=2.5cm,dz=2.5cm,type=plastic,tree=1 --gun=cosmmuonthetaE=250MeV,sr=130cm --test-tree=muons2.root --events=1000000

Create root-file with data from test volumes:sumE

By rough 'digitizer': cluster by distance (currently sqrt(10) cm):

n, x[n], y[n], z[n], t[n], e[n]

Include volume

Back-of-the-

envelope

simulations

h101->Draw(“e:x”)

Muon source (lowEcut=250.0 MeV, r=130.0 cm): avg time between ev. 0.0009705 s.Muon source with 1000000 events, total time: 970.5 s (= 0 h 16 m).

Realistic muon source nowalso gives corresponding real time.

NEW

Page 14: Command line simulations

Vertex & hit list – markup: ggmark­­hits=vertex,­ |  ./ggmark |  less ­R

Hit (δE) list

Particle & vertex list

Particle-hit

association

Page 15: Command line simulations

Versatile particle gun

­­gun=isotropic,gamma,E=5MeV

­­gun=z0=10cm,sr=0.1cm,sphere,theta=45deg,      dtheta=0.5pi,C12,T=200MeV/u

­­gun=help● Tree / conditional emission

● Source location & shape

● Direction and emission opening

● Energy / momentum

● Particle selection

● Phase-space / Lorentz boost

Page 16: Command line simulations

Particle gun 1: tree / conditional

feed=name             Activate subsequent particles (name for level).prob=w                Probability, (e.g. 45% for percent,                      division and multiplication also allowed).from=name:w           Given particle level with 'name' was activated                      as destination.  Items are mutually exclusive.

feed=1332 feed=2505 Parent decides whichlevel to populate.

from=2505:2e­6,feed=0 from=2505:99.85,feed=1332

from=1332:1,feed=0

Children are activated from named level.(Each level only activates one child; randomly).

E=2.505MeV,gamma E=1.173MeV,gamma

E=1.332MeV,gamma

dummydummy

Page 17: Command line simulations

Particle gun 2: location & shape

x0, y0, z0    [0 cm]    Origin.sx, sy, sz    [0 cm]    Source extent (box,ellipsoidals).sr            [0 cm]    Source extent (disc,sphere,shell),box/sphere/shell/disc   Shape of sx/sy/sz source extent.                        Disc perpendicular to nominal direction.                        (sphere is solid, shell is surface.)shapenorot              Do not rotate source shape with theta & phi.                        Shape of sx/sy/sz source extent.noverttochild           Do not give vertex to subsequent particle (feed).                        (Child using a source extent forces this.)

­­gun=z0=10cm,sr=0.1cm,sphere,...

Location of source

Extent of source

­­gun=z0=10cm,sr=0.1cm,sphere,...

Page 18: Command line simulations

Particle gun 3: direction & opening

ignoreparentdir         Ignore parent direction.theta, phi    [0, 0]    Nominal direction, (e.g. 45deg for degrees).dtheta        [0]       Spread of beam, (e.g. 45deg for degrees).                        Or as dcostheta.  (dphi=2pi, always)isotropic               Shorthand for dtheta=1pi.anisotropic=a2:a4       Anisotropic distribution (rel. to parent).backtoback              Generate in opposite direction to parent.

­­gun=theta=45deg,dtheta=0.5pi,...

Direction Emission opening

Used for annihilation photons from β+ sources.

Used for 60Co 1173 MeV + 1332 MeV decay.

Child direction relative to actual emissiondirection of parent particle.(Facilitates 'anisotropic', 'backtoback' etc.)

Default: z

Page 19: Command line simulations

Particle gun 4: energy

T,Tmin:Tmax   [MeV]   Kinetic energy, fixed or equidistributed min ­­ max.                      Also as T/u and T/A, with MeV/u and MeV/A.p,pmin:pmax   [MeV/c] Momentum, fixed or equidistributed min ­­ max.E,Emin:Emax   [MeV]   Total energy, fixed or equidistributed min ­­ max.                      (Units [kev] or [me] also allowed.beta,betamin:max      Beta, fixed or equidistributed min – max.

­­gun=proton,T=100MeV

­­gun=gamma,E=1MeV

­­gun=gamma,E=1me

­­gun=gamma,E=0:10MeV

­­gun=e­,beta=.99

­­gun=C12,T=200MeV/uChoose particlemomentum bygiving a suitableenergy or speed.

Page 20: Command line simulations

Particle gun 5: particles

particle/isotope        The particle to generate (e.g. gamma,e­,p,n,d,t,Li6).dummy                   Fire blank ­ no particle generated.

Predefined: decay­Na­22, decay­Co­60, decay­Cs­137

cosmmuonthetaE=lowEcut  Energy and angular distribution for cosmic muons.fromworldedge           Move particle backwards to start from world edge.

­­gun=e+,...

­­gun=C12,...

­­gun=dummy,...

­­gun=decay­Co­60 'Realistic' predefined sources.(Incl. branching probabilites, anisotropy.)

Particles from GEANT3/4­­list­particles

­­gun=cosmmuonthetaE=200MeV,      fromworldedge

Cosmic muon source.(acc to: J. Kempa, A. Krawczynska,Nucl. Phys. B (Proc. Suppl.) 151 (2006) 299-302.)

No particle (not geantino).

Page 21: Command line simulations

Particle gun 6: phase-space & boost

phasespace     Multiple particles share the given energy. (theta, phi,               dtheta, isotropic applies to *last* particle).               Particle can be followed by :setboost :dummy :feed.

­­gun=T=2.28MeV,phasespace=nu,Zr90,e­,isotropic

Total energyPhase-space distribution,(sharing total energy)(genbod algorithm – sequential two-body)

Last particle inz / parent direction,unless randomized

­­gun=beta=0.8,setboost,feed=A­­gun=from=A:1,boost,p

boost          Boost particle by set parent particle boost.setboost       Use four­vector as boost source.

Inherit reference frame.(Useful for beam-like emission.)(Currently SEGFAULTs for uninvestigated reason.)

Page 22: Command line simulations

Fun-facts

ggland: 11,7 klines

ggmark: 0,7 klines

ggdigi: 1,8 klines

g3

g4

gun

detectors

part. tree

land02-core: ~111 klines

ucesb-core: ~47 klines

Sorry: ca 20 % blank linesincluded in all numbers

GEANT3 interface

Particle gun.

GEANT3 interfaceGEANT3 interface.

GEANT4 interface.

Detector geometry.

Vertex dump.

Vertex dump markup.

Digitizer.

Other glue.

Page 23: Command line simulations

Parallellisation

● Through process duplication:

 fork()

(no threads – GEANT3/4 need not know)

● Master process distributes event seeds

NEW

TODO:

● Combine & sort output data (event “retirement”)

● “Farm-forking” using MPI

Page 24: Command line simulations

Finale!

A great deal of FUN!

Thank you!