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 #include "AliSelectorRL.h"
21 #include <AliRunLoader.h>
26 // Selector base class for analysis based on whole AliRoot
27 // Please derive your selector-based analysis from this class, if you need to access the
28 // RunLoader or anything provided by it.
30 // This selector depends on the RunLoader, therefore to use it you have to have the whole AliRoot available
31 // The benefit is that you can use the RunLoader to access everything in the data structure
33 // The class has functions to return the stack (GetStack()), the RunLoader (GetRunLoader()), and
34 // the event header (GetHeader()).
36 // Author: Jan.Fiete.Grosse-Oetringhaus@cern.ch
38 ClassImp(AliSelectorRL)
40 AliSelectorRL::AliSelectorRL() :
43 fKinematicsLoaded(kFALSE),
47 // Constructor. Initialization of pointers
51 AliSelectorRL::~AliSelectorRL()
57 // histograms are in the output list and deleted when the output
58 // list is deleted by the TSelector dtor
61 Bool_t AliSelectorRL::Notify()
63 // Calls base class Notify
64 // On top of that run loader is closed, because we change the input file
66 if (AliSelector::Notify() == kFALSE)
74 Bool_t AliSelectorRL::Process(Long64_t entry)
76 // Call the baseclass Process and set event number in runLoader (if loaded)
78 if (AliSelector::Process(entry) == kFALSE)
83 if (fRunLoader->GetEvent((Int_t)entry) != 0)
90 void AliSelectorRL::SlaveTerminate()
94 AliSelector::SlaveTerminate();
99 AliRunLoader* AliSelectorRL::GetRunLoader()
101 // Returns AliRun instance corresponding to current ESD active in fTree
102 // Loads galice.root, the file is identified by replacing "AliESDs" to
103 // "galice" in the file path of the ESD file.
107 if (!fTree->GetCurrentFile())
110 TString fileName(fTree->GetCurrentFile()->GetName());
111 fileName.ReplaceAll("AliESDs", "galice");
113 // temporary workaround for PROOF bug #18505
114 fileName.ReplaceAll("#galice.root#galice.root", "#galice.root");
116 fRunLoader = AliRunLoader::Open(fileName);
120 fRunLoader->GetEvent((Int_t)(fTree->GetTree()->GetReadEntry()));
126 void AliSelectorRL::DeleteRunLoader()
129 // deletes the runloader
134 fRunLoader->Delete();
138 fKinematicsLoaded = kFALSE;
139 fHeaderLoaded = kFALSE;
142 AliHeader* AliSelectorRL::GetHeader()
144 // Returns header retrieved from RunLoader
146 AliRunLoader* runLoader = GetRunLoader();
150 if (fHeaderLoaded == kFALSE)
151 if (runLoader->LoadHeader() != 0)
154 fHeaderLoaded = kTRUE;
156 return runLoader->GetHeader();
159 AliStack* AliSelectorRL::GetStack()
161 // Returns stack retrieved from RunLoader
163 AliRunLoader* runLoader = GetRunLoader();
167 if (fKinematicsLoaded == kFALSE)
168 if (runLoader->LoadKinematics() != 0)
171 fKinematicsLoaded = kTRUE;
173 return runLoader->Stack();