Split: fix refs to AddTaskPhysicsSelection.C
[u/mrichter/AliRoot.git] / PWGPP / macros / AddTaskPerformanceTPCPtCalib.C
CommitLineData
f70c8082 1///////////////////////////////////////////////////////////////////////////////
2// Macro to setup AliPerformanceTask for
2bfe5463 3// TPC performance QA to run on PWGPP QA train.
f70c8082 4//
f70c8082 5// By default 1 performance component is added to
6// the task:
7// 1. AliPerformancePtCalib
8// or AliPerformancePtCalibMC if bUseMCinfo = kTRUE (use MC info)
9
10// Usage on the analysis train (default configuration):
11// gSystem->Load("libANALYSIS");
12// gSystem->Load("libANALYSISalice");
4070f709 13// gSystem->Load("libTPCcalib");
14// gSystem->Load("libPWGPP");
f70c8082 15//
2bfe5463 16// gROOT->LoadMacro("$ALICE_ROOT/PWGPP/macros/AddTaskPerformanceTPCPtCalib.C");
31f305b0 17// AliPerformanceTask *tpcQA = AddTaskPerformanceTPCPtCalib("kTRUE","kTRUE","CINT1B-ABCE-NOPF-ALL");
f70c8082 18//
19// Output:
31f305b0 20// TPCPtCalib.Performance.root file with TPC performance components is created.
f70c8082 21//
22// Each of the components contains THnSparse generic histograms which
23// have to be analysed (post-analysis) by using Analyse() function.
24// Each component contains such function.
25//
31f305b0 26// June 2010 - Simone Schuchmann sschuchm@ikf.uni-frankfurt.de
f70c8082 27///////////////////////////////////////////////////////////////////////////////
28
29//____________________________________________
31f305b0 30AliPerformanceTask* AddTaskPerformanceTPCPtCalib(Bool_t bUseMCInfo=kFALSE, Bool_t bUseESDfriend=kFALSE, const char *triggerClass=0)
f70c8082 31{
31f305b0 32
33//
34 // Create physics trigger selection class
35 //
36 AliPhysicsSelection *physTrigSel = new AliPhysicsSelection();
37
f70c8082 38 //
39 // Add AliPerformanceTask with TPC performance components
40 //
41 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
42 if(!mgr) {
43 Error("AddTaskPerformanceTPCPtCalib","AliAnalysisManager not set!");
44 return NULL;
45 }
46
47 TString type = mgr->GetInputEventHandler()->GetDataType();
48 if (!type.Contains("ESD")) {
49 Error("AddTaskPerformanceTPCPtCalib", "ESD input handler needed!");
50 return NULL;
51 }
52
53 AliMCEventHandler *mcH = (AliMCEventHandler*)mgr->GetMCtruthEventHandler();
54 if (!mcH && bUseMCInfo) {
55 Error("AddTaskPerformanceTPCPtCalib", "MC input handler needed!");
56 return NULL;
57 }
58
59 //
60 // Create task
61 //
31f305b0 62 AliPerformanceTask *task = new AliPerformanceTask("TPCPerformanceInvPt","TPC Performance PtCalib");
f70c8082 63 if (!task) {
64 Error("AddTaskPerformanceTPCPtCalib", "TPC performance task cannot be created!");
65 return NULL;
66 }
67 task->SetUseMCInfo(bUseMCInfo);
31f305b0 68 task->SetUseESDfriend(kFALSE);
d6ef296a 69 task->SelectCollisionCandidates();
f70c8082 70
71 //
31f305b0 72 // Add physics selection task to analysis manager
f70c8082 73 //
63b6cbd0 74 // gROOT->LoadMacro("$ALICE_ROOT/OADB/macros/AddTaskPhysicsSelection.C");
31f305b0 75 // AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection();
76 // mgr->AddTask(physSelTask);
77
f70c8082 78 mgr->AddTask(task);
79
80 //
81 // Create TPC-ESD track reconstruction cuts
82 //
83 AliRecInfoCuts *pRecInfoCuts = new AliRecInfoCuts();
84 if(pRecInfoCuts) {
85 pRecInfoCuts->SetMaxDCAToVertexXY(3.0);
86 pRecInfoCuts->SetMaxDCAToVertexZ(3.0);
87 pRecInfoCuts->SetMinNClustersTPC(50);
88 pRecInfoCuts->SetMinNClustersITS(2);
89 pRecInfoCuts->SetHistogramsOn(kFALSE);
90 }
91 else {
92 Error("AddTaskPerformanceTPCPtCalib", "AliRecInfoCuts cannot be created!");
93 return NULL;
94 }
95 //
96 // Create TPC-MC track reconstruction cuts
97 //
98 AliMCInfoCuts *pMCInfoCuts = new AliMCInfoCuts();
99 if(pMCInfoCuts) {
100 pMCInfoCuts->SetMinTrackLength(70);
101 }
102 else {
103 Error("AddTaskPerformanceTPCPtCalib", "AliMCInfoCuts cannot be created!");
104 return NULL;
105 }
106
107 //
108 // Create performance objects for TPC and set cuts
109 //
110 enum { kTPC = 0, kTPCITS, kConstrained, kTPCInner, kTPCOuter, kTPCSec };
111
112
31f305b0 113
f70c8082 114 AliPerformancePtCalib *ptCalib = NULL;
115 AliPerformancePtCalibMC *ptCalibMC = NULL;
116
117 if(bUseMCInfo){
31f305b0 118 ptCalibMC = new AliPerformancePtCalibMC("AliPerformancePtCalibMC","AliPerformancePtCalibMC");
f70c8082 119 if(!ptCalibMC) {
120 Error("AddTaskPerformanceTPCPtCalib", "Cannot create AliPerformancePtCalibMC");
121 }
31f305b0 122 // physTrigSel->SetAnalyzeMC();
123 // ptCalibMC->SetPhysicsTriggerSelection(physTrigSel);
f70c8082 124 ptCalibMC->SetAliRecInfoCuts(pRecInfoCuts);
125 ptCalibMC->SetReadTPCTracks(kTRUE);
31f305b0 126 AliESDtrackCuts* esdtrackCuts = new AliESDtrackCuts("AliESDtrackCutsPtMC");
127 esdtrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2009(kTRUE);
128 ptCalibMC->SetAliESDtrackCuts(esdtrackCuts);
129 //ptCalibMC->SetEtaRange(0.9);
f70c8082 130 }
131 else{
132
31f305b0 133 ptCalib = new AliPerformancePtCalib("AliPerformancePtCalib","AliPerformancePtCalib");
f70c8082 134 if(!ptCalib) {
135 Error("AddTaskPerformanceTPCPtCalib", "Cannot create AliPerformancePtCalib");
136 }
137 ptCalib->SetAliRecInfoCuts(pRecInfoCuts);
138 ptCalib->SetReadTPCTracks(kTRUE);
31f305b0 139 ptCalib->SetEtaRange(0.8);
f70c8082 140 // ptCalib->SetAliMCInfoCuts(pMCInfoCut);
31f305b0 141
142 //if(triggerClass) ptCalib->SetTriggerClass(triggerClass);
143 //ptCalib->SetPhysicsTriggerSelection(physTrigSel);
144 //ptCalib->SetTrigger(AliTriggerAnalysis::kMB1);
145 AliESDtrackCuts* esdtrackCuts = new AliESDtrackCuts("AliESDtrackCutsPt");
146 esdtrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2009(kTRUE);
147 ptCalib->SetAliESDtrackCuts(esdtrackCuts);
148
f70c8082 149 }
31f305b0 150
f70c8082 151 // add components to the performance task
152
31f305b0 153 if(bUseMCInfo) task->AddPerformanceObject(ptCalibMC);
154 else task->AddPerformanceObject(ptCalib);
f70c8082 155
156 // Create containers for input
157 //
158 mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
159
160 //
161 // Create containers for output
162 //
31f305b0 163 AliAnalysisDataContainer *coutput_tpcptcalib = mgr->CreateContainer("TPCPtCalib", TList::Class(), AliAnalysisManager::kOutputContainer, Form("%s.Performance.root", task->GetName()));
6d1c59c1 164 mgr->ConnectOutput(task, 1, coutput_tpcptcalib);
f70c8082 165
166return task;
167}