Correct accessing tower equalization coefficient array
[u/mrichter/AliRoot.git] / PWG4 / macros / AddTaskJets.C
CommitLineData
0651dd18 1AliJetReader *CreateJetReader(Char_t *jr); // Common config\r
2AliJetFinder *CreateJetFinder(Char_t *jf);\r
3\r
4AliAnalysisTaskJets *AddTaskJets(Char_t *jr, Char_t *jf); // for the new AF\r
5AliAnalysisTaskJets *AddTaskJets(Char_t *jr, Char_t *jf,AliAnalysisManager* mgr,AliAnalysisDataContainer *cinput); // for the old AF\r
6\r
672f1183 7AliAnalysisTaskJets *AddTaskJets(Char_t *jr, Char_t *jf)\r
8{\r
0651dd18 9 // Creates a jet finder task, configures it and adds it to the analysis manager.\r
672f1183 10\r
11 // Get the pointer to the existing analysis manager via the static access method.\r
12 //==============================================================================\r
13 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();\r
14 if (!mgr) {\r
15 ::Error("AddTaskJets", "No analysis manager to connect to.");\r
16 return NULL;\r
17 } \r
18 \r
19 // Check the analysis type using the event handlers connected to the analysis manager.\r
20 //==============================================================================\r
21 if (!mgr->GetInputEventHandler()) {\r
22 ::Error("AddTaskJets", "This task requires an input event handler");\r
23 return NULL;\r
24 }\r
25\r
26 // Create the task and configure it.\r
27 //===========================================================================\r
28 AliAnalysisTaskJets *jetana;\r
0651dd18 29 AliJetReader *er = CreateJetReader(jr);\r
672f1183 30 // Define jet header and jet finder\r
0651dd18 31 AliJetFinder *jetFinder = CreateJetFinder(jf);\r
32\r
672f1183 33 if (jetFinder){\r
672f1183 34 if (er) jetFinder->SetJetReader(er);\r
35 }\r
36\r
37 jetana = new AliAnalysisTaskJets(Form("JetAnalysis%s%s",jr,jf));\r
38 AliAnalysisDataContainer *cout_jet = mgr->CreateContainer(Form("jethist%s%s",jr,jf), TList::Class(),\r
39 AliAnalysisManager::kOutputContainer, Form("jethist%s_%s.root",jr,jf));\r
40 // Connect jet finder to task.\r
41 jetana->SetJetFinder(jetFinder);\r
42 jetana->SetConfigFile("");\r
43 jetana->SetDebugLevel(10);\r
44 mgr->AddTask(jetana);\r
45\r
46 // Create ONLY the output containers for the data produced by the task.\r
47 // Get and connect other common input/output containers via the manager as below\r
48 //==============================================================================\r
49 mgr->ConnectInput (jetana, 0, mgr->GetCommonInputContainer());\r
50// AOD output slot will be used in a different way in future\r
51 mgr->ConnectOutput (jetana, 0, mgr->GetCommonOutputContainer());\r
52 mgr->ConnectOutput (jetana, 1, cout_jet);\r
53 \r
54 return jetana;\r
55}\r
0651dd18 56\r
57AliAnalysisTaskJets *AddTaskJets(Char_t *jr, Char_t *jf,AliAnalysisManager* mgr,AliAnalysisDataContainer *cinput)\r
58{\r
59 // This is only for running on PROOF with the old root version 5-22-00 \r
60 // and the older version of the AF\r
61\r
62 // Creates a jet fider task, configures it and adds it to the analysis manager.\r
63 // Get the pointer to the existing analysis manager via the static access method.\r
64 //==============================================================================\r
65\r
66 if (!mgr) {\r
67 ::Error("AddTaskJets", "No analysis manager to connect to.");\r
68 return NULL;\r
69 } \r
70 \r
71 // Check the analysis type using the event handlers connected to the analysis manager.\r
72 //==============================================================================\r
73 if (!mgr->GetInputEventHandler()) {\r
74 ::Error("AddTaskJets", "This task requires an input event handler");\r
75 return NULL;\r
76 }\r
77\r
78 // Create the task and configure it.\r
79 //===========================================================================\r
80 AliAnalysisTaskJets *jetana;\r
81 AliJetReader *er = CreateJetReader(jr);\r
82\r
83 // Define jet header and jet finder\r
84 AliJetFinder *jetFinder = CreateJetFinder(jf);\r
85\r
86 if (jetFinder){\r
87 if (er) jetFinder->SetJetReader(er);\r
88 }\r
89\r
90 jetana = new AliAnalysisTaskJets(Form("JetAnalysis%s%s",jr,jf));\r
91 AliAnalysisDataContainer *cout_jet = mgr->CreateContainer(Form("jethist%s%s",jr,jf), TList::Class(),AliAnalysisManager::kOutputContainer, Form("jethist%s_%s.root",jr,jf));\r
92 // Connect jet finder to task.\r
93 jetana->SetJetFinder(jetFinder);\r
94 jetana->SetConfigFile("");\r
95 jetana->SetDebugLevel(10);\r
96 mgr->AddTask(jetana);\r
97\r
98 // Create the output containers for the data produced by the task.\r
99 //==============================================================================\r
100 // AOD output slot will be used in a different way in future\r
101 // we need to have different names for each usage\r
102 c_aodjet = mgr->CreateContainer(Form("cAODjet%s%s",jr,jf), TTree::Class(),\r
103 AliAnalysisManager::kExchangeContainer);\r
104 // Connect to data containers\r
105 mgr->ConnectInput (jetana,0, cinput );\r
106 mgr->ConnectOutput (jetana,0, c_aodjet );\r
107 mgr->ConnectOutput (jetana, 1, cout_jet);\r
108 \r
109 return jetana;\r
110}\r
111\r
112AliJetFinder *CreateJetFinder(Char_t *jf){\r
113\r
114 switch (jf) {\r
115 case "CDF":\r
116 AliCdfJetHeader *jh = new AliCdfJetHeader();\r
117 jh->SetRadius(0.7);\r
118 \r
119 jetFinder = new AliCdfJetFinder();\r
120 jetFinder->SetOutputFile("jets.root");\r
121 if (jh) jetFinder->SetJetHeader(jh);\r
122 break;\r
123\r
124 case "DA":\r
125 AliDAJetHeader *jh=new AliDAJetHeader();\r
126 jh->SetComment("DA jet code with default parameters");\r
127 jh->SelectJets(kTRUE);\r
128 jh->SetNclust(10);\r
129 \r
130 jetFinder = new AliDAJetFinder();\r
131 if (jh) jetFinder->SetJetHeader(jh);\r
132 break;\r
133\r
134\r
135 case "Fastjet":\r
136 AliFastJetHeader *jh = new AliFastJetHeader();\r
137 jh->SetRparam(0.7); // setup parameters \r
138\r
139 jetFinder = new AliFastJetFinder();\r
140 jetFinder->SetOutputFile("jets.root");\r
141 if (jh) jetFinder->SetJetHeader(jh);\r
142 break;\r
143\r
144 case "UA1":\r
145 AliUA1JetHeaderV1 *jh=new AliUA1JetHeaderV1();\r
146 jh->SetComment("UA1 jet code with default parameters");\r
ba146e16 147 jh->BackgMode(0);\r
148 jh->SetRadius(0.4);\r
0651dd18 149 jh->SetEtSeed(4.);\r
150 jh->SetLegoNbinPhi(432);\r
151 jh->SetLegoNbinEta(274);\r
152 jh->SetLegoEtaMin(-2);\r
153 jh->SetLegoEtaMax(+2);\r
0651dd18 154 jh->SetMinJetEt(10.);\r
ba146e16 155 jh->SetJetEtaMax(1.5);\r
156 jh->SetJetEtaMin(-1.5);\r
0651dd18 157\r
158 jetFinder = new AliUA1JetFinderV1();\r
159 if (jh) jetFinder->SetJetHeader(jh);\r
160 break;\r
161\r
ba146e16 162 case "UA1MC":\r
163 AliUA1JetHeaderV1 *jh=new AliUA1JetHeaderV1();\r
164 jh->SetComment("UA1 jet code with default MC parameters");\r
165 jh->BackgMode(0);\r
166 jh->SetRadius(1.0);\r
167 jh->SetEtSeed(4.);\r
168 jh->SetLegoNbinPhi(432);\r
169 jh->SetLegoNbinEta(274);\r
170 jh->SetLegoEtaMin(-2);\r
171 jh->SetLegoEtaMax(+2);\r
172 jh->SetMinJetEt(10.);\r
173 jh->SetJetEtaMax(1.5);\r
174 jh->SetJetEtaMin(-1.5);\r
175\r
176 jetFinder = new AliUA1JetFinderV1();\r
177 if (jh) jetFinder->SetJetHeader(jh);\r
178 break;\r
0651dd18 179 case default:\r
180 ::Error("AddTaskJets", "Wrong jet finder selected\n");\r
181 return 0;\r
182 }\r
183\r
184 return jetFinder;\r
185\r
186}\r
187\r
188AliJetReader *CreateJetReader(Char_t *jr){\r
189 AliJetReader *er = 0;\r
190\r
191 switch (jr) {\r
192 case "MC":\r
193 AliJetKineReaderHeader *jrh = new AliJetKineReaderHeader();\r
194 jrh->SetComment("MC full Kinematics");\r
195 jrh->SetFastSimTPC(kFALSE);\r
196 jrh->SetFastSimEMCAL(kFALSE);\r
197 jrh->SetPtCut(0.);\r
198 jrh->SetFiducialEta(-2.1,2.1); // to take all MC particles default is 0 .9 \r
199 // Define reader and set its header \r
200 er = new AliJetKineReader();\r
201 er->SetReaderHeader(jrh);\r
202 break;\r
ba146e16 203 case "MC2":\r
204 AliJetKineReaderHeader *jrh = new AliJetKineReaderHeader();\r
205 jrh->SetComment("MC full Kinematics spearate config");\r
206 jrh->SetFastSimTPC(kFALSE);\r
207 jrh->SetFastSimEMCAL(kFALSE);\r
208 jrh->SetPtCut(0.);\r
209 jrh->SetFiducialEta(-2.1,2.1); // to take all MC particles default is 0 .9 \r
210 // Define reader and set its header \r
211 er = new AliJetKineReader();\r
212 er->SetReaderHeader(jrh);\r
213 break;\r
0651dd18 214 case "ESD":\r
215 AliJetESDReaderHeader *jrh = new AliJetESDReaderHeader();\r
216 jrh->SetComment("Testing");\r
217 jrh->SetFirstEvent(0);\r
218 jrh->SetLastEvent(1000);\r
219 jrh->SetPtCut(0.);\r
220 jrh->SetReadSignalOnly(kFALSE);\r
221 // Define reader and set its header \r
222 er = new AliJetESDReader();\r
223 er->SetReaderHeader(jrh);\r
224 break;\r
225\r
226 case "AOD":\r
227 AliJetAODReaderHeader *jrh = new AliJetAODReaderHeader();\r
228 jrh->SetComment("AOD Reader");\r
229 jrh->SetPtCut(0.);\r
230 jrh->SetTestFilterMask(1<<0);\r
231 // Define reader and set its header\r
232 er = new AliJetAODReader();\r
233 er->SetReaderHeader(jrh);\r
234 break;\r
235\r
236 default:\r
237 ::Error("AddTaskJets", "Wrong jet reader selected\n");\r
238 return 0;\r
239 }\r
240\r
241 return er;\r
242\r
243}\r