]>
Commit | Line | Data |
---|---|---|
ce55b926 | 1 | // ************************************************************************************************* |
2 | // *** Add Fragmentation Function Task *** | |
3 | // ************************************************************************************************** | |
4 | // The fragmentation function task expects an ESD filter and jet finder running before this task. | |
5 | // Or it runs on delta-AODs filled with filtered tracks and jets before. | |
6 | ||
7 | // ** Parameters ** | |
8 | // (char) recJetsBranch: branch in AOD for (reconstructed) jets | |
9 | // (char) genJetsBranch: branch in AOD for (generated) jets | |
10 | // (char) jetType: "AOD" jets from recJetsBranch | |
11 | // "AODMC" jets from genJetsBranch | |
12 | // "KINE" jets from PYCELL | |
13 | // +"b" (e.g. "AODb") jets with acceptance cuts | |
14 | // (char) trackType: "AOD" reconstructed tracks from AOD filled by ESD filter (choose filter mask!) | |
15 | // "AODMC" MC tracks from AOD filled by kine filter | |
16 | // "KINE" kine particles from MC event | |
17 | // +"2" (e.g. "AOD2") charged tracks only | |
18 | // +"b" (e.g. "AOD2b") with acceptance cuts | |
19 | // (UInt_t) filterMask: select filter bit of ESD filter task | |
20 | ||
21 | // *************************************************************************************************** | |
22 | ||
1aa4f09f | 23 | |
24 | // _______________________________________________________________________________________ | |
25 | ||
1db1733e | 26 | AliAnalysisTaskFragmentationFunction *AddTaskFragmentationFunction( |
27 | const char* recJetsBranch, | |
44b235ce | 28 | const char* recJetsBackBranch, |
1db1733e | 29 | const char* genJetsBranch, |
30 | const char* jetType, | |
31 | const char* trackType, | |
44b235ce | 32 | UInt_t filterMask, |
33 | Float_t radius, | |
34 | int kBackgroundMode, | |
6daac008 | 35 | Int_t PtTrackMin, |
44b235ce | 36 | Int_t eventClass=0, |
37 | TString BrOpt="", | |
38 | TString BrOpt2="", | |
6daac008 | 39 | TString BrOpt3="", |
40 | Float_t radiusBckg=0.4, | |
41 | Int_t FFMaxTrackPt = -1, | |
ce55b926 | 42 | Int_t FFMinNTracks = 0, |
43 | UInt_t filterMaskTracks = 0) | |
6bec8236 | 44 | { |
ce55b926 | 45 | // Creates a fragmentation function task, |
46 | // configures it and adds it to the analysis manager. | |
47 | ||
48 | //****************************************************************************** | |
49 | //*** Configuration Parameter ************************************************** | |
50 | //****************************************************************************** | |
51 | ||
52 | // space for configuration parameter: histo bin, cuts, ... | |
53 | // so far only default parameter used | |
54 | ||
55 | Int_t debug = -1; // debug level, -1: not set here | |
56 | ||
57 | //****************************************************************************** | |
6bec8236 | 58 | |
1db1733e | 59 | |
ce55b926 | 60 | // Get the pointer to the existing analysis manager via the static access method. |
61 | //============================================================================== | |
62 | AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); | |
63 | if (!mgr) { | |
64 | ::Error("AddTaskFragmentationFunction", "No analysis manager to connect to."); | |
65 | return NULL; | |
66 | } | |
67 | ||
68 | // Check the analysis type using the event handlers connected to the analysis manager. | |
69 | //============================================================================== | |
70 | if (!mgr->GetInputEventHandler()) { | |
71 | ::Error("AddTaskFragmentationFunction", "This task requires an input event handler"); | |
72 | return NULL; | |
73 | } | |
74 | ||
75 | TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD" | |
76 | Printf("Data Type: %s", type.Data()); | |
77 | ||
78 | TString branchRecBackJets(recJetsBackBranch); | |
79 | TString branchRecJets(recJetsBranch); | |
80 | TString branchGenJets(genJetsBranch); | |
81 | TString typeJets(jetType); | |
82 | TString typeTracks(trackType); | |
83 | ||
84 | if(branchRecBackJets.Length()==0) branchRecBackJets = "noRecBackJets"; | |
85 | if(branchRecJets.Length()==0) branchRecJets = "noRecJets"; | |
86 | if(branchGenJets.Length()==0) branchGenJets = "noGenJets"; | |
87 | if(typeTracks.Length()==0) typeTracks = "trackTypeUndef"; | |
88 | if(typeJets.Length()==0) typeJets = "jetTypeUndef"; | |
89 | ||
90 | // Create the task and configure it. | |
91 | //=========================================================================== | |
92 | ||
93 | AliAnalysisTaskFragmentationFunction *task = new AliAnalysisTaskFragmentationFunction( | |
94 | Form("Fragmentation Function %s %s %s %s", branchRecJets.Data(), branchGenJets.Data(), typeJets.Data(), typeTracks.Data())); | |
95 | ||
96 | if(debug>=0) task->SetDebugLevel(debug); | |
97 | ||
98 | Printf("Rec Jets %s", branchRecJets.Data()); | |
99 | Printf("Back Rec Jets %s", branchRecBackJets.Data()); | |
100 | Printf("Gen Jets %s", branchGenJets.Data()); | |
101 | Printf("Jet Type %s", typeJets.Data()); | |
102 | Printf("Track Type %s", typeTracks.Data()); | |
103 | ||
104 | // attach the filter mask and options | |
105 | TString cAdd = ""; | |
106 | cAdd += Form("%02d",(int)((TMath::Abs(radius)+0.01)*10.)); | |
107 | cAdd += Form("_B%d",(int)((kBackgroundMode))); | |
108 | cAdd += Form("_Filter%05d",filterMask); | |
109 | cAdd += Form("_Cut%05d",PtTrackMin); | |
110 | cAdd += Form("%s",BrOpt.Data()); | |
111 | cAdd += Form("%s",BrOpt2.Data()); | |
112 | ||
113 | Printf("%s",cAdd.Data()); | |
114 | ||
115 | TString cAddb = ""; | |
116 | cAddb += Form("%02d",(int)((radiusBckg+0.01)*10.)); | |
117 | cAddb += Form("_B%d",(int)((kBackgroundMode))); | |
118 | cAddb += Form("_Filter%05d",filterMask); | |
119 | cAddb += Form("_Cut%05d",PtTrackMin); | |
120 | cAddb += Form("%s",BrOpt.Data()); | |
121 | cAddb += Form("%s",BrOpt2.Data()); | |
122 | ||
123 | Printf("%s",cAddb.Data()); | |
124 | ||
125 | TString cAddmc = ""; | |
126 | cAddmc += Form("%02d",(int)((TMath::Abs(radius)+0.01)*10.)); | |
127 | cAddmc += Form("_B%d",(int)((kBackgroundMode))); | |
128 | cAddmc += Form("_Filter%05d",filterMask); | |
129 | cAddmc += Form("_Cut%05d",PtTrackMin); | |
130 | cAddmc += Form("%s",BrOpt3.Data()); | |
131 | ||
132 | Printf("%s",cAddmc.Data()); | |
133 | ||
134 | ||
135 | if(branchRecJets.Contains("AOD")&&branchRecJets.Contains("jets")&&!branchRecJets.Contains("MC"))branchRecJets = branchRecJets + cAdd; | |
136 | if(branchRecJets.Contains("AOD")&&branchRecJets.Contains("cluster")&&!branchRecJets.Contains("MC"))branchRecJets = branchRecJets + cAdd; | |
137 | ||
138 | if(branchRecBackJets.Contains("back")&&branchRecBackJets.Contains("cluster")&&!branchRecBackJets.Contains("MC"))branchRecBackJets = branchRecBackJets + cAddb; | |
139 | ||
140 | if(branchGenJets.Contains("AOD")&&branchGenJets.Contains("MC"))branchGenJets = branchGenJets + cAddmc; | |
141 | ||
142 | Printf("Gen jets branch %s: ", branchGenJets.Data()); | |
143 | Printf("Rec jets branch %s: ", branchRecJets.Data()); | |
144 | Printf("Jet backg branch %s: ", branchRecBackJets.Data()); | |
145 | ||
146 | if(!branchRecJets.Contains("noRecJets")) task->SetBranchRecJets(branchRecJets); | |
147 | if(!branchRecBackJets.Contains("noRecBackJets")) task->SetBranchRecBackJets(branchRecBackJets); | |
148 | if(!branchGenJets.Contains("noGenJets")) task->SetBranchGenJets(branchGenJets); | |
149 | ||
150 | ||
151 | if(typeTracks.Contains("AODMC2b")) task->SetTrackTypeGen(AliAnalysisTaskFragmentationFunction::kTrackAODMCChargedAcceptance); | |
152 | else if(typeTracks.Contains("AODMC2")) task->SetTrackTypeGen(AliAnalysisTaskFragmentationFunction::kTrackAODMCCharged); | |
153 | else if(typeTracks.Contains("AODMC")) task->SetTrackTypeGen(AliAnalysisTaskFragmentationFunction::kTrackAODMCAll); | |
154 | else if(typeTracks.Contains("KINE2b")) task->SetTrackTypeGen(AliAnalysisTaskFragmentationFunction::kTrackKineChargedAcceptance); | |
155 | else if(typeTracks.Contains("KINE2")) task->SetTrackTypeGen(AliAnalysisTaskFragmentationFunction::kTrackKineCharged); | |
156 | else if(typeTracks.Contains("KINE")) task->SetTrackTypeGen(AliAnalysisTaskFragmentationFunction::kTrackKineAll); | |
157 | else if(typeTracks.Contains("AODb")) task->SetTrackTypeGen(AliAnalysisTaskFragmentationFunction::kTrackAODCuts); | |
158 | else if(typeTracks.Contains("AOD")) task->SetTrackTypeGen(AliAnalysisTaskFragmentationFunction::kTrackAOD); | |
159 | else if(typeTracks.Contains("trackTypeUndef")) task->SetTrackTypeGen(0); // undefined | |
160 | else Printf("trackType %s not found", typeTracks.Data()); | |
161 | ||
162 | if(typeJets.Contains("AODMCb")) task->SetJetTypeGen(AliAnalysisTaskFragmentationFunction::kJetsGenAcceptance); | |
163 | else if(typeJets.Contains("AODMC")) task->SetJetTypeGen(AliAnalysisTaskFragmentationFunction::kJetsGen); | |
164 | else if(typeJets.Contains("KINEb")) task->SetJetTypeGen(AliAnalysisTaskFragmentationFunction::kJetsKineAcceptance); | |
165 | else if(typeJets.Contains("KINE")) task->SetJetTypeGen(AliAnalysisTaskFragmentationFunction::kJetsKine); | |
166 | else if(typeJets.Contains("AODb")) task->SetJetTypeGen(AliAnalysisTaskFragmentationFunction::kJetsRecAcceptance); | |
167 | else if(typeJets.Contains("AOD")) task->SetJetTypeGen(AliAnalysisTaskFragmentationFunction::kJetsRec); | |
168 | else if(typeJets.Contains("jetTypeUndef")) task->SetJetTypeGen(0); // undefined | |
169 | else Printf("jetType %s not found", typeJets.Data()); | |
170 | ||
171 | if(typeJets.Contains("AODMCb")) task->SetJetTypeRecEff(AliAnalysisTaskFragmentationFunction::kJetsGenAcceptance); // kJetsRecAcceptance | |
172 | else if(typeJets.Contains("AODb")) task->SetJetTypeRecEff(AliAnalysisTaskFragmentationFunction::kJetsRecAcceptance); | |
173 | else task->SetJetTypeRecEff(0); | |
174 | ||
175 | if(!filterMaskTracks) task->SetFilterMask(filterMask); | |
176 | else task->SetFilterMask(filterMaskTracks); | |
177 | ||
178 | task->SetEventSelectionMask(AliVEvent::kMB); | |
179 | task->SetEventClass(eventClass); | |
180 | ||
181 | // Set default parameters | |
182 | // Cut selection | |
183 | ||
184 | if(PtTrackMin == 150) task->SetTrackCuts(); // default : pt > 0.150 GeV, |eta|<0.9, full phi acc | |
185 | else if(PtTrackMin == 1000) task->SetTrackCuts(1.0, -0.9, 0.9, 0., 2*TMath::Pi()); | |
186 | else if(PtTrackMin == 2000) task->SetTrackCuts(2.0, -0.9, 0.9, 0., 2*TMath::Pi()); | |
187 | else task->SetTrackCuts(0.001*PtTrackMin,-0.9, 0.9, 0., 2*TMath::Pi()); | |
1db1733e | 188 | |
6daac008 | 189 | |
ce55b926 | 190 | task->SetJetCuts(); // default: jet pt > 5 GeV, |eta|<0.5, full phi acc |
191 | task->SetFFRadius(radius); | |
192 | task->SetFFBckgRadius(); // default: R = 0.7 | |
193 | task->SetHighPtThreshold(); // default: pt > 5 Gev | |
194 | ||
195 | task->SetQAMode(); // default: qaMode = 3 | |
196 | task->SetFFMode(1); // default: ffMode = 1 | |
197 | task->SetJSMode(1); | |
198 | ||
199 | task->SetEffMode(0); | |
200 | if(typeJets.Contains("AODb") && typeTracks.Contains("AODMC2b")) task->SetEffMode(1); | |
6daac008 | 201 | |
1db1733e | 202 | |
ce55b926 | 203 | task->SetBckgMode(1); |
204 | task->SetBckgType(AliAnalysisTaskFragmentationFunction::kBckgPerp2, | |
205 | AliAnalysisTaskFragmentationFunction::kBckgPerp, | |
206 | AliAnalysisTaskFragmentationFunction::kBckgPerp2Area); | |
207 | ||
208 | //task->SetBranchRecBackClusters(Form("clustersAOD_KT04_B0_Filter%05d_Cut00150_Skip00",filterMask)); // PbPb | |
209 | task->SetBranchRecBackClusters(""); | |
210 | ||
211 | // Define histo bins | |
212 | task->SetFFHistoBins(23, 5, 120, 480, 0., 120.,70, 0., 7., 52, 0., 1.3); | |
213 | ||
214 | task->SetQAJetHistoBins(); | |
215 | task->SetQATrackHistoBins(); | |
216 | ||
217 | if(FFMaxTrackPt>0) task->SetFFMaxTrackPt(FFMaxTrackPt); | |
218 | if(FFMinNTracks>0) task->SetFFMinNTracks(FFMinNTracks); | |
219 | ||
220 | mgr->AddTask(task); | |
221 | ||
222 | // Create ONLY the output containers for the data produced by the task. | |
223 | // Get and connect other common input/output containers via the manager as below | |
224 | //============================================================================== | |
225 | ||
226 | TString strList(Form("fracfunc_%s_%s_%s_%s_cl%d", branchRecJets.Data(), branchGenJets.Data(), typeTracks.Data(), typeJets.Data(), eventClass)); | |
227 | ||
228 | TString strDir(Form("%s:PWGJE_FragmentationFunction_%s_%s_%s_%s_cl%d", | |
229 | AliAnalysisManager::GetCommonFileName(), branchRecJets.Data(), branchGenJets. Data(), | |
230 | typeTracks.Data(), typeJets.Data(), eventClass)); | |
231 | ||
232 | ||
233 | if(FFMaxTrackPt>0){ | |
234 | strList += Form("_FFMaxPt%d", FFMaxTrackPt); | |
235 | strDir += Form("_FFMaxPt%d", FFMaxTrackPt); | |
236 | } | |
237 | if(FFMinNTracks>0){ | |
238 | strList += Form("_minNTr%d",FFMinNTracks); | |
239 | strDir += Form("_minNTr%d",FFMinNTracks); | |
240 | } | |
241 | ||
242 | if(radius<0){ | |
243 | strList += "_trackRefs"; | |
244 | strDir += "_trackRefs"; | |
245 | } | |
246 | if(filterMaskTracks){ | |
247 | strList += Form("_TrackFilter%05d",filterMaskTracks); | |
248 | strDir += Form("_TrackFilter%05d",filterMaskTracks); | |
249 | } | |
250 | ||
251 | AliAnalysisDataContainer *coutput_FragFunc = mgr->CreateContainer(strList,TList::Class(), | |
252 | AliAnalysisManager::kOutputContainer, | |
253 | strDir); | |
254 | ||
255 | mgr->ConnectInput (task, 0, mgr->GetCommonInputContainer()); | |
256 | mgr->ConnectOutput (task, 0, mgr->GetCommonOutputContainer()); | |
257 | mgr->ConnectOutput (task, 1, coutput_FragFunc); | |
258 | ||
259 | return task; | |
6bec8236 | 260 | } |