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