#include "AliRun.h"
#include "AliConfig.h"
#include "AliEMCALGetter.h"
+#include "AliEMCALHit.h"
#include "AliEMCALv1.h"
#include "AliEMCALDigitizer.h"
#include "AliEMCALSDigitizer.h"
AliEMCALGetter * AliEMCALGetter::fgObjGetter = 0 ;
//____________________________________________________________________________
-AliEMCALGetter::AliEMCALGetter(const char* headerFile, const char* branchTitle )
+AliEMCALGetter::AliEMCALGetter(const char* headerFile, const char* branchTitle, const Option_t * rw)
{
//Initialize all lists
if(file == 0){ //if file was not opened yet, read gAlice
if(fHeaderFile.Contains("rfio")) // if we read file using HPSS
- file = TFile::Open(fHeaderFile.Data(),"update") ;
+ file = TFile::Open(fHeaderFile.Data(),rw) ;
else
- file = new TFile(fHeaderFile.Data(),"update") ;
+ file = new TFile(fHeaderFile.Data(),rw) ;
if (!file->IsOpen()) {
cerr << "ERROR : AliEMCALGetter::AliEMCALGetter -> Cannot open " << fHeaderFile.Data() << endl ;
//____________________________________________________________________________
AliEMCALGetter * AliEMCALGetter::GetInstance(const char* headerFile,
- const char* branchTitle)
+ const char* branchTitle, const Option_t * rw)
{
// Creates and returns the pointer of the unique instance
// Must be called only when the environment has changed
else
fgObjGetter->~AliEMCALGetter() ; // delete it if already exists another version
- fgObjGetter = new AliEMCALGetter(headerFile,branchTitle) ;
+ fgObjGetter = new AliEMCALGetter(headerFile,branchTitle, rw) ;
// Posts a few item to the white board (folders)
// fgObjGetter->CreateWhiteBoard() ;
}
//____________________________________________________________________________
-void * AliEMCALGetter::HitsRef(void) const
+TObject ** AliEMCALGetter::HitsRef(void) const
{ //------- Hits ----------------------
return 0 ;
}
else
- return static_cast<void *>(emcalFolder->GetListOfFolders()->GetObjectRef(h)) ;
+ return emcalFolder->GetListOfFolders()->GetObjectRef(h) ;
}
//____________________________________________________________________________
return kTRUE;
}
//____________________________________________________________________________
-void * AliEMCALGetter::SDigitsRef(const char * name, const char * file) const
+TObject ** AliEMCALGetter::SDigitsRef(const char * name, const char * file) const
{ //------- SDigits ----------------------
// the hierarchy is //Folders/RunMC/Event/Data/EMCAL/SDigits/filename/SDigits
if(!dis)
return 0 ;
else
- return static_cast<void *>(emcalSubFolder->GetListOfFolders()->GetObjectRef(dis)) ;
+ return emcalSubFolder->GetListOfFolders()->GetObjectRef(dis) ;
}
}
//____________________________________________________________________________
-void * AliEMCALGetter::SDigitizerRef(const char * name) const
+TObject ** AliEMCALGetter::SDigitizerRef(const char * name) const
{
TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ;
TTask * task = dynamic_cast<TTask*>(emcal->GetListOfTasks()->FindObject(name)) ;
- return static_cast<void *>(emcal->GetListOfTasks()->GetObjectRef(task)) ;
+ return emcal->GetListOfTasks()->GetObjectRef(task) ;
}
}
//____________________________________________________________________________
-void * AliEMCALGetter::DigitsRef(const char * name) const
+TObject ** AliEMCALGetter::DigitsRef(const char * name) const
{ //------- Digits ----------------------
// the hierarchy is //Folders/Run/Event/Data/EMCAL/Digits/name
if(!d)
return 0 ;
else
- return static_cast<void *>(emcalFolder->GetListOfFolders()->GetObjectRef(d)) ;
+ return emcalFolder->GetListOfFolders()->GetObjectRef(d) ;
}
}
//____________________________________________________________________________
-void * AliEMCALGetter::DigitizerRef(const char * name) const
+TObject ** AliEMCALGetter::DigitizerRef(const char * name) const
{
TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ;
if ( !sd ) {
TTask * task = dynamic_cast<TTask*>(emcal->GetListOfTasks()->FindObject(name)) ;
- return static_cast<void *>(emcal->GetListOfTasks()->GetObjectRef(task)) ;
+ return emcal->GetListOfTasks()->GetObjectRef(task) ;
}
}
//____________________________________________________________________________
-void * AliEMCALGetter::EmcRecPointsRef(const char * name) const
+TObject ** AliEMCALGetter::EmcRecPointsRef(const char * name) const
{ // -------------- RecPoints -------------------------------------------
// the hierarchy is //Folders/Run/Event/RecData/EMCAL/EMCARecPoints/name
if ( !erp ) {
return 0 ;
}
- return static_cast<void *>(emcalFolder->GetListOfFolders()->GetObjectRef(erp)) ;
+ return emcalFolder->GetListOfFolders()->GetObjectRef(erp) ;
}
//____________________________________________________________________________
-void * AliEMCALGetter::CpvRecPointsRef(const char * name) const
+TObject ** AliEMCALGetter::CpvRecPointsRef(const char * name) const
{ // -------------- RecPoints -------------------------------------------
// the hierarchy is //Folders/Run/Event/RecData/EMCAL/CPVRecPoints/name
if ( !crp ) {
return 0 ;
}
- return static_cast<void *>(emcalFolder->GetListOfFolders()->GetObjectRef(crp)) ;
+ return emcalFolder->GetListOfFolders()->GetObjectRef(crp) ;
}
}
//____________________________________________________________________________
-void * AliEMCALGetter::ClusterizerRef(const char * name) const
+TObject ** AliEMCALGetter::ClusterizerRef(const char * name) const
{ // ------------------ AliEMCALClusterizer ------------------------
TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
}
if(clu)
- return static_cast<void *>(l->GetObjectRef(clu)) ;
+ return l->GetObjectRef(clu) ;
else
return 0 ;
}
}
//____________________________________________________________________________
-void * AliEMCALGetter::TrackSegmentsRef(const char * name) const
+TObject ** AliEMCALGetter::TrackSegmentsRef(const char * name) const
{ // ---------------TrackSegments -----------------------------------
// the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name
if (!tss) {
return 0 ;
}
- return static_cast<void *>(emcalFolder->GetListOfFolders()->GetObjectRef(tss)) ;
+ return emcalFolder->GetListOfFolders()->GetObjectRef(tss) ;
}
//____________________________________________________________________________
}
//____________________________________________________________________________
-void * AliEMCALGetter::TSMakerRef(const char * name) const
+TObject ** AliEMCALGetter::TSMakerRef(const char * name) const
{ //------------Track Segment Maker ------------------------------
TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
}
if(tsm)
- return static_cast<void *>(l->GetObjectRef(tsm)) ;
+ return l->GetObjectRef(tsm) ;
else
return 0 ;
}
//____________________________________________________________________________
-void * AliEMCALGetter::RecParticlesRef(const char * name) const
+TObject ** AliEMCALGetter::RecParticlesRef(const char * name) const
{ // ---------------TrackSegments -----------------------------------
// the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name
if (!tss) {
return 0 ;
}
- return static_cast<void *>(emcalFolder->GetListOfFolders()->GetObjectRef(tss)) ;
+ return emcalFolder->GetListOfFolders()->GetObjectRef(tss) ;
}
//____________________________________________________________________________
}
//____________________________________________________________________________
-void * AliEMCALGetter::PIDRef(const char * name) const
+TObject ** AliEMCALGetter::PIDRef(const char * name) const
{ //------------PID ------------------------------
TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
}
if(pid)
- return static_cast<void *>(l->GetObjectRef(pid)) ;
+ return l->GetObjectRef(pid) ;
else
return 0 ;
}
//____________________________________________________________________________
-void * AliEMCALGetter::AlarmsRef(void) const
+TObject ** AliEMCALGetter::AlarmsRef(void) const
{ //------- Alarms ----------------------
return 0;
}
- return static_cast<void *>(fQAFolder->GetListOfFolders()->GetObjectRef(emcalFolder)) ;
+ return fQAFolder->GetListOfFolders()->GetObjectRef(emcalFolder) ;
}
*/
//____________________________________________________________________________
}
if(!Hits())
PostHits() ;
-
+
+ if (hitsbranch->GetEntries() > 1 ) {
+ TClonesArray * tempo = new TClonesArray("AliEMCALHit",1000) ;
+ TClonesArray * hits = dynamic_cast<TClonesArray*>(*HitsRef()) ;
+ hitsbranch->SetAddress(&tempo) ;
+ Int_t index = 0 ;
+ Int_t i = 0 ;
+ for (i = 0 ; i < hitsbranch->GetEntries() ; i++) {
+ hitsbranch->GetEntry(i) ;
+ Int_t j = 0 ;
+ for ( j = 0 ; j < tempo->GetEntries() ; j++) {
+ const AliEMCALHit * hit = static_cast<const AliEMCALHit *>(tempo->At(j)) ;
+ new((*hits)[index]) AliEMCALHit( *hit ) ;
+ index++ ;
+ }
+ }
+ delete tempo ;
+ }
+ else {
hitsbranch->SetAddress(HitsRef()) ;
-
hitsbranch->GetEntry(0) ;
-
+ }
}
//____________________________________________________________________________
}
//____________________________________________________________________________
-/*void AliEMCALGetter::ReadTreeQA()
+/* void AliEMCALGetter::ReadTreeQA()
{
// Read the digit tree gAlice->TreeQA()
// so far only EMCAL knows about this Tree
}
if ( !emcalfound || !sdigitizerfound ) {
if (fDebug)
- cout << "WARNING: AliEMCALDigitizer::ReadSDigits -> Digits and/or Digitizer branch with name " << GetName()
+ cout << "WARNING: AliEMCALGetter::ReadSDigits -> Digits and/or Digitizer branch with name " << fSDigitsTitle
<< " not found" << endl ;
return ;
}
}
//____________________________________________________________________________
-const TObject * AliEMCALGetter::ReturnO(TString what, TString name, TString file) const
+TObject * AliEMCALGetter::ReturnO(TString what, TString name, TString file) const
{
// get the object named "what" from the folder
// folders are named like //Folders
#include "AliRun.h"
#include "AliEMCALv1.h"
+#include "AliEMCALHit.h"
+#include "AliEMCALDigit.h"
+#include "AliEMCALDigitizer.h"
+#include "AliEMCALSDigitizer.h"
class AliEMCALGeometry ;
-class AliEMCALHit ;
-class AliEMCALDigit ;
-class AliEMCALDigitizer ;
-class AliEMCALSDigitizer ;
//class AliEMCALEmcRecPoint ;
//class AliEMCALCpvRecPoint ;
//class AliEMCALClusterizer ;
Int_t EventNumber() { return (Int_t) gAlice->GetEvNumber() ; }
Int_t MaxEvent() { return (Int_t) gAlice->TreeE()->GetEntries() ; }
static AliEMCALGetter * GetInstance(const char* headerFile,
- const char* branchTitle = "Default" ) ;
+ const char* branchTitle = "Default", const Option_t * rw="" ) ;
static AliEMCALGetter * GetInstance() ;
const AliEMCALv1 * EMCAL() ;
// QA Tasks
//TTask * QATasks(const char * name = 0) const { return (TTask*)(ReturnT("QATasks", name)) ; }
+ // Primaries
+ TClonesArray * Primaries(void) const { return (TClonesArray*)(ReturnO("Primaries")) ; }
+
+
// Hits
- TClonesArray * Hits(void) const { return (TClonesArray*)(ReturnO("Hits")) ; }
-
+ const TClonesArray * Hits(void) { return static_cast<const TClonesArray*>(ReturnO("Hits")) ; }
+ const AliEMCALHit * Hit(Int_t index) { return static_cast<const AliEMCALHit*>(Hits()->At(index) );}
+
// SDigits
- TClonesArray * SDigits(const char * name = 0, const char * file=0) const
- { return (TClonesArray*)(ReturnO("SDigits", name, file)) ; }
-
- AliEMCALSDigitizer * SDigitizer(const char * name =0) const
- { return ((AliEMCALSDigitizer*)(ReturnT("SDigitizer", name))) ; }
-
+ TClonesArray * SDigits(const char * name = 0, const char * file=0) {
+ return static_cast<TClonesArray*>(ReturnO("SDigits", name, file)) ;
+ }
+ const AliEMCALDigit * SDigit(Int_t index) { return static_cast<const AliEMCALDigit*>(SDigits()->At(index)) ;}
+
+ AliEMCALSDigitizer * SDigitizer(const char * name =0) const {
+ return ((AliEMCALSDigitizer*)(ReturnT("SDigitizer", name))) ;
+ }
+
// Digits
- TClonesArray * Digits(const char * name = 0) const
- { return (TClonesArray*)(ReturnO("Digits", name)) ; }
- AliEMCALDigitizer * Digitizer(const char * name =0) const
- { return (AliEMCALDigitizer*)(ReturnT("Digitizer", name)) ; }
+ TClonesArray * Digits(const char * name = 0)const {
+ return static_cast<TClonesArray*>(ReturnO("Digits", name)) ;
+ }
+ const AliEMCALDigit * Digit(Int_t index) { return static_cast<const AliEMCALDigit *>(Digits()->At(index)) ;}
+ AliEMCALDigitizer * Digitizer(const char * name =0) const {
+ return (AliEMCALDigitizer*)(ReturnT("Digitizer", name)) ;
+ }
// RecPoints
//TObjArray * EmcRecPoints(const char * name = 0) const {
private:
- AliEMCALGetter(const char* headerFile, const char* branchTitle ="Default") ;
+ AliEMCALGetter(const char* headerFile, const char* branchTitle ="Default", const Option_t * rw ="") ;
void CreateWhiteBoard() const ;
- const TObject * ReturnO(TString what, TString name=0, TString file=0) const ;
+ TObject * ReturnO(TString what, TString name=0, TString file=0) const ;
const TTask * ReturnT(TString what,TString name=0) const ;
void DefineBranchTitles(char* branch, char* branchTitle) ;
void ReadTreeD() ;
//void ReadTreeQA() ;
void ReadPrimaries() ;
- void * HitsRef(void) const ;
- void * SDigitsRef(const char * name, const char * file = 0 ) const;
- void * DigitsRef (const char * name) const ;
- //void * EmcRecPointsRef (const char * name) const ;
- //void * CpvRecPointsRef (const char * name) const ;
- //void * TrackSegmentsRef(const char * name) const ;
- //void * RecParticlesRef (const char * name) const ;
- //void * AlarmsRef (void) const ;
-
- void * SDigitizerRef (const char * name) const ;
- void * DigitizerRef (const char * name) const ;
- //void * ClusterizerRef(const char * name) const ;
- //void * TSMakerRef (const char * name) const ;
- //void * PIDRef (const char * name) const ;
+ TObject ** HitsRef(void) const ;
+ TObject ** SDigitsRef(const char * name, const char * file = 0 ) const;
+ TObject ** DigitsRef (const char * name) const ;
+ //TObject ** EmcRecPointsRef (const char * name) const ;
+ //TObject ** CpvRecPointsRef (const char * name) const ;
+ //TObject ** TrackSegmentsRef(const char * name) const ;
+ //TObject ** RecParticlesRef (const char * name) const ;
+ //TObject ** AlarmsRef (void) const ;
+
+ TObject ** SDigitizerRef (const char * name) const ;
+ TObject ** DigitizerRef (const char * name) const ;
+ //TObject ** ClusterizerRef(const char * name) const ;
+ //TObject ** TSMakerRef (const char * name) const ;
+ //TObject ** PIDRef (const char * name) const ;
private: