
///\file "optical/OpNovice2/.README.txt"
///\brief Example AnaEx01 README page

/*! \page ExampleOpNovice2 Example OpNovice2 

                             OpNovice2
                             ---------

    Investigate optical properties and parameters. Details of optical
    photon boundary interactions on a surface are recorded. Details 
    of optical photon generation and transport are recorded.

	
\section OpNovice2_s1 GEOMETRY DEFINITION

 The geometry consists of a cube "box" with a side of 2 m inside 
 the world cube of side 20 m. Optical properties of the box, the world, 
 and the surface may be set interactively via the commands defined 
 in the DetectorMessenger class.

 Material properties may be added using the macro commands:
 # for the box:
 /opnovice2/boxProperty NAME EN1 V1 EN2 V2 [ .. ENn Vn]
 /opnovice2/boxConstProperty NAME VALUE
 # for the world:
 /opnovice2/worldProperty NAME EN1 V1 EN2 V2 [ .. ENn Vn]
 /opnovice2/worldConstProperty NAME VALUE
 # for the surface:
 /opnovice2/surfaceProperty NAME EN1 V1 EN2 V2 [ .. ENn Vn]

 Multiple energy and value pairs may be specified for the energy-dependent
 properties.

 Values are in Geant4 internal units. Energy is in MeV.

 Example:
 /opnovice2/boxProperty RINDEX 0.000002 1.3 0.000005 1.32 0.000008 1.34
 sets the refractive index of the box to 1.3 at 2 eV, 1.32 at 5 eV, and
 1.34 at 8 eV.

\section OpNovice2_s2 PHYSICS LIST

 The FTFP_BERT physics list is used, with electromagnetic option 
 EMZ (option4) and G4OpticalPhysics for the optical physics.
 	 
\section OpNovice2_s3 AN EVENT : THE PRIMARY GENERATOR
 
 The primary kinematic consists of a single particle. The type of 
 the particle, its energy, position, and direction, are set 
 in the PrimaryGeneratorAction class, and can be changed via the G4 
 build-in commands of G4ParticleGun class (see the macros provided with 
 this example).
	
\section OpNovice2_s4 VISUALIZATION
 
 The Visualization Manager is set in the main().
 The initialisation of the drawing is done via the commands
 /vis/... in the macro vis.mac. To get visualisation:
 > /control/execute vis.mac
 or run the program with no command line arguments:
 $ ./OpNovice2
 	
\section OpNovice2_s5 HOW TO START ?
 
 - Execute OpNovice2 in 'batch' mode from macro files
 	% OpNovice2 surface.mac
 		
 - Execute OpNovice2 in 'interactive mode' with visualization
 	% OpNovice2
 	....
 	Idle> type your commands
 	....
 	Idle> exit

\section OpNovice2_s6 RESULTS

 A table of optical photon events is printed at the end of the run.	
     	
\section OpNovice2_s7 HISTOGRAMS
 
   OpNovice2 has several predefined 1D histograms : 
      1 :  Cerenkov spectrum
      2 :  scintillation spectrum
      3 :  boundary process status
      4 :  X momentum dir of scattered photons with px < 0
      5 :  Y momentum dir of scattered photons with px < 0
      6 :  Z momentum dir of scattered photons with px < 0
      7 :  X momentum dir of scattered photons with px >= 0
      8 :  Y momentum dir of scattered photons with px >= 0
      9 :  Z momentum dir of scattered photons with px >= 0
     10 :  X momentum dir of Fresnel-refracted photons
     11 :  Y momentum dir of Fresnel-refracted photons
     12 :  Z momentum dir of Fresnel-refracted photons

   Histograms 4-12 are recorded for photons scattered from the +X
   surface of the cube. Only the first interaction is recorded.  
 
   The histograms are managed by G4Analysis classes. 
   The histos can be individually activated with the command :
   /analysis/h1/set id nbBins  valMin valMax unit 
   where unit is the desired unit for the histo (MeV or keV, deg or mrad, etc..)
   
   One can control the name of the histograms file with the command:
   /analysis/setFileName  name  (default opnovice2)
   
   It is possible to choose the format of the histogram file : root (default),
   hbook, xml, csv, by using namespace in HistoManager.hh    
   
   It is also possible to print selected histograms on an ascii file:
   /analysis/h1/setAscii id
   All selected histos will be written on a file name.ascii  (default opnovice2) 

///\file "analysis/AnaEx01/.README.txt"
///\brief Example AnaEx01 README page

/*! \page ExampleAnaEx01 Example AnaEx01

 Examples AnaEx01, AnaEx02 and AnaEx03 show the usage of histogram and tuple 
 manipulations using G4Analysis, ROOT and AIDA compliant systems on the same
 scenario. All analysis manipulations (histo booking, filling, saving histos 
 in a file, etc...) are located in one class : HistoManager, implementation of 
 which is different in each example. All the other classes are same in all 
 three examples.
 
 This example shows the usage of histogram and tuple manipulations using 
 G4Analysis system.
 
 The example is an adaptation of examples/novice/N03. It describes a simple 
 sampling calorimeter setup.

\section AnaEx01_s1 Detector description

 The calorimeter is a box made of a given number of layers. A layer
 consists of an absorber plate and of a detection gap. The layer is
 replicated.
 
 Six parameters define the calorimeter :
    - the material of the absorber,
    - the thickness of an absorber plate,
    - the material of the detection gap,
    - the thickness of a  gap,
    - the number of layers,
    - the transverse size of the calorimeter (the input face is a square). 
 
 The default geometry is constructed in DetectorConstruction class,
 but all of the above parameters can be modified interactively via
 the commands defined in the DetectorMessenger class.

<pre>
        |<----layer 0---------->|<----layer 1---------->|<----layer 2---------->|
        |                       |                       |                       |
        ==========================================================================
        ||              |       ||              |       ||              |       ||
        ||              |       ||              |       ||              |       ||
 beam   ||   absorber   |  gap  ||   absorber   |  gap  ||   absorber   |  gap  ||
======> ||              |       ||              |       ||              |       ||
        ||              |       ||              |       ||              |       ||
        ==========================================================================

</pre>
 
\section AnaEx01_s2 Physics list

   The particle's type and the physic processes which will be available
   in this example are set in the FTFP_BERT physics list.

\section AnaEx01_s3 Action Initialization

   A newly introduced class, ActionInitialization, 
   instantiates and registers to Geant4 kernel all user action classes 
   which are defined thread-local and a run action class
   which is defined both thread-local and global.
   
   The thread-local action classes are defined in 
     ActionInitialization::Build() 
   and  the global run action class is defined in 
     ActionInitialization::BuildForMaster().
   Note that ActionInitialization::Build() is also used to 
   instatiate user action clasess in sequential mode.

\section AnaEx01_s4 An event : PrimaryGeneratorAction
 
 The primary kinematic consists of a single particle which hits the
 calorimeter perpendicular to the input face. The type of the particle
 and its energy are set in the PrimaryGeneratorAction class, and can
 be changed via the G4 build-in commands of ParticleGun class.


\section AnaEx01_s5 Histograms

 AnaEx01 can produce 4 histograms :
  
  - EAbs : total energy deposit in absorber per event
  - EGap : total energy deposit in gap per event	  
  - LAbs : total track length of charged particles in absorber per event 	
  - LGap : total track length of charged particles in gap per event 
 
 And 2 Ntuples :
 - Ntuple1:
   - one row per event : EnergyAbs EnergyGap
 - Ntuple2:
   - one row per event : TrackLAbs TrackLGap
  
 These histos and ntuples are booked in HistoManager and filled from 
 EventAction.
 
 One can control the name of the histograms file and its format:
 - default name     : AnaEx01   
 The format of the histogram file can be : root (default),
 xml, csv. Include correct g4nnn.hh in HistoManager.hh 
 
\section AnaEx01_s7 How to build

 An additional step is needed when building the example with GNUmake
 due to using the extra shared directory: 
\verbatim      
% cd path_to_AnaEx01/AnaEx01
% gmake setup
% gmake
\endverbatim

 This will copy the files from shared in the example include and src;
 to remove these files:
\verbatim      
% gmake clean_setup
\endverbatim
 
*/
