
     =========================================================
     Geant4 - an Object-Oriented Toolkit for Simulation in HEP
     =========================================================

                            Example TextGeom
                            ----------------

This example illustrates the use of the text geometry. 

1.- GEOMETRY EXAMPLES

Several examples of text geometries are provided:

g4geom_simple.txt :
- Simple construction of materials and single placements 

g4geom_matemixt.txt :
- Isotopes, elements and materials

g4geom_boolean.txt :
- Boolean solids
 
g4geom_reflections.txt :
- Reflections

g4geom_replicas.txt :
- Replicas

g4geom_divisions.txt :
- Divisions

g4geom_paramLinear.txt :
- Linear parameterisations

g4geom_paramSquare.txt :
- Square parameterisations

g4geom_assembly.txt : 
- Assembly placements

     	
2.- HOW TO START ?
 
    - compile and link to generate an executable
       % cd textGeom
       % gmake
 		
    - execute textGeom in 'batch' mode from macro file 
       % textGeom run.mac
 		
It will read the geometry from a file named 'g4geom.txt', and it will create a VRML2 file to visualise the geometry.
Therefore if you want to try any of the above-mentioned files, copy it to a file with this name,

 	
3.- DEFINING A SENSITIVE DETECTOR

The detector construction class ExTGDetectorConstructionWithSD shows how to access a volume of the text geometry and assign to it a sensitive detector. 
To use it, replace at exampleTextGeom.cc the line

  runManager->SetUserInitialization(new ExTGDetectorConstruction);

by

  runManager->SetUserInitialization(new ExTGDetectorConstructionWithSD);

and recompile.

It will use the geometry from the file 'g4geom_SD.txt'


4.- MIXING TEXT AND C++ GEOMETRIES   

The detector construction class ExTGDetectorConstructionWithCpp shows how to create a volume with C++ and place it in the world or inside a volume defined in the text geometry. 
To use it, replace at exampleTextGeom.cc the line

  runManager->SetUserInitialization(new ExTGDetectorConstruction);

by

  runManager->SetUserInitialization(new ExTGDetectorConstructionWithCpp);

and recompile.

It will use the geometry from the file 'g4geom_simple.txt'


5.- CREATING NEW TAGS IN THE TEXT GEOMETRY: DEFINING CUTS PER REGION 

The detector construction class ExTGDetectorConstructionWithCuts, together with ExTGRCLineProcessor, ExTGRCDetectorBuilder, ExTGRCRegionCutsMgr and ExTGRCRegionData show how to add a couple of tags, ':REGION' and ':CUT', that allow to define cuts per region in your input geometry text file. 
To use it, replace at exampleTextGeom.cc the line

  runManager->SetUserInitialization(new ExTGDetectorConstruction);

by

  runManager->SetUserInitialization(new ExTGDetectorConstructionWithCuts);

and recompile.

It will use the geometry from the file 'g4geom_cutsPerRegion.txt'


6.- DUMP THE IN-MEMORY GEOMETRY TO TEXT FILE

The run action 'ExTGRunAction' triggers the writing of the in-memory Geant4 geometry to a text file. 
To use it you just have to uncomment in exampleTextGeom.cc the line

 runManager->SetUserAction(new ExTGRunAction);

and it will read the geometry from the file 'g4geom.txt' and will write the geometry in a file named 'geom.txt'
