Clone finctionality removed
[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);
68
69 //
70 // Add task to analysis manager
71 //
72 mgr->AddTask(task);
73
74 //
75 // Create TPC-ESD track reconstruction cuts
76 // MB tracks
77 //
78 AliRecInfoCuts *pRecInfoCutsTPC = new AliRecInfoCuts();
79 if(pRecInfoCutsTPC) {
80 pRecInfoCutsTPC->SetMaxDCAToVertexXY(3.0);
81 pRecInfoCutsTPC->SetMaxDCAToVertexZ(3.0);
82 pRecInfoCutsTPC->SetRequireSigmaToVertex(kFALSE);
83 pRecInfoCutsTPC->SetRequireTPCRefit(kFALSE);
84 pRecInfoCutsTPC->SetAcceptKinkDaughters(kTRUE);
85 pRecInfoCutsTPC->SetMinNClustersTPC(70);
86 pRecInfoCutsTPC->SetMaxChi2PerClusterTPC(1000000.);
87 pRecInfoCutsTPC->SetDCAToVertex2D(kFALSE);
88
89 pRecInfoCutsTPC->SetHistogramsOn(kFALSE);
90 }
91 else {
92 Error("AddTaskPerformanceTPC", "AliRecInfoCutsTPC cannot be created!");
93 return NULL;
94 }
95
96 //
97 // Create TPC-MC track reconstruction cuts
98 //
99 AliMCInfoCuts *pMCInfoCuts = new AliMCInfoCuts();
100 if(pMCInfoCuts) {
101 pMCInfoCuts->SetMinTrackLength(70);
102 }
103 else {
104 Error("AddTaskPerformanceTPC", "AliMCInfoCuts cannot be created!");
105 return NULL;
106 }
107
108 //
109 // Create performance objects for TPC and set cuts
110 //
111 enum { kTPC = 0, kTPCITS, kConstrained, kTPCInner, kTPCOuter, kTPCSec };
112
113 //
114 // TPC performance
115 //
c11cd0fa 116 AliPerformanceTPC *pCompTPC0 = new AliPerformanceTPC("AliPerformanceTPC","AliPerformanceTPC",kTPC,kFALSE,-1,highMult);
6f96924c 117 if(!pCompTPC0) {
118 Error("AddTaskPerformanceTPC", "Cannot create AliPerformanceTPC");
119 }
120 pCompTPC0->SetAliRecInfoCuts(pRecInfoCutsTPC);
121 pCompTPC0->SetAliMCInfoCuts(pMCInfoCuts);
122 pCompTPC0->SetUseTrackVertex(kFALSE);
814d192f 123 pCompTPC0->SetUseHLT(kFALSE);
6f96924c 124 //
125 // dEdx
126 //
127 AliPerformanceDEdx *pCompDEdx3 = new AliPerformanceDEdx("AliPerformanceDEdxTPCInner","AliPerformanceDEdxTPCInner",kTPCInner,kFALSE);
128 if(!pCompDEdx3) {
129 Error("AddTaskPerformanceTPC", "Cannot create AliPerformanceDEdxTPCInner");
130 }
131 pCompDEdx3->SetAliRecInfoCuts(pRecInfoCutsTPC);
132 pCompDEdx3->SetAliMCInfoCuts(pMCInfoCuts);
133 pCompDEdx3->SetUseTrackVertex(kFALSE);
134
135
136 //
137 // Add components to the performance task
138 //
139 if(!bUseMCInfo) {
140 pCompTPC0->SetTriggerClass(triggerClass);
141 pCompDEdx3->SetTriggerClass(triggerClass);
142 }
143 task->AddPerformanceObject( pCompTPC0 );
144 task->AddPerformanceObject( pCompDEdx3 );
145
146 //
147 // Create containers for input
148 //
149 mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
150
151 //
152 // Create containers for output
153 //
154 AliAnalysisDataContainer *coutput_tpc = mgr->CreateContainer("TPCQA", TList::Class(), AliAnalysisManager::kOutputContainer, Form("%s:TPC_%s", mgr->GetCommonFileName(), task->GetName()));
814d192f 155
f06b9a23 156 AliAnalysisDataContainer *coutput2_tpc = mgr->CreateContainer("TPCQASummary", TTree::Class(), AliAnalysisManager::kParamContainer, "trending.root:SummaryTPCQA");
814d192f 157
6f96924c 158 mgr->ConnectOutput(task, 1, coutput_tpc);
10d5d625 159 mgr->ConnectOutput(task, 0, coutput2_tpc);
6f96924c 160
161return task;
162}