- leun's home page
- Posts
- 2013
- 2012
- December (2)
- October (3)
- September (2)
- August (1)
- July (4)
- June (4)
- May (2)
- April (3)
- March (5)
- February (5)
- January (5)
- 2011
- December (3)
- November (3)
- September (5)
- August (2)
- July (2)
- June (3)
- May (4)
- April (4)
- March (2)
- February (4)
- January (2)
- 2010
- December (2)
- November (3)
- October (3)
- September (5)
- August (6)
- July (2)
- June (4)
- May (3)
- April (4)
- March (4)
- February (2)
- January (4)
- 2009
- 2008
- October (1)
- My blog
- Post new blog entry
- All blogs
How to Insert User Step Routine to GSTAR
How to Insert User Step Routine to GSTAR
Geant manual states that a user can write a custom hit-calculation routine (GUSTEP) for a sensitive volume, which will be called by GTRACK at the end of every step, and when entering a new volume. The following is my understanding of how to do this in the context of GSTAR and starsim.
For the purpose of record keeping, I will describe the process here. When it comes to STAR software, I am very much structurally challenged, so please excuse my ignorance on that front.
The first part comes from an ancient document posted on Drupal plus my own investigation.
1. Write a subroutine that calculates hits with a specific naming convention. If the sensitive volume that you want to associate this routine with has the name YYYY, (always 4 character) then the name of the subroutine should be YYYYstep(pointer,hit). From the document, "Their first integer input argument pointer is the address of the hit descriptor array (10 words, real) in the GCBANK memory", and the second argument is the hit value to be returned.
2. Stick this subroutine with other geometry files. (geometry/fpdmgeo in my case). I'm not sure exactly where this file has to be, but emprically this works fine. There is one such file currently in my directory, /star/u/leun/sim/fpdsim6/export/pams/geometry/fpdmgeo/ffpdstep.g
3. Modify the geometry file in use in two ways. (/star/u/leun/sim/fpdsim6/export/pams/geometry/fpdmgeo/fpdmgeo2.g) Let's called the sensitive volume of interest FPCT. First, declare the subroutine you wrote as external. (example: EXTERNAL FPCTSTEP) Second, find the line that declares the method of hit calculation for the volume of interest (example: "HITS FPCT ELOS:0:(0,50)") and replace it with "HITS YYYY USER:<Nbits>:(<min>,<max>)" (example: "HITS FPCT USER:0:(0,100000)") Here, ELOS is one of the many standard methods of hit calculation. 0 for Nbit should work fine for the most part, and min and max are the minimum and maximum hit values.
Compile by running cons, and now you have your own hit calculation that will be called by Geant.
As an example, here is a subroutine used to count Cerenkov photons in the FPD photocathode. (Written by someone else, comments added by me)
- leun's blog
- Login or register to post comments