Asia-Pacific Geant4 Workshop
  and Training Course 2009
7-12 December 2009 @ Tsukuba International Congress Center (Epocha...
Safety First!
                     We are here Lv4

• Emergency exits
  and assembly
  point
• Check your
  evacuation rou...
Welcome to Earthquake Country
• Be aware of exits in your building
• Fire or other emergency evacuation
      – Follow bui...
Networking
• WiFi
      – IEEE 802.11b or 802.11g compliant adaptors should
        be accepted
      – SSID: tsukuba04
  ...
Plan for the week
• Talks and practical
      – Geant4 installation (this course)
      – Others are shown in next a few s...
Tuesday
•   Introduction to Geant4
•   History of Geant4
•   Upcoming release Geant4 version 9.3

•   Don’t miss the recep...
Wednesday
•   Basic Introduction & structure of Geant4 (in Lecture 1)
•   Introduction to Hadronic & EM Physics (in Lectur...
Thursday
• Geometry Placement, Physics and Primary
  Particles (Lecture III)
• User Interface, Materials and Scoring (Lect...
Friday
• Visualization, Advanced geometry placement, and Detector
  sensitivity (Lecture V)
• Documentation and discussion...
Agenda Today
Time               Duration   Contents
13:30 - 14:30      60min      Introduction
14:30 - 14:45      15min   ...
Aims in this session
• EVERY participants can get started in Geant4
• EVERY participants can install Geant4 by
  themselve...
Not aims in this session
• I don’t aim…
• Advanced technical matter
      –   How to create materials and geometries in Ge...
Starting Point of the Workshop
• Tips to make our workshop successfull
      – To make ourselves comfortable
      – To be...
http://www-geant4.kek.jp/g4ws09/access.php
Google map may help you

                              Lunch

                 ...
http://www-geant4.kek.jp/g4ws09/access.php
Google map may help you

                              Lunch


                ...
http://www-geant4.kek.jp/g4ws09/access.php
Google map may help you

                                Dinner
   Sushi: Kinta...
http://www-geant4.kek.jp/g4ws09/access.php
Google map may help you

                            Shopping
  Daiwa Roynet Ho...
http://www-geant4.kek.jp/g4ws09/access.php
Google map may help you

                                  Shopping
   IIAS Tsu...
Who am I?
My name                  Go Iwai
Where I am working       Computing Research Center
                         KEK...
Who’s here!?
Please give us your…
 • Name
 • Where you work
 • Your experience in Geant4
       – Enough for rough estimat...
Break before Hands-on works?

   If you are not yet ready to start
 hands-on works, please let us know!
      I have not y...
Seat Arrangement
Each Group consists of ~4 members
                                We organize based on international

Build up Team       ...
Hands-on

60-90 min
Introduction
• As the admin on Grid computing at KEK
      – Keep up-to-date with the latest software on WNs as well as lo...
Technology Choice of Package Management
                    APT vs. YUM
                                                  ...
Quicker Installation
• Just 1min ready to go
  Geant4
      – If network
        performance is
        reasonable 
• Eas...
Contents of Packages
Package            Content/Comment
geant4             Dynamic libraries
                   e.g.: libG...
Supported Distros and Architecture
              As of Dec. 2009
• New: ready for Scientific Linux 5!

• Redhat Enterprise...
It's really easy, 10 seconds to setup
                      to look up repository here.
                      If your plat...
Contents of a repo file “kek.repo”
                   Enabled for two stacks geant4 and
                   geant4-data by ...
After placing a repo file in
                   /etc/yum.repos.d, just execute “yum
                   install geant4-demo...
All dependencies for a geant4-demo
                   package are resolved by yum before staring
                   to ins...
Tips: “yum -y install demo” to skip here.




December 7, 2009                  APG4WS2009                   34
To make sure to set up your
         environment valuable, logout
              here and login again




December 7, 2009 ...
After installing geant4-demo, you
                   should find short cut for a demo
                   application in ap...
You can find an icon on your desktop also




December 7, 2009            APG4WS2009                         37
Open up terminal
                                window and control
                                window by double
     ...
Selectable tab N01-N07




December 7, 2009                APG4WS2009   39
Click “Quit” to terminate a demo

December 7, 2009       APG4WS2009                     40
$ rpm --query --list geant4
                   geant4 package provides only shared
                   libraries, it’s enou...
$ rpm --query --list clhep
                   clhep package also provides only shared
                   libraries.




De...
Setup
• It's really easy, 10 seconds to setup to look up
  this repository here.

      # cd /etc/yum.repos.d
      # wget...
Geant4 Installation
                       End-Level Users
• This “geant4” package provides only shared libraries.
      –...
Novice example N01
• Fixed geometry
   – Ar gas mother volume with Al cylinder and Pb
     block with Al slices


• Incide...
Novice Example N03
    •   Sampling calorimeter with layers of Pb absorber and
        liquid Ar detection gaps (replicas)...
Novie Example N02
• Pb target, Xe gas chambers (parameterized
  volumes)

• All EM processes + decay including charged
  l...
Novie Example N04
• Simplified collider detector
   – all kinds of volume definitions

• Magnetic field

• PYTHIA primary ...
Novice Example N05
• Fast simulation with parameterized showers
   – EM showers (derived from G4VFastSimulationModel)
   –...
Novice Example N06
• Water Cerenkov detector with air
  “bubble”

• Materials
   – Specification of optical properties
   ...
Novice Example N07
• 3 simplified sandwich calorimeters (Pb, Al,
  Ar)

• Cylindrical ghost volume for scoring

• Run-base...
Make Your Application!




December 7, 2009            APG4WS2009      52
Geant4 Installation
                   Application Developers
• A package “geant4-devel” is necessary if you
  as the appl...
External Tools for Visualization
• A package “dawn” and “vrmlview” is
  necessary if you would like to visualize your
  si...
Build & Run
$ wget http://www-geant4.kek.jp/g4users/g4tut07/download/exercise-
2.tar.gz
$ tar zxvf exercise-2.tar.gz
$ cd ...
Advanced Hands-on

              Try this if you could finish everything
                   earlier and getting boring 

...
Rotate Tube
• Edit DetectorConstruction class
      – src/DetectorDescription.cc
G4RotationMatrix* rotM= new G4RotationMat...
Volume Placement
• Place 6 volumes 45 degree rotated
  about an z-axis
• Edit DetectorConstruction class
 const G4double d...
Beam On!




$ ./bin/Linux-g++/ex02
...

ex02(Idle)[/]:/control/execute gun.mac
ex02(Idle)[/]:/control/execute vis.mac
ex0...
Let’s have a break!
Geant4 Installation Guide
If you can understand a SPEC file in
                SRPM…
  • It is the best practical example to install
    Geant4
    ...
To understand build procedure in “%build” section
#...snip
export G4SYSTEM=%{g4system}
export G4INSTALL=%{_builddir}/%{nam...
http://geant4.slac.stanford.edu/tut
       orial/installation/Geant4.9.2.p02/L
       inux/Geant4_9_2_p02_Linux_Installat
...
What are the two pieces of software
     required for building Geant4?
• gcc 3.4.6 (for SLC4 or RedHat 4) or gcc 4.2.1 (fo...
Getting and Installing CLHEP
• Go to the CLHEP source download page:
• http://proj-clhep.web.cern.ch/proj-
  clhep/DISTRIB...
$ cd /tmp
$ wget http://proj-clhep.web.cern.ch/proj-
clhep/DISTRIBUTION/distributions/clhep-2.0.4.2.tgz

And then,

$ tar ...
Now navigate into the unpacked directory and begin the
configuration process.
$ cd /tmp/2.0.4.2/CLHEP
$ ./configure --pref...
For the following, be sure to type make rather than gmake. It can be very hard to
remember which of these to type. One som...
Dynamic or Static?
 •   After completing to install CLHEP, you can find libCLHEP-2.0.4.2.so and libCLHEP-2.0.4.2.a in
    ...
Getting Geant4
• From the top of the Geant4 home page:
      – http://geant4.web.cern.ch/geant4/
• Select "Download" from ...
Navigate to this directory and unpack the file:

$ cd $HOME/geant4
$ wget
http://geant4.web.cern.ch/geant4/support/source/...
Getting Data Files
• Depending on the physics of your particular
  application, you may need to install additional
  data ...
For now, pick up the "data files for low energy electromagnetic
processes":

$ mkdir –p $HOME/geant4/data
$ cd $HOME/geant...
Doing the Initial Build
• TAKE YOUR TIME AT THIS STAGE, DON'T RUSH IT.
• Mistakes made at this stage can be very time-cons...
Basic Environment Variables for sh
         family including bash
export G4SYSTEM=Linux-g++
export G4INSTALL=$HOME/geant4/...
After setup environment varuables, move to geant4 source directory
and start to make it:
$ cd $G4INSTALL/source # correspo...
Check Your Installation
• It should be noted that environment valuables
  at building Geant4 main libraries and your
  app...
export G4SYSTEM=Linux-g++
export G4INSTALL=$HOME/geant4/geant4.9.2.p02
export CLHEP_BASE_DIR=$HOME/geant4/clhep
# export G...
$ cd /tmp
$ cp –a $G4INSTALL/examples/novice/N01 .
$ cd N01

  Important & Convenient Tips!
  Just insert one line G4WORKD...
$ make
…
$ ./bin/Linux-g++/exampleN01

*************************************************************
 Geant4 version Name:...
How to keep up to date
• Major/Minor release: one time a year (end of
  Year usually)
• Beta release: 6 months prior to ma...
Shall we have a break?
QA and Comments

Note that we should lock this room and
return a key to administration office so
 we would like to close t...
Acknowledgement
http://www-public.slac.stanford.edu/geant4/Tutorial2009.asp
         Many of slides are copied and pasted ...
Upcoming SlideShare
Loading in …5
×

Geant4 Novice Training Course in Asia-Pacific Geant4 Workshop and Training Course 2009 held at Epochal, Tsukuba, Japan during 7-12 Dec 2009

3,582 views

Published on

As a basic concept of this slide "Slides as a Textbook", all materials in this training course are designed for non native English speakers & Geant4 novice users so that slides are described as verbose as possible. Consequently, participants can study by themselves even after this training course.

Visit: http://www-geant4.kek.jp/g4ws09/training.php

Published in: Education, Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
3,582
On SlideShare
0
From Embeds
0
Number of Embeds
250
Actions
Shares
0
Downloads
149
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • Footer
  • Footer
  • Geant4 Novice Training Course in Asia-Pacific Geant4 Workshop and Training Course 2009 held at Epochal, Tsukuba, Japan during 7-12 Dec 2009

    1. 1. Asia-Pacific Geant4 Workshop and Training Course 2009 7-12 December 2009 @ Tsukuba International Congress Center (Epochal), Tsukuba, Japan One Day Training Course http://www-geant4.kek.jp/g4ws09/training.php All materials in this training course are designed for non native English speakers & Geant4 novice users so that slides are described as verbose as possible. Consequently, participants can study by themselves even after this course. “Slides as a Textbook” Go Iwai, KEK/CRC go.iwai@kek.jp
    2. 2. Safety First! We are here Lv4 • Emergency exits and assembly point • Check your evacuation route • Don’t use the lift in an emergency December 7, 2009 APG4WS2009 2
    3. 3. Welcome to Earthquake Country • Be aware of exits in your building • Fire or other emergency evacuation – Follow building residents out of building to the assembly area • Earthquake – Remain in building: Duck, cover, and hold position until shaking stops – Evacuate building to assembly area outside (follow others) – Stay away from windows, downed power lines • In the event of an emergency – Dial 110 for PD, or – Dial 119 for Fires and Ambulance – Provide address • Congress Centre (Epochal): 2-20-3,Takezono,Tsukuba • OKURA FRONTIER HOTELTSUKUBA EPOCHAL: 2-20-1,Takezono, Tsukuba • Daiwa Roynet Hotel: 1-5-7 Azuma, Tsukuba December 7, 2009 APG4WS2009 3
    4. 4. Networking • WiFi – IEEE 802.11b or 802.11g compliant adaptors should be accepted – SSID: tsukuba04 – WEP: Open (Not excypted) • Wired connection – Limited number of sockets: ~16 – Supplied only in front area of this room – If you need wired connection, please let us know • Let us know if you have any difficulties or questions December 7, 2009 APG4WS2009 4
    5. 5. Plan for the week • Talks and practical – Geant4 installation (this course) – Others are shown in next a few slides • Discussion – Before and after each module 5 December 7, 2009 APG4WS2009
    6. 6. Tuesday • Introduction to Geant4 • History of Geant4 • Upcoming release Geant4 version 9.3 • Don’t miss the reception party at Incarose 6:30-8:30PM! December 7, 2009 APG4WS2009 6
    7. 7. Wednesday • Basic Introduction & structure of Geant4 (in Lecture 1) • Introduction to Hadronic & EM Physics (in Lecture 1) • More Physics (in Lecture II-1) • Still more Physics mainly focused on Medicals (in Lecture II-2) • Working session feedback report from users December 7, 2009 APG4WS2009 7
    8. 8. Thursday • Geometry Placement, Physics and Primary Particles (Lecture III) • User Interface, Materials and Scoring (Lecture IV) • Working session feedback report from users December 7, 2009 APG4WS2009 8
    9. 9. Friday • Visualization, Advanced geometry placement, and Detector sensitivity (Lecture V) • Documentation and discussion with your insights we can improve… (Lecture VI) • Follow up for this course (150min) We can follow up on Friday afternoon if anything spill out of this course December 7, 2009 APG4WS2009 9
    10. 10. Agenda Today Time Duration Contents 13:30 - 14:30 60min Introduction 14:30 - 14:45 15min Break 14:45 - 15:45 60min Hands-on work 15:45 - 16:00 15min Break 16:00 - 16:30 30min Installation & Tips 16:30 – 18:00 90min QA & comments December 7, 2009 APG4WS2009 10
    11. 11. Aims in this session • EVERY participants can get started in Geant4 • EVERY participants can install Geant4 by themselves • EVERY participants can proceed next step – i.e. application development! December 7, 2009 APG4WS2009 11
    12. 12. Not aims in this session • I don’t aim… • Advanced technical matter – How to create materials and geometries in Geant4 – How to inject particles – How to define own physics process – And so on… • But question is welcome of course! • I try to profile your questions or difficulties (we have!) and then, allocate appropriate persons to them December 7, 2009 APG4WS2009 12
    13. 13. Starting Point of the Workshop • Tips to make our workshop successfull – To make ourselves comfortable – To be relax during the workshop • Tsukuba is designed as science city… • We don’t have so many choices • A few personal recommendation can be shown in next a few slides December 7, 2009 APG4WS2009 13
    14. 14. http://www-geant4.kek.jp/g4ws09/access.php Google map may help you Lunch CASA Tsukuba Epochal ~1,000JPY Direct access through concourse We are here December 7, 2009 APG4WS2009 14
    15. 15. http://www-geant4.kek.jp/g4ws09/access.php Google map may help you Lunch KFC ~600JPY 500m away 12 min by walk Ton-Q We are here ~2,000JPY 600m away 15 min by walk December 7, 2009 APG4WS2009 15
    16. 16. http://www-geant4.kek.jp/g4ws09/access.php Google map may help you Dinner Sushi: Kintaro Sushi: Yagura ~5,000JPY ~6,000JPY OKURA FRONTIER HOTEL TSUKUBA BBQ: Shu-Yen EPOCHAL ~5,000JPY 200m J-Pub: Tairyo-Maru ~5,000JPY (depend Reception Party at Many restaurant should on quantity & quality be found basement of Incarose of your drink!) DaysTown Tsukuba 18:30-20:30 on Tue We are here December 7, 2009 APG4WS2009 16
    17. 17. http://www-geant4.kek.jp/g4ws09/access.php Google map may help you Shopping Daiwa Roynet Hotel Q’t Shopping Center OKURA FRONTIER HOTEL TSUKUBA EPOCHAL Seibu Shopping Center 500m December 7, 2009 APG4WS2009 17
    18. 18. http://www-geant4.kek.jp/g4ws09/access.php Google map may help you Shopping IIAS Tsukuba: Shopping moll Kenkyu-Gakuen Station next to Tsukuba Sta. 2min next station ~50m walking distance December 7, 2009 APG4WS2009 18
    19. 19. Who am I? My name Go Iwai Where I am working Computing Research Center KEK, Tsukuba My experience in 10 years! since beta-release when I was a MC students! Geant4 I am not wizard… Actually, same with most of you. Platform today Scientific Linux 5.4 x86_64 on VMware Windows Vista x64 as host machine Platform in usual work OpenSUSE on physical box as desktop machine Most of development are on remote resources What I aim in this It’s clear: I am hoping that EVERY participants can get started in course Geant4, can install Geant4 by themselves, can proceed next step, i.e. application development! What community I am My original background was HEP, nowadays I am getting involved in involved in distributed computing science, e.g. LCG. Goal in my research My main responsibility is to design/coordinate/implement national computing resources for a general purpose infrastructure and to show December 7, 2009 my community people how to utilize this with their legacy resources. 19 APG4WS2009
    20. 20. Who’s here!? Please give us your… • Name • Where you work • Your experience in Geant4 – Enough for rough estimation, e.g. 1day? 1week? 1year? • Platform – Today? – In usual work? • What you aim in this course • What community/experiment you are involved in – And role in your community/experiment • Goal in your research or work December 7, 2009 APG4WS2009 20
    21. 21. Break before Hands-on works? If you are not yet ready to start hands-on works, please let us know! I have not yet connected the Internet! I have not yet downloaded VM images! I have not yet installed VMware! I have not yet…. I can not…
    22. 22. Seat Arrangement
    23. 23. Each Group consists of ~4 members We organize based on international Build up Team collaboration! Front of Room Entrance door Team H Team D Team B Entrance door Team F Team G Team A Team C Team E December 7, 2009 APG4WS2009 23
    24. 24. Hands-on 60-90 min
    25. 25. Introduction • As the admin on Grid computing at KEK – Keep up-to-date with the latest software on WNs as well as local cluster machines • A few software is locally packaged out RPM – Including Geant4-related software. – Great improvement on daily duties. • RPMed Geant4 is useful for – Administrators – Application developers – Lectures in tutorial courses • Scope of presentation – Sharing experiences among those who have relevant activities – Help for users who have a difficulty of its long installation time or keeping up-to-date December 7, 2009 APG4WS2009 25
    26. 26. Technology Choice of Package Management APT vs. YUM * Perhaps reflecting my bias Pros Cons APT Wider support across distributions (since its a Debian tool) Not a base part of the FC package set. Perhaps a slightly higher learning curve to use effectively. Many users may be more familiar with APT rather than Harder to roll my own repository YUM EGEE developer team will stop providing apt repository in future YUM Compatible with many update tools, e.g. up2date, apt and Few graphical update/management tool. Yast EGEE developer team will possibly support only YUM on SL4 in future Comes with Fedora by default, widely supported by many RPM repositories. Fairly easy to roll my own repository Simple and powerful user interface • Neither found significant advantage nor disadvantage in APT/YUM • It seems using YUM is better way – As the administrator on Grid December 7, 2009 APG4WS2009 26
    27. 27. Quicker Installation • Just 1min ready to go Geant4 – If network performance is reasonable  • Easy to keep up-to- date – No more waste time for installation http://repo.cc.kek.jp/ December 7, 2009 APG4WS2009 27
    28. 28. Contents of Packages Package Content/Comment geant4 Dynamic libraries e.g.: libG4FR.so, libG4OpenGL.so, libG4RayTracer.so, ... geant4-devel Static libraries , header files and gmk files e.g.: libG4FR.a, libG4OpenGL.a, libG4RayTracer.a, ..., G4RunManager.hh, Stack of geant4 G4RunManagerKernel.hh, ..., common.gmk, binmake.gmk, ... geant4-source Source tree i.e.: All files placed in $G4INSTALL/source clhep Dynamic libraries e.g.: libCLHEP-Random-2.0.4.0.so, libCLHEP.so, ... clhep-devel Static libraries and header files e.g.: libCLHEP-Random-2.0.4.0.so, libCLHEP.so, ..., JamesRandom.h, ThreeVector.h, ... geant4-demo Executable examples Stack of geant4-data e.g.: exampleN01, exampleN02, ..., desktop icon, ... geant4-data Pseudo package, just dependencies are held data_G4NDL ASCII data files data_G4EMLOW All packages depend on geant4-data pseudo package. data_G4ABLA data_Photon... data_Radio... December 7, 2009 APG4WS2009 28
    29. 29. Supported Distros and Architecture As of Dec. 2009 • New: ready for Scientific Linux 5! • Redhat Enterprise Linux clones (SL, CentOS, and SLC) both version 4 and 5 – Both architectures i386 and x86_64 December 7, 2009 APG4WS2009 29
    30. 30. It's really easy, 10 seconds to setup to look up repository here. If your platform is SL5, URL should be addressed: http://repo.cc.kek.jp/SL5/ kek.repo December 7, 2009 APG4WS2009 30
    31. 31. Contents of a repo file “kek.repo” Enabled for two stacks geant4 and geant4-data by default December 7, 2009 APG4WS2009 31
    32. 32. After placing a repo file in /etc/yum.repos.d, just execute “yum install geant4-demo” to install geant4-demo package December 7, 2009 APG4WS2009 32
    33. 33. All dependencies for a geant4-demo package are resolved by yum before staring to install geant4-demo. clhep, geant4 and geant4-data packages are installed in this example. December 7, 2009 APG4WS2009 33
    34. 34. Tips: “yum -y install demo” to skip here. December 7, 2009 APG4WS2009 34
    35. 35. To make sure to set up your environment valuable, logout here and login again December 7, 2009 APG4WS2009 35
    36. 36. After installing geant4-demo, you should find short cut for a demo application in application menu list. December 7, 2009 APG4WS2009 36
    37. 37. You can find an icon on your desktop also December 7, 2009 APG4WS2009 37
    38. 38. Open up terminal window and control window by double clicking the desktop icon. December 7, 2009 APG4WS2009 38
    39. 39. Selectable tab N01-N07 December 7, 2009 APG4WS2009 39
    40. 40. Click “Quit” to terminate a demo December 7, 2009 APG4WS2009 40
    41. 41. $ rpm --query --list geant4 geant4 package provides only shared libraries, it’s enough to work applications. December 7, 2009 APG4WS2009 41
    42. 42. $ rpm --query --list clhep clhep package also provides only shared libraries. December 7, 2009 APG4WS2009 42
    43. 43. Setup • It's really easy, 10 seconds to setup to look up this repository here. # cd /etc/yum.repos.d # wget http://repo.cc.kek.jp/SL4/kek.repo If you are working on SL5: # cd /etc/yum.repos.d # wget http://repo.cc.kek.jp/SL5/kek.repo December 7, 2009 APG4WS2009 43
    44. 44. Geant4 Installation End-Level Users • This “geant4” package provides only shared libraries. – Basically it’s sufficient to run an application. – Neither header files nor static libraries are inclusive. (install geant4-devel package if necessary) – Useful for cloning too many nodes. • A package “geant4-data” is ascii data set of Geant4 – Pseudo package, provides only dependencies for actual data files. • i.e. data_G4ABLA, data_G4EMLOW, data_G4NDL, data_PhotonEvaporation and data_RadioactiveDecay # yum install geant4 # yum install geant4-data December 7, 2009 APG4WS2009 44
    45. 45. Novice example N01 • Fixed geometry – Ar gas mother volume with Al cylinder and Pb block with Al slices • Incident particle is a geantino – no physics interactions – only the transportation process is enabled • Hard coded batch job and verbosity
    46. 46. Novice Example N03 • Sampling calorimeter with layers of Pb absorber and liquid Ar detection gaps (replicas) • Exhaustive material definitions • Command interface • Randomization of incident beam • All EM processes + decay, with separate production cuts for γ, e+, e- • Detector response: E deposit, track length in absorber and gap • Visualization tutorial • Random number seed handling
    47. 47. Novie Example N02 • Pb target, Xe gas chambers (parameterized volumes) • All EM processes + decay including charged leptons and charged hadrons • Detector response – Trajectories and chamber hit collections may be stored • Visualization of detector and event • Command interface introduced – Can change target, chamber materials, magnetic field, incident particle type, momentum, etc. at run time
    48. 48. Novie Example N04 • Simplified collider detector – all kinds of volume definitions • Magnetic field • PYTHIA primary event generator – Higgs decay by Z0, lepton pairs • Packaged physics list (QGSP) • Event filtering by using stacking mechanism
    49. 49. Novice Example N05 • Fast simulation with parameterized showers – EM showers (derived from G4VFastSimulationModel) – Pion showers (for illustration only – not used) • EM physics only – Use of G4FastSimulationManagerProcess • Simplified collider detector geometry – Drift chamber – EM, hadronic calorimeter – Ghost volume
    50. 50. Novice Example N06 • Water Cerenkov detector with air “bubble” • Materials – Specification of optical properties – Specification of scintillation spectra • Physics – Optical processes – Generation of Cerenkov radiation, energy loss collected to produce scintillation
    51. 51. Novice Example N07 • 3 simplified sandwich calorimeters (Pb, Al, Ar) • Cylindrical ghost volume for scoring • Run-based (as opposed to event-based) hit accumulation • Changing geometries without rebuilding world • Setting different secondary production cuts for each calorimeter using G4Region
    52. 52. Make Your Application! December 7, 2009 APG4WS2009 52
    53. 53. Geant4 Installation Application Developers • A package “geant4-devel” is necessary if you as the application developer, want header files or static libraries. • The “geant4-source” may be useful as references or debugging. # yum install geant4-devel December 7, 2009 APG4WS2009 53
    54. 54. External Tools for Visualization • A package “dawn” and “vrmlview” is necessary if you would like to visualize your simulation results graphically. # yum install vrmlview dawn December 7, 2009 APG4WS2009 54
    55. 55. Build & Run $ wget http://www-geant4.kek.jp/g4users/g4tut07/download/exercise- 2.tar.gz $ tar zxvf exercise-2.tar.gz $ cd exercise-2 $ ls GNUmakefile ex02.cc gun.mac include/ src/ vis.mac vrml.mac $ make ... $ ./bin/Linux-g++/ex02 ... ex02(Idle)[/]:/control/execute vis.mac 55
    56. 56. Advanced Hands-on Try this if you could finish everything earlier and getting boring  December 7, 2009 APG4WS2009 56
    57. 57. Rotate Tube • Edit DetectorConstruction class – src/DetectorDescription.cc G4RotationMatrix* rotM= new G4RotationMatrix; rotM-> rotateY(-90.*deg); new G4PVPlacement(rotM, G4ThreeVector(), tubeLV, "tube", boxLV, false, 0); December 7, 2009 APG4WS2009 57
    58. 58. Volume Placement • Place 6 volumes 45 degree rotated about an z-axis • Edit DetectorConstruction class const G4double dphi= 45.*deg; for(G4int i=0; i<6; i++) { // check rotation directioon!! G4ThreeVector armVec= G4ThreeVector(30.*cm, 0., 0.); G4RotationMatrix armRot= G4RotationMatrix(); armVec.rotateZ(dphi*i); armRot.rotateZ(dphi*i); new G4PVPlacement(G4Transform3D(armRot, armVec), boxLV, "box", worldLV, false, i); // copy# should be unique. } December 7, 2009 APG4WS2009 58
    59. 59. Beam On! $ ./bin/Linux-g++/ex02 ... ex02(Idle)[/]:/control/execute gun.mac ex02(Idle)[/]:/control/execute vis.mac ex02(Idle)[/]:/run/beamOn December 7, 2009 APG4WS2009 59
    60. 60. Let’s have a break!
    61. 61. Geant4 Installation Guide
    62. 62. If you can understand a SPEC file in SRPM… • It is the best practical example to install Geant4 – http://repo.cc.kek.jp/SL4/geant4/SRPMS/ – http://repo.cc.kek.jp/SL5/geant4/SRPMS/ To understand dependency in “BuildRequires” BuildRequires: mesa-libGL-devel, mesa-libGLU-devel BuildRequires: xorg-x11-proto-devel, openmotif-devel BuildRequires: xerces-c-devel Everything in a SPEC file! December 7, 2009 APG4WS2009 62
    63. 63. To understand build procedure in “%build” section #...snip export G4SYSTEM=%{g4system} export G4INSTALL=%{_builddir}/%{name}.%{version} export CLHEP_BASE_DIR=/opt/clhep export G4LIB_BUILD_GDML=1 export XERCESCROOT=/usr export G4VIS_BUILD_DAWN_DRIVER=1 export G4VIS_BUILD_VRML_DRIVER=1 export G4VIS_BUILD_RAYTRACERX_DRIVER=1 export G4VIS_BUILD_OPENGLX_DRIVER=1 export G4VIS_BUILD_OPENGLXM_DRIVER=1 cd $G4INSTALL/source %{__make} %{?_smp_mflags} export G4LIB_BUILD_SHARED=1 export G4LIB=$G4INSTALL/slib export G4TMP=$G4INSTALL/tmp-slib cd $G4INSTALL/source But some magic %{__make} %{?_smp_mflags} words might %{__make} global discourage us  %{__make} includes December 7, 2009 APG4WS2009 63
    64. 64. http://geant4.slac.stanford.edu/tut orial/installation/Geant4.9.2.p02/L inux/Geant4_9_2_p02_Linux_Installat ion.htm Joseph’s Installation Note Note that we assume to install everything into your $HOME/geant4 in your home directory. This means that you don’t need any special privilege. Thank Joseph! Mac and Windows also available, find here: http://geant4.slac.stanford.edu/SLACTutorial09/Agenda.html December 7, 2009 APG4WS2009 64
    65. 65. What are the two pieces of software required for building Geant4? • gcc 3.4.6 (for SLC4 or RedHat 4) or gcc 4.2.1 (for SLC5 or RedHat 5): gcc is the compiler that is recommended for Geant4 on Linux. Users have also had success with some other gcc versions, but there is no guarantee. To check your version, type: gcc –v. • CLHEP: CLHEP is a set of base libraries that have long provided great functionality for the particle physics community. They provide things like matrix manipulations, four-vector tools and lists of particle properties. The Geant4 collaboration has chosen to use these libraries rather than re-invent these wheels. Please note that while CLHEP and Geant4 both come out of the particle physics communities, they are separate products - the Geant4 collaboration is not responsible for maintenance, distribution or documentation of CLHEP. December 7, 2009 APG4WS2009 65
    66. 66. Getting and Installing CLHEP • Go to the CLHEP source download page: • http://proj-clhep.web.cern.ch/proj- clhep/DISTRIBUTION/clhep.html • From the "Source" section near the bottom of the page, select "clhep-2.0.4.2.tgz“ • which corresponds to: • http://proj-clhep.web.cern.ch/proj- clhep/DISTRIBUTION/distributions/clhep- 2.0.4.2.tgz December 7, 2009 APG4WS2009 66
    67. 67. $ cd /tmp $ wget http://proj-clhep.web.cern.ch/proj- clhep/DISTRIBUTION/distributions/clhep-2.0.4.2.tgz And then, $ tar -zxvf clhep-2.0.4.2.tgz The unpacking process will begin, starting with: 2.0.4.2/ 2.0.4.2/CLHEP/ 2.0.4.2/CLHEP/CVS/ 2.0.4.2/CLHEP/CVS/Root 2.0.4.2/CLHEP/CVS/Repository And ending with: 2.0.4.2/CLHEP/Vector/configure 2.0.4.2/CLHEP/config.guess 2.0.4.2/CLHEP/config.sub 2.0.4.2/CLHEP/Makefile.in 2.0.4.2/CLHEP/configure December 7, 2009 APG4WS2009 67
    68. 68. Now navigate into the unpacked directory and begin the configuration process. $ cd /tmp/2.0.4.2/CLHEP $ ./configure --prefix $HOME/geant4/clhep You should get a response that starts with: checking build system type... i686-pc-linux-gnu checking host system type... i686-pc-linux-gnu checking target system type... i686-pc-linux-gnu checking for a BSD-compatible install... /usr/bin/install –c checking whether build environment is sane... Yes And ends with: config.status: creating test/exctest4.sh config.status: creating test/exctestNothrow.sh config.status: creating test/excDblThrow.sh config.status: creating Exceptions/defs.h config.status: executing depfiles commands$ cd $HOME/CLHEP/ December 7, 2009 APG4WS2009 68
    69. 69. For the following, be sure to type make rather than gmake. It can be very hard to remember which of these to type. One some Linux systems, they may even do the exact same thing, but not always. So for your CLHEP and Geant4 work, don't use gmake. Run the build process: $ make You should get a response that starts with: Making all in Units make[1]: Entering directory `/afs/slac.stanford.edu/u/ey/perl/CLHEP/2.0.4.2/CLHEP/Units‘ Making all in Units make[2]: Entering directory `/afs/slac.stanford.edu/u/ey/perl/CLHEP/2.0.4.2/CLHEP/Units/Units‘ make all-am And ends with: rm -f libCLHEP-2.0.4.2.so liblist=`./getObjectList -shared Units Vector Evaluator GenericFunctions Geometry Random Matrix RandomObjects RefCount Cast Exceptions`; ¥ g++ -O -ansi -pedantic -Wall -D_GNU_SOURCE -g -O2 -o libCLHEP-2.0.4.2.so -shared - Wl,-soname,libCLHEP-2.0.4.2.so $liblist –o libCLHEP-2.0.4.2.so ./build-header make[1]: Leaving directory `/afs/slac.stanford.edu/u/ey/perl/CLHEP/2.0.4.2/CLHEP'Now navigate into the unpacked directory and begin the configuration process. $ make install December 7, 2009 APG4WS2009 69
    70. 70. Dynamic or Static? • After completing to install CLHEP, you can find libCLHEP-2.0.4.2.so and libCLHEP-2.0.4.2.a in $HOME/clhep/lib directory. • By default, liker try to link dynamic library, i.e. libCLHEP-2.0.4.2.so – In this case, you should set LD_LIBRARY_PATH as $HOME/clhep/lib – Personally, I don’t recommend this • If you want to use a static library, i.e. libCLHEP-2.0.4.2.a, follow this instruction to remove dynamic library here: $ cd $HOME/geant4/clhep/lib $ ls libCLHEP-2.0.4.2.a libCLHEP-Matrix-2.0.4.2.a libCLHEP-2.0.4.2.so* libCLHEP-Matrix-2.0.4.2.so* libCLHEP-Cast-2.0.4.2.a libCLHEP-Random-2.0.4.2.a libCLHEP-Cast-2.0.4.2.so* libCLHEP-Random-2.0.4.2.so* libCLHEP-Evaluator-2.0.4.2.a libCLHEP-RandomObjects-2.0.4.2.a libCLHEP-Evaluator-2.0.4.2.so* libCLHEP-RandomObjects-2.0.4.2.so* libCLHEP-Exceptions-2.0.4.2.a libCLHEP-RefCount-2.0.4.2.a libCLHEP-Exceptions-2.0.4.2.so* libCLHEP-RefCount-2.0.4.2.so* libCLHEP-GenericFunctions-2.0.4.2.a libCLHEP-Vector-2.0.4.2.a libCLHEP-GenericFunctions-2.0.4.2.so* libCLHEP-Vector-2.0.4.2.so* libCLHEP-Geometry-2.0.4.2.a libCLHEP.a@ libCLHEP-Geometry-2.0.4.2.so* libCLHEP.so@ $ rm libCLHEP.so December 7, 2009 APG4WS2009 70
    71. 71. Getting Geant4 • From the top of the Geant4 home page: – http://geant4.web.cern.ch/geant4/ • Select "Download" from near the top right corner of the page. • Select "Unix tar format, compressed using gzip" • which corresponds to: – http://geant4.web.cern.ch/geant4/support/source /geant4.9.2.p02.tar.gz December 7, 2009 APG4WS2009 71
    72. 72. Navigate to this directory and unpack the file: $ cd $HOME/geant4 $ wget http://geant4.web.cern.ch/geant4/support/source/geant4.9.2.p02.tar. gz $ tar zxvf geant4.9.2.p02.tar.gz The unpacking process will begin, starting with: geant4.9.2.p02/ geant4.9.2.p02/ReleaseNotes/ geant4.9.2.p02/ReleaseNotes/Beta4.9.2-1.txt geant4.9.2.p02/ReleaseNotes/Patch4.4.0-1.txt geant4.9.2.p02/ReleaseNotes/Patch4.4.0-2.txt And ending with: geant4.9.2.p02/source/visualization/modeling/src/G4VModel.cc geant4.9.2.p02/source/visualization/modeling/src/G4VTrajectoryModel .cc geant4.9.2.p02/source/visualization/modeling/src/G4VisTrajContext.c c geant4.9.2.p02/source/GNUmakefile December 7, 2009 APG4WS2009 72
    73. 73. Getting Data Files • Depending on the physics of your particular application, you may need to install additional data files. These data files can be downloaded separately from the Geant4 source distribution page (the same place where you got Geant4 itself). • Create a new folder within ~/geant4 to hold any of these required data files. ~/geant4/data December 7, 2009 APG4WS2009 73
    74. 74. For now, pick up the "data files for low energy electromagnetic processes": $ mkdir –p $HOME/geant4/data $ cd $HOME/geant4/data $ wget http://geant4.web.cern.ch/geant4/support/source/G4EMLOW.6.2.tar.gz $ tar zxvf G4EMLOW.6.2.tar.gz The unpacking process will begin, starting with: G4EMLOW6.2/ G4EMLOW6.2/auger/ G4EMLOW6.2/auger/au-tr-pr-10.dat G4EMLOW6.2/auger/au-tr-pr-100.dat G4EMLOW6.2/auger/au-tr-pr-11.dat And ending with: G4EMLOW6.2/tripdata/pp-trip-cs-95.dat G4EMLOW6.2/tripdata/pp-trip-cs-96.dat G4EMLOW6.2/tripdata/pp-trip-cs-97.dat G4EMLOW6.2/tripdata/pp-trip-cs-98.dat G4EMLOW6.2/tripdata/pp-trip-cs-99.dat December 7, 2009 APG4WS2009 74
    75. 75. Doing the Initial Build • TAKE YOUR TIME AT THIS STAGE, DON'T RUSH IT. • Mistakes made at this stage can be very time-consuming to correct. Slow down. • Maybe get a cup of coffee (or a glass of wine) before you proceed. Breathe. • Finally, unless you're absolutely sure you are starting from a nice clean system, make sure you don't have any pre-existing Geant4 environment variables. You can use the "printenv" or “env” command to show all variables, and filter this with a "grep" for the string G4 as follows: • From a Terminal or xterm window: • printenv | grep G4 • If any variables show up, find out what is setting them and remove them. They might be coming from your .login or .cshrc file or from some other script that you invoke upon login for some other project. Take the time now to find the cause and resolve it. December 7, 2009 APG4WS2009 75
    76. 76. Basic Environment Variables for sh family including bash export G4SYSTEM=Linux-g++ export G4INSTALL=$HOME/geant4/geant4.9.2.p02 export CLHEP_BASE_DIR=$HOME/geant4/clhep export G4VIS_BUILD_DAWN_DRIVER=1 export G4VIS_BUILD_VRML_DRIVER=1 export G4VIS_BUILD_RAYTRACERX_DRIVER=1 export G4VIS_BUILD_OPENGLX_DRIVER=1 export G4VIS_BUILD_OPENGLXM_DRIVER=1 # export G4LIB_BUILD_GDML=1 # if you want to build GDML # export XERCESCROOT=/usr # if you want to build GDML December 7, 2009 APG4WS2009 76
    77. 77. After setup environment varuables, move to geant4 source directory and start to make it: $ cd $G4INSTALL/source # correspond to $HOME/geant4/geant4.9.2.p02/source $ export LANG=POSIX $ make 2>&1 | tee make.log ... $ make incudes ... December 7, 2009 APG4WS2009 77
    78. 78. Check Your Installation • It should be noted that environment valuables at building Geant4 main libraries and your applications are different! (not always) December 7, 2009 APG4WS2009 78
    79. 79. export G4SYSTEM=Linux-g++ export G4INSTALL=$HOME/geant4/geant4.9.2.p02 export CLHEP_BASE_DIR=$HOME/geant4/clhep # export G4LIB_USE_GDML=1 # if you want to use GDML # export XERCESCROOT=/usr # if you want to use GDML export G4VIS_USE_DAWN=1 export G4VIS_USE_VRML=1 export G4VIS_USE_RAYTRACERX=1 export G4VIS_USE_OPENGLX=1 export G4VIS_USE_OPENGLXM=1 export G4UI_USE_TCSH=1 export G4UI_USE_GAG=1 export G4NEUTRONHPDATA=$HOME/geant4/data/G4NDL3.13 export G4LEDATA==$HOME/geant4/data/G4EMLOW6.2 export G4LEVELGAMMADATA==$HOME/geant4/data/PhotonEvaporation2.0 export G4RADIOACTIVEDATA==$HOME/geant4/data/RadioactiveDecay3.2 export G4ABLADATA==$HOME/geant4/data/G4ABLA3.0 # if you want to link dynamic library libeCLHEP.so, not libCLHEP.a # export LD_LIBRARY_PATH=$CLHEP_BASE_DIR/lib December 7, 2009 APG4WS2009 79
    80. 80. $ cd /tmp $ cp –a $G4INSTALL/examples/novice/N01 . $ cd N01 Important & Convenient Tips! Just insert one line G4WORKDIR = . In your GNUmakefile This variable specifies your working directory, i.e. everything are build in this directory. Otherwise your application will be placed under $G4INSTALL name := exampleN01 G4TARGET := $(name) G4EXLIB := true G4WORKDIR = . ifndef G4INSTALL G4INSTALL = ../../.. endif .PHONY: all all: lib bin include $(G4INSTALL)/config/binmake.gmkAPG4WS2009 December 7, 2009 80
    81. 81. $ make … $ ./bin/Linux-g++/exampleN01 ************************************************************* Geant4 version Name: geant4-09-02-patch-01 (13-March-2009) Copyright : Geant4 Collaboration Reference : NIM A 506 (2003), 250-303 WWW : http://cern.ch/geant4 ************************************************************* ...snip Track (trackID 1, parentID 0) is processed with stopping code 2 ### pop requested out of 0 stacked tracks. ### 0 waiting tracks are re-classified to 0 urgent tracks and 0 waiting tracks. NULL returned from G4StackManager. Terminate current event processing. Run terminated. Run Summary Number of events processed : 3 User=0s Real=0.01s Sys=0s G4December 7, 2009 kernel has come to Quit state.APG4WS2009 81
    82. 82. How to keep up to date • Major/Minor release: one time a year (end of Year usually) • Beta release: 6 months prior to major/minor release (June usually) • Patch release: a few times a year (irregular) • If find the latest version, download and rebuild it – It is subject for Geant4 users to keep up-to-date! December 7, 2009 APG4WS2009 82
    83. 83. Shall we have a break?
    84. 84. QA and Comments Note that we should lock this room and return a key to administration office so we would like to close this session by ~5:45PM
    85. 85. Acknowledgement http://www-public.slac.stanford.edu/geant4/Tutorial2009.asp Many of slides are copied and pasted from SLAC Geant4 Tutorial Course 2009 Thanks to Joseph Perl and SLAC Geant4 Team http://www-geant4.kek.jp/g4ws09/training.php Communication channel to me Go Iwai, KEK/CRC go.iwai@kek.jp December 7, 2009 As goiwai onAPG4WS2009 85

    ×