]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliCaloRawAnalyzerPeakFinder.cxx
remove print
[u/mrichter/AliRoot.git] / EMCAL / AliCaloRawAnalyzerPeakFinder.cxx
index 0b406da8ef5a93dc956bb0b3f669ea2c27c3a7fe..c423b9623bc73c9194c1d6a8a2ffe39b2622ec65 100644 (file)
@@ -36,7 +36,6 @@
 #include "TFile.h"
 #include "AliCaloPeakFinderVectors.h"
 #include <iostream>
-//#include "AliEMCALRawUtils.h"
 
 using namespace std;
 
@@ -45,7 +44,6 @@ ClassImp( AliCaloRawAnalyzerPeakFinder )
 
 
 AliCaloRawAnalyzerPeakFinder::AliCaloRawAnalyzerPeakFinder() :AliCaloRawAnalyzer("Peak-Finder", "PF"),  
-//    fAmp(0),
                                                              fPeakFinderVectors(0),
                                                              fRunOnAlien(false),
                                                              fIsInitialized(false)
@@ -63,8 +61,11 @@ void
 AliCaloRawAnalyzerPeakFinder::InitOCDB(bool alien) const
 {
   // Setting the default OCDB pathe depending on wether we work locally or on the GRID.
-  AliCDBManager::Instance()->SetDefaultStorage(  alien == true ? "alien://$ALICE_ROOT/OCDB" : "local://$ALICE_ROOT/OCDB");
-  AliCDBManager::Instance()->SetRun(100);
+  if( !AliCDBManager::Instance()->IsDefaultStorageSet ())
+    {
+      AliCDBManager::Instance()->SetDefaultStorage(  alien == true ? "alien://$ALICE_ROOT/OCDB" : "local://$ALICE_ROOT/OCDB" );
+      AliCDBManager::Instance()->SetRun(100);
+    }
 }
 
 
@@ -118,6 +119,7 @@ AliCaloRawAnalyzerPeakFinder::ScanCoarse(const Double_t *const array, const int
 AliCaloFitResults 
 AliCaloRawAnalyzerPeakFinder::Evaluate( const vector<AliCaloBunchInfo> &bunchvector, const UInt_t altrocfg1,  const UInt_t altrocfg2 )
 {
+  // Evaluation of amplitude and TOF
   if( fIsInitialized == false )
     {
       cout << __FILE__ << ":" << __LINE__ << "ERROR, peakfinder vectors not loaded" << endl;
@@ -193,13 +195,11 @@ AliCaloRawAnalyzerPeakFinder::Evaluate( const vector<AliCaloBunchInfo> &bunchvec
                }
              if( TMath::Abs(  (maxf - fAmp  )/maxf )  >   0.1 )
                {
-                 //      cout << __FILE__ << ":" << __LINE__ << "WARNING: amp was" << fAmp <<", but was changed to "<< maxf << endl;
                  fAmp = maxf;
                }
              
-             //      tof = timebinOffset - 0.01*tof/fAmp; // clock ticks
              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
@@ -231,7 +231,7 @@ AliCaloRawAnalyzerPeakFinder::CopyVectors( const AliCaloPeakFinderVectors *const
          for( int j=0; j < PF::SAMPLERANGE; j++)  
            {
              pfv->GetVector( i, j, fPFAmpVectors[i][j] ,  fPFTofVectors[i][j],    
-                             fPFAmpVectorsCoarse[i][j] , fPFTofVectorsCoarse[i][j]  ); 
+                             fPFAmpVectorsCoarse[i][j] , fPFTofVectorsCoarse[i][j]  ); 
 
              fPeakFinderVectors->SetVector( i, j, fPFAmpVectors[i][j], fPFTofVectors[i][j],    
                                             fPFAmpVectorsCoarse[i][j], fPFTofVectorsCoarse[i][j] );   
@@ -254,16 +254,13 @@ 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 )
     {
       cout << __FILE__ << ":" << __LINE__ << "_ ERRROR " << endl;
     }
-    
     CopyVectors( pfv );
     
     if( pfv != 0 )
@@ -271,7 +268,6 @@ AliCaloRawAnalyzerPeakFinder::LoadVectorsOCDB()
       fIsInitialized = true;
     }
   }
-  
 }
 
 
@@ -308,7 +304,7 @@ AliCaloRawAnalyzerPeakFinder::LoadVectorsASCII()
            {
              for(int m = 0; m < n ; m++ )
         {
-          fscanf(fp, "%lf\t", &fPFAmpVectors[i][j][m] );
+          fscanf(fp,  "%lf\t", &fPFAmpVectors[i][j][m] );
           fscanf(fpc, "%lf\t", &fPFAmpVectorsCoarse[i][j][m] );
         }
              fscanf(fp,   "\n" );
@@ -322,12 +318,10 @@ AliCaloRawAnalyzerPeakFinder::LoadVectorsASCII()
              fPeakFinderVectors->SetVector( i, j, fPFAmpVectors[i][j], fPFTofVectors[i][j],    
                                       fPFAmpVectorsCoarse[i][j], fPFTofVectorsCoarse[i][j] );   
         
-             fclose (fp);
-             fclose (fpc);
            }
       
-      delete fp;
-      delete fpc;
+      if(fp) fclose (fp );
+      if(fpc)fclose (fpc);
       
     }
   }