]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PHOS/AliPHOSGetter.cxx
AliPHOSGeometry is removed from AliPHOSGetter and AliPHOSLoader
[u/mrichter/AliRoot.git] / PHOS / AliPHOSGetter.cxx
index e3e44c67b17c467a507052671ceebed3d0e80f5b..bbeb14e091fff254c37259e813c5c2229061dd7c 100644 (file)
@@ -46,7 +46,8 @@
 #include <TParticle.h>
 #include <TF1.h>
 #include <TGraph.h>
-//#include <TCanvas.h>
+#include <TCanvas.h>
+#include <TStyle.h>
 //#include <TFrame.h>
 
 // --- Standard library ---
 #include "AliPHOSBeamTestEvent.h"
 #include "AliPHOSGetter.h"
 #include "AliPHOSLoader.h"
+#include "AliPHOSPulseGenerator.h"
 #include "AliRunLoader.h"
 #include "AliStack.h"  
-#include "AliPHOSRawStream.h"
+#include "AliPHOSRawDecoder.h"
 #include "AliRawReaderFile.h"
 #include "AliLog.h"
 #include "AliCDBLocal.h"
 #include "AliCDBStorage.h"
+#include "AliCDBManager.h"
+#include "AliPHOSRawDigiProducer.h"
+#include "AliPHOSReconstructor.h"
+#include "AliPHOSRecoParam.h"
 
 ClassImp(AliPHOSGetter)
   
-AliPHOSGetter * AliPHOSGetter::fgObjGetter = 0 ; 
-AliPHOSLoader * AliPHOSGetter::fgPhosLoader = 0;
+AliPHOSGetter   * AliPHOSGetter::fgObjGetter  = 0 ; 
+AliPHOSLoader   * AliPHOSGetter::fgPhosLoader = 0;
+AliPHOSCalibData* AliPHOSGetter::fgCalibData  = 0;
 Int_t AliPHOSGetter::fgDebug = 0;
-AliPHOSCalibData* AliPHOSGetter::fCalibData = 0;
 
 //  TFile * AliPHOSGetter::fgFile = 0 ; 
 
+AliPHOSGetter::AliPHOSGetter() :
+  fBTE(0),
+  fLoadingStatus(),
+  fNPrimaries(0),
+  fPrimaries(0),
+  fESDFile(0),
+  fESDFileName(),
+  fESD(0),
+  fESDTree(0),
+  fRawDigits(kFALSE),
+  fcdb(0)
+{
+  // ctor: this is a singleton, the ctor should never be called but cint needs it as public
+  Fatal("ctor", "AliPHOSGetter is a singleton default ctor not callable") ;
+} 
+
+
 //____________________________________________________________________________ 
