]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDCalibViewer.cxx
Commented unnecessary include AliLog
[u/mrichter/AliRoot.git] / TRD / AliTRDCalibViewer.cxx
index d2296a04200dd33904fd109e0568cefa91f16e3d..90d03a38769244e1e28544975ad125b8a232a4ca 100644 (file)
@@ -57,8 +57,8 @@
 #include "AliTRDCalChamberStatus.h"
 #include "AliTRDCalSingleChamberStatus.h"
 #include "AliTRDCalPadStatus.h"
-#include "AliTRDCalDCS.h"
-#include "AliTRDCalDCSFEE.h"
+#include "AliTRDCalDCSv2.h"
+#include "AliTRDCalDCSFEEv2.h"
 #include "AliTRDcalibDB.h"
 #include "AliCDBManager.h"
 #include "AliCDBStorage.h"
@@ -112,16 +112,24 @@ AliTRDCalibViewer::AliTRDCalibViewer(const char* fileName, const char* treeName)
 }
 
 //_____________________________________________________________________________
-AliTRDCalibViewer& AliTRDCalibViewer::operator=(const AliTRDCalibViewer& param) {
+AliTRDCalibViewer& AliTRDCalibViewer::operator=(const AliTRDCalibViewer& param) 
+{
   //
   // assignment operator
   //
+
+  if (this == &param) {
+    return *this;
+  }
+
   fTree = param.fTree;
   fTreeMustBeDeleted = param.fTreeMustBeDeleted;
   fListOfObjectsToBeDeleted = param.fListOfObjectsToBeDeleted;
   fAbbreviation = param.fAbbreviation;
   fAppendString = param.fAppendString;
+
   return(*this);
+
 }
 
 //_____________________________________________________________________________
@@ -204,9 +212,9 @@ const char* AliTRDCalibViewer::AddAbbreviations(char* c, Bool_t printDrawCommand
    for (Int_t i = 0; i < nNorm; i++) {
       normLengths[i] = ((TObjString*)listOfNormalizationVariables->At(i))->String().Length();
    }
-   Int_t *varSort = new Int_t[nVariables];
+   Int_t *varSort = new Int_t[nVariables+1];
    TMath::Sort(nVariables, varLengths, varSort, kTRUE);
-   Int_t *normSort = new Int_t[nNorm];
+   Int_t *normSort = new Int_t[nNorm+1];
    TMath::Sort(nNorm, normLengths, normSort, kTRUE);
       
    for (Int_t ivar = 0; ivar < nVariables; ivar++) {
@@ -239,8 +247,8 @@ const char* AliTRDCalibViewer::AddAbbreviations(char* c, Bool_t printDrawCommand
    str.ReplaceAll(removeString, "");
   
    if (printDrawCommand) std::cout << "The string looks now like: " << str.Data() << std::endl;
-   delete varSort;
-   delete normSort;
+   delete [] varSort;
+   delete [] normSort;
    return str.Data();
 }
 
@@ -360,7 +368,25 @@ void AliTRDCalibViewer::GetLayerSectorStack(TString trdString, Int_t& layerNo, I
   // encoded with the following format:
   // Layer%dSector%dStack%d
 
-  sscanf(trdString.Data(), "Layer%dSector%dStack%d", &layerNo, &sectorNo, &stackNo);
+  //sscanf(trdString.Data(), "Layer%1dSector%02dStack%1d", &layerNo, &sectorNo, &stackNo);
+
+  // Coverity compliant solution (bit more cumbersome, but works) CBL
+  TString cName = trdString.Data();
+  Char_t  cLayer[2];
+  Char_t  cSector[3];
+  Char_t  cStack[2];
+
+  cLayer[0]  = cName[5];
+  cLayer[1]  = 0;
+  cSector[0] = cName[12];
+  cSector[1] = cName[13];
+  cSector[2] = 0;
+  cStack[0]  = cName[19];
+  cStack[1]  = 0;
+
+  layerNo    = atoi(cLayer);
+  sectorNo   = atoi(cSector);
+  stackNo    = atoi(cStack);
 
   return;
 }
@@ -636,7 +662,7 @@ Int_t AliTRDCalibViewer::EasyDraw(const char* drawCommand, Int_t chamber, const
     Int_t stackNo = (chamber%30)/6;
     Int_t layerNo = (chamber%30)%6;
     char sectorChr[22];
-    sprintf(sectorChr, "Layer%iSector%iStack%i", layerNo, superModuleNo, stackNo);
+    snprintf(sectorChr,22, "Layer%iSector%iStack%i", layerNo, superModuleNo, stackNo);
     return EasyDraw(drawCommand, sectorChr, cuts, drawOptions, writeDrawCommand);
   }
   Error("EasyDraw","The TRD contains only chamber from 0 to 539");
@@ -659,7 +685,7 @@ Int_t AliTRDCalibViewer::EasyDraw1D(const char* drawCommand, Int_t chamber, cons
     Int_t stackNo = (chamber%30)/6;
     Int_t layerNo = (chamber%30)%6;
     char sectorChr[22];
-    sprintf(sectorChr, "Layer%iSector%iStack%i", layerNo, superModuleNo, stackNo);
+    snprintf(sectorChr,22, "Layer%iSector%iStack%i", layerNo, superModuleNo, stackNo);
     return EasyDraw1D(drawCommand, sectorChr, cuts, drawOptions, writeDrawCommand);
   }
   Error("EasyDraw1D","The TRD contains only chambers from 0 to 539");
@@ -926,11 +952,11 @@ Bool_t AliTRDCalibViewer::DumpOCDBtoTreeDetails(const Char_t* runListFilename,
         dcsArray = (TObjArray*)entry->GetObject();
       }
     }
-    AliTRDCalDCS *dcsSOR = 0;
-    AliTRDCalDCS *dcsEOR = 0;
+    AliTRDCalDCSv2 *dcsSOR = 0;
+    AliTRDCalDCSv2 *dcsEOR = 0;
     if(getDCS && dcsArray) {
-      dcsSOR = (AliTRDCalDCS*)dcsArray->At(0);
-      dcsEOR = (AliTRDCalDCS*)dcsArray->At(1);
+      dcsSOR = (AliTRDCalDCSv2*)dcsArray->At(0);
+      dcsEOR = (AliTRDCalDCSv2*)dcsArray->At(1);
     }
 
     // Alignment information
@@ -1042,8 +1068,8 @@ Bool_t AliTRDCalibViewer::DumpOCDBtoTreeDetails(const Char_t* runListFilename,
           }   // end if(getCalibs)
 
          // get the dcs information
-         AliTRDCalDCSFEE *dcsfeeSOR = 0;
-         AliTRDCalDCSFEE *dcsfeeEOR = 0;
+         AliTRDCalDCSFEEv2 *dcsfeeSOR = 0;
+         AliTRDCalDCSFEEv2 *dcsfeeEOR = 0;
           if(getDCS) {
            if(dcsSOR) dcsfeeSOR = dcsSOR->GetCalDCSFEEObj(chamberNo);
            if(dcsEOR) dcsfeeEOR = dcsEOR->GetCalDCSFEEObj(chamberNo);