TENDER becomes Tender
[u/mrichter/AliRoot.git] / PWGPP / macros / AddTaskPerformanceTPC.C
CommitLineData
a62207f1 1///////////////////////////////////////////////////////////////////////////////
2// Macro to setup AliPerformanceTask for
2bfe5463 3// TPC performance QA to run on PWGPP QA train.
a62207f1 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");
af472fff 24// gSystem->Load("libTender.so");
2bfe5463 25// gSystem->Load("libPWGPP.so");
a62207f1 26//
2bfe5463 27// gROOT->LoadMacro("$ALICE_ROOT/PWGPP/macros/AddTaskPerformanceTPC.C");
23733853 28// AliPerformanceTask *tpcQA = AddTaskPerformanceTPC("kTRUE","kTRUE","triggerClass");
a62207f1 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//____________________________________________
23733853 41AliPerformanceTask* AddTaskPerformanceTPC(Bool_t bUseMCInfo=kTRUE, Bool_t bUseESDfriend=kTRUE, const char *triggerClass="CINT1B-ABCE-NOPF-ALL")
a62207f1 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
9372eb77 82 // MB tracks
83 //
84 AliRecInfoCuts *pRecInfoCutsTPC = new AliRecInfoCuts();
85 if(pRecInfoCutsTPC) {
86 pRecInfoCutsTPC->SetMaxDCAToVertexXY(3.0);
87 pRecInfoCutsTPC->SetMaxDCAToVertexZ(30.0);
23733853 88 //pRecInfoCutsTPC->SetMaxDCAToVertexZ(3.0);
9372eb77 89 pRecInfoCutsTPC->SetRequireSigmaToVertex(kFALSE);
90 pRecInfoCutsTPC->SetRequireTPCRefit(kFALSE);
91 pRecInfoCutsTPC->SetAcceptKinkDaughters(kTRUE);
92 pRecInfoCutsTPC->SetMinNClustersTPC(50);
93 pRecInfoCutsTPC->SetMaxChi2PerClusterTPC(1000000.);
94 pRecInfoCutsTPC->SetDCAToVertex2D(kFALSE);
95
96 pRecInfoCutsTPC->SetHistogramsOn(kFALSE);
97 }
98 else {
99 Error("AddTaskPerformanceTPC", "AliRecInfoCutsTPC cannot be created!");
100 return NULL;
101 }
102
a62207f1 103 //
9372eb77 104 // Create TPC-ESD track reconstruction cuts
105 // MATCH tracks
106 //
107 AliRecInfoCuts *pRecInfoCutsMATCH = new AliRecInfoCuts();
108 if(pRecInfoCutsMATCH) {
109 pRecInfoCutsMATCH->SetMaxDCAToVertexXY(3.0);
110 pRecInfoCutsMATCH->SetMaxDCAToVertexZ(3.0);
111 pRecInfoCutsMATCH->SetRequireSigmaToVertex(kFALSE);
112 pRecInfoCutsMATCH->SetRequireTPCRefit(kFALSE);
113 pRecInfoCutsMATCH->SetAcceptKinkDaughters(kTRUE);
114 pRecInfoCutsMATCH->SetMinNClustersTPC(50);
115 pRecInfoCutsMATCH->SetMaxChi2PerClusterTPC(1000000.);
116 pRecInfoCutsMATCH->SetDCAToVertex2D(kFALSE);
117 pRecInfoCutsMATCH->SetTPCITSMatchingRadius(70);
118 pRecInfoCutsMATCH->SetTPCTRDMatchingRadius(260);
23733853 119 pRecInfoCutsMATCH->SetMinNClustersITS(3);
9372eb77 120
121 pRecInfoCutsMATCH->SetHistogramsOn(kFALSE);
122 }
123 else {
124 Error("AddTaskPerformanceTPC", "AliRecInfoCutsTPC cannot be created!");
125 return NULL;
126 }
127
128 //
129 // Create TPC-ESD track reconstruction cuts
130 // standard cuts
a62207f1 131 AliRecInfoCuts *pRecInfoCuts = new AliRecInfoCuts();
132 if(pRecInfoCuts) {
133 pRecInfoCuts->SetMaxDCAToVertexXY(3.0);
134 pRecInfoCuts->SetMaxDCAToVertexZ(3.0);
135 pRecInfoCuts->SetMinNClustersTPC(50);
136 pRecInfoCuts->SetMinNClustersITS(2);
137 pRecInfoCuts->SetHistogramsOn(kFALSE);
78a97597 138 pRecInfoCuts->SetTPCITSMatchingRadius(70);
139 pRecInfoCuts->SetTPCTRDMatchingRadius(260);
a62207f1 140 }
141 else {
142 Error("AddTaskPerformanceTPC", "AliRecInfoCuts cannot be created!");
143 return NULL;
144 }
145 //
146 // Create TPC-MC track reconstruction cuts
147 //
148 AliMCInfoCuts *pMCInfoCuts = new AliMCInfoCuts();
149 if(pMCInfoCuts) {
150 pMCInfoCuts->SetMinTrackLength(70);
151 }
152 else {
153 Error("AddTaskPerformanceTPC", "AliMCInfoCuts cannot be created!");
154 return NULL;
155 }
156
157 //
158 // Create performance objects for TPC and set cuts
159 //
160 enum { kTPC = 0, kTPCITS, kConstrained, kTPCInner, kTPCOuter, kTPCSec };
161
162 //
163 // Resolution
164 //
165 AliPerformanceRes *pCompRes0 = new AliPerformanceRes("AliPerformanceRes","AliPerformanceRes",kTPC,kFALSE);
166 if(!pCompRes0) {
167 Error("AddTaskPerformanceTPC", "Cannot create AliPerformanceRes");
168 }
169 pCompRes0->SetAliRecInfoCuts(pRecInfoCuts);
170 pCompRes0->SetAliMCInfoCuts(pMCInfoCuts);
171
172 AliPerformanceRes *pCompRes3 = new AliPerformanceRes("AliPerformanceResTPCInner","AliPerformanceResTPCInner",kTPCInner,kFALSE);
173 if(!pCompRes3) {
174 Error("AddTaskPerformanceTPC", "Cannot create AliPerformanceResTPCInner");
175 }
176 pCompRes3->SetAliRecInfoCuts(pRecInfoCuts);
177 pCompRes3->SetAliMCInfoCuts(pMCInfoCuts);
178
179 AliPerformanceRes *pCompRes4 = new AliPerformanceRes("AliPerformanceResTPCOuter","AliPerformanceResTPCOuter",kTPCOuter,kFALSE);
180 if(!pCompRes4) {
181 Error("AddTaskPerformanceTPC", "Cannot create AliPerformanceResTPCOuter");
182 }
183 pCompRes4->SetAliRecInfoCuts(pRecInfoCuts);
184 pCompRes4->SetAliMCInfoCuts(pMCInfoCuts);
a62207f1 185 //
186 // Efficiency
187 //
188 AliPerformanceEff *pCompEff0 = new AliPerformanceEff("AliPerformanceEff","AliPerformanceEff",kTPC,kFALSE);
189 if(!pCompEff0) {
190 Error("AddTaskPerformanceTPC", "Cannot create AliPerformanceEff");
191 }
192 pCompEff0->SetAliRecInfoCuts(pRecInfoCuts);
193 pCompEff0->SetAliMCInfoCuts(pMCInfoCuts);
194 //
195 // dEdx
196 //
197 AliPerformanceDEdx *pCompDEdx3 = new AliPerformanceDEdx("AliPerformanceDEdxTPCInner","AliPerformanceDEdxTPCInner",kTPCInner,kFALSE);
198 if(!pCompDEdx3) {
199 Error("AddTaskPerformanceTPC", "Cannot create AliPerformanceDEdxTPCInner");
200 }
201 pCompDEdx3->SetAliRecInfoCuts(pRecInfoCuts);
202 pCompDEdx3->SetAliMCInfoCuts(pMCInfoCuts);
203 //
204 // DCA
205 //
206 AliPerformanceDCA *pCompDCA0 = new AliPerformanceDCA("AliPerformanceDCA","AliPerformanceDCA",kTPC,kFALSE);
207 if(!pCompDCA0) {
208 Error("AddTaskPerformanceTPC", "Cannot create AliPerformanceDCA");
209 }
210 pCompDCA0->SetAliRecInfoCuts(pRecInfoCuts);
211 pCompDCA0->SetAliMCInfoCuts(pMCInfoCuts);
212 //
213 // TPC performance
214 //
215 AliPerformanceTPC *pCompTPC0 = new AliPerformanceTPC("AliPerformanceTPC","AliPerformanceTPC",kTPC,kFALSE);
216 if(!pCompTPC0) {
217 Error("AddTaskPerformanceTPC", "Cannot create AliPerformanceTPC");
218 }
9372eb77 219 pCompTPC0->SetAliRecInfoCuts(pRecInfoCutsTPC);
a62207f1 220 pCompTPC0->SetAliMCInfoCuts(pMCInfoCuts);
78a97597 221 //
222 // TPC+ITS matching performance
223 //
9372eb77 224 AliPerformanceMatch *pCompMatch0 = new AliPerformanceMatch("AliPerformanceMatchTPCITS","AliPerformanceMatchTPCITS",0,kFALSE);
78a97597 225 if(!pCompMatch0) {
226 Error("AddTaskPerformanceMatch", "Cannot create AliPerformanceMatchTPCITS");
227 }
9372eb77 228 pCompMatch0->SetAliRecInfoCuts(pRecInfoCutsMATCH);
78a97597 229 pCompMatch0->SetAliMCInfoCuts(pMCInfoCuts);
230 //
231 // TPC+TRD matching performance
232 //
9372eb77 233 AliPerformanceMatch *pCompMatch1 = new AliPerformanceMatch("AliPerformanceMatchTPCTRD","AliPerformanceMatchTPCTRD",1,kFALSE);
78a97597 234 if(!pCompMatch1) {
235 Error("AddTaskPerformanceMatch", "Cannot create AliPerformanceMatchTPCTRD");
236 }
9372eb77 237 pCompMatch1->SetAliRecInfoCuts(pRecInfoCutsMATCH);
78a97597 238 pCompMatch1->SetAliMCInfoCuts(pMCInfoCuts);
a62207f1 239
78a97597 240 AliPerformanceMatch *pCompMatch2 = new AliPerformanceMatch("AliPerformanceMatchTPCEFF","AliPerformanceMatchTPCEFF",2,kFALSE);
241 if(!pCompMatch2) {
242 Error("AddTaskPerformanceMatch", "Cannot create AliPerformanceMatchTPCEFF");
243 }
9372eb77 244 pCompMatch2->SetAliRecInfoCuts(pRecInfoCutsMATCH);
78a97597 245 pCompMatch2->SetAliMCInfoCuts(pMCInfoCuts);
246
a62207f1 247 //
78a97597 248 // Add components to the performance task
a62207f1 249 //
a62207f1 250 task->AddPerformanceObject( pCompDEdx3 );
251 task->AddPerformanceObject( pCompDCA0 );
252 task->AddPerformanceObject( pCompTPC0 );
78a97597 253 task->AddPerformanceObject( pCompMatch0 );
254 task->AddPerformanceObject( pCompMatch1 );
255 task->AddPerformanceObject( pCompMatch2 );
a62207f1 256
257 //
72d759fb 258 if(bUseMCInfo) {
259 task->AddPerformanceObject( pCompRes0 );
260 task->AddPerformanceObject( pCompRes3 );
261 task->AddPerformanceObject( pCompRes4 );
262 task->AddPerformanceObject( pCompEff0 );
263 }
264
265 //
266 if(!bUseMCInfo) {
267 pCompDEdx3->SetTriggerClass(triggerClass);
268 pCompDCA0->SetTriggerClass(triggerClass);
269 pCompTPC0->SetTriggerClass(triggerClass);
270 pCompMatch0->SetTriggerClass(triggerClass);
271 pCompMatch1->SetTriggerClass(triggerClass);
272 pCompMatch2->SetTriggerClass(triggerClass);
273 }
274
275 //
a62207f1 276 // Create containers for input
277 //
43d01ef0 278 mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
a62207f1 279
280 //
281 // Create containers for output
282 //
43d01ef0 283 AliAnalysisDataContainer *coutput_tpc = mgr->CreateContainer("TPC", TList::Class(), AliAnalysisManager::kOutputContainer, Form("TPC.%s.root", task->GetName()));
65b3a5e1 284 mgr->ConnectOutput(task, 1, coutput_tpc);
a62207f1 285
286return task;
287}