/* $Id$ */
//_________________________________________________________________________
-// A singleton. This class should be used in the analysis stage to get
-// reconstructed objects: Digits, RecPoints, TrackSegments and RecParticles,
-// instead of directly reading them from galice.root file.
-//
-// MvL Feb 2006:
-// The AliEMCALLoader now holds the TClonesArray and TObjArray for reading
+// The AliEMCALLoader gets the TClonesArray and TObjArray for reading
// Hits, Dgits, SDigits and RecPoints. Filling is managed in the GetEvent()
// method.
-//
-// Creation/writing of files is managed by the relevant parts of the
-// reconstruction software (AliEMCALDigitiser etx)
+// It also provides acces methods to the calibration and simulation OCDB parameters
//
//*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH)
//*-- Completely redesigned by Dmitri Peressounko March 2001
//
//*-- Marco van Leeuwen, Jan 2006: complete revision to simplify reading
//*-- and fit better in general ALICE scheme
+//*-- GCB: Remove TClonesArrays and TObjArrays data members, they are created elsewhere.
+//*-- Provide access to OCDB calibration and simulation parameters.
//
//////////////////////////////////////////////////////////////////////////////
// --- ROOT system ---
#include "TMath.h"
#include "TTree.h"
-
// --- Standard library ---
// --- AliRoot header files ---
#include "AliCDBEntry.h"
#include "AliEMCALHit.h"
-ClassImp(AliEMCALLoader)
+ 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
//____________________________________________________________________________
AliEMCALLoader::AliEMCALLoader()
- : fDebug(0),
- fHits(0),
- fDigits(0),
- fSDigits(0),
- fRecPoints(0)
+ : fDebug(0)
{
//Default constructor for EMCAL Loader Class
-
- fDebug = 0;
- fHits = new TClonesArray("AliEMCALHit");
- fDigits = new TClonesArray("AliEMCALDigit");
- fSDigits = new TClonesArray("AliEMCALDigit");
- fRecPoints = new TObjArray();
+
}
//____________________________________________________________________________
AliEMCALLoader::AliEMCALLoader(const Char_t *detname,const Char_t *eventfoldername)
- : AliLoader(detname,eventfoldername),
- fDebug(0),
- fHits(new TClonesArray("AliEMCALHit")),
- fDigits(new TClonesArray("AliEMCALDigit")),
- fSDigits(new TClonesArray("AliEMCALDigit")),
- fRecPoints(new TObjArray())
+ : AliLoader(detname,eventfoldername), fDebug(0)
{
//Specific constructor for EMCAL Loader class
}
//____________________________________________________________________________
AliEMCALLoader::AliEMCALLoader(const Char_t *name, TFolder *topfolder)
- : AliLoader(name,topfolder),
- fDebug(0),
- fHits(new TClonesArray("AliEMCALHit")),
- fDigits(new TClonesArray("AliEMCALDigit")),
- fSDigits(new TClonesArray("AliEMCALDigit")),
- fRecPoints(new TObjArray())
+ : AliLoader(name,topfolder), fDebug(0)
{
//Specific constructor for EMCAL Loader class
}
TreeS()->SetBranchAddress(fDetectorName,0);
if (TreeR())
TreeR()->SetBranchAddress(fgkECARecPointsBranchName,0);
- if (fHits) {
- fHits->Delete();
- delete fHits;
- }
- delete fDigits;
- delete fSDigits;
- delete fRecPoints;
}
//____________________________________________________________________________
{
// Check if the instance of AliEMCALCalibData exists, if not, create it if
// the OCDB is available, and finally return it.
-
+
if(!fgCalibData && (AliCDBManager::Instance()->IsDefaultStorageSet()))
{
AliCDBEntry *entry = (AliCDBEntry*)
}
//____________________________________________________________________________
-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()
{
- // 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()))
+ // 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();
-
+ 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,
- Int_t column, Int_t row)
-{
- // Convert energy into digitized amplitude for a cell relId
- // It is a user responsilibity to open CDB and set
- // AliEMCALCalibData object by the following operators:
- //
- // AliCDBLocal *loc = new AliCDBLocal("deCalibDB");
- // AliEMCALCalibData* clb = (AliEMCALCalibData*)AliCDBStorage::Instance()
- // ->Get(path_to_calibdata,run_number);
- // AliEMCALGetter* gime = AliEMCALGetter::Instance("galice.root");
- // gime->SetCalibData(clb);
-
- if (CalibData() == 0)
- Warning("CalibrateRaw","Calibration DB is not initiated!");
-
- Float_t gainFactor = 0.00305;//0.0015; // width of one ADC channel in GeV
- Float_t pedestal = 0.009;//0.005; // pedestals
-
- if(CalibData()) {
- gainFactor = CalibData()->GetADCchannel (module,column,row);
- pedestal = CalibData()->GetADCpedestal(module,column,row);
- }
- Int_t amp = static_cast<Int_t>( (energy - pedestal) / gainFactor + 0.5 ) ;
- return amp;
+ if(!fgSimParam)
+ AliFatal("Simulations parameters not found in CDB!");
+
+ return fgSimParam;
+
}
//____________________________________________________________________________
//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
- // Now connect and fill TClonesArray
-
- // Hits
- TTree *treeH = TreeH();
-
- if (treeH) {
- Int_t nEnt = treeH->GetEntries(); // TreeH has array of hits for every primary
- fHits->Clear();
- Int_t index = 0;
- TClonesArray *tempArr = 0x0;
- TBranch * branchH = treeH->GetBranch(fDetectorName);
- branchH->SetAddress(&tempArr);
- for (Int_t iEnt = 0; iEnt < nEnt; 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)));
- index++;
- }
- }
- branchH->ResetAddress();
- if (tempArr) {
- tempArr->Delete();
- delete tempArr;
- }
- }
+ // *** 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;
+ }
+ }
+
+ // *** SDigits ***
+ // Initialize the SDigits TClonesArray, only if it did not existed before
+ MakeSDigitsArray();
+
+ TTree *treeS = TreeS();
+ if (treeS) {
+ TBranch * branchS = treeS->GetBranch(fDetectorName);
+
+ // Reset SDigits array and branch
+ branchS->ResetAddress();
+ TClonesArray* sdigits = const_cast<AliEMCALLoader *>(this)->SDigits();
+ if (sdigits) sdigits->Clear();
+
+ branchS->SetAddress(&sdigits);
+ branchS->GetEntry(0);
+ }
+
+ // *** Digits ***
+ // Initialize the Digits TClonesArray, only if it did not existed before
+ MakeDigitsArray();
+
+ TTree *treeD = TreeD();
+ if (treeD) {
+ TBranch * branchD = treeD->GetBranch(fDetectorName);
+
+ // Reset Digits array and branch
+ branchD->ResetAddress();
+ TClonesArray* digits = const_cast<AliEMCALLoader *>(this)->Digits();
+ if (digits) digits->Clear();
+
+ branchD->SetAddress(&digits);
+ branchD->GetEntry(0);
+ }
+
+ // *** RecPoints ***
+ // Initialize the RecPoints TObjArray, only if it did not existed before
+ MakeRecPointsArray();
- // SDigits
- TTree *treeS = TreeS();
- if (treeS) {
- TBranch * branchS = treeS->GetBranch(fDetectorName);
- branchS->ResetAddress();
- if (fSDigits) {
- fSDigits->Clear();
- }
- branchS->SetAddress(&fSDigits);
- branchS->GetEntry(0);
- //treeS->GetEvent(0);
- }
-
- // Digits
- TTree *treeD = TreeD();
- if (treeD) {
- TBranch * branchD = treeD->GetBranch(fDetectorName);
- branchD->ResetAddress();
- if (fDigits) {
- fDigits->Clear();
- }
- branchD->SetAddress(&fDigits);
- branchD->GetEntry(0);
- //treeD->GetEvent(0);
- }
+ TTree *treeR = TreeR();
+ if (treeR) {
+ TBranch * branchR = treeR->GetBranch(fgkECARecPointsBranchName);
+
+ // Reset RecPoints array and branch
+ branchR->ResetAddress();
+ TObjArray* rp = const_cast<AliEMCALLoader *>(this)->RecPoints();
+ if (rp) rp->Clear();
+
+ branchR->SetAddress(&rp);
+ branchR->GetEntry(0);
+ }
+
+ return 0;
+}
- // RecPoints
- TTree *treeR = TreeR();
- if (treeR) {
- TBranch * branchR = treeR->GetBranch(fgkECARecPointsBranchName);
- branchR->ResetAddress();
- if (fRecPoints) {
- fRecPoints->Clear();
- }
- branchR->SetAddress(&fRecPoints);
- //treeR->GetEvent(0);
- branchR->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
+ if (SDigits()) return;
+ TClonesArray* sdigits = new TClonesArray("AliEMCALDigit",0);
+ sdigits->SetName(fgkECASDigitsBranchName);
+ GetDetectorDataFolder()->Add(sdigits);
+}
+
+//____________________________________________________________________________
+void AliEMCALLoader::MakeDigitsArray(){
+ // Add Digits array to the data folder
+ if (Digits()) return;
+ TClonesArray* digits = new TClonesArray("AliEMCALDigit",0);
+ digits->SetName(fgkECADigitsBranchName);
+ GetDetectorDataFolder()->Add(digits);
+}
+
+//____________________________________________________________________________
+void AliEMCALLoader::MakeRecPointsArray(){
+ // Add RecPoints array to the data folder
+ if (RecPoints()) return;
+ TObjArray* rp = new TObjArray(0);
+ rp->SetName(fgkECARecPointsBranchName);
+ GetDetectorDataFolder()->Add(rp);
}
/* $Id$ */
//_________________________________________________________________________
-// A singleton that returns various objects
-// Should be used on the analysis stage to avoid confusing between different
-// branches of reconstruction tree: e.g. reading RecPoints and TS made from
-// another set of RecPoints.
-//
-// The objects are retrived from folders.
+// The AliEMCALLoader gets the TClonesArray and TObjArray for reading
+// Hits, Dgits, SDigits and RecPoints. Filling is managed in the GetEvent()
+// method. The objects are retrived from the corresponding folders.
+//
+// It also provides acces methods to the calibration and simulation OCDB parameters
+//
+
//*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH)
//
// --- AliRoot header files ---
#include "AliLoader.h"
#include "AliEMCALCalibData.h"
-#include "AliCaloCalibPedestal.h"
+//#include "AliCaloCalibPedestal.h"
#include "AliEMCALSimParam.h"
class AliLoader ;
virtual Int_t GetEvent(); // Overload to fill TClonesArray
- virtual void CleanHits() const
- { if (fHits) fHits->Clear(); AliLoader::CleanHits(); }
- virtual void CleanSDigits() const
- { if (fSDigits) fSDigits->Clear(); AliLoader::CleanSDigits(); }
- virtual void CleanDigits() const
- { if (fDigits) fDigits->Clear(); AliLoader::CleanDigits(); }
- virtual void CleanRecPoints() const
- { if (fRecPoints) fRecPoints->Clear(); AliLoader::CleanRecPoints(); }
-
- // This does not work due to const
- /*
- virtual void MakeHitsContainer() const { AliLoader::MakeHitsContainer(); TreeH()->Branch(fDetectorName,"TClonesArray",&fHits); }
- virtual void MakeSDigitsContainer() const { AliLoader::MakeSDigitsContainer(); TreeS()->SetBranchAddress(fDetectorName,&fSDigits); }
- virtual void MakeDigitsContainer() const { AliLoader::MakeDigitsContainer(); TreeD()->SetBranchAddress(fDetectorName,&fDigits); }
- virtual void MakeRecPointsContainer() const { AliLoader::MakeRecPointsContainer(); TreeR()->SetBranchAddress(fgkECARecPointsBranchName,&fRecPoints); }
- */
-
+ //Clean arrays methods
+ virtual void CleanHits() const {GetHitsDataLoader()->Clean();}
+ virtual void CleanSDigits() const {GetSDigitsDataLoader()->Clean();}
+ virtual void CleanDigits() const {GetDigitsDataLoader()->Clean();}
+ virtual void CleanRecPoints() const {GetRecPointsDataLoader()->Clean();}
+
+ // Initialize arrays methods
+ void MakeSDigitsArray() ;
+ void MakeHitsArray() ;
+ void MakeDigitsArray() ;
+ void MakeRecPointsArray() ;
+
// ************ TClonesArrays Access functions
-
- TClonesArray* Hits(void) const { return fHits;}
-
+
+ TClonesArray* Hits(void) {return (TClonesArray*)GetDetectorData(fgkECAHitsBranchName);} //{ return fHits;}
const AliEMCALHit* Hit(Int_t index) {
- if (fHits)
- return (const AliEMCALHit*) fHits->At(index);
+ if (Hits()) return (const AliEMCALHit*) Hits()->At(index);
return 0x0;
}
-
- TClonesArray* SDigits() const { return fSDigits;}
+
+ TClonesArray* SDigits() {return (TClonesArray*)GetDetectorData(fgkECASDigitsBranchName);} //const { return fSDigits;}
const AliEMCALDigit* SDigit(Int_t index) {
- if (fSDigits)
- return (const AliEMCALDigit*) fSDigits->At(index);
+ if (SDigits())return (const AliEMCALDigit*) SDigits()->At(index);
return 0x0;
}
-
- TClonesArray* Digits() const { return fDigits;}
+
+ TClonesArray* Digits() {return (TClonesArray*)GetDetectorData(fgkECADigitsBranchName);}//const { return fDigits;}
const AliEMCALDigit * Digit(Int_t index) {
- if (fDigits)
- return (const AliEMCALDigit*) fDigits->At(index);
+ if (Digits()) return (const AliEMCALDigit*) Digits()->At(index);
return 0x0;
}
-
- TObjArray * RecPoints() const { return fRecPoints;}
+
+ TObjArray * RecPoints() {return (TObjArray*)GetDetectorData(fgkECARecPointsBranchName);}//const { return fRecPoints;}
const AliEMCALRecPoint * RecPoint(Int_t index) {
- if (fRecPoints)
- return (const AliEMCALRecPoint*) fRecPoints->At(index);
+ if (RecPoints())return (const AliEMCALRecPoint*) RecPoints()->At(index);
return 0x0;
}
-
+
void SetDebug(Int_t level) {fDebug = level;} // Set debug level
-
- //Calibration
- Int_t CalibrateRaw (Double_t energy, Int_t module, Int_t column, Int_t row);//take real calibration coefficients
-
+
+ //OCDB access methods
+
void SetCalibData(AliEMCALCalibData* calibda) { fgCalibData = calibda; }
AliEMCALCalibData * CalibData(); // to get the calibration CDB object
-
- void SetPedestalData(AliCaloCalibPedestal* caloped) { fgCaloPed = caloped; }
- AliCaloCalibPedestal* PedestalData(); // to get the pedestal CDB object
-
+
+ // void SetPedestalData(AliCaloCalibPedestal* caloped) { fgCaloPed = caloped; }
+ // AliCaloCalibPedestal* PedestalData(); // to get the pedestal CDB object
+
void SetSimParam(AliEMCALSimParam* simparam) { fgSimParam = simparam; }
AliEMCALSimParam* SimulationParameters(); // to get the simulation parameter CDB object
-
-
-private:
-
+
+
+ private:
+
// assignement operator requested by coding convention, but not needed
AliEMCALLoader(const AliEMCALLoader &); //Not implemented
const AliEMCALLoader & operator = (const AliEMCALLoader &); //Not implemented
-
+
+ static const TString fgkECAHitsBranchName; //! Name of branch with ECA Hits
+ static const TString fgkECASDigitsBranchName; //! Name of branch with ECA SDigits
+ static const TString fgkECADigitsBranchName; //! Name of branch with ECA Digits
static const TString fgkECARecPointsBranchName; //! Name of branch with ECA Reconstructed Points
-
+
Int_t fDebug ; // Debug level
-
- // All data are stored in TTrees on file.
- // These TCLonesArrays are temporary storage for reading or writing
- // (connected to TTrees with SetBranchAddress)
- TClonesArray *fHits; //! TClonesArray of hits (for tree reading)
- TClonesArray *fDigits; //! TClonesArray of digits (for tree reading)
- TClonesArray *fSDigits; //! TClonesArray of sdigits (for tree reading)
- TObjArray *fRecPoints; //! TClonesArray of recpoints (for tree reading)
static AliEMCALCalibData * fgCalibData; // calibration data
- static AliCaloCalibPedestal * fgCaloPed; // dead map
+ // static AliCaloCalibPedestal * fgCaloPed; // dead map
static AliEMCALSimParam * fgSimParam; // sim param
-
- ClassDef(AliEMCALLoader,4) // Algorithm class that provides methods to retrieve objects from a list knowing the index
-
+
+ ClassDef(AliEMCALLoader,5) // Algorithm class that provides methods to retrieve objects from a list knowing the index
+
};
#endif // AliEMCALLOADER_H