Index: trunk/source/processes/optical/src/G4OpAbsorption.cc
===================================================================
--- trunk/source/processes/optical/src/G4OpAbsorption.cc	(revision 819)
+++ trunk/source/processes/optical/src/G4OpAbsorption.cc	(revision 963)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4OpAbsorption.cc,v 1.7 2006/06/29 21:08:50 gunter Exp $
-// GEANT4 tag $Name:  $
+// $Id: G4OpAbsorption.cc,v 1.9 2008/10/24 19:52:28 gum Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 ////////////////////////////////////////////////////////////////////////
@@ -52,4 +52,6 @@
 
 #include "G4ios.hh"
+#include "G4OpProcessSubType.hh"
+
 #include "G4OpAbsorption.hh"
 
@@ -76,4 +78,6 @@
            G4cout << GetProcessName() << " is created " << G4endl;
         }
+
+        SetProcessSubType(fOpAbsorption);
 }
 
Index: trunk/source/processes/optical/src/G4OpBoundaryProcess.cc
===================================================================
--- trunk/source/processes/optical/src/G4OpBoundaryProcess.cc	(revision 819)
+++ trunk/source/processes/optical/src/G4OpBoundaryProcess.cc	(revision 963)
@@ -67,4 +67,6 @@
 
 #include "G4ios.hh"
+#include "G4OpProcessSubType.hh"
+
 #include "G4OpBoundaryProcess.hh"
 #include "G4GeometryTolerance.hh"
@@ -93,4 +95,6 @@
            G4cout << GetProcessName() << " is created " << G4endl;
         }
+
+        SetProcessSubType(fOpBoundary);
 
 	theStatus = Undefined;
@@ -220,7 +224,9 @@
         OpticalSurface = NULL;
 
-        G4LogicalSurface* Surface = G4LogicalBorderSurface::GetSurface
-				    (pPreStepPoint ->GetPhysicalVolume(),
-				     pPostStepPoint->GetPhysicalVolume());
+        G4LogicalSurface* Surface = NULL;
+
+        Surface = G4LogicalBorderSurface::GetSurface
+	          (pPreStepPoint ->GetPhysicalVolume(),
+	           pPostStepPoint->GetPhysicalVolume());
 
         if (Surface == NULL){
@@ -249,6 +255,6 @@
 	}
 
-	//	if (Surface) OpticalSurface = dynamic_cast <G4OpticalSurface*> (Surface->GetSurfaceProperty());
-	if (Surface) OpticalSurface = (G4OpticalSurface*) Surface->GetSurfaceProperty();
+	if (Surface) OpticalSurface = 
+           dynamic_cast <G4OpticalSurface*> (Surface->GetSurfaceProperty());
 
 	if (OpticalSurface) {
@@ -429,4 +435,10 @@
 
 	  DielectricMetal();
+
+          // Uncomment the following lines if you wish to have 
+          //         Transmission instead of Absorption
+          // if (theStatus == Absorption) {
+          //    return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
+          // }
 
 	}
@@ -579,5 +591,9 @@
            if( !G4BooleanRand(theReflectivity) && n == 1 ) {
 
+             // Comment out DoAbsorption and uncomment theStatus = Absorption;
+             // if you wish to have Transmission instead of Absorption
+
              DoAbsorption();
+             // theStatus = Absorption;
              break;
 
@@ -657,6 +673,6 @@
 	      Through = false;
 	      theGlobalNormal = -theGlobalNormal;
-	      G4Swap(Material1,Material2);
-	      G4Swap(&Rindex1,&Rindex2);
+	      G4SwapPtr(Material1,Material2);
+	      G4SwapObj(&Rindex1,&Rindex2);
 	   }
 
@@ -864,6 +880,6 @@
 	        else {
 		   Swap = !Swap;
-		   G4Swap(Material1,Material2);
-		   G4Swap(&Rindex1,&Rindex2);
+		   G4SwapPtr(Material1,Material2);
+		   G4SwapObj(&Rindex1,&Rindex2);
 	        }
 		if ( theFinish == groundbackpainted )
Index: trunk/source/processes/optical/src/G4OpRayleigh.cc
===================================================================
--- trunk/source/processes/optical/src/G4OpRayleigh.cc	(revision 819)
+++ trunk/source/processes/optical/src/G4OpRayleigh.cc	(revision 963)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4OpRayleigh.cc,v 1.14 2006/06/29 21:08:54 gunter Exp $
-// GEANT4 tag $Name:  $
+// $Id: G4OpRayleigh.cc,v 1.17 2008/10/24 19:51:12 gum Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 // 
@@ -57,4 +57,6 @@
 
 #include "G4ios.hh"
+#include "G4OpProcessSubType.hh"
+
 #include "G4OpRayleigh.hh"
 
