]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Coverity
authorrbailhac <rbailhac@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 6 Feb 2012 09:39:08 +0000 (09:39 +0000)
committerrbailhac <rbailhac@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 6 Feb 2012 09:39:08 +0000 (09:39 +0000)
PWGHF/hfe/AliAnalysisTaskHFE.cxx
PWGHF/hfe/AliHFEspectrum.cxx

index 76727b320c53ba13fddc4da5cb2365b4065d2585..03adfb44993304d267b153b18a94744b68ae087b 100644 (file)
@@ -993,17 +993,23 @@ void AliAnalysisTaskHFE::ProcessESD(){
     // Temporary histogram for chi2/ITS cluster
     if(IsPbPb()) {
             TBits shared = track->GetTPCSharedMap();
-          Int_t sharebit=0;
+           Int_t sharebit=0;
             if(shared.CountBits() >= 2) sharebit=1;
 
+           Double_t itschi2percluster = 0.0;
+           if(track->GetNcls(0) > 0) itschi2percluster = track->GetITSchi2()/static_cast<Double_t>(track->GetNcls(0));
+
             Double_t itsChi2[7] = {track->Pt(),track->Eta(), track->Phi(),
-            fCentralityF,track->GetTPCsignalN(), sharebit,
-            track->GetITSchi2()/static_cast<Double_t>(track->GetNcls(0))};
+                                  fCentralityF,track->GetTPCsignalN(), sharebit, itschi2percluster};
             fQACollection->Fill("fChi2perITScluster", itsChi2);
     }
     else{
-            Double_t itsChi2[3] = {track->Pt(), fCentralityF, track->GetITSchi2()/static_cast<Double_t>(track->GetNcls(0))};
-            fQACollection->Fill("fChi2perITScluster", itsChi2);
+      
+      Double_t itschi2percluster = 0.0;
+      if(track->GetNcls(0) > 0) itschi2percluster = track->GetITSchi2()/static_cast<Double_t>(track->GetNcls(0));
+
+      Double_t itsChi2[3] = {track->Pt(), fCentralityF, itschi2percluster};
+      fQACollection->Fill("fChi2perITScluster", itsChi2);
     }
 
     // Fill Histogram for Hadronic Background
@@ -1355,7 +1361,7 @@ Bool_t AliAnalysisTaskHFE::ProcessMCtrack(AliVParticle *track){
   signalContainer[2] = track->Phi();
   signalContainer[3] = track->Charge()/3;
 
Double_t vertex[3]; // Production vertex cut to mask gammas which are NOT supposed to have hits in the first ITS layer(s)
 Double_t vertex[3] = {0.,0.,0.}; // Production vertex cut to mask gammas which are NOT supposed to have hits in the first ITS layer(s)
   if(IsESDanalysis()){
     AliMCParticle *mctrack = dynamic_cast<AliMCParticle *>(track);
     if(mctrack){
index 8c4ee614ba6da0a8f974288ff2d1b287e5f89b43..2c59c9d446acbe39f4f7c8a9e254eb32cc3ff871 100644 (file)
@@ -824,8 +824,10 @@ Bool_t AliHFEspectrum::CorrectBeauty(Bool_t subtractcontamination){
       alltogetherCorrection->SetName("AlltogetherCorrectedNotNormalizedSpectrum");
       alltogetherCorrection->Write();
       //
-      unnormalizedRawSpectrum->SetName("beautyAfterIP");
-      unnormalizedRawSpectrum->Write();
+      if(unnormalizedRawSpectrum) {
+       unnormalizedRawSpectrum->SetName("beautyAfterIP");
+       unnormalizedRawSpectrum->Write();
+      }
       
       if(gNormalizedRawSpectrum){
         gNormalizedRawSpectrum->SetName("normalizedBeautyAfterIP");
@@ -1270,9 +1272,9 @@ AliCFDataGrid* AliHFEspectrum::GetConversionBackground(){
   AliCFDataGrid *backgroundGrid = new AliCFDataGrid("ConversionBgGrid","ConversionBgGrid",*backgroundContainer,stepbackground);
   //backgroundGrid->Scale(evtnorm);
   //workaround for statistical errors: "Scale" method does not work for our errors, since Sumw2 is not defined for AliCFContainer
-  Int_t *nBin=new Int_t[1];
+  Int_t nBin[1];
   
-  Int_t* bins=new Int_t[1];
+  Int_t bins[1];
   bins[0]=fConversionEff->GetNbinsX();
   
   for(Long_t iBin=1; iBin<= bins[0];iBin++){
@@ -1282,7 +1284,7 @@ AliCFDataGrid* AliHFEspectrum::GetConversionBackground(){
   }
   //end of workaround for statistical errors
   
-  AliCFDataGrid *weightedConversionContainer = new AliCFDataGrid("weightedConversionContainer","weightedConversionContainer",1,bins);
+  AliCFDataGrid *weightedConversionContainer = new AliCFDataGrid("weightedConversionContainer","weightedConversionContainer",1,&bins[0]);
   weightedConversionContainer->SetGrid(GetPIDxIPEff(2));
   backgroundGrid->Multiply(weightedConversionContainer,1.0);
   
@@ -1321,9 +1323,9 @@ AliCFDataGrid* AliHFEspectrum::GetNonHFEBackground(){
   AliCFDataGrid *backgroundGrid = new AliCFDataGrid("NonHFEBgGrid","NonHFEBgGrid",*backgroundContainer,stepbackground);
   //backgroundGrid->Scale(evtnorm);
   //workaround for statistical errors: "Scale" method does not work for our errors, since Sumw2 is not defined for AliCFContainer
-  Int_t *nBin=new Int_t[1];
+  Int_t nBin[1];
   
-  Int_t* bins=new Int_t[1];
+  Int_t bins[1];
   bins[0]=fConversionEff->GetNbinsX();
   
   for(Long_t iBin=1; iBin<= bins[0];iBin++){
@@ -1333,7 +1335,7 @@ AliCFDataGrid* AliHFEspectrum::GetNonHFEBackground(){
   }
   //end of workaround for statistical errors
   
-  AliCFDataGrid *weightedNonHFEContainer = new AliCFDataGrid("weightedNonHFEContainer","weightedNonHFEContainer",1,bins);
+  AliCFDataGrid *weightedNonHFEContainer = new AliCFDataGrid("weightedNonHFEContainer","weightedNonHFEContainer",1,&bins[0]);
   weightedNonHFEContainer->SetGrid(GetPIDxIPEff(3));
   backgroundGrid->Multiply(weightedNonHFEContainer,1.0);