c1bfc12575a6482050894ebb9d966c5e76c7a561
[u/mrichter/AliRoot.git] / PWGJE / FlavourJetTasks / macros / AddTasksPicoV0Filter.C
1 const Bool_t bAnaInfoMC     = kTRUE;
2 const Bool_t bIsInfoAOD     = kTRUE;
3 const Bool_t bIsPhysSel     = kFALSE;
4 const Bool_t bIsCentSel     = kFALSE;
5 const Bool_t bIsEvPnSel     = kFALSE;
6 const Bool_t bIsRespPID     = kTRUE;
7 const UInt_t wTriggerMask   = AliVEvent::kINT7;
8 const UInt_t wCollisionType = AliPicoHeaderCJ::kPA;
9
10 const TString sCentEsti     = "V0A";  // "V0M"; "V0A"; "V0C"
11 //=============================================================================
12
13 Bool_t AddTasksPicoV0Filter()
14 {
15   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
16
17   if (bIsInfoAOD) {
18     gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/train/AddAODHandler.C");
19     AliAODInputHandler *aodIH = AddAODHandler();
20   } else {
21     gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/train/AddESDHandler.C");
22     AliESDInputHandler *esdIH = AddESDHandler();
23 //  esdIH->SetReadFriends(kFALSE);
24   }
25
26   if (bAnaInfoMC && !bIsInfoAOD) {
27     gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/train/AddMCHandler.C");
28     AliMCEventHandler *mctEH = AddMCHandler(kFALSE);
29   }
30
31   gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/train/AddAODOutputHandler.C");
32   AliAODHandler *aodH = AddAODOutputHandler();
33   aodH->SetOutputFileName("AliAOD.PicoV0s.root");
34   aodH->SetFillAOD(kTRUE);
35   aodH->SetCreateNonStandardAOD();
36   mgr->SetOutputEventHandler(aodH);
37 //=============================================================================
38
39   if (bIsPhysSel) {
40     gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");
41     AliPhysicsSelectionTask *taskPhysSel = AddTaskPhysicsSelection(bAnaInfoMC);
42   }
43
44   if (bIsCentSel) {
45     gROOT->LoadMacro("$ALICE_ROOT/OADB/macros/AddTaskCentrality.C");
46     AliCentralitySelectionTask *taskCentSel = AddTaskCentrality(kTRUE, bIsAOD);
47     if (wTriggerMask) taskCentSel->SelectCollisionCandidates(wTriggerMask);
48     if (bAnaInfoMC)   taskCentSel->SetMCInput();
49   }
50
51   if (bIsEvPnSel) {
52     gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskEventplane.C");
53     AliEPSelectionTask *taskEventPlane = AddTaskEventplane();
54     if (wTriggerMask) taskEventPlane->SelectCollisionCandidates(wTriggerMask);
55     if (bAnaInfoMC)   taskEventPlane->SetUseMCRP();
56   }
57
58   if (bIsRespPID) {
59     gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
60     AliAnalysisTaskSE *taskRespPID = AddTaskPIDResponse(bAnaInfoMC, kTRUE,
61                                                         kFALSE, 2,
62                                                         kFALSE, "",
63                                                         kTRUE, kTRUE,
64                                                         2);
65     if (wTriggerMask) taskRespPID->SelectCollisionCandidates(wTriggerMask);
66   }
67 //=============================================================================
68
69   AliAnalysisTaskSEPicoV0Maker *taskPicoV0Maker = new AliAnalysisTaskSEPicoV0Maker("AliAnalysisTaskSEPicoV0Maker", bAnaInfoMC);
70   if (wTriggerMask) {
71     taskPicoV0Maker->SetTriggerMask(wTriggerMask);
72     taskPicoV0Maker->SelectCollisionCandidates(wTriggerMask);
73   }
74
75   taskPicoV0Maker->SetCollitionType(wCollisionType);
76   taskPicoV0Maker->SetCentralityEstimator(sCentEsti.Data());
77   taskPicoV0Maker->SetVertexContributorN(1);
78 //taskPicoV0Maker->SetRefitV0ESD();
79 //taskPicoV0Maker->SetSkipFastOnly();
80 //taskPicoV0Maker->SetDMPjetMC();
81
82   mgr->AddTask(taskPicoV0Maker);
83   mgr->ConnectInput(taskPicoV0Maker,  0, mgr->GetCommonInputContainer());
84   mgr->ConnectOutput(taskPicoV0Maker, 1, mgr->CreateContainer("listPicoV0MakerEH",
85                                                               TList::Class(),
86                                                               AliAnalysisManager::kOutputContainer,
87                                                               AliAnalysisManager::GetCommonFileName()));
88
89   if (bAnaInfoMC) mgr->ConnectOutput(taskPicoV0Maker, 2, mgr->CreateContainer("listPicoV0MakerMC",
90                                                                               TList::Class(),
91                                                                               AliAnalysisManager::kOutputContainer,
92                                                                               AliAnalysisManager::GetCommonFileName()));
93 //=============================================================================
94
95   AliAnalysisTaskSEPicoV0Filter *taskPicoV0Filter = new AliAnalysisTaskSEPicoV0Filter("AliAnalysisTaskSEPicoV0Filter");
96   if (wTriggerMask) taskPicoV0Filter->SelectCollisionCandidates(wTriggerMask);
97   taskPicoV0Filter->SetAnaInfoMC(bAnaInfoMC);
98
99   mgr->AddTask(taskPicoV0Filter);
100   mgr->ConnectInput(taskPicoV0Filter, 0, mgr->GetCommonInputContainer());
101 //=============================================================================
102
103 /*if (bAnaInfoMC) {
104     if (!bIsInfoAOD) {
105       AliAnalysisTaskExtractPerformanceV0 *taskExtractV0 = new AliAnalysisTaskExtractPerformanceV0("AliAnalysisTaskExtractPerformanceV0");
106       if (wTriggerMask) taskExtractV0->SelectCollisionCandidates(wTriggerMask);
107
108       taskExtractV0->SetIsNuclear(kTRUE);
109       taskExtractV0->SetINT7Trigger(kTRUE);
110       taskExtractV0->SetUseOnTheFly(kFALSE);
111       taskExtractV0->SetTakeAllTracks(kFALSE);
112       taskExtractV0->SetpARapidityShift();
113       taskExtractV0->SetCentralityEstimator(sCentEsti);
114       taskExtractV0->SetLightWeightAnalysis(kFALSE);
115       taskExtractV0->SetpAVertexSelection(kTRUE);
116       taskExtractV0->SetSpecialExecution(kFALSE);
117       taskExtractV0->SetSaveAssociatedOnly(kTRUE);
118       taskExtractV0->SetSkipTrigger(kTRUE);
119       taskExtractV0->SetDoNotCallTPCdEdx(kFALSE);
120 //    taskExtractV0->SetDiffractiveOnly(kTRUE);
121
122       mgr->AddTask(taskExtractV0);
123       mgr->ConnectInput(taskExtractV0,  0, mgr->GetCommonInputContainer());
124       mgr->ConnectOutput(taskExtractV0, 1, mgr->CreateContainer("clistV0MC",
125                                                                 TList::Class(),
126                                                                 AliAnalysisManager::kOutputContainer,
127                                                                 AliAnalysisManager::GetCommonFileName()));
128
129       AliAnalysisDataContainer *cV0Tree = mgr->CreateContainer("cTreeMC",
130                                                                TTree::Class(),
131                                                                AliAnalysisManager::kOutputContainer,
132                                                                AliAnalysisManager::GetCommonFileName());
133       cV0Tree->SetSpecialOutput();
134       mgr->ConnectOutput(taskExtractV0, 2, cV0Tree);
135     }
136   } else {
137     if (bIsInfoAOD) {
138       AliAnalysisTaskExtractV0AOD *taskExtractV0 = new AliAnalysisTaskExtractV0AOD("AliAnalysisTaskExtractV0AOD");
139       if (wTriggerMask) taskExtractV0->SelectCollisionCandidates(wTriggerMask);
140
141       taskExtractV0->SetIsNuclear(kTRUE);
142       taskExtractV0->SetIsLowEnergyPP(kFALSE);
143       taskExtractV0->SetUseOnTheFly(kFALSE);
144       taskExtractV0->SetTriggerMask("kINT7");
145
146       mgr->AddTask(taskExtractV0);
147       mgr->ConnectInput(taskExtractV0,  0, mgr->GetCommonInputContainer());
148       mgr->ConnectOutput(taskExtractV0, 1, mgr->CreateContainer("cListV0",
149                                                               TList::Class(),
150                                                               AliAnalysisManager::kOutputContainer,
151                                                               AliAnalysisManager::GetCommonFileName()));
152
153       AliAnalysisDataContainer *cV0Tree = mgr->CreateContainer("cTree",
154                                                                TTree::Class(),
155                                                                AliAnalysisManager::kOutputContainer,
156                                                                AliAnalysisManager::GetCommonFileName());
157       cV0Tree->SetSpecialOutput();
158       mgr->ConnectOutput(taskExtractV0, 2, cV0Tree);
159     } else {
160       AliAnalysisTaskExtractV0 *taskExtractV0 = new AliAnalysisTaskExtractV0("AliAnalysisTaskExtractV0");
161       if (wTriggerMask) taskExtractV0->SelectCollisionCandidates(wTriggerMask);
162
163       taskExtractV0->SetIsNuclear(kTRUE);
164       taskExtractV0->SetINT7Trigger(kTRUE);
165       taskExtractV0->SetUseOnTheFly(kFALSE);
166       taskExtractV0->SetTakeAllTracks(kFALSE);
167       taskExtractV0->SetCentralityEstimator(sCentEsti);
168       taskExtractV0->SetLightWeightAnalysis(kFALSE);
169       taskExtractV0->SetpAVertexSelection(kTRUE);
170       taskExtractV0->SetSkipTrigger(kFALSE);
171       taskExtractV0->SetTPCdEdxSelection(kFALSE);
172
173       mgr->AddTask(taskExtractV0);
174       mgr->ConnectInput(taskExtractV0,  0, mgr->GetCommonInputContainer());
175       mgr->ConnectOutput(taskExtractV0, 1, mgr->CreateContainer("clistV0",
176                                                                 TList::Class(),
177                                                                 AliAnalysisManager::kOutputContainer,
178                                                                 AliAnalysisManager::GetCommonFileName()));
179
180       AliAnalysisDataContainer *cV0Tree = mgr->CreateContainer("cTree",
181                                                                TTree::Class(),
182                                                                AliAnalysisManager::kOutputContainer,
183                                                                AliAnalysisManager::GetCommonFileName());
184       cV0Tree->SetSpecialOutput();
185       mgr->ConnectOutput(taskExtractV0, 2, cV0Tree);
186     }
187   }*/
188
189   return kFALSE;
190 }