TPC efficiency wrt ITS added (A.Kalwait and J. Otwinowski)
[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)
17// 7. AliPerformanceTPC (TPC cluster and track information)
18//
19// Usage on the analysis train (default configuration):
20// gSystem->Load("libANALYSIS");
21// gSystem->Load("libANALYSISalice");
22// gSystem->Load("libTPCcalib.so");
23// gSystem->Load("libPWG1.so");
24//
25// gROOT->LoadMacro("$ALICE_ROOT/PWG1/macros/AddTaskPerformanceTPC.C");
26// AliPerformanceTask *tpcQA = AddTaskPerformanceTPC("kTRUE","kTRUE");
27//
28// Output:
29// TPC.Performance.root file with TPC performance components is created.
30//
31// Each of the components contains THnSparse generic histograms which
32// have to be analysed (post-analysis) by using Analyse() function.
33// Each component contains such function.
34//
35//13.10.2009 - J.Otwinowski@gsi.de
36///////////////////////////////////////////////////////////////////////////////
37
38//____________________________________________
39AliPerformanceTask* AddTaskPerformanceTPC(Bool_t bUseMCInfo=kTRUE, Bool_t bUseESDfriend=kTRUE)
40{
41 //
42 // Add AliPerformanceTask with TPC performance components
43 //
44 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
45 if(!mgr) {
46 Error("AddTaskPerformanceTPC","AliAnalysisManager not set!");
47 return NULL;
48 }
49
50 TString type = mgr->GetInputEventHandler()->GetDataType();
51 if (!type.Contains("ESD")) {
52 Error("AddTaskPerformanceTPC", "ESD input handler needed!");
53 return NULL;
54 }
55
56 AliMCEventHandler *mcH = (AliMCEventHandler*)mgr->GetMCtruthEventHandler();
57 if (!mcH && bUseMCInfo) {
58 Error("AddTaskPerformanceTPC", "MC input handler needed!");
59 return NULL;
60 }
61
62 //
63 // Create task
64 //
65 AliPerformanceTask *task = new AliPerformanceTask("Performance","TPC Performance");
66 if (!task) {
67 Error("AddTaskPerformanceTPC", "TPC performance task cannot be created!");
68 return NULL;
69 }
70 task->SetUseMCInfo(bUseMCInfo);
71 task->SetUseESDfriend(bUseESDfriend);
72
73 //
74 // Add task to analysis manager
75 //
76 mgr->AddTask(task);
77
78 //
79 // Create TPC-ESD track reconstruction cuts
80 //
81 AliRecInfoCuts *pRecInfoCuts = new AliRecInfoCuts();
82 if(pRecInfoCuts) {
83 pRecInfoCuts->SetMaxDCAToVertexXY(3.0);
84 pRecInfoCuts->SetMaxDCAToVertexZ(3.0);
85 pRecInfoCuts->SetMinNClustersTPC(50);
86 pRecInfoCuts->SetMinNClustersITS(2);
87 pRecInfoCuts->SetHistogramsOn(kFALSE);
88 }
89 else {
90 Error("AddTaskPerformanceTPC", "AliRecInfoCuts cannot be created!");
91 return NULL;
92 }
93 //
94 // Create TPC-MC track reconstruction cuts
95 //
96 AliMCInfoCuts *pMCInfoCuts = new AliMCInfoCuts();
97 if(pMCInfoCuts) {
98 pMCInfoCuts->SetMinTrackLength(70);
99 }
100 else {
101 Error("AddTaskPerformanceTPC", "AliMCInfoCuts cannot be created!");
102 return NULL;
103 }
104
105 //
106 // Create performance objects for TPC and set cuts
107 //
108 enum { kTPC = 0, kTPCITS, kConstrained, kTPCInner, kTPCOuter, kTPCSec };
109
110 //
111 // Resolution
112 //
113 AliPerformanceRes *pCompRes0 = new AliPerformanceRes("AliPerformanceRes","AliPerformanceRes",kTPC,kFALSE);
114 if(!pCompRes0) {
115 Error("AddTaskPerformanceTPC", "Cannot create AliPerformanceRes");
116 }
117 pCompRes0->SetAliRecInfoCuts(pRecInfoCuts);
118 pCompRes0->SetAliMCInfoCuts(pMCInfoCuts);
119
120 AliPerformanceRes *pCompRes3 = new AliPerformanceRes("AliPerformanceResTPCInner","AliPerformanceResTPCInner",kTPCInner,kFALSE);
121 if(!pCompRes3) {
122 Error("AddTaskPerformanceTPC", "Cannot create AliPerformanceResTPCInner");
123 }
124 pCompRes3->SetAliRecInfoCuts(pRecInfoCuts);
125 pCompRes3->SetAliMCInfoCuts(pMCInfoCuts);
126
127 AliPerformanceRes *pCompRes4 = new AliPerformanceRes("AliPerformanceResTPCOuter","AliPerformanceResTPCOuter",kTPCOuter,kFALSE);
128 if(!pCompRes4) {
129 Error("AddTaskPerformanceTPC", "Cannot create AliPerformanceResTPCOuter");
130 }
131 pCompRes4->SetAliRecInfoCuts(pRecInfoCuts);
132 pCompRes4->SetAliMCInfoCuts(pMCInfoCuts);
133
134 //
135 // Efficiency
136 //
137 AliPerformanceEff *pCompEff0 = new AliPerformanceEff("AliPerformanceEff","AliPerformanceEff",kTPC,kFALSE);
138 if(!pCompEff0) {
139 Error("AddTaskPerformanceTPC", "Cannot create AliPerformanceEff");
140 }
141 pCompEff0->SetAliRecInfoCuts(pRecInfoCuts);
142 pCompEff0->SetAliMCInfoCuts(pMCInfoCuts);
143 //
144 // dEdx
145 //
146 AliPerformanceDEdx *pCompDEdx3 = new AliPerformanceDEdx("AliPerformanceDEdxTPCInner","AliPerformanceDEdxTPCInner",kTPCInner,kFALSE);
147 if(!pCompDEdx3) {
148 Error("AddTaskPerformanceTPC", "Cannot create AliPerformanceDEdxTPCInner");
149 }
150 pCompDEdx3->SetAliRecInfoCuts(pRecInfoCuts);
151 pCompDEdx3->SetAliMCInfoCuts(pMCInfoCuts);
152 //
153 // DCA
154 //
155 AliPerformanceDCA *pCompDCA0 = new AliPerformanceDCA("AliPerformanceDCA","AliPerformanceDCA",kTPC,kFALSE);
156 if(!pCompDCA0) {
157 Error("AddTaskPerformanceTPC", "Cannot create AliPerformanceDCA");
158 }
159 pCompDCA0->SetAliRecInfoCuts(pRecInfoCuts);
160 pCompDCA0->SetAliMCInfoCuts(pMCInfoCuts);
161 //
162 // TPC performance
163 //
164 AliPerformanceTPC *pCompTPC0 = new AliPerformanceTPC("AliPerformanceTPC","AliPerformanceTPC",kTPC,kFALSE);
165 if(!pCompTPC0) {
166 Error("AddTaskPerformanceTPC", "Cannot create AliPerformanceTPC");
167 }
168 pCompTPC0->SetAliRecInfoCuts(pRecInfoCuts);
169 pCompTPC0->SetAliMCInfoCuts(pMCInfoCuts);
170
171 //
172 // add components to the performance task
173 //
174 task->AddPerformanceObject( pCompRes0 );
175 task->AddPerformanceObject( pCompRes3 );
176 task->AddPerformanceObject( pCompRes4 );
177 task->AddPerformanceObject( pCompEff0 );
178 task->AddPerformanceObject( pCompDEdx3 );
179 task->AddPerformanceObject( pCompDCA0 );
180 task->AddPerformanceObject( pCompTPC0 );
181
182 //
183 // Create containers for input
184 //
43d01ef0 185 mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
a62207f1 186
187 //
188 // Create containers for output
189 //
43d01ef0 190 AliAnalysisDataContainer *coutput_tpc = mgr->CreateContainer("TPC", TList::Class(), AliAnalysisManager::kOutputContainer, Form("TPC.%s.root", task->GetName()));
191 mgr->ConnectOutput(task, 0, coutput_tpc);
a62207f1 192
193return task;
194}