]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
correct minor coverity reports
authorgconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 15 Oct 2010 14:44:57 +0000 (14:44 +0000)
committergconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 15 Oct 2010 14:44:57 +0000 (14:44 +0000)
PWG4/PartCorrDep/AliAnaBtag.cxx
PWG4/PartCorrDep/AliAnaParticleJetLeadingConeCorrelation.cxx
PWG4/PartCorrDep/AliAnaShowerParameter.cxx

index f03924726c7f7909949338b53e1cd012846b5260..af64c2b337e095ad3ae5d724cd713fae4e939ea1 100644 (file)
@@ -424,46 +424,49 @@ void  AliAnaBtag::MakeAnalysisFillAOD()
 \r
 \r
        /////////////////////////MC stuff////////////////////////////////////////////////\r
+  Int_t pdg = 0;\r
        if(IsDataMC()){\r
          stack=GetMCStack();\r
-         if(!stack) printf("AliAnaBtag::MakeAnalysisFillHistograms() - Crap, no stack: \n");\r
-\r
-         //Is it really an electron?\r
-         TParticle *partX = stack->Particle(TMath::Abs(track->GetLabel()));\r
-         int pdg = 0;\r
-         pdg = partX->GetPdgCode();\r
-         fhSpecies->Fill(TMath::Abs(pdg));\r
-         if(TMath::Abs(pdg)==11){ //Check MC electrons\r
-           if(emcEle)\r
-             fhEmcalMCE->Fill(track->Pt());\r
-           if(trkEle)\r
-             fhTRDMCE->Fill(track->Pt());\r
-           if(tpcEle)\r
-             fhTPCMCE->Fill(track->Pt());\r
-         }else{ //Fake histos!\r
-           if(emcEle)\r
-             fhEmcalMCEFake->Fill(track->Pt());\r
-           if(trkEle)\r
-             fhTRDMCEFake->Fill(track->Pt());\r
-           if(tpcEle)\r
-             fhTPCMCEFake->Fill(track->Pt());\r
-         }\r
-         if(TMath::Abs(pdg)==211){ //Check MC pions\r
-           if(emcEle)\r
-             fhEmcalMCP->Fill(track->Pt());\r
-           if(trkEle)\r
-             fhTRDMCP->Fill(track->Pt());\r
-           if(tpcEle)\r
-             fhTPCMCP->Fill(track->Pt());\r
-         }\r
-         if(TMath::Abs(pdg)==321){ //Check MC Kaons\r
-           if(emcEle)\r
-             fhEmcalMCK->Fill(track->Pt());\r
-           if(trkEle)\r
-             fhTRDMCK->Fill(track->Pt());\r
-           if(tpcEle)\r
-             fhTPCMCK->Fill(track->Pt());\r
-         }\r
+         if(!stack) {printf("AliAnaBtag::MakeAnalysisFillHistograms() - Crap, no stack: \n");\r
+    }\r
+    else{\r
+      //Is it really an electron?\r
+      TParticle *partX = stack->Particle(TMath::Abs(track->GetLabel()));\r
+      pdg = partX->GetPdgCode();\r
+      fhSpecies->Fill(TMath::Abs(pdg));\r
+      if(TMath::Abs(pdg)==11){ //Check MC electrons\r
+        if(emcEle)\r
+          fhEmcalMCE->Fill(track->Pt());\r
+        if(trkEle)\r
+          fhTRDMCE->Fill(track->Pt());\r
+        if(tpcEle)\r
+          fhTPCMCE->Fill(track->Pt());\r
+      }else{ //Fake histos!\r
+        if(emcEle)\r
+          fhEmcalMCEFake->Fill(track->Pt());\r
+        if(trkEle)\r
+          fhTRDMCEFake->Fill(track->Pt());\r
+        if(tpcEle)\r
+          fhTPCMCEFake->Fill(track->Pt());\r
+      }\r
+      if(TMath::Abs(pdg)==211){ //Check MC pions\r
+        if(emcEle)\r
+          fhEmcalMCP->Fill(track->Pt());\r
+        if(trkEle)\r
+          fhTRDMCP->Fill(track->Pt());\r
+        if(tpcEle)\r
+          fhTPCMCP->Fill(track->Pt());\r
+      }\r
+      if(TMath::Abs(pdg)==321){ //Check MC Kaons\r
+        if(emcEle)\r
+          fhEmcalMCK->Fill(track->Pt());\r
+        if(trkEle)\r
+          fhTRDMCK->Fill(track->Pt());\r
+        if(tpcEle)\r
+          fhTPCMCK->Fill(track->Pt());\r
+      }\r
+    }\r
+    \r
          //Take care of where it came from (parent bit)\r
          tr.SetTag(GetMCAnalysisUtils()->CheckOrigin(tr.GetLabel(),GetReader(),tr.GetInputFileIndex())); //Gets a tag bit which contains info about super grandfather particle. Use (tag&(1<<11)), 11 for direct b, and 9 for B->C\r
 \r
@@ -873,28 +876,25 @@ Bool_t AliAnaBtag::CheckIfBjet(const AliAODTrack* track)
 AliAODMCParticle* AliAnaBtag::GetMCParticle(Int_t ipart) \r
 {\r
   //Get the MC particle at position ipart\r
-\r
+  \r
   AliAODMCParticle* aodprimary = 0x0;\r
   TClonesArray * mcparticles0 = 0x0;\r
-  TClonesArray * mcparticles1 = 0x0;\r
-\r
+  \r
   if(GetReader()->ReadAODMCParticles()){\r
     //Get the list of MC particles                                                                                                                           \r
     mcparticles0 = GetReader()->GetAODMCParticles(0);\r
     if(!mcparticles0 && GetDebug() > 0) {\r
       printf("AliAnaBtag::MakeAnalysisFillHistograms() -  Standard MCParticles not available!\n");\r
     }\r
-\r
-    Int_t npart0 = mcparticles0->GetEntriesFast();\r
-    Int_t npart1 = 0;\r
-    if(mcparticles1) npart1 = mcparticles1->GetEntriesFast();\r
-    if(ipart < npart0) aodprimary = (AliAODMCParticle*)mcparticles0->At(ipart);\r
-    else aodprimary = (AliAODMCParticle*)mcparticles1->At(ipart-npart0);\r
-    if(!aodprimary) {\r
-      printf("AliAnaBtag::GetMCParticle() *** no primary ***:  label %d \n", ipart);\r
-      return 0x0;\r
+    else{\r
+      Int_t npart0 = mcparticles0->GetEntriesFast();\r
+      if(ipart < npart0) aodprimary = (AliAODMCParticle*)mcparticles0->At(ipart);\r
+      \r
+      if(!aodprimary) {\r
+        printf("AliAnaBtag::GetMCParticle() *** no primary ***:  label %d \n", ipart);\r
+        return 0x0;\r
+      }\r
     }\r
-\r
   } else {\r
     printf("AliAnaBtag::GetMCParticle() - Asked for AliAODMCParticle but we have a stack reader.\n");\r
   }\r
index 903a399f7922c7a494daaf998aa0d27df0770d29..d6f83cf8e430a0fa16f7846568314f343468b64b 100755 (executable)
@@ -456,7 +456,7 @@ void AliAnaParticleJetLeadingConeCorrelation::FillJetHistos(AliAODPWG4ParticleCo
   
   if(nTracksInCone > 0) {
     TH2F *hd = dynamic_cast<TH2F*>(GetOutputContainer()->FindObject(Form("%s%sNTracksInCone%s",GetAddedHistogramsStringToName().Data(),type.Data(),lastname.Data())));
-    hd->Fill(ptTrig, nTracksInCone);
+    if(hd)hd->Fill(ptTrig, nTracksInCone);
   }
   
 }
index ab8db6e81c13a628f58621e25734e9079a2a4bf3..dc90d23f147bab97b419ec780485c61e91bc3f69 100644 (file)
@@ -895,7 +895,7 @@ void  AliAnaShowerParameter::MakeAnalysisFillHistograms()
     fhELambdaCluster ->Fill(ecluster,lambdaMainCluster,lambdaSecondCluster);
     fhELambdaCellCluster ->Fill(ecluster,lambdaMainCluster,iNumCell);
     fhNCellCluster->Fill(ecluster,iNumCell);
-
+    
     //In the case of an event with several clusters, calculate DeltaEta and DeltaPhi for the cluster pairs.
     for (Int_t jaod=iaod+1;jaod<naod;jaod++){
       AliAODPWG4Particle* phSecond = (AliAODPWG4Particle*) (GetOutputAODBranch()->At(jaod));   
@@ -903,7 +903,7 @@ void  AliAnaShowerParameter::MakeAnalysisFillHistograms()
       fhDeltaPhiClusters->Fill(phicluster-(phSecond->Phi()));
       fhDeltaEtaClusters->Fill(etacluster-(phSecond->Eta()));  
     }
-
+    
     //Fill the lambda distribution for identified particles
     if(ph->GetPdg() ==  AliCaloPID::kPhoton){
       fhDispersionPhoton->Fill(ptcluster,dispcluster);
@@ -929,6 +929,9 @@ void  AliAnaShowerParameter::MakeAnalysisFillHistograms()
     
     //Play with the MC data if available
     if(IsDataMC()){
+      if(GetReader()->ReadStack() && !stack) return;
+      if(GetReader()->ReadAODMCParticles() && !mcparticles0) return;
+
       //Get the tag from AliMCAnalysisUtils for PID
       Int_t tag =ph->GetTag();
       if ( ph->GetLabel() < 0){
@@ -952,7 +955,7 @@ void  AliAnaShowerParameter::MakeAnalysisFillHistograms()
         ePhot = pCurrent->Energy();      
         fhPhotTrueE->Fill(ePhot,ecluster,lambdaMainCluster);
         fhRatioEPhoton->Fill(ecluster/ePhot);
-       fhMCPdg->Fill(ecluster,22);
+        fhMCPdg->Fill(ecluster,22);
         if(GetDebug() > 3) 
           printf("AliAnaShowerParameter::MakeAnalysisFillHistograms() - MC Cluster identified as kMCPhoton: True E: %3.2f, Reco E: %3.2f, Lambda0:  %3.2f\n",ePhot,ecluster,lambdaMainCluster);
       }//kMCPhoton
@@ -983,7 +986,7 @@ void  AliAnaShowerParameter::MakeAnalysisFillHistograms()
         //Compare the cluster energy and true energy
         fhPi0TrueE->Fill(ePi0,ecluster,lambdaMainCluster);
         fhRatioEPi0->Fill(ecluster/ePi0);
-       fhMCPdg->Fill(ecluster,111);
+        fhMCPdg->Fill(ecluster,111);
         if(GetDebug() > 3) 
           printf("AliAnaShowerParameter::MakeAnalysisFillHistograms() - MC Cluster identified as kMCPi0: True E: %3.2f, Reco E: %3.2f, Lambda0:  %3.2f\n",ePi0,ecluster,lambdaMainCluster);
       }
@@ -1008,7 +1011,7 @@ void  AliAnaShowerParameter::MakeAnalysisFillHistograms()
           fhPionTrueE->Fill(ePion,ecluster,lambdaMainCluster);
           fhRatioEPion->Fill(ecluster/ePion);
         }
-       fhMCPdg->Fill(ecluster,211);
+        fhMCPdg->Fill(ecluster,211);
         if(GetDebug() > 3) 
           printf("AliAnaShowerParameter::MakeAnalysisFillHistograms() - MC Cluster identified as kMCPion: True E: %3.2f, Reco E: %3.2f, Lambda0:  %3.2f\n",ePion,ecluster,lambdaMainCluster);
       }        
@@ -1033,7 +1036,7 @@ void  AliAnaShowerParameter::MakeAnalysisFillHistograms()
           fhProtonTrueE->Fill(eProton,ecluster,lambdaMainCluster);
           fhRatioEProton->Fill(ecluster/eProton);
         }
-       fhMCPdg->Fill(ecluster,2212);
+        fhMCPdg->Fill(ecluster,2212);
         if(GetDebug() > 3) 
           printf("AliAnaShowerParameter::MakeAnalysisFillHistograms() - MC Cluster identified as kMCProton: True E: %3.2f, Reco E: %3.2f, Lambda0:  %3.2f\n",eProton,ecluster,lambdaMainCluster);
       } 
