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