TENDER becomes Tender, removing .so
[u/mrichter/AliRoot.git] / HLT / QA / tasks / macros / AddTaskPerformance.C
CommitLineData
325a154e 1///////////////////////////////////////////////////////////////////////////////
2// Macro to setup AliPerformanceTask for either
2bfe5463 3// HLT or offline TPC performance QA to run on PWGPP QA train.
325a154e 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)
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)
19//
20// Usage on the analysis train (default configuration):
21// gSystem->Load("libANALYSIS");
22// gSystem->Load("libANALYSISalice");
230b7aff 23// gSystem->Load("libTPCcalib");
24// gSystem->Load("libTender");
25// gSystem->Load("libPWGPP");
325a154e 26//
27// gROOT->LoadMacro("$ALICE_ROOT/HLT/QA/tasks/macros/AddTaskPerformanceTPC.C");
28// AliPerformanceTask *tpcQA = AddTaskPerformanceTPC("kTRUE","kTRUE", "kTRUE"ΒΈ"triggerClass");
29//
30// Output:
31// HLTTPC.Performance.root file with HLT TPC performance components
32// or
33// TPC.Performance.root file with TPC performance components
34//
35// Each of the components contains THnSparse generic histograms which
36// have to be analysed (post-analysis) by using Analyse() function.
37// Each component contains such function.
38//
39//01-09.10 - J.Otwinowski@gsi.de, jochen@thaeder.de, hege.erdal@ift.uib.no
40///////////////////////////////////////////////////////////////////////////////
41
42//__________________________________________________________________________________________________
43AliPerformanceTask* AddTaskPerformance(Bool_t bUseMCInfo=kTRUE,
44 Bool_t bUseESDfriend=kTRUE,
45 Bool_t bUseHLT = kFALSE,
46 const char *triggerClass=0) {
47 // const char *triggerClass="CINT1B-ABCE-NOPF-ALL") {
48 //
49 // Add AliPerformanceTask with HLT/TPC performance components
50 //
51 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
52 if(!mgr) {
53 Error("AddTaskPerformance","AliAnalysisManager not set!");
54 return NULL;
55 }
56
57 TString type = mgr->GetInputEventHandler()->GetDataType();
58 if (!type.Contains("ESD")) {
59 Error("AddTaskPerformance", "ESD input handler needed!");
60 return NULL;
61 }
62
63 AliMCEventHandler *mcH = (AliMCEventHandler*)mgr->GetMCtruthEventHandler();
64 if (!mcH && bUseMCInfo) {
65 Error("AddTaskPerformance", "MC input handler needed!");
66 return NULL;
67 }
68
69 //============= Add HLT ESD ================================================================
70 if(bUseHLT){
71 AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler*>(mgr->GetInputEventHandler());
72 esdH->SetReadHLT();
73 }
74 //==========================================================================================
75
76 //
77 // Create task -----------------------------------------------------------------------------------
78 //
79 if(bUseHLT)
80 AliPerformanceTask *task = new AliPerformanceTask("Performance","HLT TPC Performance");
81 else
82 AliPerformanceTask *task = new AliPerformanceTask("Performance","TPC Performance");
83
84 if (!task) {
85 Error("AddTaskPerformance", "Performance task cannot be created!");
86 return NULL;
87 }
88
89 task->SelectCollisionCandidates();
90 task->SetUseMCInfo(bUseMCInfo);
91 task->SetUseESDfriend(bUseESDfriend);
05658a4f 92 task->SetUseTerminate(kFALSE);
325a154e 93 task->SetUseHLT(bUseHLT);
94 //
95 // Add task to analysis manager ------------------------------------------------------------------
96 //
97
98 mgr->AddTask(task);
99
100 //================================================================================================
101 // -- Cuts
102 //================================================================================================
103
104 //
105 // Create TPC-ESD track reconstruction cuts ------------------------------------------------------
106 // MB tracks
107 //
108
109 AliRecInfoCuts *pRecInfoCutsTPC = new AliRecInfoCuts();
110 if(pRecInfoCutsTPC) {
111 // pRecInfoCutsTPC->SetMaxDCAToVertexXY(3.0);
112 // pRecInfoCutsTPC->SetMaxDCAToVertexZ(30.0);
113 pRecInfoCutsTPC->SetMaxDCAToVertexXY(150.0);
114 pRecInfoCutsTPC->SetMaxDCAToVertexZ(150.0);
115 pRecInfoCutsTPC->SetRequireSigmaToVertex(kFALSE);
116 pRecInfoCutsTPC->SetRequireTPCRefit(kFALSE);
117
118 pRecInfoCutsTPC->SetAcceptKinkDaughters(kTRUE);
119 pRecInfoCutsTPC->SetMinNClustersTPC(50);
120 pRecInfoCutsTPC->SetMaxChi2PerClusterTPC(1000000.);
121 pRecInfoCutsTPC->SetDCAToVertex2D(kFALSE);
122
123 pRecInfoCutsTPC->SetHistogramsOn(kFALSE);
124 }
125 else {
126 Error("AddTaskPerformance", "AliRecInfoCutsTPC cannot be created!");
127 return NULL;
128 }
129
130 //
131 // Create TPC-ESD track reconstruction cuts ------------------------------------------------------
132 // standard cuts
133
134 AliRecInfoCuts *pRecInfoCuts = new AliRecInfoCuts();
135 if(pRecInfoCuts) {
136 pRecInfoCuts->SetMaxDCAToVertexXY(3.0);
137 pRecInfoCuts->SetMaxDCAToVertexZ(3.0);
138 pRecInfoCuts->SetMinNClustersTPC(50);
139 pRecInfoCuts->SetMinNClustersITS(2);
140 pRecInfoCuts->SetHistogramsOn(kFALSE);
141 pRecInfoCuts->SetTPCITSMatchingRadius(70);
142 pRecInfoCuts->SetTPCTRDMatchingRadius(260);
143 }
144 else {
145 Error("AddTaskPerformance", "AliRecInfoCuts cannot be created!");
146 return NULL;
147 }
148
149 //
150 // Create TPC-MC track reconstruction cuts -------------------------------------------------------
151 //
152 AliMCInfoCuts *pMCInfoCuts = new AliMCInfoCuts();
153 if(pMCInfoCuts) {
154 pMCInfoCuts->SetMinTrackLength(70);
155 }
156 else {
157 Error("AddTaskPerformance", "AliMCInfoCuts cannot be created!");
158 return NULL;
159 }
160
161 //================================================================================================
162 // -- Object
163 //================================================================================================
164
165 //
166 // Create performance objects for TPC and set cuts
167 //
168 enum { kTPC = 0, kTPCITS, kConstrained, kTPCInner, kTPCOuter, kTPCSec };
169
170 //
171 // Resolution ------------------------------------------------------------------------------------
172 //
173
174 AliPerformanceRes *pCompRes0 = new AliPerformanceRes("AliPerformanceRes",
175 "AliPerformanceRes",kTPC,kFALSE);
176 if(!pCompRes0) {
177 Error("AddTaskPerformance", "Cannot create AliPerformanceRes");
178 }
179 pCompRes0->SetAliRecInfoCuts(pRecInfoCuts);
180 pCompRes0->SetAliMCInfoCuts(pMCInfoCuts);
181 pCompRes0->SetUseTrackVertex(kTRUE);
182
183 //
184 // Efficiency ------------------------------------------------------------------------------------
185 //
186
187 AliPerformanceEff *pCompEff0 = new AliPerformanceEff("AliPerformanceEff",
188 "AliPerformanceEff",kTPC,kFALSE);
189 if(!pCompEff0) {
190 Error("AddTaskPerformance", "Cannot create AliPerformanceEff");
191 }
192 pCompEff0->SetAliRecInfoCuts(pRecInfoCuts);
193 pCompEff0->SetAliMCInfoCuts(pMCInfoCuts);
194 pCompEff0->SetUseTrackVertex(kTRUE);
195
196 //
197 // dEdx ------------------------------------------------------------------------------------------
198 //
199
200 AliPerformanceDEdx *pCompDEdx3 = new AliPerformanceDEdx("AliPerformanceDEdxTPCInner",
201 "AliPerformanceDEdxTPCInner",kTPCInner,kFALSE);
202 if(!pCompDEdx3) {
203 Error("AddTaskPerformance", "Cannot create AliPerformanceDEdxTPCInner");
204 }
205 pCompDEdx3->SetAliRecInfoCuts(pRecInfoCuts);
206 pCompDEdx3->SetAliMCInfoCuts(pMCInfoCuts);
207 pCompDEdx3->SetUseTrackVertex(kTRUE);
208
209 //
210 // DCA -------------------------------------------------------------------------------------------
211 //
212
213 AliPerformanceDCA *pCompDCA0 = new AliPerformanceDCA("AliPerformanceDCA",
214 "AliPerformanceDCA",kTPC,kFALSE);
215 if(!pCompDCA0) {
216 Error("AddTaskPerformanceTPC", "Cannot create AliPerformanceDCA");
217 }
218 pCompDCA0->SetAliRecInfoCuts(pRecInfoCuts);
219 pCompDCA0->SetAliMCInfoCuts(pMCInfoCuts);
220 pCompDCA0->SetUseTrackVertex(kTRUE);
221
222 //
223 // TPC performance -------------------------------------------------------------------------------
224 //
225
226 AliPerformanceTPC *pCompTPC0 = new AliPerformanceTPC("AliPerformanceTPC",
227 "AliPerformanceTPC",kTPC,kFALSE);
228 if(!pCompTPC0) {
229 Error("AddTaskPerformance", "Cannot create AliPerformanceTPC");
230 }
231 pCompTPC0->SetAliRecInfoCuts(pRecInfoCutsTPC);
232 pCompTPC0->SetAliMCInfoCuts(pMCInfoCuts);
233 pCompTPC0->SetUseTrackVertex(kTRUE);
234 pCompTPC0->SetUseHLT(bUseHLT);
235
236 //
237 // Add components to the performance task --------------------------------------------------------
238 //
239
240 //01.09.10 At the moment only use pCompTPC0
241
242 //task->AddPerformanceObject( pCompDEdx3 );
243 //task->AddPerformanceObject( pCompDCA0 );
244 task->AddPerformanceObject( pCompTPC0 );
245
246 /*
247 if(bUseMCInfo) {
248 task->AddPerformanceObject( pCompRes0 );
249 task->AddPerformanceObject( pCompEff0 );
250 }
251
252 if(!bUseMCInfo && triggerClass) {
253 pCompDEdx3->SetTriggerClass(triggerClass);
254 pCompDCA0->SetTriggerClass(triggerClass);
255 pCompTPC0->SetTriggerClass(triggerClass);
256 }
257 */
258
259 //================================================================================================
260 // data containers
261 //================================================================================================
262 AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
263
264 if(bUseHLT){
265 AliAnalysisDataContainer *coutput1 =
266 mgr->CreateContainer("HLTQA", TList::Class(),
267 AliAnalysisManager::kOutputContainer, Form("HLTTPC.%s.root", task->GetName()));
268 }
269 else{
270 AliAnalysisDataContainer *coutput1 =
271 mgr->CreateContainer("TPC", TList::Class(),
272 AliAnalysisManager::kOutputContainer, Form("TPC.%s.root", task->GetName()));
273 }
274
275 // -- connect containers
276 mgr->ConnectInput (task, 0, cinput );
277 mgr->ConnectOutput (task, 1, coutput1);
278
279 return task;
280}