Print

Print


Commit in slic/src on MAIN
LCOpticalPhysics.cc+12-111.1 -> 1.2
JM: fix optical for Geant4 9.1 release

slic/src
LCOpticalPhysics.cc 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- LCOpticalPhysics.cc	3 Jul 2007 18:01:30 -0000	1.1
+++ LCOpticalPhysics.cc	15 Dec 2007 01:32:16 -0000	1.2
@@ -76,24 +76,25 @@
     G4ParticleDefinition* particle = theParticleIterator->value();
     G4ProcessManager* pmanager     = particle->GetProcessManager();
     G4String particleName          = particle->GetParticleName();
-    if (theCerenkovProcess->IsApplicable(*particle)) {
-      //#ifdef debug
-      //G4cout << "applicable to Cerenkov" << G4endl;
-      //#endif
-      pmanager->AddContinuousProcess(theCerenkovProcess);
+    if (theCerenkovProcess->IsApplicable(*particle)) 
+    {        
+        //G4cout << "G4 major: " << GEANT4_MAJOR_VERSION << G4endl;
+        //G4cout << "G4 minor: " << GEANT4_MINOR_VERSION << G4endl;
+
+#if (GEANT4_MAJOR >= 9 && GEANT4_MINOR >= 1)
+        // Changed to a post-step process in G4 9.1.
+        pmanager->AddProcess(theCerenkovProcess);
+        pmanager->SetProcessOrdering(theCerenkovProcess,pmanager->GetProcessListLength()-1);
+#else
+        pmanager->AddContinuousProcess(theCerenkovProcess);
+#endif             
     }
     if (theScintillationProcess->IsApplicable(*particle)) {
-      //#ifdef debug
-      //G4cout << "applicable to Scintillator" << G4endl;
-      //#endif
       pmanager->AddProcess(theScintillationProcess);
       pmanager->SetProcessOrderingToLast(theScintillationProcess, idxAtRest);
       pmanager->SetProcessOrderingToLast(theScintillationProcess, idxPostStep);
     }
     if (particleName == "opticalphoton") {
-      //#ifdef debug
-      //G4cout << " AddDiscreteProcess to OpticalPhoton " << G4endl;
-      //#endif
       pmanager->AddDiscreteProcess(theAbsorptionProcess);
       pmanager->AddDiscreteProcess(theRayleighScatteringProcess);
       pmanager->AddDiscreteProcess(theBoundaryProcess);
CVSspam 0.2.8