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