]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
applying kinetic energy cut limited to charged particles (to avoid break in case...
authorivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 8 Aug 2001 10:07:41 +0000 (10:07 +0000)
committerivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 8 Aug 2001 10:07:41 +0000 (10:07 +0000)
TGeant4/TG4SpecialCuts.cxx

index ca26588683ea3df1ce5692d6aafe453234db0679..19464547ab683c8a2d7725fae793d51daf94bf0a 100644 (file)
@@ -110,31 +110,34 @@ G4double TG4SpecialCuts::PostStepGetPhysicalInteractionLength(
 
     // min remaining range
     G4ParticleDefinition* particle = track.GetDefinition();
-    G4double kinEnergy = track.GetKineticEnergy();
-    G4Material* material = track.GetMaterial();
-    G4double rangeNow 
-      = G4EnergyLossTables::GetRange(particle, kinEnergy, material);
-    temp = (rangeNow - limits->GetUserMinRange(track));
-    if (temp < 0.) return 0.;
-    if (proposedStep > temp) proposedStep = temp;
-
-    // min kinetic energy (from limits)
-    // the kin energy cut can be applied only in case
-    // G4EnergyLossTables are defined for the particle
-    if (G4EnergyLossTables::GetDEDXTable(particle)) {
-      TG4Limits* tg4Limits = dynamic_cast<TG4Limits*>(limits);
-      if (!tg4Limits) {
-        G4String text = "TG4SpecialCuts::PostStepGetPhysicalInteractionLength:\n";
-        text = text + "    Unknown limits type.";
-        TG4Globals::Exception(text);
-      }  
-      G4double minEkine 
-        = (tg4Limits->*fPtrMinEkineInLimits)(track);
-      G4double minR 
-        = G4EnergyLossTables::GetRange(particle, minEkine, material);
-      temp = rangeNow - minR;
+    if (particle->GetPDGCharge() != 0.) {
+      G4double kinEnergy = track.GetKineticEnergy();
+      G4Material* material = track.GetMaterial();
+      G4double rangeNow 
+        = G4EnergyLossTables::GetRange(particle, kinEnergy, material);
+      temp = (rangeNow - limits->GetUserMinRange(track));
       if (temp < 0.) return 0.;
-      if (proposedStep > temp) proposedStep = temp;  
+      if (proposedStep > temp) proposedStep = temp;
+
+      // min kinetic energy (from limits)
+      // the kin energy cut can be applied only in case
+      // G4EnergyLossTables are defined for the particle
+      if (G4EnergyLossTables::GetDEDXTable(particle)) {
+        TG4Limits* tg4Limits = dynamic_cast<TG4Limits*>(limits);
+        if (!tg4Limits) {
+          G4String text = "TG4SpecialCuts::PostStepGetPhysicalInteractionLength:\n";
+          text = text + "    Unknown limits type.";
+          TG4Globals::Exception(text);
+        }  
+       G4double minEkine 
+          = (tg4Limits->*fPtrMinEkineInLimits)(track);
+       G4EnergyLossTables::GetTables(particle);
+       G4double minR 
+          = G4EnergyLossTables::GetRange(particle, minEkine, material);
+        temp = rangeNow - minR;
+        if (temp < 0.) return 0.;
+        if (proposedStep > temp) proposedStep = temp;  
+      }
     }  
 
   }