Undoing some unwanted method renames
[u/mrichter/AliRoot.git] / PWGJE / macros / AddTaskPID.C
CommitLineData
e131b05f 1AliAnalysisTask *AddTaskPID(TString nameSuffix, Bool_t writeOutputToSeparateFiles = kTRUE,
2 Bool_t useConvolutedGauss = kTRUE, TString centralityEstimator = "V0A",
cf2ab645 3 Bool_t considerJets = kTRUE, Bool_t overrideStoreCentralityPercentile = kFALSE,
f0465e68 4 Bool_t overrideStoreCentralityPercentileValue = kFALSE,
5 TString listOfFiles = "")
e131b05f 6{
7 // Macro to set up and add PID task with default settings.
8 //
9 // Typical parameters to run on 11a1* (MC_pp@7TeV):
10 // "PWGJE_taskPID_Jets", kTRUE, kTRUE, "V0A", kTRUE
11 // and as a second task
12 // "PWGJE_taskPID_Jets_Inclusive", kTRUE, kTRUE, "V0A", kTRUE
13
14 TString taskName = Form("PWGJE_taskPID%s", nameSuffix.Data());
15
16
17 // Get the current analysis manager
18 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
19 if (!mgr) {
20 ::Error("AddTaskPID", "No analysis manager found.");
21 return 0x0;
22 }
23
24 //========= Add task to the ANALYSIS manager =====
25 AliAnalysisTaskPID *task = new AliAnalysisTaskPID(taskName.Data());
26 task->SelectCollisionCandidates(AliVEvent::kMB | AliVEvent::kINT7);
27
28
29
30 printf("\nSetting up task %s:\n", taskName.Data());
e131b05f 31
32 if (!considerJets) {
33 //
34 // Add track filters
35 //
36
37 AliAnalysisFilter* trackFilter = new AliAnalysisFilter("trackFilter");
38 AliESDtrackCuts* esdTrackCutsL = 0x0;
39
40 if (listOfFiles.Contains("LHC11") || listOfFiles.Contains("LHC12") || listOfFiles.Contains("LHC13")) {
41 esdTrackCutsL = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011(kTRUE);
42 printf("Using standard ITS-TPC track cuts 2011\n");
43 trackFilter->SetTitle("Standard ITS-TPC track cuts 2011");
44 }
45 else if (listOfFiles.Contains("LHC10")) {
46 esdTrackCutsL = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(kTRUE);
47 printf("Using standard ITS-TPC track cuts 2010\n");
48 trackFilter->SetTitle("Standard ITS-TPC track cuts 2010");
49 }
50 else {
51 esdTrackCutsL = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011(kTRUE);
52 printf("WARNING: Cuts not configured for this period!!! Using standard ITS-TPC track cuts 2011\n");
53 trackFilter->SetTitle("Standard ITS-TPC track cuts 2011");
54 }
55 /*
56 esdTrackCutsL->SetMinNCrossedRowsTPC(120);
57 esdTrackCutsL->SetMinRatioCrossedRowsOverFindableClustersTPC(0.8);
58 esdTrackCutsL->SetMaxChi2PerClusterITS(36);
59 esdTrackCutsL->SetMaxFractionSharedTPCClusters(0.4);
60 esdTrackCutsL->SetMaxChi2TPCConstrainedGlobal(36);
61 */
62
63 trackFilter->AddCuts(esdTrackCutsL);
64 task->SetTrackFilter(trackFilter);
65 }
66
67 // Test whether we have pPb or Pbp
68 if (listOfFiles.Contains("pPb") || listOfFiles.Contains("Pbp")) {
69 task->SetIsPbpOrpPb(kTRUE);
70 printf("pPb/Pbp detected -> Adapting vertex cuts!\n");
f0465e68 71 task->SetCentralityEstimator("V0A");
e131b05f 72 }
73 else {
74 task->SetIsPbpOrpPb(kFALSE);
75 printf("Collision type different from pPb/Pbp detected -> Using standard vertex cuts!\n");
76 }
77
8aa84348 78 // Do not store centrality percentile for pp (will be set to -1 for all events) - or use special centrality estimator and store
79 if (listOfFiles.Contains("pp")) {
80 //task->SetStoreCentralityPercentile(kFALSE);
81
82 task->SetStoreCentralityPercentile(kTRUE);
83 task->SetCentralityEstimator("ITSTPCtracklets");
84 }
e131b05f 85 else
86 task->SetStoreCentralityPercentile(kTRUE);
87
cf2ab645 88 if (overrideStoreCentralityPercentile)
89 task->SetStoreCentralityPercentile(overrideStoreCentralityPercentileValue);
90
e131b05f 91 task->SetEtaAbsCutRange(0.0, 0.9);
92 task->SetUsePhiCut(kFALSE);
93
94 // Do not set the covolution parameters if they are not used (saves some cpu time for the initialisation)
95 if (useConvolutedGauss) {
96 if ((listOfFiles.Contains("pPb") || listOfFiles.Contains("Pbp")) && listOfFiles.Contains("LHC13")) {
97 printf("\n13* pPb @ 5.023 ATeV data detected -> Setting corresponding convolution parameters...\n");
98 task->SetConvolutedGaussLambdaParameter(3.0);
99 }
100
101 if (listOfFiles.Contains("LHC11a_without_SDD")) {
102 printf("\n11a (pp 2.76 TeV) detected -> Setting corresponding convolution parameters...\n");
103 task->SetConvolutedGaussLambdaParameter(3.0);
104 }
105 else {
106 printf("\nUsing default convolution parameters...\n");
107 task->SetConvolutedGaussLambdaParameter(2.0);
108 }
109 }
110
111 task->SetCentralityEstimator(centralityEstimator.Data());
112
113 task->SetUseMCidForGeneration(kTRUE);
114 task->SetUseITS(kTRUE);
115 task->SetUseTOF(kTRUE);
116 task->SetUsePriors(kTRUE);
117 task->SetUseTPCDefaultPriors(kTRUE);
118 task->SetUseConvolutedGaus(useConvolutedGauss);
119 task->SetTakeIntoAccountMuons(kTRUE);
120
121 task->SetInputFromOtherTask(considerJets);
122 task->SetStoreAdditionalJetInformation(considerJets);
123
124 task->PrintSettings();
125
126 mgr->AddTask(task);
127
128
129 //================================================
130 // data containers
131 //================================================
132
133 //define output containers
134 AliAnalysisDataContainer *coutput1 =
135 mgr->CreateContainer(Form("%s", taskName.Data()),
136 TObjArray::Class(),
137 AliAnalysisManager::kOutputContainer,
138 writeOutputToSeparateFiles
139 ? Form("%s.root", taskName.Data())
140 : Form("%s:%s", AliAnalysisManager::GetCommonFileName(), taskName.Data()));
9e95a906 141
cf2ab645 142 if (task->GetDoEfficiency()) {
143 AliAnalysisDataContainer *coutput2 =
144 mgr->CreateContainer(Form("%s_efficiency", taskName.Data()),
145 AliCFContainer::Class(),
146 AliAnalysisManager::kOutputContainer,
147 writeOutputToSeparateFiles
148 ? Form("%s_efficiency.root", taskName.Data())
149 : Form("%s:%s_efficiency", AliAnalysisManager::GetCommonFileName(), taskName.Data()));
150 mgr->ConnectOutput (task, 2, coutput2);
151 }
152
153 if (task->GetDoDeDxCheck() || task->GetDoPtResolution()) {
154 AliAnalysisDataContainer *coutput3 =
155 mgr->CreateContainer(Form("%s_PtResolution", taskName.Data()),
156 TObjArray::Class(),
157 AliAnalysisManager::kOutputContainer,
158 writeOutputToSeparateFiles
159 ? Form("%s_PtResolution.root", taskName.Data())
160 : Form("%s:%s_PtResolution", AliAnalysisManager::GetCommonFileName(), taskName.Data()));
161 mgr->ConnectOutput (task, 3, coutput3);
162 }
e131b05f 163 //connect containers
164 mgr->ConnectInput (task, 0, mgr->GetCommonInputContainer());
165 mgr->ConnectOutput (task, 0, mgr->GetCommonOutputContainer()); // comment to run local
166 mgr->ConnectOutput (task, 1, coutput1);
e131b05f 167
168 return task;
169}