@@ -1058,7 +1061,7 @@ void  AliAnaShowerParameter::MakeAnalysisFillHistograms()
           fhAntiProtonTrueE->Fill(eAntiProton,ecluster,lambdaMainCluster);
           fhRatioEAntiProton->Fill(ecluster/eAntiProton);
         }      
-       fhMCPdg->Fill(ecluster,-2212);
+        fhMCPdg->Fill(ecluster,-2212);
         if(GetDebug() > 3) 
           printf("AliAnaShowerParameter::MakeAnalysisFillHistograms() - MC Cluster identified as kMCAntiProton: True E: %3.2f, Reco E: %3.2f, Lambda0:  %3.2f\n",eAntiProton,ecluster,lambdaMainCluster);
       }
@@ -1083,7 +1086,7 @@ void  AliAnaShowerParameter::MakeAnalysisFillHistograms()
           fhNeutronTrueE->Fill(eNeutron,ecluster,lambdaMainCluster);
           fhRatioENeutron->Fill(ecluster/eNeutron);
         }
-       fhMCPdg->Fill(ecluster,2112);
+        fhMCPdg->Fill(ecluster,2112);
                  if(GetDebug() > 3) 
           printf("AliAnaShowerParameter::MakeAnalysisFillHistograms() - MC Cluster identified as kMCNeutron: True E: %3.2f, Reco E: %3.2f, Lambda0:  %3.2f\n",eNeutron,ecluster,lambdaMainCluster);
       }
