]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PMD/AliPMDCalibGain.cxx
If default parameters are allowed and runNumber is provided, search first for the...
[u/mrichter/AliRoot.git] / PMD / AliPMDCalibGain.cxx
index 61e3d12fa8c955d15a502ad728d5a542b3fb18a2..b1af5003e6fa06d7d1d15845e0a60fd9abf0709b 100644 (file)
@@ -16,6 +16,7 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
+#include "Riostream.h"
 #include "TF1.h"
 #include "TFile.h"
 #include "TObjString.h"
@@ -36,6 +37,7 @@
 #include "AliPMDddldata.h"
 #include "AliPMDCalibGain.h"
 
+using std::ifstream;
 ClassImp(AliPMDCalibGain)
 
 AliPMDCalibGain::AliPMDCalibGain():
@@ -143,8 +145,8 @@ Int_t AliPMDCalibGain::ExtractPedestal(const Char_t *rootFile)
   // Pedestal extraction from the PMD_PED.root file
   // To be called once at the beginning
   
-  Int_t   det, sm, row, col;
-  Float_t mean, rms;
+  Int_t   det=0, sm=0, row=0, col=0;
+  Float_t mean=0., rms=0.;
   
   TFile *pedfile = new TFile(rootFile);
   
@@ -187,15 +189,28 @@ Int_t AliPMDCalibGain::ExtractHotChannel(const Char_t *rootFile)
   // HotChannel extraction from the PMD_HOT.root file
   // To be called once at the beginning
 
-  Int_t   det, sm, row, col;
-  Float_t flag;
+  Int_t   det=0, sm=0, row=0, col=0;
+  Float_t flag=0.;
 
   TFile *hotmapfile = new TFile(rootFile);
 
   if(!hotmapfile)
     {
-      printf(" NO HOTCHANNEL MAP FOUND (PMD_HOT.root) FILE IS FOUND \n");
-      fHotFlag[kDet][kMaxSMN][kMaxRow][kMaxCol] = 0.;
+      printf(" NO HOTCHANNEL MAP (PMD_HOT.root) FILE IS FOUND \n");
+
+      for (Int_t idet = 0; idet < kDet; idet++)
+       {
+         for (Int_t ismn = 0; ismn < kMaxSMN; ismn++)
+           {
+             for (Int_t irow = 0; irow < kMaxRow; irow++)
+               {
+                 for (Int_t icol = 0; icol < kMaxCol; icol++)
+                   {
+                     fHotFlag[idet][ismn][irow][icol] = 0.;
+                   }
+               }
+           }
+       }
     }
 
 
@@ -231,18 +246,19 @@ void AliPMDCalibGain::ReadTempFile(const Char_t *tempFile)
 {
   // Read the variables from the file
   
-  fpw = fopen(tempFile,"r");
-  
-  Float_t smcount, smiso;
-  Float_t cellcount, celliso;
+  ifstream intmpfile;
+  intmpfile.open(tempFile);
+
+  Int_t iddet = 0, issm = 0, irrow = 0, iccol = 0;
+  Float_t smcount = 0., smiso = 0.;
+  Float_t cellcount = 0., celliso = 0.;
 
 
   for (Int_t idet = 0; idet < kDet; idet++)
     {
       for (Int_t ism = 0; ism < kMaxSMN; ism++)
        {
-         fscanf(fpw,"%d %d %f %f",&idet,&ism,&smcount,&smiso);
-         
+         intmpfile >> iddet >> issm >> smcount >> smiso;
          fSMCount[idet][ism] = smcount;
          fSMIso[idet][ism]   = smiso;
        }
@@ -256,9 +272,8 @@ void AliPMDCalibGain::ReadTempFile(const Char_t *tempFile)
            {
              for (Int_t icol = 0; icol < kMaxCol; icol++)
                {
-                 fscanf(fpw,"%d %d %d %d %f %f",&idet,&ism,&irow,&icol,
-                        &cellcount,&celliso);
-                 
+                 intmpfile >> iddet >> issm >> irrow >> iccol
+                           >> cellcount >> celliso;
                  fCellCount[idet][ism][irow][icol] = cellcount;
                  fCellIso[idet][ism][irow][icol]   = celliso;
                }
@@ -266,7 +281,8 @@ void AliPMDCalibGain::ReadTempFile(const Char_t *tempFile)
        }
     }
   
-  fclose(fpw);
+
+  intmpfile.close();
 
 }
 // ------------------------------------------------------------------------ //
@@ -333,8 +349,8 @@ Bool_t AliPMDCalibGain::ProcessEvent(AliRawReader *rawReader, TObjArray *pmdddlc
   Int_t neibx[6] = {1,0,-1,-1,0,1};
   Int_t neiby[6] = {0,1,1,0,-1,-1};
   
-  Int_t id1,jd1;  //neighbour row/col
-  Int_t isocount; //number of neighbours with 0 signal
+  Int_t id1 = 0,jd1 = 0;  //neighbour row/col
+  Int_t isocount = 0;     //number of neighbours with 0 signal
 
   Float_t d1[kDet][kMaxSMN][kMaxRow][kMaxCol];
   
@@ -466,8 +482,8 @@ Bool_t AliPMDCalibGain::ProcessEvent(AliRawReader *rawReader, TObjArray *pmdddlc
 void AliPMDCalibGain::Analyse(TTree *gaintree, TTree *meantree)
 {
   // Calculates the mean
-  Int_t   det, sm, row, col;
-  Float_t gain;
+  Int_t   det = 0, sm = 0, row = 0, col = 0;
+  Float_t gain = 0.;
   Float_t cellmean = 0.;
 
   Float_t modmean[2][24];
@@ -542,11 +558,11 @@ void AliPMDCalibGain::Analyse(TTree *gaintree, TTree *meantree)
 void AliPMDCalibGain::FindHotCell(TTree *hottree, Float_t xvar)
 {
   // Calculates the mean
-  Int_t   det, sm, row, col;
-  Float_t flag;
-  Float_t meannhit;
-  Float_t meanSqnhit;
-  Float_t sigmanhit,nhitcut;
+  Int_t   det = 0, sm = 0, row = 0, col = 0;
+  Float_t flag = 0.;
+  Float_t meannhit = 0.;
+  Float_t meanSqnhit = 0.;
+  Float_t sigmanhit = 0.,nhitcut = 0.;
 
   //Float_t xvar = 5.;