]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliEMCALLoader.cxx
Update (Rossella)
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALLoader.cxx
index 21fa357c1ba50c60f10c745f84a6ca28af667f7d..f11037522e0044cd71a0d5ed2a5bd52d80cd38bd 100644 (file)
 
 ClassImp(AliEMCALLoader)
   
-const TString AliEMCALLoader::fgkECARecPointsBranchName("EMCALECARP");//Name for branch with ECA Reconstructed Points
-AliEMCALCalibData*    AliEMCALLoader::fgCalibData = 0; //calibation data
+const TString         AliEMCALLoader::fgkECARecPointsBranchName("EMCALECARP");//Name for branch with ECA Reconstructed Points
+AliEMCALCalibData*    AliEMCALLoader::fgCalibData = 0; //calibration data
 AliCaloCalibPedestal* AliEMCALLoader::fgCaloPed   = 0; //dead map data
+AliEMCALSimParam*     AliEMCALLoader::fgSimParam  = 0; //simulation parameters
 
 //____________________________________________________________________________ 
 AliEMCALLoader::AliEMCALLoader()
@@ -162,6 +163,26 @@ AliCaloCalibPedestal* AliEMCALLoader::PedestalData()
        
 }
 
+//____________________________________________________________________________ 
+AliEMCALSimParam* AliEMCALLoader::SimulationParameters()
+{ 
+       // Check if the instance of AliEMCALSimParam exists, if not, create it if 
+       // the OCDB is available, and finally return it.
+       
+       if(!fgSimParam && (AliCDBManager::Instance()->IsDefaultStorageSet()))
+    {
+               AliCDBEntry *entry = (AliCDBEntry*) 
+               AliCDBManager::Instance()->Get("EMCAL/Calib/SimParam");
+               if (entry) fgSimParam =  (AliEMCALSimParam*) entry->GetObject();
+       
+    }
+       
+       if(!fgSimParam)
+               AliFatal("Simulations parameters not found in CDB!");
+
+       return fgSimParam;
+       
+}
 
 //____________________________________________________________________________ 
 Int_t AliEMCALLoader::CalibrateRaw(Double_t energy, Int_t module, 
@@ -214,7 +235,8 @@ Int_t AliEMCALLoader::GetEvent()
      TBranch * branchH = treeH->GetBranch(fDetectorName);
      branchH->SetAddress(&tempArr);
      for (Int_t iEnt = 0; iEnt < nEnt; iEnt++) {
-       treeH->GetEntry(iEnt);
+       //treeH->GetEntry(iEnt);
+          branchH->GetEntry(iEnt);
        Int_t nHit = tempArr->GetEntriesFast();
        for (Int_t iHit = 0; iHit < nHit; iHit++) {
         new ((*fHits)[index]) AliEMCALHit(*((AliEMCALHit*)tempArr->At(iHit)));
@@ -237,7 +259,8 @@ Int_t AliEMCALLoader::GetEvent()
        fSDigits->Clear();
      }
      branchS->SetAddress(&fSDigits);
-     treeS->GetEvent(0);
+        branchS->GetEntry(0);
+     //treeS->GetEvent(0);
    }
    
    // Digits
@@ -249,7 +272,8 @@ Int_t AliEMCALLoader::GetEvent()
        fDigits->Clear();
      }
      branchD->SetAddress(&fDigits);
-     treeD->GetEvent(0);
+        branchD->GetEntry(0);
+     //treeD->GetEvent(0);
    }
 
    // RecPoints
@@ -261,7 +285,8 @@ Int_t AliEMCALLoader::GetEvent()
        fRecPoints->Clear();
      }
      branchR->SetAddress(&fRecPoints);
-     treeR->GetEvent(0);
+     //treeR->GetEvent(0);
+        branchR->GetEntry(0);
    }
    
    return 0;