@@ -1101,20 +1104,20 @@ void  AliAnaShowerParameter::MakeAnalysisFillHistograms()
         printf("AliAnaShowerParameter::MakeAnalysisFillHistograms() *** bad label ***:  label %d \n", label);
         continue;
       }
-
+      
       //Calculate Pi0 decay angles
       if(stack && (IsDataMC() || (GetReader()->GetDataType() == AliCaloTrackReader::kMC)) ){
-       for(Int_t i=0 ; i<stack->GetNprimary(); i++){
-         TParticle * prim = stack->Particle(i) ;
-         if(prim->GetPdgCode() == 111){
-           TLorentzVector mom1 ;
-           (stack->Particle((prim->GetFirstDaughter())))->Momentum(mom1);
-           TLorentzVector mom2 ;
-           (stack->Particle((prim->GetLastDaughter())))->Momentum(mom2);
-           Float_t fDecayAngle = mom1.Angle(mom2.Vect());
-           fhDecayAngle->Fill(ecluster,fDecayAngle);
-         }
-       }
+        for(Int_t i=0 ; i<stack->GetNprimary(); i++){
+          TParticle * prim = stack->Particle(i) ;
+          if(prim->GetPdgCode() == 111){
+            TLorentzVector mom1 ;
+            (stack->Particle((prim->GetFirstDaughter())))->Momentum(mom1);
+            TLorentzVector mom2 ;
+            (stack->Particle((prim->GetLastDaughter())))->Momentum(mom2);
+            Float_t fDecayAngle = mom1.Angle(mom2.Vect());
+            fhDecayAngle->Fill(ecluster,fDecayAngle);
+          }
+        }
       }
       
       
