#include "AliCDBStorage.h"
#include "AliCDBManager.h"
#include "AliCDBEntry.h"
-#include "AliEMCALHit.h"
ClassImp(AliEMCALLoader)
const TString AliEMCALLoader::fgkECARecPointsBranchName("EMCALECARP");//Name for branch with ECA Reconstructed Points
const TString AliEMCALLoader::fgkECADigitsBranchName("DIGITS");//Name for branch with ECA Digits
const TString AliEMCALLoader::fgkECASDigitsBranchName("SDIGITS");//Name for branch with ECA SDigits
-const TString AliEMCALLoader::fgkECAHitsBranchName("HITS");//Name for branch with ECA Hits
AliEMCALCalibData* AliEMCALLoader::fgCalibData = 0; //calibration data
-//AliCaloCalibPedestal* AliEMCALLoader::fgCaloPed = 0; //dead map data
+AliCaloCalibPedestal* AliEMCALLoader::fgCaloPed = 0; //dead map data
AliEMCALSimParam* AliEMCALLoader::fgSimParam = 0; //simulation parameters
+AliEMCALRecParam* AliEMCALLoader::fgRecParam = 0; //reconstruction parameters
//____________________________________________________________________________
AliEMCALLoader::AliEMCALLoader()
- : fDebug(0)
+: fDebug(0)
{
//Default constructor for EMCAL Loader Class
-
+
}
//____________________________________________________________________________
: AliLoader(detname,eventfoldername), fDebug(0)
{
//Specific constructor for EMCAL Loader class
+
}
//____________________________________________________________________________
: AliLoader(name,topfolder), fDebug(0)
{
//Specific constructor for EMCAL Loader class
+
}
//____________________________________________________________________________
// Disconnect trees and remove arrays
if (TreeH())
TreeH()->SetBranchAddress(fDetectorName,0);
- if (TreeD())
- TreeD()->SetBranchAddress(fDetectorName,0);
- if (TreeS())
- TreeS()->SetBranchAddress(fDetectorName,0);
- if (TreeR())
- TreeR()->SetBranchAddress(fgkECARecPointsBranchName,0);
+// if (TreeD())
+// TreeD()->SetBranchAddress(fDetectorName,0);
+// if (TreeS())
+// TreeS()->SetBranchAddress(fDetectorName,0);
+// if (TreeR())
+// TreeR()->SetBranchAddress(fgkECARecPointsBranchName,0);
+
+ Clean(fgkECASDigitsBranchName);
+ Clean(fgkECADigitsBranchName);
+ Clean(fgkECARecPointsBranchName);
+
+ AliLoader::CleanFolders();
+
}
//____________________________________________________________________________
}
//____________________________________________________________________________
-//AliCaloCalibPedestal* AliEMCALLoader::PedestalData()
-//{
-// // Check if the instance of AliCaloCalibPedestal exists, if not, create it if
-// // the OCDB is available, and finally return it.
-//
-// if(!fgCaloPed && (AliCDBManager::Instance()->IsDefaultStorageSet()))
-// {
-// AliCDBEntry *entry = (AliCDBEntry*)
-// AliCDBManager::Instance()->Get("EMCAL/Calib/Pedestals");
-// if (entry) fgCaloPed = (AliCaloCalibPedestal*) entry->GetObject();
-// }
-//
-// if(!fgCaloPed)
-// AliFatal("Pedestal info not found in CDB!");
-//
-// return fgCaloPed;
-//
-//}
+AliCaloCalibPedestal* AliEMCALLoader::PedestalData()
+{
+ // Check if the instance of AliCaloCalibPedestal exists, if not, create it if
+ // the OCDB is available, and finally return it.
+
+ if(!fgCaloPed && (AliCDBManager::Instance()->IsDefaultStorageSet()))
+ {
+ AliCDBEntry *entry = (AliCDBEntry*)
+ AliCDBManager::Instance()->Get("EMCAL/Calib/Pedestals");
+ if (entry) fgCaloPed = (AliCaloCalibPedestal*) entry->GetObject();
+ }
+
+ if(!fgCaloPed)
+ AliFatal("Pedestal info not found in CDB!");
+
+ return fgCaloPed;
+
+}
//____________________________________________________________________________
AliEMCALSimParam* AliEMCALLoader::SimulationParameters()
if(!fgSimParam && (AliCDBManager::Instance()->IsDefaultStorageSet()))
{
AliCDBEntry *entry = (AliCDBEntry*)
- AliCDBManager::Instance()->Get("EMCAL/Calib/SimParam");
+ AliCDBManager::Instance()->Get("EMCAL/Calib/SimParam");
if (entry) fgSimParam = (AliEMCALSimParam*) entry->GetObject();
}
}
+
+//____________________________________________________________________________
+AliEMCALRecParam* AliEMCALLoader::ReconstructionParameters(Int_t eventType = 0)
+{
+ // Check if the instance of AliEMCALRecParam exists, if not, create it if
+ // the OCDB is available, and finally return it.
+ // The event type must be provided.
+
+ if(!fgRecParam && (AliCDBManager::Instance()->IsDefaultStorageSet()))
+ {
+ AliCDBEntry *entry = (AliCDBEntry*)
+ AliCDBManager::Instance()->Get("EMCAL/Calib/RecoParam");
+ if (entry) fgRecParam = (AliEMCALRecParam*)((TObjArray *) entry->GetObject())->At(eventType);
+
+ }
+
+ if(!fgRecParam)
+ AliFatal("Reconstruction parameters not found in CDB!");
+
+ return fgRecParam;
+
+}
+
+
//____________________________________________________________________________
Int_t AliEMCALLoader::GetEvent()
{
//Method to load all of the data
//members of the EMCAL for a given
//event from the Trees
-
+
AliLoader::GetEvent(); // First call AliLoader to do all the groundwork
// *** Hits ***
- // Initialize the Hits TClonesArray, only if it did not existed before
- MakeHitsArray();
-
- TTree *treeH = TreeH();
- if (treeH) {
- Int_t nEnt = treeH->GetEntries(); // TreeH has array of hits for every primary
- Int_t index = 0;
- TClonesArray *tempArr = 0x0;
- TBranch * branchH = treeH->GetBranch(fDetectorName);
- branchH->SetAddress(&tempArr);
- TClonesArray* hits = const_cast<AliEMCALLoader *>(this)->Hits();
- if (hits) hits->Clear();
- for (Int_t iEnt = 0; iEnt < nEnt; iEnt++) {
- branchH->GetEntry(iEnt);
- Int_t nHit = tempArr->GetEntriesFast();
- for (Int_t iHit = 0; iHit < nHit; iHit++) {
- new ((*hits)[index]) AliEMCALHit(*((AliEMCALHit*)tempArr->At(iHit)));
- index++;
- }
- }
- branchH->ResetAddress();
- if (tempArr) {
- tempArr->Delete();
- delete tempArr;
- }
- }
-
+ // Hits are now handled directly on the AliEMCALSDigitizer, the only place it is requested.
+ // together with AliEveEMCALData
+
// *** SDigits ***
// Initialize the SDigits TClonesArray, only if it did not existed before
MakeSDigitsArray();
// Reset SDigits array and branch
branchS->ResetAddress();
TClonesArray* sdigits = const_cast<AliEMCALLoader *>(this)->SDigits();
- if (sdigits) sdigits->Clear();
+ if (sdigits) sdigits->Clear("C");
branchS->SetAddress(&sdigits);
branchS->GetEntry(0);
// Reset Digits array and branch
branchD->ResetAddress();
TClonesArray* digits = const_cast<AliEMCALLoader *>(this)->Digits();
- if (digits) digits->Clear();
+ if (digits) digits->Clear("C");
branchD->SetAddress(&digits);
branchD->GetEntry(0);
return 0;
}
-//____________________________________________________________________________
-void AliEMCALLoader::MakeHitsArray(){
- // Add Hits array to the data folder
- if (Hits()) return;
- TClonesArray* hits = new TClonesArray("AliEMCALHit",0);
- hits->SetName(fgkECAHitsBranchName);
- GetDetectorDataFolder()->Add(hits);
-}
-
//____________________________________________________________________________
void AliEMCALLoader::MakeSDigitsArray(){
// Add SDigits array to the data folder