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)
62 if (fRunLoader->GetEvent(entry) != 0)
69 void AliSelectorRL::SlaveTerminate()
73 AliSelector::SlaveTerminate();
78 AliRunLoader* AliSelectorRL::GetRunLoader()
80 // Returns AliRun instance corresponding to current ESD active in fTree
81 // Loads galice.root, the file is identified by replacing "AliESDs" to
82 // "galice" in the file path of the ESD file. This is a hack, to be changed!
86 if (!fTree->GetCurrentFile())
89 TString fileName(fTree->GetCurrentFile()->GetName());
90 fileName.ReplaceAll("AliESDs", "galice");
92 // temporary workaround for PROOF bug #18505
93 fileName.ReplaceAll("#galice.root#galice.root", "#galice.root");
95 fRunLoader = AliRunLoader::Open(fileName);
99 fRunLoader->GetEvent(fTree->GetTree()->GetReadEntry());
105 void AliSelectorRL::DeleteRunLoader()
108 // deletes the runloader
113 fRunLoader->Delete();
117 fKinematicsLoaded = kFALSE;
118 fHeaderLoaded = kFALSE;
121 AliHeader* AliSelectorRL::GetHeader()
123 // Returns header retrieved from RunLoader
125 AliRunLoader* runLoader = GetRunLoader();
129 if (fHeaderLoaded == kFALSE)
130 if (runLoader->LoadHeader() != 0)
133 fHeaderLoaded = kTRUE;
135 return runLoader->GetHeader();
138 AliStack* AliSelectorRL::GetStack()
140 // Returns stack retrieved from RunLoader
142 AliRunLoader* runLoader = GetRunLoader();
146 if (fKinematicsLoaded == kFALSE)
147 if (runLoader->LoadKinematics() != 0)
150 fKinematicsLoaded = kTRUE;
152 return runLoader->Stack();