]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
coverity changes
authormarian <marian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 24 Mar 2011 11:34:23 +0000 (11:34 +0000)
committermarian <marian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 24 Mar 2011 11:34:23 +0000 (11:34 +0000)
AliESDcosmic.cxx             - pointer check
AliTPCcalibTime.cxx          - proper pointer check
AliTPCcalibTracksGain.cxx    - removing obsolete functions and data members
AliTPCtrackerSector.cxx      - array initialization in cosntructor
AliTPCclustererKr.cxx        - check the pointer at the beginning of function
AliTPCkalmanAlign.cxx        - coverity warning
AliXRDPROOFtoolkit.cxx       - snprintf instead of sprintf

TPC/AliESDcosmic.cxx
TPC/AliTPCcalibTime.cxx
TPC/AliTPCcalibTracksGain.cxx
TPC/AliTPCcalibTracksGain.h
TPC/AliTPCclustererKr.cxx
TPC/AliTPCkalmanAlign.cxx
TPC/AliTPCtrackerSector.cxx
TPC/AliXRDPROOFtoolkit.cxx

index 5e46c0af2a725d9e330cb5a6be0b2ad069beb3cf..19b475418a5ea066a9a327c102ed8f617b3ba547 100644 (file)
@@ -150,6 +150,7 @@ void AliESDcosmic::DumpToTree(){
   //
   TTreeSRedirector * cstream = fDebugStreamer;
   if (!cstream) return;
+  if (!fESD) return;
   Int_t ntracks0 =fESD->GetNumberOfTracks(); 
   Int_t ntracks  = (fTracksAcorde) ? fTracksAcorde->GetEntries():0;
   Float_t mag = fESD->GetMagneticField();
index 49c340338e78c98202cc77025233e1ae48a89308..0a18897dbaadb31040f718ee2503579589cbdd5d 100644 (file)
@@ -347,10 +347,10 @@ AliTPCcalibTime::~AliTPCcalibTime(){
     fResHistoTPCvertex[i]=0;
   }
 
-  if (fTPCVertex) {
+  if (fTPCVertex[0]) {
     for (Int_t i=0;i<12;i++)  delete fTPCVertex[i];
   }
-  if (fTPCVertexCorrelation) {
+  if (fTPCVertexCorrelation[0]) {
     for (Int_t i=0;i<5;i++)  delete fTPCVertexCorrelation[i];
   }
   
@@ -1030,7 +1030,7 @@ THnSparse* AliTPCcalibTime::GetHistoDrift(const char* name) const
   THnSparse* newHist=new THnSparseF(newName,"HistVdrift;time;p/T ratio;Vdrift;run",4,fBinsVdrift,fXminVdrift,fXmaxVdrift);
   THnSparse* addHist=NULL;
   while((addHist=(THnSparseF*)iterator->Next())){
-  if(!addHist) continue;
+    //  if(!addHist) continue;
     TString histName=addHist->GetName();
     if(!histName.Contains(newName)) continue;
     addHist->Print();
@@ -1129,7 +1129,7 @@ Long64_t AliTPCcalibTime::Merge(TCollection *const li) {
       }
     }
       
-    if (fTPCVertex && cal->fTPCVertex
+    if (fTPCVertex[0] && cal->fTPCVertex[0]
       for (Int_t imeas=0; imeas<12; imeas++){
        if (fTPCVertex[imeas] && cal->fTPCVertex[imeas]) fTPCVertex[imeas]->Add(cal->fTPCVertex[imeas]);
       }
@@ -1178,7 +1178,7 @@ Long64_t AliTPCcalibTime::Merge(TCollection *const li) {
     iterator->Reset();
     THnSparse* addHist=NULL;
     if ((fMemoryMode>1)) while((addHist=(THnSparseF*)iterator->Next())){
-      if(!addHist) continue;
+      //      if(!addHist) continue;
       addHist->Print();
       THnSparse* localHist=(THnSparseF*)fArrayDz->FindObject(addHist->GetName());
       if(!localHist){
index e453180a77a93a01de716bbae0fdf5db44cdc926..4d4de07bd752c650d0096e146f2a036070ca8b76 100644 (file)
@@ -407,12 +407,6 @@ AliTPCcalibTracksGain::AliTPCcalibTracksGain(const char* name, const char* title
    //
    fTotalTracks     = 0;
    fAcceptedTracks  = 0;
-   // this will be gone for the a new ROOT version > v5-17-05
-   for (UInt_t i = 0; i < 36; i++) {
-      fNShortClusters[i]  = 0;
-      fNMediumClusters[i] = 0;
-      fNLongClusters[i]   = 0;
-   }
 }
 
 AliTPCcalibTracksGain::~AliTPCcalibTracksGain() {
@@ -580,12 +574,6 @@ void AliTPCcalibTracksGain::Add(AliTPCcalibTracksGain* cal) {
   if (cal->fDFitter1T->GetNpoints()>0) fDFitter1T->Add(cal->fDFitter1T);
   if (cal->fDFitter2T->GetNpoints()>0) fDFitter2T->Add(cal->fDFitter2T);
    //
-   // this will be gone for the a new ROOT version > v5-17-05
-   for (UInt_t iSegment = 0; iSegment < 36; iSegment++) {
-      fNShortClusters[iSegment] += cal->fNShortClusters[iSegment];
-      fNMediumClusters[iSegment] += cal->fNMediumClusters[iSegment];
-      fNLongClusters[iSegment] += cal->fNLongClusters[iSegment];
-   }
    
    // just for debugging, remove me
    fTotalTracks += cal->fTotalTracks;
@@ -694,13 +682,6 @@ void AliTPCcalibTracksGain::AddCluster(AliTPCclusterMI* cluster, Float_t /*momen
    fitter=fSingleSectorFitter->GetFitter(0, padType);
    fitter->AddPoint(xx, q);
 
-   // this will be gone for the a new ROOT version > v5-17-05
-   if (padType == kShortPads)
-      fNShortClusters[segment]++;
-   if (padType == kMediumPads)
-      fNMediumClusters[segment]++;
-   if (padType == kLongPads)
-      fNLongClusters[segment]++;
 }
 
 void AliTPCcalibTracksGain::Evaluate(Bool_t robust, Double_t frac) {
@@ -902,31 +883,9 @@ void AliTPCcalibTracksGain::GetErrors(UInt_t segment, UInt_t padType, UInt_t fit
    //
 
    GetFitter(segment, padType, fitType)->GetErrors(fitError);
-   fitError *= TMath::Sqrt(GetRedChi2(segment, padType, fitType));
+   //fitError *= TMath::Sqrt(GetRedChi2(segment, padType, fitType));
 }
 
-Double_t AliTPCcalibTracksGain::GetRedChi2(UInt_t segment, UInt_t padType, UInt_t fitType) {
-   //
-   // Returns the reduced chi^2 value for the specified segment, padType and fitType.
-   // padType is one of kShortPads, kMediumPads, kLongPads. fitType is one of kSimpleFitter, kSqrtFitter, kLogFitter.
-   // Note: The fitter has to be evaluated first!
-   //
-
-   // this will be gone for the a new ROOT version > v5-17-05
-   Int_t lNClusters = 0;
-   switch (padType) {
-      case kShortPads:
-         lNClusters = fNShortClusters[segment];
-         break;
-      case kMediumPads:
-         lNClusters = fNMediumClusters[segment];
-         break;
-      case kLongPads:
-         lNClusters = fNLongClusters[segment];
-         break;
-   }
-   return GetFitter(segment, padType, fitType)->GetChisquare()/(lNClusters - 8);
-}
 
 void AliTPCcalibTracksGain::GetCovarianceMatrix(UInt_t segment, UInt_t padType, UInt_t fitType, TMatrixD& covMatrix) {
    //
index 767e04714bdaa5fb736ed4939c8d5bf188564621..545ad0da62bc4353f46f045f60957e8c99dfddd3 100644 (file)
@@ -90,7 +90,6 @@ public:
   void            Evaluate(Bool_t robust = kFALSE, Double_t frac = -1.);
   Bool_t            GetParameters(UInt_t segment, UInt_t padType, UInt_t fitType, TVectorD &fitParam);
   void            GetErrors(UInt_t segment, UInt_t padType, UInt_t fitType, TVectorD &fitError);
-  Double_t        GetRedChi2(UInt_t segment, UInt_t padType, UInt_t fitType);
   void            GetCovarianceMatrix(UInt_t segment, UInt_t padType, UInt_t fitType, TMatrixD& covMatrix);
   //
   //
@@ -143,9 +142,6 @@ public:
   //
   UInt_t          fTotalTracks;         // just for debugging
   UInt_t          fAcceptedTracks;      // just for debugging
-  UInt_t          fNShortClusters[36];   // number of clusters registered on short pads
-  UInt_t          fNMediumClusters[36];  // number of clusters registered on medium pads
-  UInt_t          fNLongClusters[36];    // number of clusters registered on long pads
   //
   //
   //
index 0576374467b0bd99b61c6fee7e3460027c8f614e..03c16a048e685c89cfa3e126765811f2f60787f7 100644 (file)
@@ -443,8 +443,9 @@ Int_t AliTPCclustererKr::FinderIO(AliRawReader* rawReader)
   // Krypton cluster finder for the TPC raw data\r
   // this method is unsing AliAltroRawStreamV3\r
   // fParam must be defined before\r
-  \r
-  if(rawReader)fRawData=kTRUE; //set flag to data\r
+  if (!rawReader) return 1;\r
+  //\r
+  fRawData=kTRUE; //set flag to data\r
   \r
   if (!fOutput) {\r
     Error("Digits2Clusters", "output tree not initialised");\r
index e6049f05b6b90a5f1ba375756247858b4c52adc9..3123033f59504d2d38d67cfdba7648f77e44632b 100644 (file)
@@ -919,6 +919,7 @@ void AliTPCkalmanAlign::FitCE(){
     TCut cutSector=Form("(sector%%36)==%d",isec);
     strFitLX = TStatToolkit::FitPlane(chain,"deltaT-CEG.fElements-CELX.fElements", fstringL.Data(),cutSector+cutAll+"abs(deltaT-CEG.fElements-CELX.fElements)<0.4", chi2,npoints,vecL[isec],covar,-1,0, 10000000, kFALSE);
     printf("sec=%d\tchi2=%f\n",isec,TMath::Sqrt(chi2/npoints));
+    delete strFitLX;
     //
     TString fitL=Form("((sector%%36)==%d)++((sector%%36)==%d)*(sector<36)++((sector%%36)==%d)*(lx-133)/100.++((sector%%36)==%d)*(sector<36)*(lx-133)/100.++((sector%%36)==%d)*(ly)/100.++((sector%%36)==%d)*(sector<36)*(ly)/100.",isec,isec,isec,isec,isec,isec);
     if (isec<18) padFitTmpCE=AliTPCCalPad::CreateCalPadFit(fitL.Data(),vecL[isec],dummy);
index 551a9d54570d3183d81349839ea9511b944c134e..d0671fac14af2c9f010d4496e0b98bf83f31a1cc 100644 (file)
@@ -55,7 +55,9 @@ AliTPCtrackerRow::AliTPCtrackerRow():
   fClusters2(0),
   fN2(0),
   fN(0),
-  fX(0.)
+  fClusters(),
+  fIndex(),
+  fX(0.)  
 {
   //
   // default constructor
@@ -194,7 +196,7 @@ void AliTPCtrackerRow::SetFastCluster(Int_t i, Short_t cl){
   //
   // Set cluster info for fast navigation
   //
-  if (i>510|| i<0){
+  if (i>=510|| i<0){
   }else{
     fFastCluster[i]=cl;
   }
index d2c1daf8dc99d6418748a06583cfbd4f1bf9fbc1..752da17cca12365e60239e69684684c6a848e648 100644 (file)
@@ -359,16 +359,16 @@ Bool_t  AliXRDPROOFtoolkit::FilterList(const char*inputList, const char*fileList
     for (Int_t i=0; i<array->GetEntries(); i+=2){
       char fname[1000];
       if (!isZip){
-       sprintf(fname, "%s/%s",dirname,array->At(i)->GetName());
+       snprintf(fname,1000, "%s/%s",dirname,array->At(i)->GetName());
         if (((TObjString*)array->At(i))->String().Contains("*")){
-         sprintf(fname, "%s", currentFile.Data());
+         snprintf(fname,1000, "%s", currentFile.Data());
        }
       }
       if (isZip) {
        const char * fileName   =  gSystem->BaseName(currentFile.Data());
        TString fstring=fileName;
        fstring[fstring.First("#")]=0;
-       sprintf(fname, "%s/%s#%s",dirname,fstring.Data(),array->At(i)->GetName());
+       snprintf(fname,1000, "%s/%s#%s",dirname,fstring.Data(),array->At(i)->GetName());
        printf(fname, "To check %s%s#%s\n",dirname,fstring.Data(),array->At(i)->GetName());
       }
 
@@ -444,7 +444,7 @@ Bool_t  AliXRDPROOFtoolkit::FilterListZip(const char*inputList, const char*fileL
     for (Int_t i=0; i<array->GetEntries(); i+=2){
       char fname[1000];
       //if (isZip) sprintf(fname,
-      sprintf(fname, "%s/%s#%s",dirname,fstring.Data(),array->At(i)->GetName());
+      snprintf(fname,1000, "%s/%s#%s",dirname,fstring.Data(),array->At(i)->GetName());
       printf(fname, "To check %s%s#%s\n",dirname,fstring.Data(),array->At(i)->GetName());
       //cout <<"\n arguments: "<< array->At(i+1)->GetName()<<" "<<checkLevel<<endl;
       Int_t cstatus = CheckTreeInFile(fname, array->At(i+1)->GetName(), checkLevel,0);
@@ -488,8 +488,8 @@ Bool_t  AliXRDPROOFtoolkit::XRDCopyDir(const char * idir, const char * files, co
   char outfile[1000];
   Bool_t succes=kTRUE;
   for (Int_t ifile =0; ifile<nfiles; ifile++){
-    sprintf(infile,"%s/%s", idir, array->At(ifile)->GetName());
-    sprintf(outfile,"%s/%s", odir, array->At(ifile)->GetName());
+    snprintf(infile,1000,"%s/%s", idir, array->At(ifile)->GetName());
+    snprintf(outfile,1000,"%s/%s", odir, array->At(ifile)->GetName());
     printf("%s - %s\n",infile, outfile);
     Bool_t result = TFile::Cp(infile,outfile); 
     succes &= result;