changed output file name to lower case
[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
49\r
50 \r
76f9015f 51 AliAnalysisDataContainer *cout_jet = mgr->CreateContainer(Form("jethist%s%s%s",jr,jf,cRadius), TList::Class(),\r
52 AliAnalysisManager::kOutputContainer, Form("jethist%s_%s%s.root",jr,jf,cRadius));\r
672f1183 53 // Connect jet finder to task.\r
54 jetana->SetJetFinder(jetFinder);\r
55 jetana->SetConfigFile("");\r
19027d3e 56 jetana->SetDebugLevel(0);\r
672f1183 57 mgr->AddTask(jetana);\r
58\r
59 // Create ONLY the output containers for the data produced by the task.\r
60 // Get and connect other common input/output containers via the manager as below\r
61 //==============================================================================\r
62 mgr->ConnectInput (jetana, 0, mgr->GetCommonInputContainer());\r
63// AOD output slot will be used in a different way in future\r
64 mgr->ConnectOutput (jetana, 0, mgr->GetCommonOutputContainer());\r
65 mgr->ConnectOutput (jetana, 1, cout_jet);\r
66 \r
67 return jetana;\r
68}\r
0651dd18 69\r
76f9015f 70AliJetFinder *CreateJetFinder(Char_t *jf,Float_t radius){\r
70144f07 71 AliJetFinder *jetFinder = 0;\r
0651dd18 72\r
73 switch (jf) {\r
74 case "CDF":\r
75 AliCdfJetHeader *jh = new AliCdfJetHeader();\r
76 jh->SetRadius(0.7);\r
77 \r
78 jetFinder = new AliCdfJetFinder();\r
79 jetFinder->SetOutputFile("jets.root");\r
80 if (jh) jetFinder->SetJetHeader(jh);\r
81 break;\r
82\r
83 case "DA":\r
84 AliDAJetHeader *jh=new AliDAJetHeader();\r
85 jh->SetComment("DA jet code with default parameters");\r
86 jh->SelectJets(kTRUE);\r
87 jh->SetNclust(10);\r
88 \r
89 jetFinder = new AliDAJetFinder();\r
90 if (jh) jetFinder->SetJetHeader(jh);\r
91 break;\r
92\r
93\r
70144f07 94 case "FASTJET":\r
95 AliFastJetHeaderV1 *jh = new AliFastJetHeaderV1();\r
96 jh->SetRparam(0.4); // setup parameters \r
97 if(radius>0)jh->SetRparam(radius);\r
98 jh->SetAlgorithm(2); // antikt from fastjet/JetDefinition.hh\r
0651dd18 99 jetFinder = new AliFastJetFinder();\r
0651dd18 100 if (jh) jetFinder->SetJetHeader(jh);\r
101 break;\r
102\r
103 case "UA1":\r
104 AliUA1JetHeaderV1 *jh=new AliUA1JetHeaderV1();\r
105 jh->SetComment("UA1 jet code with default parameters");\r
ba146e16 106 jh->BackgMode(0);\r
107 jh->SetRadius(0.4);\r
76f9015f 108 if(radius>0)jh->SetRadius(radius);\r
0651dd18 109 jh->SetEtSeed(4.);\r
110 jh->SetLegoNbinPhi(432);\r
111 jh->SetLegoNbinEta(274);\r
112 jh->SetLegoEtaMin(-2);\r
113 jh->SetLegoEtaMax(+2);\r
0651dd18 114 jh->SetMinJetEt(10.);\r
ba146e16 115 jh->SetJetEtaMax(1.5);\r
116 jh->SetJetEtaMin(-1.5);\r
0651dd18 117\r
118 jetFinder = new AliUA1JetFinderV1();\r
119 if (jh) jetFinder->SetJetHeader(jh);\r
120 break;\r
121\r
ba146e16 122 case "UA1MC":\r
123 AliUA1JetHeaderV1 *jh=new AliUA1JetHeaderV1();\r
124 jh->SetComment("UA1 jet code with default MC parameters");\r
125 jh->BackgMode(0);\r
126 jh->SetRadius(1.0);\r
76f9015f 127 if(radius>0)jh->SetRadius(radius);\r
ba146e16 128 jh->SetEtSeed(4.);\r
129 jh->SetLegoNbinPhi(432);\r
130 jh->SetLegoNbinEta(274);\r
131 jh->SetLegoEtaMin(-2);\r
132 jh->SetLegoEtaMax(+2);\r
133 jh->SetMinJetEt(10.);\r
134 jh->SetJetEtaMax(1.5);\r
135 jh->SetJetEtaMin(-1.5);\r
ba146e16 136 jetFinder = new AliUA1JetFinderV1();\r
137 if (jh) jetFinder->SetJetHeader(jh);\r
138 break;\r
70144f07 139 default:\r
140 Printf("\n >>>>>>> AddTaskJets Error Wrong jet finder selected\n");\r
141 break;\r
0651dd18 142 }\r
143\r
144 return jetFinder;\r
145\r
146}\r
147\r
148AliJetReader *CreateJetReader(Char_t *jr){\r
149 AliJetReader *er = 0;\r
150\r
151 switch (jr) {\r
152 case "MC":\r
153 AliJetKineReaderHeader *jrh = new AliJetKineReaderHeader();\r
154 jrh->SetComment("MC full Kinematics");\r
155 jrh->SetFastSimTPC(kFALSE);\r
156 jrh->SetFastSimEMCAL(kFALSE);\r
157 jrh->SetPtCut(0.);\r
158 jrh->SetFiducialEta(-2.1,2.1); // to take all MC particles default is 0 .9 \r
159 // Define reader and set its header \r
160 er = new AliJetKineReader();\r
161 er->SetReaderHeader(jrh);\r
162 break;\r
ba146e16 163 case "MC2":\r
164 AliJetKineReaderHeader *jrh = new AliJetKineReaderHeader();\r
5dbee319 165 jrh->SetComment("MC full Kinematics spearate config charged only");\r
ba146e16 166 jrh->SetFastSimTPC(kFALSE);\r
167 jrh->SetFastSimEMCAL(kFALSE);\r
5dbee319 168 jrh->SetChargedOnly(kTRUE);\r
ba146e16 169 jrh->SetPtCut(0.);\r
170 jrh->SetFiducialEta(-2.1,2.1); // to take all MC particles default is 0 .9 \r
171 // Define reader and set its header \r
172 er = new AliJetKineReader();\r
173 er->SetReaderHeader(jrh);\r
174 break;\r
0651dd18 175 case "ESD":\r
176 AliJetESDReaderHeader *jrh = new AliJetESDReaderHeader();\r
177 jrh->SetComment("Testing");\r
178 jrh->SetFirstEvent(0);\r
179 jrh->SetLastEvent(1000);\r
180 jrh->SetPtCut(0.);\r
181 jrh->SetReadSignalOnly(kFALSE);\r
182 // Define reader and set its header \r
183 er = new AliJetESDReader();\r
184 er->SetReaderHeader(jrh);\r
185 break;\r
186\r
187 case "AOD":\r
188 AliJetAODReaderHeader *jrh = new AliJetAODReaderHeader();\r
189 jrh->SetComment("AOD Reader");\r
190 jrh->SetPtCut(0.);\r
191 jrh->SetTestFilterMask(1<<0);\r
192 // Define reader and set its header\r
193 er = new AliJetAODReader();\r
194 er->SetReaderHeader(jrh);\r
195 break;\r
0c43aaa9 196 case "AODMC":\r
197 AliJetAODReaderHeader *jrh = new AliJetAODReaderHeader();\r
198 jrh->SetComment("AOD MC Reader");\r
199 jrh->SetPtCut(0.);\r
200 jrh->SetFiducialEta(-2.1,2.1); // to take all MC particles default is 0.9\r
201 jrh->SetReadAODMC(1);// 1 all primary MC , 2 all primary charged\r
202 // Define reader and set its header\r
203 er = new AliJetAODReader();\r
204 er->SetReaderHeader(jrh);\r
205 break;\r
5dbee319 206 case "AODMC2":\r
207 AliJetAODReaderHeader *jrh = new AliJetAODReaderHeader();\r
208 jrh->SetComment("AOD MC Reader");\r
209 jrh->SetPtCut(0.);\r
210 jrh->SetFiducialEta(-2.1,2.1); // to take all MC particles default is 0.9\r
211 jrh->SetReadAODMC(2);// 1 all primary MC , 2 all primary charged\r
212 // Define reader and set its header\r
213 er = new AliJetAODReader();\r
214 er->SetReaderHeader(jrh);\r
215 break;\r
216\r
0651dd18 217 default:\r
218 ::Error("AddTaskJets", "Wrong jet reader selected\n");\r
219 return 0;\r
220 }\r
221\r
222 return er;\r
223\r
224}\r