]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/RESONANCES/AliRsnReaderTask.cxx
Package revised - New AnalysisTask's - Added more functions
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnReaderTask.cxx
1 //
2 // Class AliRsnReaderTask
3 //
4 // An AnalysisTask object to convert any kind of source event type (ESD/AOD/MC)
5 // into the RSN internal format (AliRsnEvent).
6 // The output of this task is a TTree with converted events, which is saved in a file
7 // and can then be processed as many times as desired, to build invariant mass spectra.
8 // ---
9 // authors: Martin Vala (martin.vala@cern.ch)
10 //          Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
11 //
12
13 #include "AliLog.h"
14
15 #include "AliAnalysisManager.h"
16 #include "AliMCEventHandler.h"
17 #include "AliMCEvent.h"
18 #include "AliESDInputHandler.h"
19 #include "AliAODInputHandler.h"
20 #include "AliAODHandler.h"
21
22 #include "AliRsnEvent.h"
23 #include "AliRsnReader.h"
24 #include "AliRsnPID.h"
25 #include "AliRsnReaderTask.h"
26
27 ClassImp(AliRsnReaderTask)
28
29 //_____________________________________________________________________________
30 AliRsnReaderTask::AliRsnReaderTask() :
31     AliRsnBaseAT(),
32     fRsnTree(0x0)
33 {
34 //=========================================================
35 // Default constructor (not recommended)
36 //=========================================================
37 }
38
39 //_____________________________________________________________________________
40 AliRsnReaderTask::AliRsnReaderTask(const char *name) :
41     AliRsnBaseAT(name),
42     fRsnTree(0x0)
43 {
44 //=========================================================
45 // Working constructor (recommended)
46 //=========================================================
47   InitIOVars();
48   DefineOutput(0, TTree::Class());
49 }
50
51 //_____________________________________________________________________________
52 AliRsnReaderTask::AliRsnReaderTask(const AliRsnReaderTask& obj) :
53     AliRsnBaseAT(obj),
54     fRsnTree(0x0)
55 {
56 //=========================================================
57 // Copy constructor (not recommended)
58 //=========================================================
59 }
60
61 //_____________________________________________________________________________
62 AliRsnReaderTask& AliRsnReaderTask::operator= (const AliRsnReaderTask& /*obj*/)
63 {
64 //=========================================================
65 // Assignment operator (not recommended)
66 //=========================================================
67
68   AliInfo("Not implemented. Avoid using the assignment operator");
69   return *this;
70 }
71
72 //_____________________________________________________________________________
73 void AliRsnReaderTask::InitIOVars()
74 {
75 //=========================================================
76 // Init values for input and output data
77 //=========================================================
78   AliDebug(AliLog::kDebug, "<-");
79   AliRsnBaseAT::InitIOVars();
80   AliDebug(AliLog::kDebug, "->");
81 }
82
83 //_____________________________________________________________________________
84 void AliRsnReaderTask::CreateOutputObjects()
85 {
86 //=========================================================
87 // Create the output container
88 //=========================================================
89
90   AliDebug(1, "Creating output objects");
91   OpenFile(0);
92   fRsnTree = new TTree("aodTree", "AliRsnEvents");
93
94   fRSN[0] = new AliRsnEvent();
95   fRSN[0]->SetName("rsnEvents");
96   fRSN[0]->Init();
97   fRsnTree->Branch("rsnEvents","AliRsnEvent",&fRSN[0]);
98 //     AddAODBranch("AliRsnEvent", &fRsnEvent);
99 }
100
101 //_____________________________________________________________________________
102 void AliRsnReaderTask::LocalInit()
103 {
104 //=========================================================
105 // Initialization
106 //=========================================================
107
108   AliDebug(1, "Initializing");
109 }
110
111 Bool_t AliRsnReaderTask::Notify()
112 {
113   return kTRUE;
114 }
115
116 //_____________________________________________________________________________
117 void AliRsnReaderTask::Exec(Option_t */*option*/)
118 {
119 //=========================================================
120 // Loops on input container to store data of all tracks.
121 // Uses the AliRsnReader methods to save them in the output.
122 //=========================================================
123
124   fRSN[0] = GetRsnEventFromInputType(0);
125   if (!fRSN[0]) return;
126   AliInfo(Form("Collected %d tracks", fRSN[0]->GetMultiplicity()));
127
128   fRsnTree->Fill();
129   PostData(0, fRsnTree);
130 }
131
132 //_____________________________________________________________________________
133 void AliRsnReaderTask::Terminate(Option_t */*option*/)
134 {
135 //=========================================================
136 // Terminate analysis
137 //=========================================================
138
139   AliDebug(1, "Terminating");
140 }
141