From fdc1555317fd05daa86701deb2de595bb7dbe204 Mon Sep 17 00:00:00 2001 From: cblume Date: Mon, 11 Oct 2010 10:07:20 +0000 Subject: [PATCH] More Coverity stuff .. --- TRD/AliTRDCalibChamberStatus.cxx | 3 +- TRD/AliTRDCalibPadStatus.cxx | 4 +- TRD/AliTRDCalibTask.cxx | 6 +- TRD/AliTRDCalibraFillHisto.cxx | 6 + TRD/AliTRDCalibraFit.cxx | 10 +- TRD/AliTRDCalibraVdriftLinearFit.cxx | 5 +- TRD/AliTRDCalibraVector.cxx | 6 +- TRD/AliTRDCommonParam.cxx | 7 +- TRD/AliTRDarrayADC.cxx | 196 ++++++++++++++------------- 9 files changed, 132 insertions(+), 111 deletions(-) diff --git a/TRD/AliTRDCalibChamberStatus.cxx b/TRD/AliTRDCalibChamberStatus.cxx index 51a5dbfec68..a91ef5588d6 100644 --- a/TRD/AliTRDCalibChamberStatus.cxx +++ b/TRD/AliTRDCalibChamberStatus.cxx @@ -275,6 +275,7 @@ void AliTRDCalibChamberStatus::ProcessEvent(AliRawReader * rawReader, Int_t neve Bool_t notEmpty = kFALSE; AliTRDrawFastStream *rawStream = new AliTRDrawFastStream(rawReader); + if (!rawStream) return; rawStream->SetNoErrorWarning(); rawStream->SetSharedPadReadout(kFALSE); @@ -402,7 +403,7 @@ void AliTRDCalibChamberStatus::ProcessEvent3(AliRawReader * rawReader, Int_t nev if(notEmpty) fCounterEventNotEmpty++; if(digitsManager) delete digitsManager; - if(rawStream) delete rawStream; + delete rawStream; } //_____________________________________________________________________ diff --git a/TRD/AliTRDCalibPadStatus.cxx b/TRD/AliTRDCalibPadStatus.cxx index 9763e197781..bcb389b8d12 100644 --- a/TRD/AliTRDCalibPadStatus.cxx +++ b/TRD/AliTRDCalibPadStatus.cxx @@ -737,8 +737,8 @@ TH2F* AliTRDCalibPadStatus::GetHisto(Int_t det, TObjArray *arr, /*FOLD00*/ // if we are forced and histogram doesn't yes exist create it Char_t name[255], title[255]; - sprintf(name,"hCalib%s%.3d",type,det); - sprintf(title,"%s calibration histogram detector %.2d;ADC channel;Channel (pad)",type,det); + snprintf(name,255,"hCalib%s%.3d",type,det); + snprintf(title,255,"%s calibration histogram detector %.2d;ADC channel;Channel (pad)",type,det); Int_t nbchannels = fGeo->GetRowMax(GetLayer(det),GetStack(det),GetSector(det))*fGeo->GetColMax(GetLayer(det)); diff --git a/TRD/AliTRDCalibTask.cxx b/TRD/AliTRDCalibTask.cxx index b86517c11f9..79660af9af3 100644 --- a/TRD/AliTRDCalibTask.cxx +++ b/TRD/AliTRDCalibTask.cxx @@ -417,9 +417,13 @@ void AliTRDCalibTask::UserCreateOutputObjects() fListHist->Add(fNbTrackletsStandalone); } + + delete [] binLimLogPt; + delete [] binLimPt; + //cout << "AliTRDCalibTask::UserCreateOutputObjects() OUT" << endl; -} +} //________________________________________________________________________ void AliTRDCalibTask::UserExec(Option_t *) diff --git a/TRD/AliTRDCalibraFillHisto.cxx b/TRD/AliTRDCalibraFillHisto.cxx index af2d68dc25b..f869fa6ca1e 100644 --- a/TRD/AliTRDCalibraFillHisto.cxx +++ b/TRD/AliTRDCalibraFillHisto.cxx @@ -298,6 +298,12 @@ AliTRDCalibraFillHisto::AliTRDCalibraFillHisto(const AliTRDCalibraFillHisto &c) } fGeo = new AliTRDgeometry(); fCalibDB = AliTRDcalibDB::Instance(); + + fNumberUsedCh[0] = 0; + fNumberUsedCh[1] = 0; + fNumberUsedPh[0] = 0; + fNumberUsedPh[1] = 0; + } //____________________________________________________________________________________ diff --git a/TRD/AliTRDCalibraFit.cxx b/TRD/AliTRDCalibraFit.cxx index a6e67efbbd0..aa83e6767d5 100644 --- a/TRD/AliTRDCalibraFit.cxx +++ b/TRD/AliTRDCalibraFit.cxx @@ -4314,8 +4314,10 @@ void AliTRDCalibraFit::FitLagrangePoly(TH1* projPH) const Float_t kDrWidth = AliTRDgeometry::DrThick(); Int_t binmax = 0; Int_t binmin = 0; - Double_t *x = new Double_t[5]; - Double_t *y = new Double_t[5]; + //Double_t *x = new Double_t[5]; + //Double_t *y = new Double_t[5]; + Double_t x[5]; + Double_t y[5]; x[0] = 0.0; x[1] = 0.0; x[2] = 0.0; @@ -4889,8 +4891,8 @@ void AliTRDCalibraFit::FitLagrangePoly(TH1* projPH) if(polynome) delete polynome; if(polynomea) delete polynomea; if(polynomeb) delete polynomeb; - if(x) delete [] x; - if(y) delete [] y; + //if(x) delete [] x; + //if(y) delete [] y; if(c) delete [] c; if(line) delete line; diff --git a/TRD/AliTRDCalibraVdriftLinearFit.cxx b/TRD/AliTRDCalibraVdriftLinearFit.cxx index 7ac4f77fd3b..6069275b11d 100644 --- a/TRD/AliTRDCalibraVdriftLinearFit.cxx +++ b/TRD/AliTRDCalibraVdriftLinearFit.cxx @@ -316,7 +316,7 @@ void AliTRDCalibraVdriftLinearFit::FillPEArray() //printf("test\n"); for(Int_t ibinx = 0; ibinx < linearfitterhisto->GetNbinsX(); ibinx++){ for(Int_t ibiny = 0; ibiny < linearfitterhisto->GetNbinsY(); ibiny++){ - if(linearfitterhisto->GetBinContent(ibinx+1,ibiny+1)>0){ + if(linearfitterhxisto->GetBinContent(ibinx+1,ibiny+1)>0){ Double_t x = xaxis->GetBinCenter(ibinx+1); Double_t y = yaxis->GetBinCenter(ibiny+1); for(Int_t k = 0; k < (Int_t)linearfitterhisto->GetBinContent(ibinx+1,ibiny+1); k++){ @@ -350,6 +350,9 @@ void AliTRDCalibraVdriftLinearFit::FillPEArray() //delete linearfitterhisto; }// if something + + delete [] arrayI; + } } diff --git a/TRD/AliTRDCalibraVector.cxx b/TRD/AliTRDCalibraVector.cxx index ffcd2ed788c..8b928fe2e95 100644 --- a/TRD/AliTRDCalibraVector.cxx +++ b/TRD/AliTRDCalibraVector.cxx @@ -983,10 +983,12 @@ TGraphErrors *AliTRDCalibraVector::ConvertVectorPHTGraphErrors(Int_t det, Int_t // Axis Float_t sf = 10.0; AliTRDCommonParam *parCom = AliTRDCommonParam::Instance(); - if (!parCom) { + if (parCom) { + sf = parCom->GetSamplingFrequency(); + } + else { AliInfo("Could not get CommonParam, take the default 10MHz"); } - sf = parCom->GetSamplingFrequency(); // Axis Double_t x[35]; // Xaxis Double_t y[35]; // Sum/entries diff --git a/TRD/AliTRDCommonParam.cxx b/TRD/AliTRDCommonParam.cxx index efaabe07ed6..ac4816f452c 100644 --- a/TRD/AliTRDCommonParam.cxx +++ b/TRD/AliTRDCommonParam.cxx @@ -401,9 +401,6 @@ Double_t AliTRDCommonParam::TimeStruct(Float_t vdrift, Double_t dist, Double_t z ? fTimeStruct1[r1+38*kz2] : fTimeStruct1[r1+38*10]; const Float_t ky211 = fTimeStruct1[r2+38*kz1]; - //const Float_t ky211 = (r2 <= 37) - // ? fTimeStruct1[r2+38*kz1] - // : fTimeStruct1[37+38*kz1]; const Float_t ky112 = fTimeStruct2[r1+38*kz1]; const Float_t ky222 = ((r2 <= 37) && (kz2 <= 10)) @@ -412,9 +409,7 @@ Double_t AliTRDCommonParam::TimeStruct(Float_t vdrift, Double_t dist, Double_t z const Float_t ky122 = (kz2 <= 10) ? fTimeStruct2[r1+38*kz2] : fTimeStruct2[r1+38*10]; - const Float_t ky212 = (r2 <= 37) - ? fTimeStruct2[r2+38*kz1] - : fTimeStruct2[37+38*kz1]; + const Float_t ky212 = fTimeStruct2[r2+38*kz1]; // Interpolation in dist-directions, lower drift time map const Float_t ky11 = (ky211-ky111)*10*dist + ky111 - (ky211-ky111)*r1; diff --git a/TRD/AliTRDarrayADC.cxx b/TRD/AliTRDarrayADC.cxx index 1c0f96697de..4116907d3bd 100644 --- a/TRD/AliTRDarrayADC.cxx +++ b/TRD/AliTRDarrayADC.cxx @@ -434,111 +434,119 @@ void AliTRDarrayADC::Expand() // Expand the array // - //Check if the array has not been already expanded - Int_t verif=0; - for(Int_t i=0; i=-16000)) - { - longm[r2]=-fADC[i]; - r2++; - } - if(fADC[i]<-16000) - { - longz[r3]=-fADC[i]-16001; - r3++; - } - } - //Calculate the new dimensions of the array - for(Int_t i=0; i0) - { - bufferE[i]=fADC[contaexp]; - } + Int_t dimexp=0; + Int_t *longz = new Int_t[fNAdim]; + Int_t *longm = new Int_t[fNAdim]; - if((fADC[contaexp]<0)&&(fADC[contaexp]>=-16000)) - { - for(Int_t j=0; j=-16000)) + { + longm[r2]=-fADC[i]; + r2++; + } + if(fADC[i]<-16000) + { + longz[r3]=-fADC[i]-16001; + r3++; + } + } + + //Calculate the new dimensions of the array + for(Int_t i=0; i0) + { + bufferE[i]=fADC[contaexp]; + } + if((fADC[contaexp]<0)&&(fADC[contaexp]>=-16000)) + { + for(Int_t j=0; j