Fix for coverity:
authorfbellini <fbellini@cern.ch>
Fri, 14 Mar 2014 09:27:20 +0000 (10:27 +0100)
committerfbellini <fbellini@cern.ch>
Mon, 17 Mar 2014 13:45:08 +0000 (14:45 +0100)
- added protection against unsuccessful PropagateToDCA
- fixed some missing variable initialization in constructor

PWGLF/RESONANCES/AliRsnCutTrackQuality.cxx
PWGLF/RESONANCES/AliRsnMiniParticle.cxx
PWGLF/RESONANCES/AliRsnMother.cxx

index 379e22b..8cac06f 100644 (file)
@@ -50,8 +50,10 @@ AliRsnCutTrackQuality::AliRsnCutTrackQuality(const char *name) :
    fTPCminNClusters(0),
    fTPCmaxChi2(1E20),
    fCutMaxChi2TPCConstrainedVsGlobal(1E20),
+   fIsUseCrossedRowsCut(kFALSE),
    fTPCminNCrossedRows(0),
    fTPCminCrossedRowsOverFindableCls(0),
+   fIsUseLengthActiveVolumeTPCCut(kFALSE),
    fCutMinLengthActiveVolumeTPC(0),
    fAODTestFilterBit(-1),
    fCheckOnlyFilterBit(kTRUE),
@@ -86,8 +88,10 @@ AliRsnCutTrackQuality::AliRsnCutTrackQuality(const AliRsnCutTrackQuality &copy)
    fTPCminNClusters(copy.fTPCminNClusters),
    fTPCmaxChi2(copy.fTPCmaxChi2),
    fCutMaxChi2TPCConstrainedVsGlobal(copy.fCutMaxChi2TPCConstrainedVsGlobal),
+   fIsUseCrossedRowsCut(copy.fIsUseCrossedRowsCut),
    fTPCminNCrossedRows(copy.fTPCminNCrossedRows),
    fTPCminCrossedRowsOverFindableCls(copy.fTPCminCrossedRowsOverFindableCls),
+   fIsUseLengthActiveVolumeTPCCut(copy.fIsUseLengthActiveVolumeTPCCut),
    fCutMinLengthActiveVolumeTPC(copy.fCutMinLengthActiveVolumeTPC),
    fAODTestFilterBit(copy.fAODTestFilterBit),
    fCheckOnlyFilterBit(copy.fCheckOnlyFilterBit),
@@ -131,8 +135,10 @@ AliRsnCutTrackQuality &AliRsnCutTrackQuality::operator=(const AliRsnCutTrackQual
    fTPCminNClusters = copy.fTPCminNClusters;
    fTPCmaxChi2 = copy.fTPCmaxChi2;
    fCutMaxChi2TPCConstrainedVsGlobal = copy.fCutMaxChi2TPCConstrainedVsGlobal;
+   fIsUseCrossedRowsCut=copy.fIsUseCrossedRowsCut;
    fTPCminNCrossedRows = copy.fTPCminNCrossedRows;
    fTPCminCrossedRowsOverFindableCls = copy.fTPCminCrossedRowsOverFindableCls;
+   fIsUseLengthActiveVolumeTPCCut=copy.fIsUseLengthActiveVolumeTPCCut;
    fCutMinLengthActiveVolumeTPC = copy.fCutMinLengthActiveVolumeTPC;
    
    fAODTestFilterBit = copy.fAODTestFilterBit;
@@ -170,8 +176,10 @@ void AliRsnCutTrackQuality::DisableAll()
    fTPCmaxChi2 = 1E20;
    fAODTestFilterBit = -1;
    fCutMaxChi2TPCConstrainedVsGlobal = 1E20;
+   fIsUseCrossedRowsCut = 0;
    fTPCminNCrossedRows = 0;
    fTPCminCrossedRowsOverFindableCls = 0;
+   fIsUseLengthActiveVolumeTPCCut = 0;
    fCutMinLengthActiveVolumeTPC = 0.0;
  
    if (fESDtrackCuts) {
index bd119b0..81579c9 100644 (file)
@@ -71,8 +71,8 @@ void AliRsnMiniParticle::CopyDaughter(AliRsnDaughter *daughter)
        Double_t b[2], cov[3]; 
        if (vertex) {
         if ( !((track->GetStatus() & AliESDtrack::kTPCin) == 0) && !((track->GetStatus() & AliESDtrack::kTPCrefit) == 0) && !((track->GetStatus() & AliESDtrack::kITSrefit) == 0) ){
-          track->PropagateToDCA(vertex, aodEvent->GetMagneticField(), kVeryBig, b, cov); 
-          fDCA = b[0];
+          if (track->PropagateToDCA(vertex, aodEvent->GetMagneticField(), kVeryBig, b, cov))
+            fDCA = b[0];
         }
        }
      }
@@ -97,8 +97,8 @@ void AliRsnMiniParticle::CopyDaughter(AliRsnDaughter *daughter)
         Double_t b[2], cov[3]; 
         if (vertex) {
           if ( !((track->GetStatus() & AliESDtrack::kTPCin) == 0) && !((track->GetStatus() & AliESDtrack::kTPCrefit) == 0) && !((track->GetStatus() & AliESDtrack::kITSrefit) == 0) ){
-          track->PropagateToDCA(vertex, esdEvent->GetMagneticField(), kVeryBig, b, cov); 
-          fDCA = b[0];
+            if (track->PropagateToDCA(vertex, esdEvent->GetMagneticField(), kVeryBig, b, cov))
+              fDCA = b[0];
           }
         }
        }