-AliPHOSGetter::AliPHOSGetter(const char* headerFile, const char* version, Option_t * openingOption)
+AliPHOSGetter::AliPHOSGetter(const char* headerFile, const char* version, Option_t * openingOption) :
+  fBTE(0),
+  fLoadingStatus(),
+  fNPrimaries(0),
+  fPrimaries(0),
+  fESDFile(0),
+  fESDFileName(),
+  fESD(0),
+  fESDTree(0),
+  fRawDigits(kFALSE),
+  fcdb(0)
 {
   // ctor only called by Instance()
 
@@ -115,6 +148,40 @@ AliPHOSGetter::AliPHOSGetter(const char* headerFile, const char* version, Option
 
 }
 
+AliPHOSGetter::AliPHOSGetter(const AliPHOSGetter & obj) :
+  TObject(obj),
+  fBTE(0),
+  fLoadingStatus(),
+  fNPrimaries(0),
+  fPrimaries(0),
+  fESDFile(0),
+  fESDFileName(),
+  fESD(0),
+  fESDTree(0),
+  fRawDigits(kFALSE),
+  fcdb(0)
+{
+  // cpy ctor requested by Coding Convention 
+  Fatal("cpy ctor", "not implemented") ;
+} 
+
+//____________________________________________________________________________ 
+AliPHOSGetter::AliPHOSGetter(Int_t /*i*/) :
+  fBTE(0),
+  fLoadingStatus(),
+  fNPrimaries(0),
+  fPrimaries(0),
+  fESDFile(0),
+  fESDFileName(),
+  fESD(0),
+  fESDTree(0),
+  fRawDigits(kFALSE),
+  fcdb(0)
+{
+  // special constructor for onflight 
+} 
+
+
 //____________________________________________________________________________ 
 AliPHOSGetter::~AliPHOSGetter()
 {
@@ -167,7 +234,7 @@ AliPHOSClusterizer * AliPHOSGetter::Clusterizer()
 }
 
 //____________________________________________________________________________ 
-TObjArray * AliPHOSGetter::CpvRecPoints() 
+TObjArray * AliPHOSGetter::CpvRecPoints() const
 {
   // asks the Loader to return the CPV RecPoints container 
 
@@ -182,7 +249,7 @@ TObjArray * AliPHOSGetter::CpvRecPoints()
 }
 
 //____________________________________________________________________________ 
-TClonesArray * AliPHOSGetter::Digits() 
+TClonesArray * AliPHOSGetter::Digits() const
 {
   // asks the Loader to return the Digits container 
 
@@ -211,7 +278,7 @@ AliPHOSDigitizer * AliPHOSGetter::Digitizer()
 
 
 //____________________________________________________________________________ 
-TObjArray * AliPHOSGetter::EmcRecPoints() 
+TObjArray * AliPHOSGetter::EmcRecPoints() const
 {
   // asks the Loader to return the EMC RecPoints container 
 
@@ -226,7 +293,7 @@ TObjArray * AliPHOSGetter::EmcRecPoints()
 }
 
 //____________________________________________________________________________ 
-TClonesArray * AliPHOSGetter::TrackSegments() 
+TClonesArray * AliPHOSGetter::TrackSegments() const
 {
   // asks the Loader to return the TrackSegments container 
 
@@ -254,7 +321,7 @@ AliPHOSTrackSegmentMaker * AliPHOSGetter::TrackSegmentMaker()
 }
 
 //____________________________________________________________________________ 
-TClonesArray * AliPHOSGetter::RecParticles() 
+TClonesArray * AliPHOSGetter::RecParticles() const
 {
   // asks the Loader to return the TrackSegments container 
 
@@ -334,12 +401,15 @@ void AliPHOSGetter::Event(Int_t event, const char* opt)
 
 
 //____________________________________________________________________________ 
-void AliPHOSGetter::Event(AliRawReader *rawReader, const char* opt) 
+void AliPHOSGetter::Event(AliRawReader *rawReader, const char* opt, Bool_t isOldRCUFormat
 {
   // Reads the raw event from rawReader
-
+  // isOldRCUFormat defines whenever to assume
+  // the old RCU format or not
+  
   if( strstr(opt,"W")  ){
-    ReadRaw(rawReader) ;
+    rawReader->NextEvent();
+    ReadRaw(rawReader,isOldRCUFormat) ;
   }    
  
 }
@@ -354,7 +424,7 @@ Int_t AliPHOSGetter::EventNumber() const
 }
 
 //____________________________________________________________________________ 
-  TClonesArray * AliPHOSGetter::Hits()  
+  TClonesArray * AliPHOSGetter::Hits() const
 {
   // asks the loader to return  the Hits container 
   
@@ -398,7 +468,7 @@ AliPHOSGetter * AliPHOSGetter::Instance(const char* alirunFileName, const char*
       }
     }
     else {
-      AliRunLoader * rl = AliRunLoader::GetRunLoader(fgPhosLoader->GetTitle()) ; 
+      rl = AliRunLoader::GetRunLoader(fgPhosLoader->GetTitle()) ; 
       if ( strstr(version, AliConfig::GetDefaultEventFolderName()) ) // false in case of merging
        delete rl ; 
       fgObjGetter = new AliPHOSGetter(alirunFileName, version, openingOption) ;      
@@ -476,17 +546,6 @@ AliPHOSPID * AliPHOSGetter::PID()
   return rv ; 
 }
 
-//____________________________________________________________________________ 
-AliPHOSGeometry * AliPHOSGetter::PHOSGeometry() const 
-{
-  // Returns PHOS geometry
-
-  AliPHOSGeometry * rv = 0 ; 
-  if (PHOS() )
-    rv =  PHOS()->GetGeometry() ;
-  return rv ; 
-} 
-
 //____________________________________________________________________________ 
 TClonesArray * AliPHOSGetter::Primaries()  
 {
@@ -555,21 +614,25 @@ Bool_t AliPHOSGetter::OpenESDFile()
 }
 
 //____________________________________________________________________________ 
-void AliPHOSGetter::FitRaw(Bool_t lowGainFlag, TGraph * gLowGain, TGraph * gHighGain, TF1* signalF, Int_t & amp, Double_t & time)
+void AliPHOSGetter::FitRaw(Bool_t lowGainFlag, TGraph * gLowGain, TGraph * gHighGain, TF1* signalF, Double_t & energy, Double_t & time) const
 {
   // Fits the raw signal time distribution 
 
   const Int_t kNoiseThreshold = 0 ;
   Double_t timezero1 = 0., timezero2 = 0., timemax = 0. ;
   Double_t signal = 0., signalmax = 0. ;       
-  Double_t energy = time = 0. ; 
+  time   = 0. ; 
+  energy = 0. ; 
+
+  // Create a shaper pulse object which contains all the shaper parameters
+  AliPHOSPulseGenerator pulse;
 
   if (lowGainFlag) {
     timezero1 = timezero2 = signalmax = timemax = 0. ;
-    signalF->FixParameter(0, PHOS()->GetRawFormatLowCharge()) ; 
-    signalF->FixParameter(1, PHOS()->GetRawFormatLowGain()) ; 
+    signalF->FixParameter(0, pulse.GetRawFormatLowCharge()) ; 
+    signalF->FixParameter(1, pulse.GetRawFormatLowGain()) ; 
     Int_t index ; 
-    for (index = 0; index < PHOS()->GetRawFormatTimeBins(); index++) {
+    for (index = 0; index < pulse.GetRawFormatTimeBins(); index++) {
       gLowGain->GetPoint(index, time, signal) ; 
       if (signal > kNoiseThreshold && timezero1 == 0.) 
        timezero1 = time ;
@@ -580,21 +643,22 @@ void AliPHOSGetter::FitRaw(Bool_t lowGainFlag, TGraph * gLowGain, TGraph * gHigh
        timemax   = time ; 
       }
     }
-    signalmax /= PHOS()->RawResponseFunctionMax(PHOS()->GetRawFormatLowCharge(), 
-                                               PHOS()->GetRawFormatLowGain()) ;
-    if ( timezero1 + PHOS()->GetRawFormatTimePeak() < PHOS()->GetRawFormatTimeMax() * 0.4 ) { // else its noise 
+    signalmax /= 
+      pulse.RawResponseFunctionMax(pulse.GetRawFormatLowCharge(), 
+                                  pulse.GetRawFormatLowGain()) ;
+    if ( timezero1 + pulse.GetRawFormatTimePeak() < pulse.GetRawFormatTimeMax() * 0.4 ) { // else its noise 
       signalF->SetParameter(2, signalmax) ; 
       signalF->SetParameter(3, timezero1) ;                
-      gLowGain->Fit(signalF, "QRON", "", 0., timezero2); //, "QRON") ; 
+      gLowGain->Fit(signalF, "QRO", "", 0., timezero2); //, "QRON") ; 
       energy = signalF->GetParameter(2) ; 
-      time   = signalF->GetMaximumX() - PHOS()->GetRawFormatTimePeak() - PHOS()->GetRawFormatTimeTrigger() ;
+      time   = signalF->GetMaximumX() - pulse.GetRawFormatTimePeak() - pulse.GetRawFormatTimeTrigger() ;
     }
   } else {
     timezero1 = timezero2 = signalmax = timemax = 0. ;
-    signalF->FixParameter(0, PHOS()->GetRawFormatHighCharge()) ; 
-    signalF->FixParameter(1, PHOS()->GetRawFormatHighGain()) ; 
+    signalF->FixParameter(0, pulse.GetRawFormatHighCharge()) ; 
+    signalF->FixParameter(1, pulse.GetRawFormatHighGain()) ; 
     Int_t index ; 
-    for (index = 0; index < PHOS()->GetRawFormatTimeBins(); index++) {
+    for (index = 0; index < pulse.GetRawFormatTimeBins(); index++) {
       gHighGain->GetPoint(index, time, signal) ;               
       if (signal > kNoiseThreshold && timezero1 == 0.) 
        timezero1 = time ;
@@ -605,132 +669,104 @@ void AliPHOSGetter::FitRaw(Bool_t lowGainFlag, TGraph * gLowGain, TGraph * gHigh
        timemax   = time ; 
       }
     }
-    signalmax /= PHOS()->RawResponseFunctionMax(PHOS()->GetRawFormatHighCharge(), 
-                                               PHOS()->GetRawFormatHighGain()) ;;
-    if ( timezero1 + PHOS()->GetRawFormatTimePeak() < PHOS()->GetRawFormatTimeMax() * 0.4 ) { // else its noise  
+    signalmax /= pulse.RawResponseFunctionMax(pulse.GetRawFormatHighCharge(), 
+                                             pulse.GetRawFormatHighGain()) ;;
+    if ( timezero1 + pulse.GetRawFormatTimePeak() < pulse.GetRawFormatTimeMax() * 0.4 ) { // else its noise  
       signalF->SetParameter(2, signalmax) ; 
       signalF->SetParameter(3, timezero1) ;               
-      gHighGain->Fit(signalF, "QRON", "", 0., timezero2) ; 
+      gHighGain->Fit(signalF, "QRO", "", 0., timezero2) ; 
       energy = signalF->GetParameter(2) ; 
-      time   = signalF->GetMaximumX() - PHOS()->GetRawFormatTimePeak() - PHOS()->GetRawFormatTimeTrigger() ;
+      time   = signalF->GetMaximumX() - pulse.GetRawFormatTimePeak() - pulse.GetRawFormatTimeTrigger() ;
     }
   }
-  
-  if (time == 0. && energy == 0.) 
-    amp = 0 ; 
-  else {
-  AliPHOSDigitizer * digitizer = Digitizer() ; 
-  amp = static_cast<Int_t>( (energy - digitizer->GetEMCpedestal()) / digitizer->GetEMCchannel() + 0.5 ) ; 
-  }
+  if (time == 0) energy = 0 ; 
 }
 
 //____________________________________________________________________________ 
-Int_t AliPHOSGetter::ReadRaw(AliRawReader *rawReader)
+Int_t AliPHOSGetter::CalibrateRaw(Double_t energy, Int_t *relId)
+{
+  // Convert energy into digitized amplitude for a cell relId
+  // It is a user responsilibity to open CDB and set
+  // AliPHOSCalibData object by the following operators:
+  // 
+  // AliCDBLocal *loc = new AliCDBLocal("deCalibDB");
+  // AliPHOSCalibData* clb = (AliPHOSCalibData*)AliCDBStorage::Instance()
+  //    ->Get(path_to_calibdata,run_number);
+  // AliPHOSGetter* gime = AliPHOSGetter::Instance("galice.root");
+  // gime->SetCalibData(clb);
+
+  if (CalibData() == 0)
+    Warning("CalibrateRaw","Calibration DB is not initiated!");
+
+  Int_t   module = relId[0];
+  Int_t   column = relId[3];
+  Int_t   row    = relId[2];
+
+  Float_t gainFactor = 0.0015; // width of one Emc ADC channel in GeV
+  Float_t pedestal   = 0.005;  // Emc pedestals
+
+  if(CalibData()) {
+    gainFactor = CalibData()->GetADCchannelEmc (module,column,row);
+    pedestal   = CalibData()->GetADCpedestalEmc(module,column,row);
+  }
+  
+  Int_t   amp = static_cast<Int_t>( (energy - pedestal) / gainFactor + 0.5 ) ; 
+  return amp;
+}
+//____________________________________________________________________________ 
+Int_t AliPHOSGetter::ReadRaw(AliRawReader *rawReader,Bool_t isOldRCUFormat)
 {
   // reads the raw format data, converts it into digits format and store digits in Digits()
   // container.
-
-  AliPHOSRawStream in(rawReader);
+  // isOldRCUFormat = kTRUE in case of the old RCU
+  // format used in the raw data readout.
+  // Reimplemented by Boris Polichtchouk (Jul 2006)
+  // to make it working with the Jul-Aug 2006 beam test data.
  
-  Bool_t first = kTRUE ;
-  
-  TF1 * signalF = new TF1("signal", AliPHOS::RawResponseFunction, 0, PHOS()->GetRawFormatTimeMax(), 4);
-  signalF->SetParNames("Charge", "Gain", "Amplitude", "TimeZero") ; 
+  //Create raw decoder.
+
+  AliPHOSRawDecoder dc(rawReader);
+  dc.SetOldRCUFormat(isOldRCUFormat);
+  dc.SubtractPedestals(AliPHOSReconstructor::GetRecoParamEmc()->SubtractPedestals());
 
-  Int_t relId[4], id ;
-  Bool_t lowGainFlag = kFALSE ; 
   TClonesArray * digits = Digits() ;
-  digits->Clear() ; 
-  Int_t idigit = 0 ; 
-  Int_t amp = 0 ; 
-  Double_t time = 0. ; 
-
-  TGraph * gLowGain = new TGraph(PHOS()->GetRawFormatTimeBins()) ; 
-  TGraph * gHighGain= new TGraph(PHOS()->GetRawFormatTimeBins()) ;  
-
-  while ( in.Next() ) { // PHOS entries loop 
-    if ( (in.IsNewRow() || in.IsNewColumn() || in.IsNewModule()) ) {
-      if (!first) {
-       FitRaw(lowGainFlag, gLowGain, gHighGain, signalF, amp, time) ; 
-       if (amp > 0) {
-         new((*digits)[idigit]) AliPHOSDigit( -1, id, amp, time) ;     
-         idigit++ ; 
-       }
-       Int_t index ; 
-       for (index = 0; index < PHOS()->GetRawFormatTimeBins(); index++) {
-         gLowGain->SetPoint(index, index * PHOS()->GetRawFormatTimeMax() / PHOS()->GetRawFormatTimeBins(), 0) ;  
-         gHighGain->SetPoint(index, index * PHOS()->GetRawFormatTimeMax() / PHOS()->GetRawFormatTimeBins(), 0) ; 
-       } 
-      }
-      first = kFALSE ; 
-      relId[0] = in.GetModule() ;
-      if ( relId[0] >= PHOS()->GetRawFormatLowGainOffset() ) { 
-       relId[0] -=  PHOS()->GetRawFormatLowGainOffset() ; 
-       lowGainFlag = kTRUE ; 
-      } else 
-       lowGainFlag = kFALSE ; 
-      relId[1] = 0 ; 
-      relId[2] = in.GetRow() ; 
-      relId[3] = in.GetColumn() ; 
-      PHOSGeometry()->RelToAbsNumbering(relId, id) ;   
+  AliPHOSRawDigiProducer pr;
+  pr.MakeDigits(digits,&dc);
+  
+  //ADC counts -> GeV
+  for(Int_t i=0; i<digits->GetEntries(); i++) {
+    AliPHOSDigit* digit = (AliPHOSDigit*)digits->At(i);
+    digit->SetEnergy(digit->GetEnergy()/AliPHOSPulseGenerator::GeV2ADC());
+  }
+  
+  //!!!!for debug!!!
+  Int_t modMax=-111;
+  Int_t colMax=-111;
+  Int_t rowMax=-111;
+  Float_t eMax=-333;
+  //!!!for debug!!!
+
+  AliPHOSGeometry * phosgeom =  AliPHOSGeometry::GetInstance() ;
+  Int_t relId[4];
+  for(Int_t iDigit=0; iDigit<digits->GetEntries(); iDigit++) {
+    AliPHOSDigit* digit = (AliPHOSDigit*)digits->At(iDigit);
+    if(digit->GetEnergy()>eMax) {
+      phosgeom->AbsToRelNumbering(digit->GetId(),relId);
+      eMax=digit->GetEnergy();
+      modMax=relId[0];
+      rowMax=relId[2];
+      colMax=relId[3];
     }
-    if (lowGainFlag)
-      gLowGain->SetPoint(in.GetTime(), 
-                    in.GetTime()* PHOS()->GetRawFormatTimeMax() / PHOS()->GetRawFormatTimeBins(), 
-                    in.GetSignal()) ;
-    else 
-      gHighGain->SetPoint(in.GetTime(), 
-                        in.GetTime() * PHOS()->GetRawFormatTimeMax() / PHOS()->GetRawFormatTimeBins(), 
-                        in.GetSignal() ) ;
-
-  } // PHOS entries loop
-
-  FitRaw(lowGainFlag, gLowGain, gHighGain, signalF, amp, time) ; 
-  if (amp > 0 ) {
-    new((*digits)[idigit]) AliPHOSDigit( -1, id, amp, time) ;
-    idigit++ ; 
   }
-  digits->Sort() ; 
 
-  delete signalF ; 
-  delete gLowGain, gHighGain ; 
-  
+  AliDebug(1,Form("Digit with max. energy:  modMax %d colMax %d rowMax %d  eMax %f\n\n",
+                 modMax,colMax,rowMax,eMax));
+
   return digits->GetEntriesFast() ; 
 }
 
-//   TClonesArray * digits = Digits() ;
-//   digits->Clear() ; 
-//   Int_t idigit = 0 ; 
-
-//   while ( in.Next() ) { // PHOS entries loop 
-//     Int_t amp = in.GetSignal() ; 
-//     Double_t time = in.GetTime() ; 
-//     Int_t relId[4], id ;
-
-//     relId[0] = in.GetModule() ;
-//     if ( relId[0] >= PHOS()->GetRawFormatLowGainOffset() ) { 
-//       relId[0] -=  PHOS()->GetRawFormatLowGainOffset() ; 
-//     }
-//     relId[1] = 0 ; 
-//     relId[2] = in.GetRow() ; 
-//     relId[3] = in.GetColumn() ; 
-//     PHOSGeometry()->RelToAbsNumbering(relId, id) ;  
-    
-//     if (amp > 0 && id >=0 ) {
-//       new((*digits)[idigit]) AliPHOSDigit( -1, id, amp, time) ;     
-//       idigit++ ; 
-//     }
-    
-//   } // PHOS entries loop
-  
-//   digits->Sort() ; 
-  
-//   return digits->GetEntriesFast() ; 
-// }
 //____________________________________________________________________________ 
-Int_t AliPHOSGetter::ReadTreeD()
+Int_t AliPHOSGetter::ReadTreeD() const
 {
   // Read the Digits
   
@@ -741,7 +777,7 @@ Int_t AliPHOSGetter::ReadTreeD()
 }
 
 //____________________________________________________________________________ 
-Int_t AliPHOSGetter::ReadTreeH()
+Int_t AliPHOSGetter::ReadTreeH() const
 {
   // Read the Hits
   PhosLoader()->CleanHits() ;
@@ -754,7 +790,7 @@ Int_t AliPHOSGetter::ReadTreeH()
 }
 
 //____________________________________________________________________________ 
-Int_t AliPHOSGetter::ReadTreeR()
+Int_t AliPHOSGetter::ReadTreeR() const
 {
   // Read the RecPoints
   
@@ -762,7 +798,6 @@ Int_t AliPHOSGetter::ReadTreeR()
   // gets TreeR from the root file (PHOS.RecPoints.root)
   //if ( !IsLoaded("R") ) {
     PhosLoader()->LoadRecPoints("UPDATE") ;
-    PhosLoader()->LoadClusterizer("UPDATE") ;
     //  SetLoaded("R") ; 
     //}
 
@@ -770,7 +805,7 @@ Int_t AliPHOSGetter::ReadTreeR()
 }
 
 //____________________________________________________________________________ 
-Int_t AliPHOSGetter::ReadTreeT()
+Int_t AliPHOSGetter::ReadTreeT() const
 {
   // Read the TrackSegments
   
@@ -785,7 +820,7 @@ Int_t AliPHOSGetter::ReadTreeT()
   return TrackSegments()->GetEntries() ; 
 }
 //____________________________________________________________________________ 
-Int_t AliPHOSGetter::ReadTreeP()
+Int_t AliPHOSGetter::ReadTreeP() const
 {
   // Read the RecParticles
   
@@ -801,7 +836,7 @@ Int_t AliPHOSGetter::ReadTreeP()
   return RecParticles()->GetEntries() ; 
 }
 //____________________________________________________________________________ 
-Int_t AliPHOSGetter::ReadTreeS()
+Int_t AliPHOSGetter::ReadTreeS() const
 {
   // Read the SDigits
   
@@ -840,7 +875,7 @@ Int_t AliPHOSGetter::ReadTreeE(Int_t event)
 }
 
 //____________________________________________________________________________ 
-TClonesArray * AliPHOSGetter::SDigits() 
+TClonesArray * AliPHOSGetter::SDigits() const
 {
   // asks the Loader to return the Digits container 
 
@@ -1050,14 +1085,7 @@ Float_t AliPHOSGetter::BeamEnergy(void) const
 
 AliPHOSCalibData* AliPHOSGetter::CalibData()
 { 
+  // Check if the instance of AliPHOSCalibData exists, and return it
 
-  if(!AliCDBStorage::Instance()) {
-    fCalibData=0x0;
-    Warning("CalibData","Calibration DB is not initiated!");
-    return fCalibData;
-  }
-
-  return fCalibData;
-
-  
+  return fgCalibData;
 }