Home
Geant4 User`s Guide for Application Developers
Contents
1. name sim G4TARGET name G4EXLIB true CPPFLAGS IS HOME Xplotter include EXTRALIBS L HOME Xplotter lib l1Xplotter EXTRA LINK DEPENDENCIES HOME Xplotter lib libXplotter a PHONY all cULIEE das T9559 include G4INSTALL config binmake gmk HOME Xplotter lib libXplotter a cd HOME Xplotter MAKE 5 3 2 Adding external libraries which use Geant4 In addition to the above specify in EXTRALIBSSOURCEDIRS a list of directories containing source files in its src subdirectory Thus your GNUmakefile might contain EXTRALIBS G4WORKDIR tmp G4SYSTEM lt myApp gt lib lt myApp gt a L your path lib l lt myExtraLib gt EXTRALIBSSOURCEDIRS lt your path gt lt myApp gt lt your path gt lt MyExtraModule gt EXTRA LINK DEPENDENCIES G4WORKDIR tmp G4SYSTEM myApp lib myApp a MYSOURCES wildcard lt your path gt lt myApp gt src cc GAWORKDIR tmp GASYSTEM lt myApp gt lib lt myApp gt a MYSOURCES cd lt your path gt lt myApp gt S MAKE See Example 2 273 Appendix Example 2 An example of a customised GNUmakefile for an application or example using external modules bound to Geant4 e c O ASTE KO L S A E i ey eee ee OS S O eee Nee rae A GNUmakefile for the application phys depending on
2. as an isolated mechanism Em15 as a result of particle transport Em5 More global verifications Single layer transmission absorption reflexion Em5 Bragg curve tallies Em7 Depth dose distribution Em11 Em12 Shower shapes Moliere radius Em2 Sampling calorimeters energy flow Em3 Crystal calorimeters Em9 Other specialized programs High energy muon physics Em17 Other rare high energy processes Em6 Synchrotron radiation Em16 Transition radiation Em8 Photo absorption ionization model Em10 Table 9 4 TestEm by theme 254 Examples 9 2 1 3 Event Biasing General ReadMe 9 2 1 4 Event Generator e HepMCEx01 simplified collider detector using HepMC interface and stacking e HepMCEx02 connecting primary particles in Geant4 with various event generators using the HepMC in terface e MCTruth demonstrating a mechanism for Monte Carlo truth handling using HepMC as the event record e exgps illustrating the usage of the G4GeneralParticleSource utility 9 2 1 5 Fields BlineTracer tracing and visualizing magnetic field lines e field0l tracking using magnetic field and field dependent processes e field02 tracking using electric field and field dependent processes field03 tracking in a magnetic field where field associated with selected logical volumes varies 9 2 1 6 Geant3 to Geant4 e General ReadMe converting simple geometries in Geant3 21 to
3. G4LIB_BUILD_SHARED Flag specifying if to build kernel libraries as shared libraries libraries will be then used by default If not set static archive libraries are built by default G4LIB_BUILD_STATIC Flag specifying if to build kernel libraries as static archive libraries in addition to shared libraries in case SG4LIB_BUILD_SHARED is set as well G4LIB_BUILD_DLL Internal flag for specifying to build DLL kernel libraries for Windows systems The flag is automatically set when requested to build DLLs G4LIB_USE_DLL For Windows systems only Flag to specify to build an application using the installed DLL kernel libraries for Windows systems It is required to have this flag set in the environment in order to successfully build an application if the DLL libraries have been installed G4LIB_USE_GRANULAR To force usage of granular libraries against compound libraries at link time in case both have been in stalled The Geant4 building system chooses compound libraries by default if installed UI specific The most relevant flags for User Interface drivers are just listed here A more detailed description is given also in section 2 of this User s Guide G4UI USE TERMINAL Specifies to use dumb terminal interface in the application to be built default G4UI USE TCSH Specifies to use the tcsh shell like interface in the application to be built G4UI BUILD XM SESSION G4UI BUILD XAW SESSION Specifies to
4. seem e 191 8 1 4 Controlling Visualization Lose eit tirer Rage Pere Ere RR ai ssp k aa as 192 8 1 5 Vasualization Details oren irte eI ETE Een LEY 192 8 2 Adding Visualization to Your Executable lt a kaka aaa aaa kaka aaa aaa aaa 192 8 2 1 Installing Visualization Drivers 2 0 0 0 cece cece aa aaa aaa aa aaa aaa aaa aaa aaa 192 8 2 2 How to Realize Visualization Drivers in an Executable sese 193 82 3 A Sample Set up File i bs Re elec cess Us as sa ceed 194 8 24 Visualization Manager tu u entero ett a vet a i a Di a i ade eg a aswel 194 8 2 5 How to Write the main Function lt a aaa asas Hmm aa aaa aaa aa aaa 195 8 3 The Visualization Drivers ied rr De Vas E Tinis seta es Kai a V adda sn D E 196 8 3 1 Availability of drivers on the supported systems sess 197 8 327 OpenGL 2c iet te ete bete GET re exei to e bat iste e heo aired etre 197 8 3 3 OpenInventor e eee eei eerie rbi eere a erre ceder PD e ren e eii 198 8 344 HepRepFile Liebe Herr mehr IRR TP ud an ae ES 198 8 35 HepRepXML LL siais einen eiii pe eene iu 200 8 3 6 DAWN 2i tete be ette sette vpn t rerit et GR ere a gute ke ta E a 201 8 3 7 Remote Visualization with the DAWN Network Driver eee 202 8 3 8 VRML eno rre rtr RR REFUS EI REPRE UR ERR 203 8 319 Ray Tracer TERGUM EIDEM isi 205 8 3 10 Visualization of detector geometry tree 205 8 3 11 GAG Treb EM ERES 206 8 3 12 XML THe irs iD
5. vis drawVolume Add trajectories to the current scene Note This command is not necessary in examples novice N03 is described in the event action vis scene add trajectories Set viewing parameters vis viewer reset vis viewer set viewpointThetaPhi 10 20 Visualize one it run beamOn 1 HEHE HEE FE FE FE E FE HEE FE FE FE FE HEE FE E FE FE RHEE HEE HEE Visualization with the DAWNFILE driver RHE FE AE E FE AE FE FE AE FE FE FE HE FE FE E FE AE FE FE AE FE FE FE HE FE EFE HE E E E EE E EE E EE Invoke the DAWNFILE driver Create a scene handler and a viewer for t vis open DAWNFILE vis drawVolume Add trajectories to the current scene Create an empty scene and add detector com Started with Geant4 of events trajectories USAGE Save the commands below as a macro file say vis2 mac and execute it as follows 3 G4BINDIR exampleN03 dle gt control execute visl mac EERE EERE EE EEH H HHT HEE AE FE FE HE HE FE HE FE FE AE FE EHEH H E EERE TE EAE EEE EEH H FE EFE FE AE FE FE AE FE FE AE FE FE E FE FE E FE TE AE FE TE AE FE TE HE FE TE E E EE E EE Store particle trajectories for visualization tracking storeTrajectory 1 FE EAE FE EE FE AE FE FE AE FE FE E FE FE AE E FE AE FE FE AE FE FE E FE FE E FE FE AE FE FE AE FE FE HE FE TE HE FE TE AE FE EAE E EE E E EERE TE EFE EE EEH H FE EFE FE EAE FE AE FE FE AE FE FE FE E FE FE EE FE FE FE FE FE FE FE FE FE E FE FE E H H E E H E H Visualization with the OGL
6. GetPreviousEvent G4int i thPrevious The pointer to the i thPrevious G4Event object can be obtained through this method A pointer to a const object is returned It is inevitable that i thPrevious events must have already been simulated in the same run for getting the i thPrevious event Otherwise this method returns nu11 AbortRun This method should be invoked whenever the processing of a run must be stopped It is valid for GeomClosed and EventProc states Run processing will be safely aborted even in the midst of processing an event However the last event of the aborted run will be incomplete and should not be used for further analysis 3 4 1 3 G4UserRunAction G4UserRunAction is one of the user action classes from which you can derive your own concrete class This base class has two virtual methods as follows BeginOfRunAction This method is invoked at the beginning of the BeamOn method but after confirmation of the conditions of the Geant4 kernel Likely uses of this method include e setting a run identification number e booking histograms setting run specific conditions of the sensitive detectors and or digitizer modules e g dead channels EndOfRunAction This method is invoked at the very end of the BeamOn method Typical use cases of this method are e store print histograms manipulate run summaries 3 4 2 Geant4 as a state machine Geant4 is designed as a state machine Some methods in G
7. G4Step aStep retrieve the pre step point G4StepPoint preStepPoint aStep gt GetPreStepPoint retrieve a touchable handle and access to the information G4TouchableHandle theTouchable preStepPoint GetTouchableHandle G4int copyNo theTouchable gt GetCopyNumber G4int motherCopyNo theTouchable gt GetCopyNumber 1 To determine the exact position in global coordinates in the mass geometry and convert to local coordinates local to the current volume G4ThreeVector worldPosition preStepPoint gt GetPosition G4ThreeVector localPosition theTouchable gt GetHistory gt GetTopTransform TransformPoint worldPosition Using an alternative navigator to locate points In order to know when in the idle state of the application in which physical volume a given point is located in the detector geometry it is necessary to create an alternative navigator object first and assign it to the world volume G4Navigator aNavigator new G4Navigator aNavigator gt SetWorldVolume worldVolumePointer Then locate the point myPoint defined in global coordinates retrieve a touchable handle and do whatever you need with it 94 Detector Definition and Response aNavigator LocateGlobalPointAndSetup myPoint G4TouchableHistoryHandle aTouchable aNavigator CreateTouchableHistoryHandle Do whatever you need with it convert point in local c
8. end of C source code Next in order that the above C source code works you have to pass the information of the MySteppingAction to the Run Manager in the main function C source code Passing what to do at each step to the Run Manager int main Run Manager G4RunManager runManager new G4RunManager User initialization classes 222 Visualization runManager gt SetUserAction new MySteppingAction end of C source code Thus you can visualize tracking steps with various visualization attributes e g color at each step automatically As well as tracking steps you can visualize any kind 3D object made of line segments using class G4Polyline and its drawing method defined in class G4VVisManager See for example the implementation of the vis scene add axes command 8 5 10 Visualization User Action You can implement the Draw method of G4VUserVisAction e g the class definition could be class StandaloneVisAction public G4VUserVisAction void Draw kg and the implementation void StandaloneVisAction Draw G4VVisManager pVisManager G4VVisManager GetConcreteInstance if pVisManager 72 Sane c Ier pVisManager Draw G4Box box 2 m 2 m 2 m G4VisAttributes G4Colour 1 1 0 Boolean solid GABOR loopeN Moore Saul Sig Sida NA GABOR OEIONDOBI Iam eme Ts G4SubtractionSolid subtracted subtracted boxes amp boxA amp boxB
9. create a decay channel G4VDecayChannel mode pi0 gt gamma gamma mode new G4PhaseSpaceDecayChannel pi0 0 988 2 gamma gamma table gt Insert mode pi0 gt gamma e e mode new G4DalitzDecayChannel pi0 0 012 e e Table Insert Anoda Decay modes and branching ratios defined in Geant4 are listed in Section 5 3 2 5 2 3 3 Pre assigned Decay Modes by Event Generators Decays of heavy flavor particles such as B mesons are very complex with many varieties of decay modes and decay mechanisms There are many models for heavy particle decay provided by various event generators and it is impossible to define all the decay modes of heavy particles by using G4VDecayChannel In other words decays of heavy particles cannot be defined by the Geant4 decay process but should be defined by event generators or other external packages Geant4 provides two ways to do this pre assigned decay mode and external decayer In the latter approach the class G4VExtDecayer is used for the interface to an external package which defines decay modes for a particle If an instance of G4VExtDecayer is attached to G4Decay daughter particles will be generated by the external decay handler In the former case decays of heavy particles are simulated by an event generator and the primary event contains the decay information G4VPrimaryGenerator automatically attaches any daughter particles to the parent particle as the PreAss
10. Geant4 User s Guide for Application Developers AAT I eik ss isthe bs MEE EAE 114 4 4 2 Sensitive detector ioi ie p ses phoned Saadeh ERR d a poeta Side hasbeen atest 116 4 4 3 Readout geometry tere iad Better ssh eve i ae 117 4 454 GASDManager 5 erit cats e ted re a a Pass E S IS aa RET 118 4 4 5 G4MultiFunctionalDetector and G4VPrimitiveScorer esses e 119 4 4 6 Concrete classes of G4VPrimitiveScorer eessesssesseseeeee m Heer 121 4 4 7 G4VSDFilter and its derived classes sese 123 4 5 Digitization 5 cei e rte RP eR EFE Pre MEN prr Oea EE 124 ASM DIBE ui EHE INE IUE IN IP EE eEIes 124 4 52 Digitizer module ispere roter te ERR PERRO E EE ER EFE a aR EE ER 124 4 6 Object Persistency esee teer oi erste ve erp erae ete See rer tri ete ve rev cece 125 4 6 1 Persistency in Geaptd o estet rere breite a ss 125 4 6 2 Using Reflex for persistency of Geant4 objects ssssses ee aaa cece een een eens 126 4 7 Parallel Geometries ix t etre ros e sa a beste pha a sek Pat EE RT a a i yaa nets 126 47 1 A parallel world re e mee Rp 126 4 72 Defining a parallel world cs s reisseri rnai rosae kE Pese APATE Re ERE ERI HERR ERR 126 4 7 3 Detector sensitivity in a parallel world sesee aaa 128 5 Tracking and Physics rrr ea re tete et yere ter betas ete Ee ease tess 129 SNC AM 129 Sel T Basic Con
11. If the standard CLHEP installation procedure has been adopted the variable CLHEP_BASE_DIR should point to the area where include and lib directories for CLHEP headers amp library are installed in your system In case the library file name is different than the one expected 1ilbCLHEP a you should either create a symbolic link with the expected name or define the variable CLHEP_LIB in your environment which explicitly sets the name of the CLHEP library If a non standard CLHEP installation has been adopt ed define variables CLHEP_INCLUDE_DIR CLHEP_LIB_DIR and CLHEP LIB to refer explicitly to the place where headers library and library name respectively are placed in your system On Windows systems the full library file name with extension should be specified as CLHEP_LIB while for UNIX like systems just the name is required i e CLHEP for libCLHEP a While installing the Geant4 libraries I get the following message printed gmake 1 cernlib Command not found Has Geant4 been installed properly What to do to solve this error The message gmake 1 cernlib Command not found shows that you don t have the cernlib command installed in your system cernlib is a command from the CERN program library cernlib returning a list of libraries needed to link a cernlib application This command is only used in the g3tog4 module however if you do not make use of the g3tog4
12. construct the default run manager G4RunManager runManager new G4RunManager set mandatory initialization classes runManager gt SetUserInitialization new ExN0lDetectorConstruction runManager gt SetUserInitialization new ExN01PhysicsList set mandatory user action class runManager gt SetUserAction new ExNO1PrimaryGeneratorAction initialize G4 kernel runManager gt initialize get the pointer to the UI manager and set verbosities G4UImanager UI G4UImanager GetUIpointer UI gt ApplyCommand run verbose 1 UI gt ApplyCommand event verbose 1 UI gt ApplyCommand tracking verbose 1 start a run int numberOfEvent 3 runManager gt BeamOn numberOfEvent job termination delete runManager return 0 The main method is implemented by two toolkit classes G4RunManager and G4UImanager and three class es ExNO1DetectorConstruction ExNO1PhysicsList and ExNO1PrimaryGeneratorAction which are derived from toolkit classes Each of these are explained in the following sections 2 1 2 G4RunManager The first thing main must do is create an instance of the G4RunManager class This is the only manager class in the Geant4 kernel which should be explicitly constructed in the user s main It controls the flow of the program and manages the event loop s within a run When G4RunManager is created the other major manager classes are also created They are deleted automatically whe
13. By default you get the DAWNFILE HepRepFile RayTracer VRMLIFILE VRML2FILE ATree and GAGTree drivers Additionally you may choose from the OpenGL Xlib OpenGL Motif OpenInventor RayTracerX 193 Visualization DAWN Network and VRML Network drivers each of which can be selected by setting the proper environment variable setenv G4VIS_USE_OPENGLX setenv G4VIS_USE_OPENGLXM setenv G4VIS USE OIX setenv G4VIS USE RAYTRACERX setenv G4VIS USE DAWN setenv G4VIS USE VRML PRPRPRPRPPR Of course this has to be chosen from the set incorporated into the Geant4 libraries during their compilation Unless the environment variable GAVIS NONI Also unless the environment variable G4VIS NONI by default This flag is available in describing the main function E is set these set C pre processor flags of the same name E is set the C pre processor flag G4VIS USE is always set You may have to set additional environment variables for your selected visualization drivers and graphics systems For example the OpenGL driver may require the setting of OGLHOMI libraries For more details see Section 8 3 Visualization Drivers and pages linked from there 8 2 3 A Sample Set up File E which points to the location of the OpenGL The following can be part of the user s cshrcor tcshrcfileona Linux platform to configure the environment for creating Geant4 executables available for Geant4 visualization This sam
14. ExN04TrackerHit ExN04TrackerHit ExN04TrackerHit const ExN04TrackerHit amp right const ExN04TrackerHit amp operator const ExN04TrackerHit amp right int operator const ExN04TrackerHit amp right const inline void operator new size_t inline void operator delete void aHit void Draw const once COSE private G4double edep G4ThreeVector pos jowlailae s inline void SetEdep G4double de edep de inline G4double GetEdep const return edep inline void SetPos G4ThreeVector xyz pos xyz inline G4ThreeVector GetPos const returni pos a typedef G4THitsCollection lt ExN04TrackerHit gt ExN04TrackerHitsCollection extern G4Allocator lt ExN04TrackerHit gt ExN04TrackerHitAllocator inline void ExN04TrackerHit operator new size t void aHit aHit void ExN04TrackerHitAllocator MallocSingle return aHit inline void ExNO4TrackerHit operator delete void aHit ExN04TrackerHitAllocator FreeSingle ExN04TrackerHit aHit endif 115 Detector Definition and Response G4Allocator is a class for fast allocation of objects to the heap through the paging mechanism For details of G4Allocator refer to Section 3 2 4 Use of G4Allocator is not mandatory but it is recommended especially for users who are not familiar with the C memory allocation mechanism or alternative tools of memory allocation On the other hand note that G4Allocator is to be used
15. G4VParticleChange PostStepDoIt const G4Track amp track const G4Step amp step Do something interesting j void MyPhysicsList ConstructProcess G4LowEnergyBremsstrahlung bremProcess new G4LowEnergyBremsstrahlung MyWrapperProcess wrapper new MyWrapperProcess wrapper gt RegisterProcess bremProcess processManager gt AddProcess wrapper 1 1 3 58 Chapter 4 Detector Definition and Response 4 1 Geometry 4 1 1 Introduction The detector definition requires the representation of its geometrical elements their materials and electronics properties together with visualization attributes and user defined properties The geometrical representation of detector elements focuses on the definition of solid models and their spatial position as well as their logical relations to one another such as in the case of containment Geant4 uses the concept of Logical Volume to manage the representation of detector element properties The concept of Physical Volume is used to manage the representation of the spatial positioning of detector elements and their logical relations The concept of Solid is used to manage the representation of the detector element solid modeling The Geant4 solid modeler is STEP compliant STEP is the ISO standard defining the protocol for exchanging geometrical data between CAD systems This is achieved by standardizing the representation of solid models via the EXP
16. if particleName gamma theLEPhotoElectric theLECompton theLEGammaConversion theLERayleigh G4 G4 G4 G4 new new new new LowEnergyPhotoElectric LowEnergyCompton LowEnergyGammaConversion LowEnergyRayleigh pmanager gt AddDiscreteProcess pmanager gt AddDiscreteProcess pmanager gt AddDiscreteProcess pmanager gt AddDiscreteProcess theLEPhotoElectric theLECompton theLERayleigh theLEGammaConversion else if particleName e theLEIonisation new G4LowEnergylonisation theLEBremsstrahlung new G4LowEnergyBremsstrahlung el theeminusMultipleScattering new G4MultipleScattering pmanager gt AddProcess theeminusMultipleScattering 1 1 1 pmanager gt AddProcess theLEIonisation 1 2 2 pmanager gt AddProcess theLEBremsstrahlung 1 se if particleName e theeplusMultipleScattering theeplusIonisation theeplusBremsstrahlung theeplusAnnihilation 1 3 new G4MultipleScattering new G4elonisation new G4eBremsstrahlung new G4eplusAnnihilation pmanager gt AddProcess theeplusMultipleScattering 1 1 1 pmanager gt AddProcess pmanager gt AddProcess theeplus Ionisation 1 2 2 theeplusBremsstrahlung 1 1 3 pmanager gt AddProcess theeplusAnnihilation 0 1 4 138 Tracking and Physics Advanced examples illustrating the use of Low Energy Electromagnetic processes are av
17. 5 7 1 General Concepts The user can define artificial limits affecting to the Geant4 tracking G4UserLimits G4double uStepMax DBL MAX G4double uTrakMax DBL MAX G4double uTimeMax DBL MAX G4double uEkinMin 0 G4double uRangMin 0 uStepMax Maximum step length uTrakMax Maximum total track length uTimeMax Maximum global time for a track uEkinMin Minimum remaining kinetic energy for a track uRangMin Minimum remaining range for a track Note that uStepMax is affecting to each step while all other limits are affecting to a track The user can set G4UserLimits to logical volume and or to a region User limits assigned to logical volume do not propagate to daughter volumes while User limits assigned to region propagate to daughter volumes unless daughters belong to another region If both logical volume and associated region have user limits those of logical volume win 5 7 2 Processes co working with G4UserLimits In addition to instantiating G4UserLimits and setting it to logical volume or region the user has to assign the following process es to particle types he she wants to affect If none of these processes is assigned that kind of particle is not affected by G4UserLimits Limitation to step uSt epMax G4StepLimiter process must be defined to affected particle types This process limits a step but it does not kill a track 169 Tracking and Physics Limitations to t
18. 8 3 The Visualization Drivers As explained in the Introduction to Visualization Geant4 provides many different choices of visualization sys tems Features and notes on each driver are briefly described here along with links to detailed web pages for the various drivers 196 Visualization Details are given below for Section 8 3 2 OpenGL Section 8 3 3 OpenInventor Section 8 3 4 HepRepFile Section 8 3 5 HepRepXML Section 8 3 6 DAWN Section 8 3 8 VRML Section 8 3 9 RayTracer Section 8 3 10 ASCIITree Section 8 3 11 GAGTree Section 8 3 12 XML Tree 8 3 1 Availability of drivers on the supported systems Table 8 1 lists required graphics systems and supported platforms for the various visualization drivers Driver Required Graphics System Platform OpenGL Xlib OpenGL Linux Unix Mac with Xlib OpenGL Motif OpenGL Linux UNIX Mac with Motif OpenGL Win32 OpenGL Windows OpenInventor X OpenInventor OpenGL Linux UNIX Mac with Xlib or Mo tif OpenInventor Win32 OpenInventor OpenGL Windows HepRep WIRED or FRED HepRep Browser Linux UNIX Mac Windows DAWNFILE Fukui Renderer DAWN Linux Unix Mac Windows DAWN Network Fukui Renderer DAWN Linux UNIX VRMLFILE any VRML viewer Linux UNIX Mac Windows VRML Network any network enabled VRML viewer Linux UNIX RayTracer any JPEG viewer Linux UNIX Mac Windows ASCIITree none Linux UNIX Mac W
19. A very basic introduction to Geant4 is presented in Chapter 2 Getting Started with Geant4 Running a Simple Example It is a recipe for writing and running a simple Geant4 application program New users of Geant4 should read this chapter first It is strongly recommended that this chapter be read in conjunction with a Geant4 system installed and running on your computer It is helpful to run the provided examples as they are discussed in the manual To install the Geant4 system on your computer please refer to the Installation Guide for Setting up Geant4 in Your Computing Environment Chapter 3 Toolkit Fundamentals discusses generalGeant4 issues such as class categories and the physical units system It goes on to discuss runs and events which are the basic units of a simulation Chapter 4 Detector Definition and Response describes how to construct a detector from customized materials and geometric shapes and embed it in electromagnetic fields It also describes how to make the detector sensitive to particles passing through it and how to store this information How particles are propagated through a material is treated in Chapter 5 Tracking and Physics The Geant4 philosophy of particle tracking is presented along with summaries of the physics processes provided by the toolkit The definition and implementation of Geant4 particles is discussed and a list of particle properties is provided Chapter 6 User Actions is a descriptio
20. Define red color G4VisAttributes attribs colour Define a red visualization attribute circle SetVisAttributes attribs Assign the red attribute to the circle end of C source codes 237 Visualization 8 9 3 Text Text i e a character string is used to visualize various kinds of description particle name energy coordinate names etc Text is described by the class G4Text The following constructors are supported fii Constructors of G4Text G4Text const G4String amp text G4Text const G4String amp text const G4Point3D amp pos where the argument text is the text string to be visualized and pos is the 3D position at which the text is visualized Note that class G4Text also inherits G4VMarker Size of text is recognized as font size i e height of the text All the access functions defined for class G4VMarker mentioned above are available In addition the following access functions are available too Set functions of G4Text void G4Text SetText const G4String amp text void G4Text SetOffset double dx double dy a Get functions of G4Text G4String G4Text GetText const G4double G4Text GetxOffset const G4double G4Text GetYOffset const Method Set Text defines text to be visualized and Get Text returns the defined text Method Set Of set defines x horizontal and y vertical offsets in the screen coordinates By default both offsets are zer
21. The ideal place to copy a G4VUserTrackInformation object from a mother track to its daughter tracks is G4UserTrackingAction PostUserTrackingAction Example 6 9 Copying G4VUserTrackInformation from mother to daughter tracks void REO1TrackingAction PostUserTrackingAction const G4Track aTrack G4TrackVector secondaries fpTlrackingManager gt GimmeSecondaries if secondaries REOlTrackInformation info REOlTrackInformation aTrack gt GetUserInformation size t nSeco secondaries gt size if nSeco gt 0 1 for size t i 0 i nSeco i REOlTrackInformation infoNew new REO1TrackInformation info secondaries 1 gt SetUserInformation infoNew The concrete class object is deleted by the Geant4 kernel when the associated G4Track object is deleted In case the user wants to keep the information it should be copied to a trajectory corresponding to the track 6 3 3 G4VUserPrimaryVertexlnformation and G4VUserPrimaryTracklnformation These abstract classes allow the user to attach information regarding the generated primary vertex and pri mary particle Concrete class objects derived from these classes should be attached to G4PrimaryVertex and G4PrimaryParticle class objects respectively The concrete class objects are deleted by the Geant4 Kernel when the associated G4Primary Vertex or G4PrimaryParticle class objects are deleted along with the deletion of G4Event 6 3 4 G4VUserRegion
22. Visualization in Geant4 is considered to be remote when it is performed on a machine other than the Geant4 host Some of the visualization drivers support this feature Usually the visualization host is your local host while the Geant4 host is a remote host where you log in for example with the telnet command This enables distributed processing of Geant4 visualization avoiding the transfer of large amounts of visualization data to your terminal display via the network In order to perform remote visualization with the VRML Network driver the following must be installed on your local host beforehand 1 a VRML viewer 2 the Java application g4vrmlview The Java application g4vrmlview is included as part of the Geant4 package and is located at 203 Visualization source visualization VRML g4vrmlview Installation instructions for g4vrmlview can be found in the README file there or on the WWW page below The following steps realize remote Geant4 visualization displayed with your local VRML browser 1 Invoke the g4vrmlview on your local host giving a VRML viewer name as its argument Local Host gt java g4vrmlview VRML_viewer_name For example if you want to use the Netscape browser as your VRML viewer execute g4vrmlview as follows Local_Host gt java g4vrmlview netscape Of course the command path to the VRML viewer should be properly set 2 Log in to the remote host where a Geant4 executable is plac
23. dough subtracted volume Tcl mos and in the summary at the end of printing gt 4 daughter included mass of top physical volume s in scene to depth specified dE dE db db db db db db db db db db M ll aAwWwne Calorimeter copy no 0 belongs to logical volume Calorimeter Layer copy no 1 belongs to logical volume Layer 10 replicas Absorber copy no 0 belongs to logical volume Absorber Gap copy no 0 belongs to logical volume Gap Idle gt vis ASCIITree verbose 15 Idle gt vis drawTree tube phys 0 tube L tube G4Tubs 395841 cm3 1 782 mg cm3 9 6539e 08 mm3 1 72032e 10 mg divided tube phys 0 divided tube L divided tube G4Tubs 65973 4 cm3 Pa dpromghocms TSS Leos ame 13 52T q divided_tube_inset_phys 0 divided_tube_inset_L divided_tube_inset G4Tubs 58385 9 cms 1 782 mu cm3 6 033696 09 mm3 1 0752e 11 mg sub divided tube phys 0 sub divided tube L sub divided tube G4Tubs SNES Cts d tee mofomoc ISLS6 5 wma 21e gd lcg Calculating mass es Overall volume of expHall P 0 is 8000 m3 and the daughter included mass to unlimited depth is 78414 kg For the complete list of commands and options see the Control UICommands section of this user guide 8 3 11 GAG Tree The GAGTree driver provides a listing of the detector geometry tree within GAG the Geant Adaptive GUI http erpcl naruto u ac jp geant4 GAG allows folding un folding a part of the geomet
24. ifndef G4ParticleGunMessenger h define G4ParticleGunMessenger h 1 lass G4ParticleGun lass G4ParticleTable lass G4UIcommand lass G4UIdirectory lass G4UIcmdWithoutParameter lass G4UIcmdWithAString lass G4UIcmdWithADoubleAndUnit lass G4UIcmdWith3Vector lass G4UIcmdWith3VectorAndUnit ONGNECNONCNECEOEGNG include G4UImessenger hh include globals hh class G4ParticleGunMessenger public G4UImessenger Bu bitie G4ParticleGunMessenger G4ParticleGun fPtclGun G4ParticleGunMessenger PUDILGI void SetNewValue G4UIcommand command G4String newValues G4String GetCurrentValue G4UIcommand command private G4ParticleGun fParticleGun G4ParticleTable particleTable private commands G4UIdirectory gunDirectory G4UIcmdWithoutParameter JLsk ese Ciao tp G4UIcmdWithAString particleCmg G4UIcmdWith3Vector directionCmd G4UIcmdWithADoubleAndUnit energyCmd G4UIcmdWith3VectorAndUnit positionCmd G4UIcmdWithADoubleAndUnit timeCmd hi endif 186 Comommunication and Control Example 7 2 An example of G4ParticleGunMessenger cc include G4ParticleGunMessenger hh include G4ParticleGun hh include G4Geantino hh include G4ThreeVector hh include G4ParticleTable hh include G4UIdirectory hh include G4UIcmdWithoutParameter hh include G4UIcmdWithAString hh include G4UIcmdWithADoubleAndUnit hh include G4UIcmdWith3Vector hh includ
25. make mpeg2encode parfile sh G4OpenGL eps Then edit mpeg2encode par to specify file type and size etc diff mpeg2encode par mpeg2encode par Wicd Ke ik JA inpuc picture rile Eormat qw SY Ui iene 5 9 fe enpu jepteiebwess er TESEO rmata OS AU VAL Sy deal AU lt horizontal_size lt vertical_size lt 8 aspect ratio information 1 sguare pel 2 4 3 600 horizontal size gt 600 vertical size pd aspect ratio information 1 square pel 2 4 3 yuv 2 ppm yuv 2 ppm sido VEDI c s SEO Cac slab Ral 47 239 Visualization Then convert to ppm for i in G4OpenGL eps do je basename i eps command convert i j ppm echo command command done Then mpeg2encode mpeg2encode par G4OpenGL mpg Then on Mac for example open G4OpenGL mpg opens a QuickTime player 8 10 2 DAWNFILE You need to invoke dawn in direct mode which picks up parameters from DAWN_1 history and suppress the GUI alias dawn dawn d export DAWN BATCH 1 Change OGLSX to DAWNFILE in the above set of Geant4 commands and run Then convert to ppm files as above for Eno SESI do je basename i eps command convert i j ppm echo Scommand command done Then make a par file make mpeg2encode parfile sh g4 ppm and edit mpeg2encode par diff mpeg2encode par mpeg2encode par ite MT fi sboyobie picture le omas 10 S NC 0 VA less vu ss OO 1 SS
26. region G4RegionStore GetInstance gt GetRegion regName cuts new G4ProductionCuts cuts gt SetProductionCut 0 01 mm same cuts for gamma e and e region gt SetProductionCuts cuts regName calorimeter region G4RegionStore GetInstance gt GetRegion regName cuts new G4ProductionCuts cuts gt SetProductionCut 0 01 mm G4ProductionCuts Get Index gamma cuts gt SetProductionCut 0 1 mm G4ProductionCuts GetIndex e cuts gt SetProductionCut 0 1 mm G4ProductionCuts GetIndex e region gt SetProductionCuts cuts 5 6 Physics Table 5 6 1 General Concepts In Geant4 physics processes use many tables of cross sections energy losses and other physics values Before the execution of an event loop the BuildPhysicsTable method of G4VProcess is invoked for all processes and cross section tables are prepared Standard electromagnetic processes calculate cross section and or energy loss values for each material and for each production cut value assigned to each material A change in production cut values therefore require these cross sections to be re calculated Cross sections for hadronic processes do not depend on the production cut The G4PhysicsTable class is used to handle cross section tables G4PhysicsTable is a collection of instances of G4PhysicsVector and derived classes each of which has cross section values for a particle within a given energy range travel
27. void SetStoredInAscii Reset Retrieve flag void ResetPhysicsTableRetrieved 172 User Actions void ResetStoredInAscii TA AAA TUT AAA AA TEED QUU TQ ATA TAT ALATA AA TAA ATA ATA AAA public with description Print out the List of registered particles types void DumpList const public with description Request to print out information of cut values Printing will be performed when all tables are made void DumpCutValuesTable G4int nParticles 3 The following method actually trigger the print out requested by the above method This method must be invoked by RunManager at the proper moment void DumpCutValuesTableIfRequested public with description void SetVerboseLevel G4int value G4int GetVerboseLevel const set get controle flag for output message du rg Sucker 1 Warning message 2 More PAE TTY TAD AAAS AAA AA TAA AAA ATMA OD ATA TAT AAG MAM TAM ADA TATA AMAA TAA public with description SetCutsWithDefault method sets the default cut value Teh for all particles for the default region void SetCutsWithDefault Following are utility methods for SetCuts SetCutValue sets a cut value for a particle type for the default region void SetCutValue G4double aCut const G4String amp pname SetCutValue sets a cut value for a particle type for a region void SetCutValue G4double aCut const G4String amp pname const G4String amp
28. 1 1 Scope of this manual The User s Guide for Application Developers is the first manual the reader should consult when learning about Geant4 or developing a Geant4 based detector simulation program This manual is designed to e introduce the first time user to the Geant4 object oriented detector simulation toolkit provide a description of the available tools and how to use them and supply the practical information required to develop and run simulation applications which may be used in real experiments This manual is intended to be an overview of the toolkit rather than an exhaustive treatment of it Related physics discussions are not included unless required for the description of a particular tool Detailed discussions of the physics included in Geant4 can be found in the Physics Reference Manual Details of the design and functionality of the Geant4 classes can be found in the User s Guide for Toolkit Developers and a complete list of all Geant4 classes is given in the Software Reference Manual Geant4 is a completely new detector simulation toolkit written in the C language The reader is assumed to have a basic knowledge of object oriented programming using C No knowledge of earlier FORTRAN versions of Geant is required Although Geant4 is a fairly complicated software system only a relatively small part of it needs to be understood in order to begin developing detector simulation applications 1 2 How to use this manual
29. 256 Examples composite calorimeter test beam simulation of the CMS Hadron calorimeter at LHC e lAr calorimeter simulating the Forward Liquid Argon Calorimeter FCAL of the ATLAS Detector at LHC raredecay calorimetry illustrating how to estimate importance of photonuclear reactions for photon inef ficiency of calorimeters and compare effectiveness of different absorbers in order to reduce it e Rich simulating the TestBeam Setup of the Rich detector at the LHCb experiment testing the performance of the aerogel radiator Tiara a simulation of the neutron shielding experiment TIARA providing a realistic example for applying geometrical importance sampling Further documentation about the analysis tools used in these examples is available at AIDA Abstract Interfaces for Data Analysis and AIDA PI JAS and OpenScientist 257 Chapter FAQ Frequentry Asked Questions FAQ 1 Installation Q When I download the source from the web and unpack the tar file some files unpack into the top level directory The problem you describe usually is the result of using UNIX tar to unpack the gtar GNU tar file or vice versa or using zip on either the gtar or tar file Please make certain that you download the correct file for your system and that you use the correct unpacking tool Note that for Linux you must download the gtar gz file I cannot find CLHEP files or library and I have it installed in my system
30. 45 Toolkit Fundamentals by the user and sent to the urgent or waiting stacks or deferred again to the postpone to next event stack As the event is processed G4StackManager pops tracks from the urgent stack until it is empty At this point the NewStage method of G4UserStackingAction is called In this method tracks from the waiting stack may be sent to the urgent stack retained in the waiting stack or postponed to the next event Details of the user defined methods of G4UserStackingAction and how they affect track stack management are given in Section 6 3 3 6 Event Generator Interface 3 6 1 Structure of a primary event 3 6 1 1 Primary vertex and primary particle The G4Event class object should have a set of primary particles when it is sent to G4EventManager via pro cessOneEvent method It is the mandate of your G4VUserPrimaryGeneratorAction concrete class to send primary particles to the G4Event object The G4PrimaryParticle class represents a primary particle with which Geant4 starts simulating an event This class object has information on particle type and its three momenta The positional and time information of pri mary particle s are stored in the G4PrimaryVertex class object and thus this class object can have one or more G4PrimaryParticle class objects which share the same vertex As shown in Fig primary vertexes and primary particles are associated with the G4 Event object by a form of linked list
31. 8 3 3 Openlnventor These drivers were developed by Jeff Kallenbach FNAL and Guy Barrand IN2P3 based on the Hepvis class library originated by Joe Boudreau Pittsburgh University The OpenInventor drivers and the Hepvis class library are based on the well established OpenInventor technology for scientific visualization They have high extendibil ity They support high interactivity e g attribute e diting of picked objects Some OpenInventor viewers support stereoscopic effects It is also possible to save a visualized 3D scene as an OpenInventor formatted file and re visualize the scene afterwards Because it is connected directly to the Geant4 kernel using same language as that kernel C OpenInventor systems can have direct access to Geant4 data geometry trajectories etc Because OpenInventor uses OpenGL for rendering it supports lighting and transparency OpenInventor provides thumbwheel control to rotate and zoom OpenInventor supports picking to ask about data Control Clicking on a volume turns on rendering of that volume s daughters Shift Clicking a daughter turns that rendering off If modeling opaque solid effect is like opening a box to look inside Further information HEPVis and OpenScientist e Geant4 Inventor Visualization with OpenScientist http openscientist lal in2p3 fr v 15r0 html osc g4 vis ui html e Overall OpenScientist Home http openscientist lal in2p3 fr v15r0 html osc_g4_vis_ui html
32. E 2 0105 assemblyDetector AddPlacedVolume plateLV G4Transform3D Ta Ra Ta setr r emdiepx AM 2 eset esie 5 Ta setat 5 jp assemblyDetector AddPlacedVolume plateLV G4Transform3D Ta Ra Rae secX cado 1 Ta Set 0 escal oY AB a Se E RM assemblyDetector AddPlacedVolume plateLV G4Transform3D Ta Ra Ta setX caloX 4 Ta setY 1 caloY 4 Ta setZ 0 assemblyDetector AddPlacedVolume plateLV G4Transform3D Ta Ra Now instantiate the layers for unsigned int i 0 i lt layers 1 Translation of the assembly inside the world G4ThreeVector Tm 0 0 i caloZ caloCaloOffset firstCaloPos assemblyDetector MakeImprint worldLV G4Transform3D Tm Rm a The resulting detector will look as in Figure 4 3 below Ii 1 i jew are Figure 4 3 The geometry corresponding to the previous example code An example of usage of the G4AssemblyVolume class 0 0 0 90 Detector Definition and Response 4 1 7 Reflecting Hierarchies of Volumes Hierarchies of volumes based on CSG or specific solids can be reflected by means of the G4ReflectionFactory class and G4ReflectedSolid which implements a solid that has been shifted from its original reference frame to a new reflected one The reflection transformation is applied as a decompo
33. G4LIB can be overridden Build specific G4TARGET Specifies the target name of the source file defining the main of the application example to be built This variable is set automatically for the examples and tests placed in SG4INSTALL examples G4EXEC_BUILD Flag specifying if to use a secondary template repository or not for handling template instantiations at the time of building a user application example For internal category tests in Geant4 this variable is already in the related GNUmakefile It s however not needed for examples and tests in G4INSTALL examples where class names are already mangled and different each other It applies only on those compilers which make use of template repositories see Appendix A 2 of this Guide The secondary template repository is set to SG4TREP exec 269 Appendix G4DEBUG Specifies to compile the code libraries or examples including symbolic information in the object code for debugging The size of the generated object code can increase considerably By default code is compiled in optimised mode SG4OPTIMISE set G4NO_OPTIMISE Specifies to compile the code libraries or examples without compiler optimisation G4NO_STD_EXCEPTIONS To avoid throwing of exceptions in Geant4 G4_NO_VERBOSE Geant4 code is compiled by default in high verbosity mode G4VERBOSE flag set For better performance verbosity code can be left out by defining G4_NO_VERBOSE
34. G4UImanager GetUIpointer UI gt SetCoutDestination this Hi Similarly UI gt SetCoutDestination NULL must be added to the destructor of the class 3 Write or modify the main program To modify examp1eN0 1 to produce a log file derive a class as described in step 1 above and add the following lines to the main program include MySession hh main 1 get the pointer to the User Interface manager G4UImanager UI G4UImanager GetUIpointer construct a session which receives G4cout G4cerr MySession LoggedSession new MySession UI gt SetCoutDestination LoggedSession session gt SessionStart not required in this case do simulation here delete LoggedSession return 0 Note G4cout G4cerr should not be used in the constructor of a class if the instance of the class is intended to be used as static This restriction comes from the language specification of C See the documents below for details e M A Hllis B Stroustrup Annotated C Reference Manual Section 3 4 Ellis1990 e PJ Plauger The Draft Standard C Library Plauger1995 189 Chapter 8 Visualization 8 1 Introduction to Visualization The Geant4 visualization system was developed in response to a diverse set of requirements Quick response to study geometries trajectories and hits High quality output for publications Flexible camera control to debug complex geometries Tools to show
35. Track length scorers G4PSTrackLength The track length is defined as the sum of step lengths of the particles inside the cell Bt default the track weight is not taken into account but could be used as a multiplier of each step length if the Weighted method of this class object is invoked G4PSPassageTrackLength The passage track length is the same as the track length in G4PSTrackLength except that only tracks which pass through the volume are taken into account It means newly generated or stopped tracks inside the cell are excluded from the calculation By default the track weight is not taken into account but could be used as a multiplier of each step length if the Weighted method of this class object is invoked Deposited energy scorers G4PSEnergyDeposit This scorer stores a sum of particles energy deposits at each step in the cell The particle weight is multiplied at each step G4PSDoseDeposit In some cases dose is a more convenient way to evaluate the effect of energy deposit in a cell than simple deposited energy The dose deposit is defined by the sum of energy deposits at each step in a cell divided by the mass of the cell The mass is calculated from the density and volume of the cell taken from the methods of G4VSolid and G4LogicalVolume The particle weight is multiplied at each step Current and flux scorers There are two different definitions of a particle s flow for a given geometry One is a current and the oth
36. Trapezoid To construct a trapezoid use G4Trd const G4String amp pName G4double dxl G4double dx2 G4double dyl G4double dy2 G4double dz to obtain a solid with name pName and parameters In the picture dx1 30 dx2 10 dy1 40 dy2 15 dz 60 dx1 Half length along x at the surface positioned at dz dx2 gt Half length along x at the surface positioned at dz dyl Half length along y at the surface positioned at dz dy2 gt Half length along y at the surface positioned at dz dz Half length along z axis Generic Trapezoid To build a generic trapezoid the G4Trap class is provided Here are the two costructors for a Right Angular Wedge and for the general trapezoid for it G4Trap const G4String amp pName G4double pZ G4double PY G4double pX G4double pLTX G4Trap const G4String amp pName G4double pZ G4double pTheta G4double pPhi G4double pDyl G4double pDxl G4double pDx2 G4double pAlp1 G4double pDy2 G4double pDx3 G4double pDx4 G4double pAlp2 In the picture pDx1 30 pDx2 40 pDy1 40 pDx3 10 pDx4 14 pDy2 16 pDz 60 pTheta 20 Degree pDphi 5 Degree pAlphl pAlph2 10 Degree 62 Detector Definition and Response to obtain a Right Angular Wedge with name pName and parameters pZ Length along z pY Length along y pX Length along x at the wider side pLTX Length along x at the narrower side 9 1 TX
37. XXX assembly volume imprint number e YYY the name of the placed logical volume e ZZZ the logical volume index inside the assembly volume It is however possible to access the constituent physical volumes of an assembly and eventually customise ID and copy number 4 1 6 3 Destruction of an assembly volume At destruction all the generated physical volumes and associated rotation matrices of the imprints will be destroyed A list of physical volumes created by MakeImprint method is kept in order to be able to cleanup the objects when not needed anymore This requires the user to keep the assembly objects in memory during the whole job or during the life time of the G4Navigator logical volume store and physical volume store may keep pointers to physical volumes generated by the assembly volume The MakeImprint method will operate correctly also on transformations including reflections and can be applied also to recursive assemblies i e it is possible to generate imprints of assemblies including other assem blies Giving t rue as the last argument of the MakeImprint method it is possible to activate the volumes overlap check for the assembly s constituents the default is false At destruction of a G4AssemblyVolume all its generated physical volumes and rotation matrices will be freed 4 1 6 4 Example This example shows how to use the G4AssemblyVolume class It implements a layered detector where each layer consists of 4
38. areas C source codes to set vertex positions color etc pVVisManager gt Draw polyline end of C source codes Tracking steps are able to be visualized based on the above visualization of G4Polyline You can visualize track ing steps at each step automatically by writing a proper implementation of class MySteppingAction inheriting G4UserSteppingAction and also with the help of the Run Manager First you must implement a method MySteppingAction UserSteppingAction A typical imple mentation of this method is as follows Liam C source code An example of visualizing tracking steps void MySteppingAction UserSteppingAction G4VVisManager pVVisManager G4VVisManager GetConcreteInstance if pVVisManager gentes Get the Stepping Manager const G4SteppingManager pSM GetSteppingManager ff Define a line segment G4Polyline polyline G4double charge pSM gt GetTrack gt GetDefinition gt GetPDGCharge GA G OIF OUT COLONII IE ollage 1074 cxollkoxue 161 Colones L um 0s DRS else if charge lt 0 colour G4Colour 0 0 1 else OM SUA olio EI Was G4VisAttributes attribs colour polyline SetVisAttributes attribs polyline push back pSM gt Get Step gt GetPreStepPoint gt GetPosition polyline push_back pSM gt Get Step gt GetPostStepPoint gt GetPosition ffr Call a drawing method for G4Polyline pVVisManager Draw polyline
39. construction and set of user classes ExN04DetectorConstruction header file source file derived from G4VUserDetectorConstruction construction of ExN04MagneticField definitions of mixture and compound materials material dependent CutOff simplified collider geometry with Param Replica e tracker muon parametrised e calorimeter replica ExN04TrackerParametrisation header file source file derived from G4VPVParametrisation e parametrised sizes ExN04CalorimeterParametrisation header file source file derived from G4VPVParametrisation e parametrized position rotation ExN04MagneticField header file source file derived from G4MagneticField 248 Examples solenoid and toroidal fields ExN04TrackerSD header file source file derived from G4VSensitiveDetector e tracker type hit generation ExN04TrackerHit header file source file derived from G4VHit e draw hit point ExN04CalorimeterSD header file source file derived from G4VSensitiveDetector calorimeter type hit generation ExN04CalorimeterHit header file source file derived from G4VHit e draw physical volume with variable color ExN04MuonSD header file source file derived from G4VSensitiveDetector Seintillator type hit generation ExN04MuonHit header file source file e derived from G4VHit e draw physical volume with variable color ExN04PrimaryGeneratorAction he
40. for size t i 0 i lt 6 i for size t j 0 3 lt 6 j fullName detName i primNameSum j colIDSum i j SDMan gt GetCollectionID fullName for size t k 0 k lt 3 k fullName detName i primNameMin k colIDMin i k SDMan GetCollectionID fullName void ExN07Run RecordEvent const G4Event evt G4HCofThisEvent HCE evt gt GetHCofThisEvent if HCE return numberOfEvent Kon Size t ISO 61 for size t j 0 3 lt 6 j G4THitsMap lt G4double gt evtMap G4THitsMap lt G4double gt HCE gt GetHC colIDSum i j mapSum i j evtMap for size_t k 0 k lt 3 k G4THitsMap lt G4double gt evtMap G4THitsMap lt G4double gt HCE gt GetHC colIDMin i k std map lt G4int G4double gt iterator itr evtMap gt GetMap gt begin for itr evtMap gt GetMap gt end itr G4int key itr gt first G4double val itr gt second G4double mapP mapMin i k key if mapP amp amp val gt mapP continue mapMin i k set key val 4 4 6 Concrete classes of G4VPrimitiveScorer With Geant4 version 8 0 several concrete primitive scorer classes are provided all of which are derived from the G4VPrimitiveScorer abstract base class and which are to be registered to G4MultiFunctionalDetector Each of them contains one G4THitsMap object and scores a simple double value for each key 121 Detector Definition and Response
41. sition into rotation and translation transformations The factory is a singleton object which provides the following methods G4PhysicalVolumesPair Place const G4Transform3D amp transform3D const G4String name G4LogicalVolume LV G4LogicalVolume motherLV G4bool isMany G4int copyNo G4bool surfCheck false G4PhysicalVolumesPair Replicate const G4String amp name G4LogicalVolume LV G4LogicalVolume motherLV EAxis axis G4int nofReplicas G4double width G4double offset 0 G4PhysicalVolumesPair Divide const G4String amp name G4LogicalVolume LV G4LogicalVolume motherLV EAxis axis G4int nofDivisions G4double width G4double offset The method Place used for placements evaluates the passed transformation In case the transformation con tains a reflection the factory will act as follows 1 Performs the transformation decomposition 2 Creates a new reflected solid and logical volume or retrieves them from a map if the reflected object was already created 3 Transforms the daughters if any and place them in the given mother If successful the result is a pair of physical volumes where the second physical volume is a placement in a reflected mother Optionally it is also possible to force the overlaps check at the time of placement by activating the surfCheck flag The method Replicate creates replicas in the given mother If successful the result is a pair of physical volumes where the se
42. 4 give to the G4FastSimulationManager the placement of the myGhostLogical by invoking for the G4FastSimulationManager method AddGhostPlacement G4RotationMatrix const G4ThreeVector amp Or AddGhostPlacement G4Transform3D where the rotation matrix and translation vector of the 3 D transformation describe the placement relative to the ghost world coordinates 5 build your G4VFastSimulationModel objects and add them to the myGhostFSManager The IsApplicable methods of your models will be used by the G4GlobalFastSimulationManager to build the ghost geometries corresponding to a given particle type 6 Invoke the G4GlobalFastSimulationManager method G4GlobalFastSimulationManager getGlobalFastSimulationManager gt CloseFastSimulation 158 Tracking and Physics This last call will cause the G4GlobalFastSimulationManager to build the flavour dependent ghost geometries This call must be done before the RunManager closes the geometry It is foreseen that the run manager in the future will invoke the CloseFastSimulation to synchronize properly with the closing of the geometry Visualization facilities are provided for ghosts geometries After the CloseFastSimulation invocation it is pos sible to ask for the drawing of ghosts in an interactive session The basic commands are e vis draw Ghosts particle name which makes the drawing of the ghost geometry associated with the particle specified by name in the
43. GAG Menu The menus are to choose and run a GEANTA executable file to kill or exit a GEANT4 process and to exit GAG Upon the normal exit or an unexpected death of the Geant4 process GAG window are automatically reset to accept another GEANTA executable Getting Started with Geant4 Running a Simple Example GEANT4 Command tree Upon the establishment of the pipe with the GEANT4 process GAG displays the command menu tree whose look and feel is quite similar to Windows file browser Disabled commands are shown opaque GAG doesn amp rsquo t display commands that are just below the root of the command hierarchy Direct type in field is available for such input Guidance of command categories and commands are displayed upon focusing GAG has a command history function User can re execute a command with old parameters edit the history or save the history to create a macro file Command Parameter panel GAG s parameter panel is the user friendliest part It displays parameter name its guidance its type s inte ger double Boolean or string omittable default value s expression s of its range and candidate list s for example of units Range check is done by intercoms and the error message from it is shown in the pop up dialog box When a parameter component has a candidate list a list box is automatically displayed When a file is requested by a command the file chooser is available Logging Log can be redirected to the term
44. If yes stack the particle for performing the Action At Rest later If not and only in this case abandon this secondary With this sophisticated mechanism we have the global cut that we wanted but with energy conservation and we respect boundary constraint safety and the wishes of the processes via good for tracking 5 4 4 Why produce secondaries below threshold A process may have good reasons to produce particles below the recommended threshold checking the range of the secondary versus geometrical quantities like safety may allow one to realize the possibility that the produced particle even below threshold will reach a sensitive part of the detector another example is the gamma conversion the positron is always produced even at zero energy for further annihilation These secondary particles are sent to the Stepping Manager with a flag GoodForTracking to pass the filter explained in the previous section even when ApplyCut is ON 5 4 5 Cuts in stopping range or in energy The cuts in stopping range allow one to say that the energy has been released at the correct space position lim iting the approximation within a given distance On the contrary cuts in energy imply accuracies of the energy depositions which depend on the material 5 4 6 Summary In summary we do not have tracking cuts we only have production thresholds in range All particles produced and accepted are tracked up to zero rang
45. NUM SPECULARSPIKECONSTANT pp specularspike NUM BACKSCATTERCONSTANT pp backscatter NUM REFLECTIVITY pp reflectivity NUM EFFICIENCY pp efficiency NUM OpSurface gt SetMaterialPropertiesTable SMPT 153 Tracking and Physics The original GEANT3 21 implementation of this process is also available via the GLISUR methods flag GEANT Detector Description and Simulation Tool Application Software Group Computing and Networks Division CERN PHYS260 6 tp 260 7 Example 5 11 Dielectric metal surface properties defined via the G4OpticalSurface G4LogicalVolume volume_log G4OpticalSurface OpSurface new G4OpticalSurface name G4LogicalSkinSurface Surface new G4LogicalSkinSurface name volume_log OpSurface OpSurface gt SetType dielectric metal OpSurface SetFinish ground OpSurface SetModel glisur G4double polish 0 8 G4MaterialPropertiesTable OpSurfaceProperty new G4MaterialPropertiesTable OpSurfaceProperty gt AddProperty REFLECTIVITY pp reflectivity NUM OpSurfaceProperty gt AddProperty EFFICIENCY pp efficiency NUM OpSurface gt SetMaterialPropertiesTable OpSurfaceProperty The program defaults to the GLISUR model and polished surface finish when no specific model and sur face finish is specified by the user In the case of a dielectric metal interface or when the GLISUR model is specified the only surface finish options av
46. Tere lay NP 7 2 4 How to control the output of G4cout G4cerr Instead of cout and cerr Geant4 uses G4cout and G4cerr Output streams from G4cout G4cerr are handled by G4UImanager which allows the application programmer to control the flow of the stream Output strings may therefore be displayed on another window or stored in a file This is accomplished as follows 1 Derive a class from G4UIsession and implement the two methods G4int ReceiveG4cout G4String coutString G4int ReceiveG4cerr G4String cerrString 188 Comommunication and Control These methods receive the string stream of G4cout and G4cerr respectively The string can be handled to meet specific requirements The following sample code shows how to make a log file of the output stream ostream logFile logFile open MyLogFile G4int MySession ReceiveG4cout G4String coutString logFile lt lt coutString lt lt flush ESCUTO 2 Set the destination of G4cout G4cerr using G4UImanager SetCoutDestination session Typically this method is invoked from the constructor of G4Ulsession and its derived classes such as G4UIGAG G4UIteminal This method sets the destination of G4cout G4cerr to the session For example when the following code appears in the constructor of G4Ulterminal the method SetCoutDestination this tells UImanager that this instance of G4UIterminal receives the stream generated by G4cout G4UIterminal G4UIterminal UI
47. These instructions are suggestive only The following procedures have not been tested on all platforms There are clearly some instructions that apply only to Unix like systems with an X Windows based windowing system However it should not be difficult to take the ideas presented here and extend them to other platforms and systems The procedures described here need graphics drivers that can produce picture files that can be converted to a form suitable for an MPEG encoder There may be other ways of capturing the screen images and we would be happy to hear about them Graphics drivers currently capable of producing picture files are Driver File type DAWNFILE prim then eps using dawn HepRepFile HepRepl HepRep HepRep2 OGLX eps RayTracer jpeg VRMLFILE vrml So far only DAWNFILE OGLX and RayTracer have been road tested Once in a standard format such as eps the convert program from ImageMagick can convert to ppm files suitable for mpeg2encode 8 10 1 OGLX Make a macro something like this control verbose 2 vis open OGLSX 600x600 0 0 vis drawVolume vis viewer reset vis viewer set style surface vis viewer set projection perspective 50 deg control alias phi 30 control loop movie loop theta 0 360 1 which invokes movie loop which is something like vis viewer set viewpointThetaPhi theta phi vis viewer zoom 1 005 vis oglx printEPS This produces lots of eps files Then
48. deuteron He3 triton b heavy nuclei Nuclei other than those defined in the previous category Note that G4ParticleDefinition represents nucleus state and G4DynamicParticle represents atomic state with some nucleus Both alpha particle with charge of 2 and helium atom with no charge aggregates the same particle definition of G4Alpha but different G4DynamicParticle objects should be assigned to them De tails can be found below short lived particles Particles with very short life time decay immediately and are never tracked in the detector geometry These particles are usually used only inside physics processes to implement some models of interactions G4VShortLivedParticle is provided as the base class for these particles All classes related to particles in this category can be found in short lived sub directory under the particles directory a quarks di quarks For example all 6 quarks b gluons baryon excited states with very short life For example spin 3 2 baryons and anti baryons d meson excited states with very short life For example spin 1 vector bosons 5 3 2 3 Implementation of particles Singleton Categories a b 1 These particles are frequently used for tracking in Geant4 An individual class is defined for each particle in these categories The object in each class is unique and defined as a static object so called singleton The user can get pointers to these objects by using static methods in their own c
49. due to different libc used in the two configurations I installed Geant4 libraries and built my application when I try to run it I get error in loading shared libraries libCLHEP so cannot open shared object file No such file or directory Your installation of CLHEP includes shared libraries You need to specify the path where libCLHEP so is installed through your environment variable LD_LIBRARY_PATH For example in tcsh UNIX shell setenv LD_LIBRARY_PATH LD LIBRARY PATH CLHEP BASE DIR lib On my system I get a Floating Point Exception FPE since some physics processes sometimes return DBL MAX as interaction length and this number is afterwards multiplied by a number greater than 1 Geant4 coding conventions and installation setup explicitly follow the ANSI TEEE 754 Standard for the initialization of floating point arithmetic hardware and portability The Standard foresees floating point arithmetic to be nonstop and underflows to be gradual On DEC platforms for example the ANSI IEEE 754 Standard compliance needs to be explicitly set since deactivated by default in this case we use infact the option ieee on the DEC cxx native C compiler to achieve this You should check if your compiler provides compilation options for activating Standard initialization of FP arithmetic it may be platform specific FAQ 3 Geometry Q I have a generic point and I would like to know in which physical volume I m located in my detecto
50. e HEPVis http www pat fnal gov graphics HEPVis www Further information OpenInventor e http oss sgi com projects inventor e Josie Wernecke The Inventor Mentor Addison Wesley ISBN 0 201 62495 8 Josie Wernecke The Inventor Toolmaker Addison Wesley ISBN 0 201 62493 1 The Open Inventor C Reference Manual Addison Wesley ISBN 0 201 62491 5 8 3 4 HepRepFile The HepRepFile driver creates a HepRep XML file in the HepRepl format suitable for viewing with the WIRED3 HepRep Browser The HepRep graphics format is further described at http www slac stanford edu perl heprep 198 Visualization To write just the detector geometry to this file use the command vis viewer flush Or to also include trajectories and hits after the appropriate vis viewer add trajectories or vis viewer add hits commands just issue run beamOn 1 HepRepFile will write a file called G4DataO heprep to the current directory Each subsequent file will have a file name like G4Datal heprep G4Data2 heprep etc View the file using the WIRED3 HepRep Browser available from http www slac stanford edu BFROOT www Computing Graphics Wired WIRED3 allows you to pick on volumes trajectories and hits to find out their associated HepRep Attributes such as volume name particle ID momentum etc These same attributes can be displayed as labels on the relevant objects and you can make visibility cuts based on these attribute
51. effective number of nucleons and effective mass of a mole and will store this element in the elements table A few quantities with physical meaning or not which are constant in a given element are computed and stored here as derived data members Using the internal Geant4 database a G4Element can be accessed by atomic number or by atomic symbol Al Fe Pb In that case G4Element will be found from the list of existing elements or will be constructed us ing data from the Geant4 database which is derived from the NIST database of elements and isotope composi tions http physics nist gov PhysRefData Compositions index html Thus the natural isotope composition can be built by default 4 2 2 3 G4Material A G4Material object has a name density physical state temperature and pressure by default the standard con ditions the number of elements and a vector of pointers to such elements a vector of the fraction of mass for each element a vector of the atoms or molecules numbers of each element and an index in the materials table In addition the class has methods to add one by one the elements which will comprise the material A G4Material object can be constructed by directly providing the resulting effective numbers if the user explicitly wants to do so an underlying element will be created with these numbers Alternatively a G4Material object can be constructed by declaring the number of elements of which it w
52. iig 4 qup gue seem 0 7 RepX is an array of 5 replicas of width 10 mm positioned inside and completely filling the volume pointed by pContainingMother The mother s X length must be 5 10 mm 50 mm for example if the mother s solid were a Box of half lengths 25 25 25 then the replica s solid must be a box of half lengths 25 25 5 If the containing mother s solid is a tube of radius 50 mm and half Z length of 25 mm RepR divides the mother tube into 5 cylinders hence the solid associated with pRepRLogical must be a tube of radius 10 mm and half Z length 25 mm repRZ divides it into 5 shorter cylinders the solid associated with pRepRZLogical must be a tube of radius 10 mm and half Z length 5 mm finally repRZPhi divides it into 4 tube segments with full 80 Detector Definition and Response angle of 90 degrees the solid associated with pRepRZPhiLogical must be a tube segment of radius 10 mm half Z length 5 mm and delta phi of M PI 0 5 rad No further volumes may be placed inside these replicas To do so would result in intersecting boundaries due to the r replications Parameterised Volumes Parameterised Volumes are repeated volumes in the case in which the multiple copies of a volume can be different in size solid type or material The solid s type its dimensions the material and the transformation matrix can all be parameterised in function of the copy number both when a strong symmetry exist and when it does
53. readout geometries etc and can overlap with the mass geometry defined for the tracking The par allel transportation will be activated only after the registration of the parallel geometry in the detector descrip tion setup see Section Section 4 7 for how to define a parallel geometry and register it to the run manager The G4TransportationManager provides all the utilities to verify retrieve and activate the navigators as sociated to the various parallel geometries defined 4 1 8 4 Run time commands When running in verbose mode i e the default GAVERBOSE set while installing the Geant4 kernel libraries the navigator provides a few commands to control its behavior It is possible to select different verbosity levels up to 5 with the command geometry navigator verbose verbose level or to force the navigator to run in check mode geometry navigator check mode true false The latter will force more strict and less tolerant checks in step safety computation to verify the correctness of the solids response in the geometry By combining check mode with verbosity level 1 additional verbosity checks on the response from the solids can be activated 4 1 9 A Simple Geometry Editor GGE is the Geant4 Graphical Geometry Editor It is implemented in JAVA and is part of the Momo environment GGE aims to serve physicists who have a little knowledge of C and the Geant4 toolkit to construct his or her own detector geo
54. rname Invoke SetCuts for specified particle for a region If the pointer to the region is NULL the default region is used In case of Retrieve flag is ON Cut values will be retrieved from files void SetParticleCuts G4double cut G4ParticleDefinition particle G4Region region 0 Invoke SetCuts for all particles in a region void SetCutsForRegion G4double aCut const G4String amp rname Following are utility methods are obsolete void ResetCuts EE AAA TAA AAA AA TATA AAA AA EAA public Get SetApplyCuts gets sets the flag for ApplyCuts void SetApplyCuts G4bool value const G4String amp name G4bool GetApplyCuts const G4String amp name const TDM AAA VVV TA MAGE ADD TEA AA TATA AAA AA AAA TAEDA ATA VV protected do BuildPhysicsTable for make the integral schema void BuildIntegralPhysicsTable GA4VProcess G4ParticleDefinition protected Retrieve PhysicsTable from files for proccess belongng the particle Normal BuildPhysics procedure of processes will be invoked if it fails in case of Process s RetrievePhysicsTable returns false virtual void RetrievePhysicsTable G4ParticleDefinition const G4String amp directory G4bool ascii false WEE AAA AEA AA EAE TA EAA TUQUE protected adds new ProcessManager to all particles in the Particle Table 1 this routine is used in Construct void InitializeProcessManager 173 User Actions public with descrip
55. tool it s harmless The cernlib script and the needed cernlib libraries are available from http cern ch cernlib Trying building the Geant4 libraries I see several of these errors appearing and my installation fails ice ci G4Exception d 1 missing separator Stop 5 G4DalitzDecayChannel d 1 missing separator Stop Has Geant4 been installed properly What to do to solve this error It looks like some file dependencies d are corrupted possibly due to previous build attempts which failed for some reason You need to remove each of them A quick recipe for doing this is to Configure the environment with the installation to be repaired e Unset the GAWORKDIR environment variable in case it is eventually set Type 258 Frequentry Asked Questions gmake clean dependencies from the affected module i e for this case from G4INSTALL source global management and G4INSTALL source particles management and rebuild Alternatively you may use gmake clean dependencies from G4INSTALL source and rebuild FAQ 2 Run Time Problems On Linux I get a segmentation fault as soon as I run one of the official examples Check that the CLHEP library has been installed and compiled coherently with the same compiler you use for installing Geant4 and for the same version of Linux distribution For example a binary object produced with Red Hat 7 X is not fully compatible with binaries running on RH 9 X or higher
56. 0 00146 7 0 00244 9 0 00208 20 0 0001 a 92 92 23 32 473 56 47 01 532 667 27 261 9707 5805 234 04 56 5 59 8 93 13952 398 4 487 1 Tawi 25 48 8 67 7 77 5 71 7 75 285 Appendix 26 2e 05 30 2e 05 2 G4_TETRACHLOROETHY LENE 1 625 T5942 6 0 144856 7 0 855144 2 G4_THALLIUM_CHLORIDE 7 004 690 3 7 0 147822 81 0 852178 13 G4 TISSUE SOFT ICRP L 72 3 0 104472 6 0 23219 7 0 02488 8 0 630238 1 0 00113 2 0 00013 5 0 00133 6 0 00199 7 0 00134 9 0 00199 20 0 00023 26 5e 05 30 3e 05 4 G4 TISSUE SOFT ICRU 4 L 74 9 1 0 101172 6 0 111 7 0 026 8 0 761828 4 G4 TISSUE METHANE 0 00106409 61 2 T 0 101869 6 0 456179 7 0 035172 8 0 40678 4 G4 TISSUE PROPANE 0 00182628 5945 1 0 102672 6 0 56894 7 0 035022 8 0 293366 2 G4 TITANIUM DIOXIDE 4 26 179 5 8 0 400592 22 0 599408 2 G4_TOLUENE 0 8669 62 5 0 08751 6 0 91249 3 G4_TRICHLOROETHYLENE 1 46 148 1 0 007671 6 0 182831 7 0 809498 4 G4_TRIETHYL_PHOSPHATE 1 07 81 2 0 082998 6 0 395628 8 0 351334 5 0 17004 2 G4_TUNGSTEN_HEXAFLUORIDE 2 4 354 4 9 0 382723 74 0 617277 2 G4_URANIUM_DICARBIDE 11 28 152 6 0 091669 92 0 908331 2 G4_URANIUM_MONOCARBIDE 13 63 862 6 0 048036 92 0 951964 2 G4_URANIUM_OXIDE 10 96 720 6 8 0 118502 92 0 881498 4 G4_UREA 14323 72 8 0 067131 6 0 199999 7 0 466459 8 0 266411 4 G4 VALINE 1 23 67 7 1 0
57. 167635 6 0 832365 G4_PHOTO_EMULSION 0 014 6 0 072261 7 0 01932 8 0 066101 6 0 00189 35 0 349103 47 0 474105 o3 0 00312 G4 PLASTIC SC VINYLTOLUENE 0 085 6 0 915 G4 PLUTONIUM DIOXIDE 8 0 118055 94 0 881945 G4 POLYACRYLONITRILE 0 0569829 6 0 679055 7 0 263962 G4 POLYCARBONATE 0 055491 6 0 755751 8 0 188758 G4 POLYCHLOROSTYRENE 0 061869 6 0 696325 7 0 241806 G4 POLYETHYLENE 1 07 1 19867 0 00183094 0 7026 0 6262 032 46 17 C 2H 4 N Polyethylene 0 94 74 68 155 84 64 63 63 61 54 55 Du 331 64 746 69 134 81 od 283 Appendix 0 143711 6 0 856289 G4_MYLAR 4 78 0 041959 6 0 625016 8 0 333025 G4 PLEXIGLASS 19 74 0 080538 6 0 599848 8 0 319614 G4 POLYOXYMETHYLENE 425 77 4 0 067135 6 0 400017 8 0 532848 G4_POLYPROPYLENE C 2H 4 N Polypropylene 0 9 56 5 KE 0 143711 6 0 856289 G4_POLYSTYRENE 1 06 68 7 ik 0 077418 6 0 922582 G4 TEFLON 242 99 1 6 0 240183 9 0 759817 G4 POLYTRIFLUOROCHLOROETHYLENE 251 120 7 6 0 20625 9 0 489354 7 0 304395 G4 POLYVINYL ACETATE 34 9 JONG 0 070245 6 0 558066 8 0 371689 G4 POLYVINYL ALCOHOL v3 69 7 0 091517 6 0 545298 8 0 363185 G4 POLYVINYL BUTYRAL 12 61442 0 092802 6 0 680561 8 0 226637 G4 POLYVINYL CHLORIDE 3 108 2 0 04838 6 0 38436 7 0 56726 G4 POLYVINYLIDENE CHLORIDE 1 7 13443 0 020793 6 0 2477
58. Action Creates a scene consisting of the given physical volume and asks the current viewer to draw it The scene becomes current Command vis viewer flush should follow this command in order to declare end of visualization Example Visualization of the whole world with coordinate axes Idle vis drawVolume Idle vis scene add axes 0 0 0 500 mm Idle vis viewer flush 8 4 5 Visualization of a logical volume vis specify com mand Command vis specify visualizes a logical volume If allows you to control how much details is shown and whether to show booleans voxels and readout geometries It also does some of the other steps if you haven t done them explicitly It takes care of steps 2 3 4 and 6 Command vis viewer flush should follow the command in order to do the final Step 7 Command vis specify logical volume name depth of descent booleans flag voxels flag readout f1ag Argument A logical volume name Action Creates a scene consisting of the given logical volume and asks the current viewer to draw it The scene becomes current Example visualization of a selected logical volume with coordinate axes Idle vis specify Absorber Idle vis scene add axes 0 0 0 500 mm Idle vis scene add text 0 0 0 mm 40 100 200 LogVol Absorber Idle vis viewer flush For more options see the Control UICommands section of this user guide 8 4 6 Visualization of trajectories vis scene ad
59. Appendix 0 090027 6 0 585182 8 0 324791 G4_ETHYLENE 0 00117497 0 143711 6 0 856289 G4_EYE_LENS_ICRP 144 0 099269 6 0 19371 T 0 05327 8 0 653751 G4_FERRIC_OXIDE 542 8 0 300567 26 0 699433 G4 FERROBORIDE 7445 5 0 162174 26 0 837826 G4 FERROUS OXIDE Sed 8 0 222689 26 0 777311 G4_FERROUS_SULFATE 1 024 1 0 108259 7 2 7e 05 8 0 878636 11 2 2e 05 16 0 012968 17 3 4e 05 26 5 4e 05 G4_FREON 12 1312 6 0 099335 9 0 314247 17 0 586418 G4_FREON 12B2 1 8 6 0 057245 9 0 181096 39 0 761659 G4 FREON 13 0795 6 0 114983 9 0 545621 17 0 339396 G4 FREON 13B1 Teg 6 0 080659 9 0 382749 35 0 536592 G4 FREON 13I1 1 8 6 0 061309 9 0 290924 53 0 647767 G4_GADOLINIUM_OXYSULFIDE 7 44 8 0 084528 6 0 08469 64 0 830782 G4_GALLIUM_ARSENIDE Dd 3d 0 482019 33 0 517981 G4 GEL PHOTO EMULSION 1 2914 0 08118 6 0 41606 7 0 11124 8 0 38064 6 0 01088 G4 Pyrex Glass 32 3 5 0 0400639 8 0 539561 1 0 0281909 3 0 011644 4 0 377219 9 0 00332099 G4 GLASS LEAD 222 8 0 156453 4 0 080866 22 0 008092 33 0 002651 82 0 751938 G4_GLASS_PLATE 2 4 8 0 4598 ld 0 0964411 50 33 2214 261 248 76 143 284 126 210 293 493 384 74 134 526 145 280 Appendix 13 14 0 336553 20 0 107205 G4_GLUCOSE uh 0 071204 6 0 363652 8 0 565144 G4 GLUTAMINE 1 0 0689651 6 0 410926 T 0 191681 8 0 328427 G4_GLYCEROL d 0 0875539 6 0 391262 8 0 521184
60. DETECT TRIUMF Preprint TRI PP 96 64 Oct 1996 of the DETECT program G F Knoll T F Knoll and T M Henderson Light Collection Scintillation Detector Composites for Neutron Detection IEEE Trans Nu cl Sci 35 1988 872 It applies to dielectric dielectric interfaces and tries to provide a realistic simulation which deals with all aspects of surface finish and reflector coating The surface may be assumed as smooth and covered with a metallized coating representing a specular reflector with given reflection coefficient or painted with a diffuse reflecting material where Lambertian reflection occurs The surfaces may or may not be in optical contact with another component and most importantly one may consider a surface to be made up of micro facets with normal vectors that follow given distributions around the nominal normal for the volume at the impact point For very rough surfaces it is possible for the photon to inversely aim at the same surface again after reflection of refraction and so multiple interactions with the boundary are possible within the process itself and without the need for relocation by G4Navigator The UNIFIED model provides for a range of different reflection mechanisms The specular lobe constant represents the reflection probability about the normal of a micro facet The specular spike constant in turn illustrates the probability of reflection about the average surface normal The diffuse lobe constant is for the proba
61. Delta Theta angle of the segment in radians Full Solid Sphere To build a full solid sphere use G4Orb const G4String amp pName G4double pRmax In the picture pRmax 100 The Orb can be obtained from a Sphere with pRmin 0 pSPhi 0 pDPhi 2 Pi pSTheta 0 pDTheta Pi pRmax Outer radius Torus To build a torus use G4Torus const G4String amp pName G4double pRmin G4double pRmax G4double pRtor G4double DS El G4double pDPhi to obtain a solid with name pName and parameters In the picture pRmin 40 pRmax 60 pRtor 200 pSPhi 0 pDPhi 90 Degree pRmin Inside radius pRmax Outside radius pRtor Swept radius of torus pSPhi Starting Phi angle in radians f SPhi fDPhi lt 2P1 fSPhi 2PI pDPhi Delta angle of the segment in radians In addition the Geant4 Design Documentation shows in the Solids Class Diagram the complete list of CSG classes and the STEP documentation contains a detailed EXPRESS description of each CSG solid 64 Detector Definition and Response Specific CSG Solids Polycons Polycons PCON are implemented in Geant4 through the G4Polycon class G4Polycone const G4String amp pName G4double phiStart G4double phiTotal G4int numZPlanes const G4double zPlane const G4double rinner const G4double rOuter G4Polycone const G4String amp pName G4double phiStart G4double phiTo
62. G4 GUANINE Ji 0 033346 6 0 39738 7 0 463407 8 0 105867 G4 GYPSUM 0 023416 8 0 557572 6 0 186215 20 0 232797 G4 N HEPTANE 0 160937 6 0 839063 G4 N HEXANE 0 163741 6 0 836259 G4 KAPTON 0 026362 6 0 691133 7 0 07327 8 0 209235 G4 LANTHANUM OXYBROMIDE 8 0 068138 35 0 340294 57 0 591568 G4 LANTHANUM OXYSULFIDE 8 0 0936 16 0 093778 57 0 812622 G4 LEAD OXIDE 8 0 071682 82 0 928318 G4 LITHIUM AMIDE 0 087783 3 0 302262 7 0 609955 G4 LITHIUM CARBONATE 3 0 187871 6 0 16255 8 0 649579 G4_LITHIUM_FLUORIDE 3 0 267585 9 0 732415 G4_LITHIUM_HYDRIDE 0 126797 3 0 873203 G4_LITHIUM_IODIDE 3 0 051858 53 0 948142 G4_LITHIUM_OXIDE 3 0 46457 8 0 53543 G4 LITHIUM TETRABORATE 3 0 082085 5 0 25568 8 0 662235 G4 LUNG ICRP ak 0 101278 6 0 10231 7 0 02865 8 0 757072 11 0 00184 6 54 54 46 2613 58 32 68376 6603 42 28 86 53 178 11 635 82 494 44 205 T3 T3 72 75 129 54 54 19 421 55 87 94 36 485 134 94 75 281 Appendix 13 12 0 00073 15 0 0008 16 0 00225 17 0 00266 19 0 00194 20 9e 05 26 0 00037 30 1e 05 G4 M3 WAX Jd 0 114318 6 0 655824 8 0 0921831 12 0 134792 20 0 002883 G4 MAGNESIUM CARBONATE 6 0 142455 8 0 569278 2 0 288267 G4_MAGNESIUM_FLUORIDE 9 0 609883 2 0 390117 G4_MAGNESIUM_OXIDE 8 0 396964 2 0 603036 G4
63. G4SDParticleWithEnergy Filter The use of the G4SDParticleFilter class is demonstrated in Example 4 15 where filters which accept gamma electron positron and electron positron are defined 123 Detector Definition and Response 4 5 Digitization 4 5 1 Digi A hit is created by a sensitive detector when a step goes through it Thus the sensitive detector is associated to the corresponding G4LogicalVolume object s On the other hand a digit is created using information of hits and or other digits by a digitizer module The digitizer module is not associated with any volume and you have to implicitly invoke the Digitize method of your concrete G4VDigitizerModule class Typical usages of digitizer module include simulate ADC and or TDC simulate readout scheme generate raw data simulate trigger logics simulate pile up G4VDigi G4VDigi is an abstract base class which represents a digit You have to inherit this base class and derive your own concrete digit class es The member data of your concrete digit class should be defined by yourself G4VDigi has two virtual methods Draw and Print G4TDigiCollection G4TDigiCollection is a template class for digits collections which is derived from the abstract base class G4VDigiCollection G4Event has a G4DCofThisEvent object which is a container class of collections of digits The usages of G4VDigi and G4TDigiCollection are almost the same as G4VHit and G4THits
64. Geometry CSG Solids CSG solids are defined directly as three dimensional primitives They are described by a minimal set of parameters necessary to define the shape and size of the solid CSG solids are Boxes Tubes and their sections Cones and their sections Spheres Wedges and Toruses Box To create a box one can use the constructor 59 Detector Definition and Response G4Box const G4String amp pName G4double pX G4double pY G4double pZ In the picture pX 30 pY 40 pZ 60 by giving the box a name and its half lengths along the X Y and Z axis pX halflength in X pY halflength in Y pZ half length in Z This will create a box that extends from pX to pX in X from pY to pY in Y and from pZ to pZ in Z For example to create a box that is 2 by 6 by 10 centimeters in full length and called BoxA one should use the following code G4Box aBox new G4Box BoxA 1 0 cm 3 0 cm 5 0 cm Cylindrical Section or Tube Similarly to create a cylindrical section or tube one would use the constructor G4Tubs const G4String amp pName G4double pRMin G4double pRMax G4double pDz G4double pSPhi G4double pDPhi In the picture pRMin 10 pRMax 15 pDz 20 giving its name pName and its parameters which are pRMin Inner radius pRMax Outer radius Dz half length in z SPhi the starting phi angle in ra p g p gp g dians 60 Dete
65. H20 new G4Material name Water density ncomponents 2 H20 gt AddElement elH natoms 2 H20 gt AddElement elO natoms 1 2 3 4 Define a Mixture by Fractional Mass In the example below air is built from nitrogen and oxygen by giving the fractional mass of each component Example 2 9 Creating air by defining the fractional mass of its components a 14 01 g mole G4Element elN new G4Element name Nitrogen symbol N z 7 a a 16 00 g mole G4Element elO new G4Element name Oxygen symbol 0 z 8 a density 1 290 mg cm3 G4Material Air new G4Material name Air density ncomponents 2 Air gt AddElement elN fractionmass 70 perCent Air gt AddElement e10 fractionmass 30 perCent 2 3 5 Define a Material from the Geant4 Material Database In the example below air and water are accessed via the Geant4 material database Example 2 10 Defining air and water from the internal Geant4 database G4NistManager man G4NistManager Instance G4Material H20 man gt FindOrBuildMaterial G4 WATER G4Material Air man gt FindOrBuildMaterial G4 AIR 2 3 6 Print Material Information Example 2 11 Printing information about materials G4cout lt lt H20 print a given material G4cout lt lt G4Material GetMaterialTable print the list of materials Getting Started with Geant4 Running a Simple Example In examples novice N03 N03DetectorConstruction
66. Running a Simple Example Example 2 4 Creating a cylinder G4double innerRadiusOfTheTube 0 cm G4double outerRadiusOfTheTube 60 cm G4double hightOfTheTube 25 cm G4double startAngleOfTheTube 0 deg G4double spanningAngleOfTheTube 360 deg G4Tubs tracker_tube new G4Tubs tracker tube innerRadiusOfTheTube outerRadiusOfTheTube hightOfTheTube startAngleOfTheTube spanningAngleOfTheTube This creates a full cylinder named tracker tube of radius 60 centimeters and length 50 cm 2 2 4 Create a Logical Volume To create a logical volume you must start with a solid and a material So using the box created above you can create a simple logical volume filled with argon gas see materials by entering G4LogicalVolume experimentalHall_log new G4LogicalVolume experimentalHall_box Ar expHall_log This logical volume is named expHall log Similarly we create a logical volume with the cylindrical solid filled with aluminium G4LogicalVolume tracker_log new G4LogicalVolume tracker tube Al tracker log and named tracker log 2 2 5 Place a Volume How do you place a volume You start with a logical volume and then you decide the already existing volume inside of which to place it Then you decide where to place its center within that volume and how to rotate it Once you have made these decisions you can create a physical volume which is the placed instance of the volume and embod
67. SetParameterName Energy true true energyCmd gt SetDefaultUnit GeV energyCmd gt SetUnitCandidates eV keV MeV GeV TeV positionCmd new G4UIcmdWith3VectorAndUnit gun position this positionCmd gt SetGuidance Set starting position of the particle positionCmd SetParameterName X Y Z true true positionCmd gt SetDefaultUnit cm positionCmd SetUnitCandidates micron mm cm m km timeCmd new G4UIcmdWithADoubleAndUnit gun time this timeCmd gt SetGuidance Set initial time of the particle timeCmd gt SetParameterName t0 true true timeCmd gt SetDefaultUnit ns timeCmd gt SetUnitCandidates ns ms s Set initial value to G4ParticleGun fParticleGun gt SetParticleDefinition G4Geantino Geantino fParticleGun gt SetParticleMomentumDirection G4ThreeVector 1 0 0 0 0 0 fParticleGun gt SetParticleEnergy 1 0 GeV fParticleGun gt SetParticlePosition G4ThreeVector 0 0 cm 0 0 cm 0 0 cm fParticleGun gt SetParticleTime 0 0 ns G4ParticleGunMessenger G4ParticleGunMessenger 187 Comommunication and Control delete listCmd delete particleCmd delete directionCmd delete energyCmd delete positionCmd delete timeCmd delete gunDirectory void G4ParticleGunMessenger SetNewValue G4UIcommand command G4String newValues if command listCmd particleTable gt dumpTable else if command particleCmd G4ParticleDefinition
68. User Actions and Initializations sese 171 6 2 Optional User ACUODS sires tar Eee et rero t teet e EO Ie ER DE Ere ER Reges 174 6 3 User Information Classes i ete Kena bri ptos habs Ia epe a son egets te eye edo p rov sit 178 6 3 1 G4V UserByentInforinatlon sausais kh RR X ERR Peer K ERR E 178 6 3 2 G4VUserTrackInformation ssssseseeseseeee eene hene aaa enhn en aaa aaa 179 6 3 3 G4VUserPrimary VertexInformation and G4V UserPrimaryTrackInformation 179 6 3 4 G4VUserRegionInformation esse em eere rentre here 179 7 Comommiunication and Control poseren i ee o DR ee ia a a ER IR MEE PR rre err S 181 Tel Built in Commands RP a sekos ni c a es a o a a i E K Kas ae E Ie a 181 7 2 User Interface Defining New Commands 0 sss eren 181 7 2 1 G4U Imessenger ieu RV nr ESe e a sai 181 7 2 2 G4UIcommand and its derived classes esses e m en 182 7 2 3 An example messenger saaa sea sea sasas si e eee RE EA sa Pa ass sans sa 185 7 2 4 How to control the output of G4cout G4cerr oo cece ce aaa HH 188 Sz VISUALIZATION Maer kas hee ie Sei Sek kai da PEASY CBee Bea be PA ee 190 8 1 Introduction to Visualization a m ee rm d RR RO P i E i a as a 190 8 1 1 What Can be Visualized xi siete petet entem eere eatur vede e ERES k 190 8 1 2 You have a Choice of Visualization Drivers sss m 190 8 1 3 Choose the Driver that Meets Your Needs
69. a density density 1 390 g cm3 a 39 95 g mole vG4Material lAr new G4Material name liquidArgon z 18 a density density 8 960 g cm3 a 63 55 g mole G4Material Cu new G4Material name Copper r Z 297 a density define a material from elements case 1 chemical molecule density 1 000 g cm3 G4Material H20 new G4Material name Water density ncomponents 2 H20 gt AddElement elH natoms 2 H20 gt AddElement 610 natoms 1 density 1 032 g cm3 G4Material Sci new G4Material name Scintillator density ncomponents 2 Sci gt AddElement elC natoms 9 Sci gt AddElement elH natoms 10 density 2 200 g cm3 G4Material Si02 new G4Material name quartz density ncomponents 2 SiO2 AddElement elSi natoms 1 SiO2 AddElement 10 natoms 2 density 8 280 g cm3 G4Material PbWO4 new G4Material name PbWO4 density ncomponents 3 PbWO4 AddElement elO natoms 4 PbWO04 gt AddElement elW natoms 1 PbWO4 AddElement elPb natoms 1 define a material from elements case 2 mixture by fractional mass density 1 290 mg cm3 G4Material Air new G4Material name Air density ncomponents 2 Air gt AddElement elN fractionmass 0 7 Air AddElement elO fractionmass 0 3 define a material from elements and or others materials mixture of mixtures density 0 200 g cm3 G4Material Aerog new G4Material name A
70. a framework and is done according to particle type Nevertheless it is also possible to score particles of different types into the same score The framework may also be easily used for customized scoring Scoring may be applied to a mass or a parallel geometry It is done with an object genericly called a scor er using a sampler described above The scorer receives the information about every step taken by a particle of chosen type This information consists of an object of the Geant4 kernel class G4Step and an object of the class G4GeometryCe1l1Step provided specifically for the purpose of scoring and importance sampling G4GeometryCellStep provides information about the previous and current cell of the particle track A scorer class derives from the interface G4VScorer Users may create customized scorers or use the stan dard scoring Classes involved in the framework G4VScorer Classes derived from G4VScorer may use the Geant4 framework for scoring This is the minimum depen dence a customized scoring has to have to use the scoring frame The frame will provide a process messaging a scorer derived from G4VScorer and classes for the setup In particular an object of this type may be given to a G4VSampler In order to score different particle types in one object of G4VScorer the object may be given to different sampler objects The interface class G4VScorer public G4VScorer virtual G4VScorer virtual void Score c
71. a relative spectral distribution as a function of photon energy for the scintillating material An example of this is shown in Example 5 7 Example 5 7 Specification of scintillation properties in DetectorConstruction const G4int NUMENTRIES 9 G4double Scnt_PP NUMENTRIES 6 6 eV 6 7 eV 6 8 eV 6 9 eV Vas Paley UAB Wastin Weds jhe G4double Scnt_FAST NUMENTRIES 0 000134 0 004432 0 053991 0 241971 0 398942 0 000134 0 004432 0 053991 0 241971 G4double Scnt_SLOW NUMENTRIES 0 000010 0 000020 0 000030 0 004000 0 008000 0 005000 0 020000 0 001000 0 000010 G4Material Scnt G4MaterialPropertiesTable Scnt_MPT new G4MaterialPropertiesTable Scnt_MPT gt AddProperty FASTCOMPONENT Scnt PP Scnt_FAST NUMENTRIES Scnt_MPT gt AddProperty SLOWCOMPONENT Scnt PP Scnt_SLOW NUMENTRIES Scnt_MPT gt AddConstProperty SCINTILLATIONYIELD 5000 MeV Scnt_MPT gt AddConstProperty RESOLUTIONSCALE 2 0 Scnt_MPT gt AddConstProperty FASTTIMECONSTANT dg IS P Scnt_MPT gt AddConstProperty SLOWTIMECONSTANT 10 ns Scnt MPT gt AddConstProperty 1YLELDRATTO 078 Scnt gt SetMaterialPropertiesTable Scnt MPT In cases where the scintillation yield of a scintillator depends on the particle type different scintillation processes may be defined for them How this yield scales to the one specified for the material is expressed with the Scin tillationYieldFactor
72. a variety of commodity browsers including some web browser plug ins e VRML is the way to go 191 Visualization e If you want to visualize a geometry that the other visualization drivers can t handle or you need transparency or mirrors and you don t need to visualize trajectories e RayTracer will do it If you just want to quickly check the geometry hierarchy or if you want to calculate the volume or mass of any geometry hierarchy e ASCIITree will meet your needs e You can also add your own visualization driver e Geant4 s visualization system is modular By creating just three new classes you can direct Geant4 infor mation to your own visualization system 8 1 4 Controlling Visualization Your Geant4 code stays basically the same no matter which driver you use Visualization is performed either with commands or from C code e Some visualization drivers work directly from Geant4 e OpenGL e OpenInventor e RayTracer e ASCIITree e For other visualization drivers you first have Geant4 produce a file and then you have that file rendered by another application which may have GUI control HepRep WIRED DAWN VRML 8 1 5 Visualization Details The following sections of this guide cover the details of Geant4 visualization e Section 8 2 Adding Visualization to Your Executable e Section 8 3 The Visualization Drivers e Section 8 4 Controlling Visualization from Commands e Section 8 5 Controlling Visualizati
73. and Events 2 10 1 Introduction This section briefly explains how to perform Geant4 Visualization The description here is based on the sample program examples novice N03 More details are given in Chapter 8 Visualization Example macro files can be found in examples novice N03 visTutor exN03VisX mac 2 10 2 Visualization Drivers The Geant4 visualization system was developed in response to a diverse set of requirements Quick response to study geometries trajectories and hits High quality output for publications Flexible camera control to debug complex geometries Tools to show volume overlap errors in detector geometries Interactive picking to get more information on visualized objects MBR No one graphics system is ideal for all of these reguirements and many of the large software frameworks into which Geant4 has been incorporated already have their own visualization systems so Geant4 visualization was designed around an abstract interface that supports a diverse family of graphics systems Some of these graphics 25 Getting Started with Geant4 Running a Simple Example systems use a graphics library compiled with Geant4 such as OpenGL while others involve a separate application such as WIRED or DAWN You need not use all visualization drivers You can select those suitable to your purposes In the following for sim plicity we assume that the Geant4 libraries are built installed with the OpenGL Xlib driver and
74. and or calculation methods as in the case of the G4HadronCrossSections class mentioned above Indeed G4VCrossSectionDataSet specifies only the abstract interface between physics processes and their data sets and leaves the user free to implement whatever sort of underlying structure is appropriate The current implementation of the data set G4HadronCrossSections reuses the total cross sections for inelastic and elastic scattering radiative capture and fission as used with GHEISHA to provide cross sections for calculation of the respective mean free paths of a given particle in a given material Cross sections for low energy neutron transport The cross section data for low energy neutron transport are organized in a set of files that are read in by the corresponding data set classes at time zero Hereby the file system is used in order to allow highly gran ular access to the data The root directory of the cross section directory structure is accessed through an environment variable Neut ronHPCrossSections which is to be set by the user The classes access ing the total cross sections of the individual processes i e the cross section data set classes for low energy neutron transport are G4NeutronHPElasticData G4NeutronHPCaptureData G4NeutronHPFissionData and G4NeutronHPInelasticData 142 Tracking and Physics For detailed descriptions of the low energy neutron total cross sections they may be registered by the user as
75. and want to visualize only the most interest ones after the long execution Given the memory size of an event and its contents may be large it is the user s responsibility not to keep unnecessary events Example 6 5 G4UserEventAction class G4UserEventAction PubleKcr G4UserEventAction virtual G4UserEventAction virtual void BeginOfEventAction const G4Event virtual void EndOfEventAction const G4Event protected G4EventManager fpEventManager G4UserStackingAction This class has three virtual methods CLassifyNewTrack NewStage and PrepareNewEvent which the user may override in order to control the various track stacking mechanisms ExampleN04 could be a good example to understand the usage of this class ClassifyNewTrack is invoked by G4StackManager whenever a new G4Track object is pushed onto a stack by G4EventManager ClassifyNewTrack returns an enumerator G4ClassificationOfNewTrack whose value indicates to which stack if any the track will be sent This value should be determined by the user G4ClassificationOfNewTrack has four possible values fUrgent track is placed in the urgent stack fWaiting track is placed in the waiting stack and will not be simulated until the urgent stack is empty fPostpone track is postponed to the next event fKill the track is deleted immediately and not stored in any stack These assignments may be made based on the origin of the trac
76. are kept in the detector object and are used to generate C constructors Use marks the used materials e Constructor to create a material from a combination of elements subsequently added via AddElement Use Name Elements Density Unit State Tempera Unit Pressure Unit ture By clicking the column Elements a new window is open to select one of two methods e Add an element giving fraction by weight e Add an element giving number of atoms 4 1 9 2 Solids The most popular CSG solids G4Box G4Tubs G4Cons G4Trd and specific BREPs solids Pcons Pgons are supported at present All related parameters of such a solid can be specified in a parameter widget Users will be able to view each solid using DAWN 4 1 9 3 Logical Volume GGE can specify the following items Name Solid Material VisAttribute The construction and assignment of appropriate entities for G4FieldManager and G4VSensitiveDetector are left to the user 4 1 9 4 Physical Volume A single copy of a physical volume can be created Also repeated copies can be created in several manners First a user can translate the logical volume linearly 96 Detector Definition and Response Name Logi Mother Many XO YO ZO Direction StepSize Unit CopyNum calVolume Volume ber Combined translation and rotation are also possible placing an object repeatedly on a cylindrical pattern Simple models of replicas an
77. as a state machine sssssseseseee em em mH e ene emen meer reete 41 3 4 3 User s book for state change ERR 42 3 4 4 Customizing the Run Manager sese meer 43 3 5 ane T 45 3 5 1 Representation of an event orars cee eme enm en aaa enm aaa 45 35 2 Structire of n event i noe deer HO HR ed Ee epe si he Ere Rees Ere Reed ue 45 3 5 3 Mandates of G4EventManager ee emen mee mee hehe rre 45 3 5 4 Stacking mechanism 2i tnr E Et es atlas ape Pare reste ret bar ORE 45 3 6 Event Generator Interface sssini beige Sis Ga i K ai sys ceste prec dut ed ve cesi oy a 46 3 6 1 Structure of a primary event sedie rer asi o as Es asi 46 3 6 2 Interface to a primary generator ssssssssssee em em enm hent entree 46 3 6 3 Event overlap using multiple generators sss 48 3 7 Event Biasing Techniques 1 2 ecu E HT paie e erede code tas eerie EET RR Oed 48 3 7 1 Scoring Geometrical Importance Sampling and Weight Roulette 48 3 7 2 Physics Bas d Bi simg oerte si sa g Ia Es a sa sis temer ei ener Kaas 56 4 Detector Definition and Response scisso eee ER EU e ERR E RET Ut EE eee rpg e Sento s 59 4 1 Geometry uicit etg tete etes la a si E ER as Peto a da sa o ia a 59 411 1 Introduction 24 5 sans kata iso vaikis ais E sa rt ias RETI a aes sai 59 4 1 2 Solids idee ect iii sns See debs de paisa ecdaas egos pie 59 4 1 3 Logical Volumes i4 iet petet qe a
78. at pDz y pDy2 pAlph Angle with respect to the y axis from the centre of the side Twisted Trapezoid with x and y dimensions varying along z A twisted trapezoid with the x and y dimensions varying along z can be defined as follows G4TwistedTrd const G4String amp G4double G4double G4double G4double G4double G4double pName pDxl DX pDyl pDy2 pDz twistedangle In the picture dx1 30 dx2 10 dyl 40 dy2 15 dz 60 twistedangle 30 Degree where pDx1 Half x length at the surface positioned at dz pDx2 Half x length at the surface positioned at dz pDyl Half y length at the surface positioned at dz pDy2 Half y length at the surface positioned at dz pDz Half z length twistedangle Twisted angle 70 Detector Definition and Response Tube Section Twisted along Its Axis A tube section twisted along its axis can be defined as follows G4TwistedTubs const G4String G4TwistedTubs is a sort of twisted cylinder which placed along the z axis and divided into phi segments is G4double G4double G4double G4double G4double pName twistedangle endinnerrad endouterrad halfzlen dphi Min uhi nn ka d ann pins FUA z PHT 0 fates A AEK Util 10 Eu JEFES CHR VON m L3 SES a Eva yt a i1 SS a In the picture endinnerrad 10 end outerrad 15 halfzlen 20 dphi 90 Degree twiste
79. at the same time hiding their implementation details 4 2 2 Introduction to the Classes 4 2 2 1 G4lsotope A G4Isotope object has a name atomic number number of nucleons mass per mole and an index in the table The constructor automatically stores this isotope in the isotopes table which will assign it an index number 4 2 2 2 G4Element A G4Element object has a name symbol effective atomic number effective number of nucleons effective mass of a mole an index in the elements table the number of isotopes a vector of pointers to such isotopes and a vector of relative abundances referring to such isotopes where relative abundance means the number of atoms per volume In addition the class has methods to add one by one the isotopes which are to form the element A G4Element object can be constructed by directly providing the effective atomic number effective number of nucleons and effective mass of a mole if the user explicitly wants to do so Alternatively a G4Element object can be constructed by declaring the number of isotopes of which it will be composed The constructor will new a vector of pointers to G4Jsotopes and a vector of doubles to store their relative abundances Finally the method to add an isotope must be invoked for each of the desired pre existing isotope objects providing their addresses and relative abundances At the last isotope entry the system will automatically compute the effective atomic number
80. be built the flag G4EXEC BUILD once activated the secondary repository will become the read write one while the primary repository will be considered read only At the current time only few compilers still make use of a template repository A good recommendation valid in general such compilers is to make use of a single template repository specified by the G4TREP environment variable for building all Geant4 libraries then use a secondary template repository G4TREP exec together with the G4EXEC BUILD flag when building any kind of example or application It s always good practise to clean up the secondary template repository from time to time 1 1 Sun OS SunOS Compiler CC The default optimisation level is O2 Since version 5 0 of the compiler native STL is supported and ISO ANSI compliance is required 1 2 Unix Linux g OS Linux Compiler GNU gcc Strict ISO ANSI compilation is forced Cansi pedantic compiler flags also code is compiled with high verbosity diagnostics Wa11 flag The default optimisation level is O2 265 Appendix Note Additional compilation options march pentium4 mfpmath sse to adopt Pentium4 chip specific float ing point operations on the SSE unit can be activated by uncommenting the relevant part in the Linux g gmk configuration script By doing so it has been verified a greater stability of results making possible reproducibility of e
81. by G4EventManager after the track is simulated by G4TrackingManager if the track is marked as killed In case the primary track is suspended or postponed to next event by G4TrackingManager it is sent back to the G4StackManager Secondary G4Track objects returned by G4TrackingManager are also sent to G4StackManager e When G4StackManager returns NULL for the pop request G4EventManager terminates the current process ing event e invokes the user defined methods beginOfEventAction and endOfEventAction from the G4UserEventAction class See Section 6 3 for details 3 5 4 Stacking mechanism G4StackManager has three stacks named urgent waiting and postpone to next event which are objects of the G4TrackStack class By default all G4Track objects are stored in the urgent stack and handled in a last in first out manner In this case the other two stacks are not used However tracks may be routed to the other two stacks by the user defined G4UserStackingAction concrete class If the methods of G4UserStackingAction have been overridden by the user the postpone to next event and waiting stacks may contain tracks At the beginning of an event G4StackManager checks to see if any tracks left over from the previous event are stored in the postpone to next event stack If so it attemps to move them to the urgent stack But first the PrepareNewEvent method of G4UserStackingAction is called Here tracks may be re classified
82. camera commands are described here For more commands see the Control UJCommands section of this user guide Command vis viewer set viewpointThetaPhi theta phi deg rad Arguments Arguments theta and phi are polar and azimuthal camera angles respectively The default unit is degree Action Set a view point in direction of theta phi Example Set the viewpoint in direction of 70 deg 20 deg Idle vis viewer set viewpointThetaPhi 70 20 Additional notes Camera parameters should be set for each viewer They are initialized with command vis viewer re set Command vis viewer zoom scale factor Argument The scale factor The command multiplies magnification of the view by this factor Action Zoom up down of view Example Zoom up by factor 1 5 Idle vis viewer zoom 1 5 Additional notes Camera parameters should be set for each viewer They are initialized with command vis viewer re set A similar pair of commands scale and scaleTo allow non uniform scaling i e zoom differently along different axes For details see the Control UICommands section of this user guide Command vis viewer set style style name Arguments Candidate values of the argument are wireframe and surface w and s also work Action Set a drawing style to wireframe or surface Example Set the drawing style to surface Idle vis viewer set style surface Additional n
83. cc you will find examples of all possible ways to build a material 2 4 How to Specify Particles G4VuserPhysicsList is one of the mandatory user base classes described in Section 2 1 Within this class all particles and physics processes to be used in your simulation must be defined The range cut off parameter should also be defined in this class The user must create a class derived from G4VuserPhysicsList and implement the following pure virtual methods ConstructParticle jf a6netruction of particles ConstructProcess construct processes and register them to particles SetCuts setting a range cut value for all particles This section provides some simple examples of the Const ructParticle and SetCuts methods For infomation on Const ructProcess methods please see Section 2 5 2 4 1 Particle Definition Geant4 provides various types of particles for use in simulations ordinary particles such as electrons protons and gammas resonant particles with very short lifetimes such as vector mesons and delta baryons e nuclei such as deuterons alphas and heavy ions e quarks di quarks and gluons Each particle is represented by its own class which is derived from G4ParticleDefinition Particles are organized into six major categories lepton meson e baryon boson shortlived and ion each of which is defined in a corresponding sub directory under geant 4 source particles There is
84. ck ck ck ck ck ck ck ck ck ck ckckckckckck kc ko k kk PARAMETER NMXHEP 2000 COMMON HEPEVT NEVHEP NHEP ISTHEP NMXHEP IDHEP NMXHEP gt JMOHEP 2 NMXHEP JDAHEP 2 NMXHEP PHEP 5 NMXHEP VHEP 4 NMXHEP DOUBLE PRECISION PHEP VHEP WRITE 6 NHEP DO IHEP 1 NHEP WRITE 6 10 gt ISTHEP IHEP IDHEP IHEP JDAHEP 1 IHEP JDAHEP 2 IHEP PHEP 1 IHEP PHEP 2 IHEP PHEP 3 IHEP PHEP 5 IHEP 10 FORMAT 4110 4 1X D15 8 ENDDO RETURN END 3 6 2 3 Future interface to the new generation generators Several activities have already been started for developing object oriented event generators Such new generators can be easily linked and used with a Geant4 based simulation Furthermore we need not distinguish a primary generator from the physics processes used in Geant4 Future generators can be a kind of physics process plugged in by inheriting G4VProcess 3 6 3 Event overlap using multiple generators Your G4VUserPrimaryGeneratorAction concrete class can have more than one G4VPrimaryGenerator concrete class Each G4VPrimaryGenerator concrete class can be accessed more than once per event Using these class objects one event can have more than one primary event One possible use is the following Within an event a G4HEPEvtInterface class object instantiated with a minimum bias event file is accessed 20 times and another G4HEPEvtinterface class object instantiated with a signal event file i
85. delay between absorption and re emission of the photon is sampled from an exponential distribution with the decay term equal to WLSTIMECONSTANT If on the other hand the WLSProcess gt UseTimeGenerator delta is chosen the time delay is a delta function and equal to WLSTIMECONSTANT The default is delta in case the G4OpWLS UseTimeGenerator const G4String name method is not used 5 2 5 4 Tracking of Photons in processes optical Absorption The implementation of optical photon bulk absorption G4OpAbsorption is trivial in that the process merely kills the particle The procedure requires the user to fill the relevant GGMaterialPropertiesTable with empirical data for the absorption length using ABSLENGTH as the property key in the public method AddP rop erty The absorption length is the average distance traveled by a photon before being absorpted by the medium i e it is the mean free path returned by the GetMeanFreePath method Rayleigh Scattering The differential cross section in Rayleigh scattering is proportional to cos where is the polar of the new polarization vector with respect to the old polarization vector The G4OpRayleigh scattering process samples 151 Tracking and Physics this angle accordingly and then calculates the scattered photon s new direction by requiring that it be perpendicular to the photon s new polarization in such a way that the final direction initial and final polarizations are a
86. described above with the data stores of the corresponding processes for neutron interactions It should be noted that using these total cross section classes does not require that the neutron_hp models also be used It is up to the user to decide whethee this is desirable or not for his particular problem 5 2 2 2 Hadrons at Rest List of implemented Hadron at Rest processes The following process classes have been implemented e pi absorption class name G4PionMinusAbsorptionAtRest or G4PiMinusAbsorptionAtRest e kaon absorption class name G4KaonMinusAbsorptionAtRest or G4KaonMinusAbsorption neutron capture class name G4NeutronCaptureAtRest e anti proton annihilation class name G4AntiProtonAnnihilationAtRest anti neutron annihilation class name G4AntiNeutronAnnihilationAtRest e mu capture class name G4MuonMinusCaptureAtRest alternative CHIPS model for any negativly charged particle class name G4QCaptureAtRest Obviously the last process does not strictly speaking deal with a hadron at rest It does nonetheless share common features with the others in the above list because of the implementation model chosen The differences betweeen the alternative implementation for kaon and pion absorption concern the fast part of the emitted parti cle spectrum G4PiMinusAbsorptionAtRest and G4KaonMinusAbsorptionAtRest focus especially on a good de scription of this part of the spectrum Implementation Interface to Gea
87. drawByCharge e G4TrajectoryDrawByParticleID drawByParticleID e G4TrajectoryDrawByOriginVolume drawByOriginVolume e G4TrajectoryDrawBy Attribute drawBy Attribute Both the context and model properties can be configured by the user The models are described briefly below followed by some example configuration commands G4TrajectoryGenericDrawer This model simply draws all trajectories in the same style with the properties provided by the context G4TrajectoryDrawByCharge This is the default model if no model is specified by the user this model will be constructed automatically The trajectory lines are coloured according to charge with all other configuration parameters provided by the default context The default colouring scheme is shown below Charge Colour 1 Blue T Red 0 Green G4TrajectoryDrawByParticlelD This model colours trajectory lines according to particle type All other configuration parameters are provided by the default context By default all trajectories are coloured grey Chosen particle types can be highlighted with specified colours 230 Visualization G4TrajectoryDrawByOriginVolume This model colours trajectory lines according to the trajectories originating volume name The volume can be either a logical or physical volume Physical volume takes precedence over logical volume All trajectories are coloured grey by default G4TrajectoryDrawByAttribute This model draws trajectories based
88. drivers and the platforms on which they can be installed For any of the visualization drivers to work the corresponding graphics system must be installed beforehand Unless the environment variable GAVIS NONE is set to 1 visualization drivers that do not depend on external libraries are automatically incorporated into Geant4 libraries during their installation Here installation of Geant4 libraries means the generation of Geant4 libraries by compilation The automatically incorporated visualization drivers are DAWNFILE HepRepFile HepRepXML RayTracer VRMLIFILE VRML2FILE and ATree and GAGTree The OpenGL OpenInventor and RayTracerX drivers are not incorporated by default Nor are the DAWN Net work and VRML Network drivers because they require the network setting of the installed machine In order to incorporate them the environment variables G4AVIS BUILD DRIVERNAME DRIVER should be set to 1 before installing the Geant4 libraries setenv G4VIS BUILD OPENGLX DRIVER setenv G4VIS BUILD OPENGLXM DRIVER setenv G4VIS BUILD OIX DRIVER setenv G4VIS BUILD RAYTRACERX DRIVER setenv G4VIS BUILD DAWN DRIVER setenv G4VIS BUILD VRML DRIVER OpenGL Xlib driver OpenGL Motif driver OpenInventor Xlib driver RayTracer XLib driver DAWN Network driver VRML Network PRPRPRPRP LE db Se db OSE db Unless the environment variable GAVIS NONE is set to 1 setting any of the above variables sets a C pre proces sor fla
89. each event by implementing the method MyEventAction EndOfEventAction as follows fee C source codes void ExNO3EventAction EndOfEventAction const G4Event evt extract the trajectories and draw them if G4VVisManager GetConcreteInstance G4TrajectoryContainer trajectoryContainer evt gt GetTrajectoryContainer G4int n_trajectories 0 if trajectoryContainer n trajectories trajectoryContainer gt entries for G4int i 0 i lt n trajectories i G4Trajectory trj G4Trajectory evt GetTrajectoryContainer i if drawFlag all trj DrawTrajectory 50 else if drawFlag charged amp amp trj GetCharge 0 trj DrawTrajectory 50 else if drawFlag neutral amp amp trj GetCharge 0 trj DrawTrajectory 50 end of C source codes 8 5 4 Enhanced trajectory drawing It is possible to use the enhanced trajectory drawing functionality in compiled code as well as from commands Multiple trajectory models can be instantiated configured and registered with G4VisManager For details see the section on Section 8 7 4 Enhanced Trajectory Drawing 8 5 5 HepRep Attributes for Trajectories The HepRep file formats HepRepFile and HepRepXML attach various attributes to trajectories such that you can view these attributes label trajectories by these attributes or make visibility cuts based on these attributes If you use the default Geant
90. error the user can limit the effect of this bias on for example the future estimation of the reconstructed particle momentum 108 Detector Definition and Response Figure 4 7 The distance between the calculated chord intersection point C and a computed curve point D is used to determine whether C is an accurate representation of the intersection of the curved path ADB with a volume boundary Here CD is likely too large and a new intersection on the chord AD will be calculated The delta one step parameter is the accuracy for the endpoint of ordinary integration steps those which do not intersect a volume boundary This parameter is a limit on the estimated error of the endpoint of each physics step It can be seen as akin to a statistical uncertainty and is not expected to contribute any systematic behavior to physical quantities In contrast the bias addressed by delta intersection is clearly correlated with potential systematic errors in the momentum of reconstructed tracks Thus very strict limits on the intersection parameter should be used in tracking detectors or wherever the intersections are used to reconstruct a track s momentum Delta intersection and delta one step are parameters of the Field Manager the user can set them according to the demands of his application Because it is possible to use more than one field manager different values can be set for different detector regions Note that reasonable values for the
91. exist when the application terminates Persistent objects on the other hand live beyond the termination of the application process and may then be accessed by other processes in some cases by processes on other machines Database Environment persistent obied Application Cache Time Figure 4 9 Persistent object C does not have as an intrinsic part of the language the ability to store and retrieve persistent objects Geant4 provides an abstract framework for persistency of hits digits and events An example which demonstrates an implementation of object persistency using one of the tools accessible through the available interface is provided in examples extended persistency 125 Detector Definition and Response 4 6 2 Using Reflex for persistency of Geant4 objects Object persistency of Geant4 objects is also possible by the mean of the Reflex library Reflex provides in a non intrusive way reflection capabilities to C classes by generating dictionary information for them Those dictionaries can then be loaded in memory allowing direct persistency of the given objects without any instrumen tation of the code The Reflex library is also part of ROOT since release v5 08 The basic steps that one needs to do in order to use Reflex with ROOT I O for arbitrary C classes is 1 Generate the dictionary for the given classes using the genreflex tool from ROOT this usually is done by adding the appropr
92. exploit full potential of graphics hardware Limited printing ability pixel graphics not vector graphics e Openlnventor View directly from Geant4 Requires addition of OpenInventor libraries freely available for most Linux systems e Rendered photorealistic image Many interactive features zoom rotate translate click to see inside opaque volumes e Fast response can usually exploit full potential of graphics hardware e Expanded printing ability vector and pixel graphics HepRep WIRED 190 Visualization e Create a file to view in the WIRED3 HepRep Browser or the WIRED4 JAS Plugin Requires WIRED browser a Java application easily to install on all operating systems e Wireframe or simple area fills not photorealistic Many interactive features zoom rotate translate click to show attributes momentum etc e special projections FishEye etc control visibility from hierarchical tree view of data e Hierarchical view of the geometry e Export to many vector graphic formats PostScript PDF etc DAWN e Create a file to view in the DAWN Renderer Requires DAWN available for all Linux and Windows systems e Rendered photorealistic image No interactive features Highest quality technical rendering output to vector PostScript e VRML e Create a file to view in any VRML browser some as web browser plug ins Requires VRML browser many different choices for different operating systems
93. fSpacing G4ThreeVector origin 0 0 Zposition physVol gt SetTranslation origin physVol gt SetRotation 0 Note that the translation and rotation given in this scheme are those for the frame of coordinates the passive method They are not for the active method in which the solid is rotated into the mother frame of coordinates Similarly the ComputeDimensions method is used to set the size of that copy void ExNO2ChamberParameterisation ComputeDimensions G4Box amp trackerChamber const G4int copyNo const G4VPhysicalVolume physVol const G4double halfLength fHalfLengthFirst copyNo 1 fHalfLengthIncr trackerChamber SetXHalfLength halfLength trackerChamber SetYHalfLength halfLength 82 Detector Definition and Response trackerChamber SetZHalfLength fHalfWidth The user must ensure that the type of the first argument of this method in this example G4Box amp corresponds to the type of object the user give to the logical volume of parameterised physical volume More advanced usage allows the user to change the type of solid by creating a Comput eSolid method or tochange the material of the volume by creating a Comput eMat erial method This method can also utilise information from a parent or other ancestor volume see the Nested Parameterisation below for the parameterisation Example N07 shows a simple parameterisation by material A more complex example is provided in example
94. geometry definition CSG geometry X definition geometry X definition includes Parametrised includes replica volume uniform magnetic field e uniform magnetic field Hits Digi tracker type hits calorimeter type hits PIIM e minimal particle set EM particles set EM particles set e single element materials mixtures and com mixtures and com pound elements pound elements Physics transportation EM physics EM physics Vis e detector amp trajectory detector amp trajectory draw drawing ing tracker type hits draw ing G UI GUI selection GUI selection Global Table 9 1 The item chart for novice level examples NO1 NO2 and NO3 243 Examples ExampleN04 ExampleN05 ExampleN06 comments simplified collider geome parametrised shower ex Optical photon example try ample Run main for interactive main for interactive main for interactive mode mode mode Event event generator selec event generator selection event generator selection tion HEPEvtInterface HEPEvtInterface particleGun Stack control Tracking e select trajectories Selecting secondaries Geometry e geometry definition ghost volume for shower geometry definition BREP includes Param Repli parametrisation with rotation ca non uniform magnetic field Hits Digi e Tracker calorimeter Sensitive detector for counter types shower parametrisation ReadOut geometr
95. geometry with uniform magnetic field Electromagnetic processes ExampleN03 Description below Simplified calorimeter geometry Electromagnetic processes e Various materials ExampleN04 Description below Simplified collider detector with a readout geometry e Full ordinary processes PYTHIA primary events Event filtering by stack e ExampleN05 Description below Simplified BaBar calorimeter EM shower parametrisation 2 ExampleN06 Description below e Optical photon processes ExampleN07 Description below e Geometrical Regions for production thresholds 242 Examples Dynamic geometry setups between runs Primitive scorer and filter Derived run class and run action Table 9 1 Table 9 2 and Table 9 3 display the item charts for the examples currently prepared in the novice level ExampleN01 ExampleN02 ExampleN03 comments minimal set for geantino fixed target tracker geome EM shower in calorimeter transportation try Run main for hard coded main for interactive main for interactive batch mode mode e SetCut and Process On Off Event event generator selection event generator selection event generator selec particleGun particleGun tion particleGun e end of event simple analysis in UserEven tAction Tracking hard coded verbose level selecting secondaries select trajectories setting Geometry
96. i i wate a dos 76 4 14 Physical VOl MES 55 cas ree ee on i iais Isa ai ao ie ERR AON Wow as is Tik 77 4 1 5 Touchables Uniquely Identifying a Volume 00 0 0 aaa ses 87 4 1 6 Creating an Assembly of Volumes cece aa kaka kaka nce aa aa aaa aaa aaa aa HII emere 88 4 1 7 Reflecting Hierarchies of Volumes sese 91 4 1 8 The Geometry Navigator Laika aaa III Ie hee aaa aa aa aaa aaa 92 4 1 9 A Simple Geometry Editor 1 oie tere ERR 95 4 1 10 Converting Geometries from Geant3 21 Lukaa aaa aaa aa aaa aa aa aa aaa 97 4 1 11 Detecting Overlapping Volumes lt a cece cece HH HH ener 98 4 1 12 Dynamic Geometry Setups 2 0 0 cece cece c cence aaa aaa aa aa aaa aaa aaa aaa 102 4 1 13 Importing XML Models Using GDML see 103 4 2 Maternal i une piueeibesue eee eerte RE IDE EMI EE 103 4 2 1 General considerations itte PR Eit pare ET SER re E EE B sis err grips 103 4 2 2 Introduction to the Classes sssrin sree snr o e e e eme mH eI eene 104 4 2 3 Recipes for Building Elements and Materials se 105 4 24 The Tables 5 1 eh ias sana In sis Ia asa iais ere eI 107 4 3 Electromagnetic Field 1 td pere a si ee Ai Persi testa pes t 108 4 3 1 An Overview of Propagation in a Field sss 108 4 3 2 Practical Aspects 23332 eR ORE REPERI eka eee 109 4 3 3 Spin Tracking ied eater Rud eed ge 113 CE MID as Andis a E aa as a sa aa ie I a o a a a a a a a aa a Eine 114
97. include in kernel library the XM or XAW Motif based user interfaces G4UI USE XM G4UI USE XAW Specifies to use the XM or XAW interfaces in the application to be built G4UI BUILD WIN32 SESSION Specifies to include in kernel library the WIN32 terminal interface for Windows systems G4UI USE WIN32 Specifies to use the WIN32 interfaces in the application to be built on Windows systems 270 Appendix G4UI_NONE If set no UI sessions nor any UI libraries are built This can be useful when running a pure batch job or in a user framework having its own UI system Visualization specific The most relevant flags for visualization graphics drivers are just listed here A description of these variables is given also in section 2 of this User s Guide G4VIS_BUILD_OPENGLX_DRIVER Specifies to build kernel library for visualization including the OpenGL driver with X11 extension It requires SOGLHOME set path to OpenGL installation G4VIS_USE_OPENGLX Specifies to use OpenGL graphics with X11 extension in the application to be built G4VIS_BUILD_OPENGLXM_DRIVER Specifies to build kernel library for visualization including the OpenGL driver with XM extension It requires SOGLHOME set path to OpenGL installation G4VIS_USE_OPENGLXM Specifies to use OpenGL graphics with XM extension in the application to be built G4VIS_BUILD_OI_DRIVER Specifies to build kernel library for visualization including the OpenInventor drive
98. interact ing with the nucleus For particles in flight two sets of models exist for inelastic scattering low energy and high energy models Both sets are based originally on the GHEISHA package of Geant3 21 and the origi nal approaches to primary interaction nuclear excitation intra nuclear cascade and evaporation is kept The models are located in the sub directories hadronics models low energy and hadronics mod els high energy The low energy models are targeted towards energies below 20 GeV the high energy models cover the energy range from 20 GeV to O TeV Fission capture and coherent elastic scattering are also modeled through parametrised models e Data driven models are available for the transport of low energy neutrons in matter in sub directory hadron ics models neutron hp The modeling is based on the data formats of ENDF B VI and all distribu tions of this standard data format are implemented The data sets used are selected from data libraries that conform to these standard formats The file system is used in order to allow granular access to and flexibility in the use of the cross sections for different isotopes and channels The energy coverage of these models is from thermal energies to 20 MeV e Theory driven models are available for inelastic scattering in a first implementation covering the full ener gy range of LHC experiments They are located in sub directory hadronics models generator The current philosophy implies
99. list interpreter are supplied in the directory examples extended g3tog4 l cltog4 is asimple example which simply invokes the call list interpreter method G4BuildGeom from the G3toG4DetectorConstruction class builds the geometry and exits 2 clGeometry is more complete and is patterned as for the novice Geant4 examples It also invokes the call list interpreter but in addition allows the geometry to be visualized and particles to be tracked To compile and build the G3toG4 libraries you need to have set in your environment the variable G4LIB BUILD G3TOGA at the time of installation The G3toG4 libraries are not built by default Then simply type gmake from the top level source g3tog4 directory To build the converter executable rztog4 simply type gmake bin To make everything simply type gmake global 97 Detector Definition and Response To remove all G3t 0G4 libraries executables and d files simply type gmake clean 4 1 10 3 Current Status The package has been tested with the geometries from experiments like BaBar CMS Atlas Alice Zeus L3 and Opal Here is a comprehensive list of features supported and not supported or implemented in the current version of the package Supported shapes all GEANT 3 21 shapes except for GTRA CTUB PGON PCON are built using the specific solids GAPolycone and G4Polyhedra e GEANT 3 21 MANY feature is only partially supported MANY positions are resol
100. lt pX or to obtain the general trapezoid see the Software Reference Manual pDx1 Half x length at yz pDy pDx2 Half x length at y pDy pDy Half y length pDz Half z length pTheta Polar angle of the line joining the centres of the faces at pDz pDyl Half y length at pDz pDx1 Half x length at pDz y pDy1 pDx2 Half x length at pDz y pDy pDy2 Half y length at pDz pDx3 Half x length at pDz y pDy2 pDx4 Half x length at pDz y pDy2 pAlphl Angle with respect to the y axis from the centre of the side lower endcap pAlph2 Angle with respect to the y axis from the centre of the side upper endcap Note on pAlph1 2 the two angles have to be the same due to the planarity condition Sphere or Spherical Shell Section To build a sphere or a spherical shell section use G4Sphere const G4String pName G4double pRmin G4double pRmax G4double IDE G4double OWE ely G4double pSTheta G4double pDTheta to obtain a solid with name pName and parameters In the picture pRmin 100 pRmax 120 pSPhi 0 Degree pDPhi 180 Degree pS Theta 0 Degree pDTheta 180 Degree pRmin pRmax Inner radius Outer radius 63 Detector Definition and Response pSPhi Starting Phi angle of the segment in radians pDPhi Delta Phi angle of the segment in radians pSTheta Starting Theta angle of the segment in radians pDTheta
101. module reco d name phys GATARGET name GAEXLIB true EXTRALIBS G4WORKDIR tmp GASYSTEM name libphys a L HOME reco lib lreco EXTRALIBSSOURCEDIRS HOME phys HOME reco EXTRA LINK DEPENDENCIES G4WORKDIR tmp GASYSTEM name libphys a BEO NSA ES SINE alby be Jena include G4INSTALL config binmake gmk MYSOURCES wildcard HOME phys src cc GAWORKDIR tmp GASYSTEM name libphys a MYSOURCES cd HOME phys MAKE 6 Build for MS Visual C Geant4 can be compiled with the C compiler of MS Visual Studio C and the Cygwin toolset Detailed instructions are given in the Installation manual As the build system relies on make and other Unix tools using only the compiler of MS Visual Studio the section on Section 5 Makefile and environment variables applies also for building with MS Visual C We do not support compilation directly under MS Visual Studio i e we do not provide workspace files dsw or project files dsp However the executables created are debuggable using the debugger of MS Visual Studio You may have to help the debugger finding the path to source files the first time you debug a given executable You can find below some useful pages collecting instructions on how to start with the installation of CygWin and also tips for creating a project under Visual Studio e Step by step Installation Guides Gettin
102. mper PIRE ERR SEETI AROR ESSENER EES 207 8 4 Controlling Visualization from Commands sese eee 208 8 4 1 Scene scene handler and viewer kaka kaka asas asas asas aaa nennen nne 208 8 4 2 Create a scene handler and a viewer vis open command sese 209 8 4 3 Create an empty scene vis scene create command sees 209 8 4 4 Visualization of a physical volume vis drawVolume command 209 8 4 5 Visualization of a logical volume vis specify command ssssss 210 8 4 6 Visualization of trajectories vis scene add trajectories command 210 8 4 7 Visualization of hits vis scene add hits command sees 211 8 4 8 HepRep Attributes for Hits ehem hehehe 211 8 4 9 Basic camera workings vis viewer commands eee 211 8 4 10 Declare the end of visualization for flushing vis viewer flush command 213 8 4 11 End of Event Action and End of Run Action vis viewer endOfEventAc tion and vis viewer endOfEventAction commands lt kaka aaa 213 8 4 12 HepRep Attributes for Trajectories sse e 213 8 4 13 How to save a visualized views to PostScript files esse 214 8 4 14 Culling 1 ehm ki aa Kap ia Bai aaa ad PERI i da ia asa sia EIEN aa 214 aa Sala p 215 8 4 16 Tutorial macros 1 oie th vated rie snes TRE a ik i i i E an ai A 216 vii Geant4 U
103. of a size defined in screen units pixels Here size means overall size e g diameter of circle and side of square but diameter and radius access functions are defined to avoid ambiguity 236 Visualization So the user who constructs a marker should decide whether or not it should be visualized to a given size in world coordinates by setting the world size Alternatively the user can set the screen size and the marker is visualized to its screen size Finally the user may decide not to set any size in that case it is drawn according to the sizes specified in the default marker specified in the class G4ViewParameters By default square and circle are supported in Geant4 Visualization The former is described with class G4Square and the latter with class G4Circle Marker Type Class Name circle G4Circle right square G4Square These classes are inherited from class G4VMarker They have constructors as follows 1 gt gt gt gt Constructors of G4Circle and G4Sguare G4Circle G4Circle const G4Point3D amp pos G4Square G4Square const G4Point3D amp pos Access functions of class G4VMarker are summarized below Access functions of markers Example 8 6 shows the access functions inherited from the base class G4VMarker Example 8 6 The access functions inherited from the base class G4V Marker Jd m Set functions of G4VMarker void G4VMarker SetPosition const G4Point3D amp void G4
104. of geometrical information with CAD systems A key feature of the Geant4 geometry is that the volume definitions are independent of the solid representation By this abstract interface for the G4 solids the tracking component works identically for various representations The treatment of the propagation in the presence of fields has been provided within specified accuracy An OO design allows us to exchange different numerical algorithms and or different fields not only B field without affecting any other component of the toolkit Particle Definition and Matter These two categories manage the the definition of materials and particles Physics This category manages all physics processes participating in the interactions of particles in matter The ab stract interface of physics processes allows multiple implementations of physics models per interaction or per channel Models can be selected by energy range particle type material etc Data encapsulation and polymorphism make it possible to give transparent access to the cross sections independently of the choice of reading from an ascii file or of interpolating from a tabulated set or of computing analytically from a formula Electromagnetic and hadronic physics were handled in a uniform way in such a design opening up the physics to the users Hits and Digitization These two categories manage the creation of hits and their use for the digitization phase The basic design and implementat
105. of the CLHEP Computing Library for High Energy Physics distribution For more detailed documentation please refer to the CLHEP reference guide and the CLHEP user manual G4ThreeVector G4RotationMatrix G4LorentzVector and G4LorentzRotation Vector classes defining 3 component x y z vector entities rotation of such objects as 3x3 matrices 4 com ponent x y z t vector entities and their rotation as 4x4 matrices G4Plane3D G4Transform3D G4Normal3D G4Point3D and G4Vector3D Geometrical classes defining geometrical entities and transformations in 3D space 3 2 2 The HEPRandom module in CLHEP The HEPRandom module originally part of the Geant4 kernel and now distributed as a module of CLHEP has been designed and developed starting from the Random class of MC the original CLHEP s HepRandom module and the Rogue Wave approach in the Math h package For detailed documentation on the HEPRandom classes see the CLHEP reference guide and the CLHEP user manual Information written in this manual is extracted from the original manifesto distributed with the HEPRandom package The HEPRandom module consists of classes implementing different random engines and different random distributions A distribution associated to an engine constitutes a random generator A distribution class can collect different algorithms and different calling sequences for each method to define distribution parameters or range intervals An en
106. of the geometry used for importance sampling This may be the world volume of the mass or of a parallel geometry Importance stores derive from the interface G4VIStore class G4VIStore 1 publics GAVIStore virtual G4VIStore virtual G4double GetImportance const G4GeometryCell amp gCell virtual G4bool IsKnown const G4GeometryCell amp gCell const Icons 107 virtual const G4VPhysicalVolume amp GetWorldVolume const 0 0 A concrete implementation of an importance store is provided by the class G4VStore The public part of the class is class G4IStore public G4VIStore i public explicit G4IStore const G4VPhysicalVolume amp worldvolume virtual G4IStore virtual G4double GetImportance const G4GeometryCell amp gCell const virtual G4bool IsKnown const G4GeometryCell amp gCell const virtual const G4VPhysicalVolume amp GetWorldVolume const void AddImportanceGeometryCell G4double importance const G4GeometryCell amp gCell void AddImportanceGeometryCell G4double importance const G4VPhysicalVolume 4 G4int aRepNum 0 void ChangeImportance G4double importance const G4GeometryCell amp gCell void ChangeImportance G4double importance const G4VPhysicalVolume 4 G4int aRepNum 0 G4double GetImportance const G4VPhysicalVolume amp G4int aRepNum 0 const Disease NM Me The member function AddImportanceGeometryCell enters a cell and an importance value into the im portance
107. on the HepRep style attributes associated with trajectories Each attribute drawer can be configured with interval and or single value data A new context object is created for each inter val single value This makes it possible to have different step point markers etc as well as line colour for trajec tory attributes falling into different intervals or matching single values The single value data should override the interval data allowing specific values to be highlighted Units should be specified on the command line if the attribute unit is specified either as a G4BestUnit or if the unit is part of the value string 8 7 3 Controlling from Commands Multiple trajectory models can be created and configured using commands in the vis modeling trajec tories directory It is then possible to list available models and select one to be current Model configuration commands are generated dynamically when a model is instantiated These commands apply directly to that instance This makes it possible to have multiple instances of the drawByCharge model for example each independently configurable through it s own set of commands See the interactive help for more information on the available commands 8 7 3 1 Example commands Create a generic model named generic 0 by default vis modeling trajectories create generic Configure context to colour all trajectories red vis modeling trajectories generic 0 default setLineColour red Creat
108. only for the concrete class that is not used as a base class of any other classes For example do not use the G4Trajectory class as a base class for a customized trajectory class since G4Trajectory uses G4Allocator G4THitsMap G4THitsMap is an alternative to G4THitsCollection G4THitsMap does not demand G4VHit but instead any variable which can be mapped with an integer key Typically the key is a copy number of the volume and the mapped value could for example be a double such as the energy deposition in a volume G4THitsMap is conve nient for applications which do not need to output event by event data but instead just accumulate them All the G4VPrimitiveScorer classes discussed in Section 4 4 5 use G4THitsMap G4THitsMap is derived from the G4VHitsCollection abstract base class and all objects of this class are also stored in G4HCofThisEvent at the end of an event How to access a G4THitsMap object is discussed in the following section Section 4 4 5 4 4 2 Sensitive detector G4VSensitiveDetector G4VSensitiveDetector is an abstract base class which represents a detector The principal mandate of a sensitive de tector is the construction of hit objects using information from steps along a particle track The ProcessHits method of G4VSensitiveDetector performs this task using G4Step objects as input In the case of a Readout geometry see Section 4 4 3 objects of the G4TouchableHistory class may be used as an optional input
109. only for visualization and is not included in geometrical information such as shapes position and orientation Typical examples of visualization attributes are Color Visible Invisible Wireframe Solid For exam ple in visualizing a box the Visualization Manager must know its colour If an object to be visualized has not been assigned a set of visualization attributes then an appropriate default set is used automatically A set of visualization attributes is held by an instance of class G4VisAttributes defined in the graphics_reps category In the following we explain the main fields of the G4VisAttributes one by one 8 6 1 Visibility Visibility is a boolean flag to control the visibility of objects that are passed to the Visualization Manager for visualization Visibility is set with the following access function 224 Visualization void G4VisAttributes SetVisibility G4bool visibility If you give false to the argument and if culling is activated see below visualization is skipped for objects for which this set of visualization attributes is assigned The default value of visibility is true Note that whether an object is visible or not is also affected by the current culling policy which can be tuned with visualization commands By default the following public static function is defined static const G4VisAttributes amp GetInvisible which returns a reference to a const object in which visibility is set to fa
110. opposite one and verifying that the boundary crossings are the same The tool can be used for any Geant4 geometry provided that the user geometry to be debugged is available as a subclass of G4VUserDetectorConstruction and is used to construct the OlapDetConstr class of the tool A dummy class RandomDetector is provided for this purpose in the tool itself Run time commands are provided by the tool to navigate in the geometry tree UNIX like navigation of the logical volume hierarchy is provided by the o1ap cd command The root of the logical volume tree can be accessed by the character Any node in the volume tree can be accessed by a separated string of regular expressions If is at the beginning of the string the tree hierarchy is transversed from the root otherwise from the currently chosen logical volume Further the command olap goto regexp can be used to jump to the first logical volume matching the expression regexp Every successful navigation command olap cd olap goto results in the construction of a NewWorld the mother volume being the argument of the command and the daughter volumes being the direct daughters of the mother volume olap pwd always shows where in the full geometrical hierarchy the current NewWorld and mother volume are located For more detailed information view the README file provided with the tool 4 1 12 Dynamic Geometry Setups Geant4 can handle geometries which vary in time
111. or processes may be pointers or strings with names 137 Tracking and Physics 5 2 1 2 Low Energy Electromagnetic Processes The following is a summary of the Low Energy Electromagnetic processes available in Geant4 Further informa tion is available in the homepage of the Geant4 Low Energy Electromagnetic Physics Working Group The physics content of these processes is documented in Geant4 Physics Reference Manual and in other papers Photon processes Compton scattering class G4LowEnergyCompton Polarized Compton scattering class G4LowEnergyPolarizedCompton Rayleigh scattering class G4LowEnergyRayleigh Gamma conversion also called pair production class G4LowEnergyGammaConversion Photo electric effect classG4LowEnergyPhotoElectric Electron processes Bremsstrahlung class G4LowEnergyBremsstrahlung Ionisation and delta ray production class G4LowEnergylonisation Hadron and ion processes Ionisation and delta ray production class G4hLowEnergylonisation An example of the registration of these processes in a physics list is given in Example 5 2 Example 5 2 Registration of electromagnetic low energy electron photon processes void LowEnPhysicsList ConstructEM theParticlelterator gt reset while theParticleIterator G4ParticleDefinition particle theParticleIterator value G4ProcessManager pmanager particle GetProcessManager G4String particleName particle GetParticleName
112. original seeds stored in the static table of seeds in HepRandom at the specified index Except for the RanecuEngine for which the internal status is represented by just a couple of longs all the other engines have a much more complex representation of their internal status which currently can be obtained only through the methods saveStatus restoreStatus and showStatus which can also be statically called from HepRandom The status of the generator is needed for example to be able to reproduce a run or an event in a run at a given stage of the simulation RanecuEngine is probably the most suitable engine for this kind of operation since its internal status can be fetched reset by simply using get Seeds set Seeds get TheSeeds set TheSeeds for the stat ic interface in HepRandom 3 2 2 2 The static interface in the HepRandom class HepRandom a singleton class and using a HepJamesRandom engine as default algorithm for pseudo random num ber generation HepRandom defines a static private data member theGenerator and a set of static methods to manipulate it By means of theGenerator the user can change the underlying engine algorithm get and set the seeds and use any kind of defined random distribution The static methods set TheSeed and get The Seed will set and get respectively the initial seed to the main engine used by the static generator For example HepRandom setTheSeed seed to change the cur
113. particles 1 elementary particles which should be tracked in Geant4 All particles that can fly a finite length and interact with materials in detectors are included in this category In addition some particles with a very short lifetime are included a stable particles Stable means that the particle can not decay or has a very small possibility to decay in detectors e g gamma electron proton and neutron b long life 210 sec particles Particles which may travel a finite length e g muon charged pions c Short life particles that need to decay in Geant4 For example p h 161 Tracking and Physics d KO system K decays immediately into KOS or KV and then K s KY decays according to its life time and decay modes e optical photons Gammas and optical photons are distinguished in the simulation view though both are the same par ticle photons with different energies For example optical photons are used for Cerenkov light and scintillation light f geantinos charged geantinos Geantinos and charged geantinos are virtual particles for simulation which do not interact with materials and undertake transportation processes only nuclei Any kinds of nucleus can be used in Geant4 such as alpha He 4 uranium 238 and excited states of carbon 14 Nuclei in Geant4 are divided into two groups from the viewpoint of implementation a light nuclei Light nuclei frequently used in simulation e g alpha
114. pd particleTable gt findParticle newValues if pd NULL fParticleGun SetParticleDefinition pd else if command directionCmd fParticleGun SetParticleMomentumDirection directionCmd GetNew3VectorValue newValues else if command energyCmd fParticleGun 5SetParticleEnergy energyCmd gt GetNewDoubleValue newValues else if command positionCmd fParticleGun 5SetParticlePosition directionCmd gt GetNew3VectorValue newValues else if command timeCmd fParticleGun SetParticleTime timeCmd gt GetNewDoubleValue newValues G4String G4ParticleGunMessenger GetCurrentValue G4UIcommand command G4String cv if command directionCmd cv directionCmd ConvertToString fParticleGun gt GetParticleMomentumDirection else if command energyCmd cv energyCmd gt ConvertToString fParticleGun gt GetParticleEnergy Gev else if command positionCmd cv positionCmd gt ConvertToString fParticleGun gt GetParticlePosition cm else if command timeCmd cv timeCmd ConvertToString fParticleGun gt GetParticleTime ns else if command particleCmd update candidate list G4String candidateList G4int nPtcl particleTable entries for G4int i 0 i lt nPtcl i 1 candidateList particleTable GetParticleName i candidateList particleCmd gt SetCandidates candidateList
115. plates In the code below at first the world volume is defined then solid and logical volume for the plate are created followed by the definition of the assembly volume for the layer The assembly volume for the layer is then filled by the plates in the same way as normal physical volumes are placed inside a mother volume Finally the layers are placed inside the world volume as the imprints of the assembly volume see Example 4 7 89 Detector Definition and Response Example 4 7 An example of usage of the G4AssemblyVolume class static unsigned int layers 5 void TstVADetectorConstruction ConstructAssembly Define world volume G4Box WorldBox new G4Box WBox worldX 2 worldY 2 worldZ 2 G4LogicalVolume worldLV new G4LogicalVolume WorldBox selectedMaterial WLog G4VPhysicalVolume worldVol new G4PVPlacement 0 G4ThreeVector WPhys worldLV 0 false 0 Define a plate G4Box PlateBox new G4Box PlateBox plateX 2 plateY 2 plateZ 2 G4LogicalVolume plateLV new G4LogicalVolume PlateBox Pb PlateLV 0 0 0 Define one layer as one assembly volume G4AssemblyVolume assemblyDetector new G4AssemblyVolume Rotation and translation of a plate inside the assembly G4RotationMatrix Ra G4ThreeVector Ta Rotation of the assembly inside the world G4RotationMatrix Rm Fill the assembly by the plates as SecX caloX AL Ta SSC Y calorias Ta s
116. random numbers and numerics we use the classes for points vectors and planes and their transformations in 3D space and lorentz vectors and their transformations Although these classes have Geant4 names like G4ThreeVector these are just typedefs to the CLHEP classes 4 C Standard Template Library Overview The Standard Template Library STL is a general purpose library of generic algorithms and data structures It is part of the C Standard Library Nowadays most compiler vendors include a version on STL in their products and there are commercial implementations available as well Good books on STL are e Nicolai M Josuttis The C Standard Library A Tutorial and Reference Josuttis1999 e David R Musser Atul Saini STL Tutorial and Reference Guide C Programming with the Standard Tem plate Library Musser1996 e Scott Meyers Effective STL Meyers2001 Resources available online include A Modest STL tutorial and the reference of the SGI implementation e Mumits STL Newbie Guide is a kind of a FAQ containing answers highlighting practical details of STL programming e SGI STL homepage this is the basis of the native egcs STL implementation STL in Geant4 Since release 0 1 Geant4 supports STL the Standard Template Library From release 1 0 of Geant4 STL is required Native implementations of STL are foreseen on all supported platforms 5 Makefiles and Environment Variables This section describ
117. regions where it is required The concept of detector Region was introduced to address this need Once the final geometry setup of the detector has been defined a region can be specified by constructing it with G4Region const G4String amp rName where rName String identifier for the detector region A G4Region must then be assigned to a logical volume in order to make it a Root Logical Volume G4Region emCalorimeter new G4Region EM Calorimeter emCalorimeter AddRootLogicalVolume emCalorimeter A root logical volume is the first volume at the top of the hierarchy to which a given region is assigned Once the region is assigned to the root logical volume the information is automatically propagated to the volume tree so that each daughter volume shares the same region Propagation on a tree branch will be interrupted if an already existing root logical volume is encountered A specific Production Cut can be assigned to the region by defining and assigning to ita G4ProductionCut object emCalorimeter gt SetProductionCuts emCalCuts Section 5 4 2 describes how to define a production cut The same region can be assigned to more than one root logical volume and root logical volumes can be removed from an existing region A logical volume can have only one region assigned to it Regions will be automatically registered in a store which will take care of destroying them at the end of the job A default region
118. store The importance values may be returned either according to a physical volume and a replica num 22 Toolkit Fundamentals ber or according to a G4GeometryCe11 The user mus be aware of the interpretation of assigning importance values to a cell Note e An importance value must be assigned to every cell The different cases e Cell is not in store Not filling a certain cell in the store will cause an exception Importance value zero Tracks of the chosen particle type will be killed importance values 0 Normal allowed values Importance value smaller zero Not allowed 3 7 1 5 The Importance Sampling Algorithm Importance sampling supports using a customized importance sampling algorithm To this end the sampler inter face G4VSampler may be given a pointer to the interface G4VImportanceAlgorithm class G4VImportanceAlgorithm public G4VImportanceAlgorithm virtual G4VImportanceAlgorithm virtual G4Nsplit Weight Calculate G4double ipre G4double ipost G4double init_w const 0 The method Calculate takes the arguments ipre ipost importance of the previous cell and the importance of the current cell respectively e init w the particles weight It returns the struct class G4Nsplit Weight public Gasne ENE G4double fW e fN the calculated number of particles to exit the importance sampling fW the weight of the particles The user may have a customized a
119. style surface vis viewer zoom Tb gl vis viewer set viewpointThetaPhi 35 45 vis drawVolume Absorber vis scene add axes 0 0 0 500 mm vis scene add text 000mm 40 100 140 Absorber vis viewer flush Bird s eye view of the whole detector components vis viewer set culling global false makes the invisible L world volume visible The invisibility of the world volume is set d in ExNO3DetectorConstruction cc vis viewer set style wireframe vis viewer set culling global false vis drawVolume 500 mm nat SO S0 2100 world vis scene add axes vis scene add text vis viewer flush THHHHHEHEHEHEHEEEEE E EHEE END of visl mac HHEEEEEEHEEEEEE E OTORO 000 2 10 5 2 Visualization of events The following session visualizes events tajectories with the OpenGL Xlib driver and then with the DAWNFILE driver The former exhibits minimal visualization commands to visualize events while the latter exhibits cus tomized visualization Note that the run action and event action classes should be described properly See for example the following classes examples novice NO3 src ExNO3RunAction cc HERE TE AE FE FE HE FE FE E FE FE AE FE TE HERE RE E EE RE E ERE RE E HERE RHE RE E ERE E ERE RE E ER VES 2 mac A Sample macro to demonstrate visualization 28 Getting Running a Simple Example
120. surface drawing style has been requested The default value of the forced wireframe style is false Similarly forced solid style i e to force that objects are always visualized with surfaces is set with void G4VisAttributes SetForceSolid G4bool force The default value of the forced solid style is false too You can also force auxiliary edges to be visible Normally they are not visible unless you set the appropriate view parameter Forcing the auxiliary edges to be visible means that auxiliary edges will be seen whatever the view parameters Auxiliary edges are not genuine edges of the volume They may be in a curved surface made out of polygons for example or in plane surface of complicated shape that has to be broken down into simpler polygons HepPoly hedron breaks all surfaces into triangles or quadrilaterals There will be auxiliary edges for any volumes with a curved surface such as a tube or a sphere or a volume resulting from a Boolean operation Normally they are not shown but sometimes it is useful to see them In particular a sphere because it has no egdes will not be seen in wireframe mode in some graphics systems unless requested by the view parameters or forced as described here To force auxiliary edges to be visible use 227 Visualization void G4VisAttributes SetForceAuxEdgeVisible G4bool force The default value of the force auxiliary edges visible flag is false For volumes with edges tha
121. the C standard library to implement the 1at basic distribution and for setting seeds respectively Please note that it s well known that the spectral properties of rand leave a great deal to be desired therefore the usage of this engine is not recommended if a good randomness quality or a long period is required in your code Copies of an object of this kind are not allowed RanluxEngine The algorithm for RanluxEngine has been taken from the original implementation in FORTRANT7 by Fred James part of the MATHLIB HEP library The initialisation is carried out using a Multiplicative Congruential generator using formula constants of L Ecuyer as described in F James Comp Phys Comm 60 1990 329 344 The engine provides five different luxury levels for quality of random generation When instantiating a RanluxEngine the user can specify the luxury level to the constructor if not the default value 3 is taken For example RanluxEngine theRanluxEngine seed 4 instantiates an engine with seed and the best luxury level ine Or RanluxEngine theRanluxEngine instantiates an engine with default seed value and luxury level 34 Toolkit Fundamentals The class provides a get Luxury method to get the engine luxury level The Set Seed and Set Seeds methods to set the initial seeds for the engine can be invoked specifying the luxury level For example static interface HepRandom setTheSeed seed 4
122. the usage of parton string models at high energies of intra nuclear transport models at intermediate energies and of statistical break up models for de excitation 5 2 3 Particle Decay Process This section briefly introduces decay processes installed in Geant4 For details of the implementation of particle decays please refer to the Physics Reference Manual 5 2 3 1 Particle Decay Class Geant4 provides a G4Decay class for both at rest and in flight particle decays G4Decay can be applied to all particles except massless particles i e G4ParticleDefinition thePDGMass lt 0 particles with negative life time i e G4ParticleDefinition thePDGLifeTime lt 0 shortlived particles i e G4ParticleDefinition fShortLivedFlag True Decay for some particles may be switched on or off by using G4ParticleDefinition SetPDGStable as well as ActivateProcess and InActi vateProcess methods of G4ProcessManager G4Decay proposes the step length or step time for AtRest according to the lifetime of the particle unless PreAssignedDecayProperTime is defined in G4DynamicParticle The G4Decay class itself does not define decay modes of the particle Geant4 provides two ways of doing this using G4DecayChannel in G4DecayTable and using thePreAssignedDecayProducts of G4DynamicParticle The G4Decay class calculates the PhysicalInteractionLength and boosts decay products created by G4VDecayChan
123. the visualization attributes when they are no longer needed or just leave them to die at the end of the job 228 Visualization 8 6 6 Additional User Defined Attributes Geant4 Trajectories and Hits can be assigned additional arbitrary attributes that will be displayed when you click on the relevant object in the WIRED or FRED HepRep browsers WIRED then lets you label objects by any of these attributes or cut visibility based on these attributes Define the attributes with lines such as std map lt G4String G4AttDef gt store G4AttDefStore GetInstance G4Trajectory isNew G4String PN PN store PN G4AttDef PN Particle Name Physics G4String G4String IMom IMom store IMom G4AttDef IMom Momentum of track at start of trajectory Physics MEANT one VSSic ous I Then fill the attributes with lines such as std vector lt G4AttValue gt values new std vector lt G4AttValue gt values gt push_back G4AttValue PN ParticleName s seekp std ios beg s lt lt G4BestUnit initialMomentum Energy lt lt std ends values push back G4AttValue IMom c See geant4 source tracking src G4Trajectory cc for a good example G4AttValue objects are light containing just the value for the long description and other sharable information the G4ArtValue object refers to a G4AttDef object They are based on the HepRep standard described at http www s
124. track after the completion of the current step G4Track track step gt GetTrack G4ThreeVector momentum track gt GetMomentunm G4double kinEnergy track gt GetKineticEnergy G4double globalTime track gt GetGlobalTime Gtr SE ous t Remark To transform a position from the global coordinate system to the local system of the current volume use the preStepPoint transformation as describ 62n the geometry section above Frequentry Asked Questions FAQ 5 Physics and cuts Q How do production cuts in range work in Geant4 Are they also used in tracking If a particle has an energy lower than the converted cut in energy for the given material and the distance to the next boundary is smaller than the cut in range is the particle killed Geant4 does NOT have a tracking cut The toolkit s default behaviour is to track particles down to zero range i e zero energy Of course it is possible for the user to create and register a process that kills particles below a certain energy or range this is however NOT provided by default in Geant4 So there s NO tracking cut For example suppose a particle that is nearing zero energy will at some point be proposed by its Ionisation process to undergo one final step from its current energy down to zero energy This is still only a proposal If during this step the particle crosses a boundary then the transportation will limit the step at a length smaller than the Ioni
125. two parameters are strongly coupled it does not make sense to request an accuracy of nm for delta intersection and accept 100 amp 956m for the delta one step error value Nevertheless delta intersection is the more important of the two It is recommended that these parameters should not differ significantly certainly not by more than an order of magnitude 4 3 2 Practical Aspects 4 3 2 1 Creating a Magnetic Field for a Detector The simplest way to define a field for a detector involves the following steps 1 create a field G4UniformMagField magField new G4UniformMagField G4ThreeVector 0 0 fieldValue 2 set it as the default field G4FieldManager fieldMgr G4TransportationManager GetTransportationManager gt GetFieldManager fieldMgr gt SetDetectorField magField 3 create the objects which calculate the trajectory fieldMgr CreateChordFinder magField To change the accuracy of volume intersection use the SetDeltaChord method fieldMgr gt GetChordFinder gt SetDeltaChord G4double newValue 109 Detector Definition and Response 4 3 2 2 Creating a Field for a Part of the Volume Hierarchy It is possible to create a field for a part of the detector In particular it can describe the field with pointer fEmField for example inside a logical volume and all its daughters This can be done by simply creating a G4FieldManager and attaching it to a logical volume with pointer log
126. user has the choice to score and or sample by importance the particles of the chosen type according to mass geometry or to parallel geometry It is possible to utilize several parallel geometries in addition to the mass ge ometry This provides the user with a lot of flexibility to define separate geometries for different particle types in order to apply scoring or and importance sampling Note Limitations of parallel geometries e A special kind of transportation inside the parallel geometry has been developed In the current implemen tation this does not take fields into account Therefore parallel geometries can only be used in field free simulations The world volume of the parallel geometry must overlap the world volume of the mass geometry Particles crossing a boundary in the parallel geometry where there is vacuum in the mass geometry are also biased This may be optimized in later versions Scoring cells must not share boundaries with the world volume 3 7 1 2 Changing the Sampling Samplers are higher level tools which perform the necessary changes of the Geant4 sampling in order to apply importance sampling and weight roulette The samplers may also be used to apply scoring Scoring and variance reduction may be combined arbitrarily for chosen particle types and may be applied to the mass or to parallel geometries The samplers support all combinations 49 Toolkit Fundamentals Different samplers are implemen
127. using the JAVA Analysis Studio tool 2 2 PI Please refer to the PI Physicist Interfaces project pages on histogramming for using an AIDA Interactive Anal ysis Environment 2 3 Open Scientist Lab Please refer to the Open Scientist Lab documentation on histogramming for using the Lab Analysis plug in for the OnX package 2 4 Examples Examples in Geant4 showing how to use AIDA compliant tools for histogramming are available in the code distribution in the following directories 266 Appendix geant4 examples extended analysis geant4 examples extended electromagnetic geant4 examples advanced 3 CLHEP Foundation Library CLHEP is a set of Class Libraries containing many basic classes for use in High Energy Physics Both a CLHEP Reference Guide and a User Guide are available Origin and current situation of CLHEP CLHEP started in 1992 as a library for fundamental classes mostly needed for and in fact derived from the MC event generator MC written in C Since then various authors added classes to this package including several contributions made by developers in the Geant4 Collaboration Geant4 and CLHEP The Geant4 project contributed to the development of CLHEP The random number package physics units and constants and some of the numeric and geometry classes had their origins in Geant4 Geant4 also benefits from the development of CLHEP In addition to the already mentioned classes for
128. volume overlap errors in detector geometries Interactive picking to get more information on visualized objects UV Ee TUS bye No one graphics system is ideal for all of these requirements and many of the large software frameworks into which Geant4 has been incorporated already have their own visualization systems so Geant4 visualization was designed around an abstract interface that supports a diverse family of graphics systems Some of these graphics systems use a graphics library compiled with Geant4 such as OpenGL while others involve a separate application such as WIRED or DAWN 8 1 1 What Can be Visualized Simulation data can be visualized Detector components e A hierarchical structure of physical volumes e A piece of physical volume logical volume and solid Particle trajectories and tracking steps Hits of particles in detector components Other user defined objects can be visualized e Polylines such as coordinate axes 3D Markers such as eye guides e Text descriptive character strings comments or titles Scales Logos 8 1 2 You have a Choice of Visualization Drivers The many graphics systems that Geant4 supports are complementary to each other e OpenGL View directly from Geant4 e Uses GL libraries that are already included on most Linux systems plus some Windows availability e Rendered photorealistic image with some interactive features zoom rotate translate e Fast response can usually
129. with a default production cut is automatically created and assigned to the world volume 4 1 4 Physical Volumes Physical volumes represent the spatial positioning of the volumes describing the detector elements Several tech niques can be used They range from the simple placement of a single copy to the repeated positioning using either a simple linear formula or a user specified function The simple placement involves the definition of a transformation matrix for the volume to be positioned Repeated positioning is defined using the number of times a volume should be replicated at a given distance along a given direction Finally it is possible to define a parameterised formula to specify the position of multiple copies of a volume Details about these methods are given below Note For geometries which vary between runs and for which components of the old geometry setup are ex plicitely deleted it is required to consider the proper order of deletion which is the exact inverse of the actual 77 Detector Definition and Response construction i e first delete physical volumes and then logical volumes Deleting a logical volume does NOT delete its daughter volumes It is not necessary to delete the geometry setup at the end of a job the system will take care to free the volume and solid stores at the end of the job The user has to take care of the deletion of any additional transformation or rotation matrices allocated dinam
130. z planes rinner Tangent distance to inner surface rOuter r Tangent distance to outer surface r coordinate of corners Z Z coordinate of corners Tube with an elliptical cross section A tube with an elliptical cross section ELTU can be defined as follows G4EllipticalTube const G4String pName G4double Dx G4double Dy G4double Dz A The equation of the surface in x y is 1 0 x 49 s 4 dx 2 y dy 2 a Bi di 0 i AA AM z p di d i 10 f 20 In the picture Dx 5 Dy 10 Dz 20 Dx Half length X Dy Half length Y Dz Half length Z General Ellipsoid The general ellipsoid with possible cut in Z can be defined as follows G4Ellipsoid const G4String G4double G4double G4double G4double G4double pName pxSemiAxis pySemiAxis pzSemiAxis pzBottomCut 0 pzTopCut 0 66 Detector Definition and Response SAREE SS Se ANS S S SESS a NAY AS S KAVA SS AS HELITA LETTA oy MI Hi EE LLL SS iu In the picture pxSemiAxis 10 pySemiAxis 20 pzSemiAxis 50 pzBottomCut 10 pzTopCut 40 A general or triaxial ellipsoid is a quadratic surface which is given in Cartesian coordinates by y pySemiAxis 2 z pzSemiAxis 2 1 0 x pxSemiAxis 2 where pxSemiAxis Semiaxis in X pySemiAxis Semiaxis in
131. 0946409 6 0 512644 7 0 119565 8 0 27315 3 G4 VITON 1 8 98 6 1 0 009417 6 0 280555 286 Appendix 9 0 710028 2 G4 WATER H_20 1 T5 1 0 111894 8 0 888106 2 G4_WATER_VAPOR H 20 Gas 0 000756182 71 6 1 0 111894 8 0 888106 2 G4_XYLENE 0 87 61 8 1 0 094935 6 0 905065 1 G4_GRAPHITE Graphite 1 7 78 8 3 HEP Materials Ncomp Name density g cm 3 I eV 1 G4 1H2 0 0708 21 8 1 G4 lAr 1 396 188 1 G4 1Kr 2 418 352 al G4 1Xe 2 953 482 3 G4 PbWOA 8 28 0 8 0 140637 82 0 455366 74 0 403998 J G4_Galactic 1e 25 21 8 287 Bibliography Booch1994 Grady Booch Object Oriented Analysis and Design with Applications The Benjamin Cummings Publishing Co Inc 1994 ISBN 0 8053 5340 2 Ellis1990 Margaret Ellis and Bjarne Stroustrup Annotated C Reference Manual ARM Addison Wesley Publishing Co 1990 Hecht1974 E Hecht and A Zajac Optics Addison Wesley Publishing Co 1974 pp 71 80 and pp 244 246 Josuttis1999 Nicolai M Josuttis The C Standard Library A Tutorial and Reference Addison Wesley Publishing Co 1999 ISBN 0 201 37926 0 Meyers2001 Scott Meyers Effective STL Addison Wesley Publishing Co 2001 ISBN 0 201 74962 9 Musser1996 David R Musser and Atul Saini STL Tutorial and Reference Guide C Programming with the Standard Template Library Addison Wesley Publishing Co 1996 ISBN 0 201 63398 1 Plauger1995 P J Plauger The Draft Standa
132. 4 42 84 99 T3 48 59 86 9395 468 36 66 76 52x 399 85 166 TEs 74 278 Appendix 10 T 0 067125 6 0 545403 8 0 387472 G4 CELLULOSE NITRATE At 0 029216 6 0 271296 7 0 121276 8 0 578212 G4_CERIC_SULFATE T 0 107596 7 0 0008 8 0 874976 16 0 014627 58 0 002001 G4_CESIUM_FLUORIDE 9 0 125069 55 0 874931 G4 CESIUM IODIDE 53 0 488451 55 0 511549 G4 CHLOROBENZENE 0 044772 6 0 640254 yi 0 314974 G4_CHLOROFORM 0 008443 6 0 100613 7 0 890944 G4_CONCRETE 0 0 6 0 001 8 0 529107 1 0 016 2 0 002 3 0 033872 4 0 337021 9 0 013 20 0 044 26 0 014 G4_CYCLOHEXANE 0 143711 6 0 856289 G4 1 2 DICHLOROBENZENE 0 027425 6 0 490233 7 0 482342 G4 DICHLORODIETHYL ETHER 0 0563811 6 0 335942 8 0 111874 7 0 495802 G4 1 2 DICHLOROETHANE 0 04074 6 0 242746 7 0 716514 G4 DIETHYL ETHER 0 135978 6 0 648171 8 0 215851 G4 N N DIMETHYL FORMAMIDE 0 096523 6 0 492965 7 0 191625 8 0 218887 G4 DIMETHYL SULFOXIDE 0 077403 6 0 307467 8 0 204782 6 0 410348 G4 ETHANE 0 201115 6 0 798885 G4 ETHYL ALCOHOL 0 131269 6 0 521437 8 0 347294 G4 ETHYL CELLULOSE ds T4 0 49 0 3 415 91 1058 4832 STII 3048 2199 E2351 71378 9487 1014 00125324 7893 13 87 76 7 440 7 553 1 89 1 135 2 56 4 106 5 103 3 111 60 66 98 45 62 69 279
133. 4 V 6 11 245 24 G4 Cr 7 18 257 25 G4_Mn 7 44 272 26 G4_Fe 7 874 286 27 G4_Co 8 9 297 28 G4_Ni 8 902 311 29 G4_Cu 8 96 322 30 G4_Zn 74133 330 31 G4 Ga 5 904 334 32 G4 Ge 97923 350 33 G4 As 5 73 347 34 G4 Se 4 5 348 35 G4 Br 0 0070721 343 36 G4 Kr 0 00347832 352 37 G4 Rb 1 532 363 38 G4 Sr 2 54 366 39 G4 Y 4 469 379 40 G4 Zr 6 506 393 41 G4_Nb 8 57 417 42 G4_Mo 10 22 424 43 G4_Tc 11 5 428 44 G4 Ru 12 41 441 45 G4 Rh 12 41 449 46 G4 Pd 12 02 470 47 G4_Ag 10 5 470 48 G4 Cd 8 65 469 49 G4 In 7 31 488 50 G4 Sn 1531 488 51 G4 Sb 6 691 487 22 G4 Te 6 24 485 53 G4 4 93 491 54 G4 Xe 0 00548536 482 59 G4_Cs 1 873 488 56 G4_Ba 3 5 491 57 G4 La 6 154 501 58 G4 Ce 6 657 523 59 G4 Pr 6 71 535 60 G4 Nd 639 546 61 G4_Pm 7 22 560 62 G4_Sm 7 46 574 63 G4_Eu 5 243 580 64 G4_Gd 7 9004 591 65 G4_Tb 8 229 614 275 Appendix 66 G4_Dy 8 55 628 67 G4_Ho 8 795 650 68 G4_Er 9 066 658 69 G4_Tm 9521 674 70 G4 Yb 6 73 684 FL G4_Lu 9 84 694 72 G4 Hf 13 91 705 73 G4 Ta 16 654 718 74 GA W 19 3 727 15 G4 Re 21 02 736 76 G4 Os 224577 746 77 G4 Ir 22 42 757 78 G4_Pt 21 45 790 79 G4 Au 19 32 790 80 G4 Hg 13 546 800 81 G4 Tl 11 72 810 82 G4 Pb 11 35 823 83 G4 Bi 9 747 823 84 G4 Po 9 32 830 85 G4 At 9532 825 86 G4 Rn 0 00900662 794 87 G4 Fr 1 827 88 G4 Ra 5 826 89 G4 Ac 0 07 841 90 G4 Th 1 72 847 91 G4_Pa 5 37 878 92 G4 U 8 95 890 93 G4 Np 20 25 902 94 G4 Pu 9 84 921 95 G4 Am 3 67 934 96 G4 Cm 3 51 939 97 G4 Bk 4 952 98 G4 C
134. 4 trajectory class from tracking src G4Trajectory cc available attributes will be Track ID e Parent ID e Particle Name Charge 218 Visualization e PDG Encoding e Momentum 3 Vector e Momentum magnitude e Number of points You can add additional attributes of your choosing by modifying the relevant part of G4Trajectory look for the methods GetAttDefs and CreateAttValues If you are using your own trajectory class you may want to consider copying these methods from G4Trajectory 8 5 6 Visualization of hits Hits are visualized with classes G4Square or G4Circle or other user defined classes inheriting the abstract base class G4VMarker Drawing methods for hits are not supported by default Instead ways of their implementa tion are guided by virtual methods G4VHit Draw and G4VHitsCollection DrawAllHits of the abstract base classes G4VHit and G4VHitsCollection These methods are defined as empty functions in the digits hits category You can overload these methods using the following drawing methods of class G4VVisManager in order to visualize hits 1 2 Drawing methods of G4Sguare and G4Circle virtual void G4VVisManager Draw const G4Circle virtual void G4VVisManager Draw const G4Sguare The real implementations of these Draw methods are described in class G4VisManager The overloaded implementation of G4VHits Draw will be held by for example class MyTrackerHits in heriti
135. 4UImanager In main a pointer to the interface manager must be obtained G4UImanager UI G4UImanager getUIpointer in order for the user to issue commands to the program In the present example the appl yCommand method is called three times to direct the program to print out information at the run event and tracking levels of simulation A wide range of commands is available which allows the user detailed control of the simulation A list of these commands can be found in Section 7 1 2 1 3 User Initialization and Action Classes 2 1 3 1 Mandatory User Classes There are three classes which must be defined by the user Two of them are user initialization classes and the other is a user action class They must be derived from the abstract base classes provided by Geant4 G4VUserDetectorConstruction G4VuserPhysicsList and G4VuserPrimaryGeneratorAction Geant4 does not pro vide default behavior for these classes G4RunManager checks for the existence of these mandatory classes when the initialize and BeamOn methods are invoked As mentioned in the previous section G4VUserDetectorConstruction requires the user to define the detector and G4VUserPhysicsList requires the user to define the physics Detector definition will be discussed in Sections Section 2 2 and Section 2 3 Physics definition will be discussed in Sections Section 2 4 and Section 2 5 The user action G4VuserPrimaryGeneratorAction requires that the initial event stat
136. 93 7 0 731414 G4 POLYVINYLIDENE FLUORIDE 1 76 88 8 0 03148 6 0 375141 9 0 593379 G4 POLYVINYL PYRROLIDONE 29 67 7 0 081616 6 0 648407 7 0 126024 8 0 143953 G4 POTASSIUM IODIDE 3 13 431 9 9 0 235528 53 0 764472 G4 POTASSIUM OXIDE 2432 LEG 9 8 0 169852 9 0 830148 G4 PROPANE 0 00187939 47 1 0 182855 6 0 817145 G4 1PROPANE 0 43 52 0 182855 6 0 817145 G4_N PROPYL_ALCOHOL 0 8035 61 1 0 134173 6 0 599595 8 0 266232 G4_PYRIDINE 0 9819 66 2 0 06371 6 0 759217 284 Appendix 13 13 4 0 177073 G4_RUBBER_BUTYL 0 143711 6 0 856289 G4_RUBBER_NATURAL 0 118371 6 0 881629 G4_RUBBER_NEOPRENE 0 05692 6 0 542646 al 0 400434 G4_SILICON_DIOXIDE SiO 2 8 0 532565 4 0 467435 G4 SILVER BROMIDE 35 0 425537 47 0 574463 G4 SILVER CHLORIDE 7 0 247368 47 0 752632 G4 SILVER HALIDES 35 0 422895 47 0 573748 53 0 003357 G4 SILVER IODIDE 47 0 459458 53 0 540542 G4 SKIN ICRP 0 100588 6 0 22825 7 0 04642 8 0 619002 1 7e 05 2 6e 05 5 0 00033 6 0 00159 7 0 00267 9 0 00085 20 0 00015 26 1e 05 30 1e 05 G4 SODIUM CARBONATE 6 0 113323 8 0 452861 0 433815 G4 SODIUM IODIDE 0 153373 53 0 846627 G4_SODIUM_MONOXIDE 8 0 258143 0 741857 G4_SODIUM_NITRATE 7 0 164795 8 0 56472 0 270485 G4_STILBENE 0 067101 6 0 932899 G4_SUCROSE 0 064779 6 0 42107 8 0 514151 G4_TERPHENYL 0 044543 6 0 955457 G4_TESTES_ICRP 0 104166 6 0 09227 E 0 01994 8 0 773884 1 0 00226 2 0 00011 5 0 00125 6
137. A concrete class of G4VPrimaryGenerator the G4PrimaryParticle object is constructed with either a pointer to G4ParticleDefinition or an integer number which represents P D G particle code For the case of some arti ficial particles e g geantino optical photon etc or exotic nuclear fragments which the P D G particle code does not cover the G4PrimaryParticle should be constructed by G4ParticleDefinition pointer On the other hand elementary particles with very short life time e g weak bosons or quarks gluons can be instantiated as G4PrimaryParticle objects using the P D G particle code It should be noted that even though primary parti cles with such a very short life time are defined Geant4 will simulate only the particles which are defined as G4ParticleDefinition class objects Other primary particles will be simply ignored by G4EventManager But it may still be useful to construct such intermediate particles for recording the origin of the primary event 3 6 1 2 Forced decay channel The G4PrimaryParticle class object can have a list of its daughter particles If the parent particle is an interme diate particle which Geant4 does not have a corresponding G4ParticleDefinition this parent particle is ignored and daughters are assumed to start from the vertex with which their parent is associated For example a Z boson is associated with a vertex and it has positive and negative muons as its daughters these muons will start from
138. AE HRT FE FE E AE HEE AE AE FE E E E AE HE E HE FE EAE FE AE FE FE AE FE FE HE FE FE E FE AE FE FE AE FE FE FE FE FE FE E FE AE FE FE HE HH E E E H Visualization of detector geometry with the OGLIX OpenGL Immediate X driver FEE FE FE E E FE AE FE FE AE FE FE FE E FE AE E FE AE FE FE AE FE FE FE E FE AE E FE AE FE FE E HH E E E H Invoke the OGLIX driver Create a scene handler and a viewer for the OGLIX driver vis open OGLIX Visualize the whole detector geometry with the default camera parameters Command vis drawVolume visualizes the detector geometry and command vis viewer flush declares the end of visualization The command vis viewer flush can be omitted for the OGLIX and OGLSX drivers The default argument of vis drawVolume is world vis drawVolume vis viewer flush HEHE AE FE FE AE FE FE E FE HH EE AE FE EE FE FE HE FE FE E FE EH HEE E EE SH Visualization with the DAWNFILE driver HHT FE AE FE FE AE FE FE AE FE FE E FE FE AE FE FE AE FE TE AE FE FE HE FE TE HE FE HH EHE E EE Invoke the DAWNFILE driver Create a scene handler and a viewer for the DAWNFILE driver vis open DAWNFILE Bird s eye view of a detector component Absorber drawing style hidden surface removal viewpoint theta phi 35 deg 45 deg zoom factor 1 1 of the full screen size coordinate axes x axis red y axis green z axis blue Orrin 0 050 Eno ca SOO cram vis viewer reset vis viewer set
139. AK clear after the cursor AN next command DOWN cursor AP previous command UP cursor TAB command completion DEL backspace BS backspace Getting Started with Geant4 Running a Simple Example In addition the following string substitutions are supported Ps current application status Jol current working directory oh history number 2 8 2 2 G4UIXm G4UlXaw and G4UIWin32 classes These interfaces are versions of G4Ulterminal implemented over libraries Motif Athena and WIN32 respectively G4UIXm uses the Motif XmCommand widget G4UIXaw the Athena dialog widget and G4UIWin32 the Win dows edit component to do the command capturing These interfaces are useful if working in conjunction with visualization drivers that use the Xt library or the WIN32 one A command box is at disposal for entering or recalling Geant4 commands Command completion by typing amp ldquo TAB amp rdquo key is available on the command line The shellcommands exit cont help Is cd are also supported A menu bar could be customized through the AddMenu and AddButton method Ex gui addMenu test Test gui addButton test Init run initialize gui addButton test Set gun control execute gun g4m gui addButton test Run one event run beamOn 1 G4UIXm runs on Unix Linux with Motif G4UIXaw less user friendly runs on Unix with Athena widgets G4UIWin32 runs on Windows 2 8 2 3 G4UIGAG and G4UlGainServer class
140. Collection respec tively explained in the previous section 4 5 2 Digitizer module G4VDigitizerModule G4VDigitizerModule is an abstract base class which represents a digitizer module It has a pure virtual method Digitize A concrete digitizer module must have an implementation of this virtual method The Geant4 kernel classes do not have a built in invocation to the Digitize method You have to implement your code to invoke this method of your digitizer module In the Digitize method you construct your G4VDigi concrete class objects and store them to your G4TDigiCollection concrete class object s Your collection s should be associated with the G4DCofThisEvent object G4DigiManager G4DigiManager is the singleton manager class of the digitizer modules All of your concrete digitizer modules should be registered to G4DigiManager with their unique names G4DigiManager fDM G4DigiManager GetDMpointer MyDigitizer myDM new MyDigitizer myDet myCal myEMdigiMod DM gt AddNewModule myDM Your concrete digitizer module can be accessed from your code using the unigue module name G4DigiManager DM G4DigiManager GetDMpointer MyDigitizer myDM fDM FindDigitizerModule myDet myCal myEMdigiMod myDM gt Digitize Also G4DigiManager has a Digitize method which takes the unigue module name 124 Detector Definition and Response G4DigiManager fDM G4DigiManager GetDMpoin
141. D Re ets Maa sesso aes 265 1 2 Unix Lin x Ab ciue EDU 265 1 3 Windows MS Visual CHP 21 terre en o Pep eite ERIS EU uere in 266 1 4 MacOSX Bebe Lose Lei eer REIN REESE E sa 266 2 H stogramming iini ced D REDE OPERE ER RR RED ER EE RET 266 2 1 JAS ctii eub eni ete hee IE 266 222 BU EE 266 2 3 Open Scientist Lab 1 esee sa asi egy odes eb a a a 266 DA Examples viskiu das koma E Saga ei sia sis rot is EROR ss pa a as ais 266 3 CLHEP Foundation Library 2 2 evertere ae i sias as 267 4 C Standard Template Library tte Bai sai oi k sa Da k ages busy 267 5 Makefiles and Environment Variables sese aa aa aa aaa aaa aaa aaa 267 5 1 The GNUmake system in Geant pssi sikka si sinias sak skaniai bp ao k sa sis e EEES EES 268 5 2 Environment variables sssr s ss ks sis as te eee os Saeco ika chee ss a as as se es sis 268 5 3 Linking External Libraries with Geant4 lt a sss eee 272 6 Build for MS Visual CFE iac seed eee derit er sedetep sa is aa i se als Se Peter eri ee 274 7 Development and debug tools Feier reet ER booed bon vanes ER EPOR ENS NE a K Ea 274 TA UNIX ecd barai a E aa a Ia i Taa ee 274 8 Geant4 Material Database 5 5 5 not rede Etro i tape Ei a re i as 275 8 T Pure Materials o ee dre A ES 275 8 2 NIST Compounds e rrr Peter Er rre et Ee esr Pee HEP e RR SR RA AR 276 8 3 HEP Materials ueniet Re DIE PEE 287 Bibliography EEUU 288 Chapter 1 Introduction
142. E input splekurewniskesrornmat e vy TU ne Wipe l vr UNT OE TOTO 7A Ves SUI number of first frame gt 0 number of first frame US IGS dl lt horizontal size lt vertical size gt 482 horizontal size gt 930 Vertical size Then encode and play mpeg2encode mpeg2encode par DAWN mpg open DAWN mpg 8 10 3 RayTracerX control verbose 2 vis open RayTracerX 600x600 0 0 Raytracer doesn t need a scene smoother not to vis drawVolume vis viewer reset 240 Visualization vis viewer set style surface vis viewer set projection perspective 50 deg control alias phi 30 control loop movie loop theta 0 360 1 where movie loop is as above This produces lots of jpeg files but takes 3 days Then make mpeg2encode parfile sh g4RayTracer jpeg Then edit mpeg2encode par to specify file type and size etc diff mpeg2encode par orig mpeg2encode par iow l Akkinpucpiecune gracile Eormacs Woe Uo oo Wr diss DIN Anput pict une Ele ar ewoushe n OMe Up M dla 15 1L 7e p AA lt A ieioea eiaa o vertical_size 78 aspect ratio information 1 sguare pel 2 4 3 600 horizontal size 600 vertical size gt i aspect ratio information l square pel 2 4 3 Then convert to ppm encode and play for i in g4 jpeg GNAUNAT Pss PB ONAGK 2 gt BPM Scd oo 4 2 1 Ral 7 S 16 10 Apr do je basename i jpeg command co
143. EXIT_SUCCESS As can be seen in the later examples a material has a state solid the default liquid or gas The constructor checks the density and automatically sets the state to gas below a given threshold 10 mg cm3 In the case of a gas one may specify the temperature and pressure The defaults are STP conditions defined in PhysicalConstants hh An element must have the number of nucleons gt number of protons gt 1 A material must have non zero values of density temperature and pressure Materials can also be defined using the internal Geant4 database Example 4 11 illustrates how to do this for the same materials used in Example 4 10 There are also UI commands which allow the database to be accessed The list of currently avalable material names Section 8 is extended permanetly Example 4 11 A program which shows how to define materials from the internal database include globals hh include G4Material hh include G4NistManager hh int mazi O di G4NistManager man G4NistManager Instance man gt SetVerbose 1 define elements G4Element C man gt FindOrBuildElement C G4Element Pb man gt FindOrBuildMaterial Pb define pure NIST materials G4Material Al man gt FindOrBuildMaterial G4 Al G4Material Cu man gt FindOrBuildMaterial G4 Cu define NIST materials G4Material H20 man FindOrBuildMaterial G4 WATER G4Material Sci man gt FindOrBuildMat
144. EventAction nst G4Event evt fpEventManager get const currentEvent SDManager SDman String colNam int trackerCollID SDman get collectionID colNam TrackerCollection int calorimeterCollID SDman gt get collectionID colNam CalCollection G4SDManager get SDMpointer TrajectoryContainer trajectoryContainer evt gt get trajectoryContainer int n trajectories 0 trajectoryContainer n trajectories trajectoryContainer entries HCofThisEvent HCE evt gt get HCofThisEvent int n hitCollection HCE n hitCollection HCE get capacity 0 VVisManager pVVisManager G4VVisManager GetConcreteInstance pVVisManager Declare begininng of visualization G4UImanager GetUIpointer gt ApplyCommand vis scene notifyHandlers Draw trajectories for G4int i 0 i lt n trajectories i evt get trajectoryContainer i DrawTrajectory 0 Construct 3D data for hits MyTrackerHitsCollection THC MyTrackerHitsCollection HCE gt get HC trackerCollID if THC THC DrawAllHits MyCalorimeterHitsCollection CHC MyCalorimeterHitsCollection HCE gt get HC calorimeterCollID if CHC CHC gt DrawAllHits Declare end of visualization G4UImanager GetUIpointer gt ApplyCommand vis viewer update ae end of C codes You can re visualize a physical volume where a hit is detected with a highlight color in addition
145. Example N02 5 3 5e t t E te Det re ba EXHI Ta UR E Rv PR ki m a eee 245 9 14 Example NO3 gereret neret ve eot potete ens i Er en e ERE eder a Ry Se ete pide 247 9 1 5 Example NOA 155 eet eo Eee ERR FR REPE HEP ERE ER as Kiss 248 9 1 6 Example NOS 1 estere e MEDINA 250 9 1 75 Example NOG 5 5 greet hereto ev dates oc prae a catego 251 9 1 8 Example NOT i netter eee ioe wees eee ep R Une 252 9 2 Extended Examples Lik n reed RE E RP ER RR Rare i erre ERR eed 253 9 2 1 Extended Example Summary sicrie stesti neiise ee resu Te E He men nennen 253 9 3 Advanced Examples i ri bee ere Ee pid e tere mire tases bated 256 9 3 1 Advanced Examples Uikiai eere rr ertet re e ERE Sepe eR eee tage ce 256 FAQ Frequentry Asked Questions isso o enin erede erre Pre EES Re RE Re ohne Ee PER ER Pe Reo RUE PESE 258 FAQ Installation tus sti ina eis a eik Eee uei rM er iai 258 EAQ 2 Run Tune Problems 2 3 2 e eet het rete Aaa ied a het Atte 259 EAQ 3 Geometry une HEU b er a EE ee 259 EAQ 4 Tracks and steps i2 en C a aa ia a a H MERE EOD MEER 260 EAQ 5 Physics and Cuts uec epu eade E 263 EAQ 6 Visualization 35h bor tera anre mieten 263 viii Geant4 User s Guide for Application Developers EAQ 7 User Support Policy sse eI REIP IR woh sa EOS 263 Pump d c ES 265 1 Tips Tor Program Compilation ska ski rare ete eee ced co Sp etel evo OR SEE e Ry ee 265 IT SUMP dioec eet eR terere rem kr E er REIR e cuero re
146. G4State_Abort state When a G4Exception occurs the application comes to this dead end state and causes a core dump The user still has a hook to do some safe opperations e g storing histograms by implementing a user concrete class of G4VStateDependent The user also has a choice to suppress the occurence of G4Exception by a UI command control suppressAbortion When abortion is suppressed you will still get error messages issued by G4Exception and there is NO guarantee of a correct result after the G4Exception error message G4StateManager belongs to the intercoms category 3 4 3 User s hook for state change In case the user wants to do something at the moment of state change of Geant4 the user can create a concrete class of the G4VStateDependent base class For example the user can store histograms when G4Exception occurs and Geant4 comes to the Abort state but before the actual core dump The following is an example user code which stores histograms when Geant4 becomes to the Abort state This class object should be mabe in for example main by the user code This object will be automatically registered to G4StateManager at its construction Example 3 1 Header file of UserHookForAbortState ifndef UserHookForAbortState H define UserHookForAbortState H 1 include G4VStateDependent hh class UserHookForAbortState public G4VStateDependent public UserHookForAbortState constructor UserHookForAbortState de
147. G4Translate3D 3 m 3 m 3 m pVisManager Draw subtracted G4VisAttributes G4Colour 0 1 1 G4Translate3D 6 m 6 m 6 m Explicit use of polyhedron objects is equivalent e g Same but explicit polyhedron G4Polyhedron pA G4Box boxA 3 m 3 m 3 m CreatePolyhedron G4Polyhedron pB G4Box boxB 1 m 1 m 1 m CreatePolyhedron pB gt Transform G4Translate3D 3 m 3 m 3 m G4Polyhedron pSubtracted new G4Polyhedron pA gt subtract pB G4VisAttributes subVisAtts G4Colour 0 1 1 pSubtracted gt SetVisAttributes amp subVisAtts pVisManager gt Draw pSubtracted G4Translate3D 6 m 6 m 6 m derete pA delete pE delete pSubtracted If efficiency is an issue create the objects in the constructor delete them in the destructor and draw them in your Draw method Anyway an instance of your class needs to be registered with the vis manager e g G4VisManager visManager new G4VisExecutive visManager gt Initialize visManager gt SetUserAction new StandaloneVisAction G4VisExtent 5 m 5 m 5 m 5 m 5 m 5 m 2nd argument optional 223 Visualization then activate by adding to a scene e g control verbose 2 vis verbose c vis open OGLSXm vis scene create vis scene add userAction vis scene add userAction 10 10 10 10 10 10 m vis scene add axes 0 0 0 10 m vis scene add scale 10 m vis sceneHandler attach vis viewer refresh Th
148. Geant4 User s Guide for Application Developers Geant4 Collaboration Geant4 User s Guide for Application Developers by Geant4 Collaboration Table of Contents Ls Introduction 1 eed ete sa a i sia ii Ar a rie Sb at a i i tea nh a a i apd ha piece sess 1 1 1 Scope oF this manual cene eR yi ss Bee ss ss ibe ees ais 1 1 2 How to use this manual ssi erede tee bem Ee E sects sds vedas SR pre CR gs verse SES EEE 1 2 Getting Started with Geant4 Running a Simple Example sss 2 2 1 How to Detine the Main Programi ioci a eR rs rete Ie ps A S i ai Lean 2 2 1 1 amp Sample main Method eerte Kasas sai K a An ei ede av avere e ERI 2 2 12 G4RunMand get 3er be e re isexe ribi 2 2 1 3 User Initialization and Action Classes seem 4 2 1 4 G4UImanager and UI CommandSubmission esee 4 2 1 5 G4cout and G4cefr 5s sein san es asai na a ya E a oi te e y eT BABS a T AE D 2 2 How to Define a Detector Geometry e mense aaa t enm en ee ener 6 22 15 Basic Concepts oer EIUS ag bons 6 2 2 2 Create a Simple Volume 2 ettet Ere ru ERR eT ses ERO see 6 2 2 3 Choose a Solid REESE REP wees OR REI EE eere pese RR 6 2 24 Create Logical Volume 5 P eer RE erra re ania a 7 2 2 3 Place a Volume Louie IRURE RAN EIU AUI REI 7 2 2 6 Cr ate a Physical Volume e tree terr attt res ba a si bara sess 7 2 2 7 Coordinate Systems and Rotations 2 0 0 0 cece cece eee c
149. Geant4 executable on a system based on a Windows system is similar to what should be done on a UNIX based system assuming that your system is equipped with GNUmake MS Visual C compiler and the required software to run Geant4 see Installation Guide 2 7 2 1 Building the executable See paragraph Section 2 7 1 2 8 How to Set Up an Interactive Session 2 8 1 Introduction 2 8 1 1 Roles of the intercoms category The intercoms category provides an expandable command interpreter It is the key mechanism of Geant4 to realize user interactions of all categories without being annoyed by the dependencies among categories The direct use of Geant4 classes in a C program offers a first ground level of interactivity i e the batch session As seen in the examples novice N01 Geant4 commands and macros are to be hard coded in the program Getting Started with Geant4 Running a Simple Example 2 8 1 2 User Interfaces to steer the simulation To avoid too much programming the intercoms category provides the abstract class G4UIsession that captures interactive commands The concrete implementation of the user interface and Graphical User Interfaces GUI is left to the interfaces category This interfacing strategy opens an important door towards various user interface tools and allows Geant4 to utilize the state of the art GUI tools such as Motif and Java etc The richness of the collaboration has permitted for different groups t
150. InelasticProcess in the example above derives from the G4HadronicInelasticProcess class and simply defines the process name and calls the G4HadronicInelasticProcess constructor All of the specific particle inelastic processes derive from the G4HadronicInelasticProcess class which calls the Post StepDoIt function which returns the particle change object from the G4HadronicProcess function GeneralPostStepDolt This class also gets the mean free path builds the physics table and gets the microscopic cross section The G4HadronicInelasticProcess class derives from the G4HadronicProcess class which is the top level hadronic process class The G4HadronicProcess class derives from the G4VDiscreteProcess class The inelastic elastic capture and fission processes derive from the G4HadronicProcess class This pure virtual class also provides the energy range manager object and the Reg isterMe access function 144 Tracking and Physics A sample case for the proton s inelastic interaction model class is shown in Example 5 3 where G4LEProtonInelastic hh is the name of the include file Example 5 3 An example of a proton inelastic interaction model class include G4InelasticInteraction hh class G4LEProtonInelastic public G4InelasticInteraction public G4LEProtonInelastic G4InelasticInteraction 1 setMrnEnergv 0 0 37 getMaxEnergy MeV G4LEProtonInelastic G4ParticleChange ApplyYourself const G4Track aTrack G4
151. Information This abstract base class allows the user to attach information associated with a region For example it would be quite beneficial to add some methods returning a boolean flag to indicate the characteristics of the region e g tracker calorimeter etc With this example the user can easily and quickly identify the detector component 179 User Actions Example 6 10 A sample region information class class RE0lRegionInformation public G4VUserRegionInformation publier RE0lRegionInformation RE01RegionInformation Weel Piguiae GODS private G4bool isWorld G4bool isTracker G4bool isCalorimeter public inline void SetWorld G4bool v true isWorld v inline void SetTracker G4bool v true isTracker v inline void SetCalorimeter G4bool v true isCalorimeter v inline G4bool IsWorld const return isWorld inline G4bool IsTracker const return isTracker inline G4bool IsCalorimeter const return isCalorimeter hi The following code is an example of a stepping action Here a track is suspended when it enters the calorimeter region from the tracker region Example 6 11 Sample use of a region information class void REO1SteppingAction UserSteppingAction const G4Step theStep Suspend a track if it is entering into the calorimeter check if it is alive G4Track theTrack theStep gt GetTrack if theTrack gt GetTrackStatus fAlive return ge
152. It for each defined process is applied for every step regardless of which process pro duces the minimum step length Each resulting change to the track information is recorded and accumulated in G4Step After all processes have been invoked changes due to AlongStepDolIt are applied to G4Track including the particle relocation and the safety update Note that after the invocation of AlongStepDoIt the endpoint of the G4Track object is in a new volume if the step was limited by a geometric boundary In order to obtain information about the old volume G4Step must be accessed since it contains information about both endpoints of a step e G4VParticleChange PostStepDoIt const G4Track track const G4Step step Data 133 Tracking and Physics This method is invoked at the end point of a step only if its process has produced the minimum step length or if the process is forced to occur G4Track will be updated after each invocation of Post StepDoIt in contrast to the AlongStepDoIt method G4VParticleChange AtRestDoIt const G4Track amp track const G4Step amp stepData This method is invoked only for stopped particles and only if its process produced the minimum step length or the process is forced to occur For each of the above DoIt methods G4VProcess provides a corresponding pure virtual GPIL method G4double PostStepGetPhysicallnteractionLength const G4Track amp track G4double previousStepSize G4ForceCondition con
153. New Commands 7 2 1 G4Ulmessenger G4UlImessenger is a base class which represents a messenger that delivers command s to the destination class object Your concrete messenger should have the following functionalities e Construct your command s in the constructor of your messenger e Destruct your command s in the destructor of your messenger These requirements mean that your messenger should keep all pointers to your command objects as its data mem bers You can use G4UIcommand derived classes for the most frequent types of command These derived classes have their own conversion methods according to their types and they make implementation of the Set NewValue and GetCurrentValue methods of your messenger much easier and simpler For complicated commands which take various parameters you can use the G4Ulcommand base class and con struct G4UIparameter objects by yourself You don t need to delete G4UIparameter object s In the SetNewValue and GetCurrentValue methods of your messenger you can compare the G4UIcommand pointer given in the argument of these methods with the pointer of your command because your messenger keeps the pointers to the commands Thus you don t need to compare by command name Please re member in the cases where you use G4UIcommand derived classes you should store the pointers with the types of these derived classes so that you can use methods defined in the derived classes according to their types w
154. Nucleus amp targetNucleus private void CascadeAndCalculateMomenta required arguments include G4LEProtonInelastic hh G4ParticleChange G4LEProton Inelastic ApplyYourself const G4Track amp aTrack G4Nucleus amp targetNucleus theParticleChange Initialize aTrack const G4DynamicParticle incidentParticle aTrack GetDynamicParticle create the target particle G4DynamicParticle targetParticle targetNucleus ReturnTargetParticle CascadeAndCalculateMomenta reguired arguments e return amp theParticleChange The CascadeAndCalculateMomenta function is the bulk of the model and is to be provided by the model s creator It should determine what secondary particles are produced in the interaction calculate the momenta for all the particles and put this information into the ParticleChange object which is returned The G4LEProtonlInelastic class derives from the G4InelasticInteraction class which is an abstract base class since the pure virtual function ApplyYourself is not defined there G4InelasticInteraction itself derives from the G4HadronicInteraction abstract base class This class is the base class for all the model classes It sorts out the energy range for the models and provides class utilities The G4HadronicInteraction class provides the Set GetMinEnergy andthe Set GetMaxEnergy functions which determine the minimum and maximum energy range for the model An energy range can be set for a specific ele
155. ParticleIterator G4ParticleDefinition particle theParticleIterator gt value G4ProcessManager pmanager particle GetProcessManager pmanager gt AddProcess theFastSimulationManagerProcess 1 0 0 5 2 6 6 The G4GlobalFastSimulationManager Singleton Class This class is a singleton which can be accessed as follows include G4GlobalFastSimulationManager hh G4GlobalFastSimulationManager globalFSM globalFSM G4GlobalFastSimulationManager getGlobalFastSimulationManager 157 Tracking and Physics Presently you will mainly need to use the GlobalFastSimulationManager if you use ghost geometries 5 2 6 7 Parameterisation Using Ghost Geometries In some cases volumes of the tracking geometry do not allow envelopes to be defined This may be the case with a geometry coming from a CAD system Since such a geometry is flat a parallel geometry must be used to define the envelopes Another interesting case involves defining an envelope which groups the electromagnetic and hadronic calorime ters of a detector into one volume This may be useful when parameterizing the interaction of charged pions You will very likely not want electrons to see this envelope which means that ghost geometries have to be organized by particle flavours Using ghost geometries implies some more overhead in the parameterisation mechanism for the particles sensitive to ghosts since navigation is provided in the ghost geometry
156. PrimaryGeneratorAction ExNOlPrimaryGeneratorAction delete particleGun void ExNO1PrimaryGeneratorAction generatePrimaries G4Event anEvent G4int i anEvent gt get eventID 3 switch i ewe Us particleGun SetParticleMomentumDirection G4ThreeVector 1 0 0 0 0 0 break Case Ia particleGun gt SetParticleMomentumDirection G4ThreeVector 1 0 0 1 0 0 break oase Z8 particleGun SetParticleMomentumDirection GAThreeVector 1 0 0 0 0 1 break particleGun generatePrimaryVertex anEvent 2 6 1 1 Selection of the generator In the constructor of your G4VUserPrimaryGeneratorAction you should instantiate the primary generator s If necessary you need to set some initial conditions for the generator s 15 Getting Started with Geant4 Running a Simple Example In Example 2 19 G4ParticleGun is constructed to use as the actual primary particle generator Methods of G4ParticleGun are described in the following section Please note that the primary generator object s you con struct in your G4VUserPrimaryGeneratorAction concrete class must be deleted in your destructor 2 6 1 2 Generation of an event G4VUserPrimaryGeneratorAction has a pure virtual method named generatePrimaries This method is invoked at the beginning of each event In this method you have to invoke the G4VPrimaryGenerator concrete class you instantiated via the generatePrimaryVertex method You can invoke more than one
157. Process and InActivateProcess methods These methods are valid only after process registration is complete so they must not be used in the Prelnit phase 13 Getting Started with Geant4 Running a Simple Example The G4VUserPhysicsList class creates and attaches G4ProcessManager objects to all particle classes defined in the ConstructParticle method 2 5 3 Specifying Physics Processes G4VUserPhysicsList is the base class for a mandatory user class see Section 2 1 in which all physics pro cesses and all particles required in a simulation must be registered The user must create a class derived from G4VUserPhysicsList and implement the pure virtual method Const ructProcess For example if just the G4Geantino particle class is required only the transportation process need be registered The ConstructProcess method would then be implemented as follows Example 2 17 Register processes for a geantino void ExNO1PhysicsList ConstructProcess Define transportation process AddTransportation Here the AddTransportation method is provided in the G4VUserPhysicsList class to register the G4Transportation class with all particle classes The G4Transportation class and or related classes describes the particle motion in space and time It is the mandatory process for tracking particles In the ConstructProcess method physics processes should be created and registered with each particle s instance o
158. RESS object definition language which is part of the STEP ISO standard 4 1 2 Solids The STEP standard supports multiple solid representations Constructive Solid Geometry CSG representations and Boundary Represented Solids BREPs are available Different representations are suitable for different pur poses applications required complexity and levels of detail CSG representations are easy to use and normally give superior performance but they cannot reproduce complex solids such as those used in CAD systems BREP representations can handle more extended topologies and reproduce the most complex solids thus allowing the exchange of models with CAD systems All constructed solids can stream out their contents via appropriate methods and streaming operators For all solids it is possible to estimate the geometrical volume and the surface area by invoking the methods G4double GetCubicVolume G4double GetSurfaceArea which return an estimate of the solid volume and total area in internal units respectively For elementary solids the functions compute the exact geometrical quantities while for composite or complex solids an estimate is made using Monte Carlo techniques For all solids it is also possible to generate pseudo random points lying on their surfaces by invoking the method G4ThreeVector GetPointOnSurface const which returns the generated point in local coordinates relative to the solid 4 1 2 1 Constructed Solid
159. Repeated volumes In this case a single Physical Volume represents multiple copies of a volume within its mother volume allowing to save memory This is normally done when the volumes to be positioned follow a well defined rotational or translational symmetry along a Cartesian or cylindrical coordinate The Repeated Volumes technique is available for volumes described by CSG solids Replicas Replicas are repeated volumes in the case when the multiple copies of the volume are all identical The coordinate axis and the number of replicas need to be specified for the program to compute at run time the transformation matrix corresponding to each copy G4PVReplica const G4String amp pName G4LogicalVolume pCurrentLogical G4LogicalVolume pMotherLogical OR G4VPhysicalVolume const EAxis pAxis const G4int nReplicas const G4double width const G4double Onis Ste 0 where pName String identifier for the replicated volume pCurrentLogical The associated Logical Volume pMotherLogical The associated mother volume pAxis The axis along with the replication is applied nReplicas The number of replicated volumes width The width of a single replica along the axis of replication offset Possible offset associated to mother offset along the axis of replication G4PVReplica represents nReplicas volumes differing only in their positioning and completely filling the containing mother volume Consequently if a G4PVRe
160. SX OpenGL Stored X driver FE EAE FE AE E FE AE FE FE AE FE FE FE AE FE FE AE FE FE HE FE AE FE FE FE E FE FE E FE FE FE FE FE FE FE E HE TE E FE TE E E E EE E EE E EE Invoke the OGLSX driver Create a scene handler and a viewer for the OGLSX driver vis open OGLSX Create an empty scene and add detector components to it e g since the C method DrawTrajectory AE E AE AE AE AE AE AE AE AE AE HH E AE AE AE AE AE AE AE AE HH HE he DAWNFILE driver ponents to it Note This command is not necessary in exampleN03 since the C method DrawTrajectory is described in the event action vis scene add trajectories Visualize plural events bird s eye view drawing style wireframe viewpoint theta phi 45 deg 45 deg zoom factor 1 5 x full screen size vis viewer reset vis viewer set style wireframe vis viewer set viewpointThetaPhi 45 45 vis viewer zoom 1955 run beamOn 2 Set the drawing style to surface Candidates wireframe surface vis viewer set style surface Visualize plural events bird s eye view again with another drawing style surface run beamOn 2 AE AE AE AE AE AE AE AE AE AEAEE END of vis2 mac dH AEE aF AF AE AE dE dE A AE E HT HHH 29 Getting Started with Geant4 Running a Simple Example 2 10 6 For More Information on Geant4 Visualization See the Chapter 8 Visualization part of this user guide 30 Chapter 3 Toolkit Fundamentals 3 1 Class Categorie
161. SensitiveDetector public G4VGFlashSensitiveDetector Here it is necessary to implement a separate interface where the GFlash spots are processed ProcessHits G4GFlashSpot aSpot G4TouchableHistory ROhist A separate interface is used because the Gflash spots naturally contain less information than the full simulation Since the parameters in the Gflash package are taken from fits to full simulations with Geant3 some retuning might be necessary for good agreement with Geant4 showers For experiment specific geometries some retuning might be necessary anyway The tuning is quite complicated since there are many parameters some correlated and cannot be described here see again hep ex 0001020 For brave users the Gflash framework already forsees the possibility of passing a class with the users parameters GV FlashHomoShower Tuning to the GFlashHo moShowerParamterisation constructor The default parameters are the original Gflash parameters GF lashHomoShowerParameterisation G4Material aMat GVFlashHomoShowerTuning aPar 0 Now there is also a preliminary implemenation of a parameterization for sampling calorimeters The user must specify the active and passive material as well as the thickness of the active and passive layer The sampling structure of the calorimeter is taken into account by using an effective medium to compute the shower shape All material properties needed are calculated automatically If tuning is required t
162. SetNewValue method of your messenger into a G4ThreeVector Please note that the return value has already been multiplied by the value of the given unit G4ThreeVector GetNew3VectorRawValue G4String paramString Convert a G4String parameter value given by the SetNewValue method of your messenger into three vector but without multiplying the value of the given unit G4double GetNewUnitValue G4String paramString Convert a G4String unit value given by the Set NewValue method of your messenger into a double G4String convertToString G4ThreeVector currVal char unitName Convert the current three vector to a G4String which should be returned by the Get CurrentValue method of your messenger The three vector value will be divided by the value of the given unit and converted to a string Given unit will be added to the string Additional comments on the SetParameterName method You can add one additional argument of G4bool type for every Set ParameterName method mentioned above This additional argument is named currentAsDefaultFlag and the default value of this argument is false If you assign this extra argument as t rue the default value of the parameter will be overriden by the current value of the target class 7 2 3 An example messenger This example is of G4ParticleGunMessenger which is made by inheriting G4UIcommand 185 Comommunication and Control Example 7 1 An example of G4ParticleGunMessenger hh
163. TL etc and system related types by defining where appropriate t ypedefs according to the Geant4 code conventions 32 Toolkit Fundamentals 3 2 1 Signature of Geant4 classes In order to keep an homogeneous naming style and according to the Geant4 coding style conventions each class part of the Geant4 kernel has its name beginning with the prefix G4 e g G4VHit G4GeometryManager G4ProcessVector etc Instead of the raw C types G4 types are used within the Geant4 code For the basic numer ic types int float double etc different compilers and different platforms provide different value ranges In order to assure portability the use of G4int G4float G4double which are base classes globally defined is preferable G4 types implement the right generic type for a given architecture 3 2 1 1 Basic types The basic types in Geant4 are considered to be the following G4int e G4long e G4float G4double G4bool e G4complex e G4String which currently consist of simple t ypede fs to respective types defined in the CLHEP STL or system libraries Most definitions of these basic types come with the inclusion of a single header file globals hh This file also provides inclusion of required system headers as well as some global utility functions needed and used within the Geant4 kernel 3 2 1 2 Typedefs to CLHEP classes and their usage The following classes are t ypede fs to the corresponding classes
164. Table 5 1 shows each process and the particles for which it is relevant G4HadronElasticProcess pit pi K Kos Ks K p p bar n n bar lambda lambda bar Sigma Sigma Sigma bar Sigma bar Xi Xi Xi bar Xi bar G4HadronlnelasticProcess pit pi K Kos Ks K p p bar n n bar lambda lambda bar Sigma Sigma Sigma bar Sigma bar Xi Xi Xi bar Xi bar G4HadronFissionProcess all G4CaptureProcess n n bar Table 5 1 Hadronic processes and relevant particles How to register Models To register an inelastic process model for a particle a proton for example first get the pointer to the particle s process manager G4ParticleDefinition theProton G4Proton ProtonDefinition G4ProcessManager theProtonProcMan theProton gt GetProcessManager Create an instance of the particle s inelastic process G4ProtonInelasticProcess theProtonIEProc new G4ProtonInelasticProcess Create an instance of the model which determines the secondaries produced in the interaction and calculates the momenta of the particles G4LEProtonInelastic theProtonIE new GA4LEProtonInelastic Register the model with the particle s inelastic process theProtonIEProc gt RegisterMe theProtonIE Finally add the particle s inelastic process to the list of discrete processes theProtonProcMan gt AddDiscreteProcess theProtonIEProc The particle s inelastic process class G4Proton
165. The user may give different sets of energy bounds for every cell or one set for all geometrical cells Special case if C_S C_U 1 for all energies then weight window is equivalent to importance sampling The user can choose to apply the technique at boundaries on collisions or on boundaries and collisions The energy space cells are realized by G4Geomet ryCel11 as in importance sampling The cells are stored in a weight window store defined by G4VWeightWindowStore class G4VWeightWindowStore public G4VWeightWindowStore virtual G4VWeightWindowStore virtual G4double GetLowerWeitgh const G4GeometryCell amp gCell G4double partEnergy const 0 virtual G4bool IsKnown const G4GeometryCell amp gCell const 0 virtual const G4VPhysicalVolume amp GetWorldVolume const 0 A concrete implementation is provided class G4WeightWindowStore public G4VWeightWindowStore public explicit G4WeightWindowStore const G4VPhysicalVolume amp worldvolume virtual G4WeightWindowStore virtual G4double GetLowerWeitgh const G4GeometryCell amp gCell G4double partEnergy const virtual G4bool IsKnown const G4GeometryCell amp gCell const virtual const G4VPhysicalVolume amp GetWorldVolume const void AddLowerWeights const G4GeometryCell amp gCell 54 Toolkit Fundamentals const std vector lt G4double gt amp lowerWeights void AddUpperEboundLowerWeightPairs const G4GeometryCell amp gCell con
166. UI command tracking storeTrajectory _bool_ does the same The user can set this flag for each individual track from his her G4UserTrackingAction PreUserTrackingAction method The user should not create trajectories for secondaries in a shower due to the large amount of memory consumed All the created trajectories in an event are stored in G4TrajectoryContainer class object and this object will be kept by G4Event To draw or print trajectories generated in an event the user may invoke the DrawTrajectory or Show Trajectory methods of G4VTrajectory respectively from his her G4UserEventAction EndOfEventAction The geometry must be drawn before the trajectory drawing The color of the drawn trajectory depends on the particle charge negative red neutral green positive blue Due to improvements in G4Navigator a track can execute more than one turn of its spiral trajectory without being broken into smaller steps as long as the trajectory does not cross a geometrical boundary Thus a drawn trajectory may not be circular Customizing trajectory and trajectory point G4Track and G4Step are transient classes they are not available at the end of the event Thus the concrete classes G4VTrajectory and G4VTrajectoryPoint are the only ones a user may employ for end of event analy sis or for persistency As mentioned above the default classes which Geant4 provides i e G4Trajectory and 132 Tracking and Physics G4Trajec
167. VFastSimulationModel energy deposition in sensitive detector ExN05PionShowerModel header file source file derived from G4VFastSimulationModel energy deposition in sensitive detector ExNO5DetectorConstruction header file source file derived from G4VUserDetectorConstruction definitions of single materials and mixtures 250 Examples e CSG solids G4PVPlacement ExN05PhysicsList header file source file e derived from G4VUserPhysicsList assignment of G4FastSimulationManagerProcess ExNO5PrimaryGeneratorAction header file source file derived from G4VPrimaryGeneratorAction construction of G4ParticleGun e primary event generation via particle gun ExNO5RunAction header file source file derived from G4VUserRunAction draw detector e activation deactivation of parameterisation ExN05EventAction header file source file e derived from G4VUserEventAction print time information 9 1 7 Example N06 Basic concepts e Interactivity build messenger classes Event Gun shoot charge particle at Cerenkov Radiator and Scintillator PIIM material mixture with optical and scintillation properties Geometry volumes filled with optical materials and possessing surface properties e Physics define and initialize optical processes Tracking generate Cerenkov radiation collect energy deposition to produce scintillation e Hits Digi PMT as detector e Vis
168. VMarker SetWorldSize G4double void G4VMarker SetWorldDiameter G4double void G4VMarker SetWorldRadius G4double void G4VMarker SetScreenSize G4double void G4VMarker SetScreenDiameter G4double void G4VMarker SetScreenRadius G4double void G4VMarker SetFillStyle FillStyle Note enum G4VMarker FillStyle noFill hashed filled fi Get functions of G4VMarker G4Point3D G4VMarker GetPosition const G4double G4VMarker GetWorldSize const G4double G4VMarker GetWorldDiameter const G4double G4VMarker GetWorldRadius const G4double G4VMarker GetScreenSize const G4double G4VMarker GetScreenDiameter const G4double G4VMarker GetScreenRadius const FillStyle G4VMarker GetFillStyle const Note enum G4VMarker FillStyle noFill hashed filled Example 8 7 shows sample C source code to define a very small red circle i e a dot with diameter 1 0 pixel Such a dot is often used to visualize a hit Example 8 7 Sample C source code to define a very small red circle faa C source codes An example of defining a red small maker G4Circle circle position Instantiate a circle with its 3D position The argument position is defined as G4Point3D instance circle SetScreenDiameter 1 0 Should be circle SetScreenDiameter 1 0 pixels to be implemented circle SetFillStyle G4Circle filled Make it a filled circle GAcolone colour E 005
169. WN About DAVID html e Geant4 Visualization Tutorial using the DAWN Renderer http geant4 slac stanford edu Presentations vis GDAWNTutorial G4DA WNTutorial html 8 3 8 VRML These drivers were developed by Satoshi Tanaka and Yasuhide Sawada Fukui University They generate VRML files which describe 3D scenes to be visualized with a proper VRML viewer at either a local or a remote host It realizes virtual reality visualization with your WWW browser There are many excellent VRML viewers which enable one to perform interactive spinning of detectors walking and or flying inside detectors or particle showers interactive investigation of detailed detector geometry etc There are two kinds of VRML drivers the VRMLFILE driver and the VRML Network driver The VRMLFILE driver is usually recommended since it is faster and safer in the sense that it is not affected by network conditions The VRMLFILE driver sends 3D data to your VRML viewer which is running on the same host machine as Geant4 via an intermediate file named g4 wr1 created in the current directory This file can be re visualization afterwards In visualization the name of the VRML viewer should be specified by setting the environment variable G4VRML_VIEWER beforehand For example 5 setenv G4VRML_VIEWER netscape Its default value is NONE which means that no viewer is invoked and only the file g4 wr1 is generated Remote Visualization with the VRML Network Driver
170. Weight roulette message PrepareWeightRoulett with the optional parameters e wsurvive survival weight e wlimit minimal allowed value of weight source importance cell importance isource importance of the source cell Each object of a sampler class is responsible for one particle type The particle type is given to the constructor of the sampler classes via the particle type name e g neutron Depending on the specific purpose the Configure of a sampler will set up specialized processes derived from GAVProcess for transportation in the parallel geometry scoring importance sampling and weight roulette for the given particle type When Configure is invoked the sampler places the processes in the correct order independent of the order in which user invoked the Prepare methods Note ThePrepare functions may each only be invoked once e To configure the sampling the function Configure must be called after the G4RunManager has been initialized Two classes implementing the interface G4VSampler are provided for the mass and a parallel geometry re spectively G4MassGeometrySampler e G4ParallelGeometrySampler The constructors of both classes take the particle type name e g neutron as an argument In addition the constructor of GGParallelGeomet rySampler needs a reference to the physical world volume of the parallel geometry 50 Toolkit Fundamentals 3 7 1 3 Scoring Scoring is provided by
171. Y pzSemiAxis Semiaxis in Z pzBottomCut lower cut plane level z pzTopCut upper cut plane level z Cone with Elliptical Cross Section A cone with an elliptical cross section can be defined as follows G4EllipticalCone const G4String amp G4double G4double G4double G4double pName pxSemiAxis pySemiAxis zMax pzTopCut In the picture pxSemiAxis 030 pySemi Axis 60 zMax 50 pzTopCut 25 where pxSemiAxis Semiaxis in X pySemiAxis Semiaxis in Y zMax Height of elliptical cone pzTopCut upper cut plane level 67 Detector Definition and Response An elliptical cone of height zMax semiaxis pxSemiAxis and semiaxis pySemiAxis is given by the para metric equations sopESOMLIANIS 2a u as y pySemiAxis zMax u u Sin v z u Where v is between 0 and 2 Pi and u between 0 and h respectively Tube with Hyperbolic Profile A tube with a hyperbolic profile HYPE can be defined as follows G4Hype const G4String amp pName G4double innerRadius G4double outerRadius G4double innerStereo G do ble outerstereo G4double halfLenZ In the picture innerStereo 0 7 outerStereo 0 7 halfLenZ 50 innerRadius 20 outerRadius 30 G4Hype is shaped with curved sides parallel to the z axis has a specified half length along the z axis about which it is centred and a given minimum and maximum radius A minimum radius of 0 defines a filled Hy
172. Your concrete detector class should be instantiated with the unique name of your detector The name can be associated with one or more global names with as a delimiter for categorizing your detectors For example myEMcal new MyEMcal myDet myCal myEMcal where myEMcal is the name of your detector The pointer to your sensitive detector must be set to one or more G4LogicalVolume objects to set the sensitivity of these volumes The pointer should also be registered to G4SDManager as described in Section 4 4 4 G4VSensitiveDetector has three major virtual methods ProcessHits This method is invoked by G4SteppingManager when a step is composed in the G4LogicalVolume which has the pointer to this sensitive detector The first argument of this method is a G4Step object of the current step The second argument is a G4TouchableHistory object for the Readout geometry described in the next section The second argument is NULL if Readout geometry is not assigned to this sensitive detector In this method one or more G4VHit objects should be constructed if the current step is meaningful for your detector Initialize This method is invoked at the beginning of each event The argument of this method is an object of the G4HCofThisEvent class Hit collections where hits produced in this particular event are stored can be associated with the G4HCofThisEvent object in this method The hit collections associated with the G4HCofThisEve
173. _CORTICAL_ICRP 0 047234 34 42 97 000826019 0235 e289 45 29 89 87865 01 13 06 85 85 135 9 145 2 63 2 OO 66 2 69 5 85 9 72 4 375 9 285 7 63 4 93 2 534 1 75 2 91 9 106 4 277 Appendix 13 6 0 14433 7 0 04199 8 0 446096 12 0 0022 15 0 10497 16 0 00315 20 0 20993 30 0 0001 G4_BORON_CARBIDE 5 0 78261 6 0 21739 G4_BORON_OXIDE 2 0 310551 8 0 689449 G4 BRAIN ICRP 0 110667 6 0 12542 7 0 01328 8 013123 1 0 00184 2 0 00015 5 0 00354 6 0 00177 v 0 00236 9 0 003 20 9e 05 26 5e 05 30 1e 05 G4 BUTANE 0 173408 6 0 826592 G4 N BUTYL ALCOHOL 0 135978 6 0 648171 8 0 215851 G4 C 552 0 02468 6 0 501611 8 0 004527 9 0 465209 4 0 003973 G4 CADMIUM TELLURIDE 48 0 468355 52 0 531645 G4 CADMIUM TUNGSTATE 8 0 177644 48 0 312027 74 0 510329 G4 CALCIUM CARBONATE 6 0 120003 8 0 479554 20 0 400443 G4 CALCIUM FLUORIDE 9 0 486659 20 0 513341 G4 CALCIUM OXIDE 8 0 285299 20 0 714701 G4 CALCIUM SULFATE 8 0 470095 6 0 235497 20 0 294408 G4 CALCIUM TUNGSTATE 8 0 22227 20 0 139202 74 0 638528 G4 CARBON DIOXIDE CO 2 6 0 272916 8 0 727084 G4 CARBON TETRACHLORIDE 6 0 078083 17 0 921917 G4 CELLULOSE CELLOPHANE 1 0 062162 6 0 444462 8 0 493376 G4_CELLULOSE_BUTYRATE Ta 0 Ls Ds 52 812 03 00249343 8098 76 18 96 062 00184212 59
174. _MAGNESIUM_TETRABORATE 5 0 240837 8 0 62379 2 0 135373 G4_MERCURIC_IODIDE 53 0 55856 80 0 44144 G4_METHANE 0 251306 6 0 748694 G4_METHANOL 0 125822 6 0 374852 8 0 499326 G4_MIX_D_WAX 0 13404 6 0 77796 8 0 03502 2 0 038594 22 0 014386 G4_MS20_TISSUE 0 081192 6 0 583442 7 0 017798 8 0 186381 2 0 130287 7 0 0009 G4_MUSCLE_SKELETAL_ICRP 0 100637 6 0 10783 E 0 02768 8 0 754773 1 0 00075 2 0 00019 5 0 0018 6 0 00241 a 0 00079 9 0 00302 20 3e 05 26 4e 05 30 5e 05 G4 MUSCLE STRIATED ICRU 0 101997 6 0 123 T 0 035 8 0 729003 1 0 0008 2 0 0002 5 0 002 6 0 005 9 0 003 G4_MUSCLE_WITH_SUCROSE 0 0982341 2 Le Ts 1 05 958 58 53 36 000667151 7914 99 04 04 11 67 18 34 43 08 41 67 60 7 54 75 74 74 282 Appendix 6 0 156214 7 0 03545 8 0 71010 G4_MUSCLE_WITHOUT_SUCROSE 0 101969 6 0 120058 7 0 03545 8 0 742522 G4_NAPHTHALENE 0 062909 6 0 93709 G4_NITROBENZENE 0 040935 6 0 585374 7 0 113773 8 0 259918 G4_NITROUS_OXIDE 7 0 636483 8 0 363517 G4_NYLON 8062 1 0 103509 6 0 648416 7 0 0995361 8 0 148539 G4_NYLON 6 6 ol 0 097976 6 0 636856 T 0 123779 8 0 141389 G4_NYLON 6 10 1 0 107062 6 0 680449 7 0 099189 8 0 1133 G4_NYLON 11_RILSAN 1 0 115476 6 0 720818 7 0 0764169 8 0 0872889 G4_OCTANE 0 158821 6 0 841179 G4_PARAFFIN 0 148605 6 0 851395 G4_N PENTANE 0
175. a 16 2 7 1 Building ExampleNO1 in a UNIX Environment eH 16 2 7 2 Building ExampleNO1 in a Windows Environment see 17 2 8 How to Set Up an Interactive Session sesssse IH ehem emere 17 29 1 Introd ction eere ipe certe oper tes ui Eee AERE eR eens he 17 2 8 2 A Short Description of Available Interface Classes ee 18 2 8 3 Building the Interface Libraries esses e 20 2 8 4 How to Use the Interface ice ener E CR EE ER POR EER ii ks ERR Eos 20 2 9 How to Execute a Program i kia sis ii epe is ree eh Ere eruere ka ika ss 21 2 9 Introd ction 1 2 tere tret te OE et bat Ye op P ERR dave ODE 21 2 9 2 Hard coded Batch Mode sssrin esner emen hen entree 21 2 93 Batch Mode with Macro Fil 1 Pere re Ee Ft ERES ERRARE e nep a 21 2 9 4 Interactive Mode Driven by Command Lines esee 22 2 9 5 General Case 5e p t reete a p a a Orb eta sates seated A 24 2 10 How to Visualize the Detector and Events sese HM e 25 2 10 1 Introducti n sios reii sree romeo RE RES RR 25 2 10 2 Visualization Drivers Lisas ins emeret eher euet Ege thous ss sk aaa 25 2 10 3 How to Incorporate Visualization Drivers into an Executable lt a kaka 26 2 10 4 Writing the main Method to Include Visualization eee 27 2 10 5 Sample Visualization Sessions sees hne hee ten nenne 27 Geant4 User s Guide for Applica
176. a Geant4 process running on the remote host where Geant4 Visualization should be performed i e where the visualized views should be displayed 4 Invoke a Geant4 process and perform visualization with the DAWN Network driver For example Idle gt vis open DAWN Idle gt vis drawVolume Idle gt vis viewer flush In step 4 3D scene data are sent from the remote host to the local host as DAWN formatted data and the local DAWN will visualize the data The transferred data are saved as a file named g4 prim in the current directory of the local host Further information e http geant4 kek jp GEANT4 vis DAWN About_DAWN html e http geant4 kek jp GEANT4 vis DAWN G4PRIM_FORMAT_24 Further information Fukui Renderer DAWN http geant4 kek jp GEANT4 vis DAWN About_DAWN html The DAWNFILE driver http geant4 kek jp GEANT4 vis GEANT4 DAWNFILE_driver html 202 Visualization The DAWN Network driver http geant4 kek jp GEANT4 vis GEANT4 DAWNNET driver html Environmental variables to customize DAWN and DAWN drivers http geant4 kek jp GEANT4 vis DAWN DAWN_ENV html http geant4 kek jp GEANT4 vis GEANT4 g4vis_on_linux html DAWN format g4 prim format manual http geant4 kek jp GEANT4 vis DAWN G4PRIM_FORMAT_24 e Geant4 Fukui University Group Home Page http geant4 kek jp GEANT4 vis DAWNCUT http geant4 kek jp GEANT4 vis DAWN About_DAWNCUT html DAVID http geant4 kek jp GEANT4 vis DA
177. a sectioning plane to a yz plane at x 2 cm Idle gt vis viewer set sectionPlane on 2 0 0 0 0 0 cm 1 0 0 0 0 0 Cutting away Cutting away means to remove a half space defined with a plane from a 3D scene e Cutting away is supported by the DAWNFILE driver off line Do the following e Perform visualization with the DAWNFILE driver to generate a file g4 prim describing the whole 3D scene Make the application DAWNCUT read the generated file to make a view of cutting away See the following WWW page for details http geant4 kek jp GEANT4 vis DAWN About_DAWNCUT html 215 Visualization Alternatively add up to three cutaway planes vis viewer addCutawayPlane 0 vis viewer addCutawayPlane 3l OO it a 0 000m 0 0 and for more that one plane you can change the mode to e a add or equivalently union default or b multiply or equivalently intersection vis viewer set cutawayMode multiply To de activate vis viewer clearCutawayPlanes OpenGL supports this feature 8 4 16 Tutorial macros The followings are tutorial macros in the directory examples novice N03 visTutor exN03 VisO mac A basic macro for visualization of detector geometry and events using OpenGL in Immediate mode and DAWN exN03Vis1 mac A basic macro for visualization of detector geometry using OpenGL in Stored mode and DAWN exN03Vis2 mac A basic macro for visualization of detector geometry and events usi
178. ach photon s frequency is sampled from the empirical spectrum The photons orig inate evenly along the track segment and are emitted uniformly into 4 with a random linear polarization and at times characteristic for the scintillation component 150 Tracking and Physics 5 2 5 3 Generation of Photons in processes optical Wavelength Shifting Wavelength Shifting WLS fibers are used in many high energy particle physics experiments They absorb light at one wavelength and re emit light at a different wavelength and are used for several reasons For one they tend to decrease the self absorption of the detector so that as much light reaches the PMTs as possible WLS fibers are also used to match the emission spectrum of the detector with the input spectrum of the PMT A WLS material is characterized by its photon absorption and photon emission spectrum and by a possible time delay between the absorption and re emission of the photon Wavelength Shifting may be simulated by specify ing these empirical parameters for each WLS material in the simulation It is sufficient to specify in the user s DetectorConstruction class a relative spectral distribution as a function of photon energy for the WLS material WLSABSLENGTH is the absorption length of the material as a function of the photon s momentum WLSCOMPONENT is the relative emission spectrum of the material as a function of the photon s momentum and WLSTIMECONSTANT accounts for any time d
179. act that a local tra jectory in a slowly varying field will not vary significantly from a helix Combining this in with a variation the Runge Kutta method can provide higher accuracy at lower computational cost when large steps are possible G4Mag UsualEgRhs fEquation new G4Mag UsualEgRhs fMagneticField fStepper new G4HelixImplicitEuler fEquation Note that for magnetic field that do not vary with time the default number of variables suffices Jy E vy fStepper new G4HelixExplicitEuler fEquation fStepper new G4HelixSimpleRunge fEquation You can choose an alternative stepper either when the field manager is constructed or later At the construction of the ChordFinder it is an optional argument G4ChordFinder G4MagneticField itsMagField G4double stepMinimum 1 0e 2 mm G4MagIntegratorStepper pItsStepper 0 To change the stepper at a later time use pChordFinder GetIntegrationDriver RenewStepperAndAdjust newStepper 4 3 2 5 How to Adjust the Accuracy of Propagation In order to obtain a particular accuracy in tracking particles through an electromagnetic field it is necessary to adjust the parameters of the field propagation module In the following section some of these additional parameters are discussed 111 Detector Definition and Response When integration is used to calculate the trajectory it is necessary to determine an acceptable level of numerical imprecision in or
180. ader file source file derived from G4VPrimaryGeneratorAction e construction of G4HEPEvtInterface e primary event generation with PYTHIA event ExN04EventAction header file source file store the initial seeds ExN04StackingAction header file source file derived from G4UserStackingAction 249 Examples stage control and priority control event abortion ExN04StackingActionMessenger header file source file e derived from G4UImessenger e define abortion conditions ExN04TrackingAction header file source file derived from G4UserTrackingAction select trajectories select secondaries 9 1 6 Example N05 Basic concepts e Use of shower parameterisation definition of an EM shower model assignment to a Logical Volume definition of ghost volume when ready e Interactivity build of messengers classes e Hits Digi filled from detailed and parameterised simulation calorimeter type hits Classes main source file main forinteractive mode construction and deletion of G4RunManager construction and set of mandatory user classes construction of the G4GlobalFastSimulationmanager construction of a G4FastSimulationManager to assign fast simulation model to a logical volume envelope definition of ghost volume for parameterisation construction EM physics shower fast simulation model ExN05EMShowerModel header file source file derived from G4
181. ailable are polished or ground For dielectric metal surfaces the G4OpBoundaryProcess also defaults to unit reflectivity and zero detection efficiency In cases where the user specifies the UNIFIED model but does not otherwise specify the model reflection probability constants the default becomes Lambertian reflection 5 2 6 Parameterization In this section we describe how to use the parameterization or fast simulation facilities of GEANT4 Examples are provided in the examples novice N05 directory 5 2 6 1 Generalities The Geant4 parameterization facilities allow you to shortcut the detailed tracking in a given volume and for given particle types in order for you to provide your own implementation of the physics and of the detector response Parameterisations are bound to a G4Region object which in the case of fast simulation is also called an enve lope Prior to release 8 0 parameterisations were bound to a G4LogicalVolume the root of a volume hierar chy These root volumes are now attributes of the G4Region Envelopes often correspond to the volumes of sub detectors electromagnetic calorimeters tracking chambers etc With GEANTA it is also possible to define envelopes by overlaying a parallel or ghost geometry as discussed in Section 5 2 6 7 In GEANTA parameterisations have three main features You must specify the particle types for which your parameterisation is valid the dynamics conditions for which your parame
182. ailable as part of the Geant4 release and are further documented here To run the Low Energy code for photon and electron electromagnetic processes data files need to be copied by the user to his her code repository These files are distributed together with Geant4 release The user should set the environment variable G4LEDATA to the directory where he she has copied the files Options are available for low energy electromagnetic processes for hadrons and ions in terms of public member functions of the G4hLowEnergylonisation class e SetHighEnergyForProtonParametrisation G4double SetLowEnergyForProtonParametrisation G4double SetHighEnergyForAntiProtonParametrisation G4double SetLowEnergyForAntiProtonParametrisation G4double SetElectronicStoppingPowerModel const G4ParticleDefinition const G4String amp SetNuclearStoppingPowerModel const G4String amp SetNuclearStoppingOn SetNuclearStoppingOff SetBarkasOn SetBarkasOff SetFluorescence const G4bool e ActivateAugerElectronProduction G4bool e SetCutForSecondaryPhotons G4double e SetCutForSecondaryElectrons G4double The available models for ElectronicStoppingPower and NuclearStoppingPower are documented in the class di agrams Options are available for low energy electromagnetic processes for electrons in the G4LowEnergylonisation class e ActivateAuger G4bool SetCutForLowEnSecPhotons G4double SetCutForLowEnSecElectrons G4double Opt
183. akefile placed inside each directory in the Geant4 distribution and defining directives specific to build a library a set of sub libraries or an executable Kernel libraries are placed by default in G4INSTALL 1lib SG4SYSTEM where G4SYSTEM specifies the system architecture and compiler in use Executable binaries are placed in G4WORKDIR bin S G4SYSTEM and temporary files object files and data products of the compilation process in G4WORKDIR tmp SG4SYSTEM GAWORKDIR set by default to G4INSTALL should be set by the user to specify the place his her own workdir for Geant4 in the user area For more information on how to build Geant4 kernel libraries and set up the correct environment for Geant4 refer to the Installation Guide 2 7 1 2 Building the executable The compilation process to build an executable such as an example from G4INSTALL examples is start ed by invoking the gmake command from the sub directory in which you are interested To build for in stance exampleNO1 in your G4WORKD IR area you should copy the module G4INSTALL examples to your SGAWORKDIR and do the following actions gt cd G4WORKDIR examples novice NO1 gt gmake This will create in SG4WORKDIR bin SG4SYSTEM the exampleNO1 executable which you can invoke and run You should actually add G4WORKDIR bin G4SYSTEM to PATH in your environment 2 7 2 Building ExampleN01 in a Windows Environment The procedure to build a
184. al ComputeMaterial G4VPhysicalVolume currentVol const G4int no lev const G4VTouchable parentTouch private G4Material materiall material2 The implementation of the method can utilise any information from a parent or other ancestor volume of its parameterised physical volume but typically it will use only the copy number G4Material SampleNestedParameterisation ComputeMaterial G4VPhysicalVolume currentVol const G4int no_lev const G4VTouchable parentTouchable G4Material material 0 Get the information about the parent volume G4int no parent parentTouchable gt GetReplicaNumber G4int no_total no_parent no_lev A simple checkerboard pattern of two materials if no total 2 1 material materiall 83 Detector Definition and Response else material material2 Set the material to the current logical volume G4LogicalVolume currentLogVol currentVol gt GetLogicalVolume currentLogVol gt SetMaterial material return material Nested parameterisations are suitable for the case of regular voxel geometries in which a large number of equal volumes are required and their only difference is in their material By creating two or more levels of parame terised physical volumes it is possible to divide space while requiring only limited additional memory for very fine level optimisation This provides fast navigation Alternative implementations taking into account
185. al information e g the final position for the step in progress Also G4Track will be updated after each invocation of a Post StepDoIt 5 1 2 Access to Track and Step Information How to Get Track Information Track information may be accessed by invoking various Get methods provided in the G4Track class For details see the Software Reference Manual Typical information available includes yz e Global time time since the event was created Local time time since the track was created e Proper time Momentum direction unit vector Kinetic energy e Accumulated geometrical track length e Accumulated true track length e Pointer to dynamic particle Pointer to physical volume Track ID number Track ID number of the parent Current step number e Track status e x y z at the start point vertex position of the track Momentum direction at the start point vertex position of the track e Kinetic energy at the start point vertex position of the track Pinter to the process which created the current track How to Get Step Information Step and step point information can be retrieved by invoking various Get methods provided in the G4Step G4StepPoint classes For details see the Software Reference Manual Information in G4Step includes e Pointers to PreStep and Post StepPoint e Geometrical step length step length before the correction of multiple scattering e True step length step length after
186. al method of the G4VUserPhysicsList class Construction of particles materials and processes should precede the invocation of SetCuts G4RunManager takes care of this sequence in usual applications The idea of a unique cut value in range is one of the important features of Geant4 and is used to handle cut values in a coherent manner For most applications users need to determine only one cut value in range and apply this value to gammas electrons and positrons alike In such a case the SetCutsWithDefault method may be used It is provided by the G4VuserPhysicsList base class which has a defaultCutValue member as the default range cut off value SetCutsWithDefault uses this value It is possible to set different range cut values for gammas electrons and positrons and also to set different range cut values for each geometrical region In such cases however one must be careful with physics outputs because Geant4 processes especially energy loss are designed to conform to the unique cut value in range scheme Example 2 14 Set cut values by using the default cut value void ExN04PhysicsList SetCuts the G4VUserPhysicsList SetCutsWithDefault method sets fl the default cut value for all particle types SetCutsWithDefault The defaultCutValue is set to 1 0 mm by default Of course you can set the new default cut value in the constructor of your physics list class as shown below Example 2 15 Set the defaul
187. alf z length Trapezoid Twisted along One Axis trapezoid twisted along one axis can be defined as follows G4TwistedTrap const G4String amp G4TwistedTrap const G4double G4double G4double G4double G4double G4String G4double G4double G4double G4double G4double G4double G4double G4double G4double G4double G4double pName twistedangle pDxx1 pDxx2 pDy pDz pName twistedangle pDz pTheta BEBE pDyl pxl pDx2 pDy2 pDx3 pDx4 pAlph In the picture pDx1 30 pDx2 40 pDy1 40 pDx3 10 pDx4 14 pDy2 16 pDz 60 pTheta 20 Degree pDphi 5 Degree pAlph 10 Degree twistedangle 30 Degree 69 Detector Definition and Response The first constructor of G4TwistedTrap produces a regular trapezoid twisted along the z axis where the caps of the trapezoid are of the same shape and size The second constructor produces a generic trapezoid with polar azimuthal and tilt angles The twist angle cannot be greater than 90 degrees twistedangle Twisted angle pDx1 Half x length at y pDy pDx2 Half x length at y pDy pDy Half y length pDz Half z length pTheta Polar angle of the line joining the centres of the faces at pDz pDyl Half y length at pDz pDx1 Half x length at pDz y pDy1 pDx2 Half x length at pDz y pDy1 pDy2 Half y length at pDz pDx3 Half x length at pDz y pDy2 pDx4 Half x length
188. aller zip file as the geometry is only written once Use the command vis heprep appendGeometry false Optional To close the file remove the SceneHandler use vis sceneHandler remove scene handler 0 Limitations Only one SceneHandler can exist at any time connected to a single Viewer Since the HepRep format is a model rather than a view this is not a real limitation In WIRED 4 you can create as many views SceneHan dlers as you like Further information e WIRED4 Plugin to the JAS3 Analysis System e FRED event display e HepRep graphics format http www slac stanford edu perl heprep 8 3 6 DAWN The DAWN drivers are interfaces to Fukui Renderer DAWN which has been developed by Satoshi Tanaka Minato Kawaguti et al Fukui University It is a vectorized 3D PostScript processor and so well suited to prepare technical high quality outputs for presentation and or documentation It is also useful for precise debugging of detector geometry Remote visualization off line re visualization cut view and many other useful functions of detector simulation are supported A DAWN process is automatically invoked as a co process of Geant4 when visualization is performed and 3D data are passed with inter process communication via a file or the TCP IP socket When Geant4 Visualization is performed with the DAWN driver the visualized view is automatically saved to a file named g4 eps in the current directory which describes a vector
189. also a corresponding granular library for each particle category 2 4 1 1 The GaParticleDefinition Class G4ParticleDefinition has properties which characterize individual particles such as name mass charge spin and so on Most of these properties are read only and can not be changed by users without rebuilding the libraries 2 4 1 2 How to Access a Particle Each particle class type represents an individual particle type and each class has a single static object There are some exceptions to this rule please see Section 5 3 for details For example the class G4Electron represents the electron and its only object is G4Electron theElectron The object is therefore referred to as a singleton of the G4Electron class The pointer to this object is available through the static method GaElectron ElectronDefinition More than 100 types of particles are provided by default to be used in various physics processes In normal applications users will not need to define their own particles 10 Getting Started with Geant4 Running a Simple Example Because particles are static objects of individual particle classes these objects are instantiated automatically be fore the main routine is executed However you must explicitly declare the particle classes required by your program otherwise the compiler can not recognize which classes you need and no particles will be instantiated 2 4 1 3 Dictionary of Parti
190. alue method of your messenger into a G4ThreeVector G4String convertToString G4ThreeVector currVal Convert the current three vector to G4String which should be returned by the Get Current Value method of your messenger G4UIcmdWithADoubleAndUnit This is a G amp UIcommand derived class which takes one double type parameter and its unit G4UIcmdWithADoubleAndUnit char commandpath G4UImanager theMessenger Constructor Arguments are the full path command name and the pointer to your messenger void SetParameterName char paramName G4bool omittable Define the name of the double parameter and set the omittable flag If omittable is true you should define the default value using the next method void SetDefaultValue G4double defVal Define the default value of the double parameter void SetUnitCategory char unitCategory Define acceptable unit category void SetDefaultUnit char defUnit Define the default unit Please use this method and the SetUnitCategory method alternatively G4double GetNewDoubleValue G4String paramString Convert G4String parameter value given by the SetNewValue method of your messenger into double Please note that the return value has already been multiplied by the value of the given unit G4double GetNewDoubleRawValue G4String paramString Convert G4String parameter value given by the SetNewValue method of your messenger into double but without multiplying the value of the given
191. anager gt SetUserAction new ExNO1PrimaryGeneratorAction creates an instance of a particle generator and passes its pointer to the run manager ExNO1PrimaryGeneratorAction is an example of a user action class which is derived from G4VUserPrimaryGeneratorAction In this class the user must describe the initial state of the primary event This class has a public virtual method named generatePrimaries which will be invoked at the beginning of each event Details will be given in Section 2 6 Note that Geant4 does not provide any default behavior for gen erating a primary event The next instruction runManager gt initialize performs the detector construction creates the physics processes calculates cross sections and otherwise sets up the run The final run manager method in main int numberOfEvent 3 runManager gt beamOn numberOfEvent begins a run of three sequentially processed events The beamOn method may be invoked any number of times within main with each invocation representing a separate run Once a run has begun neither the detector setup nor the physics processes may be changed They may be changed between runs however as described in Section 3 4 4 More information on G4RunManager in general is found in Section 3 4 Getting Started with Geant4 Running a Simple Example As mentioned above other manager classes are created when the run manager is created One of these is the user interface manager G
192. and Response The second error is that daughter volumes A and B overlap This is noticeable because one of the intersections with A rightmost magenta dot is inside the volume B as defined as the space between the red dots Alternatively one of the intersections with B leftmost red dot is inside the volume A as defined as the space between the magenta dots Each of these two types of errors is represented by a line segment which has a start point an end point and a length Depending on the type of error the points are most clearly recognized in either the coordinate system of the volume the global coordinate system or the coordinate system of the daughters involved Also notice that certain errors will be missed unless a line is supplied in precisely the correct path Unfortunately it is hard to predict which lines are best at uncovering potential geometry errors Instead the geometry testing code uses a grid of lines in the hope of at least uncovering gross geometry errors More subtle errors could easily be missed Another difficult issue is roundoff error For example daughters C and D lie precisely next to each other It is possible due to roundoff that one of the intersections points will lie just slightly inside the space of the other In addition a volume that lies tightly up against the outside of its mother may have an intersection point that just slightly lies outside the mother To avoid spurious errors caused by roun
193. and min energies and values from the vector are also provided e G4Timer Utility class providing methods to measure elapsed user system process time Uses lt sys times h gt and lt unistd h gt POSIX l e G4UserLimits Class collecting methods for get and set any kind of step limitation allowed in Geant4 e G4UnitsTable Placeholder for the system of units in Geant4 3 3 System of units 3 3 1 Basic units Geant4 offers the user the possibility to choose and use the units he prefers for any quantity In fact the Geant4 kernel takes care of the units Internally it uses a consistent set on units based on the HepSystemOfUnits millimeter mm nanosecond ns Mega electron Volt MeV positron charge eplus degree Kelvin kelvin the amount of substance mole luminous intensity candela radian radian steradian steradian All other units are defined from the basic ones For instance millimeter mm 1 meter m 1000 mm m3 m m m In the file source global management include SystemOfUnits h you will find all of these defi nitions That file is part of CLHEP Moreover the user is free to change the system of units to be used by the kernel 3 3 2 Input your data 3 3 2 1 Avoid hard coded data You must give the units for the data you are going to introduce 38 Toolkit Fundamentals G4double Size 15 km KineticEnergy 90 3 GeV density 11 mg cm3 Indeed the ful
194. and translation vector that are used to transform the coordinate system of the second solid to the coordinate system of the first solid This is called the passive method e Or by creating a transformation that moves the second solid from its desired position to its standard position e g a box s standard position is with its centre at the origin and sides parallel to the three axes This is called the active method In the first case the translation is applied first to move the origin of coordinates Then the rotation is used to rotate the coordinate system of the second solid to the coordinate system of the first G4RotationMatrix yRot new G4RotationMatrix Rotates X and Z axes only yRot gt rotateY M PI 4 rad Rotates 45 degrees G4ThreeVector zTrans 0 0 50 G4UnionSolid unionMoved new G4UnionSolid Box CylinderMoved box cyl yRot zTrans The new coordinate system of the cylinder is translated so that y its 65666 Ls at Fh oncthe origins 2 axis end it 1s rotared with its X axis halfway between the original X and Z axes Now we build the same solid using the alternative method G4RotationMatrix invRot yRot gt invert G4Transform3D transform invRot zTrans G4UnionSolid unionMoved new G4UnionSolid Box CylinderMoved box cyl transform Note that the first constructor that takes a pointer to the rotation matrix G4RotationMatrix does NOT copy it Therefore once used a rotation matri
195. antino GeantinoDefinition Due to the large number of pre defined particles in Geant4 it is cumbersome to list all the particles by this method If you want all the particles in a Geant4 particle category there are six utility classes corresponding to each of the particle categories which perform this function G4BosonConstructor G4LeptonConstructor G4MesonConstructor e G4BarionConstructor e G4IonConstructor G4ShortlivedConstructor An example of this is shown in ExNO5PhysicsList listed below Example 2 13 Construct all leptons void ExN05PhysicsList ConstructLeptons Construct all leptons G4LeptonConstructor pConstructor pConstructor ConstructParticle 11 Getting Started with Geant4 Running a Simple Example 2 4 2 Range Cuts To avoid infrared divergence some electromagnetic processes require a threshold below which no secondary will be generated Because of this requirement gammas electrons and positrons require production thresholds which the user should define This threshold should be defined as a distance or range cut off which is internally converted to an energy for individual materials The range threshold should be defined in the initialization phase using the Set Cuts method of G4VUserPhysicsList Section 5 5 discusses threshold and tracking cuts in detail 2 4 2 1 Setting the cuts Production threshold values should be defined in SetCuts which is a pure virtu
196. any other physics processes The name of the parallel world where the G4ParallelWorldScoringProcess is responsible for must be defined through the method SetParallelWorld available from the class G4ParallelWorldScoringProcess If the user has more than one parallel worlds with detectors for each of the parallel worlds dedicated G4ParallelWorldScoringProcess objects must be instantiated with the name of each parallel world re spectively and registered to the particles Example 4 20 Define G4ParallelWorldScoringProcess Add parallel world scoring process Jf G4ParallelWorldScoringProcess theParallelWorldScoringProcess new G4ParallelWorldScoringProcess ParaWorldScoringProc theParallelWorldScoringProcess SetParallelWorld ParallelScoringWorld theParticleIterator reset while theParticleIterator G4ParticleDefinition particle theParticlelterator gt value if particle gt IsShortLived G4ProcessManager pmanager particle GetProcessManager pmanager gt AddProcess theParallelWorldScoringProcess pmanager gt SetProcessOrderingToLast theParallelWorldScoringProcess idxAtRest pmanager gt SetProcessOrdering theParallelWorldScoringProcess idxAlongStep 1 pmanager gt SetProcessOrderingToLast theParallelWorldScoringProcess idxPostStep At the end of processing an event all hits collections made for the parallel world are stored in G4HCofThisEvent as well as those for the m
197. applies to A peculiarity of C compilers nowadays is the way templated instances are treated during the compilation linkage process Some C compilers need to store temporarily template instantiation files object files or temporary source code files in a template repository or directory that can be specified as unique or not directly from the compilation command probably historically coming from the old cfront based implementation of the C compiler After the installation of the libraries we strongly suggest to always distinguish between the installation directory identified by G4INSTALL and the working directory identified by G4WORKDIR in order not to alter the installation area for the template repository In Geant4 the path to the template repository for those compilers which make use of it is specified by the environment variable G4TREP which is fixed and points by default to G4WORKDIR tmp G4SYSTEM g4 ptrepository where SG4SYSTEM identifies the system architecture compiler currently used and SGAWORKDIR is the path to the user working directory for Geant4 A secondary template repository G4TREP exec is created by default and can be used when building executables to isolate the main repository used for building the libraries in case of clashes provoked by conflicting class names This secondary template repository can be activated by defining in the environment or in the GNUmakefile related to the test example to
198. ar run because GenerateRun is invoked before the calculation of the physics table BeginOfRunAction This method is invoked before entering the event loop A typical use of this method would be to initialize and or book histograms for a particular run This method is invoked after the calculation of the physics tables EndOfRunAction This method is invoked at the very end of the run processing It is typically used for a simple analysis of the processed run Example 6 4 G4UserRunAction class G4UserRunAction public G4UserRunAction virtual G4UserRunAction public virtual G4Run GenerateRun virtual void BeginOfRunAction const G4Run virtual void EndOfRunAction const G4Run 174 User Actions G4UserEventAction This class has two virtual methods which are invoked by G4Event Manager for each event beginOfEventAction This method is invoked before converting the primary particles to G4Track objects A typical use of this method would be to initialize and or book histograms for a particular event endOfEventAction This method is invoked at the very end of event processing It is typically used for a simple analysis of the processed event If the user wants to keep the currently processing event until the end of the current run the user can invoke pEventManager KeepTheCurrentEvent so that it is kept in G4Run object This should be quite useful if you simulate quite many events
199. are restrictions to be considered for the parallel geometry e Materials production thresholds and EM field are used only from the mass geometry Even if such physical quantities are defined in a parallel world they do not affect to the simulation e Although all worlds will be comprehensively taken care by the G4Transportation process for the navi gation each parallel world must have its own process assigned to achieve its purpose For example in case the user defines a sensitive detector to a parallel world a process dedicated to the parallel world is responsible to invoke this detector The G4SteppingManager treats only the detectors in the mass geometry For this case of detector sensitivity defined in a parallel world a G4ParallelWorldScoringProcess process must be defined in the physics list see Section 4 7 3 4 7 2 Defining a parallel world A parallel world should be defined in the Construct virtual method of the user s class derived from the abstract base class G4VUserParallelWorld 126 Detector Definition and Response Example 4 17 An example header file of a concrete user parallel world class ifndef MyParallelWorld_h define MyParallelWorld_h 1 include globals hh include G4VUserParallelWorld hh class MyParallelWorld public G4VUserParallelWorld Publier MyParallelWorld G4String worldName virtual MyParallelWorld PUBLIC virtual void Construct endif A parallel world mu
200. art is usually to finish the session delete session For a tcsh session the second line must be G4UIsession session new G4UIterminal new G4UItcsh See the examples in examples novice NOx in which the terminal session is used Again environment variable selects a given interface But for your convenience some of them are set defaults e G4Ulterminal G4UItcsh G4UIGAG and G4UIGainServer can be used without any environment variables Sessions not needing external packages or libraries are always built see G4UI_BUILD gmk and linked so the user can instantiate one of these sessions without rebuilding the libraries and without setting any environ 20 Getting Started with Geant4 Running a Simple Example ment variables For backwards compatibility with user code as typified by geant4 examples main programs the C pre processor variables corresponding to the original environment variables for the above three i e G4UI_USE_TERMINAL G4UI_USE_TCSH and G4UI USE GAG are set However if he she sets no environment variables then the C pre processor variable G4UI USE TERMINAL is set by default although there is no need to use it Theenvironment variable G4UI USE XM GAUI USE XAW or GAUI USE WIN32 must be set to use the respective interface The file G4INSTALL config interactivity gmk resolves their dependencies on external packages If the environment variable G4UI NONE is set no externa ibraries are selected Also f
201. ass geometry 128 Chapter 5 Tracking and Physics 5 1 Tracking 5 1 1 Basic Concepts Philosophy of Tracking All Geant4 processes including the transportation of particles are treated generically In spite of the name track ing particles are not transported in the tracking category G4TrackingManager is an interface class which bro kers transactions between the event track and tracking categories An instance of this class handles the message passing between the upper hierarchical object which is the event manager and lower hierarchical objects in the tracking category The event manager is a singleton instance of the G4EventManager class The tracking manager receives a track from the event manager and takes the actions required to finish tracking it G4TrackingManager aggregates the pointers to G4SteppingManager G4Trajectory and G4UserTrackingAction Also there is a use relation to G4Track and G4Step G4SteppingManager plays an essential role in tracking the particle It takes care of all message passing between objects in the different categories relevant to transporting a particle for example geometry and interactions in matter Its public method Stepping steers the stepping of the particle The algorithm to handle one step is given below 1 The particle s velocity at the beginning of the step is calculated 2 Each active discrete or continuous process must propose a step length based on the interaction it de
202. at surface flux is a surface based flux scorer The surface flux is defined by the number of tracks that reach the surface The expression of surface flux is given by the sum of W cos t A where W t and A represent particle weight injection angle of particle with respect to the surface normal and area of the surface The user must enter one of the particle directions fFlux_In fFlux_Out or fFlux_InOut in the constructor Here fFlux_In scores incoming particles to the cell while fFlux_Out scores outgoing particles from the cell fFlux_InOut scores both directions G4PSCellFlux Cell flux is a volume based flux scorer The cell flux is defined by a track length L of the particle inside a volume divided by the volume V of this cell The track length is calculated by a sum of the step lengths 122 Detector Definition and Response in the cell The expression for cell flux is given by the sum of W L V where W is a particle weight and is multiplied by the track length at each step G4PSPassageCellFlux Passage cell flux is a volume based scorer similar to G4PSCellFlux The only difference is that tracks which pass through a cell are taken into account It means generated or stopped tracks inside the volume are excluded from the calculation Other scorers G4PSMinKinEAtGeneration This scorer records the minimum kinetic energy of secondary particles at their production point in the volume in an event This primitive scorer does not i
203. bility of internal Lambertian reflection and finally the back scatter spike constant is for the case of several reflections within a deep groove with the ultimate result of exact back scattering The four probabilities must add up to one with the diffuse lobe constant being implicit The reader may consult the reference for a thorough description of the model Example 5 10 Dielectric dielectric surface properties defined via the G4OpticalSurface G4VPhysicalVolume volumel G4VPhysicalVolume volume2 G4OpticalSurface OpSurface new G4OpticalSurface name G4LogicalBorderSurface Surface new G4LogicalBorderSurface name volumel volume2 OpSurface G4double sigma_alpha 0 1 OpSurface gt SetType dielectric_dielectric OpSurface gt SetModel unified OpSurface gt SetFinish groundbackpainted OpSurface gt SetSigmaAlpha sigma alpha const G4int NUM 2 G4double pp NUM 2 038 eV 4 144 eV G4double specularlobe NUM 0 3 0 3 G4double specularspike NUM 0 2 0 2 G4double backscatter NUM 0 1 0 1 G4double rindex NUM 1 35 1 40 G4double reflectivity NUM 0 3 0 5 G4double efficiency NUM 0 8 0 1 G4MaterialPropertiesTable SMPT new G4MaterialPropertiesTable SMPT AddProperty SMPT AddProperty SMPT AddProperty SMPT AddProperty SMPT AddProperty SMPT AddProperty RINDEX pp rindex NUM SPECULARLOBECONSTANT pp specularlobe
204. bleHistory object for which the caller has deletion responsibility The touchable volume is the volume returned by the last Locate operation The object includes a copy of the current Naviga tionHistory enabling the efficient relocation of points in close to the current volume in the hierarchy As stated previously the navigator makes use of utility classes to perform location and step computation functions The different navigation utilities manipulate the G4NavigationHistory object In LocateGlobalPointAndSetup the process of locating a point breaks down into three main stages optimisation determination that the point is contained with a subtree mother and daughters and determination of the actual containing daughter The latter two can be thought of as scanning first up the hierarchy until a volume that is guaranteed to contain the point is found and then scanning down until the actual volume that contains the point is found In ComputeStep three types of computation are treated depending on the current containing volume e The volume contains normal placement daughters or none The volume contains a single parameterised volume object representing many volumes The volume is a replica and contains normal placement daughters 93 Detector Definition and Response 4 1 8 2 Using the navigator to locate points More than one navigator objects can be created inside an application these navigators can act indep
205. bute 0 setAttribute CPN Configure single value data vis modeling trajectories drawByAttribute 0 addValue brem_key eBrem vis modeling trajectories drawByAttribute 0 addValue annihil_key annihil vis modeling trajectories drawByAttribute 0 addValue decay_key Decay vis modeling trajectories drawByAttribute 0 addValue mulon key muloni vis modeling trajectories drawByAttribute 0 addValue elon key eloni vis modeling trajectories drawByAttribute 0 brem key setLineColour red vis modeling trajectories drawByAttribute 0 annihil key setLineColour green vis modeling trajectories drawByAttribute 0 decay key setLineColour cyan vis modeling trajectories drawByAttribute 0 eIon key setLineColour yellow vis modeling trajectories drawByAttribute 0 mulon key setLineColour magenta Create a drawBy Attribute model named drawBy Attribute 1 vis modeling trajectories create drawByAttribute Select IMag attribute vis modeling trajectories drawByAttribute 1 setAttribute IMag Configure interval data vis modeling trajectories drawByAttribute l addInterval intervall 0 0 keV 2 5MeV vis modeling trajectories drawByAttribute l addInterval interval2 2 5 MeV 5 MeV vis modeling trajectories drawByAttribute 1 addlnterval interval3 5 MeV 7 5 MeV vis modeling trajectories drawByAttribute 1 addlnterval interval4 7 5 MeV 10 MeV vis modeling trajectories drawByAttribute 1 addlnterval interval5 10 MeV 12 5 MeV vis modeling trajectories drawByA
206. by the G4FastSimulationManagerProcess Usually however only a few volumes will be placed in this ghost world so that the geometry computations will remain rather cheap In the existing implementation temporary implementation with G4Region but before parallel geometry implementation you may only consider ghost G4Regions with just one root G4LogicalVolume The G4GlobalFastSimulationManager provides the construction of the ghost geometry by making first an empty clone of the world for tracking provided by the construct method of your G4VUserDetectorConstruction con crete class You provide the placement of the G4Region root G4LogicalVolume relative to the ghost world coor dinates in the G4FastSimulationManager objects A ghost G4Region is recognized by the fact that its associated G4FastSimulationManager retains a non empty list of placements The G4GlobalFastSimulationManager will then use both those placements and the IsApplicable methods of the models attached to the G4FastSimulationManager objects to build the flavour dependant ghost geometries Then at the beginning of the tracking of a particle the appropriate ghost world if any will be selected The steps required to build one ghost G4Region are 1 built the ghost G4Region myGhostRegion 2 build the root G4Logical Volume myGhostLogical set it to myGhostRegion 3 build a G4FastSimulationManager object myGhostFSManager giving myGhostRegion as argument of the constructor
207. ce is an ordered pair of physical volumes so in principle the user can choose different optical properties for photons arriving from the reverse side of the same interface For the optical boundary process to use a border surface the two volumes must have been positioned with G4PVPlacement The ordered combination can exist at many places in the simulation When the surface concept is not needed and a perfectly smooth surface exists beteen two dielectic materials the only relevant property is the index of refraction a quantity stored with the material and no restriction exists on how the volumes were positioned The physical surface object also specifies which model the boundary process should use to simulate interactions with that surface In addition the physical surface can have a material property table all its own The usage of this table allows all specular constants to be wavelength dependent In case the surface is painted or wrapped but not a cladding the table may include the thin layer s index of refraction This allows the simulation of boundary effects at the intersection between the medium and the surface layer as well as the Lambertian reflection at the far side of the thin layer This occurs within the process itself and does not invoke the G4Navigator Combinations of surface finish properties such as polished or ground and front painted or back painted enumerate the different situations which can be simulated When a photon a
208. cepts nen ERE a S a es aaa AS epe 129 5 1 2 Access to Track and Step Information 2 0 0 0 cece aa aaa aa ence aaa aaa aaa 130 5 1 3 Handling of Secondary Particles 2 0 0 0 cece kaka kaka kaka eee 131 3 14 User ACHGNS iie es sia Ia a e A A eee OR Be eas 131 5 1 5 Verbose Outputs iem ree PIER se i A sa SRS 132 5 1 6 Trajectory and Trajectory Point 2 0 0 0 cece aa cece aaa aaa aaa eere 132 5 2 Physics Processes ice Pe E iai a Aa a aa PR R a P a esa er care 133 5 2 1 Electromagnetic Interactions sss e aaa aaa aaa 135 5 22 Hadronie Interactions 1i emet kia si ia so EE e EIEEE RES PESES KENNS 140 3 2 37 Particle Decay Process eeu es eve nesses dees Va Weekes EKSTE TETERE tees 146 5 2 4 Photolepton hadron Processes soseri riseire stisi ania Hem mH mI eene 147 5 2 5 Optical Photon Processes Ldk aaa aaa aaa aaa kaka aaa aa aaa e enm eme He mee hen renes 148 5 2 6 Parametenzation suns sese ass e rr REESE 154 3 2 1 Transportation Process 3 eee he emper eee rhe si ab eceuseusecedbeasoueecss 160 5 3 Particles cnet pee RR ERST FR entra Ds ke mre P ee reps 160 3 3 1 Basic concepts ioter eren teret ve grey Env eee cet 160 5 32 Definition Of a particle 4 oett ESERE EES VENE ER ERR DR 161 333 3 Dynamic particle sisese enskt irei O EDU eap EISE 163 5 4 Production Threshold versus Tracking Cut lt a aaa aaa aaa aaa aaa eene 164 5 4 1 General considerations i endi a sa aus nis ses e tere ree rue r
209. cess G4HadronFissionProcess and G4HadronCaptureProcess comes already equipped with a cross section data store and a default cross section data set The data set objects are really just shells that invoke the singleton G4HadronCrossSections to do the real work of calculating cross sections The default cross sections can be overridden in whole or in part by the user To this end the base class G4HadronicProcess has a get method G4CrossSectionDataStore GetCrossSectionDataStore which gives public access to the data store for each process The user s cross section data sets can be added to the data store according to the following framework EL Hadeon ue ErocessmEdEPROCess E MyCrossSectionDataSet myDataSet aProcess GetCrossSectionDataStore AddDataSet amp MyDataSet The added data set will override the default cross section data whenever so indicated by its IsApplicable method In addition to the get method G4HadronicProcess also has the method void SetCrossSectionDataStore G4CrossSectionDataStore which allows the user to completely replace the default data store with a new data store It should be noted that a process does not send any information about itself to its associated data store and hence data set objects Thus each data set is assumed to be formulated to calculate cross sections for one and only one type of process Of course this does not prevent different data sets from sharing common data
210. clei It is translated from the Mars23 98 version of the MARS code system MARS code system A fixed number of particles are generated at each vertex with weights assigned as appropriate G4Mars5GeV is valid with energies less than 5 GeV with these particle types pi pit K K KOL KOS proton anti proton and gamma To use this generator create and register a G4Mars5GeV object with an appropriate inelastic process as demonstrated below MyPhysicsList ConstructProcess G4Mars5Gev leadModel new G4Mars5GeV G4ProtonInelasticProcess inelProcess new G4ProtonInelasticProcess inelProcess gt RegisterMe leadModel processManager gt AdddiscreteProcess inelProcess More examples can be found in the LHEP LEAD LHEP LEAD HP QGSC LEAD and QGSC LEAD HP physics lists Additional documentation can be found in G4Mars5GeV Another hadronic leading particle biasing technique is implemented in the G4HadLeadBias utility This method keeps only the most important part of the event as well as representative tracks of each given particle type So the track with the highest energy as well as one of each of Baryon pi0 mesons and leptons As usual appropriate weights are assigned to the particles Setting the SwitchLeadBiasOn environmental variable will activate this utility 3 7 2 1 4 Hadronic Cross Section Biasing Cross section biasing artificially enhances reduces the cross section of a process This may be useful for stud
211. cles The G4ParticleTable class is provided as a dictionary of particles Various utility methods are provided such as FindParticle G4String name find the particle by name FindParticle G4int PDGencoding find the particle by PDG encoding G4ParticleTable is also defined as a singleton object and the static method G4ParticleTable GetParticleTable provides its pointer Particles are registered automatically during construction The user has no control over particle registration 2 4 1 4 Constructing Particles ConstructParticle is a pure virtual method in which the static member functions for all the particles you require should be called This ensures that objects of these particles will be created WARNING You must define All PARTICLE TYPES which are used in your application except for heavy ions All PARTICLE TYPES means not only primary particles but also all other particles which may appear as secondaries generated by physics processes you use Beginning with Geant4 version 8 0 you should keep this rule strictly because all particle definitions are revised to non static objects For example suppose you need a proton and a geantino which is a virtual particle used for simulation and which does not interact with materials The Const ructParticle method is implemented as below Example 2 12 Construct a proton and a geantino void ExNOIPhysicsList ConstructParticle i G4Proton ProtonDefinition G4Ge
212. command line e vis draw Ghosts which draws all the ghost geometries 5 2 6 8 Gflash Parameterization This section describes how to use the Gflash library Gflash is a concrete parameterization which is based on the equations and parameters of the original Gflash package from H1 hep ex 0001020 Grindhammer amp Peters see physics manual and uses the fast simulation facilities of GEANT4 described above Briefly whenever a e e particle enters the calorimeter it is parameterized if it has a minimum energy and the shower is expected to be contained in the calorimeter or parameterization envelope If this is fulfilled the particle is killed as well as all secondaries and the energy is deposited according to the Gflash equations An example provided in examples extended parametrisation gflash shows how to interface Gflash to your application The simulation time is measured so the user can immediately see the speed increase resulting from the use of Gflash 5 2 6 9 Using the Gflash Parameterisation To use Gflash out of the box the following steps are necessary e The user must add the fast simulation process to his process manager void MyPhysicsList addParameterisation G4FastSimulationManagerProcess theFastSimulationManagerProcess new G4FastSimulationManagerProcess theParticlelterator gt reset while theParticleIterator G4ParticleDefinition particle theParticleIterator gt value G4Proc
213. command and its derived classes Methods available for all derived classes These are methods defined in the G4UIcommand base class which should be used from the derived classes e void SetGuidance char Define a guidance line You can invoke this method as many times as you need to give enough amount of guidance Please note that the first line will be used as a title head of the command guidance e void availableForStates G4ApplicationState sl If your command is valid only for certain states of the Geant4 kernel specify these states by this method Currently available states are G4State_PreInit G4State_Init G4State_Idle G4State_GeomClosed and G4State_EventProc Refer to the section 3 4 2 for meaning of each state Please note that the Pause state had been removed from G4ApplicationState void SetRange char range Define a range of the parameter s Use C notation e g x gt 0 amp amp x lt 10 with variable name s defined by the Set ParameterName method For the case of a G4ThreeVector you can set the relation between parameters e g x gt y G4Uldirectory This is a G4Ulcommand derived class for defining a directory G4UIdirectory char directoryPath Constructor Argument is the full path directory which must begin and terminate with G4UlcmdWithoutParameter This is a G amp UIcommand derived class for a command which takes no parameter G4UIcmdWithoutParameter char commandPath G4UImessenge
214. cond physical volume is a replica in a reflected mother The method Divide creates divisions in the given mother If successful the result is a pair of physical volumes where the second physical volume is a division in a reflected mother There exists also two more variants of this method which may specify or not width or number of divisions Notes e n order to reflect hierarchies containing divided volumes it is necessary to explicite ly instantiate a concrete division factory before applying the actual reflection ie G4PVDivisionFactory GetInstance Reflection of generic parameterised volumes is not possible yet 91 Detector Definition and Response Example 4 8 An example of usage of the GGReflectionFactory class include G4ReflectionFactory hh Calor placement with rotation G4double calThickness 100 cm G4double Xpos calThickness 1 5 G4RotationMatrix rotD3 new G4RotationMatrix rotD3 gt rotateY 10 deg G4VPhysicalVolume physiCalor Td new G4PVPlacement rotD3 rotation G4ThreeVector Xpos 0 0 at Xpos 0 0 logicCalor its logical volume defined elsewhere Calorimeter its name JogicHall its mother volume defined elsewhere false no boolean operation 0 copy number Calor reflection with rotation G4Translate3D translation Xpos 0 0 G4Transform3D rotation G4Rotate3D rotD3 G4ReflectX3D reflection G4Transform3D transf
215. coordinates of each plane RMIN radius of inner cone at each plane RMAX radius of outer cone at each plane The polygonal solid GGBREPSolidPolyhedra is a shape defined by an inner and outer polygonal surface and two planes perpendicular to the Z axis Each polygonal surface is created by linking a series of polygons created 73 Detector Definition and Response at different planes perpendicular to the Z axis All these polygons all have the same number of sides sides and are defined at the same Z planes for both inner and outer polygonal surfaces The polygons do not need to fill 360 degrees but have a start and opening angle The constructor takes the following parameters G4BREPSolidPolyhedra const G4String amp pName G4double start angle G4double opening angle G4int sides G4int num_z_planes G4double z_start const G4double z_values const G4double RMIN const G4double RMAX which in addition to its name have the following meaning start angle starting angle opening angle opening angle sides number of sides of each polygon in the x y plane num z planes number of planes perpendicular to the z axis used z start starting value of z z values z coordinates of each plane RMIN radius of inner polygon at each corner RMAX radius of outer polygon at each corner the shape is defined by the number of sides sides of the polygon in the plane perpendicular to
216. crete class you have to specify how a primary event should be generated Actual generation of primary 14 Getting Started with Geant4 Running a Simple Example particles will be done by concrete classes of G4VPrimaryGenerator explained in the following sub section Your G4VUserPrimaryGeneratorAction concrete class just arranges the way primary particles are generated Example 2 19 An example of a G4VUserPrimaryGeneratorAction concrete class using G4ParticleGun For the usage of G4ParticleGun refer to the next subsection ifndef ExN01PrimaryGeneratorAction_h define ExN01PrimaryGeneratorAction_h 1 include G4VUserPrimaryGeneratorAction hh class G4ParticleGun class G4Event class ExNOlPrimaryGeneratorAction public G4VUserPrimaryGeneratorAction public ExNOlPrimaryGeneratorAction ExN01PrimaryGeneratorAction public void generatePrimaries G4Event anEvent private G4ParticleGun particleGun ji endif include ExN01PrimaryGeneratorAction hh include G4Event hh include G4ParticleGun hh include G4ThreeVector hh include G4Geantino hh include globals hh ExNOlPrimaryGeneratorAction ExNOlPrimaryGeneratorAction G4int n_particle 1 particleGun new G4ParticleGun n particle particleGun SetParticleDefinition G4Geantino GeantinoDefinition particleGun SetParticleEnergy 1 0 GeV particleGun SetParticlePosition G4ThreeVector 2 0 m 0 0 m 0 0 m ExNOl
217. ct to the sensitive detector At tracking time the base class G4VReadoutGeometry will provide to your sensitive detector code the G4TouchableHistory in the Readout geometry at the beginning of the step position position of PreStepPoint of G4Step and at this position only This G4TouchableHistory is given to your sensitive detector code through the G4VSensitiveDetector virtual method G4bool processHits G4Step aStep G4TouchableHistory ROhist by the ROhist argument Thus you will be able to use information from both the G4Step and the G4TouchableHistory coming from your Readout geometry Note that since the association is done through a sensitive detector object it is perfectly possible to have several Readout geometries in parallel Definition of a virtual geometry setup The base class for the implementation of a Readout geometry is G4VReadoutGeometry This class has a single pure virtual protected method virtual G4VPhysicalVolume build 0 which you must override in your concrete class The G4VPhysicalVolume pointer you will have to return is of the physical world of the Readout geometry The step by step procedure for constructing a Readout geometry is inherit from G4VReadoutGeometry to define a MyROGeom class 117 Detector Definition and Response implement the Readout geometry in the build method returning the physical world of this geometry The world is specified in the same way as for the dete
218. ction runManager gt SetUserAction new MySteppingAction Initialize G4 kernel runManager gt Initialize Define UI terminal for interactive mode G4UIsession session new G4UIterminal session gt SessionStart delete session job termination delete visManager delete runManager return 0 This example will be executed with the command gt myProgram where myP rogram is the name of your executable The G4 kernel will prompt Idle gt and you can start your session An example session could be Create an empty scene world is default Idle gt vis scene create Add a volume to the scene Idle gt vis scene add volume Create a scene handler for a specific graphics system Change the next line to choose another graphic system Idle gt vis sceneHandler create OGLIX Create a viewer Idle gt vis viewer create Draw the scene etc Idle gt vis scene notifyHandlers 23 Getting Started with Geant4 Running a Simple Example dle gt run verbose 0 dle gt event verbose 0 dle gt tracking verbose 1 dle gt gun particle mu dle gun energy 10 GeV dle run beamOn 1 dle gun particle proton dle gun energy 100 MeV dle run beamOn 3 dle exit For the meaning of the machine state Idle see Section 3 4 2 This mode is useful for running a few events in debug mode and visualizing them Notice that the VisManager is created in the main and
219. ctor Definition and Response pDPhi the angle of the segment in radians Cone or Conical section Similarly to create a cone or conical section one would use the constructor G4Cons const G4String amp pName G4double pRminl G4double pRmaxi1 G4double pRmin2 G4double pRmax2 G4double pDz G4double pSPhi G4double pDPhi In the picture pRminl 5 pRmaxl 10 pRmin2 20 pRmax2 25 pDz 40 pSPhi 0 pDPhi 4 3 Pi giving its name pName and its parameters which are pRminl inside radius at pDz pRmaxl outside radius at pDz pRmin2 inside radius at pDz pRmax2 outside radius at pDz pDz half length in z pSPhi starting angle of the seg ment in radians pDPhi the angle of the segment in radians Parallelepiped A parallelepiped is constructed using G4Para const G4String amp pName G4double dx G4double dy G4double elg G4double alpha G4double theta G4double phi In the picture dx 30 dy 40 dz 60 giving its name pName and its parameters which are dx dy dz Half length in x y z alpha Angle formed by the y axis and by the plane joining the centre of the faces parallel to the z x plane at dy and dy 61 Detector Definition and Response theta Polar angle of the line joining the centres of the faces at dz and dz in z phi Azimuthal angle of the line joining the centres of the faces at dz and dz in z
220. ctor construction a physical volume with no mother The axis system of this world is the same as the one of the world for tracking In this geometry you need to declare the sensitive parts in the same way as in the tracking geometry by setting anon NULL G4VSensitiveDetector pointer in say the relevant G4LogicalVolume objects This sensitive class needs to be there but will not be used You will also need to assign well defined materials to the volumes you place in this geometry but these materials are irrelevant since they will not be seen by the tracking It is foreseen to allow the setting of a NULL pointer in this case of the parallel geometry e inthe construct method of your concrete G4VUserDetectorConstruction class e instantiate your Readout geometry MyROGeom ROgeom new MyROGeom ROName build it ROgeom gt buildROGeomet ry That will invoke your build method e Instantiate the sensitive detector which will receive the ROGeom pointer MySensitive and add this sensitive to the G4SDManager Associate this sensitive to the volume s of the tracking geometry as usual e Associate the sensitive to the Readout geometry MySensitive gt SetROgeometry ROgeom 4 4 4 G4SDManager G4SDManager is the singleton manager class for sensitive detectors Activation inactivation of sensitive detectors The user interface commands activate and inactivate are available to control your sensitive detectors For e
221. d can actually be of any type However in order to fully support the export of a Geant4 solid model via STEP to CAD systems we restrict the use of Boolean operations to this subset of solids But this subset contains all the most interesting use cases The tracking cost for navigating in a Boolean solid in the current implementation is proportional to the number of constituent solids So care must be taken to avoid extensive unecessary use of Boolean solids in performance crit ical areas of a geometry description where each solid is created from Boolean combinations of many other solids Examples of the creation of the simplest Boolean solids are given below G4Box box new G4Box Box 20 mm 30 mm 40 mm G4Tubs cyl new G4Tubs Cylinder 0 50 mm 50 mm 0 twopi r 0 mm 50 mm HAEC 50 mm 50 mm Lp Seat c 0 2 pi G4UnionSolid union new G4UnionSolid Box Cylinder box cyl G4IntersectionSolid intersection new G4IntersectionSolid Box Cylinder box cyl G4SubtractionSolid subtraction new G4SubtractionSolid Box Cylinder box cyl where the union intersection and subtraction of a box and cylinder are constructed The more useful case where one of the solids is displaced from the origin of coordinates also exists In this case the second solid is positioned relative to the coordinate system and thus relative to the first This can be done in two ways e Either by giving a rotation matrix
222. d parametrised volume are also implemented In the replicas a volume is slices to create new sub volumes In parametrised volumes several patterns of volumes can be created 4 1 9 5 Generation of C code MyDetectorConstruction cc By simply pushing a button source code in the form of an include file and a source file are created They are called MyDetectorConstruction cc and hh files They reflect all current user modifications in real time 4 1 9 6 Visualization Examples of individual solids can be viewed with the help of DAWN The visualization of the whole geometry is be done after the compilation of the source code MyDetectorConstruction cc with appropriate parts of Geant4 In particular only the geometry and visualization together with the small other parts they depend on are needed 4 1 10 Converting Geometries from Geant3 21 4 1 10 1 Approach G3toG4 is the Geant4 facility to convert GEANT 3 21 geometries into Geant4 This is done in two stages 1 The user supplies a GEANT 3 21 RZ file rz containing the initialization data structures An executable rztog4 reads this file and produces an ASCII call list file containing instructions on how to build the geometry The source code of rztog4 is FORTRAN 2 A call list interpreter G4BuildGeom cc reads these instructions and builds the geometry in the user s client code for Geant4 4 1 10 2 Importing converted geometries into Geant4 Two examples of how to use the call
223. d tra jectories command Command vis scene add trajectories adds trajectories to the current scene Note that this auto matically issues t racking storeTrajectory 1 so that trajectories are stored by default they are not The visualization is performed with the command run beamOn unless you have non default values for vis scene endOfEventAction or vis scene endOfRunAction described below Command vis scene add trajectories drawing mode 210 Visualization Action The command adds trajectories to the current scene Trajectories are drawn at end of event when the scene in which they are added is current Example Visualization of trajectories Idle gt vis scene add trajectories Idle gt run beamOn 10 Additional note 1 See the section Section 8 7 3 Enhanced Trajectory Drawing for details on how to control how trajectories are color coded Additional note 2 In examples novice N03 command vis scene add trajectories need not be executed since the C method G4Trajectory DrawTrajectory is explicitly described in the event action Therefore the command need not be executed though G UI For more options see the Control UICommands section of this user guide 8 4 7 Visualization of hits vis scene add hits com mand Command vis scene add hits adds hits to the current scene assuming that you have a hit class and that the hits have visualization information The visualization is p
224. dangle 60 Degree shaped like an hyperboloid where each of its segmented pieces can be tilted with a stereo angle It can have inner and outer surfaces with the same stereo angle twistedangle Twisted angle endinnerrad Inner radius at endcap endouterrad Outer radius at endcap halfzlen Half z length dphi Phi angle of a segment Additional constructors are provided allowing the shape to be specified either as the number of segments in phi and the total angle for all segments or e a combination of the above constructors providing instead the inner and outer radii at z 0 with different z lengths along negative and positive z axis 4 1 2 2 Solids made by Boolean operations Simple solids can be combined using Boolean operations For example a cylinder and a half sphere can be com bined with the union Boolean operation Creating such a new Boolean solid requires Two solids A Boolean operation union intersection or subtraction e Optionally a transformation for the second solid The solids used should be either CSG solids for examples a box a spherical shell or a tube or another Boolean solid the product of a previous Boolean operation An important purpose of Boolean solids is to allow the de scription of solids with peculiar shapes in a simple and intuitive way still allowing an efficient geometrical nav igation inside them Detector Definition and Response The solids use
225. der to get performant simulation with acceptable errors The parameters in Geant4 tell the field module what level of integration inaccuracy is acceptable In all quantities which are integrated position momentum energy there will be errors Here however we focus on the error in two key quantities the position and the momentum The error in the energy will come from the momentum integration Three parameters exist which are relevant to the integration accuracy DeltaOneStep is a distance and is roughly the position error which is acceptable in an integration step Since many integration steps may be required for a single physics step DeltaOneStep should be a fraction of the average physics step size The next two parameters impose a further limit on the relative error of the position momentum inaccuracy EpsilonMin and EpsilonMax impose a minimum and maximum on this relative error and take precedence over DeltaOneStep Note if you set EpsilonMin EpsilonMax your value then all steps will be made to this relative precision Example 4 13 How to set accuracy parameters for the global field of the setup G4FieldManager globalFieldManager G4TransportationManager transportMgr G4TransportationManager GetTransportationManager globalFieldManager transportMgr GetFieldManager Relative accuracy values G4double minEps 1 0e 5 Minimum amp value for smallest steps G4double maxEps 1 0e 4 Maximum amp value for lar
226. dition This method generates the step length allowed by its process It also provides a flag to force the interaction to occur regardless of its step length G4double AlongStepGetPhysicallnteractionLength const G4Track amp track G4double previousStepSize G4double currentMinimumStep G4double amp pro posedSafety G4GPILSelection selection This method generates the step length allowed by its process G4double AtRestGetPhysicallnteractionLength const GATrack amp track G4ForceCondition condition This method generates the step length in time allowed by its process It also provides a flag to force the interaction to occur regardless of its step length Other pure virtual methods in G4Vprocess follow virtual G4bool IsApplicable const G4ParticleDefinition amp returns true if this process object is applicable to the particle type virtual void PreparePhysicsTable const G4ParticleDefinitions amp and virtual void BuildPhysicsTable const G4ParticleDefinition amp is messaged by the process manager whenever cross section tables should be prepared and rebuilt due to changing cut off values It is not mandatory if the process is not affected by cut off values virtual void StartTracking and virtual void EndTracking are messaged by the tracking manager at the beginning and end of tracking the current track Other base classes for processes Specialized processes may be derived from seven additiona
227. dium faster than the group velocity of light in that medium Photons are emitted on the surface of a cone whose opening angle with respect to the particle s instantaneous direction decreases as the particle slows down At the same time the 148 Tracking and Physics frequency of the photons emitted increases and the number produced decreases When the particle velocity drops below the local speed of light the radiation ceases and the emission cone angle collapses to zero The photons produced by this process have an inherent polarization perpendicular to the cone s surface at production The flux spectrum polarization and emission of Cerenkov radiation in the AlongStepDoIt method of the class G4Cerenkov follow well known formulae with two inherent computational limitations The first arises from step wise simulation and the second comes from the requirement that numerical integration calculate the average number of Cerenkov photons per step The process makes use of a G4PhysicsTable which contains incremental integrals to expedite this calculation The time and position of Cerenkov photon emission are calculated from quantities known at the beginning of a charged particle s step The step is assumed to be rectilinear even in the presence of a magnetic field The user may limit the step size by specifying a maximum average number of Cerenkov photons created during the step using the SetMaxNumPhotonsPerStep const G4int NumPhotons met
228. doff a rather generous tolerance of 0 1 micron is used by default This tolerance can be adjusted as needed by the application through the run time command geometry test tolerance lt new value gt Finally notice that no mention is made of the possible daughter volumes of A B C and D To keep the code simple only the immediate daughters of a volume are checked at one pass To test these granddaughter volumes the daughters A B C and D each have to be tested themselves in turn To make this more automatic an optional recursive algorithm is included it first tests a target volume then it loops over all daughter volumes and calls itself Pay attention For a complex geometry checking the entire volume hierarchy can be extremely time consuming 4 1 11 3 Detecting overlaps at construction Since release 8 0 the Geant4 geometry modeler provides the ability to detect overlaps of placed volumes nor mal placements or parameterised at the time of construction This check is optional and can be activated when instantiating a placement see G4PVPlacement constructor in Section 4 1 4 1 or a parameterised volume see G4PVParameterised constructor in Section 4 1 4 2 The positioning of that specific volume will be checked against all volumes in the same hierarchy level and its mother volume Depending on the complexity of the geometry being checked the check may require considerable CPU time it is therefore suggested to use it only for debu
229. double red i G4double green G4double blue G4double alpha 1 The following constructor with G4Colour as its argument is also supported Jf Constructor of G4VisAttributes G4VisAttributes G4VisAttributes const G4Colour amp colour Note that colour assigned to a G4VisAttributes object is not always the colour that ultimately appears in the visu alization The ultimate appearance may be affected by shading and lighting models applied in the selected visual ization driver or stand alone graphics system 8 6 3 Forcing attributes As you will see later you can select a drawing style from various options For example you can select your detector components to be visualized in wireframe or with surfaces In the former only the edges of your detector are drawn and so the detector looks transparent In the latter your detector looks opaque with shading effects The forced wireframe and forced solid styles make it possible to mix the wireframe and surface visualization if your selected graphics system supports such visualization For example you can make only the outer wall of your detector wired transparent and can see inside in detail Forced wireframe style is set with the following access function void G4VisAttributes SetForceWireframe G4bool force If you give true as the argument objects for which this set of visualization attributes is assigned are always visualized in wireframe even if in general the
230. e It must be clear that the overall coherency that we provide cannot go beyond the capability of processes to produce particles down to the recommended threshold In other words a process can produce the secondaries down to the recommended threshold and by interrogating the geometry or by realizing when mass to energy conversion can occur recognize when particles below the threshold have to be produced 165 Tracking and Physics 5 4 7 Special tracking cuts One may need to cut given particle types in given volumes for optimisation reasons This decision is under user control and can happen for particles during tracking as well The user must be able to apply these special cuts only for the desired particles and in the desired volumes without introducing an overhead for all the rest The approach is as follows special user cuts are registered in the UserLimits class or its descendant which is associated with the logical volume class The current default list is e max allowed step size e max total track length e max total time of flight min kinetic energy minremaining range The user can instantiate a UserLimits object only for the desired logical volumes and do the association The first item max step size is automatically taken into account by the G4 kernel while the others items must be managed by the user as explained below Example see novice N02 in the Tracker region in order to force the step
231. e GA4UIcmdWith3VectorAndUnit hh include iostream h G4ParticleGunMessenger G4ParticleGunMessenger G4ParticleGun fPtclGun fParticleGun fPtclGun 1 particleTable G4ParticleTable GetParticleTable gunDirectory new G4UIdirectory gun gunDirectory SetGuidance Particle Gun control commands listCmd new G4UIcmdWithoutParameter gun list this listCmd gt SetGuidance List available particles listCmd gt SetGuidance Invoke G4ParticleTable particleCmd new G4UIcmdWithAString gun particle this particleCmd gt SetGuidance Set particle to be generated particleCmd gt SetGuidance geantino is default particleCmd gt SetParameterName particleName true particleCmd gt SetDefaultValue geantino G4String candidateList G4int nPtcl particleTable gt entries for G4int i 0 i lt nPtcl it candidateList particleTable gt GetParticleName i candidateList particleCmd gt SetCandidates candidateList directionCmd new G4UIcmdWith3Vector gun direction this directionCmd gt SetGuidance Set momentum direction directionCmd gt SetGuidance Direction needs not to be a unit vector directionCmd gt SetParameterName Px Py Pz true true directionCmd gt SetRange Px t 0 Py 0 Pz 0 energyCmd new G4UIcmdWithADoubleAndUnit gun energy this energyCmd gt SetGuidance Set kinetic energy energyCmd gt
232. e Rendered photorealistic image with some interactive features zoom rotate translate Limited printing ability pixel graphics not vector graphics e RayTracer Create a jpeg file Forms image by using Geant4 s own tracking to follow photons through the detector e Can show geometry but not trajectories e Can render any geometry that Geant4 can handle such as Boolean solids e Supports shadows transparency and mirrored surfaces e ASCIITree e Text dump of the geometry hierarchy e Not graphical e Control over level of detail to be dumped e Can calculate mass and volume of any hierarchy of volumes 8 1 3 Choose the Driver that Meets Your Needs Ifyou want very responsive photorealistic graphics and have the OpenGL libraries installed e OpenGL is a good solution if you have the Motif extensions this also gives GUI control e Ifyou want very responsive photorealistic graphics plus more interactivity and have the OpenInventor libraries installed e Openlnventor is a good solution e If you want GUI control want to be able to pick on items to inquire about them identity momentum etc perhaps want to render to vector formats and a wireframe look will do HepRep WIRED will meet your needs If you want to render highest quality photorealistic images for use in a poster or a technical design report and you can live without quick rotate and zoom DAWN is the way to go e Ifyou want to render to a 3D format that others can view in
233. e a drawByCharge model named drawCharge 0 by default Subsequent models will be named drawBy Charge 1 drawByCharge 2 etc vis modeling trajectories create drawByCharge Create a drawByCharge model named testChargeModel vis modeling trajectories create drawByCharge testChargeModel Configure drawByCharge 0 model vis modeling trajectories drawByCharge 0 set 1 red vis modeling trajectories drawByCharge 0 set 1 red vis modeling trajectories drawByCharge 0 set 0 white Configure testCharge model through G4Colour components vis modeling trajectories testChargeModel setRGBA 10 11 1 vis modeling trajectories testChargeModel setRGBA 1 0 5 0 5 0 5 1 vis modeling trajectories testChargeModel setRGBA 0 11 0 1 Create a drawByParticleID model named drawByParticleID 0 231 Visualization vis modeling trajectories create drawByParticleID Configure drawByParticleID 0 model vis modeling trajectories drawByParticleID 0 set gamma red vis modeling trajectories drawByParticleID 0 setRGBA e 1 0 1 1 List available models vis modeling trajectories list select drawByParticleID 0 to be current vis modeling trajectories select drawByParticleID 0 Create a drawBy Attribute model named drawByAttribute 0 vis modeling trajectories create drawByAttribute Configure drawByAttribute 0 model vis modeling trajectories drawByAttribute 0 verbose true Select attribute CPN vis modeling trajectories drawByAttri
234. e above member functions for another level the information for that level can be retrieved The top of the history tree is by convention the world volume 6 GetHistoryDepth gives the depth of the history tree 7 MoveUpHistory num moves the current pointer inside the touchable to point num levels up the history tree Thus e g calling it with num 1 will cause the internal pointer to move to the mother of the current volume WARNING this function changes the state of the touchable and can cause errors in tracking if applied to Pre Post step touchables 87 Detector Definition and Response These methods are valid only for the touchable history type as specified also below An update method with different arguments is available so that the information in a touchable can be updated 8 UpdateYourself vol history takes a physical volume pointer and can additionally take a Nav igationHistory pointer 4 1 5 3 Touchable history holds stack of geometry data As shown in Sections Section 4 1 3 and Section 4 1 4 a logical volume represents unpositioned detector ele ments and a physical volume can represent multiple detector elements On the other hand touchables provide a unique identification for a detector element In particular the Geant4 transportation process and the tracking system exploit touchables as implemented in G4TouchableHistory The touchable history is the minimal set of information required to specify the
235. e be defined Primary event generation will be discussed in Section 2 7 2 1 3 2 Optional User Action Classes Geant4 provides five user hook classes e G4UserRunAction e G4UserEventAction e G4UserStackingAction e G4UserTrackingAction G4UserSteppingAction There are several virtual methods in each of these classes which allow the specification of additional procedures at alllevels of the simulation application Details of the user initialization and action classes are provided in Chapter 6 2 1 4 G4U manager and UI CommandSubmission Geant4 provides a category named intercoms G4UImanager is the manager class of this category Using the functionalities of this category you can invoke set methods of class objects of which you do not know the pointer In Example 2 2 the verbosities of various Geant4 manager classes are set Detailed mechanism description and usage of intercoms will be given in the next chapter with a list of available commands Command submission can be done all through the application Getting Started with Geant4 Running a Simple Example Example 2 2 An example of main using interactive terminal and visualization Code modified from the previous example are shown in blue include G4RunManager hh include G4UImanager hh include G4UIterminal hh include G4VisExecutive hh include N02DetectorConstruction hh include NO2PhysicsList hh include N02PrimaryGeneratorAction hh include NO2R
236. e extent can be added on registration or on the command line or neither if the extent of the scene is set by other components Your Draw method will be called whenever needed to refresh the screen or rebuild a graphics database for any chosen viewer The scene can be attached to any scene handler and your drawing will be shown 8 5 11 Standalone Visualization The above raises the possibility of using Geant4 as a standalone graphics package without invoking the run manager The following main program together with a user visualization action and a macro file will allow you to view your drawing interactively on any of the supported graphics systems include globals hh include G4VisExecutive hh include G4VisExtent hh include G4UImanager hh include G4UIterminal hh include G4UItcsh hh include StandaloneVisAction hh int main G4VisManager visManager new G4VisExecutive visManager gt Initialize visManager gt SetUserAction new StandaloneVisAction G4VisExtent 5 m 5 m 5 m 5 m 5 m 5 m 2nd argument optional G4UImanager UI G4UImanager GetUIpointer UI gt ApplyCommand control execute standalone g4m G4UIsession session new G4UIterminal new G4UItcsh session gt SessionStart delete session delete visManager 8 6 Visualization Attributes Visualization attributes are extra pieces of information associated with the visualizable objects This information is necessary
237. e g a geometry varying between two runs in the same job It is considered a change to the geometry setup whenever the shape or dimension of an existing solid is modified the positioning translation or rotation of a volume is changed avolume or a set of volumes tree is removed replaced or added Whenever such a change happens the geometry setup needs to be first opened for the change to be applied and afterwards closed for the optimisation to be reorganised In the general case in order to notify the Geant4 system of the change in the geometry setup the G4RunManager has to be messaged once the new geometry setup has been finalised G4RunManager GeometryHasBeenModified The above notification needs to be performed also if a material associated to a positioned volume is changed in order to allow for the internal materials cuts table to be updated However for relatively complex geometries 102 Detector Definition and Response the re optimisation step may be extremely inefficient since it has the effect that the whole geometry setup will be re optimised and re initialised In cases where only a limited portion of the geometry has changed it may be suitable to apply the re optimisation only to the affected portion of the geometry subtree Since release 7 1 of the Geant4 toolkit it is possible to apply re optimisation local to the subtree of the geometry which has changed The user will have to explicitly ope
238. e physics table When called the Construct method of G4VUserPhysicsList first invokes Const ructParticle and then ConstructProcess The ConstructProcess method must always invoke the AddTrans portation method in order to insure particle transportation AddTransportation must never be overridden G4VUserPhysicsList provides several utility methods for the implementation of the above virtual methods They are presented with comments in the class declaration in Example 6 2 171 User Actions Example 6 2 G4VUserPhysicsList class G4VUserPhysicsList Publier G4VUserPhysicsList virtual G4VUserPhysicsList public with description By calling the Construct method particles and processes are created Voir Construct OP protected with description These two methods of ConstructParticle and ConstructProcess will be invoked in the Construct method each particle type will be instantiated virtual void ConstructParticle 0 each physics process will be instantiated and registered to the process manager of each particle type virtual void ConstructProcess 0 protected with description User must invoke this method in his ConstructProcess implementation in order to insures particle transportation Caution this class must not be overriden void AddTransportation VIM A MTU ADA IAA MAA AA AD AMAA AED ED ATA VUV AIA AAAS public with descrip
239. e user and the number of events simulated during the run Please note that the run identification number is not used by the Geant4 kernel and thus can be arbitrarily assigned at the user s convenience G4Run has pointers to the tables G4VHitsCollection and G4VDigiCollection These tables are associated in case sensitive detectors and digitizer modules are simulated respectively The usage of these tables will be mentioned in Section 4 4 and Section 4 5 3 4 1 2 Manage the run procedures G4RunManager manages the procedures of a run In the constructor of G4RunManager all of the manager classes in Geant4 kernel except for some static managers are constructed These managers are deleted in the destructor of G4RunManager G4RunManager must be a singleton and the pointer to this singleton object can be obtained by the getRunManager static method As already mentioned in Section 2 1 all of the user initialization classes and user action classes defined by the user should be assigned to G4RunManager before starting initialization of the Geant4 kernel The assignments of these user classes are done by SetUserInitialization and SetUserAction methods All user classes defined by the Geant4 kernel will be summarized in Chapter 6 G4RunManager has several public methods which are listed below Initialize All initializations required by the Geant4 kernel are triggered by this method Initializations are construction of the detector geom
240. eam objects defined by Geant4 The usage of these objects is exactly the same as the ordinary cout and cerr except that the output streams will be handled by G4UImanager Thus output strings may be displayed on another window or stored in a file Manipulation of these output streams will be described in Section 7 2 4 These objects should be used instead of the ordinary cout and cerr Getting Started with Geant4 Running a Simple Example 2 2 How to Define a Detector Geometry 2 2 1 Basic Concepts A detector geometry in Geant4 is made of a number of volumes The largest volume is called the World volume It must contain with some margin all other volumes in the detector geometry The other volumes are created and placed inside previous volumes included in the World volume The most simple and efficient shape to describe the World is a box Each volume is created by describing its shape and its physical characteristics and then placing it inside a con taining volume When a volume is placed within another volume we call the former volume the daughter volume and the latter the mother volume The coordinate system used to specify where the daughter volume is placed is the coordinate system of the mother volume To describe a volume s shape we use the concept of a solid A solid is a geometrical object that has a shape and specific values for each of that shape s dimensions A cube with a side of 10 centimeters and a cylinder of rad
241. eant4 are available for only a certain state s G4RunManager controls the state changes of the Geant4 application States of Geant4 are represented by the enu meration G4ApplicationState It has six states through the life cycle of a Geant4 application G4State Prelnit state A Geant4 application starts with this state The application needs to be initialized when it is in this state The application occasionally comes back to this state if geometry physics processes and or cut off have been changed after processing a run G4State_Init state The application is in this state while the Initialize method of G4RunManager is being invoked Meth ods defined in any user initialization classes are invoked during this state 41 Toolkit Fundamentals G4State Idle state The application is ready for starting a run G4State GeomClosed state When BeamOn is invoked the application proceeds to this state to process a run Geometry physics pro cesses and cut off cannot be changed during run processing G4State_EventProc state A Geant4 application is in this state when a particular event is being processed Get CurrentEvent and GetPreviousEvent methods of G4RunManager are available only at this state G4State_Quit state When the destructor of G4RunManager is invoked the application comes to this dead end state Managers of the Geant4 kernel are being deleted and thus the application cannot come back to any other state
242. ece cece nce em em e meme e mene 8 2 3 How to Specify Materials in the Detector sss Hee 8 2 3 General Considerations ceiiiec i ssa eee ka a i Ia ka sa ss 8 2 32 Define a Simple Material 1 ee a ask asses REP Da k a ss ESE p SE 8 2 3 3 Define a Molecule etre ete a a se is as ia dne eerie Dr segete Ne reb DER ean 9 2 3 4 Define a Mixture by Fractional Mass sese 9 2 3 5 Define a Material from the Geant4 Material Database e 9 2 3 6 Print Material Information 2 eere bere ee eter te bue eds re e epp pers 9 2 4 How to Specify Particles dede odes ees come a as elec weet eer up epe eet 10 24 1 Particle Definition rer Perm RE rr Es Sendo sects si ass serra sees 10 24 2 Range CUfs eene aces ig asa ss REIP RUD IM ahead ey 12 2 5 How to Specify Physics Processes eit tte e tree S aa a a peeve k RE 13 2521 Physics PEOCeSSeS sss teret ee aeter dent teresa Sion ssepe a eye deste eroe ny 13 2 52 Managing Processes sss miissen aiaee tee ERR aa RE PRESE ERU Ee P asas 13 2 5 3 Specifying Physics Processes essssssseee III ehem aaa ment entree 14 2 6 How to Generate a Primary Event i etae Pte i a i E a esos 14 2 6 1 Generating Primary Events 20 0 0 cece cee kaka kaka aaa aaa aaa ceca aa aaa aaa aaa aaa 14 2 6 2 GAVPrimaryGenerator i kas ss a is asi sia di ere ii i is ie ERR EE sa E is ss 16 2 7 How to Make an Executable Program sese HH aaa aaa aa
243. ed 3 Set an environment variable on the remote host as follows Remote Host setenv G4VRML_HOST_NAME local host name For example if you are working on the local host named arkoop kek jp set this environment variable as follows Remote Host setenv G4VRML HOST NAME arkoop kek jp This tells a Geant4 process running on the remote host where Geant4 Visualization should be performed i e where the visualized views should be displayed 4 Invoke a Geant4 process and perform visualization with the VRML Network driver For example Idle vis open VRML2 Idle vis drawVolume Idle vis viewer update In step 4 3D scene data are sent from the remote host to the local host as VRML formatted data and the VRML viewer specified in step 3 is invoked by the g4vrmlview process to visualize the VRML data The transferred VRML data are saved as a file named g4 wr1 in the current directory of the local host Further information httpz geant4 kek jp GEANTA vis GEANTA VRML net driver html Further information VRML drivers e httpz geant4 kek jp GEANTA vis GEANTA VRML file driver html http geant4 kek jp GEANT4 Ais GEANT4 VRML net driver html Sample VRML files 204 Visualization http geant4 kek jp GEANT4 vis GEANT4 VRML2_FIG Further information VRML language and browsers e http www vrmlsite com 8 3 9 RayTracer This driver was developed by Makoto Asai and Minamimoto Hirosihma Instutute of Technolo
244. ed In the latter case more voxels will be generated therefore a greater amount of memory will be consumed by the optimisation algorithm pSurfChk if true activates a check for overlaps with existing volumes or paramaterised instances The parameterisation mechanism associated to a parameterised volume is defined in the parameterisation class and its methods Every parameterisation must create two methods ComputeTransformation defines where one of the copies is placed ComputeDimensions defines the size of one copy and aconstructor that initializes any member variables that are required An example is ExNO2ChamberParameterisation that parameterises a series of boxes of different sizes Example 4 4 An example of Parameterised boxes of different sizes class ExN02ChamberParameterisation public G4VPVParameterisation void ComputeTransformation const G4int copyNo G4vPhysicalVolume physVol const void ComputeDimensions G4Box amp trackerLayer const G4int copyNo const G4VPhysicalVolume physVol const These methods works as follows The ComputeTransformation method is called with a copy number for the instance of the parameterisation under consideration It must compute the transformation for this copy and set the physical volume to utilize this transformation void ExN02ChamberParameterisation ComputeTransformation const G4int copyNo G4VPhysicalVolume physVol const G4double Zposition fStartZ copyNo
245. ee ee qi 164 5 4 2 Set production threshold Set Cut methods sse 164 3 43 Apply cut ieu e hune wet ua bon stetisse pr m aaa aaa E ede she tee 165 5 4 4 Why produce secondaries below threshold s sss 165 5 4 5 Cuts in stopping range or in energy ssssssessesseseee e eem em eee 165 5 4 6 Summ ty 1 5 rte ote et n repe Eee RETE RS EET Re ERE si ss 165 5 4 7 Special tracking c ts ws iore eet eere a ii Ua sis te ais aaa i sis 166 5 5 Cuts per REGION Liudas said ette E EH t ee baa bas tese tere ei e saa ai E eh tate sats 167 3 3 1 General Concepts 15 cic teg se e e e eere a ert ee der Rp deer eet 167 5 52 Default Region nri see rarene er EEPOS REP P ERE a vanes PR SERIN PESEE 167 5 5 3 Assigning Production Cuts to a Region sss 167 S6 Physics Table etre eret Rt c eh Cet ere vee EUER ER I reda 168 5 0 1 G n ral Conc pts M UE 168 5 6 2 Material Cuts Couple ize eet eerie rte eet A a a EE KESET e SEEEN 168 5 6 3 File I O for the Physics Table Lk eee ii to ioir aaa aaa aaa aa aa EE EEE aaa 168 5 6 4 Building the Physics Table iet e tp rei i ss 169 Di T User limits Lasas EE 169 5T T1 General Concepts eoru eG ON Si 169 5 7 2 Processes co working with G4UserLimits eese 169 6 UserZACUODS nte hes baa eei ru E a a sates ein oben than a bed doen a 171 vi Geant4 User s Guide for Application Developers 6 1 Mandatory
246. efault setStepPtsSize 5 vis modeling trajectories drawByCharge 0 default setDrawAuxPts true vis modeling trajectories drawByCharge 0 default setAuxPtsSize 5 vis modeling trajectories drawByCharge 0 default setTimeSliceInterval 0 1 ns vis modeling trajectories list 233 Visualization and use a graphics driver that can display by time vis open OGLSX vis drawVolume vis scene add trajectories vis ogl set startTime 0 5 ns vis ogl set endTime 0 8 ns run beamOn vis viewer refresh A good way to see the particles moving through the detector is vis ogl set fade 1 vis ogl set displayHeadTime true control alias timeRange 1 control loop movie loop timeRange 40 0 1 where fade gives a vapour trail effect displayHeadTime displays the time of the leading edge as 2D text and movie loop is a macro file vis ogl set startTime startTime ns timeRange ns From there it s straightforward to Section 8 10 make a movie 8 8 Trajectory Filtering Trajectory filtering allows you to visualise a subset of available trajectories This can be useful if you only want to view interesting trajectories and discard uninteresting ones Trajectory filtering can be run in two modes Soft filtering In this mode uninteresting trajectories are marked invisible Hence they are still written but depending on the driver will not be displayed Some drivers for example the HepRepFile driver will allow you to selectively view the
247. efault value using the next method void SetDefaultValue G4int defVal Define the default value of the integer parameter G4int GetNewIntValue G4String paramString Convert G4String parameter value given by the Set NewValue method of your messenger into integer G4String convertToString G4int currVal Convert the current integer value to G4String which should be returned by the Get CurrentValue method of your messenger G4UIcmdWithADouble This is a G amp UIcommand derived class which takes one double type parameter G4UIcmdWithADouble char commandpath G4UImanager theMessenger Constructor Arguments are the full path command name and the pointer to your messenger void SetParameterName char paramName G4bool omittable Define the name of the double parameter and set the omittable flag If omittable is true you should define the default value using the next method void SetDefaultValue G4double defVal Define the default value of the double parameter G4double GetNewDoubleValue G4String paramString Convert G4String parameter value given by the Set NewValue method of your messenger into double G4String convertToString G4double currVal Convert the current double value to G4String which should be returned by the GetCurrentValue method of your messenger G4UlcmdWithAString This is a G4Ulcommand derived class which takes one string type parameter G4UIcmdWithAString char commandpath G4UIma
248. el libraries are built with maximum granularity i e if a category is a compound this command will build all the related sub libraries not the compound one The top level GNUmakefile in G4INSTALL source will also build in this case a dependency map 1ibname map of each library to establish the linking order automatically at the bin step The map will be placed in SG4LIB SG4SYSTEM gmake global starts the compilation process to build a single compound kernel library per category If issued after gmake both granular and compound libraries will be available NOTE this will consistently increase the disk space required Compound libraries will then be selected by default at link time unless G4LIB USE GRANULAR is specified gmake binor gmake only for examples starts the compilation process to build an executable This command will build implicitly the library associated with the example and link the final application It assumes all kernel libraries are already generated and placed in the correct G4 INSTALL path defined for them The linking order is controlled automatically in case libraries have been built with maximum granularity and the link list is generated on the fly make dll On Windows systems this will start the compilation process to build single compound kernel library per cat egory and generate Dynamic Link Libraries DLLs Once the libraries are generated the process will imply also the deletion of all tempo
249. elay which may occur between absorption and re emission of the photon An example is shown in Example 5 9 Example 5 9 Specification of WLS properties in DetectorConstruction const G4int nEntries 9 G4double PhotonEnergy nEntries 6 6 eV 6 7 eV 6 8 eV 6 9 eV 7 0 eV 7 1 eV 7 2 eV 7 3 eV 7 4 eV G4double RIndexFiber nEntries i 1 60 3 500 2680 1660 14607 15607 14607 1 60 1 60 Ie G4double AbsFiber nEntries Os ma 101 2 qa O Sq 0 oA elt 1E c 0 EMO Em dL s Oras NG Osi E00 5 estan e G4double EmissionFiber nEntries i850 UO O60 Ost 0 5 1 05 5 0 1007 1050 Ir G4Material WLSFiber G4MaterialPropertiesTable MPTFiber new G4MaterialPropertiesTable MPTFiber gt AddProperty RINDEX PhotonEnergy RIndexFiber nEntries MPTFiber gt AddProperty WLSABSLENGTH PhotonEnergy AbsFiber nEntries MPTFiber AddProperty WLSCOMPONENT PhotonEnergy EmissionFiber nEntries MPTFiber AddConstProperty WLSTIMECONSTANT 0 5 ns WLSFiber gt SetMaterialPropertiesTable MPTFiber The process is defined in the PhysicsList in the usual way The process class name is G4OpWLS It should be instantiated with theWLSProcess new G4OpWLS OpWLS and attached to the process manager of the optical photon as a DiscreteProcess The way the WLSTIMECONSTANT is used depends on the time profile method chosen by the user If in the PhysicsList the WLSProcess gt UseTimeGenerator exponential option is set the time
250. eldManager G4TransportationManager GetTransportationManager gt GetFieldManager Set this field to the global field manager fFieldManager gt SetDetectorField fEMfield fMinStep 0 010 mm minimal step of 10 microns flntgrDriver new G4MagInt Driver fMinStep f tepp r fStepper GetNumberOfVariables fChordFinder new G4ChordFinder fIntgrDriver fFieldManager SetChordFinder fChordFinder An example with an electric field is examples extended field field02 where the class FO2ElectricFieldSetup demonstrates how to set these and other parameters and how to choose different Integration Steppers The user can also create their own type of field inheriting from G4VF iela and an associated Equation of Motion class inheriting from G4EqRhs to simulate other types of fields 110 Detector Definition and Response 4 3 2 4 Choosing a Stepper Runge Kutta integration is used to compute the motion of a charged track in a general field There are many general steppers from which to choose of low and high order and specialized steppers for pure magnetic fields By default Geant4 uses the classical fourth order Runge Kutta stepper which is general purpose and robust If the field is known to have specific properties lower or higher order steppers can be used to obtain the same quality results using fewer computing cycles In particular if the field is calculated from a field map a lower ord
251. endently for different purposes The main navigator which is activated automatically at the startup of a simulation program is the navigator used for the tracking and attached the world volume of the main tracking or mass geometry The navigator for tracking can be retrieved at any state of the application by messagging the G4TransportationManager G4Navigator tracking navigator G4TransportationManager GetInstance GetNavigatorForTracking The navigator for tracking also retains all the information of the current history of volumes transversed at a precise moment of the tracking during a run Therefore if the navigator for tracking is used during tracking for locating a generic point in the tree of volumes the actual particle gets also relocated in the specified position and tracking will be of course affected In order to avoid the problem above and provide information about location of a point without affecting the track ing it is suggested to either use an alternative G4Navigator object which can then be assigned to the world volume or access the information through the step Using the step to retrieve geometrical information During the tracking run geometrical information can be retrieved through the touchable handle associated to the current step For example to identify the exact copy number of a specific physical volume in the mass geometry one should do the following Given the pointer to the step object
252. eneratorAction hh include G4Event hh include G4HEPEvtInterface hh ExN04PrimaryGeneratorAction ExN04PrimaryGeneratorAction HEPEvt new GA4HEPEvtInterface pythia event data ExNO4PrimaryGeneratorAction ExNO4PrimaryGeneratorAction delete HEPEvt void ExN04PrimaryGeneratorAction GeneratePrimaries G4Event anEvent HEPEvt gt SetParticlePosition G4ThreeVector 0 cm 0 cm 0 cm HEPEvt gt GeneratePrimaryVertex anEvent 3 6 2 2 Format of the ASCII file An ASCII file which will be fed by G4HEPEvtInterface should have the following format e The first line of each primary event should be an integer which represents the number of the following lines of primary particles 47 Toolkit Fundamentals Each line in an event corresponds to a particle in the HEPEVT common Each line has ISTHEP IDHEP JDAHEP 1 JDAHEP 2 PHEP 1 PHEP 2 PHEP 3 PHEP 5 Refer to the HEPEVT manual for the meanings of these variables Example 3 4 shows an example FORTRAN code to generate an ASCII file Example 3 4 A FORTRAN example using the HEPEVT common KKKKKK KKK ck ck ck ck ck KKK KKK KKK KKK KKKKKKKKK KKK ck ck ck ck ck ck ck ck ck ck ck ckckckckckckck kk ok SUBROUTINE HEP2G4 Convert HEPEVT event structure to an ASCII file L co bem rcds by GAH RE VE BNS 9e KKKKK KKK KKK ck ck ck ck RK KKK KKK KKK KKK KKK ck ck ck ck ck ck
253. ent way to do it however you can visualize a transient piece of solid or physical volume with a temporary assigned set of visualization attributes Class G4LogicalVolume holds a pointer of G4VisAttributes This field is set and referenced with the following access functions ff Set functions of G4VisAttributes void G4VisAttributes SetVisAttributes const G4VisAttributes pVA void G4VisAttributes SetVisAttributes const G4VisAttributes amp VA ff Get functions of G4VisAttributes const G4VisAttributes G4VisAttributes GetVisAttributes const The following is sample C source codes for assigning a set of visualization attributes with cyan colour and forced wireframe style to a logical volume f C source codes Assigning G4VisAttributes to a logical volume Instantiation of a logical volume myTargetLog new G4LogicalVolume myTargetTube BGO TLog 0 0 0 Instantiation of a set of visualization attributes with cyan colour G4VisAttributes calTubeVisAtt new G4VisAttributes G4Colour 0 1 1 Set the forced wireframe style calTubeVisAtt gt SetForceWireframe true Assignment of the visualization attributes to the logical volume myTargetLog gt SetVisAttributes calTubeVisAtt end of C source codes Note that the life of the visualization attributes must be at least as long as the objects to which they are assigned it is the users responsibility to ensure this and to delete
254. ently boolean operations are not implemented at the level of physical volume So pMany must be false However an alternative implementation of boolean operations exists In this approach a solid can be created from the union intersection or subtraction of two solids See Section 4 1 2 2 above for an explanation of this The mother volume must be specified for all volumes except the world volume An alternative way to specify a Placement utilizes a different method to place the volume The solid itself is moved by rotating and translating it to bring it into the system of coordinates of the mother volume This active method can be utilized using the following constructor G4PVPlacement G4Transform3D solidTransform G4LogicalVolume pCurrentLogical const G4String pName G4LogicalVolume pMotherLogical G4bool pMany 78 Detector Definition and Response G4int pCopyNo G4bool pSurfChk false An alternative method to specify the mother volume is to specify its placed physical volume It can be used in either of the above methods of specifying the placement s position and rotation The effect will be exactly the same as for using the mother logical volume Note that a Placement Volume can still represent multiple detector elements This can happen if several copies exist of the mother logical volume Then different detector elements will belong to different branches of the tree of the hierarchy of geometrical volumes 4 1 4 2
255. er is a flux In our scorers the current is simply defined as the number of particles with the particle s weight at a certain surface or volume while the flux takes the particle s injection angle to the geometry into account The current and flux are usually defined at a surface but volume current and volume flux are also provided G4PSFlatSurfaceCurrent Flat surface current is a surface based scorer The present implementation is limited to scoring only at the Z surface of a G4Box solid The quantity is defined by the number of tracks that reach the surface The user must choose a direction of the particle to be scored The choices are fCurrent_In fCurrent_Out or fCurrent_InOut one of which must be entered as the second argument of the constructor Here fCurrent In scores incoming particles to the cell while fCurrent Out scores only outgoing particles from the cell fCurrent InOut scores both directions The current is multiplied by particle weight and is normalized for a unit area G4PSSphereSurfaceCurrent Sphere surface current is a surface based scorer and similar to the G4PSFlatSurfaceCurrent The only differ ence is that the surface is defined at the inner surface of a G4Sphere solid G4PSPassageCurrent Passage current is a volume based scorer The current is defined by the number of tracks that pass through the volume A particle weight is applied at the exit point A passage current is defined for a volume G4PSFlatSurfaceFlux Fl
256. er stepper is recommended The less smooth the field is the lower the order of the stepper that should be used The choice of lower order steppers includes the third order stepper G4SimpleHeum the second order G4ImplicitEuler and G4SimpleRunge and the first order G4ExplicitEuler A first order stepper would be useful only for very rough fields For somewhat smooth fields intermediate the choice between second and third order steppers should be made by trial and error Trying a few different types of steppers for a particular field or application is suggested if maximum performance is a goal The choice of stepper depends on the type of field magnetic or general A general field can be an electric or electromagnetic field it can be a magnetic field or a user defined field which requires a user defined equation of motion For a general field several steppers are available as alternatives to the default G4ClassicalRK4 G4int nvar 8 To integrate time amp energy de in addition to position momentum G4EgMagElectricField fEquation new G4EqMagElectricField fEMfield fStepper new G4SimpleHeum fEquation nvar 3rd order a good alternative to ClassicalRK fStepper new G4SimpleRunge fEquation nvar 2nd order for less smooth fields fStepper new G4CashKarpRKF45 fEquation 4 5th order for very smooth fields Specialized steppers for pure magnetic fields are also available They take into account the f
257. er volume G4vPhysicalVolume mother touchl GetVolume depth 1 gracie eher NECI IR o oo S o ME Frequentry Asked Questions To get the copy number of the mother volume G4int copyNumber touch1 gt GetCopyNumber depth 1 grandMothari depths 5 4 GSES os To get the process which has limited the current step G4VProcess aProcess point2 GetProcessDefinedStep To check that the particle has just entered in the current volume i e it is at the first step in the volume the preStepPoint is at the boundary if pointl gt GetStepStatus fGeomBoundary To check that the particle is leaving the current volume i e it is at the last step in the volume the post StepPoint is at the boundary if point2 gt GetStepStatus fGeomBoundary In the above situation to get touchable of the next volume G4TouchableHandle touch2 point2 gt GetTouchableHandle From t ouch2 all informations on the next volume can be retrieved as above Physics quantities are available from the step G4Step or from the track G4Track To get the energy deposition step length displacement and time of flight spent by the current step G4double eDeposit step gt GetTotalEnergyDeposit G4double sLength S5tep gt 2GetStepkength y G4ThreeVector displace step gt GetDeltaPosition G4double tof step GetDeltaTime To get momentum kinetic energy and global time time since the beginning of the event of the
258. erProcess This is described in the User s Guide for Toolkit Developers section 3 9 6 5 2 6 5 The G4FastSimulationManagerProcess Class This G4VProcess serves as an interface between the tracking and the parameterisation At tracking time it col laborates with the G4FastSimulationManager of the current volume if any to allow the models to trigger If no manager exists or if no model issues a trigger the tracking goes on normally In the present implementation you must set this process in the G4ProcessManager of the particles you parame terise to enable your parameterisation The processes ordering is H n id n Multiple Scattering G4FastSimulationManagerProcess G4Transportation ois n 2 ioi This ordering is important if you use ghost geometries since the G4FastSimulationManagerProcess will provide navigation in the ghost world to limit the step on ghost boundaries The G4FastSimulationManager must be added to the process list of a particle as a continuous and discrete process if you use ghost geometries for this particle You can add it as a discrete process if you don t use ghosts The following code registers the G4FastSimulationManagerProcess with all the particles as a discrete and contin uous process void MyPhysicsList addParameterisation G4FastSimulationManagerProcess theFastSimulationManagerProcess new G4FastSimulationManagerProcess theParticlelterator gt reset while the
259. erator point 1 since the static interface of HEPRandom is the only one used within the Geant4 toolkit 3 2 2 1 HEPRandom engines The class HepRandomEngine is the abstract class defining the interface for each random engine It implements the get Seed and get Seeds methods which return the initial seed value and the initial array of seeds Gf any respectively Many concrete random engines can be defined and added to the structure simply making them inheriting from HepRandomEngine Several different engines are currently implemented in HepRandom we describe here five of them HepJamesRandom It implements the algorithm described in F James Comp Phys Comm 60 1990 329 for pseudo random number generation This is the default random engine for the static generator it will be invoked by each distribution class unless the user sets a different one DRand48Engine Random engine using the drand48 and srand48 system functions from C standard library to imple ment the flat basic distribution and for setting seeds respectively DRand46Engine uses the seed48 function from C standard library to retrieve the current internal status of the generator which is represented by 3 short values DRand48Engine is the only engine defined in HEPRandom which intrinsically works in 32 bits precision Copies of an object of this kind are not allowed RandEngine Simple random engine using the rand and srand system functions from
260. erformed with the command run beamOn unless you have non default values for vis scene endOfEventAction or vis scene endOfRunAction described above 8 4 8 HepRep Attributes for Hits The HepRep file formats HepRepFile and HepRepXML attach various attributes to hits such that you can view these attributes label trajectories by these attributes or make visibility cuts based on these attributes Examples of adding HepRep attributes to hit classes can be found in examples extended analysis A01 and extended runAn dEvent REO1 For example in example REO1 s class REO1CalorimeterHit cc available attributes will be Hit Type Track ID ZCell ID e Phi Cell ID Energy Deposited Energy Deposited by Track Position Logical Volume You can add additional attributes of your choosing by modifying the relevant part of the hit class look for the methods GetAttDefs and CreateAttValues 8 4 9 Basic camera workings vis viewer commands Commands in the command directory vis viewer set camera parameters and drawing style of the current viewer which corresponds to Step 5 Note that the camera parameters and the drawing style should be set separately for each viewer They can be initialized to the default values with command vis viewer reset Some visualization systems such as the VRML and HepRep browsers also allow camera control from the standalone graphics application 211 Visualization Just a few of the
261. erial G4 PLASTIC SC VINYLTOLUENE G4Material Si02 man gt FindOrBuildMaterial G4 SILICON DIOXIDE G4Material Air man gt FindOrBuildMaterial G4 AIR HEP materials G4Material PbWO4 man gt FindOrBuildMaterial G4_PbWO4 G4Material lAr man gt FindOrBuildMaterial G4 lAr G4Material vac man gt FindOrBuildMaterial G4 Galactic define gas material at non STP conditions T 120K P 0 5atm G4Material coldAr man gt ConstructNewGasdMaterial ColdAr G4 Ar 120 kelvin 0 5 atmosphere print the table of materials G4cout lt lt G4Material GetMaterialTable lt lt endl return EXIIT SUCCESS 4 2 4 The Tables 4 2 4 1 Print a constituent The following shows how to print a constituent G4cout lt lt elU lt lt endl G4cout lt lt Air lt lt endl 107 Detector Definition and Response 4 2 4 2 Print the table of materials The following shows how to print the table of materials G4cout lt lt G4Material GetMaterialTable lt lt endl 4 3 Electromagnetic Field 4 3 1 An Overview of Propagation in a Field Geant4 is capable of describing and propagating in a variety of fields Magnetic fields electric fields and electro magnetic uniform or non uniform can specified for a Geant4 setup The propagation of tracks inside them can be performed to a user defined accuracy In order to propagate a track inside a field the equation of motion of the partic
262. erlapping It may also be intended that volumes are positioned within the same mother volume such that they do not intersect one another When such volumes do intersect they are also defined as overlapping The problem of detecting overlaps between volumes is bounded by the complexity of the solid model description Hence it requires the same mathematical sophistication which is needed to describe the most complex solid topol ogy in general However a tunable accuracy can be obtained by approximating the solids via first and or second order surfaces and checking their intersections 4 1 11 2 Detecting overlaps built in kernel commands In general the most powerful clash detection algorithms are provided by CAD systems treating the intersection between the solids in their topological form Geant4 provides some built in run time commands to activate verification tests for the user defined geometry geometry test grid test recursion flag to start verification of geometry for overlapping regions based on standard lines grid setup If the recursion flag is 98 Detector Definition and Response set to false the default the check is limited to the first depth level of the geometry tree otherwise it visits recursively the whole geometry tree In the latter case it may take a long time depending on the complexity of the geometry geometry test cylinder_test recursion_flag shoots lines according to a cylindrical pa
263. erogel density ncomponents 3 Aerog AddMaterial SiO2 fractionmass 62 5 perCent Aerog gt AddMaterial H20 fractionmass 37 4 perCent Aerog gt AddElement elC fractionmass 0 1 perCent examples of gas in non STP conditions density 27 mg cm3 pressure 90 atmosphere temperature 325 kelvin G4Material CO2 new G4Material name Carbonic gas density ncomponents 2 kStateGas temperature pressure CO2 gt AddElement elC natoms 1 CO2 gt AddElement elO natoms 2 density 0 3 mg cm3 pressure 2 GEmospolas ES temperature 500 kelvin G4Material steam new G4Material name Water steam density ncomponents 1 kStateGas temperature pressure steam gt AddMaterial H20 fractionmass 1 What about vacuum Vacuum is an ordinary gas with very low density density universe mean density from PhysicalConstants h pressure l e 19 pascal temperature 0 1 kelvin new G4Material name Galactic z 1 a 1 01 g mole density kStateGas temperature pressure density 1 e 5 g cm3 pressure 2 e 2 bar temperature STP_Temperature rom PhysicalConstants h G4Material beam new G4Material name Beam density ncomponents 1 kStateGas temperature pressure beam gt AddMaterial Air fractionmass 1 106 Detector Definition and Response print the table of materials G4cout lt lt G4Material GetMaterialTable lt lt endl return
264. ertex is PtO vt2 and the fourth vertex is Pt O vt 3 in anti clockwise or der when looking from the outside 4 1 3 Logical Volumes The Logical Volume manages the information associated with detector elements represented by a given Solid and Material independently from its physical position in the detector A Logical Volume knows which physical volumes are contained within it It is uniquely defined to be their mother volume A Logical Volume thus represents a hierarchy of unpositioned volumes whose positions relative to one another are well defined By creating Physical Volumes which are placed instances of a Logical Volume this hierarchy or tree can be repeated A Logical Volume also manages the information relative to the Visualization attributes Section 8 6 and user de fined parameters related to tracking electro magnetic field or cuts through the G4UserLimits interface By default tracking optimization of the geometry voxelization is applied to the volume hierarchy identified by a logical volume It is possible to change the default behavior by choosing not to apply geometry optimization for a given logical volume This feature does not apply to the case where the associated physical volume is a parameterised volume in this case optimization is always applied G4LogicalVolume G4VSolid Sos dr G4Material pMaterial const G4String Name G4FieldManager pFieldMgr 0 G4VSensitiveDetector pSDetector 0 G4UserLim
265. es They are the front end classes of Geant4 which interface with their respective graphical user interfaces GAG Geant4 Adaptive GUI and Gain Geant4 adaptive interface for network While GAG must run on the same system Windows or Unixen as a Geant4 application Gain can run on a remote system Windows Linux etc to which JVM Java Virtual Machine is installed A Geant4 application is invoked on a Unix Linux system and behaves as a network server It opens a port waiting the connection from the Gain Gain is capable to connect to multiple Geant4 servers on Unixen systems at different institutes Client GUI GAG and Gain have almost similar look and feel So GAG s functionalities are briefly introduced here Please refer to the above URL for details and to download the client GUIs GAG is a Graphical User Interface tool with which user can set parameters and execute commands It is adaptive since GAG reflects the internal states of Geant4 that is a state machine GAG is based on the server client model GAG is the server while Geant4 executables are clients Hence GAG does nothing by itself and it must invoke an executable simulation program Geant4 s front end class G4UIGAG must be instantiated to communicate with GAG This runs on Linux and Windows 2000 GAG is written in Java and its Jar Java Archive file is available from the above URL See the same pages to know how to install and run Java programs GAG has following functions
266. es up to the root of the geometrical tree A touchable is a geometrical entity volume or solid which has a unique placement in a detector description It is represented by an abstract base class which can be implemented in a variety of ways Each way must provide the capabilities of obtaining the transformation and solid that is described by the touchable 4 1 5 2 What can a Touchable do All G4VTouchab1e implementations must respond to the two following requests where in all cases by depth it is meant the number of levels up in the tree to be considered the default and current one is 0 1 GetTranslation depth 2 GetRotation depth that return the components of the volume s transformation Additional capabilities are available from implementations with more information These have a default imple mentation that causes an exception Several capabilities are available from touchables with physical volumes 3 GetSolid depth gives the solid associated to the touchable 4 GetVolume depth gives the physical volume 5 GetReplicaNumber depth or GetCopyNumber depth which return the copy number of the physical volume replicated or not Touchables that store volume hierarchy history have the whole stack of parent volumes available Thus it is possible to add a little more state in order to extend its functionality We add a pointer to a level and a member function to move the level in this stack Then calling th
267. es how the GNUmake infrastructure is implemented in Geant4 and provides a quick reference guide for the user installer about the most important environment variables defined 267 Appendix 5 1 The GNUmake system in Geant4 As described in Section 2 1 of the Installation Guide the GNUmake process in Geant4 is mainly controlled by the following GNUmake script files gmk scripts are placed in SG4INSTALL config e architecture gmk defining all the architecture specific settings and paths System settings are stored in SG4INSTALL config sys in separate files e common gmk defining all general GNUmake rules for building objects and libraries e globlib gmk defining all general GNUmake rules for building compound libraries binmake gmk defining the general GNUmake rules for building executables GNUmake scripts placed inside each directory in the G4 distribution and defining directives specific to build a library or a set of sub libraries or and executable To build a single library or a set of sub libraries or an executable you must explicitly change your current directory to the one you re interested in and invoke the gmake command from there gmake global for building a compound library Here is a list of the basic commands or GNUmake targets one can invoke to build libraries and or executables e gmake starts the compilation process for building a kernel library or a library associated with an example Kern
268. es the macroscopic properties of matter density state temperature pressure as well as macroscopic quantities like radiation length mean free path dE dx etc The G4Material class is the one which is visible to the rest of the toolkit and is used by the tracking the geometry and the physics It contains all the information relative to the eventual elements and isotopes of which it is made at the same time hiding the implementation details 2 3 2 Define a Simple Material In the example below liquid argon is created by specifying its name density mass per mole and atomic number Getting Started with Geant4 Running a Simple Example Example 2 7 Creating liquid argon G4double density 1 390 g cm3 G4double a 39 95 g mole G4Material lAr new G4Material name liquidArgon z 18 a density The pointer to the material Ar will be used to specify the matter of which a given logical volume is made G4LogicalVolume myLbox new G4LogicalVolume aBox lAr Lbox 0 0 0 2 3 3 Define a Molecule In the example below the water H20 is built from its components by specifying the number of atoms in the molecule Example 2 8 Creating water by defining its molecular components a 1 01 g mole G4Element elH new G4Element name Hydrogen symbol H z 1 a a 16 00 g mole G4Element elO new G4Element name Oxygen symbol 0 z 8 a density 1 000 g cm3 G4Material
269. essManager pmanager particle GetProcessManager pmanager gt AddProcess theFastSimulationManagerProcess 1 0 0 The envelope in which the parameterization should be performed must be specified below G4Region m calo region and the GFlashShowerModel must be assigned to this region Furthermore the class es GFlashParticleBounds which provides thresholds for the parameterization like minimal energy etc GflashHitMaker a helper class to generate hits in the sensitive detector and GFlashHomoShowerParamteri sation which does the computations must be constructed by the user at the moment and assigned to the GFlashShowerModel Please note that at the moment only homogeneous calorimeters are supported m theFastShowerModel new GFlashShowerModel fastShowerModel m calo region m theParametrisation new GFlashHomoShowerParamterisation matManager getMaterial mat m theParticleBounds new GFlashParticleBounds m theHMaker new GFlashHitMaker m theFastShowerModel SetParametrisation m theParametrisation m theFastShowerModel gt SetParticleBounds m theParticleBounds m theFastShowerModel gt SetHitMaker m theHMaker The user must also set the material of the calorimeter since the computation depends on the material tis mandatory to use G4VGFlashSensitiveDetector as additional base class for the sensitive detector 159 Tracking and Physics class ExGflashSensitiveDetector public G4V
270. ether with an annotated example is provided in the GDML example page GDML Geometry Description Markup Language is a markup language based on XML and suited for the description of detector geometry models It allows for easy exchange of geometry data in a human readable XML based description and structured formatting 4 2 Material 4 2 1 General considerations In nature materials chemical compounds mixtures are made of elements and elements are made of isotopes Geant4 has three main classes designed to reflect this organization Each of these classes has a table which is a static data member used to keep track of the instances of the respective classes created G4lsotope This class describes the properties of atoms atomic number number of nucleons mass per mole etc G4Element This class describes the properties of elements effective atomic number effective number of nucleons ef fective mass per mole number of isotopes shell energy and quantities like cross section per atom etc G4Material This class describes the macroscopic properties of matter density state temperature pressure and macro scopic quantities like radiation length mean free path dE dx etc 103 Detector Definition and Response Only the G4Material class is visible to the rest of the toolkit and used by the tracking the geometry and the physics It contains all the information relevant to its constituent elements and isotopes while
271. etry and set up of sensitive detectors and or digitizer modules construction of particles and physics processes calculation of cross section tables This method is thus mandatory before proceeding to the first run This method will be invoked automatically for the second and later runs in case some of the initialized quantities need to be updated 40 Toolkit Fundamentals BeamOn G4int numberOfEvent This method triggers the actual simulation of a run that is an event loop It takes an integer argument which represents the number of events to be simulated GetRunManager This static method returns the pointer to the GZRunManager singleton object GetCurrentEvent This method returns the pointer to the G4Event object which is currently being simulated This method is available only when an event is being processed At this moment the application state of Geant4 which is explained in the following sub section is EventProc When Geant4 is in a state other than EventProc this method returns nu11 Please note that the return value of this method is const G4Event and thus you cannot modify the contents of the object SetNumberOfEventsToBeStored G4int nPrevious When simulating the pile up of more than one event it is essential to access more than one event at the same moment By invoking this method G4RunManager keeps nPrevious G4Event objects This method must be invoked before proceeding to BeamOn
272. events electron 1 GeV to the direction 1 0 0 gun particle e gun energy 1 GeV run beamOn 100 Indeed you can re execute your program with different run conditions without recompiling anything Digression many G4 category of classes have a verbose flag which controls the level of verbosity Usually verbose 0 means silent For instance run verboseisforthe RunManager event verbose is for the EventManager e tracking verbose is for the TrackingManager etc 2 9 4 Interactive Mode Driven by Command Lines Below is an example of the main program for an application which will run interactively waiting for command lines entered from the keyboard 22 Getting Started with Geant4 Running a Simple Example Example 2 23 An example of the main routine for an application which will run interactively waiting for commands from the keyboard inte main tint arger charte Arg i Construct the default run manager G4RunManager runManager new G4RunManager set mandatory initialization classes runManager gt SetUserInitialization new MyDetectorConstruction runManager gt SetUserInitialization new MyPhysicsList visualization manager G4VisManager visManager new G4VisExecutive visManager gt Initialize set user action classes runManager gt SetUserAction new MyPrimaryGeneratorAction runManager gt SetUserAction new MyRunAction runManager gt SetUserAction new MyEventA
273. f 0 966 8 2 NIST Compounds 6 G4 A 150 TISSUE 14127 65 1 d 0 101327 6 0 7755 T 0 035057 8 0 0523159 9 0 017422 20 0 018378 3 G4_ACETONE 0 7899 64 2 0 104122 6 0 620405 8 0 275473 2 G4_ACETYLENE 0 0010967 58 2 0 077418 6 0 922582 3 G4_ADENINE 1 35 71 4 0 037294 6 0 44443 7 0 518276 13 G4 ADIPOSE TISSUE ICRP 0 92 63 2 0 119477 6 0 63724 7 0 00797 8 07232333 1 0 0005 2 2e 05 5 0 00016 6 0 00073 7 0 00119 9 0 00032 20 2e 05 26 2e 05 30 2e 05 4 G4 AIR 0 00120479 85 7 0 000124 7 0 755268 8 0 231781 276 Appendix 14 8 0 012827 G4_ALANINE 0 0791899 6 0 404439 7 0 157213 8 0 359159 G4_ALUMINUM_OXIDE Al 20 3 8 0 470749 3 0 529251 G4 AMBER 0 10593 6 0 788974 8 0 105096 G4 AMMONIA 0 177547 7 0 822453 G4 ANILINE 0 075759 6 0 773838 7 0 150403 G4 ANTHRACENE 0 05655 6 0 94345 G4 B 100 BONE 0 0654709 6 0 536944 7 0 0215 8 0 032085 9 0 167411 20 0 176589 G4 BAKELITE als 0 057441 6 0 774591 8 0 167968 G4_BARIUM_FLUORIDE 9 0 21672 56 0 78328 G4_BARIUM_SULFATE 8 0 274212 16 0 137368 56 0 58842 G4_BENZENE T 0 077418 6 0 922582 G4 BERYLLIUM OXIDE 4 0 36032 8 0 63968 G4 BGO 8 0 154126 32 0 17482 83 0 671054 G4 BLOOD ICRP 0 101866 6 0 10002 7 0 02964 8 0 759414 1 0 00185 2 4e 05 4 3e 05 5 0 00035 6 0 00185 7 0 00278 9 0 00163 20 6e 05 26 0 00046 30 1e 05 G4 BONE COMPACT ICRU 0 063984 6 0 278 7 0 027 8 0 410016 2 0 002 5 0 07 6 0 002 20 0 147 G4_BONE
274. f G4ProcessManager An example of process registration is given in the G4VUserPhysicsList AddTransportation method Registration in G4ProcessManager is a complex procedure for other processes and particles because the relations between processes are crucial for some processes Please see Section 5 2 and the example codes An example of electromagnetic process registration for photons is shown below Example 2 18 Register processes for a gamma void MyPhysicsList ConstructProcess Define transportation process AddTransportation electromagnetic processes ConstructEM void MyPhysicsList ConstructEM Get the process manager for gamma G4ParticleDefinition particle G4Gamma GammaDefinition G4ProcessManager pmanager particle GetProcessManager Construct processes for gamma G4PhotoElectricEffect thePhotoElectricEffect new G4PhotoElectricEffect G4ComptonScattering theComptonScattering new G4ComptonScattering G4GammaConversion theGammaConversion new G4GammaConversion Register processes to gamma s process manager pmanager gt AddDiscreteProcess thePhotoElectricEffect pmanager gt AddDiscreteProcess theComptonScattering pmanager gt AddDiscreteProcess theGammaConversion 2 6 How to Generate a Primary Event 2 6 1 Generating Primary Events G4VuserPrimaryGeneratorAction is one of the mandatory classes available for deriving your own concrete class In your con
275. f G4Track will be described in Section 5 1 Besides above three classes G4ParticleWithCuts class plays an important role It provides the functionality to convert the cut value in range into energy thresholds for all materials 5 3 2 Definition of a particle There are a large number of elementary particles and nuclei Geant4 provides the G4ParticleDefinition class to represent particles and various particles such as the electron proton and gamma have their own classes derived from G4ParticleDefinition We do not need to make a class in Geant4 for every kind of particle in the world There are more than 100 types of particles defined in Geant4 by default Which particles should be included and how to implement them is determined according to the following criteria Of course the user can define any particles he wants Please see the User s Guide For ToolKit Developers 5 3 2 1 Particle List in Geant4 This list includes all particles in Geant4 and you can see properties of particles such as e PDG encoding e mass and width e spin isospin and parity life time and decay modes e quark contents Here is a list of particles in Geant4 This list is generated automatically by using Geant4 functionality so listed values are same as those in your Geant4 application as far as you do not change source codes Categories e gluon quarks di quarks e leptons mesons e baryons e ions e others 5 3 2 2 Classification of
276. f green G4Colour blue 0407 O20 ta 9 7 Jus G4Colour cyan CORIO oO al A Wh eZ G4Colour magenta 1 0 0 0 1 0 magenta GAColoum vellow 4 0 1 0 090 p 44 vellow It is also possible to instantiate common colours through static public data member functions static const G4Colour amp White Oe static const G4Colour amp Gray Oe static const G4Colour amp Grey On static const G4Colour amp Black OE static const G4Colour amp Red DET static const G4Colour amp Green ET static const G4Colour amp Blue OR static const G4Colour Cyan DET Static const G4Colour amp Magenta 225 Visualization static const G4Colour amp Yellow For example a local G4Colour could be constructed as G4Colour myRed G4Colour Red After instantiation of a G4Colour object you can access to its components with the following access functions G4double G4Colour GetRed const Get the red component G4double G4Colour GetGreen const Get the green component G4double G4Colour GetBlue const Get the blue component 8 6 2 2 Colour Map G4Colour also provides a static colour map giving access to predefined G4Colour s through a G4String key The default mapping is G4String G4Colour white G4Colour White gray G4Colour Gray grey G4Colour Grey black G4Colour Black reg G4Colour Red green G4Colour Green blue G4Colour Blue cyan G4Colour Cyan magenta G4Col
277. filled with water for a typical linac used for intensity modulated radiation therapy The experimental set up is very similar to one used in clinical practice microbeam simulates the cellular irradiation beam line installed on the AIFIRA electrostatic accelerator facility located at CENBG Bordeaux Gradignan France purging magnet illustrating an application that simulates electrons traveling through a 3D magnetic field used in a medical environment for simulating a strong purging magnet in a treatment head radiation monitor illustrating an application for the study of the effects of a chip carrier on silicon radiation monitoring devices used in the LHC environment radioprotection illustrating an application to evaluate the dose in astronauts in vehicle concepts and Moon surface habitat configurations in a defined interplanetary space radiation environment gammaray telescope illustrating an application to typical gamma ray telescopes with a flexible configu ration xray telescope illustrating an application for the study of the radiation background in a typical X ray tele scope xray fluorescence illustrating the emission of X ray fluorescence and PIXE underground physics illustrating an underground detector for dark matter searches cosmicray charging illustrating an application aimed at simulating the electrostatic charging of isolated test masses in the LISA mission by galactic cosmic ray protons and helium nuclei
278. full genealogy of a given physical volume up to the root of the geo metrical tree These touchable volumes are made available to the user at every step of the Geant4 tracking in G4VUserSteppingAction To create access a G4TouchableHistory the user must message G4Navigator which provides the method CreateTouchableHistoryHandle G4TouchableHistoryHandle CreateTouchableHistoryHandle const this will return a handle to the touchable The methods that differentiate the touchable history from other touchables since they have meaning only for this type are G4int GetHistoryDepth const G4int MoveUpHistory G4int num_levels 1 The first method is used to find out how many levels deep in the geometry tree the current volume is The second method asks the touchable to eliminate its deepest level As mentioned above MoveUpHistory num significantly modifies the state of a touchable 4 1 6 Creating an Assembly of Volumes G4AssemblyVolume is a helper class which allows several logical volumes to be combined together in an arbitrary way in 3D space The result is a placement of a normal logical volume but where final physical volumes are many However an assembly volume does not act as a real mother volume being an envelope for its daughter volumes Its role is over at the time the placement of the logical assembly volume is done The physical volume objects become independent copies of each of the assembled logical volumes T
279. function is given below 26 Getting Started with Geant4 Running a Simple Example 2 10 4 Writing the main Method to Include Visualization Now we explain how to write a visualization manager and the main function for Geant4 visualization In order that your Geant4 executable is able to perform visualization you must instantiate and initialize your Visualiza tion Manager in the main function The typical main function available for visualization is written in the following style Example 2 26 The typical main routine available for visualization ff C source codes main function for visualization ifdef GAVIS USE include G4VisExecutive hh endif init maintint argc chara argyk Instantiation and initialization of the Visualization Manager ifdef G4VIS_USE visualization manager G4VisManager visManager new G4VisExecutive visManager gt Initialize endif Job termination ifdef G4VIS USE delete visManager endif return 0 Jf end of C In the instantiation initialization and deletion of the Visualization Manager the use of the macro G4VIS_USE is recommended This is set unless the environment variable G4VIS_NONE is set This allows one easily to build an executable without visualization if required without changing the code but remember you have to force re compilation whenever you change the environment Note that it is your responsibility to delete the instantia
280. g of the same name Also the C pre processor flag GAVIS BUILD is set see config G4VIS BUILD gmk which incorparates the selected driver into the Geant4 libraries 8 2 2 How to Realize Visualization Drivers in an Executable You can realize and use any of the visualization driver s you want in your Geant4 executable provided they are among the set installed beforehand into the Geant4 libraries A warning will appear if this is not the case In order to realize visualization drivers you must instantiate and initialize a subclass of GaVisManager that implements the pure virtual function RegisterGraphicsSystems This subclass must be compiled in the user s domain to force the loading of appropriate libraries in the right order The easiest way to do this is to use G4VisExecut ive a provided class with included implementation G4VisExecut ive is sensitive to the G4VIS USE variables mentioned below If you do wish to write your own subclass you may do so You will see how to do this by looking at G4VisExecutive icc A typical extract is RegisterGraphicsSystem new G4DAWNFILE ifdef G4VIS_USE_OPENGLX RegisterGraphicsSystem new G4OpenGLImmediateX RegisterGraphicsSystem new G4OpenGLStoredX fendif If you wish to use G4VisExecutive but register an additional graphics system XXX say you may do so either before or after initializing visManager gt RegisterGraphicsSytem new XXX visManager gt Initialize
281. g section However most BREPS Solids are defined by creating each surface separately and tying them together Though it is possible to do this using code it is potentially error prone So it is generally much more productive to utilize a tool to create these volumes and the tools of choice are CAD systems In future it will be possible to import export models created in CAD systems utilizing the STEP standard Specific BREP Solids We have defined one polygonal and one polyconical shape using BREPS The polycone provides a shape defined by aseries of conical sections with the same axis contiguous along it The polyconical solid GABREPSolidPCone is a shape defined by a set of inner and outer conical or cylindrical surface sections and two planes perpendicular to the Z axis Each conical surface is defined by its radius at two different planes perpendicular to the Z axis Inner and outer conical surfaces are defined using common Z planes GABREPSolidPCone const G4String amp pName G4double start angle G4double opening angle G4int num_z_planes sections G4double z_start const G4double z_values const G4double RMIN const G4double RMAX The conical sections do not need to fill 360 degrees but can have a common start and opening angle start_angle starting angle opening_angle opening angle num_z_planes number of planes perpendicular to the z axis used z start starting value of Z z values Z
282. g started with Cygwin Building a MSVC NET 2003 Geant4 project 7 Development and debug tools 7 1 UNIX Although not in the scope of this user manual in this appendix section we provide a set of references to rather known and established development tools and environments we think are useful for code development in C in general It s a rather limited list far from being complete of course The KDevelop environment on Linux systems e The GNU Data Display Debugger DDD e Valgrind a system for debugging and profiling Linux programs e SUN SUN ONE Studio environment former Workshop e Microsoft Visual Studio development environment e Parasoft Insure run time debugger and memory checker e Parasoft C Test source code analyzer e Rational Rose CASE tool Together ControlCenter development environment Logiscope tool for metrics analysis 274 Appendix e Rational Unified Process RUP tool for Software engineering 8 Geant4 Material Database 8 1 Pure Materials 1 G4_H 8 3748e 05 19 2 2 G4_He 0 000166322 41 8 3 G4 Li 0 534 40 4 G4 Be 1 848 63 7 5 G4 B 2537 76 6 GA C 2 81 yi G4 0 0011652 82 8 G4 0 0 00133151 95 9 GA F 0 00158029 15 0 G4 Ne 0 000838505 37 1 G4_Na 0 971 49 2 G4_Mg 1 74 56 3 G4 Al 2 699 66 4 G4 Si 2433 T3 5 G4_P 242 73 6 G4 S 2 80 Ui G4 Cl 0 00299473 74 8 G4 Ar 0 00166201 88 9 GA K 0 862 90 20 G4 Ca 1455 91 21 G4 Sc 2 989 216 22 G4 Ti 4 54 233 23 G
283. gStepDolt and PostStepDolt and the corresponding methods e AtRestGetPhysicalInteractionLength e AlongStepGetPhysicalInteractionLength and e PostStepGetPhysicallnteractionLength describe the behavior of a physics process when they are implemented in a derived class The details of these methods are described in Section 5 2 The following are specialized base classes to be used for simple processes G4VAtRestProcess Processes with only AtRestDoIt G4VContinuousProcess Processes with only AlongStepDoIt G4VDiscreteProcess processes with only PostStepDoIt Another 4 virtual classes such as G4VContinuousDiscreteProcess are provided for complex processes 2 5 2 Managing Processes The G4ProcessManager class contains a list of processes that a particle can undertake It has information on the order of invocation of the processes as well as which kind of DoIt method is valid for each process in the list A G4ProcessManager object corresponds to each particle and is attached to the G4ParticleDefiniton class In order to validate processes they should be registered with the particle s G4ProcessManager Process order ing information is included by using the AddProcess and SetProcessOrdering methods For reg istration of simple processes the AddAtRestProcess AddContinuousProcess and AddDis creteProcess methods may be used G4ProcessManager is able to turn some processes on or off during a run by using the Activate
284. ge to update G4Step G4VParticleChange is introduced as an abstract class It has a minimal set of methods for updating G4Step and handling secondaries A physics process can therefore define its own particle change derived from G4VParticleChange Three pure virtual methods are provided virtual G4Step UpdateStepForAtRest G4Step step e virtual G4Step UpdateStepForAlongStep G4Step step and virtual G4Step UpdateStepForPostStep G4Step step which correspond to the three DoIt methods of G4VProcess Each derived class should implement these methods 5 2 1 Electromagnetic Interactions This section summarizes the electromagnetic physics processes which are installed in Geant4 For details on the implementation of these processes please refer to the Physics Reference Manual 5 2 1 1 Standard Electromagnetic Processes The following is a summary of the standard electromagnetic processes available in Geant4 e Photon processes Compton scattering class name G4ComptonScattering Gamma conversion also called pair production class name G4GammaConversion e Photo electric effect class name G4PhotoElectricEffect Muon pair production class name G4GammaConversionToMuons Electron positron processes e Ionisation and delta ray production class name G4elonisation Bremsstrahlung class name G4eBremsstrahlung e Positron annihilation into two gammas class name G4eplusAnnihilation Positron annihilation into two
285. generator and or invoke one generator more than once Mixing up several generators can produce a more complicated primary event 2 6 2 G4VPrimaryGenerator Geant4 provides two G4VPrimaryGenerator concrete classes One is G4ParticleGun which will be discussed here and the other is G4HEPEvtInterface which will be discussed in Section 3 6 2 6 2 1 G4ParticleGun G4ParticleGun is a generator provided by Geant4 This class generates primary particle s with a given momen tum and position It does not provide any sort of randomizing The constructor of G4ParticleGun takes an integer which causes the generation of one or more primaries of exactly same kinematics It is a rather frequent user re quirement to generate a primary with randomized energy momentum and or position Such randomization can be achieved by invoking various set methods provided by G4ParticleGun The invocation of these methods should be implemented in the generatePrimaries method of your concrete G4VUserPrimaryGeneratorAction class before invoking generatePrimaryVertex of G4ParticleGun Geant4 provides various random number generation methods with various distributions see Section 3 2 2 6 2 2 Public methods of G4ParticleGun The following methods are provided by G4ParticleGun and all of them can be invoked from the generat ePri maries method in your concrete G4VUserPrimaryGeneratorAction class e void SetParticleDefinition G4ParticleDefinitio
286. gest steps globalFieldManager gt SetMinimumEpsilonStep minEps globalFieldManager gt SetMaximumEpsilonStep maxEps globalFieldManager gt SetDeltaOneStep 0 5e 3 mm 0 5 micrometer G4cout EpsilonStep set min minEps max maxEps G4endl We note that the relevant parameters above limit the inaccuracy in each step The final inaccuracy due to the full trajectory will accumulate The exact point at which a track crosses a boundary is also calculated with finite accuracy To limit this inaccuracy a parameter called DeltaIntersection is used This is a maximum for the inaccuracy of a single boundary crossing Thus the accuracy of the position of the track after a number of boundary crossings is directly proportional to the number of boundaries 4 3 2 6 Choosing different accuracies for the same volume It is possible to create a FieldManager which has different properties for particles of different momenta or de pending on other parameters of a track This is useful for example in obtaining high accuracy for important tracks e g muons and accept less accuracy in tracking others e g electrons To use this you must create your own field manager which uses the method void ConfigureForTrack const G4Track to configure itself using the parameters of the current track An example of this will be available in examples ex tended field05 4 3 2 7 Parameters that must scale with prob
287. gging the geometry setup and to apply it only to the part of the geometry setup which requires debugging The classes G4PVPlacement and G4PVParameterised also provide a method G4bool CheckOverlaps GAint res 1000 which will force the check for the specified volume The check verifies if each placed or parameterised instance is overlapping with other instances or with its mother volume A default resolution for the number of points to be generated and verified is provided The method returns t rue if an overlap occurs Using the visualization driver DAVID The Geant4 visualization offers a powerful debugging tool for detecting potential intersections of physical vol umes The Geant4 DAVID visualization tool can infact automatically detect the overlaps between the volumes defined in Geant4 and converted to a graphical representation for visualization purposes The accuracy of the graphical representation can be tuned onto the exact geometrical description In the debugging physical volume surfaces are automatically decomposed into 3D polygons and intersections of the generated polygons are investi gated If a polygon intersects with another one physical volumes which these polygons belong to are visualized in 100 Detector Definition and Response color red is the default The Figure 4 5 below is a sample visualization of a detector geometry with intersecting physical volumes highlighted Figure 4 5 A geomet
288. gine implements the basic algorithm for pseudo random numbers generation There are 3 different ways of shooting random values 33 Toolkit Fundamentals Using the static generator defined in the HepRandom class random values are shot using static methods shoot defined for each distribution class The static generator will use as default engine a HepJames Random object and the user can set its properties or change it with a new instantiated engine object by using the static methods defined in the HepRandom class Skipping the static generator and specifying an engine object random values are shot using static methods shoot HepRandomEngine defined for each distribution class The user must instantiate an engine object and give it as argument to the shoot method The generator mechanism will then be by passed by using the basic flat method of the specified engine The user must take care of the engine objects he she instantiates Skipping the static generator and instantiating a distribution object random values are shot using fire methods NOT static defined for each distribution class The user must instantiate a distribution object giving as argument to the constructor an engine by pointer or by reference By doing so the engine will be associated to the distribution object and the generator mechanism will be by passed by using the basic flat method of that engine In this guide we ll only focus on the static gen
289. gy It performs ray tracing visualization using the tracking routines of Geant4 It is therefore available for every kinds of shapes solids which Geant4 can handle It is also utilized for debugging the user s geometry for the tracking routines of Geant4 It is well suited for photo realistic high quality output for presentation and for intuitive debugging of detector geometry It produces a JPEG file This driver is by default listed in the available visualization drivers of user s application Some pieces of geometries may fail to show up in other visualization drivers due to algorithms those drivers use to compute visualizable shapes and polygons but RayTracer can handle any geometry that the Geant4 navigator can handle Because RayTracer in essence takes over Geant4 s tracking routines for its own use RayTracer cannot be used to visualize Trajectories or hits An X Window version called RayTracerX can be selected by setting G4VIS BUILD RATRACERX DRIVER at Geant4 library build time and G4VIS USE RAYTRACERX at application user code build time assuming you use the standard visualization manager G4VisExecut ive or an equally smart vis manager RayTracerX builds the same jpeg file as RayTracer but simultaneously renders to screen so you can watch as rendering grows progressively smoother RayTracer has its own built in commands vis rayTracer Alternatively you can treat it as a normal vis system and use vis
290. handler and viewer A scene is a set of visualizable raw 3D data A scene handler is a graphics data modeler which processes raw data in a scene for later visualization And a viewer generates images based on data processed by a scene handler Roughly speaking a set of a scene handler and a viewer corresponds to a visualization driver The steps of performing Geant4 visualization are explained below though some of these steps may be done for you so that in practice you may use as few as just two commands such as vis open OGLIX plus vis drawVolume The seven steps of visualization are e Step 1 Create a scene handler and a viewer e Step 2 Create an empty scene e Step 3 Add raw 3D data to the created scene Step 4 Attach the current scene handler to the current scene Step 5 Set camera parameters drawing style wireframe surface etc Step 6 Make the viewer execute visualization Step 7 Declare the end of visualization for flushing 208 Visualization These seven steps can be controlled explicitly to create multiple scenes and multiple viewers each with its own set of parameters with easy switching from one scene to another But for the most common case of just having one scene and one viewer many steps are handled implicitly for you 8 4 2 Create a scene handler and a viewer vis open com mand Command vis open creates a scene handler and a viewer which corresponds to Step 1 Command vi
291. he user can pass his own pa rameter set in the class GFlashSamplingShowerTuning Here the user can also set his calorimeter resolution All in all the constructor looks the following GFlashSamplingShowerParamterisation G4Material Matl G4Material Mat2 G4double d1 G4double d2 GVFlashSamplingShowerTuning aPar 0 An implementation of some tools that should help the user to tune the parameterization is forseen 5 2 7 Transportation Process To be delivered by J Apostolakis lt John Apostolakis cern ch gt 5 3 Particles 5 3 1 Basic concepts There are three levels of classes to describe particles in Geant4 G4ParticleDefinition defines a particle G4DynamicParticle describes a particle interacting with materials G4Track describes a particle traveling in space and time G4ParticleDefinition aggregates information to characterize a particle s properties such as name mass spin life time and decay modes G4DynamicParticle aggregates information to describe the dynamics of particles such as 160 Tracking and Physics energy momentum polarization and proper time as well as particle definition information G4Track includes all information necessary for tracking in a detector simulation such as time position and step as well as dynamic particle information G4Track has all the information necessary for tracking in Geant4 It includes position time and step as well as kinematics Details o
292. he user wishes to start optical photons as primary particles In this case the user must set the linear polarization using particle gun methods the General Particle Source or his her PrimaryGeneratorAction For an unpolarized source the linear polarization should be sampled randomly for each new primary photon The GEANT4 catalogue of processes at optical wavelengths includes refraction and reflection at medium bound aries bulk absorption and Rayleigh scattering Processes which produce optical photons include the Cerenkov ef fect transition radiation and scintillation Optical photons are generated in GEANT4 without energy conservation and their energy must therefore not be tallied as part of the energy balance of an event The optical properties of the medium which are key to the implementation of these types of processes are stored as entries in a GaMaterialPropertiesTable which is linked to the G4Material in question These properties may be constants or they may be expressed as a function of the photon s wavelength This table is a private data member of the G4Material class The G4MaterialPropertiesTable is implemented as a hash directory in which each entry consists of a value and a key The key is used to quickly and efficiently retrieve the corresponding value All values in the dictionary are either instantiations of G4double or the class G4MaterialPropertyVector and all keys are of type G4St ring A G4MaterialPropertyVector is comp
293. his class is particularly useful when there is a need to create a regular pattern in space of a complex component which consists of different shapes and can t be obtained by using replicated volumes or parametrised volumes see also Figure 4 2 reful usage of G4AssemblyVolume must be considered though in order to avoid cases of proliferation of physical volumes all placed in the same mother ae i Figure 4 2 Examples of assembly of volumes 88 Detector Definition and Response 4 1 6 1 Filling an assembly volume with its daughters Participating logical volumes are represented as a triplet of lt logical volume translation rotation gt G4AssemblyTriplet class The adopted approach is to place each participating logical volume with respect to the assembly s coordinate system according to the specified translation and rotation 4 1 6 2 Assembly volume placement An assembly volume object is composed of a set of logical volumes imprints of it can be made inside a mother logical volume Since the assembly volume class generates physical volumes during each imprint the user has no way to specify identifiers for these An internal counting mechanism is used to compose uniquely the names of the physical volumes created by the invoked MakeImprint method s The name for each of the physical volume is generated with the following format av WWW impr XXX YYY ZZZ where WWW assembly volume instance number
294. hod The actual number generated will necessarily be different due to the Poissonian nature of the production In the present implementation the production density of photons is distributed evenly along the particle s track segment even if the particle has slowed significantly during the step The frequently very large number of secondaries produced in a single step about 300 cm in water compelled the idea in GEANT3 21 of suspending the primary particle until all its progeny have been tracked Despite the fact that GEANT4 employs dynamic memory allocation and thus does not suffer from the limitations of GEANT3 21 with its fixed large initial ZEBRA store GEANT4 nevertheless provides for an analogous functionality with the public method Set TrackSecondariesFirst An example of the registration of the Cerenkov process is given in Example 5 6 Example 5 6 Registration of the Cerenkov process in PhysicsList include G4Cerenkov hh void ExptPhysicsList ConstructoOp G4Cerenkov theCerenkovProcess new G4Cerenkov Cerenkov G4int MaxNumPhotons 300 theCerenkovProcess gt SetTrackSecondariesFirst true theCerenkovProcess gt SetMaxNumPhotonsPerStep MaxNumPhotons theParticlelterator gt reset while theParticleIterator G4ParticleDefinition particle theParticlelterator gt value G4ProcessManager pmanager particle GetProcessManager G4String particleName particle gt GetParticleName if theCerenk
295. hods Draw and Print To draw or print out your concrete hits these methods should be implemented How to define the drawing method is described in Section 8 9 G4THitsCollection G4VHit is an abstract class from which you derive your own concrete classes During the processing of a giv en event represented by a G4Event object many objects of the hit class will be produced collected and associ 114 Detector Definition and Response ated with the event Therefore for each concrete hit class you must also prepare a concrete class derived from G4VHitsCollection an abstract class which represents a vector collection of user defined hits G4THitsCollection is a template class derived from G4VHitsCollection and the concrete hit collection class of a particular G4VHit concrete class can be instantiated from this template class Each object of a hit collection must have a unique name for each event G4Event has a G4HCofThisEvent class object that is a container class of collections of hits Hit collections are stored by their pointers whose type is that of the base class An example of a concrete hit class Example 4 14 shows an example of a concrete hit class Example 4 14 An example of a concrete hit class ifndef ExN04TrackerHit h define ExN04TrackerHit h 1 include G4VHit hh include G4THitsCollection hh include G4Allocator hh include G4ThreeVector hh class ExN04TrackerHit public G4VHit public
296. iate command to the makefile 2 Add initialization of ROOT I O and loading of the generated dictionary for the given classes in the appropriate part of the code 3 Whenever the objects to be persistified are available call the WriteObject method of TFile with the pointer to the appropriate object as argument usually it is some sort of container like std vector con taining the collection of objects to be persistified The example provided in examples extended persistency demonstrates an implementation of object persistency using the Reflex mechanism in ROOT I O 4 7 Parallel Geometries Notice As of Geant4 release 8 2 this functionality for defining parallel geometries is still in beta release We appreciate your feedback 4 7 1 A parallel world Occasionally it is not straightforward to define geometries for sensitive detectors importance geometries or en velopes for shower parameterization to be coherently assigned to volumes in the tracking mass geometry The new parallel navigation functionality allows the user to define more than one worlds simultaneously The new G4Transportation process will see all worlds simultaneously steps will be limited by both boundaries of the mass geometry and parallel geometries In a parallel world the user can define volumes in arbitrary manner with sensitivity regions shower parameteri zation setups and or importance weight for biasing Volumes in different worlds can overlap Here
297. icVolumeWithField for example or set of logical volumes G4bool allLocal true logicVolumeWithField gt SetFieldManager fEmField GetLocalFieldManager allLocal You can then choose whether the logical volume s daughter volumes will also be given this new field If so the field will be pushed into its daughters unless they already have a field manager 4 3 2 3 Creating an Electric or Electromagnetic Field The design and implementation of the Field category allows and enables the use of an electric or combined elec tromagnetic field These fields can also vary with time as can magnetic fields Source listing Example 4 12 shows how to define a uniform electric field for the whole of a detector Example 4 12 How to define a uniform electric field for the whole of a detector extracted from example in examples extended field field02 in the header file or first include G4EqMagElectricField hh include G4UniformElectricField hh G4ElectricField fEMfield G4EqMagElectricField fEquation G4MagIntegratorStepper fStepper G4FieldManager fFieldMgr G4double fMinStep G4ChordFinder fChordFinder in the source file fEMfield new G4UniformElectricField G4ThreeVector 0 0 100000 0 kilovolt cm 0 0 Create an equation of motion for this field fEquation new G4EqMagElectricField fEMfield G4int nvar 8 fStepper new G4ClassicalRK4 fEquation nvar Get the global field manager fFi
298. ical const EAxis pAxis const G4int nDivisions const G4double offset Giving only the division width G4PVDivision const G4String amp pName G4LogicalVolume pCurrentLogical G4LogicalVolume pMotherLogical const EAxis pAxis const G4double width const G4double offset Giving the number of divisions and the division width G4PVDivision const G4String amp pName G4LogicalVolume pCurrentLogical G4LogicalVolume pMotherLogical const EAxis pAxis const G4int nDivisions const G4double width const G4double offset 84 Detector Definition and Response where pName String identifier for the replicated volume pCurrentLogical The associated Logical Volume pMotherLogical The associated mother Logical Volume pAxis The axis along which the division is applied nDivisions The number of divisions width The width of a single division along the axis offset Possible offset associated to the mother along the axis of division The parameterisation is calculated automatically using the values provided in input Therefore the dimen sions of the solid associated with pCurrentLogical will not be used but recomputed through the G4VParameterisation ComputeDimension method Since G4VPVParameterisation may have different ComputeDimension methods for each solid type the user must provide a solid that is of the same type as of the one associated to the mother volume As for any re
299. ical Steering Board TSB represen tative who may be contacted for help with problems relating to simulations Please contact the TSB repre sentative closest to your project or to your laboratory To find out who your TSB representative is go to G4 Technical Board You may also post your question in the Geant4 HyperNews Forum If I find a bug or other problem with the code who should be informed A WWW interface available at Problem tracking system will forward the bug report to the person respon sible for the affected Geant4 domain The Geant4 web makes available a database of open incident reports tagging the ones already fixed and showing their status An acknowledgement of the bug report will be sent If I propose a fix who is responsible for approving it 263 Frequentry Asked Questions The responsible person is the working group coordinator of the domain in which the fix is to be applied This person is usually also a TSB member If the fix affects more than one domain the matter will be addressed by the TSB To whom should I send a proposal for an improvement in Geant4 functionality Any new requirement should be submitted via the automatic web system It will be discussed at the Geant4 TSB You may also ask your TSB representative to forward your requirement to the TSB A new requirement will trigger a cycle of analysis design implementation testing and documentation which may involve different working groups Any ne
300. ically in his her own application 4 1 4 1 Placements single positioned copy In this case the Physical Volume is created by associating a Logical Volume with a Rotation Matrix and a Transla tion vector The Rotation Matrix represents the rotation of the reference frame of the considered volume relatively to its mother volume s reference frame The Translation Vector represents the translation of the current volume in the reference frame of its mother volume Transformations including reflections are not allowed To create a Placement one must construct it using G4PVPlacement G4RotationMatrix pRot const G4ThreeVector amp tlate G4LogicalVolume pCurrentLogical const G4String amp pName G4LogicalVolume pMotherLogical G4bool pMany G4int pCopyNo G4bool pSurfChk false where pRot Rotation with respect to its mother volume tlate Translation with respect to its mother volume pCurrentLogical The associated Logical Volume pName String identifier for this placement pMotherLogical The associated mother volume pMany For future use Can be set to false pCopyNo Integer which identifies this placement pSurfChk if true activates check for overlaps with existing vol umes Care must be taken because the rotation matrix is not copied by a G4PVPlacement So the user must not modify it after creating a Placement that uses it However the same rotation matrix can be re used for many volumes Curr
301. icationOfNewTrack hh class G4UserStackingAction pubis G4UserStackingAction virtual G4UserStackingAction protected G4StackManager stackManager virtual G4ClassificationOfNewTrack ClassifyNewTrack const G4Track 176 User Actions G4UserTrackingAction 177 User Actions G4UserSteppingAction Example 6 8 G4UserSteppingAction G4UserSteppingAction hh Descriptions This class represents actions taken place by the user at each end of stepping VVV I class G4UserSteppingAction VAM VVV A Constructor and destructor G4UserSteppingAction virtual G4UserSteppingAction Member functions virtual void UserSteppingAction const G4Step Member data G4SteppingManager fpSteppingManager 6 3 User Information Classes Additional user information can be associated with various Geant4 classes There are basically two ways for the user to do this e derive concrete classes from base classes used in Geant4 These are classes for run hit digit trajectory and tra jectory point which are discussed in Section 6 2 for G4Run Section 4 4 for G4VHit Section 4 5 for G4VDigit and Section 5 1 6 for G4VTrajectory and G4VTrajectoryPoint create concrete classes from provided abstract base classes and associate them with classes used in Geant4 Geant4 classes which can accommodate user information classes are G4Event G4Track G4Primary Vertex G4PrimaryPartic
302. icle can be set arbitrarily time by using PreAssignedDecayProperTime 5 4 Production Threshold versus Tracking Cut 5 4 1 General considerations We have to fulfill two contradictory requirements It is the responsibility of each individual process to produce secondary particles according to its own capabilities On the other hand it is only the Geant4 kernel i e tracking which can ensure an overall coherence of the simulation The general principles in Geant4 are the following 1 Each process has its intrinsic limit s to produce secondary particles 2 All particles produced and accepted will be tracked up to zero range 3 Each particle has a suggested cut in range which is converted to energy for all materials and defined via a SetCut method see Section 2 4 2 Points 1 and 2 imply that the cut associated with the particle is a recommended production threshold of sec ondary particles 5 4 2 Set production threshold SetCut methods As already mentioned each kind of particle has a suggested production threshold Some of the processes will not use this threshold e g decay while other processes will use it as a default value for their intrinsic limits e g ionisation and bremsstrahlung See Section 2 4 2 to see how to set the production threshold 164 Tracking and Physics 5 4 3 Apply cut The DoIt methods of each process can produce secondary particles Two cases can happen e aprocess set
303. ided concrete class and implement the GetIndex G4Step virtual method to return the unique key Example 4 15 shows an example of primitive sensitivity class definitions 119 Detector Definition and Response Example 4 15 An example of defining primitive sensitivity classes taken from ExN07DetectorConstruction void ExN07DetectorConstruction SetupDetectors i G4String filterName particleName G4SDParticleFilter gammaFilter new G4SDParticleFilter filterName gammaFilter particleName gamma G4SDParticleFilter electronFilter new G4SDParticleFilter filterName G4SDParticleFilter positronFilter new G4SDParticleFilter filterName positronFilter particleName et G4SDParticleFilter epFilter new G4SDParticleFilter filterName epFilter epFilter add particleName e epFilter gt add particleName e electronrilter part iclename e 7 for G4int i 0 i1 lt 3 i for G4int j 0 j lt 2 j Loop counter j 0 absorber T 1 gap G4String detName calName i aie 3535 detName abs else detName gap G4MultiFunctionalDetector det new G4MultiFunctionalDetector detName The second argument in each primitive means the level of geometrical hierarchy the copy number of that level is used as the key of the G4THitsMap For absorber j 0 the copy number of its own physical volume is used For gap j 1 the copy number of its
304. ies all of these atributes 2 2 6 Create a Physical Volume You create a physical volume starting with your logical volume A physical volume is simply a placed instance of the logical volume This instance must be placed inside a mother logical volume For simplicity it is unrotated Example 2 5 A simple physical volume G4double trackerPos x 1 0 meter G4double trackerPos y 0 0 meter G4double trackerPos z 0 0 meter G4VPhysicalVolume tracker phys new G4PVPlacement 0 no rotation G4ThreeVector trackerPos_x trackerPos_y trackerPos_z If translation position tracker log its logical volume tracker its name experimentalHall log its mother logical volume false no boolean operations 0 its copy number This places the logical volume tracker log at the origin of the mother volume experimentalHall log shifted by one meter along X and unrotated The resulting physical volume is named tracker and has a copy number of 0 Getting Started with Geant4 Running a Simple Example An exception exists to the rule that a physical volume must be placed inside a mother volume That exception is for the World volume which is the largest volume created and which contains all other volumes This volume obviously cannot be contained in any other Instead it must be created as a G4PVPlacement with a null mother pointer It also must be unrotated and it must be placed at the origin of the global coo
305. ignedDecayProducts member of G4DynamicParticle G4Decay adopts these pre assigned daughter particles instead of asking G4VDecayChannel to generate decay products In addition the user may assign a pre assigned decay time for a specific track in its rest frame i e decay time is defined in the proper time by using the G4PrimaryParticle SetProperTime method G4VPrimaryGenerator sets the PreAssignedDecayProperTime member of G4DynamicParticle G4Decay uses this decay time instead of the life time of the particle type 5 2 4 Photolepton hadron Processes To be delivered 147 Tracking and Physics 5 2 5 Optical Photon Processes A photon is considered to be optical when its wavelength is much greater than the typical atomic spacing In GEANT4 optical photons are treated as a class of particle distinct from their higher energy gamma cousins This implementation allows the wave like properties of electromagnetic radiation to be incorporated into the optical photon process Because this theoretical description breaks down at higher energies there is no smooth transition as a function of energy between the optical photon and gamma particle classes For the simulation of optical photons to work correctly in GEANT4 they must be imputed a linear polarization This is unlike most other particles in GEANT4 but is automatically and correctly done for optical photons that are generated as secondaries by existing processes in GEANT4 Not so if t
306. ildLog motherLog kZAxis 2 0 1 m divPconePhiW is a division of a polycone along its phi axis in equal copies of width 30 degrees with an offset of 60 degrees As the mother extends from 0 to 180 degrees there s space for 4 copies All the copies 86 Detector Definition and Response have a starting angle of 20 degrees as for the mother and a phi extension of 30 degrees They are rotated around the Z axis by 60 and 30 degrees so that the first copy will extend from 80 to 110 and the last from 170 to 200 degrees e divPconeZN isa division of the same polycone along its Z axis As the mother polycone has two sections it will be divided in two one section polycones the first one extending from 1 to 0 25 meters the second from 0 25 to 1 meters Although specified the offset will not be used 4 1 5 Touchables Uniquely Identifying a Volume 4 1 5 1 Introduction to Touchables A touchable for a volume serves the purpose of providing a unique identification for a detector element This can be useful for description of the geometry alternative to the one used by the Geant4 tracking system such as a Sensitive Detectors based read out geometry or a parameterised geometry for fast Monte Carlo In order to create a touchable volume several techniques can be implemented for example in Geant4 touchables are implemented as solids associated to a transformation matrix in the global reference system or as a hierarchy of physical volum
307. ill be composed The constructor will new a vector of pointers to G4Element and a vector of doubles to store their fraction of mass Finally the method to add an element must be invoked for each of the desired pre existing element objects providing their addresses and mass fractions At the last element entry the system will automatically compute the vector of the number of atoms of each element per volume the total number of electrons per volume and will store this material in the materials table In the same way a material can be constructed as a mixture of other materials and elements It should be noted that if the user provides the number of atoms or molecules for each element comprising the chemical compound the system automatically computes the mass fraction A few quantities with physical meaning or not which are constant in a given material are computed and stored here as derived data members Some materials are included in the internal Geant4 database which were derived from the NIST database of ma terial properties http physics nist gov PhysRefData Star Text method html Additionally a number of materi als friquently used in HEP is included in the database Materials are interrogated or constructed by their names Section 8 There are also UI commands for the material category which provide access to the database 104 Detector Definition and Response 4 2 2 4 Final Considerations The classes will automa
308. implemented mainly based on recommendations given in the books B H Flowers An introduction to Numerical Methods In C Claredon Press Oxford 1995 e M Abramowitz I Stegun Handbook of mathematical functions DOVER Publications INC New York 1965 chapters 9 10 and 22 This set of classes includes e G4ChebyshevApproximation Class creating the Chebyshev approximation for a function pointed by fFunction data member The Chebyshev polynomial approximation provides an efficient evaluation of the minimax polynomial which among all polynomials of the same degree has the smallest maximum deviation from the true function G4Datalnterpolation Class providing methods for data interpolations and extrapolations Polynomial Cubic Spline e G4GaussChebyshevQ e G4GaussHermiteQ e G4GaussJacobiQ e G4GaussLaguerreQ Classes implementing the Gauss Chebyshev Gauss Hermite Gauss Jacobi Gauss Laguerre and Gauss Leg endre guadrature methods Roots of orthogonal polynomials and corresponding weights are calculated based on iteration method by bisection Newton algorithm G4Integrator Template class collecting integrator methods for generic functions Legendre Simpson Adaptive Gauss La guerre Hermite Jacobi G4Simplelntegration Class implementing simple numerical methods Trapezoidal MidPoint Gauss Simpson Adaptive Gauss for integration of functions with signature double f double 3 2 4 General managemen
309. in the users PhysicsList as shown in Example 5 8 In those cases where the fast to slow excitation ratio changes with particle type the method SetScintillationExcitationRatio can be called for each scintillation process see the advanced underground physics example This overwrites the YieldRatio obtained from the G4MaterialPropertiesTable Example 5 8 Implementation of the scintillation process in PhysicsList G4Scintillation theMuonScintProcess new G4Scintillation Scintillation theMuonScintProcess gt SetTrackSecondariesFirst true theMuonScintProcess gt SetScintillationYieldFactor 0 8 Lhebaititletiorator 656607 while theParticleIterator G4ParticleDefinition particle theParticlelterator gt value G4ProcessManager pmanager particle gt GetProcessManager G4String particleName particle gt GetParticleName if theMuonScintProcess gt IsApplicable particle if particleName mu pmanager gt AddProcess theMuonScintProcess pmanager gt SetProcessOrderingToLast theMuonScintProcess idxAtRest pmanager gt SetProcessOrderingToLast theMuonScintProcess idxPostStep A QGaussian distributed number of photons is generated according to the energy lost during the step A resolution scale of 1 0 produces a statistical fluctuation around the average yield set with AddConstProperty SCINTILLATIONYIELD while values gt 1 broaden the fluctuation A value of Zero produces no fluctuation E
310. inal xterm or cygwin window from which GAG is invoked It can be interrupted as will in the middle of long session of execution Log can be saved to a file independent of the above redirection GAG displays warning or error messages from GEANT4 in a pop up warning widget 2 8 3 Building the Interface Libraries The libraries that don t depend on external packages are made by default They include G4Ulterminal G4Ultesh and G4UIGAG in libraries libG4UIbasic a so and libG4UIGAG a so G4UIGainServer o is packed in the libG4UIGAG To make the libraries of G4UIXm G4UIXaw and G4UIWin32 respective environment variables G4UI BUILD XM SESSION G4UI BUILD XAW SESSION or G4UI BUILD WIN32 SESSION must be set explicitly However if the environment variable G4UI NONE is set no interface libraries are built at all Build scheme of the user interface libraries is specified in G4INSTALL config G4UI_BUILD gmk makefile and the dependencies on the external packages are specified in G4INSTALL config interactivity gmk 2 8 4 How to Use the Interface To use a given interface GAUIxxx where xxx terminal Xm Xaw Win32 GAG GainServer in a user s program he has the following lines in his main program to include the class definition in his main program include G4Uixxx hh to instantiate a session of his choice and start the session G4UIsession session new G4UIxxx session gt SessionStart the line next to the SessionSt
311. inal position of the parent particle final global time of the parent particle final proper time of the parent particle final polarization of the parent particle status of the parent particle G4TrackStatus true step length this is used by multiple scattering to store the result of the transformation from the geometrical step length to the true step length local energy deposited this consists of either energy deposited by the energy loss process or the energy lost by secondaries which have NOT been generated because each of their energies was below the cut threshold number of secondaries particles list of secondary particles list of G4Track 5 1 3 Handling of Secondary Particles Secondary particles are passed as G4Tracks from a physics process to tracking G4ParticleChange provides the following four methods for a physics process AddSecondary AddSecondary G4Track aSecondary G4DynamicParticle aSecondary AddSecondary G4DynamicParticle aSecondary G4ThreeVector position AddSecondary G4DynamicParticle aSecondary G4double time In all but the first the construction of G4Track is done in the methods using informaton given by the arguments 5 1 4 User Actions There are two classes which allow the user to intervene in the tracking These are 131 Tracking and Physics e G4UserTrackingAction and e G4UserSteppingAction Each provides methods which allow the user access to the Gean
312. indows GAGTree GAG Linux UNIX Mac Windows XMLTree any XML viewer Linux UNIX Mac Windows Table 8 1 Required graphics systems and supported platforms for the various visualization drivers 8 3 2 OpenGL These drivers have been developed by John Allison and Andrew Walkden University of Manchester It is an interface to the de facto standard 3D graphics library OpenGL It is well suited for real time fast visualization and demonstration Fast visualization is realized with hardware acceleration reuse of shapes stored in a display list etc NURBS visualization is also supported Several versions of the OpenGL drivers are prepared Versions for Xlib Motif and Win32 platforms are available by default For each version there are two modes immediate mode and stored mode The former has no limitation on data size and the latter is fast for visualizing large data repetitively and so is suitable for animation If you don t have Motif all control is done from Geant4 commands 197 Visualization vis open OGLIX vis viewer set viewpointThetaPhi 70 20 vis viewer zoom 2 GEC gt But if you have Motif libraries you can control Geant4 from Motif widgets vis open OGLIXm The OpenGL driver added Smooth shading and Transparency since Geant4 release 8 0 Further information OpenGL and Mesa e http www opengl org e http www mesa3d org e Geant4 Visualization Tutorial using the OpenGL Graphics System
313. ing in a material 5 6 2 Material Cuts Couple Users can assign different production cuts to different regions see Section 5 5 This means that if the same material is used in regions with different cut values the processes need to prepare several different cross sections for that material The G4ProductionCutsTable has G4MaterialCutsCouple objects each of which consists of a material paired with a cut value These G4MaterialCutsCouples are numbered with an index which is the same as the index of a G4PhysicsVector for the corresponding G4MaterialCutsCouplein the G4PhysicsTable The list of Material CutsCouples used in the current geometry setup is updated before starting the event loop in each run 5 6 3 File I O for the Physics Table Calculated physics tables for Standard electromagnetic processes can be stored in files The user may thus elim inate the time required for the calculation of physics tables by retrieving them from the files Using the built in user command storePhysicsTable see Section 7 1 stores physics tables in files Informa tion on materials and cuts defined in the current geometry setup are stored together with physics tables because calculated values in the physics tables depend on MaterialCutsCouple Note that physics tables are calculated before the event loop not in the initialization phase So at least one event must be executed before using the storePhysicsTable command 168 Tracking and Physic
314. ing these quantities and the G4VSolid methods you can for example easily check how far you are from the root G4LogicalVolume boundary G4bool IsApplicable const G4ParticleDefinition amp In your implementation you must return true when your model is applicable to the G4ParticleDefinition passed to this method The G4ParticleDefinition provides all intrinsic particle information mass charge spin name If you want to implement a model which is valid only for certain particle types it is recommended for effi ciency that you use the static pointer of the corresponding particle classes As an example in a model valid for gammas only the IsApplicable method should take the form include G4Gamma hh G4bool MyGammaModel IsApplicable const G4ParticleDefinition amp partDef return amp partDef G4Gamma GammaDefinition G4bool ModelTrigger const G4FastTrack amp You must return true when the dynamic conditions to trigger your parameterisation are fulfilled The G4FastTrack provides access to the current G4Track gives simple access to envelope related features G4Logical Volume G4V Solid and G4AffineTransform references between the global and the envelope local coordinates systems and simple access to the position and momentum expressed in the envelope coordinate system Using these quantities and the G4VSolid methods you can for example easily check how far you are from the envelope boundary void DoIt c
315. ion constructing ExNO7Run class object e print out a run summary with ExNO7Run class object ExN07Run header file source file derived from G4Run uses G4THitsMap template class to accumulate physics quantities extracts event data from G4Event and add up to run data 9 2 Extended Examples 9 2 1 Extended Example Summary Geant4 extended examples serve three purposes testing and validation of processes and tracking demonstration of Geant4 tools and extending the functionality of Geant4 The code for these examples is maintained as part of the categories to which they belong Links to descriptions of the examples are listed below 9 2 1 1 Analysis e AOI hit scoring and histogramming using the AIDA interface 253 Examples e AnaEx01 histogram and tuple manipulations using an AIDA compliant system 9 2 1 2 Electromagnetic e TestEm0 how to print cross sections and stopping power used in input by the standard EM package e TestEm1 how to count processes activate inactivate them and survey the range of charged particles How to define a maximum step size TestEm2 shower development in an homogeneous material longitudinal and lateral profiles e TestEm3 shower development in a sampling calorimeter collect energy deposited survey energy flow and print stopping power TestEm4 9 MeV point like photon source plot spectrum of energy deposited in a single media e TestEm5 how to study
316. ion of the Hits and Digi had been realized and also several prototypes test cases and scenarios had been developed before the alpha release Volumes not necessarily the ones used by the tracking are aggregated in sensitive detectors while hits collections represent the logical read out of the detector Different ways of creating and managing hits collections had been delivered and tested notably for both single hits and calorimetry hits types In all cases hits collections had been successfully stored into and retrieved from an Object Data Base Management System Visualization This manages the visualization of solids trajectories and hits and interacts with underlying graphical libraries the Visualization class category The basic and most frequently used graphics functionality had been im plemented already by the alpha release The OO design of the visualization component allowed us to devel op several drivers independently such as for OpenGL and Openlnventor for X11 and Windows DAWN Postscript via DAWN and VRML Interfaces This category handles the production of the graphical user interface GUI and the interactions with external software OODBMS reconstruction etc 3 2 Global Usage Classes The global category in Geant4 collects all classes types structures and constants which are considered of general use within the Geant4 toolkit This category also defines the interface with third party software libraries CLHEP S
317. ions are available for low energy electromagnetic processes for electrons positrons in the G4LowEnergyBremsstrahlung class that allow the use of alternative bremsstrahlung angular generators e SetAngularGenerator G4VBremAngularDistribution distribution e SetAngularGenerator const G4String amp name Currently three angular generators are available G4ModifiedTsai 2BNGenerator and 2BSGenerator G4ModifiedTsai is set by default but it can be forced using the string tsai 2BNGenerator and 2BS Generator can be set using the strings 2bs and 2bn Information regarding conditions of use performance and energy limits of different models are available in the Physics Reference Manual and in the Geant4 Low Energy Electromagnetic Physics Working Group homepage Other options G4LowEnergyBremsstrahlung class are SetCutForLowEnSecPhotons G4double Options can also be set in the G4LowEnergyPhotoElectric class that allow the use of alternative photoelectron angular generators e SetAngularGenerator G4VPhotoElectricAngularDistribution distribution e SetAngularGenerator const G4String amp name 139 Tracking and Physics Currently three angular generators are available G4PhotoElectricAngularGeneratorSimple G4PhotoElectricAngularGeneratorS auterGavrilla and G4PhotoElectricAngularGeneratorPolarized G4PhotoElectricAngularGeneratorSimple is set by default but it can be forced using the string default G4PhotoElectricAngularGe
318. is viewer flush This is a good example to show that the visualization drivers are complementary to each other In the OpenInventor drivers you can simply click the Print button on their GUI to generate a PostScript file as a hard copy of a visualized view The OpenGL Motif driver also has a menu to generate PostScript files It can generate either vectorized or raster ized PostScript data In generating vectorized PostScript data hidden surface removal is performed based on the painter s algorithm after dividing facets of shapes into small sub triangles The WIRED HepRep Browser and WIREDA JAS Plug In can generate a wide variety of bitmap and vector output formats including PostScript and PDF 8 4 14 Culling Culling means to skip visualizing parts of a 3D scene Culling is useful for avoiding complexity of visualized views keeping transparent features of the 3D scene and for quick visualization Geant4 Visualization supports the following 3 kinds of culling e Culling of invisible physical volumes Culling of low density physical volumes e Culling of covered physical volumes by others 214 Visualization In order that one or all types of the above culling are on i e activated the global culling flag should also be on Table 8 2 summarizes the default culling policies Culling Type Default Value global ON invisible ON low density OFF covered daughter OFF Table 8 2 The default cul
319. istribution class can collect different algorithms and different calling sequences for each method to define distribution parameters or range intervals it also collects methods to fill arrays of specified size of random values according to the distribution This class collects either static and not static methods A set of distribution classes are defined in HEPRandom Here is the description of some of them e RandFlat Class to shoot flat random values integers or double within a specified interval The class provides also methods to shoot just random bits e RandExponential Class to shoot exponential distributed random values given a mean default mean 1 e RandGauss Class to shoot Gaussian distributed random values given a mean default 0 or specifying also a deviation default 1 Gaussian random numbers are generated two at the time so every other time a number is shot the number returned is the one generated the time before e RandBreitWigner Class to shoot numbers according to the Breit Wigner distribution algorithms plain or mean 2 e RandPoisson Class to shoot numbers according to the Poisson distribution given a mean default 1 Algorithm taken from W H Press et al Numerical Recipes in C Second Edition 36 Toolkit Fundamentals 3 2 3 The HEPNumerics module A set of classes implementing numerical algorithms has been developed in Geant4 Most of the algorithms and methods have been
320. ithout casting G4UImanager G4UIcommand G4UIparameter have very powerful type and range checking routines You are strongly recommended to set the range of your parameters For the case of a numerical value int or double the range can be given by a G4String using C notation e g X gt 0 amp amp X lt 10 Forthe case of a string type parameter you can set a candidate list Please refer to the detailed descriptions below GetCurrentValue will be invoked after the user s application of the corresponding command and before the SetNewValue invocation This GetCurrentValue method will be invoked only if e at least one parameter of the command has a range atleast one parameter of the command has a candidate list atleast the value of one parameter is omitted and this parameter is defined as omittable and currentVal ueAsDefault 181 Comommunication and Control For the first two cases you can re set the range or the candidate list if you need to do so but these re set parameters are needed only for the case where the range or the candidate list varies dynamically A command can be state sensitive i e the command can be accepted only for a certain G4ApplicationState s For example the run beamOn command should not be accepted when Geant4 is processing another event G4State_EventProc state You can set the states available for the command with the Available ForStates method 7 2 2 G4Ul
321. ithout user intervention This is accomplished by calling methods of the Visualization Manager from methods of the user action classes G4UserRunAction and G4UserEventAction for example In this section methods of the class G4VVis Manager which is part of the graphics_reps category are described and examples of their use are given 8 5 1 G4VVisManager The Visualization Manager is implemented by classes G4VisManager and G4VisExecutive See Section 8 2 Mak ing a Visualization Executable In order that your Geant4 be compilable either with or without the visualization category you should not use these classes directly in your C source code other than in the main function Instead you should use their abstract base class G4VVisManager defined in the intercoms category The pointer to the concrete instance of the real Visualization Manager can be obtained as follows ae Getting a pointer to the concrete Visualization Manager instance G4VVisManager pVVisManager G4VVisManager GetConcreteInstance The method GaVVisManager GetConcreteInstance returns NULL if Geant4 is not ready for visu alization Thus your C source code should be protected as follows yg wee How to protect your C source codes in visualization if pVVisManager pVVisManager gt Draw 8 5 2 Visualization of detector components If you have already constructed detector components with logical volumes to which visualization attributes are pro
322. ition particle theParticlelterator gt value G4ProcessManager pmanager particle gt GetProcessManager G4String particleName particle gt GetParticleName if particleName gamma pmanager gt AddDiscreteProcess new G4PhotoElectricEffect pmanager gt AddDiscreteProcess new G4ComptonScattering pmanager gt AddDiscreteProcess new G4GammaConversion else if particleName e pmanager gt Ad pmanager gt Ad pmanager gt Ad else if pmanager gt Ad pmanager gt Ad pmanager gt Ad pmanager gt Ad else if particleName d d d d d d d Process new Process new Process new particleName Process Process Elo ees EEOGESS new new new new particleName pmanager gt Add pmanager gt Add pmanager gt Add pmanager gt Add else if Process Process Elo EEOGESS new new new new particle gt IsShortLived G4MultipleScattering G4elonisation G4eBremsstrahlung e G4MultipleScattering G4elIonisation G4eBremsstrahlung G4eplusAnnihilation mur mu 4 G4MultipleScattering G4MuIonisation G4MuBremsstrahlung G4MuPairProduction amp amp amp amp 9 T 2 3 1 2 f o DE 1 2 3 5 4 particle GetPDGCharge 0 0 particle GetParticleName chargedgeantino all others charged particles except geantino pmanager AddP
323. ition of geantinos electrons positrons gammas e utilisation of transportation and standard EM processes Interactivity chooses processes interactively gt messenger class ExNO2PrimaryGeneratorAction header file source file derived from G4VPrimaryGeneratorAction construction of G4ParticleGun e primary event generation via particle gun ExNO2RunAction header file source file derived from G4VUserRunAction e draw detector ExNO2EventAction header file source file derived from G4VUserEventAction e print time information ExNO2TrackerSD header file source file e derived from G4VSensitiveDetector e tracker type hit generation ExNO 2TrackerHit header file source file 246 Examples derived from G4VHit e draw hit point 9 1 4 Example N03 Basic concepts e Visualize Em processes e Interactivity build messenger classes e Gun shoot particle randomly e Tracking collect energy deposition total track length Classes main source file main forinteractive mode and batch mode via macro file construction and deletion of G4RunManager construction and deletion of G UI session and VisManager construction and set of mandatory user classes automatic initialization of geometry and visualization via a macro file ExNO3DetectorConstruction header file source file derived from G4VUserDetectorConstruction definitions of single materials and m
324. its pULimits 0 G4bool Optimise true The logical volume provides a way to estimate the mass of a tree of volumes defining a detector or sub detector This can be achieved by calling the method G4double GetMass G4bool forced false The mass of the logical volume tree is computed from the estimated geometrical volume of each solid and material associated with the logical volume and its daughters Note that this computation may require a considerable amount of time depending on the complexity of the geometry tree The returned value is cached by default and can be 76 Detector Definition and Response used for successive calls unless recomputation is forced by providing t rue for the boolean argument forced in input Computation should be forced if the geometry setup has changed after the previous call Finally the Logical Volume manages the information relative to the Envelopes hierarchy required for fast Monte Carlo parameterisations Section 5 2 6 4 1 3 1 Sub detector Regions In complex geometry setups such as those found in large detectors in particle physics experiments it is useful to think of specific Logical Volumes as representing parts sub detectors of the entire detector setup which perform specific functions In such setups the processing speed of a real simulation can be increased by assigning specific production cuts to each of these detector parts This allows a more detailed simulation to occur only in those
325. ius 30 cm and length 75 cm are examples of solids To describe a volume s full properties we use a logical volume It includes the geometrical properties of the solid and adds physical characteristics the material of the volume whether it contains any sensitive detector elements the magnetic field etc We have yet to describe how to position the volume To do this you create a physical volume which places a copy of the logical volume inside a larger containing volume 2 2 2 Create a Simple Volume What do you need to do to create a volume e Create a solid Create a logical volume using this solid and adding other attributes 2 2 3 Choose a Solid To create a simple box you only need to define its name and its extent along each of the Cartesian axes You can find an example how to do this in Novice Example NOI In the detector description in the source file ExNO1DetectorConstruction cc you will find the following box definition Example 2 3 Creating a box G4double expHall_x 3 0 m G4double expHall y 1 0 m G4double expHall z 1 0 m G4Box experimentalHall box new G4Box expHall box expHall x expHall y expHall Zz This creates a box named expHall box with extent from 3 0 meters to 3 0 meters along the X axis from 1 0 to 1 0 meters in Y and from 1 0 to 1 0 meters in Z It is also very simple to create a cylinder To do this you can use the G4Tubs class Getting Started with Geant4
326. ixtures e CSG solids G4PVPlacement without rotation e Interactivity change detector size material magnetic field gt messenger class e visualization ExN03PhysicsList header file source file e derived from G4VUserPhysicsList definition of geantinos gamma leptons light mesons barions and ions e Transportation process standard Em processes Decay e Interactivity SetCut process on off gt messenger class ExNO3PrimaryGeneratorAction header file source file derived from G4VPrimaryGeneratorAction construction of G4ParticleGun e primary event generation via particle gun e Interactivity shoot particle randomly gt messenger class ExNO3RunAction header file source file e derived from G4VUserRunAction e draw detector and tracks Interactivity SetCut process on off Interactivity change detector size material magnetic field 247 Examples ExN03EventAction header file source file derived from G4VUserEventAction Store trajectories e print end of event information energy deposited etc ExN03SteppingAction header file source file derived from G4VUserSteppingAction collect energy deposition etc 9 1 5 Example N04 Basic concepts e Simplified collider experiment geometry e Full hits digits trigger Classes main source file construction and deletion of ExNO4RunManager construction and deletion of G UI session and VisManager
327. ized Encapsulated PostScript data of the view There are two kinds of DAWN drivers the DAWNFILE driver and the DAWN Network driver The DAWNFILE driver is usually recommended since it is faster and safer in the sense that it is not affected by network conditions The DAWNFILE driver sends 3D data to DAWN via an intermediate file named g4 prim in the current direc tory The file g4 prim can be re visualized later without the help of Geant4 This is done by invoking DAWN by hand 3 dawn g4 prim DAWN files can also serve as input to two additional programs e Astandalone program DAWNCUT can perform a planar cut on a DAWN image DAWNCUT takes as input a prim file and some cut parameters Its output is a new prim file to which the cut has been applied e Another standalone program DAVID can show you any volume overlap errors in your geometry DAVID takes as input a prim file and outputs a new prim file in which overlapping volumes have been highlighted The use of DAVID is described in section Section 4 1 11 of this manual The DAWN Network driver is almost the same as the DAWNFILE driver except that 3D data are passed to DAWN via the TCP IP the socket default or the named pipe and that If you have not set up network configurations of your host machine set the environment variable G4DAWN NAMED PIPEto l e g setenv G4DAWN NAMED PIPE 1 This setting switches the default 201 Visualization s
328. k which is obtained as follows G4int parent ID aTrack gt get parentID where parent ID 0 indicates a primary particle parent ID gt 0 indicates a secondary particle lt parent ID 0 indicates postponed particle from previous event NewStage is invoked when the urgent stack is empty and the waiting stack contains at least one G4Track object Here the user may kill or re assign to different stacks all the tracks in the waiting stack by calling the 175 User Actions stackManager gt ReClassify method which in turn calls the ClassifyNewTrack method If no user action is taken all tracks in the waiting stack are transferred to the urgent stack The user may also decide to abort the current event even though some tracks may remain in the waiting stack by calling stackManag er clear This method is valid and safe only if it is called from the G4UserStackingAction class A global method of event abortion is G4UImanager UImanager G4UImanager GetUlpointer UImanager ApplyCommand event abort PrepareNewEvent is invoked at the beginning of each event At this point no primary particles have been converted to tracks so the urgent and waiting stacks are empty However there may be tracks in the postponed to next event stack for each of these the ClassifyNewTrack method is called and the track is assigned to the appropriate stack Example 6 6 G4UserStackingAction include G4Classif
329. king into account daughters up to the depth specified for each physical volume The calculation involves subtracting the mass of that part of the mother that is occupied by each daughter and then adding the mass of the daughter and so on down the hierarchy vis ASCIITree Verbose 4 vis viewer flush HadCalorimeterPhysical 0 HadCalorimeterLogical HadCalorimeterBox G4Box 1 8 m3 11 35 4 2m3 HadCalColumnPhysical 1 10 replicas HadCalColumnLogical HadCalColumnBox G4Box 180DO0D ome 211235 goma HadCalCellPhysical 1 2 replicas HadCalCellLogical HadCalCellBox G4Box 90000 cm3 11 35 g cm3 HadCalLayerPhysical 1 20 replicas HadCalLayerLogical HadCalLayerBox G4Box 1600 cms Tiles a7 ome HadCalScintiPhysical 0 HadCalScintiLogical HadCalScintiBox G4Box 900 em3 1 032 g om3 Calculating mass es Overall volume of worldPhysical 0 is 2400 m3 Mass of tree to unlimited depth is 22260 5 kg Some more examples of ASCII Tree in action Idle gt vis ASCIITree verbose 1 Idle gt vis drawTree Set verbosity with vis ASCIITree verbose lt 10 does not print daughters of repeated placements does not repeat replicas gt 10 prints all physical volumes The level of detail is given by verbosity 10 for each volume gt 0 physical volume name logical volume name and names of sensitive detector and readout geometry if any solid name and type volume and density
330. l Geant4 code is written respecting these specifications and this makes it independent of the units chosen by the user If the units are not specified it is understood that the data is implicitly in the internal G4 system but this is strongly discouraged If the data set comes from an array or from an external file it is strongly recommended to set the units as soon as the data are read before any treatment For instance Epe EE OPE jma J oS SSE SE Oni TCI cary my calculations 3 3 2 2 Interactive commands Some built in commands from the User Interface UD also require the units to be specified For instance gun energy 15 2 kev gun position 3 2 7 meter If the units are not specified or are not valid the command is refused 3 3 3 Output your data You can output your data with the units you wish To do so it is sufficient to divide the data by the corresponding unit G4cout lt lt KineticEnergy keV lt lt keV G4cout lt lt density g cm3 xe M cu ona Of course G4cout lt lt KineticEnergy will print the energy in the internal units system There is another way to output your data Let Geant4 choose the most appropriate units for the actual numerical value of your data It is sufficient to specify to which category your data belong Length Time Energy etc For example G4cout lt lt G4BestUnit StepSize Length StepSize will be printed in km m mm fermi etc depending of its ac
331. l scripts env c sh Installation paths G4INSTALL Defines the path where the Geant4 toolkit should be installed It should be set by the system installer By default it sets to SHOME geant 4 assuming the Geant4 distribution is placed in HOME G4BASE Defines the path to the source code Internally used to define SCPPFLAGS and LDFLAGS for I and L directives It has to be set to SG4INSTALL src G4WORKDIR Defines the path for the user s workdir for Geant4 It is set by default to SHOME geant 4 assuming the user s working directory for Geant4 is placed in HOME G4INCLUDE Defines the path where source header files may be mirrored at installation by issuing gmake includes default is set to SG4INSTALL include G4BIN G4BINDIR Used by the system to specify the place where to store executables By default they re set to G4WORKDIR bin and 5G4BIN G4SYSTEM respectively The path to GAWORKDIR bin S GA4SYSTEM should be added to PATH in the user environment G4BIN can be overridden G4TMP G4TMPDIR Used by the system to specify the place where to store temporary files products of the compilation build of a user application or test By default they re set to G4WORKDIR tmp and G4TMP G4SYSTEM respec tively G4TMP can be overridden G4LIB G4LIBDIR Used by the system to specify the place where to store libraries By default they re set to G4INSTALL 1lib and 5G4LIB G4SYSTEM respectively
332. l virtual base classes which are themselves derived from G4VProcess Three of these classes are used for simple processes G4VRestProcess Processes using only the AtRestDoIt method example neutron capture G4VContinuousProcess Processes using only the AlongStepDoIt method example cerenkov G4VDiscreteProcess Processes using only the Post StepDoIt method 134 Tracking and Physics example compton scattering hadron inelastic interaction The other four classes are provided for rather complex processes G4VContinuousDiscreteProcess Processes using both AlongStepDoIt and PostStepDoIt methods example transportation ionisation energy loss and delta ray G4VRestDiscreteProcess Processes using both AtRestDoIt and Post StepDoIt methods example positron annihilation decay both in flight and at rest G4VRestContinuousProcess Processes using both At Rest DoIt and AlongStepDoIt methods G4VRestContinuousDiscreteProcess Processes using AtRestDoIt AlongStepDoIt and PostStepDolt methods Particle change G4VParticleChange and its descendants are used to store the final state information of the track including sec ondary tracks which has been generated by the DoIt methods The instance of G4VParticleChange is the only object whose information is updated by the physics processes hence it is responsible for updating the step The stepping manager collects secondary tracks and only sends requests via particle chan
333. lac stanford edu perl heprep Geant4 also provides an G4AttDefStore Geant4 provides some default examples of the use of this facility in the trajectory classes in source tracking such as G4Trajectory G4SmoothTrajectory G4Trajectory CreateAttValues shows how G4AttValue objects can be made and G4Trajectory GetAttDefs shows how to make the corresponding G4AttDef objects and use the G4AttDefStore Note that the user of CreateAttValues guarantees to destroy them this is a way of allowing cre ation on demand and leaving the G4Trajectory object for example free of such objects in memory The comments in G4VTrajectory hh explain further and additional insights might be obtained by looking at two methods which use them namely G4VTrajectory DrawTrajectory and G4VTrajectory ShowTrajectory Hits classes in examples extended analysis A01 and extended runAndEvent REO1 show how to do the same for your hits The base class no action methods CreateAttValues and GetAttDefs should be overridden in your concrete class The comments in G4VHit hh explain further In addition the user is free to add a G4std vector lt G4AttValue gt and a G4std vector lt G4AttDef gt to a G4VisAttributes object as could for example be used by a G4LogicalVolume object At the time of writing only the HepRep graphics systems are capable of displaying the G4AttValue information but this information will become useful for all Geant4 visualization systems through impro
334. lasses On the fly creation Category b 2 Ions will travel in a detector geometry and should be tracked however the number of ions which may be used for hadronic processes is so huge that ions are dynamic rather than static Each ion corresponds to one object of the G4lons class and it will be created on the fly in the G4ParticleTable GetIon method Dynamic creation by processes Category c 162 Tracking and Physics Particle types in this category are are not created by default but will only be created by request from processes or directly by users Each shortlived particle corresponds to one object of a class derived from G4VshortLivedParticle and it will be created dynamically during the initialization phase 5 3 2 4 G4ParticleDefinition The G4ParticleDefinition class has read only properties to characterize individual particles such as name mass charge spin and so on These properties are set during initialization of each particle Methods to get these prop erties are listed in Table 5 2 G4String GetParticleName particle name G4double GetPDGMass mass G4double GetPDGWidth decay width G4double GetPDGCharge electric charge G4double GetPDGSpin spin G4int GetPDGiParity parity O not defined G4int GetPDGiConjugation charge conjugation 0 not defined G4double GetPDGIsospin iso spin G4double GetPDGIsospin3 3 comp
335. lculate the upper weight bound upperLimitFaktor calculate the survival weight survivalFaktor and introduce a maximal number maxNumberOfSplits of copies to be created in one go In addition the inverse of the maxNumberOfSplits is used to specify the minimum survival probability in case of Russian roulette 3 7 1 7 The Weight Roulette Technique Weight roulette also called weight cutoff is usually applied if importance sampling and implicit capture are used together Implicit capture is not described here but it is useful to note that this procedure reduces a particle weight in every collision instead of killing the particle with some probability Together with importance sampling the weight of a particle may become so low that it does not change any result significantly Hence tracking a very low weight particle is a waste of computing time Weight roulette is applied in order to solve this problem The weight roulette concept Weight roulette takes into account the importance Ic of the current cell and the importance Is of the cell in which the source is located by using the ratio R Is Ic 55 Toolkit Fundamentals Weight roulette uses a relative minimal weight limit and a relative survival weight When a particle falls below the weight limit Russian roulette is applied If the particle survives tracking will be continued and the particle weight will be set to the survival weight The weight roulette uses the follo
336. le and G4Region These classes are discussed here 6 3 1 GAVUserEventlnformation G4VUserEventInformation is an abstract class from which the user can derive his her own concrete class for storing user information associated with a G4Event class object It is the user s responsibility to construct a concrete class object and set the pointer to a proper G4Event object Within a concrete implementation of G4UserEventAction the SetUserEventInformation method of G4EventManager may be used to set a pointer of a concrete class object to G4Event given that the G4Event object is available only by pointer to const Alternatively the user may modify the GenerateEvent method of his her own RunManager to instantiate a G4VUserEventInformation object and set it to G4Event The concrete class object is deleted by the Geant4 kernel when the associated G4Event object is deleted 178 User Actions 6 3 2 G4VUserTrackinformation This is an abstract class from which the user can derive his her own concrete class for storing user information associated with a G4Track class object It is the user s responsibility to construct a concrete class object and set the pointer to the proper G4Track object Within a concrete implementation of G4UserTrackingAction the SetUserTrackInformation method of G4TrackingManager may be used to set a pointer of a concrete class object to G4Track given that the G4Track object is available only by pointer to const
337. le in the field is integrated In general this is done using a Runge Kutta method for the integration of ordinary differential equations However for specific cases where an analytical solution is known it is possible to utilize this instead Several Runge Kutta methods are available suitable for different conditions In specific cases such as a uniform field where the ana lytical solution is known different solvers can also be used In addition when an approximate analytical solution is known it is possible to utilize it in an iterative manner in order to converge to the solution to the precision required This latter method is currently implemented and can be used particularly well for magnetic fields that are almost uniform Once a method is chosen that calculates the track s propagation in a specific field the curved path is broken up into linear chord segments These chord segments are determined so that they closely approximate the curved path The chords are then used to interrogate the Navigator as to whether the track has crossed a volume boundary Several parameters are available to adjust the accuracy of the integration and the subsequent interrogation of the model geometry How closely the set of chords approximates a curved trajectory is governed by a parameter called the miss distance also called the chord distance This is an upper bound for the value of the sagitta the distance between the real curved trajectory and the appr
338. lem size The default settings of this module are for problems with the physical size of a typical high energy physics setup that is distances smaller than about one kilometer A few parameters are necessary to carry this information to the magnetic field module and must typically be rescaled for problems of vastly different sizes in order to get reasonable performance and robustness Two of these parameters are the maximum acceptable step and the minimum step size The maximum acceptable step should be set to a distance larger than the biggest reasonable step If the apparatus in a setup has a diameter of two meters a likely maximum acceptable steplength would be 10 meters A particle 112 Detector Definition and Response could then take large spiral steps but would not attempt to take for example a 1000 meter long step in the case of a very low density material Similarly for problems of a planetary scale such as the earth with its radius of roughly 6400 km a maximum acceptabe steplength of a few times this value would be reasonable An upper limit for the size of a step is a parameter of G4PropagatorInField and can be set by calling its SetLargestAcceptableStep method The minimum step size is used during integration to limit the amount of work in difficult cases It is possible that strong fields or integration problems can force the integrator to try very small steps this parameter stops them from becoming unnecessarily s
339. lgorithm used by providing a class inheriting from G4VImportanceAlgorithm If no customized algorithm is given to the sampler the default importance sampling algorithm is used This algo rithm is implemented in G4ImportanceAlgorithm 3 7 1 6 The Weight Window Technique The weight window technique is a weight based alternative to importance sampling 53 Toolkit Fundamentals applies splitting and Russian roulette depending on space cells and energy user defines weight windows in contrast to defining importance values as in importance sampling In contrast to importance sampling this technique is not weight blind Instead the technique is applied according to the particle weight with respect to the current energy space cell Therefore the technique is convenient to apply in combination with other variance reduction techniques such as cross section biasing and implicit capture A weight window may be specified for every cell and for several energy regions space energy cell splitting to survival weight upper weight bound survival weight weight lower weight bound Russian roulette kill or move to survival weight Figure 3 2 Weight window concept Weight window concept The user specifies a lower weight bound W_L for every space energy cell The upper weight bound W_U and the survival weight W_S are calculated as W_U C_U W_Land W_S C_S W_L The user specifies C_S and C_U once for the whole problem
340. lid name 6 solid type Eg Layer wth cores logical volume E solid name i solid type GQ Absorber sam copy no logical volume solid name solid type For Help press F1 207 Visualization e Searching a string 4 Output XML Notepad ioi x File Edit View Insert Tools Help pisal 4 82 2 a Flos gt S Structure World copy_no 0 0 0 0 logical volume solid name solid type i Calorimeter copy_no pO logical volume solid name solid type aa 7 copy no 9 logical volume 6 solid name Md E GQ Abso EM Gap Find what Layer Search in Match case Cancel Content Direction C Up Down IV Element Tags 8 4 Controlling Visualization from Commands Attribute Names Attribute Values Comments For Help press F1 This section describes just a few of the more commonly used visualization commands For the complete list of commands and options see the Control UICommands section of this user guide For simplicity this section assumes that the Geant4 executable was compiled incorporating the DAWNFILE and the OpenGL Xlib drivers For details on creating an executable for visualization see Section 8 2 8 4 1 Scene scene handler and viewer In using the visualization commands it is useful to know the concept of scene scene
341. ling policies The default threshold density of the low density culling is 0 01 g cm The default culling policies can be modified with the following visualization commands Below the argument flag takes a value of t rue or false global vis viewer set culling global flag invisible vis viewer set culling invisible flag low density value is a proper value of a treshold density unit is either g cm3 mg cm3 or kg m3 vis viewer set culling density flag value unit covered daughter vis viewer set culling coveredDaughters flag density The HepRepFile graphic system will by default include culled objects in the file so that they can still be made visible later from controls in the HepRep browser If this behavior would cause files to be too large you can instead choose to have culled objects be omitted from the HepRep file See details in the HepRepFile Driver section of this user guide 8 4 15 Cut view Sectioning Sectioning means to make a thin slice of a 3D scene around a given plane At present this function is supported by the OpenGL drivers The sectioning is realized by setting a sectioning plane before performing visualization The sectioning plane can be set by the command vis viewer set sectionPlane on x y z units nx ny nz where the vector x y z defines a point on the sectioning plane and the vector nx ny nz defines the normal vector of the sectioning plane For example the following sets
342. ll in one plane This process thus depends on the particle s polarization spin The photon s polarization is a data member of the G4DynamicParticle class A photon which is not assigned a polarization at production either via the SetPolarization method of the G4PrimaryParticle class or indirectly with the SetParticlePolarization method of the G4ParticleGun class may not be Rayleigh scattered Optical photons produced by the G4Cerenkov process have inherently a polarization perpendicular to the cone s surface at production Scintillation photons have a ran dom linear polarization perpendicular to their direction The process requires a GAMaterialPropertiesTable to be filled by the user with Rayleigh scattering length data The Rayleigh scattering attenuation length is the average distance traveled by a photon before it is Rayleigh scattered in the medium and it is the distance returned by the GetMeanF reePath method The G40pRayleigh class provides aRayleighAttenuationLengthGenerator method which calculates the attenuation coef ficient of a medium following the Einstein Smoluchowski formula whose derivation requires the use of statistical mechanics includes temperature and depends on the isothermal compressibility of the medium This generator is convenient when the Rayleigh attenuation length is not known from measurement but may be calculated from first principles using the above material constants For a medium named Water and no Rayleigh scat
343. lly opti mized based on a comparison with results obtained using uniform cuts 5 5 2 Default Region The world volume is treated as a region by default A G4Region object is automatically assigned to the world volume and is referred to as the default region The production cuts for this region are the defaults which are defined in the UserPhysicsList Unless the user defines different cut values for other regions the cuts in the default region will be used for the entire geometry Please note that the default region and its default production cuts are created and set automatically by G4RunManager The user is not allowed to set a region to the world volume nor to assign other production cuts to the default region 5 5 3 Assigning Production Cuts to a Region In the SetCuts method of the user s physics list the user must first define the default cuts Then a G4ProductionCuts object must be created and initialized with the cut value desired for a given region This ob ject must in turn be assigned to the region object which can be accessed by name from the G4RegionStore An example SetCuts code follows 167 Tracking and Physics Example 5 12 Setting production cuts to a region void MyPhysicsList SetCuts default production thresholds for the world volume SetCutsWithDefault Production thresholds for detector regions G4Region region G4String regName G4ProductionCuts cuts regName tracker
344. lse It can be used as follows experimentalHall logical SetVisAttributes G4VisAttributes GetInvisible Direct access to the public static const data member G4VisAttributes Invisible is also possible but deprecated on account of initialisation issues with dynamic libraries 8 6 2 Colour 8 6 2 1 Construction Class G4Colour an equivalent class name G4Color is also available has 4 fields which represent the RGBA red green blue and alpha components of colour Each component takes a value between 0 and 1 If an irrele vant value i e a value less than O or greater than 1 is given as an argument of the constructor such a value is automatically clipped to 0 or 1 Alpha is opacity which is not used at present You can use its default value 1 which means opaque in instantiation of G4Colour A G4Colour object is instantiated by giving red green and blue components to its constructor i e G4Colour G4Colour G4double r 1 0 G4double g 1 0 G4double b 1 0 SZ douce Una O lt red green blue lt 1 0 The default value of each component is 1 0 That is to say the default colour is white opaque For example colours which are often used can be instantiated as follows G4Colour white 0 white G4Colour white dus 2407 db o V ae G4Colour gray Dose Ue Ves oe MU opas G4Colour black G50 W 0 050 5 7 Ju G4Colour red LOO O20 4050 2 V see G4Colour green o0 on 0020 8 f
345. lumes matching those registered with the model will pass the filter 234 Visualization G4TrajectoryAttributeFilter This model filters trajectories based on the HepRep style attributes associated with trajectories Each attribute drawer can be configured with interval and or single value data Single value data should override the interval data Units should be specified on the command line if the attribute unit is specified either as a G4BestUnit or if the unit is part of the value string 8 8 1 Controlling from Commands Multiple trajectory filter models can be created and configured using commands in the vis filtering trajectories directory All generated filter models are chained together automatically Model configuration commands are generated dynamically when a filter model is instantiated These commands apply directly to that instance See the interactive help for more information on the available commands 8 8 2 Example commands Create a particle filter Configure to pass only gammas Then invert to pass anything other than gammas Set verbose printout and then deactivate filter vis filtering trajectories create particleFilter vis filtering trajectories particleFilter 0 add gamma vis filtering trajectories particleFilter 0 invert true vis filtering trajectories particleFilter 0 verbose true vis filtering trajectories particleFilter 0 active false Create a charge filter Configure to pass only neut
346. m nuclear in teractions 9 2 1 16 Run amp Event REO1 information between primary particles and hits and usage of user information classes REO2 simplified fixed target application for demonstration of primitive scorers 9 2 1 17 Visualization Examples of customisation for visualization 9 3 Advanced Examples 9 3 1 Advanced Examples Geant4 advanced examples illustrate realistic applications of Geant4 in typical experimental environments Most of them also show the usage of analysis tools such as histograms ntuples and plotting various visualization features and advanced user interface facilities together with the simulation core Note Maintenance and updates of the code is under the responsibility of the authors These applications are therefore not subject to regular system testing and no guarantee can be provided The advanced examples include air shower a simulation of the ULTRA detector with Fresnel lenses for UV and charged particles detection in cosmic rays brachytherapy illustrating a typical medical physics application simulating energy deposit in a Phantom filled with soft tissue hadrontherapy illustrating a application simulating an hadron therapy beam line for medical physics human phantom implementing an Anthropomorphic Phantom body built importing the description from a GDML representation medical linac illustrating a typical medical physics application simulating energy deposit in a Phantom
347. mall Trial steps smaller than this parameter will be treated with less accuracy and may even be ignored depending on the situation The minimum step size is a parameter of the MagInt_Driver but can be set in the contstructor of G4ChordFinder as in the source listing above 4 3 2 8 Known Issues Currently it is computationally expensive to change the miss distance to very small values as it causes tracks to be limited to curved sections whose bend is smaller than this value The bend is the distance of the mid point from the chord between endpoints For tracks with small curvature typically low momentum particles in strong fields this can cause a large number of steps even in areas where there are no volumes to intersect something that is expected to be addressed in future development in which the safety will be utilized to partially alleviate this limitation especially in a region near a volume boundary in which case it is necessary in order to discover whether a track might intersect a volume for only a short distance Requiring such precision at the intersection is clearly expensive and new development would be necessary to minimize the expense By contrast changing the intersection parameter is less computationally expensive It causes further calculation for only a fraction of the steps in particular those that intersect a volume boundary 4 3 3 Spin Tracking The effects of a particle s motion on the precessio
348. materials for which physics tables are already built and Compute methods which can be applied to any material defined in the application or existing in the Geant4 internal database The public methods of this class are e GetDEDX kinEnergy particle material G4Region region 0 e GetRangeFromRestrictedDEDX kinEnergy particle material G4Region region 0 e GetCSDARange kinEnergy particle material G4Region region 0 e GetRange kinEnergy particle material G4Region region 0 e GetKinEnergy range particle material G4Region region 0 e GetCrosSectionPerVolume kinEnergy particle material G4Region region 0 e GetMeanFreePath kinEnergy particle material G4Region region 0 PrintDEDXTable particle e PrintRangeTable particle e PrintInverseRangeTable particle e ComputeDEDX kinEnergy particle process material cut DBL MAX e ComputeElectronicDEDX kinEnergy particle material cut DBL MAX ComputeNuclearDEDX kinEnergy particle material cut DBL MAX e ComputeTotalDEDX kinEnergy particle material cut DBL MAX ComputeCrosSectionPerVolume kinEnergy particle process material cut 0 ComputeCrosSectionPerAtom kinEnergy particle process Z A cut 0 ComputeMeanFreePath kinEnergy particle process material cut 0 FindParticle const G4String amp e FindMaterial const G4String amp FindRegion const G4String amp e FindCouple const G4Material const G4Region region 0 e SetVerbose Gdint For these interfaces particles materials
349. ment a specific material or for general appli cability void SetMinEnergy void SetMinEnergy void SetMinEnergy void SetMaxEnergy void SetMaxEnergy void SetMaxEnergy G4double anEnergy G4Element anElement G4double anEnergy G4Material aMaterial const G4double anEnergy G4double anEnergy G4Element anElement G4double anEnergy G4Material aMaterial const G4double anEnergy Which models are there and what are the defaults In Geant4 any model can be run together with any other model without the need for the implementation of a special interface or batch suite and the ranges of applicability for the different models can be steered at initialisation time This way highly specialised models valid only for one material and particle and applicable only in a very restricted energy range can be used in the same application together with more general code in a coherent fashion Each model has an intrinsic range of applicability and the model chosen for a simulation depends very much on the use case Consequently there are no defaults However physics lists are provided which specify sets of models for various purposes 145 Tracking and Physics Three types of hadronic shower models have been implemented parametrisation driven models data driven mod els and theory driven models e Parametrisation driven models are used for all processes pertaining to particles coming to rest and
350. metry in a graphical manner GGE provides methods to 95 Detector Definition and Response 1 construct a detector geometry including G4Element G4Material G4Solids G4LogicalVolume G4PVPlacement etc view the detector geometry using existing visualization system like DAWN keep the detector object in a persistent way produce corresponding C codes after the norm of Geant4 toolkit make a Geant4 executable under adequate environment GE Do GGE is implemented with Java using Java Foundation Class Swing 1 0 2 In essence GGE is made a set of tables which contain all relevant parameters to construct a simple detector geometry The software installation instructions and notes for GGE and other JAV A based UI tools can be freely downloaded from the Geant4 GUI and Environments web site of Naruto University of Education in Japan 4 1 9 1 Materials elements and mixtures GGE provides the database of elements in a form of the periodic table which users can use to construct new materials GGE provides a pre constructed database of materials taken from the PDG book They can be loaded used edited and saved as persistent objects Users can also create new materials either from scratch or by combining other materials creating a material from scratch Use Name JA Z Density Unit State Temper Unit Pressure Unit ature Only the elements and materials used in the logical volumes
351. mother physical volume is used since there is only one physical volume of gap is placed with respect to its mother G4vPrimitiveScorer primitive primitive new G4PSEnergyDeposit eDep j det gt RegisterPrimitive primitive primitive new G4PSNofSecondary nGamma j primitive gt SetFilter gammaFilter det gt RegisterPrimitive primitive primitive new G4PSNofSecondary nElectron j primitive gt SetFilter electronFilter det gt RegisterPrimitive primitive primitive new G4PSNofSecondary nPositron j primitive gt SetFilter positronFilter det gt RegisterPrimitive primitive primitive new G4PSMinKinEAtGeneration minEkinGamma j primitive gt SetFilter gammaFilter det gt RegisterPrimitive primitive primitive new G4PSMinKinEAtGeneration minEkinElectron j primitive gt SetFilter electronFilter det gt RegisterPrimitive primitive primitive new G4PSMinKinEAtGeneration minEkinPositron j primitive gt SetFilter positronFilter det gt RegisterPrimitive primitive primitive new G4PSTrackLength trackLength j primitive gt SetFilter epFilter det gt RegisterPrimitive primitive primitive new G4PSNofStep nStep j primitive gt SetFilter epFilter det gt RegisterPrimitive primitive 7 G4SDManager Get SDMpointer gt AddNewDetector det aue O layerLogical i gt SetSensitiveDetector det ele
352. mulate Additional note You may instead choose to use update commands from your BeginOfRunAction or EndOfEventAction as in early examples but now the vis manager ia able to do most of what most users require through the above commands Command vis scene endOfRunAction refresh accumulate Action Control how often the picture should be cleared refresh means each run will be written to a new picture accumulate means runs will be accumulated into a single picture To start a new picture you must explicitly issue vis viewer refresh vis viewer update or vis viewer flush 8 4 12 HepRep Attributes for Trajectories The HepRep file formats HepRepFile and HepRepXML attach various attributes to trajectories such that you can view these attributes label trajectories by these attributes or make visibility cuts based on these attributes If you use the default Geant4 trajectory class from tracking src G4Trajectory cc available attributes will be Track ID e Parent ID e Particle Name e Charge e PDG Encoding e Momentum 3 Vector e Momentum magnitude e Number of points 213 Visualization You can add additional attributes of your choosing by modifying the relevant part of G4Trajectory look for the methods GetAttDefs and CreateAttValues If you are using your own trajectory class you may want to consider copying these methods from G4Trajectory 8 4 13 How to save a visualized views to PostScript files Most of
353. muons class name G4AnnihiToMuPair e Positron annihilation into hadrons class name G4eeToHadrons e Muon processes 135 Tracking and Physics e Jonisation and delta ray production class name G4Mulonisation Bremsstrahlung class name G4MuBremsstrahlung e e e pair production class name G4MuPairProduction e Hadron ion processes Jonisation class name G4hlonisation e Jonisation for ions class name G4ionEnergyLoss e Jonisation for heavy exotic particles class name G4hhIonisation The multiple scattering process The class name G4MultipleScattering is a general process in the sense that the same process class is used to simulate the multiple scattering of all the charged particles i e it is used for e e muons charged hadrons e The processes described above use physics model classes which may be combined according to particle ener gy It is possible to change the energy range over which different models are valid and to apply other models specific to particle type energy range and G4Region The following alternative models are available e Jonisation in thin absorbers class name G4PAIModel An example of the registration of these processes in a physics list is given in Example 5 1 extracted from exam ples novice N02 Example 5 1 Registration of standard electromagnetic processes void PhysicsList ConstructEM theParticlelterator gt reset while theParticleIterator G4ParticleDefin
354. n e void SetParticleMomentum G4ParticleMomentum void SetParticleMomentumDirection G4ThreeVector void SetParticleEnergy G4double e void SetParticleTime G4double e void SetParticlePosition G4ThreeVector e void SetParticlePolarization G4ThreeVector e void SetNumberOfParticles G4int 2 7 How to Make an Executable Program 2 7 1 Building ExampleN01 in a UNIX Environment The code for the user examples in Geant4 is placed in the directory G4INSTALL examples where SGA4INSTALLis the environment variable set to the place where the Geant4 distribution is installed set by default to SHOME geant 4 In the following sections a quick overview on how the GNUmake mechanism works in Geant4 will be given and we will show how to build a concrete example ExampleNO1 which is part of the Geant4 distribution 2 7 1 1 How GNUmake works in Geant4 The GNUmake process in Geant4 is mainly controlled by the following GNUmake script files gmk scripts are placed in SG4INSTALL config Getting Started with Geant4 Running a Simple Example architecture gmk invoking and defining all the architecture specific settings and paths which are stored in G4INSTALL config sys common gmk defining all general GNUmake rules for building objects and libraries globlib gmk defining all general GNUmake rules for building compound libraries binmake gmk defining the general GNUmake rules for building executables GNUm
355. n G4RunManager is deleted The run manager is also responsible for managing initialization procedures including methods in the user initialization classes Through these the run manager must be given all the information necessary to build and run the simulation including Getting Started with Geant4 Running a Simple Example how the detector should be constructed all the particles and all the physics processes to be simulated how the primary particle s in an event should be produced and PING any additional requirements of the simulation In the sample main the lines runManager gt SetUserInitialization new ExN0lDetectorConstruction runManager gt SetUserInitialization new ExN01PhysicsList create objects which specify the detector geometry and physics processes respectively and pass their pointers to the run manager ExNO1DetectorConstruction is an example of a user initialization class which is derived from G4VUserDetectorConstruction This is where the user describes the entire detector setup including e its geometry the materials used in its construction adefinition of its sensitive regions and e the readout schemes of the sensitive regions Similarly ExNO1PhysicsList is derived from G4VUserPhysicsList and requires the user to define the particles to be used in the simulation e the range cuts for these particles and e all the physics processes to be simulated The next instruction in main runM
356. n close the geometry providing a pointer to the top physical volume concerned Example 4 9 Opening and closing a portion of the geometry without notifying the G4RunManager include G4GeometryManager hh Open geometry for the physical volume to be modified Vai G4GeometryManager OpenGeometry physCalor Modify dimension of the solid physCalor gt GetLogicalVolume gt GetSolid gt SetXHalfLength 12 5 cm Close geometry for the portion modified G4GeometryManager CloseGeometry physCalor If the existing geometry setup is modified locally in more than one place it may be convenient to apply such a technique only once by specifying a physical volume on top of the hierarchy subtree containing all changed portions of the setup An alternative solution for dealing with dynamic geometries is to specify NOT to apply optimisation for the subtree affected by the change and apply the general solution of invoking the G4RunManager In this case a performance penalty at run time may be observed depending on the complexity of the not optimised subtree considering that without optimisation intersections to all volumes in the subtree will be explicitely computed each time 4 1 13 Importing XML Models Using GDML An example of how to import and export a detector description model based on GDML is provided and can be found inexamples extended gdm1 A description on how to describe a geometry in GDML tog
357. n new MyDetectorConstruction runManager set userInitialization new MyPhysicsList UserAction classes runManager set userAction runManager gt set userAction runManager set userAction runManager set userAction new MyRunAction new MyPrimaryGeneratorAction new MyEventAction new MySteppingAction ifdef G4VIS USE G4VisManager visManager new G4VisExecutive visManager gt initialize fendif Event loop Define G UI terminal G4UIsession session new G4UIterminal session gt sessionStart delete session delete runManager ifdef G4VIS USE delete visManager fendif return 0 ff end of C Useful information on incorporated visualization drivers can be displayed in initializing the Visualization Man ager This is done by setting the verbosity flag to an appropriate string Simple graded message scheme give first letter or a digit 0 quiet Nothing is printed D grece Startup and endup messages are printed 2 errors 27 CET BYP OLS wc 3 warnings JL CET arci Wa INS 4 confirmations and confirming messages 5 parameters and parameters of scenes and views 6 all and everything available For example in your main function write the following code G4VisManager visManager new G4VisExecutive visManager SetVerboseLevel 1 visManager gt Initialize This can also be set with the vis verbose command
358. n of its spin angular momentum in slowly varying external fields are simulated The relativistic equation of motion for spin is known as the BMT equation The equation demonstrates a remarkable property in a purely magnetic field in vacuum and neglecting small anomalous mag netic moments the particle s spin precesses in such a manner that the longitudinal polarization remains a constant whatever the motion of the particle But when the particle interacts with electric fields of the medium and multi ple scatters the spin which is related to the particle s magnetic moment does not participate and the need thus arises to propagate it independent of the momentum vector In the case of a polarized muon beam for example it is important to predict the muon s spin direction at decay time in order to simulate the decay electron Michel distribution correctly In order to track the spin of a particle in a magnetic field you need to code the following 1 in your DetectorConstruction include G4Mag_SpinEqRhs hh G4Mag_EqRhs fEquation new G4Mag SpinEgRhs magField G4MagIntegratorStepper pStepper new G4ClassicalRK4 fEquation 12 notice the 12 2 in your PrimaryGenerator 113 Detector Definition and Response particleGun gt SetParticlePolarization G4ThreeVector p for example particleGun gt SetParticlePolarization particleGun gt GetParticleMomentumDirection kon particleGun gt SetParticlePolarizatio
359. n of the user hooks by which the simulation code may be customized to perform special tasks Chapter 7 Communication and Control provides a summary of the commands available to the user to control the execution of the simulation After Chapter 2 Chapters 6 and 7 are of formeost importance to the new application developer The display of detector geometry tracks and events may be incorporated into a simulation application by using the tools described in Chapter 8 Visualization Chapter 9 Examples provides a set of novice and advanced simulation codes which may be compiled and run as is from the Geant4 source code These examples may be used as educational tools or as base code from which more complex applications are developed Chapter 2 Getting Started with Geant4 Running a Simple Example 2 1 How to Define the main Program 2 1 1 A Sample main Method The contents of main will vary according to the needs of a given simulation application and therefore must be supplied by the user The Geant4 toolkit does not provide a main method but a sample is provided here as a guide to the beginning user Example 2 1 is the simplest example of main required to build a simulation program Example 2 1 Simplest example of main include G4RunManager hh include G4UImanager hh include ExN01DetectorConstruction hh include ExN01PhysicsList hh include ExN01PrimaryGeneratorAction hh int main
360. n particleGun gt GetParticleMomentumDirection cross G4ThreeVector 0 1 0 where you set the initial spin direction While the G4Mag SpinEgRhs class constructor G4Mag SpinEqRhs G4Mag SpinEgRhs G4MagneticField MagField G4Mag EgRhs MagField anomaly 1 165923e 3 sets the muon anomaly by default the class also comes with the public method inline void SetAnomaly G4double a anomaly a with which you can set the magnetic anomaly to any value you require For the moment the code is written such that field tracking of the spin is done only for particles with non ze ro charge Please see the Forum posting http geant4 hn slac stanford edu 5090 Hyper News public get emfields 88 3 1 html for modifications the user is required to make to facilitate neutron spin tracking 4 4 Hits 4 4 1 Hit A hit is a snapshot of the physical interaction of a track in the sensitive region of a detector In it you can store information associated with a G4Step object This information can be the position and time of the step the momentum and energy of the track the energy deposition of the step geometrical information or any combination of the above G4VHit G4VHit is an abstract base class which represents a hit You must inherit this base class and derive your own concrete hit class es The member data of your concrete hit class can be and should be your choice G4VHit has two virtual met
361. nager theMessenger Constructor Arguments are the full path command name and the pointer to your messenger void SetParameterName char paramName G4bool omittable Define the name of the string parameter and set the omittable flag If omittable is true you should define the default value using the next method 183 Comommunication and Control void SetDefaultValue char defVal Define the default value of the string parameter void SetCandidates char candidateList Define a candidate list which can be taken by the parameter Each candidate listed in this list should be sep arated by a single space If this candidate list is given a string given by the user but which is not listed in this list will be rejected G4UIcmdWith3Vector This is a G4UIcommand derived class which takes one three vector parameter G4UIcmdWith3Vector char commandpath G4UImanager theMessenger Constructor Arguments are the full path command name and the pointer to your messenger void SetParameterName char paramNamX char paramNamY char paramNamZ G4bool omittable Define the names of each component of the three vector and set the omittable flag If omittable is true you should define the default value using the next method void SetDefaultValue G4ThreeVector defVal Define the default value of the three vector G4ThreeVector GetNew3VectorValue G4String paramString Convert the G4String parameter value given by the SetNewV
362. nal User Defined Attributes ssesssee HH 229 8 7 Enhanced Trajectory Drawing rette terr ko keep Pene EE ERE dread se as Sean 229 8 7 1 Default eunituncujo m 229 8 7 2 Trajectory Drawing Models tete tege ER et a P sale ER rb genes 230 8 7 3 Controlling from Commands sss e emen herren 231 8 7 4 Controlling from Compiled Code lt aaa kaka aaa aaa aaa aa eee 233 8 75 Drawing by time esee e etel tender tiene ce EE EE EEEE EES EEE 233 8 8 Trajectory Falt nng ssi cs to etm re SPORT Ey TERRE Ere RF D EE ER SK 234 8 8 1 Controlling from Commands sss eene entrent 235 8 8 2 Example commands 5 ertet rem rete koa ss oi rene sa 235 8 8 3 Hit Filtering IRISH UE IS ERE EET RUN ahead 236 8 9 PolyInes Markers And Text i c tte Ee Pe Oei Ree sa 236 8 91 Polylin i inmune eee arp i ER epe 236 8 92 Markers oie or or Re EP EE eR RR ER e so si 236 io A 238 8 10 Making a MOViE itt ER ai ias i a Da a EO OR a a cea aes 239 8 10 1 OGK MEE 239 8 10 2 DAWNEILE pease orio ana saaa Ete HR Pete EP i asis a ET NISE EEES 240 8 10 3 Ray Ir cerX eio ei nere ia teca sa EE EEE E EEE EE E a 240 DL Examples etre repete Go eri Exe ette ee i a E E ja Stee E a EEA 242 9 1 Novice Examples arr desi sa ias ks EE EE EDI EI E enced 242 9 1 1 Novice Example Summary 1 uere he bee re ed Ee Dai ss is 242 9 1 2 Example NOL 2 2 rera erp IRE ERR EM ia sa ISO e PA EU qne 245 91 3
363. nctions for geometries containing place ment physical volumes with voxels Internally a stack of voxel information is maintained Private functions allow for isotropic distance computation to voxel boundaries and for computation of the next voxel in a spec ified direction G4ParameterisedNavigation provides location and distance computation functions for geome tries containing parameterised volumes with voxels Voxel information is maintained similarly to G4VoxelNavigation but computation can also be simpler by adopting voxels to be one level deep only unrefined or 1D optimisation G4ReplicaNavigation provides location and distance computation functions for replicated volumes 92 Detector Definition and Response In addition the navigator maintains a set of flags for exiting entry optimisation A navigator is not a singleton class this is mainly to allow a design extension in future e g geometrical event biasing 4 1 8 1 Navigation and Tracking The main functions required for tracking in the geometry are described below Additional functions are provided to return the net transformation of volumes and for the creation of touchables None of the functions implicitly requires that the geometry be described hierarchically SetWorldVolume Sets the first volume in the hierarchy It must be unrotated and untranslated from the origin LocateGlobalPointAndSetup Locates the volume containing the specified global poi
364. nel or event generators See below for information on the determination of the decay modes An object of G4Decay can be shared by particles Registration of the decay process to particles in the Con structPhysics method of PhysicsList see Section 2 5 3 is shown in Example 5 4 146 Tracking and Physics Example 5 4 Registration of the decay process to particles in the ConstructPhysics method of Physics List include G4Decay hh void ExN02PhysicsList ConstructGeneral Add Decay Process G4Decay theDecayProcess new G4Decay theParticleIterator reset while theParticleIterator G4ParticleDefinition particle theParticlelterator gt value G4ProcessManager pmanager particle GetProcessManager if theDecayProcess IsApplicable particle pmanager AddProcess theDecayProcess set ordering for PostStepDoIt and AtRestDoIt pmanager SetProcessOrdering theDecayProcess idxPostStep pmanager SetProcessOrdering theDecayProcess idxAtRest 5 2 3 2 Decay Table Each particle has its G4DecayTable which stores information on the decay modes of the particle Each de cay mode with its branching ratio corresponds to an object of various decay channel classes derived from G4VDecayChannel Default decay modes are created in the constructors of particle classes For example the de cay table of the neutral pion has G4PhaseSpaceDecayChannel and G4DalitzDecayChannel as follows
365. neratorS auterGavrilla and G4PhotoElectricAngularGeneratorPolarized can be set us ing the strings standard and polarized Information regarding conditions of use performance and energy limits of different models are available in the Physics Reference Manual and in the Geant4 Low Energy Electromagnetic Physics Working Group homepage 5 2 1 3 Interactions of Muons The following is a summary of the muon interaction processes available in Geant4 Bremsstrahlung class name G4MuBremsstrahlung e onisation and delta ray knock on electron production class name G4Mulonisation e Nuclear interaction class name G4MuNuclearInteraction Direct pair production class name G4MuPairProduction In the case of muons the bremsstrahlung ionisation and pair production processes give contributions to the total continuous energy loss 5 2 1 4 X ray production Processes The following is a summary of the X ray production processes available in Geant4 e Cerenkov process class name G4Cerenkov e Synchrotron radiation class name G4SynchrotronRadiation e Transition radiation class names G4TransitionRadiation and G4ForwardXrayTR The Low Energy electromagnetic processes listed in section Section 5 2 1 2 also produce X rays through fluores cence 5 2 2 Hadronic Interactions This section briefly introduces the hadronic physics processes installed in Geant4 For details of the implementa tion of hadronic interactions available in Gean
366. ng G4VHit as follows fae C source codes An example of giving concrete implementation of f G4VHit Draw using class MyTrackerHit public G4VHit 14 void MyTrackerHit Draw G4VVisManager pVVisManager G4VVisManager GetConcreteInstance if pVVisManager define a circle in a 3D space G4Circle circle pos circle SetScreenSize 0 3 circle SetFillStyle G4Circle filled make the circle red GAcolkour colour IPs G4VisAttributes attribs colour circle SetVisAttributes attribs make a 3D data for visualization pVVisManager Draw circle end of C source codes The overloaded implementation of G4VHitsCollection DrawAllHits will be held by for example class MyTrackerHitsCollection inheriting class G4VHitsCollection as follows C source codes An example of giving concrete implementation of G4VHitsCollection Draw ti using class MyTrackerHit public G4VHitsCollection void MyTrackerHitsCollection DrawAllHits G4int n_hit theCollection entries for G4int i 0 i lt n hit i theCollection i Draw 219 Visualization end of C source codes Thus you can visualize hits as well as trajectories for example at the end of each event by implementing the method MyEventAction EndOfEventAction as follows void co G4 G4 G4 G4 G4 G4 aiie G4 G4 AR G4 wae t MyEventAction EndOf
367. ng OpenGL in Stored mode and DAWN exNO3Vis3 mac A basic macro for demonstrating various drawing styles using OpenGL in Immediate mode and DAWN exN03Vis4 mac An example of visualizing specific logical volumes using OpenGL in Immediate mode and DAWN exN03Vis5 mac A basic macro for visualization of detector geometry and events using OpenInventor on Unix exN03Vis6 mac A basic macro for visualization of detector geometry and events using VRML exN03Vis7 mac A macro to demonstrate batch visualization to generate PostScript files with the DAWNFILE driver exNO3Vis8 mac A macro to demonstrate creation of a multi page PostScript file with the DAWNFILE driver exN03Vis9 mac A basic macro for visualization of detector geometry and events using OpenGL for Windows exN03Vis10 mac A basic macro for visualization of detector geometry and events using OpenInventor on Windows exN03Vis11 mac 216 Visualization A basic macro for visualization of detector geometry and events using OpenGL in Stored Motif mode and DAWN e exNO3Vis12 mac and exNO3Vis12 loop A basic macro for demonstrating time slicing e exNO3Vis13 mac and exNO3Vis3 loop Time development of an electrmagnetic shower e exN03Tree0 mac A macro to demonstrate ASCII tree exNOS3Treel mac A macro to demonstrate GAG tree 8 5 Controlling Visualization from Compiled Code While a Geant4 simulation is running visualization can be performed w
368. ng a concrete run class derived from G4Run base class for accumulating physics quantities and hits as a run Hits Demonstrating the use of primitive scorer and filter classes without implementing sensitive detector class Classes main source file main for interactive mode and batch mode via macro file construction and deletion of G4RunManager construction and deletion of G4VisExective and G4UITerminal construction and set of mandatory user classes construction and set of ExNO7RunAction ExNO7DetectorConstruction header file source file derived from G4VUserDetectorConstruction definitions of materials and mixtures G4Box with G4PVPlacement and G4PVReplica Dynamic changing of size position orientation and number of volumes 252 Examples G4Region for each calorimeter tower G4VPrimitiveScorer and G4VSDFilter visualization ExN07DetectorMessenger header file source file derived from G4UIMessenger definition of example specific geometry commands ExN07PhysicsList header file source file e derived from G4VUserPhysicsList e difine all types of particles e define standard EM and decay processes e production thresholds for each region ExN07PrimaryGeneratorAction header file source file derived from G4VPrimaryGeneratorAction construction of G4ParticleGun e primary event generation via particle gun ExN07RunAction header file source file derived from G4UserRunAct
369. niquely a physical volume in your mass geometry is by using the touchables see also section 4 1 5 of the User s Guide for Application Developers as follows G4Step aStep G4StepPoint preStepPoint aStep GetPreStepPoint G4TouchableHandle theTouchable preStepPoint GetTouchableHandle G4int copyNo theTouchable gt GetCopyNumber G4int motherCopyNo theTouchable gt GetCopyNumber 1 where Copy here stays for any duplicated instance of a physical volume either if it is a G4PVPlacement multiple placements of the same logical volume or a G4PVReplica G4PVParameterised The method Get CopyNo is meant to return only the serial number of placements not duplicated in the ge ometry tree Q How can I determine the exact position in global coordinates in my mass geometry during tracking and how can I convert it to coordinates local to the current volume A You need again to do it through the touchables see also section 4 1 5 of the User s Guide for Application Developers as follows G4Step aStep G4StepPoint preStepPoint aStep GetPreStepPoint G4TouchableHandle theTouchable preStepPoint GetTouchableHandle G4ThreeVector worldPosition preStepPoint gt GetPosition G4ThreeVector localPosition theTouchable gt GetHistory gt GetTopTransform TransformPoint worldPosition where worldPosition here stays for the position related to the world volume while localPosition refers to the c
370. not The user implements the desired parameterisation function and the program computes and updates automatically at run time the information associated to the Physical Volume An example of creating a parameterised volume by dimension and position exists in novice exam ple N02 The implementation is provided in the two classes ExNO2DetectorConstruction and ExNO2ChamberParameterisation To create a parameterised volume one must first create its logical volume like trackerChamberLV below Then one must create his own parameterisation class ExNO2ChamberParameterisation and instantiate an object of this class chamberParam We will see how to create the parameterisation below Example 4 3 An example of Parameterised volumes f itn En EI T ar Tracker segments f fee rers An example of Parameterised volumes dummy values for G4Box modified by parameterised volume G4VSolid solidChamber new G4Box chamberBox 10 cm 10 cm 10 cm G4LogicalVolume trackerChamberLV new G4LogicalVolume solidChamber Aluminum trackerChamberLV G4VPVParameterisation chamberParam new ExNO2ChamberParameterisation 6 NoChambers 240 cm Z of centre of first 80 cm 4 spacing of centres Al Gp Width Chamber 50 cm lengthInitial trackerSize 2 lengthFinal G4VPhysicalVolume trackerChamber phys new G4PVParameterised TrackerChamber parameterisedPV trackerChamberLV Its logical volume l
371. nt This involves a traverse of the hierarchy reguir ing the computation of compound transformations testing replicated and parameterised volumes etc To improve efficiency this search may be performed relative to the last and this is the recommended way of calling the function A relative search may be used for the first call of the function which will result in the search defaulting to a search from the root node of the hierarchy Searches may also be performed using a G4TouchableHistory LocateGlobalPointAndUpdateTouchableHandle First search the geometrical hierarchy like the above method LocateGlobalPointAndSetup Then use the volume found and its navigation history to update the touchable ComputeStep Computes the distance to the next boundary intersected along the specified unit direction from a specified point The point must be have been located prior to calling ComputeStep When calling ComputeStep a proposed physics step is passed If it can be determined that the first intersection lies at or beyond that distance then kInfinity is returned In any case if the returned step is greater than the physics step the physics step must be taken SetGeometricallyLimitedStep Informs the navigator that the last computed step was taken in its entirety This enables entering exiting opti misation and should be called prior to calling LocateGlobalPointAndSetup e CreateTouchableHistory Creates a G4Toucha
372. nt object during this method can be used for during the event processing digitization EndOfEvent This method is invoked at the end of each event The argument of this method is the same object as the previous method Hit collections occasionally created in your sensitive detector can be associated with the G4HCofThisEvent object 116 Detector Definition and Response 4 4 3 Readout geometry This section describes how a Readout geometry can be defined A Readout geometry is a virtual parallel ge ometry for obtaining the channel number As an example the accordion calorimeter of ATLAS has a complicated tracking geometry however the readout can be done by simple cylindrical sectors divided by theta phi and depth Tracks will be traced in the tracking geometry the real one and the sensitive detector will have its own readout geometry Geant4 will message to find to which readout cell the current hit belongs The Tracking Geometry A Readout Geometry builds by G4VUserDetectorC onstruction builds by a G4VReadoutGeometry G4VSensitiveDetector object W World of RO geometry Figure 4 8 Association of tracking and readout geometry Figure 4 8 shows how this association is done in Geant4 The first step is to associate a sensitive detector to a volume of the tracking geometry in the usual way see Section 4 4 2 The next step is to associate your G4VReadoutGeometry obje
373. nt4 All of these classes are derived from the abstract class G4VRestProcess In addition to the constructor and de structor methods the following public methods of the abstract class have been implemented for each of the above six processes e AtRestGetPhysicallInteractionLength const G4Track amp G4ForceCondition This method returns the time taken before the interaction actually occurs In all processes listed above except for muon capture a value of zero is returned For the muon capture process the muon capture lifetime is returned e AtRestDoIt const G4Track amp const G4Step amp This method generates the secondary particles produced by the process e IsApplicable const G4ParticleDefinition This method returns the result of a check to see if the process is possible for a given particle Example of how to use a hadron at rest process Including a hadron at rest process for a particle a pi for example into the Geant4 system is straightforward and can be done in the following way create a process theProcess new G4PionMinusAbsorptionAtRest register the process with the particle s process manager theParticleDef G4PionMinus PionMinus G4ProcessManager pman theParticleDef GetProcessManager pman gt AddRestProcess theProcess 143 Tracking and Physics 5 2 2 3 Hadrons in Flight What processes do you need For hadrons in motion there are four physics process classes
374. ntegrate the quantity but records the minimum quantity G4PSNofSecondary This class scores the number of secondary particles generated in the volume The weight of the secondary track is taken into account G4PSNofStep This class scores the number of steps in the cell A particle weight is not applied G4PSCellCharge This class scored the total charge of particles which has stoped in the volume 4 4 7 G4VSDFilter and its derived classes G4VSDFilter is an abstract class that represents a track filter to be associated with G4VSensitiveDetector or G4VPrimitiveScorer It defines a virtual method G4bool Accept const G4Step that should return true if this particular step should be scored by the G4VSensitiveDetector or G4VPrimitiveScorer While the user can implement his her own filter class Geant4 version 8 0 provides the following concrete filter classes G4SDChargedFilter All charged particles are accepted G4SDNeutralFilter All neutral particles are accepted G4SDParticleFilter Particle species which are registered to this filter object by Add particle_name are accepted More than one species can be registered G4SDKineticEnergyFilter A track with kinetic energy greater than or equal to EKmin and smaller than EKmin is accepted EKmin and EKmax should be defined as arguments of the constructor The default values of EKmin and EKmax are zero and DBL_MAX G4SDParticleWithEnergyFilter Combination of G4SDParticleFilter and
375. nvert i j ppm echo command command done mpeg2encode mpeg2encode par g4RayTracer mpg open g4RayTracer mpg 241 Chapter 9 Examples 9 1 Novice Examples The Geant4 toolkit includes several fully coded examples which demonstrate the implementation of the user classes required to build a customized simulation Seven novice examples are provided ranging from the simulation of a non interacting particle and a trivial detector to the simulation of electromagnetic and hadronic physics processes in a complex detector Each example may be used as a base from which more detailed applications can be developed A set of extended examples implement simulations of actual high energy physics detectors and require some libraries in addition to those of Geant4 The advanced examples cover cases useful to the developement of the Geant4 toolkit itself The examples can be compiled and run without modification Most of them can be run both in interactive and batch mode using the input macro files in and reference output files out provided These examples are run routinely as part of the validation or testing of official releases of the Geant4 toolkit 9 1 1 Novice Example Summary Descriptions of the 7 novice examples are provided here along with links to the code ExampleN01 Description below Mandatory user classes Demonstrates how Geant4 kernel works ExampleN02 Description below Simplified tracker
376. o and the text starts from the 3D position given to the constructor or to the method G4VMarker SetPosition Offsets should be given with the same units as the one adopted for the size i e world size or screen size units Example 8 8 shows sample C source code to define text with the following properties Text Welcome to Geant4 Visualization e Position 0 0 0 in the world coordinates Horizontal offset 10 pixels e Vertical offset 20 pixels e Colour blue default Example 8 8 An example of defining text JA C source codes An example of defining a visualizable text Pia Instantiation CAMHS tert 7 text SetText Welcome to Geant4 Visualization text SetPosition G4Point3D 0 0 0 These three lines are equivalent to G4Text text Welcome to Geant4 Visualization A G4Point3D 0 0 0 ff Size font size in units of pixels G4double fontsize 24 Should be 24 pixels to be implemented text SetScreenSize fontsize Jf fe Offsets G4double x offset 10 Should be 10 pixels to be implemented G4double y offset 20 Should be 20 pixels to be implemented text SetOffset x offset y offset fd Color Blue is the default setting and so the codes below are omissible Gacodounel bue Os Wor ik Wie G4VisAttributes att blue text SetVisAttributes att end of C source codes 238 Visualization 8 10 Making a Movie
377. o intersection is detected visualization is skipped and the following message is displayed on the console Number of intersected volumes 0 Li Congratulations X o ur If you always want to skip visualization set an environmental variable as follows beforehand setenv DAVID NO VIEW 1 To control the precision associated to computation of intersections default precision is set to 9 it is possible to use the environmental variable for the DAWNFILE graphics driver as follows 101 Detector Definition and Response setenv G4DAWNFILE PRECISION 10 If necessary re visualize the detector geometry with intersected parts highlighted The data are saved in a file g4david prim in the current directory This file can be re visualized with DAWN as follows 3 dawn g4david prim It is also helpful to convert the generated file g4david prim into a VRML formatted file and perform interactive visualization of it with your WWW browser The file conversion tool prim2wrml can be downloaded from the DAWN web site download pages For more details see the document of DAVID mentioned above 4 1 11 4 Using the geometry debugging tool OLAP OLAP is a tool developed in the CMS experiment at CERN to help in identifying ovelapping volumes in a detector geometry It is placed in the area for specific tools examples in geant 4 examples extended geometry The technique consists in shooting geant inos particles in one direction and the
378. o offer various user interfaces to the Geant4 command system Currently available are the following 1 Character terminal dumb terminal and tcsh bash like terminal the default user interface of Geant4 Xm Xaw Win32 variations of the upper terminal by using a Motif Athena or Windows widget to retrieve commands and 3 GAG a fully Graphical User Interface and its extension GainServer of the client server type Full implementation of the character terminals 1 and 2 is included in the standard Geant4 distribution in the source interfaces basic directory As for GAG with rich GUI functionalities its front end classes are included in the Geant4 distribution in the source interfaces GAG directory The corresponding GUI package is available either from the author s Web pages see URL below or in the distributed package under the environ ments MOMO directory GAG GainServer s client GUI Gain http erpc 1 naruto u ac jp geant4 2 8 2 A Short Description of Available Interface Classes 2 8 2 1 G4Ulterminal and G4Ultcsh classes These interfaces open a session on the character terminal G4Ulterminal runs on all platform supported by Geant4 including cygwin on Windows while G4UItcsh runs on Solaris and Linux G4Ultesh supports user friendly key bindings a la tcsh or bash AA move cursor to the top AB backward cursor LEFT cursor AD delete exit show matched list AE move cursor to the end AF forward cursor RIGHT cursor
379. ocket connection to the named pipe connection within the same host machine The DAWN Network driver also saves the 3D data to the file g4 prim in the current directory 8 3 7 Remote Visualization with the DAWN Network Driver Visualization in Geant4 is considered to be remote when it is performed on a machine other than the Geant4 host Some of the visualization drivers support this feature Usually the visualization host is your local host while the Geant4 host is a remote host where you log in for example with the telnet command This enables distributed processing of Geant4 visualization avoiding the transfer of large amounts of visualization data to your terminal display via the network This section describes how to perform remote Geant4 visualization with the DAWN Network driver In order to do it you must install the Fukui Renderer DAWN on your local host beforehand The following steps realize remote Geant4 visualization viewed by DAWN l Invoke DAWN with G option on your local host Local Host gt dawn G This invokes DAWN with the network connection mode 2 Login to the remote host where a Geant4 executable is placed 3 Set an environment variable on the remote host as follows Remote_Host gt setenv G4DAWN_HOST_NAME local_host_name For example if you are working in the local host named arkoop kek jp set this environment variable as follows Remote_Host gt setenv G4DAWN_HOST_NAME arkoop kek jp This tells
380. ogicTracker Mother logical volume kUndefined Allow default voxelising no axis 6 Number of chambers chamberParam The parameterisation kUndefined is the suggested choice giving 3D voxelisation i e along the three cartesian axes as is applied for placements Note In some cases where volume have clear separation along a single axis this axis eg kZAxis can be used to choose force optimisation only along this axis in geometrical calculations When an axis is given it forces the use of one dimensional voxelisation The general constructor is G4PVParameterised const G4String pName G4LogicalVolume pCurrentLogical G4LogicalVolume pMotherLogical OR G4VPhysicalVolume const EAxis pAxis const G4int nReplicas G4VPVParameterisation pParam G4bool pSurfChk false 81 Detector Definition and Response Note that for a parameterised volume the user must always specify a mother volume So the world volume can never be a parameterised volume nor it can be sliced The mother volume can be specified either as a physical or a logical volume pAxis specifies the tracking optimisation algorithm to apply if a valid axis the axis along which the parameter isation is performed is specified a simple one dimensional voxelisation algorithm is applied if kUndefined is specified instead the default three dimensional voxelisation algorithm applied for normal placements will be ac tivat
381. on See Example 8 3 Example 8 3 An alternative style for the main function d C source codes How to register a visualization driver directly in main function G4VisManager visManager new G4VisExecutive visManager gt RegisterGraphicsSystem new MyGraphicsSystem delete visManager ff end of C Do not forget to delete the instantiated Visualization Manager by yourself Note that a graphics system for Geant4 Visualization may run as a different process In that case the destructor of GaVisManager might have to ter minate the graphics system and or close the connection We recommend that the instantiation initialization and deletion of the Visualization Manager be protected by C pre processor commands as in the novice examples The C pre processor macro G4VIS_USE is automatically defined unless the environment variable G4VIS NONE is set This assumes that you are compiling your Geant4 executable with the standard version of GNUmakefile found in the config directory Example 8 4 shows an example of the main function available for Geant4 Visualization 195 Visualization Example 8 4 An example of the main function available for Geant4 Visualization acies C source codes An example of main for visualization include G4VisExecutive hh int main Run Manager G4RunManager runManager new G4RunManager Detector components runManager gt set_userInitializatio
382. on from Compiled Code e Section 8 6 Visualization Attributes e Section 8 7 Enhanced Trajectory Drawing e Section 8 9 Polylines Markers and Text Other useful references for Geant4 visualization outside of this user guide Introduction to Geant4 Visualization pdf ppt e Status of Geant4 Visualization giving current status and a summary of what has been improved over the last few releases pdf ppt e Macro files distributed in Geant4 source in examples novice N03 visTutor 8 2 Adding Visualization to Your Executable This section explains how to incorporate your selected visualization drivers into the main function and create an executable for it In order to perform visualization with your Geant4 executable you must compile it with realized visualization driver s You may be dazzled by the number of choices of visualization driver but you need not use all of them at one time 8 2 1 Installing Visualization Drivers Depending on what has been installed on your system several kinds of visualization driver are available One or many drivers may be chosen for realization in compilation depending on your visualization requirements Features 192 Visualization and notes on each driver are briefly described in Section 8 3 Visualization Drivers along with links to detailed web pages for the various drivers Note that not all drivers can be installed on all systems Table 8 1 in Section 8 3 lists all the available
383. ondaryList This includes constructing G4Track objects and setting their member data Note that the stepping manager is responsible for deleting seco daries from ParticleChange 10 The track is checked to see whether or not it has been terminated by the discrete process 11 Safety is updated 12 Ifthe step was limited by the volume boundary push the particle into the next volume 13 Invoke the user intervention G4UserSteppingAction 14 Handle hit information 15 Save data to Trajectory 16 Update the mean free paths of the discrete processes 17 If the parent particle is still alive reset the maximum interaction length of the discrete process which has occurred 18 One step completed P 129 Tracking and Physics What is a Step G4Step stores the transient information of a step This includes the two endpoints of the step PreStepPoint and Post StepPoint which contain the points coordinates and the volumes containing the points G4Step also stores the change in track properties between the two points These properties such as energy and momentum are updated as the various active processes are invoked What is a Track G4Track keeps information on the final status of the particle after the completion of one step This means that G4Track has information on the previous step while the AlongStepDoLts are being invoked for the step in progress Only after finishing all AlongStepDoIts will G4Track have the fin
384. one or more G4LogicalVolumes G4VPrimitiveScorer is an abstract base class representing a class to be registered to G4MultiFunctionalDetector that creates a G4THitsMap object of one physics quantity for an event Geant4 provides many concrete primitive scorer classes listed in Section 4 4 6 and the user can also implement his her own primitive scorers Each prim itive scorer object must be instantiated with a name that must be unique among primitive scorers registered in a G4MultiFunctionalDetector Please note that a primitive scorer object must not be shared by more than one G4MultiFunctionalDetector object As mentioned in Section 4 4 1 each G4VPrimitiveScorer generates one G4THitsMap object per event The name of the map object is the same as the name of the primitive scorer Each of the concrete primitive scorers listed in Section 4 4 6 generates a G4THitsMap G4double that maps a G4double value to its key integer number By default the key is taken as the copy number of the G4LogicalVolume to which G4MultiFunctionalDetector is assigned In case the logical volume is uniquely placed in its mother volume and the mother is replicated the copy number of its mother volume can be taken by setting the second argument of the G4VPrimitiveScorer constructor depth to 1 i e one level up Furthermore in case the key must consider more than one copy number of a different geometry hierarchy the user can derive his her own primitive scorer from the prov
385. onent of iso spin G4int GetPDGiGParity G parity 0 not defined G4String GetParticleType particle type G4String GetParticleSubType particle sub type G4int GetLeptonNumber lepton number G4int GetBaryonNumber baryon number G4int GetPDGEncoding particle encoding number by PDG G4int GetAntiPDGEncoding encoding for anti particle of this particle Table 5 2 Methods to get particle properties Table 5 3 shows the methods of G4ParticleDefinition for getting information about decay modes and the life time of the particle G4bool GetPDGStable stable flag G4double GetPDGLifeTime life time G4DecayTable GetDecayTable decay table Table 5 3 Methods to get particle decay modes and life time Users can modify these properties though the other properties listed above can not be change without rebuilding the libraries G4ParticleDefinition provides methods for setting and or getting cut off values as shown in Table However these methods only provide the functionality to set and get values Calculation of energy cut off values from a cut off value in range is implemented in the G4Particle WithCuts class as described below In addition each particle has its own G4ProcessManger object that manages a list of processes applicable to the particle 5 3 3 Dynamic particle The G4DynamicParticle class has kinematics information for the particle and is used for describing the d
386. onst G4FastTrack amp G4FastStep amp The details of your parameterisation will be implemented in this method The G4FastTrack reference provides the input information and the final state of the particles after parameterisation must be returned through the G4FastStep reference Tracking for the final state particles is requested after your parameterisation has been invoked 5 2 6 4 The G4FastSimulationManager Class G4FastSimulationManager functionnalities regarding the use of ghost volumes are explained in Section 5 2 6 7 Constructor G4FastSimulationManager G4Region anEnvelope G4bool IsUnique false This is the only constructor You specify the G4Region by providing its pointer The G4FastSimulationManager object will bind itself to this G4Region If you know that this G4Region has a single root G4Logical Volume placed only once you can set the IsUnique boolean to true to allow some optimization Note that if you choose to use the G4VFastSimulationModel const G4String amp G4Region G4bool con structor for your model the G4FastSimulationManager will be constructed using the given G4Region and G4bool values of the model constructor 156 Tracking and Physics G4VFastSimulationModel object management The following two methods provide the usual management functions void AddFastSimulationModel G4VFastSimulationModel RemoveFastSimulationModel G4VFastSimulationModel Interface with the G4FastSimulationManag
387. onst G4Step amp step const G4GeometryCellStep amp gstep 0 hi The member function Score const G4Step amp step const G4GeometryCellStep amp gstep is invoked for every PostStep of a chosen particle before the Post StepDoIt functions of the physical processes are invoked G4GeometryCellStep class G4GeometryCellStep public G4GeometryCellStep const G4GeometryCell amp preCell const G4GeometryCell amp postCell G4GeometryCellStep const G4GeometryCell amp GetPreGeometryCell const const G4GeometryCell amp GetPostGeometryCell const G4bool GetCrossBoundary const void SetPreGeometryCell const G4GeometryCell amp preCell void SetPostGeometryCell const G4GeometryCell amp postCell void SetCrossBoundary G4bool b private hi The classes and fuctions used in G4Geomet ryCellStep e G4GeometryCell identifies a cell as a physical volume with a replica number The cell is in the parallel geometry if a sampler for parallel geometries is used otherwise it is in the mass geometry e GetPreGeometryCell returns the previous cell touched by the particle or it is equal to Get PostGeomet ryCel1 if the track has not crossed a boundary GetPostGeometryCell refers to the current cell GetCrossBoundary returns t rue if the particle crosses a boundary in the parallel or mass geometry with respect to the sampler used 51 Toolkit Fundamentals Note e When scoring i
388. oordinates local to the current volume G4ThreeVector localPosition aTouchable gt GetHistory gt GetTopTransform TransformPoint myPoint convert back to global coordinates system G4ThreeVector globalPosition aTouchable GetHistory GetTopTransform Inverse TransformPoint localPosition If outside of the tracking run and given a generic local position local to a given volume in the geometry tree it is not possible to determine a priori its global position and convert it to the global coordinates system The reason for this is rather simple nobody can guarantee that the given local point is located in the right copy of the physical volume In order to retrieve this information some extra knowledge related to the absolute position of the physical volume is required first i e one should first determine a global point belonging to that volume eventually making a dedicated scan of the geometry tree through a dedicated G4Navigator object and then apply the method above after having created the touchable for it 4 1 8 3 Navigation in parallel geometries Since release 8 2 of Geant4 it is possible to define geometry trees which are parallel to the tracking geometry and having them assigned to navigator objects that transparently communicate in sync with the normal tracking geometry Parallel geometries can be defined for several uses fast shower parameterisation geometrical biasing particle scoring
389. oordinates local to the volume where the particle is currently placed FAQ 4 Tracks and steps Q Howcan I access the track information through the step object and what information am I allowed to access A AG4Step object consists of two points G4StepPoint pointl step gt GetPreStepPoint G4StepPoint point2 step gt GetPostStepPoint 260 Frequentry Asked Questions To get their positions in the global coordinate system G4ThreeVector posl point1 gt GetPosition G4ThreeVector pos2 point2 gt GetPosition Hereafter we call current volume the volume where the step has just gone through Geometrical informations are available from preStepPoint G4VTouchable and its derivates keep these geometrical informa tions We retrieve a touchable by creating a handle for it G4TouchableHandle touchl point1 gt GetTouchableHandle To get the current volume G4VPhysicalVolume volume touchl GetVolume To get its name G4String name volume gt GetName To get the physical volume copy number G4int copyNumber touch1 gt GetCopyNumber To get logical volume G4LogicalVolume 1Volume volume gt GetLogicalVolume To get the associated material the following statements are eguivalent G4Material material pointl gt GetMaterial G4Material material lVolume gt GetMaterial To get the geometrical region G4Region region lVolume GetRegion To get its moth
390. or your convenience if any G4UI USE XXX environment variable is set then the corresponding C pre processor flag is also set However if the environment variable G4UI NONE is set no C pre processor flags are set 2 9 How to Execute a Program 2 9 1 Introduction A Geant4 application can be run either in e purely hard coded batch mode e batch mode but reading a macro of commands interactive mode driven by command lines interactive mode via a Graphical User Interface The last mode will be covered in Section 2 8 The first three modes are explained here 2 9 2 Hard coded Batch Mode Below is an example of the main program for an application which will run in batch mode Example 2 20 An example of the main routine for an application which will run in batch mode int main Construct the default run manager G4RunManager runManager new G4RunManager set mandatory initialization classes runManager gt SetUserInitialization new ExN0lDetectorConstruction runManager gt SetUserInitialization new ExN0lPhysicsList set mandatory user action class runManager gt SetUserAction new ExNOlPrimaryGeneratorAction Initialize G4 kernel runManager gt Initialize start a run int numberOfEvent 1000 runManager gt BeamOn numberOfEvent job termination delete runManager return 0 Even the number of events in the run is frozen To change this number you must at least
391. orm translation rotation reflection G4ReflectionFactory Instance 77 T Place transform the transformation with reflection Calorimeter the actual name logiccalor the logical volume logicHall the mother volume false no boolean operation 1 copy number false no overlap check triggered Replicate layers G4ReflectionFactory Instance Replicate Layer layer name logicLayer layer logical volume defined elsewhere l ogmecaston Ett samo her kXAxis axis of replication 57 number of replica ZO width of replica 4 1 8 The Geometry Navigator Navigation through the geometry at tracking time is implemented by the class G4Navigator The navigator is used to locate points in the geometry and compute distances to geometry boundaries At tracking time the navigator is intended to be the only point of interaction with tracking Internally the G4Navigator has several private helper utility classes G4NavigationHistory stores the compounded transformations replication parameterisation information and volume pointers at each level of the hierarchy to the current location The volume types at each level are also stored whether normal placement replicated or parameterised G4NormalNavigation provides location amp distance computation functions for geometries containing place ment volumes with no voxels G4VoxelNavigation provides location and distance computation fu
392. osed of instantiations of the class G4MPVEntry The G4MPVEntry is a pair of numbers which in the case of an optical property are the photon momentum and corresponding property value The GaMaterialPropertyVector is implemented as a G4std vector with the sorting operation defined as MPVEntry lt MPVEntry gt photon momentum lt photon momentum This results in all GaMaterialPropertyVectors being sorted in ascending order of photon momenta It is possible for the user to add as many material optical properties to the material as he wishes using the methods supplied by the GaMaterialPropertiesTable class An example of this is shown in Example 5 5 Example 5 5 Optical properties added to a G4MaterialPropertiesTable and linked to a G4Material const G4int NUMENTRIES 32 G4double ppckov NUMENTRIES 2 034 eV 4 136 eV G4double rindex NUMENTRIES 1 3435 p LPSE R G4double absorption NUMENTRIES 344 8 cm EE oom emil G4MaterialPropertiesTable MPT new G4MaterialPropertiesTable MPT AddConstProperty SCINTILLATIONYIELD 100 MeV MPT gt AddProperty RINDEX ppckov rindex NUMENTRIES MPT gt AddProperty ABSLENGTH ppckov absorption NUMENTRIES scintillator gt SetMaterialPropertiesTable MPT 5 2 5 1 Generation of Photons in processes electromagnetic xrays Cerenkov Effect The radiation of Cerenkov light occurs when a charged particle moves through a dispersive me
393. otes The style of some geometry components may have been forced one way or the other through calls in compiled code The set style command will NOT override such force styles Drawing style should be set for each viewer The drawing style is initialized with command vis view er reset 212 Visualization 8 4 10 Declare the end of visualization for flushing vis viewer flush command Command vis viewer flush Action Declare the end of visualization for flushing Additional notes Command vis viewer flush should follow vis drawVolume vis specify etc in or der to complete visualization It corresponds to Step 7 The flush is done automatically after every run beamOn command unless you have non default values for vis scene endOfEventAction or vis scene endOfRunAction described above 8 4 11 End of Event Action and End of Run Action vis viewer endOfEventAction and vis viewer end OfEventAction commands By default a separate picture is created for each event You can change this behavior to accumulate multiple events or even multiple runs in a single picture Command vis scene endOfEventAction refresh accumulate Action Control how often the picture should be cleared refresh means each event will be written to a new picture accumulate means events will be accumulated into a single picture Picture will be flushed at end of run unless you have also set vis scene endOfRunAction accu
394. our Magenta yellow G4Colour Yellow Colours can be retrieved through the GetColour method bool G4Colour GetColour const G4String amp key G4Colour amp result For example G4Colour myColour G4Colour Black if G4Colour GetColour red myColour Successfully retrieved colour red myColour is now red else Colour did not exist in map myColour is still black If the key is not registered in the colour map a warning message is printed and the input colour is not changed The colour map is case insensitive It is also possible to load user defined G4Colour s into the map through the public AddToMap method For ex ample CAC od ouesny Consens LO T Orar e LTT G4Colour AddToMap custom myColour This loads a user defined G4Colour with key custom into the colour map 8 6 2 3 Colour and G4VisAttributes Class G4VisAttributes holds its colour entry as an object of class G4Colour A G4Colour object is passed to a G4VisAttributes object with the following access functions Jf Set functions of G4VisAttributes void G4VisAttributes SetColour const G4Colour amp colour void G4VisAttributes SetColor const G4Color amp color 226 Visualization We can also set RGBA components directly pf Set functions of G4VisAttributes void G4VisAttributes SetColour G4double red p G4double green G4double blue G4double alpha 1 0 void G4VisAttributes SetColor G4
395. ovProcess gt IsApplicable particle pmanager gt AddContinuousProcess theCerenkovProcess 5 2 5 2 Generation of Photons in processes electromagnetic xrays Scintillation Every scintillating material has a characteristic light yield SCINTILLATIONYIELD and an intrinsic resolu tion RESOLUTIONSCALE which generally broadens the statistical distribution of generated photons A wider intrinsic resolution is due to impurities which are typical for doped crystals like Nal TI and CsI TI On the other hand the intrinsic resolution can also be narrower when the Fano factor plays a role The actual num ber of emitted photons during a step fluctuates around the mean number of photons with a width given by ResolutionScale sqrt MeanNumberOfPhotons The average light yield MeanNumberOfPho tons has a linear dependence on the local energy deposition but it may be different for minimum ionizing and non minimum ionizing particles A scintillator is also characterized by its photon emission spectrum and by the exponential decay of its time spec trum In GEANTA the scintillator can have a fast and a slow component The relative strength of the fast component 149 Tracking and Physics as a fraction of total scintillation yield is given by the YIELDRATIO Scintillation may be simulated by specifying these empirical parameters for each material It is sufficient to specify in the user s DetectorConstruction class
396. oximate linear trajectory of the chord By setting this parameter the user can control the precision of the volume interrogation Every attempt has been made to ensure that all volume interrogations will be made to an accuracy within this miss distance miss distance XT rr m ad ronds real trajectory Figure 4 6 The curved trajectory will be approximated by chords so that the maximum estimated distance between curve and chord is less than the the miss distance In addition to the miss distance there are two more parameters which the user can set in order to adjust the accuracy and performance of tracking in a field In particular these parameters govern the accuracy of the intersection with a volume boundary and the accuracy of the integration of other steps As such they play an important role for tracking The delta intersection parameter is the accuracy to which an intersection with a volume boundary is calculated If a candidate boundary intersection is estimated to have a precision better than this it is accepted This parameter is especially important because it is used to limit a bias that our algorithm for boundary crossing in a field exhibits This algorithm calculates the intersection with a volume boundary using a chord between two points on the curved particle trajectory As such the intersection point is always on the inside of the curve By setting a value for this parameter that is much smaller than some acceptable
397. p aName Here aName identifies the parameterisation model G4VFastSimulationModel const G4String amp aName G4Region G4bool IsUnique false In addition to the model name this constructor accepts a G4Region pointer The needed G4FastSimulationManager object is constructed if necessary passing to it the G4Region pointer and the boolean value If it already exists the model is simply added to this manager Note that the G4VFastSimulationModel object will not keep track of the G4Region passed in the constructor The boolean argument is there for optimization purposes if you know that the G4Region has a unique root G4LogicalVolume uniquely placed you can set the boolean value to true 155 Tracking and Physics Virtual methods The G4VFastSimulationModel has three pure virtual methods which must be overriden in your concrete class G4VFastSimulationModel const G4String amp aName Here aName identifies the parameterisation model G4bool ModelTrigger const G4FastTrack amp You must return true when the dynamic conditions to trigger your parameterisation are ful filled G4FastTrack provides access to the current G4Track gives simple access to the current root G4Logical Volume related features its G4VSolid and G4AffineTransform references between the global and the root G4LogicalVolume local coordinates systems and simple access to the position and momentum ex pressed in the root G4LogicalVolume coordinate system Us
398. p1ica is positioned inside a given mother it MUST be the mother s only daughter volume Replica s correspond to divisions or slices that completely fill the mother volume and have no offsets For Cartesian axes slices are considered perpendicular to the axis of replication The replica s positions are calculated by means of a linear formula Replication may occur along e Cartesian axes kXAxis kYAxis kZAxis The replications of specified width have coordinates of form width nReplicas 1 0 5 n width 0 0 where n 0 nReplicas 1 for the case of kXAxis and are unrotated Radial axis cylindrical polar kRho 79 Detector Definition and Response The replications are cons tubs sections centred on the origin and are unrotated They have radii of width nt offset to width n 1 offset where n 0 nReplicas 1 Phi axis cylindrical polar kPhi The replications are phi sections or wedges and of cons tubs form They have phi of offsett n width to offset n 1 width where n20 nReplicas 1 The coordinate system of the replicas is at the centre of each replica for the cartesian axis For the radial case the coordinate system is unchanged from the mother For the phi axis the new coordinate system is rotated such that the X axis bisects the angle made by each wedge and Z remains parallel to the mother s Z axis The solid associated via the replicas logical volume should have the dimensions of the first volume crea
399. pe with hyperbolic inner surface i e inner radius 0 AND inner stereo angle 0 The inner and outer hyperbolic surfaces can have different stereo angles A stereo angle of 0 gives a cylindrical surface innerRadius Inner radius outerRadius Outer radius innerStereo Inner stereo angle in radians outerStereo Outer stereo angle in radians halfLenZ Half length in Z Tetrahedra A tetrahedra solid can be defined as follows G4Tet const G4String amp pName G4ThreeVector anchor G4ThreeVector p2 G4ThreeVector p3 G4ThreeVector p4 G4bool degeneracyFlag 0 In the picture anchor 0 0 sqrt 3 p2 0 2 sqrt 2 3 1 sqrt 3 p3 sqrt 2 sqrt 2 3 l sqrt 3 p4 sqrt 2 sqrt 2 3 1 sqrt 3 68 Detector Definition and Response The solid is defined by 4 points in space anchor Anchor point p2 Point 2 p3 Point 3 p4 Point 4 degeneracyFlag Flag indicating degeneracy of points Box Twisted A box twisted along one axis can be defined as follows G4TwistedBox const G4String amp G4TwistedBox is a box twisted along the z axis G4double G4double G4double G4double pName twistedangle pDx pDy pDz In the picture twistedangle 30 De gree pDx 30 pDy 40 pDz 60 The twist angle cannot be greater than 90 degrees twistedangle Twist angle pDx Half x length pDy Half y length pDz H
400. perly assigned you are almost ready for visualizing detector components All you have to do is to describe proper visualization commands within your C codes using the ApplyCommand method For example the following is sample C source codes to visualize the detector components fuese C source code How to visualize detector components 2 using visualization commands in source codes G4VVisManager pVVisManager G4VVisManager GetConcreteInstance if pVVisManager camera setting etc 217 Visualization G4UImanager GetUIpointer gt ApplyCommand vis drawVolume G4UImanager GetUIpointer gt ApplyCommand vis viewer flush A end of Ct source code In the above you should also describe vis open command somewhere in your C codes or execute the command from G UI at the executing stage 8 5 3 Visualization of trajectories In order to visualize trajectories you can use the method void G4Trajectory DrawTrajectory defined in the tracking category In the implementation of this method the following drawing method of G4VVisManager is used f A drawing method of G4Polyline virtual void G4VVisManager Draw const G4Polyline The real implementation of this method is described in the class G4VisManager At the end of one event a set of trajectories can be stored as a list of G4Trajectory objects There fore you can visualize trajectories for example at the end of
401. ple is shown only as an example it may NOT correspond to a specific platform configuration and does NOT apply in general for any specific setup Example 8 1 Part of a sample cshrc setup file for the Linux platform LES tt LES se LES Se LES SE se se se se LES se LES 8 HEHE EH HE EH HE EH HE EH HE HE FE HE AE TE AE FE EE HE HE FE HE EEE EE HE ERE HEHE ERE Main Environment Variables for GEANT4 with Visualization HEE TE AE FE TE AE HH HE FE HE FE TE AE FE TE AE HE EHH FE TE HE TE AE HE EE FE TE AE FE EE E E EE ERE ER Platform tenv G4SYSTEM Linux g CLHEP base directory tenv CLHEP_BASE_DIR opt local OpenGL base directory tenv OGLHOME usr X11R6 GAVIS BUILD Incorporation of OpenGL Xlib and OpenGL Motif drivers into Geant4 libraries tenv GA4VIS BUILD OPENGLX DRIVER 1 tenv GA4VIS BUILD OPENGLXM DRIVER 1 GAVIS USE Incorporation of OpenGL Xlib and OpenGL Motif drivers into Geant4 executables tenv G4VIS USE OPENGLX tenv G4VIS_USE_OPENGLXM i Viewer for DAWNFILE driver Default value is dawn You can change it to say david for volume overlapping tests setenv G4DAWNFILE_VIEWER david Viewer for VRMLFILE drivers tenv G4VRMLFILE_VIEWER vrmlview THREE end 2 4 Visualization Manager Visualization procedures are controlled by the Visualization Manager a class which must inherit from G4VisManager defined in the visualization category Most users will find that
402. plica the coordinate system of the divisions is related to the centre of each division for the carte sian axis For the radial axis the coordinate system is the same of the mother volume For the phi axis the new coordinate system is rotated such that the X axis bisects the angle made by each wedge and Z remains parallel to the mother s Z axis As divisions are parameterised volumes with constant dimensions they may be placed inside other divisions except in the case of divisions along the radial axis It is also possible to place other volumes inside a volume where a division is placed The list of volumes that currently support divisioning and the possible division axis are summarised below G4Box kXAxis kYAxis kZAxis G4Tubs kRho kPhi kZAxis G4Cons kRho kPhi kZAxis G4Trd kXAxis kYAxis kZAxis G4Para kXAxis kYAxis kZAxis G4Polycone kRho kPhi kZAxis G4Polyhedra kRho kPhi kZAxis G4Polycone kZAxis the number of divisions has to be the same as solid sections i e numZPlanes 1 the width will not be taken into account G4Polyhedra kPhi the number of divisions has to be the same as solid sides i e numSides the width will not be taken into account kZAxis the number of divisions has to be the same as solid sections i e numZPlanes 1 the width will not be taken into account In the case of division along kRho of G4Cons G4Pol
403. plied in anti clockwise order looking from the outside of the solid where it belongs Its constructor looks like G4TriangularFacet const G4ThreeVector PEO const G4ThreeVector UELS const G4ThreeVector NAE E G4FacetVertexType fType i e it takes 4 parameters to define the three vertices G4FacetVertexType ABSOLUTE in which case Pt 0 vt1 and vt2 are the three vertices in anti clockwise order looking from the outside G4FacetVertexType RELATIVE in which case the first vertex is Pt O the second vertex is PtO vt1 and the third vertex is 75 Detector Definition and Response PtO vt2 all in anti clockwise order when looking from the outside The G4QuadrangularFacet class can be used for the contruction of GGTessellatedSolidas well It is defined by four vertices which shall be in the same plane and be supplied in anti clockwise order looking from the outside of the solid where it belongs Its constructor looks like G4QuadrangularFacet const G4ThreeVector PEO const G4ThreeVector SEL const G4ThreeVector WEDS const G4ThreeVector YES G4FacetVertexType fType i e it takes 5 parameters to define the four vertices G4FacetVertexType ABSOLUTE in which case Pt 0 vt 1 vt2 and vt3 are the four vertices required in anti clockwise order when looking from the outside G4FacetVertexType RELATIVE in which case the first vertex is Pt O the second vertex is Pt 0 vt the third v
404. prep zip heprep gz or heprep format and their binary versions bheprep zip bheprep gz or bheprep The heprep zip is the default for file output the heprep is the default for stdout and stderr Optional To set the filename with a particular extension such as heprep zip heprep gz heprep bheprep zip bheprep gz or bheprep use for instance vis scene create filename bheprep zip Optional To create separate files for each event you can set a suffix such as 0001 to start writing files from filename 0001 bheprep zip to filename 9999 bheprep zip or up while 55 sub will start write files filename 55 sub bheprep zip to filename 99 sub bheprep zip or up vis heprep setEventNumberSuffix 0001 Note suffix has to contain at least one digit Optional To route the HepRep XML output to stdout or stderr by default uncompressed use vis scene create stdout Optional To add attributes to each point on a trajectory use vis heprep addPointAttributes 1 Be aware that this may increase the size of the output dramatically Optional You may use the commands vis viewer zoom to set an initial zoom factor vis viewer set viewpointThetaPhi to set an initial view point vis heprep setCoordinateSystem uvw to change the coordinate system where uvw 200 Visualization eua Joys Ay Az A Optional You may decide to write zip files with events and geometry separated but linked This results in a sm
405. protected virtual void InitializePhysics physics processes construction public virtual void BeamOn G4int n event main entry point of the event loop protected virtual G4bool ConfirmBeamOnCondition check the kernel conditions for the event loop protected virtual void RunInitialization prepare a run protected virtual void DoEventLoop G4int n events manage an event loop nt G4int i event K w ct Fl 4 protected virtual G4Event Gen generation of G4Event object protected virtual void AnalyzeEvent G4Event anEvent storage analysis of an event protected virtual void RunTermination terminate a run public virtual void DefineWorldVolume GAVPhysicalVolume worldVol set the world volume to G4Navigator public virtual void AbortRun abort the run 3 4 4 2 Customizing the Event Loop In G4RunManager the event loop is handled by the virtual method DoEvent Loop This method is imple mented by a or loop consisting of the following steps l construct a G4Event object and assign to it primary vertex es and primary particles This is done by the virtual GeneratePrimaryEvent method 2 send the G4Event object to G4EventManager for the detector simulation Hits and trajectories will be associated with the G4Event object as a consequence 3 perform bookkeeping for the current G4Event object This is done by the virtual AnalyzeE
406. r It requires OIHOME set paths to the OpenInventor installation G4VIS USE OI Specifies to use OpenInventor graphics in the application to be built G4VIS BUILD OIX DRIVER Specifies to build the driver for the free X11 version of OpenInventor G4VIS USE OIX Specifies to use the free X11 version of OpenInventor G4VIS BUILD RAYTRACERX DRIVER Specifies to build kernel library for visualization including the Ray Tracer driver with X11 extension It re quires X11 installed in the system G4VIS USE RAYTRACERX Specifies to use the X11 version of the Ray Tracer driver G4VIS BUILD OIWIN32 DRIVER Specifies to build the driver for the free X11 version of OpenInventor on Windows systems G4VIS USE OIWIN32 Specifies to use the free X11 version of OpenInventor on Windows systems G4VIS BUILD DAWN DRIVER Specifies to build kernel library for visualization including the driver for DAWN G4VIS USE DAWN Specifies to use DAWN as a possible graphics renderer in the application to be built G4DAWN HOST NAME To specify the hostname for use with the DAWN network driver G4VIS NONE If specified no visualization drivers will be built or used 271 Appendix hadronic lists module G4LIB BUILD LISTS Specifies to build or notthe physics lists module By default the variable is set and the module is built Set it to NO to skip the compilation of the physics lists zlib and g3tog4 modules G4LIB BUILD ZLIB If
407. r theMessenger Constructor Arguments are the full path command name and the pointer to your messenger G4UIcmdWithABool This is a G amp UIcommand derived class which takes one boolean type parameter e G4UIcmdWithABool char commandpath G4UImanager theMessenger Constructor Arguments are the full path command name and the pointer to your messenger void SetParameterName char paramName G4bool omittable Define the name of the boolean parameter and set the omittable flag If omittable is true you should define the default value using the next method e void SetDefaultValue G4bool defVal Define the default value of the boolean parameter e G4bool GetNewBoolValue G4String paramString 182 Comommunication and Control Convert G4String parameter value given by the SetNewValue method of your messenger into boolean G4String convertToString G4bool currVal Convert the current boolean value to G4String whichshould be returned by the GetCurrentValue method of your messenger G4UlcmdWithAnlnteger This is a G amp UIcommand derived class which takes one integer type parameter G4UIcmdWithAnInteger char commandpath G4UImanager theMessenger Constructor Arguments are the full path command name and the pointer to your messenger void SetParameterName char paramName G4bool omittable Define the name of the integer parameter and set the omittable flag If omittable is true you should define the d
408. r file source file derived from G4VUserDetectorConstruction definitions of single element materials e CSG solids G4PVPlacement without rotation ExNO1PhysicsList header file source file e derived from G4VUserPhysicsList definition of geantino assignment of transportation process ExNO1PrimaryGeneratorAction header file source file derived from G4VPrimaryGeneratorAction construction of G4ParticleGun e primary event generation via particle gun 9 1 3 Example N02 Basic concepts e Detector fixed target type e Processes EM e Hits tracker type hits Classes main source file e main for interactive mode and batch mode via macro file construction and deletion of G UI session and VisManager random number engine construction and deletion of G4RunManager construction and set of mandatory user classes 245 Examples ExNO2DetectorConstruction header file source file derived from G4VUserDetectorConstruction definitions of single element mixture and compound materials e CSG solids e Uniform magnetic field construction of ExNO2MagneticField e Physical Volumes e G4Placement volumes with amp without rotation e G4PVParameterised volumes without rotation ExNO2MagneticField header file source file e derived from G4MagneticField e Uniform field ExNO2MagneticField ExNO2PhysicsList header file source file e derived from G4VUserPhysicsList defin
409. r ge ometry The best way of doing this is by invoking the G4Navigator First get a pointer of the navigator through the G4TransportationManager and then locate the point i e include G4TransportationManager hh include G4Navigator hh G4ThreeVector myPoint G4Navigator theNavigator G4TransportationManager GetTransportationManager GetNavigatorForTracking G4VPhysicalVolume myVolume theNavigator LocateGlobalPointAndSetup myPoint Frequentry Asked Questions Note by using the navigator for tracking as shown above the actual particle gets also relocated in the specified position Therefore if this information is needed during tracking time in order to avoid affecting tracking you should either use an alternative G4Navigator object which you then assign to your world volume or you access the information through the track or touchable as specified in the FAQ for tracking and steps How can I access the daughter volumes of a specific physical volume Through the associated logical volume G4VPhysicalVolume myPVolume G4LogicalVolume myLVolume myPVolume gt GetLogicalVolume for G4int i 0 iGetNoDaughters i myPVolume myLVolume GetDaughter i Q How can I identify the exact copy number of a specific physical volume in my mass geometry I tried with GetCopyNo from my physical volume pointer but it doesn t seem to work A The correct way to identify u
410. r very large files if you know that you will never want to make these parts visible you can choose to have them left entirely out of the file Set the environment variable G4HEPREPFILE CULL as in export G4HEPREPFILE_CULL 1 Further information 199 Visualization e WIRED3 Users Home Page http www slac stanford edu B FROOT www Computing Graphics Wired HepRep graphics format http www slac stanford edu perl heprep e Geant4 Visualization Tutorial using the WIRED3 HepRep Browser http geant4 slac stanford edu Presentations vis G4WIREDTutorial G4WIREDTutorial html 8 3 5 HepRepXML The HepRepXML driver creates a HepRep file in the HepRep2 format suitable for viewing with the WIRED4 Plugin to the JAS3 Analysis System or the FRED event display This driver can write both Binary HepRep bheprep and XML HepRep heprep files Binary HepRep files are a one to one translation of XML HepRep files but they are considerably shorter and faster to parse by a HepRepViewer such as WIRED 4 Both Binary HepRep and XML HepRep can be compressed using the standard zlib library if linked into Geant4 using G4LIB_USE_ZLIB If a standard zlib is not available WIN32 VC for instance you should also set G4LIB_BUILD_ZLIB to build G4zlib included with Geant4 HepRep files Binary and XML can contain multiple HepRep events geometries If the file contains more than one HepRep it is not strictly XML anymore Files can be written in he
411. rHit cc available attributes will be e Hit Type Track ID ZCell ID Phi Cell ID Energy Deposited Energy Deposited by Track Position Logical Volume You can add additional attributes of your choosing by modifying the relevant part of the hit class look for the methods GetAttDefs and CreateAttV alues 8 5 8 Visualization of text In Geant4 Visualization a text i e a character string is described by class G4Text inheriting G4VMarker as well as G4Square and G4Circle Therefore the way to visualize text is the same as for hits The corresponding drawing method of G4VVisManager is feroces Drawing methods of G4Text virtual void G4VVisManager Draw const G4Text amp The real implementation of this method is described in class G4VisManager 8 5 9 Visualization of polylines and tracking steps Polylines i e sets of successive line segments are described by class G4Polyline For G4Polyline the following drawing method of class G4VVisManager is prepared f A drawing method of G4Polyline virtual void G4VVisManager Draw const G4Polyline 221 Visualization The real implementation of this method is described in class G4VisManager Using this method C source codes to visualize G4Polyline are described as follows gt C source code How to visualize a polyline G4VVisManager pVVisManager G4VVisManager GetConcreteInstance if pVVisManager G4Polyline polyline
412. rack uTrakMax uTimeMax uEkinMin uRangMin G4UserSpecialCuts process must be defined to affected particle types This process limits a step and kills the track when the track comes to one of these limits Step limitation occurs only for the final step Example of G4UserLimits can be found in examples novice N02 see DetectorConstruction and PhysicsList 170 Chapter 6 User Actions 6 1 Mandatory User Actions and Initializations Geant4 has three virtual classes whose methods the user must override in order to implement a simulation They require the user to define the detector specify the physics to be used and describe how initial particles are to be generated G4VUserDetectorConstruction Example 6 1 G4VUserDetectorConstruction class G4VUserDetectorConstruction public G4VUserDetectorConstruction virtual G4VUserDetectorConstruction OUEST virtual G4VPhysicalVolume Construct 0 un GAVUserPhysicsList This is an abstract class for constructing particles and processes The user must derive a concrete class from it and implement three virtual methods e ConstructParticle to instantiate each requested particle type e ConstructPhysics to instantiate the desired physics processes and register each of them with the pro cess managers of the appropriate particles and SetCuts G4double aValue to set a cut value in range for all particles in the particle table which invokes the rebuilding of th
413. ral trajectories Set verbose printout Reset filter and reconfigure to pass only negativly charged trajectories vis filtering trajectories create chargeFilter vis filtering trajectories chargeFilter 0 add 0 vis filtering trajectories chargeFilter 0 verbose true vis filtering trajectories chargeFilter 0 reset true vis filtering trajectories chargeFilter 0 add 1 Create an attribute filter named attributeFilter O vis filtering trajectories create attributeFilter Select attribute IMag vis filtering trajectories attributeFilter 0 setAttribute IMag Select trajectories with 2 5 MeV lt IMag lt 1000 MeV vis filtering trajectories attributeFilter 0 addInterval 2 5 MeV 1000 MeV List filters vis filtering trajectories list Note that although particleFilter 0 and chargeFilter 0 are automatically 235 Visualization chained particleFilter 0 will not have any effect since it is has been deactivated 8 8 3 Hit Filtering The attribute based filtering can be used on hits as well as trajectories To active the interactive attribute based hit filtering a filter call should be added to the Draw method of the hit class void MyHit Draw if pVVisManager gt FilterHit this return Interactive filtering can then be done through the commands in vis filtering hits 8 9 Polylines Markers and Text Polylines markers and text are defined in the graphics_reps category and are u
414. rary files generated during the compilation lib bin and tmp directories The G4INSTALL environment variable specifies where the installation of the Geant4 toolkit should take place therefore kernel libraries will be placed in G4INSTALL lib The G4WORKDIR environment variable is set by the user and specifies the path to the user working directory temporary files object files and data products of the installation process of Geant4 will be placed in G4WORKDIR tmp according to the system architecture used Binaries will be placed in GAWORKDIR bin according to the system architecture used The path to SG4WORKDIR bin G4SYSTEM should be added to PATH in the user environment 5 2 Environment variables Here is a list of the most important environment variables defined within the Geant4 GNUmake infrastructure with a short explanation of their use 268 Appendix We recommend that those environment variables listed here and marked with NOT be overriden or set explicitly or by accident They are already set and used internally in the default setup System configuration CLHEP_BASE_DIR Specifies the path where the CLHEP package is installed in your system G4SY STEM Defines the architecture and compiler currently used NOTE This variable is set automatically if the Configure script is adopted for the installation This will result in the proper settings also for configuring the environment with the generated shel
415. rd C Library Prentice Hall Englewood Cliffs 1995 288
416. rdinate system Generally it is best to choose a simple solid as the World volume and in Example NO1 we use the experimental hall Example 2 6 The World volume from Example N01 G4VPhysicalVolume experimentalHall phys new G4PVPlacement 0 no rotation G4ThreeVector 0 0 0 translation position experimentalHall_log its logical volume expHall its name 0 its mother volume false no boolean operations 0 its copy number 2 2 7 Coordinate Systems and Rotations In Geant4 the rotation matrix associated to a placed physical volume represents the rotation of the reference system of this volume with respect to its mother A rotation matrix is normally constructed as in CLHEP by instantiating the identity matrix and then applying a rotation to it This is also demonstrated in Example N04 2 3 How to Specify Materials in the Detector 2 3 1 General Considerations In nature general materials chemical compounds mixtures are made of elements and elements are made of isotopes Therefore these are the three main classes designed in Geant4 Each of these classes has a table as a static data member which is for keeping track of the instances created of the respective classes The G4Element class describes the properties of the atoms atomic number number of nucleons atomic mass e shell energy e as well as quantities such as cross sections per atom etc The G4Material class describ
417. recompile main 2 9 3 Batch Mode with Macro File Below is an example of the main program for an application which will run in batch mode but reading a file of commands 21 Getting Started with Geant4 Running a Simple Example Example 2 21 An example of the main routine for an application which will run in batch mode but reading a file of commands int main int argc char argv Construct the default run manager G4RunManager runManager new G4RunManager set mandatory initialization classes runManager 5SetUserInitialization new MyDetectorConstruction runManager gt SetUserInitialization new MyPhysicsList set mandatory user action class runManager gt SetUserAction new MyPrimaryGeneratorAction Initialize G4 kernel runManager gt Initialize read a macro file of commands G4UImanager UI G4UImanager getUlpointer G4String command control execute G4String fileName argv 1 UI gt applyCommand command fileName delete runManager return 0 This example will be executed with the command gt myProgram runl mac where myP rogram is the name of your executable and run1 mac is a macro of commands located in the current directory which could look like Example 2 22 A typical command macro Macro file for myProgram cc set verbose level for this run run verbose 2 event verbose 0 tracking verbose 1 Set the initial kinematic and run 100
418. rent seed to seed int startSeed HepRandom getTheSeed to get the current initial seed HepRandom saveEngineStatus to save the current engine status on file 35 Toolkit Fundamentals HepRandom restoreEngineStatus to restore the current engine to a previous saved configuration HepRandom showEngineStatus to display the current engine status to stdout int index n long seeds 2 HepRandom get TheTableSeeds seeds index fills seeds with the values stored in the global seedTable at position index Only one random engine can be active at a time the user can decide at any time to change it define a new one if not done already and set it For example RanecuEngine theNewEngine HepRandom setTheEngine amp theNewEngine or simply setting it to an old instantiated engine the old engine status is kept and the new random sequence will start exactly from the last one previously interrupted For example HepRandom setTheEngine amp myOldEngine Other static methods defined in this class are void setTheSeeds const G4long seeds G4int const G4long getTheSeeds To set get an array of seeds for the generator in the case of a RanecuEngine this corresponds also to set get the current status of the engine e HepRandomEngine getTheEngine To get a pointer to the current engine used by the static generator 3 2 2 3 HEPRandom distributions A d
419. responds positively a GAExcept ion is thrown and DBL_MIN is returned void AddDataSet G4VCrossSectionDataSet aDataSet This method adds the given cross section data set to the end of the list of data sets in the data store For the evaluation of cross sections the list has a LIFO Last In First Out priority meaning that data sets added later to the list will have priority over those added earlier to the list Another way of saying this is that the data store when given a Get CrossSection request does the IsApplicable queries in the reverse list order starting with the last data set in the list and proceeding to the first and the first data set that responds positively is used to calculate the cross section void BuildPhysicsTable const G4ParticleDefinition amp aParticleType This method may be invoked to indicate to the data store that there has been a change in the cuts or other parameters of the given particle type In response the data store will invoke the BuildPhysicsTable of each of its data sets 141 Tracking and Physics void DumpPhysicsTable const G4ParticleDefinition This method may be used to request the data store to invoke the DumpPhysicsTable method of each of its data sets Default cross sections The defaults for total cross section data and calculations have been encapsulated in the singleton class G4HadronCrossSections Each hadronic process G4HadronInelasticProcess G4HadronElasticPro
420. rocess new G4MultipleScattering pmanager AddProcess new G4hIonisation 1 1 1 2 10 E 2 136 Tracking and Physics Novice and extended electromagnetic examples illustrating the use of electromagnetic processes are available as part of the Geant4 release Options are available for steering the standard electromagnetic processes These options may be invoked either by UI commands or by the interface class G4EmProcessOptions This class has the following public methods SetLossFluctuations G4bool e SetSubCutoff G4bool const G4Region r 0 e Setlntegral G4bool e SetRandomStep G4bool e SetApplyCuts G4bool SetBuildCSDARange G4bool e SetLPMFlag G4bool e SetBremsstrahlungTh G4double e SetMinSubRange G4double SetMinEnergy G4double SetMaxEnergy G4double SetMaxEnergyForCSDARange G4double e SetMaxEnergyForMuons G4double e SetDEDXBinning Gdint e SetDEDXBinningForCSDARange G4int e SetLambdaBinning G4int e SetVerbose G4int const G4String name all SetLambdaFactor G4double e SetMscStepLimitation G4bool G4double factor 1 The corresponding UI command can be accessed in the UI subdirectory process eLoss G4EmCalculator is a class which provides access to cross sections and stopping powers This class can be used anywhere in the user code provided the physics list has already been initialised G4State_Idle G4EmCalculator has Get methods which can be applied to
421. rrives at a medium boundary its behavior depends on the nature of the two materials that join at that boundary Medium boundaries may be formed between two dielectric materials or a dielectric and a metal In the case of two dielectric materials the photon can undergo total internal reflection refraction or reflection depending on the photon s wavelength angle of incidence and the refractive indices on both sides of the boundary Furthermore reflection and transmission probabilites are sensitive to the state of linear polarization In the case of 152 Tracking and Physics an interface between a dielectric and a metal the photon can be absorbed by the metal or reflected back into the dielectric If the photon is absorbed it can be detected according to the photoelectron efficiency of the metal As expressed in Maxwell s equations Fresnel reflection and refraction are intertwined through their relative prob abilities of occurrence Therefore neither of these processes nor total internal reflection are viewed as individual processes deserving separate class implementation Nonetheless an attempt was made to adhere to the abstraction of having independent processes by splitting the code into different methods where practicable One implementation of the G4OpBoundaryProcess class employs the UNIFIED model A Levin and C Moisan A More Physical Approach to Model the Surface Treatment of Scintillation Counters and its Implementa tion into
422. rtation Tracking and Physics 5 5 Cuts per Region 5 5 1 General Concepts Beginning with Geant4 version 5 1 the concept of a region has been defined for use in geometrical descriptions Details about regions and how to use them are available in Section 4 1 3 1 As an example suppose a user defines three regions corresponding to the tracking volume the calorimeter and the bulk structure of a detector For performance reasons the user may not be interested in the detailed development of electromagnetic showers in the insensitive bulk structure but wishes to maintain the best possible accuracy in the tracking region In such a use case Geant4 allows the user to set different production thresholds cuts for each geometrical region This ability referred to as cuts per region is also a new feature provided by the Geant4 5 1 release The general concepts of production thresholds were presented in the Section 5 4 Please note that this new feature is intended only for users who 1 are simulating the most complex geometries such as an LHC detector and 2 are experienced in simulating electromagnetic showers in matter We strongly recommend that results generated with this new feature be compared with results using the same geometry and uniform production thresholds Setting completely different cut values for individual regions may break the coherent and comprehensive accuracy of the simulation Therefore cut values should be carefu
423. rticleDefinition amp 0 This method may be invoked to request the data set to print its internal database and or other state information for the given particle type to the standard output stream Cross section data store Cross section data sets are used by the process for the calculation of the physical interaction length A given cross section data set may only apply to a certain energy range or may only be able to calculate cross sections for a particular type of particle The class G4CrossSectionDataStore has been provided to allow the user to specify if desired a series of data sets for a process and to arrange the priority of data sets so that the appropriate one is used for a given energy range particle and material It implements the following public methods G4CrossSectionDataStore G4CrossSectionDataStore and G4double GetCrossSection const G4DynamicParticle const G4Element For a given particle and material this method returns a cross section value provided by one of the collection of cross section data sets listed in the data store object If there are no known data sets a G4Exception is thrown and DBL MIN is returned Otherwise each data set in the list is gueried in reverse list order by invoking its IsApplicable method for the given particle and material The first data set object that responds positively will then be asked to return a cross section value via its Get CrossSection method If no data set
424. ry tree using the Tree Widget in Java 206 Visualization 9 civis 3 enable disable verbose C drawTree D drawVolume m name gt lt pixels gt D dram View ates a scene handler ready for drawing open ie scene handler name is auto generated 3 specify e 2nd parameter is the window size hint ASCIITree 4 leranhic s system name GAGTree 9 CA CAGTree D verbose Tm 7 scene 5x 5 sceneHandler exampleNO3 viewer 9 G World 0 0 camera 9 CACalorimeter 0 1 9 Layer 1 2 y Absorber 0 3 Desna O 312740 813 Bil Liver t 5 6 1525116 592 hone 9 CLayer 1 8 733320 872 win Dy Absorber 0 9 C 627 010 jLayer 1 11 Q9 CLayer 1 14 Dy Absorber 0 15 D 62 0 16 Layer 1 17 Layer 1 20 9 Layer 1 23 Dj Absorber 0 24 3 Gap 0 25 J Layer 1 26 Layer 1 29 pixel 3600 8 3 12 XML Tree The XML description of the geometry tree can be created in Geant4 by the XML Tree driver The XML source can also be edited on the fly The created XML files are visualizable with any XML browser in Windows a good XML viewer is XML Notepad Folding and un folding b Output L Notepad File Edit View Insert Tools Help T copy_no 6 logical volume 6 solid name solid type Calorimeter copy no pO logical volume so
425. ry with overlapping volumes highlighted by DAVID At present physical volumes made of the following solids are able to be debugged G4Box G4Cons G4Para G4Sphere G4Trd G4Trap G4Tubs Existence of other solids is harmless Visual debugging of physical volume surfaces is performed with the DAWNFILE driver defined in the visual ization category and with the two application packages i e Fukui Renderer DAWN and a visual intersection debugger DAVID DAWN and DAVID can be downloaded from the Web How to compile Geant4 with the DAWNFILE driver incorporated is described in Section 8 3 If the DAWNFILE driver DAWN and DAVID are all working well in your host machine the visual intersection debugging of physical volume surfaces can be performed as follows Run your Geant4 executable invoke the DAWNFILE driver and execute visualization commands to visualize your detector geometry Idle gt vis open DAWNFILE eu setting camera etc Idle gt vis drawVolume Idle gt vis viewer update Then a file g4 prim which describes the detector geometry is generated in the current directory and DAVID is invoked to read it The description of the format of the file g4 prim can be found from the DAWN web site documentation If DAVID detects intersection of physical volume surfaces it automatically invokes DAWN to visualize the de tector geometry with the intersected physical volumes highlighted See the above sample visualization If n
426. s Calculated physics tables can be retrieved from files by using the retrievePhysicsTable command Materials and cuts from files are compared with those defined in the current geometry setup and only physics vectors corresponding to the MaterialCutsCouples used in the current setup are restored Note that nothing happens just after the retrievePhysicsTable command is issued Restoration of physics tables will be executed in parallel with the calculation of physics tables 5 6 4 Building the Physics Table In the G4RunManagerKernel RunInitialization method after the list of MaterialCutsCouples is updated the G4VUserPhysicsList BuildPhysicsTable method is invoked to build physics tables for all processes Initially the GaVProcess PreparePhysicsTable method is invoked Each process creates G4PhysicsTable objects as necessary It then checks whether the MaterialCutsCouples have been modified after a run to determine if the corresponding physics vectors can be used in the next run or need to be re calculated Next the GAVProcess RetrievePhysicsTable method is invoked if the GAVUserPhysicsList fRetrievePhysicsTable flag is asserted After checking materials and cuts in files physics vectors corresponding to the MaterialCutsCouples used in the current setup are restored Finally the GAVProcess BuildPhysicsTable method is invoked and only physics vectors which need to be re calculated are built 5 7 User limits
427. s extended medical DICOM where a phantom grid of cells is built using a parameterisation by material de fined through a map Note Currently for many cases it is not possible to add daughter volumes to a parameterised volume Only parameterised volumes all of whose solids have the same size are allowed to contain daughter volumes When the size or type of solid varies adding daughters is not supported So the full power of parameterised volumes can be used only for leaf volumes which contain no other volumes Advanced parameterisations for nested parameterised volumes A new type of parameterisation enables a user to have the daughter s material also depend on the copy number of the parent when a parameterised volume daughter is located inside another parent repeated volume The parent volume can be a replica a parameterised volume or a division if the key feature of modifying its contents is utilised Note a nested parameterisation inside a placement volume is not supported because all copies of a placement volume must be identical at all levels In such a nested parameterisation the user must provide a ComputeMaterial method that utilises the new argument that represents the touchable history of the parent volume Sample Parameterisation class SampleNestedParameterisation public G4VNestedParameterisation public other methods Mandatory method required and reason for this class virtual G4Materi
428. s show me only the photons or omit any volumes made of iron WIRED3 can read heprep files in zipped format as well as unzipped so you can save space by applying gzip to the heprep file This will reduce the file to about five percent of its original size Several environment variables are available to override some of HepRepFile s defaults You can specify a different directory for the heprep output files by setting the environment variable G4HEPREPFILE_DIR as in export G4HEPREPFILE_DIR someOtherDir someOtherSubDir e You can specify a different file name the part before the number by setting the environment variable G4HEPREPFILE_NAME as in export G4HEPREPFILE_NAME myFileName which will produce files named myFileName0 heprep myFileNamel heprep etc e You can specify that each file should overwrite the previous file always rewriting to the same file name by setting the environment variable G4HEPREPFILE OVERWRITE as in export G4HEPREPFILE_OVERWRITE 1 This may be useful in some automated applications where you always want to see the latest output file in the same location e Geant4 visualization supports a concept called culling by which certain parts of the detector can be made invisible Since you may want to control visibility from the HepRep browser turning on visibility of detector parts that had defaulted to be invisible the HepRepFile driver does not omit these invisible detector parts from the HepRep file But fo
429. s accessed once Thus this event represents a typical signal event of LHC overlapping 20 minimum bias events It should be noted that a simulation of event overlapping can be done by merging hits and or digits associated with several events and these events can be simulated independently Digitization over multiple events will be mentioned in Section 4 5 3 7 Event Biasing Techniques 3 7 1 Scoring Geometrical Importance Sampling and Weight Roulette Geant4 provides event biasing techniques which may be used to save computing time in such applications as the simulation of radiation shielding These are geometrical splitting and Russian roulette also called geometrical importance sampling and weight roulette A basic scoring system is also provided in order to monitor the sam pling In this chapter it is assumed that the reader is familiar with both the usage of Geant4 and the concepts of importance sampling More detailed documentation may be found in the documents Latest development in 48 Toolkit Fundamentals importance sampling and scoring A detailed description of different use cases which employ the sampling and scoring techniques can be found in the document Scoring and geometrical importance sampling use cases The goals of the scoring technique are to appraise particle quantities related to special regions or surfaces e be applicable to all cells physical volumes or replicas of a given geometry e be cus
430. s and Domains 3 1 1 What is a class category In the design of a large software system such as Geant4 it is essential to partition it into smaller logical units This makes the design well organized and easier to develop Once the logical units are defined independent to each other as much as possible they can be developed in parallel without serious interference In object oriented analysis and design methodology by Grady Booch Booch1994 class categories are used to create logical units They are defined as clusters of classes that are themselves cohesive but are loosely coupled relative to other clusters This means that a class category contains classes which have a close relationship for example the has a relation However relationships between classes which belong to different class categories are weak i e only limitted classes of these have uses relations The class categories and their relations are presented by a class category diagram The class category diagram designed for Geant4 is shown in the figure below Each box in the figure represents a class category and a uses relation by a straight line The circle at an end of a straight line means the class category which has this circle uses the other category ae Figure 3 1 Geant4 class categories The file organization of the Geant4 codes follows basically the
431. s done in a parallel geometry special action must be taken to prevent counting of collisions with boundaries of the mass geometry as interactions This is handled differently when scoring is done in the mass geometry 3 7 1 4 Importance Sampling Importance sampling acts on particles crossing boundaries between importance cells The action taken depends on the importance values assigned to the cells In general a particle history is either split or Russian roulette is played if the importance increases or decreases respectively A weight assigned to the history is changed according to the action taken The tools provided for importance sampling require the user to have a good understanding of the physics in the problem This is because the user has to decide which particle types require importance sampled define the cells and assign importance values to the cells If this is not done properly the results cannot be expected to describe areal experiment The assignment of importance values to a cell is done using an importance store described below An importance store with the interface G4VISt ore is used to store importance values related to cells In order to do importance sampling the user has to create an object e g of class G4IStore of type G4VIStore The samplers may be given a G4VIStore The user fills the store with cells and their importance values Animportance store has to be constructed with a reference to the world volume
432. s its intrinsic limit greater than or equal to the recommended production threshold OK Nothing has to be done nothing can be done e a process sets its intrinsic limit smaller than the production threshold for instance 0 The list of secondaries is sent to the SteppingManager via a ParticleChange object Before being recopied to the temporary stack for later tracking the particles below the production threshold will be kept or deleted according to the safe mechanism explained hereafter The ParticleDefinition or ParticleWithCuts has a boolean data member ApplyCut ApplyCut is OFF do nothing All the secondaries are stacked and then tracked later on regardless of their initial energy The Geant4 kernel respects the best that the physics can do but neglects the overall coherence and the efficiency Energy conservation is respected as far as the processes know how to handle correctly the particles they produced ApplyCut in ON the TrackingManager checks the range of each secondary against the production threshold and against the safety The particle is stacked if range gt min cut safety If not check if the process has nevertheless set the flag good for tracking and then stack it see Sec tion 5 4 4 below for the explanation of the GoodForTracking flag If not recuperate its kinetic energy in the localEnergyDeposit and set tkin 0 Then check in the ProcessManager if the vector of ProcessAtRest is not empty
433. s open driver_tag_name Argument A name of a mode of an available visualization driver Action Create a visualization driver 1 e a set of a scene hander and a viewer Example Create the OpenGL Xlib driver with its immediate mode Idle gt vis open OGLIX Additional notes For immediate viewers such as OGLIX your geometry will immediately be rendered in the new GL window How to list available driver tag name Idle gt help vis open Or Idle gt help vis sceneHandler create The list is for example displayed as follows Candidates DAWNFILE OGLIX OGLSX For additional options see the Control UICommands section of this user guide 8 4 3 Create an empty scene vis scene create com mand Command vis scene create creates an empty scene which corresponds to Step 2 Command vis scene create scene name Argument A name for this scene Created for you if you don t specify one 8 4 4 Visualization of a physical volume vis drawVol ume command Command vis drawVolume adds a physical volume to the scene It also does some of the other steps if you haven t done them explicitly It takes care of steps 2 3 4 and 6 Command vis viewer flush should follow in order to do the final Step 7 209 Visualization Commands vis drawVolume physical volume name Idle gt vis viewer flush Argument A physical volume name The default value is world which is omittable
434. sation so the particle will still see and cross the relevant boundary and another step will occur on the other side of that boundary In summary the production threshold range and its equivalent in energy are not utilised as a tracking cut A particle is not abandoned by Geant4 below a certain range energy unless the user registers a process to do this by him her self FAQ 6 Visualization I have set G4VIS environmental variables but visualization does not appear to be enabled This might be because you set the environment variables after already compiling The environment variables control C pre processor macros of the same name and therefore influence what code gets com piled It is suggested to proceed with the following manual procedure to correct the current installation G4VIS_BUILD_ name _DRIVERG4VIS_USE_ name cd SG4INSTALL source visualization gmake clean gmake cd SG4INSTALL source interfaces gmake clean gmake cd G4INSTALL source gmake libmap setenv G4WORKDIR your working directory or export cd your application directory gmake clean gmake e Configure the environment according to the installation making sure to unset the G2WORKDIR envi ronment variable if set FAQ 7 User Support Policy Q If I need to discuss technical matters specific to my simulation application or ask for first aid help who can I contact Every institute and experiment participating in Geant4 has a G4 Techn
435. scribes The smallest of these step lengths is taken 3 The geometry navigator calculates Safety the distance to the next volume boundary If the minimum phys ical step length from the processes is shorter than Safety the physical step length is selected as the next step length In this case no further geometrical calculations will be performed 4 If the minimum physical step length from the processes is longer than Safety the distance to the next boundary is re calculated The smaller of the minimum physical step length and the geometric step length is taken 6 Allactive continuous processes are invoked Note that the particle s kinetic energy will be updated only after all invoked processes have completed The change in kinetic energy will be the sum of the contributions from these processes 7 The track is checked to see whether or not it has been terminated by a continuous process 8 The current track properties are updated before discrete processes are invoked This includes updating the kinetic energy of the current track particle note that sumEnergyChange is the sum of the new kinetic energy after each continuos process was invoked and NOT the sum of the energy difference before and after the process invocation and updating position and time 9 The discrete process is invoked After the invocation e the energy of the current track particle is updated and the secondaries from ParticleChange are stored in Sec
436. se gapLogical i gt SetSensitiveDetector det Each G4THitsMap object can be accessed from G4HCofThisEvent with a unique collection ID number This ID number can be obtained from G4SDManager GetCollectionID with a name of G4MultiFunctionalDetector 120 Detector Definition and Response and G4VPrimitiveScorer connected with a slush G4THitsMap has a operator taking the key value as an argument and returning the pointer of the value Please note that the operator returns the pointer of the value If you get zero from the operator it does not mean the value is zero but that the provided key does not exist The value itself is accessible with an astarisk It is advised to check the validity of the returned pointer before accessing the value G4THitsMap also has a operator in order to accumulate event data into run data Example 4 16 shows the use of G4THitsMap Example 4 16 An example of accessing to G4THitsMap objects include ExN07Run hh include G4Event hh include G4HCofThisEvent hh include G4SDManager hh EXNO7Run ExNO7Run G4String detName 6 Calor A abs Calor A gap Calor B abs Calor B gap dto GESTOS GadKo C dapi i G4String primNameSum 6 eDep nGamma nElectron nPositron trackLength nStep G4String primNameMin 3 minEkinGamma minEkinElectron minEkinPositron G4SDManager SDMan G4SDManager GetSDMpointer G4String fullName
437. se soft filtered trajectories Hard filtering In this mode uninteresting trajectories are not drawn at all This mode is especially useful if the job produces huge graphics files dominated by data from uninteresting trajectories Trajectory filter models are used to apply filtering according to specific criteria The following models are currently supplied with the Geant4 distribution e G4TrajectoryChargeFilter chargeFilter e G4TrajectoryParticleFilter particleFilter e G4TrajectoryOriginVolumeFilter originVolumeFilter e G4TrajectoryAttributeFilter attributeFilter Multiple filters are automatically chained together and can configured either interactively or in commands or in compiled code The filters can be inverted set to be inactive or set in a verbose mode The above models are described briefly below followed by some example configuration commands G4TrajectoryChargeFilter This model filters trajectories according to charge In standard running mode only trajectories with charges match ing those registered with the model will pass the filter G4TrajectoryParticleFilter This model filters trajectories according to particle type In standard running mode only trajectories with particle types matching those registered with the model will pass the filter G4TrajectoryOriginVolumeFilter This model filters trajectories according to originating volume name In standard running mode only trajectories with originating vo
438. sed only for visualization Here we explain their definitions and usages 8 9 1 Polylines A polyline is a set of successive line segments It is defined with a class G4Polyline defined in the graphics_reps category A polyline is used to visualize tracking steps particle trajectories coordinate axes and any other user defined objects made of line segments G4Polyline is defined as a list of G4Point3D objects i e vertex positions The vertex positions are set to a G4Polyline object with the push_back method For example an x axis with length 5 cm and with red color is defined in Example 8 5 Example 8 5 Defining an x axis with length 5 cm and with colour red I C source codes An example of defining a line segment Instantiate an emply polyline object G4Polyline x_axis Set red line colour G4Colour wc sO 10 0 Oo G4VisAttributes att red x axis SetVisAttributes amp att Set vertex positions x axis push back G4Point3D 0 0 0 sas Sp uS BASRI Aeron sD Sem 010 end of C source codes 8 9 2 Markers Here we explain how to use 3D markers in Geant4 Visualization What are Markers Markers set marks at arbitrary positions in the 3D space They are often used to visualize hits of particles at detector components A marker is a 2 dimensional primitive with shape square circle etc color and special properties a of always facing the camera and b of having the possibility
439. ser s Guide for Application Developers 8 5 Controlling Visualization from Compiled Code sss 217 8 531 G4V VIS Manager 5c cete ED do FE EE ka be o e a Fe ED E eet 217 8 5 2 Visualization of detector components LL aaa kaka aaa aaa emm e 217 8 5 3 Visualization of trajectories sissi tereti e rte REPE PRR a e aa 218 8 5 4 Enhanced trajectory drawing sss e e emm emm ee meer 218 8 5 5 HepRep Attributes for Trajectories esses m e emere 218 8 5 6 Visualization Eu 219 8 57 HepRep Attributes for Hits cs s raais imensei re es PEE RAER eR RII is 221 8 5 8 Vasualization of text datore ione snee cett ks Kaas mre rper E gen eee EE ren rtu enel 221 8 5 9 Visualization of polylines and tracking steps sese 221 8 5 10 Visualization User Action 20 0 0 cece cee ccee cence aaa seca seca aa aaa aaa aaa aaa nhe mee nennen 223 8 5 11 Standalone Visualization eee Reit de Seas EEE SETE SSRIS EREE SPS 224 8 6 Visualization Attributes 1 ea repr Se RII E RENE ee EE E EEEE ESEE 224 8 6 T Vasibiltty citet rae eese vss poh edet a aj ates sey PESE as 224 8 6 2 Colour 5 i exe ia aa as ais eae es 225 8 6 3 Forcing attributes 1 entree doe mb rtr E sia iir ERE so di 227 8 6 4 Constructors of G4VisAttributes oo cece HH hee rene 228 8 6 5 How to assign G4VisAttributes to a logical volume eA 228 8 6 6 Additio
440. ses are treated in the same manner from the tracking point of view The Geant4 approach enables anyone to create a process and assign it to a particle type This openness should allow the creation of processes for novel domain specific or customised purposes by individuals or groups of users Each process has two groups of methods which play an important role in tracking Get PhysicalInterac tionLength GPIL and DoIt The GPIL method gives the step length from the current space time point to the next space time point It does this by calculating the probability of interaction based on the process s cross section information At the end of this step the DoIt method should be invoked The DoIt method implements the details of the interaction changing the particle s energy momentum direction and position and producing secondary tracks if required These changes are recorded as G4VParticleChange objects see Particle Change G4VProcess G4VProcess is the base class for all physics processes Each physics process must implement virtual methods of G4VProcess which describe the interaction Dolt and determine when an interaction should occur GPIL In order to accommodate various types of interactions G4VProcess provides three DoIt methods e G4VParticleChange AlongStepDoIt const G4Track track const G4Step step Data This method is invoked while G4SteppingManager is transporting a particle through one step The correspond ing AlongStepDo
441. set triggers compilation of a specific z1ib module for the compression of output files mainly in use currently for the HepRep graphics driver By default the flag is not set and the built in system library for compression is adopted instead Setting this flag will also implicitely set the flag below G4LIB USE ZLIB Specifies to use the z1ib module either system built in or Geant4 specific G4LIB_BUILD_G3TOG4 If set triggers compilation of the g3tog4 module for conversions of simple legacy geometries descriptions to Geant4 By default the flag is not set and the module s library is not built Setting this flag will also implicitely set the flag below G4LIB_USE_G3TOG4 Specifies to use the g3tog4 module assuming the related library has been already installed Analysis specific G4ANALYSIS_USE Specifies to activate the appropriate environment for analysis if an application includes code for histogram ming based on AJDA Additional setup variables are required G4ANALYSIS AIDA CONFIG CFLAGS SG4ANALYSIS_AIDA_CONFIG_LIBS to define config options for AIDA aida config cflags and aida config libs See installation instructions of the specific analysis tools for details Directory paths to Physics Data NeutronHPCrossSections Path to external data set for Neutron Scattering processes G4LEDATA Path to external data set for low energy electromagnetic processes G4LEVELGAMMADATA Path to the data set for Photon Evapora
442. sets the seed to seed and luxury to 4 HepRandom set TheSeed seed sets the seed to seed keeping the current luxury level e RanecuEngine The algorithm for RanecuEngine is taken from the one originally written in FORTRAN77 as part of the MATHLIB HEP library The initialisation is carried out using a Multiplicative Congruential generator using formula constants of L Ecuyer as described in F James Comp Phys Comm 60 1990 329 344 Handling of seeds for this engine is slightly different than the other engines in HEPRandom Seeds are taken from a seed table given an index the get Seed method returns the current index of seed table The set Seeds method will set seeds in the local SeedTable at a given position index if the index number specified exceeds the table s size index size is taken For example static interface const G4long table entry table entry HepRandom getTheSeeds it returns a pointer table entry to the local SeedTable at the current index position The couple of seeds accessed represents the current status of the engine itself G4int index n G4long seeds 2 HepRandom setTheSeeds seeds index sets the new index for seeds and modify the values inside the local SeedTable at the index position If the index is not specified the current index in the table is considered The setSeed method resets the current status of the engine to the
443. size not to exceed 1 10 of the Tracker thickness it is enough to put the following code in DetectorConstruction Construct G4double maxStep 0 1 TrackerLength logicTracker gt SetUserLimits new G4UserLimits maxStep The G4UserLimits class is in source global management Concerning the others cuts the user must define dedicaced process es He registers this process or its de scendant only for the desired particles in their process manager He can apply his cuts in the DoIt of this process since via G4Track he can access the logical volume and UserLimits An example of such process called UserSpecialCuts is provided in the repository but not inserted in any process manager of any particle Example neutrons One may need to abandon the tracking of neutrons after a given time of flight or a charged particle in a magnetic field after a given total track length etc Example see novice N02 in the Tracker region in order to force the total time of flight of the neutrons not to exceed 10 milliseconds put the following code in DetectorConstruction Construct G4double maxTime 10 ms logicTracker gt SetUserLimits new G4UserLimits DBL MAX DBL MAX maxTime and put the following code in NO2PhysicsList G4ProcessManager pmanager G4Neutron Neutron gt GetProcessManager pmanager AddProcess new G4UserSpecialCuts 1 1 1 The default G4UserSpecialCuts class is in sourck6fprocesses transpo
444. sor flags G4VIS BUILD DRIVERNAME DRIVER are automatically set by config G4VIS_BUILD gmk in installa tion 2 10 3 How to Incorporate Visualization Drivers into an Ex ecutable You can realize use visualization driver s you want in your Geant4 executable These can only be from the set installed in the Geant4 libraries You will be warned if the one you request is not available In order to realize visualization drivers you must instantiate and initialize a subclass of GAVisManager that implements the pure virtual function RegisterGraphicsSystems This subclass must be compiled in the user s domain to force the loading of appropriate libraries in the right order The easiest way to do this is to use GaVisExecutive a provided class with included implementation G4VisExecut ive is sensitive to the G4VIS USE variables mentioned above If you do wish to write your own subclass you may do so You will see how to do this by looking at G4VisExecutive icc A typical extract is RegisterGraphicsSystem new G4DAWNFILE ifdef G4VIS_USE_OPENGLX RegisterGraphicsSystem new G4OpenGLImmediateX RegisterGraphicsSystem new G4OpenGLStoredX fendif If you wish to use G4VisExecut ive but register an additional graphics system XXX say you may do so either before or after initializing visManager gt RegisterGraphicsSytem new XXX visManager gt Initialize An example of a typical main
445. st G4UpperEnergyToLowerWeightMap enWeMap void SetGeneralUpperEnergyBounds const std set lt G4double std less lt G4double gt gt amp enBounds private The user may choose equal energy bounds for all cells In this case a set of upper energy bounds must be given to the store using the method SetGeneralUpperEnergyBounds If a general set of energy bounds have been set AddLowerWeights can be used to add the cells Alternatively the user may chose different energy regions for different cells In this case the user must provide a mapping of upper energy bounds to lower weight bounds for every cell using the method AddUpperEbound LowerWeightPairs Weight window algorithms implementing the interface class G4VWeightWindowAlgorithm can be used to define a customized algorithm class G4VWeightWindowAlgorithm public G4VWeightWindowAlgorithm virtual G4VWeightWindowAlgorithm virtual G4Nsplit Weight Calculate G4double init_w G4double lowerWeightBound const 0 A concrete implementation is provided and used as a default class G4WeightWindowAlgorithm public G4VWeightWindowAlgorithm public G4WeightWindowAlgorithm G4double upperLimitFaktor 5 G4double survivalFaktor 3 G4int maxNumberOfSplits 5 virtual G4WeightWindowAlgorithm virtual G4Nsplit_Weight Calculate G4double init w G4double lowerWeightBound const private i The constructor takes three parameters which are used to ca
446. st have its unique name which should be set to the G4VUserParallelWorld base class as an argument of the base class constructor The world physical volume of the parallel world is provided by the G4RunManager as a clone of the mass geometry In the Construct virtual method of the user s class the pointer to this cloned world physical volume is available through the Get World method defined in the base class The user should fill the volumes in the parallel world by using this provided world volume For a logical volume in a parallel world the material pointer can be NULL Even if specified a valid material pointer it will not be taken into account by any physics process Example 4 18 An example source code of a concrete user parallel world class include MyParallelWorld hh include G4LogicalVolume hh include G4VPhysicalVolume hh include G4Box hh include G4PVPlacement hh MyParallelWorld MyParallelWorld G4String worldName G4VUserParallelWorld worldName 7 MyParallelWorld MyParallelWorld 7 void MyParallelWorld Construct G4VPhysicalVolume ghostWorld GetWorld G4LogicalVolume worldLogical ghostWorld gt GetLogicalVolume place volumes in the parallel world here For example G4Box ghostSolid new G4Box GhostdBox 60 cm 60 cm 60 cm G4LogicalVolume ghostLogical new G4LogicalVolume ghostSolid 0 GhostLogical 0 0 0 new G4PVPlacement 0 G4ThreeVector gho
447. stLogical GhostPhysical worldLogical 0 0 In case the user needs to define more than one parallel worlds each of them must be implemented through its dedicated class Each parallel world should be registered to the mass geometry class using the method Regis terParallelWorld available through the class G4VUserDetectorConstruction The registration must be done before the mass world is registed to the G4RunManager 127 Detector Definition and Response Example 4 19 Typical implementation in the main to define a parallel world RunManager construction 14 G4RunManager runManager new G4RunManager mass world Hi MyDetectorConstruction massWorld new MyDetectorConstruction parallel world J massWorld gt RegisterParallelWorld new MyParallelWorld ParallelScoringWorld set mass world to run manager runManager gt SetUserInitialization massWorld 4 7 3 Detector sensitivity in a parallel world Any kind of G4VSensitiveDetector object can be defined in volumes in a parallel world exactly at the same manner for the mass geometry Once the user defines the sensitive detector in a parallel world he she must define a process which takes care of these detectors The G4ParallelWorldScoringProcess is the class provided for this purpose This process must be defined to all kinds of particles which need to be detected This process must be ordered just after G4Transporation and prior to
448. structor virtual G4bool Notify G4ApplicationState requiredState Example 3 2 Source file of UserHookForAbortState include UserHookForAbortState hh UserHookForAbortState UserHookForAbortState UserHookForAbortState UserHookForAbortState G4bool UserHookForAbortState Notify G4ApplicationState requiredState if requiredState Abort return true Do book keeping here LECU LEUG 42 Toolkit Fundamentals 3 4 4 Customizing the Run Manager 3 4 4 1 Virtual Methods in the Run Manager G4RunManager is a concrete class with a complete set of functionalities for managing the Geant4 kernel It is the only manager class in the Geant4 kernel which must be constructed in the main method of the user s application Thus instead of constructing the G4RunManager provided by Geant4 you are free to construct your own RunManager It is recommended however that your RunManager inherit G4RunManager For this purpose G4RunManager has various virtual methods which provide all the functionalities required to handle the Geant4 kernel Hence your customized run manager need only override the methods particular to your needs the remaining methods in G4RunManager base class can still be used A summary of the available methods is presented here public virtual void Initialize main entry point of Geant4 kernel initialization protected virtual void InitializeGeometry geometry construction
449. structure of this class cateogory This User s Manual is also organized according to class categories In the development and maintenance of Geant4 one software team will be assigned to a class category This team will have a responsibility to develop and maintain all classes belonging to the class category 3 1 2 Class categories in Geant4 The following is a brief summary of the role of each class category in Geant4 31 Toolkit Fundamentals Run and Event These are categories related to the generation of events interfaces to event generators and any secondary particles produced Their roles are principally to provide particles to be tracked to the Tracking Management Tracking and Track These are categories related to propagating a particle by analyzing the factors limiting the step and applying the relevant physics processes The important aspect of the design was that a generalized Geant4 physics process or interaction could perform actions along a tracking step either localized in space or in time or distributed in space and time and all the possible combinations that could be built from these cases Geometry and Magnetic Field These categories manage the geometrical definition of a detector solid modeling and the computation of distances to solids also in a magnetic field The Geant4 geometry solid modeler is based on the ISO STEP standard and it is fully compliant with it in order to allow in future the exchange
450. t This class object is constructed in G4RunManager and sent to G4EventManager The event currently being processed can be obtained via the get CurrentEvent method of G4RunManager 3 5 2 Structure of an event A G4Event object has four major types of information Get methods for this information are available in G4Event Primary vertexes and primary particles Details are given in Section 3 6 Trajectories Trajectories are stored in G4TrajectoryContainer class objects and the pointer to this container is stored in G4Event The contents of a trajectory are given in Section 5 1 6 Hits collections Collections of hits generated by sensitive detectors are kept in G4HCofThisEvent class object and the pointer to this container class object is stored in G4Event See Section 4 4 for the details Digits collections Collections of digits generated by digitizer modules are kept in G4DCofThisEvent class object and the pointer to this container class object is stored in G4Event See Section 4 5 for the details 3 5 3 Mandates of G4EventManager G4EventManager is the manager class to take care of one event It is responsible for converting G4PrimaryVertex and G4PrimaryParticle objects associated with the current G4Event object to G4Track objects All of G4Track objects representing the primary particles are sent to G4StackManager e Pop one G4Track object from G4StackManager and send it to G4TrackingManager The current G4Track object is deleted
451. t are parts of a circle such as a tube G4Tubs etc it is possible to force the precision of polyhedral representation for visualisation This is recommended for volumes containing only a small angle of circle for example a thin tube segment For visualisation a circle is represented by an N sided polygon The default is 24 sides or segments The user may change this for all volumes in a particular viewer at run time with vis viewer set lineSegmentsPerCircle alternatively it can be forced for a particular volume with void G4VisAttributes SetForceLineSegmentsPerCircle G4int nSegments 8 6 4 Constructors of G4VisAttributes The following constructors are supported for class G4VisAttributes f Constructors of class G4VisAttributes G4VisAttributes void G4VisAttributes G4bool visibility G4VisAttributes const G4Colour amp colour G4VisAttributes G4bool visibility const G4Colour amp colour 8 6 5 How to assign G4VisAttributes to a logical volume In constructing your detector components you may assign a set of visualization attributes to each logical volume in order to visualize them later if you do not do this the graphics system will use a default set You cannot make a solid such as G4Box hold a set of visualization attributes this is because a solid should hold only geometrical information At present you cannot make a physical volume hold one but there are plans to design a memory ef fici
452. t classes The global category defines also a set of utility classes generally used within the kernel of Geant4 These classes include G4Allocator A class for fast allocation of objects to the heap through paging mechanism It s meant to be used by associating it to the object to be allocated and defining for it new and delete operators via MallocSingle and FreeSingle methods of G4Allocator G4ReferenceCountedHandle Template class acting as a smart pointer and wrapping the type to be counted It performs the reference counting during the life time of the counted object e G4FastVector Template class defining a vector of pointers not performing boundary checking e G4PhysicsVector Defines a physics vector which has values of energy loss cross section and other physics values of a particle in matter in a given range of the energy momentum etc This class serves as the base class for a vector having various energy scale for example like log G4PhysicsLogVector linear G4PhysicsLinearVector free G4PhysicsFree Vector etc 37 Toolkit Fundamentals e G4LPhysicsFreeVector Implements a free vector for low energy physics cross section data A subdivision method is used to find the energylmomentum bin e G4PhysicsOrderedFreeVector A physics ordered free vector inherits from G4PhysicsVector It provides in addition a method for the user to insert energy value pairs in sequence Methods to retrieve the max
453. t cut value ExN04PhysicsList ExN04PhysicsList G4VUserPhysicsList default cut value 1 0mm defaultCutValue 1 0 mm The SetDefaultCutValue method in G4VUserPhysicsList may also be used and the run setCut command may be used to change the default cut value interactively WARNING DO NOT change cut values inside the event loop Cut values may however be changed between runs An example implementation of Set Cuts is shown below Example 2 16 Example implementation of the SetCuts method void ExN03PhysicsList SetCuts set cut values for gamma at first and for e second and next for et because some processes for e e need cut values for gamma SetCutValue cutForGamma gamma SetCutValue cutForElectron e SetCutValue cutForElectron e 12 Getting Started with Geant4 Running a Simple Example Beginning with Geant4 version 5 1 it is now possible to set production thresholds for each geometrical region This new functionality is described in Section 5 5 2 5 How to Specify Physics Processes 2 5 1 Physics Processes Physics processes describe how particles interact with materials Geant4 provides seven major categories of pro cesses electromagnetic e hadronic transportation decay Optical e photolepton hadron and e parameterisation All physics processes are derived from the G4VProcess base class Its virtual methods e AtRestDoIt Alon
454. t from 0 35 to 0 45 meters divBox3 is a division of the same box along its X axis in 3 equal copies of width 0 1 meters and an offset of 0 5 meters The first copy will extend from 0 to 0 1 meters in the mother s frame and the last from 0 2to 0 3 meters Example 4 6 An example of division of a polycone G4double zPlanem new G4double 3 zPlanem 0 1 m zPlanem 04521 zPlanem 2 SEX G4double rInnerm new G4double 3 rInnerm 0 0 rInnerm 0 1 m rInnerm 2 0 5 m G4double rOuterm new G4double 3 rOuterm 0 0 2 m rOuterm 0 4 m rOuterm 2 1 m G4Polycone motherSolid new G4Polycone motherSolid 20 deg 180 deg 3 zPlanem rInnerm rOuterm G4LogicalVolume motherLog new G4LogicalVolume motherSolid material mother 0 0 0 G4double zPlaned new G4double 3 zPlaned 0 3 m zPlaned 0 m zPlaned 2 1 m G4double rInnerd new G4double 3 rInnerd 0 0 2 rInnerd 0 4 m rInnerd 2 0 5 m G4double rOuterd new G4double 3 EOUce AION Oroe Mt rOuterd 0 8 m rOuterd 2 2 m G4Polycone divSolid new G4Polycone divSolid 0 deg 10 deg 3 zPlaned rInnerd rOuterd G4LogicalVolume childLog new G4LogicalVolume divSolid material child 0 0 0 G4PVDivision divPconePhiW division along phi giving width and offset childLog motherLog kPhi 30 deg 60 deg G4PVDivision divPconeZN division along Z giving nDiv and offset ch
455. t region information G4StepPoint thePrePoint theStep gt GetPreStepPoint G4LogicalVolume thePreLV thePrePoint gt GetPhysicalVolume gt GetLogicalVolume REOIRegionInformation thePreRInfo REOlRegionInformation thePreLV gt GetRegion gt GetUserInformation G4StepPoint thePostPoint theStep gt GetPostStepPoint G4LogicalVolume thePostLV thePostPoint gt GetPhysicalVolume gt Get LogicalVolume REO1lRegionInformation thePostRInfo REOlRegionInformation thePostLV gt GetRegion gt GetUserInformation check if it is entering to the calorimeter volume if thePreRInfo gt IsCalorimeter amp amp thePostRInfo gt IsCalorimeter theTrack gt SetTrackStatus fSuspend 180 Chapter 7 Comommunication and Control 7 1 Built in Commands Geant4 has various built in user interface commands each of which corresponds roughly to a Geant4 category These commands can be used e interactively via a Graphical User Interface G UI inamacro file via control execute command e within C code with the ApplyCommand method of G4UImanager Note The availability of individual commands the ranges of parameters the available candidates on individual com mand parameters vary according to the implementation of your application and may even vary dynamically dur ing the execution of your job List of built in commands 7 2 User Interface Defining
456. t2 new G4ThreeVector targetSize targetSize 05107 G4ThreeVector targetSize targetSize 0 56 7 G4ThreeVector 01410 0 0 targetSize ABSOLUTE e h h h e h h h G4TriangularFace G4TriangularFace P Tot G4TriangularFacet facet3 new G4TriangularFacet G4ThreeVector targetSize targetSize 0 509 G4ThreeVector targetSize targetSize O O G4ThreeVector 0 0 0 0 targetSize ABSOLUTE G4TriangularFacet facet4 new G4TriangularFacet G4ThreeVector targetSize targetSize 0 50 E G4ThreeVector targetSize targetSize 05097 G4ThreeVector ORO 0 0 targetSize ABSOLUTE G4QuadrangularFacet facet5 new G4QuadrangularFacet G4ThreeVector targetSize targetSize 0 0 G4ThreeVector targetSize targetSize OP G4ThreeVector ttargetSize targetSize ORO 0 0 G4ThreeVector ttargetSize targetSize ABSOLUTE Now add the facets to the solid 24 solidTarget gt AddFacet G4VFacet facetl solidTarget gt AddFacet G4VFacet facet2 solidTarget gt AddFacet G4VFacet facet3 F 7 solidTarget gt AddFacet G4VFacet facet4 solidTarget gt AddFacet G4VFacet facet5 7 Finally declare the solid is complete ah solidTarget gt SetSolidClosed true The G4TriangularFacet class is used for the contruction of G4TessellatedSolid It is defined by three vertices which shall be sup
457. t4 please refer to the Physics Reference Manual 5 2 2 1 Treatment of Cross Sections Cross section data sets Each hadronic process object derived from G4HadronicProcess may have one or more cross section data sets associated with it The term data set is meant in a broad sense to be an object that encapsulates methods and data for calculating total cross sections for a given process The methods and data may take many forms from a simple equation using a few hard wired numbers to a sophisticated parameterisation using large data tables Cross section data sets are derived from the abstract class G4VCrossSectionDataSet and are required to implement the following methods G4bool IsApplicable const G4DynamicParticle const G4Element This method must return True if the data set is able to calculate a total cross section for the given particle and material and False otherwise 140 Tracking and Physics G4double GetCrossSection const G4DynamicParticle const G4Element This method which will be invoked only if True was returned by IsApplicable must return a cross section in Geant4 default units for the given particle and material void BuildPhysicsTable const G4ParticleDefinitions amp This method may be invoked to request the data set to recalculate its internal database or otherwise reset its state after a change in the cuts or other parameters of the given particle type void DumpPhysicsTable const G4Pa
458. t4 kernel at specific points in the tracking For details see the Software Reference Manual 5 1 5 Verbose Outputs The verbose information output flag can be turned on or off The amount of information printed about the track step from brief to very detailed can be controlled by the value of the verbose flag for example G4UImanager UI G4UImanager GetUIpointer UI gt ApplyCommand tracking verbose 1 5 1 6 Trajectory and Trajectory Point G4Trajectory and G4TrajectoryPoint G4Trajectory and G4TrajectoryPoint are default concrete classes provided by Geant4 which are derived from the G4VTrajectory and G4VTrajectoryPoint base classes respectively A G4Trajectory class object is created by G4TrackingManager when a G4Track is passed from the G4EventManager G4Trajectory has the following data members ID numbers of the track and the track s parent e particle name charge and PDG code e acollection of G4TrajectoryPoint pointers G4TrajectoryPoint corresponds to a step point along the path followed by the track Its position is given by a G4ThreeVector A G4TrajectoryPoint class object is created in the AppendStep method of G4Trajectory and this method is invoked by G4TrackingManager at the end of each step The first point is created when the G4Trajectory is created thus the first point is the original vertex The creation of a trajectory can be controlled by invoking G4TrackingManager SetStoreTrajectory G4bool The
459. tal G4int numRZ const G4double const G4double sls z In the picture phiStart 0 Degree phi Total 2 Pi numZPlanes 9 rInner 0 0 0 0 0 0 0 0 0 rOuter 0 10 10 5 5 10 10 2 2 22 5 7 9 11 25 27 29 31 35 where phiStart Initial Phi starting angle phiTotal Total Phi angle numZPlanes Number of z planes numRZ Number of corners in r z space zPlane Position of z planes rInner Tangent distance to inner surface rOuter Tangent distance to outer surface r r coordinate of corners Z z coordinate of corners Polyhedra PGON Polyhedra PGON are implemented through G4Polyhedra G4Polyhedra const G4String amp pName G4double phiStart G4double phiTotal G4int numSide G4int numZPlanes const G4double zPlane const G4double rInner const G4double rOuter G4Polyhedra const G4String amp pName G4double phiStart G4double phiTotal G4int numSide G4int numRZ In the picture phiStart 0 phiTotal 2 Pi 1 numSide 5 nunZPlanes 7 rInner const G4double z 65 Detector Definition and Response where phiStart s 0 0 rOuter 0 15 15 4 Z 0 5 8 13 30 32 35 Initial Phi starting angle phiTotal Total Phi angle numSide Number of sides numZPlanes numRZ Number of z planes Number of corners in r z space zPlane Position of
460. ted Visualization Manager by yourself A complete description of a sample main function is described in exam ples novice N03 exampleN03 cc 2 10 5 Sample Visualization Sessions In this section we present typical sessions of Geant4 visualization You can test them with the sample program geant4 examples novice N03 Run a binary executable exampleN03 without an argument and then execute the commands below in the Idle gt state Explanation of each command will be described later Note that the OpenGL Xlib driver and the DAWNFILE driver are incorporated into the executable and that Fukui Renderer DAWN is installed in your machine 2 10 5 1 Visualization of detector components The following session visualizes detector components with the OpenGL Xlib driver and then with the DAWN FILE driver The former exhibits minimal visualization commands to visualize detector geometry while the latter exhibits customized visualization visualization of a selected physical volume coordinate axes texts etc HHH HE EHH HE FE FE E FE TE AE FE EH FE FE RE HERE AE FE FE AE FE FE E FE E RE RE E ERE RE E ERE RE E ER visl mac d A Sample macro to demonstrate visualization of detector geometry 27 Getting Started with Geant4 Running a Simple Example USAGE Save the commands below as a macro file say visl mac and execute it as follows 3 S G4BINDIR exampleN03 Idle gt control execute visl mac FE E AE E AE AE
461. ted and must be of the correct symmetry type in order to assist in good visualisation ex For X axis replicas in a box the solid should be another box with the dimensions of the replications same Y amp Z dimensions as mother box X dimension mother s X dimension nReplicas Replicas may be placed inside other replicas provided the above rule is observed Normal placement volumes may be placed inside replicas provided that they do not intersect the mother s or any previous replica s boundaries Parameterised volumes may not be placed inside Because of these rules it is not possible to place any other volume inside a replication in radius The world volume cannot act as a replica therefore it cannot be sliced During tracking the translation rotation associated with each G4PVReplica object is modified according to the currently active replication The solid is not modified and consequently has the wrong parameters for the cases of phi and r replication and for when the cross section of the mother is not constant along the replication Example Example 4 2 An example of simple replicated volumes with G4PVReplica G4PVReplica repX Linear Array pRepLogical pContainingMother IAR S 5y ee Orin G4PVReplica repR RSlices pRepRLogical pContainingMother KO Sp Lorin OJy G4PVReplica repRZ RZSlices pRepRZLogical amp repR heavens Spn ALO G4PVReplica repRZPhi RZPhiSlices pRepRZPhiLogical amp repRZ
462. ted for the mass and parallel geometries Both implement the interface G4VSampler G4VSampler allows the chosen combinations of scoring and variance reduction to be prepared and configures the sampling appropriately To this end G4VSampler provides Prepare methods and a Configure method class G4VSampler public G4vSampler virtual G4VSampler virtual void PrepareScoring G4VScorer Scorer 0 virtual void PrepareImportanceSampling G4VIStore istore const G4VImportanceAlgorithm ialg 0 0 virtual void PrepareWeightRoulett G4double wsurvive 0 5 G4double wlimit 0 25 G4double isource 1 0 virtual void PrepareWeightWindow G4VWeightWindowStore wwstore G4VWeightWindowAlgorithm wwAlg 0 G4PlaceOfAction placeOfAction onBoundary 0 virtual void Configure 0 virtual void ClearSampling 0 virtual G4bool IsConfigured const 0 The methods for setting up the desired combination need specific information e Scoring message PrepareScoring witha G4VScorer e Importance sampling message PrepareImportanceSampling with a G4VIStore and optionally a G4VImportanceAlgorithm e Weight window message PrepareWeight Window with the arguments e wwstore a G4VWeightWindowStore for retrieving the lower weight bounds for the energy space cells wwAlg a GAVWeightWindowAlgorithm if a customized algorithm should be used placeOfAction a G4PlaceOfAction specifying where to perform the biasing
463. ter MyDigitizer myDM fDM Digitize myDet myCal myEMdigiMod How to get hitsCollection and or digiCollection G4DigiManager has the following methods to access to the hits or digi collections of the currently processing event or of previous events First you have to get the collection ID number of the hits or digits collection G4DigiManager fDM G4DigiManager GetDMpointer G4int myHitsCollID fDM GetHitsCollectionID hits collection name G4int myDigiCollID fDM GetDigiCollectionID digi collection name Then you can get the pointer to your concrete G4THitsCollection object or G4TDigiCollection object of the currently processing event MyHitsCollection HC fDM GetHitsCollection myHitsCollID MyDigiCollection DC fDM GetDigiCollection myDigiCollID In case you want to access to the hits or digits collection of previous events add the second argument MyHitsCollection HC fDM GetHitsCollection myHitsCollID n MyDigiCollection DC DM gt GetDigiCollection myDigiCollID n where n indicates the hits or digits collection of the p previous event 4 6 Object Persistency 4 6 1 Persistency in Geant4 Object persistency is provided by Geant4 as an optional category so that the user may run Geant4 with or without an object database management system ODBMS When a usual transient object is created in C the object is placed onto the application heap and it ceases to
464. tering attenutation length specified by the user the program automatically calls the RayleighAttenuationLengthGenera tor which calculates it for 10 degrees Celsius liquid water Boundary Process Reference E Hecht and A Zajac Optics Hecht1974 For the simple case of a perfectly smooth interface between two dielectric materials all the user needs to provide are the refractive indices of the two materials stored in their respective G4MaterialPropertiesTable In all other cases the optical boundary process design relies on the concept of surfaces The information is split into two classes One class in the material category keeps information about the physical properties of the surface itself and a second class in the geometry category holds pointers to the relevant physical and logical volumes involved and has an association to the physical class Surface objects of the second type are stored in a related table and can be retrieved by either specifying the two ordered pairs of physical volumes touching at the surface or by the logical volume entirely surrounded by this surface The former is called a border surface while the latter is referred to as the skin surface This second type of surface is useful in situations where a volume is coded with a reflector and is placed into many different mother volumes A limitation is that the skin surface can only have one and the same optical property for all of the enclosed volume s sides The border surfa
465. terisation is valid and must be triggered the parameterisation itself where the primary will be killed or moved whether or not to create it or create secondaries etc and where the detector response will be computed GEANT4 will message your parameterisation code for each step starting in any root G4Logical Volume including daughters sub daughters etc of this volume of the G4Region It will proceed by first asking the available parameterisations for the current particle type if one of them and only one wants to issue a trigger If so it will invoke its parameterisation In this case the tracking will not apply physics to the particle in the step Instead the UserSteppingAction will be invoked Parameterisations look like a user stepping action but are more advanced because 154 Tracking and Physics e parameterisation code is messaged only in the G4Region to which it is bound e parameterisation code is messaged anywhere in the G4Region that is any volume in which the track is located e GEANT4 will provide information to your parameterisation code about the current root volume of the G4Region in which the track is travelling 5 2 6 2 Overview of Parameterisation Components The GEANT4 components which allow the implementation and control of parameterisations are G4VFastSimulationModel This is the abstract class for the implementation of parameterisations You must inherit from it to implement your concrete parame
466. terisation model G4FastSimulationManager The G4VFastSimulationModel objects are attached to the G4Region through a G4FastSimulationManager This object will manage the list of models and will message them at tracking time G4Region Envelope As mentioned before an envelope in GEANT4 is a G4Region The parameterisation is bound to the G4Region by setting a G4FastSimulationManager pointer to it The figure below shows how the G4VFastSimulationModel and G4FastSimulationManager ob jects are bound to the G4Region Then for all root G4Logical Volume s held by the G4Region the fast sim ulation code is active G4Region G4FastSimulationManager G4VFastSimulationModel eg e e gamma model G4VFastSimulationModel hobt G4LogicalVolume 2 eg pion model mother volume of hierarchy tree G4VFastSimulationModel root d ogicalVolume 1 mother volume of hierarchy tree G4FastSimulationManagerProcess This is a G4VProcess It provides the interface between the tracking and the parameterisation It must be set in the process list of the particles you want to parameterise G4GlobalFastSimulationManager This a singleton class which provides the management of the G4FastSimulationManager objects and some ghost facilities 5 2 6 3 The G4VFastSimulationModel Abstract Class Constructors The G4VFastSimulationModel class has two constructors The second one allows you to get started quickly G4VFastSimulationModel const G4String am
467. that vertex There are some kinds of particles which should fly some reasonable distances and thus should be simulated by Geant4 but you still want to follow the decay channel generated by an event generator A typical case of these particles is B meson Even for the case of a primary particle which has a corresponding G4ParticleDefinition it can have daughter primary particles Geant4 will trace the parent particle until it comes to decay obeying multiple scattering ionization loss rotation with the magnetic field etc according to its particle type When the parent comes to decay instead of randomly choosing its decay channel it follows the pre assigned decay channel To conserve the energy and the momentum of the parent daughters will be Lorentz transformed according to their parent s frame 3 6 2 Interface to a primary generator 3 6 2 1 G4HEPEvtInterface Unfortunately almost all event generators presently in use commonly are written in FORTRAN For Geant4 it was decided to not link with any FORTRAN program or library even though the C language syntax itself 46 Toolkit Fundamentals allows such a link Linking to a FORTRAN package might be convenient in some cases but we will lose many advantages of object oriented features of C such as robustness Instead Geant4 provides an ASCII file interface for such event generators G4HEPEvtInterface is one of G4VPrimaryGenerator concrete class and thus it can be used in
468. the DAWN FILE driver incorporated In order to use the DAWNFILE driver you need Fukui Renderer DAWN which is obtainable from the following Web site http geant4 kek jp GEANT4 vis In order to use the the OpenGL drivers you need the OpenGL library which is installed in many platforms by default You also need to set an environmental variable G4VIS_BUILD_OPENGLX_DRIVER to 1 in building installing Genat4 libraries and also set another environmental variable G4VIS_USE_OPENGLX to 1 in com piling your Geant4 executable You may also have to set an environmental variable OGLHOME to the OpenGL root directory For example LE setenv G4VIS BUILD OPENGLX DRIVER 1 setenv G4VIS USE OPENGLX 1 setenv OGLHOME usr X11R6 Some other visualization drivers depending on external libraries are also required to set the similar environmental variables G4VIS BUILD DRIVERNAME DRIVER and G4VIS USE DRIVERNAME to 1 All visualization drivers independent of external libraries e g DAWNFILE and VRMLFILE drivers need not such setting But you must prepare a proper visualization manager class and a proper main function anyway See below For all visualization drivers available in your Geant4 executable the C pre processor flags GAVIS USE DRIVERNAME are automatically set by config G4VIS USE gmk in compilation Sim ilaly for all visualization drivers incorporated into the Geant4 libraries the C pre proces
469. the correction of multiple scattering Increment of position and time between PreStepPoint and PostStepPoint Increment of momentum and energy between PreStepPoint and PostStepPoint Note to get the energy deposited in the step you cannot use this Delta energy You have to use Total energy deposit as below Pointer to G4Track Total energy deposited during the step this is the sum of the energy deposited by the energy loss process and 130 Tracking and Physics the energy lost by secondaries which have NOT been generated because each of their energies was below the cut threshold Information in G4StepPoint PreStepPoint and PostStepPoint includes x y z t px py pz Ek Momentum direction init vector Pointers to physical volumes Safety Beta gamma Polarization Step status Pointer to the physics process which defined the current step and its DoIt type Pointer to the physics process which defined the previous step and its DoIt type Total track length Global time time since the current event began Local time time since the current track began Proper time How to Get particle change Particle change information can be accessed by invoking various Get methods provided in the G4ParticleChange class Typical information available includes for details see the Software Reference Manual final momentum direction of the parent particle final kinetic energy of the parent particle f
470. the regular structure of such geometries in navigation are under study Divisions of Volumes Divisions in Geant4 are implemented as a specialized type of parameterised volumes They serve to divide a volume into identical copies along one of its axes providing the possibility to define an offset and without the limitation that the daugthers have to fill the mother volume as it is the case for the replicas In the case for example of a tube divided along its radial axis the copies are not strictly identical but have increasing radii although their widths are constant To divide a volume it will be necessary to provide 1 the axis of division and 2 either e the number of divisions so that the width of each division will be automatically calculated or e the division width so that the number of divisions will be automatically calculated to fill as much of the mother as possible or e both the number of divisions and the division width this is especially designed for the case where the copies do not fully fill the mother An offset can be defined so that the first copy will start at some distance from the mother wall The dividing copies will be then distributed to occupy the rest of the volume There are three constructors corresponding to the three input possibilities described above e Giving only the number of divisions G4PVDivision const G4String amp pName G4LogicalVolume pCurrentLogical G4LogicalVolume pMotherLog
471. the visualization drivers offer ways to save visualized views to PostScript files or Encapsulated PostScript EPS files by themselves The DAWNFILE driver which co works with Fukui Renderer DAWN generates vectorized PostScript data with analytical hidden line surface removal and so it is well suited for technical high quality outputs for pre sentation documentation and debugging geometry In the default setting of the DAWNFILE drivers EPS files named g4 00 eps g4_0l eps g4 02 eps are automatically generated in the current directory each time when visualization is performed and then a PostScript viewer gv is automatically invoked to visualize the generated EPS files For large data sets it may take time to generate the vectorized PostScript data In such a case visualize the 3D scene with a faster visualization driver beforehand for previewing and then use the DAWNFILE drivers For example the following visualizes the whole detector with the OpenGL Xlib driver immediate mode first and then with the DAWNFILE driver to generate an EPS file g4 XX eps to save the visualized view Invoke the OpenGL visualization driver in its immediate mode vis open OGLIX Camera setting vis viewer set viewpointThetaPhi 20 20 Camera setting vis drawVolume vis viewer flush Invoke the DAWNFILE visualization driver vis open DAWNFILE Camera setting vis viewer set viewpointThetaPhi 20 20 Camera setting vis drawVolume v
472. the visualization system is choosen via the command vis sceneHandler create OGLIX 2 9 5 General Case Most of the examples in the SG4INSTALL examples directory have the following main which covers cases 2 and 3 above Thus the application can be run either in batch or interactive mode Example 2 24 The typical main routine from the examples directory inte maintint venere er chart cue d Construct the default run manager G4RunManager runManager new G4RunManager set mandatory initialization classes NO3DetectorConstruction detector new N03DetectorConstruction runManager 5SetUserInitialization detector runManager SetUserInitialization new NO3PhysicsList ifdef G4VIS USE visualization manager G4VisManager visManager new G4VisExecutive visManager gt Initialize endif set user action classes runManager gt SetUserAction new NO3PrimaryGeneratorAction detector runManager gt SetUserAction new NO3RunAction runManager gt SetUserAction new N03EventAction runManager gt SetUserAction new N03SteppingAction get the pointer to the User Interface manager G4UImanager UI G4UImanager GetUlpointer if argc 1 Define UI terminal for interactive mode G4UIsession session new G4UIterminal UI gt ApplyCommand control execute prerunN03 mac session gt SessionStart delete session else Batch mode 1 G4String command control execute G4S
473. the z axis 4 1 2 4 Tessellated Solids In Geant4 it is also implemented a class GaTessellatedSolid which can be used to generate a generic solid defined by a number of facets G4VFacet Such constructs are especially important for conversion of complex geometrical shapes imported from CAD systems bounded with generic surfaces into an approximate description with facets of defined dimension see Figure 4 1 Figure 4 1 Example of geometries imported from CAD system and converted to tessellated solids They can also be used to generate a solid bounded with a generic surface made of planar facets It is important that the supplied facets shall form a fully enclose space to represent the solid 74 Detector Definition and Response Two types of facet can be used for the construction of a G4TessellatedSolid a triangular facet G4TriangularFacet and a quadrangular facet G4QuadrangularFacet An example on how to generate a simple tessellated shape is given below Example 4 1 An example of a simple tessellated solid with G4TessellatedSolid First declare a tessellated solid G4TessellatedSolid solidTarget new G4TessellatedSolid Solid_name Define the facets which form the solid Ay G4double targetSize 10 cm G4TriangularFacet facetl new G4TriangularFacet G4ThreeVector targetSize targetSize 00 G4ThreeVector targetSize targetSize Qe ner G4ThreeVector Qr 0 0 targetSize ABSOLUTE face
474. their Geant4 equivalents 9 2 1 7 Geometry Definition Markup Language e General ReadMe illustrating import and export of a detector geometry with GDML 9 2 1 8 Geometry e ReadMe OLAP debugging tool for overlapping geometries 9 2 1 9 Hadronic e Hadr01 example based on the application HON developed for simulation of proton or ion beam interaction with a water target Different aspects of beam target interaction are included 9 2 1 10 Medical Applications e DICOM geometry set up using the Geant4 interface to the DICOM image format e GammaTherapy gamma radiation field formation in water phantom by electron beam hitting different targets e fanoCavity ionization chamber test 9 2 1 11 Optical Photons e General ReadMe e LXe optical photons in a liquid xenon scintillator 9 2 1 12 Parallel Computing e General ReadMe e ExDiane example of a medical application run in a distributed environment using the DIANE framework e ParGeant4 set of examples derived from novice using parallelism at event level with the TopC application 9 2 1 13 Persistency e General ReadMe e PersEx01 storing calorimeter hits using reflection mechanism with Root 255 Examples 9 2 1 14 Polarisation Pol01 decays of radioactive isotopes as well as induced radioactivity resulted from nuclear interactions 9 2 1 15 Radioactive Decay General ReadMe decays of radioactive isotopes as well as induced radioactivity resulted fro
475. ther rare The second case is more frequent for the user The second case is the following Suppose you want to move and or rotate a particular piece of your detector component This case can easily happen for a beam test of your detector It is obvious for this case that you need not change the world volume Rather it should be said that your world volume experimental hall for your beam test should be big enough for moving rotating your test detector For this case you can still use all of your detector geometries and just use a Set method of a particular physical volume to update the transformation vector as you want Thus you don t need to re set your world volume pointer to RunManager If you want to change your geometry for every run you can implement itin the BeginOfRunAction method of G4UserRunAction class which will be invoked at the beginning of each run or derive the RunInitial ization method Please note that for both of the above mentioned cases you need to let RunManager know the geometry needs to be closed again Thus you need to invoke runManager GeometryHasBeenModified before proceeding to the next run An example of changing geometry is given in a Geant4 tutorial in Geant4 Training kit 2 3 4 4 4 Switch physics processes Inthe InitializePhysics method G4VUserPhysicsList Construct is invoked in order to de fine particles and physics processes in your application Basically you can not add nor remo
476. they can just use the default visual 194 Visualization ization manager G4VisExecutive The Visualization Manager accepts users requests for visualization processes them and passes the processed requirements to the abstract interface i e to the currently selected visualization driver 8 2 5 How to Write the main Function In order for your Geant4 executable to perform visualization you must instantiate and initialize your Visual ization Manager in the main function The core of the Visualization Manager is the class G4VisManager defined in the visualization category This class requires that one pure virtual function be implemented namely void RegisterGraphicsSystems The easiest way to do this is to use G4VisExecutive as de scribed above but you may write your own class see above Example 8 2 shows the form of the main function Example 8 2 The form of the main function JA C source codes Instantiation and initialization of G4VisManager Your Visualization Manager include G4VisExecutive hh Instantiation and initialization of the Visualization Manager ifdef G4VIS_USE G4VisManager visManager new G4VisExecutive visManager gt initialize endif ifdef G4VIS_USE delete visManager fendif f end of C Alternatively you can implement an empty RegisterGraphicsSystems function and register visualiza tion drivers you want directly in your main functi
477. tically decide if the total of the mass fractions is correct and perform the necessary checks The main reason why a fixed index is kept as a data member is that many cross section and energy tables will be built in the physics processes by rows of materials or elements or even isotopes The tracking gives the physics process the address of a material object the material of the current volume If the material has an index according to which the cross section table has been built then direct access is available when a number in such a table must be accessed We get directly to the correct row and the energy of the particle will tell us the column Without such an index every access to the cross section or energy tables would imply a search to get to the correct material s row More details will be given in the section on processes 4 2 3 Recipes for Building Elements and Materials Example 4 10 illustrates the different ways to define materials Example 4 10 A program which illustrates the different ways to define materials include G4Isotope hh include G4Element hh include G4Material hh include G4UnitsTable hh int main G4String name symbol a mass of a mole G4double a z density z mean number of protons Galime aba n iz nb of protons in an isotope n nb of nucleons in an isotope G4int ncomponents natoms G4double abundance fractionmass G4double temperature pressure G4UnitDefinition B
478. time at the beginning and end of each step To do this write a tracking action that sets G4RichTrajectory for example include G4UserTrackingAction hh class G4Track class MyTrackingAction public G4UserTrackingAction public virtual void PreUserTrackingAction const G4Track aTrack include G4RichTrajectory hh include G4TrackingManager hh include G4IdentityTrajectoryFilter hh include G4TransportationManager hh include G4PropagatorInField hh void MyTrackingAction PreUserTrackingAction const G4Track aTrack Require rich trajectory fpTrackingManager gt SetTrajectory new G4RichTrajectory aTrack Activate storing of auxiliary points for smoother trajectory static G4IdentityTrajectoryFilter curvedFilter G4TransportationManager GetTransportationManager gt GetPropagatorInField gt SetTrajectoryFilter amp curvedFilter and register an instance of this with the run manager this can be done once and for all as soon as the run manager is instantiated probably in your main program include MyTrackingAction hh runManager gt SetUserAction new MyTrackingAction When you run you need to create a trajectory model and set the time slice interval remembering that paticles are often relativistic and travel 30 cm ns vis modeling trajectories create drawByCharge vis modeling trajectories drawByCharge 0 default setDrawStepPts true vis modeling trajectories drawByCharge 0 d
479. tion SetCuts method sets a cut value for all particle types in the particle table virtual void Setcute 05 public with description set get the default cut value Calling SetDefaultCutValue causes re calcuration of cut values and physics tables just before the next event loop void SetDefaultCutValue G4double newCutValue G4double GetDefaultCutValue const TEE ATE EAA EET A ETA TA TTA ATTA AAA AAA public with description Invoke BuildPhysicsTable for all processes for all particles In case of Retrieve flag is ON PhysicsTable will be retrieved from files void BuildPhysicsTable do BuildPhysicsTable for specified particle type void BuildPhysicsTable G4ParticleDefinition Store PhysicsTable together with both material and cut value information in files under the specified directory return true if files are sucessfully created G4bool StorePhysicsTable const G4String amp directory Return true if Retrieve flag is ON i e PhysicsTable will be retrieved from files G4bool IsPhysicsTableRetrieved const G4bool IsStoredInAscii const Get directory path for physics table files const G4String amp GetPhysicsTableDirectory const Set Retrieve flag Directory path can be set together Null string default means directory is not changed from the current value void SetPhysicsTableRetrieved const G4String amp directory
480. tion G4RADIOACTIVEDATA Path to the data set for Radiative Decay processes 5 3 Linking External Libraries with Geant4 The Geant4 GNUmake infrastructure allows to extend the link list of libraries with external or user defined packages which may be required for some user s applications to generate the final executable 5 3 1 Adding external libraries which do not use Geant4 In the GNUmakefile of your application before including binmake gmk specify the extra library in EX TRALIBS either using the L 1 syntax or by specifying the full pathname e g 272 Appendix EXTRALIBS L your path lib l myExtraLib or EXTRALIBS lt your path gt lib lib lt myExtraLib gt a You may also specify EXTRA_LINK_DEPENDENCIES which is added to the dependency of the target exe cutable and you may also specify a rule for making it e g EXTRA LINK DEPENDENCIES lt your path gt lib lib lt myExtraLib gt a lt your path gt lib lib lt myExtraLib gt a cd lt your path gt lib MAKE Note that you almost certainly need to augment CPPFLAGS for the header files of the external library e g CPPFLAGS I lt your path gt include See Example 1 Example 1 An example of a customised GNUmakefile for an application or example using an external module not bound to Geant4 A Pa A Mul me M r ny a S a S A A GNUmakefile for the application sim depending on module Xplotter
481. tion remove and delete ProcessManagers for all particles in tha Particle Table EL this routine is invoked from RunManager void RemoveProcessManager public with description add process manager for particles created on the fly void AddProcessManager G4ParticleDefinition newParticle G4ProcessManager newManager 0 i G4VUserPrimaryGeneratorAction Example 6 3 G4VUserPrimaryGeneratorAction class G4VUserPrimaryGeneratorAction i Public G4VUserPrimaryGeneratorAction virtual G4VUserPrimaryGeneratorAction public virtual void GeneratePrimaries G4Event anEvent 0 6 2 Optional User Actions There are five virtual classes whose methods the user may override in order to gain control of the simulation at var ious stages Each method of each action class has an empty default implementation allowing the user to inherit and implement desired classes and methods Objects of user action classes must be registered with G4RunManager G4UserRunAction This class has three virtual methods which are invoked by G4RunManager for each run GenerateRun This method is invoked at the beginning of BeamOn Because the user can inherit the class G4Run and create his her own concrete class to store some information about the run the GenerateRun method is the place to instantiate such an object It is also the ideal place to set variables which affect the physics table such as production thresholds for a particul
482. tion Developers 2 10 6 For More Information on Geant4 Visualization eee 30 3 Toolkit Fundamentals eim et re E a boing des D asa 31 3 1 Class Categories and Domains sesh nuserie seser a e e aaa aaa nhe mee hee hen nennen 31 3 1 1 What is a Class Category ius anas sis ss te ERR EVE ss REPRE PERDERE 31 3 1 2 Class categories in Geantd irren eiee o E E plebe a a a s 31 3 2 Global Usage Classes s o sas sai erp tb nia oi bad o sa Aa er k a pa ab 32 3 2 1 Signature of Geant4 classes eee ce saaa aaa aaa aaa aaa aaa aaa ee aa aa EE s ETE 33 3 2 2 The HEPRandom module in CLEP rede erre mede rre nenne 33 3 2 3 The HEPNumerics module isise essees neis siose i KEE II HH e mee hene 37 3 2 4 General management classes cett ertet so PER Rr cp rh a a i P ROI 37 3 3 System Of UNIS isset eet a serrer iot ee Te pe etes ar eet e ener ter sete tae ye oerte eret Eyre rey RE 38 3 3 1 Basic nits erre ehe E aeils seta sass ESSE E EPA RE TIES E nSP EET oE 38 3 3 2 Input your data tecto iei er ent ee Ee HERE eM eects lovee 38 3 3 37 Output your data ete c t Pte te rab ces edet reae RES ia sa de raga des 39 3 3 4 Introduce new units IL sis is iii se RR eere eee eth des eee se rre EEI E 39 3 3 5 Print tbe list of Units eri rr eR rh LR EE Re RR RE ERES 40 32L RUN eene eeepc eu ests eeu hen aa Ii eed eI eS pl REESE 40 3 4 1 Basic CONCEpt OF Run cere hee ssa RP ESPERE T SE esse bata 40 3 4 2 Geant4
483. to the whole set of detector components It is done by calling a drawing method of a physical volume directly The method is i Drawing methods of a physical volume virtual void Draw const G4VPhysicalVolume amp This method is for example called in a method MyXXXHit Draw describing the visualization of hits with markers The following is an example for this Jul ems C source codes An example of visualizing hits with 220 Visualization void MyCalorimeterHit Draw G4VVisManager pVVisManager G4VVisManager GetConcreteInstance if pVVisManager G4Transform3D trans rot pos G4VisAttributes attribs G4LogicalVolume logVol pPhys gt GetLogicalVolume const G4VisAttributes pVA logVol gt GetVisAttributes if pVA attribs pVA GAColour ee oloum 020 attribs SetColour colour attribs SetForceSolid true ee Re visualization of a selected physical volume with red color pVVisManager gt Draw pPhys attribs trans 1J gt gt end of C codes 8 5 7 HepRep Attributes for Hits The HepRep file formats HepRepFile and HepRepXML attach various attributes to hits such that you can view these attributes label trajectories by these attributes or make visibility cuts based on these attributes Examples of adding HepRep attributes to hit classes can be found in examples extended analysis A01 and extended runAn dEvent REO1 For example in example REOI s class REO1Calorimete
484. tomizable Standard scoring must be provided for quantities such as tracks entering a cell average weight of entering tracks energy of entering tracks and collisions inside the cell The purpose of importance sampling is to save computing time by sampling less often the particle histories en tering less important geometry regions and more often in more important regions Given the same amount of computing time an importance sampled and an analogue sampled simulation must show equal mean values while the importance sampled simulation will have a decreased variance The implementation of scoring is independent of the implementation of importance sampling However both share common concepts Scoring and importance sampling apply to particle types chosen by the user Examples on how to use scoring and importance sampling may be found in examples extended biasing and examples advanced Tiara 3 7 1 1 Geometries The kind of scoring referred to in this note and the importance sampling apply to spatial cells provided by the user A cell is a physical volume further specified by it s replica number if the volume is a replica Cells may be defined in two kinds of geometries 1 mass geometry the geometry setup of the experiment to be simulated Physics processes apply to this ge ometry 2 parallel geometry a geometry constructed to define the physical volumes according to which scoring and or importance sampling is applied The
485. toryPoint have only very primitive quantities The user can customize his her own trajectory and trajec tory point classes by deriving directly from the respective base classes To use the customized trajectory the user must construct a concrete trajectory class object in the G4UserTrackingAction PreUserTrackingAction method and make its pointer available to G4TrackingManager by using the SetTrajectory method The customized trajectory point class object must be constructed in the Ap pendStep method of the user s implementation of the trajectory class This AppendStep method will be invoked by G4TrackingManager To customize trajectory drawing the user can override the DrawTrajectory method in his her own trajectory class When a customized version of G4Trajectory declares any new class variables operator new and operator delete must be provided It is also useful to check that the allocation size in operator new is equal to sizeof G4Trajectory These two points do not apply to G4VTrajectory because it has no operator new or operator delete 5 2 Physics Processes Physics processes describe how particles interact with a material Seven major categories of processes are provided by Geant4 electromagnetic hadronic decay photolepton hadron optical parameterization and transportation DU ue Cae The generalization and abstraction of physics processes is a key issue in the design of Geant4 All physics pro ces
486. transmission absorption and reflection of particles through a single thin or thick layer e TestEm6 physics list for rare high energy electromagnetic processes gamma conversion and e annihilation into pair of muons TestEm7 how to produce a Bragg curve in water phantom How to compute dose in tallies e TestEm8 test of photo absorption ionisation model in thin absorbers and transition radiation e TestEm9 shower development in a crystal calorimeter cut per region e TestEm10 XTR transition radiation model investigation of ionisation in thin absorbers e TestEm11 how to plot a depth dose profile in a rectangular box e TestEm12 how to plot a depth dose profile in spherical geometry point like source TestEm13 how to compute cross sections of EM processes from rate of transmission coefficient e TestEm14 how to compute cross sections of EM processes from direct evaluation of the mean free path How to plot final state e TestEm15 compute and plot final state of Multiple Scattering as an isolated process e TestEm16 simulation of synchrotron radiation e TestEm17 check the cross sections of high energy muon processes Check basic quantities Total cross sections mean free paths Em0 Em13 Em14 Stopping power particle range Em0 Em1 Em5 Em11 Em12 Final state energy spectra angular distributions Em14 Energy loss fluctuations Em18 Multiple Coulomb scattering
487. tring fileName argv 1 UI gt ApplyCommand command fileName job termination ifdef G4VIS_USE delete visManager endif delete runManager return 0 24 Getting Started with Geant4 Running a Simple Example Notice that the visualization system is under the control of the precompiler variable GAVIS USE Notice also that in interactive mode few intializations have been put in the macro prerunN03 mac which is executed before the session start Example 2 25 The prerunN03 mac macro Macro file for the initialization phase of exampleN03 cc Sets some default verbose flags and initializes the graphics control verbose 2 control saveHistory run verbose 2 run particle dumpCutValues Create empty scene world is default vis scene create Add volume to scene vis scene add volume Create a scene handler for a specific graphics system Edit the next line s to choose another graphic system vis sceneHandler create DAWNFILE vis sceneHandler create OGLIX Create a viewer vis viewer create Draw scene vis scene notifyHandlers for drawing the tracks if too many tracks cause core dump gt storeTrajectory 0 tracking storeTrajectory 1 vis scene include trajectories Also this example demonstrates that you can read and execute a macro interactively Idle gt control execute mySubMacro mac 2 10 How to Visualize the Detector
488. ttern If the recursion flag is set to false the default the check is limited to the first depth level of the geometry tree otherwise it visits recursively the whole geometry tree In the latter case it may take a long time depending on the complexity of the geometry geometry test line test recursion flag shoots a line according to a specified direction and position defined by the user If the recursion flag is set to false the default the check is limited to the first depth level of the geometry tree otherwise it visits recursively the whole geometry Trec geometry test position to specify position for the line test geometry test direction to specify direction for the line test geometry test grid cells to define the resolution of the lines in the grid test as number of cells specifying them for each dimension X Y and Z The new settings will be applied to the grid test command geometry test cylinder geometry to define the details of the cylinder geometry by specifying nPhi number of lines per Phi nZ number of Z points nRho number of Rho points he new settings will be applied to the cylinder test command geometry test cylinder scaleZ to define the resolution of the cylinder geometry by specifying the fraction scale for points along Z The new settings will be applied to the cylinder test command geometry test cylinder scaleRho to define the resolution of the cylinder geometr
489. ttribute 1 addlnterval interval6 12 5 MeV 10000 MeV vis modeling trajectories drawByAttribute l intervall setLineColourRGBA 0 8 0 0 8 1 vis modeling trajectories drawByAttribute l interval2 setLineColourRGBA 0 23 0 41 1 1 vis modeling trajectories drawByAttribute l interval3 setLineColourRGBA 0 1 0 1 vis modeling trajectories drawByAttribute l interval4 setLineColourRGBA 1 1 0 1 vis modeling trajectories drawByAttribute l interval5 setLineColourRGBA 1 0 3 0 1 vis modeling trajectories drawByAttribute l interval6 setLineColourRGBA 1 0 0 1 232 Visualization 8 7 4 Controlling from Compiled Code It is possible to use the enhanced trajectory drawing functionality in compiled code as well as from commands Multiple trajectory models can be instantiated configured and registered with G4VisManager Only one model may be current For example G4VisManager visManager new G4VisExecutive visManager gt Initialize G4TrajectoryDrawByParticleID model new G4TrajectoryDrawByParticleID G4TrajectoryDrawByParticleID model2 new G4TrajectoryDrawByParticleID test modeli gt SeEBe alte cyan model gt Set gamma green model gt Set e magenta model sec Eau MEO SP OS visManager gt RegisterModel model visManager gt RegisterModel model2 visManager gt SelectTrajectoryModel model Name 8 7 5 Drawing by time To draw by time you need to use a trajectory that records the track
490. tual value 3 3 4 Introduce new units If you wish to introduce new units there are two methods e You can complete the file SystemOfUnits h include SystemOfUnits h static const G4double inch 2 54 cm Using this method it is not easy to define composed units It is better to do the following e You can instantiate an object of the class G4UnitDefinition 39 Toolkit Fundamentals G4UnitDefinition name symbol category value For example define a few units for speed G4UnitDefinition km hour km h Speed km 3600 s G4UnitDefinition meter ns m ns Speed m ns The category Speed does not exist by default in G4UnitsTable but it will be created automatically The class G4UnitDefinition is located in source global management 3 3 5 Print the list of units You can print the list of units with the static function GAUnitDefinition PrintUnitsTable or with the interactive command units list 3 4 Run 3 4 1 Basic concept of Run In Geant4 Run is the largest unit of simulation A run consists of a sequence of events Within a run the detector geometry the set up of sensitive detectors and the physics processes used in the simulation should be kept un changed A run is represented by a G4Run class object A run starts with BeamOn method of G4RunManager 3 4 1 1 Representation of a run G4Run represents a run It has a run identification number which should be set by th
491. ualization geometry optical photon trajectories Classes main source file main forinteractive mode and batch mode via macro file random number engine construction and deletion of G4RunManager construction and set of mandatory user classes hard coded beamOn ExNO6DetectorConstruction header file source file derived from G4VUserDetectorConstruction 251 Examples definitions of single materials and mixtures generate and add Material Properties Table to materials CSG and BREP solids G4PVPlacement with rotation definition of surfaces generate and add Material Properties Table to surfaces visualization ExN06PhysicsList header file source file derived from G4VUserPhysicsList definition of gamma leptons and optical photons transportation standard EM processes decay Cerenkov scintillation standard optical and boundary process modify augment optical process parameters ExNO6PrimaryGeneratorAction header file source file derived from G4VPrimaryGeneratorAction construction of G4ParticleGun primary event generation via particle gun ExNOG6RunAction header file source file derived from G4VUserRunAction draw detector 9 1 8 Example N07 Basic concepts Geometry Changing geometry of three simplified sandwitch calorimeters without re building a world volume Region Defining geometrical regions ans setting production thresholds for each region Run Utilizi
492. uildUnitsTable define Elements a 1 01 g mole G4Element elH new G4Element name Hydrogen symbol H z 1 a a 12 01 g mole G4Element elC new G4Element name Carbon symbol C z 6 a a 14 01 g mole G4Element elN new G4Element name Nitrogen symbol N z 7 a a 16 00 g mole G4Element elO new G4Element name Oxygen symbol 0 z 8 a a 28 09 g mole G4Element elSi new G4Element name Silicon symbol Si z 14 a a 55 85 g mole G4Element elFe new G4Element name Iron symbol Fe z 26 a a 183 84 g mole G4Element elW new G4Element name Tungsten symbol W za a 207 20 g mole G4Element elPb new G4Element name Lead Symbol Pb z 82 a define an Element from isotopes by relative abundance G4Isotope U5 new G4Isotope name U235 iz 92 n 235 a 235 01 g mole G4Isotope U8 new G4Isotope name U238 iz 92 n 238 a 238 03 g mole G4Element elU new G4Element name enriched Uranium symbol U ncomponents 2 elU gt AddIsotope U5 abundance 90 perCent elU gt AddIsotope U8 abundance 10 perCent cout lt lt G4Isotope GetIsotopeTable lt lt endl cout lt lt G4Element GetElementTable lt lt endl define simple materials 105 Detector Definition and Response density 2 700 g cm3 a 26 98 g mole G4Material Al new G4Material name Aluminum z 13
493. unAction hh include N02EventAction hh include N02SteppingAction hh include g4templates hh Tigle Ties pans eneo e celsus eei construct the default run manager G4RunManager runManager new G4RunManager set mandatory initialization classes NO2DetectorConstruction detector new N02DetectorConstruction runManager SetUserInitialization detector runManager SetUserInitialization new NO2PhysicsList visualization manager G4VisManager visManager new G4VisExecutive visManager gt initialize set user action classes runManager gt SetUserAction new NO2PrimaryGeneratorAction detector runManager gt SetUserAction new NO2RunAction runManager gt SetUserAction new NO2EventAction runManager gt SetUserAction new NO2SteppingAction get the pointer to the User Interface manager G4UImanager UI G4UImanager GetUIpointer if argc 1 Define G UI terminal for interactive mode 4 G4UIsession session new G4UIterminal UI gt ApplyCommand control execute prerun g4mac session gt sessionStart delete session else Batch mode 4 G4String command control execute G4String fileName argv 1 UI gt ApplyCommand command fileName job termination delete visManager delete runManager return 0 2 1 5 G4cout and G4cerr Although not yet included in the above examples output streams will be needed G4cout and G4cerr are iostr
494. unit 184 Comommunication and Control G4double GetNewUnitValue G4String paramString Convert G4String unit value given by the SetNewValue method of your messenger into double G4String convertToString G4bool currVal char unitName Convert the current double value to a G4String which should be returned by the GetCurrentValue method of your messenger The double value will be divided by the value of the given unit and converted to a string Given unit will be added to the string G4UIcmdWith3VectorAndUnit This is a G amp UIcommand derived class which takes one three vector parameter and its unit G4UIcmdWith3VectorAndUnit char commandpath G4UImanager theMessenger Constructor Arguments are the full path command name and the pointer to your messenger void SetParameterName char paramNamX char paramNamY char paramNamZ G4bool omittable Define the names of each component of the three vector and set the omittable flag If omittable is true you should define the default value using the next method void SetDefaultValue G4ThreeVector defVal Define the default value of the three vector void SetUnitCategory char unitCategory Define acceptable unit category void SetDefaultUnit char defUnit Define the default unit Please use this method and the SetUnitCategory method alternatively G4ThreeVector GetNew3VectorValue G4String paramString Convert a G4String parameter value given by the
495. ve any particles during execution because particles are static objects in Geant4 see Section 2 4 and Section 5 3 for details In addition it is very difficult to add and or remove physics processes during execution because registration procedures are very complex except for experts see Section 2 5 and Section 5 2 This is why the initializePhysics method is assumed to be invoked at once in Geant4 kernel initialization However you can switch on off physics processes defined in your G4VUserPhysicsList concrete class and also change parameters in physics processes during the run break You can use ActivateProcess and InActivateProcess methods of G4ProcessManager any where outside the event loop to switch on off some process You should be very careful to switch on off processes inside the event loop though it is not prohibited to use these methods even in the EventProc state It is a likely case to change cut off values in a run You can change defaultCutValue in G4VUserPhysicsList during the dle state In this case all cross section tables need to be recalculated before the event loop You should 44 Toolkit Fundamentals use the CutOffHasBeenModified method when you change cut off values so that the Set Cuts method of your PhysicsList concrete class will be invoked 3 5 Event 3 5 1 Representation of an event G4Event represents an event An object of this class contains all inputs and outputs of the simulated even
496. ved in the G3t oG4MANY function which has to be processed before G3toG4BuildTree itis not called by default In order to resolve MANY the user code has to provide additional info using G4gsbool G4String volName G4String manyVolName function for all the overlapping volumes Daughters of overlapping volumes are then resolved automatically and should not be specified via Gsboo1 Limitation a volume with a MANY position can have only this one position if more than one position is needed a new volume has to be defined gsvolu for each position GSDV routines for dividing volumes are implemented using G4PVReplicas for shapes BOX TUBE TUBS PARA all axes CONE CONS axes 2 3 TRD1 TRD2 TRAP axis 3 PGON PCON axis 2 PARA axis 1 axis 2 3 for a special case GSPOSP is implemented via individual logical volumes for each instantiation e GSROTM is implemented Reflections of hierachies based on plain CSG solids are implemented through the G3Division class Hits are not implemented e Conversion of GEANT 3 21 magnetic field is currently not supported However the usage of magnetic field has to be turned on 4 1 11 Detecting Overlapping Volumes 4 1 11 1 The problem of overlapping volumes Volumes are often positioned within other volumes with the intent that one is fully contained within the other If however a volume extends beyond the boundaries of its mother volume it is defined as ov
497. vements in release 8 1 or later 8 7 Enhanced Trajectory Drawing 8 7 1 Default Configuration Trajectory drawing styles are specified through trajectory drawing models Each drawing model has a default configuration provided through a G4VisTrajContext object The default context settings are shown below Property Default Setting Line colour grey Line visibility true Draw line true 229 Visualization Draw auxiliary points false Auxiliary point type squares Auxiliary point size 0 Auxiliary point fill style filled Auxiliary point colour magenta Auxiliary point visibility true Draw step point false Step point type circles Step point size 0 Step point fill style filled Step point colour yellow Step point visibility true Time slice interval 0 Points to note e The context approach is intended to replace the configuration through the imode parameter The use of imode is depreciated and will be removed in Geant4 v9 0 e Different visualisation drivers handle trajectory configuration in different ways so trajectories may not nec essarily get displayed as you have configured them 8 7 2 Trajectory Drawing Models A trajectory drawing model can override the default context according to the properties of a given trajectory The following models are supplied with the Geant4 distribution e G4TrajectoryGenericDrawer generic G4TrajectoryDrawByCharge
498. vent method 43 Toolkit Fundamentals DoEvent Loop performs the entire simulation of an event However it is often useful to split the above three steps into isolated application programs If for example you wish to examine the effects of changing discriminator thresholds ADC gate widths and or trigger conditions on simulated events much time can be saved by perform ing steps 1 and 2 in one program and step 3 in another The first program need only generate the hit trajectory information once and store it perhaps in a database The second program could then retrieve the stored G4Event objects and perform the digitization analysis using the above threshold gate and trigger settings These settings could then be changed and the digitization program re run without re generating the G4Events 3 4 4 3 Changing the Detector Geometry The detector geometry defined in your G4VUserDetectorConstruction concrete class can be changed during a run break between two runs Two different cases are considered The first is the case in which you want to delete the entire structure of your old geometry and build up a completely new set of volumes For this case you need to set the new world physical volume pointer to the RunManager Thus you should proceed in the following way G4RunManager runManager G4RunManager GetRunManager runManager DefineWorldVolume newWorldPhys Presumably this case is ra
499. viewer commands e g vis open RayTracerX vis drawVolume vis viewer set viewpointThetaPhi 30 30 vis viewer refresh The view parameters are translated into the necessary RayTracer parameters RayTracer is compute intensive If you are unsure of a good viewing angle or zoom factor you might be advised to choose them with a faster renderer such as OpenGL and transfer the view parameters with vis viewer set all vis open OGLSXm or any of the OGL options Opens say viewer 0 vis drawVolume vis viewer zoom plus any vis viewer commands that get you the view you want vis open RayTracerX vis viewer set all viewer 0 vis viewer refresh 8 3 10 Visualization of detector geometry tree ASCIITREE is a visualization driver that is not actually graphical but that dumps the volume hierarchy as a simple text tree Each call to vis viewer flush or vis drawTree will dump the tree ASCII Tree has command to control its verbosity vis ASCIITree verbose The verbosity value controls the amount of information available e g physical volume name alone or also logical volume and solid names 205 Visualization If the volume is sensitive and or has a readout geometry this may also be indicated Also the mass of the physical volume tree s can be printed but beware higher verbosity levels can be computationally intensive At verbosity level 4 ASCIITree calculates the mass of the complete geometry tree ta
500. w software or enhancement which will become a part of Geant4 must be agreed upon by the TSB which is charged with ensuring the consistency of the entire toolkit Is there a regular user meeting which I should attend There is only one Geant4 workshop per year However many experiments and institutes in the Geant4 collaboration organize their own regular and or special Geant4 user workshops Where can I find solutions to particular problems as well as general user support Solutions and tips for solving practical problems can be found on the current FAQ page General and specific user support information is available at the User Support page 264 Appendix Appendix 1 Tips for Program Compilation This section is dedicated to illustrate and justify some of the options used and fixed by default in the compilation of the Geant4 toolkit It is also meant to be a simple guide for the user installer to avoid or overcome problems which may occur on some compilers Solutions proposed here are based on the experience gained while porting the Geant4 code to different architectures compilers and are specific to the OS s and compiler s version valid at the current time of writing of this manual It s well known that each compiler adopts its own internal techniques to produce the object code which in the end might be more or less perfomant and more or less optimised depending on several factors also related to the system architecture which it
501. wing parameters with their default values wsurvival 0 5 wlimit 0 25 isource 1 The following algorithm is applied If a particle weight w is lower than R wlimit e the weight of the particle will be changed to ws wsurvival R the probability for the particle to survive is p w ws 3 7 2 Physics Based Biasing Geant4 supports physics based biasing through a number of general use built in biasing techniques A utility class G4WrapperProcess is also available to support user defined biasing 3 7 2 1 Built in Biasing Options 3 7 2 1 1 Primary Particle Biasing Primary particle biasing can be used to increase the number of primary particles generated in a particular phase space region of interest The weight of the primary particle is modified as appropriate A general implementation is provided through the G4GeneralParticleSource class It is possible to bias position angular and energy distri butions G4GeneralParticleSource is a concrete implementation of G4VPrimaryGenerator To use instantiate G4GeneralParticleSource in the G4VUserPrimaryGeneratorAction class as demonstrated below MyPrimaryGeneratorAction MyPrimaryGeneratorAction generator new G4GeneralParticleSource void MyPrimaryGeneratorAction GeneratePrimaries G4Event anEvent generator gt GeneratePrimaryVertex anEvent The biasing can be configured through interactive commands Extensive documentation can be found in Primar
502. x to construct a Boolean solid it must NOT be modified In contrast with the alternative method shown a G4Transform3D is provided to the constructor by value and its transformation is stored by the Boolean solid The user may modify the G4Transform3D and eventually use it again 72 Detector Definition and Response When positioning a volume associated to a Boolean solid the relative center of coordinates considered for the positioning is the one related to the first of the two constituent solids 4 1 2 3 Boundary Represented BREPS Solids BREP solids are defined via the description of their boundaries The boundaries can be made of planar and second order surfaces Eventually these can be trimmed and have holes The resulting solids such as polygonal polycon ical solids are known as Elementary BREPS In addition the boundary surfaces can be made of Bezier surfaces and B Splines or of NURBS Non Uniform Rational B Splines surfaces The resulting solids are Advanced BREPS Currently the implementation for surfaces generated by Beziers B Splines or NURBS is only at the level of prototype and not fully functional Extensions are foreseen in the near future also to allow exchange of geometrical models with CAD systems We have defined a few simple Elementary BREPS that can be instantiated simply by a user in a manner similar to the construction of Constructed Solids CSGs We summarize their capabilities in the followin
503. xact outputs between debug non optimised and optimised runs A little performance improvement in the order of 2 can also be achieved in some cases To be considered that binaries built using these chip specific options will NOT be portable cross platforms generated applications will only run on Pentium4 based architectures 1 3 Windows MS Visual C OS MS Windows Compiler MS VC Since version NET 7 0 of the compiler ISO ANSI compliance is required See Section 3 1 of the Installation Guide for more detailed information See also Section 6 for more tips 1 4 MacOS X g OS MacOS Darwin Compiler GNU gcc The setup adopted for the g compiler on MacOS resembles in great part the one for Linux systems The default optimisation level in this case is 02 Dynamic libraries dy1ib are supported as well once built in order to run the generated application the user must specify the absolute path in the system where they re installed with the DYLD LIBRARY PATH system variable 2 Histogramming Geant4 is independent of any histogramming package The Geant4 toolkit has no drivers for histogramming and no drivers are needed in Geant4 to use a histogramming package The code for generating histograms should be compliant with the AIDA abstract interfaces for Data Analysis Consequently you may use your favourite package together with the Geant4 toolkit 2 1 JAS Please refer to the JAS documentation on histogramming for
504. xample hits activate detector_name hits inactivate detector name where detector name can be the detector name or the category name For example if your EM calorimeter is named myDet myCal myEMcal hits inactivate myCal will inactivate all detectors belonging to the myCa1 category Access to the hit collections 118 Hit collections are accessed for various cases Detector Definition and Response Digitization Event filtering in G4VUserStackingAction End of event simple analysis Drawing printing hits The following is an example of how to access the hit collection of a particular concrete type G4SDManager fSDM G4SDManager GetSDMpointer G4RunManager fRM G4RunManager GetRunManager G4int collectionID fSDM GetCollectionID collection name const G4Event currentEvent fRM GetCurrentEvent G4HCofThisEvent HCofEvent currentEvent gt GetHCofThisEvent MyHitsCollection myCollection MyHitsCollection HC0fEvent gt GetHC collectionID 4 4 5 G4MultiFunctionalDetector and G4VPrimitiveScorer G4MultiFunctionalDetector is a concrete class derived from G4VSensitiveDetector Instead of implementing a user specific detector class G4MultiFunctionalDetector allows the user to register G4VPrimitiveScorer classes to build up the sensitivity G4MultiFunctionalDetector should be instantiated in the users detector construction with its unique name and should be assigned to
505. y ing thin layer interactions or thick layer shielding The built in hadronic cross section biasing applies to photon inelastic electron nuclear and positron nuclear processes The biasing is controlled through the BiasCrossSectionByFactor method in G4HadronicProcess as demonstrated below void MyPhysicsList ConstructProcess G4ElectroNuclearReaction theElectroReaction new G4ElectroNuclearReaction G4ElectronNuclearProcess theElectronNuclearProcess theElectronNuclearProcess RegisterMe theElectroReaction theElectronNuclearProcess BiasCrossSectionByFactor 100 57 Toolkit Fundamentals pManager gt AddDiscreteProcess amp theElectronNuclearProcess More details can be found in Hadronic cross section biasing 3 7 2 2 G4WrapperProcess G4WrapperProcess can be used to implement user defined event biasing G4WrapperProcess which is a process itself wraps an existing process By default all function calls are forwared to the wrapped process It is a non in vasive way to modify the behaviour of an existing process To use this utility first create a derived class inheriting from G4WrapperProcess Override the methods whose behaviour you would like to modify for example PostStepDolt and register the derived class in place of the process to be wrapped Finally register the wrapped process with G4WrapperProcess The code snippets below demonstrate its use class MyWrapperProcess public G4WrapperProcess
506. y PIIM e Full particle set EM set EM set e mixtures and com mixtures and com mixtures and com pound elements pound elements pound elements Physics Full physics processes Parametrized shower Optical photon processes Vis detector amp hit drawing detector amp hit drawing calorimeter type hits drawing G UI define user commands define user commands define user commands Global random number engine Table 9 2 The item chart for novice level examples NO4 NO5 and NO6 ExampleN07 comments Cuts per region Run e main for interactive mode e Customized run class Event event generator selection particleGun Tracking Geometry geometry definition includes Replica Region Hits Digi Primitive scorer Filter PIIM EM set e mixtures and compound elements Physics EM processes Vis detector amp trajectory drawing G UI define user commands Global Table 9 3 The item chart for novice level example NO7 244 Examples 9 1 2 Example N01 Basic concepts e minimal set for geantino transportation Classes main source file e hard coded batch construction and deletion of G4RunManager e hard coded verbose level setting to G4RunManager G4EventManager and G4TrackingManager construction and set of mandatory user classes hard coded beamOn e Hard coded UI command application ExNO1DetectorConstruction heade
507. y by specifying the fraction scale for points along Rho The new settings will be applied to the cylinder test command geometry test recursion start to set the initial level in the geometry tree for starting the recursion default value being zero i e the world volume The new settings will then be applied to any recursive test geometry test recursion depth to set the depth in the geometry tree for recursion so that recursion will stop after having reached the specified depth the default being the full depth of the geometry tree The new settings will then be applied to any recursive test To detect overlapping volumes the built in test uses the intersection of solids with linear trajectories For example consider Figure 4 4 Mother Volume Figure 4 4 Different cases of placed volumes overlapping each other Here we have a line intersecting some physical volume large black rectangle Belonging to the volume are four daughters A B C and D Indicated by the dots are the intersections of the line with the mother volume and the four daughters This example has two geometry errors First volume A sticks outside its mother volume this practice sometimes used in GEANT3 21 is not allowed in Geant4 This can be noticed because the intersection point leftmost magenta dot lies outside the mother volume as defined by the space between the two black dots 99 Detector Definition
508. y particle biasing Examples are also distributed with the Geant4 distribution in examples extended eventgenera tor exgps 3 7 2 1 2 Radioactive Decay Biasing The G4RadioactiveDecay class simulates the decay of radioactive nuclei and implements the following biasing options e Increase the sampling rate of radionuclides within observation times through a user defined probability distri bution function e Nuclear splitting where the parent nuclide is split into a user defined number of nuclides e Branching ratio biasing where branching ratios are sampled with equal probability G4RadioactiveDecay is a process which must be registered with a process manager as demonstrated below void MyPhysicsList ConstructProcess 56 Toolkit Fundamentals G4RadioactiveDecay theRadioactiveDecay new G4RadioactiveDecay G4ProcessManager pmanager pmanager gt AddProcess theRadioactiveDecay The biasing can be controlled either in compiled code or through interactive commands Extensive documentation can be found in Radioactive decay biasing example and Radioactive decay biasing Radioactive decay biasing examples are also distributed with the Geant4 distribution in examples extended ra dioactivedecay exrdm 3 7 2 1 3 Hadronic Leading Particle Biasing Two built in hadronic leading particle techniques are available One is through G4Mars5GeV This is an inclusive event generator for hadron interactions with nu
509. ycone G4Polyhedra if width is provided it is taken as the width at the Z radius the width at other radii will be scaled to this one 85 Detector Definition and Response Examples are given below in listings Example 4 4 and Example 4 5 Example 4 5 An example of a box division along different axes with or without offset G4Box motherSolid new G4Box motherSolid 0 5 m 0 5 m 0 5 m G4LogicalVolume motherLog new G4LogicalVolume motherSolid material mother 0 0 0 G4Para divSolid new G4Para divSolid 0 512 m 1 21 m 1 43 m G4LogicalVolume childLog new G4LogicalVolume divSolid material child 0 0 0 G4PVDivision divBoxl division along X giving nDiv childLog motherLog kXAxis 5 0 G4PVDivision divBox2 division along X giving width and offset childLog motherLog kXAxis 0 1 m 0 45 m G4PVDivision divBox3 division along X giving nDiv width and offset childLog motherLog kXAxis 3 0 1 m 0 5 m divBoxl is a division of a box along its X axis in 5 equal copies Each copy will have a dimension in meters OE 0 95 T2 A e divBox2 is a division of the same box along its X axis with a width of 0 1 meters and an offset of 0 5 meters As the mother dimension along X of 1 meter 0 5 m of halflength the division will be sized in total 1 0 45 0 55 meters Therefore there s space for 5 copies the first extending from 0 05 to 0 05 meters in the mother s frame and the las
510. ynamics of physics processes The properties in G4DynamicParticle are listed in Table 5 4 163 Tracking and Physics G4double theDynamicalMass dynamical mass G4ThreeVector theMomentumDirection normalized momentum vector G4ParticleDefinition theParticleDef definition of particle inition G4ThreeVector thePolarization polarization vector G4double theKineticEnergy kinetic energy G4double theProperTim proper time G4ElectronOccupancy theElectronOccu electron orbits for ions pancy Table 5 4 Methods to set get cut off values Here the dynamical mass is defined as the mass for the dynamic particle For most cases it is same as the mass defined in G4ParticleDefinition class i e mass value given by Get PDGMass method However there are two exceptions resonace particle e ions Resonace particles have large mass width and the total energy of decay products at the center of mass system can be different event by event As for ions G4ParticleDefintion defines a nucleus and G4DynamicParticle defines an atom G4ElectronOccupancy describes state of orbital electrons So the dynaimc mass can be different from the PDG mass by the mass of electrons and their binding energy Decay products of heavy flavor particles are given in many event generators In such cases G4VPrimaryGenerator sets this information in thePreAssignedDecayProducts In addition decay time of the part
511. your G4VUserPrimaryGeneratorAction concrete class G4HEPEvtInterface reads an ASCII file produced by an event generator and reproduces G4PrimaryParticle objects associated with a G4PrimaryVertex object It re produces a full production chain of the event generator starting with primary quarks etc In other words G4HEPEvtInterface converts information stored in the HEPEVT common block to an object oriented data structure Because the HEPEVT common block is commonly used by almost all event generators written in FORTRAN G4HEPEvtInterface can interface to almost all event generators currently used in the HEP commu nity The constructor of G4HEPEVvtInterface takes the file name Example 3 3 shows an example how to use G4HEPEvtInterface Note that an event generator is not assumed to give a place of the primary particles the interaction point must be set before invoking GeneratePrimaryVertex method Example 3 3 An example code for G4HEPEvtInterface ifndef ExN04PrimaryGeneratorAction h define ExN04PrimaryGeneratorAction h 1 include G4VUserPrimaryGeneratorAction hh include globals hh class G4VPrimaryGenerator class G4Event class ExN04PrimaryGeneratorAction public G4VUserPrimaryGeneratorAction public ExN04PrimaryGeneratorAction ExNO4PrimaryGeneratorAction Buitis void GeneratePrimaries G4Event anEvent private G4vPrimaryGenerator HEPEvt i endif include ExN04PrimaryG
Download Pdf Manuals
Related Search
Related Contents
documentacion Timex T5K615 sport watch Electrolux 137019200 Use & care guide Toshiba Excite 10 AT305-T16 ISTRUZIONI PER L`USO OS-314plus User's Manual Aquatic AI5INF7248 User's Manual Cornelius UFB-1 User's Manual Copyright © All rights reserved.
Failed to retrieve file