]>
Commit | Line | Data |
---|---|---|
dc740de4 | 1 | /* $Id$ */ |
2 | ||
0c7e8af2 | 3 | #include "AliSelectorRL.h" |
4 | ||
5 | #include <AliLog.h> | |
6 | #include <AliRun.h> | |
7 | #include <AliRunLoader.h> | |
8 | ||
9 | ClassImp(AliSelectorRL) | |
10 | ||
11 | AliSelectorRL::AliSelectorRL() : | |
12 | AliSelector(), | |
13 | fRunLoader(0) | |
14 | { | |
15 | // | |
16 | // Constructor. Initialization of pointers | |
17 | // | |
18 | } | |
19 | ||
20 | AliSelectorRL::~AliSelectorRL() | |
21 | { | |
22 | // | |
23 | // Destructor | |
24 | // | |
25 | ||
26 | // histograms are in the output list and deleted when the output | |
27 | // list is deleted by the TSelector dtor | |
28 | } | |
29 | ||
30 | Bool_t AliSelectorRL::Notify() | |
31 | { | |
32 | // Calls base class Notify | |
33 | // On top of that run loader is closed, because we change the input file | |
34 | ||
35 | if (AliSelector::Notify() == kFALSE) | |
36 | return kFALSE; | |
37 | ||
38 | DeleteRunLoader(); | |
39 | ||
40 | return kTRUE; | |
41 | } | |
42 | ||
43 | void AliSelectorRL::SlaveTerminate() | |
44 | { | |
45 | // removes runloader | |
46 | ||
47 | AliSelector::SlaveTerminate(); | |
48 | ||
49 | DeleteRunLoader(); | |
50 | } | |
51 | ||
52 | AliRun* AliSelectorRL::GetAliRun() | |
53 | { | |
54 | // Returns AliRun instance corresponding to current ESD active in fChain | |
55 | // Loads galice.root, the file is identified by replacing "AliESDs" to | |
56 | // "galice" in the file path of the ESD file. This is a hack, to be changed! | |
57 | ||
58 | if (!fRunLoader) | |
59 | { | |
60 | if (!fChain->GetCurrentFile()) | |
61 | return 0; | |
62 | ||
63 | TString fileName(fChain->GetCurrentFile()->GetName()); | |
64 | fileName.ReplaceAll("AliESDs", "galice"); | |
65 | ||
66 | fRunLoader = AliRunLoader::Open(fileName); | |
67 | if (!fRunLoader) | |
68 | return 0; | |
69 | ||
70 | fRunLoader->LoadgAlice(); | |
71 | } | |
72 | ||
73 | return fRunLoader->GetAliRun(); | |
74 | } | |
75 | ||
76 | void AliSelectorRL::DeleteRunLoader() | |
77 | { | |
78 | // | |
79 | // deletes the runloader | |
80 | // | |
81 | ||
82 | if (fRunLoader) | |
83 | { | |
84 | fRunLoader->Delete(); | |
85 | fRunLoader = 0; | |
86 | } | |
87 | } |