modifications related to primary track selection
[u/mrichter/AliRoot.git] / PWG1 / macros / AddTaskPerformanceTPC.C
CommitLineData
a62207f1 1///////////////////////////////////////////////////////////////////////////////
2// Macro to setup AliPerformanceTask for
3// TPC performance QA to run on PWG1 QA train.
4//
5// Input: ESDs, ESDfriends (optional), Kinematics (optional), TrackRefs (optional)
6// ESD and MC input handlers must be attached to AliAnalysisManager
7// to run default configuration.
8//
9// By default 7 performance components are added to
10// the task:
11// 1. AliPerformanceRes (TPC track resolution w.r.t MC at DCA)
12// 2. AliPerformanceResTPCInner (TPC track resolution w.r.t MC at inner TPC wall)
13// 3. AliPerformanceResTPCOuter (TPC track resolution w.r.t MC at outer TPC wall)
14// 4. AliPerformanceEff (TPC track reconstruction efficiency, MC primaries)
15// 5. AliPerformanceDEdxTPCInner (TPC dEdx response - track parameters at TPC inner wall)
16// 6. AliPerformanceDCA (TPC impact parameters resolution at DCA)
78a97597 17// 7. AliPerformanceTPC (TPC cluster and track and event information)
18// 8. AliPerformanceMatch (TPC and ITS/TRD matching and TPC eff w.r.t ITS)
a62207f1 19//
20// Usage on the analysis train (default configuration):
21// gSystem->Load("libANALYSIS");
22// gSystem->Load("libANALYSISalice");
23// gSystem->Load("libTPCcalib.so");
78a97597 24// gSystem->Load("libTENDER.so");
a62207f1 25// gSystem->Load("libPWG1.so");
26//
27// gROOT->LoadMacro("$ALICE_ROOT/PWG1/macros/AddTaskPerformanceTPC.C");
28// AliPerformanceTask *tpcQA = AddTaskPerformanceTPC("kTRUE","kTRUE");
29//
30// Output:
31// TPC.Performance.root file with TPC performance components is created.
32//
33// Each of the components contains THnSparse generic histograms which
34// have to be analysed (post-analysis) by using Analyse() function.
35// Each component contains such function.
36//
37//13.10.2009 - J.Otwinowski@gsi.de
38///////////////////////////////////////////////////////////////////////////////
39
40//____________________________________________
41AliPerformanceTask* AddTaskPerformanceTPC(Bool_t bUseMCInfo=kTRUE, Bool_t bUseESDfriend=kTRUE)
42{
43 //
44 // Add AliPerformanceTask with TPC performance components
45 //
46 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
47 if(!mgr) {
48 Error("AddTaskPerformanceTPC","AliAnalysisManager not set!");
49 return NULL;
50 }
51
52 TString type = mgr->GetInputEventHandler()->GetDataType();
53 if (!type.Contains("ESD")) {
54 Error("AddTaskPerformanceTPC", "ESD input handler needed!");
55 return NULL;
56 }
57
58 AliMCEventHandler *mcH = (AliMCEventHandler*)mgr->GetMCtruthEventHandler();
59 if (!mcH && bUseMCInfo) {
60 Error("AddTaskPerformanceTPC", "MC input handler needed!");
61 return NULL;
62 }
63
64 //
65 // Create task
66 //
67 AliPerformanceTask *task = new AliPerformanceTask("Performance","TPC Performance");
68 if (!task) {
69 Error("AddTaskPerformanceTPC", "TPC performance task cannot be created!");
70 return NULL;
71 }
72 task->SetUseMCInfo(bUseMCInfo);
73 task->SetUseESDfriend(bUseESDfriend);
74
75 //
76 // Add task to analysis manager
77 //
78 mgr->AddTask(task);
79
80 //
81 // Create TPC-ESD track reconstruction cuts
82 //
83 AliRecInfoCuts *pRecInfoCuts = new AliRecInfoCuts();
84 if(pRecInfoCuts) {
85 pRecInfoCuts->SetMaxDCAToVertexXY(3.0);
86 pRecInfoCuts->SetMaxDCAToVertexZ(3.0);
87 pRecInfoCuts->SetMinNClustersTPC(50);
88 pRecInfoCuts->SetMinNClustersITS(2);
89 pRecInfoCuts->SetHistogramsOn(kFALSE);
78a97597 90 pRecInfoCuts->SetTPCITSMatchingRadius(70);
91 pRecInfoCuts->SetTPCTRDMatchingRadius(260);
a62207f1 92 }
93 else {
94 Error("AddTaskPerformanceTPC", "AliRecInfoCuts cannot be created!");
95 return NULL;
96 }
97 //
98 // Create TPC-MC track reconstruction cuts
99 //
100 AliMCInfoCuts *pMCInfoCuts = new AliMCInfoCuts();
101 if(pMCInfoCuts) {
102 pMCInfoCuts->SetMinTrackLength(70);
103 }
104 else {
105 Error("AddTaskPerformanceTPC", "AliMCInfoCuts cannot be created!");
106 return NULL;
107 }
108
109 //
110 // Create performance objects for TPC and set cuts
111 //
112 enum { kTPC = 0, kTPCITS, kConstrained, kTPCInner, kTPCOuter, kTPCSec };
113
114 //
115 // Resolution
116 //
117 AliPerformanceRes *pCompRes0 = new AliPerformanceRes("AliPerformanceRes","AliPerformanceRes",kTPC,kFALSE);
118 if(!pCompRes0) {
119 Error("AddTaskPerformanceTPC", "Cannot create AliPerformanceRes");
120 }
121 pCompRes0->SetAliRecInfoCuts(pRecInfoCuts);
122 pCompRes0->SetAliMCInfoCuts(pMCInfoCuts);
123
124 AliPerformanceRes *pCompRes3 = new AliPerformanceRes("AliPerformanceResTPCInner","AliPerformanceResTPCInner",kTPCInner,kFALSE);
125 if(!pCompRes3) {
126 Error("AddTaskPerformanceTPC", "Cannot create AliPerformanceResTPCInner");
127 }
128 pCompRes3->SetAliRecInfoCuts(pRecInfoCuts);
129 pCompRes3->SetAliMCInfoCuts(pMCInfoCuts);
130
131 AliPerformanceRes *pCompRes4 = new AliPerformanceRes("AliPerformanceResTPCOuter","AliPerformanceResTPCOuter",kTPCOuter,kFALSE);
132 if(!pCompRes4) {
133 Error("AddTaskPerformanceTPC", "Cannot create AliPerformanceResTPCOuter");
134 }
135 pCompRes4->SetAliRecInfoCuts(pRecInfoCuts);
136 pCompRes4->SetAliMCInfoCuts(pMCInfoCuts);
a62207f1 137 //
138 // Efficiency
139 //
140 AliPerformanceEff *pCompEff0 = new AliPerformanceEff("AliPerformanceEff","AliPerformanceEff",kTPC,kFALSE);
141 if(!pCompEff0) {
142 Error("AddTaskPerformanceTPC", "Cannot create AliPerformanceEff");
143 }
144 pCompEff0->SetAliRecInfoCuts(pRecInfoCuts);
145 pCompEff0->SetAliMCInfoCuts(pMCInfoCuts);
146 //
147 // dEdx
148 //
149 AliPerformanceDEdx *pCompDEdx3 = new AliPerformanceDEdx("AliPerformanceDEdxTPCInner","AliPerformanceDEdxTPCInner",kTPCInner,kFALSE);
150 if(!pCompDEdx3) {
151 Error("AddTaskPerformanceTPC", "Cannot create AliPerformanceDEdxTPCInner");
152 }
153 pCompDEdx3->SetAliRecInfoCuts(pRecInfoCuts);
154 pCompDEdx3->SetAliMCInfoCuts(pMCInfoCuts);
155 //
156 // DCA
157 //
158 AliPerformanceDCA *pCompDCA0 = new AliPerformanceDCA("AliPerformanceDCA","AliPerformanceDCA",kTPC,kFALSE);
159 if(!pCompDCA0) {
160 Error("AddTaskPerformanceTPC", "Cannot create AliPerformanceDCA");
161 }
162 pCompDCA0->SetAliRecInfoCuts(pRecInfoCuts);
163 pCompDCA0->SetAliMCInfoCuts(pMCInfoCuts);
164 //
165 // TPC performance
166 //
167 AliPerformanceTPC *pCompTPC0 = new AliPerformanceTPC("AliPerformanceTPC","AliPerformanceTPC",kTPC,kFALSE);
168 if(!pCompTPC0) {
169 Error("AddTaskPerformanceTPC", "Cannot create AliPerformanceTPC");
170 }
171 pCompTPC0->SetAliRecInfoCuts(pRecInfoCuts);
172 pCompTPC0->SetAliMCInfoCuts(pMCInfoCuts);
78a97597 173 //
174 // TPC+ITS matching performance
175 //
176 AliPerformanceMatch *pCompMatch0 = new AliPerformanceMatch("AliPerformanceMatchTPCITS","AliPerformanceMatch",0,kFALSE);
177 if(!pCompMatch0) {
178 Error("AddTaskPerformanceMatch", "Cannot create AliPerformanceMatchTPCITS");
179 }
180 pCompMatch0->SetAliRecInfoCuts(pRecInfoCuts);
181 pCompMatch0->SetAliMCInfoCuts(pMCInfoCuts);
182 //
183 // TPC+TRD matching performance
184 //
185 AliPerformanceMatch *pCompMatch1 = new AliPerformanceMatch("AliPerformanceMatchTPCTRD","AliPerformanceMatch",1,kFALSE);
186 if(!pCompMatch1) {
187 Error("AddTaskPerformanceMatch", "Cannot create AliPerformanceMatchTPCTRD");
188 }
189 pCompMatch1->SetAliRecInfoCuts(pRecInfoCuts);
190 pCompMatch1->SetAliMCInfoCuts(pMCInfoCuts);
a62207f1 191
78a97597 192 AliPerformanceMatch *pCompMatch2 = new AliPerformanceMatch("AliPerformanceMatchTPCEFF","AliPerformanceMatchTPCEFF",2,kFALSE);
193 if(!pCompMatch2) {
194 Error("AddTaskPerformanceMatch", "Cannot create AliPerformanceMatchTPCEFF");
195 }
196 pCompMatch2->SetAliRecInfoCuts(pRecInfoCuts);
197 pCompMatch2->SetAliMCInfoCuts(pMCInfoCuts);
198
a62207f1 199 //
78a97597 200 // Add components to the performance task
a62207f1 201 //
78a97597 202 if(bUseMCInfo) task->AddPerformanceObject( pCompRes0 );
203 if(bUseMCInfo) task->AddPerformanceObject( pCompRes3 );
204 if(bUseMCInfo) task->AddPerformanceObject( pCompRes4 );
205 if(bUseMCInfo)task->AddPerformanceObject( pCompEff0 );
a62207f1 206 task->AddPerformanceObject( pCompDEdx3 );
207 task->AddPerformanceObject( pCompDCA0 );
208 task->AddPerformanceObject( pCompTPC0 );
78a97597 209 task->AddPerformanceObject( pCompMatch0 );
210 task->AddPerformanceObject( pCompMatch1 );
211 task->AddPerformanceObject( pCompMatch2 );
a62207f1 212
213 //
214 // Create containers for input
215 //
43d01ef0 216 mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
a62207f1 217
218 //
219 // Create containers for output
220 //
43d01ef0 221 AliAnalysisDataContainer *coutput_tpc = mgr->CreateContainer("TPC", TList::Class(), AliAnalysisManager::kOutputContainer, Form("TPC.%s.root", task->GetName()));
222 mgr->ConnectOutput(task, 0, coutput_tpc);
a62207f1 223
224return task;
225}