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10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Name Size       Last modified (GMT) Description
Back Parent directory       2024-12-05 15:16:16
Folder histo/       2024-12-05 15:16:16
Folder include/       2024-12-05 15:16:16
Folder ntuple/       2024-12-05 15:16:16
Folder shared/       2024-12-05 15:16:16
Folder src/       2024-12-05 15:16:16
File AnaEx03-csv.in 135 bytes       2024-12-05 15:16:16
File AnaEx03-csv.out 50337 bytes       2024-12-05 15:16:16
File AnaEx03-hdf5.in 137 bytes       2024-12-05 15:16:16
File AnaEx03-hdf5.out 45139 bytes       2024-12-05 15:16:16
File AnaEx03-root.in 147 bytes       2024-12-05 15:16:16
File AnaEx03-root.out 45273 bytes       2024-12-05 15:16:16
File AnaEx03-xml.in 135 bytes       2024-12-05 15:16:16
File AnaEx03-xml.out 45920 bytes       2024-12-05 15:16:16
C++ file AnaEx03.cc 3678 bytes       2024-12-05 15:16:16
File AnaEx03.in 1350 bytes       2024-12-05 15:16:16
File CMakeLists.txt 2404 bytes       2024-12-05 15:16:16
File GNUmakefile 728 bytes       2024-12-05 15:16:16
File History 914 bytes       2024-12-05 15:16:16
File README 3986 bytes       2024-12-05 15:16:16
File init_vis.mac 338 bytes       2024-12-05 15:16:16
File plotHisto.C 525 bytes       2024-12-05 15:16:16
File plotter.mac 9844 bytes       2024-12-05 15:16:16
File vis.mac 2013 bytes       2024-12-05 15:16:16

  1 --------------------------------------------------
  2 
  3      =========================================================
  4      Geant4 - an Object-Oriented Toolkit for Simulation in HEP
  5      =========================================================
  6 
  7                             AnaEx03
  8                             -------
  9 
 10  Example AnaEx03 demonstrates usage of analysis commands for file management
 11  (new since Geant4 11.1), in particular writing histograms and ntuples in a file
 12  multiple times, and commands for histogram deleting (new since Geant4 11.2).
 13 
 14  It uses the same scenario (detector description, primary generator
 15  and physics) as AnaEx02 and AnaEx02. In difference from these examples
 16  the analysis manipulations (histograms and ntuples booking and filling)
 17  are performed directly with G4AnalysisManager. The classes that are same
 18  in all three examples are located in shared directory.
 19 
 20  For detector description, primary generator, physics and the example output
 21  see README in AnaEx01 example.
 22 
 23  Histograms, Ntuple:
 24  --------------------
 25 
 26  The example produces the same 4 histograms and 2 ntuples as in AnaEx01.
 27 
 28  These histos and ntuples are booked in the RunAction constructor and filled from
 29  EventAction.
 30 
 31  The file managent in this example, usually performed via calls to G4AnalysisManager
 32  OpenFile(), Write() and CloseFile() in the code, is in this example performed
 33  via UI commands in a macro:
 34  /analysis/openFile
 35  /analysis/write
 36  /analysis/closeFile
 37 
 38  Note that the file need not to be closed at each end of run, but the histograms and ntuples
 39  can be saved in the same file multiple time. In that case we need to reset the  histograms
 40  and ntuples data before a new run:
 41  /analysis/reset
 42 
 43  We can define the default file type and set it to the analysis manager via
 44  /analysis/setDefaultFileType root    # or csv hdf5 xml
 45 
 46  The file names then need not to be provided with the file extension and the same macro
 47  can be used with different output types.
 48 
 49  To demonstrate UI commands for deleting of selected histograms:
 50  /analysis/h1/delete id [keepSetting]
 51  two H1 histograms, id: 1 and 3, are deleted in AnaEx03.in macro before starting Run 2,
 52  and new histograms are then created before starting Run3. New histograms are created at
 53  id's liberated with previous deleting, 1 and 3.
 54 
 55  It should be notes that using UI commands for writing histograms and ntuples in a file
 56  multiple times is not necessary, the same can be achieved by calls to G4AnalysisManager
 57  functions from the code using conditional statements.
 58 
 59  Macros:
 60  --------
 61 
 62  The AnaEx03.in macro performs 5 runs and produces 2 files: e-.root, containg data from first
 63  3 runs, and proton.root, containing data from the next 2 runs.
 64  The macro uses the defaultFileType parameter (alias), which default value, "root" is
 65  defined in main.
 66 
 67  AnaEx03-csv.in, AnaEx03-hdf5.in, AnaEx03-root.in, AnaEx03-xml.in:
 68 
 69  In these macros, the default value of the defaultFileType is overritten with
 70 
 71  /control/alias defaultFileType cvs   # or hdf5 root xml
 72 
 73  and then the AnaEx03.in macro is called.
 74 
 75  The plotter.mac macro can be used in the interactive mode to plot histograms. It should be executed after the first /run/beamOn call and before the first /analysis/reset call.
 76  (See also a commented line with this macro call in AnaEx03.in.)
 77 
 78  How to run
 79  --------------
 80 
 81  - It is preferable to execute the exampole in the 'batch' mode from macro files:
 82    % ./AnaEx03 AnaEx03.in
 83    % ./AnaEx03 AnaEx03.in >& output
 84 
 85  - When executing AnaEx03 in the 'interactive mode' with visualization, be careful not
 86    to forget to issue the /analysis/openFile command befor starting a run:
 87 
 88    % ./AnaEx03
 89    and type in the commands from AnaEx03[-xyz].mac line by line:
 90       Idle> /analysis/openFile myFile
 91       Idle> /tracking/verbose 1
 92       Idle> /run/beamOn 10
 93       Idle> ...
 94       Idle> /analysis/write
 95       Idle> /analysis/closeFile
 96       ....
 97       Idle> exit
 98 
 99   All AnaEx03-*.in macros are used in Geant4 testing.