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