Add protection against division by zero in AliMUONVTrackReconstruct::TriggerToTrack
authorbogdan <bogdan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 8 Nov 2012 15:49:27 +0000 (15:49 +0000)
committerbogdan <bogdan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 8 Nov 2012 15:49:27 +0000 (15:49 +0000)
MUON/AliMUONRecoCheck.cxx
MUON/AliMUONRecoCheck.h
MUON/AliMUONVTrackReconstructor.cxx
MUON/AliMUONVTrackReconstructor.h

index 4478a79..07102ab 100644 (file)
@@ -408,12 +408,12 @@ void AliMUONRecoCheck::MakeTriggeredTracks()
 }
 
 //_____________________________________________________________________________
-void AliMUONRecoCheck::TriggerToTrack(const AliMUONLocalTrigger& locTrg, AliMUONTriggerTrack& triggerTrack)
+Bool_t AliMUONRecoCheck::TriggerToTrack(const AliMUONLocalTrigger& locTrg, AliMUONTriggerTrack& triggerTrack)
 {
   /// Make trigger track from local trigger info
-  if ( ! InitCircuit() ) return;
+  if ( ! InitCircuit() ) return kFALSE;
   AliMUONVTrackReconstructor* tracker = AliMUONESDInterface::GetTracker();
-  tracker->TriggerToTrack(*fTriggerCircuit, locTrg, triggerTrack);
+  return tracker->TriggerToTrack(*fTriggerCircuit, locTrg, triggerTrack);
 }
 
 
index a264003..381e4c8 100644 (file)
@@ -41,7 +41,7 @@ public:
   /// Return the list of reconstructed trigger tracks
   AliMUONVTriggerTrackStore* TriggeredTracks(Int_t event);
 
-  void TriggerToTrack(const AliMUONLocalTrigger& locTrg, AliMUONTriggerTrack& triggerTrack);
+  Bool_t TriggerToTrack(const AliMUONLocalTrigger& locTrg, AliMUONTriggerTrack& triggerTrack);
        
   /// Return reference muon tracks
   AliMUONVTrackStore* TrackRefs(Int_t event);
index c4aa0e5..fc4f0a0 100644 (file)
@@ -1297,15 +1297,15 @@ void AliMUONVTrackReconstructor::EventReconstructTrigger(const AliMUONTriggerCir
     if ( locTrg->IsTrigX() && locTrg->IsTrigY() ) 
     { // make Trigger Track if trigger in X and Y
       
-      TriggerToTrack(circuit, *locTrg, triggerTrack, gloTrigPat);
+      if (TriggerToTrack(circuit, *locTrg, triggerTrack, gloTrigPat))
+       triggerTrackStore.Add(triggerTrack);
 
-      triggerTrackStore.Add(triggerTrack);
     } // board is fired 
   } // end of loop on Local Trigger
 }
 
 //__________________________________________________________________________
-void AliMUONVTrackReconstructor::TriggerToTrack(const AliMUONTriggerCircuit& circuit,
+Bool_t AliMUONVTrackReconstructor::TriggerToTrack(const AliMUONTriggerCircuit& circuit,
                                                 const AliMUONLocalTrigger& locTrg,
                                                 AliMUONTriggerTrack& triggerTrack,
                                                 UChar_t globalTriggerPattern)
@@ -1332,6 +1332,8 @@ void AliMUONVTrackReconstructor::TriggerToTrack(const AliMUONTriggerCircuit& cir
   AliDebug(1, Form(" MakeTriggerTrack %3d %2d %2d %2d (%f %f %f) (%f %f)\n",locTrg.LoCircuit(),
                    locTrg.LoStripX(),locTrg.LoStripX()+deviation+1,locTrg.LoStripY(),x11, y11, z11, y21, z21));
       
+  if (TMath::Abs(z11) < 0.00001) return kFALSE;
+
   Double_t deltaZ = z11 - z21;
       
   Float_t slopeX = x11/z11;
@@ -1358,4 +1360,7 @@ void AliMUONVTrackReconstructor::TriggerToTrack(const AliMUONTriggerCircuit& cir
   triggerTrack.SetLoTrgNum(localBoardId);
   triggerTrack.SetCovariances(trigCov);
   triggerTrack.SetUniqueID(locTrg.GetUniqueID());
+
+  return kTRUE;
+
 }
index be29209..edc042f 100644 (file)
@@ -55,10 +55,10 @@ class AliMUONVTrackReconstructor : public TObject {
   /// Re-fit the given track
   virtual Bool_t RefitTrack(AliMUONTrack &track, Bool_t enableImprovement = kTRUE) = 0;
   
-  void TriggerToTrack(const AliMUONTriggerCircuit& circuit,
-                      const AliMUONLocalTrigger& locTrg,
-                      AliMUONTriggerTrack& triggerTrack,
-                      UChar_t globalTriggerPattern = 0);
+  Bool_t TriggerToTrack(const AliMUONTriggerCircuit& circuit,
+                       const AliMUONLocalTrigger& locTrg,
+                       AliMUONTriggerTrack& triggerTrack,
+                       UChar_t globalTriggerPattern = 0);