]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGCF/FLOW/Attic/AddTwoParticleResonanceFlowTask.C
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGCF / FLOW / Attic / AddTwoParticleResonanceFlowTask.C
CommitLineData
ee557a59 1/////////////////////////////////////////////////////////////////////////////////////////////
2//
3// AddTaskPhiFlow macro
4// Author: Redmer A. Bertens, Utrecht University, 2012
5// rbertens@cern.ch, r.a.bertens@uu.nl
6// Commented where necessary
7/////////////////////////////////////////////////////////////////////////////////////////////
8
9class AliAnalysisDataContainer;
10class AliFlowTrackCuts;
11class AliFlowTrackSimpleCuts;
12class AliFlowEventCuts;
13class AliFlowEventSimpleCuts;
14class AliAnalysisDataContainer;
15
16AliAnalysisTwoParticleResonanceFlowTask* AddTwoParticleResonanceFlowTask(Bool_t SP = 1, // select flow analysis methods
17 Bool_t SPSUB = 0,
18 Bool_t QC = 0,
19 Bool_t EP = 0,
20 Bool_t EP3sub = 0,
21 Bool_t VZERO_SP = 0, // use vzero sp method
22 Float_t centrMin = 20., // centrality selection
23 Float_t centrMax = 40.,
24 Float_t TPConlyA = 3.,
25 Float_t TPCTOFA = 5.,
26 Float_t TOFA = 3.,
27 Float_t TPConlyB = 3.,
28 Float_t TPCTOFB = 5.,
29 Float_t TOFB = 3.,
30 Float_t Bpurity = 0.9, // set to 0 to disable bayesian PID
31 TString suffixName = "UniqueID", // unique id for output objects
32 Bool_t bCentralTrigger = kTRUE, // trigger selection
33 Float_t EtaGap = 0., // eta gap for SPSUB
34 TString DCA = "pt", // dca mode (see task implementation)
35 Int_t harm = 2, // harmonic vn
36 UInt_t poi_filter = 1, // aod filterbits
37 UInt_t rp_filter = 1,
38 Float_t minMass = .71, // min mass for flow analysis
39 Float_t maxMaxx = 1.13, // max mass for flow analysis
40 Int_t speciesA = 3, // species a
41 Int_t speciesB = 2, // species b
42 Int_t chargeA = 1, // charge a
43 Int_t chargeB = -1, // charge b
44 Float_t massA = 4.93676999999999977e-01, // mass species a
45 Float_t massB = 1.39570e-01, // mass species b
46 Float_t minPtA = 0.15, // min pt for track a
47 Float_t maxPtA = 10., // max pt for track a
48 Float_t minPtB = 0.15, // min pt for track b
49 Float_t maxPtB = 10, // max pt for track b
50 Bool_t PhiMinusPsiMethod = 0, // use phi minus psi method
51 Bool_t event_mixing = kTRUE, // use event mixing
52 Bool_t highPtMode = kFALSE, // use with caution !!! disables invariant mass fit method
53 Float_t mass = 1.092, // mass for high pt analysis
54 Float_t deltaMass = 0.0003) // dM in which to look for resonance
55{
56 // removed because CINT cannot cope with more than 40 function arguments
57 Bool_t shrinkSP = kTRUE;
58 Bool_t debug = kFALSE;
59 /* some defaults that are used frequently:
60 * for phi:
61 * - minMass = 0.99
62 * - maxMass = 1.092
63 * for kstar
64 * - minMass = 0.71
65 * - maxMass = 1.13
66 * kaon mass = 4.93676999999999977e-01
67 * pion mass = 1.39570e-01
68 */
69 // some defaults that have been removed as function arguments (august 30 2012)
70 Float_t deltaDip = 0.;
71 Float_t deltaDipMaxPt = 0.;
72 Float_t vertexZ = 10.;
73 Float_t POIEtaMin = -0.8;
74 Float_t POIEtaMax = 0.8;
75 // start of macro
76 Float_t PIDconfig[] = {TPConlyA, TPCTOFA, TOFA, TPConlyB, TPCTOFB, TOFB, Bpurity};
77 // main function, create and add tasks
78 if(debug) cout << " === Adding Task TwoParticleResonanceFlow === " << endl;
79 // set up main output container's name
80 TString fileName = AliAnalysisManager::GetCommonFileName();
81 fileName += ":Reconstruction";
82 suffixName += Form("%.0f", centrMin);
83 suffixName += Form("%.0f", centrMax);
84 fileName+=suffixName;
85 if(debug) cout << " --> Reconstruction data container: " << fileName << endl;
86 if(EP3sub) {
87 if(highPtMode) {
88 if(debug) cout << " --> Can't launch 3 subevent method for high pt analysis, exiting ... <--" << endl;
89 return 0x0;
90 }
91 if(debug) cout << " --> Starting 3 subevent plane method - try at your own risk !!! <-- " << endl;
92 if(!(harm!=2||harm!=3)) {
93 if(debug) cout << " --> Fatal error: can only return v2 and v3 with 3 subevent method! " << endl;
94 return 0x0;
95 }
96 }
97 if((EP3sub||PhiMinusPsiMethod)&&debug) {
98 gROOT->LoadMacro("$ALICE_ROOT/PWGCF/FLOW/macros/AddTaskVZERO.C");
99 AddTaskVZERO(0,0,0,0);
100 }
101 // get the manager and input event handler
102 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
103 if (!mgr) {
104 if(debug) cout << " Fatal error: no analysis manager found! " << endl;
105 return 0x0;
106 }
107 if (!mgr->GetInputEventHandler()) {
108 if(debug) cout << " Fatal error: no imput event handler found!" << endl;
109 return 0x0;
110 }
111 if(EP3sub&&debug) { // don't use this on train ! this is why it's only enabled in macro debug mode
112 gROOT->LoadMacro("$ALICE_ROOT/PWGCF/FLOW/macros/AddTaskVZERO.C");
113 AddTaskVZERO(0,0,0,0);
114 }
115 // create the main task
116 AliAnalysisTwoParticleResonanceFlowTask *task = new AliAnalysisTwoParticleResonanceFlowTask(suffixName.Data());
117 if(debug) cout << " === AliAnalysisTwoParticleResonanceFlowTask === " << task << endl;
118 if(!task) {
119 if(debug) cout << " --> Unexpected error occurred: NO TASK WAS CREATED! (could be a library problem!) " << endl;
120 return 0x0;
121 }
122 if(task->UsePhiMinusPsiMethod(PhiMinusPsiMethod)) {
123 cout << " --> Using phi - Psi method <-- ... " << endl;
124 Float_t dphibins[] = {0., 0.63, 1.26, 1.89, 2.52, 3.15};
125 task->SetdPhiBins(dphibins, (Int_t)(sizeof(dphibins)/sizeof(dphibins[1])-1));
126 event_mixing = kTRUE;// only implemented for event mixing FIXME
127 }
128 task->SetupSpeciesA(speciesA, chargeA, massA, minPtA, maxPtA);
129 task->SetupSpeciesB(speciesB, chargeB, massB, minPtB, maxPtB);
130
131 if(task->SetVZEROSubEvents(EP3sub)) cout << " --> Setting up VZERO subevents method ... " << endl;
132 if(event_mixing) {
133 if(debug) cout << " --> Enabeling event mixing for reconstruction - try at your own risk !!! <-- " << endl;
134 // set vertex and mixing bins - arrays MUST have length 20!
135 Int_t c[] = {0, 2, 4, 6, 8, 10, 20, 30, 40, 50, 60, 70, 80, 90, 101, 0, 0, 0, 0, 0};
136 Int_t v[] = {-10, -8, -6, -4, -2, 0, 2, 4, 6, 8, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0};
137 if(((Int_t)(sizeof(c)/sizeof(c[1]))!=20)||((Int_t)(sizeof(v)/sizeof(v[1]))!=20)) {
138 cout << " --> Fatal error: check mixing parameters ! <-- " << endl;
139 return 0x0;
140 }
141 else task->SetMixingBins(c, v);
142 }
143 // set triggers
144 if (bCentralTrigger) task->SelectCollisionCandidates(AliVEvent::kMB | AliVEvent::kCentral | AliVEvent::kSemiCentral);
145 else task->SelectCollisionCandidates(AliVEvent::kMB);
146 if(debug) cout << " --> Set trigger selection to ";
147 if(debug&&bCentralTrigger) cout << " kMB, kCentral, kSemiCentral " << endl;
148 if(debug&&(!bCentralTrigger)) cout << " kMB " << endl;
149 //set RP cuts for flow package analysis
150 AliFlowTrackCuts* cutsRP = new AliFlowTrackCuts("RFPcuts");
151 if(!cutsRP) {
152 if(debug) cout << " Fatal error: no RP cuts found, could be a library problem! " << endl;
153 return 0x0;
154 }
155 if(!VZERO_SP) {
156 AliFlowTrackCuts::trackParameterType rptype = AliFlowTrackCuts::kGlobal;
157 cutsRP->SetParamType(rptype);
158 cutsRP->SetPtRange(0.2, 5.0);
159 cutsRP->SetEtaRange(-0.8, 0.8);
160 cutsRP->SetMinNClustersTPC(70);
161 cutsRP->SetMinChi2PerClusterTPC(0.1);
162 cutsRP->SetMaxChi2PerClusterTPC(4.0);
163 cutsRP->SetRequireTPCRefit(kTRUE);
164 cutsRP->SetMaxDCAToVertexXY(0.3);
165 cutsRP->SetMaxDCAToVertexZ(0.3);
166 cutsRP->SetAcceptKinkDaughters(kFALSE);
167 cutsRP->SetMinimalTPCdedx(10.);
168 if(rp_filter < 9999 ) {
169 if(debug) cout << " > set RP filterbit " << rp_filter << endl;
170 cutsRP->SetAODfilterBit(rp_filter);
171 }
172 if(debug) cout << " --> kGlobal RP's " << cutsRP << endl;
173 }
174 if(VZERO_SP) { // use vzero sub analysis
175 cutsRP = cutsRP->GetStandardVZEROOnlyTrackCuts(); // select vzero tracks
176 SP = kFALSE; // disable other methods
177 SPSUB = kTRUE; // calculate sp_qa and sp_qb
178 QC = kFALSE;
179 EP = kFALSE;
180 EP3sub = kFALSE;
181 EtaGap = 0.; // no eta gap, full tpc poi's
182 if(debug) cout << " --> VZERO RP's " << cutsRP << endl;
183 }
184 task->SetRPCuts(cutsRP);
185 // set POI cuts for kaon selection
186 AliFlowTrackCuts* cutsPOI = new AliFlowTrackCuts("GlobalPOI");
187 if(!cutsPOI) {
188 if(debug) cout << " Fatal error: no POI cuts (could be a library problem)!" << endl;
189 return 0x0;
190 }
191 cutsPOI = cutsPOI->GetStandardGlobalTrackCuts2010();
192 cutsPOI->SetMaxDCAToVertexXY(0.3); // FIXME not implemented in aod086 aod095 see PassesDCACut() in implementation
193 cutsPOI->SetMaxDCAToVertexZ(0.3);
194 if(poi_filter < 9999 ) {
195 if(debug) cout << " > set POI filterbit " << poi_filter << endl;
196 cutsPOI->SetAODfilterBit(poi_filter);
197 }
198 if(debug) cout << " --> cutsPOI " << cutsPOI << endl;
199 task->SetPOICuts(cutsPOI);
200
201 // set event cuts for flow package analysis
202 AliFlowEventCuts* cutsEvent = new AliFlowEventCuts("event cuts");
203 task->SetCentralityParameters(centrMin, centrMax, centralityName);
204 task->SetQA(kTRUE);
205
206
207 //set POI cuts for aods XY Z - 3 distinct cases
208 Float_t POIDCA[] = {0., 0., 0., 0., 0.};
209 if(DCA == "none" ) { // 1 --- do nothing
210 if (debug) cout << " --> No DCA cut on POI's <-- " << endl;
211 for (Int_t i = 0; i < 5; i++) POIDCA[i] = 0.;
212 }
213 if(DCA == "fix" ) { // 2 --- use fixed values for xy z
214 if (debug) cout << " --> Fixed DCA cut on POI's <-- " << endl;
215 POIDCA[0] = -1.; POIDCA[1] = 0.3; POIDCA[2] = 0.3; POIDCA[3] = 0.; POIDCA[4] = 0.;
216 }
217 if(DCA == "pt" ) { // 3 --- use pt dependent cut
218 if (debug) cout << " --> Pt dependent DCA cut on POI's <-- " << endl;
219 POIDCA[0] = 1.; POIDCA[1] = 0.0105; POIDCA[2] = 0.0350; POIDCA[3] = 1.1; POIDCA[4] = 2.;
220 }
221 task->SetPOIDCAXYZ(POIDCA);
222 Float_t AddTaskMacroSummary[] = {(Float_t)0, (Float_t)SP, (Float_t)SPSUB, (Float_t)QC, (Float_t)EP, (Float_t)EP3sub, (Float_t)VZERO_SP, (Float_t)EtaGap, (Float_t)harm, (Float_t)highPtMode, (Float_t)deltaDip};
223 task->SetAddTaskMacroSummary(AddTaskMacroSummary);
224
225 if(highPtMode) { // high pt loop - loop will end macro
226 Float_t _pt[] = {0., 1., 2., 3., 4., 5., 6., 7., 8., 9., 10., 12., 15.};
227 task->SetPtBins(_pt, (Int_t)(sizeof(_pt)/sizeof(_pt[1]))-1);
228 // general approach: use kinematic filters which select kaon pairs with a certain mass window
229 AliFlowTrackSimpleCuts* HighPtSubEventFilterA = new AliFlowTrackSimpleCuts("HighPtSubEventFilterA");
230 HighPtSubEventFilterA->SetEtaMin(-0.8);
231 HighPtSubEventFilterA->SetEtaMax(0.0);
232 HighPtSubEventFilterA->SetMassMin(mass - deltaMass);
233 HighPtSubEventFilterA->SetMassMax(mass + deltaMass);
234 AliFlowTrackSimpleCuts* HighPtSubEventFilterB = new AliFlowTrackSimpleCuts("HighPtSubEventFilterB");
235 HighPtSubEventFilterB->SetEtaMin(0.0);
236 HighPtSubEventFilterB->SetEtaMax(+0.8);
237 HighPtSubEventFilterB->SetMassMin(mass - deltaMass);
238 HighPtSubEventFilterB->SetMassMax(mass + deltaMass);
239 AliFlowTrackSimpleCuts* HighPtGenericFilter = new AliFlowTrackSimpleCuts("HighPtGenericFilter");
240 HighPtGenericFilter->SetEtaMin(-0.8);
241 HighPtGenericFilter->SetEtaMax(+0.8);
242 HighPtGenericFilter->SetMassMin(mass - deltaMass);
243 HighPtGenericFilter->SetMassMax(mass + deltaMass);
244 if(debug) cout << " --> Created poi filters " << endl;
245 // set pair and event cuts
246 if((deltaDip>0.005)&&(deltaDipMaxPt>0.005)) task->SetMaxDeltaDipAngleAndPt(deltaDip, deltaDipMaxPt);
247 else cout << " --> Disabled Delta-Dip exclusion. <-- " << endl;
248 task->SetCandidateEtaAndPt(POIEtaMin, POIEtaMax, 0., 15.);
249 task->SetCentralityParameters(centrMin, centrMax, "TRK", "V0M", kTRUE, kFALSE);
250 task->SetVertexZ(vertexZ);
251 if(debug) cout << " --> Set pair cuts and event cuts" << endl;
252 // specify the PID procedure which will be used
253 task->SetPIDConfiguration(PIDconfig);
254 AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
255 AliAnalysisDataContainer *coutHist = mgr->CreateContainer(Form("%s", TwoParticleResonanceFlow::OutputName(centrMin, centrMax,PIDconfig, suffixName, bCentralTrigger, EtaGap, POIEtaMin, POIEtaMax, deltaDip, deltaDipMaxPt, DCA, harm, vertexZ, debug).Data()), TList::Class(), AliAnalysisManager::kOutputContainer, fileName);
256 if(debug) cout << " --> Created IO containers " << cinput << ", " << coutHist << endl;
257 mgr->AddTask(task);
258 if(debug) cout << " === ADDING MAIN TASK == " << endl;
259 mgr->ConnectInput(task, 0, cinput);
260 mgr->ConnectOutput(task, 1, coutHist);
261 if(debug) cout << " --> Connected IO containers " << endl;
262 if (SP || EP || QC || SPSUB) // if flow analysis should be done after reconstruction
263 {
264 Int_t mb(999);
265 if(debug) cout << " === RECEIVED REQUEST FOR FLOW ANALYSIS === " << endl;
266 AliAnalysisDataContainer *flowEvent = mgr->CreateContainer(Form("FC%s", suffixName.Data()), AliFlowEventSimple::Class(), AliAnalysisManager::kExchangeContainer);
267 mgr->ConnectOutput(task, 2, flowEvent);
268 if(debug) cout << " --> Created IO containers " << flowEvent << endl;
269 if(debug) cout << " --> suffixName " << suffixName << endl;
270 if (QC) { // add qc tasks
271 TwoParticleResonanceFlow::AddQCmethod(Form("QCTPCMB_%d_%s", mb, suffixName.Data()), harm, flowEvent, HighPtGenericFilter, debug, 0x0, suffixName.Data());
272 if(debug) cout << " --> Hanging QC task ... " << mb << " succes! "<< endl;
273 }
274 if (SPSUB) { // add sp subevent tasks
275 TwoParticleResonanceFlow::AddSPmethod(Form("SPTPCMB_%d_%s", mb, suffixName.Data()), -0.8, -.5*EtaGap, .5*EtaGap, +0.8, "Qa", harm, flowEvent, HighPtSubEventFilterB, NULL, false, shrinkSP, debug, true, suffixName.Data());
276 if(debug) cout << " --> Hanging SP Qa task " << mb << " succes!" << endl;
277 TwoParticleResonanceFlow::AddSPmethod(Form("SPTPCMB_%d_%s", mb, suffixName.Data()), -0.8, -.5*EtaGap, .5*EtaGap, +0.8, "Qb", harm, flowEvent, HighPtSubEventFilterA, NULL, false, shrinkSP, debug, true, suffixName.Data());
278 if(debug) cout << " --> Hanging SP Qb task ..." << mb << " succes!"<< endl;
279 }
280 if (SP) { // add sp tasks
281 TwoParticleResonanceFlow::AddSPmethod(Form("SPTPCMB_%d_%s", mb, suffixName.Data()), -0.8, -0.0, +0.0, +0.8, "QaQb", harm, flowEvent, HighPtGenericFilter, NULL, false, shrinkSP, debug, 0x0, suffixName.Data());
282 if(debug) cout << " --> Hanging SP task ... " << mb << " succes!" << endl;
283 }
284 if (EP) { // add ep tasks
285 TwoParticleResonanceFlow::AddSPmethod(Form("EPTPCMBSP_%d_%s", mb, suffixName.Data()), -0.8, -0.0, +0.0, +0.8, "QaQb", harm, flowEvent, HighPtGenericFilter, NULL, true, shrinkSP, debug, 0x0, suffixName.Data());
286 if(debug) cout << " --> Hanging EP task ... " << mb << " succes!" << endl;
287 }
288 }
289 // print summary to screen
290 cout << endl << endl << " ==== AddTwoParticleResonanceFlowTask launched ===== " << endl;
291 cout << " ************ Configured PID routine ************ " << endl;
292 cout << " 0 < " << PIDconfig[1] << " p_t, ITS || TPC with s < " << PIDconfig[0] << endl;
293 if(PIDconfig[2] < 0.) cout << " --> TPC control disabled " << endl;
294 if(PIDconfig[2] > 0.) cout << " --> TPC control enabled " << endl;
295 cout << " " << PIDconfig[1] << " < " << PIDconfig[4] << " p_t, TPC || ITS with s < " << PIDconfig[3] << endl;
296 if(PIDconfig[5] < 0.) cout << " --> ITS control disabled " << endl;
297 if(PIDconfig[5] > 0.) cout << " --> ITS control enabled " << endl;
298 cout << " " << PIDconfig[4] << " < 7 p_t, TPC / TOF Bayesian with p < " << PIDconfig[6] << endl;
299 cout << " ************ Configured DCA setup ************** " << endl;
300 cout << " DCA type: " << DCA;
301 if (DCA == "") cout << "default";
302 cout << endl << " ************* Task statisti:q!cs ****************** " << endl;
303 cout << " -> Launched resonance reconstruction " << endl;
304 if(SP) cout << " --> Launched QaQb SP filters and corresponding SP task " << endl;
305 if(EP) cout << " --> Launched QaQb QC filters and corresponding EP task " << endl;
306 if(SPSUB) cout << " --> Launched Qa&&Qb SP filters and corresponding SP tasks " << endl;
307 if(QC) cout << " --> Launched QaQb QC filters and corresponding QC task " << endl;
308 if(EP3sub) cout << " --> Launched VZERO subevent analysis alongside reconstruction - USE WITH CAUTION!" << endl;
309 cout << " ************************************************ " << endl;
310 TString condit = "";
311 (task->SetQA(kFALSE)) ? condit+= " --> Enabled QA plots <-- " : condit+= " --> Disabled QA plots <-- ";
312 (task->SetIsMC(kFALSE)) ? condit+= " --> MC mode <-- " : condit+= " --> DATA mode <-- ";
313 (task->UseEventMixing(event_mixing)) ? condit+= " --> Using EVENT MIXING <--" : condit+= "--> Combinatorial background <--";
314 cout << condit << endl;
315 cout << " --> Now go for a coffee! <-- " << endl;
316 cout << " ************************************************ " << endl;
317 return task;
318 } // end of high pt loop - high-pt task is ready to go at this point
319 Float_t _pt[] = {0.0, 0.6, 1.2, 1.8, 2.4, 3.0, 3.5, 4.0, 4.5, 5.0, 5.5, 6.0, 6.5, 7.0};
320 task->SetPtBins(_pt, (Int_t)(sizeof(_pt)/sizeof(_pt[1]))-1);
321 // POI filter cuts, will filter invm mass bands and subevents
322 AliFlowTrackSimpleCuts* POIfilterQC[30];
323 AliFlowTrackSimpleCuts* POIfilterSP[30][2];
324 Double_t flowBands[2][30];
325 Double_t _inc = (maxMaxx-minMass)/30.;
326 for (Int_t mb = 0; mb < 30; mb++) {
327 flowBands[0][mb] = minMass + mb * _inc;
328 flowBands[1][mb] = minMass + (mb + 1) * _inc;
329 POIfilterSP[mb][0] = new AliFlowTrackSimpleCuts(Form("FilterPOISP_MB%d_ETANEG", mb));
330 if(!POIfilterSP[mb][0]) {
331 if(debug) cout << " FAILED to initialize POI filters, could be a library problem!" << endl;
332 return 0x0;
333 }
334 POIfilterSP[mb][0]->SetEtaMin(-0.8);
335 POIfilterSP[mb][0]->SetEtaMax(0.0);
336 POIfilterSP[mb][0]->SetMassMin(flowBands[0][mb]);
337 POIfilterSP[mb][0]->SetMassMax(flowBands[1][mb]);
338 POIfilterSP[mb][1] = new AliFlowTrackSimpleCuts(Form("FilterPOISP_MB%d_ETAPOS", mb));
339 POIfilterSP[mb][1]->SetEtaMin(0.0);
340 POIfilterSP[mb][1]->SetEtaMax(+0.8);
341 POIfilterSP[mb][1]->SetMassMin(flowBands[0][mb]);
342 POIfilterSP[mb][1]->SetMassMax(flowBands[1][mb]);
343 POIfilterQC[mb] = new AliFlowTrackSimpleCuts(Form("FilterPOIQC_MB%d", mb));
344 POIfilterQC[mb]->SetEtaMin(-0.8);
345 POIfilterQC[mb]->SetEtaMax(+0.8);
346 POIfilterQC[mb]->SetMassMin(flowBands[0][mb]);
347 POIfilterQC[mb]->SetMassMax(flowBands[1][mb]);
348 }
349 if(debug) cout << " --> Created poi filters " << endl;
350 task->SetCommonConstants(30, flowBands[0][0], flowBands[1][29]);
351 if(debug) cout << " --> Set common constants " << endl;
352 // set pair and event cuts
353 if((deltaDip>0.005)&&(deltaDipMaxPt>0.005)) task->SetMaxDeltaDipAngleAndPt(deltaDip, deltaDipMaxPt);
354 else cout << " --> Disabled Delta-Dip exclusion. <-- " << endl;
355 task->SetCandidateEtaAndPt(POIEtaMin, POIEtaMax, 0., 10.);
356 task->SetCentralityParameters(centrMin, centrMax, "TRK", "V0M", kTRUE, kFALSE);
357 task->SetVertexZ(vertexZ);
358 if(debug) cout << " --> Set pair cuts and event cuts" << endl;
359 // set the kaon cuts, and specify the PID procedure which will be used
360 task->SetPIDConfiguration(PIDconfig);
361 if(debug) {
362 cout << " ************ Configured PID routine ************ " << endl;
363 cout << " 0 < " << PIDconfig[1] << " p_t, ITS || TPC with s < " << PIDconfig[0] << endl;
364 if(PIDconfig[2] < 0.) cout << " --> TPC control disabled " << endl;
365 if(PIDconfig[2] > 0.) cout << " --> TPC control enabled " << endl;
366 cout << " " << PIDconfig[1] << " < " << PIDconfig[4] << " p_t, TPC || ITS with s < " << PIDconfig[3] << endl;
367 if(PIDconfig[5] < 0.) cout << " --> ITS control disabled " << endl;
368 if(PIDconfig[5] > 0.) cout << " --> ITS control enabled " << endl;
369 cout << " " << PIDconfig[4] << " < 7 p_t, TPC / TOF Bayesian with p < " << PIDconfig[6] << endl;
370 cout << " ************************************************ " << endl;
371 }
372 // create and configure IO containers
373 AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
374 AliAnalysisDataContainer *coutHist = mgr->CreateContainer(Form("%s", TwoParticleResonanceFlow::OutputName(centrMin, centrMax,PIDconfig, suffixName, bCentralTrigger, EtaGap, POIEtaMin, POIEtaMax, deltaDip, deltaDipMaxPt, DCA, harm, vertexZ, debug).Data()), TList::Class(), AliAnalysisManager::kOutputContainer, fileName);
375 if(debug) cout << " --> Created IO containers " << cinput << ", " << coutHist << endl;
376 mgr->AddTask(task);
377 if(debug) cout << " === ADDING MAIN TASK == " << endl;
378 mgr->ConnectInput(task, 0, cinput);
379 mgr->ConnectOutput(task, 1, coutHist);
380 if(debug) cout << " --> Connected IO containers " << endl;
381 if (SP || EP || QC || SPSUB) // if flow analysis should be done after reconstruction
382 {
383 if(debug) cout << " === RECEIVED REQUEST FOR FLOW ANALYSIS === " << endl;
384 AliAnalysisDataContainer *flowEvent = mgr->CreateContainer(Form("FC%s", suffixName.Data()), AliFlowEventSimple::Class(), AliAnalysisManager::kExchangeContainer);
385 mgr->ConnectOutput(task, 2, flowEvent);
386 if(debug) cout << " --> Created IO containers " << flowEvent << endl;
387 if(debug) cout << " --> suffixName " << suffixName << endl;
388 for (int mb = 0; mb != 30; ++mb) {
389 if (QC) { // add qc tasks
390 TwoParticleResonanceFlow::AddQCmethod(Form("QCTPCMB_%d_%s", mb, suffixName.Data()), harm, flowEvent, POIfilterQC[mb], debug, 0x0, suffixName.Data());
391 if(debug) cout << " --> Hanging QC task ... " << mb << " succes! "<< endl;
392 }
393 if (SPSUB) { // add sp subevent tasks
394 TwoParticleResonanceFlow::AddSPmethod(Form("SPTPCMB_%d_%s", mb, suffixName.Data()), -0.8, -.5*EtaGap, .5*EtaGap, +0.8, "Qa", harm, flowEvent, POIfilterSP[mb][1], NULL, false, shrinkSP, debug, true, suffixName.Data(), VZERO_SP);
395 if(debug) cout << " --> Hanging SP Qa task " << mb << " succes!" << endl;
396 TwoParticleResonanceFlow::AddSPmethod(Form("SPTPCMB_%d_%s", mb, suffixName.Data()), -0.8, -.5*EtaGap, .5*EtaGap, +0.8, "Qb", harm, flowEvent, POIfilterSP[mb][0], NULL, false, shrinkSP, debug, true, suffixName.Data(), VZERO_SP);
397 if(debug) cout << " --> Hanging SP Qb task ..." << mb << " succes!"<< endl;
398 }
399 if (SP) { // add sp tasks
400 TwoParticleResonanceFlow::AddSPmethod(Form("SPTPCMB_%d_%s", mb, suffixName.Data()), -0.8, -0.0, +0.0, +0.8, "QaQb", harm, flowEvent, POIfilterQC[mb], NULL, false, shrinkSP, debug, 0x0, suffixName.Data());
401 if(debug) cout << " --> Hanging SP task ... " << mb << " succes!" << endl;
402 }
403 if (EP) { // add ep tasks
404 TwoParticleResonanceFlow::AddSPmethod(Form("EPTPCMB_%d_%s", mb, suffixName.Data()), -0.8, -0.0, +0.0, +0.8, "QaQb", harm, flowEvent, POIfilterQC[mb], NULL, true, shrinkSP, debug, 0x0, suffixName.Data());
405 if(debug) cout << " --> Hanging EP task ... " << mb << " succes!" << endl;
406 }
407 }
408 }
409 // print summary to screen
410 cout << endl << endl << " ==== AddTwoParticleResonanceFlowTask launched ===== " << endl;
411 cout << " ************ Configured PID routine ************ " << endl;
412 cout << " 0 < " << PIDconfig[1] << " p_t, ITS || TPC with s < " << PIDconfig[0] << endl;
413 if(PIDconfig[2] < 0.) cout << " --> TPC control disabled " << endl;
414 if(PIDconfig[2] > 0.) cout << " --> TPC control enabled " << endl;
415 cout << " " << PIDconfig[1] << " < " << PIDconfig[4] << " p_t, TPC || ITS with s < " << PIDconfig[3] << endl;
416 if(PIDconfig[5] < 0.) cout << " --> ITS control disabled " << endl;
417 if(PIDconfig[5] > 0.) cout << " --> ITS control enabled " << endl;
418 cout << " " << PIDconfig[4] << " < 7 p_t, TPC / TOF Bayesian with p < " << PIDconfig[6] << endl;
419 cout << " ************ Configured DCA setup ************** " << endl;
420 cout << " DCA type: " << DCA;
421 if (DCA == "") cout << "default";
422 cout << endl << " ************* Task statisti:q!cs ****************** " << endl;
423 cout << " -> Launched resonance reconstruction " << endl;
424 if(SP) cout << " --> Launched 30 QaQb SP filters and corresponding 30 SP tasks " << endl;
425 if(EP) cout << " --> Launched 30 QaQb QC filters and corresponding 30 EP tasks " << endl;
426 if(SPSUB) cout << " --> Launched 30+30 Qa&&Qb SP filters and corresponding 30+30 SP tasks " << endl;
427 if(QC) cout << " --> Launched 30 QaQb QC filters and corresponding 30 QC tasks " << endl;
428 if(EP3sub) cout << " --> Launched VZERO subevent analysis alongside reconstruction - USE WITH CAUTION!" << endl;
429 cout << " ************************************************ " << endl;
430 TString condit = "";
431 (task->SetQA(kFALSE)) ? condit+= " --> Enabled QA plots <-- " : condit+= " --> Disabled QA plots <-- ";
432 (task->SetIsMC(kFALSE)) ? condit+= " --> MC mode <-- " : condit+= " --> DATA mode <-- ";
433 (task->UseEventMixing(event_mixing)) ? condit+= " --> Using EVENT MIXING <--" : condit+= "--> Combinatorial background <--";
434 cout << condit << endl;
435 cout << " --> Now go for a coffee! <-- " << endl;
436 cout << " ************************************************ " << endl;
437 return task;
438}
439namespace TwoParticleResonanceFlow {
440//_____________________________________________________________________________
441 void AddSPmethod(char *name, double minEtaA, double maxEtaA, double minEtaB, double maxEtaB, char *Qvector, int harmonic, AliAnalysisDataContainer *flowEvent, AliFlowTrackSimpleCuts *cutsPOI = NULL, AliFlowTrackSimpleCuts *cutsRFP = NULL, bool bEP, bool shrink = false, bool debug, bool etagap = false, char *suffixName, Bool_t VZERO_SP = kFALSE)
442 {
443 // add sp task and invm filter tasks
444 if(debug) (bEP) ? cout << " ****** Reveived request for EP task ****** " << endl : cout << " ******* Switching to SP task ******* " << endl;
445 TString fileName = AliAnalysisManager::GetCommonFileName();
446 (bEP) ? fileName+=":EP" : fileName+=":SP";
447 fileName+=suffixName;
448 if(etagap) {
449 fileName+="_SUBEVENTS";
450 if(debug) cout << " --> Setting up subevent analysis <-- " << endl;
451 }
452 if(debug) cout << " --> fileName " << fileName << endl;
453 TString myNameSP;
454 (bEP) ? myNameSP = Form("%sSPasEPv%d%s", name, harmonic, Qvector): myNameSP = Form("%sSPv%d%s", name, harmonic, Qvector);
455 if(debug) cout << " Task and filter name: " << myNameSP << endl;
456 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
457 AliAnalysisDataContainer *flowEvent2 = mgr->CreateContainer(Form("Filter_%s", myNameSP.Data()), AliFlowEventSimple::Class(), AliAnalysisManager::kExchangeContainer);
458 AliAnalysisTaskFilterFE *tskFilter = new AliAnalysisTaskFilterFE(Form("TaskFilter_%s", myNameSP.Data()), cutsRFP, cutsPOI);
459 tskFilter->SetSubeventEtaRange(minEtaA, maxEtaA, minEtaB, maxEtaB);
460 if(VZERO_SP) tskFilter->SetSubeventEtaRange(-10, 0, 0, 10);
461 mgr->AddTask(tskFilter);
462 mgr->ConnectInput(tskFilter, 0, flowEvent);
463 mgr->ConnectOutput(tskFilter, 1, flowEvent2);
464 AliAnalysisDataContainer *outSP = mgr->CreateContainer(myNameSP.Data(), TList::Class(), AliAnalysisManager::kOutputContainer, fileName);
465 AliAnalysisTaskScalarProduct *tskSP = new AliAnalysisTaskScalarProduct(Form("TaskScalarProduct_%s", myNameSP.Data()), kFALSE);
466 tskSP->SetApplyCorrectionForNUA(kTRUE);
467 tskSP->SetHarmonic(harmonic);
468 tskSP->SetTotalQvector(Qvector);
469 if (bEP) tskSP->SetBehaveAsEP();
470 if (shrink) tskSP->SetBookOnlyBasicCCH(kTRUE);
471 mgr->AddTask(tskSP);
472 mgr->ConnectInput(tskSP, 0, flowEvent2);
473 mgr->ConnectOutput(tskSP, 1, outSP);
474 }
475//_____________________________________________________________________________
476 void AddQCmethod(char *name, int harmonic, AliAnalysisDataContainer *flowEvent, AliFlowTrackSimpleCuts *cutsPOI = NULL, Bool_t debug, AliFlowTrackSimpleCuts *cutsRFP = NULL, char *suffixName)
477 {
478 // add qc task and invm filter tasks
479 if(debug) cout << " ****** Received request for QC v" << harmonic << " task " << name << ", POI " << cutsPOI << ", IO ****** " << flowEvent << endl;
480 TString fileName = AliAnalysisManager::GetCommonFileName();
481 fileName+=":QC";
482 fileName+=suffixName;
483 if(debug) cout << " --> Common filename: " << fileName << endl;
484 TString myName = Form("%s", name);
485 if(debug) cout << " --> myName: " << myName << endl;
486 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
487 AliAnalysisDataContainer *flowEvent2 = mgr->CreateContainer(Form("Filter_%s", myName.Data()), AliFlowEventSimple::Class(),AliAnalysisManager::kExchangeContainer);
488 AliAnalysisTaskFilterFE *tskFilter = new AliAnalysisTaskFilterFE(Form("TaskFilter_%s", myName.Data()), cutsRFP, cutsPOI);
489 mgr->AddTask(tskFilter);
490 mgr->ConnectInput(tskFilter, 0, flowEvent);
491 mgr->ConnectOutput(tskFilter, 1, flowEvent2);
492 AliAnalysisDataContainer *outQC = mgr->CreateContainer(myName.Data(), TList::Class(), AliAnalysisManager::kOutputContainer, fileName);
493 AliAnalysisTaskQCumulants *tskQC = new AliAnalysisTaskQCumulants(Form("TaskQCumulants_%s", myName.Data()), kFALSE);
494 tskQC->SetApplyCorrectionForNUA(kTRUE);
495 tskQC->SetHarmonic(harmonic);
496 tskQC->SetBookOnlyBasicCCH(kTRUE);
497 mgr->AddTask(tskQC);
498 mgr->ConnectInput(tskQC, 0, flowEvent2);
499 mgr->ConnectOutput(tskQC, 1, outQC);
500 }
501//_____________________________________________________________________________
502 TString OutputName( Float_t centrMin,
503 Float_t centrMax,
504 Float_t PIDconfig[7],
505 TString suffixName,
506 Bool_t bCentralTrigger,
507 Float_t EtaGap,
508 Float_t POIEtaMin,
509 Float_t POIEtaMax,
510 Float_t deltaDip,
511 Float_t deltaDipMaxPt,
512 TString DCA,
513 Int_t harm,
514 Float_t vertexZ,
515 Bool_t debug)
516 {
517 // generate output name
518 TString centralityName = "";
519 centralityName += suffixName;
520 centralityName += "_DCA";
521 centralityName += DCA;
522 centralityName += Form("_vZ%.f", vertexZ);
523 centralityName += "_";
524 for(Int_t i = 0; i < 7; i++) centralityName += Form("%.1f_", PIDconfig[i]);
525 centralityName += "_POIEta";
526 centralityName += Form("%.1f", POIEtaMin);
527 centralityName += Form("%.1f", POIEtaMax);
528 centralityName += "_gap";
529 centralityName += Form("%.1f", -0.5*EtaGap);
530 centralityName += Form("%.1f", 0.5*EtaGap);
531 centralityName += "_";
532 centralityName += Form("dDip%.2f", deltaDip);
533 centralityName += "-";
534 centralityName += Form("dDipPt%.2f", deltaDipMaxPt);
535 if (bCentralTrigger) {
536 centralityName += "-";
537 centralityName += "kMBkCkSC";
538 }
539 if(debug) cout << " --> centralityName " << centralityName << endl;
540 return centralityName;
541 }
542//_____________________________________________________________________________
543} // end of namespace TwoParticleResonanceFlow