-------------------------------------------------------------------

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

                            Example B4dScoreWriter
                            ----------------------

This example demonstrates saving the Geant4 scorers hits in form of ntuples in a Root 
file using Geant4 analysis tools. 

The example is completely based on basic B4d example, the storing scorers hits is activated 
in the main () function with instantiating G4ScoreNtupleWriter. 
In difference from the B3aScoreWriter example, the G4AnalysisManager is explicitly used 
in this example and the ntuples with scorers hits are saved in addition to the histograms 
and ntuples created in B4RunAction.

The G4ScoreNtupleWriter and G4ScoreNtupleWriterMessenger classses are provided in
the 'scoreWriter' directory in this example. These classes are fully independent from 
the example classes and they can be reused in any Geant4 application.

The Geant4 UI command defined in G4ScoreNtupleWriterMessenger can be used to choose
the output file type, the file name and the level of verbosity:

  /score/writerType root
  /score/fileName name
  /score/writerVerbose 1

How to build
--------------- 

An additional step is needed when building the example with GNUmake
due to using the extra 'scoreWriter' directory: 

  % cd path_to_B4dScoreWriter/B4dScoreWriter
  % gmake setup
  % gmake

 This will copy the files from scoreWriter in the example include and src;
 to remove these files:
  % gmake clean_setup

How to run
-------------

- Execute exampleB4dExt in the 'interactive mode' with visualization
    % ./exampleB4dExt
  and type in the commands from run1.mac line by line:  
    Idle> /run/initialize
    Idle> /control/verbose 2
    Idle> /tracking/verbose 2
    Idle> /run/beamOn 1 
    Idle> ...
    Idle> exit
  or
    Idle> /control/execute run1.mac
    ....
    Idle> exit
- Execute exampleB4dExt in the 'batch' mode from macro files 
 (without visualization)
    % ./exampleB4dExt -m run2.mac
    % ./exampleB4dExt -m exampleB4dExt.in > exampleB3.out
  
See the B3 example README for the further documentation of the basic B3 example.
