]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliCaloRawAnalyzerPeakFinder.cxx
coverity fixes
[u/mrichter/AliRoot.git] / EMCAL / AliCaloRawAnalyzerPeakFinder.cxx
index 6a5a993b3d31facde0f7ea9e1c9f83cfbfe8d146..0d58208cf769633382a85a91429913a359709bb9 100644 (file)
@@ -40,6 +40,7 @@
 using namespace std;
 
 
+
 ClassImp( AliCaloRawAnalyzerPeakFinder )
 
 
@@ -159,11 +160,8 @@ AliCaloRawAnalyzerPeakFinder::Evaluate( const vector<AliCaloBunchInfo> &bunchvec
              int n = last - first;  
              int pfindex = n - fNsampleCut; 
              pfindex = pfindex > PF::SAMPLERANGE ? PF::SAMPLERANGE : pfindex;
-
              int dt =  maxampindex - startbin -2; 
              int tmpindex = 0;
-
-
              Float_t tmptof = ScanCoarse( &fReversed[dt] , n );
              
              if( tmptof < -1 )
@@ -181,26 +179,24 @@ AliCaloRawAnalyzerPeakFinder::Evaluate( const vector<AliCaloBunchInfo> &bunchvec
                  }
 
              double tof = 0;
-           
              for(int k=0; k < PF::SAMPLERANGE; k++   )
                {
                  tof +=  fPFTofVectors[0][pfindex][k]*fReversed[ dt  +k + tmpindex -1 ];   
                }
-           
              for( int i=0; i < PF::SAMPLERANGE; i++ )
                {
                  {
+                   
                    fAmp += fPFAmpVectors[0][pfindex][i]*fReversed[ dt  +i  +tmpindex -1 ];
                  }
                }
+
              if( TMath::Abs(  (maxf - fAmp  )/maxf )  >   0.1 )
                {
                  fAmp = maxf;
                }
              
              tof = timebinOffset - 0.01*tof/fAmp - fL1Phase/TIMEBINWITH; // clock
-             
-             // use local-array time for chi2 estimate
              Float_t chi2 = CalculateChi2(fAmp, tof-timebinOffset+maxrev, first, last);
              Int_t ndf = last - first - 1; // nsamples - 2
              return AliCaloFitResults( maxamp, ped , Ret::kFitPar, fAmp, tof, 
@@ -254,8 +250,8 @@ AliCaloRawAnalyzerPeakFinder::LoadVectorsOCDB()
   
   if( entry != 0 )
   {
-    cout << __FILE__ << ":" << __LINE__ << ": Printing metadata !! " << endl;
-    entry->PrintMetaData();
+    //cout << __FILE__ << ":" << __LINE__ << ": Printing metadata !! " << endl;
+    //entry->PrintMetaData();
     AliCaloPeakFinderVectors  *pfv = (AliCaloPeakFinderVectors *)entry->GetObject(); 
     if( pfv == 0 )
     {
@@ -271,67 +267,9 @@ AliCaloRawAnalyzerPeakFinder::LoadVectorsOCDB()
 }
 
 
-void 
-AliCaloRawAnalyzerPeakFinder::LoadVectorsASCII()
-{
-  //Read in the Peak finder vecors from ASCI files
-  fIsInitialized= true;  
-  const Int_t buffersize = 256;
-  for(int i = 0;  i < PF::MAXSTART ; i++)
-  {
-    for( int j=0; j < PF::SAMPLERANGE; j++)
-    {
-      char filenameCoarse[buffersize];
-      char filename[buffersize];
-      int n = j+fNsampleCut;
-      double start = (double)i+0;
-      
-      snprintf(filename, buffersize,       "%s/EMCAL/vectors-emcal/start%.1fN%dtau0.235fs10dt1.0.txt", getenv("ALICE_ROOT"), start, n);
-      snprintf(filenameCoarse, buffersize, "%s/EMCAL/vectors-emcal/start%.1fN%dtau0.235fs10dt3.0.txt", getenv("ALICE_ROOT"), start, n);
-      
-      FILE *fp  =  fopen(filename, "r");
-      FILE *fpc =  fopen(filenameCoarse, "r");
-      
-      if( fp == 0 )
-           {
-             AliFatal( Form( "could not open file: %s", filename ) );
-           }
-      else if(fpc == 0)
-           {
-             AliFatal( Form( "could not open file: %s", filenameCoarse ) );
-           }
-      else
-           {
-             for(int m = 0; m < n ; m++ )
-        {
-          fscanf(fp,  "%lf\t", &fPFAmpVectors[i][j][m] );
-          fscanf(fpc, "%lf\t", &fPFAmpVectorsCoarse[i][j][m] );
-        }
-             fscanf(fp,   "\n" );
-             fscanf(fpc,  "\n" );
-             for(int m = 0; m < n ; m++ )
-        {
-          fscanf(fp, "%lf\t",   &fPFTofVectors[i][j][m]  );
-          fscanf(fpc, "%lf\t",  &fPFTofVectorsCoarse[i][j][m]  );  
-        }
-             
-             fPeakFinderVectors->SetVector( i, j, fPFAmpVectors[i][j], fPFTofVectors[i][j],    
-                                      fPFAmpVectorsCoarse[i][j], fPFTofVectorsCoarse[i][j] );   
-        
-           }
-      
-      if(fp) fclose (fp );
-      if(fpc)fclose (fpc);
-      
-    }
-  }
-}
-
-
 void   
 AliCaloRawAnalyzerPeakFinder::WriteRootFile() const
-{
-  // Utility function to write Peak-Finder vectors to an root file
+{ // Utility function to write Peak-Finder vectors to an root file
   // The output is used to create an OCDB entry.
   fPeakFinderVectors->PrintVectors();
   TFile *f = new TFile("peakfindervectors2.root",  "recreate" );
@@ -343,7 +281,7 @@ AliCaloRawAnalyzerPeakFinder::WriteRootFile() const
 
 void 
 AliCaloRawAnalyzerPeakFinder::PrintVectors()
-{
+{ // Utility function to write Peak-Finder vectors 
   for(int i=0; i < 20; i++)
     {
       for( int j = 0; j < PF::MAXSTART; j ++ )