]>
Commit | Line | Data |
---|---|---|
b254f323 | 1 | #include <TString.h> |
2 | #include <TClonesArray.h> | |
3 | ||
4 | #include "AliAnalysisManager.h" | |
5 | ||
6 | #include "AliAODHandler.h" | |
7 | #include "AliAODEvent.h" | |
8 | ||
9 | #include "AliPicoHeaderCJ.h" | |
10 | #include "AliPicoV0RD.h" | |
11 | #include "AliPicoV0MC.h" | |
12 | ||
13 | #include "AliAnalysisTaskSEPicoV0Filter.h" | |
14 | ||
15 | ClassImp(AliAnalysisTaskSEPicoV0Filter) | |
16 | ||
17 | //_____________________________________________________________________________ | |
18 | AliAnalysisTaskSEPicoV0Filter::AliAnalysisTaskSEPicoV0Filter() : | |
19 | AliAnalysisTaskSE(), | |
20 | fIsAnaInfoMC(kFALSE), | |
21 | fV0s(0), | |
22 | fPicoHeaderCJ(0), | |
23 | fPicoV0sClArr(0), | |
24 | fListUserOutputs(0) | |
25 | { | |
26 | // | |
27 | // AliAnalysisTaskSEPicoV0Filter::AliAnalysisTaskSEPicoV0Filter | |
28 | // | |
29 | } | |
30 | ||
31 | //_____________________________________________________________________________ | |
32 | AliAnalysisTaskSEPicoV0Filter::AliAnalysisTaskSEPicoV0Filter(const char *name) : | |
33 | AliAnalysisTaskSE(name), | |
34 | fIsAnaInfoMC(kFALSE), | |
35 | fV0s(0), | |
36 | fPicoHeaderCJ(0), | |
37 | fPicoV0sClArr(0), | |
38 | fListUserOutputs(0) | |
39 | { | |
40 | // | |
41 | // AliAnalysisTaskSEPicoV0Filter::AliAnalysisTaskSEPicoV0Filter | |
42 | // | |
43 | ||
44 | //DefineOutput(2, TList::Class()); | |
45 | } | |
46 | ||
47 | //_____________________________________________________________________________ | |
48 | AliAnalysisTaskSEPicoV0Filter::~AliAnalysisTaskSEPicoV0Filter() | |
49 | { | |
50 | // | |
51 | // AliAnalysisTaskSEPicoV0Filter::~AliAnalysisTaskSEPicoV0Filter | |
52 | // | |
53 | ||
54 | if (fV0s) { delete fV0s; fV0s = 0; } | |
55 | if (fPicoHeaderCJ) { delete fPicoHeaderCJ; fPicoHeaderCJ = 0; } | |
56 | if (fPicoV0sClArr) { delete fPicoV0sClArr; fPicoV0sClArr = 0; } | |
57 | if (fListUserOutputs) { delete fListUserOutputs; fListUserOutputs = 0; } | |
58 | } | |
59 | ||
60 | //_____________________________________________________________________________ | |
61 | void AliAnalysisTaskSEPicoV0Filter::Init() | |
62 | { | |
63 | // | |
64 | // AliAnalysisTaskSEPicoV0Filter::Init | |
65 | // | |
66 | ||
67 | return; | |
68 | } | |
69 | ||
70 | //_____________________________________________________________________________ | |
71 | void AliAnalysisTaskSEPicoV0Filter::UserCreateOutputObjects() | |
72 | { | |
73 | // | |
74 | // AliAnalysisTaskSEPicoV0Filter::UserCreateOutputObjects | |
75 | // | |
76 | ||
77 | fPicoHeaderCJ = new AliPicoHeaderCJ(); | |
78 | fPicoHeaderCJ->SetName("PicoHeaderCJ"); | |
79 | AddAODBranch("AliPicoHeaderCJ", &fPicoHeaderCJ); | |
80 | ||
81 | if (fIsAnaInfoMC) { | |
82 | fPicoV0sClArr = new TClonesArray("AliPicoV0MC"); | |
83 | fPicoV0sClArr->SetName("PicoV0sMC"); | |
84 | } else { | |
85 | fPicoV0sClArr = new TClonesArray("AliPicoV0RD"); | |
86 | fPicoV0sClArr->SetName("PicoV0sRD"); | |
87 | } | |
88 | ||
89 | AddAODBranch("TClonesArray", &fPicoV0sClArr); | |
90 | ||
91 | /*fListUserOutputs = new TList(); | |
92 | fListUserOutputs->SetOwner(); | |
93 | CreateUserOutputHistograms(); | |
94 | PostData(1, fListUserOutputs);*/ | |
95 | return; | |
96 | } | |
97 | ||
98 | //_____________________________________________________________________________ | |
99 | void AliAnalysisTaskSEPicoV0Filter::Terminate(Option_t */*opt*/) | |
100 | { | |
101 | // | |
102 | // AliAnalysisTaskSEPicoV0Filter::Terminate | |
103 | // | |
104 | ||
105 | return; | |
106 | } | |
107 | ||
108 | //_____________________________________________________________________________ | |
109 | void AliAnalysisTaskSEPicoV0Filter::UserExec(Option_t */*opt*/) | |
110 | { | |
111 | // | |
112 | // AliAnalysisTaskSEPicoV0Filter::Run | |
113 | // | |
114 | ||
115 | Int_t ncs = 0; | |
116 | fPicoHeaderCJ->Reset(); | |
117 | fPicoV0sClArr->Delete(); | |
118 | //============================================================================= | |
119 | ||
120 | AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler()->SetFillAOD(kTRUE); | |
121 | //============================================================================= | |
122 | ||
123 | fPicoHeaderCJ->SetEventInfo(fInputHandler); | |
124 | fV0s = dynamic_cast<TClonesArray*>(InputEvent()->FindListObject("PicoV0s")); if (!fV0s) return; | |
125 | //============================================================================= | |
126 | ||
127 | AliPicoV0RD *pV0RD = 0; | |
128 | AliPicoV0MC *pV0MC = 0; | |
129 | ncs = fPicoV0sClArr->GetEntriesFast(); | |
130 | for (Int_t i=0; i<fV0s->GetEntriesFast(); i++) { | |
131 | if (fIsAnaInfoMC) { | |
132 | pV0MC = static_cast<AliPicoV0MC*>(fV0s->At(i)); if (!pV0MC) continue; | |
133 | new ((*fPicoV0sClArr)[ncs++]) AliPicoV0MC(*pV0MC); | |
134 | pV0MC = 0; | |
135 | } else { | |
136 | pV0RD = static_cast<AliPicoV0RD*>(fV0s->At(i)); if (!pV0RD) continue; | |
137 | new ((*fPicoV0sClArr)[ncs++]) AliPicoV0RD(*pV0RD); | |
138 | pV0RD = 0; | |
139 | } | |
140 | } | |
141 | ||
142 | return; | |
143 | } | |
144 | ||
145 | //_____________________________________________________________________________ | |
146 | void AliAnalysisTaskSEPicoV0Filter::CreateUserOutputHistograms() | |
147 | { | |
148 | // | |
149 | // AliAnalysisTaskSEPicoV0Filter::CreateUserOutputHistograms | |
150 | // | |
151 | ||
152 | if (!fListUserOutputs) return; | |
153 | ||
154 | Bool_t bStatusTmpH = TH1::AddDirectoryStatus(); | |
155 | TH1::AddDirectory(kFALSE); | |
156 | ||
157 | TH1::AddDirectory(bStatusTmpH); | |
158 | return; | |
159 | } |