Fix compiler warning
[u/mrichter/AliRoot.git] / PWG4 / macros / AddTaskJets.C
CommitLineData
0651dd18 1AliJetReader *CreateJetReader(Char_t *jr); // Common config\r
76f9015f 2AliJetFinder *CreateJetFinder(Char_t *jf,Float_t radius = -1);\r
0651dd18 3\r
76f9015f 4AliAnalysisTaskJets *AddTaskJets(Char_t *jr, Char_t *jf,Float_t radius = -1); // for the new AF\r
0651dd18 5\r
9902ce1e 6AliAnalysisTaskJets *AddTaskJets(){\r
7 // fills the standard "jets" branch in the AOD\r
8 // need the ESDFilter to run before, to access the AODtracks\r
9 // Tracks selected by the first Filter (1<<0)\r
10 // needs to be adapted for different cuts\r
11 \r
12 // UA1 as standard chosen, since it is the most robust and simple JF\r
13 // R = 0.4 suffficient to provide accurate jet axis for correlation studies\r
14 // energy resolution suffers a little\r
15 // Acceptance of jets not limited by the Jet Finder but should be done\r
16 // by user to abs(eta) < 0.5 \r
17\r
18 return AddTaskJets("AOD","UA1",0.4);\r
19\r
20}\r
21\r
22\r
23\r
76f9015f 24AliAnalysisTaskJets *AddTaskJets(Char_t *jr, Char_t *jf, Float_t radius)\r
672f1183 25{\r
0651dd18 26 // Creates a jet finder task, configures it and adds it to the analysis manager.\r
672f1183 27\r
28 // Get the pointer to the existing analysis manager via the static access method.\r
29 //==============================================================================\r
30 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();\r
31 if (!mgr) {\r
32 ::Error("AddTaskJets", "No analysis manager to connect to.");\r
33 return NULL;\r
34 } \r
35 \r
36 // Check the analysis type using the event handlers connected to the analysis manager.\r
37 //==============================================================================\r
38 if (!mgr->GetInputEventHandler()) {\r
39 ::Error("AddTaskJets", "This task requires an input event handler");\r
40 return NULL;\r
41 }\r
42\r
0511798f 43 AliAODHandler *aodh = (AliAODHandler*)mgr->GetOutputEventHandler();\r
44 if (!aodh) {\r
45 ::Error("AddTaskJets", "This task needs an output event handler");\r
46 return NULL;\r
47 } \r
48\r
49\r
672f1183 50 // Create the task and configure it.\r
51 //===========================================================================\r
52 AliAnalysisTaskJets *jetana;\r
0651dd18 53 AliJetReader *er = CreateJetReader(jr);\r
672f1183 54 // Define jet header and jet finder\r
76f9015f 55 AliJetFinder *jetFinder = CreateJetFinder(jf,radius);\r
0651dd18 56\r
672f1183 57 if (jetFinder){\r
672f1183 58 if (er) jetFinder->SetJetReader(er);\r
59 }\r
60\r
76f9015f 61 char *cRadius = "";\r
62 if(radius>0)cRadius = Form("%02d",(int)(radius*10));\r
63\r
64 jetana = new AliAnalysisTaskJets(Form("JetAnalysis%s%s%s",jr,jf,cRadius));\r
06847475 65 TString type = mgr->GetInputEventHandler()->GetDataType();\r
66 if (type == "AOD") jetana->SetNonStdBranch(Form("jets%s",jf));\r
06847475 67 \r
be60d38b 68 TString c_jr(jr);\r
69 c_jr.ToLower();\r
70 TString c_jf(jf);\r
71 c_jf.ToLower();\r
72\r
73 AliAnalysisDataContainer *cout_jet = mgr->CreateContainer(Form("jethist%s%s%s",c_jr.Data(),c_jf.Data(),cRadius), TList::Class(),\r
74 AliAnalysisManager::kOutputContainer, Form("jethist_%s_%s%s.root",c_jr.Data(),c_jf.Data(),cRadius));\r
672f1183 75 // Connect jet finder to task.\r
76 jetana->SetJetFinder(jetFinder);\r
77 jetana->SetConfigFile("");\r
19027d3e 78 jetana->SetDebugLevel(0);\r
672f1183 79 mgr->AddTask(jetana);\r
80\r
81 // Create ONLY the output containers for the data produced by the task.\r
82 // Get and connect other common input/output containers via the manager as below\r
83 //==============================================================================\r
84 mgr->ConnectInput (jetana, 0, mgr->GetCommonInputContainer());\r
85// AOD output slot will be used in a different way in future\r
86 mgr->ConnectOutput (jetana, 0, mgr->GetCommonOutputContainer());\r
87 mgr->ConnectOutput (jetana, 1, cout_jet);\r
88 \r
89 return jetana;\r
90}\r
0651dd18 91\r
76f9015f 92AliJetFinder *CreateJetFinder(Char_t *jf,Float_t radius){\r
70144f07 93 AliJetFinder *jetFinder = 0;\r
0651dd18 94\r
95 switch (jf) {\r
96 case "CDF":\r
97 AliCdfJetHeader *jh = new AliCdfJetHeader();\r
98 jh->SetRadius(0.7);\r
99 \r
100 jetFinder = new AliCdfJetFinder();\r
101 jetFinder->SetOutputFile("jets.root");\r
102 if (jh) jetFinder->SetJetHeader(jh);\r
103 break;\r
104\r
105 case "DA":\r
106 AliDAJetHeader *jh=new AliDAJetHeader();\r
107 jh->SetComment("DA jet code with default parameters");\r
108 jh->SelectJets(kTRUE);\r
109 jh->SetNclust(10);\r
110 \r
111 jetFinder = new AliDAJetFinder();\r
112 if (jh) jetFinder->SetJetHeader(jh);\r
113 break;\r
114\r
115\r
70144f07 116 case "FASTJET":\r
117 AliFastJetHeaderV1 *jh = new AliFastJetHeaderV1();\r
118 jh->SetRparam(0.4); // setup parameters \r
119 if(radius>0)jh->SetRparam(radius);\r
120 jh->SetAlgorithm(2); // antikt from fastjet/JetDefinition.hh\r
0651dd18 121 jetFinder = new AliFastJetFinder();\r
0651dd18 122 if (jh) jetFinder->SetJetHeader(jh);\r
123 break;\r
124\r
125 case "UA1":\r
126 AliUA1JetHeaderV1 *jh=new AliUA1JetHeaderV1();\r
127 jh->SetComment("UA1 jet code with default parameters");\r
ba146e16 128 jh->BackgMode(0);\r
129 jh->SetRadius(0.4);\r
76f9015f 130 if(radius>0)jh->SetRadius(radius);\r
0651dd18 131 jh->SetEtSeed(4.);\r
c40ab9fa 132 jh->SetEtSeed(4.);\r
133 jh->SetNAcceptJets(6);\r
0651dd18 134 jh->SetLegoNbinPhi(432);\r
135 jh->SetLegoNbinEta(274);\r
136 jh->SetLegoEtaMin(-2);\r
137 jh->SetLegoEtaMax(+2);\r
9902ce1e 138 jh->SetMinJetEt(5.);\r
ba146e16 139 jh->SetJetEtaMax(1.5);\r
140 jh->SetJetEtaMin(-1.5);\r
0651dd18 141\r
142 jetFinder = new AliUA1JetFinderV1();\r
143 if (jh) jetFinder->SetJetHeader(jh);\r
144 break;\r
145\r
ba146e16 146 case "UA1MC":\r
147 AliUA1JetHeaderV1 *jh=new AliUA1JetHeaderV1();\r
148 jh->SetComment("UA1 jet code with default MC parameters");\r
149 jh->BackgMode(0);\r
150 jh->SetRadius(1.0);\r
76f9015f 151 if(radius>0)jh->SetRadius(radius);\r
ba146e16 152 jh->SetEtSeed(4.);\r
c40ab9fa 153 jh->SetNAcceptJets(6);\r
ba146e16 154 jh->SetLegoNbinPhi(432);\r
155 jh->SetLegoNbinEta(274);\r
156 jh->SetLegoEtaMin(-2);\r
157 jh->SetLegoEtaMax(+2);\r
9902ce1e 158 jh->SetMinJetEt(5.);\r
ba146e16 159 jh->SetJetEtaMax(1.5);\r
160 jh->SetJetEtaMin(-1.5);\r
ba146e16 161 jetFinder = new AliUA1JetFinderV1();\r
162 if (jh) jetFinder->SetJetHeader(jh);\r
163 break;\r
70144f07 164 default:\r
165 Printf("\n >>>>>>> AddTaskJets Error Wrong jet finder selected\n");\r
166 break;\r
0651dd18 167 }\r
168\r
169 return jetFinder;\r
170\r
171}\r
172\r
173AliJetReader *CreateJetReader(Char_t *jr){\r
174 AliJetReader *er = 0;\r
175\r
176 switch (jr) {\r
177 case "MC":\r
178 AliJetKineReaderHeader *jrh = new AliJetKineReaderHeader();\r
179 jrh->SetComment("MC full Kinematics");\r
180 jrh->SetFastSimTPC(kFALSE);\r
181 jrh->SetFastSimEMCAL(kFALSE);\r
182 jrh->SetPtCut(0.);\r
183 jrh->SetFiducialEta(-2.1,2.1); // to take all MC particles default is 0 .9 \r
184 // Define reader and set its header \r
185 er = new AliJetKineReader();\r
186 er->SetReaderHeader(jrh);\r
187 break;\r
ba146e16 188 case "MC2":\r
189 AliJetKineReaderHeader *jrh = new AliJetKineReaderHeader();\r
5dbee319 190 jrh->SetComment("MC full Kinematics spearate config charged only");\r
ba146e16 191 jrh->SetFastSimTPC(kFALSE);\r
192 jrh->SetFastSimEMCAL(kFALSE);\r
5dbee319 193 jrh->SetChargedOnly(kTRUE);\r
ba146e16 194 jrh->SetPtCut(0.);\r
195 jrh->SetFiducialEta(-2.1,2.1); // to take all MC particles default is 0 .9 \r
196 // Define reader and set its header \r
197 er = new AliJetKineReader();\r
198 er->SetReaderHeader(jrh);\r
199 break;\r
0651dd18 200 case "ESD":\r
201 AliJetESDReaderHeader *jrh = new AliJetESDReaderHeader();\r
202 jrh->SetComment("Testing");\r
203 jrh->SetFirstEvent(0);\r
204 jrh->SetLastEvent(1000);\r
205 jrh->SetPtCut(0.);\r
206 jrh->SetReadSignalOnly(kFALSE);\r
207 // Define reader and set its header \r
208 er = new AliJetESDReader();\r
209 er->SetReaderHeader(jrh);\r
210 break;\r
211\r
212 case "AOD":\r
213 AliJetAODReaderHeader *jrh = new AliJetAODReaderHeader();\r
214 jrh->SetComment("AOD Reader");\r
215 jrh->SetPtCut(0.);\r
216 jrh->SetTestFilterMask(1<<0);\r
217 // Define reader and set its header\r
218 er = new AliJetAODReader();\r
219 er->SetReaderHeader(jrh);\r
220 break;\r
0c43aaa9 221 case "AODMC":\r
222 AliJetAODReaderHeader *jrh = new AliJetAODReaderHeader();\r
223 jrh->SetComment("AOD MC Reader");\r
224 jrh->SetPtCut(0.);\r
225 jrh->SetFiducialEta(-2.1,2.1); // to take all MC particles default is 0.9\r
226 jrh->SetReadAODMC(1);// 1 all primary MC , 2 all primary charged\r
227 // Define reader and set its header\r
228 er = new AliJetAODReader();\r
229 er->SetReaderHeader(jrh);\r
230 break;\r
5dbee319 231 case "AODMC2":\r
232 AliJetAODReaderHeader *jrh = new AliJetAODReaderHeader();\r
233 jrh->SetComment("AOD MC Reader");\r
234 jrh->SetPtCut(0.);\r
235 jrh->SetFiducialEta(-2.1,2.1); // to take all MC particles default is 0.9\r
236 jrh->SetReadAODMC(2);// 1 all primary MC , 2 all primary charged\r
237 // Define reader and set its header\r
238 er = new AliJetAODReader();\r
239 er->SetReaderHeader(jrh);\r
240 break;\r
241\r
0651dd18 242 default:\r
243 ::Error("AddTaskJets", "Wrong jet reader selected\n");\r
244 return 0;\r
245 }\r
246\r
247 return er;\r
248\r
249}\r