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