1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 //_______________________________________________________________________
19 /////////////////////////////////////////////////////////////////////////
21 // class AliReaderESDTree
23 // Reader for MUON ESD Tree (only for rec)
25 // finck@subatech.in2p3.fr
27 /////////////////////////////////////////////////////////////////////////
36 #include "AliReaderESDTree.h"
38 #include "AliRunLoader.h"
40 ClassImp(AliReaderESDTree)
42 AliReaderESDTree::AliReaderESDTree(const Char_t* esdfilename, const Char_t* galfilename):
43 AliReaderESD(esdfilename,galfilename),
49 /********************************************************************/
50 AliReaderESDTree::~AliReaderESDTree()
56 /**********************************************************/
57 Int_t AliReaderESDTree::ReadNext()
59 //reads next event from fFile
60 //fRunLoader is for reading Kine
62 AliDebug(1,"Entered");
64 if (fEventSim == 0x0) fEventSim = new AliAOD();
65 if (fEventRec == 0x0) fEventRec = new AliAOD();
70 do //do{}while; is OK even if 0 dirs specified. In that case we try to read from "./"
74 fFile = OpenFile(fCurrentDir);//rl is opened here
77 Error("ReadNext","Cannot get fFile for dir no. %d",fCurrentDir);
84 static AliESD* esd = 0x0;
85 fTree->SetBranchAddress("ESD", &esd);
86 Int_t status = fTree->GetEvent(fCurrentEvent);
90 AliDebug(2,Form("Cannot find event# %d in Tree", fCurrentEvent));
94 delete fFile;//we have to assume there is no more ESD objects in the fFile
105 return 0;//success -> read one event
106 }while(fCurrentDir < GetNumberOfDirs());//end of loop over directories specified in fDirs Obj Array
108 return 1; //no more directories to read
111 /**********************************************************/
112 TFile* AliReaderESDTree::OpenFile(Int_t n)
114 //opens fFile with kine tree
116 const TString& dirname = GetDirName(n);
119 Error("OpenFiles","Can not get directory name");
122 TString filename = dirname +"/"+ fESDFileName;
123 TFile *ret = TFile::Open(filename.Data());
127 Error("OpenFiles","Can't open fFile %s",filename.Data());
132 Error("OpenFiles","Can't open fFile %s",filename.Data());
136 TString esdname = "esdTree";
137 fTree = dynamic_cast<TTree*> (ret->Get(esdname));
141 Error("OpenFiles","Can't open ESD Tree %s",esdname.Data());
149 fRunLoader = AliRunLoader::Open(dirname +"/"+ fGAlFileName);
150 if (fRunLoader == 0x0)
152 Error("OpenFiles","Can't get RunLoader for directory %s",dirname.Data());
158 fRunLoader->LoadHeader();
159 if (fRunLoader->LoadKinematics())
161 Error("Next","Error occured while loading kinematics.");