AliPhysics  ec7afe5 (ec7afe5)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliAnalysisTaskSEPicoV0Filter.cxx
Go to the documentation of this file.
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 
14 
16 
17 //_____________________________________________________________________________
20 fIsAnaInfoMC(kFALSE),
21 fV0s(0),
22 fPicoHeaderCJ(0),
23 fPicoV0sClArr(0),
24 fListUserOutputs(0)
25 {
26 //
27 // AliAnalysisTaskSEPicoV0Filter::AliAnalysisTaskSEPicoV0Filter
28 //
29 }
30 
31 //_____________________________________________________________________________
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 //_____________________________________________________________________________
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; }
58 }
59 
60 //_____________________________________________________________________________
62 {
63 //
64 // AliAnalysisTaskSEPicoV0Filter::Init
65 //
66 
67  return;
68 }
69 
70 //_____________________________________________________________________________
72 {
73 //
74 // AliAnalysisTaskSEPicoV0Filter::UserCreateOutputObjects
75 //
76 
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 //_____________________________________________________________________________
100 {
101 //
102 // AliAnalysisTaskSEPicoV0Filter::Terminate
103 //
104 
105  return;
106 }
107 
108 //_____________________________________________________________________________
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 //_____________________________________________________________________________
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 }
int Int_t
Definition: External.C:63
void SetEventInfo(AliInputEventHandler *const pEH)
ClassImp(AliAnalysisTaskSEPicoV0Filter) AliAnalysisTaskSEPicoV0Filter
const char Option_t
Definition: External.C:48
bool Bool_t
Definition: External.C:53