]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliCaloRawAnalyzerPeakFinder.cxx
Getting keyword substitution to work.
[u/mrichter/AliRoot.git] / EMCAL / AliCaloRawAnalyzerPeakFinder.cxx
index 45c99dcfbc543a5c7ee433304d195a6939f69dba..43934f12e41f77a3d0bc81e1f785785fe3f533cc 100644 (file)
@@ -63,8 +63,14 @@ 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()->HasStorage("alien://$ALICE_ROOT/OCDB")  == false  &&  AliCDBManager::Instance()->HasStorage("local://$ALICE_ROOT/OCDB") == false )
+  if( !AliCDBManager::Instance()->IsDefaultStorageSet ())
+    {
+      AliCDBManager::Instance()->SetDefaultStorage(  alien == true ? "alien://$ALICE_ROOT/OCDB" : "local://$ALICE_ROOT/OCDB" );
+      AliCDBManager::Instance()->SetRun(100);
+    }
 }
 
 
@@ -251,24 +257,27 @@ AliCaloRawAnalyzerPeakFinder::LoadVectorsOCDB()
   //Loading of Peak-Finder  vectors from the 
   //Offline Condition Database  (OCDB)
   AliCDBEntry* entry = AliCDBManager::Instance()->Get("EMCAL/Calib/PeakFinder/");
-  cout << __FILE__ << ":" << __LINE__ << ": Printing metadata !! " << endl;
-  entry->PrintMetaData();
-
+  
   if( entry != 0 )
+  {
+    
+    cout << __FILE__ << ":" << __LINE__ << ": Printing metadata !! " << endl;
+    entry->PrintMetaData();
+
+    AliCaloPeakFinderVectors  *pfv = (AliCaloPeakFinderVectors *)entry->GetObject(); 
+    if( pfv == 0 )
     {
-      AliCaloPeakFinderVectors  *pfv = (AliCaloPeakFinderVectors *)entry->GetObject(); 
-      if( pfv == 0 )
-       {
-         cout << __FILE__ << ":" << __LINE__ << "_ ERRROR " << endl;
-       }
-  
-      CopyVectors( pfv );
-      
-      if( pfv != 0 )
-       {
-         fIsInitialized = true;
-       }
+      cout << __FILE__ << ":" << __LINE__ << "_ ERRROR " << endl;
+    }
+    
+    CopyVectors( pfv );
+    
+    if( pfv != 0 )
+    {
+      fIsInitialized = true;
     }
+  }
+  
 }
 
 
@@ -305,7 +314,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" );
@@ -319,9 +328,11 @@ AliCaloRawAnalyzerPeakFinder::LoadVectorsASCII()
              fPeakFinderVectors->SetVector( i, j, fPFAmpVectors[i][j], fPFTofVectors[i][j],    
                                       fPFAmpVectorsCoarse[i][j], fPFTofVectorsCoarse[i][j] );   
         
-             fclose (fp);
-             fclose (fpc);
            }
+      
+      if(fp) fclose (fp );
+      if(fpc)fclose (fpc);
+      
     }
   }
 }