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 // class AliReaderESDTree
20 // Reader for MUON ESD Tree (only for rec)
21 // finck@subatech.in2p3.fr
22 //***********************************************************************
31 #include "AliReaderESDTree.h"
32 #include "AliRunLoader.h"
35 ClassImp(AliReaderESDTree)
37 AliReaderESDTree::AliReaderESDTree(const Char_t* esdfilename, const Char_t* galfilename):
38 AliReaderESD(esdfilename,galfilename),
44 /********************************************************************/
45 AliReaderESDTree::~AliReaderESDTree()
51 /**********************************************************/
52 Int_t AliReaderESDTree::ReadNext()
54 //reads next event from fFile
55 //fRunLoader is for reading Kine
57 AliDebug(1,"Entered");
59 if (fEventSim == 0x0) fEventSim = new AliAOD();
60 if (fEventRec == 0x0) fEventRec = new AliAOD();
65 do //do{}while; is OK even if 0 dirs specified. In that case we try to read from "./"
69 fFile = OpenFile(fCurrentDir);//rl is opened here
72 Error("ReadNext","Cannot get fFile for dir no. %d",fCurrentDir);
79 static AliESD* esd = 0x0;
80 fTree->SetBranchAddress("ESD", &esd);
81 Int_t status = fTree->GetEvent(fCurrentEvent);
85 AliDebug(2,Form("Cannot find event# %d in Tree", fCurrentEvent));
89 delete fFile;//we have to assume there is no more ESD objects in the fFile
100 return 0;//success -> read one event
101 }while(fCurrentDir < GetNumberOfDirs());//end of loop over directories specified in fDirs Obj Array
103 return 1; //no more directories to read
106 /**********************************************************/
107 TFile* AliReaderESDTree::OpenFile(Int_t n)
109 //opens fFile with kine tree
111 const TString& dirname = GetDirName(n);
114 Error("OpenFiles","Can not get directory name");
117 TString filename = dirname +"/"+ fESDFileName;
118 TFile *ret = TFile::Open(filename.Data());
122 Error("OpenFiles","Can't open fFile %s",filename.Data());
127 Error("OpenFiles","Can't open fFile %s",filename.Data());
131 TString esdname = "esdTree";
132 fTree = dynamic_cast<TTree*> (ret->Get(esdname));
136 Error("OpenFiles","Can't open ESD Tree %s",esdname.Data());
144 fRunLoader = AliRunLoader::Open(dirname +"/"+ fGAlFileName);
145 if (fRunLoader == 0x0)
147 Error("OpenFiles","Can't get RunLoader for directory %s",dirname.Data());
153 fRunLoader->LoadHeader();
154 if (fRunLoader->LoadKinematics())
156 Error("Next","Error occured while loading kinematics.");