Include base class 'header'
[u/mrichter/AliRoot.git] / PWG1 / TPC / macros / AddTaskPerformanceTPCdEdxQA.C
CommitLineData
6f96924c 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 1 performance components are added to
10// the task:
11// 1. AliPerformanceTPC (TPC cluster and track and event information)
12// 2. AliPerformancedEdx (TPC dEdx information)
13//
14// Usage on the analysis train (default configuration):
15// gSystem->Load("libANALYSIS");
16// gSystem->Load("libANALYSISalice");
17// gSystem->Load("libTPCcalib.so");
18// gSystem->Load("libTENDER.so");
19// gSystem->Load("libPWG1.so");
20//
21// gROOT->LoadMacro("$ALICE_ROOT/PWG1/TPC/macros/AddTaskPerformanceTPCdEdxQA.C");
10d5d625 22// AliPerformanceTask *tpcQA = AddTaskPerformanceTPCdEdxQA("kFALSE","kTRUE","kFALSE","triggerClass");
6f96924c 23//
24// Output:
25// TPC.Performance.root file with TPC performance components is created.
26//
27// Each of the components contains THnSparse generic histograms which
28// have to be analysed (post-analysis) by using Analyse() function.
29// Each component contains such function.
30//
31//30.09.2010 - J.Otwinowski@gsi.de
32///////////////////////////////////////////////////////////////////////////////
33
34//____________________________________________
c11cd0fa 35AliPerformanceTask* AddTaskPerformanceTPCdEdxQA(Bool_t bUseMCInfo=kFALSE, Bool_t bUseESDfriend=kTRUE, Bool_t highMult = kFALSE, const char *triggerClass=0)
6f96924c 36{
37 //
38 // Add AliPerformanceTask with TPC performance components
39 //
40 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
41 if(!mgr) {
42 Error("AddTaskPerformanceTPCdEdxQA","AliAnalysisManager not set!");
43 return NULL;
44 }
45
46 TString type = mgr->GetInputEventHandler()->GetDataType();
47 if (!type.Contains("ESD")) {
48 Error("AddTaskPerformanceTPCdEdxQA", "ESD input handler needed!");
49 return NULL;
50 }
51
52 AliMCEventHandler *mcH = (AliMCEventHandler*)mgr->GetMCtruthEventHandler();
53 if (!mcH && bUseMCInfo) {
54 Error("AddTaskPerformanceTPCdEdxQA", "MC input handler needed!");
55 return NULL;
56 }
57
58 //
59 // Create task
60 //
61 AliPerformanceTask *task = new AliPerformanceTask("PerformanceQA","TPC Performance");
62 if (!task) {
63 Error("AddTaskPerformanceTPCdEdxQA", "TPC performance task cannot be created!");
64 return NULL;
65 }
66 task->SetUseMCInfo(bUseMCInfo);
67 task->SetUseESDfriend(bUseESDfriend);
1833a193 68 // task->SetUseTerminate(kFALSE);
6f96924c 69
70 //
71 // Add task to analysis manager
72 //
73 mgr->AddTask(task);
74
75 //
76 // Create TPC-ESD track reconstruction cuts
77 // MB tracks
78 //
79 AliRecInfoCuts *pRecInfoCutsTPC = new AliRecInfoCuts();
80 if(pRecInfoCutsTPC) {
81 pRecInfoCutsTPC->SetMaxDCAToVertexXY(3.0);
82 pRecInfoCutsTPC->SetMaxDCAToVertexZ(3.0);
83 pRecInfoCutsTPC->SetRequireSigmaToVertex(kFALSE);
84 pRecInfoCutsTPC->SetRequireTPCRefit(kFALSE);
1833a193 85 pRecInfoCutsTPC->SetAcceptKinkDaughters(kFALSE);
6f96924c 86 pRecInfoCutsTPC->SetMinNClustersTPC(70);
1833a193 87 pRecInfoCutsTPC->SetMaxChi2PerClusterTPC(4.);
88 pRecInfoCutsTPC->SetDCAToVertex2D(kTRUE);
6f96924c 89
90 pRecInfoCutsTPC->SetHistogramsOn(kFALSE);
91 }
92 else {
93 Error("AddTaskPerformanceTPC", "AliRecInfoCutsTPC cannot be created!");
94 return NULL;
95 }
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 // TPC performance
116 //
c11cd0fa 117 AliPerformanceTPC *pCompTPC0 = new AliPerformanceTPC("AliPerformanceTPC","AliPerformanceTPC",kTPC,kFALSE,-1,highMult);
6f96924c 118 if(!pCompTPC0) {
119 Error("AddTaskPerformanceTPC", "Cannot create AliPerformanceTPC");
120 }
121 pCompTPC0->SetAliRecInfoCuts(pRecInfoCutsTPC);
122 pCompTPC0->SetAliMCInfoCuts(pMCInfoCuts);
1833a193 123 // pCompTPC0->SetUseTrackVertex(kFALSE);
124 pCompTPC0->SetUseTrackVertex(kTRUE);
814d192f 125 pCompTPC0->SetUseHLT(kFALSE);
1833a193 126 pCompTPC0->SetUseTOFBunchCrossing(kTRUE);
127
128 //
129 // TPC ITS match
130 //
131 AliPerformanceMatch *pCompMatch1 = new AliPerformanceMatch("AliPerformanceMatchTPCITS","AliPerformanceMatchTPCITS",0,kFALSE);
132 if(!pCompMatch1) {
133 Error("AddTaskPerformanceMatch", "Cannot create AliPerformanceMatchTPCITS");
134 }
135 pCompMatch1->SetAliRecInfoCuts(pRecInfoCutsTPC);
136 pCompMatch1->SetAliMCInfoCuts(pMCInfoCuts);
137 pCompMatch1->SetUseTOFBunchCrossing(kTRUE);
138
139
140 //
141 // ITS TPC match
142 //
143 AliPerformanceMatch *pCompMatch2 = new AliPerformanceMatch("AliPerformanceMatchITSTPC","AliPerformanceMatchITSTPC",1,kFALSE);
144 if(!pCompMatch2) {
145 Error("AddTaskPerformanceMatch", "Cannot create AliPerformanceMatchITSTPC"); }
146 pCompMatch2->SetAliRecInfoCuts(pRecInfoCutsTPC);
147 pCompMatch2->SetAliMCInfoCuts(pMCInfoCuts);
148 pCompMatch2->SetUseTOFBunchCrossing(kTRUE);
149
6f96924c 150 //
151 // dEdx
152 //
153 AliPerformanceDEdx *pCompDEdx3 = new AliPerformanceDEdx("AliPerformanceDEdxTPCInner","AliPerformanceDEdxTPCInner",kTPCInner,kFALSE);
154 if(!pCompDEdx3) {
155 Error("AddTaskPerformanceTPC", "Cannot create AliPerformanceDEdxTPCInner");
156 }
157 pCompDEdx3->SetAliRecInfoCuts(pRecInfoCutsTPC);
158 pCompDEdx3->SetAliMCInfoCuts(pMCInfoCuts);
1833a193 159 //pCompDEdx3->SetUseTrackVertex(kFALSE);
160 pCompDEdx3->SetUseTrackVertex(kTRUE);
6f96924c 161
162
163 //
164 // Add components to the performance task
165 //
166 if(!bUseMCInfo) {
167 pCompTPC0->SetTriggerClass(triggerClass);
1833a193 168 pCompMatch1->SetTriggerClass(triggerClass);
169 pCompMatch2->SetTriggerClass(triggerClass);
6f96924c 170 pCompDEdx3->SetTriggerClass(triggerClass);
171 }
172 task->AddPerformanceObject( pCompTPC0 );
1833a193 173 task->AddPerformanceObject( pCompMatch1 );
174 task->AddPerformanceObject( pCompMatch2 );
6f96924c 175 task->AddPerformanceObject( pCompDEdx3 );
176
177 //
178 // Create containers for input
179 //
180 mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
181
182 //
183 // Create containers for output
184 //
185 AliAnalysisDataContainer *coutput_tpc = mgr->CreateContainer("TPCQA", TList::Class(), AliAnalysisManager::kOutputContainer, Form("%s:TPC_%s", mgr->GetCommonFileName(), task->GetName()));
814d192f 186
f06b9a23 187 AliAnalysisDataContainer *coutput2_tpc = mgr->CreateContainer("TPCQASummary", TTree::Class(), AliAnalysisManager::kParamContainer, "trending.root:SummaryTPCQA");
814d192f 188
6f96924c 189 mgr->ConnectOutput(task, 1, coutput_tpc);
10d5d625 190 mgr->ConnectOutput(task, 0, coutput2_tpc);
6f96924c 191
192return task;
193}