]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliCaloRawAnalyzerPeakFinder.cxx
correct mask for V0 charge decoding in STU payload
[u/mrichter/AliRoot.git] / EMCAL / AliCaloRawAnalyzerPeakFinder.cxx
index c423b9623bc73c9194c1d6a8a2ffe39b2622ec65..24f7df1dfba1ff74bed997f5d82c70a2983802c9 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, 
@@ -291,6 +287,9 @@ AliCaloRawAnalyzerPeakFinder::LoadVectorsASCII()
       
       FILE *fp  =  fopen(filename, "r");
       FILE *fpc =  fopen(filenameCoarse, "r");
+
+      int status = 0;
+      int statusc = 0;
       
       if( fp == 0 )
            {
@@ -303,17 +302,23 @@ AliCaloRawAnalyzerPeakFinder::LoadVectorsASCII()
       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" );
+               {
+                 status = fscanf(fp,  "%lf\t", &fPFAmpVectors[i][j][m] );
+                 statusc = fscanf(fpc, "%lf\t", &fPFAmpVectorsCoarse[i][j][m] );
+                 if (!status) { AliFatal( Form( "could not read file: %s", filename ) ); }
+                 if (!statusc) { AliFatal( Form( "could not read file: %s", filenameCoarse ) ); }
+               }
+             status = fscanf(fp,   "\n" );
+             statusc = fscanf(fpc,  "\n" );
+             if (status < 0) { AliFatal( Form( "could not read file: %s", filename ) ); }
+             if (statusc < 0) { AliFatal( Form( "could not read file: %s", filenameCoarse ) ); }
              for(int m = 0; m < n ; m++ )
-        {
-          fscanf(fp, "%lf\t",   &fPFTofVectors[i][j][m]  );
-          fscanf(fpc, "%lf\t",  &fPFTofVectorsCoarse[i][j][m]  );  
-        }
+               {
+                 status = fscanf(fp, "%lf\t",   &fPFTofVectors[i][j][m]  );
+                 statusc = fscanf(fpc, "%lf\t",  &fPFTofVectorsCoarse[i][j][m]  );  
+                 if (!status) { AliFatal( Form( "could not read file: %s", filename ) ); }
+                 if (!statusc) { AliFatal( Form( "could not read file: %s", filenameCoarse ) ); }
+               }
              
              fPeakFinderVectors->SetVector( i, j, fPFAmpVectors[i][j], fPFTofVectors[i][j],    
                                       fPFAmpVectorsCoarse[i][j], fPFTofVectorsCoarse[i][j] );