3 #include "AliSelectorRL.h"
6 #include <AliRunLoader.h>
13 // This selector depends on the RunLoader, therefore to use it you have to have the whole AliRoot available
14 // The benefit is that you can use the RunLoader to access everything in the data structure
15 // If you only have the ESD library use AliSelector instead
18 ClassImp(AliSelectorRL)
20 AliSelectorRL::AliSelectorRL() :
28 // Constructor. Initialization of pointers
32 AliSelectorRL::~AliSelectorRL()
38 // histograms are in the output list and deleted when the output
39 // list is deleted by the TSelector dtor
42 Bool_t AliSelectorRL::Notify()
44 // Calls base class Notify
45 // On top of that run loader is closed, because we change the input file
47 if (AliSelector::Notify() == kFALSE)
56 void AliSelectorRL::SlaveTerminate()
60 AliSelector::SlaveTerminate();
66 AliRunLoader* AliSelectorRL::GetAliRunLoader()
68 // Returns AliRun instance corresponding to current ESD active in fTree
69 // Loads galice.root, the file is identified by replacing "AliESDs" to
70 // "galice" in the file path of the ESD file. This is a hack, to be changed!
74 if (!fTree->GetCurrentFile())
77 TString fileName(fTree->GetCurrentFile()->GetName());
78 fileName.ReplaceAll("AliESDs", "galice");
80 fRunLoader = AliRunLoader::Open(fileName);
84 fRunLoader->LoadgAlice();
90 void AliSelectorRL::DeleteRunLoader()
93 // deletes the runloader
103 AliHeader* AliSelectorRL::GetHeader()
105 // Returns header corresponding to current ESD active in fTree
106 // Loads the header from galice.root, the file is identified by replacing "AliESDs" to
107 // "galice" in the file path of the ESD file. This is a hack, to be changed!
109 if (!fHeaderFile || !fHeaderTree)
111 if (!fTree->GetCurrentFile())
114 TString fileName(fTree->GetCurrentFile()->GetName());
115 fileName.ReplaceAll("AliESDs", "galice");
117 AliDebug(AliLog::kInfo, Form("Opening %s", fileName.Data()));
119 fHeaderFile = TFile::Open(fileName);
123 fHeaderTree = dynamic_cast<TTree*> (fHeaderFile->Get("TE"));
127 fHeaderTree->SetBranchAddress("Header", &fHeader);
130 fHeaderTree->GetEntry(fTree->GetTree()->GetReadEntry());
135 void AliSelectorRL::DeleteHeaderFile()
138 // Closes the kinematics file and deletes the pointer.
143 fHeaderFile->Close();