From 677c8a304fb8097de87fb3a9a9b1b4eb5ba1c93c Mon Sep 17 00:00:00 2001 From: schutz Date: Thu, 1 Jul 2004 11:35:07 +0000 Subject: [PATCH] New ESD format (with TTree) --- PHOS/AliPHOSGetter.cxx | 51 ++++++++++++++++++++++++++++-------------- PHOS/AliPHOSGetter.h | 11 +++++---- 2 files changed, 41 insertions(+), 21 deletions(-) diff --git a/PHOS/AliPHOSGetter.cxx b/PHOS/AliPHOSGetter.cxx index 7a6a8227da4..6e9bfb620c1 100644 --- a/PHOS/AliPHOSGetter.cxx +++ b/PHOS/AliPHOSGetter.cxx @@ -100,6 +100,8 @@ AliPHOSGetter::AliPHOSGetter(const char* headerFile, const char* version, Option fESDFileName = rl->GetFileName() ; // this should be the galice.root file fESDFileName.ReplaceAll("galice.root", "AliESDs.root") ; fESDFile = 0 ; + fESD = 0 ; + fESDTree = 0 ; } //____________________________________________________________________________ @@ -112,7 +114,11 @@ AliPHOSGetter::~AliPHOSGetter() fBTE = 0 ; fPrimaries->Delete() ; delete fPrimaries ; - fgObjGetter = 0; + fgObjGetter = 0; + if (fESD) + delete fESD ; + if (fESDTree) + delete fESDTree ; } //____________________________________________________________________________ @@ -294,7 +300,11 @@ void AliPHOSGetter::Event(Int_t event, const char* opt) if( strstr(opt,"P") ) ReadTreeP() ; + + if( strstr(opt,"E") ) + ReadTreeE(event) ; + // if( strstr(opt,"Q") ) // ReadTreeQA() ; @@ -484,22 +494,6 @@ void AliPHOSGetter::ReadPrimaries() } } -//____________________________________________________________________________ -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(fESDFile->Get(esdEvent)) ; - return esd ; -} - //____________________________________________________________________________ Bool_t AliPHOSGetter::OpenESDFile() { @@ -610,6 +604,29 @@ Int_t AliPHOSGetter::ReadTreeS() 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(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() { diff --git a/PHOS/AliPHOSGetter.h b/PHOS/AliPHOSGetter.h index e647553ee7e..07240ec9022 100644 --- a/PHOS/AliPHOSGetter.h +++ b/PHOS/AliPHOSGetter.h @@ -184,8 +184,7 @@ public: AliPHOSLoader * PhosLoader() const { return fgPhosLoader ; } void Reset() ; - AliESD * ESD(Int_t event = 0) ; - Bool_t OpenESDFile() ; + AliESD * ESD() const { return fESD ; } private: @@ -199,7 +198,9 @@ 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: @@ -212,7 +213,9 @@ 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 -- 2.39.3