@@ -1147,15 +1150,15 @@ void  AliAnaShowerParameter::MakeAnalysisFillHistograms()
           aodprimary = (AliAODMCParticle*) mcparticles0->At(label);
           
         }
-//        else {//Second input
-//          if(!mcparticles1) continue;
-//          if(label >=  mcparticles1->GetEntriesFast()) {
-//            if(GetDebug() > 2)  printf("AliAnaShowerParameter::MakeAnalysisFillHistograms() *** large label ***:  label %d, n tracks %d \n",label, mcparticles1->GetEntriesFast());
-//            continue ;
-//          }
-//          //Get the particle
-//          aodprimary = (AliAODMCParticle*) mcparticles1->At(label); 
-//        }//second input
+        //        else {//Second input
+        //          if(!mcparticles1) continue;
+        //          if(label >=  mcparticles1->GetEntriesFast()) {
+        //            if(GetDebug() > 2)  printf("AliAnaShowerParameter::MakeAnalysisFillHistograms() *** large label ***:  label %d, n tracks %d \n",label, mcparticles1->GetEntriesFast());
+        //            continue ;
+        //          }
+        //          //Get the particle
+        //          aodprimary = (AliAODMCParticle*) mcparticles1->At(label); 
+        //        }//second input
         
         if(!aodprimary){
           printf("AliAnaShowerParameter::MakeAnalysisFillHistograms() *** no primary ***:  label %d \n", label);