fixing some minor coverty reports
authorkleinb <kleinb@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 2 Sep 2010 13:37:59 +0000 (13:37 +0000)
committerkleinb <kleinb@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 2 Sep 2010 13:37:59 +0000 (13:37 +0000)
JETAN/AliAnalysisTaskJetCluster.cxx
JETAN/AliAnalysisTaskJets.cxx
JETAN/AliJetAODReader.cxx
JETAN/AliJetBkg.cxx
JETAN/AliJetESDReader.cxx
JETAN/AliUA1JetFinderV1.cxx

index af7f148..bfdcd39 100644 (file)
@@ -668,9 +668,8 @@ void AliAnalysisTaskJetCluster::UserExec(Option_t */*option*/)
     
     // correlation of leading jet with tracks
     TIterator *recIter = recParticles.MakeIterator();
-    AliVParticle *tmpRecTrack = (AliVParticle*)(recIter->Next());  
-    
     recIter->Reset();
+    AliVParticle *tmpRecTrack = 0;
     while((tmpRecTrack = (AliVParticle*)(recIter->Next()))){
       Float_t tmpPt = tmpRecTrack->Pt();
       // correlation
@@ -679,7 +678,6 @@ void AliAnalysisTaskJetCluster::UserExec(Option_t */*option*/)
       Float_t dPhi = phi - tmpPhi;
       if(dPhi>TMath::Pi())dPhi = dPhi - 2.*TMath::Pi();
       if(dPhi<(-1.*TMath::Pi()))dPhi = dPhi + 2.*TMath::Pi();      
-      //      Float_t dEta = eta - tmpRecTrack->Eta();
       fh2TracksLeadingJetPhiPt->Fill(dPhi,pt);
       fh2TracksLeadingJetPhiPtW->Fill(dPhi,pt,tmpPt);
     }  
@@ -848,7 +846,6 @@ void AliAnalysisTaskJetCluster::UserExec(Option_t */*option*/)
        Float_t dPhi = phi - tmpPhi;
        if(dPhi>TMath::Pi())dPhi = dPhi - 2.*TMath::Pi();
        if(dPhi<(-1.*TMath::Pi()))dPhi = dPhi + 2.*TMath::Pi();      
-       //      Float_t dEta = eta - tmpRecTrack->Eta();
        fh2TracksLeadingJetPhiPtRan->Fill(dPhi,pt);
        fh2TracksLeadingJetPhiPtWRan->Fill(dPhi,pt,tmpPt);
       }  
