]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Coverity fixes (Chiara, Diego, Ivana)
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 4 Mar 2011 16:05:03 +0000 (16:05 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 4 Mar 2011 16:05:03 +0000 (16:05 +0000)
PWG3/muon/AliAnalysisTaskSingleMu.cxx
PWG3/muondep/AliCheckMuonDetEltResponse.cxx
PWG3/vertexingHF/AliCFTaskVertexingHF.cxx
PWG3/vertexingHF/AliCFVertexingHF.cxx
PWG3/vertexingHF/AliCFVertexingHF.h

index 67132ae6dc3647cef7051cc173710ead8052856f..d43f442949275abe2f7a16eb83653c4be208de9e 100644 (file)
@@ -138,8 +138,11 @@ AliAnalysisTaskSingleMu::~AliAnalysisTaskSingleMu()
 
   delete fTriggerClasses;
   // For proof: do not delete output containers
-  if ( ! AliAnalysisManager::GetAnalysisManager()->IsProofMode() ) {
-    delete fCFManager->GetParticleContainer();  // The container is not deleted by framework
+  if ( ! AliAnalysisManager::GetAnalysisManager() || ! AliAnalysisManager::GetAnalysisManager()->IsProofMode() ) {
+    // In terminate mode fCFManager does not exist!
+    // So, check before deleting
+    if ( fCFManager )
+      delete fCFManager->GetParticleContainer();  // The container is not deleted by framework
     delete fCFManager;
     delete fHistoList;
     delete fHistoListMC;
@@ -208,7 +211,7 @@ void AliAnalysisTaskSingleMu::FinishTaskOutput()
       TH2* hStat = dynamic_cast<TH2*>(inputHandler->GetStatistics(statType.Data()));
       if ( hStat ) {
         histoName = Form("%s_SingleMuon", hStat->GetName());
-        TH2* cloneStat = dynamic_cast<TH2*>(hStat->Clone(histoName.Data()));
+        TH2* cloneStat = static_cast<TH2*>(hStat->Clone(histoName.Data()));
         cloneStat->SetDirectory(0);
         fHistoList->Add(cloneStat);
       }
index 247bfed289bd327581d4adfc038874d510e52d18..709b925d602c4310ee4a2d83cc6bb7c48545cf07 100644 (file)
@@ -78,11 +78,8 @@ AliCheckMuonDetEltResponse::AliCheckMuonDetEltResponse()
 
     fNbrUsableTracks = 0;
 
-    for (Int_t iCluster = 0; iCluster<fgkNCh; ++iCluster)
-      fNbrClustersCh[iCluster] = 0;
-
-    for (Int_t i=0; i<fgkNCh; ++i)
-      fTrackFilter[i] = 0;
+    memset(fNbrClustersCh,0, fgkNCh*sizeof(Int_t));
+    memset(fTrackFilter,  0, fgkNCh*sizeof(Int_t));
 }
 
 //_____________________________________________________________________________
index 9c172aee09b92b244fd2162317e93d9d3dd36764..60f6c050cba982c019c4fc2ccbff73c0171fb9e5 100644 (file)
@@ -469,7 +469,12 @@ void AliCFTaskVertexingHF::UserExec(Option_t *)
        cfVtxHF->SetNVar(fNvar);
 
        if (fCentralitySelection)
-         if(fCuts->IsEventSelectedInCentrality(aodEvent)!=0) return;  
+         if(fCuts->IsEventSelectedInCentrality(aodEvent)!=0) {
+           delete[] containerInput;
+           delete[] containerInputMC;
+            delete [] trackCuts;
+            return;
+          }    
        
        Float_t centValue = fCuts->GetCentrality(aodEvent);
        cfVtxHF->SetCentralityValue(centValue);  
index ba1a2efca557c2a31bbc3b6e5472c8d303ab6acf..784dd4631e6308fb76ba7230597f31d33ab14ac2 100644 (file)
@@ -13,6 +13,8 @@
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
+// $Id$
+
 //-----------------------------------------------------------------------
 // Class for HF corrections as a function of many variables and step 
 // Author : C. Zampolli, CERN
@@ -143,6 +145,8 @@ AliCFVertexingHF& AliCFVertexingHF::operator=(const AliCFVertexingHF& c)
                fCentValue=c.fCentValue;
                if (fProngs > 0){
                        fLabelArray = new Int_t[fProngs];
+                        fPtAccCut = new Float_t[fProngs];
+                        fEtaAccCut = new Float_t[fProngs];
                        for(Int_t iP=0; iP<fProngs; iP++){
                                fLabelArray[iP]=c.fLabelArray[iP];
                                fPtAccCut[iP]=c.fPtAccCut[iP];
@@ -180,6 +184,8 @@ AliCFVertexingHF::AliCFVertexingHF(const AliCFVertexingHF &c) :
        //
        if (fProngs > 0){
                fLabelArray = new Int_t[fProngs];
+                fPtAccCut = new Float_t[fProngs];
+                fEtaAccCut = new Float_t[fProngs];
                if (c.fLabelArray) memcpy(fLabelArray,c.fLabelArray,fProngs*sizeof(Int_t));
                if (c.fPtAccCut) memcpy(fPtAccCut,c.fPtAccCut,fProngs*sizeof(Int_t));
                if (c.fEtaAccCut) memcpy(fEtaAccCut,c.fEtaAccCut,fProngs*sizeof(Int_t));
@@ -743,6 +749,12 @@ Bool_t AliCFVertexingHF::SetLabelArray()
                for(Int_t iDau=0; iDau<fProngs-1; iDau++){
                        Int_t iLabelDau = labelFirstDau+iDau;
                        AliAODMCParticle* part = dynamic_cast<AliAODMCParticle*>(fmcArray->At(iLabelDau));
+                        if ( ! part ) {
+                          AliError("Wrong particle type in fmcArray");
+                         delete [] fLabelArray; 
+                         fLabelArray = 0x0; 
+                          return bLabelArray;
+                        }  
                        Int_t pdgCode=TMath::Abs(part->GetPdgCode());
                        if(pdgCode==211 || pdgCode==321 || pdgCode==2212){
                                if (part) {
index 92eb0955b3287dd64d61a07ddb0c7de88003881f..844bd0b8e8d6f1f320508bb537bad25dd8e353f0 100644 (file)
@@ -93,7 +93,7 @@ class AliCFVertexingHF : public TObject {
        Bool_t FillUnfoldingMatrix(Double_t fill[4]) const;
        
        void SetNProngs(Int_t nProngs){fProngs = nProngs;}
-       const Int_t GetNProngs() const {return fProngs;}
+       Int_t GetNProngs() const {return fProngs;}
        void SetDselection(UShort_t originDselection); 
        UShort_t GetDselection() {return fOriginDselection;}; 
        Int_t CheckReflexion(Char_t isSign);