adding the option for hybrid tracks global+global constrained as well as global+TPC...
[u/mrichter/AliRoot.git] / PWG4 / macros / AddTaskCorrectionsUE.C
CommitLineData
3a9d4bcf 1void ConfigTaskCorrectionsUE(AliAnalysisTaskCorrectionsUE * uecorr ); // common config, extend with different cases\r
2void SetTrackCuts(AliAnalysisTaskCorrectionsUE * uecorr, Char_t *ct); //can be extended\r
3void SetAnaTopology(AliAnalysisTaskCorrectionsUE * uecorr, Char_t *at); //can be extended \r
4void SetRegionType(AliAnalysisTaskCorrectionsUE * uecorr, Char_t *rt); //can be extended \r
5void SetSorting(AliAnalysisTaskCorrectionsUE * uecorr, Char_t *sort);\r
6\r
7AliAnalysisTaskCorrectionsUE *AddTaskCorrectionsUE(Char_t *jetBranch = "jets",Char_t *cuts = "ALICE", Char_t *anaTopology="LJ", Char_t *regionType="TRANSV", Char_t *sortBy="MSP", Bool_t proof=0)\r
8{\r
9\r
10 gSystem->SetIncludePath("-I. -I$ROOTSYS/include -I$ALICE_ROOT/include -I$ALICE_ROOT/lib/tgt_linux -I$ALICE_ROOT/ANALYSIS -I$ALICE_ROOT/JETAN -I$ALICE_ROOT/JETAN/fastjet -I$ALICE_ROOT/PWG4 -I$ALICE_ROOT/PYTHIA6 -I$ALICE_ROOT/CORRFW");\r
11 \r
12 // Get the pointer to the existing analysis manager via the static access method.\r
13 //==============================================================================\r
14 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();\r
15 if (!mgr) {\r
16 ::Error("AddTaskCorrectionsUE", "No analysis manager to connect to.");\r
17 return NULL;\r
18 } \r
19 \r
20 // Check the analysis type using the event handlers connected to the analysis manager.\r
21 //==============================================================================\r
22 if (!mgr->GetInputEventHandler()) {\r
23 ::Error("AddTaskCorrectionsUE", "This task requires an input event handler");\r
24 return NULL;\r
25 }\r
26\r
27 // Create the task and configure it.\r
28 //===========================================================================\r
29 \r
30 TString jb(jetBranch);\r
31 TString ct(cuts);\r
32 TString at(anaTopology);\r
33 TString rt(regionType);\r
34 TString sort(sortBy);\r
35 TString name(Form("%s_%s_%s_%s_%s",jb.Data(),ct.Data(),at.Data(),rt.Data(),sort.Data()));\r
36 \r
37 AliAnalysisTaskCorrectionsUE* uecorr = new AliAnalysisTaskCorrectionsUE(Form("UECorrections_%s",name.Data()));\r
38 uecorr->SelectAODBranch(jb.Data());\r
39 ConfigTaskCorrectionsUE(uecorr);\r
40 SetTrackCuts(uecorr,cuts);\r
41 SetAnaTopology(uecorr,anaTopology);\r
42 SetRegionType(uecorr,regionType);\r
43 SetSorting(uecorr,sortBy);\r
44\r
45 if( jb.Contains("ICDF") ) { // Use internal "Charged Particle Jet CDF" instead of jets from AOD\r
46 uecorr->SetUseChPartJet( kTRUE );\r
47 uecorr->SetPtMinChPartJet(0.5);\r
48 }\r
49\r
50 // ***** to be fixed *******\r
51 /*\r
52 if(jb.Length()>0){\r
53 ueana->ReadDeltaAOD(kTRUE);\r
54 ueana->SelectDeltaAODBranch(jb.Data());\r
55 }\r
56 */\r
57\r
58 mgr->AddTask(uecorr);\r
59 \r
60 // Create ONLY the output containers for the data produced by the task.\r
61 // Get and connect other common input/output containers via the manager as below\r
62 //==============================================================================\r
63 AliAnalysisDataContainer *coutput1_UE = 0;\r
64 AliAnalysisDataContainer *coutput2_UE = 0;\r
65\r
66 if (!proof){\r
67 if(jb.Length()==0)coutput1_UE = mgr->CreateContainer("histosCorrectionsUE", TList::Class(),AliAnalysisManager::kOutputContainer,Form("%s:PWG4_CorrectionsUE",AliAnalysisManager::GetCommonFileName()));\r
68 else coutput1_UE = mgr->CreateContainer(Form("histosCorrectionsUE_%s",name.Data()), TList::Class(),AliAnalysisManager::kOutputContainer,Form("%s:PWG4_CorrectionsUE_%s",AliAnalysisManager::GetCommonFileName(),name.Data()));\r
69 \r
70 if(jb.Length()==0)coutput2_UE = mgr->CreateContainer("containersCorrectionsUE", AliCFContainer::Class(),AliAnalysisManager::kOutputContainer,Form("%s:PWG4_CorrectionsUE",AliAnalysisManager::GetCommonFileName()));\r
71 else coutput2_UE = mgr->CreateContainer(Form("containersCorrectionsUE_%s",name.Data()), AliCFContainer::Class(),AliAnalysisManager::kOutputContainer,Form("%s:PWG4_CorrectionsUE_%s",AliAnalysisManager::GetCommonFileName(),name.Data()));\r
72 } else {//simplify output structure in case of PROOF or it crashes while transferring files from master)\r
73 if(jb.Length()==0)coutput1_UE = mgr->CreateContainer("histosCorrectionsUE", TList::Class(),AliAnalysisManager::kOutputContainer,Form("%s",AliAnalysisManager::GetCommonFileName()));\r
74 else coutput1_UE = mgr->CreateContainer(Form("histosCorrectionsUE_%s",name.Data()), TList::Class(),AliAnalysisManager::kOutputContainer,Form("%s",AliAnalysisManager::GetCommonFileName()));\r
75 \r
76 if(jb.Length()==0)coutput2_UE = mgr->CreateContainer("containersCorrectionsUE", AliCFContainer::Class(),AliAnalysisManager::kOutputContainer,Form("%s",AliAnalysisManager::GetCommonFileName()));\r
77 else coutput2_UE = mgr->CreateContainer(Form("containersCorrectionsUE_%s",name.Data()), AliCFContainer::Class(),AliAnalysisManager::kOutputContainer,Form("%s",AliAnalysisManager::GetCommonFileName()));\r
78\r
79\r
80\r
81 }\r
82\r
83 mgr->ConnectInput (uecorr, 0, mgr->GetCommonInputContainer());\r
84 mgr->ConnectOutput (uecorr, 0, coutput1_UE );\r
85 mgr->ConnectOutput (uecorr, 1, coutput2_UE );\r
86 \r
87 return uecorr;\r
88}\r
89\r
90//------------------------------------------------------------------------\r
91void ConfigTaskCorrectionsUE(AliAnalysisTaskCorrectionsUE * uecorr){\r
92 // common config,\r
93 uecorr->SetDebugLevel(10); \r
94 uecorr->SetPtRangeInHist(100, 0., 100.);\r
95}\r
96\r
97//------------------------------------------------------------------------\r
98SetTrackCuts(AliAnalysisTaskCorrectionsUE * uecorr, Char_t *ct){\r
99 \r
100 uecorr->SetFilterBit(16); // Standard TPC+ITS cuts 2009\r
101\r
102 switch (ct) {\r
103 case "ALICE":\r
104 uecorr->SetTrackPtCut(0.1);\r
105 uecorr->SetTrackEtaCut(0.9);\r
106 break;\r
107 \r
108 case "CDF":\r
109 uecorr->SetTrackPtCut(0.5);\r
110 uecorr->SetTrackEtaCut(0.9); \r
111 break;\r
112\r
113 default:\r
114 Printf("\n >>>>>>> AddTaskCorrectionsUE Error Wrong Set of Track Cuts selected\n");\r
115 break;\r
116 }\r
117}\r
118\r
119//------------------------------------------------------------------------\r
120SetAnaTopology(AliAnalysisTaskCorrectionsUE * uecorr, Char_t *at){\r
121\r
122 switch (at) {\r
123 case "LJ": // leading jet\r
124 uecorr->SetAnaTopology(1);\r
125 uecorr->SetJet1EtaCut(0.5);\r
126 break;\r
127\r
128 case "LJCC": // leading jet with charged cluster\r
129 uecorr->SetAnaTopology(1);\r
130 uecorr->SetJet1EtaCut(0.9); // CDF allow jet radius extend ouside |eta|<1\r
131 break;\r
132 \r
133 case "BB": // back-to-back\r
134 uecorr->SetAnaTopology(2);\r
135 uecorr->SetJet1EtaCut(0.5);\r
136 uecorr->SetJet2DeltaPhiCut(2.616);\r
137 break;\r
138\r
139 case "BE": // back-to-back exclusive\r
140 uecorr->SetAnaTopology(3);\r
141 uecorr->SetJet1EtaCut(0.5);\r
142 uecorr->SetJet2DeltaPhiCut(2.616);\r
143 uecorr->SetJet3PtCut(10.);\r
144 break;\r
145\r
146 case "MP_eta05":\r
147 uecorr->SetAnaTopology(4);\r
148 uecorr->SetJet1EtaCut(0.9);\r
149 break;\r
150\r
151 case "MP_eta09": // max Pt charged particle\r
152 uecorr->SetAnaTopology(4);\r
153 uecorr->SetJet1EtaCut(0.9);\r
154 break;\r
155\r
156\r
157 default:\r
158 Printf("\n >>>>>>> AddTaskCorrectionsUE Error Wrong Analysis Topology selected\n");\r
159 break;\r
160 }\r
161\r
162}\r
163\r
164//------------------------------------------------------------------------\r
165SetRegionType(AliAnalysisTaskCorrectionsUE * uecorr, Char_t *rt){\r
166\r
167 switch (rt) {\r
168 case "TRANSV": \r
169 uecorr->SetRegionType(1); \r
170 break;\r
171 \r
172 case "CONE":\r
173 uecorr->SetRegionType(2); \r
174 uecorr->SetConeRadius(0.4); \r
175 break;\r
176\r
177 default:\r
178 Printf("\n >>>>>>> AddTaskCorrectionsUE Error Wrong Region Type selected\n");\r
179 break;\r
180 }\r
181} \r
182\r
183//------------------------------------------------------------------------\r
184SetSorting(AliAnalysisTaskCorrectionsUE * uecorr, Char_t *sort){\r
185 \r
186 switch (sort){\r
187 // Minimum zone is selected per quantity type\r
188 case "MQA":\r
189 uecorr->SetPtSumOrdering(1); \r
190 break;\r
191 \r
192 // Minimum Zone is selected at the region having lowest pt summation of all tracks \r
193 case "MSP":\r
194 uecorr->SetPtSumOrdering(2);\r
195 break;\r
196 \r
197 // Minimum Zone is selected at the region having lowest average pt per track\r
198 case "MAP":\r
199 uecorr->SetPtSumOrdering(3);\r
200 break;\r
201 \r
202 default:\r
203 Printf("\n >>>>>>> AddTaskCorrectionsUE Error Wrong Sorting selected\n"); \r
204 Printf("\n >>>>>>> AddTaskCorrectionsUE Sort by Set to MSP \n");\r
205 uecorr->SetPtSumOrdering(2);\r
206 break;\r
207 }\r
208}\r