3 #include "AliSelectorRL.h"
6 #include <AliRunLoader.h>
12 // This selector depends on the RunLoader, therefore to use it you have to have the whole AliRoot available
13 // The benefit is that you can use the RunLoader to access everything in the data structure
14 // If you only have the ESD library use AliSelector instead
17 ClassImp(AliSelectorRL)
19 AliSelectorRL::AliSelectorRL() :
22 fKinematicsLoaded(kFALSE),
26 // Constructor. Initialization of pointers
30 AliSelectorRL::~AliSelectorRL()
36 // histograms are in the output list and deleted when the output
37 // list is deleted by the TSelector dtor
40 Bool_t AliSelectorRL::Notify()
42 // Calls base class Notify
43 // On top of that run loader is closed, because we change the input file
45 if (AliSelector::Notify() == kFALSE)
53 Bool_t AliSelectorRL::Process(Long64_t entry)
55 // Call the baseclass Process and set event number in runLoader (if loaded)
57 if (AliSelector::Process(entry) == kFALSE)
61 fRunLoader->GetEvent(entry);
66 void AliSelectorRL::SlaveTerminate()
70 AliSelector::SlaveTerminate();
75 AliRunLoader* AliSelectorRL::GetRunLoader()
77 // Returns AliRun instance corresponding to current ESD active in fTree
78 // Loads galice.root, the file is identified by replacing "AliESDs" to
79 // "galice" in the file path of the ESD file. This is a hack, to be changed!
83 if (!fTree->GetCurrentFile())
86 TString fileName(fTree->GetCurrentFile()->GetName());
87 fileName.ReplaceAll("AliESDs", "galice");
89 // temporary workaround for PROOF bug #18505
90 fileName.ReplaceAll("#galice.root#galice.root", "#galice.root");
92 fRunLoader = AliRunLoader::Open(fileName);
96 if (fRunLoader->LoadgAlice() != 0)
102 fRunLoader->GetEvent(fTree->GetTree()->GetReadEntry());
108 void AliSelectorRL::DeleteRunLoader()
111 // deletes the runloader
116 fRunLoader->Delete();
120 fKinematicsLoaded = kFALSE;
121 fHeaderLoaded = kFALSE;
124 AliHeader* AliSelectorRL::GetHeader()
126 // Returns header retrieved from RunLoader
128 AliRunLoader* runLoader = GetRunLoader();
132 if (fHeaderLoaded == kFALSE)
133 if (runLoader->LoadHeader() != 0)
136 fHeaderLoaded = kTRUE;
138 return runLoader->GetHeader();
141 AliStack* AliSelectorRL::GetStack()
143 // Returns stack retrieved from RunLoader
145 AliRunLoader* runLoader = GetRunLoader();
149 if (fKinematicsLoaded == kFALSE)
150 if (runLoader->LoadKinematics() != 0)
153 fKinematicsLoaded = kTRUE;
155 return runLoader->Stack();