6f884e25b27ac2ca84bd562d9bcfbfbede001f2a
[u/mrichter/AliRoot.git] / FMD / analysis / AliFMDAnalysisTaskSE.cxx
1 #include "AliFMDAnalysisTaskSE.h"
2 #include "AliESDEvent.h"
3 #include "iostream"
4 #include "AliESDFMD.h"
5
6 ClassImp(AliFMDAnalysisTaskSE)
7
8 //_____________________________________________________________________
9 AliFMDAnalysisTaskSE::AliFMDAnalysisTaskSE():
10 AliAnalysisTaskSE(),
11   fListOfHistos(0),
12   fSharing("Sharing",kFALSE),
13   fDensity("Density",kFALSE),
14   fBackground("BackgroundCorrected",kFALSE),
15   fDndeta("dNdeta",kFALSE),
16   fPrimary(kTRUE)
17 {
18   // Default constructor
19 }
20 //_____________________________________________________________________
21 AliFMDAnalysisTaskSE::AliFMDAnalysisTaskSE(const char* name):
22   AliAnalysisTaskSE(name),
23   fListOfHistos(0),
24   fSharing("Sharing",kFALSE),
25   fDensity("Density",kFALSE),
26   fBackground("BackgroundCorrected",kFALSE),
27   fDndeta("dNdeta",kFALSE),
28   fPrimary(kTRUE)
29 {
30   
31   DefineOutput(1, TList::Class());
32 }
33 //_____________________________________________________________________
34 void AliFMDAnalysisTaskSE::UserCreateOutputObjects()
35 {
36 // Create the output containers
37 //
38   fListOfHistos = new TList();
39   
40   AliESDFMD* fmd = new AliESDFMD();
41   AliESDVertex* vertex = new AliESDVertex();
42   
43   TObjString* vtxString1 = new TObjString();
44   
45   TList* densitylist = new TList();
46   
47   TList* bgcorlist = new TList();
48   
49   fSharing.SetFMDData(fmd);
50   fSharing.SetVertex(vertex);
51   fSharing.SetOutputList(fListOfHistos);
52
53   fDensity.SetOutputList(densitylist);
54   fDensity.SetInputESDFMD(fmd) ;
55   fDensity.SetInputVertex(vertex);
56   
57   fBackground.SetInputList(densitylist);
58   fBackground.SetOutputList(bgcorlist);
59   fBackground.SetHitList(fListOfHistos);
60   fBackground.SetOutputVertex(vtxString1);
61   
62   fDndeta.SetInputVertex(vtxString1);
63   fDndeta.SetInputList(bgcorlist); 
64   fDndeta.SetOutputList(fListOfHistos); 
65   fDndeta.SetAnalyzePrimary(fPrimary);
66   fSharing.CreateOutputObjects();
67   fDensity.CreateOutputObjects();
68   fBackground.CreateOutputObjects();
69   fDndeta.CreateOutputObjects();
70   
71   
72   
73 }
74 //_____________________________________________________________________
75 void AliFMDAnalysisTaskSE::Init()
76 {
77   std::cout<<"Init"<<std::endl;
78 }
79 //_____________________________________________________________________
80 void AliFMDAnalysisTaskSE::UserExec(Option_t */*option*/)
81 {
82   // Execute analysis for current event
83   //
84   AliESDEvent* fESD = (AliESDEvent*)InputEvent();
85   fSharing.SetInputESD(fESD);
86   
87   fSharing.Exec("");
88   if(fSharing.GetEventStatus()) {
89     fDensity.Exec("");
90     if(fDensity.GetEventStatus()) {
91       fBackground.Exec("");  
92       AliMCEvent* mcevent = MCEvent();
93       fDndeta.SetMCEvent(mcevent);
94       fDndeta.Exec("");
95       
96     }
97   }
98   else
99     return;
100   
101   //fListOfHistos = fBackground.GetOutputList();
102   
103   PostData(1, fListOfHistos);
104 }
105 //_____________________________________________________________________
106 void AliFMDAnalysisTaskSE::Terminate(Option_t */*option*/)
107 {
108   fDndeta.Terminate("");
109
110 }
111 //_____________________________________________________________________
112 //
113 // EOF
114 //