TENDER becomes Tender
[u/mrichter/AliRoot.git] / PWGPP / TPC / macros / AddTaskPerformanceTPCITSQA.C
CommitLineData
7f7db898 1///////////////////////////////////////////////////////////////////////////////
2// Macro to setup AliPerformanceTask for
2bfe5463 3// TPC and TPC+ITS performance QA to run on PWGPP QA train.
7f7db898 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//
13// Usage on the analysis train (default configuration):
14// gSystem->Load("libANALYSIS");
15// gSystem->Load("libANALYSISalice");
16// gSystem->Load("libTPCcalib.so");
af472fff 17// gSystem->Load("libTender.so");
2bfe5463 18// gSystem->Load("libPWGPP.so");
7f7db898 19//
2bfe5463 20// gROOT->LoadMacro("$ALICE_ROOT/PWGPP/macros/AddTaskPerformanceTPCITSQA.C");
7f7db898 21// AliPerformanceTask *tpcQA = AddTaskPerformanceTPC("kFALSE","kTRUE","triggerClass");
22//
23// Output:
24// TPCITS.Performance.root file with TPC and TPCITS performance components is created.
25//
26// Each of the components contains THnSparse generic histograms which
27// have to be analysed (post-analysis) by using Analyse() function.
28// Each component contains such function.
29//
30//14.12.2009 - J.Otwinowski@gsi.de
31///////////////////////////////////////////////////////////////////////////////
32
33//____________________________________________
34AliPerformanceTask* AddTaskPerformanceTPCITSQA(Bool_t bUseMCInfo=kFALSE, Bool_t bUseESDfriend=kTRUE, const char *triggerClass=0)
35{
36 //
37 // Add AliPerformanceTask with TPC performance components
38 //
39 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
40 if(!mgr) {
41 Error("AddTaskPerformanceTPC","AliAnalysisManager not set!");
42 return NULL;
43 }
44
45 TString type = mgr->GetInputEventHandler()->GetDataType();
46 if (!type.Contains("ESD")) {
47 Error("AddTaskPerformanceTPC", "ESD input handler needed!");
48 return NULL;
49 }
50
51 AliMCEventHandler *mcH = (AliMCEventHandler*)mgr->GetMCtruthEventHandler();
52 if (!mcH && bUseMCInfo) {
53 Error("AddTaskPerformanceTPC", "MC input handler needed!");
54 return NULL;
55 }
56
57 //
58 // Create task
59 //
60 AliPerformanceTask *task = new AliPerformanceTask("PerformanceQA","TPC Performance");
61 if (!task) {
62 Error("AddTaskPerformanceTPC", "TPC performance task cannot be created!");
63 return NULL;
64 }
65 task->SetUseMCInfo(bUseMCInfo);
66 task->SetUseESDfriend(bUseESDfriend);
17d3c4d6 67 task->SelectCollisionCandidates();
7f7db898 68
69 //
70 // Add task to analysis manager
71 //
72 mgr->AddTask(task);
73
74 //
faa3b211 75 // Create TPC-ITS ESD track reconstruction cuts
7f7db898 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);
faa3b211 88 pRecInfoCutsTPC->SetMinNClustersITS(2);
7f7db898 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 TPCITS set cuts
111 //
112 enum { kTPC = 0, kTPCITS};
113
114 //
115 // TPC performance
116 //
117 AliPerformanceTPC *pCompTPC0 = new AliPerformanceTPC("AliPerformanceTPC","AliPerformanceTPC",kTPC,kFALSE);
118 if(!pCompTPC0) {
119 Error("AddTaskPerformanceTPC", "Cannot create AliPerformanceTPC");
120 }
121 pCompTPC0->SetAliRecInfoCuts(pRecInfoCutsTPC);
122 pCompTPC0->SetAliMCInfoCuts(pMCInfoCuts);
123
124 //
125 // TPC+ITS performance
126 //
127 AliPerformanceTPC *pCompTPC1 = new AliPerformanceTPC("AliPerformanceTPCITS","AliPerformanceTPCITS",kTPCITS,kFALSE);
128 if(!pCompTPC1) {
129 Error("AddTaskPerformanceTPC", "Cannot create AliPerformanceTPCITS");
130 }
131 pCompTPC1->SetAliRecInfoCuts(pRecInfoCutsTPC);
132 pCompTPC1->SetAliMCInfoCuts(pMCInfoCuts);
133
134 //
135 // Add components to the performance task
136 //
137 if(!bUseMCInfo) {
138 pCompTPC0->SetTriggerClass(triggerClass);
139 pCompTPC1->SetTriggerClass(triggerClass);
140 }
141 task->AddPerformanceObject( pCompTPC0 );
142 task->AddPerformanceObject( pCompTPC1 );
143
144 //
145 // Create containers for input
146 //
147 mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
148
149 //
150 // Create containers for output
151 //
152 AliAnalysisDataContainer *coutput_tpc = mgr->CreateContainer("TPCITSQA", TList::Class(), AliAnalysisManager::kOutputContainer, Form("%s:TPCITS_%s", mgr->GetCommonFileName(), task->GetName()));
153 mgr->ConnectOutput(task, 1, coutput_tpc);
154
155return task;
156}