including new options for high p_T QA (ITSRefit) adding eta window confiuration to...
[u/mrichter/AliRoot.git] / PWG4 / macros / AddTaskPWG4HighPtQAMC.C
1
2 //DEFINITION OF A FEW CONSTANTS
3
4 AliPWG4HighPtQAMC* AddTaskPWG4HighPtQAMC(char *prodType = "LHC10e14", int trackType = 0)
5 {
6   // Creates HighPtQAMC analysis task and adds it to the analysis manager.
7   
8   // A. Get the pointer to the existing analysis manager via the static access method.
9   //==============================================================================
10   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
11   if (!mgr) {
12     Error("AddTaskPWG4HighPtQMC", "No analysis manager to connect to.");
13     return NULL;
14   }  
15
16   // B. Check the analysis type using the event handlers connected to the analysis
17   //    manager. The availability of MC handler can also be checked here.
18   //==============================================================================
19   if (!mgr->GetInputEventHandler()) {
20     ::Error("AddPWG4TaskHighPtQAMC", "This task requires an input event handler");
21     return NULL;
22   }  
23   TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
24   const char *analysisType = "ESD";
25
26   // C. Create the task, add it to manager.
27   //===========================================================================
28  
29   //CREATE THE  CUTS -----------------------------------------------
30   //Use AliESDtrackCuts
31   AliESDtrackCuts *trackCuts = new AliESDtrackCuts("AliESDtrackCuts","Standard Cuts");
32   //Standard Cuts
33   //Set track cuts for global tracks
34   if(trackType==0) {
35     trackCuts = trackCuts->GetStandardITSTPCTrackCuts2010(kTRUE);//Primary Track Selection
36     trackCuts->SetRequireITSRefit(kTRUE);
37   }
38   if(trackType==3) {
39     //Cuts global tracks with ITSrefit requirement
40     // TPC  
41     trackCuts->SetMinNClustersTPC(70);
42     trackCuts->SetMaxChi2PerClusterTPC(4);
43     trackCuts->SetAcceptKinkDaughters(kFALSE);
44     trackCuts->SetRequireTPCRefit(kTRUE);
45     // ITS
46     trackCuts->SetRequireITSRefit(kTRUE);
47     
48     trackCuts->SetMaxDCAToVertexXYPtDep("0.0182+0.0350/pt^1.01");
49     trackCuts->SetMaxDCAToVertexZ(2);
50     trackCuts->SetDCAToVertex2D(kFALSE);
51     trackCuts->SetRequireSigmaToVertex(kFALSE);
52     
53     trackCuts->SetEtaRange(-0.9,0.9);
54     trackCuts->SetPtRange(0.15, 1e10);
55   }
56   //Set track cuts for TPConly tracks
57   if(trackType==1 || trackType==2) { 
58     trackCuts = trackCuts->GetStandardTPCOnlyTrackCuts(); 
59     trackCuts->SetMinNClustersTPC(70);
60   }
61   trackCuts->SetEtaRange(-0.9,0.9);
62   trackCuts->SetPtRange(0.15, 1e10);
63   
64   AliESDtrackCuts *trackCutsITS = new AliESDtrackCuts("AliESDtrackCuts","Standard Cuts with SPD or SDD");
65   //Cuts SPD || SDD
66   // TPC  
67   trackCutsITS->SetMinNClustersTPC(70);
68   trackCutsITS->SetMaxChi2PerClusterTPC(4);
69   trackCutsITS->SetAcceptKinkDaughters(kFALSE);
70   trackCutsITS->SetRequireTPCRefit(kTRUE);
71   // ITS
72   trackCutsITS->SetRequireITSRefit(kTRUE);
73   trackCutsITS->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kNone);
74   trackCutsITS->SetClusterRequirementITS(AliESDtrackCuts::kSDD, AliESDtrackCuts::kFirst);
75
76   trackCutsITS->SetMaxDCAToVertexXYPtDep("0.0182+0.0350/pt^1.01");
77   trackCutsITS->SetMaxDCAToVertexZ(2);
78   trackCutsITS->SetDCAToVertex2D(kFALSE);
79   trackCutsITS->SetRequireSigmaToVertex(kFALSE);
80
81   trackCutsITS->SetEtaRange(-0.9,0.9);
82   trackCutsITS->SetPtRange(0.15, 1e10);
83   trackCutsITS->SetRequireITSRefit(kTRUE);
84
85   //Create the task
86   AliPWG4HighPtQAMC *taskPWG4QAMC = new AliPWG4HighPtQAMC(Form("AliPWG4HighPtQAMC%d",trackType));
87   taskPWG4QAMC->SetCuts(trackCuts);
88   taskPWG4QAMC->SetCutsITS(trackCutsITS);
89   taskPWG4QAMC->SetTrackType(trackType);
90   
91   if(!strcmp(prodType, "LHC10e14")  || !strcmp(prodType, "PbPb")) taskPWG4QAMC->SetPtMax(500.);
92   else taskPWG4QAMC->SetPtMax(100.);
93  
94   // E. Create ONLY the output containers for the data produced by the task.
95   // Get and connect other common input/output containers via the manager as below
96   //==============================================================================
97
98   //------ input data ------
99   //  AliAnalysisDataContainer *cinput0  = mgr->GetCommonInputContainer();
100   printf("Create output containers \n");
101   TString outputfile = AliAnalysisManager::GetCommonFileName();
102   outputfile += Form(":PWG4_HighPtQAMC%d",trackType);
103   
104   AliAnalysisDataContainer *cout_hist1 = mgr->CreateContainer(Form("qa_histsMC%d",trackType), TList::Class(), AliAnalysisManager::kOutputContainer,outputfile);
105   AliAnalysisDataContainer *cout_hist2 = mgr->CreateContainer(Form("qa_histsMCITS%d",trackType), TList::Class(), AliAnalysisManager::kOutputContainer,outputfile);  
106
107   mgr->AddTask(taskPWG4QAMC);
108   mgr->ConnectInput(taskPWG4QAMC,0,mgr->GetCommonInputContainer());
109   mgr->ConnectOutput(taskPWG4QAMC,0,cout_hist1);
110   mgr->ConnectOutput(taskPWG4QAMC,1,cout_hist2);
111
112     // Return task pointer at the end
113   return taskPWG4QAMC;
114 }