CID 21213: Other violation (DIVIDE_BY_ZERO)
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 29 May 2013 14:59:10 +0000 (14:59 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 29 May 2013 14:59:10 +0000 (14:59 +0000)
PYTHIA8/pythia8175/src/HelicityMatrixElements.cxx

index 8488efc..d226de7 100644 (file)
@@ -713,8 +713,10 @@ void HMEUnpolarized::calculateRho(unsigned int idx,
 
   for (int i = 0; i < p[idx].spinStates(); i++ ) {
     for (int j = 1; j < p[idx].spinStates(); j++) {
-       if (i == j) p[idx].rho[i][j] = 1.0 / 
-                     static_cast<double>(p[idx].spinStates());
+      if ((i == j) && static_cast<double>(p[idx].spinStates()) != 0.) {
+       p[idx].rho[i][j] = 1.0 / 
+         static_cast<double>(p[idx].spinStates());
+      }
        else p[idx].rho[i][j] = 0;
     }
   }