index 9272b75..09e45bc 100644 (file)
@@ -247,24 +247,26 @@ Double_t AliRsnMother::DCAproduct()
     AliAODTrack *track1 = (AliAODTrack*)fDaughter[0]->Ref2AODtrack();
     AliAODTrack *track2 = (AliAODTrack*)fDaughter[1]->Ref2AODtrack();
     AliVVertex *vertex = aodEvent->GetPrimaryVertex();   
-    if (!vertex || !track1 || track2) return 0.0;
+    if (!vertex || !track1 || !track2) return 0.0;
      
     Double_t b1[2], cov1[3], b2[2], cov2[3];
-    track1->PropagateToDCA(vertex, aodEvent->GetMagneticField(), kVeryBig, b1, cov1);    
-    track2->PropagateToDCA(vertex, aodEvent->GetMagneticField(), kVeryBig, b2, cov2);    
-    fDCAproduct = b1[0]*b2[0];  
+    if ( track1->PropagateToDCA(vertex, aodEvent->GetMagneticField(), kVeryBig, b1, cov1) &&   
+        track2->PropagateToDCA(vertex, aodEvent->GetMagneticField(), kVeryBig, b2, cov2) )
+      fDCAproduct = b1[0]*b2[0]; 
+    else fDCAproduct = 0.0;
   } else {
     AliESDEvent *esdEvent = (AliESDEvent*)event1->GetRefESD();  
     if (!esdEvent) return 0.0;
     AliESDtrack *track1 = (AliESDtrack*)fDaughter[0]->Ref2ESDtrack();
     AliESDtrack *track2 = (AliESDtrack*)fDaughter[1]->Ref2ESDtrack();
     const AliVVertex *vertex = esdEvent->GetPrimaryVertex();
-    if (!vertex || !track1 || track2) return 0.0;
+    if (!vertex || !track1 || !track2) return 0.0;
      
     Double_t b1[2], cov1[3], b2[2], cov2[3];
-    track1->PropagateToDCA(vertex, esdEvent->GetMagneticField(), kVeryBig, b1, cov1);    
-    track2->PropagateToDCA(vertex, esdEvent->GetMagneticField(), kVeryBig, b2, cov2);    
-    fDCAproduct = b1[0]*b2[0];  
+    if ( track1->PropagateToDCA(vertex, esdEvent->GetMagneticField(), kVeryBig, b1, cov1) &&    
+        track2->PropagateToDCA(vertex, esdEvent->GetMagneticField(), kVeryBig, b2, cov2) )
+      fDCAproduct = b1[0]*b2[0];  
+    else fDCAproduct = 0.0;  
   }
   return fDCAproduct;
 }