@@ -938,7 +935,7 @@ Int_t  AliAnalysisTaskJetCluster::GetListOfTracks(TList *list,Int_t type){
     TClonesArray *tca = dynamic_cast<TClonesArray*>(aod->FindListObject(AliAODMCParticle::StdBranchName()));
     if(!tca)return iCount;
     for(int it = 0;it < tca->GetEntriesFast();++it){
-      AliAODMCParticle *part = dynamic_cast<AliAODMCParticle*>(tca->At(it));
+      AliAODMCParticle *part = (AliAODMCParticle*)(tca->At(it));
       if(!part->IsPhysicalPrimary())continue;
       if(type == kTrackAODMCAll){
        list->Add(part);
index 6620276..664acd4 100644 (file)
@@ -137,20 +137,23 @@ void AliAnalysisTaskJets::UserCreateOutputObjects()
        // case that we have an AOD extension we need to fetch the jets from the extended output
        // we identifay the extension aod event by looking for the branchname
        AliAODHandler *aodH = dynamic_cast<AliAODHandler*>(AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler());
-       TObjArray* extArray = aodH->GetExtensions();
-       if (extArray) {
-         TIter next(extArray);
-         while ((fAODExtension=(AliAODExtension*)next())){
-           TObject *obj = fAODExtension->GetAOD()->FindListObject(fNonStdBranch.Data());
-           if(fDebug>10){
-             Printf("%s:%d Dumping..",(char*)__FILE__,__LINE__);
-             fAODExtension->GetAOD()->Dump();
-           }
-           if(obj){
+       fAODExtension = 0;
+       if(aodH){
+         TObjArray* extArray = aodH->GetExtensions();
+         if (extArray) {
+           TIter next(extArray);
+           while ((fAODExtension=(AliAODExtension*)next())){
+             TObject *obj = fAODExtension->GetAOD()->FindListObject(fNonStdBranch.Data());
+             if(fDebug>10){
+               Printf("%s:%d Dumping..",(char*)__FILE__,__LINE__);
+               fAODExtension->GetAOD()->Dump();
+             }
+             if(obj){
              if(fDebug>1)Printf("AODExtension found for %s",fNonStdBranch.Data());
              break;
+             }
+             fAODExtension = 0;
            }
-           fAODExtension = 0;
          }
        }
        if(fAODExtension)fJetFinder->ConnectAODNonStd(fAODExtension->GetAOD(), fNonStdBranch.Data()); 
index 597cf7d..21256b4 100644 (file)
@@ -119,9 +119,7 @@ void AliJetAODReader::OpenInputFiles()
        if (a>=naod) continue;
        
        if (strstr(name,pattern)){
-          char path[256];
-          sprintf(path,"%s/%s/aod.root",dirName,name);
-          fChain->AddFile(path);
+          fChain->AddFile(Form("%s/%s/aod.root",dirName,name));
           a++;
        }
    }
index 3ca4147..69185cb 100644 (file)
@@ -397,7 +397,7 @@ Float_t AliJetBkg::BkgFastJetCone(TClonesArray* fAODJets)
   Float_t rCone=0.4;
   
   if(nJ==1) { 
-    AliAODJet *jettmp = dynamic_cast<AliAODJet*>(fAODJets->At(0));
+    AliAODJet *jettmp = (AliAODJet*)(fAODJets->At(0));
     jeteta=jettmp->Eta();
     jetphi=jettmp->Phi();
     acc=EmcalAcceptance(jeteta,jetphi,rCone);
@@ -407,8 +407,8 @@ Float_t AliJetBkg::BkgFastJetCone(TClonesArray* fAODJets)
 
   
   if(nJ>=2) { 
-    AliAODJet *jettmp = dynamic_cast<AliAODJet*>(fAODJets->At(0));
-    AliAODJet *jettmp1 = dynamic_cast<AliAODJet*>(fAODJets->At(1));
+    AliAODJet *jettmp = (AliAODJet*)(fAODJets->At(0));
+    AliAODJet *jettmp1 = (AliAODJet*)(fAODJets->At(1));
     jeteta=jettmp->Eta();
     jetphi=jettmp->Phi();
     jeteta1=jettmp1->Eta();
index d60df72..5477303 100755 (executable)
@@ -122,9 +122,7 @@ void AliJetESDReader::OpenInputFiles()
        
        if (strstr(name,pattern)){
         printf("Adding %s\n",name);
-        char path[256];
-        sprintf(path,"%s/%s/AliESDs.root",dirName,name);
-        fChain->AddFile(path);
+        fChain->AddFile(Form("%s/%s/AliESDs.root",dirName,name));
         a++;
        }
    }
index a2105f4..d573579 100644 (file)
@@ -97,7 +97,7 @@ void AliUA1JetFinderV1::FindJets()
   AliUA1JetHeaderV1* header = (AliUA1JetHeaderV1*) fHeader;
   TClonesArray *lvArray = fReader->GetMomentumArray();
   Int_t nIn =  lvArray->GetEntries();
-  if (nIn == 0) return;
+  if (nIn <= 0) return;
 
   // local arrays for input
   // ToDo: check memory fragmentation, maybe better to 
@@ -108,6 +108,9 @@ void AliUA1JetFinderV1::FindJets()
   Float_t* phiT  = new Float_t[nIn];
   Int_t*   injet = new Int_t[nIn];
 
+  memset(ptT,0,sizeof(Float_t)*nIn);
+  memset(etaT,0,sizeof(Float_t)*nIn);
+  memset(phiT,0,sizeof(Float_t)*nIn);
 
 
   // load input vectors and calculate total energy in array