Getting rid of a potencial floating-point exception by adding some extra checking...
authorszostak <szostak@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 20 Sep 2007 13:01:01 +0000 (13:01 +0000)
committerszostak <szostak@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 20 Sep 2007 13:01:01 +0000 (13:01 +0000)
HLT/MUON/OnlineAnalysis/AliHLTMUONCalculations.cxx
HLT/MUON/OnlineAnalysis/AliHLTMUONMansoTrackerFSMComponent.cxx

index 36e7f7d..40c7ef0 100644 (file)
@@ -72,7 +72,11 @@ bool AliHLTMUONCalculations::ComputeMomentum(
        
        fgPx = AliHLTFloat32_t( pDivZf * xf );
        fgPy = AliHLTFloat32_t( pDivZf * yf );
-       fgPz = AliHLTFloat32_t( sqrt(p*p - fgPx*fgPx - fgPy*fgPy) );
+       AliHLTFloat64_t k = p*p - fgPx*fgPx - fgPy*fgPy;
+       if (k > 0)
+               fgPz = AliHLTFloat32_t( sqrt(k) );
+       else
+               fgPz = 0;
        // fgPz must be the same sign as fgZf else it could not have been measured.
        if (fgZf < 0) fgPz = -fgPz;
 
index 151c7c4..945ea17 100644 (file)
@@ -167,7 +167,16 @@ int AliHLTMUONMansoTrackerFSMComponent::DoEvent(
                                continue;
                        }
                        
-                       AddRecHits(blocks[n].fSpecification, inblock.GetArray(), inblock.Nentries());
+                       if (inblock.Nentries() != 0)
+                               AddRecHits(blocks[n].fSpecification, inblock.GetArray(), inblock.Nentries());
+                       else
+                       {
+                               Logging(kHLTLogWarning,
+                                       "AliHLTMUONMansoTrackerFSMComponent::DoEvent",
+                                       "Block empty",
+                                       "Received a reconstructed hits data block which contains no entries."
+                               );
+                       }
                }
                else if (blocks[n].fDataType != AliHLTMUONConstants::TriggerRecordsBlockDataType())
                {