Index: trunk/source/geometry/solids/test/SolidsChecker/src/Sc01DetectorConstruction.cc
===================================================================
--- trunk/source/geometry/solids/test/SolidsChecker/src/Sc01DetectorConstruction.cc	(revision 1316)
+++ trunk/source/geometry/solids/test/SolidsChecker/src/Sc01DetectorConstruction.cc	(revision 1316)
@@ -0,0 +1,659 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: Sc01DetectorConstruction.cc,v 1.13 2006/12/13 15:43:42 gunter Exp $
+// 
+//  GEANT 4 class header file 
+//
+//      This is a version for maximum particle set
+//  History: 
+//       27.01.04  V. Grichine based on test10 detector construction
+//        
+// 
+
+#include "Sc01DetectorConstruction.hh"
+#include "Sc01DetectorMessenger.hh"
+
+#include "G4Material.hh"
+#include "G4MaterialTable.hh"
+#include "G4Element.hh"
+#include "G4ElementTable.hh"
+
+#include "G4Box.hh"
+#include "G4Orb.hh"
+#include "G4Tubs.hh"
+#include "G4Sphere.hh"
+#include "G4Cons.hh"
+#include "G4Hype.hh"
+#include "G4Para.hh"
+#include "G4Torus.hh"
+#include "G4Trd.hh"
+
+#include "G4Polycone.hh"
+
+#include "G4TwistedBox.hh"
+#include "G4TwistedTrd.hh"
+#include "G4TwistedTrap.hh"
+
+#include "G4BooleanSolid.hh"
+#include "G4DisplacedSolid.hh"
+#include "G4UnionSolid.hh"
+#include "G4IntersectionSolid.hh"
+#include "G4SubtractionSolid.hh"
+#include "G4ReflectedSolid.hh"
+
+#include "G4LogicalBorderSurface.hh"
+#include "G4OpticalSurface.hh"
+#include "G4LogicalVolume.hh"
+#include "G4ThreeVector.hh"
+#include "G4PVPlacement.hh"
+#include "G4VisAttributes.hh"
+#include "G4VVisManager.hh"
+#include "G4Colour.hh"
+#include "G4TransportationManager.hh"
+#include "G4GeometryManager.hh"
+#include "G4StateManager.hh"
+#include "G4UImanager.hh"
+#include "G4RunManager.hh"
+#include "G4ios.hh"
+
+///////////////////////////////////////////////////////////////
+
+Sc01DetectorConstruction::Sc01DetectorConstruction()
+  : aVolume(0), PhysicalVolume(0), Water(0), Water1(0), aSurface(0)
+{
+  detectorMessenger = new Sc01DetectorMessenger (this);
+}
+
+////////////////////////////////////////////////////////////////
+
+Sc01DetectorConstruction::~Sc01DetectorConstruction()
+{
+}
+
+////////////////////////////////////////////////////////////////
+
+void Sc01DetectorConstruction::SwitchDetector()
+{
+  G4RunManager::GetRunManager()->DefineWorldVolume(PhysicalVolume);
+}
+
+///////////////////////////////////////////////////////////////
+
+G4VPhysicalVolume*
+Sc01DetectorConstruction::SelectDetector( const G4String& val )
+{
+
+  // fHallSize = 2.8*m;
+  fHallSize = 4.8*m;
+
+  G4Box * Hall
+          = new G4Box("Hall", fHallSize,fHallSize,fHallSize );
+
+  G4LogicalVolume * Hall_log
+          = new G4LogicalVolume (Hall, Water, "Hall_L", 0,0,0);
+
+  PhysicalVolume
+          = new G4PVPlacement(0,G4ThreeVector(),"Hall_P",Hall_log,0,false,0);
+
+  
+
+  G4Box* b1 = new G4Box ( "b1", 100*cm, 50*cm, 50*cm );
+  G4Box* b2 = new G4Box ( "b2", 50*cm, 100*cm, 50*cm );
+
+  if (val == "Sphere")
+  {
+      aVolume = new G4Sphere ( "aSphere", 80.0*cm, 100.0*cm, 
+                          0.0*deg, 300.0*deg,10.0*deg, 130.0*deg);
+
+    //    aVolume = new G4Sphere("aSphere", 2400*mm, 2404*mm,
+    //                          -7.349220986995449*deg,
+    //                          14.6984419739909*deg,
+    //                          80.16372565937344*deg,
+    //                          19.67254868125311*deg      );
+  }
+  else if (val == "Orb")
+  {
+   aVolume = new G4Orb ( "aOrb", 10.0*cm );
+  }
+  else if (val == "Box") 
+  {         
+    aVolume = new G4Box ( "aBox", 10*cm, 10*cm, 10*cm );
+  }
+  else if (val == "Cone")
+  {        
+    aVolume = new G4Cons ( "aCone", 2*cm, 6*cm, 8*cm, 14*cm,
+                           10*cm, 10*deg, 300*deg ); 
+  //  10*cm, 10*deg, 300*deg ); 
+                           //  0., pi); 
+  }
+  else if (val == "manyCons")
+  {        
+    aVolume = new G4Cons ( "aCone", 2*cm, 6*cm, 8*cm, 14*cm,
+                           10*cm, 10*deg, 300*deg ); 
+  //  10*cm, 10*deg, 300*deg ); 
+                           //  0., pi);
+
+ 
+  }
+  else if (val == "Tube")
+  {
+    //  aVolume = new G4Tubs ( "aTube", 5*cm, 10*cm, 7*cm, 70*deg, 100*deg);
+    //    aVolume = new G4Tubs ( "aTube", 5*cm, 10*cm, 7*cm, 10*deg, 300*deg);
+    aVolume = new G4Tubs ( "aTube", 0.*mm, 1300*mm, 2700*mm,
+                                    0.*deg, 360*deg );
+  }
+  else if (val == "Hype")
+  {
+    aVolume = new G4Hype ("aHype", 10*cm, 20*cm, 0*deg, 360*deg, 10*cm );
+  }
+  else if (val == "Torus")
+  {
+    // aVolume = new G4Torus ("aTorus", 10*cm, 15*cm, 20*cm, 0*deg, 60*deg);
+    aVolume = new G4Torus ("aTorus", 25*cm, 26*cm, 290*cm, 0*deg, 90*deg);
+    G4LogicalVolume* aVolume_log  = new G4LogicalVolume(aVolume, Water1, "aVolume_L", 0,0,0);
+    G4RotationMatrix* rot = new G4RotationMatrix();
+    rot->rotateX(-90*degree);
+    // G4VPhysicalVolume * aVolume_phys1 =
+      new G4PVPlacement(rot,G4ThreeVector(0*cm, 0*cm, 0*cm),val, 
+                        aVolume_log, PhysicalVolume, false, 0);
+  }
+  else if (val == "Para")
+  {
+    aVolume = new G4Para ("aPara", 8*cm, 10*cm, 12*cm, 30*deg, 45*deg, 60*deg);
+  }
+  else if (val == "Trd")
+  {
+    aVolume = new G4Trd ("aTrd", 80*cm, 100*cm, 70*cm, 90*cm, 100*cm);
+  }
+  else if (val == "b1Ub2") 
+  {         
+    aVolume = new G4UnionSolid("b1Ub2",b1,b2);
+    /*
+    G4Box * box1 = new G4Box("Box1",1092.500000,240.103374,92.000000);
+    G4Box * box2 = new G4Box("Box2",540.103374,792.500000,92.000000);
+
+    G4double L1 = 1104;
+
+    aVolume =
+    new G4UnionSolid("ECShapeBoxes",
+                     box1,
+                     box2,
+                     0,
+                     G4ThreeVector(-L1/2.,
+                                   L1/2.,
+                                   0.));
+    */
+  }
+  else if (val == "b1Ib2") 
+  {         
+    aVolume = new G4IntersectionSolid("b1Ib2",b1,b2);
+  }
+  else if (val == "b1Sb2") 
+  {         
+    aVolume = new G4SubtractionSolid("b1Sb2",b1,b2);
+  }
+  else if (val == "b1Ib1") 
+  {         
+    aVolume = new G4IntersectionSolid("b1Ib1",b1,b1);
+  }
+  else if (val == "b1Ub1") 
+  {         
+    aVolume = new G4UnionSolid("b1Ub1",b1,b1);
+  }
+  else if (val == "b1Sb1") 
+  {         
+    aVolume = new G4SubtractionSolid("b1Sb1",b1,b1);
+  }
+  else if (val == "TwistedBox")
+  {
+    aVolume = new G4TwistedBox("aTwistedBox",40*deg,5*cm,8*cm,15*cm) ;
+  }
+  else if (val == "TwistedTrd")
+  {
+    aVolume = new G4TwistedTrd("aTwistedTrd",5*cm,10*cm,8*cm,15*cm,18*cm,20*deg);
+  }
+  else if (val == "TwistedTrap")
+  {
+    aVolume = new G4TwistedTrap("aTwistedTrap",40*deg,5*cm,7*cm,8*cm,15*cm);
+  }
+  else if ( val == "TwistedTrap2") 
+  {
+    aVolume = new G4TwistedTrap("aTwistedTrap2",
+                                20*deg,    // twist angle
+                                80*cm,         // half z length
+                                10*deg,      // direction between end planes
+                                40*deg,        // defined by polar and azimutal angles.
+                                8*cm,        // half y length at -pDz
+                                11*cm,        // half x length at -pDz,-pDy
+                                16*cm,        // half x length at -pDz,+pDy
+                                8*cm,        // half y length at +pDz
+                                11*cm,         // half x length at +pDz,-pDy
+                                16*cm,        // half x length at +pDz,+pDy
+                                -50*deg        // tilt angle at +pDz
+                                ) ;
+  }
+
+  else
+  {
+    //   G4Exception("Sc01DetectorConstruction::SelectDetector() - Invalid shape!");
+  }
+  if(val == "manyCons")
+  {
+
+    G4Cons* cons1 = new G4Cons ( "cons1", 2*cm, 3*cm, 4*cm, 6*cm,
+                           10*cm, 0*deg, 360*deg );
+    G4Cons* cons2 = new G4Cons ( "cons2", 3*cm, 4*cm, 6*cm, 8*cm,
+                           10*cm, 0*deg, 360*deg );
+    G4Cons* cons3 = new G4Cons ( "cons3", 4*cm, 5*cm, 8*cm, 10*cm,
+                           10*cm, 0*deg, 360*deg );
+
+    G4LogicalVolume* lcons1 = new G4LogicalVolume(cons1, Water1,"lcons1",0,0,0);
+    G4LogicalVolume* lcons2 = new G4LogicalVolume(cons2, Water1,"lcons2",0,0,0);
+    G4LogicalVolume* lcons3 = new G4LogicalVolume(cons3, Water1,"lcons3",0,0,0);
+
+    // G4VPhysicalVolume * pcons1 =
+    new G4PVPlacement(0,G4ThreeVector(0*cm, 0*cm, 0*cm),
+                      "pcons1",lcons1,PhysicalVolume, false, 0); 
+    // G4VPhysicalVolume * pcons2 =
+    new G4PVPlacement(0,G4ThreeVector(0*cm, 0*cm, 0*cm),
+                      "pcons2",lcons2,PhysicalVolume, false, 0); 
+    // G4VPhysicalVolume * pcons3 =
+    new G4PVPlacement(0,G4ThreeVector(0*cm, 0*cm, 0*cm),
+                      "pcons3",lcons3,PhysicalVolume, false, 0); 
+  }  
+  else
+  {
+    G4Torus* solidFiber =
+      new G4Torus("clad",0.,1.*cm,10.*cm,0.*deg,180.*deg);    // external
+
+    G4Torus* solidCore =
+      new G4Torus("core",0.,0.5*cm,10.*cm,0.*deg,180.*deg); // internal
+
+    G4LogicalVolume* logicFiber =
+    new G4LogicalVolume(solidFiber,Water1,"FiberClad",0,0,0);
+
+    G4LogicalVolume* logicCore =
+    new G4LogicalVolume(solidCore,Water1,"FiberCore",0,0,0);
+
+  G4VPhysicalVolume * aVolume_phys1 =
+  new G4PVPlacement(0,0,logicFiber,"FiberClad",Hall_log,false,0);
+
+  // G4VPhysicalVolume * aVolume_phys2 =
+  // new G4PVPlacement(0,0,logicCore,"FiberCore",logicFiber,false,0);
+  new G4PVPlacement(0,0,"FiberCore",logicCore,aVolume_phys1,false,0);
+
+  /*
+  G4LogicalVolume* aVolume_log 
+
+    //  = new G4LogicalVolume(aVolume, Water1, "aVolume_L", 0,0,0);
+
+    //  =  GetConePolycone();
+   
+  G4VPhysicalVolume * aVolume_phys1
+    = new G4PVPlacement(0,G4ThreeVector(0*cm, 0*cm, 0*cm),val, 
+                        aVolume_log, PhysicalVolume, false, 0);
+
+
+  */
+//--------- Visualization attributes -------------------------------
+
+  //  G4VisAttributes* BoxVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0));
+  //  Hall_log  ->SetVisAttributes(BoxVisAtt);
+  Hall_log  ->SetVisAttributes (G4VisAttributes::Invisible);
+
+  // aVolume_log ->SetVisAttributes(BoxVisAtt);
+  // logicTracker->SetVisAttributes(BoxVisAtt);
+
+  // G4VisAttributes* ChamberVisAtt = new G4VisAttributes(G4Colour(0.0,1.0,0.0));
+  //  aVolume_log->SetVisAttributes(ChamberVisAtt);
+
+//--------- example of User Limits -------------------------------
+
+
+
+  /*
+  G4VPhysicalVolume * aVolume_phys1
+    = new G4PVPlacement(0,G4ThreeVector(50*cm, 0*cm, 0*cm),val, 
+                        aVolume_log, PhysicalVolume, false, 0);
+  G4VPhysicalVolume * aVolume_phys2
+    = new G4PVPlacement(0,G4ThreeVector(-50*cm, 0*cm, 0*cm),val, 
+                        aVolume_log, PhysicalVolume, false, 0);
+  G4VPhysicalVolume * aVolume_phys3
+    = new G4PVPlacement(0,G4ThreeVector(0*cm, 50*cm, 0*cm),val, 
+                        aVolume_log, PhysicalVolume, false, 0);
+  G4VPhysicalVolume * aVolume_phys4
+    = new G4PVPlacement(0,G4ThreeVector(0*cm, -50*cm, 0*cm),val, 
+                        aVolume_log, PhysicalVolume, false, 0);
+  G4VPhysicalVolume * aVolume_phys5
+    = new G4PVPlacement(0,G4ThreeVector(0*cm, 0*cm, 50*cm),val, 
+                        aVolume_log, PhysicalVolume, false, 0);
+  G4VPhysicalVolume * aVolume_phys6
+    = new G4PVPlacement(0,G4ThreeVector(0*cm, 0*cm, -50*cm),val, 
+                    aVolume_log, PhysicalVolume, false, 0);
+  */
+
+  // ------------ Surfaces definition ------------------
+
+//  G4LogicalBorderSurface* BorderSurfaces[12];   
+  G4LogicalBorderSurface* BorderSurfaces[2];   
+  
+BorderSurfaces[0] = new G4LogicalBorderSurface("VolumeSurface",
+                               PhysicalVolume,
+                               aVolume_phys1,
+                               aSurface);
+
+  BorderSurfaces[6] = new G4LogicalBorderSurface("VolumeSurface",
+                               aVolume_phys1,
+                               PhysicalVolume,
+                               aSurface);
+/*
+  BorderSurfaces[1] = new G4LogicalBorderSurface("VolumeSurface",
+                               PhysicalVolume,
+                               aVolume_phys2,
+                               aSurface);
+  BorderSurfaces[2] = new G4LogicalBorderSurface("VolumeSurface",
+                               PhysicalVolume,
+                               aVolume_phys3,
+                               aSurface);
+  BorderSurfaces[3] = new G4LogicalBorderSurface("VolumeSurface",
+                               PhysicalVolume,
+                               aVolume_phys4,
+                               aSurface);
+  BorderSurfaces[4] = new G4LogicalBorderSurface("VolumeSurface",
+                               PhysicalVolume,
+                               aVolume_phys5,
+                               aSurface);
+  BorderSurfaces[5] = new G4LogicalBorderSurface("VolumeSurface",
+                               PhysicalVolume,
+                               aVolume_phys6,
+                               aSurface);
+  BorderSurfaces[6] = new G4LogicalBorderSurface("VolumeSurface",
+                               aVolume_phys1,
+                               PhysicalVolume,
+                               aSurface);
+  BorderSurfaces[7] = new G4LogicalBorderSurface("VolumeSurface",
+                               aVolume_phys2,
+                               PhysicalVolume,
+                               aSurface);
+  BorderSurfaces[8] = new G4LogicalBorderSurface("VolumeSurface",
+                               aVolume_phys3,
+                               PhysicalVolume,
+                               aSurface);
+  BorderSurfaces[9] = new G4LogicalBorderSurface("VolumeSurface",
+                               aVolume_phys4,
+                               PhysicalVolume,
+                               aSurface);
+  BorderSurfaces[10] = new G4LogicalBorderSurface("VolumeSurface",
+                               aVolume_phys5,
+                               PhysicalVolume,
+                               aSurface);
+  BorderSurfaces[11] = new G4LogicalBorderSurface("VolumeSurface",
+                               aVolume_phys6,
+                               PhysicalVolume,
+                               aSurface);
+*/
+  }
+  G4cout << "You select " << val << " detector" << G4endl;
+
+  return PhysicalVolume;
+}
+
+
+
+G4VPhysicalVolume* Sc01DetectorConstruction::SelectTubeSector()
+{
+  G4double a,z,density;
+
+  G4Material* Al =
+    new G4Material("Aluminum", z=13., a=26.98*g/mole, density=1.782*mg/cm3);
+
+  G4Material* Vacuum =
+    new G4Material("Galactic", z=1., a=1.01*g/mole,density= universe_mean_density,
+                   kStateGas, 3.e-18*pascal, 2.73*kelvin);
+
+
+
+
+  G4int i, sections_ = 12; // 12;
+
+  G4double cof, dPhi, sPhi;
+
+  sPhi = twopi/sections_;
+  cof = 1.;
+  dPhi = cof*sPhi;
+
+  G4cout<<"sections_ = "<<sections_<<G4endl;
+
+  G4double lab_x = 20.0*m;
+  G4double lab_y = 20.0*m;
+  G4double lab_z = 20.0*m;
+
+  fHallSize = lab_x;
+
+  G4cout<<"m = "<<m<<"; degree = "<<degree<<G4endl;
+
+  // world volume
+
+  G4Box* lab_S = new G4Box("lab",lab_x,lab_y,lab_z);
+
+  G4LogicalVolume*  lab_L = new G4LogicalVolume(lab_S,
+                              Vacuum, "lab", 0, 0, 0);
+
+  // tube section
+
+  G4Tubs* arcSection_S = new G4Tubs("arcSection",
+                              6.*m, 10.*m, 2.*m,
+                              0., dPhi            );
+
+  G4cout<<"dPhi = "<<dPhi<<G4endl;
+
+  G4LogicalVolume* arcSection_L = new G4LogicalVolume(arcSection_S,
+                                     Al, "arcSection", 0, 0, 0);
+
+  for( i = 0; i < sections_; i++)
+  {
+    G4RotationMatrix rot;
+    rot.rotateZ( sPhi*i );
+
+    G4cout<<"i = "<<i<<";  i*sPhi = "<<i*sPhi<<G4endl;
+
+    G4cout<<"cos(i*sPhi)= "<<std::cos(i*sPhi)
+          <<";  std::sin(i*sPhi) = "<<std::sin(i*sPhi)<<G4endl<<G4endl;
+
+    G4cout<<rot.xx()<<"\t\t"<<rot.xy()<<"\t\t"<<rot.xz()<<G4endl;
+    G4cout<<rot.yx()<<"\t\t"<<rot.yy()<<"\t\t"<<rot.yz()<<G4endl;
+    G4cout<<rot.zx()<<"\t\t"<<rot.zy()<<"\t\t"<<rot.zz()<<G4endl<<G4endl;
+
+    G4Transform3D transf(rot, G4ThreeVector() );
+
+    // G4VPhysicalVolume* arcSection_P = 
+    new G4PVPlacement(transf, arcSection_L,
+                      "section", lab_L, false, i, true);
+  } 
+  G4VPhysicalVolume* lab_P= new G4PVPlacement(0, G4ThreeVector(),
+                           lab_L, "lab", 0, false, 0);
+
+  G4VisAttributes* labVisAtt = new G4VisAttributes(G4Colour());
+  labVisAtt -> SetVisibility(1);
+  lab_L -> SetVisAttributes(labVisAtt);
+
+  G4VisAttributes* aSVisAtt =
+  new G4VisAttributes(G4Colour(1.0,0.0,0.0,1.0));
+  aSVisAtt -> SetForceWireframe(1);
+  arcSection_L -> SetVisAttributes(aSVisAtt);
+
+  return lab_P;
+
+}
+
+///////////////////////////////////////////////////////////////////////
+//
+//
+
+G4LogicalVolume* Sc01DetectorConstruction::GetConePolycone()
+{
+
+  G4double cryoMotherZplan[] = {-3490.*mm,
+                              -2850.*mm,
+                              -2849.*mm, 
+                               2849.*mm, 
+                               2850.*mm, 
+                               3490.*mm};
+
+  G4double cryoMotherRin[]   = { 1149.8*mm, 
+                               1149.8*mm,
+                               1149.8*mm,
+                               1149.8*mm,
+                               1149.8*mm,
+                               1149.8*mm};
+
+  G4double cryoMotherRout[]  = { 2890.*mm, 
+                               2890.*mm,
+                               2250.*mm,
+                               2250.*mm,
+                               2890.*mm,
+                               2890.*mm};  
+
+  // LArVG4DetectorParameters* parameters = LArVG4DetectorParameters::GetInstance();
+
+  // Get the z-Shift from the detector parameters routine.
+
+  G4double zShift = 4.*cm;               // parameters->GetValue("LArEMECZshift");
+
+   // Adjust mother volume size.
+
+G4int lastPlaneCryo = ( sizeof(cryoMotherZplan) / sizeof(G4double) );
+
+cryoMotherZplan[lastPlaneCryo-1] += zShift;
+
+cryoMotherZplan[0] -= zShift;
+
+G4String cryoMotherName = "LAr::Barrel::Cryostat::MotherVolume";
+
+G4Polycone* cryoMotherShape =
+   new G4Polycone(cryoMotherName,          // name
+                   0.,                     // starting phi
+                   twopi,                  // total phi
+                   lastPlaneCryo,          // number of z planes
+                   cryoMotherZplan,        // position of z planes    
+                   cryoMotherRin,          // tangent distance to inner surface
+                   cryoMotherRout );       // tangent distance to outer surface
+
+
+
+ G4LogicalVolume* lvPolycone = new G4LogicalVolume(cryoMotherShape,
+                                                   Water1,
+                                                  "lvPolycone");
+
+
+// #  Material  Zmin     Dz     Rmin1     Rmax1     Rmin2    Rmax2
+// { 11,  Al, 316.000,  22.500, 120.800, 122.021, 140.779, 142.000},
+
+// the cone is positioned at Zmin+Dz, hence 316cm+22.5cm...
+
+  G4Cons* coneATLAS = new G4Cons("coneATLAS",120.8*cm, 122.021*cm, 
+                                            140.779*cm, 142.0*cm,
+                                            22.5*cm/2., 0., 2*pi              );
+
+  G4LogicalVolume* lvCone = new G4LogicalVolume(coneATLAS,
+                                       Water1,
+                                      "lvCone");
+
+// G4VPhysicalVolume*  pvCone =
+    new G4PVPlacement(0, G4ThreeVector( 0, 0, 316.0*cm + 22.5*cm ),
+                                       lvCone ,
+                                      "pvCone",
+                                       lvPolycone,
+                                       false,
+                                       0                );
+
+
+  G4VisAttributes* ChamberVisAtt = new G4VisAttributes(G4Colour(1.0,1.0,0.0));
+  lvCone->SetVisAttributes(ChamberVisAtt);
+
+  return lvPolycone;
+}
+
+
+
+void Sc01DetectorConstruction::SetMaterial()
+{
+  G4String name, symbol;
+  G4double density = 1.00*g/cm3;
+  G4double a, iz;
+  Water = new G4Material(name="Water", density, 2);
+  Water1 = new G4Material(name="Water1", density, 2);
+  a = 1*g/mole;
+  G4Element* elH = new G4Element(name="Hydrogen", symbol="H", iz=1., a);
+  a = 16.00*g/mole;
+  G4Element* elO = new G4Element(name="Oxygen", symbol="O", iz=8., a);
+
+  Water->AddElement(elH, .66);
+  Water->AddElement(elO, .34);
+  Water1->AddElement(elH, .66);
+  Water1->AddElement(elO, .34);
+
+  const G4int NUMENTRIES = 5;
+  G4double RINDEX_WATER [NUMENTRIES];
+  G4double RINDEX_WATER1 [NUMENTRIES];
+  G4double REFLECTIVITY [NUMENTRIES];
+  G4double EFFICIENCY [NUMENTRIES];
+  
+  for (int i=0; i<NUMENTRIES; i++) {
+    RINDEX_WATER1[i]=5.0;
+    RINDEX_WATER[i]=1.33;
+    REFLECTIVITY[i]=0.9;
+    EFFICIENCY[i]=1.0;
+  }  
+  G4double PHENERGY[NUMENTRIES] =
+            { 0.0, 1.0, 2.0, 3.0, 4.0};
+  G4MaterialPropertiesTable *WaterMPT = new G4MaterialPropertiesTable();
+  G4MaterialPropertiesTable *WaterMPT1 = new G4MaterialPropertiesTable();
+  WaterMPT->AddProperty("RINDEX", PHENERGY, RINDEX_WATER, NUMENTRIES);
+  WaterMPT1->AddProperty("RINDEX", PHENERGY, RINDEX_WATER1, NUMENTRIES);
+  Water->SetMaterialPropertiesTable(WaterMPT);
+  Water1->SetMaterialPropertiesTable(WaterMPT1);
+
+  aSurface = new G4OpticalSurface ( "aSurface" );
+  aSurface->SetType(dielectric_metal);
+  aSurface->SetFinish(polishedfrontpainted);
+  aSurface->SetModel(glisur);  
+  G4MaterialPropertiesTable* SurfaceMPT = new G4MaterialPropertiesTable();
+  SurfaceMPT->AddProperty("REFLECTIVITY", PHENERGY, REFLECTIVITY, NUMENTRIES);
+  SurfaceMPT->AddProperty("EFFICIENCY", PHENERGY, EFFICIENCY, NUMENTRIES);
+  aSurface->SetMaterialPropertiesTable ( SurfaceMPT );
+}
+
+G4VPhysicalVolume* Sc01DetectorConstruction::Construct()
+{
+  SetMaterial();
+
+  //-------------------Hall ----------------------------------
+  // return SelectTubeSector();  
+  return SelectDetector ("Torus");
+}
+
+
Index: trunk/source/geometry/solids/test/SolidsChecker/src/Sc01DetectorMessenger.cc
===================================================================
--- trunk/source/geometry/solids/test/SolidsChecker/src/Sc01DetectorMessenger.cc	(revision 1316)
+++ trunk/source/geometry/solids/test/SolidsChecker/src/Sc01DetectorMessenger.cc	(revision 1316)
@@ -0,0 +1,74 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+
+#include "Sc01DetectorMessenger.hh"
+
+#include "Sc01DetectorConstruction.hh"
+#include "G4UIdirectory.hh"
+#include "G4UIcmdWithAString.hh"
+#include "globals.hh"
+
+#include "G4ios.hh"
+
+Sc01DetectorMessenger::Sc01DetectorMessenger(Sc01DetectorConstruction * myDC)
+  : myDetector(myDC)
+{
+  G4String defParam;
+
+  mydetDir = new G4UIdirectory("/mydet/");
+  mydetDir->SetGuidance("Detector setup commands.");
+
+  selDetCmd = new G4UIcmdWithAString("/mydet/SelectDetector",this);
+  selDetCmd->SetGuidance("Select Detector Setup.");
+  selDetCmd->SetGuidance("  Choice : Detector type ");
+  selDetCmd->SetParameterName("choice",true);
+  selDetCmd->SetDefaultValue("Sphere");
+
+ selDetCmd->SetCandidates("Sphere Orb Box Cone manyCons Tube Hype Torus Para Trd b1Ib2 b1Ub2 b1Sb2 b1Ub1 b1Ib1 b1Sb1 TwistedBox TwistedTrd TwistedTrap TwistedTrap2");
+  selDetCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
+
+    myDetector->SelectDetector(defParam="Sphere");
+}
+
+void Sc01DetectorMessenger::SetNewValue(G4UIcommand * command,
+                                         G4String newValues)
+{
+  if( command == selDetCmd )
+  {
+    myDetector->SelectDetector(newValues);
+    myDetector->SwitchDetector();
+  }
+  return;
+}
+
+
+
+
+
+
+
+
+
Index: trunk/source/geometry/solids/test/SolidsChecker/src/Sc01EventAction.cc
===================================================================
--- trunk/source/geometry/solids/test/SolidsChecker/src/Sc01EventAction.cc	(revision 1316)
+++ trunk/source/geometry/solids/test/SolidsChecker/src/Sc01EventAction.cc	(revision 1316)
@@ -0,0 +1,110 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: Sc01EventAction.cc,v 1.3 2006/06/29 18:54:00 gunter Exp $
+// ------------------------------------------------------------
+//	GEANT 4 class header file 
+//
+//      This is a version for maximum particle set
+//	History
+//        first version              09  Sept. 1998 by S.Magni
+// ------------------------------------------------------------
+
+#include "Sc01EventAction.hh"
+#include "Sc01EventActionMessenger.hh"
+
+
+#include "G4Event.hh"
+#include "G4EventManager.hh"
+#include "G4HCofThisEvent.hh"
+#include "G4VHitsCollection.hh"
+#include "G4TrajectoryContainer.hh"
+#include "G4Trajectory.hh"
+#include "G4VVisManager.hh"
+#include "G4SDManager.hh"
+#include "G4UImanager.hh"
+#include <iostream>
+
+Sc01EventAction::Sc01EventAction()
+  : fDrawFlag("all")
+{
+  eventMessenger = new Sc01EventActionMessenger(this);
+}
+
+Sc01EventAction::~Sc01EventAction()
+{
+  delete eventMessenger;
+}
+
+void Sc01EventAction::BeginOfEventAction(const G4Event* evt)
+{
+ G4int evtNb = evt->GetEventID();
+ 
+ if ( evtNb % printModulo == 0 )
+ { 
+    G4cout << "\n---> Begin of Event: " << evtNb << G4endl;
+ }
+   //  G4cout << ">>> Start Event " << evt->GetEventID() << G4endl;
+}
+
+void Sc01EventAction::EndOfEventAction(const G4Event* evt)
+{
+  // G4cout << ">>> End Event " << evt->GetEventID() << G4endl;
+
+  G4TrajectoryContainer * trajectoryContainer = evt->GetTrajectoryContainer();
+  G4int n_trajectories = 0;
+  if(trajectoryContainer) n_trajectories = trajectoryContainer->entries(); 
+
+  G4VVisManager* pVisManager = G4VVisManager::GetConcreteInstance();
+
+  if(pVisManager) 
+  {
+    G4TrajectoryContainer* trajectoryContainer = evt->GetTrajectoryContainer();
+    G4int n_trajectories = 0;
+
+    if (trajectoryContainer) n_trajectories = trajectoryContainer->entries();
+
+    for (G4int i=0; i<n_trajectories; i++)
+    { 
+      G4VTrajectory* trj = ((*(evt->GetTrajectoryContainer()))[i]);
+
+      // if ( fDrawFlag == "all" )        
+      trj->DrawTrajectory(50); 
+                                  //     pVisManager->Draw(*trj,1000);
+      /*
+      else if ( (fDrawFlag == "charged")&&
+                (trj->GetCharge() != 0.) )  pVisManager->Draw(*trj,1000);
+
+      else if ((fDrawFlag == "neutral")&&
+               (trj->GetCharge() == 0.))    pVisManager->Draw(*trj,1000);
+      */
+    }
+  }		 
+}
+
+
+
+
+
Index: trunk/source/geometry/solids/test/SolidsChecker/src/Sc01EventActionMessenger.cc
===================================================================
--- trunk/source/geometry/solids/test/SolidsChecker/src/Sc01EventActionMessenger.cc	(revision 1316)
+++ trunk/source/geometry/solids/test/SolidsChecker/src/Sc01EventActionMessenger.cc	(revision 1316)
@@ -0,0 +1,75 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: Sc01EventActionMessenger.cc,v 1.2 2006/06/29 18:54:02 gunter Exp $
+// GEANT4 tag $Name: geant4-09-04-beta-cand-01 $
+//
+// 
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+#include "Sc01EventActionMessenger.hh"
+#include "Sc01EventAction.hh"
+
+#include "G4UIcmdWithAString.hh"
+#include "G4UIcmdWithAnInteger.hh"
+#include "G4UIcmdWithADoubleAndUnit.hh"
+#include "globals.hh"
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+Sc01EventActionMessenger::Sc01EventActionMessenger(Sc01EventAction* EvAct)
+:
+eventAction(EvAct)
+{ 
+  
+  PrintCmd = new G4UIcmdWithAnInteger("/event/printModulo",this);
+  PrintCmd->SetGuidance("Print events modulo n");
+  PrintCmd->SetParameterName("EventNb",false);
+  PrintCmd->SetRange("EventNb>0");
+  PrintCmd->AvailableForStates(G4State_Idle);     
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+Sc01EventActionMessenger::~Sc01EventActionMessenger()
+{
+  delete PrintCmd;    
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+void Sc01EventActionMessenger::SetNewValue(G4UIcommand* command,
+                                            G4String     newValue  )
+{    
+  if(command == PrintCmd)
+  {
+    eventAction->SetPrintModulo( PrintCmd->GetNewIntValue(newValue) );
+  }
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Index: trunk/source/geometry/solids/test/SolidsChecker/src/Sc01PhysicsList.cc
===================================================================
--- trunk/source/geometry/solids/test/SolidsChecker/src/Sc01PhysicsList.cc	(revision 1316)
+++ trunk/source/geometry/solids/test/SolidsChecker/src/Sc01PhysicsList.cc	(revision 1316)
@@ -0,0 +1,144 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: Sc01PhysicsList.cc,v 1.4 2006/06/29 18:54:05 gunter Exp $
+// ------------------------------------------------------------
+//	GEANT 4 class header file 
+//
+//      This is a version for maximum particle set
+//	History
+//        first version              10  Jan. 1998 by H.Kurashige
+//        add decay at rest          26  Feb. 1998 by H.Kurashige
+// ------------------------------------------------------------
+
+#include "globals.hh"
+#include "Sc01PhysicsList.hh"
+#include "G4ParticleDefinition.hh"
+#include "G4ParticleWithCuts.hh"
+#include "G4ProcessManager.hh"
+#include "G4ProcessVector.hh"
+#include "G4Geantino.hh"
+#include "G4OpticalPhoton.hh"
+#include "G4ParticleTable.hh"
+#include "G4Material.hh"
+#include "G4MaterialTable.hh"
+#include "G4ios.hh"
+#include <iomanip>                
+
+
+Sc01PhysicsList::Sc01PhysicsList():  G4VUserPhysicsList()
+{
+  SetVerboseLevel(1);
+}
+
+Sc01PhysicsList::~Sc01PhysicsList()
+{
+}
+
+void Sc01PhysicsList::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();
+
+}
+
+void Sc01PhysicsList::ConstructBosons()
+{
+  // pseudo-particles
+  G4Geantino::GeantinoDefinition();
+
+  // optical photon
+  G4OpticalPhoton::OpticalPhotonDefinition();
+}
+
+
+
+void Sc01PhysicsList::ConstructProcess()
+{
+  AddTransportation();
+  ConstructEM();
+  ConstructGeneral();
+}
+#include "G4OpBoundaryProcess.hh"
+
+void Sc01PhysicsList::ConstructEM()
+{
+  theParticleIterator->reset();
+  while( (*theParticleIterator)() )
+  {
+    G4ParticleDefinition* particle = theParticleIterator->value();
+    // G4ProcessManager* pmanager = particle->GetProcessManager();
+    G4String particleName = particle->GetParticleName();
+     
+    if (particleName == "opticalphoton") 
+    {
+    // opticalphoton
+    // Construct processes for opticalphoton
+    //  pmanager->AddDiscreteProcess(new G4OpBoundaryProcess());
+ 
+    } 
+  }
+}
+
+#include "G4Decay.hh"
+void Sc01PhysicsList::ConstructGeneral()
+{
+  G4Decay* theDecayProcess = new G4Decay();
+  theParticleIterator->reset();
+
+  while( (*theParticleIterator)() )
+  {
+    G4ParticleDefinition* particle = theParticleIterator->value();
+    G4ProcessManager* pmanager = particle->GetProcessManager();
+
+    if (theDecayProcess->IsApplicable(*particle)) 
+    { 
+      pmanager->AddProcess(theDecayProcess, INT_MAX, -1, INT_MAX); 
+    }
+  }
+}
+
+void Sc01PhysicsList::SetCuts()
+{
+  if (verboseLevel >0)
+  {
+    G4cout << "Sc01PhysicsList::SetCuts:";
+    G4cout << "CutLength : " << defaultCutValue/mm << " (mm)" << G4endl;
+  }
+  // set verbose level 0 to surpress messages
+  G4int temp = GetVerboseLevel();
+  SetVerboseLevel(0);  
+
+  SetCutsWithDefault();   
+
+  // retrieve verbose level
+  SetVerboseLevel(temp);
+}
+
+
Index: trunk/source/geometry/solids/test/SolidsChecker/src/Sc01PrimaryGeneratorAction.cc
===================================================================
--- trunk/source/geometry/solids/test/SolidsChecker/src/Sc01PrimaryGeneratorAction.cc	(revision 1316)
+++ trunk/source/geometry/solids/test/SolidsChecker/src/Sc01PrimaryGeneratorAction.cc	(revision 1316)
@@ -0,0 +1,147 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: Sc01PrimaryGeneratorAction.cc,v 1.4 2006/12/13 15:43:44 gunter Exp $
+// ------------------------------------------------------------
+//	GEANT 4 class header file 
+//
+//      This is a version for maximum particle set
+//	History
+//        first version              09  Sept. 1998 by S.Magni
+// ------------------------------------------------------------
+
+#include "Sc01PrimaryGeneratorAction.hh"
+#include "Sc01DetectorConstruction.hh"
+
+#include "G4Event.hh"
+#include "G4ParticleGun.hh"
+#include "G4ParticleTable.hh"
+#include "G4ParticleDefinition.hh"
+#include "Randomize.hh"
+#include "globals.hh"
+
+#include <iostream>
+#include <fstream>
+
+Sc01PrimaryGeneratorAction::
+Sc01PrimaryGeneratorAction(Sc01DetectorConstruction*det)
+  :
+  fDetector(det)
+{
+  particleGun = new G4ParticleGun();
+}
+
+Sc01PrimaryGeneratorAction::~Sc01PrimaryGeneratorAction()
+{
+  delete particleGun;
+}
+
+void Sc01PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
+{
+
+  G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
+  G4String particleName;
+  G4ParticleDefinition* aParticleDefinition 
+    = particleTable->FindParticle(particleName="opticalphoton");
+
+  // create a new vertex in a random position 
+
+  //  G4ThreeVector VertexPosition (GetRandomPosition());
+  G4ThreeVector VertexPosition (G4ThreeVector(0,0,0));
+  G4PrimaryVertex* aVertex = 
+    new G4PrimaryVertex( VertexPosition, 0);
+
+  //  G4int NumberOfParticlesToBeGenerated = 10000;
+  G4int NumberOfParticlesToBeGenerated = 1;
+  // G4cout << "  A " << NumberOfParticlesToBeGenerated 
+  //          << " optical photons vertex has been generated at " 
+  //          << VertexPosition << G4endl;
+  // create new primaries and set them to the vertex
+  for( int i=0; i<NumberOfParticlesToBeGenerated; i++ )
+  {
+    //	G4ThreeVector m = GetRandomDirection();
+		G4ThreeVector m(0.,1.,0.);
+    G4PrimaryParticle* aPrimaryParticle =
+      new G4PrimaryParticle(aParticleDefinition, m.x(), m.y(), m.z());
+    aPrimaryParticle->SetMass (0);
+    G4ThreeVector p = GetRandomPolarization ( m );
+    aPrimaryParticle->SetPolarization(p.x(),p.y(),p.z());
+    aVertex->SetPrimary( aPrimaryParticle );
+  }
+  anEvent->AddPrimaryVertex( aVertex );
+}
+
+G4ThreeVector Sc01PrimaryGeneratorAction::GetRandomDirection() {
+
+  G4ThreeVector retval;
+
+  G4double CosTheta;
+  G4double SinTheta;
+
+  G4double Phi;
+  G4double SinPhi;
+  G4double CosPhi;
+
+  G4double rand;
+
+  rand = G4UniformRand();
+
+  CosTheta = 2.0*rand -1.0;
+  SinTheta = std::sqrt (1.-CosTheta*CosTheta);
+  rand = G4UniformRand();
+  Phi = twopi*rand;
+  SinPhi = std::sin (Phi);
+  CosPhi = std::cos (Phi);
+  retval.setX(SinTheta*CosPhi);
+  retval.setY(SinTheta*SinPhi);
+  retval.setZ(CosTheta);
+
+  return retval;
+}
+
+G4ThreeVector Sc01PrimaryGeneratorAction::GetRandomPosition() 
+{
+  G4double a = fDetector->GetHallSize();
+
+  G4double x = ( G4UniformRand()*2 - 1 )*a;
+  G4double y = ( G4UniformRand()*2 - 1 )*a;
+  G4double z = ( G4UniformRand()*2 - 1 )*a;
+
+  G4ThreeVector retval (x, y, z);
+
+  return retval;
+}
+
+G4ThreeVector Sc01PrimaryGeneratorAction::GetRandomPolarization(G4ThreeVector Direction) {
+  G4ThreeVector Polarization = Direction.orthogonal();
+  G4ThreeVector retval = Polarization.unit();
+  return retval;
+}
+
+
+
+
+
+
Index: trunk/source/geometry/solids/test/SolidsChecker/src/Sc01RunAction.cc
===================================================================
--- trunk/source/geometry/solids/test/SolidsChecker/src/Sc01RunAction.cc	(revision 1316)
+++ trunk/source/geometry/solids/test/SolidsChecker/src/Sc01RunAction.cc	(revision 1316)
@@ -0,0 +1,69 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: Sc01RunAction.cc,v 1.3 2006/06/29 18:54:10 gunter Exp $
+// ------------------------------------------------------------
+//	GEANT 4 class header file 
+//
+//      This is a version for maximum particle set
+//	History
+//        first version              09  Sept. 1998 by S.Magni
+// ------------------------------------------------------------
+
+#include "Sc01RunAction.hh"
+
+#include "G4Run.hh"
+#include "G4UImanager.hh"
+#include "G4VVisManager.hh"
+#include "G4ios.hh"
+
+Sc01RunAction::Sc01RunAction()
+{
+}
+
+Sc01RunAction::~Sc01RunAction()
+{
+
+}
+
+void Sc01RunAction::BeginOfRunAction(const G4Run* )
+{
+  // G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
+
+  if (G4VVisManager::GetConcreteInstance())
+    {
+      G4UImanager* UI = G4UImanager::GetUIpointer();
+      UI->ApplyCommand("/vis/scene/notifyHandlers");
+    }
+}
+
+void Sc01RunAction::EndOfRunAction(const G4Run* )
+{
+  if (G4VVisManager::GetConcreteInstance())
+    {
+     G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/update");
+    }
+}
+
Index: trunk/source/geometry/solids/test/SolidsChecker/src/Sc01VisManager.cc
===================================================================
--- trunk/source/geometry/solids/test/SolidsChecker/src/Sc01VisManager.cc	(revision 1316)
+++ trunk/source/geometry/solids/test/SolidsChecker/src/Sc01VisManager.cc	(revision 1316)
@@ -0,0 +1,140 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: Sc01VisManager.cc,v 1.3 2007/05/18 11:03:28 gcosmo Exp $
+// GEANT4 tag $Name: geant4-09-04-beta-cand-01 $
+//
+// 
+// John Allison 24th January 1998.
+
+#ifdef G4VIS_USE
+
+#include "Sc01VisManager.hh"
+
+// Supported drivers...
+
+// Not needing external packages or libraries...
+#include "G4ASCIITree.hh"
+#include "G4DAWNFILE.hh"
+#include "G4HepRepFile.hh"
+#include "G4HepRep.hh"
+#include "G4RayTracer.hh"
+#include "G4VRML1File.hh"
+#include "G4VRML2File.hh"
+
+// Needing external packages or libraries...
+
+#ifdef G4VIS_USE_DAWN
+#include "G4FukuiRenderer.hh"
+#endif
+
+#ifdef G4VIS_USE_OPENGLX
+#include "G4OpenGLImmediateX.hh"
+#include "G4OpenGLStoredX.hh"
+#endif
+
+#ifdef G4VIS_USE_OPENGLWIN32
+#include "G4OpenGLImmediateWin32.hh"
+#include "G4OpenGLStoredWin32.hh"
+#endif
+
+#ifdef G4VIS_USE_OPENGLXM
+#include "G4OpenGLImmediateXm.hh"
+#include "G4OpenGLStoredXm.hh"
+#endif
+
+#ifdef G4VIS_USE_OIX
+#include "G4OpenInventorX.hh"
+#endif
+
+#ifdef G4VIS_USE_OIWIN32
+#include "G4OpenInventorWin32.hh"
+#endif
+
+#ifdef G4VIS_USE_VRML
+#include "G4VRML1.hh"
+#include "G4VRML2.hh"
+#endif
+
+
+Sc01VisManager::Sc01VisManager () {}
+
+
+void Sc01VisManager::RegisterGraphicsSystems () {
+
+  // Graphics Systems not needing external packages or libraries...
+  RegisterGraphicsSystem (new G4ASCIITree);
+  RegisterGraphicsSystem (new G4DAWNFILE);
+  RegisterGraphicsSystem (new G4HepRepFile);
+  RegisterGraphicsSystem (new G4HepRep);
+  RegisterGraphicsSystem (new G4RayTracer);
+  RegisterGraphicsSystem (new G4VRML1File);
+  RegisterGraphicsSystem (new G4VRML2File);
+
+  // Graphics systems needing external packages or libraries...
+
+#ifdef G4VIS_USE_DAWN
+  RegisterGraphicsSystem (new G4FukuiRenderer);
+#endif
+
+#ifdef G4VIS_USE_OPENGLX
+  RegisterGraphicsSystem (new G4OpenGLImmediateX);
+  RegisterGraphicsSystem (new G4OpenGLStoredX);
+#endif
+
+#ifdef G4VIS_USE_OPENGLWIN32
+  RegisterGraphicsSystem (new G4OpenGLImmediateWin32);
+  RegisterGraphicsSystem (new G4OpenGLStoredWin32);
+#endif
+
+#ifdef G4VIS_USE_OPENGLXM
+  RegisterGraphicsSystem (new G4OpenGLImmediateXm);
+  RegisterGraphicsSystem (new G4OpenGLStoredXm);
+#endif
+
+#ifdef G4VIS_USE_OIX
+  RegisterGraphicsSystem (new G4OpenInventorX);
+#endif
+
+#ifdef G4VIS_USE_OIWIN32
+  RegisterGraphicsSystem (new G4OpenInventorWin32);
+#endif
+
+#ifdef G4VIS_USE_VRML
+  RegisterGraphicsSystem (new G4VRML1);
+  RegisterGraphicsSystem (new G4VRML2);
+#endif
+
+  if (fVerbose > 0) {
+    G4cout <<
+      "\nYou have successfully chosen to use the following graphics systems."
+	 << G4endl;
+    PrintAvailableGraphicsSystems ();
+  }
+}
+
+#endif
+
Index: trunk/source/geometry/solids/test/SolidsChecker/src/SteppingAction.cc
===================================================================
--- trunk/source/geometry/solids/test/SolidsChecker/src/SteppingAction.cc	(revision 1316)
+++ trunk/source/geometry/solids/test/SolidsChecker/src/SteppingAction.cc	(revision 1316)
@@ -0,0 +1,87 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: SteppingAction.cc,v 1.3 2006/06/29 18:54:14 gunter Exp $
+// GEANT4 tag $Name: geant4-09-04-beta-cand-01 $
+//
+//
+/////////////////////////////////////////////////////////////////////////
+//
+// TestEm9: Crystal calorimeter
+//
+// Created: 31.01.03 V.Ivanchenko
+//
+// Modified:
+//
+////////////////////////////////////////////////////////////////////////
+//
+
+#include "SteppingAction.hh"
+#include "G4SteppingManager.hh"
+#include "G4VTouchable.hh"
+
+
+/////////////////////////////////////////////////////////
+
+SteppingAction::SteppingAction()
+  //: theHisto(HistoManager::GetPointer())
+{}
+
+////////////////////////////////////////////////////////////
+
+SteppingAction::~SteppingAction()
+{}
+
+/////////////////////////////////////////////////////////////////
+
+void SteppingAction::UserSteppingAction(const G4Step* aStep)
+{
+  // theHisto->AddStep();
+  // G4double edep = aStep->GetTotalEnergyDeposit();
+  //  if(edep == 0.) return;
+
+  const G4VPhysicalVolume* pv = aStep->GetPreStepPoint()->GetPhysicalVolume();
+  const G4LogicalVolume* lv = pv->GetLogicalVolume();
+  //  const G4MaterialCutsCouple* couple = aStep->GetTrack()->GetMaterialCutsCouple();
+  //  G4int idx = couple->GetIndex();
+  //  const G4Material* mat = couple->GetMaterial();
+  //  G4cout << "Step in " << mat->GetName() << "   idx= " << idx << " edep= " << edep << G4endl;
+  // G4int volumeIndex = -1;
+
+  // G4int copyNo = pv->GetCopyNo();
+  G4String name = lv->GetName();
+  // G4cout<<name<<" "<<aStep->GetStepLength()<<"  ";
+  if(name == "aVolume_L")
+  {
+    //  G4cout<<"l = "<<aStep->GetStepLength()<< G4endl;
+  }
+  // G4cout << "     vIndx= " << volumeIndex << " copyNo= " << copyNo << G4endl;
+  // if(volumeIndex>=0) theHisto->AddEnergy(edep, volumeIndex, copyNo);
+}
+
+//////////////////////////////////////////////////////////////////
+
+
