]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDCalibViewer.cxx
Put 0.1 as minimal value of the gas gain (Raphaelle)
[u/mrichter/AliRoot.git] / TRD / AliTRDCalibViewer.cxx
index c208787e12974f5e4a4f0301a5650daeec88a3a6..ba04d1418d6a15aeb7555f8c507bb438f157f892 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"
@@ -204,9 +204,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 +239,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 +360,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 +654,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 +677,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 +944,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 +1060,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);
@@ -1356,11 +1374,11 @@ void AliTRDCalibViewer::DumpCalibToTree(const Char_t* inFilename, const Char_t*
           Double_t rocMedian=0;
           
           if (calROC){
-            Int_t index = 0;
+            Int_t index2 = 0;
             for(Short_t iRow=0; iRow<nrows; iRow++) {
               for(Short_t iCol=0; iCol<ncols; iCol++) {
-                valueVector->GetMatrixArray()[index] = calROC->GetValue(iCol,iRow);
-                index++;
+                valueVector->GetMatrixArray()[index2] = calROC->GetValue(iCol,iRow);
+                index2++;
               }
             }
             rocMean   = calROC->GetMean();