1 #include "AliReaderESDTree.h"
2 //_______________________________________________________________________
3 /////////////////////////////////////////////////////////////////////////
5 // class AliReaderESDTree
7 // Reader for MUON ESD Tree (only for rec)
9 // finck@subatech.in2p3.fr
11 /////////////////////////////////////////////////////////////////////////
19 #include <AliRunLoader.h>
24 ClassImp(AliReaderESDTree)
26 AliReaderESDTree::AliReaderESDTree(const Char_t* esdfilename, const Char_t* galfilename):
27 AliReaderESD(esdfilename,galfilename),
33 /********************************************************************/
34 AliReaderESDTree::~AliReaderESDTree()
40 /**********************************************************/
41 Int_t AliReaderESDTree::ReadNext()
43 //reads next event from fFile
44 //fRunLoader is for reading Kine
46 if (AliVAODParticle::GetDebug())
47 Info("ReadNext","Entered");
49 if (fEventSim == 0x0) fEventSim = new AliAOD();
50 if (fEventRec == 0x0) fEventRec = new AliAOD();
55 do //do{}while; is OK even if 0 dirs specified. In that case we try to read from "./"
59 fFile = OpenFile(fCurrentDir);//rl is opened here
62 Error("ReadNext","Cannot get fFile for dir no. %d",fCurrentDir);
69 static AliESD* esd = 0x0;
70 fTree->SetBranchAddress("ESD", &esd);
71 Int_t status = fTree->GetEvent(fCurrentEvent);
75 if (AliVAODParticle::GetDebug() > 2 )
77 Info("ReadNext","Can not find event# %d in Tree", fCurrentEvent);
82 delete fFile;//we have to assume there is no more ESD objects in the fFile
93 return 0;//success -> read one event
94 }while(fCurrentDir < GetNumberOfDirs());//end of loop over directories specified in fDirs Obj Array
96 return 1; //no more directories to read
99 /**********************************************************/
100 TFile* AliReaderESDTree::OpenFile(Int_t n)
102 //opens fFile with kine tree
104 const TString& dirname = GetDirName(n);
107 Error("OpenFiles","Can not get directory name");
110 TString filename = dirname +"/"+ fESDFileName;
111 TFile *ret = TFile::Open(filename.Data());
115 Error("OpenFiles","Can't open fFile %s",filename.Data());
120 Error("OpenFiles","Can't open fFile %s",filename.Data());
124 TString esdname = "esdTree";
125 fTree = dynamic_cast<TTree*> (ret->Get(esdname));
129 Error("OpenFiles","Can't open ESD Tree %s",esdname.Data());
137 fRunLoader = AliRunLoader::Open(dirname +"/"+ fGAlFileName);
138 if (fRunLoader == 0x0)
140 Error("OpenFiles","Can't get RunLoader for directory %s",dirname.Data());
146 fRunLoader->LoadHeader();
147 if (fRunLoader->LoadKinematics())
149 Error("Next","Error occured while loading kinematics.");