]>
Commit | Line | Data |
---|---|---|
1 | ||
2 | /************************************************************************************************* | |
3 | *** Add Fragmentation Function Task *** | |
4 | ************************************************************************************************** | |
5 | The fragmenation function task expects an ESD filter and jet finder running before this task. | |
6 | Or it runs on delta-AODs filled with filtered tracks and jets before. | |
7 | ||
8 | ** Parameters ** | |
9 | (char) recJetsBranch: branch in AOD for (reconstructed) jets | |
10 | (char) genJetsBranch: branch in AOD for (generated) jets | |
11 | (char) jetType: "AOD" jets from recJetsBranch | |
12 | "AODMC" jets from genJetsBranch | |
13 | "KINE" jets from PYCELL | |
14 | +"b" (e.g. "AODb") jets with acceptance cuts | |
15 | (char) trackType: "AOD" reconstructed tracks from AOD filled by ESD filter (choose filter mask!) | |
16 | "AODMC" MC tracks from AOD filled by kine filter | |
17 | "KINE" kine particles from MC event | |
18 | +"2" (e.g. "AOD2") charged tracks only | |
19 | +"b" (e.g. "AOD2b") with acceptance cuts | |
20 | (UInt_t) filterMask: select filter bit of ESD filter task | |
21 | ||
22 | ***************************************************************************************************/ | |
23 | ||
24 | ||
25 | ||
26 | ||
27 | AliAnalysisTaskFragmentationFunction *AddTaskFragmentationFunction(UInt_t iFlag=1, UInt_t filterMask=32){ | |
28 | ||
29 | AliAnalysisTaskFragmentationFunction *ff=0; | |
30 | ||
31 | // UA1 Jets | |
32 | // only reconstructed (default) | |
33 | if(iFlag&(1<<0)) ff = AddTaskFragmentationFunction("jets", "", "", "", filterMask); | |
34 | // charged MC tracks and jets | |
35 | if(iFlag&(1<<1)) ff = AddTaskFragmentationFunction("jets", "jetsAODMC2_UA104", "AODMC", "AODMC2", filterMask); | |
36 | // charged MC tracks and jets with acceptance cuts | |
37 | if(iFlag&(1<<2)) ff = AddTaskFragmentationFunction("jets", "jetsAODMC2_UA104", "AODMCb", "AODMC2b", filterMask); | |
38 | // kine tracks in acceptance, pythia jets in acceptance | |
39 | if(iFlag&(1<<3)) ff = AddTaskFragmentationFunction("jets", "", "KINEb", "KINEb", filterMask); | |
40 | // reconstructed charged tracks after cuts, MC jets in acceptance | |
41 | if(iFlag&(1<<4)) ff = AddTaskFragmentationFunction("jets", "jetsMC2b", "AODMCb", "AOD2b", filterMask); | |
42 | // reconstruction efficiency: pointing with rec jet axis into gen tracks | |
43 | if(iFlag&(1<<5)) ff = AddTaskFragmentationFunction("jets", "jetsAODMC2_UA104", "AODb", "AODMC2b", filterMask); | |
44 | ||
45 | // kt jets | |
46 | // only reconstructed | |
47 | if(iFlag&(1<<10)) ff = AddTaskFragmentationFunction("jetsAOD_FASTKT04", "", "", "", filterMask); | |
48 | // charged MC tracks and jets | |
49 | if(iFlag&(1<<11)) ff = AddTaskFragmentationFunction("jetsAOD_FASTKT04", "jetsAODMC2_FASTKT04", "AODMC", "AODMC2", filterMask); | |
50 | // charged MC tracks and jets with acceptance cuts | |
51 | if(iFlag&(1<<12)) ff = AddTaskFragmentationFunction("jetsAOD_FASTKT04", "jetsAODMC2_FASTKT04", "AODMCb", "AODMC2b", filterMask); | |
52 | ||
53 | // anti-kt jets | |
54 | // only reconstructed | |
55 | if(iFlag&(1<<20)) ff = AddTaskFragmentationFunction("jetsAOD_FASTJET04", "", "", "", filterMask); | |
56 | // charged MC tracks and jets | |
57 | if(iFlag&(1<<21)) ff = AddTaskFragmentationFunction("jetsAOD_FASTJET04", "jetsAODMC2_FASTJET04", "AODMC", "AODMC2", filterMask); | |
58 | // charged MC tracks and jets with acceptance cuts | |
59 | if(iFlag&(1<<22)) ff = AddTaskFragmentationFunction("jetsAOD_FASTJET04", "jetsAODMC2_FASTJET04", "AODMCb", "AODMC2b", filterMask); | |
60 | ||
61 | ||
62 | ||
63 | return ff; | |
64 | } | |
65 | ||
66 | // _______________________________________________________________________________________ | |
67 | ||
68 | AliAnalysisTaskFragmentationFunction *AddTaskFragmentationFunction( | |
69 | const char* recJetsBranch, | |
70 | const char* genJetsBranch, | |
71 | const char* jetType, | |
72 | const char* trackType, | |
73 | UInt_t filterMask) | |
74 | { | |
75 | // Creates a fragmentation function task, | |
76 | // configures it and adds it to the analysis manager. | |
77 | ||
78 | //****************************************************************************** | |
79 | //*** Configuration Parameter ************************************************** | |
80 | //****************************************************************************** | |
81 | ||
82 | // space for configuration parameter: histo bin, cuts, ... | |
83 | // so far only default parameter used | |
84 | ||
85 | Int_t debug = -1; // debug level, -1: not set here | |
86 | ||
87 | //****************************************************************************** | |
88 | ||
89 | ||
90 | ||
91 | // Get the pointer to the existing analysis manager via the static access method. | |
92 | //============================================================================== | |
93 | AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); | |
94 | if (!mgr) { | |
95 | ::Error("AddTaskFragmentationFunction", "No analysis manager to connect to."); | |
96 | return NULL; | |
97 | } | |
98 | ||
99 | // Check the analysis type using the event handlers connected to the analysis manager. | |
100 | //============================================================================== | |
101 | if (!mgr->GetInputEventHandler()) { | |
102 | ::Error("AddTaskFragmentationFunction", "This task requires an input event handler"); | |
103 | return NULL; | |
104 | } | |
105 | ||
106 | TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD" | |
107 | Printf("Data Type: %s", type.Data()); | |
108 | ||
109 | TString branchRecJets(recJetsBranch); | |
110 | TString branchGenJets(genJetsBranch); | |
111 | TString typeJets(jetType); | |
112 | TString typeTracks(trackType); | |
113 | ||
114 | if(branchRecJets.Length()==0) branchRecJets = "noRecJets"; | |
115 | if(branchGenJets.Length()==0) branchGenJets = "noGenJets"; | |
116 | if(typeTracks.Length()==0) typeTracks = "trackTypeUndef"; | |
117 | if(typeJets.Length()==0) typeJets = "jetTypeUndef"; | |
118 | ||
119 | // Create the task and configure it. | |
120 | //=========================================================================== | |
121 | ||
122 | AliAnalysisTaskFragmentationFunction *task = new AliAnalysisTaskFragmentationFunction( | |
123 | Form("Fragmenation Function %s %s %s %s", branchRecJets.Data(), branchGenJets.Data(), typeJets.Data(), typeTracks.Data())); | |
124 | ||
125 | if(debug>=0) task->SetDebugLevel(debug); | |
126 | ||
127 | Printf("Rec Jets %s", branchRecJets.Data()); | |
128 | Printf("Gen Jets %s", branchGenJets.Data()); | |
129 | Printf("Jet Type %s", typeJets.Data()); | |
130 | Printf("Track Type %s", typeTracks.Data()); | |
131 | ||
132 | // attach the filter maska | |
133 | if(branchRecJets.Contains("AOD")&&branchRecJets.Contains("jets")&&!branchRecJets.Contains("MC"))branchRecJets += Form("_Filter%05d",filterMask); | |
134 | if(branchGenJets.Contains("AOD")&&branchRecJets.Contains("jets")&&!branchGenJets.Contains("MC"))branchGenJets += Form("_Filter%05d",filterMask); | |
135 | ||
136 | if(!branchRecJets.Contains("noRecJets")) task->SetBranchRecJets(branchRecJets); | |
137 | if(!branchGenJets.Contains("noGenJets")) task->SetBranchGenJets(branchGenJets); | |
138 | ||
139 | ||
140 | if(typeTracks.Contains("AODMC2b")) task->SetTrackTypeGen(AliAnalysisTaskFragmentationFunction::kTrackAODMCChargedAcceptance); | |
141 | else if(typeTracks.Contains("AODMC2")) task->SetTrackTypeGen(AliAnalysisTaskFragmentationFunction::kTrackAODMCCharged); | |
142 | else if(typeTracks.Contains("AODMC")) task->SetTrackTypeGen(AliAnalysisTaskFragmentationFunction::kTrackAODMCAll); | |
143 | else if(typeTracks.Contains("KINE2b")) task->SetTrackTypeGen(AliAnalysisTaskFragmentationFunction::kTrackKineChargedAcceptance); | |
144 | else if(typeTracks.Contains("KINE2")) task->SetTrackTypeGen(AliAnalysisTaskFragmentationFunction::kTrackKineCharged); | |
145 | else if(typeTracks.Contains("KINE")) task->SetTrackTypeGen(AliAnalysisTaskFragmentationFunction::kTrackKineAll); | |
146 | else if(typeTracks.Contains("AODb")) task->SetTrackTypeGen(AliAnalysisTaskFragmentationFunction::kTrackAODCuts); | |
147 | else if(typeTracks.Contains("AOD")) task->SetTrackTypeGen(AliAnalysisTaskFragmentationFunction::kTrackAOD); | |
148 | else if(typeTracks.Contains("trackTypeUndef")) task->SetTrackTypeGen(0); // undefined | |
149 | else Printf("trackType %s not found", typeTracks.Data()); | |
150 | ||
151 | if(typeJets.Contains("AODMCb")) task->SetJetTypeGen(AliAnalysisTaskFragmentationFunction::kJetsGenAcceptance); | |
152 | else if(typeJets.Contains("AODMC")) task->SetJetTypeGen(AliAnalysisTaskFragmentationFunction::kJetsGen); | |
153 | else if(typeJets.Contains("KINEb")) task->SetJetTypeGen(AliAnalysisTaskFragmentationFunction::kJetsKineAcceptance); | |
154 | else if(typeJets.Contains("KINE")) task->SetJetTypeGen(AliAnalysisTaskFragmentationFunction::kJetsKine); | |
155 | else if(typeJets.Contains("AODb")) task->SetJetTypeGen(AliAnalysisTaskFragmentationFunction::kJetsRecAcceptance); | |
156 | else if(typeJets.Contains("AOD")) task->SetJetTypeGen(AliAnalysisTaskFragmentationFunction::kJetsRec); | |
157 | else if(typeJets.Contains("jetTypeUndef")) task->SetJetTypeGen(0); // undefined | |
158 | else Printf("jetType %s not found", typeJets.Data()); | |
159 | ||
160 | if(typeJets.Contains("AODMCb")) task->SetJetTypeRecEff(AliAnalysisTaskFragmentationFunction::kJetsGenAcceptance); // kJetsRecAcceptance | |
161 | else if(typeJets.Contains("AODb")) task->SetJetTypeRecEff(AliAnalysisTaskFragmentationFunction::kJetsRecAcceptance); | |
162 | else task->SetJetTypeRecEff(0); | |
163 | ||
164 | task->SetFilterMask(filterMask); | |
165 | ||
166 | // Set default parameters | |
167 | // Cut selection | |
168 | task->SetTrackCuts(); // default : pt > 0.150 GeV, |eta|<0.9, full phi acc | |
169 | task->SetJetCuts(); // default: jet pt > 5 GeV, |eta|<0.5, full phi acc | |
170 | task->SetDiJetCuts(); // default: type of cut = 1 (cut in deltaPhi), deltaPhi = 0., cdf = 0.5, fraction of pt = 0.6 | |
171 | task->SetKindSlices(); // default: kindSlice = 1 (inv mass) | |
172 | task->SetFFRadius(); // default: R = 0.4 | |
173 | task->SetFFBckgRadius(); // default: R = 0.7 | |
174 | task->SetBckgMode(); // default: bgMode = 1 | |
175 | task->SetHighPtThreshold(); // default: pt > 5 Gev | |
176 | task->UseRecEffRecJetPtBins(); // efficiency in bins of rec/gen jet pt - default: kTRUE | |
177 | ||
178 | // Define histo bins | |
179 | task->SetFFHistoBins(); | |
180 | task->SetQAJetHistoBins(); | |
181 | task->SetQATrackHistoBins(); | |
182 | task->SetIJHistoBins(); | |
183 | task->SetDiJetHistoBins(); | |
184 | task->SetQADiJetHistoBins(); | |
185 | ||
186 | mgr->AddTask(task); | |
187 | ||
188 | // Create ONLY the output containers for the data produced by the task. | |
189 | // Get and connect other common input/output containers via the manager as below | |
190 | //============================================================================== | |
191 | ||
192 | AliAnalysisDataContainer *coutput_FragFunc = mgr->CreateContainer( | |
193 | Form("fracfunc_%s_%s_%s_%s", branchRecJets.Data(), branchGenJets.Data(), typeTracks.Data(), typeJets.Data()), | |
194 | TList::Class(), | |
195 | AliAnalysisManager::kOutputContainer, | |
196 | Form("%s:PWG4_FragmentationFunction_%s_%s_%s_%s", | |
197 | AliAnalysisManager::GetCommonFileName(), branchRecJets.Data(), branchGenJets. Data(), typeTracks.Data(), typeJets.Data())); | |
198 | ||
199 | mgr->ConnectInput (task, 0, mgr->GetCommonInputContainer()); | |
200 | mgr->ConnectOutput (task, 0, mgr->GetCommonOutputContainer()); | |
201 | mgr->ConnectOutput (task, 1, coutput_FragFunc); | |
202 | ||
203 | return task; | |
204 | } |