@@ -78,4 +80,5 @@
            : G4VDiscreteProcess(processName, type)
 {
+        SetProcessSubType(fOpRayleigh);
 
         thePhysicsTable = 0;
@@ -248,5 +251,5 @@
         const G4Material* aMaterial = aTrack.GetMaterial();
 
-        G4double thePhotonMomentum = aParticle->GetTotalMomentum();
+        G4double thePhotonEnergy = aParticle->GetTotalEnergy();
 
         G4double AttenuationLength = DBL_MAX;
@@ -258,5 +261,5 @@
            AttenuationLength =
                 (*thePhysicsTable)(aMaterial->GetIndex())->
-                           GetValue(thePhotonMomentum, isOutRange);
+                           GetValue(thePhotonEnergy, isOutRange);
         }
         else {
@@ -270,5 +273,5 @@
              if(AttenuationLengthVector){
                AttenuationLength = AttenuationLengthVector ->
-                                    GetProperty(thePhotonMomentum);
+                                    GetProperty(thePhotonEnergy);
              }
              else{
@@ -305,5 +308,5 @@
 
         // Retrieve vectors for refraction index
-        // and photon momentum from the material properties table
+        // and photon energy from the material properties table
 
         G4MaterialPropertyVector* Rindex = aMPT->GetProperty("RINDEX");
@@ -325,5 +328,5 @@
            while (++(*Rindex)) {
 
-                e = (Rindex->GetPhotonMomentum());
+                e = (Rindex->GetPhotonEnergy());
 
                 refraction_index = Rindex->GetProperty();
@@ -332,5 +335,5 @@
 
 	        if (verboseLevel>0) {
-        	        G4cout << Rindex->GetPhotonMomentum() << " MeV\t";
+        	        G4cout << Rindex->GetPhotonEnergy() << " MeV\t";
                 	G4cout << xlambda << " mm\t";
 		}
@@ -347,5 +350,5 @@
 		}
                 RayleighScatteringLengths->
-			InsertValues(Rindex->GetPhotonMomentum(), Dist);
+			InsertValues(Rindex->GetPhotonEnergy(), Dist);
            }
 
Index: trunk/source/processes/optical/src/G4OpWLS.cc
===================================================================
--- trunk/source/processes/optical/src/G4OpWLS.cc	(revision 819)
+++ trunk/source/processes/optical/src/G4OpWLS.cc	(revision 963)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4OpWLS.cc,v 1.9 2007/10/30 03:53:36 gum Exp $
-// GEANT4 tag $Name:  $
+// $Id: G4OpWLS.cc,v 1.13 2008/10/24 19:50:50 gum Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 ////////////////////////////////////////////////////////////////////////
@@ -46,4 +46,6 @@
 
 #include "G4ios.hh"
+#include "G4OpProcessSubType.hh"
+
 #include "G4OpWLS.hh"
 #include "G4WLSTimeGeneratorProfileDelta.hh"
@@ -61,4 +63,6 @@
   : G4VDiscreteProcess(processName, type)
 {
+  SetProcessSubType(fOpWLS);
+
   theIntegralTable = 0;
  
@@ -161,12 +165,12 @@
   for (G4int i = 0; i < NumPhotons; i++) {
     
-    // Determine photon momentum
+    // Determine photon energy
     
     G4double CIIvalue = G4UniformRand()*CIImax;
-    G4double sampledMomentum = 
+    G4double sampledEnergy = 
       WLSIntegral->GetEnergy(CIIvalue);
     
     if (verboseLevel>1) {
-      G4cout << "sampledMomentum = " << sampledMomentum << G4endl;
+      G4cout << "sampledEnergy = " << sampledEnergy << G4endl;
       G4cout << "CIIvalue =        " << CIIvalue << G4endl;
     }
@@ -217,5 +221,5 @@
        photonPolarization.z());
     
-    aWLSPhoton->SetKineticEnergy(sampledMomentum);
+    aWLSPhoton->SetKineticEnergy(sampledEnergy);
     
     // Generate new G4Track object:
@@ -230,6 +234,7 @@
     G4Track* aSecondaryTrack = 
       new G4Track(aWLSPhoton,aSecondaryTime,aSecondaryPosition);
-    
-    aSecondaryTrack->SetTouchableHandle((G4VTouchable*)0);
+   
+    aSecondaryTrack->SetTouchableHandle(aTrack.GetTouchableHandle()); 
+    // aSecondaryTrack->SetTouchableHandle((G4VTouchable*)0);
     
     aSecondaryTrack->SetParentID(aTrack.GetTrackID());
@@ -285,5 +290,5 @@
 	  
 	  // Retrieve the first intensity point in vector
-	  // of (photon momentum, intensity) pairs
+	  // of (photon energy, intensity) pairs
 	  
 	  theWLSVector->ResetIterator();
@@ -295,8 +300,8 @@
 	  if (currentIN >= 0.0) {
 
-	    // Create first (photon momentum) 
+	    // Create first (photon energy) 
 	   
 	    G4double currentPM = theWLSVector->
-	      GetPhotonMomentum();
+	      GetPhotonEnergy();
 	    
 	    G4double currentCII = 0.0;
@@ -311,5 +316,5 @@
 	    G4double prevIN  = currentIN;
 	    
-	    // loop over all (photon momentum, intensity)
+	    // loop over all (photon energy, intensity)
 	    // pairs stored for this material
 	    
@@ -317,5 +322,5 @@
 	      {
 		currentPM = theWLSVector->
-		  GetPhotonMomentum();
+		  GetPhotonEnergy();
 		
 		currentIN=theWLSVector->
@@ -355,5 +360,5 @@
   const G4Material* aMaterial = aTrack.GetMaterial();
 
-  G4double thePhotonMomentum = aParticle->GetTotalMomentum();
+  G4double thePhotonEnergy = aParticle->GetTotalEnergy();
 
   G4MaterialPropertiesTable* aMaterialPropertyTable;
@@ -369,5 +374,5 @@
     if ( AttenuationLengthVector ){
       AttenuationLength = AttenuationLengthVector->
-	GetProperty (thePhotonMomentum);
+	GetProperty (thePhotonEnergy);
     }
     else {
