Updating track cuts and removing functionality that is now in separate cosmics tasks
[u/mrichter/AliRoot.git] / PWG4 / macros / AddTaskPWG4HighPtQATPConly.C
CommitLineData
fdceab34 1//DEFINITION OF A FEW CONSTANTS
2
10295ac3 3AliPWG4HighPtQATPConly* AddTaskPWG4HighPtQATPConly(int cuts=1)//1: Standard Cuts 2009 2: GetStandardITSTPCTrackCuts2009
fdceab34 4{
67ebd013 5 // Creates HighPtQATPConly analysis task and adds it to the analysis manager.
fdceab34 6
7 // A. Get the pointer to the existing analysis manager via the static access method.
8 //==============================================================================
9 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
10 if (!mgr) {
67ebd013 11 Error("AddTaskPWG4HighPtQATPConly", "No analysis manager to connect to.");
fdceab34 12 return NULL;
13 }
14
15 // B. Check the analysis type using the event handlers connected to the analysis
16 // manager. The availability of MC handler can also be checked here.
17 //==============================================================================
18 if (!mgr->GetInputEventHandler()) {
67ebd013 19 ::Error("AddTaskPWG4HighPtQATPConly", "This task requires an input event handler");
fdceab34 20 return NULL;
21 }
22 TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
23 const char *analysisType = "ESD";//"TPC"
24
25 // C. Create the task, add it to manager.
26 //===========================================================================
27
28 //CREATE THE CUTS -----------------------------------------------
29 //Use AliESDtrackCuts
30 AliESDtrackCuts *trackCuts = new AliESDtrackCuts("AliESDtrackCuts","Standard Cuts");
10295ac3 31 if(cuts==1) {
32 //Standard Cuts
33 trackCuts->SetAcceptKinkDaughters(kFALSE);
34 trackCuts->SetRequireTPCStandAlone(kTRUE);
35 trackCuts->SetRequireTPCRefit(kTRUE);
36 trackCuts->SetMinNClustersTPC(70);
37 trackCuts->SetEtaRange(-0.9,0.9);
38 trackCuts->SetMaxCovDiagonalElements(2,2,0.5,0.5,2);
39 trackCuts->SetPtRange(0.15, 1e10);
40 trackCuts->SetMaxChi2PerClusterTPC(3.5);
41 trackCuts->SetMaxDCAToVertexXY(2.4);
42 trackCuts->SetMaxDCAToVertexZ(3.2);
43 trackCuts->SetDCAToVertex2D(kTRUE);
44 }
45 else if(cuts==2) {
9f54dd56 46 trackCuts=trackCuts->GetStandardITSTPCTrackCuts2009(kTRUE);//Primary Track Selection
10295ac3 47 trackCuts->SetEtaRange(-0.9,0.9);
48 trackCuts->SetPtRange(0.15, 1e10);
10295ac3 49 trackCuts->SetRequireITSRefit(kFALSE);
50 }
51
fdceab34 52 AliESDtrackCuts *trackCutsITS = new AliESDtrackCuts("AliESDtrackCuts","Standard Cuts with ITSrefit");
10295ac3 53 if(cuts==1) {
54 trackCutsITS->SetAcceptKinkDaughters(kFALSE);
55 trackCutsITS->SetRequireTPCRefit(kTRUE);
56 trackCutsITS->SetEtaRange(-0.9,0.9);
57 trackCutsITS->SetMaxCovDiagonalElements(2,2,0.5,0.5,2);
58 trackCutsITS->SetPtRange(0.15, 1e10);
59 trackCutsITS->SetMinNClustersTPC(70);
60 trackCutsITS->SetMaxChi2PerClusterTPC(3.5);
61 trackCutsITS->SetRequireITSRefit(kTRUE);
62 trackCutsITS->SetMaxDCAToVertexXY(2.4);
63 trackCutsITS->SetMaxDCAToVertexZ(3.2);
64 trackCutsITS->SetDCAToVertex2D(kTRUE);
65 }
66 else if(cuts==2) {
9f54dd56 67 trackCutsITS=trackCutsITS->GetStandardITSTPCTrackCuts2009(kTRUE);//Primary Track Selection
10295ac3 68 trackCutsITS->SetEtaRange(-0.9,0.9);
69 trackCutsITS->SetPtRange(0.15, 1e10);
70 }
fdceab34 71
10295ac3 72//Create the task
73 AliPWG4HighPtQATPConly *taskPWG4QA = new AliPWG4HighPtQATPConly(Form("AliPWG4HighPtQATPConly%d",cuts));
fdceab34 74 taskPWG4QA->SetCuts(trackCuts);
75 taskPWG4QA->SetCutsITS(trackCutsITS);
82ebd295 76 taskPWG4QA->SetCutType(cuts);
67ebd013 77
fdceab34 78 // E. Create ONLY the output containers for the data produced by the task.
79 // Get and connect other common input/output containers via the manager as below
80 //==============================================================================
81
82 //------ input data ------
10295ac3 83 TString outputfile = "";
84 outputfile = AliAnalysisManager::GetCommonFileName();
85 outputfile += Form(":PWG4_HighPtQATPConly%d",cuts);
86
87 AliAnalysisDataContainer *cout_hist0;
88 AliAnalysisDataContainer *cout_hist1;
89 AliAnalysisDataContainer *cout_hist2;
9b58297c 90
82ebd295 91 AliAnalysisDataContainer *cout_cuts0;
92 AliAnalysisDataContainer *cout_cuts1;
10295ac3 93
82ebd295 94 cout_hist0 = mgr->CreateContainer(Form("qa_histsCuts%d",cuts), TList::Class(), AliAnalysisManager::kOutputContainer,outputfile);
95 cout_hist1 = mgr->CreateContainer(Form("qa_histsTPCCuts%d",cuts), TList::Class(), AliAnalysisManager::kOutputContainer,outputfile);
96 cout_hist2 = mgr->CreateContainer(Form("qa_histsITSCuts%d",cuts), TList::Class(), AliAnalysisManager::kOutputContainer,outputfile);
9b58297c 97
82ebd295 98 cout_cuts0 = mgr->CreateContainer(Form("qa_trackCuts%d",cuts), AliESDtrackCuts::Class(), AliAnalysisManager::kParamContainer,outputfile);
99 cout_cuts1 = mgr->CreateContainer(Form("qa_trackCutsITS%d",cuts), AliESDtrackCuts::Class(), AliAnalysisManager::kParamContainer,outputfile);
100
101 //Add task to manager
fdceab34 102 mgr->AddTask(taskPWG4QA);
103
82ebd295 104 //Connect input containter to manager
fdceab34 105 mgr->ConnectInput(taskPWG4QA,0,mgr->GetCommonInputContainer());
82ebd295 106
107 //Connect output containers to manager
fdceab34 108 mgr->ConnectOutput(taskPWG4QA,0,cout_hist0);
109 mgr->ConnectOutput(taskPWG4QA,1,cout_hist1);
110 mgr->ConnectOutput(taskPWG4QA,2,cout_hist2);
9b58297c 111 mgr->ConnectOutput(taskPWG4QA,3,cout_cuts0);
112 mgr->ConnectOutput(taskPWG4QA,4,cout_cuts1);
fdceab34 113
114 // Return task pointer at the end
115 return taskPWG4QA;
116}