]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
This commit was generated by cvs2svn to compensate for changes in r1459,
authorfca <fca@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 21 Jun 2000 17:13:31 +0000 (17:13 +0000)
committerfca <fca@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 21 Jun 2000 17:13:31 +0000 (17:13 +0000)
which included commits to RCS files with non-trunk default branches.

163 files changed:
AliGeant4/AliColour.cxx [new file with mode: 0644]
AliGeant4/AliColour.h [new file with mode: 0644]
AliGeant4/AliColourStore.cxx [new file with mode: 0644]
AliGeant4/AliColourStore.h [new file with mode: 0644]
AliGeant4/AliDetConstruction.cxx [new file with mode: 0644]
AliGeant4/AliDetConstruction.h [new file with mode: 0644]
AliGeant4/AliDetConstructionMessenger.cxx [new file with mode: 0644]
AliGeant4/AliDetConstructionMessenger.h [new file with mode: 0644]
AliGeant4/AliDetSwitch.cxx [new file with mode: 0644]
AliGeant4/AliDetSwitch.h [new file with mode: 0644]
AliGeant4/AliEmptyPhysicsList.cxx [new file with mode: 0644]
AliGeant4/AliEmptyPhysicsList.h [new file with mode: 0644]
AliGeant4/AliEventAction.cxx [new file with mode: 0644]
AliGeant4/AliEventAction.h [new file with mode: 0644]
AliGeant4/AliEventActionMessenger.cxx [new file with mode: 0644]
AliGeant4/AliEventActionMessenger.h [new file with mode: 0644]
AliGeant4/AliFiles.cxx [new file with mode: 0644]
AliGeant4/AliFiles.h [new file with mode: 0644]
AliGeant4/AliGeant4LinkDef.h [new file with mode: 0644]
AliGeant4/AliGlobals.cxx [new file with mode: 0644]
AliGeant4/AliGlobals.h [new file with mode: 0644]
AliGeant4/AliGunParticle.cxx [new file with mode: 0644]
AliGeant4/AliGunParticle.h [new file with mode: 0644]
AliGeant4/AliLVStructure.cxx [new file with mode: 0644]
AliGeant4/AliLVStructure.h [new file with mode: 0644]
AliGeant4/AliLegoSensitiveDetector.cxx [new file with mode: 0644]
AliGeant4/AliLegoSensitiveDetector.h [new file with mode: 0644]
AliGeant4/AliMagneticField.cxx [new file with mode: 0644]
AliGeant4/AliMagneticField.h [new file with mode: 0644]
AliGeant4/AliModuleConstruction.cxx [new file with mode: 0644]
AliGeant4/AliModuleConstruction.h [new file with mode: 0644]
AliGeant4/AliModuleConstructionMessenger.cxx [new file with mode: 0644]
AliGeant4/AliModuleConstructionMessenger.h [new file with mode: 0644]
AliGeant4/AliModuleType.h [new file with mode: 0644]
AliGeant4/AliModulesComposition.cxx [new file with mode: 0644]
AliGeant4/AliModulesComposition.h [new file with mode: 0644]
AliGeant4/AliModulesCompositionMessenger.cxx [new file with mode: 0644]
AliGeant4/AliModulesCompositionMessenger.h [new file with mode: 0644]
AliGeant4/AliMoreModulesConstruction.cxx [new file with mode: 0644]
AliGeant4/AliMoreModulesConstruction.h [new file with mode: 0644]
AliGeant4/AliParticleGun.cxx [new file with mode: 0644]
AliGeant4/AliParticleGun.h [new file with mode: 0644]
AliGeant4/AliParticleGunMessenger.cxx [new file with mode: 0644]
AliGeant4/AliParticleGunMessenger.h [new file with mode: 0644]
AliGeant4/AliPrimaryGenerator.h [new file with mode: 0644]
AliGeant4/AliPrimaryGeneratorAction.cxx [new file with mode: 0644]
AliGeant4/AliPrimaryGeneratorAction.h [new file with mode: 0644]
AliGeant4/AliPrimaryGeneratorMessenger.cxx [new file with mode: 0644]
AliGeant4/AliPrimaryGeneratorMessenger.h [new file with mode: 0644]
AliGeant4/AliRunAction.cxx [new file with mode: 0644]
AliGeant4/AliRunAction.h [new file with mode: 0644]
AliGeant4/AliRunActionMessenger.cxx [new file with mode: 0644]
AliGeant4/AliRunActionMessenger.h [new file with mode: 0644]
AliGeant4/AliRunConfiguration.cxx [new file with mode: 0644]
AliGeant4/AliRunConfiguration.h [new file with mode: 0644]
AliGeant4/AliRunMessenger.cxx [new file with mode: 0644]
AliGeant4/AliRunMessenger.h [new file with mode: 0644]
AliGeant4/AliSDManager.cxx [new file with mode: 0644]
AliGeant4/AliSDManager.h [new file with mode: 0644]
AliGeant4/AliSensitiveDetector.cxx [new file with mode: 0644]
AliGeant4/AliSensitiveDetector.h [new file with mode: 0644]
AliGeant4/AliSingleModuleConstruction.cxx [new file with mode: 0644]
AliGeant4/AliSingleModuleConstruction.h [new file with mode: 0644]
AliGeant4/AliSingleModuleConstructionMessenger.cxx [new file with mode: 0644]
AliGeant4/AliSingleModuleConstructionMessenger.h [new file with mode: 0644]
AliGeant4/AliStackingAction.cxx [new file with mode: 0644]
AliGeant4/AliStackingAction.h [new file with mode: 0644]
AliGeant4/AliStackingActionMessenger.cxx [new file with mode: 0644]
AliGeant4/AliStackingActionMessenger.h [new file with mode: 0644]
AliGeant4/AliSteppingAction.cxx [new file with mode: 0644]
AliGeant4/AliSteppingAction.h [new file with mode: 0644]
AliGeant4/AliSteppingActionMessenger.cxx [new file with mode: 0644]
AliGeant4/AliSteppingActionMessenger.h [new file with mode: 0644]
AliGeant4/AliTrackingAction.cxx [new file with mode: 0644]
AliGeant4/AliTrackingAction.h [new file with mode: 0644]
AliGeant4/AliTrackingActionMessenger.cxx [new file with mode: 0644]
AliGeant4/AliTrackingActionMessenger.h [new file with mode: 0644]
AliGeant4/Makefile [new file with mode: 0644]
AliGeant4/aligeant4.cxx [new file with mode: 0644]
AliGeant4/config/doc_alc++2html.pl [new file with mode: 0755]
AliGeant4/config/doc_alcategory.pl [new file with mode: 0755]
AliGeant4/config/doc_alddl2html.pl [new file with mode: 0755]
AliGeant4/config/doc_alsorthtml.pl [new file with mode: 0755]
AliGeant4/config/doc_g4c++2html.pl [new file with mode: 0755]
AliGeant4/config/doc_g4category.pl [new file with mode: 0755]
AliGeant4/config/doc_g4ddl2html.pl [new file with mode: 0755]
AliGeant4/config/doc_g4sorthtml.pl [new file with mode: 0755]
AliGeant4/config/setup.csh [new file with mode: 0755]
AliGeant4/config/setup.sh [new file with mode: 0755]
AliGeant4/config/test_create.sh [new file with mode: 0755]
AliGeant4/config/test_create_in.sh [new file with mode: 0755]
AliGeant4/config/test_create_struct.sh [new file with mode: 0755]
AliGeant4/config/test_default_det_novis.in [new file with mode: 0644]
AliGeant4/config/test_default_det_vis.in [new file with mode: 0644]
AliGeant4/config/test_default_gen0.in [new file with mode: 0644]
AliGeant4/config/test_default_gen1.in [new file with mode: 0644]
AliGeant4/config/test_default_gen2.in [new file with mode: 0644]
AliGeant4/config/test_default_gen3.in [new file with mode: 0644]
AliGeant4/config/test_default_gen4.in [new file with mode: 0644]
AliGeant4/config/test_default_vis1.in [new file with mode: 0644]
AliGeant4/config/test_run.sh [new file with mode: 0755]
AliGeant4/config/test_run_in.sh [new file with mode: 0755]
AliGeant4/config/test_run_struct.sh [new file with mode: 0755]
AliGeant4/doc/CodePrototype.html [new file with mode: 0644]
AliGeant4/doc/G4CodePrototype.html [new file with mode: 0644]
AliGeant4/doc/README [new file with mode: 0644]
AliGeant4/doc/README.CodingConvention [new file with mode: 0644]
AliGeant4/doc/g3tog4tests.txt [new file with mode: 0644]
AliGeant4/doc/history/History [new file with mode: 0644]
AliGeant4/doc/history/alice_History [new file with mode: 0644]
AliGeant4/doc/history/alice_event_History [new file with mode: 0644]
AliGeant4/doc/history/alice_geometry_History [new file with mode: 0644]
AliGeant4/doc/history/alice_global_History [new file with mode: 0644]
AliGeant4/doc/history/alice_physics_History [new file with mode: 0644]
AliGeant4/doc/history/alice_run_History [new file with mode: 0644]
AliGeant4/doc/history/alice_visualization_History [new file with mode: 0644]
AliGeant4/doc/history/g4mc_History [new file with mode: 0644]
AliGeant4/doc/history/g4mc_geometry_History [new file with mode: 0644]
AliGeant4/doc/history/g4mc_global_History [new file with mode: 0644]
AliGeant4/doc/history/g4mc_physics_History [new file with mode: 0644]
AliGeant4/doc/history/g4mc_run_History [new file with mode: 0644]
AliGeant4/doc/history/g4mc_visualization_History [new file with mode: 0644]
AliGeant4/macro/CASTOR/Config.C [new file with mode: 0644]
AliGeant4/macro/CASTOR/Config.in [new file with mode: 0644]
AliGeant4/macro/FMD/Config.C [new file with mode: 0644]
AliGeant4/macro/FMD/Config.in [new file with mode: 0644]
AliGeant4/macro/ITS/Config.C [new file with mode: 0644]
AliGeant4/macro/ITS/Config.in [new file with mode: 0644]
AliGeant4/macro/MUON/Config.C [new file with mode: 0644]
AliGeant4/macro/MUON/Config.in [new file with mode: 0644]
AliGeant4/macro/MUON/Config_MUON.C [new file with mode: 0644]
AliGeant4/macro/PHOS/Config.C [new file with mode: 0644]
AliGeant4/macro/PHOS/Config.in [new file with mode: 0644]
AliGeant4/macro/PMD/Config.C [new file with mode: 0644]
AliGeant4/macro/PMD/Config.in [new file with mode: 0644]
AliGeant4/macro/RICH/Config.C [new file with mode: 0644]
AliGeant4/macro/RICH/Config.in [new file with mode: 0644]
AliGeant4/macro/START/Config.C [new file with mode: 0644]
AliGeant4/macro/START/Config.in [new file with mode: 0644]
AliGeant4/macro/STRUCT/ConfigABSO.C [new file with mode: 0644]
AliGeant4/macro/STRUCT/ConfigABSO.in [new file with mode: 0644]
AliGeant4/macro/STRUCT/ConfigBODY.C [new file with mode: 0644]
AliGeant4/macro/STRUCT/ConfigBODY.in [new file with mode: 0644]
AliGeant4/macro/STRUCT/ConfigDIPO.C [new file with mode: 0644]
AliGeant4/macro/STRUCT/ConfigDIPO.in [new file with mode: 0644]
AliGeant4/macro/STRUCT/ConfigFRAME.C [new file with mode: 0644]
AliGeant4/macro/STRUCT/ConfigFRAME.in [new file with mode: 0644]
AliGeant4/macro/STRUCT/ConfigHALL.C [new file with mode: 0644]
AliGeant4/macro/STRUCT/ConfigHALL.in [new file with mode: 0644]
AliGeant4/macro/STRUCT/ConfigMAG.C [new file with mode: 0644]
AliGeant4/macro/STRUCT/ConfigMAG.in [new file with mode: 0644]
AliGeant4/macro/STRUCT/ConfigPIPE.C [new file with mode: 0644]
AliGeant4/macro/STRUCT/ConfigPIPE.in [new file with mode: 0644]
AliGeant4/macro/STRUCT/ConfigSHIL.C [new file with mode: 0644]
AliGeant4/macro/STRUCT/ConfigSHIL.in [new file with mode: 0644]
AliGeant4/macro/TOF/Config.C [new file with mode: 0644]
AliGeant4/macro/TOF/Config.in [new file with mode: 0644]
AliGeant4/macro/TPC/Config.C [new file with mode: 0644]
AliGeant4/macro/TPC/Config.in [new file with mode: 0644]
AliGeant4/macro/TRD/Config.C [new file with mode: 0644]
AliGeant4/macro/TRD/Config.in [new file with mode: 0644]
AliGeant4/macro/ZDC/Config.C [new file with mode: 0644]
AliGeant4/macro/ZDC/Config.in [new file with mode: 0644]

diff --git a/AliGeant4/AliColour.cxx b/AliGeant4/AliColour.cxx
new file mode 100644 (file)
index 0000000..1634414
--- /dev/null
@@ -0,0 +1,71 @@
+// $Id$
+// Category: visualization
+//
+// See the class description in the header file.
+
+#include "AliColour.h"
+   
+AliColour::AliColour()
+  : fName (""),
+    fRed(0.),
+    fBlue(0.),
+    fGreen(0.)
+{
+//
+}
+
+AliColour::AliColour(G4String name, G4double red, G4double blue, G4double green)
+  : fName(name),
+    fRed(red),
+    fBlue(blue),
+    fGreen(green)
+{
+//
+}
+
+AliColour::AliColour(const AliColour& right) {
+//
+  fName = right.fName;
+  fRed = right.fRed;
+  fBlue = right.fBlue;
+  fGreen = right.fGreen;
+}
+
+AliColour::~AliColour() {
+//
+}
+
+// operators
+
+AliColour& AliColour::operator=(const AliColour& right)
+{    
+  // check assignement to self
+  if (this == &right) return *this;
+  
+  fName = right.fName;
+  fRed = right.fRed;
+  fBlue = right.fBlue;
+  fGreen = right.fGreen;
+  
+  return *this;
+}
+
+G4int AliColour::operator==(const AliColour& right) const
+{    
+//
+  G4int returnValue = 0;
+  if ( fName == right.fName && 
+       fRed == right.fRed && fBlue == right.fBlue && fGreen == right.fGreen) 
+  { returnValue = 1; };
+
+  return returnValue;  
+}
+
+G4int AliColour::operator!=(const AliColour& right) const
+{
+//    
+  G4int returnValue = 1;
+  if (*this == right) returnValue = 0; 
+  
+  return returnValue;
+}
diff --git a/AliGeant4/AliColour.h b/AliGeant4/AliColour.h
new file mode 100644 (file)
index 0000000..bc8a40a
--- /dev/null
@@ -0,0 +1,45 @@
+// $Id$
+// Category: visualization
+//
+// Data type class that defines colours with names.
+
+#ifndef ALI_COLOUR_H
+#define ALI_COLOUR_H
+
+#include <G4Colour.hh>
+#include <globals.hh>
+
+class AliColour
+{
+  public:
+    AliColour();
+    AliColour(G4String name, G4double red, G4double blue, G4double green);
+    AliColour(const AliColour& right);
+    virtual ~AliColour();
+
+    // operators
+    AliColour& operator=(const AliColour& right);
+    G4int operator==(const AliColour& right) const;
+    G4int operator!=(const AliColour& right) const;
+
+    // get methods
+    G4Colour GetColour() const;
+    G4String GetName() const;
+  
+  private:
+    G4String  fName;  //colour name
+    G4double  fRed;   //red component
+    G4double  fBlue;  //blue component
+    G4double  fGreen; //green component
+};
+
+// inline methods
+
+inline G4Colour AliColour::GetColour() const
+{ return G4Colour(fRed, fBlue, fGreen); }
+
+inline G4String AliColour::GetName() const
+{ return fName; }
+
+#endif //ALCOLOUR_H
+
diff --git a/AliGeant4/AliColourStore.cxx b/AliGeant4/AliColourStore.cxx
new file mode 100644 (file)
index 0000000..ec02e72
--- /dev/null
@@ -0,0 +1,124 @@
+// $Id$
+// Category: visualization
+//
+// See the class description in the header file.
+
+#include "AliColourStore.h"
+#include "AliGlobals.h"
+
+#include <G4Element.hh>
+
+// static data members
+
+AliColourStore* AliColourStore::fgInstance = 0;
+
+// lifecycle
+
+AliColourStore::AliColourStore() {
+//
+  fColours.insert(AliColour("White",     1.0, 1.0, 1.0));    
+  fColours.insert(AliColour("Black",     0.0, 0.0, 0.0));     
+  fColours.insert(AliColour("Red",       1.0, 0.0, 0.0));   
+  fColours.insert(AliColour("RoseDark",  1.0, 0.0, 0.5));  
+  fColours.insert(AliColour("Green",     0.0, 1.0, 0.0));     
+  fColours.insert(AliColour("Green2",    0.0, 1.0, 0.5));     
+  fColours.insert(AliColour("GreenClair",0.5, 1.0, 0.0));
+  fColours.insert(AliColour("Yellow",    1.0, 1.0, 0.0));     
+  fColours.insert(AliColour("BlueDark",  0.0, 0.0, 1.0)); 
+  fColours.insert(AliColour("BlueClair", 0.0, 1.0, 1.0)); 
+  fColours.insert(AliColour("BlueClair2",0.0, 0.5, 1.0));
+  fColours.insert(AliColour("Magenta",   1.0, 0.0, 1.0));    
+  fColours.insert(AliColour("Magenta2",  0.5, 0.0, 1.0));   
+  fColours.insert(AliColour("BrownClair",1.0, 0.5, 0.0));
+  fColours.insert(AliColour("Gray",      0.3, 0.3, 0.3));    
+  fColours.insert(AliColour("GrayClair", 0.6, 0.6, 0.6));
+}
+
+AliColourStore::AliColourStore(const AliColourStore& right) {
+// 
+  AliGlobals::Exception(
+    "Attempt to copy AliColourStore singleton.");
+}
+
+AliColourStore::~AliColourStore() {
+//
+}
+
+// operators
+
+AliColourStore& AliColourStore::operator=(const AliColourStore& right)
+{
+  // check assignement to self
+  if (this == &right) return *this;
+
+  AliGlobals::Exception(
+    "Attempt to assign AliColourStore singleton.");
+    
+  return *this;  
+}    
+
+// static methods
+  
+AliColourStore* AliColourStore::Instance() 
+{
+// Returns the singleton instance.
+// Creates the instance if it does not exist.
+// ---
+
+  if (fgInstance == 0 ) {
+    fgInstance = new AliColourStore();
+  }
+  
+  return fgInstance;
+}
+
+// public methods
+
+G4Colour AliColourStore::GetColour(G4String name) const
+{
+// Retrieves the colour by name.
+// ---
+
+  G4int nofCol = fColours.entries();
+  for (G4int i=0; i<nofCol; i++)
+  {
+    AliColour alColour = fColours[i];
+    if (name == alColour.GetName()) 
+    { return alColour.GetColour(); }
+  }
+  
+  G4String text = "Colour " + name + " is not defined.";
+  AliGlobals::Exception(text);
+  return 0;
+}
+    
+G4String AliColourStore::GetColoursList() const
+{
+// Returns the list of all defined colours names.
+// ---
+
+  G4String list = "";
+  G4int nofCol = fColours.entries();
+  for (G4int i=0; i<nofCol; i++)
+  {
+    list += fColours[i].GetName();
+    list += " ";
+  };
+  return list;
+} 
+       
+G4String AliColourStore::GetColoursListWithCommas() const
+{
+// Returns the list of all defined colours names
+// with commas.
+// ---
+
+  G4String list = "";
+  G4int nofCol = fColours.entries();
+  for (G4int i=0; i<nofCol; i++)
+  {
+    list += fColours[i].GetName();
+    if (i < nofCol-1) list += ", ";
+  };
+  return list;
+} 
diff --git a/AliGeant4/AliColourStore.h b/AliGeant4/AliColourStore.h
new file mode 100644 (file)
index 0000000..480af54
--- /dev/null
@@ -0,0 +1,46 @@
+// $Id$
+// Category: visualization
+//
+// Singleton data type class - store for the predefined colours.
+
+#ifndef ALI_COLOUR_STORE_H
+#define ALI_COLOUR_STORE_H
+
+#include "AliColour.h"
+
+#include <g4rw/tvordvec.h>
+
+class AliColourStore 
+{
+  typedef G4RWTValOrderedVector<AliColour>  AliColourVector;
+
+  public:
+    // --> protected
+    // AliColourStore();
+    // AliColourStore(const AliColourStore& right);
+    virtual ~AliColourStore();
+    
+    // static methods
+    static AliColourStore* Instance();
+
+    // get methods
+    G4Colour GetColour(G4String name) const;
+    G4String GetColoursList() const;
+    G4String GetColoursListWithCommas() const;
+    
+  protected:
+    AliColourStore();  
+    AliColourStore(const AliColourStore& right);
+
+    // operators
+    AliColourStore& operator=(const AliColourStore& right);
+
+  private:
+    // static data members
+    static AliColourStore*  fgInstance; //this instance
+
+    // data members
+    AliColourVector  fColours;          //vector of AliColour
+};   
+
+#endif //ALI_COLOUR_STORE_H
diff --git a/AliGeant4/AliDetConstruction.cxx b/AliGeant4/AliDetConstruction.cxx
new file mode 100644 (file)
index 0000000..d5c0a34
--- /dev/null
@@ -0,0 +1,287 @@
+// $Id$
+// Category: geometry
+//
+// See the class description in the header file.
+
+#include "AliDetConstruction.h"
+#include "AliSingleModuleConstruction.h"
+#include "AliGlobals.h"
+#include "AliRun.h"
+#include "AliModule.h"
+
+AliDetConstruction::AliDetConstruction()
+  : fTopVolumeName("ALIC")
+{
+  // initialize det switch vector: 
+  // moduleName nofVersions defaultVersion [type isStandalone] 
+
+  AliDetSwitch* detSwitch;
+  detSwitch = new AliDetSwitch("ABSO",   1, 0, kStructure);
+  AddDetSwitch(detSwitch); 
+  detSwitch = new AliDetSwitch("DIPO",   3, 2, kStructure);
+  AddDetSwitch(detSwitch); 
+  detSwitch = new AliDetSwitch("FRAME",  2, 1, kStructure, false);
+  AddDetSwitch(detSwitch); 
+  detSwitch = new AliDetSwitch("HALL",   1, 0, kStructure);
+  AddDetSwitch(detSwitch); 
+  detSwitch = new AliDetSwitch("MAG",    1, 0, kStructure);
+  AddDetSwitch(detSwitch); 
+  detSwitch = new AliDetSwitch("PIPE",   4, 0, kStructure);
+  AddDetSwitch(detSwitch); 
+  detSwitch = new AliDetSwitch("SHIL",   1, 0, kStructure);
+  AddDetSwitch(detSwitch); 
+  detSwitch = new AliDetSwitch("CASTOR", 2, 1);
+  AddDetSwitch(detSwitch); 
+  detSwitch = new AliDetSwitch("FMD",    2, 1);
+  AddDetSwitch(detSwitch); 
+  detSwitch = new AliDetSwitch("ITS",    6, 5);
+  AddDetSwitch(detSwitch); 
+  detSwitch = new AliDetSwitch("MUON",   1, 0);
+  AddDetSwitch(detSwitch); 
+  detSwitch = new AliDetSwitch("PHOS",   2, 0);
+  AddDetSwitch(detSwitch); 
+  detSwitch = new AliDetSwitch("PMD",    3, 0);
+  AddDetSwitch(detSwitch); 
+  detSwitch = new AliDetSwitch("RICH",   1, 0);
+  AddDetSwitch(detSwitch); 
+  detSwitch = new AliDetSwitch("START",  1, 0);
+  AddDetSwitch(detSwitch); 
+  detSwitch = new AliDetSwitch("TOF",    7, 1, kDetector, false);
+  AddDetSwitch(detSwitch); 
+  detSwitch = new AliDetSwitch("TPC",    4, 1);
+  AddDetSwitch(detSwitch); 
+  detSwitch = new AliDetSwitch("TRD",    2, 0, kDetector, false);
+  AddDetSwitch(detSwitch); 
+  detSwitch = new AliDetSwitch("ZDC",    2, 1);
+  AddDetSwitch(detSwitch);  
+}
+
+AliDetConstruction::AliDetConstruction(const AliDetConstruction& right)
+  : AliModulesComposition(right)
+{
+  // AliModuleComposition is protected from copying
+}  
+
+AliDetConstruction::~AliDetConstruction() {
+//
+}
+
+// operators
+
+AliDetConstruction& 
+AliDetConstruction::operator=(const AliDetConstruction& right)
+{
+  // check assignement to self
+  if (this == &right) return *this;
+
+  // base class assignement
+  // AliModuleComposition is protected from assigning
+  AliModulesComposition::operator=(right);
+
+  return *this;  
+}    
+          
+// private methods
+
+void AliDetConstruction::BuildDetectors()
+{
+// Create module constructions for AliModules 
+// that have been created and registered by gAlice 
+// ---
+
+  TObjArray* pDetectors = gAlice->Detectors();
+  TIter next(pDetectors);
+
+  // the first AliModule is expected to be the top volume
+  AliModule *module = (AliModule*)next();
+  if (G4String(module->GetName()) != "BODY") {
+    G4String text = "AliDetConstruction::BuildDetectors():\n";
+    text = text + "    Instead of BODY - the first module ";
+    text = text + module->GetName() + " has been found.";
+    AliGlobals::Exception(text);
+  }  
+  AddSingleModuleConstruction("BODY", 0, kStructure);
+
+  G4bool first = true;
+  while ((module = (AliModule*)next())) {
+    // register moduleConstruction in fDetSwitchVector
+    // in order to keep availability of /AlDet/list command
+    G4String modName = module->GetName();
+    G4int modVersion = module->IsVersion();
+    if (first)
+      // skip registering of the top volume 
+      first = false;
+    else 
+      SwitchDetOn(modName, modVersion);
+    // all modules will be processed alltogether
+    AddMoreModuleConstruction(modName, modVersion);
+
+    G4cout << "Created module construction for " 
+           << modName << "v" << modVersion << "." << endl;   
+  }
+  
+  // do not process Config.C 
+  // (it was processed when creating modules by gAlice)
+  SetProcessConfigToModules(false);    
+}
+
+void AliDetConstruction::CreateDetectors()
+{
+// Creates AliModules and their module constructions 
+// according to the fDetSwitchVector
+// ---
+
+  // add top volume (AliBODY) construction first
+  AddSingleModuleConstruction("BODY", 0, kStructure);
+
+  // add modules constructions
+  const G4RWTPtrOrderedVector<AliDetSwitch>& krDetSwitchVector 
+    = GetDetSwitchVector();
+  for (G4int id=0; id<krDetSwitchVector.entries(); id++)
+  {
+    G4String detName = krDetSwitchVector[id]->GetDetName();
+    G4int version = krDetSwitchVector[id]->GetSwitchedVersion();
+    G4bool isStandalone = krDetSwitchVector[id]->IsStandalone();
+    AliModuleType type = krDetSwitchVector[id]->GetType();
+    
+    if (version > -1)
+      if (isStandalone)
+        AddSingleModuleConstruction(detName, version, type);
+      else
+        AddMoreModuleConstruction(detName, version, type);
+  }    
+}
+
+void AliDetConstruction::CheckDetDependencies()
+{
+// Checks modules dependencies.
+// Dependent modules FRAME, TOF, TRD 
+// TOF always requires FRAMEv1
+// TRD can be built with both (??)
+// ---
+
+  const G4RWTPtrOrderedVector<AliDetSwitch>& krDetSwitchVector 
+    = GetDetSwitchVector();
+
+  // get switched versions of dependent modules
+  G4int nofDets = krDetSwitchVector.entries();
+  G4int verFRAME = -1; 
+  G4int verTOF = -1; 
+  G4int verTRD = -1; 
+  AliDetSwitch* detSwitchFRAME = 0;
+  for (G4int id=0; id<nofDets; id++) {  
+    G4String detName = krDetSwitchVector[id]->GetDetName();
+    if (detName == "FRAME") { 
+      verFRAME = krDetSwitchVector[id]->GetSwitchedVersion();  
+      detSwitchFRAME = krDetSwitchVector[id];
+    }  
+    if (detName == "TOF")  
+      verTOF = krDetSwitchVector[id]->GetSwitchedVersion();  
+    if (detName == "TRD")  
+      verTRD = krDetSwitchVector[id]->GetSwitchedVersion();  
+  }
+  
+  // check dependencies  
+  if (verTRD > -1 && verTOF > -1) {
+    // both TRD and TOF 
+    if (verFRAME != 1) {
+      detSwitchFRAME->SwitchOn(1);
+      G4String text = "AliDetConstruction::CheckDetDependencies: \n";
+      text = text + "    Switched TOF and TRD require FRAME v1.\n"; 
+      text = text + "    The det switch for FRAME has been changed."; 
+      AliGlobals::Warning(text);
+    }  
+  }
+  else if (verTRD > -1 && verTOF == -1)   {
+    // only TRD
+    if (verFRAME < 0) {
+      detSwitchFRAME->SwitchOn(1);
+      G4String text = "AliDetConstruction::CheckDetDependencies: \n";
+      text = text + "    Switched TRD require FRAME.\n"; 
+      text = text + "    The det switch for FRAME has been changed."; 
+      AliGlobals::Warning(text);
+    }  
+  }  
+  else if (verTRD == -1 && verTOF > -1)   {
+    // only TOF
+    if (verFRAME != 1) {
+      detSwitchFRAME->SwitchOn(1);
+      G4String text = "AliDetConstruction::CheckDetDependencies: \n";
+      text = text + "    Switched TOF requires FRAME v1.\n"; 
+      text = text + "    The det switch for FRAME has been changed."; 
+      AliGlobals::Warning(text);
+    }  
+  }
+/*  
+  if (verTRD > -1 && verTOF > -1) {
+    // both TRD and TOF 
+    if (verTOF == 2 || verTOF == 3 || verTOF == 5 || verTOF == 6) {
+      G4String text = "AliDetConstruction::CheckDetDependencies: \n";
+      text = text + "    Switched TOF and TRD require different FRAME versions."; 
+      AliGlobals::Exception(text);
+    }  
+    if (verFRAME != 0) {
+      detSwitchFRAME->SwitchOn(0);
+      G4String text = "AliDetConstruction::CheckDetDependencies: \n";
+      text = text + "    Switched TOF and TRD require FRAME v0.\n"; 
+      text = text + "    The det switch for FRAME has been changed."; 
+      AliGlobals::Warning(text);
+    }  
+  }
+  else if (verTRD > -1 && verTOF == -1)   {
+    // only TRD
+    if (verFRAME != 0) {
+      detSwitchFRAME->SwitchOn(0);
+      G4String text = "AliDetConstruction::CheckDetDependencies: \n";
+      text = text + "    Switched TRD requires FRAME v0.\n"; 
+      text = text + "    The det switch for FRAME has been changed."; 
+      AliGlobals::Warning(text);
+    }          
+  }  
+  else if (verTRD == -1 && verTOF > -1)   {
+    // only TOF
+    if ((verTOF == 0 || verTOF == 1 || verTOF == 4) && (verFRAME !=0)) {
+      detSwitchFRAME->SwitchOn(0);
+      G4String text = "AliDetConstruction::CheckDetDependencies: \n";
+      text = text + "    Switched TOF requires FRAME v0.\n"; 
+      text = text + "    The det switch for FRAME has been changed."; 
+      AliGlobals::Warning(text);
+    }
+    if ((verTOF == 2 || verTOF == 3 || verTOF == 5 || verTOF == 6) &&
+        (verFRAME != 1)) {
+      detSwitchFRAME->SwitchOn(1);
+      G4String text = "AliDetConstruction::CheckDetDependencies: \n";
+      text = text + "    Switched TOF requires FRAME v1.\n"; 
+      text = text + "    The det switch for FRAME has been changed."; 
+      AliGlobals::Warning(text);
+    }
+  }
+*/    
+}  
+
+// public methods
+
+G4VPhysicalVolume* AliDetConstruction::Construct()
+{
+// Constructs geometry.
+// This method is called by G4RunManager in initialization.
+// ---
+
+  if (gAlice->Modules()->GetLast() < 0) {
+    // create geometry (including AliModules) according to 
+    // the fDetSwitchVector
+    CheckDetDependencies();
+    CreateDetectors();
+  }   
+  else {
+    // create geometry for AliModules 
+    // that have been created and registered by gAlice 
+    BuildDetectors();
+  }  
+  // construct modules geometry
+  ConstructModules();
+
+  return AliSingleModuleConstruction::GetWorld();      
+}
+
diff --git a/AliGeant4/AliDetConstruction.h b/AliGeant4/AliDetConstruction.h
new file mode 100644 (file)
index 0000000..02ebe79
--- /dev/null
@@ -0,0 +1,55 @@
+// $Id$
+// Category: geometry
+//
+// Detector construction class with interactive setting of detectors setup 
+// available.  
+// In case the detector setup is not defined in Root macro Config.C
+// commands /alDet/switchOn/Off can be used either interactively or
+// in Geant4 macro.
+
+#ifndef ALI_DET_CONSTRUCTION_H
+#define ALI_DET_CONSTRUCTION_H
+
+#include "AliModulesComposition.h"
+
+#include <globals.hh>
+
+class G4VPhysicalVolume;
+
+class AliDetConstruction : public AliModulesComposition
+{
+  public:
+    AliDetConstruction();
+    // --> protected
+    // AliDetConstruction(const AliDetConstruction& right);
+    virtual ~AliDetConstruction();
+
+    // methods
+    virtual G4VPhysicalVolume* Construct();
+
+    // set methods
+    void SetTopVolumeName(G4String name);
+    
+  protected:
+    AliDetConstruction(const AliDetConstruction& right);
+
+    // operators
+    AliDetConstruction& operator=(const AliDetConstruction& right);
+
+  private:  
+    // methods
+    void BuildDetectors();
+    void CreateDetectors();
+    void CheckDetDependencies();
+  
+    // data members
+    G4String  fTopVolumeName;  //top volume name
+};
+
+// inline methods
+
+inline void AliDetConstruction::SetTopVolumeName(G4String name)
+{ fTopVolumeName = name; }
+
+#endif //ALI_DET_CONSTRUCTION_H
+
diff --git a/AliGeant4/AliDetConstructionMessenger.cxx b/AliGeant4/AliDetConstructionMessenger.cxx
new file mode 100644 (file)
index 0000000..648a279
--- /dev/null
@@ -0,0 +1,96 @@
+// $Id$
+// Category: geometry
+//
+// See the class description in the header file.
+
+#include "AliDetConstructionMessenger.h"
+#include "AliDetConstruction.h"
+#include "AliGlobals.h"
+
+#include <G4UIcmdWithABool.hh>
+
+AliDetConstructionMessenger::AliDetConstructionMessenger(
+                                AliDetConstruction* detConstruction)
+  : fDetConstruction(detConstruction)
+{
+//
+  fSetAllSensitiveCmd
+    = new G4UIcmdWithABool("/aliDet/setAllSensitive", this);
+  fSetAllSensitiveCmd 
+    ->SetGuidance("If true: set all logical volumes sensitive.");
+  fSetAllSensitiveCmd 
+    ->SetGuidance("         (Each logical is volume associated with a sensitive");
+  fSetAllSensitiveCmd 
+    ->SetGuidance("          detector.)");
+  fSetAllSensitiveCmd 
+    ->SetGuidance("If false: only volumes defined with a sensitive tracking");
+  fSetAllSensitiveCmd 
+    ->SetGuidance("          medium are associated with a sensitive detector.");
+  fSetAllSensitiveCmd->SetParameterName("sensitivity", false);
+  fSetAllSensitiveCmd->AvailableForStates(PreInit);  
+
+  fSetReadGeometryCmd 
+    = new G4UIcmdWithABool("/aliDet/readGeometry", this);
+  fSetReadGeometryCmd->SetGuidance("Read geometry from g3calls.dat files");
+  fSetReadGeometryCmd->SetParameterName("readGeometry", false);
+  fSetReadGeometryCmd->AvailableForStates(PreInit);  
+  fSetWriteGeometryCmd 
+    = new G4UIcmdWithABool("/aliDet/writeGeometry", this);
+  fSetWriteGeometryCmd->SetGuidance("Write geometry to g3calls.dat file");
+  fSetWriteGeometryCmd->SetParameterName("writeGeometry", false);
+  fSetWriteGeometryCmd->AvailableForStates(PreInit);   
+}
+
+AliDetConstructionMessenger::AliDetConstructionMessenger() {
+//
+}
+
+AliDetConstructionMessenger::AliDetConstructionMessenger(
+                                const AliDetConstructionMessenger& right)
+{
+//
+  AliGlobals::Exception(
+    "AliDetConstructionMessenger is protected from copying.");
+}
+
+AliDetConstructionMessenger::~AliDetConstructionMessenger() {
+//
+  delete fSetAllSensitiveCmd;
+  delete fSetReadGeometryCmd;
+  delete fSetWriteGeometryCmd;
+}
+
+// operators
+
+AliDetConstructionMessenger& 
+AliDetConstructionMessenger::operator=(const AliDetConstructionMessenger& right)
+{
+  // check assignement to self
+  if (this == &right) return *this;
+
+  AliGlobals::Exception(
+     "AliDetConstructionMessenger is protected from assigning.");
+    
+  return *this;  
+}    
+          
+// public methods
+  
+void AliDetConstructionMessenger::SetNewValue(G4UIcommand* command, G4String newValues)
+{
+// Applies command to the associated object.
+// ---
+
+  if (command == fSetAllSensitiveCmd) {
+    fDetConstruction->SetAllLVSensitive(
+                         fSetAllSensitiveCmd->GetNewBoolValue(newValues));
+  }
+  else if (command == fSetReadGeometryCmd) {
+    fDetConstruction->SetReadGeometry(newValues);
+  }  
+  else if (command == fSetWriteGeometryCmd) {
+    fDetConstruction->SetWriteGeometry(newValues);
+  }    
+}
+
diff --git a/AliGeant4/AliDetConstructionMessenger.h b/AliGeant4/AliDetConstructionMessenger.h
new file mode 100644 (file)
index 0000000..f708221
--- /dev/null
@@ -0,0 +1,46 @@
+// $Id$
+// Category: geometry
+//
+// Messenger class that defines commands for AliDetConstruction.
+
+#ifndef ALI_DET_CONSTRUCTION_MESSENGER_H
+#define ALI_DET_CONSTRUCTION_MESSENGER_H
+
+#include <G4UImessenger.hh>
+#include <globals.hh>
+
+class AliDetConstruction;
+
+class G4UIcommand;
+class G4UIcmdWithABool;
+
+class AliDetConstructionMessenger: public G4UImessenger
+{
+  public:
+    AliDetConstructionMessenger(AliDetConstruction* detConstruction);
+    // --> protected
+    // AliDetConstructionMessenger();  
+    // AliDetConstructionMessenger(const AliDetConstructionMessenger& right);
+    virtual ~AliDetConstructionMessenger();
+
+    // methods
+    virtual void SetNewValue(G4UIcommand* command, G4String newValues);
+
+  protected:
+    AliDetConstructionMessenger();
+    AliDetConstructionMessenger(const AliDetConstructionMessenger& right);
+
+    // operators
+    AliDetConstructionMessenger& operator=(
+                                const AliDetConstructionMessenger& right);
+  
+  private:
+    // data members
+    AliDetConstruction*  fDetConstruction;     //associated class
+    G4UIcmdWithABool*    fSetAllSensitiveCmd;  //command: setAllSensitive   
+    G4UIcmdWithABool*    fSetReadGeometryCmd;  //command: setReadGeometry   
+    G4UIcmdWithABool*    fSetWriteGeometryCmd; //command: setWriteGeometry   
+};
+
+#endif //ALI_DET_CONSTRUCTION_MESSENGER_H
+
diff --git a/AliGeant4/AliDetSwitch.cxx b/AliGeant4/AliDetSwitch.cxx
new file mode 100644 (file)
index 0000000..22ee551
--- /dev/null
@@ -0,0 +1,101 @@
+// $Id$
+// Category: geometry
+//
+// See the class description in the header file.
+
+#include "AliDetSwitch.h"
+#include "AliGlobals.h"
+
+AliDetSwitch::AliDetSwitch(G4String detName, G4int nofVersions, 
+                 G4int defaultVersion, AliModuleType modType, 
+                G4bool isStandalone)
+  : fDetName(detName),
+    fNofVersions(nofVersions),
+    fDefaultVersion(defaultVersion),
+    fIsStandalone(isStandalone),
+    fType(modType),
+    fSwitchedVersion(-1)
+{
+//
+}
+
+AliDetSwitch::AliDetSwitch(const AliDetSwitch& right) {
+//
+  fDetName = right.fDetName;
+  fNofVersions = right.fNofVersions;
+  fDefaultVersion = right.fDefaultVersion;
+  fIsStandalone = right.fIsStandalone;
+  fType = right.fType;
+  fSwitchedVersion = right.fSwitchedVersion;
+}
+
+AliDetSwitch::~AliDetSwitch(){
+//
+}
+
+// operators
+AliDetSwitch& AliDetSwitch::operator=(const AliDetSwitch& right)
+{    
+  // check assignement to self
+  if (this == &right) return *this;
+
+  fDetName = right.fDetName;
+  fNofVersions = right.fNofVersions;
+  fDefaultVersion = right.fDefaultVersion;
+  fSwitchedVersion = right.fSwitchedVersion;
+  fType = right.fType;
+  fIsStandalone = right.fIsStandalone;
+  
+  return *this;
+}
+
+G4int AliDetSwitch::operator==(const AliDetSwitch& right) const
+{    
+//
+  G4int returnValue = 0;
+  if (fDetName == right.fDetName )
+     returnValue = 1;
+
+  return returnValue;  
+}
+
+G4int AliDetSwitch::operator!=(const AliDetSwitch& right) const
+{ 
+//   
+  G4int returnValue = 1;
+  if (*this == right) returnValue = 0; 
+  
+  return returnValue;
+}
+  
+// public methods
+
+void AliDetSwitch::SwitchOn(G4int iVersion)
+{
+// Switchs on the iVersion version.
+// ---
+
+  if ((iVersion < 0) || (iVersion >= fNofVersions)) {
+    G4String text = "Wrong version number for ";
+    text = text + fDetName + ".";
+    AliGlobals::Exception(text);
+  }  
+   
+  fSwitchedVersion = iVersion;
+}
+
+void AliDetSwitch::SwitchOnDefault()
+{
+// Switchs on the default version.
+// ---
+
+  fSwitchedVersion = fDefaultVersion;
+}
+
+void AliDetSwitch::SwitchOff()
+{
+// No version is switched on.
+// ---
+
+  fSwitchedVersion = -1;
+}
diff --git a/AliGeant4/AliDetSwitch.h b/AliGeant4/AliDetSwitch.h
new file mode 100644 (file)
index 0000000..12a8b11
--- /dev/null
@@ -0,0 +1,70 @@
+// $Id$
+// Category: geometry
+//
+// Data type class that stores available detector option.
+// Used in interactive detector setup.
+
+#ifndef ALI_DET_SWITCH_H
+#define ALI_DET_SWITCH_H
+
+#include "AliModuleType.h"
+
+#include <globals.hh>
+
+class AliDetSwitch
+{
+  public:
+    AliDetSwitch(G4String detName, G4int nofVersions, G4int defaultVersion,
+                 AliModuleType modType = kDetector, G4bool isStandalone = true);
+    AliDetSwitch(const AliDetSwitch& right);
+    virtual ~AliDetSwitch();
+
+    //operators
+    AliDetSwitch& operator=(const AliDetSwitch& right);
+    G4int operator==(const AliDetSwitch& right) const;
+    G4int operator!=(const AliDetSwitch& right) const;
+    
+    // methods
+    void SwitchOn(G4int version); 
+    void SwitchOnDefault(); 
+    void SwitchOff(); 
+
+    // get methods
+    G4String GetDetName() const;
+    G4int GetNofVersions() const;
+    G4int GetDefaultVersion() const;
+    G4bool IsStandalone() const;
+    AliModuleType GetType() const;
+    G4int GetSwitchedVersion() const;
+
+  private:
+    // data members
+    G4String       fDetName;         //module name
+    G4int          fNofVersions;     //number of versions
+    G4int          fDefaultVersion;  //default version
+    G4bool         fIsStandalone;    //true if module can be built standalone
+    AliModuleType  fType;            //type of module (detector or structure)
+    G4int          fSwitchedVersion; //current selected version
+};
+    
+// inline methods    
+    
+inline G4String AliDetSwitch::GetDetName() const
+{ return fDetName; }
+
+inline G4int AliDetSwitch::GetNofVersions() const
+{ return fNofVersions; }
+
+inline G4int AliDetSwitch::GetDefaultVersion() const
+{ return fDefaultVersion; }
+
+inline G4int AliDetSwitch::GetSwitchedVersion() const
+{ return fSwitchedVersion; }
+
+inline AliModuleType AliDetSwitch::GetType() const
+{ return fType; }
+
+inline G4bool AliDetSwitch::IsStandalone() const
+{ return fIsStandalone; }
+
+#endif //ALI_DET_SWITCH_H
diff --git a/AliGeant4/AliEmptyPhysicsList.cxx b/AliGeant4/AliEmptyPhysicsList.cxx
new file mode 100644 (file)
index 0000000..936ffc3
--- /dev/null
@@ -0,0 +1,91 @@
+// $Id$
+// Category: physics
+//
+// See the class description in the header file.
+
+#include "AliEmptyPhysicsList.h"
+#include "AliGlobals.h"
+
+#include <G4Geantino.hh>
+#include <G4ChargedGeantino.hh>
+
+#include <iomanip.h>                
+
+AliEmptyPhysicsList::AliEmptyPhysicsList() {
+//
+  defaultCutValue = AliGlobals::DefaultCut();
+  SetVerboseLevel(1);
+}
+
+AliEmptyPhysicsList::~AliEmptyPhysicsList() {
+//
+}
+
+// public methods
+
+void AliEmptyPhysicsList::ConstructParticle()
+{
+// In this method, static member functions should be called
+// for all particles which you want to use.
+// This ensures that objects of these particle types will be
+// created in the program. 
+// ---
+
+  ConstructBosons();
+  ConstructLeptons();
+  ConstructMesons();
+  ConstructBarions();
+}
+
+void AliEmptyPhysicsList::ConstructBosons()
+{
+// Constructs pseudo-particles only.
+// ---
+
+  G4Geantino::GeantinoDefinition();
+  G4ChargedGeantino::ChargedGeantinoDefinition();
+}
+
+void AliEmptyPhysicsList::ConstructLeptons()
+{
+  // no leptons
+}
+
+void AliEmptyPhysicsList::ConstructMesons()
+{
+ //  no mesons
+}
+
+void AliEmptyPhysicsList::ConstructBarions()
+{
+ // no barions
+}
+
+void AliEmptyPhysicsList::ConstructProcess()
+{
+// Constructs physics processes.
+// ---
+
+  AddTransportation();
+  ConstructEM();
+  ConstructGeneral();
+}
+
+void AliEmptyPhysicsList::ConstructEM()
+{
+  // no EM
+}
+
+void AliEmptyPhysicsList::ConstructGeneral()
+{
+  // no Decay Process
+}
+
+void AliEmptyPhysicsList::SetCuts()
+{
+// Sets the default range cut values for all defined particles.
+// ---
+
+  SetCutsWithDefault();
+}
+
diff --git a/AliGeant4/AliEmptyPhysicsList.h b/AliGeant4/AliEmptyPhysicsList.h
new file mode 100644 (file)
index 0000000..de792d1
--- /dev/null
@@ -0,0 +1,40 @@
+// $Id$
+// Category: physics
+//
+// Empty physics list for geometry tests.
+
+#ifndef ALI_EMPTY_PHYSICS_LIST_H
+#define ALI_EMPTY_PHYSICS_LIST_H
+
+#include <G4VUserPhysicsList.hh>
+#include <globals.hh>
+
+class AliEmptyPhysicsList: public G4VUserPhysicsList
+{
+  public:
+    AliEmptyPhysicsList();
+    virtual ~AliEmptyPhysicsList();
+
+  protected:
+    // methods
+    // construct particle and physics
+    virtual void ConstructParticle();
+    virtual void ConstructProcess();
+    virtual void SetCuts();
+    
+    // construct particles methods
+    void ConstructBosons();
+    void ConstructLeptons();
+    void ConstructMesons();
+    void ConstructBarions();
+
+    // construct physics processes and register them
+    void ConstructGeneral();
+    void ConstructEM();    
+};
+
+#endif //ALI_EMPTY_PHYSICS_LIST_H
+
+
+
diff --git a/AliGeant4/AliEventAction.cxx b/AliGeant4/AliEventAction.cxx
new file mode 100644 (file)
index 0000000..1b3b8d8
--- /dev/null
@@ -0,0 +1,145 @@
+// $Id$
+// Category: event
+//
+// See the class description in the header file.
+
+#include "AliEventAction.h"
+#include "AliEventActionMessenger.h"
+#include "AliRun.h"
+#include "AliTrackingAction.h"
+#include "AliSensitiveDetector.h"
+#include "AliGlobals.h"
+
+#include "TG4GeometryManager.h"
+
+#include <G4Event.hh>
+#include <G4TrajectoryContainer.hh>
+#include <G4Trajectory.hh>
+#include <G4VVisManager.hh>
+#include <G4UImanager.hh>
+#include <G4LogicalVolumeStore.hh>
+#include <G4VSensitiveDetector.hh>
+
+AliEventAction::AliEventAction()
+  : fVerboseLevel(1), 
+    fDrawFlag("CHARGED")
+{
+//
+  fMessenger = new AliEventActionMessenger(this);
+}
+
+AliEventAction::AliEventAction(const AliEventAction& right) {
+//
+  AliGlobals::Exception("AliEventAction is protected from copying.");
+}
+
+AliEventAction::~AliEventAction() {
+//
+  delete fMessenger;
+}
+
+// operators
+
+AliEventAction& AliEventAction::operator=(const AliEventAction &right)
+{
+  // check assignement to self
+  if (this == &right) return *this;
+  
+  AliGlobals::Exception("AliEventAction is protected from assigning.");
+
+  return *this;
+}
+
+// private methods
+
+void AliEventAction::DisplayEvent(const G4Event* event) const
+{
+// Draws trajectories.
+// ---
+
+
+  // trajectories processing
+  G4TrajectoryContainer* trajectoryContainer 
+    = event->GetTrajectoryContainer();
+
+  G4int nofTrajectories = 0;
+  if (trajectoryContainer)
+  { nofTrajectories = trajectoryContainer->entries(); }
+  
+  if (fVerboseLevel>0) {
+    G4cout << "    " << nofTrajectories; 
+    G4cout << " trajectories stored." << endl;
+  }  
+
+  G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
+  if(pVVisManager && nofTrajectories>0)
+  {
+    G4UImanager::GetUIpointer()->ApplyCommand("/vis~/draw/current");
+
+    for (G4int i=0; i<nofTrajectories; i++)
+    { 
+      G4VTrajectory* vtrajectory = (*(event->GetTrajectoryContainer()))[i];
+      G4Trajectory* trajectory = dynamic_cast<G4Trajectory*>(vtrajectory);
+      if (!trajectory) {
+        AliGlobals::Exception(
+         "AliEventAction::DisplayEvent: Unknown trajectory type.");
+      }
+      else if ( (fDrawFlag == "ALL") ||
+               ((fDrawFlag == "CHARGED") && (trajectory->GetCharge() != 0.))){
+        trajectory->DrawTrajectory(2000); 
+      }        
+    }      
+    G4UImanager::GetUIpointer()->ApplyCommand("/vis~/show/view");
+  }  
+}
+
+// public methods
+
+void AliEventAction::BeginOfEventAction(const G4Event* event)
+{
+// Called by G4 kernel at the beginning of event.
+// ---
+
+  G4int eventID = event->GetEventID();
+
+  // reset the counters (primary tracks, saved tracks)
+  AliTrackingAction* trackingAction
+    = AliTrackingAction::Instance();
+  trackingAction->PrepareNewEvent();   
+
+  if (fVerboseLevel>0)
+    G4cout << ">>> Event " << event->GetEventID() << endl;
+}
+
+void AliEventAction::EndOfEventAction(const G4Event* event)
+{
+// Called by G4 kernel at the end of event.
+// ---
+
+  // save the last primary track store of
+  // the current event
+  AliTrackingAction* trackingAction
+    = AliTrackingAction::Instance();
+  trackingAction->SaveAndDestroyTrack();   
+
+  if (fVerboseLevel>0) {
+    G4int nofPrimaryTracks = trackingAction->GetNofPrimaryTracks();
+    G4cout  << "    " << nofPrimaryTracks << 
+               " primary tracks processed." << endl;
+  }           
+
+  // display event
+  DisplayEvent(event);
+
+  // aliroot
+  // store event header data
+  gAlice->GetHeader()->SetEvent(event->GetEventID());
+  gAlice->GetHeader()->SetNvertex(event->GetNumberOfPrimaryVertex());
+  gAlice->GetHeader()->SetNprimary(trackingAction->GetNofPrimaryTracks());
+  gAlice->GetHeader()->SetNtrack(trackingAction->GetNofSavedTracks());
+
+  gAlice->FinishEvent();    
+}
+
+
+
diff --git a/AliGeant4/AliEventAction.h b/AliGeant4/AliEventAction.h
new file mode 100644 (file)
index 0000000..d8ab0f3
--- /dev/null
@@ -0,0 +1,68 @@
+// $Id$
+// Category: event
+//
+// Class that defines actions at the beginning and the end of event.
+
+#ifndef ALI_EVENT_ACTION_H
+#define ALI_EVENT_ACTION_H 
+
+#include <G4UserEventAction.hh>
+#include <globals.hh>
+
+class AliEventActionMessenger;
+
+class G4Event;
+
+class AliEventAction : public G4UserEventAction
+{
+  public:
+    AliEventAction();
+    // --> protected
+    // AliEventAction(const AliEventAction& right);
+    virtual ~AliEventAction();
+    
+    // methods
+    virtual void BeginOfEventAction(const G4Event* event);
+    virtual void EndOfEventAction(const G4Event* event);
+    
+    // set methods
+    void SetVerboseLevel(G4int level);
+    void SetDrawFlag(G4String drawFlag);
+    
+    // get methods
+    G4int GetVerboseLevel() const;
+    G4String GetDrawFlag() const;
+    
+  protected:
+    AliEventAction(const AliEventAction& right);
+
+    // operators
+    AliEventAction& operator=(const AliEventAction& right);
+
+  private:
+    // methods 
+    void DisplayEvent(const G4Event* event) const;
+  
+    // data members
+    AliEventActionMessenger*  fMessenger;    //messenger
+    G4int                     fVerboseLevel; //verbose level
+    G4String                  fDrawFlag;     //control drawing of the event
+};
+
+// inline methods
+
+inline void AliEventAction::SetVerboseLevel(G4int level)
+{ fVerboseLevel = level; }
+
+inline void AliEventAction::SetDrawFlag(G4String drawFlag)
+{ fDrawFlag = drawFlag; }
+
+inline G4int AliEventAction::GetVerboseLevel() const
+{ return fVerboseLevel; }
+
+inline G4String AliEventAction::GetDrawFlag() const
+{ return fDrawFlag; }
+
+#endif //ALI_EVENT_ACTION_H
+
+    
diff --git a/AliGeant4/AliEventActionMessenger.cxx b/AliGeant4/AliEventActionMessenger.cxx
new file mode 100644 (file)
index 0000000..d043f77
--- /dev/null
@@ -0,0 +1,84 @@
+// $Id$
+// Category: event
+//
+// See the class description in the header file.
+
+#include "AliEventActionMessenger.h"
+#include "AliEventAction.h"
+#include "AliGlobals.h"
+
+#include <G4UIdirectory.hh>
+#include <G4UIcmdWithAString.hh>
+#include <G4UIcmdWithAnInteger.hh>
+
+AliEventActionMessenger::AliEventActionMessenger(AliEventAction* eventAction)
+  :fEventAction(eventAction)
+{ 
+//
+  fEventDirectory = new G4UIdirectory("/aliEvent/");
+  fEventDirectory->SetGuidance("AliEventAction control commands.");
+
+  fDrawTracksCmd = new G4UIcmdWithAString("/aliEvent/drawTracks", this);
+  fDrawTracksCmd->SetGuidance("Draw the tracks in the event");
+  fDrawTracksCmd->SetGuidance("  Choice : NONE, CHARGED(default), ALL");
+  fDrawTracksCmd->SetParameterName("Choice", true);
+  fDrawTracksCmd->SetDefaultValue("CHARGED");
+  fDrawTracksCmd->SetCandidates("NONE CHARGED ALL");
+  fDrawTracksCmd->AvailableForStates(Idle);
+  fVerboseCmd = new G4UIcmdWithAnInteger("/aliEvent/verbose", this);
+  fVerboseCmd->SetGuidance("Set verbose level for AliEventAction");
+  fVerboseCmd->SetParameterName("VerboseLevel", true);
+  fVerboseCmd->SetDefaultValue(0);
+  fVerboseCmd->SetRange("VerboseLevel >= 0 && VerboseLevel <= 2");
+  fVerboseCmd->AvailableForStates(Idle);
+}
+
+AliEventActionMessenger::AliEventActionMessenger(){
+//
+}
+
+AliEventActionMessenger::AliEventActionMessenger(
+                                 const AliEventActionMessenger& right) {
+//                              
+  AliGlobals::Exception("AliEventActionMessenger is protected from copying.");
+}
+
+AliEventActionMessenger::~AliEventActionMessenger() {
+//
+  delete fEventDirectory;
+  delete fDrawTracksCmd;
+  delete fVerboseCmd;
+}
+
+// operators
+
+AliEventActionMessenger& 
+AliEventActionMessenger::operator=(const AliEventActionMessenger &right)
+{
+  // check assignement to self
+  if (this == &right) return *this;
+  
+  AliGlobals::Exception("AliEventActionMessenger is protected from assigning.");
+
+  return *this;
+}
+
+// public methods
+
+void AliEventActionMessenger::SetNewValue(G4UIcommand* command, 
+       G4String newValue)
+{ 
+// Applies command to the associated object.
+// ---
+
+  if(command == fDrawTracksCmd)
+  { 
+    fEventAction->SetDrawFlag(newValue); 
+  }   
+  else if(command == fVerboseCmd)
+  { 
+    fEventAction
+      ->SetVerboseLevel(fVerboseCmd->GetNewIntValue(newValue)); 
+  }   
+}
diff --git a/AliGeant4/AliEventActionMessenger.h b/AliGeant4/AliEventActionMessenger.h
new file mode 100644 (file)
index 0000000..5257515
--- /dev/null
@@ -0,0 +1,46 @@
+// $Id$
+// Category: event
+//
+// Messenger class that defines commands for AliEventAction.
+
+#ifndef ALI_EVENT_ACTION_MESSENGER_H
+#define ALI_EVENT_ACTION_MESSENGER_H 
+
+#include <G4UImessenger.hh>
+#include <globals.hh>
+
+class AliEventAction;
+
+class G4UIdirectory;
+class G4UIcmdWithAString;
+class G4UIcmdWithAnInteger;
+
+class AliEventActionMessenger: public G4UImessenger
+{
+  public:
+    AliEventActionMessenger(AliEventAction* eventAction);
+    // --> protected
+    // AliEventActionMessenger();
+    // AliEventActionMessenger(const AliEventActionMessenger& right);
+    virtual ~AliEventActionMessenger();
+   
+    // methods 
+    virtual void SetNewValue(G4UIcommand* command, G4String string);
+    
+  protected:
+    AliEventActionMessenger();
+    AliEventActionMessenger(const AliEventActionMessenger& right);
+
+    // operators
+    AliEventActionMessenger& operator=(
+                            const AliEventActionMessenger& right);
+
+  private:
+    // data members
+    AliEventAction*        fEventAction;    //associated class
+    G4UIdirectory*         fEventDirectory; //command directory
+    G4UIcmdWithAString*    fDrawTracksCmd;  //command: drawTracks
+    G4UIcmdWithAnInteger*  fVerboseCmd;     //command: verbose
+};
+
+#endif //ALI_EVENT_ACTION_MESSENGER_H
diff --git a/AliGeant4/AliFiles.cxx b/AliGeant4/AliFiles.cxx
new file mode 100644 (file)
index 0000000..c3d30f4
--- /dev/null
@@ -0,0 +1,32 @@
+// $Id$
+// Category: global
+//
+// See the class description in the header file.
+
+#include "AliFiles.h"
+
+#include <stdlib.h>
+
+// static data members
+
+const G4String AliFiles::fgTop =    getenv("AG4_INSTALL");    
+const G4String AliFiles::fgConfig = fgTop + "/../macros/Config.C";    
+const G4String AliFiles::fgDetConfig1 = fgTop + "/macro/";    
+const G4String AliFiles::fgDetConfig2 = "/Config";    
+const G4String AliFiles::fgDetConfig3 = ".C";    
+const G4String AliFiles::fgDetConfig4 = ".in";    
+const G4String AliFiles::fgDetConfigName1 = "Config(";    
+const G4String AliFiles::fgDetConfigName2 = ")";    
+const G4String AliFiles::fgDetData1 = fgTop + "/macro/";
+const G4String AliFiles::fgDetData2 = "/g3calls_";    
+const G4String AliFiles::fgDetData3 = ".dat";    
+const G4String AliFiles::fgSTRUCT = "STRUCT/";
+
+AliFiles::AliFiles() {
+//
+}
+  
+AliFiles::~AliFiles() {
+//
+}
+  
diff --git a/AliGeant4/AliFiles.h b/AliGeant4/AliFiles.h
new file mode 100644 (file)
index 0000000..d259cff
--- /dev/null
@@ -0,0 +1,92 @@
+// $Id$
+// Category: global
+//
+// Class for file names and paths.
+// It is protected from instantiating (only static data members
+// and static methods are defined).
+
+#ifndef ALI_FILES_H
+#define ALI_FILES_H
+
+#include <globals.hh>
+
+#ifdef G4USE_STL
+#include <string>
+#endif
+
+class AliFiles
+{
+  public:
+    // --> protected
+    // AliFiles();
+    virtual ~AliFiles();
+
+    // static get methods
+    static G4String Config();   
+    static G4String DetConfig1();
+    static G4String DetConfig2();
+    static G4String DetConfig3();
+    static G4String DetConfig4();
+    static G4String DetConfigName1();
+    static G4String DetConfigName2();
+    static G4String DetData1();
+    static G4String DetData2();
+    static G4String DetData3();
+    static G4String STRUCT();
+
+  protected:
+    AliFiles();  
+       // only static data members and methods
+    
+  private:       
+    // static data members  
+    static const G4String  fgTop;        //top directory
+    static const G4String  fgConfig;     //path to general Config.C
+    static const G4String  fgDetConfig1; //path (part 1) to module Config.C/in
+    static const G4String  fgDetConfig2; //path (part 2) to module Config.C/in
+    static const G4String  fgDetConfig3; //path (part 3) to module Config.C/in
+    static const G4String  fgDetConfig4; //path (part 2) to module Config.C/in
+    static const G4String  fgDetConfigName1;  //config macro name (part 1)
+    static const G4String  fgDetConfigName2;  //config macro name (part 2)
+    static const G4String  fgDetData1;   //path (part 1) to module g3calls.dat
+    static const G4String  fgDetData2;   //path (part 2) to module g3calls.dat
+    static const G4String  fgDetData3;   //path (part 3) to module g3calls.dat
+    static const G4String  fgSTRUCT;     //structure directory name
+};  
+
+// inline methods
+
+inline G4String AliFiles::Config()
+{ return fgConfig; }
+
+inline G4String AliFiles::DetConfig1()
+{ return fgDetConfig1; }
+
+inline G4String AliFiles::DetConfig2()
+{ return fgDetConfig2; }
+
+inline G4String AliFiles::DetConfig3()
+{ return fgDetConfig3; }
+
+inline G4String AliFiles::DetConfig4()
+{ return fgDetConfig4; }
+
+inline G4String AliFiles::DetConfigName1()
+{ return fgDetConfigName1; }
+
+inline G4String AliFiles::DetConfigName2()
+{ return fgDetConfigName2; }
+
+inline G4String AliFiles::DetData1()
+{ return fgDetData1; }
+
+inline G4String AliFiles::DetData2()
+{ return fgDetData2; }
+
+inline G4String AliFiles::DetData3()
+{ return fgDetData3; }
+
+inline G4String AliFiles::STRUCT()
+{ return fgSTRUCT; }
+
+#endif //ALI_FILES_H
diff --git a/AliGeant4/AliGeant4LinkDef.h b/AliGeant4/AliGeant4LinkDef.h
new file mode 100644 (file)
index 0000000..eecb14d
--- /dev/null
@@ -0,0 +1,11 @@
+// $Id$
+
+#ifdef __CINT__
+
+#pragma link off all globals;
+#pragma link off all classes;
+#pragma link off all functions;
+#pragma link C++ class  AliRunConfiguration;
+
+#endif
diff --git a/AliGeant4/AliGlobals.cxx b/AliGeant4/AliGlobals.cxx
new file mode 100644 (file)
index 0000000..ca9ca15
--- /dev/null
@@ -0,0 +1,103 @@
+// $Id$
+// Category: global
+//
+// See the class description in the header file.
+
+#include "AliGlobals.h"
+
+#include <stdlib.h>
+
+// static data members
+const G4double AliGlobals::fgDefaultCut = 2.0*mm;
+
+AliGlobals::AliGlobals() {
+//
+}
+  
+AliGlobals::~AliGlobals() {
+//
+}
+  
+// static methods
+
+void AliGlobals::Exception(const char* s)
+{
+// Prints error message end exits the program.
+// ---
+
+  if (s)
+  {  cerr << endl << "    " << s << endl; }
+  cerr << "*** AliceException: Aborting execution ***" << endl;   
+  exit(1);
+}
+
+void AliGlobals::Warning(const char* s)
+{
+// Prints warning message.
+// ---
+
+  cerr << "+++ Alice Warning: +++" << endl;   
+  if (s)
+  {  cerr  << "    " << s << endl; }
+  cerr << "++++++++++++++++++++++" << endl;   
+}
+
+#ifdef G4USE_STL
+void AliGlobals::Exception(G4std::string s) {
+//
+  AliGlobals::Exception(s.c_str());
+}
+
+void AliGlobals::Exception(G4String s) {
+//
+   AliGlobals::Exception(s.c_str());
+}
+
+void AliGlobals::Warning(G4std::string s) {
+//
+  AliGlobals::Warning(s.c_str());
+}
+
+void AliGlobals::Warning(G4String s) {
+//
+  AliGlobals::Warning(s.c_str());
+}
+#endif
+
+void AliGlobals::AppendNumberToString(G4String& s, G4int a)
+{
+// Appends number to string.
+// ---
+
+  const char* kpNumber="0123456789";
+  G4String p=""; G4String q="";
+  do 
+  {
+    G4int b=a/10;
+    G4int c=a%10;
+    p=kpNumber[c];
+    q=p.append(q);
+    a=b;        
+  } while (a>0);
+  s.append(q);
+};
+
+G4int AliGlobals::StringToInt(G4String s)
+{
+// Converts one char string to integer number.
+// ---
+
+  // make better
+  if (s=="0") return 0;
+  if (s=="1") return 1;
+  if (s=="2") return 2;
+  if (s=="3") return 3;
+  if (s=="4") return 4;
+  if (s=="5") return 5;
+  if (s=="6") return 6;
+  if (s=="7") return 7;
+  if (s=="8") return 8;
+  if (s=="9") return 9;
+  return -1;
+}
diff --git a/AliGeant4/AliGlobals.h b/AliGeant4/AliGlobals.h
new file mode 100644 (file)
index 0000000..69504ab
--- /dev/null
@@ -0,0 +1,58 @@
+// $Id$
+// Category: global
+//
+// Class for generally used basic functions.
+// It is protected from instantiating (only static data members
+// and static methods are defined).
+
+
+#ifndef ALI_GLOBALS_H
+#define ALI_GLOBALS_H
+
+#include <globals.hh>
+
+#ifdef G4USE_STL
+#include <string>
+#endif
+
+class AliGlobals
+{
+  public:
+    // --> protected
+    // AliGlobals();
+    virtual ~AliGlobals();
+
+    // static methods
+    static void Exception(const char* s=0);
+      // Global error function prints string to cerr, and aborts
+      // program - according to G4Exception.cc
+    static void Warning(const char* s=0);
+      // Global warning function prints string to cerr
+#ifdef G4USE_STL
+    static void Exception(G4std::string s);
+    static void Exception(G4String s);
+    static void Warning(G4std::string s);
+    static void Warning(G4String s);
+#endif
+
+    static void AppendNumberToString(G4String& string, G4int number);
+    static G4int StringToInt(G4String string);
+    
+    // static get methods
+    static G4double DefaultCut();
+
+  protected:
+    AliGlobals();  
+       // only static data members and methods
+    
+  private:       
+    // static data members  
+    static const G4double  fgDefaultCut; //default cut value
+};  
+
+// inline methods
+
+inline G4double AliGlobals::DefaultCut()
+{ return fgDefaultCut; }
+
+#endif //ALI_GLOBALS_H
diff --git a/AliGeant4/AliGunParticle.cxx b/AliGeant4/AliGunParticle.cxx
new file mode 100644 (file)
index 0000000..76d0fa7
--- /dev/null
@@ -0,0 +1,146 @@
+// $Id$
+// Category: event
+//
+// See the class description in the header file.
+
+#include "AliGunParticle.h"
+
+#include <G4ios.hh>
+
+AliGunParticle::AliGunParticle()
+  : fParticleDefinition(0),
+    fParticleMomentum(G4ThreeVector(0., 0., 1.)),
+    fPosition(G4ThreeVector()),
+    fTime(0),
+    fPolarization(G4ThreeVector())
+{
+//
+}
+
+AliGunParticle::AliGunParticle(G4ParticleDefinition* particleDef,
+                   G4ParticleMomentum momentum, G4ThreeVector position, 
+                   G4double time, G4ThreeVector polarization )
+  : fParticleDefinition(particleDef),
+    fParticleMomentum(momentum),
+    fPosition(position),
+    fTime(time),
+    fPolarization(polarization)
+{
+//
+}
+
+AliGunParticle::AliGunParticle( G4ParticleDefinition* particleDef, 
+                   G4ParticleMomentum momentumDir, G4double kinEnergy,
+                  G4ThreeVector position, G4double time, 
+                  G4ThreeVector polarization )
+  : fParticleDefinition(particleDef),
+    fPosition(position),
+    fTime(time),
+    fPolarization(polarization)
+{
+//   
+  G4double mass = fParticleDefinition->GetPDGMass();
+  G4double energy = kinEnergy + mass;
+  G4double pmag = sqrt(energy*energy - mass*mass);
+  fParticleMomentum = pmag*momentumDir;
+}
+
+AliGunParticle::AliGunParticle(const AliGunParticle& right) {
+//
+  fParticleDefinition = right.fParticleDefinition;
+  fParticleMomentum = right.fParticleMomentum;
+  fPosition = right.fPosition; 
+  fTime = right.fTime;
+  fPolarization = right.fPolarization; 
+}
+
+AliGunParticle::~AliGunParticle() {
+//
+}
+
+// operators
+
+AliGunParticle& AliGunParticle::operator=(const AliGunParticle& right)
+{    
+  // check assignement to self
+  if (this == &right) return *this;
+
+  fParticleDefinition = right.fParticleDefinition;
+  fParticleMomentum = right.fParticleMomentum;
+  fPosition = right.fPosition; 
+  fTime = right.fTime;
+  fPolarization = right.fPolarization; 
+  
+  return *this;
+}
+
+G4int AliGunParticle::operator==(const AliGunParticle& right) const 
+{
+//    
+  G4int returnValue = 0;
+  if (fParticleDefinition == right.fParticleDefinition 
+      && fParticleMomentum == right.fParticleMomentum 
+      && fPosition == right.fPosition 
+      && fTime == right.fTime 
+      && fPolarization == right.fPolarization)  returnValue = 1; 
+
+  return returnValue;  
+}
+
+G4int AliGunParticle::operator!=(const AliGunParticle& right) const
+{
+//    
+  G4int returnValue = 1;
+  if (*this == right) returnValue = 0; 
+  
+  return returnValue;
+}
+
+// public methods
+
+void AliGunParticle::Print() const
+{
+// Prints particle properties.
+// ---
+
+  G4cout << "    particle name: ";
+  G4cout << fParticleDefinition->GetParticleName() << endl;
+  G4cout << "    particle momentum: ";
+  G4cout << fParticleMomentum << endl;
+  G4cout << "    particle position: ";
+  G4cout << fPosition << " mm" << endl;
+  G4cout << "    particle time: ";
+  G4cout << fTime     << " s" << endl;
+  G4cout << "    particle polarization: ";
+  G4cout << fPolarization << endl;
+}  
+
+void AliGunParticle::SetKineticEnergy(G4double kinEnergy)
+{
+// Sets kinetic energy.
+// ---
+
+  G4double mass = fParticleDefinition->GetPDGMass();
+  G4double energy = kinEnergy + mass;
+  G4double pmag = sqrt(energy*energy - mass*mass);
+  fParticleMomentum.setMag(pmag); 
+}
+
+G4double AliGunParticle::GetKineticEnergy() const
+{
+// Gets kinetic energy.
+// ---
+
+  G4double mass = fParticleDefinition->GetPDGMass();
+  G4double energy 
+   = sqrt(fParticleMomentum.mag()*fParticleMomentum.mag() + mass*mass);
+  return energy - mass;
+}
+
+
+
+
+
+
+
+
diff --git a/AliGeant4/AliGunParticle.h b/AliGeant4/AliGunParticle.h
new file mode 100644 (file)
index 0000000..34e51f9
--- /dev/null
@@ -0,0 +1,102 @@
+// $Id$
+// Category: event
+//
+// Data type class that stores properties of a gun particle.
+// Used in AliParticleGun.
+
+#ifndef ALI_GUN_PARTICLE_H
+#define ALI_GUN_PARTICLE_H
+
+#include <G4ParticleMomentum.hh>
+#include <G4ParticleDefinition.hh>
+#include <G4ThreeVector.hh>
+#include <globals.hh>
+
+class AliGunParticle
+{
+  public:
+    AliGunParticle();
+    AliGunParticle(G4ParticleDefinition* particleDef, G4ParticleMomentum momentum, 
+       G4ThreeVector position, G4double time, G4ThreeVector polarization );
+    AliGunParticle( G4ParticleDefinition* particleDef, G4ParticleMomentum momentumDir, 
+      G4double kinEnergy, G4ThreeVector position, G4double time, 
+      G4ThreeVector polarization );
+    AliGunParticle(const AliGunParticle& right);
+    ~AliGunParticle();     
+
+    // operators
+    AliGunParticle& operator=(const AliGunParticle& right);
+    G4int operator==(const AliGunParticle& right) const;
+    G4int operator!=(const AliGunParticle& right) const;
+
+    // methods
+    void Print() const;  
+
+    // set methods
+    void SetParticleDefinition(G4ParticleDefinition* particleDef);
+    void SetMomentum(G4ParticleMomentum  momentum);
+    void SetPosition(G4ThreeVector position);
+    void SetTime(G4double time);
+    void SetPolarization(G4ThreeVector polarization);
+    void SetMomentumDirection(G4ParticleMomentum  momentumDir);
+    void SetKineticEnergy(G4double kinEnergy);
+      
+    // get methods  
+    G4ParticleDefinition* GetParticleDefinition() const;
+    G4ParticleMomentum GetMomentum() const;
+    G4ThreeVector GetPosition() const;
+    G4double GetTime() const;
+    G4ThreeVector GetPolarization() const;
+    G4ParticleMomentum GetMomentumDirection() const;
+    G4double GetKineticEnergy() const;
+                         
+  private:
+    // data members
+    G4ParticleDefinition*  fParticleDefinition; //G4ParticleDefinition
+    G4ParticleMomentum     fParticleMomentum;   //G4ParticleMomentum
+    G4ThreeVector          fPosition;           //position
+    G4double               fTime;               //time
+    G4ThreeVector          fPolarization;       //polarization
+};
+
+// inline methods
+
+inline void AliGunParticle::SetParticleDefinition(G4ParticleDefinition* particleDef)
+{ fParticleDefinition = particleDef; }
+
+inline void AliGunParticle::SetMomentum(G4ParticleMomentum  momentum)
+{ fParticleMomentum = momentum; }
+
+inline void AliGunParticle::SetPosition(G4ThreeVector position)
+{ fPosition = position; }
+
+inline void AliGunParticle::SetTime(G4double time)
+{ fTime = time; }
+
+inline void AliGunParticle::SetPolarization(G4ThreeVector polarization)
+{ fPolarization = polarization; }
+
+inline void AliGunParticle::SetMomentumDirection(G4ParticleMomentum  momentumDir)
+{ fParticleMomentum = fParticleMomentum.mag()*momentumDir.unit(); }
+
+inline G4ParticleDefinition* AliGunParticle::GetParticleDefinition() const
+{ return fParticleDefinition; }
+
+inline G4ParticleMomentum AliGunParticle::GetMomentum() const
+{ return fParticleMomentum; }
+
+inline G4ThreeVector AliGunParticle::GetPosition() const
+{ return fPosition; }
+
+inline G4double AliGunParticle::GetTime() const
+{ return fTime; }
+
+inline G4ThreeVector AliGunParticle::GetPolarization() const
+{ return fPolarization; }
+
+inline G4ParticleMomentum AliGunParticle::GetMomentumDirection() const
+{ return fParticleMomentum.unit(); }
+
+#endif //ALI_GUN_PARTICLE_H   
+   
+
diff --git a/AliGeant4/AliLVStructure.cxx b/AliGeant4/AliLVStructure.cxx
new file mode 100644 (file)
index 0000000..3065607
--- /dev/null
@@ -0,0 +1,298 @@
+// $Id$
+// Category: geometry
+//
+// See the class description in the header file.
+
+#include "AliLVStructure.h"
+#include "AliGlobals.h"
+
+#ifdef ALICE_VISUALIZE
+#include "AliColourStore.h"
+
+#include <G4Colour.hh>
+#include <G4VisAttributes.hh>
+#endif //ALICE_VISUALIZE
+#include <globals.hh>
+
+AliLVStructure::AliLVStructure(G4String path)
+  : fPathName(path),
+    fDirName(path),
+    fVerboseLevel(0)
+{
+//
+  G4int i = fDirName.length();
+  if (i > 1) {
+    fDirName.remove(i-1);
+    G4int isl = fDirName.last('/');
+    fDirName.remove(0,isl+1);
+    fDirName += "/";
+  }
+}
+
+AliLVStructure::AliLVStructure(const AliLVStructure& right)
+{
+  // copy vector of structures
+  fStructures.clearAndDestroy();
+  G4int i;
+  for (i=0; i<right.fStructures.entries(); i++) {
+    // new full structure tree has to be created
+    AliLVStructure* rhsStructure = right.fStructures[i];
+    fStructures.insert(new AliLVStructure(*rhsStructure)); 
+  }  
+  
+  // copy vector of logical volumes
+  fLogicalVolumes.clear();
+  for (i=0; i<right.fLogicalVolumes.entries(); i++) {
+    G4LogicalVolume* rhsLV = right.fLogicalVolumes[i];
+    fLogicalVolumes.insert(rhsLV); 
+  }  
+  
+  fPathName = right.fPathName;
+  fDirName = right.fPathName;
+  fVerboseLevel = right.fVerboseLevel;
+}
+
+AliLVStructure::AliLVStructure() {
+//
+}
+
+AliLVStructure::~AliLVStructure() {
+//
+  fStructures.clearAndDestroy();
+  fLogicalVolumes.clear();
+}
+
+// operators
+
+AliLVStructure& AliLVStructure::operator=(const AliLVStructure &right)
+{
+  // check assignement to self
+  if (this == &right) return *this;
+
+  // copy vector of structures
+  fStructures.clearAndDestroy();
+  G4int i;
+  for (i=0; i<right.fStructures.entries(); i++) {
+    // new full structure tree has to be created
+    AliLVStructure* rhsStructure = right.fStructures[i];
+    fStructures.insert(new AliLVStructure(*rhsStructure)); 
+  }  
+  
+  // copy vector of logical volumes
+  fLogicalVolumes.clear();
+  for (i=0; i<right.fLogicalVolumes.entries(); i++) {
+    G4LogicalVolume* rhsLV = right.fLogicalVolumes[i];
+    fLogicalVolumes.insert(rhsLV); 
+  }  
+  
+  fPathName = right.fPathName;
+  fDirName = right.fPathName;
+  fVerboseLevel = right.fVerboseLevel;
+
+  return *this;
+}
+
+G4int AliLVStructure::operator==(const AliLVStructure &right) const
+{
+  // check == to self
+  if (this == &right) return true;
+
+  return false;
+}
+
+// private methods
+
+AliLVStructure* AliLVStructure::FindSubDirectory(G4String subDir)
+{
+// Finds the subdirectory.
+// ---
+
+  for( G4int i=0; i<fStructures.entries(); i++ ) {
+    if (subDir == fStructures(i)->fDirName) return fStructures(i);
+  } 
+  return 0;
+}
+
+G4String AliLVStructure::ExtractDirName(G4String name)
+{
+// Extracts the directory name from the path.
+// ---
+
+  G4String subDir = name;
+  G4int i = name.first('/');
+  if (i != G4std::string::npos) subDir.remove(i+1);
+  return subDir;
+}
+
+// public methods
+
+void AliLVStructure::AddNewVolume(G4LogicalVolume* lv, 
+                      G4String treeStructure)
+{
+// Adds new logical volume to the structure.
+// ---
+
+  G4String remainingPath = treeStructure;
+  remainingPath.remove(0, fPathName.length());  
+  if (!remainingPath.isNull()) { 
+    // The lv should be kept in subdirectory.
+    // First, check if the subdirectoy exists.
+    G4String subDir = ExtractDirName( remainingPath );
+    AliLVStructure* targetLVS = FindSubDirectory(subDir);
+    if (targetLVS == 0) { 
+      // Subdirectory not found. Create a new directory.
+      subDir.prepend(fPathName);
+      targetLVS = new AliLVStructure(subDir);
+      fStructures.insert( targetLVS );
+    }
+    targetLVS->AddNewVolume(lv, treeStructure);
+  }
+  else { 
+    // the logical volumes should be kept in this directory.
+    G4LogicalVolume* targetLV = GetVolume(lv->GetName());
+    if (targetLV != 0) {
+      // G4cout << lv->GetName() << " had already stored in "
+      //        << fPathName << endl;
+    }
+    else {
+      fLogicalVolumes.insert(lv);
+    }
+  }
+}
+
+G4LogicalVolume* AliLVStructure::GetVolume(G4String lvName)
+{
+// Returns logical volume of lvName if present in the structure,
+// returns 0 otherwise.
+// ---
+
+  for (G4int i=0; i<fLogicalVolumes.entries(); i++) {
+    G4LogicalVolume* targetLV = fLogicalVolumes(i);
+    if (lvName == targetLV->GetName()) return targetLV;
+  }
+  return 0;
+}
+
+G4LogicalVolume* AliLVStructure::FindVolume(G4String name)
+{
+// Finds logical volume of given name in all structure tree.
+// ---
+
+  G4String path = name;
+  path.remove(0, fPathName.length());
+  if (path.first('/') != G4std::string::npos) { 
+    // SD exists in sub-directory
+    G4String subDir = ExtractDirName(path);
+    AliLVStructure* targetLVS = FindSubDirectory(subDir);
+    if (targetLVS == 0) {  
+      // The subdirectory is not found
+      G4String text = subDir + " is not found in " + fPathName;
+      AliGlobals:: Warning(text);
+      return 0;
+    }
+    else { 
+      return targetLVS->FindVolume(name); 
+    }
+  }
+  else { 
+    // LV must exist in this directory
+    G4LogicalVolume* targetLV = GetVolume(path);
+    if (targetLV == 0) {  
+      // The fLogicalVolumes is not found.
+      G4String text = path + " is not found in " + fPathName;
+      AliGlobals::Warning(text);
+    }
+    return targetLV;
+  }
+}
+
+void AliLVStructure::ListTree() const
+{
+// Prints LV tree structure.
+// ---
+
+  for (G4int i=0; i<fLogicalVolumes.entries(); i++) {
+    G4LogicalVolume* lv = fLogicalVolumes(i);
+    G4cout << fPathName << lv->GetName() << endl;
+  }
+  for (G4int j=0; j<fStructures.entries(); j++) { 
+    fStructures(j)->ListTree(); 
+  }
+}
+        
+void AliLVStructure::ListTreeLong() const
+{
+// Prints LV tree structure with number of
+// daughters (physical volume)
+// ---
+
+  for (G4int i=0; i<fLogicalVolumes.entries(); i++) {
+    G4LogicalVolume* lv = fLogicalVolumes(i);
+    G4cout << fPathName << lv->GetName() 
+           << " (" << lv->GetNoDaughters() << ")" << endl;
+  }
+  for (G4int j=0; j<fStructures.entries(); j++) { 
+    fStructures(j)->ListTreeLong(); 
+  }
+}
+        
+void AliLVStructure::SetVerboseLevel(G4int verbose) 
+{
+// Sets verbose level.
+// ---
+
+  fVerboseLevel = verbose;  
+  for (G4int i=0; i<fStructures.entries(); i++) { 
+    fStructures(i)->SetVerboseLevel(verbose); 
+  }
+}
+
+#ifdef ALICE_VISUALIZE
+void AliLVStructure::SetTreeVisibility(G4bool visibility)       
+{
+// Sets visibility to all logical volumes in the structure 
+// tree.
+// ---
+
+  for (G4int i=0; i<fLogicalVolumes.entries(); i++) {
+    G4LogicalVolume* lv = fLogicalVolumes(i);
+
+    const G4VisAttributes* kpVisAttributes = lv->GetVisAttributes ();
+    G4VisAttributes* newVisAttributes = new G4VisAttributes(kpVisAttributes); 
+    delete kpVisAttributes;
+
+    newVisAttributes->SetVisibility(visibility); 
+
+    lv->SetVisAttributes(newVisAttributes);
+  }
+  for (G4int j=0; j<fStructures.entries(); j++) { 
+    fStructures(j)->SetTreeVisibility(visibility); 
+  }
+}
+
+void AliLVStructure::SetTreeColour(G4String colName)
+{
+// Sets colour specified  by name to all logical volumes
+// in the structure tree.
+// ---
+
+  for (G4int i=0; i<fLogicalVolumes.entries(); i++) {
+    G4LogicalVolume* lv = fLogicalVolumes(i);
+
+    const G4VisAttributes* kpVisAttributes = lv->GetVisAttributes ();
+    G4VisAttributes* newVisAttributes = new G4VisAttributes(kpVisAttributes); 
+    delete kpVisAttributes;
+
+    AliColourStore* pColours = AliColourStore::Instance();
+    G4Colour colour = pColours->GetColour(colName);
+    newVisAttributes->SetColour(colour);
+
+    lv->SetVisAttributes(newVisAttributes);
+  }
+  for (G4int j=0; j<fStructures.entries(); j++) { 
+    fStructures(j)->SetTreeColour(colName); 
+  }
+}
+#endif             
+
+
diff --git a/AliGeant4/AliLVStructure.h b/AliGeant4/AliLVStructure.h
new file mode 100644 (file)
index 0000000..c2837ed
--- /dev/null
@@ -0,0 +1,66 @@
+// $Id$
+// Category: geometry
+//
+// Class that associates the name tree with logical volumes tree. 
+// Used for printing volumes trees.  
+
+#ifndef ALI_LV_STRUCTURE_H
+#define ALI_LV_STRUCTURE_H
+
+#include <G4LogicalVolume.hh>
+#include <globals.hh>
+
+#include <g4rw/tpordvec.h>
+
+class AliLVStructure 
+{
+  public:
+    AliLVStructure(G4String aPath);
+    AliLVStructure(const AliLVStructure& right);
+    // --> protected 
+    // AliLVStructure();
+    virtual ~AliLVStructure();
+
+    // operators
+    AliLVStructure& operator=(const AliLVStructure& right);
+    G4int operator==(const AliLVStructure &right) const;
+
+    // methods
+    void AddNewVolume(G4LogicalVolume* lv, G4String treeStructure);
+    void ListTree() const;
+    void ListTreeLong() const;
+
+    // set methods
+    void SetVerboseLevel(G4int verbose); 
+#ifdef ALICE_VISUALIZE
+    void SetTreeVisibility(G4bool visibility);       
+    void SetTreeColour(G4String colName);
+#endif             
+
+    // get methods
+    G4LogicalVolume* GetVolume(G4String name);
+    G4LogicalVolume* FindVolume(G4String name);
+
+  protected:
+    AliLVStructure(); 
+
+  private:
+    // methods
+    AliLVStructure* FindSubDirectory(G4String subDir);
+    G4String ExtractDirName(G4String path);
+
+    // data members
+    G4RWTPtrOrderedVector<AliLVStructure>   fStructures;                     //.
+                                                //vector of
+                                                //contained structures
+    G4RWTPtrOrderedVector<G4LogicalVolume>  fLogicalVolumes;                 //.
+                                                //vector of
+                                                //contained logical volumes
+                                               //(parallel to fStructures)
+    G4String  fPathName;     //full path name
+    G4String  fDirName;      //directory name
+    G4int     fVerboseLevel; //verbose level
+};
+
+#endif //ALI_LV_STRUCTURE_H
+
diff --git a/AliGeant4/AliLegoSensitiveDetector.cxx b/AliGeant4/AliLegoSensitiveDetector.cxx
new file mode 100644 (file)
index 0000000..fcf85fc
--- /dev/null
@@ -0,0 +1,91 @@
+// $Id$ //
+// Category: geometry
+//
+// See the class description in the header file.
+
+#include "AliLegoSensitiveDetector.h"
+#include "AliLego.h"
+
+#include "TG4StepManager.h"
+
+AliLegoSensitiveDetector::AliLegoSensitiveDetector(
+                             G4String name, AliLego* lego, 
+                            G4VSensitiveDetector* standardSD)
+  : TG4VSensitiveDetector(name),
+    fLego(lego),
+    fStandardSD(standardSD),
+    fStepManager(TG4StepManager::Instance())
+{
+//
+}
+
+AliLegoSensitiveDetector::AliLegoSensitiveDetector(
+                                 const AliLegoSensitiveDetector& right)
+  : TG4VSensitiveDetector(right)                            
+{
+//
+  fLego = right.fLego;
+  fStandardSD = right.fStandardSD;
+  fStepManager = right.fStepManager;
+}
+
+AliLegoSensitiveDetector::AliLegoSensitiveDetector() {
+//
+}
+
+AliLegoSensitiveDetector::~AliLegoSensitiveDetector() {
+//
+}
+
+// operators
+
+AliLegoSensitiveDetector& 
+AliLegoSensitiveDetector::operator=(const AliLegoSensitiveDetector &right)
+{
+  // check assignement to self
+  if (this == &right) return *this;
+  
+  // base class assignement
+  TG4VSensitiveDetector::operator=(right);
+
+  fLego = right.fLego;
+  fStandardSD = right.fStandardSD;
+  fStepManager = right.fStepManager;
+  
+  return *this;
+}
+
+// public methods
+
+void AliLegoSensitiveDetector::Initialize(G4HCofThisEvent* hc)
+{
+// This method is called at the beginning of event action
+// before user defined BeginOfEventAction() method.
+}
+
+G4bool AliLegoSensitiveDetector::ProcessHits(G4Step* step, G4TouchableHistory*)
+{
+// Calls StepManager of associated lego.
+// ---
+
+  // let lego process step
+  fStepManager->SetStep(step);
+  fLego->StepManager();
+
+  return true;
+}
+
+void AliLegoSensitiveDetector::EndOfEvent(G4HCofThisEvent* hce){
+//
+}
+
+//void AliLegoSensitiveDetector::clear()
+//{} 
+
+void AliLegoSensitiveDetector::PrintAll() {
+//
+} 
+
+void AliLegoSensitiveDetector::DrawAll() {
+//
+} 
diff --git a/AliGeant4/AliLegoSensitiveDetector.h b/AliGeant4/AliLegoSensitiveDetector.h
new file mode 100644 (file)
index 0000000..b48ccac
--- /dev/null
@@ -0,0 +1,62 @@
+// $Id$
+// Category: geometry
+//
+// Special sensitive detector class for lego run.
+// It implements G4VSensitiveDetector::ProcessHits() 
+// with AliLego:: StepManager().
+
+#ifndef ALI_LEGO_SENSITIVE_DETECTOR_H
+#define ALI_LEGO_SENSITIVE_DETECTOR_H
+
+#include "TG4VSensitiveDetector.h"
+
+#include <globals.hh>
+
+class AliLego;
+class TG4StepManager;
+
+class G4HCofThisEvent;
+class G4Step;
+
+class AliLegoSensitiveDetector : public TG4VSensitiveDetector
+{
+  public:
+    AliLegoSensitiveDetector(G4String name, AliLego* lego,
+                             G4VSensitiveDetector* standardSD);
+    AliLegoSensitiveDetector(const AliLegoSensitiveDetector& right);
+    // --> protected
+    // AliLegoSensitiveDetector();
+    virtual ~AliLegoSensitiveDetector();
+
+    // operators
+    AliLegoSensitiveDetector& operator=(const AliLegoSensitiveDetector& right);
+
+    // methods
+    virtual void Initialize(G4HCofThisEvent* hc);
+    virtual G4bool ProcessHits(G4Step* step, G4TouchableHistory* history);
+    virtual void EndOfEvent(G4HCofThisEvent* hce);
+    //virtual void clear();
+    virtual void PrintAll();
+    virtual void DrawAll();
+    
+    // get methods
+    G4VSensitiveDetector* GetStandardSD() const;
+    
+  protected:  
+    AliLegoSensitiveDetector();
+    
+  private:
+    // data members
+    AliLego*               fLego;        //lego from AliRoot
+    G4VSensitiveDetector*  fStandardSD;  //standard sensitive detector
+    TG4StepManager*        fStepManager; //TG4StepManager
+};
+
+// inline methods
+
+inline G4VSensitiveDetector* AliLegoSensitiveDetector::GetStandardSD() const
+{ return fStandardSD; }
+
+#endif //ALI_LEGO_SENSITIVE_DETECTOR_H
+
+
diff --git a/AliGeant4/AliMagneticField.cxx b/AliGeant4/AliMagneticField.cxx
new file mode 100644 (file)
index 0000000..234f058
--- /dev/null
@@ -0,0 +1,92 @@
+// $Id$
+// Category: geometry
+//
+// According to:
+// Id: ExN02MagneticField.cc,v 1.1 1999/01/07 16:05:49 gunter Exp 
+// GEANT4 tag Name: geant4-00-01
+
+#include "AliMagneticField.h"
+
+#include <G4FieldManager.hh>
+#include <G4TransportationManager.hh>
+
+//  Constructors
+
+AliMagneticField::AliMagneticField()
+  : G4UniformMagField(G4ThreeVector()) 
+{
+//
+  GetGlobalFieldManager()->CreateChordFinder(this);
+}
+
+AliMagneticField::AliMagneticField(G4ThreeVector fieldVector)
+  : G4UniformMagField(fieldVector)
+{    
+//
+  GetGlobalFieldManager()->CreateChordFinder(this);
+}
+
+AliMagneticField::AliMagneticField(const AliMagneticField& right)
+  : G4UniformMagField(right)
+{
+//  
+  GetGlobalFieldManager()->CreateChordFinder(this);
+}
+
+AliMagneticField::~AliMagneticField() {
+//
+}
+
+// operators
+
+AliMagneticField& 
+AliMagneticField::operator=(const AliMagneticField& right)
+{                                
+  // check assignement to self
+  if (this == &right) return *this;
+
+  // base class assignement
+  G4UniformMagField::operator=(right);
+  
+  return *this;
+}  
+
+// public methods
+
+void AliMagneticField::SetFieldValue(G4double fieldValue)
+{
+// Sets the value of the Global Field to fieldValue along Z.
+// ---
+
+  G4UniformMagField::SetFieldValue(G4ThreeVector(0,0,fieldValue));
+}
+
+void AliMagneticField::SetFieldValue(G4ThreeVector fieldVector)
+{
+// Sets the value of the Global Field.
+// ---
+
+  // Find the Field Manager for the global field
+  G4FieldManager* fieldMgr= GetGlobalFieldManager();
+    
+  if(fieldVector!=G4ThreeVector(0.,0.,0.)) { 
+    G4UniformMagField::SetFieldValue(fieldVector); 
+    fieldMgr->SetDetectorField(this);
+  } 
+  else {
+    // If the new field's value is Zero, then it is best to
+    //  insure that it is not used for propagation.
+    G4MagneticField* magField = NULL;
+    fieldMgr->SetDetectorField(magField);
+  }
+}
+
+G4FieldManager*  AliMagneticField::GetGlobalFieldManager()
+{
+// Utility method/
+// ---
+
+  return G4TransportationManager::GetTransportationManager()
+           ->GetFieldManager();
+}
+    
diff --git a/AliGeant4/AliMagneticField.h b/AliGeant4/AliMagneticField.h
new file mode 100644 (file)
index 0000000..c837312
--- /dev/null
@@ -0,0 +1,40 @@
+//  $Id$
+// Category: geometry
+//
+// Uniform magnetic field.
+// According to:
+// Id: ExN02MagneticField.hh,v 1.1 1999/01/07 16:05:47 gunter Exp 
+// GEANT4 tag Name: geant4-00-01 
+
+#ifndef ALI_MAGNETIC_FIELD_H
+#define ALI_MAGNETIC_FIELD_H
+
+#include <G4UniformMagField.hh>
+
+class G4FieldManager;
+
+class AliMagneticField: public G4UniformMagField
+{
+  public:
+    AliMagneticField();                   //  A zero field
+    AliMagneticField(G4ThreeVector fied); //  The value of the field
+    AliMagneticField(const AliMagneticField& right);
+    virtual ~AliMagneticField();  
+      
+    // operators
+    AliMagneticField& operator=(const AliMagneticField& right);
+
+    // set methods
+    void SetFieldValue(G4ThreeVector fieldVector);
+    void SetFieldValue(G4double      fieldValue);
+              // Set the field to (0, 0, fieldValue)
+
+    // get methods
+    G4ThreeVector GetConstantFieldValue();
+
+  protected:
+    // Find the global Field Manager
+    G4FieldManager* GetGlobalFieldManager(); 
+};
+
+#endif //ALI_MAGNETIC_FIELD_H
diff --git a/AliGeant4/AliModuleConstruction.cxx b/AliGeant4/AliModuleConstruction.cxx
new file mode 100644 (file)
index 0000000..a9da9bc
--- /dev/null
@@ -0,0 +1,347 @@
+// $Id$
+// Category: geometry
+//
+// See the class description in the header file.
+
+#include "AliModuleConstruction.h"
+#include "AliGlobals.h"
+#include "AliLVStructure.h"
+
+#ifdef ALICE_VISUALIZE
+#include "AliColourStore.h"
+
+#include <G4Colour.hh>
+#include <G4VisAttributes.hh>
+#endif //ALICE_VISUALIZE
+#include <G4LogicalVolumeStore.hh>
+#include <G4LogicalVolume.hh>
+
+#include <fstream.h>
+
+AliModuleConstruction::AliModuleConstruction(G4String moduleName) 
+  : fModuleName(moduleName), 
+    fModuleFrameName(moduleName),
+    fModuleFrameLV(0),
+    fAliModule(0),
+    fReadGeometry(false),
+    fWriteGeometry(false),
+    fDataFilePath("")    
+{
+//
+  moduleName.toLower();
+  fMessenger = new AliModuleConstructionMessenger(this, moduleName);
+}
+
+AliModuleConstruction::AliModuleConstruction(const AliModuleConstruction& right)
+{
+//
+  fModuleName = right.fModuleName; 
+  fModuleFrameName = right.fModuleFrameName;
+  fModuleFrameLV = right.fModuleFrameLV;
+  fAliModule = right.fAliModule;
+  fReadGeometry = right.fReadGeometry;
+  fWriteGeometry = right.fWriteGeometry;
+  fDataFilePath = right.fDataFilePath;
+
+  // new messenger
+  G4String moduleName = fModuleName;
+  moduleName.toLower();
+  fMessenger = new AliModuleConstructionMessenger(this, moduleName);
+}
+
+AliModuleConstruction::AliModuleConstruction()
+  : fModuleName(""), 
+    fModuleFrameName(""),
+    fModuleFrameLV(0),
+    fMessenger(0),
+    fAliModule(0),
+    fReadGeometry(false),
+    fWriteGeometry(false),
+    fDataFilePath("")    
+{
+//
+}
+
+AliModuleConstruction::~AliModuleConstruction()
+{
+//
+  delete fMessenger;
+  delete fAliModule;
+}
+
+// operators
+
+AliModuleConstruction& 
+AliModuleConstruction::operator=(const AliModuleConstruction& right)
+{    
+  // check assignement to self
+  if (this == &right) return *this;
+  
+  fModuleName = right.fModuleName; 
+  fModuleFrameName = right.fModuleFrameName;
+  fModuleFrameLV = right.fModuleFrameLV;
+  fAliModule = right.fAliModule;
+  fReadGeometry = right.fReadGeometry;
+  fWriteGeometry = right.fWriteGeometry;
+  fDataFilePath = right.fDataFilePath;
+
+  return *this;
+}
+
+G4int 
+AliModuleConstruction::operator==(const AliModuleConstruction& right) const
+{
+//    
+  return 0;
+}
+
+G4int 
+AliModuleConstruction::operator!=(const AliModuleConstruction& right) const
+{
+//    
+  G4int returnValue = 1;
+  if (*this == right) returnValue = 0; 
+  
+  return returnValue;
+}
+
+// protected methods
+
+void AliModuleConstruction::RegisterLogicalVolume(G4LogicalVolume* lv,
+       G4String path, AliLVStructure& lvStructure)
+{
+// Registers logical volume lv in the structure.
+// ---        
+
+  G4String lvName = lv->GetName();
+  lvStructure.AddNewVolume(lv, path);
+  
+  // register daughters
+  G4int nofDaughters = lv->GetNoDaughters();
+  if (nofDaughters>0) {
+    G4String previousName = "";
+    for (G4int i=0; i<nofDaughters; i++) {
+      G4LogicalVolume* lvd = lv->GetDaughter(i)->GetLogicalVolume();
+      G4String currentName = lvd->GetName();
+      if (currentName != lvName && currentName != previousName) { 
+        G4String newPath = path + lvName +"/";
+        RegisterLogicalVolume(lvd, newPath, lvStructure);
+       previousName = currentName;
+      }
+    }
+  }     
+}          
+
+// public methods
+
+void AliModuleConstruction::SetDetFrame(G4bool warn)
+{ 
+// The logical volume with name identical with
+// fModuleName is retrieved from G4LogicalVolumeStore.
+// ---
+
+  fModuleFrameLV = FindLogicalVolume(fModuleFrameName, true);
+  
+  if (fModuleFrameLV == 0 && warn) {
+    G4String text = "AliModuleConstruction: Detector frame for ";
+    text = text + fModuleFrameName + " has not been found.";
+    AliGlobals::Warning(text); 
+  }  
+}
+
+void AliModuleConstruction::SetDetFrame(G4String frameName, G4bool warn)
+{ 
+// The logical volume with frameName
+// is retrieved from G4LogicalVolumeStore.
+// ---
+
+  fModuleFrameName = frameName;
+  SetDetFrame(warn);
+}
+
+void AliModuleConstruction::ListAllLVTree()
+{
+// Lists all logical volumes tree if the frame logical volume 
+// is defined.
+// ---- 
+
+  if (fModuleFrameLV) 
+    ListLVTree(fModuleFrameLV->GetName());
+  else {
+    G4String text = "AliModuleConstruction::ListAllLVTree:\n";
+    text = text + "    Detector frame is not defined.";    
+    AliGlobals::Warning(text);
+  }   
+}
+
+void AliModuleConstruction::ListAllLVTreeLong()
+{
+// Lists all logical volume tree if the frame logical volume 
+// is defined with numbers of daughters (physical volumes).
+// ---- 
+
+  if (fModuleFrameLV) 
+    ListLVTreeLong(fModuleFrameLV->GetName());
+  else {
+    G4String text = "AliModuleConstruction::ListAllLVTreeLong:\n";
+    text = text + "    Detector frame is not defined.";    
+    AliGlobals::Warning(text);
+  }  
+}
+
+void AliModuleConstruction::ListLVTree(G4String lvName)
+{
+// Lists logical volumes tree (daughters) of the logical volume 
+// with specified lvName.
+// ---- 
+
+  G4LogicalVolume* lv = FindLogicalVolume(lvName);
+  if (lv)
+  {
+    G4String path = "";
+    AliLVStructure lvStructure(path);
+    RegisterLogicalVolume(lv, path, lvStructure);
+    lvStructure.ListTree();
+  }
+}
+
+void AliModuleConstruction::ListLVTreeLong(G4String lvName)
+{
+// Lists logical volumes tree (daughters) of the logical volume 
+// with specified lvName with numbers of daughters (physical volumes).
+// ---- 
+
+  G4LogicalVolume* lv = FindLogicalVolume(lvName);
+  if (lv) {
+    G4String path = "";
+    AliLVStructure lvStructure(path);
+    RegisterLogicalVolume(lv, path, lvStructure);
+    lvStructure.ListTreeLong();
+  }
+}
+
+G4LogicalVolume* AliModuleConstruction::FindLogicalVolume(
+                                          G4String name, G4bool silent) const
+{
+// Finds logical volume with specified name in G4LogicalVolumeStore.
+// (To do: use this method only for retrieving detector frame;
+//  add method FindLogicalVolumeInDet - that will search only
+//  in the detector frame LVTree.)
+// ---
+
+  G4LogicalVolumeStore* pLVStore = G4LogicalVolumeStore::GetInstance();
+  
+  for (G4int i=0; i<pLVStore->entries(); i++) {
+    G4LogicalVolume* lv = pLVStore->at(i);
+    if (lv->GetName() == name) return lv;
+  }
+  
+  G4String text = "AliModuleConstruction: Logical volume "; 
+  text = text + name + " does not exist.";
+  if (!silent) AliGlobals::Warning(text);
+  return 0;                     
+}  
+
+#ifdef ALICE_VISUALIZE
+
+void AliModuleConstruction::SetDetVisibility(G4bool visibility)
+{
+// Sets visibility to all detector logical volumes if
+// frame logical volume is defined.
+// ---
+
+  if (fModuleFrameLV) 
+    SetLVTreeVisibility(fModuleFrameLV, visibility);  
+  else  {
+    G4String text = "AliModuleConstruction::SetDetVisibility:\n";
+    text = text + "    Detector frame is not defined.";    
+    AliGlobals::Warning(text);
+  }  
+}
+
+
+void AliModuleConstruction::SetLVTreeVisibility(G4LogicalVolume* lv, 
+                             G4bool visibility)
+{ 
+// Sets visibility to the logical volumes tree (daughters) of 
+// the logical volume lv.
+// ---
+
+  if (lv) {
+    G4String path = "";
+    AliLVStructure lvStructure(path);
+    RegisterLogicalVolume(lv, path, lvStructure);
+    lvStructure.SetTreeVisibility(visibility);
+  }
+}
+
+void AliModuleConstruction::SetVolumeVisibility(G4LogicalVolume* lv, 
+                             G4bool visibility)
+{ 
+// Sets visibility to the specified logical volume.
+// ---
+
+  if (lv) {
+    const G4VisAttributes* kpVisAttributes = lv->GetVisAttributes ();
+    G4VisAttributes* newVisAttributes = new G4VisAttributes(kpVisAttributes); 
+    delete kpVisAttributes;
+
+    newVisAttributes->SetVisibility(visibility); 
+
+    lv->SetVisAttributes(newVisAttributes);
+  }
+}
+
+void AliModuleConstruction::SetDetColour(G4String colName)
+{
+// Sets colour to all detector logical volumes if
+// frame logical volume is defined.
+// ---
+
+  if (fModuleFrameLV) 
+    SetLVTreeColour(fModuleFrameLV, colName);  
+  else { 
+    G4String text = "AliModuleConstruction::SetDetColour:\n";
+    text = text + "    Detector frame is not defined.";    
+    AliGlobals::Warning(text);
+  }  
+}
+
+void AliModuleConstruction::SetLVTreeColour(G4LogicalVolume* lv, 
+                             G4String colName)
+{ 
+// Sets colour to the logical volumes tree (daughters) of 
+// the logical volume lv.
+// ---
+
+  if (lv) {
+    G4String path = "";
+    AliLVStructure lvStructure(path);
+    RegisterLogicalVolume(lv, path, lvStructure);
+    lvStructure.SetTreeVisibility(true);
+    lvStructure.SetTreeColour(colName);
+  }
+}
+
+void AliModuleConstruction::SetVolumeColour(G4LogicalVolume* lv,
+                             G4String colName)
+{
+// Sets colour to the specified logical volume.
+// ---
+
+  if (lv) {
+    const G4VisAttributes* kpVisAttributes = lv->GetVisAttributes ();
+    G4VisAttributes* newVisAttributes = new G4VisAttributes(kpVisAttributes); 
+    delete kpVisAttributes;
+
+    AliColourStore* pColours = AliColourStore::Instance();
+    const G4Colour kColour = pColours->GetColour(colName);
+    newVisAttributes->SetVisibility(true); 
+    newVisAttributes->SetColour(kColour);
+
+    lv->SetVisAttributes(newVisAttributes);
+  }      
+}
+
+#endif //ALICE_VISUALIZE
+
diff --git a/AliGeant4/AliModuleConstruction.h b/AliGeant4/AliModuleConstruction.h
new file mode 100644 (file)
index 0000000..32382a0
--- /dev/null
@@ -0,0 +1,125 @@
+// $Id$
+// Category: geometry
+//
+// Abstract base class for modular construction of geometry,
+// providing methods for browsing geometry (list volumes trees, 
+// visualization).
+
+#ifndef ALI_MODULE_CONSTRUCTION_H
+#define ALI_MODULE_CONSTRUCTION_H
+
+#include "AliModuleConstructionMessenger.h"
+#include "AliModule.h"
+
+#include <globals.hh>
+#ifdef ALICE_VISUALIZE
+#include <G4VisAttributes.hh>
+#endif
+
+class AliLVStructure;
+
+class G4VPhysicalVolume;
+class G4LogicalVolume;
+#ifdef ALICE_VISUALIZE
+class G4Colour;
+#endif
+
+class AliModuleConstruction
+{
+  public:
+    AliModuleConstruction(G4String moduleName);
+    AliModuleConstruction(const AliModuleConstruction& right);
+    // --> protected
+    // AliModuleConstruction();
+    virtual ~AliModuleConstruction();
+
+    // operators
+    AliModuleConstruction& operator=(const AliModuleConstruction &right);
+    G4int operator==(const AliModuleConstruction& right) const;
+    G4int operator!=(const AliModuleConstruction& right) const;
+
+    // methods
+    virtual void Construct() = 0;
+    void ListAllLVTree();
+    void ListAllLVTreeLong();
+    void ListLVTree(G4String lvName);
+    void ListLVTreeLong(G4String lvName);
+    G4LogicalVolume* FindLogicalVolume(G4String name, 
+                                       G4bool silent = false) const;
+
+    // set methods
+    void SetDetFrame(G4bool warn = true);
+    void SetDetFrame(G4String frameName, G4bool warn = true);
+    void SetReadGeometry(G4bool readGeometry);
+    void SetWriteGeometry(G4bool writeGeometry);
+#ifdef ALICE_VISUALIZE
+    void SetDetVisibility(G4bool visibility);
+    void SetLVTreeVisibility(G4LogicalVolume* lv, G4bool visibility);
+    void SetVolumeVisibility(G4LogicalVolume* lv, G4bool visibility);
+    void SetDetColour(G4String colName);
+    void SetLVTreeColour(G4LogicalVolume* lv, G4String colName);
+    void SetVolumeColour(G4LogicalVolume* lv, G4String colName);     
+#endif
+
+    // get methods
+    G4String GetDetName() const;
+    G4LogicalVolume* GetDetFrame() const;
+    AliModule* GetAliModule() const;
+    G4bool GetReadGeometry() const;
+    G4bool GetWriteGeometry() const;
+    G4String GetDataFilePath() const;
+
+  protected:
+    AliModuleConstruction(); 
+
+    // data members
+    G4String            fModuleName;      //module name
+    G4String            fModuleFrameName; //module frame name
+                                          //(used for retrieving the frame LV)
+    G4LogicalVolume*    fModuleFrameLV;   //module frame logical volume
+
+    // to be moved to AliSingleModuleConstruction
+    // in order to make AliModuleConstruction independent on
+    // AliRoot
+    AliModule*          fAliModule;       //AliModule
+    G4bool              fReadGeometry;    //if true: geometry is read from file
+    G4bool              fWriteGeometry;   //if true: geometry is written to file
+    G4String            fDataFilePath;    //path to geometry data file
+
+  private:
+    // methods
+    void RegisterLogicalVolume(G4LogicalVolume* lv, G4String path, 
+           AliLVStructure& lvStructure);
+
+    // data members
+    AliModuleConstructionMessenger*  fMessenger; //messenger     
+};
+
+// inline methods
+
+inline void AliModuleConstruction::SetReadGeometry(G4bool readGeometry)
+{ fReadGeometry = readGeometry; }  
+
+inline void AliModuleConstruction::SetWriteGeometry(G4bool writeGeometry)
+{ fWriteGeometry = writeGeometry; }  
+
+inline G4String AliModuleConstruction::GetDetName() const
+{ return fModuleName; }
+
+inline G4LogicalVolume* AliModuleConstruction::GetDetFrame() const
+{ return fModuleFrameLV; }
+
+inline AliModule* AliModuleConstruction::GetAliModule() const
+{ return fAliModule; }
+
+inline G4bool AliModuleConstruction::GetReadGeometry() const
+{ return fReadGeometry; }
+
+inline G4bool AliModuleConstruction::GetWriteGeometry() const
+{ return fWriteGeometry; }
+
+inline G4String AliModuleConstruction::GetDataFilePath() const
+{ return fDataFilePath; }
+
+#endif //ALI_MODULE_CONSTRUCTION_H
+
diff --git a/AliGeant4/AliModuleConstructionMessenger.cxx b/AliGeant4/AliModuleConstructionMessenger.cxx
new file mode 100644 (file)
index 0000000..94a1cd5
--- /dev/null
@@ -0,0 +1,234 @@
+// $Id$
+// Category: geometry
+//
+// See the class description in the header file.
+
+#include "AliModuleConstructionMessenger.h"
+#include "AliModuleConstruction.h"
+#include "AliGlobals.h"
+#ifdef ALICE_VISUALIZE
+#include "AliColourStore.h"
+#endif
+
+#include <G4UIdirectory.hh>
+#include <G4UIcmdWithABool.hh>
+#include <G4UIcmdWithAString.hh>
+#include <G4UIcmdWithoutParameter.hh>
+#include <G4LogicalVolume.hh>
+
+AliModuleConstructionMessenger::AliModuleConstructionMessenger(
+   AliModuleConstruction* moduleConstruction, G4String moduleName)
+ : fModuleConstruction(moduleConstruction)
+{
+//
+  G4String dirName = "/aliDet/"; 
+  dirName = dirName + moduleName + "/"; 
+  fModuleDirectory = new G4UIdirectory(dirName);
+  G4String guidance = "AlSubDetConstruction ";
+  guidance = guidance + moduleName + " control commands.";
+  fModuleDirectory->SetGuidance(guidance);
+
+  G4String commandPath = dirName + "setFrame";
+  fSetFrameCmd= new G4UIcmdWithAString(commandPath, this);
+  fSetFrameCmd ->SetGuidance("Set detector frame");
+  fSetFrameCmd->SetParameterName("frameName", false);
+  fSetFrameCmd->AvailableForStates(PreInit, Idle);  
+  commandPath = dirName + "list";
+  fListCmd = new G4UIcmdWithoutParameter(commandPath, this);
+  guidance = "List all logical volumes of ";
+  guidance = guidance + moduleName + " detector";
+  fListCmd->SetGuidance(guidance);
+  fListCmd->AvailableForStates(PreInit,Idle);  
+  commandPath = dirName + "listLong";
+  fListLongCmd = new G4UIcmdWithoutParameter(commandPath, this);
+  fListLongCmd
+    ->SetGuidance("List all logical volumes and number of its physical volumes");
+  guidance = "of " + moduleName + " detector";
+  fListLongCmd->SetGuidance(guidance);
+  fListLongCmd->AvailableForStates(PreInit,Idle);  
+  commandPath = dirName + "listDaughters";
+  fListDaughtersCmd = new G4UIcmdWithAString(commandPath, this);
+  fListDaughtersCmd->SetGuidance("List daughters of the given logical volumes");
+  fListDaughtersCmd->SetParameterName("lvName", false);
+  fListDaughtersCmd->AvailableForStates(PreInit,Idle);  
+  commandPath = dirName + "listLongDaughters";
+  fListLongDaughtersCmd = new G4UIcmdWithAString(commandPath, this);
+  fListLongDaughtersCmd
+    ->SetGuidance("List daughters of the given logical volumes");
+  fListLongDaughtersCmd->SetGuidance("and number of its physical volumes");
+  fListLongDaughtersCmd->SetParameterName("lvName", false);
+  fListLongDaughtersCmd->AvailableForStates(PreInit,Idle);  
+#ifdef ALICE_VISUALIZE
+  fCurrentVolume = 0;
+
+  commandPath = dirName + "setVolume";
+  fSetCurrentLVCmd = new G4UIcmdWithAString(commandPath, this);
+  fSetCurrentLVCmd->SetGuidance("Set the current logical volume.");
+  fSetCurrentLVCmd->SetParameterName("curVolume", false);
+  fSetCurrentLVCmd->AvailableForStates(PreInit,Idle);  
+  commandPath = dirName + "setVisibility";
+  fSetDetVisibilityCmd = new G4UIcmdWithABool(commandPath, this);
+  guidance = "Make ";
+  guidance = guidance + moduleName + " detector visible/invisible.";
+  fSetDetVisibilityCmd->SetGuidance(guidance);
+  fSetDetVisibilityCmd->SetParameterName("detVisibility", false);
+  fSetDetVisibilityCmd->AvailableForStates(PreInit,Idle);  
+  commandPath = dirName + "setLVTreeVisibility";
+  fSetLVTreeVisibilityCmd = new G4UIcmdWithABool(commandPath, this);
+  fSetLVTreeVisibilityCmd 
+    ->SetGuidance("Make current volume tree visible/invisible.");
+  fSetLVTreeVisibilityCmd->SetParameterName("volVisibility", false);
+  fSetLVTreeVisibilityCmd->AvailableForStates(PreInit,Idle);  
+  commandPath = dirName + "setVolVisibility";
+  fSetVolVisibilityCmd = new G4UIcmdWithABool(commandPath, this);
+  fSetVolVisibilityCmd 
+    ->SetGuidance("Make current volume visible/invisible.");
+  fSetVolVisibilityCmd->SetParameterName("volVisibility", false);
+  fSetVolVisibilityCmd->AvailableForStates(PreInit,Idle);  
+  commandPath = dirName + "setColour";
+  fSetDetColourCmd = new G4UIcmdWithAString(commandPath, this);
+  AliColourStore* pColours = AliColourStore::Instance();
+  guidance = "Set colour for all ";
+  guidance = guidance + moduleName + " detector volumes.";
+  fSetDetColourCmd->SetGuidance(guidance);
+  fSetDetColourCmd->SetGuidance("Available colours:");
+  fSetDetColourCmd->SetGuidance(pColours->GetColoursListWithCommas());
+  fSetDetColourCmd->SetParameterName("detColour", false);
+  G4String candidatesList = pColours->GetColoursList();  
+  fSetDetColourCmd->SetCandidates(candidatesList);
+  fSetDetColourCmd->AvailableForStates(PreInit,Idle);  
+
+  commandPath = dirName + "setLVTreeColour";
+  fSetLVTreeColourCmd = new G4UIcmdWithAString(commandPath, this);
+  fSetLVTreeColourCmd->SetGuidance("Set colour for the current volume tree.");
+  fSetLVTreeColourCmd->SetGuidance("Available colours:");
+  fSetLVTreeColourCmd->SetGuidance(pColours->GetColoursListWithCommas());
+  fSetLVTreeColourCmd->SetParameterName("volColour", false);
+  candidatesList = pColours->GetColoursList();  
+  fSetLVTreeColourCmd->SetCandidates(candidatesList);
+  fSetLVTreeColourCmd->AvailableForStates(PreInit,Idle);  
+
+  commandPath = dirName + "setVolColour";
+  fSetVolColourCmd = new G4UIcmdWithAString(commandPath, this);
+  fSetVolColourCmd->SetGuidance("Set colour for the current volume.");
+  fSetVolColourCmd->SetGuidance("Available colours:");
+  fSetVolColourCmd->SetGuidance(pColours->GetColoursListWithCommas());
+  fSetVolColourCmd->SetParameterName("volColour", false);
+  candidatesList = pColours->GetColoursList();  
+  fSetVolColourCmd->SetCandidates(candidatesList);
+  fSetVolColourCmd->AvailableForStates(PreInit,Idle);  
+#endif //ALICE_VISUALIZE
+}
+
+AliModuleConstructionMessenger::AliModuleConstructionMessenger() {
+//
+}
+
+AliModuleConstructionMessenger::AliModuleConstructionMessenger(
+                                const AliModuleConstructionMessenger& right)
+{
+//
+  AliGlobals::Exception(
+    "AliModuleConstructionMessenger is protected from copying.");
+}
+
+AliModuleConstructionMessenger::~AliModuleConstructionMessenger()
+{
+//
+  delete fModuleDirectory;
+  delete fSetFrameCmd;  
+  delete fListCmd;
+  delete fListLongCmd;
+  delete fListDaughtersCmd;
+  delete fListLongDaughtersCmd;
+#ifdef ALICE_VISUALIZE
+  delete fSetDetVisibilityCmd;
+  delete fSetDetColourCmd;
+  delete fSetCurrentLVCmd;
+  delete fSetVolVisibilityCmd;    
+  delete fSetVolColourCmd;    
+  delete fSetLVTreeVisibilityCmd;    
+  delete fSetLVTreeColourCmd;    
+#endif //ALICE_VISUALIZE
+}
+
+// operators
+
+AliModuleConstructionMessenger& 
+AliModuleConstructionMessenger::operator=(
+                                const AliModuleConstructionMessenger& right)
+{
+  // check assignement to self
+  if (this == &right) return *this;
+
+  AliGlobals::Exception(
+     "AliModuleConstructionMessenger is protected from assigning.");
+    
+  return *this;  
+}    
+          
+// public methods
+  
+void AliModuleConstructionMessenger::SetNewValue(G4UIcommand* command,
+                                                 G4String newValues)
+{
+// Applies command to the associated object.
+// ---
+
+  if (command == fSetFrameCmd) {
+    fModuleConstruction->SetDetFrame(newValues);
+  }
+  else if (command == fListCmd) {
+    fModuleConstruction->ListAllLVTree();
+  }
+  else if (command == fListLongCmd) {
+    fModuleConstruction->ListAllLVTreeLong();
+  }
+  else if (command == fListDaughtersCmd) {
+    fModuleConstruction->ListLVTree(newValues);
+  }
+  else if (command == fListLongDaughtersCmd) {
+    fModuleConstruction->ListLVTreeLong(newValues);
+  }
+#ifdef ALICE_VISUALIZE
+  if (command == fSetCurrentLVCmd) {
+    fCurrentVolume = fModuleConstruction->FindLogicalVolume(newValues);
+  }    
+  else if (command == fSetDetVisibilityCmd) {
+    fModuleConstruction
+      ->SetDetVisibility(fSetDetVisibilityCmd->GetNewBoolValue(newValues)); 
+  } 
+  else if (command == fSetLVTreeVisibilityCmd) {
+    fModuleConstruction
+      ->SetLVTreeVisibility(fCurrentVolume,
+          fSetVolVisibilityCmd->GetNewBoolValue(newValues)); 
+  } 
+  else if (command == fSetVolVisibilityCmd) {
+    fModuleConstruction
+      ->SetVolumeVisibility(fCurrentVolume,
+          fSetVolVisibilityCmd->GetNewBoolValue(newValues)); 
+  } 
+  else if (command == fSetDetColourCmd) {
+    fModuleConstruction
+      ->SetDetColour(newValues);
+  }     
+  else if (command == fSetLVTreeColourCmd) {
+    fModuleConstruction
+      ->SetLVTreeColour(fCurrentVolume, newValues);
+  }     
+  else if (command == fSetVolColourCmd) {
+    fModuleConstruction
+      ->SetVolumeColour(fCurrentVolume, newValues);
+  }     
+#endif //ALICE_VISUALIZE
+}
+
diff --git a/AliGeant4/AliModuleConstructionMessenger.h b/AliGeant4/AliModuleConstructionMessenger.h
new file mode 100644 (file)
index 0000000..3d8b6d3
--- /dev/null
@@ -0,0 +1,68 @@
+// $Id$
+// Category: geometry
+//
+// Messenger class that defines command directory for each
+// AliModuleConstruction instance.
+
+#ifndef ALI_MODULE_CONSTRUCTION_MESSENGER_H
+#define ALI_MODULE_CONSTRUCTION_MESSENGER_H
+
+#include <G4UImessenger.hh>
+#include <globals.hh>
+
+class AliModuleConstruction;
+
+class G4UIdirectory;
+class G4UIcmdWithABool;
+class G4UIcmdWithAString;
+class G4UIcmdWithoutParameter;
+class G4LogicalVolume;
+
+class AliModuleConstructionMessenger: public G4UImessenger
+{
+  public:
+    AliModuleConstructionMessenger(
+       AliModuleConstruction* moduleConstruction, G4String moduleName);
+    // --> protected   
+    // AliModuleConstructionMessenger();
+    // AliModuleConstructionMessenger(
+    //       const AliModuleConstructionMessenger& right);
+    virtual ~AliModuleConstructionMessenger();
+
+    // methods
+    virtual void SetNewValue(G4UIcommand* command, G4String newValues);
+
+  protected:
+    AliModuleConstructionMessenger();
+    AliModuleConstructionMessenger(
+             const AliModuleConstructionMessenger& right);
+
+    // operators
+    AliModuleConstructionMessenger& operator=(
+             const AliModuleConstructionMessenger &right);
+             
+  private:
+    // data members
+    AliModuleConstruction*    fModuleConstruction;   //associated class
+    G4UIdirectory*            fModuleDirectory;      //command directory
+    G4UIcmdWithAString*       fSetFrameCmd;          //command: setFrame
+    G4UIcmdWithoutParameter*  fListCmd;              //command: list
+    G4UIcmdWithoutParameter*  fListLongCmd;          //command: listLong
+    G4UIcmdWithAString*       fListDaughtersCmd;     //command: listDaughters
+    G4UIcmdWithAString*       fListLongDaughtersCmd; //command: listLongDaughters  
+    
+#ifdef ALICE_VISUALIZE
+    // commands data members
+    G4LogicalVolume*          fCurrentVolume;          //current logical volume
+    G4UIcmdWithAString*       fSetCurrentLVCmd;        //command: setVolume
+    G4UIcmdWithABool*         fSetDetVisibilityCmd;    //command: setDetVisibility
+    G4UIcmdWithABool*         fSetLVTreeVisibilityCmd; //command: setLVTreeVisibility   
+    G4UIcmdWithABool*         fSetVolVisibilityCmd;    //command: setVolVisibility
+    G4UIcmdWithAString*       fSetDetColourCmd;        //command: setDetColour
+    G4UIcmdWithAString*       fSetLVTreeColourCmd;     //command: setLVTreeColour  
+    G4UIcmdWithAString*       fSetVolColourCmd;        //command: setVolColour
+#endif //ALICE_VISUALIZE
+};
+
+#endif //ALI_MODULE_CONSTRUCTION_MESSENGER_H
+
diff --git a/AliGeant4/AliModuleType.h b/AliGeant4/AliModuleType.h
new file mode 100644 (file)
index 0000000..21d2ab9
--- /dev/null
@@ -0,0 +1,8 @@
+// $Id$
+
+#ifndef ALI_MODULE_TYPE_H
+#define ALI_MODULE_TYPE_H
+
+enum AliModuleType { kDetector, kStructure };
+
+#endif //ALI_MODULE_TYPE_H
diff --git a/AliGeant4/AliModulesComposition.cxx b/AliGeant4/AliModulesComposition.cxx
new file mode 100644 (file)
index 0000000..d7e9288
--- /dev/null
@@ -0,0 +1,451 @@
+// $Id$
+// Category: geometry
+//
+// See the class description in the header file.
+
+#include "AliModulesComposition.h"
+#include "AliModulesCompositionMessenger.h"
+#include "AliSingleModuleConstruction.h"
+#include "AliMoreModulesConstruction.h"
+#include "AliMagneticField.h"
+#include "AliGlobals.h"
+
+#include <G4UniformMagField.hh>
+#include <G4FieldManager.hh>
+#include <G4TransportationManager.hh>
+
+AliModulesComposition::AliModulesComposition()
+  : fAllLVSensitive(false),
+    fReadGeometry(false),
+    fWriteGeometry(false)    
+{
+//
+  fMoreModulesConstruction = new AliMoreModulesConstruction();
+  fMagneticField = new AliMagneticField();
+  fMessenger = new AliModulesCompositionMessenger(this);
+}
+
+AliModulesComposition::AliModulesComposition(const AliModulesComposition& right)
+{
+//
+  AliGlobals::Exception("AliModulesComposition is protected from copying.");  
+}
+
+AliModulesComposition::~AliModulesComposition() {
+//   
+  delete fMoreModulesConstruction;
+  delete fMagneticField;
+  delete fMessenger; 
+  
+  // destroy det switch vector
+  fDetSwitchVector.clearAndDestroy();  
+  
+  // destroy det construction vector
+  fModuleConstructionVector.clearAndDestroy();
+}
+
+// operators
+
+AliModulesComposition& 
+AliModulesComposition::operator=(const AliModulesComposition& right)
+{
+  // check assignement to self
+  if (this == &right) return *this;
+  
+  AliGlobals::Exception("AliModulesComposition is protected from assigning.");  
+
+  return *this;  
+}    
+          
+// protected methods
+
+void AliModulesComposition::AddDetSwitch(AliDetSwitch* detSwitch)
+{
+// Adds detSwitch to the detSwitch vector.
+// ---
+
+  fDetSwitchVector.insert(detSwitch);
+  fMessenger->SetCandidates();
+}  
+  
+void AliModulesComposition::AddSingleModuleConstruction(G4String moduleName, 
+                               G4int version, AliModuleType moduleType)
+{
+// Adds SingleModuleConstruction.
+// ---
+
+  AliSingleModuleConstruction* moduleConstruction
+    = new AliSingleModuleConstruction(moduleName, version, moduleType);
+  fModuleConstructionVector.insert(moduleConstruction);
+}  
+                 
+void AliModulesComposition::AddMoreModuleConstruction(G4String moduleName, 
+                               G4int version, AliModuleType moduleType)
+{
+// Adds module to MoreModulesConstruction (construction of dependent
+// modules.)
+// ---
+
+  fMoreModulesConstruction->AddModule(moduleName, version, moduleType);
+}  
+                                 
+void AliModulesComposition::ConstructModules()
+{
+// Construct geometry of all modules (both standalone and dependent.)
+// ---
+
+  // set common options
+  SetReadGeometryToModules(fReadGeometry);
+  SetWriteGeometryToModules(fWriteGeometry);
+  SetAllLVSensitiveToModules(fAllLVSensitive);
+     // common setAllLVSensitive is overridden by Config.in
+     // macro
+  
+  // one module constructions
+  G4int nofDets = fModuleConstructionVector.entries();
+  for (G4int i=0; i<nofDets; i++) {
+    G4cout << "Module " << fModuleConstructionVector[i]->GetDetName()
+           << " will be constructed now." << endl;
+    fModuleConstructionVector[i]->Construct();
+  }  
+    
+  // more modules construction
+  G4int nofModules = fMoreModulesConstruction->GetNofModules();
+  if (nofModules>0) {
+    G4cout << "Dependent modules will be constructed now." << endl;
+    fMoreModulesConstruction->Construct();
+  }  
+}  
+
+void AliModulesComposition::SetReadGeometryToModules(G4bool readGeometry)
+{
+// Sets readGeometry control to all modules.
+// ---
+
+  // single module constructions
+  G4int nofDets = fModuleConstructionVector.entries();
+  G4int i;
+  for (i=0; i<nofDets; i++)
+    fModuleConstructionVector[i]->SetReadGeometry(readGeometry);
+
+  // more modules construction
+  nofDets = fMoreModulesConstruction->GetNofModules();
+  for (i=0; i<nofDets; i++) { 
+    AliSingleModuleConstruction* moduleConstruction
+      = fMoreModulesConstruction->GetModuleConstruction(i);
+    moduleConstruction->SetReadGeometry(readGeometry);
+  }  
+}    
+  
+void AliModulesComposition::SetWriteGeometryToModules(G4bool writeGeometry)
+{
+// Sets writeGeometry control to all modules.
+// ---
+
+  // single module constructions
+  G4int nofDets = fModuleConstructionVector.entries();
+  G4int i;
+  for (i=0; i<nofDets; i++)
+    fModuleConstructionVector[i]->SetWriteGeometry(writeGeometry);
+
+  // more modules construction
+  nofDets = fMoreModulesConstruction->GetNofModules();
+  for (i=0; i<nofDets; i++) { 
+    AliSingleModuleConstruction* moduleConstruction
+      = fMoreModulesConstruction->GetModuleConstruction(i);
+    moduleConstruction->SetWriteGeometry(writeGeometry);
+  }  
+}    
+
+void AliModulesComposition::SetAllLVSensitiveToModules(G4bool allSensitive)
+{
+// Sets setAllSensitive control to all modules.
+// ---
+
+  // single module constructions
+  G4int nofDets = fModuleConstructionVector.entries();
+  G4int i;
+  for (i=0; i<nofDets; i++) {
+    AliSingleModuleConstruction* moduleConstruction
+      = dynamic_cast<AliSingleModuleConstruction*>(fModuleConstructionVector[i]);
+    if (!moduleConstruction) {
+      G4String text = "AliModulesComposition::SetProcessConfig: \n";
+      text = text + "    Unknown module construction type.";
+      AliGlobals::Exception(text);
+    }      
+    moduleConstruction->SetAllLVSensitive(allSensitive);
+  }  
+
+  // more modules construction
+  nofDets = fMoreModulesConstruction->GetNofModules();
+  for (i=0; i<nofDets; i++) { 
+    AliSingleModuleConstruction* moduleConstruction
+      = fMoreModulesConstruction->GetModuleConstruction(i);
+    moduleConstruction->SetAllLVSensitive(allSensitive);
+  }  
+}    
+
+void AliModulesComposition::SetProcessConfigToModules(G4bool processConfig)
+{
+// Sets processConfig control to all modules.
+// ---
+
+  // single module constructions
+  G4int nofDets = fModuleConstructionVector.entries();
+  G4int i;
+  for (i=0; i<nofDets; i++) {
+    AliSingleModuleConstruction* moduleConstruction
+      = dynamic_cast<AliSingleModuleConstruction*>(fModuleConstructionVector[i]);
+    if (!moduleConstruction) {
+      G4String text = "AliModulesComposition::SetProcessConfig: \n";
+      text = text + "    Unknown module construction type.";
+      AliGlobals::Exception(text);
+    }      
+    moduleConstruction->SetProcessConfig(processConfig);
+  }  
+  
+  // more modules construction
+  nofDets = fMoreModulesConstruction->GetNofModules();
+  for (i=0; i<nofDets; i++) { 
+    AliSingleModuleConstruction* moduleConstruction
+      = fMoreModulesConstruction->GetModuleConstruction(i);
+    moduleConstruction->SetProcessConfig(processConfig);
+  }    
+}    
+
+// public methods
+
+void AliModulesComposition::SwitchDetOn(G4String moduleNameVer)
+{ 
+// Switchs on module specified by name and version.
+// ---
+
+  G4int nofDets = fDetSwitchVector.entries(); 
+  if (moduleNameVer == "ALL") {
+    for (G4int id=0; id<nofDets; id++) {
+      G4int defaultVersion = fDetSwitchVector[id]->GetDefaultVersion();
+      fDetSwitchVector[id]->SwitchOn(defaultVersion); 
+    }  
+  }
+  else if (moduleNameVer == "NONE") {
+    for (G4int id=0; id<nofDets; id++)
+      fDetSwitchVector[id]->SwitchOff(); 
+  }
+  else {
+    // get version number
+    G4int len = moduleNameVer.length();
+    G4String moduleName = moduleNameVer(0, len-1);
+    G4String version = moduleNameVer(len-1, 1);
+    G4int iVersion = AliGlobals::StringToInt(version);
+
+    if (iVersion < 0) {
+      // in case the version number is not provided
+      // the default one is set
+      SwitchDetOnDefault(moduleNameVer);
+    }  
+    else 
+      SwitchDetOn(moduleName, iVersion);
+  }
+}
+
+void AliModulesComposition::SwitchDetOn(G4String moduleName, G4int version)
+{ 
+// Switchs on module specified by name and version.
+// ---
+
+  G4int nofDets = fDetSwitchVector.entries(); 
+  for (G4int id=0; id<nofDets; id++) {
+    G4String iDetName = fDetSwitchVector[id]->GetDetName();
+    if (iDetName == moduleName) {
+      fDetSwitchVector[id]->SwitchOn(version);
+      return;
+    }
+  }
+  AliGlobals::Exception(
+    "AliModulesComposition: Wrong detector name for " + moduleName + ".");
+}
+
+void AliModulesComposition::SwitchDetOnDefault(G4String moduleName)
+{ 
+// Switchs on module specified by name with default version.
+// ---
+
+  G4int nofDets = fDetSwitchVector.entries(); 
+  for (G4int id=0; id<nofDets; id++) {
+    G4String iDetName = fDetSwitchVector[id]->GetDetName();
+    if (iDetName == moduleName) {
+      fDetSwitchVector[id]->SwitchOnDefault();
+      return;
+    }
+  }
+  AliGlobals::Exception(
+    "AliModulesComposition: Wrong detector name for " + moduleName + ".");
+}
+
+void AliModulesComposition::SwitchDetOff(G4String moduleName)
+{ 
+// Switchs off module specified by name.
+// ---
+
+  G4int nofDets = fDetSwitchVector.entries(); 
+  if (moduleName == "ALL") {
+    for (G4int id=0; id<nofDets; id++)
+      fDetSwitchVector[id]->SwitchOff(); 
+  }
+  else {
+    for (G4int id=0; id<nofDets; id++) {
+      G4String iDetName = fDetSwitchVector[id]->GetDetName();
+      if (iDetName == moduleName) { 
+        fDetSwitchVector[id]->SwitchOff();
+        return;
+      }
+    }
+  }
+  AliGlobals::Exception(
+    "AliModulesComposition: Wrong detector name for " + moduleName + ".");
+}
+
+void AliModulesComposition::PrintSwitchedDets() const
+{ 
+// Lists switched detectors.
+// ---
+
+  G4String svList = GetSwitchedDetsList();
+    
+  G4cout << "Switched Alice detectors: " << endl;
+  G4cout << "--------------------------" << endl;
+  G4cout << svList << endl;
+}
+
+void AliModulesComposition::PrintAvailableDets() const
+{ 
+// Lists available detectors.
+// ---
+
+  G4String avList = GetAvailableDetsList();
+    
+  G4cout << "Available Alice detectors: " << endl;
+  G4cout << "---------------------------" << endl;
+  G4cout << avList << endl;
+}
+
+G4String AliModulesComposition::GetSwitchedDetsList() const
+{ 
+// Returns list of switched detectors.
+// ---
+
+  G4String svList = "";
+  
+  G4int nofDets = fDetSwitchVector.entries(); 
+  G4int nofSwitchedDets = 0;
+  for (G4int id=0; id<nofDets; id++) {
+    G4int iVersion = fDetSwitchVector[id]->GetSwitchedVersion();
+    if (iVersion > -1) {
+      nofSwitchedDets++;
+      G4String moduleNameVer = fDetSwitchVector[id]->GetDetName();
+      AliGlobals::AppendNumberToString(moduleNameVer, iVersion);
+      svList += moduleNameVer;
+      svList += " "; 
+    }
+  }
+
+  if (nofSwitchedDets ==  nofDets) svList = "ALL: " + svList;
+  if (nofSwitchedDets ==  0)       svList = "NONE";   
+
+  return svList;
+}
+
+const G4RWTPtrOrderedVector<AliDetSwitch>& 
+AliModulesComposition::GetDetSwitchVector() const
+{
+// Returns detSwitch vector.
+// ---
+
+  //const AliDetSwitchVector& vector = fDetSwitchVector;
+  const G4RWTPtrOrderedVector<AliDetSwitch>& vector = fDetSwitchVector;
+  return vector;
+}  
+
+G4String AliModulesComposition::GetAvailableDetsList() const
+{ 
+// Returns list of available detectors.
+// ---
+
+  G4String svList = "";
+  
+  G4int nofDets = fDetSwitchVector.entries(); 
+  for (G4int id=0; id<nofDets; id++) {
+    G4int nofVersions = fDetSwitchVector[id]->GetNofVersions();
+    for (G4int iv=0; iv<nofVersions; iv++) {
+      G4String moduleNameVer = fDetSwitchVector[id]->GetDetName();
+      AliGlobals::AppendNumberToString(moduleNameVer, iv);
+      svList += moduleNameVer;
+      svList += " ";
+    }
+  }
+
+  return svList;
+}
+
+G4String AliModulesComposition::GetAvailableDetsListWithCommas() const
+{ 
+// Returns list of available detectors with commas.
+// ---
+
+  G4String svList = "";
+  
+  G4int nofDets = fDetSwitchVector.entries(); 
+  for (G4int id=0; id<nofDets; id++) {
+    G4int nofVersions = fDetSwitchVector[id]->GetNofVersions();
+    for (G4int iv=0; iv<nofVersions; iv++) {
+      G4String moduleNameVer = fDetSwitchVector[id]->GetDetName();
+      AliGlobals::AppendNumberToString(moduleNameVer, iv);
+      svList += moduleNameVer;
+      if (iv<nofVersions-1)    svList += "/";
+      else if (id < nofDets-1) svList += ", ";
+    }
+  }
+
+  return svList;
+}
+
+G4String AliModulesComposition::GetDetNamesList() const
+{ 
+// Returns list of detector names.
+// ---
+
+  G4String svList = "";
+  
+  G4int nofDets = fDetSwitchVector.entries(); 
+  for (G4int id=0; id<nofDets; id++) { 
+    svList += fDetSwitchVector[id]->GetDetName();
+    svList += " ";
+  }
+
+  return svList;
+}
+
+G4String AliModulesComposition::GetDetNamesListWithCommas() const
+{ 
+// Returns list of detector names with commas.
+// ---
+
+  G4String svList = "";
+  
+  G4int nofDets = fDetSwitchVector.entries(); 
+  for (G4int id=0; id<nofDets; id++) { 
+    svList += fDetSwitchVector[id]->GetDetName();
+    if (id < nofDets-1) svList += ", ";
+  }
+
+  return svList;
+}
+
+void AliModulesComposition::SetMagField(G4double fieldValue)
+{
+// Sets uniform magnetic field to specified value.
+// ---
+
+  fMagneticField->SetFieldValue(fieldValue);
+}
+
diff --git a/AliGeant4/AliModulesComposition.h b/AliGeant4/AliModulesComposition.h
new file mode 100644 (file)
index 0000000..3db3679
--- /dev/null
@@ -0,0 +1,107 @@
+// $Id$
+// Category: geometry
+//
+// Detector construction base class for building geometry
+// composed from independent modules with availability of interactive modules
+// setup.
+
+#ifndef ALI_MODULES_COMPOSITION_H
+#define ALI_MODULES_COMPOSITION_H
+
+#include "AliModuleConstruction.h"
+#include "AliDetSwitch.h"
+#include "AliModuleType.h"
+
+#include <G4VUserDetectorConstruction.hh>
+#include <globals.hh>
+
+#include <g4rw/tpordvec.h>
+
+class AliModulesCompositionMessenger;
+class AliMoreModulesConstruction;
+class AliMagneticField;
+
+class G4VPhysicalVolume;
+
+class AliModulesComposition : public G4VUserDetectorConstruction
+{
+  typedef G4RWTPtrOrderedVector<AliDetSwitch>          AliDetSwitchVector;
+  typedef G4RWTPtrOrderedVector<AliModuleConstruction> AliModuleConstructionVector; 
+
+  public:
+    AliModulesComposition();
+    // --> protected
+    // AliModulesComposition(const AliModulesComposition& right);
+    virtual ~AliModulesComposition();
+
+    // methods
+    virtual G4VPhysicalVolume* Construct() = 0;
+    void SwitchDetOn(G4String moduleNameVer);
+    void SwitchDetOn(G4String moduleName, G4int version);
+    void SwitchDetOnDefault(G4String moduleName);
+    void SwitchDetOff(G4String moduleName);
+    void PrintSwitchedDets() const;
+    void PrintAvailableDets() const;
+
+    // set methods
+    void SetMagField(G4double fieldValue);
+    void SetAllLVSensitive(G4bool allLVSensitive);
+    void SetReadGeometry(G4bool readGeometry);
+    void SetWriteGeometry(G4bool writeGeometry);
+    void SetProcessConfigToModules(G4bool processConfig);
+    
+    // get methods
+    const G4RWTPtrOrderedVector<AliDetSwitch>& GetDetSwitchVector() const;
+    G4String GetSwitchedDetsList() const;
+    G4String GetAvailableDetsList() const;
+    G4String GetAvailableDetsListWithCommas() const;
+    G4String GetDetNamesList() const;
+    G4String GetDetNamesListWithCommas() const;
+    //G4ThreeVector GetMagField() const;
+    
+  protected:
+    AliModulesComposition(const AliModulesComposition& right);
+
+    // operators
+    AliModulesComposition& operator=(const AliModulesComposition& right);
+
+    // methods  
+    void AddDetSwitch(AliDetSwitch* detSwitch);
+    void AddSingleModuleConstruction(G4String moduleName, G4int version,
+                                     AliModuleType moduleType = kDetector);
+    void AddMoreModuleConstruction(G4String moduleName, G4int version,
+                                     AliModuleType moduleType = kDetector);
+    void ConstructModules();
+
+  private:    
+    // methods
+    void SetReadGeometryToModules(G4bool readGeometry);
+    void SetWriteGeometryToModules(G4bool writeGeometry);
+    void SetAllLVSensitiveToModules(G4bool allSensitive);
+
+    // data members
+    AliDetSwitchVector           fDetSwitchVector;          //vector of AliDetSwitch
+    AliModuleConstructionVector  fModuleConstructionVector; //vector of 
+                                                           //AliModuleConstruction 
+    AliMoreModulesConstruction*  fMoreModulesConstruction;  //AliMoreModulesConstruction
+
+    AliMagneticField*                fMagneticField;  //magnetic field
+    AliModulesCompositionMessenger*  fMessenger;      //messenger
+    G4bool                           fAllLVSensitive; //option applied to all modules
+    G4bool                           fReadGeometry;   //option applied to all modules
+    G4bool                           fWriteGeometry;  //option applied to all modules  
+};
+
+// inline methods
+
+inline void AliModulesComposition::SetAllLVSensitive(G4bool allLVSensitive)
+{ fAllLVSensitive = allLVSensitive; }
+
+inline void AliModulesComposition::SetReadGeometry(G4bool readGeometry)
+{ fReadGeometry = readGeometry; }
+
+inline void AliModulesComposition::SetWriteGeometry(G4bool writeGeometry)
+{ fWriteGeometry = writeGeometry; }
+
+#endif //ALI_MODULES_COMPOSITION_H
+
diff --git a/AliGeant4/AliModulesCompositionMessenger.cxx b/AliGeant4/AliModulesCompositionMessenger.cxx
new file mode 100644 (file)
index 0000000..c07faf0
--- /dev/null
@@ -0,0 +1,188 @@
+// $Id$
+// Category: geometry
+//
+// See the class description in the header file.
+
+#include "AliModulesCompositionMessenger.h"
+#include "AliModulesComposition.h"
+#include "AliGlobals.h"
+
+#include <G4UIdirectory.hh>
+#include <G4UIcmdWithAString.hh>
+#include <G4UIcmdWithoutParameter.hh>
+#include <G4UIcmdWithABool.hh>
+#include <G4UIcmdWithADoubleAndUnit.hh>
+
+AliModulesCompositionMessenger::AliModulesCompositionMessenger(
+                                   AliModulesComposition* modulesComposition)
+  : fModulesComposition(modulesComposition)
+{
+//
+  fDirectory = new G4UIdirectory("/aliDet/");
+  fDirectory->SetGuidance("Detector construction control commands.");
+
+  fSwitchOnCmd = new G4UIcmdWithAString("/aliDet/switchOn", this);
+  fSwitchOnCmd->SetGuidance("Define the module to be built.");
+  fSwitchOnCmd->SetGuidance("Available modules:");
+  G4String listAvailableDets = "NONE, ALL, ";  
+  listAvailableDets 
+    = listAvailableDets + modulesComposition->GetAvailableDetsListWithCommas();
+  fSwitchOnCmd->SetGuidance(listAvailableDets);
+  fSwitchOnCmd->SetParameterName("module", false);
+  fSwitchOnCmd->AvailableForStates(PreInit);;
+
+  fSwitchOffCmd = new G4UIcmdWithAString("/aliDet/switchOff", this);
+  fSwitchOffCmd->SetGuidance("Define the module not to be built.");
+  fSwitchOffCmd->SetGuidance("Available modules:");
+  G4String listDetsNames = "ALL, "; 
+  listDetsNames
+    = listDetsNames + modulesComposition->GetDetNamesListWithCommas();
+  fSwitchOffCmd->SetGuidance(listDetsNames);
+  fSwitchOffCmd->SetParameterName("module", false);
+  fSwitchOffCmd->AvailableForStates(PreInit);;
+
+  fListCmd 
+    = new G4UIcmdWithoutParameter("/aliDet/list", this);
+  fListCmd->SetGuidance("List the currently switched modules.");
+  fListCmd
+    ->AvailableForStates(PreInit, Init, Idle, GeomClosed, EventProc);
+
+  fListAvailableCmd 
+    = new G4UIcmdWithoutParameter("/aliDet/listAvailable", this);
+  fListAvailableCmd->SetGuidance("List all available modules.");
+  fListAvailableCmd
+    ->AvailableForStates(PreInit, Init, Idle, GeomClosed, EventProc);
+
+  fFieldValueCmd = new G4UIcmdWithADoubleAndUnit("/aliDet/fieldValue", this);
+  fFieldValueCmd->SetGuidance("Define magnetic field in Z direction.");
+  fFieldValueCmd->SetParameterName("fieldValue", false, false);
+  fFieldValueCmd->SetDefaultUnit("tesla");
+  fFieldValueCmd->SetUnitCategory("Magnetic flux density");
+  fFieldValueCmd->AvailableForStates(PreInit,Idle);  
+  
+  fSetAllSensitiveCmd
+    = new G4UIcmdWithABool("/aliDet/setAllSensitive", this);
+  fSetAllSensitiveCmd 
+    ->SetGuidance("If true: set all logical volumes sensitive.");
+  fSetAllSensitiveCmd 
+    ->SetGuidance("         (Each logical is volume associated with a sensitive");
+  fSetAllSensitiveCmd 
+    ->SetGuidance("          detector.)");
+  fSetAllSensitiveCmd 
+    ->SetGuidance("If false: only volumes defined with a sensitive tracking");
+  fSetAllSensitiveCmd 
+    ->SetGuidance("          medium are associated with a sensitive detector.");
+  fSetAllSensitiveCmd->SetParameterName("sensitivity", false);
+  fSetAllSensitiveCmd->AvailableForStates(PreInit);  
+
+  fSetReadGeometryCmd 
+    = new G4UIcmdWithABool("/aliDet/readGeometry", this);
+  fSetReadGeometryCmd->SetGuidance("Read geometry from g3calls.dat files");
+  fSetReadGeometryCmd->SetParameterName("readGeometry", false);
+  fSetReadGeometryCmd->AvailableForStates(PreInit);  
+  fSetWriteGeometryCmd 
+    = new G4UIcmdWithABool("/aliDet/writeGeometry", this);
+  fSetWriteGeometryCmd->SetGuidance("Write geometry to g3calls.dat file");
+  fSetWriteGeometryCmd->SetParameterName("writeGeometry", false);
+  fSetWriteGeometryCmd->AvailableForStates(PreInit);   
+
+  // set candidates list
+  SetCandidates();
+
+  // set default values to a detector
+  fModulesComposition->SwitchDetOn("NONE");
+  fModulesComposition->SetMagField(0.0*tesla);    
+}
+
+AliModulesCompositionMessenger::AliModulesCompositionMessenger() {
+//
+}
+
+AliModulesCompositionMessenger::AliModulesCompositionMessenger(
+                                const AliModulesCompositionMessenger& right)
+{
+//
+  AliGlobals::Exception(
+    "AliModulesCompositionMessenger is protected from copying.");
+}
+
+AliModulesCompositionMessenger::~AliModulesCompositionMessenger() {
+//
+  delete fDirectory;
+  delete fSwitchOnCmd;
+  delete fSwitchOffCmd;
+  delete fListCmd;
+  delete fListAvailableCmd;
+  delete fFieldValueCmd;
+  delete fSetAllSensitiveCmd;
+  delete fSetReadGeometryCmd;
+  delete fSetWriteGeometryCmd;
+}
+
+// operators
+
+AliModulesCompositionMessenger& 
+AliModulesCompositionMessenger::operator=(
+                                const AliModulesCompositionMessenger& right)
+{
+  // check assignement to self
+  if (this == &right) return *this;
+
+  AliGlobals::Exception(
+     "AliModulesCompositionMessenger is protected from assigning.");
+    
+  return *this;  
+}    
+          
+// public methods
+  
+void AliModulesCompositionMessenger::SetNewValue(G4UIcommand* command, G4String newValues)
+{
+// Applies command to the associated object.
+// ---
+
+  if (command == fSwitchOnCmd) {  
+    fModulesComposition->SwitchDetOn(newValues); 
+  }
+  else if (command == fSwitchOffCmd) {  
+    fModulesComposition->SwitchDetOff(newValues); 
+  }
+  else if (command == fListCmd) {  
+    fModulesComposition->PrintSwitchedDets(); 
+  }
+  else if (command == fListAvailableCmd) {  
+    fModulesComposition->PrintAvailableDets(); 
+  }
+  else if (command == fFieldValueCmd) {  
+    fModulesComposition
+      ->SetMagField(fFieldValueCmd->GetNewDoubleValue(newValues)); 
+  }
+  else if (command == fSetAllSensitiveCmd) {
+    fModulesComposition->SetAllLVSensitive(
+                         fSetAllSensitiveCmd->GetNewBoolValue(newValues));
+  }
+  else if (command == fSetReadGeometryCmd) {
+    fModulesComposition->SetReadGeometry(
+                         fSetReadGeometryCmd->GetNewBoolValue(newValues));
+  }  
+  else if (command == fSetWriteGeometryCmd) {
+    fModulesComposition->SetWriteGeometry(
+                         fSetWriteGeometryCmd->GetNewBoolValue(newValues));
+  }    
+}
+
+void AliModulesCompositionMessenger::SetCandidates() 
+{
+// Builds candidates list.
+// ---
+
+  G4String candidatesList = "NONE ALL ";
+  candidatesList += fModulesComposition->GetDetNamesList();;
+  candidatesList += fModulesComposition->GetAvailableDetsList();
+  fSwitchOnCmd->SetCandidates(candidatesList);
+
+  candidatesList = "ALL ";
+  candidatesList += fModulesComposition->GetDetNamesList();;
+  fSwitchOffCmd->SetCandidates(candidatesList);
+}
diff --git a/AliGeant4/AliModulesCompositionMessenger.h b/AliGeant4/AliModulesCompositionMessenger.h
new file mode 100644 (file)
index 0000000..576525a
--- /dev/null
@@ -0,0 +1,60 @@
+// $Id$
+// Category: geometry
+//
+// Messenger class that defines commands for AliModulesComposition.
+
+#ifndef ALI_MODULES_COMPOSITION_MESSENGER_H
+#define ALI_MODULES_COMPOSITION_MESSENGER_H
+
+#include <G4UImessenger.hh>
+#include <globals.hh>
+
+class AliModulesComposition;
+
+class G4UIcommand;
+class G4UIdirectory;
+class G4UIcmdWithAString;
+class G4UIcmdWithoutParameter;
+class G4UIcmdWithABool;
+class G4UIcmdWithADoubleAndUnit;
+
+class AliModulesCompositionMessenger: public G4UImessenger
+{
+  public:
+    AliModulesCompositionMessenger(AliModulesComposition* modulesComposition);
+    // --> protected
+    // AliModulesCompositionMessenger();
+    // AliModulesCompositionMessenger(
+    //       const AliModulesCompositionMessenger& right);
+    virtual ~AliModulesCompositionMessenger();
+
+    // methods
+    virtual void SetNewValue(G4UIcommand* command, G4String newValues);
+    void SetCandidates();
+    
+  protected:
+    AliModulesCompositionMessenger();
+    AliModulesCompositionMessenger(
+             const AliModulesCompositionMessenger& right);
+
+    // operators
+    AliModulesCompositionMessenger& operator=(
+             const AliModulesCompositionMessenger &right);
+             
+  private:
+    AliModulesComposition*  fModulesComposition; //associated class
+    G4UIdirectory*          fDirectory;          //command directory
+    
+    // commands data members
+    G4UIcmdWithAString*         fSwitchOnCmd;         //command: switchOn 
+    G4UIcmdWithAString*         fSwitchOffCmd;        //command: switchOn
+    G4UIcmdWithoutParameter*    fListCmd;             //command: list
+    G4UIcmdWithoutParameter*    fListAvailableCmd;    //command: listAvailable
+    G4UIcmdWithADoubleAndUnit*  fFieldValueCmd;       //command: fieldValue
+    G4UIcmdWithABool*           fSetAllSensitiveCmd;  //command: setAllSensitive   
+    G4UIcmdWithABool*           fSetReadGeometryCmd;  //command: readGeometry   
+    G4UIcmdWithABool*           fSetWriteGeometryCmd; //command: writeGeometry    
+};
+
+#endif //ALI_MODULES_COMPOSITION_MESSENGER_H
+
diff --git a/AliGeant4/AliMoreModulesConstruction.cxx b/AliGeant4/AliMoreModulesConstruction.cxx
new file mode 100644 (file)
index 0000000..0a1d26d
--- /dev/null
@@ -0,0 +1,248 @@
+// $Id$
+// Category: geometry
+//
+// See the class description in the header file.
+
+#include "AliMoreModulesConstruction.h"
+#include "AliSingleModuleConstruction.h"
+#include "AliSDManager.h"
+#include "AliSensitiveDetector.h"
+#include "AliModule.h"
+#include "AliRun.h"
+#include "AliGlobals.h"
+
+#include "TG4GeometryManager.h"
+
+#include <G4SDManager.hh>
+#include <G4LogicalVolume.hh>
+#include <G4LogicalVolumeStore.hh>
+
+#include <TROOT.h> 
+#include <TCint.h> 
+
+AliMoreModulesConstruction::AliMoreModulesConstruction() {
+//
+  fSDManager = AliSDManager::Instance();
+}
+
+AliMoreModulesConstruction::AliMoreModulesConstruction(
+                               const AliMoreModulesConstruction& right)
+{
+  // delete current module constructions
+  fModuleConstructionVector.erase(
+    fModuleConstructionVector.begin(), fModuleConstructionVector.end());
+    
+  // create new module constructions   
+  G4int nofModules = right.fModuleConstructionVector.size();
+  for (G4int i=0; i<nofModules; i++) {
+    G4String name = right.fModuleConstructionVector[i]->GetDetName();
+    G4int version = right.fModuleConstructionVector[i]->GetVersion();
+    AliModuleType type = right.fModuleConstructionVector[i]->GetType();
+    AddModule(name, version, type);
+  }  
+  
+  fSDManager = right.fSDManager;
+}  
+                              
+
+AliMoreModulesConstruction::~AliMoreModulesConstruction()
+{
+  // delete module constructions
+  fModuleConstructionVector.erase(
+    fModuleConstructionVector.begin(), fModuleConstructionVector.end());
+}
+
+// operators
+
+AliMoreModulesConstruction& 
+AliMoreModulesConstruction::operator=(const AliMoreModulesConstruction& right)
+{
+  // check assignement to self
+  if (this == &right) return *this;
+
+  // delete current module constructions
+  fModuleConstructionVector.erase(
+    fModuleConstructionVector.begin(), fModuleConstructionVector.end());
+    
+  // create new module constructions   
+  G4int nofModules = right.fModuleConstructionVector.size();
+  for (G4int i=0; i<nofModules; i++) {
+    G4String name = right.fModuleConstructionVector[i]->GetDetName();
+    G4int version = right.fModuleConstructionVector[i]->GetVersion();
+    AliModuleType type = right.fModuleConstructionVector[i]->GetType();
+    AddModule(name, version, type);
+  }  
+  
+  fSDManager = right.fSDManager;
+
+  return *this;  
+}    
+          
+// private methods
+
+void AliMoreModulesConstruction::CreateSensitiveDetectors(
+                                   G4bool allLVSensitive)
+{
+// Creates sensitive detectors.
+// ---
+
+  if (allLVSensitive)
+    CreateSensitiveDetectors1();
+  else
+    CreateSensitiveDetectors2();
+
+  // set static number of logical volumes already processed
+  G4LogicalVolumeStore* pLVStore = G4LogicalVolumeStore::GetInstance();
+  fSDManager->SetNofLVWithSD(pLVStore->entries());  
+}    
+
+void AliMoreModulesConstruction::CreateSensitiveDetectors1()
+{ 
+// Creates sensitive detectors.
+// Sensitive detectors are set to all logical volumes
+// ---
+
+  G4LogicalVolumeStore* pLVStore = G4LogicalVolumeStore::GetInstance();
+  G4int nofLV = pLVStore->entries();
+  
+  G4int nofLVWithSD = fSDManager->GetNofLVWithSD();
+  for (G4int i=nofLVWithSD; i<nofLV; i++) {
+    G4LogicalVolume* lv = (*pLVStore)[i];
+    AliModule* module = fSDManager->FindAliModule(lv);
+    fSDManager->CreateSD(lv, module);
+  }
+}
+
+void AliMoreModulesConstruction::CreateSensitiveDetectors2()
+{ 
+// Creates sensitive detectors.
+// Sensitive detectors are set only to logical volumes
+// in G3SensVolVector.
+// ---
+
+  TG4GeometryManager* pGeometryManager = TG4GeometryManager::Instance();
+
+  G3SensVolVector pSVVector
+    = pGeometryManager->GetG3SensVolVector();
+
+  G4int nofSV = pSVVector.entries();
+  if (nofSV>0)
+    for (G4int isv=0; isv<nofSV; isv++) {
+      G4LogicalVolume* lv = pSVVector[isv];
+      AliModule* module = fSDManager->FindAliModule(lv);    
+      fSDManager->CreateSD(lv, module);
+    } 
+}
+
+// public methods
+
+void AliMoreModulesConstruction::AddModule(G4String moduleName, G4int version,
+                                           AliModuleType moduleType)
+{                                         
+// Adds module specified by name, version and type.
+// ---
+
+  // create module construction
+  AliSingleModuleConstruction* moduleConstruction 
+    = new AliSingleModuleConstruction(moduleName, version, moduleType);
+
+  // add module, module construction to vectors
+  fModuleConstructionVector.push_back(moduleConstruction);
+}  
+                                          
+void AliMoreModulesConstruction::Construct()
+{ 
+// Constructs geometry.
+// G3 tables are process for all modules alltogether.
+// --
+
+  // number of modules
+  G4int nofModules = fModuleConstructionVector.size();
+
+  if (nofModules == 0) {
+    AliGlobals::Warning(
+      "AliMoreModulesConstruction::Construct(): No modules are defined.");
+  }
+  else {      
+    // get geometry manager
+    TG4GeometryManager* pGeometryManager = TG4GeometryManager::Instance();
+
+    G4bool allLVSensitive = false;    
+    G4int i;
+    for (i=0; i<nofModules; i++) {
+
+      fModuleConstructionVector[i]->Configure();
+    
+      // register module name in the name map
+      AliModule* module = fModuleConstructionVector[i]->GetAliModule();
+      pGeometryManager->SetMapSecond(module->GetName());       
+
+      G4bool readGeometry = fModuleConstructionVector[i]->GetReadGeometry();
+      G4bool writeGeometry = fModuleConstructionVector[i]->GetWriteGeometry();
+      G4String dataFilePath = fModuleConstructionVector[i]->GetDataFilePath();
+
+      if (readGeometry) {
+        // create G3 geometry from g3calls.dat
+        pGeometryManager->SetWriteGeometry(false);
+        pGeometryManager->ReadG3Geometry(dataFilePath);
+      }
+      else {               
+        // set geometry output stream for this module
+        pGeometryManager->SetWriteGeometry(writeGeometry);
+        if (writeGeometry) 
+          pGeometryManager->OpenOutFile(dataFilePath);
+        
+        // create geometry from AliRoot
+      
+        // construct materials
+        module->CreateMaterials();   
+
+        // construct G3 geometry
+        module->CreateGeometry();
+      }        
+
+      // all logical volumes will be made sensitive if any
+      // module requires this
+      if (fModuleConstructionVector[i]->GetAllLVSensitive()) 
+         allLVSensitive = true;
+    }  
+  
+    // construct G4 geometry
+    pGeometryManager->CreateG4Geometry();
+
+    // print name map
+    // pGeometryManager->PrintNameMap();
+    
+    // create sensitive detectors
+    CreateSensitiveDetectors(allLVSensitive);
+         // each single module construction can build sensitive detectors
+         // for all modules as all modules are in memory
+         // (volumes entities do not know to which module belong)
+  
+    for (i=0; i<nofModules; i++) {
+      // set the detector frame (envelope)
+      // (without warning output if enevelope is not defined)
+      fModuleConstructionVector[i]->SetDetFrame(false);
+
+      // build sensitive detectors table
+      fModuleConstructionVector[i]->GetAliModule()->Init();
+    }  
+
+    // reset TG4GeometryManager 
+    pGeometryManager->ClearG3Tables();
+  
+    // print current total number of logical volumes
+    G4cout << "Current total number of sensitive volumes: "
+           << pGeometryManager->NofVolumes() << endl;
+
+#ifdef ALICE_VISUALIZE
+    // set visualization attributes
+    for (i=0; i<nofModules; i++) {
+      if (fModuleConstructionVector[i]->GetDetFrame()) {
+        fModuleConstructionVector[i]->SetDetVisibility(true);
+        fModuleConstructionVector[i]->SetDetColour("Yellow");
+      }
+    }  
+#endif
+  }
+}
diff --git a/AliGeant4/AliMoreModulesConstruction.h b/AliGeant4/AliMoreModulesConstruction.h
new file mode 100644 (file)
index 0000000..2cae0fe
--- /dev/null
@@ -0,0 +1,62 @@
+// $Id$
+// Category: geometry
+//
+// Class for geometry construction of a set of dependent
+// modules (AliModule). 
+
+
+#ifndef ALI_MORE_MODULES_CONSTRUCTION_H
+#define ALI_MORE_MODULES_CONSTRUCTION_H
+
+#include "AliModuleType.h"
+
+#include <G3VolTable.hh>
+#include <globals.hh>
+
+#include <vector.h>
+
+class AliSingleModuleConstruction;
+class AliSDManager;
+
+class AliMoreModulesConstruction
+{  
+  public:
+    AliMoreModulesConstruction();
+    AliMoreModulesConstruction(const AliMoreModulesConstruction& right);
+    virtual ~AliMoreModulesConstruction();
+
+    // operators
+    AliMoreModulesConstruction& operator=(
+                               const AliMoreModulesConstruction& right);
+
+    // methods
+    void AddModule(G4String moduleName, G4int version, 
+                   AliModuleType moduleType);
+    void Construct();
+    
+    // get methods
+    G4int GetNofModules() const;
+    AliSingleModuleConstruction* GetModuleConstruction(G4int i) const;
+        
+  private:    
+    // methods
+    void CreateSensitiveDetectors(G4bool allLVSensitive);
+    void CreateSensitiveDetectors1();
+    void CreateSensitiveDetectors2();
+
+    // data members
+    vector<AliSingleModuleConstruction*>  fModuleConstructionVector;        //.
+                                //vector of AliSingleModuleConstruction
+    AliSDManager*  fSDManager;  //AliSDManager                                            
+};                                                
+
+// inline methods
+
+inline G4int AliMoreModulesConstruction::GetNofModules() const
+{ return fModuleConstructionVector.size(); }
+
+inline AliSingleModuleConstruction* 
+  AliMoreModulesConstruction::GetModuleConstruction(G4int i) const 
+{ return fModuleConstructionVector[i]; }
+
+#endif //ALI_MORE_MODULES_CONSTRUCTION_H
diff --git a/AliGeant4/AliParticleGun.cxx b/AliGeant4/AliParticleGun.cxx
new file mode 100644 (file)
index 0000000..9b4b7d2
--- /dev/null
@@ -0,0 +1,174 @@
+// $Id$
+// Category: event
+//
+// See the class description in the header file.
+
+#include "AliParticleGun.h"
+#include "AliParticleGunMessenger.h"
+#include "AliGlobals.h"
+
+#include <G4PrimaryParticle.hh>
+#include <G4Event.hh>
+#include <G4ios.hh>
+
+
+AliParticleGun::AliParticleGun() {
+//
+  fMessenger = new AliParticleGunMessenger(this);
+}
+
+AliParticleGun::AliParticleGun(const AliParticleGun& right)
+{
+  // particles vector
+  fGunParticlesVector.clearAndDestroy();
+  for (G4int i=0; i<right.fGunParticlesVector.entries(); i++) {
+    AliGunParticle* rhsParticle = right.fGunParticlesVector[i];
+    AliGunParticle* newParticle = new AliGunParticle(*rhsParticle);
+    fGunParticlesVector.insert(newParticle);
+  }  
+
+  fMessenger = new AliParticleGunMessenger(this);
+}
+
+AliParticleGun::~AliParticleGun() {
+//
+  fGunParticlesVector.clearAndDestroy();
+  delete fMessenger;
+}
+
+// operators
+
+AliParticleGun& AliParticleGun::operator=(const AliParticleGun& right)
+{
+  // check assignement to self
+  if (this == &right) return *this;
+
+  // particles vector
+  fGunParticlesVector.clearAndDestroy();
+  for (G4int i=0; i<right.fGunParticlesVector.entries(); i++) {
+    AliGunParticle* rhsParticle = right.fGunParticlesVector[i];
+    AliGunParticle* newParticle = new AliGunParticle(*rhsParticle);
+    fGunParticlesVector.insert(newParticle);
+  }
+  
+  return *this;  
+}
+  
+// public methods
+
+void AliParticleGun::AddParticle(AliGunParticle* particle)
+{ 
+// Adds particle.
+// ---
+
+  fGunParticlesVector.insert(particle); 
+}
+
+void AliParticleGun::RemoveParticle(G4int iParticle)
+{ 
+// Removes particle.
+// ---
+
+  AliGunParticle* particle = fGunParticlesVector[iParticle];
+  fGunParticlesVector.remove(particle); 
+  delete particle;  
+}
+
+void AliParticleGun::GeneratePrimaryVertex(G4Event* event)
+{
+// Generates primary vertices.
+// ---
+
+  G4PrimaryVertex* previousVertex = 0;
+  G4ThreeVector previousPosition = G4ThreeVector(); 
+  G4double previousTime = 0.; 
+
+  G4int nofGunParticles = fGunParticlesVector.entries();
+  for( G4int i=0; i<nofGunParticles; i++ )
+  {    
+    AliGunParticle* particle = fGunParticlesVector[i];
+
+    G4ParticleDefinition* particleDefinition
+      = particle->GetParticleDefinition();
+    if (particleDefinition==0) {
+      AliGlobals::Exception(
+        "AliParticleGun::GeneratePrimaryVertex: Unknown particle definition.");
+    }  
+
+    G4ThreeVector position = particle->GetPosition(); 
+    G4double time = particle->GetTime(); 
+    G4PrimaryVertex* vertex;
+    if ( i==0 || position != previousPosition || time != previousTime ) {   
+      // create a new vertex 
+      // in case position and time of gun particle are different from 
+      // previous values
+      // (vertex objects are destroyed in G4EventManager::ProcessOneEvent()
+      // when event is deleted)  
+      vertex = new G4PrimaryVertex(position, time);
+      event->AddPrimaryVertex(vertex);
+
+      previousVertex = vertex;
+      previousPosition = position;
+      previousTime = time;
+    }
+    else 
+      vertex = previousVertex;
+
+    // create a primary particle and add it to the vertex
+    // (primaryParticle objects are destroyed in G4EventManager::ProcessOneEvent()
+    // when event and then vertex is deleted)
+    G4double px = particle->GetMomentum().x();
+    G4double py = particle->GetMomentum().y();
+    G4double pz = particle->GetMomentum().z();
+    G4PrimaryParticle* primaryParticle 
+      = new G4PrimaryParticle(particleDefinition, px, py, pz);
+      
+    G4double mass =  particleDefinition->GetPDGMass();
+    primaryParticle->SetMass(mass);
+    primaryParticle->SetPolarization(particle->GetPolarization().x(),
+                                     particle->GetPolarization().y(),
+                                    particle->GetPolarization().z());    
+    
+    vertex->SetPrimary(primaryParticle);
+  }
+  
+  // delete gun particles
+  fGunParticlesVector.clearAndDestroy();
+
+  // add verbose
+  G4cout << "AliParticleGun::GeneratePrimaryVertex:" << endl;
+  G4cout << "   " 
+         << event->GetNumberOfPrimaryVertex() << " of primary vertices,"
+         << "   " << nofGunParticles << " of primary particles " << endl;  
+}
+
+void AliParticleGun::Reset()
+{ 
+// Resets the particle gun.
+// ---
+
+  fGunParticlesVector.clearAndDestroy(); 
+}
+
+void AliParticleGun::List()
+{
+// Lists the particle gun.
+// ---
+
+  G4int nofGunParticles = fGunParticlesVector.entries();
+
+  G4cout << "Particle Gun: " << endl;
+
+  if (nofGunParticles==0)
+  { G4cout << "   No particles are defined." << endl; }
+  else
+  {
+    for (G4int i=0; i<nofGunParticles; i++)
+    {
+      G4cout << i << " th particle properties: " << endl;
+      G4cout << "============================" << endl;
+      fGunParticlesVector[i]->Print();
+    }
+  }
+}
+
diff --git a/AliGeant4/AliParticleGun.h b/AliGeant4/AliParticleGun.h
new file mode 100644 (file)
index 0000000..df96faa
--- /dev/null
@@ -0,0 +1,60 @@
+// $Id$
+// Category: event
+//
+// Particle gun that can be interactively composed by a user.
+
+#ifndef ALI_PARTICLE_GUN_H
+#define ALI_PARTICLE_GUN_H
+
+#include "AliGunParticle.h"
+
+#include <G4VPrimaryGenerator.hh>
+#include <G4PrimaryVertex.hh>
+#include <globals.hh>
+
+#include <g4rw/tpordvec.h>
+
+class G4Event;
+class AliParticleGunMessenger;
+
+class AliParticleGun : public G4VPrimaryGenerator
+{
+  typedef G4RWTPtrOrderedVector<AliGunParticle>  AliGunParticleVector;
+
+  public:
+     AliParticleGun();
+     AliParticleGun(const AliParticleGun &right);
+     virtual ~AliParticleGun();
+
+     // operators
+     AliParticleGun& operator=(const AliParticleGun& right);
+
+     // methods
+     void AddParticle(AliGunParticle* particle);
+     void RemoveParticle(G4int iParticle);
+     virtual void GeneratePrimaryVertex(G4Event* evt);
+     void Reset();
+     void List();
+
+     // get methods
+     G4int GetNofGunParticles() const;
+  
+  private:
+     // data members
+     AliGunParticleVector      fGunParticlesVector; //vector of AliGunParticle
+     AliParticleGunMessenger*  fMessenger;          //messenger
+};
+
+// inline methods
+
+inline G4int AliParticleGun::GetNofGunParticles() const
+{ return fGunParticlesVector.entries(); }
+
+#endif //ALI_PARTICLE_GUN_H
+
+
+
+
+
+
+
diff --git a/AliGeant4/AliParticleGunMessenger.cxx b/AliGeant4/AliParticleGunMessenger.cxx
new file mode 100644 (file)
index 0000000..9048930
--- /dev/null
@@ -0,0 +1,287 @@
+// $Id$
+// Category: event
+//
+// See the class description in the header file.
+
+#include "AliParticleGunMessenger.h"
+#include "AliParticleGun.h"
+#include "AliGunParticle.h"
+#include "AliGlobals.h"
+
+#include <G4Geantino.hh>
+#include <G4ThreeVector.hh>
+#include <G4ParticleTable.hh>
+#include <G4UIdirectory.hh>
+#include <G4UIcmdWithoutParameter.hh>
+#include <G4UIcmdWithAString.hh>
+#include <G4UIcmdWithADoubleAndUnit.hh>
+#include <G4UIcmdWithAnInteger.hh>
+#include <G4UIcmdWith3Vector.hh>
+#include <G4UIcmdWith3VectorAndUnit.hh>
+
+AliParticleGunMessenger::AliParticleGunMessenger(AliParticleGun* gun)
+  :fGun(gun)
+{
+//
+  fParticleTable = G4ParticleTable::GetParticleTable();
+
+  fGunDirectory = new G4UIdirectory("/aliGun/");
+  fGunDirectory->SetGuidance("AliParticleGun control commands.");
+
+  fListAvailableCmd 
+    = new G4UIcmdWithoutParameter("/aliGun/listAvailable", this);
+  fListAvailableCmd->SetGuidance("List available particles.");
+  fListAvailableCmd->SetGuidance(" Invoke G4ParticleTable.");
+  fListAvailableCmd->AvailableForStates(PreInit,Idle);
+
+  fListCurrentCmd 
+    = new G4UIcmdWithoutParameter("/aliGun/listCurrent", this);
+  fListCurrentCmd->SetGuidance("List current particle properties.");
+  fListCurrentCmd
+    ->SetGuidance("(Use addParticle to add this particle to the gun.");
+  fListCurrentCmd->AvailableForStates(PreInit,Idle);
+
+  fParticleCmd 
+    = new G4UIcmdWithAString("/aliGun/particle", this);
+  fParticleCmd->SetGuidance("Set particle to be generated.");
+  fParticleCmd->SetGuidance(" (geantino is default)");
+  fParticleCmd->SetParameterName("particleName", true);
+  fParticleCmd->SetDefaultValue("geantino");
+  G4String candidateList; 
+  G4int nofPTEntries = fParticleTable->entries();
+  for (G4int i=0; i<nofPTEntries; i++)
+  {
+    candidateList += fParticleTable->GetParticleName(i);
+    candidateList += " ";
+  }
+  fParticleCmd->SetCandidates(candidateList);
+  fParticleCmd->AvailableForStates(PreInit,Idle);
+
+  fMomentumCmd 
+    = new G4UIcmdWith3VectorAndUnit("/aliGun/momentum", this);
+  fMomentumCmd->SetGuidance("Set momentum.");
+  fMomentumCmd->SetParameterName("Px","Py","Pz", true, true);
+  fMomentumCmd->SetDefaultUnit("MeV");
+  fMomentumCmd->SetUnitCategory("Energy"); 
+  fMomentumCmd->SetRange("Px != 0 || Py != 0 || Pz != 0");
+  fMomentumCmd->AvailableForStates(PreInit,Idle);
+
+  fPositionCmd 
+    = new G4UIcmdWith3VectorAndUnit("/aliGun/position", this);
+  fPositionCmd->SetGuidance("Set starting position of the particle.");
+  fPositionCmd->SetParameterName("X","Y","Z", true, true);
+  fPositionCmd->SetDefaultUnit("cm");
+  fPositionCmd->SetUnitCategory("Length");
+  fPositionCmd->AvailableForStates(PreInit,Idle);
+
+  fTimeCmd 
+    = new G4UIcmdWithADoubleAndUnit("/aliGun/time", this);
+  fTimeCmd->SetGuidance("Set initial time of the particle.");
+  fTimeCmd->SetParameterName("t0", true, true);
+  fTimeCmd->SetDefaultUnit("ns");
+  fTimeCmd->SetUnitCategory("Time");
+  fTimeCmd->AvailableForStates(PreInit,Idle);
+  
+  fPolarizationCmd 
+    = new G4UIcmdWith3Vector("/aliGun/polarization", this);
+  fPolarizationCmd->SetGuidance("Set polarization.");
+  fPolarizationCmd->SetParameterName("Px","Py","Pz", true, true); 
+  fPolarizationCmd
+    ->SetRange("Px>=-1. && Px<=1. && Py>=-1. && Py<=1. && Pz>=-1. && Pz<=1.");
+  fPolarizationCmd->AvailableForStates(PreInit,Idle);
+  
+  fDirectionCmd 
+    = new G4UIcmdWith3Vector("/aliGun/direction", this);
+  fDirectionCmd->SetGuidance("Set momentum direction.");
+  fDirectionCmd->SetGuidance("Direction needs not to be a unit vector.");
+  fDirectionCmd->SetParameterName("Dx","Dy","Dz", true, true); 
+  fDirectionCmd->SetRange("Dx != 0 || Dy != 0 || Dz != 0");
+  fDirectionCmd->AvailableForStates(PreInit,Idle);
+  
+  fKinEnergyCmd 
+    = new G4UIcmdWithADoubleAndUnit("/aliGun/kinEnergy", this);
+  fKinEnergyCmd->SetGuidance("Set kinetic energy.");
+  fKinEnergyCmd->SetParameterName("KineticEnergy", true, true);
+  fKinEnergyCmd->SetDefaultUnit("GeV");
+  fKinEnergyCmd->SetUnitCategory("Energy");
+  fKinEnergyCmd->AvailableForStates(PreInit,Idle);
+
+  fListCmd 
+    = new G4UIcmdWithoutParameter("/aliGun/list",this);
+  fListCmd->SetGuidance("List the Alice gun particles.");
+  fListCmd->AvailableForStates(PreInit,Idle);
+
+  fAddParticleCmd 
+    = new G4UIcmdWithoutParameter("/aliGun/addParticle", this);
+  fAddParticleCmd->SetGuidance("Add the particle to the Alice particle gun.");
+  fAddParticleCmd->AvailableForStates(PreInit,Idle);
+
+  fRemoveParticleCmd 
+    = new G4UIcmdWithAnInteger("/aliGun/removeParticle", this);
+  fRemoveParticleCmd
+    ->SetGuidance("Remove the i-th particle friom the Alice particle gun.");
+  fRemoveParticleCmd->SetParameterName("iParticle", false);
+  fRemoveParticleCmd->SetRange("iParticle>=0");
+  fRemoveParticleCmd->AvailableForStates(PreInit,Idle);
+
+  fResetCmd 
+    = new G4UIcmdWithoutParameter("/aliGun/reset", this);
+  fResetCmd->SetGuidance("ReSet the Alice particle gun.");
+  fResetCmd->AvailableForStates(PreInit,Idle);
+
+  // Set initial value to AliGunParticle
+  fParticle = new AliGunParticle();
+
+  fParticle->SetParticleDefinition(G4Geantino::Geantino());
+  fParticle->SetMomentumDirection(G4ThreeVector(1.0,0.0,0.0));
+  fParticle->SetKineticEnergy(1.0*GeV);
+  fParticle->SetPosition(G4ThreeVector(0.0*cm, 0.0*cm, 0.0*cm));
+  fParticle->SetTime(0.0*ns);
+  fParticle->SetPolarization(G4ThreeVector(0.0*cm, 0.0*cm, 0.0*cm));
+}
+
+AliParticleGunMessenger::AliParticleGunMessenger() {
+//
+}
+
+AliParticleGunMessenger::AliParticleGunMessenger(
+                                 const AliParticleGunMessenger& right) {
+//                              
+  AliGlobals::Exception("AliParticleGunMessenger is protected from copying.");
+}
+
+AliParticleGunMessenger::~AliParticleGunMessenger() {
+//
+  delete fListAvailableCmd;
+  delete fParticleCmd;
+  delete fMomentumCmd;
+  delete fPositionCmd;
+  delete fTimeCmd;
+  delete fPolarizationCmd;
+  delete fDirectionCmd;
+  delete fKinEnergyCmd;
+  delete fListCmd;
+  delete fAddParticleCmd;
+  delete fRemoveParticleCmd;
+  delete fResetCmd;
+  delete fGunDirectory;
+  delete fParticle;
+}
+
+// operators
+
+AliParticleGunMessenger& 
+AliParticleGunMessenger::operator=(const AliParticleGunMessenger &right)
+{
+  // check assignement to self
+  if (this == &right) return *this;
+  
+  AliGlobals::Exception("AliParticleGunMessenger is protected from assigning.");
+
+  return *this;
+}
+
+// public methods
+
+void AliParticleGunMessenger::SetNewValue(G4UIcommand * command, 
+       G4String newValues)
+{
+// Applies command to the associated object.
+// ---
+
+  // Alice gun particle set commands
+  if (command==fListAvailableCmd)
+  { 
+    fParticleTable->DumpTable(); 
+  } 
+  else if (command == fParticleCmd)
+  {
+    G4ParticleDefinition* particleDef 
+      = fParticleTable->FindParticle(newValues);
+    if (particleDef != 0)
+    { fParticle->SetParticleDefinition(particleDef); }
+  } 
+  else if (command == fListCurrentCmd)
+  { 
+    fParticle->Print(); 
+  } 
+  else if (command == fMomentumCmd)
+  { 
+    fParticle->SetMomentum(fMomentumCmd->GetNew3VectorValue(newValues)); 
+  } 
+  else if (command == fPositionCmd)
+  { 
+    fParticle->SetPosition(fDirectionCmd->GetNew3VectorValue(newValues)); 
+  }
+  else if (command == fTimeCmd)
+  { 
+    fParticle->SetTime(fTimeCmd->GetNewDoubleValue(newValues)); 
+  }
+  else if (command == fPolarizationCmd)
+  { 
+    fParticle
+      ->SetPolarization(fPolarizationCmd->GetNew3VectorValue(newValues)); 
+  } 
+  else if (command == fDirectionCmd)
+  { 
+    fParticle
+      ->SetMomentumDirection(fDirectionCmd->GetNew3VectorValue(newValues)); 
+  } 
+  else if (command == fKinEnergyCmd)
+  { 
+    fParticle->SetKineticEnergy(fKinEnergyCmd->GetNewDoubleValue(newValues)); 
+  }
+
+  // Alice particle gun commands 
+  else if (command == fListCmd)
+  { 
+    fGun->List(); 
+  }
+  else if (command == fAddParticleCmd)
+  { 
+    fGun->AddParticle(fParticle);
+    fParticle = new AliGunParticle(*fParticle); 
+  } 
+  else if (command == fRemoveParticleCmd)
+  { 
+    fGun->RemoveParticle(fRemoveParticleCmd->GetNewIntValue(newValues)); 
+  }
+  else if (command == fResetCmd)
+  { 
+    fGun->Reset(); 
+  }
+}
+
+G4String AliParticleGunMessenger::GetCurrentValue(G4UIcommand * command)
+{
+// Returns current command parameters as string.
+// ---
+
+  G4String curValue;
+
+  if( command==fDirectionCmd )
+  { 
+    curValue 
+      = fDirectionCmd->ConvertToString(fParticle->GetMomentumDirection()); 
+  } 
+  else if( command==fKinEnergyCmd )
+  { 
+    curValue 
+      = fKinEnergyCmd->ConvertToString(fParticle->GetKineticEnergy(),"GeV"); 
+  } 
+  else if( command==fPositionCmd )
+  { 
+    curValue = fPositionCmd->ConvertToString(fParticle->GetPosition(),"cm"); 
+  } 
+  else if( command==fTimeCmd )
+  { 
+    curValue = fTimeCmd->ConvertToString(fParticle->GetTime(),"ns"); 
+  } 
+  else if( command==fPolarizationCmd )
+  { 
+    curValue = fPolarizationCmd->ConvertToString(fParticle->GetPolarization()); 
+  }
+  
+ return curValue;
+}
+
diff --git a/AliGeant4/AliParticleGunMessenger.h b/AliGeant4/AliParticleGunMessenger.h
new file mode 100644 (file)
index 0000000..e596d7b
--- /dev/null
@@ -0,0 +1,70 @@
+// $Id$
+// Category: event
+//
+// Messenger class that defines commands for AliParticleGun.
+
+#ifndef ALI_PARTICLE_GUN_MESSENGER_H
+#define ALI_PARTICLE_GUN_MESSENGER_H
+
+#include <G4UImessenger.hh>
+#include <globals.hh>
+
+class AliParticleGun;
+class AliGunParticle;
+class G4ParticleTable;
+class G4UIcommand;
+class G4UIdirectory;
+class G4UIcmdWithoutParameter;
+class G4UIcmdWithAString;
+class G4UIcmdWithADoubleAndUnit;
+class G4UIcmdWithAnInteger;
+class G4UIcmdWith3Vector;
+class G4UIcmdWith3VectorAndUnit;
+
+class AliParticleGunMessenger: public G4UImessenger
+{
+  public:
+    AliParticleGunMessenger(AliParticleGun* gun);
+    // --> protected
+    // AliParticleGunMessenger();
+    // AliParticleGunMessenger(const AliParticleGunMessenger& right);
+    virtual ~AliParticleGunMessenger();
+
+    // methods
+    virtual void SetNewValue(G4UIcommand* command, G4String newValues);
+    virtual G4String GetCurrentValue(G4UIcommand* command);
+
+  protected:
+    AliParticleGunMessenger();
+    AliParticleGunMessenger(const AliParticleGunMessenger& right);
+
+    // operators
+    AliParticleGunMessenger& operator=(
+                            const AliParticleGunMessenger& right);
+
+  private:
+    // data members
+    AliParticleGun*   fGun;           //associated class
+    AliGunParticle*   fParticle;      //current AliGunParticle
+    G4ParticleTable*  fParticleTable; //G4ParticleTable
+    // commands data members
+    G4UIdirectory*              fGunDirectory;      //command directory
+    G4UIcmdWithoutParameter*    fListAvailableCmd;  //command: listAvailable
+    G4UIcmdWithoutParameter*    fListCurrentCmd;    //command: listCurrent
+    G4UIcmdWithAString*         fParticleCmd;       //command: particle
+    G4UIcmdWith3VectorAndUnit*  fMomentumCmd;       //command: momentum
+    G4UIcmdWith3VectorAndUnit*  fPositionCmd;       //command: position
+    G4UIcmdWithADoubleAndUnit*  fTimeCmd;           //command: time
+    G4UIcmdWith3Vector*         fPolarizationCmd;   //command: polarization
+    G4UIcmdWith3Vector*         fDirectionCmd;      //command: direction 
+    G4UIcmdWithADoubleAndUnit*  fKinEnergyCmd;      //command: kinEnergy
+    G4UIcmdWithoutParameter*    fListCmd;           //command: list
+    G4UIcmdWithoutParameter*    fAddParticleCmd;    //command: addParticle
+    G4UIcmdWithAnInteger*       fRemoveParticleCmd; //command: removeParticle
+    G4UIcmdWithoutParameter*    fResetCmd;          //command: reset
+};
+
+#endif //ALI_PARTICLE_GUN_MESSENGER_H
+
+
diff --git a/AliGeant4/AliPrimaryGenerator.h b/AliGeant4/AliPrimaryGenerator.h
new file mode 100644 (file)
index 0000000..552bad8
--- /dev/null
@@ -0,0 +1,15 @@
+// $Id$
+
+#ifndef ALI_PRIMARY_GENERATOR_H
+#define ALI_PRIMARY_GENERATOR_H
+
+// available primary generators
+
+enum AliPrimaryGenerator {
+    kGun,               // gun (can be set interactively) 
+    kGeantino,          // geantino with random direction
+    kChargedGeantino,   // chargedgeantino with random direction
+    kAliGenerator       // AliGenerator from AliRoot
+};  
+
+#endif //ALI_PRIMARY_GENERATOR_H
diff --git a/AliGeant4/AliPrimaryGeneratorAction.cxx b/AliGeant4/AliPrimaryGeneratorAction.cxx
new file mode 100644 (file)
index 0000000..d990a4a
--- /dev/null
@@ -0,0 +1,304 @@
+// $Id$
+// Category: run
+//
+// See the class description in the header file.
+
+#include "AliPrimaryGeneratorAction.h"
+#include "AliPrimaryGeneratorMessenger.h"
+#include "AliTrackingAction.h"
+#include "AliParticleGun.h"
+#include "AliGunParticle.h"
+#include "AliGlobals.h"
+#include "AliRun.h"
+#include "AliGenerator.h"
+
+#include "TG3Units.h"
+
+#include <G4Event.hh>
+#include <G4ParticleTable.hh>
+#include <G4ParticleDefinition.hh>
+
+#include <Randomize.hh>
+
+#include <TParticle.h>
+
+AliPrimaryGeneratorAction::AliPrimaryGeneratorAction()
+  : fGenerator(kAliGenerator),
+    fNofGunParticles(1),
+    fVerboseLevel(0),
+    fParticleArray(0)
+{
+//
+  fParticleGun = new AliParticleGun();
+  fMessenger = new AliPrimaryGeneratorMessenger(this);
+}
+
+AliPrimaryGeneratorAction::AliPrimaryGeneratorAction(
+                                    const AliPrimaryGeneratorAction& right) {
+//                                 
+  AliGlobals::Exception(
+    "AliPrimaryGeneratorAction is protected from copying.");
+}
+
+AliPrimaryGeneratorAction::~AliPrimaryGeneratorAction() {
+//
+  delete fMessenger;
+  delete fParticleGun;
+}
+
+// operators
+
+AliPrimaryGeneratorAction& 
+AliPrimaryGeneratorAction::operator=(const AliPrimaryGeneratorAction &right)
+{
+  // check assignement to self
+  if (this == &right) return *this;
+  
+  AliGlobals::Exception(
+    "AliPrimaryGeneratorAction is protected from assigning.");
+
+  return *this;
+}
+
+// private methods
+
+void AliPrimaryGeneratorAction::ConstructGenerator()
+{
+// Constructs selected generator.
+// ---
+
+  fParticleArray = 0;
+  switch (fGenerator) { 
+    case kGun:
+      // gun is constructed interactively      
+      return;
+    case kGeantino: 
+      ConstructGeantinoGenerator(false);
+      return;
+    case kChargedGeantino:  
+      ConstructGeantinoGenerator(true);
+      return;
+    case kAliGenerator:
+      ConstructAliGenerator();
+      return;
+  }
+}   
+      
+void AliPrimaryGeneratorAction::ConstructGeantinoGenerator(G4bool isCharged)
+{
+// Geantino with random momentum direction
+// (the default generator).
+// ---
+
+  // reset gun
+  fParticleGun->Reset();     
+
+  G4ParticleTable* particleTable 
+    = G4ParticleTable::GetParticleTable();
+
+  for (G4int i=0; i< fNofGunParticles; i++)
+  {
+    G4ParticleDefinition* particleDef = 0; 
+    if (!isCharged)
+      particleDef = particleTable->FindParticle("geantino");
+    else  
+      particleDef = particleTable->FindParticle("chargedgeantino");
+
+    if (!particleDef) {
+      G4String text = "AliPrimaryGeneratorAction::GenerateGeantino:\n";
+      text = text + "   G4ParticleTable::FindParticle() failed.";
+      AliGlobals::Exception(text);
+    }  
+      
+    G4double rn[3];
+    RandFlat::shootArray(3,rn);
+    G4double px=rn[0];
+    G4double py=rn[1];
+    G4double pz=rn[2];
+    G4ThreeVector momentumDir(px, py, pz);
+
+    G4double energy = 1.*GeV;
+    G4ThreeVector position(0.,0.,0.);
+    G4double time = 0.;
+    G4ThreeVector polarization(0.,0.,0.);
+    
+    AliGunParticle * gunParticle
+      = new AliGunParticle(particleDef, momentumDir, energy, position, time, 
+              polarization);
+
+    fParticleGun->AddParticle(gunParticle);     
+  } 
+  if (fVerboseLevel>1) { 
+    G4cout << "Geantino generator has been built." << endl; 
+  }
+} 
+            
+void AliPrimaryGeneratorAction::ConstructAliGenerator()
+{
+// Generator from AliRoot
+// AliGenerator::Generate() fills the AliRun::fParticles array.
+// ---
+
+  // check if AliGenerator is set
+  AliGenerator* generator = gAlice->Generator();
+  if (!generator) {
+    G4String text = "AliPrimaryGeneratorAction::ConstructGenerator:\n";
+    text = text + "   No AliGenerator is defined in gAlice.";
+    AliGlobals::Exception(text);
+  }  
+  // fill AliRun::fParticles array 
+  generator->Generate();
+  fParticleArray = gAlice->Particles();
+}
+
+void AliPrimaryGeneratorAction::GenerateAliGeneratorPrimaries(G4Event* event)
+{
+// Creates a new G4PrimaryVertex objects for each TParticle
+// in fParticles array.
+// ---
+
+  G4PrimaryVertex* previousVertex = 0;
+  G4ThreeVector previousPosition = G4ThreeVector(); 
+  G4double previousTime = 0.; 
+
+  G4int nofParticles = gAlice->GetNtrack();
+  // add verbose
+  //G4cout << " nofParticles: " <<  nofParticles << endl;
+  for( G4int i=0; i<nofParticles; i++ ) {    
+  
+    // get particle from TClonesArray
+    TObject* particleTObject
+      = fParticleArray->UncheckedAt(i);      
+    TParticle* particle
+      = dynamic_cast<TParticle*>(particleTObject);
+
+    // check particle type
+    if (!particle) {
+      G4String text =
+        "AliPrimaryGeneratorAction::GenerateAliGeneratorPrimaries\n";
+      text = text + "Unknown particle type";           
+      AliGlobals::Exception(text);
+    }  
+     
+    // get particle definition from G4ParticleTable
+    G4int pdgEncoding = particle->GetPdgCode();
+    G4ParticleTable* particleTable 
+      = G4ParticleTable::GetParticleTable();                
+    G4ParticleDefinition* particleDefinition = 0;    
+    if (pdgEncoding != 0) 
+      particleDefinition = particleTable->FindParticle(pdgEncoding);
+    else {
+      G4String name = particle->GetName();
+      if (name == "Rootino")   
+        particleDefinition = particleTable->FindParticle("geantino");
+    }  
+  
+    if (particleDefinition==0) {
+      G4cout << "pdgEncoding: " << pdgEncoding << endl;
+      G4String text = 
+        "AliPrimaryGeneratorAction::GenerateAliGeneratorPrimaries:\n";
+      text = text + "   G4ParticleTable::FindParticle() failed.";
+      AliGlobals::Exception(text);
+    }  
+
+    // get/create vertex
+    G4ThreeVector position 
+      = G4ThreeVector(particle->Vx()*TG3Units::Length(),
+                      particle->Vy()*TG3Units::Length(),
+                     particle->Vz()*TG3Units::Length());
+    G4double time = particle->T()*TG3Units::Time(); 
+    G4PrimaryVertex* vertex;
+    if ( i==0 || position != previousPosition || time != previousTime ) {   
+      // create a new vertex 
+      // in case position and time of gun particle are different from 
+      // previous values
+      // (vertex objects are destroyed in G4EventManager::ProcessOneEvent()
+      // when event is deleted)  
+      vertex = new G4PrimaryVertex(position, time);
+      event->AddPrimaryVertex(vertex);
+
+      previousVertex = vertex;
+      previousPosition = position;
+      previousTime = time;
+    }
+    else 
+      vertex = previousVertex;
+
+    // create a primary particle and add it to the vertex
+    // (primaryParticle objects are destroyed in G4EventManager::ProcessOneEvent()
+    // when event and then vertex is deleted)
+    G4double px = particle->Px()*TG3Units::Energy();
+    G4double py = particle->Py()*TG3Units::Energy();
+    G4double pz = particle->Pz()*TG3Units::Energy();
+    G4PrimaryParticle* primaryParticle 
+      = new G4PrimaryParticle(particleDefinition, px, py, pz);
+      
+    // set polarization
+    TVector3 polarization;
+    particle->GetPolarisation(polarization);
+    primaryParticle
+      ->SetPolarization(polarization.X(), polarization.Y(), polarization.Z());    
+    
+    // add primary particle to the vertex
+    vertex->SetPrimary(primaryParticle);
+  }
+}
+
+// public methods
+
+void AliPrimaryGeneratorAction::GeneratePrimaries(G4Event* event)
+{
+// Generates primary particles by the selected generator.
+// ---
+
+  // reset AliRun
+  gAlice->BeginEvent();
+
+  // fill particle gun/particle array
+  ConstructGenerator();
+  
+  // generate primary vertices
+  if (fParticleArray)  {
+    // use AliGenerator if set
+    GenerateAliGeneratorPrimaries(event);
+
+    // do not save primary particles
+    // (they would be stored twice)
+    AliTrackingAction* trackingAction
+      =  AliTrackingAction::Instance();
+    trackingAction->SetSavePrimaries(false);
+  }  
+  else {
+    // use particle gun otherwise
+    fParticleGun->GeneratePrimaryVertex(event);
+
+    // primary particles have to be saved
+    AliTrackingAction* trackingAction
+      =  AliTrackingAction::Instance();
+    trackingAction->SetSavePrimaries(true);
+  }  
+}
+
+void AliPrimaryGeneratorAction::SetGenerator(AliPrimaryGenerator generator)
+{ 
+// Sets generator.
+// ---
+
+  fGenerator = generator; 
+}
+
+void AliPrimaryGeneratorAction::SetNofGunParticles(G4int nofParticles)
+{ 
+// Sets number of primary particles.
+// This method is applied only to "gun" type generators
+// (and not to AliGenerator from AliRoot).
+// ---
+
+  fNofGunParticles = nofParticles;
+}
+
+
+
+
+
+
diff --git a/AliGeant4/AliPrimaryGeneratorAction.h b/AliGeant4/AliPrimaryGeneratorAction.h
new file mode 100644 (file)
index 0000000..8c0b2f6
--- /dev/null
@@ -0,0 +1,86 @@
+// $Id$
+// Category: run
+//
+// Class that defines primary generator action. 
+// Available primary generators (AliPrimaryGenerator):
+//  kGun,               // gun (can be set interactively) 
+//  kGeantino,          // geantino with random direction
+//  kChargedGeantino,   // chargedgeantino with random direction
+//  kAliGenerator       // AliGenerator from AliRoot
+
+#ifndef ALI_PRIMARY_GENERATOR_ACTION_H
+#define ALI_PRIMARY_GENERATOR_ACTION_H
+
+#include "AliPrimaryGenerator.h"
+
+#include <G4VUserPrimaryGeneratorAction.hh>
+#include <globals.hh>
+
+#include <TClonesArray.h>
+
+class AliParticleGun;
+class AliPrimaryGeneratorMessenger;
+class G4ParticleGun;
+class G4Event;
+
+class AliPrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
+{
+  public:
+    AliPrimaryGeneratorAction();
+    // --> protected
+    // AliPrimaryGeneratorAction(const AliPrimaryGeneratorAction& right);
+    virtual ~AliPrimaryGeneratorAction();
+
+    // methods
+    virtual void GeneratePrimaries(G4Event* event);
+    
+    // set methods
+    void SetGenerator(AliPrimaryGenerator generator);
+    void SetNofGunParticles(G4int nofParticles);
+    void SetVerboseLevel(G4int level);
+
+    // get methods
+    AliPrimaryGenerator GetGenerator() const;
+    G4int GetNofGunParticles() const;
+    G4int GetVerboseLevel() const;
+    
+  protected:
+    AliPrimaryGeneratorAction(const AliPrimaryGeneratorAction& right);
+
+    // operators
+    AliPrimaryGeneratorAction& operator=(
+                              const AliPrimaryGeneratorAction& right);
+
+  private:
+    // methods
+    void ConstructGenerator();
+    void ConstructGeantinoGenerator(G4bool isCharged);
+    void ConstructAliGenerator();
+    void GenerateAliGeneratorPrimaries(G4Event* event);
+    
+    // data members
+    AliPrimaryGenerator  fGenerator;       //selected AliPrimaryGenerator
+    G4int                fNofGunParticles; //number of gun particles
+    G4int                fVerboseLevel;    //verbose level
+    AliParticleGun*      fParticleGun;     //AliParticleGun
+    TClonesArray*        fParticleArray;   //AliRun::fParticles
+    AliPrimaryGeneratorMessenger*  fMessenger; //messenger
+};
+
+// inline methods
+
+inline void AliPrimaryGeneratorAction::SetVerboseLevel(G4int level)
+{ fVerboseLevel = level; }
+
+inline AliPrimaryGenerator AliPrimaryGeneratorAction::GetGenerator() const
+{ return fGenerator; }
+
+inline G4int AliPrimaryGeneratorAction::GetNofGunParticles() const
+{ return fNofGunParticles; }
+
+inline G4int AliPrimaryGeneratorAction::GetVerboseLevel() const
+{ return fVerboseLevel; }
+
+#endif //ALI_PRIMARY_GENERATOR_ACTION_H
+
+
diff --git a/AliGeant4/AliPrimaryGeneratorMessenger.cxx b/AliGeant4/AliPrimaryGeneratorMessenger.cxx
new file mode 100644 (file)
index 0000000..490395a
--- /dev/null
@@ -0,0 +1,112 @@
+// $Id$
+// Category: run
+//
+// See the class description in the header file.
+
+#include "AliPrimaryGeneratorMessenger.h"
+#include "AliPrimaryGeneratorAction.h"
+#include "AliPrimaryGenerator.h"
+#include "AliGlobals.h"
+
+#include <G4UIdirectory.hh>
+#include <G4UIcmdWithAString.hh>
+#include <G4UIcmdWithAnInteger.hh>
+
+AliPrimaryGeneratorMessenger::AliPrimaryGeneratorMessenger(
+  AliPrimaryGeneratorAction* primaryGenAction)
+  : fPrimaryGenAction(primaryGenAction)
+{
+// 
+  fPrimariesDirectory = new G4UIdirectory("/aliGenerator/");
+  fPrimariesDirectory->SetGuidance("AliPrimaryGeneratorAction control commands.");
+
+  fGeneratorCmd = new G4UIcmdWithAString("/aliGenerator/set", this);
+  G4String guidance =   "Set one of the defined primary generators:\n";
+  guidance = guidance + "  Gun:               particle gun (default)\n";
+  guidance = guidance + "  Geantino:          geantino with random momentum(default)\n";
+  guidance = guidance + "  ChargedGeantino:   chargedgeantino with random momentum\n";
+  guidance = guidance + "  AliGenerator:      standard aliroot generator";
+  fGeneratorCmd->SetGuidance(guidance);
+  fGeneratorCmd->SetParameterName("Generator", true);
+  fGeneratorCmd->SetCandidates("Gun Geantino ChargedGeantino AliGenerator");   
+  fGeneratorCmd->SetDefaultValue("AliGenerator");
+  fGeneratorCmd->AvailableForStates(PreInit,Idle);
+
+  fNofParticlesCmd = new G4UIcmdWithAnInteger("/aliGenerator/nofParticles", this);
+  fNofParticlesCmd->SetGuidance("Give number of primary particles:");
+  fNofParticlesCmd->SetGuidance("It is applied only to \"gun\" type generators.");
+  fNofParticlesCmd->SetParameterName("NofParticles", true);
+  fNofParticlesCmd->SetDefaultValue(1);
+  fNofParticlesCmd->SetRange("NofParticles >= 0");
+  fNofParticlesCmd->AvailableForStates(PreInit,Idle);
+
+  fVerboseCmd = new G4UIcmdWithAnInteger("/aliGenerator/verbose", this);
+  fVerboseCmd->SetGuidance("Set verbose level for AliPrimaryGeneratorAction");
+  fVerboseCmd->SetParameterName("VerboseLevel", true);
+  fVerboseCmd->SetDefaultValue(0);
+  fVerboseCmd->SetRange("VerboseLevel >= 0 && VerboseLevel <= 2");
+  fVerboseCmd->AvailableForStates(Idle);
+}
+
+AliPrimaryGeneratorMessenger::AliPrimaryGeneratorMessenger() {
+//
+}
+
+AliPrimaryGeneratorMessenger::AliPrimaryGeneratorMessenger(
+                                 const AliPrimaryGeneratorMessenger& right) {
+//                              
+  AliGlobals::Exception(
+    "AliPrimaryGeneratorMessenger is protected from copying.");
+}
+
+AliPrimaryGeneratorMessenger::~AliPrimaryGeneratorMessenger() {
+//
+  delete fPrimariesDirectory;
+  delete fGeneratorCmd;
+  delete fNofParticlesCmd;
+  delete fVerboseCmd;
+}
+
+// operators
+
+AliPrimaryGeneratorMessenger& 
+AliPrimaryGeneratorMessenger::operator=(
+                                const AliPrimaryGeneratorMessenger &right)
+{
+  // check assignement to self
+  if (this == &right) return *this;
+  
+  AliGlobals::Exception(
+    "AliPrimaryGeneratorMessenger is protected from assigning.");
+
+  return *this;
+}
+
+// public methods
+
+void AliPrimaryGeneratorMessenger::SetNewValue(G4UIcommand * command,
+       G4String newValue)
+{ 
+// Applies command to the associated object.
+// ---
+
+  if( command == fGeneratorCmd ) { 
+    if (newValue == "Gun") 
+      fPrimaryGenAction->SetGenerator(kGun); 
+    else if (newValue == "Geantino") 
+      fPrimaryGenAction->SetGenerator(kGeantino); 
+    else if (newValue == "ChargedGeantino")  
+      fPrimaryGenAction->SetGenerator(kChargedGeantino); 
+    else if (newValue == "AliGenerator")  
+      fPrimaryGenAction->SetGenerator(kAliGenerator);       
+  }
+  else if( command == fNofParticlesCmd ) { 
+    fPrimaryGenAction
+      ->SetNofGunParticles(fNofParticlesCmd->GetNewIntValue(newValue)); 
+  }   
+  else if(command == fVerboseCmd) { 
+    fPrimaryGenAction
+      ->SetVerboseLevel(fVerboseCmd->GetNewIntValue(newValue)); 
+  }
+}
+
diff --git a/AliGeant4/AliPrimaryGeneratorMessenger.h b/AliGeant4/AliPrimaryGeneratorMessenger.h
new file mode 100644 (file)
index 0000000..7fb492b
--- /dev/null
@@ -0,0 +1,48 @@
+// $Id$
+// Category: run
+//
+// Messenger class that defines commands for AliPrimaryGeneratorAction.
+
+#ifndef ALI_PRIMARY_GENERATOR_MESSENGER_H
+#define ALI_PRIMARY_GENERATOR_MESSENGER_H
+
+#include <G4UImessenger.hh>
+#include <globals.hh>
+
+class AliPrimaryGeneratorAction;
+
+class G4UIdirectory;
+class G4UIcmdWithAString;
+class G4UIcmdWithAnInteger;
+
+class AliPrimaryGeneratorMessenger: public G4UImessenger
+{
+  public:
+    AliPrimaryGeneratorMessenger(AliPrimaryGeneratorAction* primaryGenAction);
+    // --> protected
+    // AliPrimaryGeneratorMessenger();
+    // AliPrimaryGeneratorMessenger(const AliPrimaryGeneratorMessenger& right);
+    virtual ~AliPrimaryGeneratorMessenger();
+    
+    // methods
+    void SetNewValue(G4UIcommand* command, G4String string);
+    
+  protected:
+    AliPrimaryGeneratorMessenger();
+    AliPrimaryGeneratorMessenger(const AliPrimaryGeneratorMessenger& right);
+
+    // operators
+    AliPrimaryGeneratorMessenger& operator=(
+                                 const AliPrimaryGeneratorMessenger& right);
+
+  private:
+    // data members
+    AliPrimaryGeneratorAction*  fPrimaryGenAction;   //associated class
+    G4UIdirectory*              fPrimariesDirectory; //command directory
+    G4UIcmdWithAString*         fGeneratorCmd;       //command: set
+    G4UIcmdWithAnInteger*       fNofParticlesCmd;    //command: nofParticles
+    G4UIcmdWithAnInteger*       fVerboseCmd;         //command: verbose
+};
+
+#endif //ALI_PRIMARY_GENERATOR_MESSENGER_H
+
diff --git a/AliGeant4/AliRunAction.cxx b/AliGeant4/AliRunAction.cxx
new file mode 100644 (file)
index 0000000..c643b53
--- /dev/null
@@ -0,0 +1,103 @@
+// $Id$
+// Category: run
+//
+// See the class description in the header file.
+
+#include <G4Timer.hh>
+   // in order to avoid the odd dependency for the
+   // times system function this include must be the first
+
+#include "AliRunAction.h"
+#include "AliRunActionMessenger.h"
+#include "AliSDManager.h"
+#include "AliGlobals.h"
+#include "AliRun.h"
+#include "AliLego.h"
+
+#include "TG4GeometryManager.h"
+
+#include <G4Run.hh>
+#include <G4UImanager.hh>
+
+#include <TFile.h>
+
+AliRunAction::AliRunAction()
+  : fRunID(-1),
+    fVerboseLevel(0)
+{
+//
+  fMessenger = new AliRunActionMessenger(this);
+  fTimer = new G4Timer;
+}
+
+AliRunAction::AliRunAction(const AliRunAction& right) {
+//
+  AliGlobals::Exception("AliRunAction is protected from copying.");
+}
+
+AliRunAction::~AliRunAction() {
+//
+  delete fMessenger;
+  delete fTimer;
+}
+
+// operators
+
+AliRunAction& AliRunAction::operator=(const AliRunAction &right)
+{
+  // check assignement to self
+  if (this == &right) return *this;
+  
+  AliGlobals::Exception("AliRunAction is protected from assigning.");
+
+  return *this;
+}
+
+// public methods
+
+void AliRunAction::BeginOfRunAction(const G4Run* run)
+{
+// Called by G4 kernel at the beginning of run.
+// ---
+
+  fRunID++;
+  
+  // aliroot
+  // store runID in the event header
+  gAlice->GetHeader()->SetRun(fRunID);
+
+  // clear remaining G3 tables
+  if (fRunID == 0)
+    TG4GeometryManager::Instance()->ClearG3TablesFinal();
+
+  // create lego sensitive detectors 
+  // if lego is instantiated
+  AliLego* lego = gAlice->Lego();
+  if (lego) {
+    AliSDManager::Instance()->SetLego(lego);
+    G4UImanager::GetUIpointer()->ApplyCommand("/aliEvent/verbose 0");
+    G4UImanager::GetUIpointer()->ApplyCommand("/aliGenerator/set AliGenerator");
+  }  
+
+  G4cout << "### Run " << run->GetRunID() << " start." << endl;
+  fTimer->Start();
+}
+
+void AliRunAction::EndOfRunAction(const G4Run* run)
+{
+// Called by G4 kernel at the end of run.
+// ---
+
+  fTimer->Stop();
+
+  // delete lego sensitive detectors 
+  // if lego is instantiated
+  AliLego* lego = gAlice->Lego();
+  if (lego) {
+    AliSDManager::Instance()->UnsetLego();
+    G4UImanager::GetUIpointer()->ApplyCommand("/aliEvent/verbose 1");
+  }  
+
+  G4cout << "Number of events = " << run->GetNumberOfEvent() 
+         << " " << *fTimer << endl;
+}    
diff --git a/AliGeant4/AliRunAction.h b/AliGeant4/AliRunAction.h
new file mode 100644 (file)
index 0000000..8320199
--- /dev/null
@@ -0,0 +1,60 @@
+// $Id$
+// Category: run
+//
+// Class that defines actions at the beginning and the end of run.
+
+#ifndef ALI_RUN_ACTION_H
+#define ALI_RUN_ACTION_H
+
+#include <globals.hh>
+#include <G4UserRunAction.hh>
+
+class G4Timer;
+    // in order to avoid the odd dependency for the
+    // times system function this declaration must be the first
+
+class AliRunActionMessenger;
+class G4Run;
+
+class AliRunAction : public G4UserRunAction
+{
+  public:
+    AliRunAction();
+    // --> protected
+    // AliRunAction(const AliRunAction& right);
+    virtual ~AliRunAction();
+
+    // methods
+    virtual void BeginOfRunAction(const G4Run* run);
+    virtual void EndOfRunAction(const G4Run* run);
+
+    // set methods
+    void SetVerboseLevel(G4int level);
+
+    // get methods
+    G4int GetVerboseLevel() const;
+
+  protected:
+    AliRunAction(const AliRunAction& right);
+
+    // operators
+    AliRunAction& operator=(const AliRunAction& right);
+
+  private:
+    // data members
+    AliRunActionMessenger*  fMessenger;    //messenger 
+    G4Timer*                fTimer;        //G4Timer
+    G4int                   fRunID;        //run ID
+    G4int                   fVerboseLevel; //verbose level
+};
+
+// inline methods
+
+inline void AliRunAction::SetVerboseLevel(G4int level)
+{ fVerboseLevel = level; }
+
+inline G4int AliRunAction::GetVerboseLevel() const
+{ return fVerboseLevel; }
+
+#endif //ALI_RUN_ACTION_H
+
diff --git a/AliGeant4/AliRunActionMessenger.cxx b/AliGeant4/AliRunActionMessenger.cxx
new file mode 100644 (file)
index 0000000..1dc1e66
--- /dev/null
@@ -0,0 +1,70 @@
+// $Id$
+// Category: run
+//
+// See the class description in the header file.
+
+#include "AliRunActionMessenger.h"
+#include "AliRunAction.h"
+#include "AliGlobals.h"
+
+#include <G4UIdirectory.hh>
+#include <G4UIcmdWithAnInteger.hh>
+#include <G4UIcmdWithoutParameter.hh>
+
+AliRunActionMessenger::AliRunActionMessenger(AliRunAction* runAction)
+  : fRunAction(runAction)
+{
+// 
+  fRunActionDirectory = new G4UIdirectory("/aliRunAction/");
+  fRunActionDirectory->SetGuidance("AliRunAction control commands.");
+
+  fVerboseCmd = new G4UIcmdWithAnInteger("/aliRunAction/verbose", this);
+  fVerboseCmd->SetGuidance("Set verbose level for AliRunAction");
+  fVerboseCmd->SetParameterName("VerboseLevel", true);
+  fVerboseCmd->SetDefaultValue(0);
+  fVerboseCmd->SetRange("VerboseLevel >= 0 && VerboseLevel <= 2");
+  fVerboseCmd->AvailableForStates(PreInit, Init, Idle, GeomClosed, EventProc);
+}
+
+AliRunActionMessenger::AliRunActionMessenger() {
+//
+}
+
+AliRunActionMessenger::AliRunActionMessenger(const AliRunActionMessenger& right)
+{
+//
+  AliGlobals::Exception("AliRunActionMessenger is protected from copying.");
+}
+
+AliRunActionMessenger::~AliRunActionMessenger() {
+//
+  delete fRunActionDirectory;
+  delete fVerboseCmd;
+}
+
+// operators
+
+AliRunActionMessenger& 
+AliRunActionMessenger::operator=(const AliRunActionMessenger &right)
+{
+  // check assignement to self
+  if (this == &right) return *this;
+  
+  AliGlobals::Exception("AliRunActionMessenger is protected from assigning.");
+
+  return *this;
+}
+
+// public methods
+
+void AliRunActionMessenger::SetNewValue(G4UIcommand* command, 
+       G4String newValue)
+{ 
+// Applies command to the associated object.
+// ---
+
+  if(command == fVerboseCmd) { 
+    fRunAction
+      ->SetVerboseLevel(fVerboseCmd->GetNewIntValue(newValue)); 
+  }   
+}
diff --git a/AliGeant4/AliRunActionMessenger.h b/AliGeant4/AliRunActionMessenger.h
new file mode 100644 (file)
index 0000000..7320ded
--- /dev/null
@@ -0,0 +1,44 @@
+// $Id$
+// Category: run
+//
+// Messenger class that defines commands for AliRunAction.
+
+#ifndef ALI_RUN_ACTION_MESSENGER_H
+#define ALI_RUN_ACTION_MESSENGER_H 
+
+#include <G4UImessenger.hh>
+#include <globals.hh>
+
+class AliRunAction;
+
+class G4UIdirectory;
+class G4UIcmdWithAnInteger;
+
+class AliRunActionMessenger: public G4UImessenger
+{
+  public:
+    AliRunActionMessenger(AliRunAction* eventAction);
+    // --> protected
+    // AliRunActionMessenger();
+    // AliRunActionMessenger(const AliRunActionMessenger& right);
+    virtual ~AliRunActionMessenger();
+   
+    // methods 
+    virtual void SetNewValue(G4UIcommand* command, G4String string);
+    
+  protected:
+    AliRunActionMessenger();
+    AliRunActionMessenger(const AliRunActionMessenger& right);
+
+    // operators
+    AliRunActionMessenger& operator=(
+                            const AliRunActionMessenger& right);
+
+  private:
+    // data members
+    AliRunAction*          fRunAction;          //associated class
+    G4UIdirectory*         fRunActionDirectory; //command directory
+    G4UIcmdWithAnInteger*  fVerboseCmd;         //command: verbose 
+};
+
+#endif //ALI_RUN_ACTION_MESSENGER_H
diff --git a/AliGeant4/AliRunConfiguration.cxx b/AliGeant4/AliRunConfiguration.cxx
new file mode 100644 (file)
index 0000000..5a16807
--- /dev/null
@@ -0,0 +1,82 @@
+// $Id$
+// Category: run
+//
+// See the class description in the header file.
+
+#include "AliRunConfiguration.h"
+#include "AliRunMessenger.h"
+#include "AliGlobals.h"
+
+#include "AliDetConstruction.h"
+#include "AliEmptyPhysicsList.h"
+#include "AliPrimaryGeneratorAction.h"
+#include "AliRunAction.h"
+#include "AliEventAction.h"
+#include "AliTrackingAction.h"
+#include "AliStackingAction.h"
+#include "AliSteppingAction.h"
+
+#include "TG4PhysicsList.h"
+
+AliRunConfiguration::AliRunConfiguration(){
+//
+  fRunMessenger = new AliRunMessenger();
+  CreateUserConfiguration();
+}
+
+AliRunConfiguration::AliRunConfiguration(const AliRunConfiguration& right)
+  : TG4VRunConfiguration(right)
+{
+  // TG4VRunConfiguration is protected from copying
+}
+
+AliRunConfiguration::~AliRunConfiguration() {
+//
+  delete fRunMessenger;
+
+  // all user action data members are deleted 
+  // in G4RunManager::~G4RunManager()
+}
+
+// operators
+
+AliRunConfiguration& 
+AliRunConfiguration::operator=(const AliRunConfiguration& right)
+{
+  // check assignement to self
+  if (this == &right) return *this;
+  
+  // base class assignement
+  // TG4VRunConfiguration is protected from assigning
+  TG4VRunConfiguration::operator=(right);
+
+  return *this;  
+}    
+          
+// protected methods
+
+void AliRunConfiguration::CreateUserConfiguration()
+{
+// Creates the mandatory Geant4 classes and 
+// the other user action classes. 
+// ---
+
+  // create mandatory Geant4 classes
+  fDetectorConstruction = new AliDetConstruction();
+#ifndef ALICE_EMPTY_PHYSICS_LIST
+  fPhysicsList = new TG4PhysicsList();
+#else
+  fPhysicsList = new AliEmptyPhysicsList();
+#endif
+  fPrimaryGenerator = new AliPrimaryGeneratorAction();
+
+  // create the other user action classes
+  fRunAction = new AliRunAction();
+  fEventAction = new AliEventAction();
+  fTrackingAction = new AliTrackingAction();
+  fSteppingAction = new AliSteppingAction();
+#ifdef ALICE_STACKING
+  fStackingAction = new AliStackingAction();
+#endif
+}
diff --git a/AliGeant4/AliRunConfiguration.h b/AliGeant4/AliRunConfiguration.h
new file mode 100644 (file)
index 0000000..c7de077
--- /dev/null
@@ -0,0 +1,40 @@
+// $Id$
+// Category: run
+//
+// This class creates all Ali* specific action classes
+// that will be initialized and managed by Geant4 kernel (G4RunManager)
+// and creates AliRunMessenger that implements commands for
+// AliRun methods.
+
+#ifndef ALI_RUN_CONFIGURATION_H
+#define ALI_RUN_CONFIGURATION_H
+
+#include "TG4VRunConfiguration.h"
+
+class AliRunMessenger;
+
+class G4RunManager;
+
+class AliRunConfiguration : public TG4VRunConfiguration
+{
+  public:
+    AliRunConfiguration();
+    // --> protected
+    // AliRunConfiguration(const AliRunConfiguration& right);
+    virtual ~AliRunConfiguration();
+
+  protected:
+    AliRunConfiguration(const AliRunConfiguration& right);
+
+    // operators
+    AliRunConfiguration& operator=(const AliRunConfiguration& right);
+
+    // methods
+    virtual void CreateUserConfiguration();
+    
+  private:
+    AliRunMessenger*  fRunMessenger;  //messenger  
+};
+
+#endif //ALI_RUN_CONFIGURATION_H
+
diff --git a/AliGeant4/AliRunMessenger.cxx b/AliGeant4/AliRunMessenger.cxx
new file mode 100644 (file)
index 0000000..50af6b1
--- /dev/null
@@ -0,0 +1,85 @@
+// $Id$
+// Category: run
+//
+// See the class description in the header file.
+
+#include "AliRunMessenger.h"
+#include "AliFiles.h"
+#include "AliGlobals.h"
+#include "AliRun.h"
+
+#include <G4UIdirectory.hh>
+#include <G4UIcmdWithAnInteger.hh>
+#include <G4UIcmdWithoutParameter.hh>
+
+AliRunMessenger::AliRunMessenger()
+{
+// 
+  fRunDirectory = new G4UIdirectory("/aliRun/");
+  fRunDirectory->SetGuidance("AliRun control commands.");
+
+  fInitializeCmd = new G4UIcmdWithoutParameter("/aliRun/initialize", this);
+  fInitializeCmd->SetGuidance("Initialize AliRun");
+  fInitializeCmd->AvailableForStates(PreInit);
+
+  fBeamOnCmd = new G4UIcmdWithAnInteger("/aliRun/beamOn", this);
+  fBeamOnCmd->SetGuidance("Run the specified number of events");
+  fBeamOnCmd->SetParameterName("NofEvents", true);
+  fBeamOnCmd->SetDefaultValue(1);
+  fBeamOnCmd->SetRange("NofEvents >= 0");
+  fBeamOnCmd->AvailableForStates(Idle);
+
+  fLegoCmd = new G4UIcmdWithoutParameter("/aliRun/lego", this);
+  fLegoCmd->SetGuidance("Lego run");
+  fLegoCmd->AvailableForStates(Idle);
+}
+
+AliRunMessenger::AliRunMessenger(const AliRunMessenger& right) {
+//
+  AliGlobals::Exception("AliRunMessenger is protected from copying.");
+}
+
+AliRunMessenger::~AliRunMessenger() {
+//
+  delete fRunDirectory;
+  delete fInitializeCmd;
+  delete fBeamOnCmd;
+  delete fLegoCmd;
+}
+
+// operators
+
+AliRunMessenger& AliRunMessenger::operator=(const AliRunMessenger &right)
+{
+  // check assignement to self
+  if (this == &right) return *this;
+  
+  AliGlobals::Exception("AliRunMessenger is protected from assigning.");
+
+  return *this;
+}
+
+// public methods
+
+void AliRunMessenger::SetNewValue(G4UIcommand* command, 
+       G4String newValue)
+{ 
+// Applies command to the associated object.
+// ---
+
+  // test gAlice
+  if (!gAlice) {
+    AliGlobals::Exception(
+      "AliRunMessenger: gAlice has not been instantiated yet.");
+  }      
+
+  if(command == fInitializeCmd) { 
+    gAlice->Init(AliFiles::Config()); 
+  }   
+  else if(command == fBeamOnCmd) { 
+    gAlice->Run(fBeamOnCmd->GetNewIntValue(newValue)); 
+  }   
+  else if(command == fLegoCmd) { 
+    gAlice->RunLego(); 
+  }   
+}
diff --git a/AliGeant4/AliRunMessenger.h b/AliGeant4/AliRunMessenger.h
new file mode 100644 (file)
index 0000000..5b601d5
--- /dev/null
@@ -0,0 +1,41 @@
+// $Id$
+// Category: run
+//
+// Messenger class that defines commands for AliRun.
+
+#ifndef ALI_RUN_MESSENGER_H
+#define ALI_RUN_MESSENGER_H 
+
+#include <G4UImessenger.hh>
+#include <globals.hh>
+
+class G4UIdirectory;
+class G4UIcmdWithoutParameter;
+class G4UIcmdWithAnInteger;
+
+class AliRunMessenger: public G4UImessenger
+{
+  public:
+    AliRunMessenger();
+    // --> protected
+    // AliRunMessenger(const AliRunMessenger& right);
+    virtual ~AliRunMessenger();
+   
+    // methods 
+    virtual void SetNewValue(G4UIcommand* command, G4String string);
+    
+  protected:
+    AliRunMessenger(const AliRunMessenger& right);
+
+    // operators
+    AliRunMessenger& operator=(const AliRunMessenger& right);
+
+  private:
+    // data members
+    G4UIdirectory*            fRunDirectory;  //command directory
+    G4UIcmdWithoutParameter*  fInitializeCmd; //command: initialize
+    G4UIcmdWithAnInteger*     fBeamOnCmd;     //command: beamOn
+    G4UIcmdWithoutParameter*  fLegoCmd;       //command: lego
+};
+
+#endif //ALI_RUN_MESSENGER_H
diff --git a/AliGeant4/AliSDManager.cxx b/AliGeant4/AliSDManager.cxx
new file mode 100644 (file)
index 0000000..b6f56e8
--- /dev/null
@@ -0,0 +1,231 @@
+// $Id$
+// Category: geometry
+//
+// See the class description in the header file.
+
+#include "AliSDManager.h"
+//#include "AliSDMessenger.h"
+#include "AliSensitiveDetector.h"
+#include "AliLegoSensitiveDetector.h"
+#include "AliGlobals.h"
+#include "AliFiles.h"
+#include "AliRun.h"
+
+#include "TG4GeometryManager.h"
+
+#include <G3SensVolVector.hh>
+#include <G4SDManager.hh>
+#include <G4UImanager.hh>
+#include <G4LogicalVolume.hh>
+#include <G4LogicalVolumeStore.hh>
+
+AliSDManager* AliSDManager::fgInstance = 0;
+
+AliSDManager* AliSDManager::Instance()
+{
+// Returns the singleton instance.
+// Creates the instance if it does not exist.
+// ---
+
+  if (!fgInstance) new AliSDManager();
+  
+  return fgInstance;
+}  
+    
+AliSDManager::AliSDManager() {
+//
+  //fMessenger = new AliSDMessenger(this);
+  fgInstance = this;
+}
+
+AliSDManager::AliSDManager(const AliSDManager& right) {
+//
+  AliGlobals::Exception(
+    "Singleton AliSDManager is protected from copying.");
+}
+
+AliSDManager::~AliSDManager()
+{
+  //delete fMessenger;
+}
+
+// operators
+
+AliSDManager& AliSDManager::operator=(const AliSDManager& right)
+{
+  // check assignement to self
+  if (this == &right) return *this;
+
+  AliGlobals::Exception(
+     "Singleton AliSDManager is protected from assigning.");
+    
+  return *this;  
+}    
+          
+// private methods
+
+void AliSDManager::CreateLegoSD(G4LogicalVolume* lv, AliLego* lego) const
+{ 
+// Replaces the existing sensitive detector of the logical volume
+// with the lego sensitive detector.
+// ---
+
+  TG4GeometryManager* pGeometryManager = TG4GeometryManager::Instance();
+  G4SDManager* pSDManager = G4SDManager::GetSDMpointer();
+
+  G4String lvName = lv->GetName(); 
+  G4String sdName = "/Alice/lego/" + lvName;
+
+  // cut copy number from sdName
+  pGeometryManager->G4ToG3VolumeName(sdName);
+  
+  // retrieve the standard sensitive detector
+  G4VSensitiveDetector* sd = lv->GetSensitiveDetector();
+
+  // create/retrieve the lego sensitive detector
+  G4VSensitiveDetector* legoVSD = 0; 
+  legoVSD = pSDManager->FindSensitiveDetector(sdName);
+
+  if (!legoVSD) {
+    AliLegoSensitiveDetector* legoSD
+      = new AliLegoSensitiveDetector(sdName, lego, sd);        
+    pSDManager->AddNewDetector(legoSD);
+    // add verbose
+    G4cout << "Lego sensitive detector " << sdName 
+         << ") has been created." << endl;
+    legoVSD = legoSD;  
+  }      
+  lv->SetSensitiveDetector(legoVSD);        
+}
+
+void AliSDManager::UnsetLegoSD(G4LogicalVolume* lv) const
+{ 
+// Replace the lego sensitive detector of the logical volume
+// with the standard sensitive detector.
+// ---
+
+  G4SDManager* pSDManager = G4SDManager::GetSDMpointer();
+
+  // get the lego sensitive detector
+  G4VSensitiveDetector* sd = lv->GetSensitiveDetector();
+  AliLegoSensitiveDetector* legoSD = 0; 
+  if (sd) {
+    // check type
+    legoSD = dynamic_cast<AliLegoSensitiveDetector*>(sd);
+    if (!legoSD) {
+      G4String text = "AliSDManager::UnsetLego: \n";
+      text = text + "    Wrong sensitive detector type.";
+      AliGlobals::Exception(text);
+    }  
+  }
+  // get the standard sensitive detector
+  G4VSensitiveDetector* standardSD = legoSD->GetStandardSD();
+
+  // set the standard sensitive detector
+  lv->SetSensitiveDetector(standardSD);             
+}
+
+
+// public methods
+
+void AliSDManager::CreateSD(G4LogicalVolume* lv, AliModule* module) const
+{ 
+// Creates/retrieves a sensitive detector for the logical volume.
+// ---
+
+  TG4GeometryManager* pGeometryManager = TG4GeometryManager::Instance();
+  G4SDManager* pSDManager = G4SDManager::GetSDMpointer();
+
+  G4String lvName = lv->GetName(); 
+  
+  G4String moduleName = module->GetName();
+  G4String sdName = "/Alice/" + moduleName + "/" + lvName;
+
+  // cut copy number from sdName
+  pGeometryManager->G4ToG3VolumeName(sdName);
+  
+  // create/retrieve the sensitive detector
+  G4VSensitiveDetector* sd = 0; 
+  sd = pSDManager->FindSensitiveDetector(sdName);
+  if (!sd) {
+    AliSensitiveDetector* asd 
+      = new AliSensitiveDetector(sdName, module);      
+    pSDManager->AddNewDetector(asd);
+    // add verbose
+    G4cout << "Sensitive detector " << sdName << "(" 
+           << asd->GetID() << ") has been created." << endl;
+    sd = asd;  
+  }    
+  lv->SetSensitiveDetector(sd);             
+}
+
+AliModule* AliSDManager::FindAliModule(G4LogicalVolume* lv) const
+{
+// Finds the module containing specified logical volume.
+// ---
+
+  // geometry manager
+  TG4GeometryManager* pGeometryManager = TG4GeometryManager::Instance();
+
+  // get g3 volume name
+  G4String g3Name = lv->GetName();
+  pGeometryManager->G4ToG3VolumeName(g3Name);
+  
+  // get module name from the map
+  G4String moduleName = pGeometryManager->GetMapSecond(g3Name);
+  
+  // find module from gAlice
+  AliModule* module = gAlice->GetModule(moduleName);
+  if (!module) {
+    G4String text = "AliSDManager::Configure:\n";
+    text = text + "    AliModule " + moduleName;
+    text = text + " has not been found in gAlice.";
+    AliGlobals::Exception(text);
+  }  
+   
+  return module;
+}  
+
+void AliSDManager::SetLego(AliLego* lego) const 
+{ 
+// Replaces the existing sensitive detectors 
+// with lego sensitive detectors.
+// ---
+
+  if (!lego) {
+    G4String text = "AliSDManager::SetLego: \n";
+    text = text + "    No AliLego is defined.";
+    AliGlobals::Warning(text);
+    return;
+  }  
+
+  G4LogicalVolumeStore* pLVStore = G4LogicalVolumeStore::GetInstance();
+  G4int nofLV = pLVStore->entries();
+  
+  for (G4int i=0; i<nofLV; i++) {
+    G4LogicalVolume* lv = (*pLVStore)[i];
+    CreateLegoSD(lv, lego);
+  }
+}
+
+void AliSDManager::UnsetLego() const
+{
+// Replace the lego sensitive detectors 
+// back with standard sensitive detectors.
+// ---
+
+  G4SDManager* pSDManager = G4SDManager::GetSDMpointer();
+  G4LogicalVolumeStore* pLVStore = G4LogicalVolumeStore::GetInstance();
+  G4int nofLV = pLVStore->entries();
+  
+  // set back standard sensitive detectors
+  for (G4int i=0; i<nofLV; i++) {
+    G4LogicalVolume* lv = (*pLVStore)[i];
+    UnsetLegoSD(lv);
+  }  
+
+  // The lego sensitive detectors are not deleted here
+  // as there is no way how to unregister them
+  // from G4SDManager
+}
diff --git a/AliGeant4/AliSDManager.h b/AliGeant4/AliSDManager.h
new file mode 100644 (file)
index 0000000..3ac71aa
--- /dev/null
@@ -0,0 +1,70 @@
+// $Id$
+// Category: geometry
+//
+// Class providing methods for creating sensitive detectors
+// and switching between lego sensitive detectors and 
+// the standard ones.
+
+#ifndef ALI_SD_MANAGER_H
+#define ALI_SD_MANAGER_H
+
+#include <globals.hh>
+
+//class AliSDMessenger;
+class AliLego;
+class AliModule;
+
+class G4VPhysicalVolume;
+class G4LogicalVolume;
+
+class AliSDManager 
+{  
+  public:
+    // --> protected
+    // AliSDManager();
+    // AliSDManager(const AliSDManager& right);
+    virtual ~AliSDManager();
+    
+    // static methods
+    static AliSDManager* Instance();
+    
+    // methods
+    void CreateSD(G4LogicalVolume* lv, AliModule* module) const;
+    AliModule* FindAliModule(G4LogicalVolume* lv) const;
+    void SetLego(AliLego* lego) const;
+    void UnsetLego() const;
+
+    // set/get methods 
+    inline void SetNofLVWithSD(G4int nofLV);
+    inline G4int GetNofLVWithSD() const;
+    
+  protected:
+    AliSDManager();
+    AliSDManager(const AliSDManager& right);
+
+    // operators
+    AliSDManager& operator=(const AliSDManager& right);
+  
+  private:
+    // methods
+    void CreateLegoSD(G4LogicalVolume* lv, AliLego* lego) const;
+    void UnsetLegoSD(G4LogicalVolume* lv) const;
+
+    // static data members
+    static AliSDManager*    fgInstance;   //this instance
+
+    // data members
+    G4int                   fNofLVWithSD; //counter of logical volumes
+                                          //with sensitive detectors
+    //AliSDManagerMessenger*  fMessenger;
+};             
+
+// inline methods
+
+inline G4int AliSDManager::GetNofLVWithSD() const
+{ return fNofLVWithSD; }
+
+inline void AliSDManager::SetNofLVWithSD(G4int nofLV)
+{ fNofLVWithSD = nofLV; }
+
+#endif //ALI_SD_MANAGER_H
diff --git a/AliGeant4/AliSensitiveDetector.cxx b/AliGeant4/AliSensitiveDetector.cxx
new file mode 100644 (file)
index 0000000..2e56cf4
--- /dev/null
@@ -0,0 +1,107 @@
+// $Id$ //
+// Category: geometry
+//
+// See the class description in the header file.
+
+#include "AliSensitiveDetector.h"
+#include "AliModule.h" 
+#include "AliRun.h"
+
+#include "TG4StepManager.h"
+
+AliSensitiveDetector::AliSensitiveDetector(G4String sdName, AliModule* module)
+  : TG4VSensitiveDetector(sdName),
+    fModule(module),
+    fStepManager(TG4StepManager::Instance())
+{
+//
+}
+
+AliSensitiveDetector::AliSensitiveDetector(G4String sdName, AliModule* module, 
+                                           G4int id)
+  : TG4VSensitiveDetector(sdName, id),
+    fModule(module),
+    fStepManager(TG4StepManager::Instance())
+{
+//
+}
+
+AliSensitiveDetector::AliSensitiveDetector(const AliSensitiveDetector& right)
+  : TG4VSensitiveDetector(right)
+{
+//
+  fModule = right.fModule;
+  fStepManager = right.fStepManager;
+}  
+  
+AliSensitiveDetector::AliSensitiveDetector(){
+//
+}
+
+AliSensitiveDetector::~AliSensitiveDetector() {
+//
+}
+
+// operators
+
+AliSensitiveDetector& 
+AliSensitiveDetector::operator=(const AliSensitiveDetector& right)
+{
+  // check assignement to self
+  if (this == &right) return *this;
+
+  // base class assignement
+  TG4VSensitiveDetector::operator=(right);
+
+  fModule = right.fModule;
+  fStepManager = right.fStepManager;
+
+  return *this;  
+}    
+          
+// public methods
+
+void AliSensitiveDetector::Initialize(G4HCofThisEvent* hc)
+{
+// This method is called at the beginning of event action
+// before user defined BeginOfEventAction() method.
+}
+
+G4bool AliSensitiveDetector::ProcessHits(G4Step* step, G4TouchableHistory*)
+{
+// Calls StepManager of associated AliModules.
+// ---
+
+  // add energy deposit of the current step
+  // directly to AliRun
+  G4int copy;
+  gAlice->AddEnergyDeposit(fID, step->GetTotalEnergyDeposit());
+
+  // parent ID -> shunt
+  G4int parentID
+    = step->GetTrack()->GetParentID();
+  Int_t shunt = 0;
+  if (parentID==0) shunt = 1;
+  fModule->SetIshunt(shunt);
+
+  // let AliModule process step
+  fStepManager->SetStep(step);
+  fModule->StepManager();
+
+  return true;
+}
+
+void AliSensitiveDetector::EndOfEvent(G4HCofThisEvent* hce){
+//
+}
+
+//void AliSensitiveDetector::clear()
+//{} 
+
+void AliSensitiveDetector::PrintAll() {
+//
+} 
+
+void AliSensitiveDetector::DrawAll() {
+//
+} 
diff --git a/AliGeant4/AliSensitiveDetector.h b/AliGeant4/AliSensitiveDetector.h
new file mode 100644 (file)
index 0000000..e06fda8
--- /dev/null
@@ -0,0 +1,53 @@
+// $Id$
+// Category: geometry
+//
+// Sensitive detector class,
+// that implements G4VSensitiveDetector::ProcessHits()
+// with AliDetector:: StepManager().
+
+#ifndef ALI_SENSITIVE_DETECTOR_H
+#define ALI_SENSITIVE_DETECTOR_H
+
+#include "TG4VSensitiveDetector.h"
+
+#include <globals.hh>
+
+class AliModule;
+class TG4StepManager;
+
+class G4HCofThisEvent;
+class G4Step;
+
+class AliSensitiveDetector : public TG4VSensitiveDetector
+{
+  public:
+    AliSensitiveDetector(G4String sdName, AliModule* module);
+    AliSensitiveDetector(G4String sdName, AliModule* module, G4int id);
+    AliSensitiveDetector(const AliSensitiveDetector& right);
+    // --> protected
+    // AliSensitiveDetector();
+    virtual ~AliSensitiveDetector();
+
+    // operators
+    AliSensitiveDetector& operator=(const AliSensitiveDetector& right);
+  
+    // methods
+    virtual void Initialize(G4HCofThisEvent* hc);
+    virtual G4bool ProcessHits(G4Step* step, G4TouchableHistory* history);
+    virtual void EndOfEvent(G4HCofThisEvent* hce);
+    //virtual void clear();
+    virtual void PrintAll();
+    virtual void DrawAll();
+    
+  protected:  
+    AliSensitiveDetector();
+    
+  private:
+    // data members
+    AliModule*       fModule;      //AliModule
+    TG4StepManager*  fStepManager; //TG4StepManager
+};
+
+#endif //ALI_SENSITIVE_DETECTOR_H
+
+
diff --git a/AliGeant4/AliSingleModuleConstruction.cxx b/AliGeant4/AliSingleModuleConstruction.cxx
new file mode 100644 (file)
index 0000000..3e2a4f0
--- /dev/null
@@ -0,0 +1,297 @@
+// $Id$
+// Category: geometry
+//
+// See the class description in the header file.
+
+#include "AliSingleModuleConstruction.h"
+#include "AliSingleModuleConstructionMessenger.h"
+#include "AliSDManager.h"
+#include "AliSensitiveDetector.h"
+#include "AliGlobals.h"
+#include "AliFiles.h"
+#include "AliRun.h"
+
+#include "TG4GeometryManager.h"
+
+#include <G3SensVolVector.hh>
+#include <G4SDManager.hh>
+#include <G4UImanager.hh>
+//#include <G4Element.hh>
+#include <G4LogicalVolume.hh>
+#include <G4LogicalVolumeStore.hh>
+
+#include <TROOT.h> 
+#include <TCint.h> 
+
+G4VPhysicalVolume* AliSingleModuleConstruction::fgWorld = 0;
+
+AliSingleModuleConstruction::AliSingleModuleConstruction(
+                                G4String moduleName, G4int version,
+                               AliModuleType moduleType)
+  : AliModuleConstruction(moduleName),
+    fVersion(version),
+    fType(moduleType),
+    fProcessConfig(true),
+    fAllLVSensitive(false)
+{
+//
+  fSDManager = AliSDManager::Instance();
+
+  moduleName.toLower();
+  fMessenger = new AliSingleModuleConstructionMessenger(this, moduleName);
+}
+
+AliSingleModuleConstruction::AliSingleModuleConstruction(
+                                const AliSingleModuleConstruction& right)
+  : AliModuleConstruction(right)                               
+{
+//
+  fVersion = right.fVersion;
+  fType = right.fType;
+  fProcessConfig = right.fProcessConfig;
+  fAllLVSensitive = right.fAllLVSensitive;
+  fSDManager = right.fSDManager;
+
+  G4String moduleName = right.fModuleName;
+  moduleName.toLower();
+  fMessenger = new AliSingleModuleConstructionMessenger(this, moduleName);
+}
+
+AliSingleModuleConstruction::AliSingleModuleConstruction() {
+//
+}
+
+AliSingleModuleConstruction::~AliSingleModuleConstruction() {
+//
+  delete fMessenger;
+}
+
+// operators
+
+AliSingleModuleConstruction& 
+AliSingleModuleConstruction::operator=(const AliSingleModuleConstruction& right)
+{    
+  // check assignement to self
+  if (this == &right) return *this;
+  
+  // base class assignement
+  AliModuleConstruction::operator=(right);
+  
+  fVersion = right.fVersion;
+  fType = right.fType;
+  fProcessConfig = right.fProcessConfig;
+  fAllLVSensitive = right.fAllLVSensitive;
+  fSDManager = right.fSDManager;
+  
+  return *this;
+}
+
+// private methods
+
+void AliSingleModuleConstruction::CreateSensitiveDetectors()
+{
+// Creates sensitive detectors.
+// ---
+
+  if (fAllLVSensitive)
+    CreateSensitiveDetectors1();
+  else
+    CreateSensitiveDetectors2();
+
+  // set static number of logical volumes already processed
+  G4LogicalVolumeStore* pLVStore = G4LogicalVolumeStore::GetInstance();
+  fSDManager->SetNofLVWithSD(pLVStore->entries());  
+}   
+
+void AliSingleModuleConstruction::CreateSensitiveDetectors1()
+{ 
+// Creates sensitive detectors.
+// Sensitive detectors are set to all logical volumes
+// ---
+
+  G4LogicalVolumeStore* pLVStore = G4LogicalVolumeStore::GetInstance();
+  G4int nofLV = pLVStore->entries();
+  
+  G4int nofLVWithSD = fSDManager->GetNofLVWithSD();
+  
+  for (G4int i=nofLVWithSD; i<nofLV; i++) {
+    G4LogicalVolume* lv = (*pLVStore)[i];
+    fSDManager->CreateSD(lv, fAliModule);
+  }
+}
+
+void AliSingleModuleConstruction::CreateSensitiveDetectors2()
+{ 
+// Creates sensitive detectors.
+// Sensitive detectors are set only to logical volumes
+// in G3SensVolVector.
+// ---
+
+  TG4GeometryManager* pGeometryManager = TG4GeometryManager::Instance();
+
+  G3SensVolVector pSVVector
+    = pGeometryManager->GetG3SensVolVector();
+
+  G4int nofSV = pSVVector.entries();
+  if (nofSV>0)
+    for (G4int isv=0; isv<nofSV; isv++) {
+      G4LogicalVolume* lv = pSVVector[isv];
+      fSDManager->CreateSD(lv, fAliModule);
+    } 
+}
+
+// public methods 
+
+void AliSingleModuleConstruction::Configure()
+{ 
+// Executes the detector setup Root macro
+// (extracted from AliRoot Config.C) and
+// G4 macro.
+// ---
+         
+  // filepaths and macro names 
+  G4String rootFilePath;
+  G4String g4FilePath;
+
+  if (fType == kDetector) {
+    // macro file path 
+    //$AG4_INSTALL/macro/XXX/Config.C
+    //$AG4_INSTALL/macro/XXX/Config.in
+    rootFilePath = AliFiles::DetConfig1();
+    rootFilePath.append(fModuleName);
+    rootFilePath.append(AliFiles::DetConfig2());
+    g4FilePath = rootFilePath;
+
+    rootFilePath.append(AliFiles::DetConfig3());
+    g4FilePath.append(AliFiles::DetConfig4());
+
+    // path to g3calls.dat file
+    //$AG4_INSTALL/macro/XXX/g3calls_vN.dat
+    fDataFilePath = AliFiles::DetData1();
+    fDataFilePath.append(fModuleName);
+    fDataFilePath.append(AliFiles::DetData2());
+    G4String version("v");
+    AliGlobals::AppendNumberToString(version,fVersion);
+    fDataFilePath.append(version);
+    fDataFilePath.append(AliFiles::DetData3());          
+  }  
+  else if (fType == kStructure) {    
+    // macro file path is set to 
+    //$AG4_INSTALL/macro/STRUCT/XXXConfig.C
+    //$AG4_INSTALL/macro/STRUCT/XXXConfig.in
+    rootFilePath = AliFiles::DetConfig1();
+    rootFilePath.append(AliFiles::STRUCT());
+    rootFilePath.append(AliFiles::DetConfig2());
+    rootFilePath.append(fModuleName);
+    g4FilePath = rootFilePath;
+
+    rootFilePath.append(AliFiles::DetConfig3());
+    g4FilePath.append(AliFiles::DetConfig4());
+
+    // path to g3calls.dat file
+    //$AG4_INSTALL/macro/STRUCT/g3calls_XXXvN.dat
+    fDataFilePath = AliFiles::DetData1();
+    fDataFilePath.append(AliFiles::STRUCT());
+    fDataFilePath.append(AliFiles::DetData2());
+    fDataFilePath.append(fModuleName);
+    G4String version("v");
+    AliGlobals::AppendNumberToString(version,fVersion);
+    fDataFilePath.append(version);
+    fDataFilePath.append(AliFiles::DetData3());
+  }  
+  
+  if (fProcessConfig) {
+    // load and execute aliroot macro
+    gROOT->LoadMacro(rootFilePath);
+    G4String macroName = AliFiles::DetConfigName1();
+    AliGlobals::AppendNumberToString(macroName, fVersion);
+    macroName.append(AliFiles::DetConfigName2());
+    gInterpreter->ProcessLine(macroName);
+  } 
+  
+  // add process g4 config macro
+  // execute Geant4 macro if file is specified as an argument 
+  G4String command = "/control/execute ";
+  G4UImanager* pUI = G4UImanager::GetUIpointer();  
+  pUI->ApplyCommand(command + g4FilePath);
+  
+  // get AliModule created in Config.C macro
+  fAliModule = gAlice->GetModule(fModuleName);
+  if (!fAliModule) {
+    G4String text = "AliSingleModuleConstruction::Configure:\n";
+    text = text + "    AliModule " + fModuleName;
+    text = text + " has not been found in gAlice.";
+    AliGlobals::Exception(text);
+  }  
+}
+
+void AliSingleModuleConstruction::Construct()
+{ 
+// Constructs geometry.
+// ---
+
+  // print default element table
+  // const G4ElementTable* table = G4Element::GetElementTable();
+  // G4cout << "Default elemnt table: " << endl;
+  // for (G4int i=0; i<table->entries(); i++) {
+  //   G4cout << *(*table)[i] << endl;
+  // }  
+
+  Configure();
+
+  // get geometry manager
+  TG4GeometryManager* pGeometryManager = TG4GeometryManager::Instance();
+
+  // register module name in the name map
+  pGeometryManager->SetMapSecond(fAliModule->GetName());       
+
+  if (fReadGeometry) {
+    // create G3 geometry from g3calls.dat
+    pGeometryManager->SetWriteGeometry(false);
+    pGeometryManager->ReadG3Geometry(fDataFilePath);
+  }
+  else {
+    // set geometry output stream for this module
+    pGeometryManager->SetWriteGeometry(fWriteGeometry);
+    if (fWriteGeometry) 
+      pGeometryManager->OpenOutFile(fDataFilePath);
+
+    // create geometry from AliRoot
+
+    // construct materials
+    fAliModule->CreateMaterials();
+
+    // construct G3 geometry
+    fAliModule->CreateGeometry();
+  }  
+  
+  // construct G4 geometry
+  G4VPhysicalVolume* world = pGeometryManager->CreateG4Geometry();
+  if (!fgWorld) fgWorld = world; 
+  
+  // set the detector frame (envelope)
+  // (without warning output if enevelope is not defined)
+  SetDetFrame(false);
+
+  // create sensitive detectors
+  CreateSensitiveDetectors();
+
+  // build sensitive detectors table
+  fAliModule->Init();
+
+  // reset TG4GeometryManager 
+  pGeometryManager->ClearG3Tables();
+  
+  // print current total number of logical volumes
+  G4cout << "Current total number of sensitive volumes: "
+         << pGeometryManager->NofVolumes() << endl;
+
+#ifdef ALICE_VISUALIZE
+  if (GetDetFrame()) {
+    // set visualization attributes
+    // if detector envelope is defined
+    SetDetVisibility(true);
+    SetDetColour("Yellow");
+  }  
+#endif
+}
diff --git a/AliGeant4/AliSingleModuleConstruction.h b/AliGeant4/AliSingleModuleConstruction.h
new file mode 100644 (file)
index 0000000..e035d71
--- /dev/null
@@ -0,0 +1,108 @@
+// $Id$
+// Category: geometry
+//
+// Class for geometry construction of a standalone
+// module (AliModule). 
+
+#ifndef ALI_SINGLE_MODULE_CONSTRUCTION_H
+#define ALI_SINGLE_MODULE_CONSTRUCTION_H
+
+#include "AliModuleConstruction.h"
+#include "AliModuleType.h"
+
+#include <globals.hh>
+
+class AliSingleModuleConstructionMessenger;
+class AliSDManager;
+
+class G4VPhysicalVolume;
+class G4LogicalVolume;
+
+class AliSingleModuleConstruction : public AliModuleConstruction
+{  
+  public:
+    AliSingleModuleConstruction(G4String moduleName, G4int version,
+                                AliModuleType moduleType = kDetector);
+    AliSingleModuleConstruction(const AliSingleModuleConstruction& right);
+    // --> protected
+    // AliSingleModuleConstruction();
+    virtual ~AliSingleModuleConstruction();
+    
+    // operators
+    AliSingleModuleConstruction& operator=(
+                                const AliSingleModuleConstruction &right);
+
+    // static set/get methods 
+    static void SetWorld(G4VPhysicalVolume* world);
+    static G4VPhysicalVolume* GetWorld();
+
+    // methods
+    void Configure();    
+    virtual void Construct();
+
+    // set methods
+    void SetProcessConfig(G4bool processConfig);
+    void SetAllLVSensitive(G4bool allLVSensitive);
+    void SetModuleFrameName(G4String moduleFrameName);
+    void SetModuleType(AliModuleType type);
+
+    // get methods
+    G4int  GetVersion() const;
+    AliModuleType GetType() const;
+    G4bool GetAllLVSensitive() const;
+    G4bool GetProcessConfig() const;
+    
+  protected:
+    AliSingleModuleConstruction();
+
+  private:
+    // methods
+    void CreateSensitiveDetectors();
+    void CreateSensitiveDetectors1();
+    void CreateSensitiveDetectors2();
+    
+    // static data members
+    static G4VPhysicalVolume* fgWorld;       //top (world) physical volume
+
+    // data members
+    AliSDManager*   fSDManager;      //AliSDManager
+    G4int           fVersion;        //module version
+    AliModuleType   fType;           //module type (detector/structure)
+    G4bool          fAllLVSensitive; //control for setting sensitive detectors
+    G4bool          fProcessConfig;  //control for processing Config.C
+    AliSingleModuleConstructionMessenger*  fMessenger; //messenger
+};             
+
+// inline methods
+
+inline G4VPhysicalVolume* AliSingleModuleConstruction::GetWorld()
+{ return fgWorld; }
+
+inline void AliSingleModuleConstruction::SetWorld(G4VPhysicalVolume* world)
+{ fgWorld = world; }
+
+inline void AliSingleModuleConstruction::SetProcessConfig(G4bool processConfig)
+{ fProcessConfig = processConfig; }
+
+inline void AliSingleModuleConstruction::SetAllLVSensitive(G4bool allLVSensitive)
+{ fAllLVSensitive = allLVSensitive; }
+
+inline void AliSingleModuleConstruction::SetModuleFrameName(G4String name)
+{ fModuleFrameName = name; }
+
+inline void AliSingleModuleConstruction::SetModuleType(AliModuleType type)
+{ fType = type; }
+
+inline G4int AliSingleModuleConstruction::GetVersion() const
+{ return fVersion; }
+
+inline AliModuleType AliSingleModuleConstruction::GetType() const
+{ return fType; }
+
+inline G4bool AliSingleModuleConstruction::GetAllLVSensitive() const
+{ return fAllLVSensitive; }
+
+inline G4bool AliSingleModuleConstruction::GetProcessConfig() const
+{ return fProcessConfig; }
+
+#endif //ALI_SINGLE_MODULE_CONSTRUCTION_H
diff --git a/AliGeant4/AliSingleModuleConstructionMessenger.cxx b/AliGeant4/AliSingleModuleConstructionMessenger.cxx
new file mode 100644 (file)
index 0000000..2909c79
--- /dev/null
@@ -0,0 +1,78 @@
+// $Id$
+// Category: geometry
+//
+// See the class description in the header file.
+
+#include "AliSingleModuleConstructionMessenger.h"
+#include "AliSingleModuleConstruction.h"
+#include "AliGlobals.h"
+
+#include <G4UIcmdWithABool.hh>
+
+AliSingleModuleConstructionMessenger::AliSingleModuleConstructionMessenger(
+   AliSingleModuleConstruction* moduleConstruction, G4String moduleName)
+ : fModuleConstruction(moduleConstruction)
+{
+//
+  G4String dirName = "/aliDet/"; 
+  dirName = dirName + moduleName + "/"; 
+
+  G4String commandPath = dirName + "setAllSensitive";
+  fSetAllSensitiveCmd = new G4UIcmdWithABool(commandPath, this);
+  G4String guidance =   "If true: set all " + moduleName;
+  guidance = guidance + "logical volumes sensitive.\n";
+  guidance = guidance + "      (Each logical is volume associated with ";
+  guidance = guidance + "a sensitive detector.)";    
+  guidance = guidance + "If false: only volumes defined with a sensitive ";
+  guidance = guidance + "tracking medium\n";
+  guidance = guidance + "are associated with a sensitive detector.";
+  fSetAllSensitiveCmd->SetGuidance(guidance);
+  fSetAllSensitiveCmd->SetParameterName("detSensitivity", false);
+  fSetAllSensitiveCmd->AvailableForStates(PreInit, Init);  
+}
+
+AliSingleModuleConstructionMessenger::AliSingleModuleConstructionMessenger() {
+//
+}
+
+AliSingleModuleConstructionMessenger::AliSingleModuleConstructionMessenger(
+                            const AliSingleModuleConstructionMessenger& right) {
+//
+  AliGlobals::Exception(
+    "AliSingleModuleConstructionMessenger is protected from copying.");
+}
+
+AliSingleModuleConstructionMessenger::~AliSingleModuleConstructionMessenger() {
+//
+  delete fSetAllSensitiveCmd;  
+}
+
+// operators
+
+AliSingleModuleConstructionMessenger& 
+AliSingleModuleConstructionMessenger::operator=(
+                            const AliSingleModuleConstructionMessenger& right)
+{
+  // check assignement to self
+  if (this == &right) return *this;
+
+  AliGlobals::Exception(
+     "AliSingleModuleConstructionMessenger is protected from assigning.");
+    
+  return *this;  
+}    
+          
+// public methods
+  
+void AliSingleModuleConstructionMessenger::SetNewValue(G4UIcommand* command,
+                                                 G4String newValues)
+{
+// Applies command to the associated object.
+// ---
+
+  if (command == fSetAllSensitiveCmd) {
+    fModuleConstruction
+      ->SetAllLVSensitive(fSetAllSensitiveCmd->GetNewBoolValue(newValues)); 
+  } 
+}
+
diff --git a/AliGeant4/AliSingleModuleConstructionMessenger.h b/AliGeant4/AliSingleModuleConstructionMessenger.h
new file mode 100644 (file)
index 0000000..0e1df17
--- /dev/null
@@ -0,0 +1,48 @@
+// $Id$
+// Category: geometry
+//
+// Messenger class that defines command directory for the
+// AliSingleModuleConstruction instances.
+
+#ifndef ALI_SINGLE_MODULE_CONSTRUCTION_MESSENGER_H
+#define ALI_SINGLE_MODULE_CONSTRUCTION_MESSENGER_H
+
+#include <G4UImessenger.hh>
+#include <globals.hh>
+
+class AliSingleModuleConstruction;
+
+class G4UIcmdWithABool;
+
+class AliSingleModuleConstructionMessenger: public G4UImessenger
+{
+  public:
+    AliSingleModuleConstructionMessenger(
+       AliSingleModuleConstruction* moduleConstruction, G4String moduleName);
+    // --> protected
+    // AliSingleModuleConstructionMessenger();
+    // AliSingleModuleConstructionMessenger(
+    //                 const AliSingleModuleConstructionMessenger& right); 
+    virtual ~AliSingleModuleConstructionMessenger();
+
+    // methods
+    virtual void SetNewValue(G4UIcommand* command, G4String newValues);
+
+  protected:
+    AliSingleModuleConstructionMessenger();
+    AliSingleModuleConstructionMessenger(
+                       const AliSingleModuleConstructionMessenger& right);
+
+    // operators
+    AliSingleModuleConstructionMessenger& operator=(
+                       const AliSingleModuleConstructionMessenger& right);
+  
+  private:
+    // data members
+    AliSingleModuleConstruction*  fModuleConstruction; //associated class
+
+    G4UIcmdWithABool*  fSetAllSensitiveCmd; //command: setAllSensitive   
+};
+
+#endif //ALI_MODULE_CONSTRUCTION_MESSENGER_H
+
diff --git a/AliGeant4/AliStackingAction.cxx b/AliGeant4/AliStackingAction.cxx
new file mode 100644 (file)
index 0000000..36518b5
--- /dev/null
@@ -0,0 +1,132 @@
+// $Id$
+// Category: event
+//
+// See the class description in the header file.
+
+#include "AliStackingAction.h"
+#include "AliStackingActionMessenger.h"
+#include "AliTrackingAction.h"
+#include "AliGlobals.h"
+
+#include <G4Track.hh>
+#include <G4StackedTrack.hh>
+#include <G4StackManager.hh>
+#include <G4ios.hh>
+
+AliStackingAction::AliStackingAction()
+  : fStage(0), 
+    fVerboseLevel(0),
+    fSavePrimaries(true),
+    fTrackingAction(0) 
+{
+// 
+  fPrimaryStack = new G4TrackStack();
+  fMessenger = new AliStackingActionMessenger(this);
+}
+
+AliStackingAction::AliStackingAction(const AliStackingAction& right) {
+//
+  AliGlobals::Exception("AliStackingAction is protected from copying.");
+}
+
+AliStackingAction::~AliStackingAction() {
+// 
+  delete fPrimaryStack;
+  delete fMessenger; 
+}
+
+// operators
+
+AliStackingAction& 
+AliStackingAction::operator=(const AliStackingAction &right)
+{
+  // check assignement to self
+  if (this == &right) return *this;
+  
+  AliGlobals::Exception("AliStackingAction is protected from assigning.");
+
+  return *this;
+}
+
+// public methods
+
+G4ClassificationOfNewTrack 
+AliStackingAction::ClassifyNewTrack(const G4Track* track)
+{
+// Classifies the new track.
+// ---
+
+  G4ClassificationOfNewTrack classification;
+  if (fStage == 0) { 
+    // move all primaries to PrimaryStack
+    G4Track* nonconstTrack = (G4Track*)track;
+    G4StackedTrack* newTrack = new G4StackedTrack(nonconstTrack);
+    fPrimaryStack->PushToStack(newTrack);  
+    classification = fPostpone;
+
+    // save primary particle info
+    // (secondary particles are stored 
+    //  by AlTrackingAction::PreUserTrackingAction() method)
+    if (fSavePrimaries)
+      fTrackingAction->SaveParticle(track, "primary");
+  }  
+  else {
+     G4int parentID = track->GetParentID();
+     if (parentID ==0) { 
+       classification = fUrgent; 
+     }
+     else { 
+       classification = fWaiting; 
+     }
+  }
+  return classification;
+}
+
+void AliStackingAction::NewStage()
+{
+// Called by G4 kernel at the new stage of stacking.
+// ---
+
+  fStage++;
+  if (fVerboseLevel>0) 
+  {
+    G4cout << "AliStackingAction::NewStage " << fStage 
+           << " has been started." << endl;
+  }
+
+  G4int nofUrgent = stackManager->GetNUrgentTrack();
+  if (nofUrgent == 0)
+  {
+    G4int nofPrimary = fPrimaryStack->GetNTrack();
+    if (nofPrimary>0)
+    { 
+       G4StackedTrack* stackedTrack
+         = fPrimaryStack->PopFromStack();
+       G4Track* primaryTrack
+         = stackedTrack->GetTrack();
+       delete stackedTrack;
+       stackManager->PushOneTrack(primaryTrack);
+     }
+  }
+}
+    
+void AliStackingAction::ClearPrimaryStack()
+{
+// Clears the primary stack.
+// ---
+
+  stackManager->ClearPostponeStack();
+}
+
+void AliStackingAction::PrepareNewEvent()
+{
+// Called by G4 kernel at the beginning of event.
+// ---
+
+  fStage = 0;
+  ClearPrimaryStack();
+  fTrackingAction = AliTrackingAction::Instance();
+  fSavePrimaries = fTrackingAction->GetSavePrimaries();
+}
+
+
diff --git a/AliGeant4/AliStackingAction.h b/AliGeant4/AliStackingAction.h
new file mode 100644 (file)
index 0000000..73040dc
--- /dev/null
@@ -0,0 +1,64 @@
+// $Id$
+// Category: event
+//
+// Class that defines Alice stacking mechanism.
+
+#ifndef ALI_STACKING_ACTION_H
+#define ALI_STACKING_ACTION_H
+
+#include <G4UserStackingAction.hh>
+#include <G4TrackStack.hh>
+
+#include <globals.hh>
+
+class AliStackingActionMessenger;
+class AliTrackingAction;
+class G4Track;
+
+class AliStackingAction : public G4UserStackingAction
+{
+  public:
+    AliStackingAction();
+    // --> protected
+    // AliStackingAction(const AliStackingAction& right);
+    virtual ~AliStackingAction();
+
+    // methods
+    G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track* track);
+    void NewStage();
+    void ClearPrimaryStack();
+    void PrepareNewEvent();
+
+    // set methods
+    void SetVerboseLevel(G4int level);
+
+    // get methods
+    G4int GetVerboseLevel() const;
+
+  protected:
+    AliStackingAction(const AliStackingAction& right);
+
+    // operators
+    AliStackingAction& operator=(const AliStackingAction& right);
+
+  private:
+    // data members
+    G4int                        fStage;          //stage number
+    G4int                        fVerboseLevel;   //verbose level
+    G4bool                       fSavePrimaries;  //control of saving primaries
+    G4TrackStack*                fPrimaryStack;   //stack of primary tracks
+    AliTrackingAction*           fTrackingAction; //AliTrackingAction
+    AliStackingActionMessenger*  fMessenger;      //messenger
+};
+
+
+// inline methods
+
+inline void AliStackingAction::SetVerboseLevel(G4int level)
+{ fVerboseLevel = level; }
+
+inline G4int AliStackingAction::GetVerboseLevel() const
+{ return fVerboseLevel; }
+
+#endif //ALI_STACKING_ACTION_H
+
diff --git a/AliGeant4/AliStackingActionMessenger.cxx b/AliGeant4/AliStackingActionMessenger.cxx
new file mode 100644 (file)
index 0000000..2a11f81
--- /dev/null
@@ -0,0 +1,80 @@
+// $Id$
+// Category: event
+//
+// See the class description in the header file.
+
+#include "AliStackingActionMessenger.h"
+#include "AliStackingAction.h"
+#include "AliGlobals.h"
+
+#include <G4UIdirectory.hh>
+#include <G4UIcmdWithAnInteger.hh>
+#include <G4UIcmdWithoutParameter.hh>
+
+AliStackingActionMessenger::AliStackingActionMessenger(
+                              AliStackingAction* stackingAction)
+  :fStackingAction(stackingAction)
+{
+// 
+  fStackingDirectory = new G4UIdirectory("/aliStacking/");
+  fStackingDirectory->SetGuidance("AliStackingAction control commands.");
+
+  fClearStackCmd = new G4UIcmdWithoutParameter("/aliStacking/clearStack", this);
+  fClearStackCmd->SetGuidance("Clears the primary stack.");
+  fClearStackCmd->AvailableForStates(EventProc);
+
+  fVerboseCmd = new G4UIcmdWithAnInteger("/aliStacking/verbose", this);
+  fVerboseCmd->SetGuidance("Set verbose level for AliStackingAction");
+  fVerboseCmd->SetParameterName("VerboseLevel", true);
+  fVerboseCmd->SetDefaultValue(0);
+  fVerboseCmd->SetRange("VerboseLevel >= 0 && VerboseLevel <= 1");
+  fVerboseCmd->AvailableForStates(Idle);
+}
+
+AliStackingActionMessenger::AliStackingActionMessenger() {
+//
+}
+
+AliStackingActionMessenger::AliStackingActionMessenger(
+                                 const AliStackingActionMessenger& right) {
+//                              
+  AliGlobals::Exception("AliStackingActionMessenger is protected from copying.");
+}
+
+AliStackingActionMessenger::~AliStackingActionMessenger() {
+//
+  delete fStackingDirectory;
+  delete fClearStackCmd;
+  delete fVerboseCmd;
+}
+
+// operators
+
+AliStackingActionMessenger& 
+AliStackingActionMessenger::operator=(const AliStackingActionMessenger &right)
+{
+  // check assignement to self
+  if (this == &right) return *this;
+  
+  AliGlobals::Exception(
+    "AliStackingActionMessenger is protected from assigning.");
+
+  return *this;
+}
+
+// public methods
+
+void AliStackingActionMessenger::SetNewValue(G4UIcommand* command, 
+       G4String newValue)
+{ 
+// Applies command to the associated object.
+// ---
+
+  if (command == fClearStackCmd) { 
+    fStackingAction->ClearPrimaryStack(); 
+  }
+  else if (command == fVerboseCmd) { 
+    fStackingAction
+      ->SetVerboseLevel(fVerboseCmd->GetNewIntValue(newValue)); 
+  }  
+}
diff --git a/AliGeant4/AliStackingActionMessenger.h b/AliGeant4/AliStackingActionMessenger.h
new file mode 100644 (file)
index 0000000..85bdb11
--- /dev/null
@@ -0,0 +1,46 @@
+// $Id$
+// Category: event
+//
+// Messenger class that defines commands for AliStackingAction.
+
+#ifndef ALI_STACKING_ACTION_MESSENGER_H
+#define ALI_STACKING_ACTION_MESSENGER_H 
+
+#include <G4UImessenger.hh>
+#include <globals.hh>
+
+class AliStackingAction;
+
+class G4UIdirectory;
+class G4UIcmdWithAnInteger;
+class G4UIcmdWithoutParameter;
+
+class AliStackingActionMessenger: public G4UImessenger
+{
+  public:
+    AliStackingActionMessenger(AliStackingAction* trackingAction);
+    // --> protected
+    // AliStackingActionMessenger();
+    // AliStackingActionMessenger(const AliStackingActionMessenger& right);
+    virtual ~AliStackingActionMessenger();
+   
+    // methods 
+    virtual void SetNewValue(G4UIcommand* command, G4String string);
+    
+  protected:
+    AliStackingActionMessenger();
+    AliStackingActionMessenger(const AliStackingActionMessenger& right);
+
+    // operators
+    AliStackingActionMessenger& operator=(
+                            const AliStackingActionMessenger& right);
+
+  private:
+    // data members
+    AliStackingAction*        fStackingAction;    //associated class 
+    G4UIdirectory*            fStackingDirectory; //command directory
+    G4UIcmdWithoutParameter*  fClearStackCmd;     //command: clearStack
+    G4UIcmdWithAnInteger*     fVerboseCmd;        //command: verbose
+};
+
+#endif //ALI_STACKING_ACTION_MESSENGER_H
diff --git a/AliGeant4/AliSteppingAction.cxx b/AliGeant4/AliSteppingAction.cxx
new file mode 100644 (file)
index 0000000..6ae9927
--- /dev/null
@@ -0,0 +1,157 @@
+// $Id$
+// Category: event
+//
+// See the class description in the header file.
+
+#include "AliSteppingAction.h"
+#include "AliSteppingActionMessenger.h"
+#include "AliGlobals.h"
+
+#include <G4Track.hh>
+#include <G4SteppingManager.hh>
+
+const G4double AliSteppingAction::fgTolerance = 1e-6*mm;
+
+AliSteppingAction::AliSteppingAction()
+  : fKeptStepPoint(G4ThreeVector()),
+    fLoopVerboseLevel(1),
+    fStandardVerboseLevel(0),
+    fLoopStepCounter(0)
+{
+//
+  fMessenger = new AliSteppingActionMessenger(this);
+}
+
+AliSteppingAction::AliSteppingAction(const AliSteppingAction& right) {
+//
+  AliGlobals::Exception("AliSteppingAction is protected from copying.");
+}
+
+AliSteppingAction::~AliSteppingAction() {
+//
+  delete fMessenger;
+}
+
+// operators
+
+AliSteppingAction& 
+AliSteppingAction::operator=(const AliSteppingAction &right)
+{
+  // check assignement to self
+  if (this == &right) return *this;
+  
+  AliGlobals::Exception("AliSteppingAction is protected from assigning.");
+
+  return *this;
+}
+
+// private methods
+
+void AliSteppingAction::PrintTrackInfo(const G4Track* track) const
+{
+// Prints the track info
+// - taken from private G4TrackingManager::Verbose()
+// and the standard header for verbose tracking
+// - taken from G4SteppingVerbose::TrackingStarted().
+// ---
+
+  // print track info
+  G4cout << endl;
+  G4cout << "*******************************************************"
+         << "**************************************************"
+         << endl;
+  G4cout << "* G4Track Information: " 
+         << "  Particle = " << track->GetDefinition()->GetParticleName() 
+         << "," 
+        << "   Track ID = " << track->GetTrackID() 
+         << "," 
+        << "   Parent ID = " << track->GetParentID() 
+         << endl;
+  G4cout << "*******************************************************"
+         << "**************************************************"
+         << endl;
+  G4cout << endl;
+      
+  // print header    
+#ifdef G4_USE_G4BESTUNIT_FOR_VERBOSE
+    G4cout << setw( 5) << "Step#"  << " "
+           << setw( 8) << "X"      << "     "
+          << setw( 8) << "Y"      << "     "  
+          << setw( 8) << "Z"      << "     "
+          << setw( 9) << "KineE"  << "     "
+          << setw( 8) << "dE"     << "     "  
+          << setw(12) << "StepLeng"   << " "  
+          << setw(12) << "TrackLeng"  << " "
+          << setw(12) << "NextVolume" << " "
+          << setw( 8) << "ProcName"   << endl;      
+#else
+    G4cout << setw( 5) << "Step#"      << " "
+          << setw( 8) << "X(mm)"      << " "
+          << setw( 8) << "Y(mm)"      << " "  
+          << setw( 8) << "Z(mm)"      << " "
+          << setw( 9) << "KinE(MeV)"  << " "
+          << setw( 8) << "dE(MeV)"    << " "  
+          << setw( 8) << "StepLeng"   << " "  
+          << setw( 9) << "TrackLeng"  << " "
+          << setw(11) << "NextVolume" << " "
+          << setw( 8) << "ProcName"   << endl;      
+#endif
+}
+
+// public methods
+
+void AliSteppingAction::UserSteppingAction(const G4Step* step)
+{
+// After processing the given number of steps (kCheckNofSteps)
+// the particle position is compared with the previus one
+// - in case the distance is less than fgTolerance value
+// the verbose mode is switched on, particle is let 
+// to process a small number of steps (kMaxNofLoopSteps)
+// and then stopped and killed.
+// ---
+
+  G4Track* track = step->GetTrack();  
+
+  // reset parameters at beginning of tracking
+  G4int stepNumber = track->GetCurrentStepNumber();
+  if (stepNumber == 0) {
+    fKeptStepPoint = G4ThreeVector();
+    fLoopStepCounter = 0;
+    fStandardVerboseLevel = fpSteppingManager->GetverboseLevel();
+    return;
+  }  
+    
+  if (fLoopStepCounter) {
+    // count steps after detecting looping track
+    fLoopStepCounter++;
+    if (fLoopStepCounter == kMaxNofLoopSteps) {
+
+      // stop the looping track
+      track->SetTrackStatus(fStopAndKill);      
+
+      // reset back parameters
+      fpSteppingManager->SetVerboseLevel(fStandardVerboseLevel);
+      fKeptStepPoint = G4ThreeVector();
+      fLoopStepCounter = 0;
+    }  
+  }  
+
+  if (stepNumber % kCheckNofSteps == 0) {  
+    // detect looping track
+    G4ThreeVector newStepPoint = step->GetPreStepPoint()->GetPosition();
+    G4double trajectory = (newStepPoint-fKeptStepPoint).mag();
+    if (trajectory < fgTolerance) {
+
+      // print looping info
+      if (fLoopVerboseLevel > 0) {
+        G4cout << "*** Particle is looping. ***" << endl;
+       if (fStandardVerboseLevel == 0) PrintTrackInfo(track);
+      }        
+      // set loop verbose level 
+      fpSteppingManager->SetVerboseLevel(fLoopVerboseLevel);
+      
+      fLoopStepCounter++;
+    }  
+    fKeptStepPoint = newStepPoint;
+  }  
+}
diff --git a/AliGeant4/AliSteppingAction.h b/AliGeant4/AliSteppingAction.h
new file mode 100644 (file)
index 0000000..90f40a5
--- /dev/null
@@ -0,0 +1,70 @@
+// $Id$
+// Category: event
+//
+// Class for detecting and stopping looping particles
+
+#ifndef ALI_STEPPING_ACTION_H
+#define ALI_STEPPING_ACTION_H
+
+#include <G4UserSteppingAction.hh>
+#include <G4ThreeVector.hh>
+#include <globals.hh>
+
+class AliSteppingActionMessenger;
+
+class G4Track;
+
+class AliSteppingAction : public G4UserSteppingAction
+{
+  enum { 
+    kCheckNofSteps = 100,
+    kMaxNofLoopSteps = 5
+  };
+
+  public:
+    AliSteppingAction();
+    // protected
+    // AliSteppingAction(const AliSteppingAction& right);
+    virtual ~AliSteppingAction();
+
+    // methods
+    virtual void UserSteppingAction(const G4Step* step);
+    
+    // set methods
+    void SetLoopVerboseLevel(G4int level);
+    
+    // get methods
+    G4int GetLoopVerboseLevel() const;
+
+  protected:
+    AliSteppingAction(const AliSteppingAction& right);
+
+    // operators
+    AliSteppingAction& operator=(const AliSteppingAction& right);
+
+  private:
+    // methods
+    void PrintTrackInfo(const G4Track* track) const;
+  
+    // static data members
+    static const G4double fgTolerance;
+
+    // data members
+    G4ThreeVector   fKeptStepPoint;        //kept step point
+    G4int           fLoopVerboseLevel;     //tracking verbose level
+                                           //for looping particles
+    G4int           fStandardVerboseLevel; //standard tracking verbose level
+    G4int           fLoopStepCounter;      //loop steps counter
+    AliSteppingActionMessenger*  fMessenger;  //messenger
+};
+
+// inline methods
+
+inline void AliSteppingAction::SetLoopVerboseLevel(G4int level)
+{ fLoopVerboseLevel = level; }
+
+inline G4int AliSteppingAction::GetLoopVerboseLevel() const
+{ return fLoopVerboseLevel; }
+
+#endif //ALI_STEPPING_ACTION_H
+
diff --git a/AliGeant4/AliSteppingActionMessenger.cxx b/AliGeant4/AliSteppingActionMessenger.cxx
new file mode 100644 (file)
index 0000000..70a3f54
--- /dev/null
@@ -0,0 +1,69 @@
+// $Id$
+// Category: event
+//
+// See the class description in the header file.
+
+#include "AliSteppingActionMessenger.h"
+#include "AliSteppingAction.h"
+#include "AliGlobals.h"
+
+#include <G4UIdirectory.hh>
+#include <G4UIcmdWithAnInteger.hh>
+
+AliSteppingActionMessenger::AliSteppingActionMessenger(
+                              AliSteppingAction* trackingAction)
+  :fSteppingAction(trackingAction)
+{
+// 
+  fLoopVerboseCmd = new G4UIcmdWithAnInteger("/aliTracking/loopVerbose", this);
+  fLoopVerboseCmd
+    ->SetGuidance("Set tracking verbose level for detected looping tracks.");
+  fLoopVerboseCmd->SetParameterName("LoopVerboseLevel", true);
+  fLoopVerboseCmd->SetDefaultValue(1);
+  fLoopVerboseCmd->SetRange("LoopVerboseLevel >= 0 && LoopVerboseLevel <= 5");
+  fLoopVerboseCmd->AvailableForStates(Idle);
+}
+
+AliSteppingActionMessenger::AliSteppingActionMessenger() {
+//
+}
+
+AliSteppingActionMessenger::AliSteppingActionMessenger(
+                                 const AliSteppingActionMessenger& right) {
+//                              
+  AliGlobals::Exception(
+    "AliSteppingActionMessenger is protected from copying.");
+}
+
+AliSteppingActionMessenger::~AliSteppingActionMessenger() {
+//
+  delete fLoopVerboseCmd;
+}
+
+// operators
+
+AliSteppingActionMessenger& 
+AliSteppingActionMessenger::operator=(const AliSteppingActionMessenger &right)
+{
+  // check assignement to self
+  if (this == &right) return *this;
+  
+  AliGlobals::Exception(
+    "AliSteppingActionMessenger is protected from assigning.");
+
+  return *this;
+}
+
+// public methods
+
+void AliSteppingActionMessenger::SetNewValue(G4UIcommand* command, 
+       G4String newValue)
+{ 
+// Applies command to the associated object.
+// ---
+
+  if(command == fLoopVerboseCmd) { 
+    fSteppingAction
+      ->SetLoopVerboseLevel(fLoopVerboseCmd->GetNewIntValue(newValue)); 
+  }   
+}
diff --git a/AliGeant4/AliSteppingActionMessenger.h b/AliGeant4/AliSteppingActionMessenger.h
new file mode 100644 (file)
index 0000000..57b9b30
--- /dev/null
@@ -0,0 +1,43 @@
+// $Id$
+// Category: event
+//
+// Messenger class that defines commands for AliSteppingAction.
+
+#ifndef ALI_STEPPING_ACTION_MESSENGER_H
+#define ALI_STEPPING_ACTION_MESSENGER_H 
+
+#include <G4UImessenger.hh>
+#include <globals.hh>
+
+class AliSteppingAction;
+
+class G4UIdirectory;
+class G4UIcmdWithAnInteger;
+
+class AliSteppingActionMessenger: public G4UImessenger
+{
+  public:
+    AliSteppingActionMessenger(AliSteppingAction* trackingAction);
+    // --> protected
+    // AliSteppingActionMessenger();
+    // AliSteppingActionMessenger(const AliSteppingActionMessenger& right);
+    virtual ~AliSteppingActionMessenger();
+   
+    // methods 
+    virtual void SetNewValue(G4UIcommand* command, G4String string);
+    
+  protected:
+    AliSteppingActionMessenger();
+    AliSteppingActionMessenger(const AliSteppingActionMessenger& right);
+
+    // operators
+    AliSteppingActionMessenger& operator=(
+                            const AliSteppingActionMessenger& right);
+
+  private:
+    // data members
+    AliSteppingAction*     fSteppingAction; //associated class  
+    G4UIcmdWithAnInteger*  fLoopVerboseCmd; //command: loopVerbose
+};
+
+#endif //ALI_STEPPING_ACTION_MESSENGER_H
diff --git a/AliGeant4/AliTrackingAction.cxx b/AliGeant4/AliTrackingAction.cxx
new file mode 100644 (file)
index 0000000..ab197e0
--- /dev/null
@@ -0,0 +1,274 @@
+// $Id$
+// Category: event
+//
+// See the class description in the header file.
+
+#include "AliTrackingAction.h"
+#include "AliTrackingActionMessenger.h"
+#include "AliRun.h"
+#include "AliGlobals.h"  
+#include "TG4StepManager.h"
+
+#include <G4TrackingManager.hh>
+#include <G4Track.hh>
+#include <G4Event.hh>
+#include <G4SDManager.hh>
+#include <G4VHitsCollection.hh>
+
+#include <TParticle.h>
+
+// static data members
+AliTrackingAction* AliTrackingAction::fgInstance = 0;
+
+// static methods
+AliTrackingAction* AliTrackingAction::Instance() {
+// 
+  return fgInstance; 
+}
+
+AliTrackingAction::AliTrackingAction()
+  : fParticles(0),
+    fPrimaryTrackID(0),
+    fVerboseLevel(2),
+    fSavePrimaries(true),
+    fPrimariesCounter(0),
+    fParticlesCounter(0),
+    fLastParticleIndex(-1)
+{
+//
+  if (fgInstance) { 
+    AliGlobals::Exception("AliTrackingAction constructed twice."); 
+  }
+
+  fMessenger = new AliTrackingActionMessenger(this);
+  fgInstance = this;
+}
+
+AliTrackingAction::AliTrackingAction(const AliTrackingAction& right) {
+//
+  AliGlobals::Exception("AliTrackingAction is protected from copying.");
+}
+
+AliTrackingAction::~AliTrackingAction() {
+//
+  delete fMessenger;
+}
+
+// operators
+
+AliTrackingAction& 
+AliTrackingAction::operator=(const AliTrackingAction &right)
+{
+  // check assignement to self
+  if (this == &right) return *this;
+  
+  AliGlobals::Exception("AliTrackingAction is protected from assigning.");
+
+  return *this;
+}
+
+// public methods
+
+void AliTrackingAction::PrepareNewEvent()
+{
+// Called by G4 kernel at the beginning of event.
+// ---
+
+  // aliroot
+  if (!fParticles) fParticles = gAlice->Particles();
+
+  // set the particles and primaries counter to the
+  // number of tracks already stored in AliRun::fParticles
+  // (fParticles can already contain primary particles
+  //  saved by AliGenerator)
+  G4int nofTracks = gAlice->GetNtrack();
+  fPrimariesCounter = nofTracks;
+  fParticlesCounter = nofTracks;
+  fLastParticleIndex = nofTracks-1;
+
+  // set g4 stepping manager pointer
+  G4SteppingManager* pG4StepManager 
+    = fpTrackingManager->GetSteppingManager();
+  TG4StepManager* pStepManager = TG4StepManager::Instance();
+  pStepManager->SetSteppingManager(pG4StepManager);
+}
+
+void AliTrackingAction::PreUserTrackingAction(const G4Track* aTrack)
+{
+// Called by G4 kernel before starting tracking.
+// ---
+
+  // aliroot
+  // track index in the particles array
+  G4int trackID = aTrack->GetTrackID();
+  G4int parentID = aTrack->GetParentID();
+  Int_t trackIndex;
+  if (parentID==0) { 
+    trackIndex = trackID; 
+  } 
+  else { 
+    trackIndex = GetNofSavedTracks(); 
+  }
+
+  // in AliRoot (from V3.0) track numbering starts from 0
+  gAlice->SetCurrentTrack(--trackIndex);
+
+  if (parentID == 0) {  
+    // save primary track
+    SaveAndDestroyTrack();
+    fPrimaryTrackID = aTrack->GetTrackID();
+  }
+  else { 
+    // save secondary particles info 
+    // improve this later with retrieving the generation process
+    // (primary particles are stored 
+    //  by AlStackingAction in ClassifyNewTrack() method)
+    G4String origin = "secondary"; 
+    SaveParticle(aTrack, origin);
+  };
+}
+
+void AliTrackingAction::PostUserTrackingAction(const G4Track* aTrack)
+{
+// Called by G4 kernel after finishing tracking.
+// ---
+
+  G4String particleName 
+    = aTrack->GetDynamicParticle()->GetDefinition()->GetParticleName();
+  if (particleName == "opticalphoton") {
+    G4cout << "$$$ Track " <<  aTrack->GetTrackID()
+           << " is optical photon." << endl;
+  }                    
+}
+
+void AliTrackingAction::SaveAndDestroyTrack()
+{
+// Calls AliRun::PurifyKine and fills trees of hits
+// after finishing tracking of each primary track.
+// !! This method has to be also called from AlEventAction::EndOfEventAction() 
+// for storing the last primary track of the current event.
+// --- 
+
+  if (fPrimaryTrackID>0)
+  {
+     if (fVerboseLevel == 3) { 
+       G4cout << "$$$ Primary track " << fPrimaryTrackID << endl;
+     } 
+     else if ( fVerboseLevel == 2 &&  fPrimaryTrackID % 10 == 0 ) {
+         G4cout << "$$$ Primary track " << fPrimaryTrackID  << endl;
+     } 
+     else if ( fVerboseLevel == 1 &&  fPrimaryTrackID % 100 == 0 ) {
+         G4cout << "$$$ Primary track " << fPrimaryTrackID  << endl;
+     } 
+     
+     // aliroot
+     G4int lastSavedTrack 
+       = gAlice->PurifyKine(fLastParticleIndex, fParticlesCounter);
+     G4int nofPuredSavedTracks 
+       = gAlice->GetNtrack();
+     fLastParticleIndex = lastSavedTrack;
+     fParticlesCounter = nofPuredSavedTracks;
+
+     if(gAlice->TreeH()) gAlice->TreeH()->Fill();
+     gAlice->ResetHits();
+   }
+   else { 
+     fLastParticleIndex = fPrimariesCounter-1; 
+   }
+   fPrimaryTrackID = 0;
+}  
+
+void AliTrackingAction::SaveParticle(const G4Track* track, 
+                                     G4String processName)
+{
+// Converts G4track to TParticle and saves it in AliRun::fParticles
+// array.
+// ----
+
+  fParticlesCounter++;
+
+  // track history
+  G4int firstDaughter = -1; 
+  G4int lastDaughter = -1;      
+  G4int parentID = track->GetParentID();
+  G4int motherIndex1;
+  G4int motherIndex2 = -1;
+  if (parentID == 0) { 
+    motherIndex1 = -1; 
+    fPrimariesCounter++;    
+  }
+  else {
+    // set first/last child for already defined particles
+    motherIndex1 = GetParticleIndex(parentID);
+    // aliroot
+    TParticle* parent 
+      = dynamic_cast<TParticle*>(fParticles->UncheckedAt(motherIndex1));
+    if (parent) {  
+      if (parent->GetFirstDaughter()<0) 
+        parent->SetFirstDaughter(fParticlesCounter);
+      parent->SetLastDaughter(fParticlesCounter);
+    }
+    else {
+      AliGlobals::Exception(
+        "AliTrackingAction::SaveParticle: Unknown particle type");
+    }          
+  };
+     
+  // ?? status of particle 
+  // temporarily used for storing trackID from G4
+  G4int ks = track->GetTrackID();
+   
+  // particle type
+  // is this G3 ekvivalent ?? - check
+  G4int pdg = track->GetDefinition()->GetPDGEncoding();
+
+  // track kinematics
+  G4ThreeVector momentum = track->GetMomentum(); 
+  G4double px = momentum.x()/GeV;
+  G4double py = momentum.y()/GeV;
+  G4double pz = momentum.z()/GeV;
+  G4double e = track->GetTotalEnergy()/GeV;
+
+  G4ThreeVector position = track->GetPosition(); 
+  G4double vx = position.x()/cm;
+  G4double vy = position.y()/cm;
+  G4double vz = position.z()/cm;
+  // time of production - check if ekvivalent with G4
+  G4double t = track->GetGlobalTime();
+
+  G4ThreeVector polarization = track->GetPolarization(); 
+  G4double polX = polarization.x();
+  G4double polY = polarization.y();
+  G4double polZ = polarization.z();
+
+  // aliroot
+  TClonesArray& theCollectionRef = *fParticles;
+  G4int nofParticles = theCollectionRef.GetEntriesFast();
+  TParticle* particle 
+   = new(theCollectionRef[nofParticles]) 
+       TParticle(pdg, ks, motherIndex1, motherIndex1, 
+         firstDaughter, lastDaughter, px, py, pz, e, vx, vy, vz, t);
+  particle->SetPolarisation(polX, polY, polZ);
+  particle->SetBit(Keep_Bit, false); 
+}
+
+G4int AliTrackingAction::GetParticleIndex(G4int trackID)
+{
+// Converts the trackID into the index of the particle
+// in AliRun::fParticles array.
+// ---
+
+  if (trackID <= fPrimariesCounter) { 
+    return trackID-1; 
+  }
+  else
+    for (G4int i=fLastParticleIndex+1; i<fParticlesCounter; i++) {
+      // aliroot
+      TParticle* particle
+        = (TParticle*)fParticles->UncheckedAt(i);
+      if (trackID == particle->GetStatusCode()) return i;
+    }
+
+  AliGlobals::Exception("AliTrackingAction::GetParticleIndex() has failed.");
+  return 0;   
+}
diff --git a/AliGeant4/AliTrackingAction.h b/AliGeant4/AliTrackingAction.h
new file mode 100644 (file)
index 0000000..bf41d49
--- /dev/null
@@ -0,0 +1,90 @@
+// $Id$
+// Category: event
+//
+// Class that takes care of storing kinematics.
+
+#ifndef ALI_TRACKING_ACTION_H
+#define ALI_TRACKING_ACTION_H
+
+#include <G4UserTrackingAction.hh>
+#include <globals.hh>
+
+#include <TClonesArray.h>
+
+class AliTrackingActionMessenger;
+
+class G4Track;
+
+class AliTrackingAction : public G4UserTrackingAction 
+{
+  public:
+    AliTrackingAction();
+    // --> protected
+    // AliTrackingAction(const AliTrackingAction& right);
+    ~AliTrackingAction();
+   
+    // static get method
+    static AliTrackingAction* Instance();
+
+    // methods
+    void PrepareNewEvent();
+    virtual void PreUserTrackingAction(const G4Track* aTrack);
+    virtual void PostUserTrackingAction(const G4Track* aTrack);
+    void SaveParticle(const G4Track* track, G4String processName);
+    void SaveAndDestroyTrack();
+
+    // set methods
+    void SetVerboseLevel(G4int level);
+    void SetSavePrimaries(G4bool savePrimaries);
+
+    // get methods
+    G4int GetVerboseLevel() const;
+    G4bool GetSavePrimaries() const;
+    G4int GetNofPrimaryTracks() const;
+    G4int GetNofSavedTracks() const;
+
+  protected:
+    AliTrackingAction(const AliTrackingAction& right);
+
+    // operators
+    AliTrackingAction& operator=(const AliTrackingAction& right);
+
+  private:
+    // methods
+    G4int GetParticleIndex(G4int trackID);
+  
+    // static data members
+    static AliTrackingAction*    fgInstance; //this instance
+
+    // data members
+    TClonesArray*  fParticles;         //AliRun::fParticles
+    G4int          fPrimaryTrackID;    //primary track ID 
+    G4bool         fSavePrimaries;     //control of saving primaries
+    G4int          fVerboseLevel;      //verbose level
+    G4int          fPrimariesCounter;  //primary particles counter
+    G4int          fParticlesCounter;  //particles counter
+    G4int          fLastParticleIndex; //index of the last particle in fParticles
+    AliTrackingActionMessenger*  fMessenger; //messenger
+};
+
+// inline methods
+
+inline void AliTrackingAction::SetVerboseLevel(G4int level)
+{ fVerboseLevel = level; }
+
+inline void AliTrackingAction::SetSavePrimaries(G4bool savePrimaries)
+{ fSavePrimaries = savePrimaries; }
+
+inline G4int AliTrackingAction::GetVerboseLevel() const
+{ return fVerboseLevel; }
+
+inline G4bool AliTrackingAction::GetSavePrimaries() const
+{ return fSavePrimaries; }
+
+inline G4int AliTrackingAction::GetNofPrimaryTracks() const
+{ return fPrimariesCounter; }
+
+inline G4int AliTrackingAction::GetNofSavedTracks() const
+{ return fParticlesCounter; }
+
+#endif //ALI_TRACKING_ACTION_H
diff --git a/AliGeant4/AliTrackingActionMessenger.cxx b/AliGeant4/AliTrackingActionMessenger.cxx
new file mode 100644 (file)
index 0000000..4f61bef
--- /dev/null
@@ -0,0 +1,73 @@
+// $Id$
+// Category: event
+//
+// See the class description in the header file.
+
+#include "AliTrackingActionMessenger.h"
+#include "AliTrackingAction.h"
+#include "AliGlobals.h"
+
+#include <G4UIdirectory.hh>
+#include <G4UIcmdWithAnInteger.hh>
+
+AliTrackingActionMessenger::AliTrackingActionMessenger(
+                              AliTrackingAction* trackingAction)
+  :fTrackingAction(trackingAction)
+{
+// 
+  fTrackingDirectory = new G4UIdirectory("/aliTracking/");
+  fTrackingDirectory->SetGuidance("AliTrackingAction control commands.");
+
+  fVerboseCmd = new G4UIcmdWithAnInteger("/aliTracking/verbose", this);
+  fVerboseCmd->SetGuidance("Set verbose level for AliTrackingAction");
+  fVerboseCmd->SetParameterName("VerboseLevel", true);
+  fVerboseCmd->SetDefaultValue(2);
+  fVerboseCmd->SetRange("VerboseLevel >= 0 && VerboseLevel <= 3");
+  fVerboseCmd->AvailableForStates(Idle);
+}
+
+AliTrackingActionMessenger::AliTrackingActionMessenger() {
+//
+}
+
+AliTrackingActionMessenger::AliTrackingActionMessenger(
+                                 const AliTrackingActionMessenger& right) {
+//                              
+  AliGlobals::Exception(
+    "AliTrackingActionMessenger is protected from copying.");
+}
+
+AliTrackingActionMessenger::~AliTrackingActionMessenger() {
+//
+  delete fTrackingDirectory;
+  delete fVerboseCmd;
+}
+
+// operators
+
+AliTrackingActionMessenger& 
+AliTrackingActionMessenger::operator=(const AliTrackingActionMessenger &right)
+{
+  // check assignement to self
+  if (this == &right) return *this;
+  
+  AliGlobals::Exception(
+    "AliTrackingActionMessenger is protected from assigning.");
+
+  return *this;
+}
+
+// public methods
+
+void AliTrackingActionMessenger::SetNewValue(G4UIcommand* command, 
+       G4String newValue)
+{ 
+// Applies command to the associated object.
+// ---
+
+  if(command == fVerboseCmd)
+  { 
+    fTrackingAction
+      ->SetVerboseLevel(fVerboseCmd->GetNewIntValue(newValue)); 
+  };   
+}
diff --git a/AliGeant4/AliTrackingActionMessenger.h b/AliGeant4/AliTrackingActionMessenger.h
new file mode 100644 (file)
index 0000000..621451c
--- /dev/null
@@ -0,0 +1,44 @@
+// $Id$
+// Category: event
+//
+// Messenger class that defines commands for AliTrackingAction.
+
+#ifndef ALI_TRACKING_ACTION_MESSENGER_H
+#define ALI_TRACKING_ACTION_MESSENGER_H 
+
+#include <G4UImessenger.hh>
+#include <globals.hh>
+
+class AliTrackingAction;
+
+class G4UIdirectory;
+class G4UIcmdWithAnInteger;
+
+class AliTrackingActionMessenger: public G4UImessenger
+{
+  public:
+    AliTrackingActionMessenger(AliTrackingAction* trackingAction);
+    // --> protected
+    // AliTrackingActionMessenger();
+    // AliTrackingActionMessenger(const AliTrackingActionMessenger& right);
+    virtual ~AliTrackingActionMessenger();
+   
+    // methods 
+    virtual void SetNewValue(G4UIcommand* command, G4String string);
+    
+  protected:
+    AliTrackingActionMessenger();
+    AliTrackingActionMessenger(const AliTrackingActionMessenger& right);
+
+    // operators
+    AliTrackingActionMessenger& operator=(
+                            const AliTrackingActionMessenger& right);
+
+  private:
+    // data members
+    AliTrackingAction*     fTrackingAction;    //associated class 
+    G4UIdirectory*         fTrackingDirectory; //command directory
+    G4UIcmdWithAnInteger*  fVerboseCmd;        //command: verbose
+};
+
+#endif //ALI_TRACKING_ACTION_MESSENGER_H
diff --git a/AliGeant4/Makefile b/AliGeant4/Makefile
new file mode 100644 (file)
index 0000000..4772146
--- /dev/null
@@ -0,0 +1,96 @@
+# $Id$
+
+############################### AliGeant4 Makefile #############################
+
+# Include Geant4 specific definitions
+
+include $(G4INSTALL)/config/architecture.gmk
+
+# Include machine specific definitions
+
+include $(ALICE_ROOT)/conf/GeneralDef
+include $(ALICE_ROOT)/conf/MachineDef.$(ALICE_TARGET)
+
+# Include Alice Geant4 specific definitions
+
+NEED_G4_LIBS := 1
+include $(ALICE_ROOT)/conf/Geant4.gmk
+
+PACKAGE = AliGeant4
+TARGET  = aligeant4
+
+# C++ sources
+
+SRCS           = $(wildcard *.cxx)
+
+# C++ Headers
+
+HDRS          =  $(wildcard *.icc) $(wildcard *.h)
+
+# Library dictionary
+# only for selected classes
+
+DICT          = AliGeant4Cint.cxx
+DICTH         = AliRunConfiguration.h AliGeant4LinkDef.h
+DICTO         = $(patsubst %.cxx,tgt_$(ALICE_TARGET)/%.o,$(DICT))
+
+# C++ Objects
+
+OBJS          = $(patsubst %.cxx,tgt_$(ALICE_TARGET)/%.o,$(SRCS)) $(DICTO)
+
+# Program C++ source, objects
+
+PSRC          = $(TARGET).cxx
+POBJ          = $(patsubst %.cxx,tgt_$(ALICE_TARGET)/%.o,$(PSRC))
+
+# C++ compilation flags
+
+CXXFLAGS      = $(CXXOPTS) -I$(ROOTSYS)/include -I. -I$(ALICE_ROOT)/include/ \
+               -I$(ALICE_ROOT)/TGeant4/
+
+##### TARGETS #####
+# Target
+
+SLIBRARY       = $(LIBDIR)/libAliGeant4.$(SL)
+ALIBRARY       = $(LIBDIR)/lib/libAliGeant4.a
+PROGRAM                = $(BINDIR)/$(TARGET)
+
+default:       $(SLIBRARY) $(PROGRAM)
+
+$(LIBDIR)/libAliGeant4.$(SL):          $(OBJS)
+
+$(BINDIR)/$(TARGET):                   $(POBJ)
+
+$(DICT):                               $(DICTH)
+
+depend:                                        $(SRCS)
+
+#HEADERS =     $(filter-out %LinkDef.h,$(HDRS))
+
+# filter-out Geant3 dependent libraries (ZDC requires symbols from G3)
+# and add Geant4 dependent ones
+ALILIBS := $(filter-out -lTGeant3,$(ALILIBS))
+ALILIBS := $(filter-out -lZDC,$(ALILIBS))
+ALILIBS += -lTGeant4 -lAliGeant4
+
+LIBS = $(ALILIBS) $(G4LDLIBS) $(CLIBS) $(GLIBS) -lEG -lEGPythia -lpythia -lpdf
+
+TOCLEAN              = $(OBJS) *Cint.cxx *Cint.h
+
+CHECKS        = $(patsubst %.cxx,check/%.viol,$(SRCS))
+
+############################### General Macros ################################
+
+include $(ALICE_ROOT)/conf/GeneralMacros
+
+
+# Geant4 specific compiler flags
+
+CXXFLAGS += $(CPPFLAGS)
+
+
+############################ Dependencies #####################################
+
+-include tgt_$(ALICE_TARGET)/Make-depend 
diff --git a/AliGeant4/aligeant4.cxx b/AliGeant4/aligeant4.cxx
new file mode 100644 (file)
index 0000000..3a49d48
--- /dev/null
@@ -0,0 +1,65 @@
+// $Id$
+
+#include "AliRunConfiguration.h"
+#include "AliFiles.h"
+#include "AliRun.h"
+
+#include "TGeant4.h"
+#include "TG4RunManager.h"
+
+#include <TROOT.h>
+#include <TRint.h>
+
+extern void InitGui();
+
+#include <stdlib.h>
+
+int main(int argc, char** argv) 
+{
+  // ROOT  ===================
+#ifdef G4VIS_USE_OPACS
+  // Root graphics does not work when OPACS graphics is build 
+  TROOT aTROOT("Alice","Alice G4 prototype Root I/O");
+#else
+  VoidFuncPtr_t initfuncs[] = { InitGui, 0 };
+  TROOT aTROOT("Alice","Alice G4 prototype Root I/O",initfuncs);
+#endif
+
+  // ALICE ======================
+
+  // AliRun
+  AliRun* run
+    = new AliRun("gAlice","The Alice run manager");
+  G4cout << "AliRun has been created." << endl;
+
+  // AliRunConfiguration for Geant4
+  AliRunConfiguration* runConfiguration 
+    = new AliRunConfiguration();
+  G4cout << "AliRunConfiguration has been created." << endl;
+   
+  // Geant4 ======================
+
+  // TGeant4
+  TGeant4* geant4 
+    = new TGeant4("TGeant4", "The Geant4 Monte Carlo",
+                   runConfiguration, argc, argv );
+  G4cout << "TGeant4 has been created." << endl;
+  
+  // start UI ===================
+
+  TG4RunManager* runManager = TG4RunManager::Instance();
+
+  // Root interactive session
+  //runManager->StartRootUI();
+
+  // Geant4 interactive session
+  runManager->StartGeantUI();
+
+  delete run;
+  //runConfiguration is deleted in TG4RunManager
+  //geant4 is deleted in AliRun destructor 
+
+  G4cout << "Everything has been deleted." << endl;
+  return 0;
+}
+
diff --git a/AliGeant4/config/doc_alc++2html.pl b/AliGeant4/config/doc_alc++2html.pl
new file mode 100755 (executable)
index 0000000..cd464cc
--- /dev/null
@@ -0,0 +1,86 @@
+#!/usr/local/bin/perl
+# $Id$
+# Ivana Hrivnacova 12.2.99
+#
+# HTML documentation is created for all 
+# source code files: *.h *.cxx 
+# makefiles: Makefile, *.gmk 
+# and configuration setup scripts
+
+# create doc directory if it does not exist
+$CURDIR = `pwd`;
+chdir $ENV{'AG4_INSTALL'};
+if (! grep(/doc/, `ls`)) {
+  `mkdir doc` ;
+  print "Directory doc has been created." . "\n";
+};
+# move doc/HTML directory to doc/HTML.old
+chdir doc;
+if (grep(/HTML.old/, `ls`)) {
+  print "Cleaning HTML.old" . "\n";
+  `rm -fr HTML.old`;
+}
+if (grep(/HTML/, `ls`)) {
+  `mkdir HTML.old`;
+  `mv HTML HTML.old`;
+  print "Old HTML directory has been saved." . "\n";
+}
+chdir $ENV{'AG4_INSTALL'};
+
+# create tmpdoc directory is it does not exist
+# or clean it
+if (! grep(/tmpdoc/, `ls`)) {
+  `mkdir tmpdoc` ;
+  print "Directory tmpdoc has been created." . "\n";
+} else {
+  print "Cleaning tmpdoc" . "\n";
+  `rm -fr tmpdoc/*`;
+}  
+
+# select directory that will be processed
+$SOURCEDIR = ". ../TGeant4";
+
+# copy everything for documentation to tmpdoc
+@FILELIST = `find $SOURCEDIR -name "*.ddl"`;
+@FILELIST = (@FILELIST, `find $SOURCEDIR -name "*.h"`);
+@FILELIST = (@FILELIST, `find $SOURCEDIR -name "*.cxx"`);
+@FILELIST = (@FILELIST, `find $SOURCEDIR -name "*.icc"`);
+@FILELIST = (@FILELIST, `find $SOURCEDIR -name "Makefile"`);
+@FILELIST = (@FILELIST, `find $SOURCEDIR -name "*.gmk"`);
+@FILELIST = (@FILELIST, `find $SOURCEDIR -name "setup*"`);
+
+print "Copying files to tmpdoc" . "\n";
+foreach $FILE (@FILELIST) {
+  chop $FILE;
+  # exclude dictionary classes
+  if (!grep(/Dict/,$FILE)) {
+    `cp $FILE tmpdoc`;
+  }  
+  #print "$FILE has been copied to tmpdoc" . "\n";
+}
+
+# mv *.cxx to *.C 
+# what is recquired by ddl2html.pl
+chdir tmpdoc;
+print "Renaming files" . "\n";
+@CXXLIST = `ls *.cxx`;
+foreach $CXXFILE (@CXXLIST) {
+  chop $CXXFILE;
+  $CFILE = `echo $CXXFILE | sed s/.cxx/.C/g`;
+  `mv $CXXFILE $CFILE`;
+}
+
+# execute the modified P.Binko's script
+system $ENV{'AG4_INSTALL'} . "/config/doc_alddl2html.pl ALICE G4 Project";
+
+# move HTML to doc and remove tmpdoc
+$DOCDIR = $ENV{'AG4_INSTALL'} . "/doc";
+`mv HTML $DOCDIR`;  
+print "Removing tmpdoc" . "\n";
+chdir $ENV{'AG4_INSTALL'};
+`rm -fr tmpdoc`;
+
+# generate the category pages
+system $ENV{'AG4_INSTALL'} . "/config/doc_alsorthtml.pl";
+
+chdir $CURDIR;
diff --git a/AliGeant4/config/doc_alcategory.pl b/AliGeant4/config/doc_alcategory.pl
new file mode 100755 (executable)
index 0000000..a7c8183
--- /dev/null
@@ -0,0 +1,93 @@
+#!/usr/local/bin/perl
+# $Id$
+# Ivana Hrivnacova 15.2.00
+#
+# This script generates the class category page
+# from all *.h files found in the category directory
+
+# no test of arguments is performed
+$CAT = $ARGV[0];
+$NAME = $ARGV[1];
+
+# open output file
+$output =  $ENV{'AG4_INSTALL'} . "/doc/HTML/" . $NAME . "Category.html";
+open(OUTPUT, ">" . $output);
+
+print "Processing class category: " . $NAME . "\n"; 
+
+# print the begining of file
+print OUTPUT "<HTML>\n";
+print OUTPUT "\n";
+print OUTPUT "<HEAD>\n";
+print OUTPUT "<TITLE>Class category: ". $NAME . "</TITLE></HEAD>\n";
+print OUTPUT "\n";
+print OUTPUT "\n";
+print OUTPUT "<BODY bgcolor=#FFFFFF>\n";
+print OUTPUT "\n";
+print OUTPUT "<!-- Header material -->\n";
+print OUTPUT "<table border=0   cellpadding=5 cellspacing=0 width=\"100%\">\n";
+print OUTPUT "  <tr bgcolor=#d0ffd0>\n";
+print OUTPUT "     <td align=left width=30%>\n";
+print OUTPUT "     <img alt=\"Alice\"\n";
+print OUTPUT "       src=\"http://AliSoft.cern.ch/offline/geant4/gif/AliceLogo.gif\"\n";
+print OUTPUT "     width=\"60\" height=\"60\" align=\"absmiddle\" border=1>\n";
+print OUTPUT "     <td align=center width=40%>\n";
+print OUTPUT "        <font size=\"+2\">\n";
+print OUTPUT "           Alice Geant4 Simulation Code Prototype        </font>\n";
+print OUTPUT "     <td align=right width=30% valign=bottom>\n";
+print OUTPUT "        <font size=\"-1\">\n";
+print OUTPUT "        <script language=\"JavaScript\">\n";
+print OUTPUT "        document.write(\"Last modified \"+ document.lastModified)\n";
+print OUTPUT "        // end of script -->\n";
+print OUTPUT "        </script></font>\n";
+print OUTPUT "     </td>\n";
+print OUTPUT "  </tr>\n";
+print OUTPUT "</table>\n";
+print OUTPUT "<CENTER>\n";
+print OUTPUT "<H2>Class category: " . $NAME . "</H2>\n";
+print OUTPUT "</CENTER>\n";
+print OUTPUT "\n";
+print OUTPUT "<P><HR SIZE=5><BR>\n";
+print OUTPUT "\n";
+print OUTPUT "<UL><BR>\n";
+print OUTPUT "\n";
+print OUTPUT "<LI><STRONG>C++ header files:</STRONG>\n";
+print OUTPUT "\n";
+print OUTPUT "  <UL>\n";
+
+# print the linked header files
+$CATSTRING = "\"Category: " . $CAT . "\"";
+@FILELIST = `find . -name \"*.h\" -exec grep -l  $CATSTRING  {} \\;`;
+
+foreach $FILEPATH (@FILELIST) { 
+  @TEMP = split('/',$FILEPATH);
+  $FILE = @TEMP[@TEMP - 1];
+  chop $FILE;
+  print "   Linking file " . $FILE . "\n"; 
+  print OUTPUT "  <LI><A HREF=\"" . $FILE . ".html\">" . $FILE . "</A>\n";
+}
+
+# print the end of file
+$today = localtime(time);
+$today =~ s/ \d\d:\d\d:\d\d / /;
+@list = getpwuid($<);
+$user = $list[6];
+print OUTPUT "</UL>\n";
+print OUTPUT "\n";
+print OUTPUT "</UL>\n";
+print OUTPUT "\n";
+print OUTPUT "<P><HR SIZE=5>\n";
+print OUTPUT "\n";
+print OUTPUT "<ADDRESS>\n";
+print OUTPUT "Created on $today by <B>$user</B> <BR>\n";
+print OUTPUT "using the HTML generator\n";
+print OUTPUT "<A HREF=\"http://home.cern.ch/~binko/Ddl2Html/Ddl2Html.html\">Ddl2Html description</A>\n";
+print OUTPUT " (the source <A HREF=\"http://home.cern.ch/~binko/Ddl2Html/Ddl2Html.code\">Perl5 code</A>)\n";
+print OUTPUT "</ADDRESS>\n";
+print OUTPUT "\n";
+print OUTPUT "</BODY bgcolor=#FFFFFF >\n";
+print OUTPUT "\n";
+print OUTPUT "</HTML>\n";
+
+# close output file
+close(OUTPUT);    
diff --git a/AliGeant4/config/doc_alddl2html.pl b/AliGeant4/config/doc_alddl2html.pl
new file mode 100755 (executable)
index 0000000..331839c
--- /dev/null
@@ -0,0 +1,728 @@
+#!/usr/local/bin/perl5
+# $Id$
+################################################################################
+#
+# Automatic HTML generator for projects using Objectivity
+#
+# Author : Pavel Binko
+#
+# Last update : 09/04/96
+#
+################################################################################
+# Modified for Alice specifics by Ivana Hrivnacova: 22.5.98;
+# some more changes 12.2.99;
+#
+# ------------------------------------------------------------------------------
+# Analyse the command arguments
+#
+if( $#ARGV == -1 )
+{
+  $pwd = `pwd`;
+  chop($pwd);
+  @help = split(/\//,$pwd);
+  $help[$#help] =~ tr/a-z/A-Z/;
+  $html_title = "The ".$help[$#help]." Project";
+  undef $help;
+}
+elsif( $#ARGV == 0 && $ARGV[0] =~ /^-[?hH]/ )
+{
+  print "\n";
+  print "The Ddl2Html functionality :\n\n";
+  print "  Ddl2Html has to be started from the project directory you'd like\n";
+  print "           to document (to convert to html)\n";
+  print "  Ddl2Html creates (if not existing) the directory HTML in the project\n";
+  print "           directory and adds the afs access rights \"cern:nodes rl\"\n";
+  print "           to both HTML and project directories\n";
+  print "  Ddl2Html creates index.html file and *.ddl.html, *.h.html and\n";
+  print "           *.C.html files in the HTML directory\n\n";
+  print "  Contents of the project directory remains unchanged.\n\n\n";
+  print "The Ddl2Html command syntax :\n\n";
+  print "  Ddl2Html [ arguments ] \n\n";
+  print "    No argument : The project directory name will be chosen\n";
+  print "                  as the project name (in upper case)\n\n";
+  print "    One argument : a) If the argument starts with -h or -H or -?,\n";
+  print "                      this help text will be printed\n";
+  print "                   b) If the argument matches with a file name\n";
+  print "                      in the project directory, the first line\n";
+  print "                      from the file will be the project title\n";
+  print "                   c) Othetwise  the whole text from the command\n";
+  print "                      line will be the project title\n\n";
+  print "    More than one argument : The whole text from the command line\n";
+  print "                             will be the project title\n\n\n";
+  print "For further details see the :\n";
+  die "    http://home.cern.ch/~binko/Ddl2Html/Ddl2Html.html\n\n";
+}
+elsif( $#ARGV == 0 && -e $ARGV[0] )
+{
+  $first = 1;
+  while( <> )
+  {
+    if( $first )
+    {
+      chop($_);
+      $html_title = $_;
+      $first = 0;
+    }
+  }
+  undef $first;
+}
+else
+{
+  $html_title = join( " ", @ARGV );
+}
+
+study();
+
+print "\n\n";
+print "*****************************************************************\n";
+print "*\n";
+print "*  $html_title\n";
+print "*\n";
+print "*****************************************************************\n\n\n";
+
+#
+# ------------------------------------------------------------------------------
+# Get some information about the creator
+#
+# UID is in the variable $<
+@list = getpwuid($<);
+$user = $list[6];
+
+#
+# ==============================================================================
+# Get a list of all .ddl files
+#
+@ddls = <*.ddl>;
+print "List of Objectivity DDL files = @ddls\n\n";
+
+#
+# ------------------------------------------------------------------------------
+# Get a list of .h files, where no .ddl files exist (ignore _ref.h files)
+#
+while( $hdrname = <*.h> )
+{
+  if( ! ( $hdrname =~ /_ref.h$/ ) )
+  {
+    $helpname = $hdrname;
+    $helpname =~ s/.h$/.ddl/;
+    if( ! -e $helpname )
+    { @hdrs = (@hdrs, $hdrname);
+    }
+  }
+}
+print "List of C++ header files = @hdrs\n\n";
+
+#
+# ------------------------------------------------------------------------------
+# Get a list of all C++ programs
+#
+while( $cppname = <*.C> )
+{
+  if( ! ( $cppname =~ /_ddl.C$/ ) )
+  {
+    $helpname = $cppname;
+    $helpname =~ s/.C$//;
+    if( -e "$helpname.ddl" )
+    { @cppddls = (@cppddls, $cppname);
+    }
+    elsif( -e "$helpname.h" )
+    { @cpphdrs = (@cpphdrs, $cppname);
+    }
+    else
+    { @cppmain = (@cppmain, $cppname);
+    }
+  }
+}
+print "List of C++ programs to the *.ddl = @cppddls\n\n";
+print "List of C++ programs to the *.h = @cpphdrs\n\n";
+print "List of main programs = @cppmain\n\n";
+
+#
+# ------------------------------------------------------------------------------
+# Get a list of all Makefiles, makefiles, s.Makefiles and s.makefiles
+#
+@maks = <*.gmk>;
+print "List of Makefiles = @maks\n\n";
+
+#
+# ------------------------------------------------------------------------------
+# Get a list of all config.* files
+#
+#@cnfs = <config.*>;
+@cnfs = <setup* *boot*>;
+print "List of configuration files = @cnfs\n\n";
+
+#
+# ==============================================================================
+# Analyse the .ddl and .h files
+#
+print "Analysing the .ddl and .h files ...\n\n";
+
+foreach $file (@ddls, @hdrs)
+{
+  open (HF, $file);
+  $fileline = 0;
+
+  while (<HF>)
+  {
+    $fileline += 1;
+    chop;
+    if ( ! (/^[ \t]*\/\//) )   # ignore C++ comment lines
+    {
+      s/\/\/.*//;              # ignore all after C++ comment sign //
+
+      if ( /\bclass\b/ && ! ( /template.*<.*class.*>/ ) )
+      {
+        @words = split();                      # split line read in
+        for( $i = 0 ; $i < $#words ; $i++ )
+        {
+          if( $words[$i] eq "class" )
+          {
+            $words[$i+1] =~ s/:.*//;
+            $words[$i+1] =~ s/{.*//;
+            if( !($words[$i+1] =~ /;/ ) && !($words[$i+2] =~ /^;/ )
+                                        && ($words[$i+1] ne "") )
+            {
+              $fileclass{$words[$i+1]} = $file."//".$fileline;
+              $i = $#words;
+            }
+          }
+        }
+      }
+
+      if ( /\benum\b/ )
+      {
+        @words = split();                      # split line read in
+        for( $i = 0 ; $i < $#words ; $i++ )
+        {
+          if( $words[$i] eq "enum" )
+          {
+            $words[$i+1] =~ s/{.*//;
+            if( $words[$i+1] ne "" )
+            {
+              $fileenum{$words[$i+1]} = $file."//".$fileline;
+              $i = $#words;
+            }
+          }
+        }
+      }
+
+    }
+  }
+  close(HF);
+}
+
+# debug
+# print "\n\n\nDEBUG INFORMATION :\n";
+# foreach $class (keys %fileclass)
+# { print "DEBUG: class $class found in $fileclass{$class}\n";
+# }
+# foreach $enum (keys %fileenum)
+# { print "DEBUG: enum $enum found in $fileenum{$enum}\n";
+# }
+# print "\n\n";
+# end debug
+
+#
+# ==============================================================================
+# Some variables needed for html files
+#
+$today = localtime(time);
+$today =~ s/ \d\d:\d\d:\d\d / /;
+
+#
+# ------------------------------------------------------------------------------
+# Create the directory html (if not existing)
+#
+if( ! -e "HTML" )
+{
+  `mkdir HTML`;
+}
+if( -e "/usr/sue/bin/fs" )
+{
+  `/usr/sue/bin/fs setacl . cern:nodes rl`;
+  `/usr/sue/bin/fs setacl HTML cern:nodes rl`;
+}
+
+#
+# ==============================================================================
+# Create *.ddl.html and *.h.html files
+#
+foreach $file (@ddls, @hdrs)
+{
+print "Writing file $file.html ... \n";
+
+# Open the .ddl or .h file and the .html file
+open (HDRF, $file);
+open (HLPF,">HTML/$file.html");
+
+&html_header($file);
+#print HLPF "<HR SIZE=5><P>\n\n";
+#&centred_header1($html_title);
+#print HLPF "<P><HR SIZE=5><P>\n\n";
+&see_source_file;
+print HLPF "<P><HR SIZE=5><P>\n\n";
+&centred_header1($file);
+print HLPF "<P><HR><P>\n\n";
+
+print HLPF "<PRE>\n\n";
+&html_ddl_h_cpp_code;
+print HLPF "\n</PRE>\n\n";
+
+print HLPF "<P><HR SIZE=5><P>\n\n";
+&back_to_index_see_source_file;
+&create_address;
+
+close(HLPF);
+close(HDRF);
+}
+print "\nHTML for Objectivity DDL files and C++ header files created ... \n\n";
+
+#
+# ------------------------------------------------------------------------------
+# Create *.C.html files
+#
+foreach $file (@cppddls, @cpphdrs, @cppmain)
+{
+print "Writing file $file.html ... \n";
+
+# Open the C++ file and the .html file
+open (HDRF, $file);
+open (HLPF,">HTML/$file.html");
+
+&html_header($file);
+#print HLPF "<HR SIZE=5><P>\n\n";
+#&centred_header1($html_title);
+#print HLPF "<P><HR SIZE=5><P>\n\n";
+&see_ddl_h_file;
+print HLPF "<P><HR SIZE=5><P>\n\n";
+&centred_header1($file);
+print HLPF "<P><HR><P>\n\n";
+
+print HLPF "<PRE>\n\n";
+&html_ddl_h_cpp_code;
+print HLPF "\n</PRE>\n\n";
+
+print HLPF "<P><HR SIZE=5><P>\n\n";
+&back_to_index_see_ddl_h_file;
+&create_address;
+
+close(HLPF);
+close(HDRF);
+}
+print "\nHTML for C++ files created ... \n\n";
+
+#
+# ------------------------------------------------------------------------------
+# Copy Make and Config files
+#
+foreach $file (@maks, @cnfs)
+{
+print "Copying file $file ... \n";
+`cp $file HTML/$file`;
+}
+print "\nMake and Config files copied ... \n\n";
+
+#
+# ------------------------------------------------------------------------------
+# Write index.html
+#
+print "Writing index file ... \n";
+
+open (HLPF,">HTML/index.html");
+
+&html_header($html_title);
+
+#print HLPF "<H1 ALIGN=RIGHT>";
+#print HLPF "<TABLE COLSPEC=\"20\" BORDER=5 CELLPADDING=0 CELLSPACING=0>\n";
+#print HLPF "<TR><TH>";
+#print HLPF "<A HREF=\"index.html\" TARGET=_top>No Frame</A>";
+#print HLPF "</TH></TR>\n";
+#print HLPF "</TABLE></H1>\n\n";
+
+print HLPF "<!-- Header material -->\n";
+print HLPF "<table border=0   cellpadding=5 cellspacing=0 width=\"100%\">\n";
+print HLPF "  <tr bgcolor=#d0ffd0>\n";
+print HLPF "     <td align=left width=30%>\n";
+print HLPF "     <img alt=\"Alice\"\n"; 
+print HLPF "        src=\"http://AliSoft.cern.ch/offline/geant4/gif/AliceLogo.gif\"\n"; 
+print HLPF "       width=\"60\" height=\"60\" align=\"absmiddle\" border=1>\n";
+print HLPF "     <td align=center width=40%>\n";
+print HLPF "        <font size=\"+2\">\n";
+print HLPF "           Alice Geant4 Simulation Code Prototype";
+print HLPF "        </font>\n";
+print HLPF "     <td align=right width=30% valign=bottom>\n"; 
+print HLPF "        <font size=\"-1\">\n"; 
+print HLPF "        <script language=\"JavaScript\">\n"; 
+print HLPF "        document.write(\"Last modified \"+ document.lastModified)\n"; 
+print HLPF "        // end of script -->\n"; 
+print HLPF "        </script></font>\n"; 
+print HLPF "     </td>\n";
+print HLPF "  </tr>\n";
+print HLPF "</table>\n";
+
+#&centred_header1($html_title);
+#print HLPF "<P><HR SIZE=5><P>\n\n";
+
+print HLPF "<UL><BR>\n\n";
+
+if( @hdrs )
+{
+print HLPF "<LI><STRONG>C++ header files:</STRONG>\n";
+  print HLPF "  <UL>\n";
+  foreach $file (@hdrs)
+  { print HLPF "  <LI><A HREF=\"$file.html\">$file</A>\n";
+  }
+
+if( @cpphdrs )
+{
+#  &and_cpp_code;
+#  foreach $file (@cpphdrs)
+#  { print HLPF "  <LI><A HREF=\"$file.html\">$file</A>\n";
+#  }
+}
+print HLPF "  </UL>\n\n";
+
+print HLPF "<P><HR><P>\n\n";
+}
+
+if( @ddls )
+{
+print HLPF "<LI><STRONG>Objectivity DDL files:</STRONG>\n";
+  print HLPF "  <UL>\n";
+  foreach $file (@ddls)
+  { print HLPF "  <LI><A HREF=\"$file.html\">$file</A>\n";
+  }
+
+if( @cppddls )
+{
+#  &and_cpp_code;
+#  foreach $file (@cppddls)
+#  { print HLPF "  <LI><A HREF=\"$file.html\">$file</A>\n";
+#  }
+}
+print HLPF "  </UL>\n\n";
+
+print HLPF "<P><HR><P>\n\n";
+}
+
+if( @cppmain )
+{
+print HLPF "<LI><STRONG>Main programs/Extern methods:</STRONG>\n";
+  print HLPF "  <UL>\n";
+  foreach $file (@cppmain)
+  { print HLPF "  <LI><A HREF=\"$file.html\">$file</A>\n";
+  }
+  print HLPF "  </UL>\n\n";
+
+print HLPF "<P><HR><P>\n\n";
+}
+
+if( @maks || @cnfs )
+{
+print HLPF "<LI><STRONG>Makefiles and configuration files:</STRONG>\n";
+  print HLPF "  <UL>\n";
+  foreach $file (@maks)
+#   { print HLPF "  <LI><A HREF=\"../$file\">$file</A>\n";
+  { print HLPF "  <LI><A HREF=\"$file\">$file</A>\n";
+  }
+  foreach $file (@cnfs)
+#   { print HLPF "  <LI><A HREF=\"../$file\">$file</A>\n";
+  { print HLPF "  <LI><A HREF=\"$file\">$file</A>\n";
+  }
+  print HLPF "  </UL>\n\n";
+}
+
+print HLPF "</UL>\n\n";
+
+&create_address;
+
+close(HLPF);
+
+print "\n\n";
+
+########################  END OF THE PROGRAM  ##################################
+
+#
+# ------------------------------------------------------------------------------
+# Subroutine create_address
+#
+sub create_address
+{
+  print HLPF "<P><HR SIZE=5><BR>\n\n";
+
+  print HLPF "<ADDRESS>\n";
+  print HLPF "Created on $today by <B>$user</B> <BR>\n";
+  print HLPF "using the HTML generator\n";
+  print HLPF "<A HREF=\"http://home.cern.ch/~binko/Ddl2Html/Ddl2Html.html\">Ddl2Html description</A>\n";
+  print HLPF " (the source ";
+  print HLPF "<A HREF=\"http://home.cern.ch/~binko/Ddl2Html/Ddl2Html.code\">Perl5 code</A>)\n";
+  print HLPF "</ADDRESS>\n\n";
+
+  print HLPF "</BODY bgcolor=#FFFFFF >\n\n";
+
+  print HLPF "</HTML>\n";
+}
+
+#
+# ------------------------------------------------------------------------------
+# Subroutine back_to_index
+#
+sub back_to_index
+{
+  print HLPF "<H4>Back to: ";
+  print HLPF "<A HREF=\"../CodePrototype.html\"> Class categories index, </A>";
+  print HLPF "<A HREF=\"index.html\">Alphabetical index</A>";
+  print HLPF "</H4>\n\n";
+}
+
+#
+# ------------------------------------------------------------------------------
+# Subroutine see_source_file
+#
+sub see_source_file
+{
+  # The C++ file corresponding to the .ddl or .h file
+  $cfile = $file;
+  $cfile =~ s/.h$/.C/;
+  $cfile =~ s/.ddl$/.C/;
+
+  if( -e $cfile )
+  {
+    print HLPF "<H4>See the source file ";
+    print HLPF "<A HREF=\"$cfile.html\">$cfile</A>";
+    print HLPF "</H4>\n\n";
+  }
+  undef $cfile;
+}
+
+#
+# ------------------------------------------------------------------------------
+# Subroutine see_ddl_h_file
+#
+sub see_ddl_h_file
+{
+  # The .ddl or .h file corresponding to the C++ file
+  $ddlfile = $file;
+  $ddlfile =~ s/.C$/.ddl/;
+  if( -e $ddlfile )
+  {
+    print HLPF "<H4>See the Objectivity DDL file ";
+    print HLPF "<A HREF=\"$ddlfile.html\">$ddlfile</A>";
+    print HLPF "</H4>\n\n";
+  }
+  else
+  {
+    $hfile = $file;
+    $hfile =~ s/.C$/.h/;
+    if( -e $hfile )
+    {
+      print HLPF "<H4>See the C++ header file ";
+      print HLPF "<A HREF=\"$hfile.html\">$hfile</A>";
+      print HLPF "</H4>\n\n";
+    }
+  }
+  undef $ddlfile;
+  undef $hfile;
+}
+
+#
+# ------------------------------------------------------------------------------
+# Subroutine back_to_index_see_source_file
+#
+sub back_to_index_see_source_file
+{
+  &back_to_index;
+  &see_source_file;
+}
+
+#
+# ------------------------------------------------------------------------------
+# Subroutine back_to_index_see_ddl_h_file
+#
+sub back_to_index_see_ddl_h_file
+{
+  &back_to_index;
+  &see_ddl_h_file;
+}
+
+#
+# ------------------------------------------------------------------------------
+# Subroutine and_cpp_code
+#
+sub and_cpp_code
+{
+  print HLPF "<P>\n";
+  print HLPF "<STRONG>... and the corresponding C++ code :</STRONG>\n\n";
+}
+
+#
+# ------------------------------------------------------------------------------
+# Subroutine centred_header1
+#
+sub centred_header1
+{
+  local($sometitle) = @_;
+
+  print HLPF "<CENTER>\n";
+  print HLPF "<H1>$sometitle</H1>\n";
+  print HLPF "</CENTER>\n\n";
+}
+
+#
+# ------------------------------------------------------------------------------
+# Subroutine html_header
+#
+sub html_header
+{
+  local($sometitle) = @_;
+
+  print HLPF "<HTML>\n\n";
+
+  print HLPF "<HEAD>\n";
+  print HLPF "<TITLE>$sometitle</TITLE>";
+  print HLPF "</HEAD>\n\n";
+
+  print HLPF "<BODY bgcolor=#FFFFFF>\n\n";
+}
+
+#
+# ------------------------------------------------------------------------------
+# Subroutine html_ddl_h_cpp_code
+#
+sub html_ddl_h_cpp_code
+{
+$fileline = 0;
+
+while (<HDRF>)
+{
+  $fileline += 1;
+  chop;
+               
+  s/</&lt\;/g;                 # convert special characters to html
+  s/>/&gt\;/g;
+
+# Write the HTML
+  foreach $class (keys %fileclass)             # add links for classes 
+  {
+    undef $newstr;
+    undef $newerstr;
+
+    ( $locfileclass, $locfileline ) = split( /\/\//, $fileclass{$class} );
+
+    if( ($file eq $locfileclass) && ($fileline eq $locfileline) )
+    { print HLPF "<A NAME=\"$class\_classdef\">\n";
+    }
+
+    if ( /\b$class\b/ )
+    {
+      if( $file eq $locfileclass )
+      { $newstr="<a href=\"\#$class\_classdef\">$class</a>";
+      }
+      else
+      { $newstr="<a href=\"$locfileclass.html\#$class\_classdef\">$class</a>";
+      }
+
+undef $hotovo;
+
+while( $_ ne "" )
+{
+  if( /\b$class\b/ )
+  {
+    $hotovo = $hotovo.$`;
+    $zbytek = $';
+
+    if( !( ($hotovo =~ /<a href="$/) && ($zbytek =~ /^\./) ) )
+    {
+      $hotovo = $hotovo.$newstr;
+    }
+    else
+    {
+      $hotovo = $hotovo.$class
+    }
+
+    $_ = $zbytek;
+    /\b$class\b/;
+  }
+  else
+  {
+    $hotovo = $hotovo.$_;
+    $_ = "";
+  }
+}
+
+$_ = $hotovo;
+
+      if ( /$newstr\.h/ )
+      {
+        if( -e "$class.ddl" )
+        { $newerstr="<a href=\"$class.ddl.html\">$class.h</a>";
+          s/$newstr\.h/$newerstr/g; 
+        }
+        else
+        { $newerstr="<a href=\"$class.h.html\">$class.h</a>";
+          s/$newstr\.h/$newerstr/g; 
+        }
+      }
+
+      if ( /$newstr\.C/ )
+      { $newerstr="<a href=\"$class.C.html\">$class.C</a>";
+        s/$newstr\.C/$newerstr/g; 
+      }
+
+    }
+  }
+
+  foreach $enum (keys %fileenum)               # add links for enums
+  {
+    undef $newstr;
+    undef $newerstr;
+
+    ( $locfileenum, $locfileline ) = split( /\/\//, $fileenum{$enum} );
+
+    if( ($file eq $locfileenum) && ($fileline eq $locfileline) )
+    { print HLPF "<A NAME=\"$enum\_enumdef\">\n";
+    }
+
+    if ( /\b$enum\b/ )
+    {
+      if( $file eq $locfileenum )
+      { $newstr="<a href=\"\#$enum\_enumdef\">$enum</a>";
+        s/\b$enum\b/$newstr/g; 
+      }
+      else
+      { $newstr="<a href=\"$locfileenum.html\#$enum\_enumdef\">$enum</a>";
+        s/\b$enum\b/$newstr/g; 
+      }
+
+      if ( /$newstr\.ddl/ )
+      { $newerstr="<a href=\"$enum.ddl.html\">$enum.ddl</a>";
+        s/$newstr\.ddl/$newerstr/g; 
+      }
+
+      if ( /$newstr\.h/ )
+      {
+        if( -e "$enum.ddl" )
+        { $newerstr="<a href=\"$enum.ddl.html\">$enum.h</a>";
+          s/$newstr\.h/$newerstr/g; 
+        }
+        else
+        { $newerstr="<a href=\"$enum.h.html\">$enum.h</a>";
+          s/$newstr\.h/$newerstr/g; 
+        }
+      }
+
+      if ( /$newstr\.C/ )
+      { $newerstr="<a href=\"$enum.C.html\">$enum.C</a>";
+        s/$newstr\.C/$newerstr/g; 
+      }
+
+    }
+  }
+
+  print HLPF "$_\n";           # output line to html file
+}
+}
+
+# ------------------------------------------------------------------------------
+
diff --git a/AliGeant4/config/doc_alsorthtml.pl b/AliGeant4/config/doc_alsorthtml.pl
new file mode 100755 (executable)
index 0000000..21e301a
--- /dev/null
@@ -0,0 +1,44 @@
+#!/usr/local/bin/perl
+# $Id$
+# Ivana Hrivnacova 15.2.00
+#
+# This script defines the class categories
+# and calls doc_alcategory.pl to generate 
+# the html category pages
+
+
+print "Generating html pages for class categories\n"; 
+
+# main categories (packages)
+@DIRLIST = "TGeant4";
+@DIRLIST = (@DIRLIST,"AliGeant4");
+@NAMELIST = "TGeant4";
+@NAMELIST = (@NAMELIST,"AliGeant4");
+
+# subcategories
+@CATLIST = "global";
+@CATLIST = (@CATLIST,"geometry");
+@CATLIST = (@CATLIST,"physics");
+@CATLIST = (@CATLIST,"event");
+@CATLIST = (@CATLIST,"run");
+@CATLIST = (@CATLIST,"visualization");
+
+# categories
+for( $i = 0 ; $i < $#DIRLIST+1 ; $i++ ) {
+#foreach $DIR (@DIRLIST) {
+  $DIR = @DIRLIST[$i];
+  $NAME = @NAMELIST[$i];
+  $DIRPATH = $ENV{'AG4_INSTALL'} . "/../" . $DIR;
+  chdir $DIRPATH;
+  foreach $CAT (@CATLIST) {
+    #chop $CAT;
+    # exclude other subdirectories
+
+    print "Processing category: " . $CAT . " of " . $NAME . "\n"; 
+    $CATDIRPATH = $DIRPATH . "/" . $CAT;
+    $CATNAME = $NAME . "_" . $CAT;      
+    # generate the category pages
+    system $ENV{'AG4_INSTALL'} . "/config/doc_alcategory.pl " . $CAT . " " . $CATNAME;
+  }  
+}      
diff --git a/AliGeant4/config/doc_g4c++2html.pl b/AliGeant4/config/doc_g4c++2html.pl
new file mode 100755 (executable)
index 0000000..8cad65d
--- /dev/null
@@ -0,0 +1,97 @@
+#!/usr/local/bin/perl
+# $Id$
+# Ivana Hrivnacova 12.2.99
+#
+# HTML documentation is created for all 
+# source code files: *.hh *.cc *.icc 
+# generic makefiles: *.gmk 
+# and configuration setup scripts
+
+# file extensions
+#$INCEXT = ".hh"
+#$SRCEXT = ".cc"
+#$MKFEXT = ".gmk"
+
+# create doc directory if it does not exist
+$CURDIR = `pwd`;
+chdir $ENV{'G4INSTALL'};
+if (! grep(/doc/, `ls`)) {
+  `mkdir doc` ;
+  print "Directory doc has been created." . "\n";
+};
+# move doc/HTML directory to doc/HTML.old
+chdir doc;
+if (grep(/HTML.old/, `ls`)) {
+  print "Cleaning HTML.old" . "\n";
+  `rm -fr HTML.old`;
+}
+if (grep(/HTML/, `ls`)) {
+  `mkdir HTML.old`;
+  `mv HTML HTML.old`;
+  print "Old HTML directory has been saved." . "\n";
+}
+chdir $ENV{'G4INSTALL'};
+
+# create tmpdoc directory is it does not exist
+# or clean it
+if (! grep(/tmpdoc/, `ls`)) {
+  `mkdir tmpdoc` ;
+  print "Directory tmpdoc has been created." . "\n";
+} else {
+  print "Cleaning tmpdoc" . "\n";
+  `rm -fr tmpdoc/*`;
+}  
+
+# copy everything for documentation to tmpdoc
+@FILELIST = `find . -name "*.ddl"`;
+@FILELIST = (@FILELIST, `find . -name "*.h"`);
+@FILELIST = (@FILELIST, `find . -name "*.hh"`);
+@FILELIST = (@FILELIST, `find . -name "*.cc"`);
+@FILELIST = (@FILELIST, `find . -name "*.icc"`);
+@FILELIST = (@FILELIST, `find config -name "*.gmk"`);
+@FILELIST = (@FILELIST, `find config -name "setup*"`);
+@FILELIST = (@FILELIST, `find config -name "*boot"`);
+
+print "Copying files to tmpdoc" . "\n";
+foreach $FILE (@FILELIST) {
+  chop $FILE;
+  # exclude dictionary classes
+  if (!grep(/Dict/,$FILE)) {
+    `cp $FILE tmpdoc`;
+  }  
+  #print "$FILE has been copied to tmpdoc" . "\n";
+}
+
+# mv *.cc to *.C
+# what is recquired by ddl2html.pl
+chdir tmpdoc;
+print "Renaming files" . "\n";
+@CXXLIST = `ls *.cc`;
+foreach $CXXFILE (@CXXLIST) {
+  chop $CXXFILE;
+  $CFILE = `echo $CXXFILE | sed s/.cc/.C/g`;
+  `mv $CXXFILE $CFILE`;
+}
+
+# mv *.hh to *.h 
+@HHLIST = `ls *.hh`;
+foreach $HHFILE (@HHLIST) {
+  chop $HHFILE;
+  $HFILE = `echo $HHFILE | sed s/.hh/.h/g`;
+  `mv $HHFILE $HFILE`;
+}
+
+# execute the modified P.Binko's script
+system $ENV{'AG4_INSTALL'} . "/config/doc_g4ddl2html.pl GEANT4 Project";
+
+# move HTML to doc and remove tmpdoc
+$DOCDIR = $ENV{'G4INSTALL'} . "/doc";
+`mv HTML $DOCDIR`;  
+print "Removing tmpdoc" . "\n";
+chdir $ENV{'G4INSTALL'};
+`rm -fr tmpdoc`;
+
+# generate the category pages
+system $ENV{'AG4_INSTALL'} . "/config/doc_g4sorthtml.pl";
+
+chdir $CURDIR;
diff --git a/AliGeant4/config/doc_g4category.pl b/AliGeant4/config/doc_g4category.pl
new file mode 100755 (executable)
index 0000000..2f15048
--- /dev/null
@@ -0,0 +1,97 @@
+#!/usr/local/bin/perl
+# $Id$
+# Ivana Hrivnacova 15.2.00
+#
+# This script generates the class category page
+# from all *.h files found in the category directory
+
+# no test of arguments is performed
+$DIR = $ARGV[0];
+$NAME = $ARGV[1];
+
+# open output file
+$output =  $ENV{'G4INSTALL'} . "/doc/HTML/" . $NAME . "Category.html";
+open(OUTPUT, ">" . $output);
+
+print "Processing class category: " . $NAME . "\n"; 
+
+# print the begining of file
+print OUTPUT "<HTML>\n";
+print OUTPUT "\n";
+print OUTPUT "<HEAD>\n";
+print OUTPUT "<TITLE>Class category: ". $NAME . "</TITLE></HEAD>\n";
+print OUTPUT "\n";
+print OUTPUT "\n";
+print OUTPUT "<BODY bgcolor=#FFFFFF>\n";
+print OUTPUT "\n";
+print OUTPUT "<!-- Header material -->\n";
+print OUTPUT "<table border=0   cellpadding=5 cellspacing=0 width=\"100%\">\n";
+print OUTPUT "  <tr bgcolor=#d0ffd0>\n";
+print OUTPUT "     <td align=left width=30%>\n";
+print OUTPUT "     <img alt=\"Alice\"\n";
+print OUTPUT "       src=\"http://AliSoft.cern.ch/offline/geant4/gif/AliceLogo.gif\"\n";
+print OUTPUT "     width=\"60\" height=\"60\" align=\"absmiddle\" border=1>\n";
+print OUTPUT "     <td align=center width=40%>\n";
+print OUTPUT "        <font size=\"+2\">\n";
+print OUTPUT "           Alice Geant4 Simulation <br> \n";
+print OUTPUT "           Geant4 Code </font>\n";
+print OUTPUT "     <td align=right width=30% valign=bottom>\n";
+print OUTPUT "        <font size=\"-1\">\n";
+print OUTPUT "        <script language=\"JavaScript\">\n";
+print OUTPUT "        document.write(\"Last modified \"+ document.lastModified)\n";
+print OUTPUT "        // end of script -->\n";
+print OUTPUT "        </script></font>\n";
+print OUTPUT "     </td>\n";
+print OUTPUT "  </tr>\n";
+print OUTPUT "</table>\n";
+print OUTPUT "<CENTER>\n";
+print OUTPUT "<H2>Class category: " . $NAME . "</H2>\n";
+print OUTPUT "</CENTER>\n";
+print OUTPUT "\n";
+print OUTPUT "<P><HR SIZE=5><BR>\n";
+print OUTPUT "\n";
+print OUTPUT "<UL><BR>\n";
+print OUTPUT "\n";
+print OUTPUT "<LI><STRONG>C++ header files:</STRONG>\n";
+print OUTPUT "\n";
+print OUTPUT "  <UL>\n";
+
+# print the linked header files
+#chdir $ENV{'AG4_INSTALL'} . "/source/" . $DIR;
+chdir $DIR;
+@FILELIST = `find . -name "*.h"`;
+@FILELIST = (@FILELIST, `find . -name "*.hh"`);
+
+foreach $FILEPATH (@FILELIST) { 
+  @TEMP = split('/',$FILEPATH);
+  $FILE = @TEMP[@TEMP - 1];
+  chop $FILE;
+  print "   Linking file " . $FILE . "\n";
+  $HFILE = `echo $FILE | sed s/.hh/.h/g`;   
+  print OUTPUT "  <LI><A HREF=\"" . $HFILE . ".html\">" . $FILE . "</A>\n";
+}
+
+# print the end of file
+$today = localtime(time);
+$today =~ s/ \d\d:\d\d:\d\d / /;
+@list = getpwuid($<);
+$user = $list[6];
+print OUTPUT "</UL>\n";
+print OUTPUT "\n";
+print OUTPUT "</UL>\n";
+print OUTPUT "\n";
+print OUTPUT "<P><HR SIZE=5>\n";
+print OUTPUT "\n";
+print OUTPUT "<ADDRESS>\n";
+print OUTPUT "Created on $today by <B>$user</B> <BR>\n";
+print OUTPUT "using the HTML generator\n";
+print OUTPUT "<A HREF=\"http://home.cern.ch/~binko/Ddl2Html/Ddl2Html.html\">Ddl2Html description</A>\n";
+print OUTPUT " (the source <A HREF=\"http://home.cern.ch/~binko/Ddl2Html/Ddl2Html.code\">Perl5 code</A>)\n";
+print OUTPUT "</ADDRESS>\n";
+print OUTPUT "\n";
+print OUTPUT "</BODY bgcolor=#FFFFFF >\n";
+print OUTPUT "\n";
+print OUTPUT "</HTML>\n";
+
+# close output file
+close(OUTPUT);    
diff --git a/AliGeant4/config/doc_g4ddl2html.pl b/AliGeant4/config/doc_g4ddl2html.pl
new file mode 100755 (executable)
index 0000000..e45f61c
--- /dev/null
@@ -0,0 +1,728 @@
+#!/usr/local/bin/perl5
+# $Id$
+################################################################################
+#
+# Automatic HTML generator for projects using Objectivity
+#
+# Author : Pavel Binko
+#
+# Last update : 09/04/96
+#
+################################################################################
+# Modified for Alice specifics by Ivana Hrivnacova: 22.5.98;
+# some more changes 12.2.99;
+#
+# ------------------------------------------------------------------------------
+# Analyse the command arguments
+#
+if( $#ARGV == -1 )
+{
+  $pwd = `pwd`;
+  chop($pwd);
+  @help = split(/\//,$pwd);
+  $help[$#help] =~ tr/a-z/A-Z/;
+  $html_title = "The ".$help[$#help]." Project";
+  undef $help;
+}
+elsif( $#ARGV == 0 && $ARGV[0] =~ /^-[?hH]/ )
+{
+  print "\n";
+  print "The Ddl2Html functionality :\n\n";
+  print "  Ddl2Html has to be started from the project directory you'd like\n";
+  print "           to document (to convert to html)\n";
+  print "  Ddl2Html creates (if not existing) the directory HTML in the project\n";
+  print "           directory and adds the afs access rights \"cern:nodes rl\"\n";
+  print "           to both HTML and project directories\n";
+  print "  Ddl2Html creates index.html file and *.ddl.html, *.h.html and\n";
+  print "           *.C.html files in the HTML directory\n\n";
+  print "  Contents of the project directory remains unchanged.\n\n\n";
+  print "The Ddl2Html command syntax :\n\n";
+  print "  Ddl2Html [ arguments ] \n\n";
+  print "    No argument : The project directory name will be chosen\n";
+  print "                  as the project name (in upper case)\n\n";
+  print "    One argument : a) If the argument starts with -h or -H or -?,\n";
+  print "                      this help text will be printed\n";
+  print "                   b) If the argument matches with a file name\n";
+  print "                      in the project directory, the first line\n";
+  print "                      from the file will be the project title\n";
+  print "                   c) Othetwise  the whole text from the command\n";
+  print "                      line will be the project title\n\n";
+  print "    More than one argument : The whole text from the command line\n";
+  print "                             will be the project title\n\n\n";
+  print "For further details see the :\n";
+  die "    http://home.cern.ch/~binko/Ddl2Html/Ddl2Html.html\n\n";
+}
+elsif( $#ARGV == 0 && -e $ARGV[0] )
+{
+  $first = 1;
+  while( <> )
+  {
+    if( $first )
+    {
+      chop($_);
+      $html_title = $_;
+      $first = 0;
+    }
+  }
+  undef $first;
+}
+else
+{
+  $html_title = join( " ", @ARGV );
+}
+
+study();
+
+print "\n\n";
+print "*****************************************************************\n";
+print "*\n";
+print "*  $html_title\n";
+print "*\n";
+print "*****************************************************************\n\n\n";
+
+#
+# ------------------------------------------------------------------------------
+# Get some information about the creator
+#
+# UID is in the variable $<
+@list = getpwuid($<);
+$user = $list[6];
+
+#
+# ==============================================================================
+# Get a list of all .ddl files
+#
+@ddls = <*.ddl>;
+print "List of Objectivity DDL files = @ddls\n\n";
+
+#
+# ------------------------------------------------------------------------------
+# Get a list of .h files, where no .ddl files exist (ignore _ref.h files)
+#
+while( $hdrname = <*.h> )
+{
+  if( ! ( $hdrname =~ /_ref.h$/ ) )
+  {
+    $helpname = $hdrname;
+    $helpname =~ s/.h$/.ddl/;
+    if( ! -e $helpname )
+    { @hdrs = (@hdrs, $hdrname);
+    }
+  }
+}
+print "List of C++ header files = @hdrs\n\n";
+
+#
+# ------------------------------------------------------------------------------
+# Get a list of all C++ programs
+#
+while( $cppname = <*.C> )
+{
+  if( ! ( $cppname =~ /_ddl.C$/ ) )
+  {
+    $helpname = $cppname;
+    $helpname =~ s/.C$//;
+    if( -e "$helpname.ddl" )
+    { @cppddls = (@cppddls, $cppname);
+    }
+    elsif( -e "$helpname.h" )
+    { @cpphdrs = (@cpphdrs, $cppname);
+    }
+    else
+    { @cppmain = (@cppmain, $cppname);
+    }
+  }
+}
+print "List of C++ programs to the *.ddl = @cppddls\n\n";
+print "List of C++ programs to the *.h = @cpphdrs\n\n";
+print "List of main programs = @cppmain\n\n";
+
+#
+# ------------------------------------------------------------------------------
+# Get a list of all Makefiles, makefiles, s.Makefiles and s.makefiles
+#
+@maks = <*.gmk>;
+print "List of Makefiles = @maks\n\n";
+
+#
+# ------------------------------------------------------------------------------
+# Get a list of all config.* files
+#
+#@cnfs = <config.*>;
+@cnfs = <setup* *boot*>;
+print "List of configuration files = @cnfs\n\n";
+
+#
+# ==============================================================================
+# Analyse the .ddl and .h files
+#
+print "Analysing the .ddl and .h files ...\n\n";
+
+foreach $file (@ddls, @hdrs)
+{
+  open (HF, $file);
+  $fileline = 0;
+
+  while (<HF>)
+  {
+    $fileline += 1;
+    chop;
+    if ( ! (/^[ \t]*\/\//) )   # ignore C++ comment lines
+    {
+      s/\/\/.*//;              # ignore all after C++ comment sign //
+
+      if ( /\bclass\b/ && ! ( /template.*<.*class.*>/ ) )
+      {
+        @words = split();                      # split line read in
+        for( $i = 0 ; $i < $#words ; $i++ )
+        {
+          if( $words[$i] eq "class" )
+          {
+            $words[$i+1] =~ s/:.*//;
+            $words[$i+1] =~ s/{.*//;
+            if( !($words[$i+1] =~ /;/ ) && !($words[$i+2] =~ /^;/ )
+                                        && ($words[$i+1] ne "") )
+            {
+              $fileclass{$words[$i+1]} = $file."//".$fileline;
+              $i = $#words;
+            }
+          }
+        }
+      }
+
+      if ( /\benum\b/ )
+      {
+        @words = split();                      # split line read in
+        for( $i = 0 ; $i < $#words ; $i++ )
+        {
+          if( $words[$i] eq "enum" )
+          {
+            $words[$i+1] =~ s/{.*//;
+            if( $words[$i+1] ne "" )
+            {
+              $fileenum{$words[$i+1]} = $file."//".$fileline;
+              $i = $#words;
+            }
+          }
+        }
+      }
+
+    }
+  }
+  close(HF);
+}
+
+# debug
+# print "\n\n\nDEBUG INFORMATION :\n";
+# foreach $class (keys %fileclass)
+# { print "DEBUG: class $class found in $fileclass{$class}\n";
+# }
+# foreach $enum (keys %fileenum)
+# { print "DEBUG: enum $enum found in $fileenum{$enum}\n";
+# }
+# print "\n\n";
+# end debug
+
+#
+# ==============================================================================
+# Some variables needed for html files
+#
+$today = localtime(time);
+$today =~ s/ \d\d:\d\d:\d\d / /;
+
+#
+# ------------------------------------------------------------------------------
+# Create the directory html (if not existing)
+#
+if( ! -e "HTML" )
+{
+  `mkdir HTML`;
+}
+if( -e "/usr/sue/bin/fs" )
+{
+  `/usr/sue/bin/fs setacl . cern:nodes rl`;
+  `/usr/sue/bin/fs setacl HTML cern:nodes rl`;
+}
+
+#
+# ==============================================================================
+# Create *.ddl.html and *.h.html files
+#
+foreach $file (@ddls, @hdrs)
+{
+print "Writing file $file.html ... \n";
+
+# Open the .ddl or .h file and the .html file
+open (HDRF, $file);
+open (HLPF,">HTML/$file.html");
+
+&html_header($file);
+#print HLPF "<HR SIZE=5><P>\n\n";
+#&centred_header1($html_title);
+#print HLPF "<P><HR SIZE=5><P>\n\n";
+&see_source_file;
+print HLPF "<P><HR SIZE=5><P>\n\n";
+&centred_header1($file);
+print HLPF "<P><HR><P>\n\n";
+
+print HLPF "<PRE>\n\n";
+&html_ddl_h_cpp_code;
+print HLPF "\n</PRE>\n\n";
+
+print HLPF "<P><HR SIZE=5><P>\n\n";
+&back_to_index_see_source_file;
+&create_address;
+
+close(HLPF);
+close(HDRF);
+}
+print "\nHTML for Objectivity DDL files and C++ header files created ... \n\n";
+
+#
+# ------------------------------------------------------------------------------
+# Create *.C.html files
+#
+foreach $file (@cppddls, @cpphdrs, @cppmain)
+{
+print "Writing file $file.html ... \n";
+
+# Open the C++ file and the .html file
+open (HDRF, $file);
+open (HLPF,">HTML/$file.html");
+
+&html_header($file);
+#print HLPF "<HR SIZE=5><P>\n\n";
+#&centred_header1($html_title);
+#print HLPF "<P><HR SIZE=5><P>\n\n";
+&see_ddl_h_file;
+print HLPF "<P><HR SIZE=5><P>\n\n";
+&centred_header1($file);
+print HLPF "<P><HR><P>\n\n";
+
+print HLPF "<PRE>\n\n";
+&html_ddl_h_cpp_code;
+print HLPF "\n</PRE>\n\n";
+
+print HLPF "<P><HR SIZE=5><P>\n\n";
+&back_to_index_see_ddl_h_file;
+&create_address;
+
+close(HLPF);
+close(HDRF);
+}
+print "\nHTML for C++ files created ... \n\n";
+
+#
+# ------------------------------------------------------------------------------
+# Copy Make and Config files
+#
+foreach $file (@maks, @cnfs)
+{
+print "Copying file $file ... \n";
+`cp $file HTML/$file`;
+}
+print "\nMake and Config files copied ... \n\n";
+
+#
+# ------------------------------------------------------------------------------
+# Write index.html
+#
+print "Writing index file ... \n";
+
+open (HLPF,">HTML/index.html");
+
+&html_header($html_title);
+
+#print HLPF "<H1 ALIGN=RIGHT>";
+#print HLPF "<TABLE COLSPEC=\"20\" BORDER=5 CELLPADDING=0 CELLSPACING=0>\n";
+#print HLPF "<TR><TH>";
+#print HLPF "<A HREF=\"index.html\" TARGET=_top>No Frame</A>";
+#print HLPF "</TH></TR>\n";
+#print HLPF "</TABLE></H1>\n\n";
+
+print HLPF "<!-- Header material -->\n";
+print HLPF "<table border=0   cellpadding=5 cellspacing=0 width=\"100%\">\n";
+print HLPF "  <tr bgcolor=#d0ffd0>\n";
+print HLPF "     <td align=left width=30%>\n";
+print HLPF "     <img alt=\"Alice\"\n"; 
+print HLPF "        src=\"http://AliSoft.cern.ch/offline/geant4/gif/AliceLogo.gif\"\n"; 
+print HLPF "       width=\"60\" height=\"60\" align=\"absmiddle\" border=1>\n";
+print HLPF "     <td align=center width=40%>\n";
+print HLPF "        <font size=\"+2\">\n";
+print HLPF "           Geant4 Project";
+print HLPF "        </font>\n";
+print HLPF "     <td align=right width=30% valign=bottom>\n"; 
+print HLPF "        <font size=\"-1\">\n"; 
+print HLPF "        <script language=\"JavaScript\">\n"; 
+print HLPF "        document.write(\"Last modified \"+ document.lastModified)\n"; 
+print HLPF "        // end of script -->\n"; 
+print HLPF "        </script></font>\n"; 
+print HLPF "     </td>\n";
+print HLPF "  </tr>\n";
+print HLPF "</table>\n";
+
+#&centred_header1($html_title);
+#print HLPF "<P><HR SIZE=5><P>\n\n";
+
+print HLPF "<UL><BR>\n\n";
+
+if( @hdrs )
+{
+print HLPF "<LI><STRONG>C++ header files:</STRONG>\n";
+  print HLPF "  <UL>\n";
+  foreach $file (@hdrs)
+  { print HLPF "  <LI><A HREF=\"$file.html\">$file</A>\n";
+  }
+
+if( @cpphdrs )
+{
+#  &and_cpp_code;
+#  foreach $file (@cpphdrs)
+#  { print HLPF "  <LI><A HREF=\"$file.html\">$file</A>\n";
+#  }
+}
+print HLPF "  </UL>\n\n";
+
+print HLPF "<P><HR><P>\n\n";
+}
+
+if( @ddls )
+{
+print HLPF "<LI><STRONG>Objectivity DDL files:</STRONG>\n";
+  print HLPF "  <UL>\n";
+  foreach $file (@ddls)
+  { print HLPF "  <LI><A HREF=\"$file.html\">$file</A>\n";
+  }
+
+if( @cppddls )
+{
+#  &and_cpp_code;
+#  foreach $file (@cppddls)
+#  { print HLPF "  <LI><A HREF=\"$file.html\">$file</A>\n";
+#  }
+}
+print HLPF "  </UL>\n\n";
+
+print HLPF "<P><HR><P>\n\n";
+}
+
+if( @cppmain )
+{
+print HLPF "<LI><STRONG>Main programs/Extern methods:</STRONG>\n";
+  print HLPF "  <UL>\n";
+  foreach $file (@cppmain)
+  { print HLPF "  <LI><A HREF=\"$file.html\">$file</A>\n";
+  }
+  print HLPF "  </UL>\n\n";
+
+print HLPF "<P><HR><P>\n\n";
+}
+
+if( @maks || @cnfs )
+{
+print HLPF "<LI><STRONG>Makefiles and configuration files:</STRONG>\n";
+  print HLPF "  <UL>\n";
+  foreach $file (@maks)
+#   { print HLPF "  <LI><A HREF=\"../$file\">$file</A>\n";
+  { print HLPF "  <LI><A HREF=\"$file\">$file</A>\n";
+  }
+  foreach $file (@cnfs)
+#   { print HLPF "  <LI><A HREF=\"../$file\">$file</A>\n";
+  { print HLPF "  <LI><A HREF=\"$file\">$file</A>\n";
+  }
+  print HLPF "  </UL>\n\n";
+}
+
+print HLPF "</UL>\n\n";
+
+&create_address;
+
+close(HLPF);
+
+print "\n\n";
+
+########################  END OF THE PROGRAM  ##################################
+
+#
+# ------------------------------------------------------------------------------
+# Subroutine create_address
+#
+sub create_address
+{
+  print HLPF "<P><HR SIZE=5><BR>\n\n";
+
+  print HLPF "<ADDRESS>\n";
+  print HLPF "Created on $today by <B>$user</B> <BR>\n";
+  print HLPF "using the HTML generator\n";
+  print HLPF "<A HREF=\"http://home.cern.ch/~binko/Ddl2Html/Ddl2Html.html\">Ddl2Html description</A>\n";
+  print HLPF " (the source ";
+  print HLPF "<A HREF=\"http://home.cern.ch/~binko/Ddl2Html/Ddl2Html.code\">Perl5 code</A>)\n";
+  print HLPF "</ADDRESS>\n\n";
+
+  print HLPF "</BODY bgcolor=#FFFFFF >\n\n";
+
+  print HLPF "</HTML>\n";
+}
+
+#
+# ------------------------------------------------------------------------------
+# Subroutine back_to_index
+#
+sub back_to_index
+{
+  print HLPF "<H4>Back to: ";
+  print HLPF "<A HREF=\"../G4CodePrototype.html\"> Class categories index, </A>";
+  print HLPF "<A HREF=\"index.html\">Alphabetical index</A>";
+  print HLPF "</H4>\n\n";
+}
+
+#
+# ------------------------------------------------------------------------------
+# Subroutine see_source_file
+#
+sub see_source_file
+{
+  # The C++ file corresponding to the .ddl or .h file
+  $cfile = $file;
+  $cfile =~ s/.h$/.C/;
+  $cfile =~ s/.ddl$/.C/;
+
+  if( -e $cfile )
+  {
+    print HLPF "<H4>See the source file ";
+    print HLPF "<A HREF=\"$cfile.html\">$cfile</A>";
+    print HLPF "</H4>\n\n";
+  }
+  undef $cfile;
+}
+
+#
+# ------------------------------------------------------------------------------
+# Subroutine see_ddl_h_file
+#
+sub see_ddl_h_file
+{
+  # The .ddl or .h file corresponding to the C++ file
+  $ddlfile = $file;
+  $ddlfile =~ s/.C$/.ddl/;
+  if( -e $ddlfile )
+  {
+    print HLPF "<H4>See the Objectivity DDL file ";
+    print HLPF "<A HREF=\"$ddlfile.html\">$ddlfile</A>";
+    print HLPF "</H4>\n\n";
+  }
+  else
+  {
+    $hfile = $file;
+    $hfile =~ s/.C$/.h/;
+    if( -e $hfile )
+    {
+      print HLPF "<H4>See the C++ header file ";
+      print HLPF "<A HREF=\"$hfile.html\">$hfile</A>";
+      print HLPF "</H4>\n\n";
+    }
+  }
+  undef $ddlfile;
+  undef $hfile;
+}
+
+#
+# ------------------------------------------------------------------------------
+# Subroutine back_to_index_see_source_file
+#
+sub back_to_index_see_source_file
+{
+  &back_to_index;
+  &see_source_file;
+}
+
+#
+# ------------------------------------------------------------------------------
+# Subroutine back_to_index_see_ddl_h_file
+#
+sub back_to_index_see_ddl_h_file
+{
+  &back_to_index;
+  &see_ddl_h_file;
+}
+
+#
+# ------------------------------------------------------------------------------
+# Subroutine and_cpp_code
+#
+sub and_cpp_code
+{
+  print HLPF "<P>\n";
+  print HLPF "<STRONG>... and the corresponding C++ code :</STRONG>\n\n";
+}
+
+#
+# ------------------------------------------------------------------------------
+# Subroutine centred_header1
+#
+sub centred_header1
+{
+  local($sometitle) = @_;
+
+  print HLPF "<CENTER>\n";
+  print HLPF "<H1>$sometitle</H1>\n";
+  print HLPF "</CENTER>\n\n";
+}
+
+#
+# ------------------------------------------------------------------------------
+# Subroutine html_header
+#
+sub html_header
+{
+  local($sometitle) = @_;
+
+  print HLPF "<HTML>\n\n";
+
+  print HLPF "<HEAD>\n";
+  print HLPF "<TITLE>$sometitle</TITLE>";
+  print HLPF "</HEAD>\n\n";
+
+  print HLPF "<BODY bgcolor=#FFFFFF>\n\n";
+}
+
+#
+# ------------------------------------------------------------------------------
+# Subroutine html_ddl_h_cpp_code
+#
+sub html_ddl_h_cpp_code
+{
+$fileline = 0;
+
+while (<HDRF>)
+{
+  $fileline += 1;
+  chop;
+               
+  s/</&lt\;/g;                 # convert special characters to html
+  s/>/&gt\;/g;
+
+# Write the HTML
+  foreach $class (keys %fileclass)             # add links for classes 
+  {
+    undef $newstr;
+    undef $newerstr;
+
+    ( $locfileclass, $locfileline ) = split( /\/\//, $fileclass{$class} );
+
+    if( ($file eq $locfileclass) && ($fileline eq $locfileline) )
+    { print HLPF "<A NAME=\"$class\_classdef\">\n";
+    }
+
+    if ( /\b$class\b/ )
+    {
+      if( $file eq $locfileclass )
+      { $newstr="<a href=\"\#$class\_classdef\">$class</a>";
+      }
+      else
+      { $newstr="<a href=\"$locfileclass.html\#$class\_classdef\">$class</a>";
+      }
+
+undef $hotovo;
+
+while( $_ ne "" )
+{
+  if( /\b$class\b/ )
+  {
+    $hotovo = $hotovo.$`;
+    $zbytek = $';
+
+    if( !( ($hotovo =~ /<a href="$/) && ($zbytek =~ /^\./) ) )
+    {
+      $hotovo = $hotovo.$newstr;
+    }
+    else
+    {
+      $hotovo = $hotovo.$class
+    }
+
+    $_ = $zbytek;
+    /\b$class\b/;
+  }
+  else
+  {
+    $hotovo = $hotovo.$_;
+    $_ = "";
+  }
+}
+
+$_ = $hotovo;
+
+      if ( /$newstr\.h/ )
+      {
+        if( -e "$class.ddl" )
+        { $newerstr="<a href=\"$class.ddl.html\">$class.h</a>";
+          s/$newstr\.h/$newerstr/g; 
+        }
+        else
+        { $newerstr="<a href=\"$class.h.html\">$class.h</a>";
+          s/$newstr\.h/$newerstr/g; 
+        }
+      }
+
+      if ( /$newstr\.C/ )
+      { $newerstr="<a href=\"$class.C.html\">$class.C</a>";
+        s/$newstr\.C/$newerstr/g; 
+      }
+
+    }
+  }
+
+  foreach $enum (keys %fileenum)               # add links for enums
+  {
+    undef $newstr;
+    undef $newerstr;
+
+    ( $locfileenum, $locfileline ) = split( /\/\//, $fileenum{$enum} );
+
+    if( ($file eq $locfileenum) && ($fileline eq $locfileline) )
+    { print HLPF "<A NAME=\"$enum\_enumdef\">\n";
+    }
+
+    if ( /\b$enum\b/ )
+    {
+      if( $file eq $locfileenum )
+      { $newstr="<a href=\"\#$enum\_enumdef\">$enum</a>";
+        s/\b$enum\b/$newstr/g; 
+      }
+      else
+      { $newstr="<a href=\"$locfileenum.html\#$enum\_enumdef\">$enum</a>";
+        s/\b$enum\b/$newstr/g; 
+      }
+
+      if ( /$newstr\.ddl/ )
+      { $newerstr="<a href=\"$enum.ddl.html\">$enum.ddl</a>";
+        s/$newstr\.ddl/$newerstr/g; 
+      }
+
+      if ( /$newstr\.h/ )
+      {
+        if( -e "$enum.ddl" )
+        { $newerstr="<a href=\"$enum.ddl.html\">$enum.h</a>";
+          s/$newstr\.h/$newerstr/g; 
+        }
+        else
+        { $newerstr="<a href=\"$enum.h.html\">$enum.h</a>";
+          s/$newstr\.h/$newerstr/g; 
+        }
+      }
+
+      if ( /$newstr\.C/ )
+      { $newerstr="<a href=\"$enum.C.html\">$enum.C</a>";
+        s/$newstr\.C/$newerstr/g; 
+      }
+
+    }
+  }
+
+  print HLPF "$_\n";           # output line to html file
+}
+}
+
+# ------------------------------------------------------------------------------
+
diff --git a/AliGeant4/config/doc_g4sorthtml.pl b/AliGeant4/config/doc_g4sorthtml.pl
new file mode 100755 (executable)
index 0000000..cb55abd
--- /dev/null
@@ -0,0 +1,56 @@
+#!/usr/local/bin/perl
+# $Id$
+# Ivana Hrivnacova 15.2.00
+#
+# This script defines the class categories
+# and calls doc_alcategory.pl to generate 
+# the html category pages
+
+print "Generating html pages for class categories\n"; 
+
+# main categories list
+$G4SOURCE = $ENV{'G4INSTALL'} . "/source";
+chdir $G4SOURCE;
+@DIRLIST = `ls`;
+
+# categories
+foreach $DIR (@DIRLIST) {
+  chop $DIR;
+  # exclude unwanted subdirectories/files
+  if ($DIR ne "GNUmakefile" && $DIR ne "History" && $DIR ne "nohup.out") {  
+    # subcategories are considered only in one level
+    $DIRPATH = $G4SOURCE . "/" . $DIR;
+    chdir $DIRPATH;
+    
+    # test if subcategories are present
+    @INCLUDE = `find . -name "include"`;
+    $FIRSTINCLUDE = @INCLUDE[0];
+    chop $FIRSTINCLUDE;
+    if ($FIRSTINCLUDE eq "./include") {
+      @CATLIST = ".";
+    } 
+    else {      
+      @CATLIST = `ls`;    
+    }  
+   
+    # process subcategories
+    foreach $CAT (@CATLIST) {
+      chop $CAT;
+      # exclude other subdirectories
+      if ($CAT ne "GNUmakefile" && $CAT ne "History" && $CAT ne "nohup.out") {
+        print "Processing category: " . $CAT . " of " . $DIR . "\n"; 
+       if ($CAT eq ".") {
+          $CATDIRPATH = $DIRPATH;
+          $CATNAME = $DIR;      
+       }
+       else {
+          $CATDIRPATH = $DIRPATH . "/" . $CAT;
+          $CATNAME = $DIR . "_" . $CAT;      
+       }  
+        # generate the category pages
+        system $ENV{'AG4_INSTALL'} . "/config/doc_g4category.pl " . $CATDIRPATH . " " . $CATNAME;
+      }        
+    }
+  }  
+}      
diff --git a/AliGeant4/config/setup.csh b/AliGeant4/config/setup.csh
new file mode 100755 (executable)
index 0000000..a34df96
--- /dev/null
@@ -0,0 +1,731 @@
+# $Id$
+# ----------------------------------------------------------------
+# This script sets the default environment variables for
+# Alice Geant4 based prototype
+# Options: -g     verbose mode
+#          local  recomended local configuration
+#   
+# csh version by I.Gonzalez  18.2.2000
+
+
+
+#
+# ==================================================================
+# Alice configuration options: Please define your selection with the
+# variables below.
+# ==================================================================
+# 
+
+#
+# ====== AG4_VERSION
+# Geant4 version
+# If set: the provided Geant4 version and not the default one is set
+#setenv AG4_VERSION 1.1
+
+#
+# ====== AG4_VISUALIZE
+# Set/Unset to get/avoid Geant4 visualisation.
+setenv AG4_VISUALIZE 1
+#unsetenv AG4_VISUALIZE
+
+#
+# ====== AG4_OPACS
+# Set/Unset to get OPACS as a Geant4 visualisation driver.
+#setenv AG4_OPACS 1
+unsetenv AG4_OPACS
+
+#
+# ====== AG4_STACKING
+# If set: the secondary particles are not tracked immediatelly
+#       when they are created but after the urgent stack is exhausted
+# If not set: the G4 default stacking is used
+setenv AG4_STACKING 1
+#unsetenv AG4_STACKING
+
+#
+# ====== AG4_NOPHYSICS
+# If set: only geantino or charged geantino can be shooted  
+#setenv AG4_NOPHYSICS 1
+unsetenv AG4_NOPHYSICS
+
+#
+# ====== AG4_MAKESHLIB
+# If set: shared libraris are created
+setenv AG4_MAKESHLIB 1
+#unsetenv AG4_MAKESHLIB
+
+#
+# ====== AG4_ODBMS
+# If set: the environment for using Objectivity is set. Not available on Linux?
+#setenv AG4_ODBMS 1
+unsetenv AG4_ODBMS
+
+
+#
+# Resolve input parameters
+#
+set VERBOSE = "NO"
+set LOCAL = "NO"
+foreach param ( $* )
+  switch ( $param )
+    case -g:
+      set VERBOSE="YES"; shift; breaksw;
+    case local:
+      set LOCAL="YES"; shift; breaksw;
+  endsw
+end
+
+#
+# ==================================================================
+# Key path variables
+# ==================================================================
+#
+
+if ( "$LOCAL" == "NO" ) then
+  # 
+  # AFS
+  #
+
+  # ====== ALICE_BASE
+  # ALICE base directory
+  set ALICE_BASE = /afs/cern.ch/alice/offline
+
+  # ====== G4_BASE
+  # Geant4 base directory
+  set G4_BASE = ${ALICE_BASE}/geant4
+
+  # ====== LHCXX_BASE
+  # LHC++ base directory
+  set LHCXX_BASE = /afs/cern.ch/sw/lhcxx/specific/@sys
+
+  # ====== ROOT_BASE
+  # Root base directory  
+  set ROOT_BASE = /afs/cern.ch/alice/library/root
+  # to be removed after aCC support will be defined
+  # in the offline in a standard way    
+  if ( "`uname`" == "HP-UX" ) then 
+   set ROOT_BASE = /afs/cern.ch/alice/library/.hp_ux102/root.2.23.aCC
+  endif 
+
+  # ====== IRST_BASE
+  # IRST code check tool base directory
+  setenv IRST_BASE /afs/cern.ch/alice/offline/geant4/tools/IRST
+
+  # ====== OBJY_BASE
+  # Objectivity base directory
+  set OBJY_BASE = /afs/cern.ch/rd45/objectivity
+
+else
+  # 
+  # recommended local installation
+  #
+
+  # ====== ALICE_BASE
+  # ALICE base directory
+  set ALICE_BASE = $HOME/dev
+
+  # ====== G4_BASE
+  # Geant4 base directory
+  set G4_BASE = $HOME/dev
+
+  # ====== LHCXX_BASE
+  # LHC++ base directory
+  set LHCXX_BASE = $HOME/dev
+
+  # ====== ROOT_BASE
+  # Root base directory  
+  set ROOT_BASE = $HOME/dev/root
+
+  # ====== IRST_BASE
+  # IRST code check tool base directory
+  setenv IRST_BASE $HOME/dev/tools/IRST
+
+endif
+
+
+#....................................... SKIP ................................
+#
+# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+# You should not need to change 
+# the lines below this one
+# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 
+
+# ====== AG4_INSTALL
+# Alice Geant4 install directory
+#
+setenv AG4_INSTALL $ALICE_ROOT/AliGeant4
+
+# Set variables depending on other variables
+# if opacs is selected then select also visualize
+if ( "$?AG4_OPACS" == 1 ) then
+  setenv AG4_VISUALIZE 1
+endif
+
+# Start the output
+if ( "$VERBOSE" == "YES" ) then
+  echo " "
+  echo "    =========================================="
+  echo "      ALICE Geant4 environment configuration"
+  echo "    =========================================="
+
+  #
+  # Some output on the selections... 
+  #
+
+  if ("$?AG4_VISUALIZE" == 1) then
+    echo "Geant4 visualisation is     selected."
+  else
+    echo "Geant4 visualisation is NOT selected."
+  endif
+  if ("$?AG4_OPACS" == 1) then
+    echo "OPACS driver         is     selected."
+  else
+    echo "OPACS driver         is NOT selected."
+  endif
+  if ("$?AG4_TOY" == 1) then
+    echo "Toy geometry         is     selected"
+  else
+    echo "Full geometry        is     selected"
+  endif
+  if ("$?AG4_STACKING" == 1) then
+    echo "Secondaries will be tracked after the urgent stack is exhausted."
+  else
+    echo "The Geant4 default stackin will be used."
+  endif
+  if ("$?AG4_NOPHYSICS" == 1) then
+    echo "Only geantino or charged geantino can be shooted."
+  else
+    echo "Full physics has been selected."
+  endif
+  if ("$?AG4_ODBMS" == 1) then
+    echo "The environment for using Objectivity will be set."
+  else
+    echo "No Geant4 Persistency."
+  endif
+
+endif
+
+#
+# ROOT Alice definitions & options
+# ==================================
+#
+if ( "$?ROOTSYS" == 0 ) then
+  setenv ROOTSYS ${ROOT_BASE}
+endif
+if ( "$VERBOSE" == "YES" ) then
+  echo " "
+  echo "ROOT"
+  echo "===="
+  echo ROOTSYS set to $ROOTSYS
+endif
+
+#
+# ODBMS Alice definitions & options
+# ==================================
+#
+if ( "$VERBOSE" == "YES" ) then
+  echo " "
+  echo "ODBMS & Objectivity"
+  echo "==================="
+endif
+if ( "$?AG4_ODBMS" == 1 ) then
+  if ( "$VERBOSE" == "YES" ) then
+    echo Setting ODBMS Alice definitions & options...
+  endif
+  setenv G4ODBMS 1
+  unsetenv AG4_VISUALIZE
+  setenv ALBOOT_DIR $AG4_INSTALL/ObjyDatabase
+  setenv ALBOOT_NAME Alice
+  setenv ALBOOT $ALBOOT_DIR/$ALBOOT_NAME
+  if ( ! -d $ALBOOT_DIR ) then
+    echo "  Making new directory $ALBOOT_DIR ..."
+    mkdir $ALBOOT_DIR
+  endif
+else
+  if ( "$VERBOSE" == "YES" ) then
+    echo Unsetting ODBMS Alice definitions \& options...
+  endif
+  unsetenv G4ODBMS
+  unsetenv ALBOOT_DIR
+  unsetenv ALBOOT_NAME
+  unsetenv ALBOOT
+endif
+#
+# Objectivity G4 options
+# according to run/example5/g4odbms_setup.sh
+#
+if ( "$?G4ODBMS" == 1 ) then
+  setenv OBJY_VERS 4.0.2
+  if ( -r $OBJY_BASE/objyenv.csh ) then
+    source $OBJY_BASE/objyenv.csh
+    if ( "$VERBOSE" == "YES" ) then
+      echo "  Environment for Objectivity has been set."
+    endif
+  endif
+  setenv HEP_ODBMS_DIR ${LHCXX_BASE}/HepODBMS/0.0
+  setenv HEP_ODBMS_INCLUDES $HEP_ODBMS_DIR/include
+endif
+
+
+#
+# Geant4  
+# ==================================
+#
+if ( "$VERBOSE" == "YES" ) then
+  echo " "
+  echo "Geant4 env. variables..."
+  echo "============================"
+endif
+if ("$?AG4_VERSION" == 0) then
+  setenv G4INSTALL ${G4_BASE}/geant4
+else
+  setenv G4INSTALL ${G4_BASE}/g4dev/geant4.${AG4_VERSION}
+endif
+
+if ("$?AG4_MAKESHLIB" == 0) then
+  unsetenv G4MAKESHLIB 
+else 
+  setenv G4MAKESHLIB ${G4INSTALL}/config/makeshlib.sh
+endif  
+
+# path to data files needed by hadronic processes
+setenv G4LEVELGAMMADATA ${G4INSTALL}/data/PhotonEvaporation
+
+# This is architecture dependent...
+set SYSTEM = `uname`
+if ( $SYSTEM == "HP-UX" ) then
+  setenv G4SYSTEM "HP-aCC"
+  setenv G4USE_OSPACE 1
+endif 
+if ( $SYSTEM == "Linux" ) then
+  setenv G4SYSTEM "Linux-g++"
+endif
+if ( "$VERBOSE" == "YES" ) then
+  echo "Architecture is $SYSTEM"
+  echo "Geant4 is istalled in $G4INSTALL"
+  echo "Geant4 architecture type is $G4SYSTEM"
+  if ( "$?G4USE_OSPACE" == 1 ) then
+    echo "ObjectSpace will be used for STL"
+  endif
+endif
+
+
+#
+# CLHEP
+# ==================================
+#
+
+if ( -d $LHCXX_BASE/CLHEP/new ) then
+  setenv CLHEP_BASE_DIR $LHCXX_BASE/CLHEP/new
+else
+  echo "WARNING: CLHEP has not been found in the default path."
+  if ( "$VERBOSE" == "YES" ) then
+    echo "         Please set the variable CLHEP_BASE_DIR to its base path"
+    echo "         Example: setenv  CLHEP_BASE_DIR /afs/cern.ch/sw/lhcxx/specific/@sys/CLHEP/pro"
+  endif
+endif
+if ( "$VERBOSE" == "YES" ) then
+  echo "CLHEP base directory: $CLHEP_BASE_DIR"
+endif
+
+
+#
+# Visualization
+# ==================================
+#
+
+if ( "$?AG4_VISUALIZE" == 1 ) then
+  if ( "$VERBOSE" == "YES" ) then
+    echo "G4 Visualization env. variables..."
+  endif
+
+  #
+  # Xm UI
+  #
+  if ( "$VERBOSE" == "YES" ) then
+    echo "* X11 with Motif..."
+  endif
+  setenv G4UI_BUILD_XM_DRIVER  1
+  setenv G4UI_BUILD_XM_SESSION 1
+  setenv G4UI_USE_XM           1
+
+  #
+  # Fukui Renderer
+  #
+  if ( "$VERBOSE" == "YES" ) then
+    echo "* Fukui Renderer (DAWN)..."
+  endif
+  setenv G4VIS_BUILD_DAWN_DRIVER     1
+  setenv G4VIS_BUILD_DAWNFILE_DRIVER 1
+  setenv G4VIS_USE_DAWN              1
+  setenv G4VIS_USE_DAWNFILE          1
+  setenv G4DAWNFILE_VIEWER   david
+  setenv DAWN_HOME ${G4_BASE}/tools/bin
+  if ( "`echo ${PATH} | grep ${DAWN_HOME} `" == "" ) then
+    setenv PATH "${PATH}:${DAWN_HOME}"
+    rehash
+  endif
+  setenv G4DAWN_MULTI_WINDOW 1
+  if ( $SYSTEM == "Linux" ) then
+    setenv G4DAWN_NAMED_PIPE 1
+  endif
+
+  if ( "$VERBOSE" == "YES" ) then
+    if ("$?G4VIS_USE_DAWN" == 1) then
+      echo "  Dawn driver activated"
+    endif
+    if ("$?G4VIS_USE_DAWNFILE" == 1) then
+      echo "  Dawn file driver activated"
+    endif
+    if ("$?G4DAWNFILE_VIEWER" == 1) then
+      echo "  Dawn file viewer set to ${G4DAWNFILE_VIEWER}"
+    endif
+    if ("$?DAWN_HOME" == 1) then
+      echo "  Dawn home path set to ${DAWN_HOME}"
+    endif
+    if ("$?G4DAWN_MULTI_WINDOW" == 1) then
+      echo "  Dawn multi window selected"
+    endif
+    if ("$?G4DAWN_NAMED_PIPE" == 1) then
+      echo "  Dawn named pipe selected"
+    endif
+  endif
+
+  # David flags
+  # Set colors for overlappings
+  setenv DAVID_RAINBOW_FLAG 1
+  #setenv DAVID_HIGHLIGHT_COLOR_R  r
+  #setenv DAVID_HIGHLIGHT_COLOR_G  g
+  #setenv DAVID_HIGHLIGHT_COLOR_B  b
+
+  # If set volumes names are shown
+  setenv DAVID_DISPLAY_PVNAME   1
+  # If set supresses the call to dawn
+  #setenv DAVID_NO_VIEW  1
+  setenv DAVID_EPSILON_3D  0.001
+
+  if ( "$VERBOSE" == "YES" ) then
+    if ("$?DAVID_RAINBOW_FLAG" == 1) then
+      echo "  DAVID Rainbow mode is ON"
+    endif
+    if ("$?DAVID_HIGHLIGHT_COLOR_R" == 1) then
+      echo "  DAVID Highlight color (Red) set to ${DAVID_HIGHLIGHT_COLOR_R}"
+    endif
+    if ("$?DAVID_HIGHLIGHT_COLOR_G" == 1) then
+      echo "  DAVID Highlight color (Green) set to ${DAVID_HIGHLIGHT_COLOR_G}"
+    endif
+    if ("$?DAVID_HIGHLIGHT_COLOR_B" == 1) then
+      echo "  DAVID Highlight color (Blue) set to ${DAVID_HIGHLIGHT_COLOR_B}"
+    endif
+    if ("$?DAVID_DISPLAY_PVNAME" == 1) then
+      echo "  DAVID will display intersected volumes name"
+    endif
+    if ("$?DAVID_DISPLAY_PVNAME" == 1) then
+      echo "  Dawn will not be called from DAVID"
+    endif
+    if ("$?DAVID_EPSILON_3D" == 1) then
+      echo "  DAVID tolerance set to ${DAVID_EPSILON_3D}"
+    endif
+  endif
+
+  #
+  # OpenGL
+  #
+  if ( "$VERBOSE" == "YES" ) then
+    echo "* OpenGL..."
+  endif
+  setenv G4VIS_BUILD_OPENGLX_DRIVER  1
+  setenv G4VIS_BUILD_OPENGLXM_DRIVER 1
+  setenv G4VIS_USE_OPENGLX           1
+  setenv G4VIS_USE_OPENGLXM          1
+  if ( $SYSTEM == "Linux" ) then
+    setenv OGLHOME /usr/local
+    setenv OGLLIBS "-L$OGLHOME/lib -lMesaGLU -lMesaGL"
+  else
+    setenv OGLHOME $LHCXX_BASE/OpenGL/pro
+  endif
+
+  if ( "$VERBOSE" == "YES" ) then
+    if ("$?G4VIS_USE_OPENGLX" == 1) then
+      echo "  OpenGL and  X11 driver activated"
+    endif
+    if ("$?G4VIS_USE_OPENGLXM" == 1) then
+      echo "  OpenGL with Motif extension driver activated"
+    endif
+    if ("$?OGLHOME" == 1) then
+      echo "  OpenGL path set to ${OGLHOME}"
+    endif
+    if ("$?OGLLIBS" == 1) then
+      echo "  OpenGL libraries set to ${OGLLIBS}"
+    endif
+  endif
+
+  #
+  # OpenInventor
+  #
+  if ( "$VERBOSE" == "YES" ) then
+    echo "* OpenInventor..."
+  endif
+  #setenv G4VIS_USE_OPENINVENTOR 1
+  #setenv OIHOME whatever
+  #setenv HEPVISDIR something
+  if ( "$VERBOSE" == "YES" ) then
+    if ("$?G4VIS_USE_OPENINVENTOR" == 1) then
+      echo "  OpenInventor driver activated"
+      echo "  OpenInventor path is ${OIHOME}"
+      echo "  HepVis path is ${HEPVISDIR}"
+    endif
+  endif
+
+  #
+  # VRML1
+  #
+  if ( "$VERBOSE" == "YES" ) then
+    echo "* VRML..."
+  endif
+  setenv G4VIS_BUILD_VRML_DRIVER        1
+  setenv G4VIS_BUILD_VRMLFILE_DRIVER    1
+  setenv G4VIS_USE_VRML                 1
+  setenv G4VIS_USE_VRMLFILE            1
+  #Set preferred vrml viewer to be invoked in this mode
+  setenv G4VRMLFILE_VIEWER vrweb
+  #Set host name for VRML1 visualization.... the g4vrmlview machine!
+  setenv G4VRML_HOST_NAME nohost
+  #Command to run java listener for VRML driver
+  #alias javavrml "java -classpath $G4_BASE/tools/bin/java g4vrmlview vrweb"
+
+  if ( "$VERBOSE" == "YES" ) then
+    if ("$?G4VIS_USE_VRML" == 1) then
+      echo "  VRML driver activated"
+      echo "  Host Name for remote visualization is ${G4VRML_HOST_NAME}"
+    endif
+    if ("$?G4VIS_USE_VRMLFILE" == 1) then
+      echo "  VRML file driver activated"
+      echo "  VRML viewer set to ${G4VRMLFILE_VIEWER}"
+    endif
+  endif
+
+  #
+  # Ray Tracer
+  #
+  if ( "$VERBOSE" == "YES" ) then
+    echo "* Ray Tracer..."
+  endif
+  #setenv G4VIS_BUILD_RAYTRACER_DRIVER 1
+  #setenv G4VIS_USE_RAYTRACER          1
+  if ( "$VERBOSE" == "YES" ) then
+    if ("$?G4VIS_USE_RAYTRACER" == 1) then
+      echo "  Ray tracing driver activated"
+    endif
+  endif
+
+  #
+  # GAG
+  #
+  if ( "$VERBOSE" == "YES" ) then
+    echo "* Geant Adaptative GUI (GAG)..."
+  endif
+  setenv G4UI_BUILD_GAG_SESSION 1
+  setenv G4UI_USE_GAG           1
+  setenv MOMOPATH     ${G4_BASE}/tools/GAG/tcltk
+  if ( "`echo ${PATH} | grep ${MOMOPATH} `" == "" ) then
+    setenv PATH "${PATH}:${MOMOPATH}"
+    rehash
+  endif
+  set    NCLASSPATH = ".:${G4_BASE}/tools/swing-1.0.3/swingall.jar:${G4_BASE}/tools/GAG/java/GAG.jar"
+  if ("$?CLASSPATH" == 0) then
+    setenv CLASSPATH $NCLASSPATH
+  else
+    if ( "`echo ${CLASSPATH} | grep ${NCLASSPATH} `" == "" ) then
+      setenv CLASSPATH "${CLASSPATH}:${NCLASSPATH}"
+    endif
+  endif
+
+  if ( "$VERBOSE" == "YES" ) then
+    if ("$?G4UI_USE_GAG" == 1) then
+      echo "  GAG UI activated"
+      echo "  Momo path set to $MOMOPATH"
+      echo "    NOTE: Run "\'tmomo\' "to use Momo (TK/Tcl version)"
+      echo "  The path to the java GAG code was updated"
+      echo "    NOTE: Run "\'java gag\'" to use GAG (java version)"
+    endif
+  endif
+
+else
+  if ( "$VERBOSE" == "YES" ) then
+    echo Unsetting G4 Visualization env. variables...
+  endif
+
+  #XM
+  unsetenv G4UI_BUILD_XM_DRIVER
+  unsetenv G4UI_BUILD_XM_SESSION
+  unsetenv G4UI_USE_XM
+
+  # Dawn
+  unsetenv G4VIS_BUILD_DAWN_DRIVER
+  unsetenv G4VIS_BUILD_DAWNFILE_DRIVER
+  unsetenv G4VIS_USE_DAWN
+  unsetenv G4VIS_USE_DAWNFILE
+  unsetenv G4DAWNFILE_VIEWER
+  unsetenv DAWN_HOME
+  unsetenv G4DAWN_MULTI_WINDOW
+  if ( $SYSTEM == "Linux" ) then
+    unsetenv G4DAWN_NAMED_PIPE
+  endif
+
+  # David
+  unsetenv DAVID_RAINBOW_FLAG
+  unsetenv DAVID_HIGHLIGHT_COLOR_R
+  unsetenv DAVID_HIGHLIGHT_COLOR_G
+  unsetenv DAVID_HIGHLIGHT_COLOR_B
+  unsetenv DAVID_DISPLAY_PVNAME
+  unsetenv DAVID_NO_VIEW
+  unsetenv DAVID_EPSILON_3D
+  
+  # OpenGL
+  unsetenv G4VIS_BUILD_OPENGLX_DRIVER
+  unsetenv G4VIS_BUILD_OPENGLXM_DRIVER
+  unsetenv G4VIS_USE_OPENGLX
+  unsetenv G4VIS_USE_OPENGLXM
+  unsetenv OGLHOME
+  unsetenv OGLLIBS
+
+  # OpenInventor
+  unsetenv G4VIS_USE_OPENINVENTOR
+
+  # VRML1
+  unsetenv G4VIS_BUILD_VRML_DRIVER
+  unsetenv G4VIS_BUILD_VRMLFILE_DRIVER
+  unsetenv G4VIS_USE_VRML
+  unsetenv G4VIS_USE_VRMLFILE
+  unsetenv G4VRMLFILE_VIEWER
+  unsetenv G4VRML_HOST_NAME
+
+  # GAG
+  unsetenv G4UI_BUILD_GAG_SESSION
+  unsetenv G4UI_USE_GAG
+  unsetenv MOMOPATH
+
+endif
+
+#
+# OPACS
+#
+if ( "$?AG4_OPACS" == 1 ) then
+  if ( "$VERBOSE" == "YES" ) then
+    echo "* OPACS..."
+  endif
+  setenv AG4_VISUALIZE 1
+
+  #
+  # OpenGL: needed by OPACS
+  #
+  setenv G4VIS_BUILD_OPENGLX_DRIVER 1
+  setenv G4VIS_USE_OPENGLX          1
+  if ( $SYSTEM == "Linux" ) then
+    setenv OGLHOME /usr/local
+    setenv OGLLIBS "-L$OGLHOME/lib -lMesaGLU -lMesaGL"
+  else
+    setenv OGLHOME $LHCXX_BASE/OpenGL/pro
+  endif
+
+  #
+  # OPACS
+  #
+  setenv G4VIS_BUILD_OPACS_DRIVER 1
+  setenv G4UI_BUILD_WO_DRIVER     1
+  setenv G4UI_BUILD_WO_SESSION    1
+  setenv G4VIS_USE_OPACS          1
+  setenv G4UI_USE_WO              1
+  setenv OPACS_HOME $G4_BASE/tools/OPACS
+  #setenv OPACS_HOME /afs/cern.ch/rd44/dev/OPACS
+  if ( $SYSTEM == "Linux" ) then
+    setenv G4_OPACS_WIDGET_SET lesstif
+  else
+    setenv G4_OPACS_WIDGET_SET Xm
+  endif
+  source $OPACS_HOME/OPACS/v3/setup.csh
+  setenv WOENVIRONMENT $AG4_INSTALL/bin/Alice.odb
+  setenv OPATH "$OPATH $G4INSTALL/environments/OPACS/usr"
+  if ( "$VERBOSE" == "YES" ) then
+    if ("$?G4VIS_USE_OPACS" == 1) then
+      echo "  OPACS driver activated"
+      echo "  OPACS path set to $OPACS_HOME"
+    endif
+  endif
+else   
+  if ( "$VERBOSE" == "YES" ) then
+    echo "* Unsetting OPACS driver env. variables ..."
+  endif
+  unsetenv G4VIS_BUILD_OPACS_DRIVER
+  unsetenv G4UI_BUILD_WO_DRIVER
+  unsetenv G4UI_BUILD_WO_SESSION
+  unsetenv G4VIS_USE_OPACS
+  unsetenv G4UI_USE_WO
+  unsetenv OPACS_HOME
+  unsetenv G4_OPACS_WIDGET_SET
+  unsetenv G4OROOT
+  unsetenv WOENVIRONMENT
+  unsetenv OPATH
+endif
+
+#
+# path to Alice executable and config scripts
+#  
+if ( "`echo ${PATH} | grep ${AG4_INSTALL}/bin/${G4SYSTEM} `" == "" ) then
+  if ( "$VERBOSE" == "YES" ) then
+    echo Adding $AG4_INSTALL/bin/$G4SYSTEM to the path...
+  endif
+  setenv PATH "${PATH}:${AG4_INSTALL}/bin/${G4SYSTEM}"
+endif
+if ( "`echo ${PATH} | grep ${AG4_INSTALL}/config `" == "" ) then
+  if ( "$VERBOSE" == "YES" ) then
+    echo Adding ${AG4_INSTALL}/config to the path...
+  endif
+  setenv PATH "${PATH}:${AG4_INSTALL}/config"
+endif
+
+#
+# path to shared libraries
+# 
+if ( $SYSTEM == "HP-UX" ) then
+  set SHLIBVAR = $SHLIB_PATH
+  set SHLIBVARNAME = SHLIB_PATH
+endif 
+if ( $SYSTEM == "Linux" ) then
+  set SHLIBVAR = $LD_LIBRARY_PATH
+  set SHLIBVARNAME = LD_LIBRARY_PATH
+endif
+if ( "`echo ${SHLIBVAR} | grep ${AG4_INSTALL}/lib/${G4SYSTEM} `" == "" ) then
+  if ( "$VERBOSE" == "YES" ) then
+    echo Adding ${AG4_INSTALL}/lib/${G4SYSTEM} to the shared libraries path...
+  endif
+  set SHLIBVAR="${AG4_INSTALL}/lib/${G4SYSTEM}:${SHLIBVAR}"
+endif
+
+if ( "`echo ${SHLIBVAR} | grep ${G4INSTALL}/lib/${G4SYSTEM} `" == "" ) then
+  if ( "$VERBOSE" == "YES" ) then
+    echo Adding ${G4INSTALL}/lib/${G4SYSTEM} to the shared libraries path...
+  endif
+  set SHLIBVAR="${G4INSTALL}/lib/${G4SYSTEM}:${SHLIBVAR}"
+endif
+
+setenv $SHLIBVARNAME $SHLIBVAR
+
+
+#
+# Remove unneeded variables. If this is not done the vars. remain in the env.
+#
+
+unset ALICE_BASE
+unset G4_BASE
+unset LHCXX_BASE
+unset OBJY_BASE
+unset SYSTEM
+unset NCLASSPATH
+unset SHLIBVAR
+unset SHLIBVARNAME
+unset LOCAL
+unset VERBOSE
+
+echo "Default ALICE environment for GEANT4 has been set."
diff --git a/AliGeant4/config/setup.sh b/AliGeant4/config/setup.sh
new file mode 100755 (executable)
index 0000000..172e17f
--- /dev/null
@@ -0,0 +1,731 @@
+# $Id$
+# ----------------------------------------------------------------
+# This script sets the default environment variables for
+# Alice Geant4 based prototype
+# Options: -g     verbose mode
+#          local  recomended local configuration
+#   
+# by I. Hrivnacova, 18.8.1998
+#
+# sh version modified by I. Gonzalez 2.3.2000
+
+#
+# ==================================================================
+# Alice configuration options: 
+# Please define your selection with the variables below.
+# ==================================================================
+# 
+
+#
+# ====== AG4_VERSION
+# Geant4 version
+# If set: the provided Geant4 version and not the default one is set
+#export AG4_VERSION=1.0_test
+
+#
+# ====== AG4_VISUALIZE
+# Set/Unset to get/avoid Geant4 visualisation.
+export AG4_VISUALIZE=1
+#unset AG4_VISUALIZE
+
+#
+# ====== AG4_OPACS
+# Set/Unset to get OPACS as a Geant4 visualisation driver.
+#export AG4_OPACS=1
+unset AG4_OPACS
+
+#
+# ====== AG4_STACKING
+# If set: the secondary particles are not tracked immediatelly
+#       when they are created but after the urgent stack is exhausted
+# If not set: the G4 default stacking is used
+export AG4_STACKING=1
+#unset AG4_STACKING
+
+#
+# ====== AG4_NOPHYSICS
+# If set: only geantino or charged geantino can be shooted  
+#export AG4_NOPHYSICS=1
+unset AG4_NOPHYSICS
+
+#
+# ====== AG4_MAKESHLIB
+# If set: shared libraris are created
+export AG4_MAKESHLIB=1
+#unset AG4_MAKESHLIB
+
+#
+# ====== AG4_ODBMS
+# If set: the environment for using Objectivity is set. Not available on Linux?
+#export AG4_ODBMS=1
+unset AG4_ODBMS
+
+
+#
+# Resolve input parameters
+#
+VERBOSE="NO"
+LOCAL="NO"
+for param in $*
+do
+  case $param in
+    -g) VERBOSE="YES"; shift 1;;
+    local) LOCAL="YES"; shift 1;;
+  esac
+done
+
+
+#
+# ==================================================================
+# Key path variables
+# ==================================================================
+#
+
+if [ "$LOCAL" = "NO" ]; then
+  # 
+  # AFS
+  #
+
+  # ====== ALICE_BASE
+  # ALICE base directory
+  ALICE_BASE=/afs/cern.ch/alice/offline
+
+  # ====== G4_BASE
+  # Geant4 base directory
+  G4_BASE=${ALICE_BASE}/geant4
+
+  # ====== LHCXX_BASE
+  # LHC++ base directory
+  LHCXX_BASE=/afs/cern.ch/sw/lhcxx/specific/@sys
+
+  # ====== ROOT_BASE
+  # Root base directory  
+  ROOT_BASE=/afs/cern.ch/alice/library/root
+  # to be removed after aCC support will be defined
+  # in the offline in a standard way  
+  if [ `uname` = "HP-UX" ]; then 
+   ROOT_BASE=/afs/cern.ch/alice/library/.hp_ux102/root.2.23.aCC
+  fi 
+
+  # ====== IRST_BASE
+  # IRST code check tool base directory
+  export IRST_BASE=/afs/cern.ch/alice/offline/geant4/tools/IRST
+
+  # ====== OBJY_BASE
+  # Objectivity base directory
+  OBJY_BASE="/afs/cern.ch/rd45/objectivity"
+
+else
+  # 
+  # recommended local installation
+  #
+
+  # ====== ALICE_BASE
+  # ALICE base directory
+  ALICE_BASE=$HOME/dev
+
+  # ====== G4_BASE
+  # Geant4 base directory
+  G4_BASE=$HOME/dev
+
+  # ====== LHCXX_BASE
+  # LHC++ base directory
+  LHCXX_BASE=$HOME/dev
+
+  # ====== ROOT_BASE
+  # Root base directory  
+  ROOT_BASE=$HOME/dev/root
+
+  # ====== IRST_BASE
+  # IRST code check tool base directory
+  export IRST_BASE=$HOME/dev/tools/IRST
+
+fi
+
+
+#....................................... SKIP ................................
+#
+# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+# You should not need to change 
+# the lines below this one
+# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 
+
+# ====== AG4_INSTALL
+# Alice Geant4 install directory
+#
+export AG4_INSTALL=$ALICE_ROOT/AliGeant4
+
+# Set variables depending on other variables
+# if opacs is selected then select also visualize
+if [ $AG4_OPACS ]; then
+  export AG4_VISUALIZE=1
+fi
+
+# Start the output
+if [ "$VERBOSE" = "YES" ]; then
+  echo " "
+  echo "    =========================================="
+  echo "      ALICE Geant4 environment configuration"
+  echo "    =========================================="
+
+  #
+  # Some output on the selections... 
+  #
+
+  if [ $AG4_VISUALIZE ]; then
+    echo "Geant4 visualisation is     selected."
+  else
+    echo "Geant4 visualisation is NOT selected."
+  fi
+  if [ $AG4_OPACS ]; then
+    echo "OPACS driver         is     selected."
+  else
+    echo "OPACS driver         is NOT selected."
+  fi
+  if [ $AG4_TOY ]; then
+    echo "Toy geometry         is     selected"
+  else
+    echo "Full geometry        is     selected"
+  fi
+  if [ $AG4_STACKING ]; then
+    echo "The ALICE default stacking will be used."
+  else
+    echo "The Geant4 default stacking will be used."
+  fi
+  if [ $AG4_NOPHYSICS ]; then
+    echo "Only geantino or charged geantino can be shooted."
+  else
+    echo "Full physics has been selected."
+  fi
+  if [ $AG4_ODBMS ]; then
+    echo "The environment for using Objectivity will be set."
+  else
+    echo "No Geant4 Persistency."
+  fi
+
+fi
+
+#
+# ROOT Alice definitions & options
+# ==================================
+#
+if [ "$ROOTSYS" = "" ]; then
+  export ROOTSYS=$ROOT_BASE
+fi
+if [ "$VERBOSE" = "YES" ]; then
+  echo " "
+  echo "ROOT"
+  echo "===="
+  echo "ROOTSYS set to $ROOTSYS"
+fi
+
+#
+# ODBMS Alice definitions & options
+# ==================================
+#
+if [ "$VERBOSE" = "YES" ]; then
+  echo " "
+  echo "ODBMS & Objectivity"
+  echo "==================="
+fi
+if [ $AG4_ODBMS ]; then
+  if [ "$VERBOSE" = "YES" ]; then
+    echo Setting ODBMS Alice definitions & options...
+  fi
+  export G4ODBMS=1
+  unset AG4_VISUALIZE
+  export ALBOOT_DIR=$AG4_INSTALL/ObjyDatabase
+  export ALBOOT_NAME=Alice
+  export ALBOOT=$ALBOOT_DIR/$ALBOOT_NAME
+  if [ ! -d $ALBOOT_DIR ]; then 
+    echo "  Making new directory $ALBOOT_DIR ..."
+    mkdir $ALBOOT_DIR
+  fi 
+else
+  if [ "$VERBOSE" = "YES" ]; then
+    echo Unsetting ODBMS Alice definitions \& options...
+  fi 
+  unset G4ODBMS
+  unset ALBOOT_DIR
+  unset ALBOOT_NAME
+  unset ALBOOT
+fi
+#
+# Objectivity G4 options
+# according to run/example5/g4odbms_setup.sh
+#
+if [ $G4ODBMS ]; then
+  export OBJY_VERS=4.0.2
+  if [ -r $OBJYDEV/objyenv.sh ]; then
+    . $OBJYDEV/objyenv.sh
+    if [ "$VERBOSE" = "YES" ]; then
+      echo "Environment for Objectivity has been set."
+    fi
+  fi
+  export HEP_ODBMS_DIR=$HEPDEV/HepODBMS/0.0
+  export HEP_ODBMS_INCLUDES=$HEP_ODBMS_DIR/include
+fi
+
+
+#
+# Geant4
+# ==================================
+#
+if [ "$VERBOSE" = "YES" ]; then
+  echo " "
+  echo "Geant4 env. variables..."
+  echo "============================"
+fi
+if [ "$AG4_VERSION" = "" ]; then
+  export G4INSTALL=$G4_BASE/geant4
+else
+  export G4INSTALL=$G4_BASE/g4dev/geant4.$AG4_VERSION
+fi
+
+if [ "$AG4_MAKESHLIB" = "" ]; then
+  unset G4MAKESHLIB  
+else
+  export G4MAKESHLIB=$G4INSTALL/config/makeshlib.sh
+fi  
+
+# path to data files needed by hadronic processes
+export G4LEVELGAMMADATA=$G4INSTALL/data/PhotonEvaporation
+
+# This is architecture dependent...
+SYSTEM=`uname`
+if [ "$SYSTEM" = "HP-UX" ]; then
+  export G4SYSTEM="HP-aCC"
+  export G4USE_OSPACE=1
+fi  
+if [ "$SYSTEM" = "Linux" ]; then
+  export G4SYSTEM="Linux-g++"
+fi
+if [ "$VERBOSE" = "YES" ]; then
+  echo "Architecture is $SYSTEM"
+  echo "Geant4 is istalled in $G4INSTALL"
+  echo "Geant4 architecture type is $G4SYSTEM"
+  if [ $G4USE_OSPACE ]; then
+    echo "ObjectSpace will be used for STL"
+  fi
+fi
+
+
+#
+# CLHEP
+# ==================================
+#
+
+if [ -d $LHCXX_BASE/CLHEP/new ]; then
+  export CLHEP_BASE_DIR=$LHCXX_BASE/CLHEP/new
+else
+  echo "WARNING: CLHEP has not been found in the default path."
+  if [ "$VERBOSE" = "YES" ]; then
+    echo "         Please set the variable CLHEP_BASE_DIR to its base path"
+    echo "         Example: export CLHEP_BASE_DIR=/afs/cern.ch/sw/lhcxx/specific/@sys/CLHEP/pro"
+  fi
+fi
+if [ "$VERBOSE" = "YES" ]; then
+  echo "CLHEP base directory: $CLHEP_BASE_DIR"
+fi
+
+
+#
+# Visualization
+# ==================================
+#
+
+if [ $AG4_VISUALIZE ]; then
+  if [ "$VERBOSE" = "YES" ]; then
+    echo "G4 Visualization env. variables..."
+  fi
+
+  #
+  # Xm UI
+  #
+  if [ "$VERBOSE" = "YES" ]; then
+    echo "* X11 with Motif..."
+  fi
+  export G4UI_BUILD_XM_DRIVER=1
+  export G4UI_BUILD_XM_SESSION=1
+  export G4UI_USE_XM=1
+
+  #
+  # Fukui Renderer
+  #
+  if [ "$VERBOSE" = "YES" ]; then
+    echo "* Fukui Renderer (DAWN)..."
+  fi
+  export G4VIS_BUILD_DAWN_DRIVER=1
+  export G4VIS_BUILD_DAWNFILE_DRIVER=1
+  export G4VIS_USE_DAWN=1
+  export G4VIS_USE_DAWNFILE=1
+  export G4DAWNFILE_VIEWER=david
+  export DAWN_HOME=${G4_BASE}/tools/bin
+  if [ "`echo ${PATH} | grep ${DAWN_HOME} `" = "" ]; then
+    export PATH=$PATH:$DAWN_HOME
+    rehash
+  fi
+  export G4DAWN_MULTI_WINDOW=1
+  if [ `uname` = "Linux" ]; then
+    export G4DAWN_NAMED_PIPE=1
+  fi
+
+  if [ "$VERBOSE" = "YES" ]; then
+    if [ $G4VIS_USE_DAWN ]; then
+      echo "  Dawn driver activated"
+    fi
+    if [ $G4VIS_USE_DAWNFILE ]; then
+      echo "  Dawn file driver activated"
+    fi
+    if [ $G4DAWNFILE_VIEWER ]; then
+      echo "  Dawn file viewer set to ${G4DAWNFILE_VIEWER}"
+    fi
+    if [ $DAWN_HOME ]; then
+      echo "  Dawn home path set to ${DAWN_HOME}"
+    fi
+    if [ $G4DAWN_MULTI_WINDOW ]; then
+      echo "  Dawn multi window selected"
+    fi
+    if [ $G4DAWN_NAMED_PIPE ]; then
+      echo "  Dawn named pipe selected"
+    fi
+  fi
+
+  # David flags
+  # Set colors for overlappings
+  export DAVID_RAINBOW_FLAG=1
+  #export DAVID_HIGHLIGHT_COLOR_R=r
+  #export DAVID_HIGHLIGHT_COLOR_G=g
+  #export DAVID_HIGHLIGHT_COLOR_B=b
+
+  # If set volumes names are shown
+  export DAVID_DISPLAY_PVNAME=1
+  # If set supresses the call to dawn
+  #export DAVID_NO_VIEW=1
+  export DAVID_EPSILON_3D=0.001
+
+  if [ "$1" = "-g"  ]; then
+    if [ $DAVID_RAINBOW_FLAG ]; then
+      echo "  DAVID Rainbow mode is ON"
+    fi
+    if [ $DAVID_HIGHLIGHT_COLOR_R ]; then
+      echo "  DAVID Highlight color (Red) set to ${DAVID_HIGHLIGHT_COLOR_R}"
+    fi
+    if [ $DAVID_HIGHLIGHT_COLOR_G ]; then
+      echo "  DAVID Highlight color (Green) set to ${DAVID_HIGHLIGHT_COLOR_G}"
+    fi
+    if [ $DAVID_HIGHLIGHT_COLOR_B ]; then
+      echo "  DAVID Highlight color (Blue) set to ${DAVID_HIGHLIGHT_COLOR_B}"
+    fi
+    if [ $DAVID_DISPLAY_PVNAME ]; then
+      echo "  DAVID will display intersected volumes name"
+    fi
+    if [ $DAVID_DISPLAY_PVNAME ]; then
+      echo "  Dawn will not be called from DAVID"
+    fi
+    if [ $DAVID_EPSILON_3D ]; then
+      echo "  DAVID tolerance set to ${DAVID_EPSILON_3D}"
+    fi
+  fi
+
+  #
+  # OpenGL
+  #
+  if [ "$VERBOSE" = "YES" ]; then
+    echo "* OpenGL..."
+  fi
+  export G4VIS_BUILD_OPENGLX_DRIVER=1
+  export G4VIS_BUILD_OPENGLXM_DRIVER=1
+  export G4VIS_USE_OPENGLX=1
+  export G4VIS_USE_OPENGLXM=1
+  if [ "$SYSTEM" = "Linux" ]; then
+    export OGLHOME=/usr/local
+    export OGLLIBS="-L$OGLHOME/lib -lMesaGLU -lMesaGL"
+  else
+    export OGLHOME=$LHCXX_BASE/OpenGL/pro
+  fi
+
+  if [ "$VERBOSE" = "YES" ]; then
+    if [ $G4VIS_USE_OPENGLX ]; then
+      echo "  OpenGL and  X11 driver activated"
+    fi
+    if [ $G4VIS_USE_OPENGLXM ]; then
+      echo "  OpenGL with Motif extension driver activated"
+    fi
+    if [ $OGLHOME ]; then
+      echo "  OpenGL path set to ${OGLHOME}"
+    fi
+    if [ $OGLLIBS ]; then
+      echo "  OpenGL libraries set to ${OGLLIBS}"
+    fi
+  fi
+
+  #
+  # OpenInventor
+  #
+  if [ "$VERBOSE" = "YES" ]; then
+    echo "* OpenInventor..."
+  fi
+  #export G4VIS_USE_OPENINVENTOR=1
+  #export OIHOME=whatever
+  #export HEPVISDIR=something
+  if [ "$VERBOSE" = "YES" ]; then
+    if [ $G4VIS_USE_OPENINVENTOR ]; then
+      echo "  OpenInventor driver activated"
+      echo "  OpenInventor path is ${OIHOME}"
+      echo "  HepVis path is ${HEPVISDIR}"
+    fi
+  fi
+
+  #
+  # VRML1
+  #
+  if [ "$VERBOSE" = "YES" ]; then
+    echo "* VRML..."
+  fi
+  export G4VIS_BUILD_VRML_DRIVER=1    
+  export G4VIS_BUILD_VRMLFILE_DRIVER=1
+  export G4VIS_USE_VRML=1
+  export G4VIS_USE_VRMLFILE=1
+  #Set preferred vrml viewer to be invoked in this mode
+  export G4VRMLFILE_VIEWER=vrweb
+  #Set host name for VRML1 visualization.... the g4vrmlview machine!
+  export G4VRML_HOST_NAME=nohost
+  #Command to run java listener for VRML driver
+  #alias javavrml "java -classpath $G4_BASE/tools/bin/java g4vrmlview vrweb"
+
+  if [ "$VERBOSE" = "YES" ]; then
+    if [ $G4VIS_USE_VRML ]; then
+      echo "  VRML driver activated"
+      echo "  Host Name for remote visualization is ${G4VRML_HOST_NAME}"
+    fi
+    if [ $G4VIS_USE_VRMLFILE ]; then
+      echo "  VRML file driver activated"
+      echo "  VRML viewer set to ${G4VRMLFILE_VIEWER}"
+    fi
+  fi
+
+  #
+  # Ray Tracer
+  #
+  if [ "$VERBOSE" = "YES" ]; then
+    echo "* Ray Tracer..."
+  fi
+  #export G4VIS_BUILD_RAYTRACER_DRIVER=1
+  #export G4VIS_USE_RAYTRACER=1
+  if [ "$VERBOSE" = "YES" ]; then
+    if [ $G4VIS_USE_RAYTRACER ]; then
+      echo "  Ray tracing driver activated"
+    fi
+  fi
+
+  #
+  # GAG
+  #
+  if [ "$VERBOSE" = "YES" ]; then
+    echo "* Geant Adaptative GUI (GAG)..."
+  fi
+  export G4UI_BUILD_GAG_SESSION=1
+  export G4UI_USE_GAG=1
+  export MOMOPATH=${G4_BASE}/tools/GAG/tcltk
+  if [ "`echo ${PATH} | grep ${MOMOPATH} `" = "" ]; then
+    export PATH=$PATH:$MOMOPATH
+    rehash
+  fi
+  NCLASSPATH=".:${G4_BASE}/tools/swing-1.0.3/swingall.jar:${G4_BASE}/tools/GAG/java/GAG.jar"
+  if [ "$CLASSPATH" = "" ]; then
+    export CLASSPATH=$NCLASSPATH
+  else
+    if [ "`echo ${CLASSPATH} | grep ${NCLASSPATH} `" = "" ]; then
+      export CLASSPATH="${CLASSPATH}:${NCLASSPATH}"
+    fi
+  fi
+
+  if [ "$VERBOSE" = "YES" ]; then
+    if [ $G4UI_USE_GAG ]; then
+      echo "  GAG UI activated"
+      echo "  Momo path set to $MOMOPATH"
+      echo "    NOTE: Run "\'tmomo\' "to use Momo (TK/Tcl version)"
+      echo "  The path to the java GAG code was updated"
+      echo "    NOTE: Run "\'java gag\'" to use GAG (java version)"
+    fi
+  fi
+
+else
+  if [ "$VERBOSE" = "YES" ]; then
+    echo Unsetting G4 Visualization env. variables...
+  fi
+
+  #XM
+  unset G4UI_BUILD_XM_DRIVER
+  unset G4UI_BUILD_XM_SESSION
+  unset G4UI_USE_XM
+
+  # Dawn
+  unset G4VIS_BUILD_DAWN_DRIVER
+  unset G4VIS_BUILD_DAWNFILE_DRIVER
+  unset G4VIS_USE_DAWN
+  unset G4VIS_USE_DAWNFILE
+  unset G4DAWNFILE_VIEWER
+  unset DAWN_HOME
+  unset G4DAWN_MULTI_WINDOW
+  if [ "$SYSTEM" = "Linux" ]; then
+    unset G4DAWN_NAMED_PIPE
+  fi
+
+  # David
+  unset DAVID_RAINBOW_FLAG
+  unset DAVID_HIGHLIGHT_COLOR_R
+  unset DAVID_HIGHLIGHT_COLOR_G
+  unset DAVID_HIGHLIGHT_COLOR_B
+  unset DAVID_DISPLAY_PVNAME
+  unset DAVID_NO_VIEW
+  unset DAVID_EPSILON_3D
+  
+  # OpenGL
+  unset G4VIS_BUILD_OPENGLX_DRIVER
+  unset G4VIS_BUILD_OPENGLXM_DRIVER
+  unset G4VIS_USE_OPENGLX
+  unset G4VIS_USE_OPENGLXM
+  unset OGLHOME
+  unset OGLLIBS
+
+  # OpenInventor
+  #unset G4VIS_USE_OPENINVENTOR
+
+  # VRML1
+  unset G4VIS_BUILD_VRML_DRIVER
+  unset G4VIS_BUILD_VRMLFILE_DRIVER
+  unset G4VIS_USE_VRML
+  unset G4VIS_USE_VRMLFILE             1
+  unset G4VRMLFILE_VIEWER
+  unset G4VRML_HOST_NAME
+
+  # GAG
+  unset G4UI_BUILD_GAG_SESSION
+  unset G4UI_USE_GAG
+  unset MOMOPATH
+
+fi
+
+#
+# OPACS
+#
+if [ $AG4_OPACS ]; then
+  if [ "$VERBOSE" = "YES" ]; then
+    echo "* OPACS..."
+  fi
+  export AG4_VISUALIZE=1
+
+  #
+  # OpenGL: needed by OPACS
+  #
+  export G4VIS_BUILD_OPENGLX_DRIVER=1
+  export G4VIS_USE_OPENGLX=1
+  if [ `uname` = "Linux" ]; then
+    export OGLHOME=/usr/local
+    export OGLLIBS="-L$OGLHOME/lib -lMesaGLU -lMesaGL"
+  else
+    export OGLHOME=$LHCXX_BASE/OpenGL/pro
+  fi
+    
+  #
+  # OPACS
+  #
+  export G4VIS_BUILD_OPACS_DRIVER=1
+  export G4UI_BUILD_WO_DRIVER=1
+  export G4UI_BUILD_WO_SESSION=1
+  export G4VIS_USE_OPACS=1
+  export G4UI_USE_WO=1
+  export OPACS_HOME=$G4_BASE/tools/OPACS
+  #export OPACS_HOME=/afs/cern.ch/rd44/dev/OPACS
+  if [ "$SYSTEM" = "Linux" ]; then
+    export G4_OPACS_WIDGET_SET=lesstif
+  else
+    export G4_OPACS_WIDGET_SET=Xm
+  fi
+  . $OPACS_HOME/OPACS/v3/setup.sh
+  export WOENVIRONMENT=$AG4_INSTALL/bin/Alice.odb
+  export OPATH="$OPATH $G4INSTALL/environments/OPACS/usr"
+  if [ "$VERBOSE" = "YES" ]; then
+    if [ $G4VIS_USE_OPACS ]; then
+      echo "  OPACS driver activated"
+      echo "  OPACS path set to $OPACS_HOME"
+    fi
+  fi
+else   
+  if [ "$VERBOSE" = "YES" ]; then
+    echo "* Unsetting OPACS driver env. variables ..."
+  fi
+  unset G4VIS_BUILD_OPACS_DRIVER
+  unset G4UI_BUILD_WO_DRIVER
+  unset G4UI_BUILD_WO_SESSION
+  unset G4VIS_USE_OPACS
+  unset G4UI_USE_WO
+  unset OPACS_HOME
+  unset G4_OPACS_WIDGET_SET
+  unset G4OROOT
+  unset WOENVIRONMENT
+  unset OPATH
+fi
+
+#
+# path to Alice executable and config scripts
+#  
+if [ "`echo ${PATH} | grep ${AG4_INSTALL}/bin/${G4SYSTEM} `" = "" ]; then
+  if [ "$VERBOSE" = "YES" ]; then
+    echo Adding $AG4_INSTALL/bin/$G4SYSTEM to the path...
+  fi
+  export PATH=$PATH:$AG4_INSTALL/bin/$G4SYSTEM
+fi
+if [ "`echo ${PATH} | grep ${AG4_INSTALL}/config `" = "" ]; then
+  if [ "$VERBOSE" = "YES" ]; then
+    echo Adding ${AG4_INSTALL}/config to the path...
+  fi
+  export PATH=${PATH}:${AG4_INSTALL}/config
+fi
+
+#
+# path to shared libraries
+# 
+if [ "$SYSTEM" = "HP-UX" ]; then
+  SHLIBVAR=$SHLIB_PATH
+  SHLIBVARNAME=SHLIB_PATH
+fi  
+if [ "$SYSTEM" = "Linux" ]; then
+  SHLIBVAR=$LD_LIBRARY_PATH
+  SHLIBVARNAME=LD_LIBRARY_PATH
+fi
+if [ "`echo ${SHLIBVAR} | grep ${AG4_INSTALL}/lib/${G4SYSTEM} `" = "" ]; then
+  if [ "$VERBOSE" = "YES" ]; then
+    echo Adding ${AG4_INSTALL}/lib/${G4SYSTEM} to the shared libraries path...
+  fi
+  SHLIBVAR="${AG4_INSTALL}/lib/${G4SYSTEM}:${SHLIBVAR}"
+fi
+
+if [ "`echo ${SHLIBVAR} | grep ${G4INSTALL}/lib/${G4SYSTEM} `" = "" ]; then
+  if [ "$VERBOSE" = "YES" ]; then
+    echo Adding ${G4INSTALL}/lib/${G4SYSTEM} to the shared libraries path...
+  fi
+  SHLIBVAR="${G4INSTALL}/lib/${G4SYSTEM}:${SHLIBVAR}"
+fi
+
+export $SHLIBVARNAME=$SHLIBVAR
+
+
+#
+# Remove unneeded variables. If this is not done the vars. remain in the env.
+#
+
+unset ALICE_BASE
+unset G4_BASE
+unset LHCXX_BASE
+unset OBJY_BASE
+unset SYSTEM
+unset NCLASSPATH
+unset SHLIBVAR
+unset SHLIBVARNAME
+unset LOCAL
+unset VERBOSE
+
+echo "Default ALICE environment for GEANT4 has been set."
diff --git a/AliGeant4/config/test_create.sh b/AliGeant4/config/test_create.sh
new file mode 100755 (executable)
index 0000000..d1d2806
--- /dev/null
@@ -0,0 +1,98 @@
+# $Id$
+# ----------------------------------------------------------------
+# This script generates test macros for all versions of
+# one detector if it specified or for all detectors otherwise
+# with specified (or default) test event generator 
+# in macro/DDD/test
+#
+# Usage: test_create.sh detName [-g genNumber] [-v visNumber]
+#                      for all detectors: detName = ALL
+#
+# 5.11.99  I. Hrivnacova
+
+# check input parameters
+if [ $# -lt 1 ]; then
+  echo "Usage: "
+  echo "test_create.sh detName [-g genNumber] [-v visNumber]"
+  echo "                 for all detectors: detName = ALL"
+  exit
+fi
+
+# default parameters
+DIR=$1
+GEN="0"
+VIS="0"
+
+# get input parameters
+for param in $*
+do
+  case $param in
+    -g) GEN=$3; shift 2;;
+    -v) VIS=$3; shift 2;;
+  esac
+done
+
+CURDIR=`pwd`
+SRC=$ALICE_ROOT
+TO=$AG4_INSTALL/"test"
+MAX=10
+
+# create destination directory if it does not exist
+if [ ! -d $TO ] ; then    
+  mkdir $TO
+  cd $TO
+  mkdir CASTOR FMD ITS MUON PHOS PMD RICH START STRUCT TOF TPC TRD ZDC
+  cd STRUCT
+  mkdir ABSO BODY DIPO FRAME HALL MAG PIPE SHIL
+fi  
+
+cd $SRC
+if [ "$DIR" = "ALL" ]; then
+# loop over all detectors if det is not specified
+  for DIR in `ls`; do
+    if [ -d $DIR ] ; then
+      cd $SRC/$DIR
+      VER=0
+      until [ "$VER" = "$MAX" ] ; do
+        if [ -f "Ali"$DIR"v"$VER".cxx" ]; then
+          echo "test_create_in.sh $DIR v$VER test$GEN$VIS"
+          test_create_in.sh $DIR -d $VER -g $GEN -v $VIS
+        fi
+        let VER=$VER+1
+      done 
+      cd $SRC    
+    fi  
+  done
+else
+
+# loop over all structures
+  if [ "$DIR" = "STRUCT" ]; then
+    cd $TO/$DIR
+    for MODULE in `ls`; do
+      VER=0
+      until [ "$VER" = "$MAX" ] ; do
+        if [ -f $SRC/$DIR/"Ali"$MODULE"v"$VER".cxx" ]; then
+          echo "test_create_struct.sh $MODULE v$VER test$GEN$VIS"
+          test_create_struct.sh $MODULE -d $VER -g $GEN -v $VIS
+       fi  
+        let VER=$VER+1
+      done
+    done
+  else
+  
+# specified detector only
+    if [ -d $SRC/$DIR ] ; then    
+    cd $SRC/$DIR
+    VER=0
+      until [ "$VER" = "$MAX" ] ; do
+        if [ -f "Ali"$DIR"v"$VER".cxx" ]; then
+          echo "test_create_in.sh $DIR v$VER test$GEN$VIS"
+          test_create_in.sh $DIR -d $VER -g $GEN -v $VIS
+        fi
+        let VER=$VER+1
+      done 
+      cd $TO     
+    fi
+  fi    
+fi
+cd $CURDIR
diff --git a/AliGeant4/config/test_create_in.sh b/AliGeant4/config/test_create_in.sh
new file mode 100755 (executable)
index 0000000..4faaf7d
--- /dev/null
@@ -0,0 +1,76 @@
+# $Id$
+# ----------------------------------------------------------------
+# This script generates test macro for a specified
+# detector and its version number with specified
+# (or default) test event generator in macro/DDD/test
+#
+# In order to prevent from unwanted rewriting of the generator
+# it is created only in case it does not yet exist.
+#
+# Usage: 
+# create_test_in.sh detName [-d detVersionNumber] [-g genNumber] [-v visNumber]
+#
+# 5.11.99,  I.Hrivnacova
+
+# check input parameters
+if [ $# -lt 1 ]; then
+  echo "Usage: "
+  echo "create_test_in.sh detName [-d detVersionNumber] [-g genNumber] [-v visNumber]"
+  exit
+fi
+
+# default parameters
+DIR=$1
+VER="0"
+GEN="0"
+VIS="0"
+
+# get input parameters
+for param in $*
+do
+  case $param in
+    -d) VER=$3; shift 2;;
+    -g) GEN=$3; shift 2;;
+    -v) VIS=$3; shift 2;;
+  esac
+done
+
+CURDIR=`pwd`
+
+SRC=$ALICE_ROOT
+TO=$AG4_INSTALL/"test"
+
+# test if corresponding version order number
+# is defined
+cd $SRC/$DIR
+IS_VERSION="NO"
+if [ -f "Ali"$DIR"v"$VER".cxx" ]; then
+  IS_VERSION="YES"
+else
+  if [ -f "Ali"$DIR".cxx" && "$VER" = "0" ]; then
+    IS_VERSION="YES" 
+  fi  
+fi
+if [ "$IS_VERSION" = "NO" ]; then
+  cd $CURDIR
+  exit;
+fi       
+cd $TO  
+
+# create basic test macro
+if [ "$VIS" = "0" ]; then 
+  cat $AG4_INSTALL/config/test_default_det_novis.in | sed s/NNN/$VER/g | sed s/WWW/$VER/g | sed s/GGG/$GEN/g |  sed s/VVV/$VIS/g | sed s/XXX/$DIR/g > $TO/$DIR"/v"$VER"_test"$GEN""$VIS".in"
+else
+  cat $AG4_INSTALL/config/test_default_det_vis.in | sed s/NNN/$VER/g | sed s/WWW/$VER/g | sed s/GGG/$GEN/g |  sed s/VVV/$VIS/g | sed s/XXX/$DIR/g > $TO/$DIR"/v"$VER"_test"$GEN""$VIS".in"
+# create visualisation macro (if it does not yet exist)
+  if [ ! -f $TO/$DIR/vis_test$VIS".in" ]; then
+    cp $AG4_INSTALL/config/test_default_vis$VIS.in $TO/$DIR/vis_test$VIS.in
+  fi
+fi  
+
+# create generator macro (if it does not yet exist)
+if [ ! -f $TO/$DIR/gen_test$GEN".in" ]; then
+  cp $AG4_INSTALL/config/test_default_gen$GEN.in $TO/$DIR/gen_test$GEN.in
+fi
+
+cd $CURDIR
diff --git a/AliGeant4/config/test_create_struct.sh b/AliGeant4/config/test_create_struct.sh
new file mode 100755 (executable)
index 0000000..be5ed63
--- /dev/null
@@ -0,0 +1,76 @@
+# $Id$
+# ----------------------------------------------------------------
+# This script generates test macro for a specified
+# module and its version number with specified
+# (or default) test event generator in macro/STRUCT/test/MODULE
+#
+# In order to prevent from unwanted rewriting of the generator
+# it is created only in case it does not yet exist.
+#
+# Usage: 
+# test_create_struct.sh modName [-d modVersionNumber] [-g genNumber] [-v visNumber]
+#
+# 5.11.99,  I.Hrivnacova
+
+# check input parameters
+if [ $# -lt 1 ]; then
+  echo "Usage: "
+  echo "test_create_struct.sh modName [-d modVersionNumber] [-g genNumber] [-v visNumber]"
+  exit
+fi
+
+# default parameters
+MOD=$1
+VER="0"
+GEN="0"
+VIS="0"
+
+# get input parameters
+for param in $*
+do
+  case $param in
+    -d) VER=$3; shift 2;;
+    -g) GEN=$3; shift 2;;
+    -v) VIS=$3; shift 2;;
+  esac
+done
+
+CURDIR=`pwd`
+
+SRC=$ALICE_ROOT/STRUCT
+TO=$AG4_INSTALL/"test"/STRUCT
+
+# test if corresponding version order number
+# is defined
+cd $SRC
+IS_VERSION="NO"
+if [ -f "Ali"$MOD"v"$VER".cxx" ]; then
+  IS_VERSION="YES"
+else
+  if [ -f "Ali"$MOD".cxx" && "$VER" = "0" ]; then
+    IS_VERSION="YES" 
+  fi  
+fi
+if [ "$IS_VERSION" = "NO" ]; then
+  cd $CURDIR
+  exit;
+fi       
+cd $TO  
+
+# create basic test macro
+if [ "$VIS" = "0" ]; then 
+  cat $AG4_INSTALL/config/test_default_det_novis.in | sed s/NNN/$VER/g | sed s/WWW/$VER/g | sed s/GGG/$GEN/g |  sed s/VVV/$VIS/g | sed s/XXX/$MOD/g > $TO/$MOD"/v"$VER"_test"$GEN""$VIS".in"
+else
+  cat $AG4_INSTALL/config/test_default_det_vis.in | sed s/NNN/$VER/g | sed s/WWW/$VER/g | sed s/GGG/$GEN/g |  sed s/VVV/$VIS/g | sed s/XXX/$MOD/g > $TO/$MOD"/v"$VER"_test"$GEN""$VIS".in"
+# create visualisation macro (if it does not yet exist)
+  if [ ! -f $TO/$MOD/vis_test$VIS".in" ]; then
+    cp $AG4_INSTALL/config/test_default_vis$VIS.in $TO/$MOD/vis_test$VIS.in
+  fi
+fi  
+
+# create generator macro (if it does not yet exist)
+if [ ! -f $TO/$MOD/gen_test$GEN".in" ]; then
+  cp $AG4_INSTALL/config/test_default_gen$GEN.in $TO/$MOD/gen_test$GEN.in
+fi
+
+cd $CURDIR
diff --git a/AliGeant4/config/test_default_det_novis.in b/AliGeant4/config/test_default_det_novis.in
new file mode 100644 (file)
index 0000000..5ae5fc1
--- /dev/null
@@ -0,0 +1,19 @@
+# $Id$
+#
+# XXXvWWW
+#
+# basic one module test 
+# with specified test event generator
+# without visualization 
+
+/aliDet/switchOn XXXNNN
+/aliRun/initialize
+#/aliDet/body/listLong
+
+/control/execute gen_testGGG.in
+
+#/tracking/verbose 1
+/aliRun/beamOn 1
+
+/control/exit
+exit
diff --git a/AliGeant4/config/test_default_det_vis.in b/AliGeant4/config/test_default_det_vis.in
new file mode 100644 (file)
index 0000000..b2cf89b
--- /dev/null
@@ -0,0 +1,33 @@
+# $Id$
+#
+# XXXvWWW
+#
+# basic one module test 
+# with specified test event generator
+# and visualization 
+
+/aliDet/switchOn XXXNNN
+/aliRun/initialize
+/aliDet/body/listLong
+
+# generator
+/control/execute gen_testGGG.in
+
+/vis~/create_view/new_graphics_system DAWN
+#/vis~/create_view/new_graphics_system OPACS
+#/vis~/create_view/new_graphics_system OGLIX
+
+# module visualization
+/control/execute vis_testVVV.in
+
+/vis~/draw/current
+/vis~/show/view
+
+/tracking/verbose 1
+/tracking/storeTrajectory 1
+/aliEvent/drawTracks ALL
+
+/aliRun/beamOn 1
+
+/control/exit
+exit
diff --git a/AliGeant4/config/test_default_gen0.in b/AliGeant4/config/test_default_gen0.in
new file mode 100644 (file)
index 0000000..7de9533
--- /dev/null
@@ -0,0 +1,11 @@
+# $Id$
+#
+# basic one geantino generator (test0)
+# (geantino from center in x direction) 
+
+/aliGenerator/set Gun
+/aliGun/direction  1 0 0
+/aliGun/addParticle
+/aliGun/list
+
+/tracking/verbose 1
diff --git a/AliGeant4/config/test_default_gen1.in b/AliGeant4/config/test_default_gen1.in
new file mode 100644 (file)
index 0000000..76e2434
--- /dev/null
@@ -0,0 +1,5 @@
+# $Id$
+# aliroot generator (test1)
+
+/aliGenerator/set AliGenerator
+#
diff --git a/AliGeant4/config/test_default_gen2.in b/AliGeant4/config/test_default_gen2.in
new file mode 100644 (file)
index 0000000..4087991
--- /dev/null
@@ -0,0 +1,5 @@
+# $Id$
+# empty generator - no particles are shooted (test2)
+
+/aliGun/reset
+#
diff --git a/AliGeant4/config/test_default_gen3.in b/AliGeant4/config/test_default_gen3.in
new file mode 100644 (file)
index 0000000..b605a60
--- /dev/null
@@ -0,0 +1,9 @@
+# $Id$
+# basic random geantino generator (test3)
+
+/aliGenerator/set Geantino
+/aliGenerator/nofParticles 10
+/aliGun/list
+
+/tracking/verbose 1
+#
diff --git a/AliGeant4/config/test_default_gen4.in b/AliGeant4/config/test_default_gen4.in
new file mode 100644 (file)
index 0000000..ae3b2cd
--- /dev/null
@@ -0,0 +1,12 @@
+# $Id$
+#
+# special lego run
+
+/aliGenerator/set AliGenerator
+/aliEvent/verbose 0
+/aliRun/lego
+
+/g4mc/rootMacro legoSave
+
+/control/exit
+exit
diff --git a/AliGeant4/config/test_default_vis1.in b/AliGeant4/config/test_default_vis1.in
new file mode 100644 (file)
index 0000000..c07e5c8
--- /dev/null
@@ -0,0 +1,4 @@
+# $Id$
+#
+# default visualization macro
+# for module specific options
diff --git a/AliGeant4/config/test_run.sh b/AliGeant4/config/test_run.sh
new file mode 100755 (executable)
index 0000000..2068f58
--- /dev/null
@@ -0,0 +1,89 @@
+# $Id$
+# ----------------------------------------------------------------
+# This script runs specified (or default) test macros 
+# for all versions of one detector if it specified 
+# or for all detectors otherwise
+#
+# Usage: test_run.sh detName [-g genNumber] [-v visNumber]
+#                      for all detectors: detName = ALL
+#
+# 5.11.99  I. Hrivnacova
+
+# check input parameters
+if [ $# -lt 1 ]; then
+  echo "Usage: "
+  echo "test_run.sh detName [-g genNumber] [-v visNumber]"
+  echo "               for all detectors: detName = ALL"
+  exit
+fi
+
+# default parameters
+DIR=$1
+GEN="0"
+VIS="0"
+
+# get input parameters
+for param in $*
+do
+  case $param in
+    -g) GEN=$3; shift 2;;
+    -v) VIS=$3; shift 2;;
+  esac
+done
+
+CURDIR=`pwd`
+SRC=$ALICE_ROOT
+TO=$AG4_INSTALL/"test"
+MAX=10
+
+cd $TO
+if [ "$DIR" = "ALL" ]; then
+# loop over all detectors if det is not specified
+  for DIR in `ls`; do
+    if [ -d $DIR ] ; then
+      cd $TO/$DIR
+      VER=0
+      until [ "$VER" = "$MAX" ] ; do
+        if [ -f "v"$VER"_test"$GEN""$VIS".in" ] ; then
+          echo "test_run_in.sh $DIR v$VER test$GEN$VIS"
+          test_run_in.sh $DIR -d $VER -g $GEN -v $VIS
+        fi
+        let VER=$VER+1
+      done 
+      cd $TO
+    fi       
+  done
+else
+
+# loop over all structures
+  if [ "$DIR" = "STRUCT" ]; then
+    cd $TO/$DIR
+    for MODULE in `ls`; do
+      VER=0
+      until [ "$VER" = "$MAX" ] ; do
+        if [ -f $MODULE/"v"$VER"_test"$GEN""$VIS".in" ]; then
+          echo "test_run_struct.sh $MODULE v$VER test$GEN$VIS"
+          test_run_struct.sh $MODULE -d $VER -g $GEN -v $VIS
+       fi  
+        let VER=$VER+1
+      done
+    done
+  else
+  
+# run for specified detector only
+    if [ -d $DIR ] ; then
+      cd $TO/$DIR
+      VER=0
+      until [ "$VER" = "$MAX" ] ; do
+        if [ -f "v"$VER"_test"$GEN""$VIS".in" ] ; then
+          echo "test_run_in.sh $DIR v$VER test$GEN$VIS"
+          test_run_in.sh $DIR -d $VER -g $GEN -v $VIS
+        fi
+        let VER=$VER+1
+      done 
+      cd $TO
+    fi       
+  fi  
+fi
+
+cd $CURDIR
diff --git a/AliGeant4/config/test_run_in.sh b/AliGeant4/config/test_run_in.sh
new file mode 100755 (executable)
index 0000000..f5c1338
--- /dev/null
@@ -0,0 +1,78 @@
+# $Id$
+# ----------------------------------------------------------------
+# This script runs the specified (or default) test macro 
+# for a specified detector and its version number
+# in macro/DDD/test
+#
+# Usage: 
+# test_run_in.sh detName [-d detVersionNumber] [-g genNumber] [-v visNumber]
+#
+# 5.11.99,  I.Hrivnacova
+
+# check input parameters
+if [ $# -lt 1 ]; then
+  echo "Usage: "
+  echo "test_run_in.sh detName [-d detVersionNumber] [-g genNumber] [-v visNumber]"
+  exit
+fi
+
+# default parameters
+DIR=$1
+VER="0"
+GEN="0"
+VIS="0"
+
+# get input parameters
+for param in $*
+do
+  case $param in
+    -d) VER=$3; shift 2;;
+    -g) GEN=$3; shift 2;;
+    -v) VIS=$3; shift 2;;
+  esac
+done
+
+CURDIR=`pwd`
+TO=$AG4_INSTALL/"test"
+
+# go to detector test directory
+cd $TO/$DIR
+
+# remove old output files if exist
+if [ -f "v"$VER"_test"$GEN""$VIS".out" ]; then
+  rm "v"$VER"_test"$GEN""$VIS".out"
+fi  
+if [ -f "v"$VER"_test"$GEN""$VIS".err" ]; then
+  rm "v"$VER"_test"$GEN""$VIS".err"
+fi  
+
+# run aligeant4
+aligeant4 "v"$VER"_test"$GEN""$VIS".in" > "v"$VER"_test"$GEN""$VIS".out" 2> "v"$VER"_test"$GEN""$VIS".err"
+
+# check if aligeant4 ran successfully
+if [ $? -ne 0 ]; then
+  echo "   !!! ERROR: Test v"$VER"_test"$GEN""$VIS" in "$DIR 
+fi  
+# rename galice.root
+if [ -f galice.root ]; then
+  mv galice.root "v"$VER"_test"$GEN""$VIS".root"
+fi
+# rename gif lego plots if they were created
+if [ -f gcm2.gif ]; then
+  mv gcm2.gif "v"$VER"_gcm2.gif"
+fi
+if [ -f etar.gif ]; then
+  mv etar.gif "v"$VER"_etar.gif"
+fi
+if [ -f radl.gif ]; then
+  mv radl.gif "v"$VER"_radl.gif"
+fi
+if [ -f abso.gif ]; then
+  mv abso.gif "v"$VER"_abso.gif"
+fi
+# rename g4.prim if it was created
+if [ -f g4.prim ]; then
+  mv g4.prim "v"$VER"_test"$GEN""$VIS".prim"
+fi
+
+cd $CURDIR
diff --git a/AliGeant4/config/test_run_struct.sh b/AliGeant4/config/test_run_struct.sh
new file mode 100755 (executable)
index 0000000..58d2e53
--- /dev/null
@@ -0,0 +1,61 @@
+# $Id$
+# ----------------------------------------------------------------
+# This script runs the specified (or default) test macro 
+# for a specified STRUCT module and its version number
+# in aliroot/STRUCT/test/MODULE
+#
+# Usage: 
+# test_run_struct.sh modName [-d detVersionNumber] [-g genNumber] [-v visNumber]
+#
+# 5.11.99,  I.Hrivnacova
+
+# check input parameters
+if [ $# -lt 1 ]; then
+  echo "Usage: "
+  echo "test_run_struct.sh modName [-d detVersionNumber] [-g genNumber] [-v visNumber]"
+  exit
+fi
+
+# default parameters
+MOD=$1
+VER="0"
+GEN="0"
+VIS="0"
+
+# get input parameters
+for param in $*
+do
+  case $param in
+    -d) VER=$3; shift 2;;
+    -g) GEN=$3; shift 2;;
+    -v) VIS=$3; shift 2;;
+  esac
+done
+
+CURDIR=`pwd`
+TO=$AG4_INSTALL/"test"
+
+# go to detector test directory
+cd $TO/STRUCT/$MOD
+
+# remove old output files if exist
+if [ -f "v"$VER"_test"$GEN""$VIS".out" ]; then
+  rm "v"$VER"_test"$GEN""$VIS".out"
+fi  
+if [ -f "v"$VER"_test"$GEN""$VIS".err" ]; then
+  rm "v"$VER"_test"$GEN""$VIS".err"
+fi  
+
+# run aligeant4
+aligeant4 "v"$VER"_test"$GEN""$VIS".in" > "v"$VER"_test"$GEN""$VIS".out" 2> "v"$VER"_test"$GEN""$VIS".err"
+
+# check if aligeant4 ran successfully
+if [ $? -ne 0 ]; then
+  echo "   !!! ERROR: Test v"$VER"_test"$GEN""$VIS" in "$MOD 
+fi  
+# rename g4.prim if it was created
+if [ -f g4.prim ]; then
+  mv g4.prim "v"$VER"_test"$GEN""$VIS".prim"
+fi
+
+cd $CURDIR
diff --git a/AliGeant4/doc/CodePrototype.html b/AliGeant4/doc/CodePrototype.html
new file mode 100644 (file)
index 0000000..ef7d968
--- /dev/null
@@ -0,0 +1,117 @@
+<HTML>
+
+<HEAD>
+<TITLE>ALICE G4 Simulation - Code Prototype</TITLE></HEAD>
+
+<BODY bgcolor=#FFFFFF>
+
+<!-- Header material -->
+<hr>
+<table border=0   cellpadding=5 cellspacing=0 width="100%">
+  <tr bgcolor=#d0ffd0>
+      <td align=left width=30%>
+      <img alt="Alice" 
+           src="http://AliSoft.cern.ch/offline/geant4/gif/AliceLogo.gif" 
+          width="60" height="60" align="absmiddle" border=1>
+         <td align=center width=40%>
+           ALICE Geant4 Simulation <br>
+          <font size="+2">
+          Code Prototype
+      </font>
+      <td align=right width=30% valign=bottom> 
+          <font size="-1">
+           <script language="JavaScript">
+           document.write("Last modified "+ document.lastModified)
+           // end of script -->
+           </script></font>
+      </TD>
+  </TR>
+</TABLE>
+<HR>
+
+<UL>
+
+<LI><STRONG>ALICE Geant4 specific classes (AliGeant4):</STRONG>
+    <UL>
+    <LI><A HREF="CodePrototype/AliGeant4_geometryCategory.html">geometry</A>
+    <LI><A HREF="CodePrototype/AliGeant4_physicsCategory.html">physics</A>
+    <LI><A HREF="CodePrototype/AliGeant4_eventCategory.html">event</A>
+    <LI><A HREF="CodePrototype/AliGeant4_runCategory.html">run</A>
+    <LI><A HREF="CodePrototype/AliGeant4_globalCategory.html">global</A>
+    <LI><A HREF="CodePrototype/AliGeant4_visualizationCategory.html">visualization</A>
+    </UL>
+    <br>
+
+<LI><STRONG>Geant4 Monte Carlo interface implementation (TGeant4):</STRONG>
+    <UL>
+    <LI><A HREF="CodePrototype/TGeant4_geometryCategory.html">geometry</A>
+    <LI><A HREF="CodePrototype/TGeant4_physicsCategory.html">physics</A>
+    <LI><A HREF="CodePrototype/TGeant4_eventCategory.html">event</A>
+    <LI><A HREF="CodePrototype/TGeant4_runCategory.html">run</A>
+    <LI><A HREF="CodePrototype/TGeant4_globalCategory.html">global</A>
+    <LI><A HREF="CodePrototype/TGeant4_visualizationCategory.html">visualization</A>
+    </UL>
+    <br>
+
+<!--
+<LI><STRONG>AliRoot (aliroot):</STRONG><br>
+    imported from AliRoot package
+    <UL>
+    <LI><A HREF="CodePrototype/aliroot_STEERCategory.html"> STEER </A>
+    <LI><A HREF="CodePrototype/aliroot_TGeant3Category.html"> TGeant3 </A>
+    <LI><A HREF="CodePrototype/aliroot_CASTORCategory.html"> CASTOR </A>
+    <LI><A HREF="CodePrototype/aliroot_FMDCategory.html"> FMD </A>
+    <LI><A HREF="CodePrototype/aliroot_ITSCategory.html"> ITS </A>
+    <LI><A HREF="CodePrototype/aliroot_MUONCategory.html"> MUON </A>
+    <LI><A HREF="CodePrototype/aliroot_PHOSCategory.html"> PHOS </A>
+    <LI><A HREF="CodePrototype/aliroot_PMDCategory.html"> PMD </A>
+    <LI><A HREF="CodePrototype/aliroot_RICHCategory.html"> RICH </A>
+    <LI><A HREF="CodePrototype/aliroot_STARTCategory.html"> START </A>
+    <LI><A HREF="CodePrototype/aliroot_STRUCTCategory.html"> STRUCT </A>
+    <LI><A HREF="CodePrototype/aliroot_TOFCategory.html"> TOF </A>
+    <LI><A HREF="CodePrototype/aliroot_TPCCategory.html"> TPC </A>
+    <LI><A HREF="CodePrototype/aliroot_TRDCategory.html"> TRD </A>
+    <LI><A HREF="CodePrototype/aliroot_ZDCCategory.html"> ZDC </A>
+    </UL>
+    <br>
+-->
+<P><P>
+    
+<LI><STRONG>All classes:</STRONG>
+    <UL>
+    <LI><A HREF="CodePrototype/index.html">alphabetical index</A>
+    </UL>      
+
+<P><HR><P>
+
+<LI><STRONG>Main program:</STRONG>
+  <UL>
+  <LI><A HREF="CodePrototype/Alice.C.html">Alice.C</A>
+  </UL>
+
+<P><HR><P>
+
+<LI><STRONG>Configuration files:</STRONG>
+  <UL>
+  <LI><A HREF="CodePrototype/setup.sh">setup.sh</A>
+  <LI><A HREF="CodePrototype/setup.csh">setup.csh</A>
+  </UL>
+
+</UL>
+
+<P><HR SIZE=5><P>
+
+<ADDRESS>
+Created on Wed Jan 13 1999 by <B>Ivana Hrivnacova</B> <BR>
+using the HTML generator
+<A HREF="http://wwwcn1.cern.ch/~binko/Ddl2Html/Ddl2Html.html">Ddl2Html description</A>
+ (the source <A HREF="http://wwwcn1.cern.ch/~binko/Ddl2Html/Ddl2Html.code">Perl5 code</A>)
+</ADDRESS>
+
+<br>
+Back to: 
+<A HREF="Main.html">
+ALICE G4 Simulation home, </A>
+</BODY bgcolor=#FFFFFF >
+
+</HTML>
diff --git a/AliGeant4/doc/G4CodePrototype.html b/AliGeant4/doc/G4CodePrototype.html
new file mode 100644 (file)
index 0000000..86357b3
--- /dev/null
@@ -0,0 +1,203 @@
+<HTML>
+
+<HEAD>
+<TITLE>ALICE G4 Simulation - Geant4 Code</TITLE></HEAD>
+
+<BODY bgcolor=#FFFFFF>
+
+<!-- Header material -->
+<hr>
+<table border=0   cellpadding=5 cellspacing=0 width="100%">
+  <tr bgcolor=#d0ffd0>
+      <td align=left width=30%>
+      <img alt="Alice" 
+           src="http://AliSoft.cern.ch/offline/geant4/gif/AliceLogo.gif" 
+          width="60" height="60" align="absmiddle" border=1>
+         <td align=center width=40%>
+           ALICE Geant4 Simulation <br>
+          <font size="+2">
+          Geant4 Code
+      </font>
+      <td align=right width=30% valign=bottom> 
+          <font size="-1">
+           <script language="JavaScript">
+           document.write("Last modified "+ document.lastModified)
+           // end of script -->
+           </script></font>
+      </TD>
+  </TR>
+</TABLE>
+<HR>
+
+<P>
+Geant4 categories and sub-categories (in one level only):
+</p>
+
+<UL>
+<LI><STRONG>digits+hits</STRONG>
+    <UL>
+    <LI><A HREF="G4CodePrototype/digits+hits_detectorCategory.html">detector</A>
+    <LI><A HREF="G4CodePrototype/digits+hits_digitsCategory.html">digits</A>
+    <LI><A HREF="G4CodePrototype/digits+hits_hitsCategory.html">hits</A>
+    </UL>
+    <br>
+<LI><STRONG>event</STRONG>
+    <UL>
+    <LI><A HREF="G4CodePrototype/event_Category.html">event</A>
+    </UL>
+    <br>
+<LI><STRONG>geometry</STRONG>
+    <UL>
+    <LI><A HREF="G4CodePrototype/geometry_benchmarksCategory.html">benchmarks</A>
+    <LI><A HREF="G4CodePrototype/geometry_magneticfieldCategory.html">magneticfield</A>
+    <LI><A HREF="G4CodePrototype/geometry_managementCategory.html">management</A>
+    <LI><A HREF="G4CodePrototype/geometry_solidsCategory.html">solids</A>
+    <LI><A HREF="G4CodePrototype/geometry_volumesCategory.html">volumes</A>
+    </UL>
+    <br>
+<LI><STRONG>global</STRONG>
+    <UL>
+    <LI><A HREF="G4CodePrototype/global_HEPGeometryCategory.html">HEPGeometry</A>
+    <LI><A HREF="G4CodePrototype/global_HEPNumericsCategory.html">HEPNumerics</A>
+    <LI><A HREF="G4CodePrototype/global_HEPRandomCategory.html">HEPRandom</A>
+    <LI><A HREF="G4CodePrototype/global_STLInterfaceCategory.html">STLInterface</A>
+    <LI><A HREF="G4CodePrototype/global_managementCategory.html">management</A>
+    </UL>
+    <br>
+<LI><STRONG>graphics_reps</STRONG>
+    <UL>
+    <LI><A HREF="G4CodePrototype/graphics_reps_Category.html">graphics_reps</A>
+    </UL>
+    <br>
+<LI><STRONG>intercoms</STRONG>
+    <UL>
+    <LI><A HREF="G4CodePrototype/intercoms_Category.html">intercoms</A>
+    </UL>
+    <br>
+<LI><STRONG>interfaces</STRONG>
+    <UL>
+    <LI><A HREF="G4CodePrototype/interfaces_GAGCategory.html">GAG</A>
+    <LI><A HREF="G4CodePrototype/interfaces_OPACSCategory.html">OPACS</A>
+    <LI><A HREF="G4CodePrototype/interfaces_XVTCategory.html">XVTCategory</A>
+    <LI><A HREF="G4CodePrototype/interfaces_basicCategory.html">basic</A>
+    <LI><A HREF="G4CodePrototype/interfaces_commonCategory.html">common</A>
+    </UL>
+    <br>
+<LI><STRONG>materials</STRONG>
+    <UL>
+    <LI><A HREF="G4CodePrototype/materials_Category.html">materials</A>
+    </UL>
+    <br>
+<LI><STRONG>messengers</STRONG>
+    <UL>
+    <LI><A HREF="G4CodePrototype/messengers_Category.html">intercoms</A>
+    </UL>
+    <br>
+<LI><STRONG>particles</STRONG>
+    <UL>
+    <LI><A HREF="G4CodePrototype/particles_bosonsCategory.html">bosons</A>
+    <LI><A HREF="G4CodePrototype/particles_hadronsCategory.html">hadrons</A>
+    <LI><A HREF="G4CodePrototype/particles_leptonsCategory.html">leptons</A>
+    <LI><A HREF="G4CodePrototype/particles_managementCategory.html">management</A>
+    <LI><A HREF="G4CodePrototype/particles_shortlivedCategory.html">shortlived</A>
+    </UL>
+    <br>
+<LI><STRONG>processes</STRONG>
+    <UL>
+    <LI><A HREF="G4CodePrototype/processes_decayCategory.html">processes_decay</A>
+    <LI><A HREF="G4CodePrototype/processes_electromagneticCategory.html">processes_electromagnetic</A>
+    <LI><A HREF="G4CodePrototype/processes_hadronicCategory.html">processes_hadronic</A>
+    <LI><A HREF="G4CodePrototype/processes_managementCategory.html">processes_management</A>
+    <LI><A HREF="G4CodePrototype/processes_opticalCategory.html">processes_optical</A>
+    <LI><A HREF="G4CodePrototype/processes_parameterisationCategory.html">processes_parameterisation</A>
+    <LI><A HREF="G4CodePrototype/processes_photolepton_hadronCategory.html">processes_photolepton_hadron</A>
+    <LI><A HREF="G4CodePrototype/processes_transportationCategory.html">processes_transportation</A>
+    </UL>
+    <br>
+<LI><STRONG>readout</STRONG>
+    <UL>
+    <LI><A HREF="G4CodePrototype/readout_Category.html">readout</A>
+    </UL>
+    <br>
+<LI><STRONG>run</STRONG>
+    <UL>
+    <LI><A HREF="G4CodePrototype/run_Category.html">run</A>
+    </UL>
+    <br>
+<LI><STRONG>track</STRONG>
+    <UL>
+    <LI><A HREF="G4CodePrototype/track_Category.html">track</A>
+    </UL>
+    <br>
+<LI><STRONG>tracking</STRONG>
+    <UL>
+    <LI><A HREF="G4CodePrototype/tracking_Category.html">tracking</A>
+    </UL>
+    <br>
+<LI><STRONG>visualization</STRONG>
+    <UL>
+    <LI><A HREF="G4CodePrototype/visualization_FukuiRendererCategory.html">FukuiRenderer</A>
+    <LI><A HREF="G4CodePrototype/visualization_OpenGLCategory.html">OpenGL</A>
+    <LI><A HREF="G4CodePrototype/visualization_OpenInventor.html">OpenInventor</A>
+    <LI><A HREF="G4CodePrototype/visualization_OPACSCategory.html">OPACS</A>
+    <LI><A HREF="G4CodePrototype/visualization_VRMLCategory.html">VRML</A>
+    <LI><A HREF="G4CodePrototype/visualization_managementCategory.html">management</A>
+    <LI><A HREF="G4CodePrototype/visualization_modelingCategory.html">modeling</A>
+    </UL>
+    <br>
+<LI><STRONG>g3tog4</STRONG>
+    <UL>
+    <LI><A HREF="G4CodePrototype/g3tog4_Category.html">g3tog4</A>
+    </UL>
+    <br>
+<LI><STRONG>persistency</STRONG>
+    <UL>
+    <LI><A HREF="G4CodePrototype/persistency_digits+hitsCategory.html">digits+hits</A>
+    <LI><A HREF="G4CodePrototype/persistency_eventsCategory.html">events</A>
+    <LI><A HREF="G4CodePrototype/persistency_geometryCategory.html">geometry</A>
+    <LI><A HREF="G4CodePrototype/persistency_globalCategory.html">global</A>
+    <LI><A HREF="G4CodePrototype/persistency_managementCategory.html">management</A>
+    <LI><A HREF="G4CodePrototype/persistency_runCategory.html">run</A>
+    </UL>
+    <br>
+</UL>
+
+<P><P>
+
+<STRONG>All classes:</STRONG>
+    <UL>
+    <LI><A HREF="G4CodePrototype/index.html">alphabetical index</A>
+    </UL>      
+
+<P><HR><P>
+
+<STRONG>Makefiles and configuration files:</STRONG>
+  <UL>
+  <LI><A HREF="G4ODBMS_BUILD.gmk">G4ODBMS_BUILD.gmk</A>
+  <LI><A HREF="G4UI_BUILD.gmk">G4UI_BUILD.gmk</A>
+  <LI><A HREF="G4UI_USE.gmk">G4UI_USE.gmk</A>
+  <LI><A HREF="G4VIS_BUILD.gmk">G4VIS_BUILD.gmk</A>
+  <LI><A HREF="G4VIS_USE.gmk">G4VIS_USE.gmk</A>
+  <LI><A HREF="architecture.gmk">architecture.gmk</A>
+  <LI><A HREF="binmake.gmk">binmake.gmk</A>
+  <LI><A HREF="common.gmk">common.gmk</A>
+  <LI><A HREF="globlib.gmk">globlib.gmk</A>
+  <LI><A HREF="interactivity.gmk">interactivity.gmk</A>
+  </UL>
+
+<P><HR SIZE=5><P>
+
+<ADDRESS>
+Created on Wed Jan 13 1999 by <B>Ivana Hrivnacova</B> <BR>
+using the HTML generator
+<A HREF="http://wwwcn1.cern.ch/~binko/Ddl2Html/Ddl2Html.html">Ddl2Html description</A>
+ (the source <A HREF="http://wwwcn1.cern.ch/~binko/Ddl2Html/Ddl2Html.code">Perl5 code</A>)
+</ADDRESS>
+
+<br>
+Back to: 
+<A HREF="Main.html">
+ALICE G4 Simulation home, </A>
+</BODY bgcolor=#FFFFFF >
+
+</HTML>
diff --git a/AliGeant4/doc/README b/AliGeant4/doc/README
new file mode 100644 (file)
index 0000000..0f7592f
--- /dev/null
@@ -0,0 +1,309 @@
+$Id$
+-----------------------------------------------------------------
+
+Alice CVS Repository
+====================
+   CVSROOT=/afs/cern.ch/alice/offline/ivana/cvsAlice
+   cvs checkout Alice 
+   
+Prototype structure:
+=====================
+   bin     - executables are put into bin/$G4SYSTEM directory;
+             macro files, *.odb 
+   config  - configuration scripts: 
+                setup.sh, setup.csh, objy_boot.sh 
+            makefile scripts: 
+               make_architecture.gmk, make_common.gmk, make_lib.gmk, 
+               make_bin.gmk, make_include.gmk, make_options.gmk, make_base.gmk
+            script for generating HTML documentation:
+               doc_XXc++2html.pl, doc_XXddl2html.pl, doc_XXsorthtml.pl, 
+               doc_XXcategory.pl                     where XX = al, g4
+             scripts for aliroot support:
+               aliroot_cint.sh, aliroot_cintall.sh, aliroot_link.sh,
+               aliroot_import.sh
+            scripts and template files for automatic generation of G4 test 
+            macros:
+               test_create.sh, test_create_in.sh, test_create_struct.sh,
+               test_run.sh, test_run_in.sh, test_run_struct.sh,
+               test_default_det_novis.in, test_default_det_vis.in              
+               test_default_genN.in;       N = 0,1,2,3
+                test_default_visN.in;      N = 1            
+   doc     - README, 
+            README.CodingConvention;
+            CodePrototype.html, G4CodePrototype.html - main code html pages
+             HTML directory is created here by doc_alc++2html.sh script;
+            HTML documentation of Geant4 can be created by doc_g4c++2html.pl
+   lib     - libraries are put into lib/$G4SYSTEM directory;
+   macro   - detector specific root (ported from AliRoot) and G4 macros
+   source  - source code  
+   tmp     - compilation by-products (*.d, *.o, template repository)
+             are put into tmp/$G4SYSTEM directory;          
+
+   Directories lib and tmp are not checkout from cvs - they are created
+   during compilation. 
+   
+Environment variables:
+======================
+  (used when the Alice is compiled; see config/setup.sh)
+
+  AG4_INSTALL
+    the path to the Alice;
+    should be defined in your .zshenv (zsh users) or .login (tcsh users);
+    if not set: the default path to the current directory is set
+
+  AG4_VERSION
+    the Geant4 version;
+    if set: the provided Geant4 version and not the default one is set
+    Deafault: unset
+
+  AG4_VISUALIZE
+    if set: the program is compiled with visualisation (default)
+    Categories affected: 
+       geometry, main, visualization     
+    Default: set 
+    
+  AG4_OPACS    
+    if set: the program is compiled with OPACS visualisation
+    Categories affected: 
+       geometry, main, visualization     
+    Default: unset 
+
+  AG4_STACKING
+    if set: the secondary particles are not tracked immediatelly
+       when they are created but after the urgent stack is exhausted
+    if not set: the G4 default stacking is used
+    Categories affected: event
+    Default: set          
+    
+  AG4_NOPHYSICS
+    if set: only geantino or charged geantino can be shooted  
+    Categories affected: main
+    Default: unset   
+    
+  AG4_ODBMS
+    if set: the environment for using Objectivity is set
+       !!! tested very long time ago only
+    Categories affected: none
+    Default: unset  
+        
+  Default setting:
+  ---------------- 
+  Can be set running the setup.sh script;
+  Check first that AG4_INSTALL variable is set correctly!!
+
+  cd $AG4_INSTALL
+  . config/setup.sh            for zsh  users   
+  source config/setup.csh      for tcsh users (not available yet)
+
+  Supported systems: HP-aCC, Linux-g++.
+  
+  The setup script can be added into the users login scripts:
+  
+  for zsh  users:
+  # can be added to .zshenv
+  # Alice and Geant4 default settings 
+  export AG4_INSTALL=mypath/Alice     
+  . $AG4_INSTALL/config/setup.sh         
+
+  for tcsh users (not available yet)
+  # can be added to .login
+  # Alice and Geant4 default settings 
+  setenv AG4_INSTALL mypath/Alice      
+  source $AG4_INSTALL/config/setup.csh     
+
+Compilation:
+============
+   cd $AG4_INSTALL/source
+   gmake       
+
+Code documentation:
+===================                
+    doc_alc++2html.pl
+       - perl script using Pavel Binko's ddl2html perl script
+         (http://wwwinfo.cern.ch/~binko/Ddl2Html/Ddl2Html.code)
+         for automatic generating of code documentation in html;
+        creates doc/HTML directory containing *.html files for all 
+        *.hh, *.ddl, *.cc, alice.mk, GNUmakefile*, alice_*.(c)sh
+        and *.html index pages according to class categories  
+       - calls: doc_alddl2html.pl: modified ddl2html
+                doc_alsorthtml.pl: generates html pages for class
+                                  categories 
+       - the main page AG4CodePrototype.html with links to category index 
+         pages and the alphabetical index page was created manually                             
+
+Executable:
+============
+    Alice - G4 base simulation program;
+      1. Interactive mode:
+         cd $AG4_INSTALL/bin
+         A.   Alice Xm 
+                  UI - X Motif Window is open for typing command 
+         B.   Alice Wo    
+                  OPACS GUI is activated
+        C.1. java gag
+                  java GAG GUI is activated; 
+                  select: GEANT4 -> Execute GEANT4 
+                  and select Alice executable in file browser
+        C.2. tmomo
+                  Tcl/Tk Momo and GAG GUI is activated;
+                  select GAG -> Function -> Run GEANT4 
+                  and select Alice executable in file browser     
+         D. Alice
+                  terminal is used for typing commands;
+                   !! when used with Xo driver may freeze the whole
+                  X server -> use A. instead of this possibility 
+      2. Batch mode:    
+            Several samples of macro for running Alice in a batch mode
+           are available:
+            alrun0.mac - the default geantino generator
+            alrun1.mac - generator of four pi- is created and one event is run
+                         and visualized
+           alrun2/3/4.in  - visualization of all structure/detector/both modules
+                        of the default versions 
+            alrun5.in  - run with standard AliRoot generator when all detector
+                        and structure modules are built
+
+            To run Alice protorype with alrunN.mac:
+            cd $AG4_INSTALL/bin
+            Alice alrunN.mac
+
+Alice Commands:
+===============
+
+/aliDet
+  
+  /aliDet/switchOn  modNameVer
+     modNameVer: 
+       NONE, ALL, DDD[n]      
+     where
+       NONE    no modules are selected (default)
+       ALL     all available modules (default versions) are selected
+       DDD[n]  AliRoot module DDD of n-th version is selected;
+               if n is not specified the default version is selected 
+       !! work only during preinit phase;
+     
+  /aliDet/switchOff  whichVolume
+     whichVolume: 
+       ALL, LV, DDD
+     default value: no
+     !! work only during preinit phase;
+
+  /aliDet/list
+     list of all volumes currently switched on
+
+  /aliDet/XXX/setVisible visible 
+     XXX - name of subdetector (only of the switched on ones)
+     visible: true false
+     default value: no
+     !! work during idle phase (after initialization);
+
+  /aliDet/XXX/list
+  /aliDet/XXX/listLong
+    list the logical volumes tree structure; listLong prints
+    also number of the daughters of each LV 
+    (! daughters are physical volumes that are placed in this LV) 
+    
+  /aliDet/writeGeometry true
+     generate g3calls.dat for all built AliRoot detectors  
+
+  /aliDet/readGeometry true
+     build AliRoot detectors from g3calls.dat instead of
+     processing AliModule->CreateGeometry()
+       
+/aliGenerator
+   set primary generator action 
+   /aliGenerator/set generatorName
+      generatorName: 
+        Gun              ->  particle gun (default)
+        Geantino         ->  geantino with random momentum (default);
+        GhargedGeantino  ->  charged geantino with random momentum;
+        Parameterisation ->  pi-K-p mixture with specified distribution 
+                            of rapidity and pT
+        AliGenerator     ->  generator from AliRoot defined either in
+                            Config.C or interactively in Root shell                                                 
+   /aliGenerator/nofParticles number
+      default value: 1
+      Comment: does not set nof particles for AliGenerator
+               ( it has to be set by Aligenerator set method)  
+   /aliGenerator/verbose verboseLevel
+     verboseLevel: 0, 1, 2
+          default value: 0                     
+
+/aliGun
+   build a gun of partcles with given properties
+   
+  /aliGun/listAvailable
+     list of available particles
+  /aliGun/listCurrent
+     list of the properties of the current gun particle, that
+     can be add to the gun using addGun command
+  /aliGun/particle
+     set the current particle definition
+  /aliGun/momentum
+     set the current particle momentum 
+  /aliGun/position
+     set the current particle position  
+  /aliGun/time
+     set the current particle initial time
+  /aliGun/polarization
+     set the current particle polarization
+  /aliGun/direction 
+     set the current particle momentum direction
+  /aliGun/kinEnergy
+     set the current particle kinetic energy
+  /aliGun/list
+     list of all particles in the Alice gun
+  /aliGun/addParticle      
+     add the current particle to the gun
+  /aliGun/removeParticle i
+     remove the i-th particle from the gun
+  /aliGun/reset
+     remove all the particles from the gun   
+     
+/aliEvent        
+  /aliEvent/verbose verboseLevel
+     verboseLevel: 0   no hits information  is printed
+                   1   number of hits for hits collections stored per event
+                      is printed
+                  2   full hits information for hits collections stored 
+                      per event is printed
+     default value: 0                  
+  /aliEvent/drawTracks  drawFlag
+     drawFlag:  ALL      tracks for all particles are drawn
+                CHARGED  tracks for charged particles only are drawn
+               NONE     no tracks are drawn
+     default value: CHARGED    
+
+/aliTracking        
+  /aliTracking/verbose verboseLevel
+     verboseLevel: 0   no information from AlTrackingAction is printed
+                   1   each 100th primary track id is printed
+                   2   each primary track id is printed    
+     default value: 0          
+
+/aliRunAction
+  /aliRunAction/verbose  verboseLevel
+     verboseLevel: 0 - 2    no influence on output yet
+
+/aliRun  
+  redefinition of /run commands for AliRoot:
+  !! /aliRun commands has to be used instead of /run
+  commands in order to perform AliRun actions, too       
+  /aliRun/initialize  
+  /aliRun/beamOn   nofEvent
+
+  /aliRun/lego    
+     special lego run from AliRoot
+     (with default lego parameters) 
+
+/g4mc
+  /g4mc/root      
+     switch to Root interactive shell
+  /g4mc/rootMacro  macroName
+     execute Root macro macroName from a file macroName.C
+  /g4mc/g3Defaults
+     set G3 default parameters (cut values, tracking media max step values,
+      ...)
+  /g4mc/setProcessActivation     
+     activate/inactivate physics processes
+       
diff --git a/AliGeant4/doc/README.CodingConvention b/AliGeant4/doc/README.CodingConvention
new file mode 100644 (file)
index 0000000..881b467
--- /dev/null
@@ -0,0 +1,67 @@
+$ Id:$
+--------------------------------------------------------------
+ Coding Standards
+ ================
+
+ additional to the ALICE C++ Coding Conventions 
+
+ 1. Ordering of headers:
+    1. Ali*
+    2. G4*
+    3. other packages (CLHEP, ODBMS, ROOT, ...)
+    4. system (eg. <iostrem.h>)      
+
+ 2. Use G4 basic type instead of "raw" types:
+    G4int, G4double, G4bool, G4String, ...
+       
+ 3. Inline fuctions:
+    When implementation of inline methods is within two lines,
+    put it in the header file after the class
+    declaration in the header file (*.hh or *.ddl);
+    otherwise put it in a separated *.cc file.  
+    
+ 4. Declare member functions that should not
+    change class member data as const.   
+    
+ 5. Always provide dummy arguments at 
+    a member function declaration.
+ 6. Header file:
+    Place each section in the class declarations 
+    (public, protected, private) in this order:
+    // constructors 
+    // destructor 
+    // operators
+    // static methods
+    // methods
+    // set methods
+    // get methods
+    // static data members
+    // data members
+    Use comment line for all sections except for
+    constructors and destructors.
+    
+ 7. Implementation file:
+    declare class definitions in this order:
+    // static data members
+    // static methods
+    // constructors
+    // destructors
+    // methods 
+    Private definitions should be declared first,
+    then protected and public.
+    
+ 8. Exception/Warning:
+    Use AliGlobal::Exception()/Warning(); (or TG4Global in g4mc)
+    use this form of text:
+    class_name::method_name: exception/warning_text    
+
+ 9. Style:
+    Standard indention:  2 spaces;
+    Max. line length:   80 characters;  
+
+ Recomendations:
+      - default constructor - protected in suitable cases
+        (to prevent from creation of invalid objects)
+      - always provide copy constructor and assignement operator
+        for a class with pointer-type data member(s)
diff --git a/AliGeant4/doc/g3tog4tests.txt b/AliGeant4/doc/g3tog4tests.txt
new file mode 100644 (file)
index 0000000..cce5735
--- /dev/null
@@ -0,0 +1,78 @@
+
+"Preconditions" in g3tog4: 
+==========================
+  leading to warning, exception, error;
+  TBD = to be done;
+  
+TG4GeometryManager::Material:
+  TG4gsmate:
+    dens < G3_minimum_density   => density set to G3_minimum_density;
+                                   no WARNING message
+    z<1                         => Z = 1.; A = 2.;
+                                   no WARNING message
+
+TG4GeometryManager::Gfmate:
+  GetEffA, GetEffZ:
+    nofElements > 1             => Effective Z, A for material mixture
+                                   is used
+                                   WARNING message
+                                  
+TG4GeometryManager::Medium:
+  TG4gstmed:
+    nbuf > 0                    => additional user defined parameters
+                                   are ignored
+                                  WARNING message
+    
+    Only STEMAX (max allowed step) is used in Geant4 tracking
+    the other parameters (IFIELD, FIELDM, TMAXFD, DEEMAX, EPSIL, STMIN)
+    are ignored by Geant4.                        
+
+TG4GeometryManager::Matrix:
+  TG4gsrotm:
+    1-abs((x.cross(y))*z)>tol      ortogonality test
+                                   => EXCEPTION
+    (1+(x.cross(y))*z)<=tol        check for left-handedness
+                                   => WARNING message  
+                                     -> may cause incorrect visualization      
+                              
+TG4GeometryManager::Gstpar
+  TG4gstpar:
+    currently supported parameters:
+    Cuts:
+      "CUTGAM", "BCUTE", "BCUTM", "CUTELE", "DCUTE", "DCUTM", "CUTNEU",
+      "CUTHAD", "CUTMUO", "PPCUTM"
+           implemented as dummy: "PPCUTM"   
+    Processes:
+      "PAIR", "COMP", "PHOT", "PFIS", "DRAY", "ANNI", "BREM", "HADR",
+      "MUNU", "DCAY", "LOSS", "MULS"
+           implemented as dummy:    "PFIS", "HADR"
+          need more investigation: "DRAY", "LOSS"
+               (Current implementation (in)activate Ionization according
+                to the DRAY flag and ignores LOSS.)             
+
+    for the others                   => WARNINGS
+                                        -> parameters are ignored
+                              
+TG4GeometryManager::Gsvolu:
+   TG4makevol:
+     Unsupported shapes:
+     "ELTU", "HYPE", "GTRA", "CTUB"  => EXCEPTION  
+     
+TG4GeometryManager::Gsdvn, Gsdvn2, Gsdvt, Gsdvt2, Gsdvx:
+  TG4gsdvn, TG4gsdvn2, TG4gsdvt, TG4gsdvt2, TG4dvx:                               
+    Supported shapes(axes):
+      "BOX"(1,2,3), "TUBE"(1,2,3), "TUBS"(1,2,3),
+      "CONE" (2,3), "CONS" (2, 3),
+      "TRD1"(3),  "TRD2"(3), "TRAP"(3), "PGON"(2), "PCON"(2),
+    Unsupported shapes:
+      "SPHE", "PARA", "ELTU", "HYPE", "GTRA", "CTUB"
+    
+    call to unsupported shape/axis  => WARNING message
+    
+TG4GeometryManager::Gspos, Gsposp:
+   TG4gspos, TG4gsposp:
+      Unsupported option (TBD):  "MANY" =>  WARNING message
+                                            !! may cause intersecting volumes
+  
+  
+  
diff --git a/AliGeant4/doc/history/History b/AliGeant4/doc/history/History
new file mode 100644 (file)
index 0000000..91b01af
--- /dev/null
@@ -0,0 +1,443 @@
+$Id$
+-----------------------------------------------------------------
+     
+Tags (history):
+===============
+   15.6.00:
+   al-2-04__ar-2-5-00__g4-1-1:
+        TG4PhysicsList extended with optical and hadronic
+       processes, the messenger TG4PhysicsListMessenger implemented.
+       aliroot.cxx (main program from AliRoot) added
+       with g4libs.C, g4menu.C, g4Config.C macros
+       (G4 can be dynamically instantiated from Root UI).
+        Tag before AliRoot update.
+       
+
+   8.5.00: 
+   al-2-03__ar-2-5-00__g4-1-1:
+        Updated to AliRoot cvs head from 2.5.2000;
+        implemented lego Run.
+
+   2.5.00:
+   al-2-02__ar-17-4-00__g4-1-1:
+        Tag before AliRoot update;
+       updated aliroot_cint scripts for new source
+       structure; corrections in g4mc/visualization;
+       GAG GUI added. 
+
+   17.4.00:
+   al-2-01__ar-17-4-00__g4-1-1:
+        Updated to AliRoot cvs head (17.4.2000):
+       AliVMC merged with AliMC; AliRun modified
+       for G4 needs;
+       All /alXXX commands renamed to /aliXXX;
+       !! /aliRun/initialize and /aliRun/beamOn have to be
+       used instead of standard g4 /run commands.      
+
+   28.3.00:
+   al-2-00__ar-3-03-pre__g4-1-1:
+        AliRoot code has been removed from the prototype and
+       is used as external package;
+       Two main categories: 
+          alice, g4mc
+       Subcategories (in both) : 
+          global geometry physics event run visualization
+        New cvs repository was created due to global reorganization
+       of directories.
+
+   ----------------------------------------------------cvsAlice.4
+   22.3.00:
+   al01-00-16_ar-3-02-mod_g4-01-00:
+        aliroot/STEER updated to AliRoot CVS head
+        version (29.2.2000) + to mods needed for G4;
+        new AliSteppingAction for detecting of looping
+        particles; 
+        AliPrimaryGeneratorAction updated for support
+        of AliGenerator from AliRoot;
+        Setup scripts in config enhanced (*.csh added;
+        verbose and local options introduced; VRML1
+        driver support added);        
+        Tag before update to geant4 1.1 release.
+
+   25.1.00:
+   al01-00-15_ar-3-02_g4-01-00:
+        Update to geant4.1.0 release;
+       the g4mc/g3tog4 has been removed and the g3tog4
+       is used from Geant4 directly;
+       a few bug fixes in Geant4 g3tog4 had to be applied.
+
+   7.12.99:
+   al01-00-14_ar-3-02_g4-00-01:
+        AliRoot updated to release v3.02 (from 9 Nov 1999);
+       enabled writing and reading g3calls.dat files
+       (for each detector);
+       added simple visualization macros (vis_test1.in)
+       for all dets and structures and detailed ones       
+       for some dets (vis_test2.in).
+
+   8.11.99:
+   al01-00-13_ar-3-02-pre_g4-00-01:
+        Fixed bugs in g3tog4 (rewritten TG3Division class);
+        all AliRoot detectors and modules included;
+        scripts for automatical geometry testing added;
+        toy directory excluded from default compilation;
+        corresponds to AliRoot pre-release v3.02 from 14 Oct 99. 
+
+   15.10.99:
+   al01-00-12_ar-3-02-pre_g4-00-01:
+        Fixed bugs in g3tog4;
+        Tag before update of AliRoot to later pre-release v3.02;
+
+   4.10.99:
+   al01-00-11_ar-3-02-pre_g4-00-01:
+        Updated to G4 release geant4.0.1;
+       substantial modification of g4mc/g3tog4. 
+
+   9.8.99:
+   al01-00-10_ar-3-02-pre_g4-00-00:
+        Updated to AliRoot pre-release v 3.02
+       (from AliRoot cvs head 7/28/99 );
+
+   12.7.99:
+   al01-00-09_ar-3-01-p00_g4-00-00:
+        Updated to AliRoot v 3.01 + patch 00
+       (AliRoot cvs tag: Release-3-01-Patch-00);
+       aliroot version added to the tag; 
+
+   22.6.99:
+   al01-00-08_g4-00-00:
+        config: unified names for makefiles/scripts
+          has been introduced:
+          make_*.gmk : makefiles
+          aliroot_*  : scripts for aliroot support 
+          doc_*      : scripts for html documentation;
+       source: category changes:
+          toy: has been separated from geometry;
+          digits+hits, materials: categories has been removed,
+               classes have been moved to geometry
+          aliroot: subcategories according AliRoot 3.1 
+               has been introduced; 
+        Tag before update of AliRoot to version 3.01.
+
+   18.6.99:
+   al01-00-07_g4-00-00:
+        New category G4mc has been introduced.
+       It contains all classes that implements the interface
+        to the abstract Monte Carlo (AliMC) class for Geant4
+       and that are independent on the Ali* classes.
+       Class names in this category have the prefix "TG4".
+
+   17.6.99:
+   al01-00-06_g4-00-00:
+        Several corrections in definition of materials;
+       Default element table has been implemented in 
+       AlMaterialStore::ConstructG4ElementTable().
+
+   27.5.99:
+   al01-00-05_g4-00-00:
+        Process control flags corresponding to Geant3 flags
+       has been implemented (via classes: AliLimits, AliSpecialFlags,
+       AliG3Defaults, AliPhysicsList).
+
+   23.4.99:
+   al01-00-04_g4-00-00:
+        Kinetic energy cuts corresponding to Geant3 cuts
+       has been implemented (via classes: AliLimits, AliSpecialCuts,
+       AliG3Defaults, AliPhysicsList).
+       config files have been modified to support
+       the Linux-g++ system (egcs 1.1 with RedHat Linux 5.1).
+
+   8.4.99:
+   al01-00-03_g4-00-00:
+        Update to AliRoot v3.0.
+
+   19.3.99:
+   al01-00-02_g4-00-00:
+        Tag before update of AliRoot to version 3.00.
+   
+   11.3.99:
+   al01-00-01_g4-00-00:
+        New AliG4RunManager class has been added:
+       it implements methods of the abstract interface MonteCarlo
+       for Geant4 run control.
+   
+   ----------------------------------------------------cvsAlice.3
+   1.3.99:
+   al01-00-00_g4-00-00:
+        Other event models (transient, simple-root, Objectivity)
+       has been removed from the prototype;
+       only Galice/Aliroot event model has been kept.
+   
+   26.2.99:
+   al00-07-07_g4-00-00:
+        The interface class AlG3ToG4Geometry:AliGeomInterface,
+        has been implemented; it is used by 
+        AlTPCv0DetConstruction class (ConstructGeometry method).
+
+   24.2.99:
+   al00-07-06_g4-00-00:
+        Command for switching between Geant4 UI and
+       root UI has been implemented.
+       Comment: Root graphics does not work together with
+                OPACS => ALOPACS option has been added.
+
+   16.2.99:
+   al00-07-05_g4-00-00:
+        The skeleton for the g3tog4 geometry interface
+       has been added.
+        The "empty" interface class AlG3ToG4Geometry:AliGeomInterface,
+       a commented method AliITSv0::CreateGeometry using the
+       abstract interface and an "empty" AlITSv0DetConstruction
+       for building geometry using AlG3ToG4Geometry 
+       
+
+   15.2.99:
+   al00-07-04_g4-00-00:
+       AliDetector::StepManager() method is used for TPC0; 
+        misc. corrections in AliG4MonteCarlo; 
+
+   10.2.99:
+   al00-07-03_g4-00-00:
+        aliroot updated for the galice from 4Feb99;
+        !! This aliroot code doe NOT work with the rest 
+           of prototype
+   al00-07-02_g4-00-00:
+        AliG4MonteCarlo has been implemented (with ALALI_ROOT
+       option);
+       AliDetector::StepManager() method is used for ITS;  
+       
+   9.2.99:
+   al00-07-02_g4-00-00:
+        AliG4MonteCarlo has been implemented (with ALALI_ROOT
+       option);
+       AliDetector::StepManager() method is used for ITS;  
+       
+   8.2.99:
+   al00-07-01_g4-00-00:
+        fixed for bugs in running for more than one
+       event per run (when ALALI_ROOT is set);
+
+   28.1.99:
+   al00-07-00_g4-00-00:
+        AliRoot persistency added:
+         new /source/aliroot directory;
+         new option AlALI_ROOT introduced;
+         AliRoot taken from ~/fca/public/galice.tar.gz 16.1.99;
+
+   22.1.99:
+   al00-06-01_g4-00-00:
+        bugs in Root persistency fixed: 
+         primary particles are stored now too when ALSTEPPING
+         and ALROOT is set;
+         bug in defining Kinematics tree fixed;
+         run time error at the deleting phase eliminated;     
+
+   ----------------------------------------------------cvsAlice.2
+   14.1.99:
+   al00-06-00_g4-00-00:
+        Update for geant4.0.0;
+
+   13.1.99:
+   al00-05-01_g4beta03:
+       AlTrackingAction added - some hits collections (TPC) 
+         are stored per primary track;
+         the prototype runs for "big" events o.k.
+         (10000 primaries in ROOT mode tested);
+       Root persistency: only from this tag Root persistency   
+         of event for more than one hits collection in event
+         works o.k. 
+
+   4.12.98:      
+   al00-05-00_g4beta03:
+        Update for geant4 beta03-01;
+       New: CC compiler (on HP) is no longer supported -
+            aCC is supported from this tag. 
+
+   4.12.98:      
+   al00-04-04_g4beta02:
+        Event: AlSteppingAction, AlStackingAction classes have been
+          added; two new options have been introduced:
+          ALSTEPPING, ALSTACKING
+
+   12.11.98:   
+   al00-04-03_g4beta02:
+        Run: primary generator action can be chosen from 3 predefined
+          generators or built using AlParticleGun;
+          new AlPrimaryGeneratorMessenger class;
+        Event: new AlEventActionMessenger class;
+        Materials: material name checking has been added;
+          materials construction has been moved to AlXXXDetConstruction; 
+
+   2.11.98:    
+   al00-04-02_g4beta02:
+        Geometry: each subdetector must be built inside its frame;
+         AlDetSwitch - used for storing info which subdetectors of
+           which version will be built;
+         AlSubDetMessenger class - generates command directory
+           for each subdetector; 
+       Visualization: commands for interactive changing of visualization
+         attributes for subdetectors (setVisibility, setColour)
+
+   27.10.98: 
+   al00-04-01_g4beta02:
+        Root persistency: REvent class enhanced with all ITS hits collections
+        pointer data members.
+
+   26.10.98: 
+   al00-04-00_g4beta02:
+        Updated for geant4 beta02.         
+
+   23.10.98: 
+   al00-03-06_g4beta01:
+        Corrected for Objectivity model.        
+
+   23.10.98: 
+   al00-03-05_g4beta01:
+        new coding standards applied to all source code;
+        (Alice naming conventions, making methods const,
+         avoiding unvalid objects - not complete, unification
+         of header file style);
+        Root persistency: REvent class with one hits collection
+        pointer datum member -> retrieving objects from file
+        is o.k.  
+        !! not completely committed Objectivity model
+           - for Objectivity option use al00-03-06_g4beta01
+
+   12.10.98:   
+   al00-03-04_g4beta01:
+        Root persistency of hits for ITS corrected;
+        (but bug in Root in retrieving them from a file)
+       inline methods moved to the end of *.hh, *.ddl  
+        !! this tag was by mistake applied on 23.10.98
+           instead of al00-03-05_g4beta01 - add date when
+           retrieving this tag !!!! 
+
+   18.9.98:    
+   al00-03-03_g4beta01: 
+        added Root persistency of hits for ITS
+       (with using global TClonesArray* variable); 
+       all inline methods separated from *.hh, *.ddl
+       to *.icc files; 
+       BUG: created Root file is wrong;
+            do NOT use this tag !!!
+
+   8.9.98:
+   al00-03-02_g4beta01:
+        added Objectivity persistency of hits for PHOS, TPC; 
+
+   31.8.98:
+   al00-03-01_g4beta01:
+        added Objectivity persistency of hits for ITS; 
+       
+   ----------------------------------------------------cvsAlice.1
+   18.8.98:
+   al00-03-00_g4beta01:
+        updated for geant4 beta01 - without Objectivity and ROOT
+       persistency;
+       new features: global code reorganization;
+                     update to beta01;
+                     changed GNUmakefiles  
+   4.7.98:                   
+   al-00-02-05_g4-alpha06:  
+        new features: added ROOT persistency for TPC hits 
+
+   3.7.98:
+       new features: added samples directory and
+                     README.HowToAddSubDetector
+                     
+   30.6.98:
+   al-00-02-04_g4-alpha06:  
+        new features: changed TPC0Geometry (added parameterisation);
+                     changed AlParticleGun attributes;
+                     changed default AlPrimaryGeneratorAction                
+
+   12.6.98: 
+   al-00-02-03_g4-alpha06:  
+        new features: added AliceAnalyse for retrieving objects
+                     from Objy database 
+   15.5.98: 
+   al-00-02-02_g4-alpha06:  
+        new features: update for G4 alpha06 tag 
+                     
+   14.5.98: 
+   al-00-02-02_g4-alpha05:  
+        new features: added Objectivity persistency for ITS hits 
+                             
+   11.5.98: 
+   al-00-02-01_g4-alpha05:  
+        new features: small bugs fixed                              
+
+   4.5.98:                    
+   al-00-02-00_g4-alpha05:  
+        new features: new cvs repository (created subdirectories,
+                      renamed classes and files)                      
+                                            
+   30.4.98:                    
+   al-00-01-03_g4-alpha05: works with g4-alpha05 
+        new features: added new ITS detailed geometry;
+                      created classes for storing geometry data
+                      parameters;                  
+
+   23.4.98:                    
+   al-00-01-02_g4-alpha05: works with g4-alpha05 
+        new features: created data files for geometry parameters;
+                      Wo GUI                    
+   27.3.98:
+   al-00-01-01_g4-alpha05: works with g4-alpha05 
+        new features: added sensitive detectors + hits
+                                                                   
+   9.2.98:
+   al-00-01-01_g4-alpha04: works with g4-alpha04 
+       new features: added OPACS graphics system as default
+
+   al-00-01-00_g4-alpha04: works with g4-alpha04 
+   g4-alpha04_al-00-03: new Alice physics list (bug)
+   g4-alpha03_al-00-03: works with g4-alpha03
+   g4-alpha03_al-00-02: new Alice particle gun (bugs)                        
+   g4-alpha03_al-00-01: works with g4-alpha03
+   g4-alpha03_al-00-00: the first Alice prototype;
+
+
+CVS Repository
+================
+   CVSROOT=/afs/cern.ch/alice/offline/ivana/cvsAlice
+   cvs checkout Alice 
+   
+   28.3.00:
+     cvsAlice     moved to cvsAlice.previous/cvsAlice.4;
+     New cvs repository was created due to global reorganization
+     of directories: AliRoot code has been removed from the prototype
+     and categories has been reorganized; toy code has been removed.
+
+   28.2.99:
+     cvsAlice     moved to cvsAlice.previous/cvsAlice.3;
+     New cvs repository was created due to removing the other
+     event data model (options: ALODBMS, ALSIMPLE_ROOT,
+     none=transient) - only AliRoot (option ALALI_ROOT)
+     has been kept.
+
+   14.1.99:
+     cvsAlice     moved to cvsAlice.previous/cvsAlice.2;
+     New cvs repository was created due to global renaming of files:
+     *.hh -> *.h; *.cc -> *.cxx
+
+   18.8.98:
+     cvsAlice.old moved to cvsAlice.previous/cvsAlice.0
+     cvsAlice     moved to cvsAlice.previous/cvsAlice.1
+     New cvs repository was created due to global code reorganization:
+     - creating directories corresponding to the new geant4 structure
+       (bin, config, data, doc, lib, samples, source, tmp) 
+   4.5.98: 
+     mv cvsAlice (tagged al-00-01-03_g4-alpha05) to cvsAlice.old
+     new cvs repository created due to global changes:
+     - creating directories corresponding to objects categories
+     - renaming classes and files                          
+     
+Compilation comments:
+=====================
+   Useful linker options (gcc):
+   -Xlinker -verbose    
+   -Xlinker -Bstatic   .. search only for *.a libraries
+
diff --git a/AliGeant4/doc/history/alice_History b/AliGeant4/doc/history/alice_History
new file mode 100644 (file)
index 0000000..a5988d1
--- /dev/null
@@ -0,0 +1,9 @@
+$Id$
+-------------------------------------------------------------
+
+alice:
+=======
+  28.3.00:
+     New "top" category for all Ali* dependent classes
+     (previously in /source);
+     Subcategories: global geometry physics event run visualization
diff --git a/AliGeant4/doc/history/alice_event_History b/AliGeant4/doc/history/alice_event_History
new file mode 100644 (file)
index 0000000..7ed4a42
--- /dev/null
@@ -0,0 +1,114 @@
+$Id$
+-----------------------------------------------------------------
+
+alice/event:
+============
+  7.3.00:
+     AliSteppingAction: newly implemented for detecting and
+         stopping looping particles:
+        After processing a given number of steps (kCheckNofSteps)
+         particle position is compared with the previus one
+         - in case the distance is less than kTolerance value
+         the verbose mode is switched on, particle is let 
+         to process a small number of steps (kMaxNofLoopSteps)
+         and then stopped and killed 
+     AliSteppingActionMessenger:
+         new class; implements command /alTracking/loopVerbose 
+
+  25.10.99:
+     AliParticleGun:
+       GeneratePrimaryVertex(): when particles are created in 
+         the same space point (x,t), they are added to the same
+        primary vertex. 
+
+  28.7.99:
+     All classes renamed: Al -> Ali
+
+  28.1.99:
+     AlSteppingAction: saving of secondary particles moved tp
+       AlTrackingAction => class AlSteppingAction is no longer used,
+       but it is kept for future;
+     ALSTEPPING options has been removed;
+         
+  22.1.99:
+     AlSteppingAction, AlTrackingAction:
+       methods SaveParticle() added: the method in AlSteppingAction
+         calls the method from AlTrackingAction;
+       ALL (both PRIMARY and SECONDARY) particles are stored now 
+       
+  11.1.98:       
+     New classes:   
+     AlTrack:  similar structure as G4Event - collects hits 
+       collections for primary track;                 
+     AlTrackingAction: performs similar actions as G4EventManager
+       - but on the track level;
+     AlTrackingActionMessenger:
+       command: /alTracking/verbose  
+       
+  8.12.98:
+     AlStackingAction: added fPrimaryStack (G4TrackStack*) for
+       postponning primary particles;
+       commented pRootManager->StackNewStage() - should be
+       called from AlTrackingAction;    
+       
+  3.12.98:
+     New classes: 
+     AlSteppingAction: saves info on generated particles
+       (it is ruled by ALSTEPPING option) 
+     AlStackingAction: postpones tracking of secondary particles
+       till the urgent stack is exhausted
+       (it is ruled by ALSTACKING option)
+     !! ONLY secondary particles are stored  
+       
+  5.11.98:
+     New class: AlEventActionMessenger
+     commands: /alEvent/verbose
+               /alEvent/drawTracks
+              
+  18.9.98:
+     Persistent Event (both for Objectivity and Root) is 
+     created in AlEventAction::EndOfEventAction(). 
+     
+  27.8.98:
+     removed RWTValOrderedVector<RWCString> AlHCNames attribute;
+     Using the G4VHitsCollection::GetSDName() function for
+     getting the type of AlXXXHitsCollections.
+     
+  18.8.98:
+     Category name Events changed to Event;
+     options G4ROOT/ODBMS_STORE_HITS renamed to ALICE_ROOT/ODBMS;
+     updated for beta01
+     
+  3.7.98:
+     modified for root persistency option (G4ROOT_STORE_HITS);
+
+  26.6.98:
+     AlGunParticle:
+     changed attributes from aParticleMomentumDir, aEnergy to
+     aParticleMomentum; added constructor for creating particle
+     with given kinEnergy and momentumDir;
+     AlParticleGunMessenger:
+     changed /alGun/energy to /alGun/kinEnergy;
+     added /alGun/momentum
+     
+  12.5.98:
+     AlEventAction:
+     added RWTValOrderedVector<RWCString> AlHCNames attribute;
+     used AlHCNames for looping over all hits collections defined;
+     
+  11.5.98:
+     modified for persistency option (G4ODBMS_STORE_HITS);
+     removed the general loop through all event hits collections
+     - only ITS hits collections are included now;
+     must be generalised again !
+
+  4.5.98:
+     Renaming of classes:
+     AliceXXX -> AlXXX
+     
+  30.1.98:  
+     new class Alice particle gun:
+     redefines the G4ParticleGun, G4ParticleGunMessenger classes
+     - enables shooting different particles in one run 
+     - classes: AliceParticleGun, AliceGunParticle
+     
diff --git a/AliGeant4/doc/history/alice_geometry_History b/AliGeant4/doc/history/alice_geometry_History
new file mode 100644 (file)
index 0000000..e3a0809
--- /dev/null
@@ -0,0 +1,471 @@
+$Id$
+
+alice/geometry:
+===============
+  4.5.00:
+   AliSDManager:
+     new class; Replaces the static methods for creating
+     sensitive detectors in AliSingleModuleConstruction
+     (they should be removed from there) + defines methods
+     for creatin lego SDs and switchhing between lego
+     and standard SDs.
+   AliLegoSensitiveDetector:
+     new class;
+     Defines special sensitive detector for lego run;
+     keeps pointer to the standard SD.
+     
+  13.4.00:
+   AliMoreModulesConstruction:
+     Added method CreateSensitiveDetectors that use the volumes name
+     map (TG4NameMap) for associating the sensitive detectors with 
+     AliModule.
+
+  7.3.00:
+   AliDetContruction:
+     Changed definitions of detSwitch to have the same
+     version numbers as in AliRoot; in case a selected version 
+     does not exist, warning is printed only.
+
+  21.2.00:
+    AliMoreModulesConstruction:
+      new class that have replaced AliTwoModulesConstruction;
+      it builds geometry of bounded modules (the bounded
+      modules can be added dynamically);
+    AliTwoModulesConstruction: removed
+
+  2.11.99:
+    AliTwoModulesConstruction:
+      new class that build geometry of two bounded modules
+      (G3 tables are removed after both modules are processed)
+
+  18.10.99:
+    Renaming all classes:
+    AlSubDetConstruction -> AliModuleConstruction
+    AlSubDetMessenger    -> AliModuleConstructionMessenger
+    AlAnyDetConstruction -> AliAnyModuleConstruction
+    AlDetConstruction    -> AliModulesComposition
+                         -> AliDetConstruction
+    AlDetMessenger       -> AliModulesCompositionMessenger
+                         -> AliDetConstructionMessenger
+    Al* -> Ali* the rest;    
+    AliModulesComposition:
+       new class generalization of AliDetConstruction:
+       all methods needed for handling fDetSwitchVector are here;
+    AliDetContruction:
+       three version available:
+       1) AliDetContruction:AliModulesComposition (default)
+                   - complete (as much as possible) aliroot geometry 
+                    with interactivity   
+       2) AliDetContruction1:AliModulesComposition 
+                   - ITS + TPC + toy with interactivity
+       3) AliDetContruction2
+                   - aliroot geometry without interactivity;
+                    aliroot dets must be define in Config.C;
+                    !!! requires shared libs
+                    (For archived libs can be done:
+                     add all available dets includes +
+                     its declaration in constructor) 
+                                     
+  12.8.99:
+    AlDetConstruction(2):
+      The top (world) volume has been changed from
+      Hall0 (from toy category) to AliBODY (from aliroot)
+      built using TG4GeometryManager.
+      (Warning: Volume created with g3tog4 package cannot be 
+       placed inside a volume that was not created by g3tog4 
+       package now.)
+
+  14.7.99:
+    AlDetConstruction:
+      Executing of Config.C Root macros for detectors built
+      from AliDetector has been added to CreateDetectors(..) method.
+
+  20.6.99:
+    Subcategories:
+    geometry/toy, geometry/volumes: have been separated into
+       new Toy category;
+    materials, digits+hits: have been removed and their classes
+       have been added to geometry    
+  7.4.99:
+     AlAnyDetConstruction:
+       New way of defining sensitive detectors is implemented:
+       The sensitive detector is created for the logical volume
+       associated with medium with the parameter ISVOL=1
+       with the name equal to the "base" name of the volume
+       (name preceding .CopyNo);
+       if the SD with the given base name already exists, the logical
+       volume is associated with this SD and the new SD is not created.
+
+  2.3.99:
+     New class: AlLVStructure
+       according to G4SDStructure;
+       it is used for "maping" logical volume trees;
+     AlSubDetConstruction: 
+       - new methods
+         SetLVTreeVisibility(..);
+         SetVolumeVisibility(..);
+         SetLVTreeColour(..);
+         SetVolumeColour(..); 
+       - data member fDetVisAttributes and abstract methods 
+         ConstractFrame(), ConstructMaterial has been removed;
+
+  26.2.99:    
+     New AlTPCv0DetConstruction with building geometry
+       using AliG3ToG4Geometry:AliGeomInterface has been implemented;
+       CreateMaterials() method does not work, yet. 
+                                           
+  16.2.99:
+     AlSubDetConstruction:
+       fAliDetector data member has been added for ALIROOT
+       option;  
+     New AlITSv0DetConstruction (still "empty") for building geometry
+       using AliG3ToG4Geometry:AliGeomInterface; 
+       
+  12.11.98:
+     AlSubDetConstruction:
+       Abstract method ConstructMaterials() has been added:
+       the materials are defined separately for each subdetector.
+         
+  2.11.98:
+     AlSubDetConstruction:
+       - method SetDetColour(name);
+     AlSubDetMessenger:
+       - command /alDet/XXX/setColour;
+       
+  30.10.98:
+     AlSubDetConstruction:
+       Protected abstract methods ConstructDetFrame(mother), Construct() 
+       were added -> this ensures that all AlXXXnDetConstruction will
+       build the detector within its frame.
+       AlMaterials are not included in DetConstruction classes
+       and are not arguments in Construct methods - see also
+       materials/History 30.10.98.
+       
+  28.10.98:
+     new class AlDetSwitch:
+       it has replaced bool data members setXXX;
+       it is used for automatical generation of candidates lists
+       for commands switchOn, switchOf in AlDetManager
+     new class AlSubDetMessenger:
+       generates new commands directory /alDet/XXX
+       and command:  /alDet/XXX/setVisibility
+       To add: command alDet/XXX/setColour colourName 
+       when colours names will be implemented in the AlColours class.
+     AlSubDetConstruction:
+       added data members:
+       G4String fDetName;
+       default constructor has been moved to protected area;
+       AlSubDetMessenger*  fSubDetMessenger;    
+       abstract methods Construct() and ReadGeometryParameters()
+       has been removed;
+     AlXXXnDetConstruction:
+       default constructor has been moved to protected area;
+       ReadGeametryParameters() method has been removed and incorporated
+       into Construct();
+       Construct() is called from public constructor
+       => Creating non valid AlXXXnDetConstruction objects is 
+          made impossible.
+         
+  16.10.98:
+     Visualization of detectors/modules:
+     visualization/paramdef directory was removed;
+     #include "DDDVisualization.hh/cc" were removed'
+
+     AlSubDetConstruction:
+       - G4VisAttributes*  fDetVisAttributes;
+         data membber was added;
+       - Implemented methods:
+           SetDetVisibility(G4bool visibility);
+           SetDetColour(const G4Colour& colour);
+           SetDetVisAttributes(G4VisAttributes* visAttributes);
+           G4VisAttributes* GetDetVisAttributes() const;
+          
+      The default det vis attributes are set in
+      AlDDDnDetConstruction::AlDDDnDetConstruction();        
+      
+  27.8.98:
+     Sensitive detector and hits collection names were changed 
+      - see doc/README.NamedObjects
+      
+  18.8.98:
+     - Changed subdirectory names:
+         subsets -> detectors
+         subdets -> volumes
+     - Renamed attributes in AlDetConsctruction:
+         XXX_build -> setXXXn        n - geometry version number
+     - updated for beta01 (only 0th version);
+         ITS1, TPC1 not updated to beta01 yet;
+        
+  11.5.98:
+     subdets/GNUmakefile: added G4ODBMS option                                       
+
+  4.5.98: 
+     - Subdirectories:
+       global:  classes common for all geometry components
+       subsets: classes defining volumes without sensitive detectors
+       subdets: classes defining volumes with sensitive detectors
+       volumes: base geometry classes
+     - Renaming of classes:
+       AliceXXX                     ->  AlXXX
+       DDD (DDD - subdetector name) ->  AlDDDnDetConstruction
+                                         (n is the geometry version number)
+
+  30.4.98:
+      moved paramdef/XXXGeometry.cc,hh files into the XXX.hh,cc 
+        (XXX - detector name) files;
+      changed attributes of XXX (XXX - detector name) classes
+      from pointers to objects;
+  
+  24.4.98: 
+      Changed structure of xxxGeometry.data files;
+      New classes: AliceXXX : public AliceVolume, XXX=Box,Cons,Tubs,Trd
+      are created for storage of volume's parameters; 
+      member function for reading, printing parameteres
+      and building G4XXX and G4LogicalVolumes are implemented;   
+
+  20.4.98: data files for geometry parameters were created
+    in the data directory: xxxGeometry.data 
+
+  27.3.98: geometry parameters are defined in xxxGeometry.hh,cc
+    in the paramdef directory (xxx = name of detector)
+
+
+ITS "toy" geometry:
+-------------------
+  18.8.98:
+        only ITS0 updated to beta01;   
+
+   4.5.98: 
+        positioning of volumes was redefined using CLHEP
+        vectors and rotations;
+
+  30.4.98: (after tag al-00-01-03_g4-alpha05)
+      New ITSDetConstruction class was created
+         - build ITS volumes according to 
+           AliceDetConstruction::ITSXXX_build settings                        
+
+  30.4.98:
+     - ITS class was splitted into four classes:
+       ITSFrame, ITSPixel, ITSDrift, ITSStrip 
+     - geometry parameters definitions were changed 
+                
+  24.4.98: 
+      - All ITS* classes renamed to ITS0*;
+      - new ITS class created (according to Dubna FORTRAN code):
+        1) parameter definitions must be changed in a new way
+        (Using AliceXXX:AliceVolume classes);
+        2) positioning of volumes must be redefined using CLHEP
+        vectors and rotations
+        3) the class should be split into smaller classes
+        (ITSPixel, ITSDrift, ITSStrip) 
+
+
+TPC "toy" geometry:
+-------------------
+  16.11.98:
+     Parameterisation of the inner TPC ring was implemented;
+     inner tracking ring was made sensistive.   
+               
+  18.8.98:
+     - /aliceDet/switchVolume TPCTrd changed to TPC1
+     - only TPC0 updated for beta01 
+
+  15.6.98: 
+     1) Dividing TGAS tube using parameterisation;
+        (eliminating infinite loops during tracking)
+        set TPC as default when /aliceDet/switchVolume ALL;
+
+  20.4.98: Two possible geometries of TGAS detector:
+     1) Tube shape (divided into Phi sectors, pad rows, pads in rows)
+           /aliceDet/switchVolume TPC
+     2) Trapezoid shape (divided into Phi sectors, pad rows)     
+           /aliceDet/switchVolume TPCTrd
+     (with /aliceDet/switchVolume ALL - TPCTrd is used)
+     Sensitive detector definition and Hit definition is common
+     for both geometries.
+     
+
+Materials:
+==========
+  21.2.00:
+    AliMaterialStore,
+    AliMaterialStoreMessenger:
+      classes removed from the prototype;
+      elements for G4ElementTable constructions are defined in g3tog4;
+  
+  20.6.99:
+    Category has been merged into geometry.
+
+  11.6.99:
+    AlMaterialStore:
+      ConstructG4ElementTable():
+         elements up to 30 has been added;
+        to be continued;
+    new class:          
+    AliMaterialStoreMessenger: 
+      implemented commands: /alMaterials/list   
+
+  12.11.98:
+    AlMaterialStore:
+    - Public methods: IsMaterial();
+                      WarnWrongMatName();                   
+      has been added - they provide possibility for checking
+      material table before creating new material (in order to avoid
+      creating different materials with equal names).
+    - Code from constructor was extracted into private methods:
+                      ConstructG4ElementTable();
+                      ConstructG4Materials();
+      that are called from constructor.
+      Creating materials was moved to 
+      AlXXXnDetConstruction::ConstructMaterials() except for
+      Air, Vacuum and (temporary) materials comming from old ITS1.
+                   
+  30.10.98:
+    Renaming of the class:
+    AlMaterials -> AlMaterialStore
+    Change class to singleton -> no need to send AlMaterials* to
+    det. construction methods. 
+    
+  4.8.98:
+    changed Vacuum definition according to materials/test/G4MaterialsTest.cc 
+    "Galactic"
+    
+  4.5.98:
+    Renaming of the class:
+    AliceDetMaterials -> AlMaterials 
+
+  34.4.98:
+    added new materials for ITS1 detector
+
+  31.3.98 :  Gas-mixt redefined 
+    
+  30.1.98: material Vacuum leads to runtime error during tracking
+    - until fixing this bug LVP_log use Air instead of Vacuum
+                   
+  Before dating:
+  - according to g4 method
+    defined in the class AliceDetMaterials
+  - one mixture (Gas-mixt) not defined in the "right" G4 way
+    (as a composition of elements)
+
+
+Digits+Hits:
+============
+   20.6.99:
+     Category has been merged into geometry.
+
+   19.3.99:
+     New class: AliSensitiveDetector
+       common sensitive detector definition for all
+       detector classes;
+
+   11.3.99:
+     AliG4MonteCarlo was renamed to AliG4StepManager and moved from
+     global.
+   1.3.98:
+       subdirectories digits, hits - removed;
+       detectors/* moved to digits+hits;   
+
+   16.11.98:
+     - AlHit: removed fParentID attribute;
+       AlITST/O/RHit: added fMomentum attribute;
+     - Root persistency implemented (for XXX=TPC):
+       see persistency/Root/History
+
+   18.9.98:
+     Root persistency implemented (for XXX=ITS):
+     see persistency/Root/History
+     
+   7.9.98:
+     Objectivity persistency implemented (for XXX=PHOS,TPC):
+
+   27.8.98:
+     Hits collection names were changed 
+     - see doc/README.NamedObjects
+
+   18.8.98:
+     New subdirectories detectors, digits, hits were created.
+     New design for hit classes:
+     
+     Base classes:
+     AlHit     - base class for all hit classes;
+     template <classT> class AlTHitsCollection
+               - template base class for all transient hits collections;     
+              
+     Derived classes:         
+     AlXXXTHit - classes for transient XXX hit;
+     AlXXXTHitsCollection  - transient XXX hits collections;
+       is defined as typedef AlTHitsCollection<AlITSTHit>
+
+     AlXXXOHit - classes for persistent Objectivity XXX hit
+                 (not implemented yet)                              
+     AlXXXRHit - classes for persistent Root XXX hit
+                 (not implemented yet)
+     Collection classes not available yet. 
+
+   24.8.98:
+     Objectivity persistency implemented (for XXX=ITS):
+     see persistency/Objectivity/History
+     
+   3.7.98:
+     added Root persistency for TPC hits;
+     G4Hits.root file is created in $(ALICE_HOME) directory.
+     The dictionary class AlRootHits and AlRootLinkDef.h
+     was created for including AlTPCHit, AlTPCHitsCollection classes 
+     into Root system (scripts/aliceMakeRootDict.sh)
+     Limitation: 
+     for G4ThreeVector class rootcint does not work !! 
+     These G4 classes had to be modified:
+     G4RunManager  - get_userRunAction() member function was added;
+                     (changed file: G4RunManager.hh)
+     G4VHitsCollection -  #ifndef __CINT__ condition was added
+                     (changed file: G4VHitsCollection.hh)
+
+   15.6.98:
+     AlTPCSD: 
+       changed GetTGASSectorNo(), GetTGASPadsRowNo(), GetTGASPadInRowNo()   
+       (due to the change of AlTPC00DetConstruction);
+       !! These functions are wrong now for AlTPC01DetConstruction.
+
+   12.6.98:
+     removed save() and saveVerbose() member functions
+     and removed aParticleName attribute in all AlXXXHit;
+
+   12.5.98:
+     AlXXXHitsCollection:printAllHits():
+       added printing of global information (HCname, number of hits in HC);
+       - get_name() does not work in persistent case !! 
+       
+   11.5.98:
+     added Objy persistency for ITS hits according to
+     run/example5;
+     Objectivity database is created in $(ALICE_HOME)/ObjyDatabase
+     directory.
+
+   4.5.98:
+     - Renaming of classes:
+       AliceXXX -> AlXXX
+
+   6.4.98: 
+      added DDD =PHOS   
+
+   31.3.98: 
+      added DDD=TPC
+   27.3.98: 
+    - new sensitive detector classes:
+      DDDSD (DDD = name of detector);
+    - new hit classes:
+      DDDHit, DDDHitsCollection
+        (DDD = name of detector);
+      only DDD=ITS available now;
+    - Hits information is printed on the screen,
+       it is not yet saved into a file/database;
+       verbose key skould be added
+
+   Before dating:
+   - Sensitive volumes: GSDET, GSDETH from g3tog4 not accepted
+     (in g3tog4 - hits definition are not transformed; 
+      commented lines in the source g3tog4 code)
diff --git a/AliGeant4/doc/history/alice_global_History b/AliGeant4/doc/history/alice_global_History
new file mode 100644 (file)
index 0000000..e74673a
--- /dev/null
@@ -0,0 +1,62 @@
+$Id$
+-----------------------------------------------------------------
+
+alice/global:
+=============
+  27.5.99:
+     G3Cut.h, G3Flag.h: new enum types;
+     AliLimits:
+       fFlagVector (the vector of G3FlagValue flag values)
+         is added;
+       fIsCut/Flag boolean data members are addes:
+         true is return in case the cut/flag value is set;      
+
+  20.4.99:
+     AliLimits: new class derived from G4UserLimits;
+       fCutVector (the vector of double energy cut values)
+       is added to the G4UserLimits.
+
+  11.3.99:
+     AliG3ToG4Geometry was renamed to AliG3GeometryManager 
+     and moved to g3tog4.
+     AliG4MonteCarlo was renamed to AliG4StepManager and 
+     moved to digits+hits.
+  16.2.99:
+     The "empty" interface class AliG3ToG4Geometry:AliGeomInterface
+     has been added;
+     The abstract interface is used for the time being only in 
+     the method AliITSv0::CreateGeometry (aliroot) still commented 
+     and its derived class (AliG3ToG4Geometry) is used by 
+     (still "empty") AlITSv0DetConstruction for building geometry.
+       
+  9.2.99:
+     Class AliG4MonteCarlo derived from AliMC (in aliroot)
+     temporarily moved from aliroot;
+     
+  18.9.98:
+     Class AlConstants renamed to AlGlobals;
+     All "global" definitions are defined in the class
+     AlGlobals scope.
+     Added: 
+     static variables for Root definitions;
+     
+  18.8.98:
+     Category name Globals was changed to Global;
+     Changed: 
+       AlConstants::GeomPrecission to aGeomPrecission
+     Added:
+       G4String AlConstants::aDataDirPath (relative path 
+          from bin to data directory)  
+
+  11.5.98:
+     ALICE_GPARAMETERS_CHECK flag was removed;
+
+  4.5.98:
+     Renaming:
+     AliceXXX -> AlXXX
+
+  30.1.98: 
+     a file for global parameters definitions was created:
+     AliceGlobals containing global objects:
+     class AliceConstants, function AliceException
diff --git a/AliGeant4/doc/history/alice_physics_History b/AliGeant4/doc/history/alice_physics_History
new file mode 100644 (file)
index 0000000..7c757e4
--- /dev/null
@@ -0,0 +1,42 @@
+$Id$
+-----------------------------------------------------------------
+
+alice/physics:
+==============
+  27.5.99:
+     New class:
+     AliSpecialFlags : G4VProcess
+       defines the process that sets the physics process control
+       flags defined in AliLimits (global);
+       !! Some processes in G4 (eg. multiple-scattering) do not
+       work correctly if they are "alone" (ie. msc does not work if
+       this is the only process in addition to G4Transportation
+       associated with the particle.) 
+
+  20.4.99:
+     New classes:
+     AliPhysicsList : G4VUserPhysicsList
+       replaces older AlPhysicsList class;
+       ConstructSpecialCuts() method has been added; 
+     AliSpecialCuts : G4VProcess
+       (currently is derived from G4UserSpecialCuts - to be changed)
+       defines the process that sets kinetic energy cuts
+       defined in the AliLimits (global);
+
+  18.8.98:
+     Added classes:
+     AlEmptyPhysicsList  
+       (used only when env. variable ALEMPTY_PHYSICS_LIST is set)          
+     AlPhysicsListMessenger
+       according to N02PhysicsListMessenger
+
+  4.5.98:  
+     Renaming:
+     AlicePhysicsList -> AlPhysicsList 
+
+  9.2.98: new class Alice physics list: 
+     (geant4 way) definition of particles and physical processes;
+     accoring to run/test_skeleton example
+     - class: AlicePhysicsList 
+     
+
diff --git a/AliGeant4/doc/history/alice_run_History b/AliGeant4/doc/history/alice_run_History
new file mode 100644 (file)
index 0000000..ecddf32
--- /dev/null
@@ -0,0 +1,89 @@
+$Id$
+-------------------------------------------------------------
+
+alice/run:
+==========
+  17.4.00:
+     AliRunMessenger - new class;
+       - implements commands /aliRun/initialize, /aliRun/beamOn
+         that call the AliRun::Init(), AliRun::Run() methods
+
+  7.3.00:
+     AliPrimaryGeneratorAction:
+       - added enum type AliPrimaryGenerator;  
+       - renaming methods
+       - ConstructAliGenerator(), GenerateAliGeneratorPrimaries()
+         - new methods supported AliGenerator from AliRoot;
+        (AliGenerator is instantiated in Config.C; the event generator
+         libraries are loaded dynamicaly from AliRoot/lib) 
+     AliPrimaryGeneratorMessenger:
+       changed commands: /alPrimaries -> /alGenerator
+                         /alPrimaries/generator id -> /alGenerator/set genName
+       
+  28.7.99:
+     All classes renamed: Al -> Ali
+
+  11.3.99:
+     New classes:
+     AlG4RunManager : AliRunManager
+       - creates and configures G4RunManager, AlVisManager,
+         geant4 and Root UI (interactive shells)
+     AlG4RunMessenger 
+       - defines commands /alRun/*
+         that were previously defined by AlRunActionMessenger
+
+  24.2.99:
+     AlRunAction:
+       StartRootUI() - method for switch to the interactive Root UI;
+       Root graphic does not work when OPACS graphics driver is used.
+     AlRunActionMessenger - new class;
+       commands:  /alRun/verbose
+                  /alRun/root
+                     
+  5.11.98:
+     AlPrimaryGeneratorAction:
+       new attributes:
+         G4int fGeneratorID;
+         G4int fNofGunParticles;
+       new methods:
+         ConstructParticleGun():
+           creates the generator selected by fGeneratorID
+           and fNofGunParticles (default: 1);
+           implemented generators:
+              void GeantinoGenerator() - default;
+              void ChargedgeantinoGenerator();
+              void PiKaonProtonMixtureGenerator();
+     New class: 
+     AlPrimaryGeneratorMessenger
+       commands for changing fGeneratorID and fNofGunParticles:
+       /alPrimaries/generator
+       /alPrimaries/nofParticles
+       The particle gun built by generator can be listed/modified
+       by  /alPrimaries/gun commands.  
+       
+  18.9.98:
+     Modified for new persistency (root) design.   
+     
+  18.8.98:
+     Options G4ROOT/ODBMS_STORE_HITS renamed to ALICE_ROOT/ODBMS;
+     updated for beta01
+     
+  3.7.98:
+     modified for root persistency option (G4ROOT_STORE_HITS);
+
+  15.6.98:
+     Deafault AlPrimaryGeneratorAction:
+     generates 20 pi with given distribution of eta, pT
+     !! check/change to a good physics example 
+     
+  11.5.98:
+     GNUmakefile: added G4ODBMS option 
+
+  4.5.98:
+     Renaming of classes:
+     AliceXXX -> AlXXX
+
+  30.1.98:
+     added default Alice primary generator action
+     (using AliceParticleGun)
+
diff --git a/AliGeant4/doc/history/alice_visualization_History b/AliGeant4/doc/history/alice_visualization_History
new file mode 100644 (file)
index 0000000..db8fed5
--- /dev/null
@@ -0,0 +1,49 @@
+$Id$
+-----------------------------------------------------------------
+
+alice/visualisation:
+====================
+  7.9.99:
+    AlVisManager:
+      The AG4_VISUALIZE flag has been replaced with G4VIS_USE
+      => the independent on Ali* specifics  class has been renamed to
+      TG4VisManager and moved to g4mc/management.
+
+  2.11.98:
+    AlDetColours replaced with:
+    AlColour, AlColourStore:
+      AlColour - stores rgb values and colour name value;
+      AlColourStore - stores all defined AlColour instances in RW array;
+        Methods: GetColour(name), GetColoursList()
+          
+  16.10.98:
+    paramdef directory was removed;
+    see also geometry/History;
+    
+  18.8.98:
+    Changed colours names: the first letter changed to the capital one;
+    
+  4.5.98:
+    Renaming:
+    AliceDetColours -> AlDetColours
+    
+  7.4.98: added (G)UI chooser; 
+    enabled OPACS Wo; 
+    created Alice.odb according to  visualisation/test/test19.odb;
+    To run Alice with Wo:
+    /HP-AFS/Alice Wo
+    
+  27.3.98: visualisation parameters are defined in xxxVisualization.hh,cc
+    in the paramdef directory (xxx = name of detector)
+
+  10.3.98: Available graphics packages:
+    a) Fukui Renderer:      
+       /vis/create_view/new_graphics_system DAWN
+    b) OPACS:
+       /vis/create_view/new_graphics_system Xo
+
+  16.1.98: a class with predefined colours was created:
+    AliceDetColours  
+      
+    
+
diff --git a/AliGeant4/doc/history/g4mc_History b/AliGeant4/doc/history/g4mc_History
new file mode 100644 (file)
index 0000000..7e6438e
--- /dev/null
@@ -0,0 +1,226 @@
+$Id$
+-----------------------------------------------------------------
+
+G4MC:
+=======
+ 28.4.00:
+    cint:
+       new subdirectory for Root dictionary classes;
+       only header files that are specified in the include/.rootcint
+       file are processed;
+
+ 28.3.00: new subcategories introduced:
+    geometry, physics, event, run, global, visualization
+
+ 7.3.00:
+    TG4RunManager:
+       added inheritance from AliVMC;
+       Changed the roles with TGeant4: main program
+       instantiates TG4RunManager and TGeant4 is created
+       within TG4RunManager constructor.
+       (see aliroot/History, too)
+
+  24.2.00:
+    TG4VisManager:
+       AliMC methods for visualization (Gsatt, Gdraw)
+       has been implemeted.
+       Comments:
+       Gdraw() ignores the last four parameters (e.g. position of the volume 
+       center and scaling factors) the volume is automatically centered 
+       in the window and make it confortably on the view at any viewing 
+       angle. 
+       If the visible attributes for a required volume are shared by others 
+       (in G4 it is possible) Gsatt() duplicates them so they
+       can be changed at any time.
+
+  17.12.99:
+    New class TG4GeometryOutputManager:
+    management of g3calls.dat output (open/close
+    the file; prvides write method for G3 "tokens").
+
+  6.12.99:
+    TG4GeometryManager:
+      Added methods for writing (if fWriteGeometry is set true
+      -> the methods for writing tokens WG4xxx() are called before
+      TG4xxx()) and reading tokens (ReadG3Geometry()) 
+      to/from g3calls.dat files.      
+
+  18.9.99:
+    TG4gspos:
+      Exception case "INCONSISTENT GEOMETRY" has been
+      taken into account: for each mother copy
+      (created with gsposp) a new VTE daughter is creted
+      !! TO DO: to create only new G3Pos, set
+      mother <-> daughter and use test of existence of logical
+      volume in G3toG4BuildTree to position this volume
+      correctly
+
+  7.9.99:
+    TG4VisManager:
+      After the AG4_VISUALIZE flag has been replaced with G4VIS_USE,
+      the independent on Ali* specifics class has been renamed from
+      AlVisManager and moved from visualization.
+
+  6.9.99:
+     TG4PhysicsList::ConstructEM()
+       When only one instance of Muon process of each type
+       is created for both mu+ and mu- -> run-time error.
+       The new instance of each process is created each time
+       when it is associated with a new particle.
+
+  12.8.99:
+     Physics management - new classes:
+     TG4PhysicsManager: 
+       - cuts/process flags handling has been moved from 
+         TG4GeometryManager here
+       - methods SetCut(), SetProcess() fro global setup
+         of physics has been implemented  
+     TG4Cut/FlagVector:
+       - replaced the RW vector of cut/flag values;
+         get methods moved from TG4Limits here
+        (as these classes are used also for storing the global
+         physics setup)
+     TG4PhysicsList 
+       - replaced AliPhysics list
+       - build physics setup according to TG4Cut/FlagVector 
+         set in the TG4PhysicsManager           
+
+  17.6.99:
+     New category g4mc has been created;
+       It contains all classes that implements the interface
+       to the abstract Monte Carlo (AliMC) class for Geant4.
+       Subcategories:
+         g3tog4     - corrected methods from geant4 g3tog4 package 
+                     (moved from previous g3tog4 category)
+         management - all other classes/methods implemented for
+                     AliMC          
+
+G3toG4:
+=======
+  17.12.99:
+    g3tog4 has been replaced from G4 g3tog4;
+    WG4xxx() methods for writing tokens to g3calls.dat
+    have been merged into the TG4GeometryOutputManager class;
+    TG4gstparcut/flag() methods have been moved to 
+    TG4GeometryManager as they were not yet provided to G4.
+
+  6.12.99:
+    Added methods for reading (RG4xxx()) and writing (WG4xxx())
+    tokens to/from g3calls.dat file.
+    The generated g3calls.dat file can be processed with standard
+    g3tog4 tool in G4.
+
+  8.11.99:
+    TG3Division: 
+        Class methods has been modified:
+        public UpdateVTE() method has been added:
+          it redefines the divided volume parameters,
+          creates solid and eventually envelope VTE and its solid,
+          and calculates parameters needed for creating G4PVReplica
+          (parameters are stored in class data members)
+       public CreatePVReplica() has been modified:
+          it creates G4PVReplica using the parameteres stored
+          in relevant class data members;   
+
+  2.11.99:
+    TG3Division: 
+      - Test of existence of clones of mother added;
+        TO DO: restore Npar, Rpar from mother when G4gsdvn/t(2)
+        are processed in order to take into account positioning
+        with gsposp into division. 
+      - CONS division for axis 2,3 has been implemented;
+        missing parts in CreateEnvelope() for supported division
+       has been added  
+    G3Pos, TG3toG4BUildTree:
+        Mother volume name is stored in G3Pos in order to be able to
+       place the VTE's positions correctly in case when more 
+       different mothers (not only clone copies) exist.        
+  
+  13.10.99: 
+     TG3VolTableEntry:
+        removed inheritance from orig. VolTableEntry,
+       added vector of TG3VolTableEntry* fClones;
+        In case a volume is positioned with negative parameters
+       or via gsposp - a new vte (clone) is created and
+       its pointer is added to fClones. The original vte
+       is kept unchanged.      
+
+  7.9.99:
+     TG3Division - new class;
+        Used for storing the parameters for the division
+       methods and for creating the G4 correspondent geometry;
+       Extern methods G4MakeReplica/Envelope were moved
+       here (as member function CreateLV(), CreateEnvelope()  
+     Division methods TG4Gstdvn/t(2) has been rewritten with
+        usage of TG3Division                
+     TO DO: Extract the parts that build G4 geometry objects
+        into TG3toG4BuildTree() method         and unified this method
+       for VTEs with positions and divisions;        
+
+  12.8.99:
+     Updated to geant4.0.1 release:
+     change of the "table" classes
+     -> added class: TG3Mat/Med/RotTable, 
+                     TG3Mat/Med/RotTableEntry
+                    TG3VolTableEntry : VolTableEntry
+     Change of the way of construction of G4 geometry:
+     the G3VolTable is filled (with TG3VolTableEntry objects)
+     when processing the G3-like methods and G4 geometry objects
+     are created afterwords.
+     Division methods TG4Gstdvn/t(2) has not yet been updated.                      
+
+  11.6.99:
+     Gstmate(), Gstmixt():
+         retrieving elements from the default element table 
+         has been implemented;
+         several bugs in materials definition were fixed;
+     MixMaterial() - new method for mixing materials
+         was implemented;
+
+  27.5.99:
+     AliG3GeometryManager:
+       Gstpar() method has been updated for setting
+         physics processes control flags, too, in similar way as
+        cut values.
+
+  20.4.99:
+     AliG3GeometryManager:
+       Gstpar() method (that sets the tracking media parameters
+          in Geant3) has been implemented for kinetic energu cut parameters:
+          The cut values are stored in the AliLimits:G4UserLimits (global) 
+          and are applied by AliSpecialCuts:G4UserSpecialCuts (physics)
+          as the additional process that is added to the defined particles
+          in the AliPhysicsList (physics).
+       New methods:
+       UseG3Defaults(): 
+          switchs the fUseG3Defaults option -> 
+         the G3 default cut values are set for all logical volumes ;
+       IsSpecialCuts():
+          returns true if any logical volume has defined the
+         AliLimits
+       GetSwitchCutVector():
+          returns a vector of booleans - with info which particles
+         have set the special cuts; 
+     AliG3Defaults: new class
+          contains the Geant3 default parameters as static constants
+         and a static method for inquiring whether a given parameter
+         value is equal to the default one;
+             
+  22.3.99:
+     All AG4gsdv*.cxx were reimplemented. Now it works for following
+     volumes:
+      BOX, TRD1-z, TRD2-z,TUBE, TUBS, CONE-phi,z CONS-phi,z 
+
+  19.3.99:
+     G3SensVolVector - has been added:
+       In case the created logical volume contains a medium with isvol>0
+       its pointer is stored in the extern G3SensVol vector.
+       The G3SensVol is defined in AliG3GeometryManager.cxx.
+
+  11.3.99:
+     Class AliG3ToG4Geometry was renamed to AliG3GeometryManager 
+     and moved from global;
+  10.2.99: 
+     Category for classes and methods for porting
+     G3 geometry to G4.
diff --git a/AliGeant4/doc/history/g4mc_geometry_History b/AliGeant4/doc/history/g4mc_geometry_History
new file mode 100644 (file)
index 0000000..d1c24a7
--- /dev/null
@@ -0,0 +1,21 @@
+$Id$
+-----------------------------------------------------------------
+
+g4mc/geometry:
+==============
+  6.6.00: TG4NameMap moved to g4mc/global;
+        as it is used also in TG4PhysicsManager
+       for mapping names of particles between
+       G4 and TDatabasePDG
+
+  13.4.00:
+     TG4NameMap: new class;
+        defines a map for associated names;
+       it is used in TG4Geometry manager for the map of
+       G3 volume names with the modules name; 
+       
+  28.3.00:
+     New subcategory:
+     Classes: TG4GeometryManager, TG4GeometryOutputManager,
+              TG4VSensitiveDetector, TG4ElementTable
+
diff --git a/AliGeant4/doc/history/g4mc_global_History b/AliGeant4/doc/history/g4mc_global_History
new file mode 100644 (file)
index 0000000..43f628b
--- /dev/null
@@ -0,0 +1,20 @@
+$Id$
+-----------------------------------------------------------------
+
+g4mc/global:
+============
+  6.6.00: 
+     TG4IntMap - new class; map of names to integer values;
+         used in TG4PhysicsManager for mapping between
+        G4particle names and non-standard PDG codes.
+     TG4NameMap moved from g4mc/geometry.
+
+  27.4.00
+     TG3Units - new class;
+     Defines the G3 default units of physical quantities; 
+     all physical quantities returned by MC are expressed 
+     in these units.
+
+  28.3.00:
+     New subcategory:
+     Classes: TG4Globals, TG4Limits
diff --git a/AliGeant4/doc/history/g4mc_physics_History b/AliGeant4/doc/history/g4mc_physics_History
new file mode 100644 (file)
index 0000000..07f0def
--- /dev/null
@@ -0,0 +1,19 @@
+$Id$
+-----------------------------------------------------------------
+
+g4mc/physics:
+=============
+  6.6.00:
+     TG4PhysicsList: updated according the example N04;
+        all particles are instantiated; hadronic processes
+       are added;
+     TG4PhysicsListMessenger: new class;
+        implements commands for selection of the processes
+       (setOptical, setHadron, setSpecialCuts/Flags)    
+            
+
+  28.3.00:
+     New subcategory:
+     Classes: TG4CutVector, TG4FlagVector, TG4SpecialCuts, TG4SpecialFlags,
+              TG4PhysicsList, TG4PhysicsManager, TG4G3Defaults
+     Enum types: TG3Cut, TG3Flag, TG3ParticleWSP
diff --git a/AliGeant4/doc/history/g4mc_run_History b/AliGeant4/doc/history/g4mc_run_History
new file mode 100644 (file)
index 0000000..e5d2517
--- /dev/null
@@ -0,0 +1,22 @@
+$Id$
+-----------------------------------------------------------------
+
+g4mc/run:
+=========
+  28.4.00:
+     TGeant4:
+     Root dictionary is created for this class;
+     Files for supporting rootcint (.rootcint, runLinkDef.h)
+     have been added.     
+
+  17.4.00:
+     TG4RunManager:
+     inheritance from AliVMC removed (as AliVMC has been merged in AliMC);
+     Changed the roles with TGeant4 back: main program
+     instantiates TGeant4 and TG4RunManager is created
+     within TGeant4 constructor.
+
+  28.3.00:
+     New subcategory:
+     Classes: TG4RunManager, TG4RunMessenger, TG4VRunConfiguration,
+              TGeant4, TG4Messenger,
diff --git a/AliGeant4/doc/history/g4mc_visualization_History b/AliGeant4/doc/history/g4mc_visualization_History
new file mode 100644 (file)
index 0000000..689c0af
--- /dev/null
@@ -0,0 +1,12 @@
+$Id$
+-----------------------------------------------------------------
+
+g4mc/visualization:
+===================
+  26.4.00:
+     enum type TG3Attribute.h 
+     separated from TG4VisManager
+
+  28.3.00:
+     New subcategory:
+     Classes: TG4VisManager
diff --git a/AliGeant4/macro/CASTOR/Config.C b/AliGeant4/macro/CASTOR/Config.C
new file mode 100644 (file)
index 0000000..5fafaf5
--- /dev/null
@@ -0,0 +1,11 @@
+void Config(Int_t version)
+{
+  gSystem->Load("$(ALICE_ROOT)/lib/tgt_$(ALICE_TARGET)/libCASTOR");
+
+  AliCASTOR* CASTOR = 0;
+  switch (version) {
+    case 1: CASTOR  = new AliCASTORv1("CASTOR","normal CASTOR"); break;
+  }  
+
+//=================== CASTOR parameters ============================
+}
diff --git a/AliGeant4/macro/CASTOR/Config.in b/AliGeant4/macro/CASTOR/Config.in
new file mode 100644 (file)
index 0000000..8c68303
--- /dev/null
@@ -0,0 +1,5 @@
+# CASTOR
+
+#/aliDet/castor/setAllSensitive true
+/aliDet/castor/setFrame CAL
diff --git a/AliGeant4/macro/FMD/Config.C b/AliGeant4/macro/FMD/Config.C
new file mode 100644 (file)
index 0000000..ebc9861
--- /dev/null
@@ -0,0 +1,12 @@
+void Config(Int_t version)
+{
+  gSystem->Load("$(ALICE_ROOT)/lib/tgt_$(ALICE_TARGET)/libFMD");
+
+  AliFMD* FMD = 0;
+  switch (version) {
+    case 0: FMD =  new AliFMDv0("FMD", "FMDv0 detector"); break;
+    case 1: FMD  = new AliFMDv1("FMD","normal FMD");        break;
+  }  
+
+//=================== FMD parameters ============================
+}  
diff --git a/AliGeant4/macro/FMD/Config.in b/AliGeant4/macro/FMD/Config.in
new file mode 100644 (file)
index 0000000..8d076c8
--- /dev/null
@@ -0,0 +1,5 @@
+# FMD
+
+#/aliDet/fmd/setAllSensitive true
+/aliDet/fmd/setFrame FMD
diff --git a/AliGeant4/macro/ITS/Config.C b/AliGeant4/macro/ITS/Config.C
new file mode 100644 (file)
index 0000000..7cc7329
--- /dev/null
@@ -0,0 +1,20 @@
+void Config(Int_t version)
+{
+  gSystem->Load("$(ALICE_ROOT)/lib/tgt_$(ALICE_TARGET)/libITS");
+
+  AliITS* ITS = 0;
+  switch (version) {
+    case 1: ITS  = new AliITSv1("ITS","ITSv1 detector"); break;
+    case 3: ITS  = new AliITSv3("ITS","ITSv3 detector"); break; 
+    case 5: ITS  = new AliITSv5("ITS","normal ITS");       break;
+  }  
+
+//=================== ITS parameters ============================
+//
+// EUCLID is a flag to output (=1) both geometry and media to two ASCII files 
+// (called by default ITSgeometry.euc and ITSgeometry.tme) in a format
+// understandable to the CAD system EUCLID. The default (=0) means that you 
+// dont want to use this facility.
+//
+ITS->SetEUCLID(0);
+}
diff --git a/AliGeant4/macro/ITS/Config.in b/AliGeant4/macro/ITS/Config.in
new file mode 100644 (file)
index 0000000..1c8c963
--- /dev/null
@@ -0,0 +1,5 @@
+# ITS
+
+/aliDet/its/setAllSensitive true
+/aliDet/its/setFrame ITSV
diff --git a/AliGeant4/macro/MUON/Config.C b/AliGeant4/macro/MUON/Config.C
new file mode 100644 (file)
index 0000000..d1ac754
--- /dev/null
@@ -0,0 +1,329 @@
+void Config(Int_t version)
+{
+  gSystem->Load("$(ALICE_ROOT)/lib/tgt_$(ALICE_TARGET)/libminicern");
+  gSystem->Load("$(ALICE_ROOT)/lib/tgt_$(ALICE_TARGET)/libMUON");
+
+  AliMUON *MUON = 0;
+  switch (version) {
+    case 0: MUON  = new AliMUONv0("MUON","normal MUON"); break;
+  }  
+
+//=================== MUON parameters ===========================
+  MUON->SetMaxStepGas(0.1);
+  MUON->SetMaxStepAlu(0.1);
+
+//
+// Version 0
+//
+// First define the number of planes that are segmented (1 or 2) by a call
+// to SetNsec. 
+// Then chose for each chamber (chamber plane) the segmentation 
+// and response model.
+// They should be equal for the two chambers of each station. In a future
+// version this will be enforced.
+//
+//  
+ Int_t chamber;
+ Int_t station;
+// Default response
+ AliMUONresponseV0* response0 = new AliMUONresponseV0;
+ response0->SetSqrtKx3(0.7131);
+ response0->SetKx2(1.0107);
+ response0->SetKx4(0.4036);
+ response0->SetSqrtKy3(0.7642);
+ response0->SetKy2(0.9706);
+ response0->SetKy4(0.3831);
+ response0->SetPitch(0.25);
+ response0->SetSigmaIntegration(10.);
+ response0->SetChargeSlope(50);
+ response0->SetChargeSpread(0.18, 0.18);
+ response0->SetMaxAdc(4096);
+//--------------------------------------------------------
+// Configuration for Chamber TC1/2  (Station 1) ----------           
+//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+// Float_t rseg1[4]={17.5, 55.2, 71.3, 95.5};
+ Float_t rseg1[4]={15.5, 55.2, 71.3, 95.5};
+ Int_t   nseg1[4]={4, 4, 2, 1};
+//
+ chamber=1;
+//^^^^^^^^^
+ MUON->SetNsec(chamber-1,2);
+//
+ AliMUONsegmentationV01 *seg11=new AliMUONsegmentationV01;
+ seg11->SetSegRadii(rseg1);
+ seg11->SetPADSIZ(3, 0.5);
+ seg11->SetDAnod(3.0/3./4);
+ seg11->SetPadDivision(nseg1);
+ MUON->SetSegmentationModel(chamber-1, 1, seg11);
+//
+ AliMUONsegmentationV02 *seg12=new AliMUONsegmentationV02;
+ seg12->SetSegRadii(rseg1); 
+ seg12->SetPADSIZ(0.75, 2.0);
+ seg12->SetDAnod(3.0/3./4);
+ seg12->SetPadDivision(nseg1);
+
+ MUON->SetSegmentationModel(chamber-1, 2, seg12);
+
+ MUON->SetResponseModel(chamber-1, response0);     
+
+ chamber=2;
+//^^^^^^^^^
+//
+ MUON->SetNsec(chamber-1,2);
+//
+ AliMUONsegmentationV01 *seg21=new AliMUONsegmentationV01;
+ seg21->SetSegRadii(rseg1);
+ seg21->SetPADSIZ(3, 0.5);
+ seg21->SetDAnod(3.0/3./4);
+ seg21->SetPadDivision(nseg1);
+ MUON->SetSegmentationModel(chamber-1, 1, seg21);
+//
+ AliMUONsegmentationV02 *seg22=new AliMUONsegmentationV02;
+ seg22->SetSegRadii(rseg1); 
+ seg22->SetPADSIZ(0.75, 2.);
+ seg22->SetDAnod(3.0/3./4);
+ seg22->SetPadDivision(nseg1);
+ MUON->SetSegmentationModel(chamber-1, 2, seg22);
+
+ MUON->SetResponseModel(chamber-1, response0);     
+//
+//--------------------------------------------------------
+// Configuration for Chamber TC3/4 -----------------------
+//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+// Float_t rseg2[4]={23.5, 47.1, 87.7, 122.5};
+ Float_t rseg2[4]={21.5, 47.1, 87.7, 122.5};
+ Int_t   nseg2[4]={4, 4, 2, 1};
+//
+ chamber=3;
+//^^^^^^^^^
+ MUON->SetNsec(chamber-1,2);
+//
+ AliMUONsegmentationV01 *seg31=new AliMUONsegmentationV01;
+ seg31->SetSegRadii(rseg2);
+ seg31->SetPADSIZ(3, 0.5);
+ seg31->SetDAnod(3.0/3./4);
+ seg31->SetPadDivision(nseg2);
+ MUON->SetSegmentationModel(chamber-1, 1, seg31);
+//
+ AliMUONsegmentationV02 *seg32=new AliMUONsegmentationV02;
+ seg32->SetSegRadii(rseg2); 
+ seg32->SetPADSIZ(0.75, 2.);
+ seg32->SetPadDivision(nseg2);
+ seg32->SetDAnod(3.0/3./4);
+
+ MUON->SetSegmentationModel(chamber-1, 2, seg32);
+
+ MUON->SetResponseModel(chamber-1, response0);     
+
+ chamber=4;
+//^^^^^^^^^
+//
+ MUON->SetNsec(chamber-1,2);
+//
+ AliMUONsegmentationV01 *seg41=new AliMUONsegmentationV01;
+ seg41->SetSegRadii(rseg2);
+ seg41->SetPADSIZ(3, 0.5);
+ seg41->SetDAnod(3.0/3./4);
+ seg41->SetPadDivision(nseg2);
+ MUON->SetSegmentationModel(chamber-1, 1, seg41);
+//
+ AliMUONsegmentationV02 *seg42=new AliMUONsegmentationV02;
+ seg42->SetSegRadii(rseg2); 
+ seg42->SetPADSIZ(0.75, 2.);
+ seg42->SetPadDivision(nseg2);
+ seg42->SetDAnod(3.0/3./4);
+
+ MUON->SetSegmentationModel(chamber-1, 2, seg42);
+
+ MUON->SetResponseModel(chamber-1, response0);     
+
+
+//--------------------------------------------------------
+// Configuration for Chamber TC5/6 -----------------------
+//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+/*
+ seg5 =  new AliMUONsegmentationV1;
+ AliMUONresponseV0* response5 =  new AliMUONresponseV0;
+ // K3 = 0.62
+ response5->SetSqrtKx3(0.78740079);
+ response5->SetKx2(0.95237319); //  0.5 * kPI * (1- 0.5*sqrtky3 )
+ response5->SetKx4(0.37480633); // 0.25/TMath::ATan(sqrtkx3)
+ // K3 = 0.55
+ response5->SetSqrtKy3(0.74161985);
+ response5->SetKy2(0.98832946);
+ response5->SetKy4(0.39177817);
+ response5->SetPitch(0.325);
+ response5->SetSigmaIntegration(10.);
+ response5->SetChargeSlope(50);
+ response5->SetChargeSpread(0.4, 0.4);
+ response5->SetMaxAdc(4096);
+
+ chamber=5;
+ MUON->SetNsec(chamber-1,1);
+ MUON->SetSegmentationModel(chamber-1, 1, seg5);
+ MUON->SetResponseModel(chamber-1, response5);     
+
+ chamber=6;
+ MUON->SetNsec(chamber-1,1);
+ MUON->SetSegmentationModel(chamber-1, 1, seg5);
+ MUON->SetResponseModel(chamber-1, response5);     
+//
+// Station 3
+ station=3;
+ MUON->SetPADSIZ(station, 1, 0.975, 0.55);
+*/
+
+ chamber=5;
+//^^^^^^^^^
+ MUON->SetNsec(chamber-1,2);
+//
+ AliMUONsegmentationV0 *seg51=new AliMUONsegmentationV0;
+ seg51->SetPADSIZ(0.75, 0.5);
+ seg51->SetDAnod(3.0/3./4);
+ MUON->SetSegmentationModel(chamber-1, 1, seg51);
+//
+ AliMUONsegmentationV0 *seg52=new AliMUONsegmentationV0;
+ seg52->SetPADSIZ(0.5,0.75);
+ seg52->SetDAnod(3.0/3./4);
+ MUON->SetSegmentationModel(chamber-1, 2, seg52);
+
+ MUON->SetResponseModel(chamber-1, response0);     
+
+ chamber=6;
+//^^^^^^^^^
+ MUON->SetNsec(chamber-1,2);
+//
+ AliMUONsegmentationV0 *seg61=new AliMUONsegmentationV0;
+ seg61->SetPADSIZ(0.75, 0.5);
+ seg61->SetDAnod(3.0/3./4);
+ MUON->SetSegmentationModel(chamber-1, 1, seg61);
+//
+ AliMUONsegmentationV0 *seg62=new AliMUONsegmentationV0;
+ seg62->SetPADSIZ(0.5,0.75);
+ seg62->SetDAnod(3.0/3./4);
+ MUON->SetSegmentationModel(chamber-1, 2, seg62);
+
+ MUON->SetResponseModel(chamber-1, response0);   
+
+//--------------------------------------------------------
+// Configuration for Chamber TC7/8  (Station 4) ----------           
+//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ Int_t   nseg4[4]={4, 4, 2, 1};
+
+ chamber=7;
+//^^^^^^^^^
+ MUON->SetNsec(chamber-1,2);
+//
+ AliMUONsegmentationV04 *seg71=new AliMUONsegmentationV04;
+ seg71->SetPADSIZ(10.,0.5);
+ seg71->SetDAnod(0.25);
+ seg71->SetPadDivision(nseg4);
+ MUON->SetSegmentationModel(chamber-1, 1, seg71);
+
+ AliMUONsegmentationV05 *seg72=new AliMUONsegmentationV05;
+ seg72->SetPADSIZ(1,10);
+ seg72->SetDAnod(0.25);
+ seg72->SetPadDivision(nseg4);
+ MUON->SetSegmentationModel(chamber-1, 2, seg72);
+
+ MUON->SetResponseModel(chamber-1, response0);     
+
+ chamber=8;
+//^^^^^^^^^
+ MUON->SetNsec(chamber-1,2);
+ AliMUONsegmentationV04 *seg81=new AliMUONsegmentationV04;
+ seg81->SetPADSIZ(10., 0.5);
+ seg81->SetPadDivision(nseg4);
+ seg81->SetDAnod(0.25);
+ MUON->SetSegmentationModel(chamber-1, 1, seg81);
+
+ AliMUONsegmentationV05 *seg82=new AliMUONsegmentationV05;
+ seg82->SetPADSIZ(1, 10);
+ seg82->SetPadDivision(nseg4);
+ seg82->SetDAnod(0.25);
+ MUON->SetSegmentationModel(chamber-1, 2, seg82);
+
+ MUON->SetResponseModel(chamber-1, response0);     
+//--------------------------------------------------------
+// Configuration for Chamber TC9/10  (Station 5) ---------           
+//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ chamber=9;
+//^^^^^^^^^
+ MUON->SetNsec(chamber-1,2);
+//
+ AliMUONsegmentationV04 *seg91=new AliMUONsegmentationV04;
+ seg91->SetPADSIZ(10.,0.5);
+ seg91->SetDAnod(0.25);
+ seg91->SetPadDivision(nseg4);
+ MUON->SetSegmentationModel(chamber-1, 1, seg91);
+
+ AliMUONsegmentationV05 *seg92=new AliMUONsegmentationV05;
+ seg92->SetPADSIZ(1,10);
+ seg92->SetDAnod(0.25);
+ seg92->SetPadDivision(nseg4);
+
+ MUON->SetSegmentationModel(chamber-1, 2, seg92);
+
+ MUON->SetResponseModel(chamber-1, response0);     
+
+ chamber=10;
+//^^^^^^^^^
+ MUON->SetNsec(chamber-1,2);
+ AliMUONsegmentationV04 *seg101=new AliMUONsegmentationV04;
+ seg101->SetPADSIZ(10., 0.5);
+ seg101->SetPadDivision(nseg4);
+ seg101->SetDAnod(0.25);
+ MUON->SetSegmentationModel(chamber-1, 1, seg101);
+
+ AliMUONsegmentationV05 *seg102=new AliMUONsegmentationV05;
+ seg102->SetPADSIZ(1,10);
+ seg102->SetPadDivision(nseg4);
+ seg102->SetDAnod(0.25);
+ MUON->SetSegmentationModel(chamber-1, 2, seg102);
+
+ MUON->SetResponseModel(chamber-1, response0);     
+//--------------------------------------------------------
+// Configuration for Trigger staions --------------------- 
+// (not yet used/implemented) ----------------------------          
+//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ chamber=11;
+ MUON->SetNsec(chamber-1,1);
+ AliMUONsegmentationV0 *seg1112=new AliMUONsegmentationV0;
+ seg1112->SetDAnod(0.51/3.);
+
+ MUON->SetSegmentationModel(chamber-1, 1, seg1112);
+ MUON->SetResponseModel(chamber-1, response0);     
+
+ chamber=12;
+ MUON->SetNsec(chamber-1,1);
+ MUON->SetSegmentationModel(chamber-1, 1, seg1112);
+ MUON->SetResponseModel(chamber-1, response0);     
+//
+// Trigger Station 1
+ station=6;
+ MUON->SetPADSIZ(station, 1, 0.75, 0.5);
+
+ chamber=13;
+ MUON->SetNsec(chamber-1,1);
+ AliMUONsegmentationV0 *seg1314=new AliMUONsegmentationV0;
+ seg1314->SetDAnod(0.51/3.);
+
+ MUON->SetSegmentationModel(chamber-1, 1, seg1314);
+ MUON->SetResponseModel(chamber-1, response0);     
+
+ chamber=14;
+ MUON->SetNsec(chamber-1,1);
+ MUON->SetSegmentationModel(chamber-1, 1, seg1314);
+ MUON->SetResponseModel(chamber-1, response0);     
+//
+// Trigger Station 2
+ station=7;
+ MUON->SetPADSIZ(station, 1, 0.75, 0.5);
+
+
+
+}
diff --git a/AliGeant4/macro/MUON/Config.in b/AliGeant4/macro/MUON/Config.in
new file mode 100644 (file)
index 0000000..39dbd45
--- /dev/null
@@ -0,0 +1,5 @@
+# MUON
+
+#/aliDet/muon/setAllSensitive true
+/aliDet/muon/setFrame MUON
diff --git a/AliGeant4/macro/MUON/Config_MUON.C b/AliGeant4/macro/MUON/Config_MUON.C
new file mode 100644 (file)
index 0000000..2cb7747
--- /dev/null
@@ -0,0 +1,412 @@
+void Config()
+{
+
+new TGeant3("C++ Interface to Geant3");
+
+//=======================================================================
+//  Create the output file
+   
+TFile *rootfile = new TFile("galice.root","recreate");
+rootfile->SetCompressionLevel(2);
+TGeant3 *geant3 = (TGeant3*)gMC;
+
+//=======================================================================
+// ******* GEANT STEERING parameters FOR ALICE SIMULATION *******
+geant3->SetTRIG(1); //Number of events to be processed 
+geant3->SetSWIT(4,10);
+geant3->SetDEBU(0,0,1);
+//geant3->SetSWIT(2,2);
+geant3->SetDCAY(0);
+geant3->SetPAIR(0);
+geant3->SetCOMP(0);
+geant3->SetPHOT(0);
+geant3->SetPFIS(0);
+geant3->SetDRAY(0);
+geant3->SetANNI(0);
+geant3->SetBREM(0);
+geant3->SetMUNU(1);
+geant3->SetCKOV(1);
+geant3->SetHADR(0); //Select pure GEANH (HADR 1) or GEANH/NUCRIN (HADR 3)
+geant3->SetLOSS(1);
+geant3->SetMULS(1);
+geant3->SetRAYL(1);
+geant3->SetAUTO(1); //Select automatic STMIN etc... calc. (AUTO 1) or manual (AUTO 0)
+geant3->SetABAN(0); //Restore 3.16 behaviour for abandoned tracks
+geant3->SetOPTI(2); //Select optimisation level for GEANT geometry searches (0,1,2)
+Float_t cut    = 1.e-3; // 1MeV cut by default
+Float_t tofmax = 1.e10;
+//             GAM ELEC NHAD CHAD MUON EBREM MUHAB EDEL MUDEL MUPA TOFMAX
+geant3->SetCUTS(cut,cut, cut, cut, cut, cut,  cut,  cut, cut,  cut, tofmax);
+//
+//=======================================================================
+// ************* STEERING parameters FOR ALICE SIMULATION **************
+// --- Specify event type to be tracked through the ALICE setup
+// --- All positions are in cm, angles in degrees, and P and E in GeV
+//
+//*********************************************
+// Example for Fixed Particle Gun             *
+//*********************************************
+//AliGenFixed *gener = new AliGenFixed(200);
+//gener->SetMomentumRange(0,999);
+//gener->SetPhiRange(0,0);
+//gener->SetThetaRange(5., 5.);
+//gener->SetOrigin(0,0,0);          //vertex position
+//gener->SetPart(14)                //GEANT particle type
+
+//*********************************************
+// Example for Moving Particle Gun            *
+//*********************************************
+/*
+AliGenBox *gener = new AliGenBox(500);
+gener->SetMomentumRange(0,10);
+gener->SetPhiRange(0,360);
+gener->SetThetaRange(2., 10.);
+gener->SetOrigin(0,0,0);   
+       //vertex position
+gener->SetSigma(0,0,5.6);           //Sigma in (X,Y,Z) (cm) on IP position
+gener->SetPart(14)                //GEANT particle type
+ */
+//**************************************
+// Example for HIJING Parameterisation *
+//**************************************
+/*
+AliGenHIJINGpara *gener = new AliGenHIJINGpara(84210);
+gener->SetMomentumRange(0,999);
+gener->SetPhiRange(0,360);
+gener->SetThetaRange(0.28,179.72);
+gener->SetOrigin(0,0,0);                //vertex position
+gener->SetSigma(0,0,0);     //Sigma in (X,Y,Z) (cm) on IP position
+/*
+//********************************************
+// Example for Charm  Production with Pythia *
+//********************************************
+*/
+/*
+AliGenPythia *gener = new AliGenPythia(200);
+gener->SetMomentumRange(0,999);
+gener->SetPhiRange(0,360);
+gener->SetThetaRange(0., 180.);
+gener->SetYRange(2,5);
+gener->SetOrigin(0,0,0);          // vertex position
+gener->SetSigma(0,0,5.6);         // Sigma in (X,Y,Z) (cm) on IP position
+gener->SetProcess(AliGenPythia::jpsi);       
+gener->ForceDecay(AliGenPythia::dimuon);       
+
+//*******************************************************
+// Example for J/psi  Production from  Parameterisation *
+//*******************************************************
+/*
+ AliGenParam *gener = new AliGenParam(1000, 443);
+ gener->SetMomentumRange(0,999);
+ gener->SetPhiRange(0,360);
+ gener->SetYRange(2,4);
+ gener->SetPtRange(1,10);
+ gener->SetOrigin(0,0,0);          //vertex position
+ gener->SetSigma(0,0,5.6);         //Sigma in (X,Y,Z) (cm) on IP position
+
+//*******************************************************
+// Example for a FLUKA Boundary Source                  *
+//*******************************************************
+/*
+AliGenFLUKAsource *gener = new AliGenFLUKAsource(1000); 
+gener->SetPartFlag(9);
+gener->SetMomentumRange(0,999);
+gener->SetPhiRange(0,360);
+gener->SetThetaRange(0., 180.);      
+ */
+//*******************************************************
+// Example for a Cocktail                               *
+//*******************************************************
+
+AliGenCocktail *gener = new AliGenCocktail(); 
+
+gener->SetMomentumRange(0,999);
+gener->SetPhiRange(0,360);
+gener->SetYRange(-4,4);
+gener->SetPtRange(0,10);
+gener->SetOrigin(0,0,0);          //vertex position
+gener->SetSigma(0,0,5.6);         //Sigma in (X,Y,Z) (cm) on IP position
+//
+ AliGenPythia *jpsi = new AliGenPythia(200);
+ jpsi->SetProcess(AliGenPythia::jpsi);       
+ jpsi->ForceDecay(AliGenPythia::dimuon);
+
+ AliGenPythia *beauty = new AliGenPythia(200);
+ beauty->SetProcess(AliGenPythia::beauty_unforced);       
+ beauty->ForceDecay(AliGenPythia::semielectronic);
+
+ AliGenPythia *charm = new AliGenPythia(200);
+ charm->SetProcess(AliGenPythia::charm_unforced);       
+ charm->ForceDecay(AliGenPythia::semimuonic);
+ charm->SetPtHard(5,10);
+
+ AliGenParam *jpsi_to_muons = new AliGenParam(100,443);
+ jpsi_to_muons->ForceDecay(AliGenParam::dimuon);
+
+ AliGenParam *jpsi_to_electrons = new AliGenParam(100,443);
+ jpsi_to_electrons->ForceDecay(AliGenParam::dielectron);
+
+ AliGenParam *phi_to_electrons = new AliGenParam(100,333);
+ phi_to_electrons->ForceDecay(AliGenParam::dielectron);
+
+// gener->AddGenerator(jpsi,"Jpsi",1.);
+// gener->AddGenerator(beauty,"Beauty",1.);
+// gener->AddGenerator(charm,"Charm",1.);
+// gener->AddGenerator(jpsi_to_muons,"Jpsi_to_Muons",1.);
+ gener->AddGenerator(jpsi_to_electrons,"Jpsi_to_Electrons",1.);
+ // gener->AddGenerator(phi_to_electrons,"Phi_to_Electrons",1.);
+//
+gener->Init();
+//**************************************************************************
+// Specify maximum magnetic field in Tesla (neg. ==> default field)
+gAlice->SetField(-999,2);    
+// gAlice->TrackingLimits(2000.,200);
+
+//=================== Alice BODY parameters =============================
+
+AliBODY *BODY = new AliBODY("BODY","Alice envelop");
+/*
+AliFRAME *FRAME = new AliFRAMEv0("FRAME", "Space Frame");
+/*
+//=================== ABSO parameters ============================
+
+AliABSO *ABSO  = new AliABSO("ABSO","Muon Absorber");
+
+//=================== DIPO parameters ============================
+
+AliDIPO *DIPO  = new AliDIPOv2("DIPO","Dipole version 2");
+
+//=================== SHIL parameters ============================
+
+AliSHIL *SHIL  = new AliSHIL("SHIL","Shielding");
+
+//=================== PIPE parameters ============================
+*/
+// AliPIPE *PIPE  = new AliPIPEv0("PIPE","Beam Pipe");
+/*
+*/
+//=================== MUON parameters ===========================
+
+
+AliMUON *MUON  = new AliMUONv0("MUON","normal MUON");
+
+MUON->SetSMAXAR(0.03);
+MUON->SetSMAXAL(-1);
+//
+// Version 0
+//
+// First define the number of planes that are segmented (1 or 2) by a call
+// to SetNsec. 
+// Then chose for each chamber (chamber plane) the segmentation 
+// and response model.
+// They should be equal for the two chambers of each station. In a future
+// version this will be enforced.
+//
+//  
+ Int_t chamber;
+ Int_t station;
+// Default Segmentation
+ AliMUONsegmentationV0* segV0 = new AliMUONsegmentationV0;
+// Default response
+ AliMUONresponseV0* response0 = new AliMUONresponseV0;
+ response0->SetSqrtKx3(0.761577);
+ response0->SetKx2(0.972655);
+ response0->SetKx4(0.3841);
+ response0->SetSqrtKy3(0.714143);
+ response0->SetKy2(1.0099);
+ response0->SetKy4(0.403);
+ response0->SetPitch(0.25);
+ response0->SetRSIGM(10.);
+ response0->SetMUCHSP(5.);
+ response0->SetMUSIGM(0.18, 0.18);
+ response0->SetMAXADC( 1024);
+//--------------------------------------------------------
+// Configuration for Chamber TC1/2  (Station 1) ----------           
+//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ Float_t rseg[4]={17.5, 55.2, 71.3, 95.5};
+ Int_t   nseg[4]={4, 4, 2, 1};
+
+ chamber=1;
+//^^^^^^^^^
+ MUON->SetNsec(chamber-1,2);
+//
+ AliMUONsegmentationV01 *seg11=new AliMUONsegmentationV01;
+ seg11->SetSegRadii(rseg);
+ seg11->SetPADSIZ(3.048, 0.508);
+ seg11->SetPadDivision(nseg);
+ MUON->SetSegmentationModel(chamber-1, 1, seg11);
+//
+ AliMUONsegmentationV01 *seg12=new AliMUONsegmentationV01;
+ seg12->SetSegRadii(rseg); 
+ seg12->SetPADSIZ(2.032, 0.762);
+ seg12->SetPadDivision(nseg);
+
+ MUON->SetSegmentationModel(chamber-1, 2, seg12);
+
+ chamber=2;
+//^^^^^^^^^
+ MUON->SetNsec(chamber-1,2);
+ MUON->SetSegmentationModel(chamber-1, 1, seg11);
+ MUON->SetSegmentationModel(chamber-1, 2, seg12);
+
+ station=1;
+//^^^^^^^^^ 
+ MUON->SetResponseModel(0, response0);     
+ MUON->SetResponseModel(1, response0);     
+//
+//--------------------------------------------------------
+// Configuration for Chamber TC3/4 -----------------------
+//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ chamber=3;
+ MUON->SetNsec(chamber-1,1);
+ AliMUONsegmentationV0 *seg34=new AliMUONsegmentationV0;
+ seg34->SetDAnod(0.51/3.);
+ MUON->SetSegmentationModel(chamber-1, 1, seg34);
+ MUON->SetResponseModel(chamber-1, response0);     
+
+ chamber=4;
+ MUON->SetNsec(chamber-1,1);
+ MUON->SetSegmentationModel(chamber-1, 1, seg34);
+ MUON->SetResponseModel(chamber-1, response0);     
+//
+// Station 2
+ station=2;
+ MUON->SetPADSIZ(station, 1, 0.75, 0.51);
+ MUON->SetMUCHSP(station, 5.);
+ MUON->SetMUSIGM(station, 0.18, 0.18);
+ MUON->SetRSIGM(station, 10.);
+ MUON->SetMAXADC(station, 1024);
+
+//
+//--------------------------------------------------------
+// Configuration for Chamber TC5/6 -----------------------
+//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ seg5 =  new AliMUONsegmentationV1;
+ AliMUONresponseV0* response5 =  new AliMUONresponseV0;
+ // K3 = 0.62
+ response5->SetSqrtKx3(0.78740079);
+ response5->SetKx2(0.95237319); //  0.5 * kPI * (1- 0.5*sqrtky3 )
+ response5->SetKx4(0.37480633); // 0.25/TMath::ATan(sqrtkx3)
+ // K3 = 0.55
+ response5->SetSqrtKy3(0.74161985);
+ response5->SetKy2(0.98832946);
+ response5->SetKy4(0.39177817);
+ response5->SetPitch(0.325);
+ response5->SetRSIGM(10.);
+ response5->SetMUCHSP(5.);
+ response5->SetMUSIGM( 0.4, 0.4);
+ response5->SetMAXADC( 1024);
+
+ chamber=5;
+ MUON->SetNsec(chamber-1,1);
+ MUON->SetSegmentationModel(chamber-1, 1, seg5);
+ MUON->SetResponseModel(chamber-1, response5);     
+
+ chamber=6;
+ MUON->SetNsec(chamber-1,1);
+ MUON->SetSegmentationModel(chamber-1, 1, seg5);
+ MUON->SetResponseModel(chamber-1, response5);     
+//
+// Station 3
+ station=3;
+ MUON->SetPADSIZ(station, 1, 0.975, 0.55);
+
+//
+//--------------------------------------------------------
+// Configuration for Chamber TC7/8/9/10-------------------
+//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ chamber=7;
+ MUON->SetNsec(chamber-1,1);
+ AliMUONsegmentationV0 *seg78=new AliMUONsegmentationV0;
+ seg78->SetDAnod(0.51/3.);
+
+ MUON->SetSegmentationModel(chamber-1, 1, seg78);
+ MUON->SetResponseModel(chamber-1, response0);     
+
+ chamber=8;
+ MUON->SetNsec(chamber-1,1);
+ MUON->SetSegmentationModel(chamber-1, 1, seg78);
+ MUON->SetResponseModel(chamber-1, response0);     
+//
+// Station 4
+ station=4;
+ MUON->SetPADSIZ(station, 1, 0.75, 0.5);
+
+ chamber=9;
+ MUON->SetNsec(chamber-1,1);
+ AliMUONsegmentationV0 *seg910=new AliMUONsegmentationV0;
+ seg910->SetDAnod(0.51/3.);
+
+ MUON->SetSegmentationModel(chamber-1, 1, seg910);
+ MUON->SetResponseModel(chamber-1, response0);     
+
+ chamber=10;
+ MUON->SetNsec(chamber-1,1);
+ MUON->SetSegmentationModel(chamber-1, 1, seg910);
+ MUON->SetResponseModel(chamber-1, response0);     
+//
+// Station 5
+ station=5;
+ MUON->SetPADSIZ(station, 1, 0.75, 0.5);
+
+ chamber=11;
+ MUON->SetNsec(chamber-1,1);
+ AliMUONsegmentationV0 *seg1112=new AliMUONsegmentationV0;
+ seg1112->SetDAnod(0.51/3.);
+
+ MUON->SetSegmentationModel(chamber-1, 1, seg1112);
+ MUON->SetResponseModel(chamber-1, response0);     
+
+ chamber=12;
+ MUON->SetNsec(chamber-1,1);
+ MUON->SetSegmentationModel(chamber-1, 1, seg1112);
+ MUON->SetResponseModel(chamber-1, response0);     
+//
+// Trigger Station 1
+ station=6;
+ MUON->SetPADSIZ(station, 1, 0.75, 0.5);
+
+ chamber=13;
+ MUON->SetNsec(chamber-1,1);
+ AliMUONsegmentationV0 *seg1314=new AliMUONsegmentationV0;
+ seg1314->SetDAnod(0.51/3.);
+
+ MUON->SetSegmentationModel(chamber-1, 1, seg1314);
+ MUON->SetResponseModel(chamber-1, response0);     
+
+ chamber=14;
+ MUON->SetNsec(chamber-1,1);
+ MUON->SetSegmentationModel(chamber-1, 1, seg1314);
+ MUON->SetResponseModel(chamber-1, response0);     
+//
+// Trigger Station 2
+ station=7;
+ MUON->SetPADSIZ(station, 1, 0.75, 0.5);
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/AliGeant4/macro/PHOS/Config.C b/AliGeant4/macro/PHOS/Config.C
new file mode 100644 (file)
index 0000000..07ba69c
--- /dev/null
@@ -0,0 +1,12 @@
+void Config(Int_t version)
+{  
+  gSystem->Load("$(ALICE_ROOT)/lib/tgt_$(ALICE_TARGET)/libPHOS");
+
+  AliPHOS* PHOS = 0;
+  switch (version) {
+    case 0: PHOS  = new AliPHOSv0("PHOS","GPS2");                break;
+    case 1: PHOS  = new AliPHOSv1("PHOS","GPS2");                break;
+  }  
+
+//=================== PHOS parameters ===========================
+}  
diff --git a/AliGeant4/macro/PHOS/Config.in b/AliGeant4/macro/PHOS/Config.in
new file mode 100644 (file)
index 0000000..5ebfbd9
--- /dev/null
@@ -0,0 +1,5 @@
+# PHOS
+
+/aliDet/phos/setAllSensitive true
+#/aliDet/phos/setFrame PHOS
diff --git a/AliGeant4/macro/PMD/Config.C b/AliGeant4/macro/PMD/Config.C
new file mode 100644 (file)
index 0000000..66f98bc
--- /dev/null
@@ -0,0 +1,17 @@
+void Config(Int_t version)
+{
+  gSystem->Load("$(ALICE_ROOT)/lib/tgt_$(ALICE_TARGET)/libPMD");
+
+  AliPMD *PMD = 0;
+  switch (version) {
+    case 0: PMD  = new AliPMDv0("PMD","normal PMD");      break;
+    case 1: PMD  = new AliPMDv1("PMD", "PMDv1 detector"); break;
+    case 2: PMD  = new AliPMDv2("PMD", "PMDv2 detector"); break;
+  }  
+
+//=================== PMD parameters ============================
+PMD->SetPAR(1., 1., 0.8, 0.02);
+PMD->SetIN(6., 18., -580., 27., 27.);
+PMD->SetGEO(0.0, 0.2, 4.);
+PMD->SetPadSize(0.8, 1.0, 1.0, 1.5);
+}
diff --git a/AliGeant4/macro/PMD/Config.in b/AliGeant4/macro/PMD/Config.in
new file mode 100644 (file)
index 0000000..90fcbae
--- /dev/null
@@ -0,0 +1,5 @@
+# PMD
+
+/aliDet/pmd/setAllSensitive true
+/aliDet/pmd/setFrame DPMD
diff --git a/AliGeant4/macro/RICH/Config.C b/AliGeant4/macro/RICH/Config.C
new file mode 100644 (file)
index 0000000..099f648
--- /dev/null
@@ -0,0 +1,56 @@
+void Config(Int_t version)
+{
+  gSystem->Load("$(ALICE_ROOT)/lib/tgt_$(ALICE_TARGET)/libRICH");
+
+  AliRICH *RICH = 0;
+  switch (version) {
+    case 0: RICH  = new AliRICHv0("RICH","normal RICH"); break;
+  }  
+
+//
+// Version 0
+// Default Segmentation
+    AliRICHSegmentationV0* SegmentationV0 = new AliRICHSegmentationV0;
+//
+//  Segmentation parameters
+    SegmentationV0->SetPadSize(0.84,0.80);
+    SegmentationV0->SetDAnod(0.84/2);
+//
+//  Geometry parameters
+    AliRICHGeometry* GeometryV0 = new AliRICHGeometryV0;
+    GeometryV0->SetGapThickness(7.6);
+    GeometryV0->SetProximityGapThickness(.4);
+    GeometryV0->SetQuartzLength(131);
+    GeometryV0->SetQuartzWidth(126.2);
+    GeometryV0->SetQuartzThickness(.5);
+    GeometryV0->SetOuterFreonLength(131);
+    GeometryV0->SetOuterFreonWidth(40.3);
+    GeometryV0->SetInnerFreonLength(131);
+    GeometryV0->SetInnerFreonWidth(40.3);
+    GeometryV0->SetFreonThickness(1);
+//
+//  Response parameters
+    AliRICHResponseV0*  Rresponse0   = new AliRICHResponseV0;
+    Rresponse0->SetSigmaIntegration(5.);
+    Rresponse0->SetChargeSlope(41.);
+    Rresponse0->SetChargeSpread(0.18, 0.18);
+    Rresponse0->SetMaxAdc(1024);
+    Rresponse0->SetAlphaFeedback(0.05);
+    Rresponse0->SetEIonisation(26.e-9);
+    Rresponse0->SetSqrtKx3(0.77459667);
+    Rresponse0->SetKx2(0.962);
+    Rresponse0->SetKx4(0.379);
+    Rresponse0->SetSqrtKy3(0.77459667);
+    Rresponse0->SetKy2(0.962);
+    Rresponse0->SetKy4(0.379);
+    Rresponse0->SetPitch(0.25);
+//
+//      
+  for (Int_t i=0; i<7; i++) {
+    RICH->SetGeometryModel(i,GeometryV0);
+    RICH->SetSegmentationModel(i, SegmentationV0);
+    RICH->SetResponseModel(i, Rresponse0);
+    RICH->SetNsec(i,1);
+  }
+}
+
diff --git a/AliGeant4/macro/RICH/Config.in b/AliGeant4/macro/RICH/Config.in
new file mode 100644 (file)
index 0000000..89d65c6
--- /dev/null
@@ -0,0 +1,5 @@
+# RICH
+
+#/aliDet/rich/setAllSensitive true
+/aliDet/rich/setFrame RICH
diff --git a/AliGeant4/macro/START/Config.C b/AliGeant4/macro/START/Config.C
new file mode 100644 (file)
index 0000000..3f6c5e6
--- /dev/null
@@ -0,0 +1,12 @@
+void Config(Int_t version)
+{
+  gSystem->Load("$(ALICE_ROOT)/lib/tgt_$(ALICE_TARGET)/libSTART");
+
+  AliSTART* START = 0;
+  switch (version) {
+    case 0: START  = new AliSTARTv0("START","START Detector"); break;
+  }  
+
+//=================== START parameters ============================
+
+}
diff --git a/AliGeant4/macro/START/Config.in b/AliGeant4/macro/START/Config.in
new file mode 100644 (file)
index 0000000..8b7e4b9
--- /dev/null
@@ -0,0 +1,5 @@
+# START
+
+/aliDet/start/setAllSensitive true
+/aliDet/start/setFrame START
diff --git a/AliGeant4/macro/STRUCT/ConfigABSO.C b/AliGeant4/macro/STRUCT/ConfigABSO.C
new file mode 100644 (file)
index 0000000..f451471
--- /dev/null
@@ -0,0 +1,9 @@
+void Config(Int_t version)
+{
+  AliABSO* ABSO = 0;
+  switch (version) {
+    case 0: ABSO  = new AliABSOv0("ABSO","Muon Absorber"); break;
+  }
+
+//=================== ABSO parameters ============================
+}  
diff --git a/AliGeant4/macro/STRUCT/ConfigABSO.in b/AliGeant4/macro/STRUCT/ConfigABSO.in
new file mode 100644 (file)
index 0000000..e19c19c
--- /dev/null
@@ -0,0 +1,6 @@
+# ABSO
+
+#/aliDet/abso/setAllSensitive true
+/aliDet/abso/setFrame ABSM
+/aliDet/abso/setConfigDir STRUCT
diff --git a/AliGeant4/macro/STRUCT/ConfigBODY.C b/AliGeant4/macro/STRUCT/ConfigBODY.C
new file mode 100644 (file)
index 0000000..455e8cb
--- /dev/null
@@ -0,0 +1,11 @@
+void Config(Int_t version)
+{
+  gSystem->Load("$(ALICE_ROOT)/lib/tgt_$(ALICE_TARGET)/libSTRUCT");
+
+  AliBODY* BODY = 0;
+  switch (version) {
+    case 0: BODY = new AliBODY("BODY","Alice envelop"); break;
+  }  
+
+//=================== Alice BODY parameters =============================
+}  
diff --git a/AliGeant4/macro/STRUCT/ConfigBODY.in b/AliGeant4/macro/STRUCT/ConfigBODY.in
new file mode 100644 (file)
index 0000000..5059a01
--- /dev/null
@@ -0,0 +1,5 @@
+# BODY
+
+#/aliDet/body/setAllSensitive true
+/aliDet/body/setFrame ALIC
+/aliDet/body/setConfigDir STRUCT
diff --git a/AliGeant4/macro/STRUCT/ConfigDIPO.C b/AliGeant4/macro/STRUCT/ConfigDIPO.C
new file mode 100644 (file)
index 0000000..75f31cb
--- /dev/null
@@ -0,0 +1,10 @@
+void Config(Int_t version)
+{
+  AliDIPO* DIPO = 0;
+  switch (version) {
+    case 1: DIPO  = new AliDIPOv1("DIPO","DIPOv1 module"); break;
+    case 2: DIPO  = new AliDIPOv2("DIPO","Dipole version 2"); break;
+  }  
+
+//=================== DIPO parameters ============================
+}  
diff --git a/AliGeant4/macro/STRUCT/ConfigDIPO.in b/AliGeant4/macro/STRUCT/ConfigDIPO.in
new file mode 100644 (file)
index 0000000..f821f19
--- /dev/null
@@ -0,0 +1,6 @@
+# DIPO
+
+#/aliDet/dipo/setAllSensitive true
+/aliDet/dipo/setFrame DDIP
+/aliDet/dipo/setSTRUCT
diff --git a/AliGeant4/macro/STRUCT/ConfigFRAME.C b/AliGeant4/macro/STRUCT/ConfigFRAME.C
new file mode 100644 (file)
index 0000000..82d533f
--- /dev/null
@@ -0,0 +1,10 @@
+void Config(Int_t version)
+{
+  AliFRAME* FRAME = 0;
+  switch (version) {
+    case 0: FRAME = new AliFRAMEv0("FRAME","Space Frame");   break;
+    case 1: FRAME = new AliFRAMEv1("FRAME","FRAMEv1 module"); break;
+  }  
+
+//=================== FRAME parameters ============================
+}  
diff --git a/AliGeant4/macro/STRUCT/ConfigFRAME.in b/AliGeant4/macro/STRUCT/ConfigFRAME.in
new file mode 100644 (file)
index 0000000..34d9b52
--- /dev/null
@@ -0,0 +1,6 @@
+# FRAME
+
+#/aliDet/frame/setAllSensitive true
+/aliDet/frame/setFrame B077
+/aliDet/frame/setConfigDir STRUCT
diff --git a/AliGeant4/macro/STRUCT/ConfigHALL.C b/AliGeant4/macro/STRUCT/ConfigHALL.C
new file mode 100644 (file)
index 0000000..1d6165b
--- /dev/null
@@ -0,0 +1,9 @@
+void Config(Int_t version)
+{
+  AliHALL* HALL = 0;
+  switch (version) {
+    case 0: HALL  = new AliHALL("HALL","Alice Hall"); break;
+  }  
+
+//=================== HALL parameters ============================
+}  
diff --git a/AliGeant4/macro/STRUCT/ConfigHALL.in b/AliGeant4/macro/STRUCT/ConfigHALL.in
new file mode 100644 (file)
index 0000000..cd8ad02
--- /dev/null
@@ -0,0 +1,6 @@
+# HALL
+
+#/aliDet/hall/setAllSensitive true
+#/aliDet/hall/setFrame HALL
+/aliDet/hall/setConfigDir STRUCT
diff --git a/AliGeant4/macro/STRUCT/ConfigMAG.C b/AliGeant4/macro/STRUCT/ConfigMAG.C
new file mode 100644 (file)
index 0000000..4e6e0a3
--- /dev/null
@@ -0,0 +1,13 @@
+void Config(Int_t version)
+{
+//=================== All modules in STRUCT parameters =========================
+
+  AliMAG* MAG = 0;
+  switch (version) {
+    case 0: MAG  = new AliMAG("MAG","Magnet"); break;
+  }  
+
+//=================== MAG parameters ============================
+// --- Start with Magnet since detector layouts may be depending ---
+// --- on the selected Magnet dimensions ---
+}  
diff --git a/AliGeant4/macro/STRUCT/ConfigMAG.in b/AliGeant4/macro/STRUCT/ConfigMAG.in
new file mode 100644 (file)
index 0000000..4ae49aa
--- /dev/null
@@ -0,0 +1,6 @@
+# MAG
+
+#/aliDet/mag/setAllSensitive true
+/aliDet/mag/setFrame MAG
+/aliDet/mag/setConfigDir STRUCT
diff --git a/AliGeant4/macro/STRUCT/ConfigPIPE.C b/AliGeant4/macro/STRUCT/ConfigPIPE.C
new file mode 100644 (file)
index 0000000..a63e7e2
--- /dev/null
@@ -0,0 +1,11 @@
+void Config(Int_t version)
+{
+  AliPIPE* PIPE = 0;
+  switch (version) {
+    case 0: PIPE  = new AliPIPEv0("PIPE","Beam Pipe"); break;
+    case 1: PIPE  = new AliPIPEv1("PIPE","PIPEv1 module"); break;
+    case 3: PIPE  = new AliPIPEv3("PIPE","PIPEv3 module"); break;
+  }
+
+//=================== PIPE parameters ============================
+}  
diff --git a/AliGeant4/macro/STRUCT/ConfigPIPE.in b/AliGeant4/macro/STRUCT/ConfigPIPE.in
new file mode 100644 (file)
index 0000000..93303a1
--- /dev/null
@@ -0,0 +1,7 @@
+# PIPE
+
+#/aliDet/pipe/setAllSensitive true
+/aliDet/pipe/setFrame QBPM
+#/aliDet/pipe/setFrame QQMO
+/aliDet/pipe/setConfigDir STRUCT
diff --git a/AliGeant4/macro/STRUCT/ConfigSHIL.C b/AliGeant4/macro/STRUCT/ConfigSHIL.C
new file mode 100644 (file)
index 0000000..c117180
--- /dev/null
@@ -0,0 +1,9 @@
+void Config(Int_t version)
+{
+  AliSHIL* SHIL = 0;
+  switch (version) {
+    case 0: SHIL  = new AliSHILv0("SHIL","Shielding"); break;
+  }  
+
+//=================== SHIL parameters ============================
+}  
diff --git a/AliGeant4/macro/STRUCT/ConfigSHIL.in b/AliGeant4/macro/STRUCT/ConfigSHIL.in
new file mode 100644 (file)
index 0000000..ab0b88b
--- /dev/null
@@ -0,0 +1,6 @@
+# SHIL
+
+#/aliDet/shil/setAllSensitive true
+/aliDet/shil/setFrame YMOT
+/aliDet/shil/setConfigDir STRUCT
diff --git a/AliGeant4/macro/TOF/Config.C b/AliGeant4/macro/TOF/Config.C
new file mode 100644 (file)
index 0000000..93c51be
--- /dev/null
@@ -0,0 +1,17 @@
+void Config(Int_t version)
+{
+  gSystem->Load("$(ALICE_ROOT)/lib/tgt_$(ALICE_TARGET)/libTOF");
+
+  AliTOF *TOF = 0;
+  switch (version) {
+    case 0: TOF  = new AliTOFv0("TOF", "TOFv0 detector"); break;
+    case 1: TOF  = new AliTOFv1("TOF","normal TOF");      break;
+    case 2: TOF  = new AliTOFv2("TOF", "TOFv2 detector"); break;
+    case 3: TOF  = new AliTOFv3("TOF", "TOFv3 detector"); break;
+    case 4: TOF  = new AliTOFv4("TOF", "TOFv4 detector"); break;
+    case 5: TOF  = new AliTOFv5("TOF", "TOFv5 detector"); break;
+    case 6: TOF  = new AliTOFv6("TOF", "TOFv6 detector"); break;
+  }   
+
+//=================== TOF parameters ============================
+}  
diff --git a/AliGeant4/macro/TOF/Config.in b/AliGeant4/macro/TOF/Config.in
new file mode 100644 (file)
index 0000000..fec03d5
--- /dev/null
@@ -0,0 +1,5 @@
+# TOF
+
+/aliDet/tof/setAllSensitive true
+/aliDet/tof/setFrame TOF
diff --git a/AliGeant4/macro/TPC/Config.C b/AliGeant4/macro/TPC/Config.C
new file mode 100644 (file)
index 0000000..aea63bc
--- /dev/null
@@ -0,0 +1,43 @@
+void Config(Int_t version)
+{
+  gSystem->Load("$(ALICE_ROOT)/lib/tgt_$(ALICE_TARGET)/libTPC");
+  gROOT->LoadMacro("SetTPCParam.C");
+  AliTPCParam *param = SetTPCParam();
+
+  AliTPC* TPC = 0;
+  switch (version) {
+    case 0: TPC  = new AliTPCv0("TPC","TPCv0 detector"); break;
+    case 1: TPC  = new AliTPCv1("TPC","normal TPC");     break;
+    case 2: TPC  = new AliTPCv2("TPC","TPCv2 detector"); break;
+    case 3: TPC  = new AliTPCv3("TPC","TPCv3 detector"); break;
+  }   
+
+//============================ TPC parameters ================================
+// --- This allows the user to specify sectors for the SLOW (TPC geometry 2)
+// --- Simulator. SecAL (SecAU) <0 means that ALL lower (upper)
+// --- sectors are specified, any value other than that requires at least one 
+// --- sector (lower or upper)to be specified!
+// --- Reminder: sectors 1-24 are lower sectors (1-12 -> z>0, 13-24 -> z<0)
+// ---           sectors 25-72 are the upper ones (25-48 -> z>0, 49-72 -> z<0)
+// --- SecLows - number of lower sectors specified (up to 6)
+// --- SecUps - number of upper sectors specified (up to 12)
+// --- Sens - sensitive strips for the Slow Simulator !!!
+// --- This does NOT work if all S or L-sectors are specified, i.e.
+// --- if SecAL or SecAU < 0
+//
+//
+//-----------------------------------------------------------------------------
+
+  TPC->SetParam(param); // pass the parameter object to the TPC
+
+// set gas mixture
+
+TPC->SetGasMixt(2,20,10,-1,0.9,0.1,0.);
+TPC->SetSecAL(4);
+TPC->SetSecAU(4);
+TPC->SetSecLows(1,  2,  3, 19, 20, 21);
+TPC->SetSecUps(37, 38, 39, 37+18, 38+18, 39+18, -1, -1, -1, -1, -1, -1);
+TPC->SetSens(1);
+
+if (TPC->IsVersion()==1) param->Write(param->GetTitle());
+}
diff --git a/AliGeant4/macro/TPC/Config.in b/AliGeant4/macro/TPC/Config.in
new file mode 100644 (file)
index 0000000..89a67f2
--- /dev/null
@@ -0,0 +1,5 @@
+# TPC 
+
+/aliDet/tpc/setAllSensitive true
+/aliDet/tpc/setFrame TPC
diff --git a/AliGeant4/macro/TRD/Config.C b/AliGeant4/macro/TRD/Config.C
new file mode 100644 (file)
index 0000000..1a56cc7
--- /dev/null
@@ -0,0 +1,27 @@
+void Config(Int_t version)
+{
+  gSystem->Load("$(ALICE_ROOT)/lib/tgt_$(ALICE_TARGET)/libTRD");
+
+  AliTRD *TRD = 0;
+  switch (version) {
+    case 0: TRD  = new AliTRDv0("TRD", "TRDv0 detector"); break;
+    case 1: TRD  = new AliTRDv1("TRD","TRD version 0");   break;
+  }
+
+//=================== TRD parameters ============================
+  
+  //TRD->SetHits();
+  
+  //AliTRD *TRD  = new AliTRDv1("TRD","TRD slow simulator");
+  //TRD->SetSensPlane(0);
+  //TRD->SetSensChamber(2);
+  //TRD->SetSensSector(17);
+  
+  // Select the gas mixture (0: 97% Xe + 3% isobutane, 1: 90% Xe + 10% CO2)
+  TRD->SetGasMix(1);
+  
+  // With hole in front of PHOS
+  TRD->SetPHOShole();
+  // With hole in front of RICH
+  TRD->SetRICHhole();
+}
diff --git a/AliGeant4/macro/TRD/Config.in b/AliGeant4/macro/TRD/Config.in
new file mode 100644 (file)
index 0000000..d461fd0
--- /dev/null
@@ -0,0 +1,5 @@
+# TRD 
+
+/aliDet/trd/setAllSensitive true
+/aliDet/trd/setFrame TRD
diff --git a/AliGeant4/macro/ZDC/Config.C b/AliGeant4/macro/ZDC/Config.C
new file mode 100644 (file)
index 0000000..0880703
--- /dev/null
@@ -0,0 +1,11 @@
+void Config(Int_t version)
+{
+  gSystem->Load("$(ALICE_ROOT)/lib/tgt_$(ALICE_TARGET)/libZDC");
+
+  AliZDC* ZDC = 0;
+  switch (version) {
+    case 1: ZDC  = new AliZDCv1("ZDC","normal ZDC"); break;
+  }  
+
+//=================== ZDC parameters ============================
+}  
diff --git a/AliGeant4/macro/ZDC/Config.in b/AliGeant4/macro/ZDC/Config.in
new file mode 100644 (file)
index 0000000..c50ceec
--- /dev/null
@@ -0,0 +1,5 @@
+# ZDC
+
+#/aliDet/zdc/setAllSensitive true
+/aliDet/zdc/setFrame ZDC