fESDFileName = rl->GetFileName() ; // this should be the galice.root file
fESDFileName.ReplaceAll("galice.root", "AliESDs.root") ;
fESDFile = 0 ;
+ fESD = 0 ;
+ fESDTree = 0 ;
}
//____________________________________________________________________________
fBTE = 0 ;
fPrimaries->Delete() ;
delete fPrimaries ;
- fgObjGetter = 0;
+ fgObjGetter = 0;
+ if (fESD)
+ delete fESD ;
+ if (fESDTree)
+ delete fESDTree ;
}
//____________________________________________________________________________
if( strstr(opt,"P") )
ReadTreeP() ;
+
+ if( strstr(opt,"E") )
+ ReadTreeE(event) ;
+
// if( strstr(opt,"Q") )
// ReadTreeQA() ;
}
}
-//____________________________________________________________________________
-AliESD * AliPHOSGetter::ESD(Int_t event)
-{
- //Read the ESD
-
- AliESD * esd = 0 ;
- if (!fESDFile)
- if ( !OpenESDFile() )
- return esd ;
-
- TString esdEvent("ESD") ;
- esdEvent+= event ;
- esd = dynamic_cast<AliESD *>(fESDFile->Get(esdEvent)) ;
- return esd ;
-}
-
//____________________________________________________________________________
Bool_t AliPHOSGetter::OpenESDFile()
{
return SDigits()->GetEntries() ;
}
+//____________________________________________________________________________
+Int_t AliPHOSGetter::ReadTreeE(Int_t event)
+{
+ // Read the ESD
+
+ // gets esdTree from the root file (AliESDs.root)
+ if (!fESDFile)
+ if ( !OpenESDFile() )
+ return -1 ;
+
+ fESDTree = static_cast<TTree*>(fESDFile->Get("esdTree")) ;
+ fESD = new AliESD;
+ if (!fESDTree) {
+
+ Error("ReadTreeE", "no ESD tree found");
+ return -1;
+ }
+ fESDTree->SetBranchAddress("ESD", &fESD);
+ fESDTree->GetEvent(event);
+
+ return event ;
+}
+
//____________________________________________________________________________
TClonesArray * AliPHOSGetter::SDigits()
{
AliPHOSLoader * PhosLoader() const { return fgPhosLoader ; }
void Reset() ;
- AliESD * ESD(Int_t event = 0) ;
- Bool_t OpenESDFile() ;
+ AliESD * ESD() const { return fESD ; }
private:
Int_t ReadTreeT(void) ;
Int_t ReadTreeS(void) ;
Int_t ReadTreeP(void) ;
-
+
+ Int_t ReadTreeE(Int_t event) ;
+ Bool_t OpenESDFile() ;
void ReadPrimaries(void) ;
private:
TClonesArray * fPrimaries ; //! list of lists of primaries
TFile * fESDFile ; //! ESD file
TString fESDFileName ; //! ESD File Name
-
+ AliESD * fESD ; //! ESD object
+ TTree * fESDTree ; //! ESD Tree
+
// AliPHOSCalibrationDB * fcdb ; //!
static AliPHOSLoader * fgPhosLoader ; // the loader for the NewIO