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