]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGCF/FLOW/macros/AddTaskPIDFlow.C
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / PWGCF / FLOW / macros / AddTaskPIDFlow.C
1 class AliAnalysisDataContainer;
2 class AliFlowTrackCuts;
3 class AliFlowEventCuts;
4
5
6 void AddTaskPIDFlow(Int_t triggerSelectionString=AliVEvent::kMB,
7                                    Float_t etamin=-0.8,
8                                    Float_t etamax=0.8,
9                                    Float_t EtaGap=0.2,
10                                    TString fileNameBase="output",
11                                    TString uniqueStr="",
12                                    Int_t AODfilterBitRP = 272,
13                                    Int_t AODfilterBitPOI = 272,
14                                    Int_t charge=0,
15                                    Int_t MinTPCdedx = 10,
16                                    Int_t ncentrality = 6,
17                                    Bool_t doQA=kTRUE,
18                                    Bool_t isPID = kTRUE,
19                                    Bool_t is2011 = kFALSE,
20                                    AliPID::EParticleType particleType=AliPID::kPion,
21                                    AliFlowTrackCuts::PIDsource sourcePID=AliFlowTrackCuts::kTOFbayesian) {
22     
23 // Define a range of the detector to exclude
24 Bool_t ExcludeRegion = kFALSE;
25 Double_t excludeEtaMin = -0.;
26 Double_t excludeEtaMax = 0.;
27 Double_t excludePhiMin = 0.;
28 Double_t excludePhiMax = 0.;
29    
30 // RUN SETTINGS
31 // Flow analysis method can be:(set to kTRUE or kFALSE)
32 Bool_t SPSUB    = kTRUE;
33 Bool_t SP       = kTRUE;  // scalar product method (similar to eventplane method)
34 Bool_t QC       = kTRUE;  // cumulants using Q vectors
35     
36 int centrMin[9] = {0,5,10,20,30,40,50,60,70};
37 int centrMax[9] = {5,10,20,30,40,50,60,70,80};
38 const int ncentr = ncentrality;
39     
40     
41 //---------Data selection----------
42 //kMC, kGlobal, kESD_TPConly, kESD_SPDtracklet
43 AliFlowTrackCuts::trackParameterType rptype = AliFlowTrackCuts::kTPCstandalone;
44 AliFlowTrackCuts::trackParameterType poitype = AliFlowTrackCuts::kTPCstandalone;
45     
46 //---------Parameter mixing--------
47 //kPure - no mixing, kTrackWithMCkine, kTrackWithMCPID, kTrackWithMCpt
48 AliFlowTrackCuts::trackParameterMix rpmix = AliFlowTrackCuts::kPure;
49 AliFlowTrackCuts::trackParameterMix poimix = AliFlowTrackCuts::kPure;
50     
51 const char* rptypestr = AliFlowTrackCuts::GetParamTypeName(rptype);
52 const char* poitypestr = AliFlowTrackCuts::GetParamTypeName(poitype);
53
54     
55 //===========================================================================
56 // EVENTS CUTS:
57 AliFlowEventCuts* cutsEvent[ncentr];
58 AliFlowTrackCuts* cutsRP[ncentr];
59 AliFlowTrackCuts* cutsPOI[ncentr];
60 TString outputSlotName[ncentr][4];
61 TString suffixName[ncentr];
62     
63 for(int icentr=0;icentr<ncentr;icentr++){
64     cutsEvent[icentr] = DefinecutsEvent();
65     //cutsEvent[icentr]->SetUsedDataset(is2011);
66     cutsEvent[icentr]->SetCentralityPercentileRange(centrMin[icentr],centrMax[icentr]);
67     cutsEvent[icentr]->SetCentralityPercentileMethod(AliFlowEventCuts::kV0);
68     //  cutsEvent->SetRefMultMethod(AliFlowEventCuts::kVZERO);
69     //cutsEvent->SetCentralityPercentileMethod(AliFlowEventCuts::kSPD1tracklets);
70     //cutsEvent->SetNContributorsRange(2);
71     cutsEvent[icentr]->SetPrimaryVertexZrange(-10.,10.);
72     cutsEvent[icentr]->SetQA(doQA);
73     cutsEvent[icentr]->SetCutTPCmultiplicityOutliers();
74     
75     
76     // RP TRACK CUTS:
77     //  AliFlowTrackCuts* cutsRP2 = AliFlowTrackCuts::GetStandardVZEROOnlyTrackCuts();
78     cutsRP[icentr] = DefineRPcuts();
79     cutsRP[icentr]->SetParamType(rptype);
80     cutsRP[icentr]->SetParamMix(rpmix);
81     cutsRP[icentr]->SetPtRange(0.2,5.);
82     cutsRP[icentr]->SetEtaRange(etamin,etamax);
83     cutsRP[icentr]->SetMinNClustersTPC(70);
84     //  cutsRP->SetMinChi2PerClusterTPC(0.1);//
85     // cutsRP->SetMaxChi2PerClusterTPC(4.0);//
86     cutsRP[icentr]->SetMaxDCAToVertexXY(3.0);
87     cutsRP[icentr]->SetMaxDCAToVertexZ(3.0);
88     cutsRP[icentr]->SetAcceptKinkDaughters(kFALSE);
89     cutsRP[icentr]->SetMinimalTPCdedx(MinTPCdedx);
90     cutsRP[icentr]->SetAODfilterBit(AODfilterBitRP);
91     cutsRP[icentr]->SetQA(doQA);
92     
93     // POI TRACK CUTS:
94     cutsPOI[icentr] = DefinePOIcuts();
95     cutsPOI[icentr]->GetBayesianResponse()->ForceOldDedx(); // for 2010 data to use old TPC PID Response instead of the official one
96     cutsPOI[icentr]->SetParamType(poitype);
97     cutsPOI[icentr]->SetParamMix(poimix);
98     cutsPOI[icentr]->SetPtRange(0.2,5.);//
99     cutsPOI[icentr]->SetEtaRange(etamin,etamax);
100     //cutsPOI->SetRequireCharge(kTRUE);
101     //cutsPOI->SetPID(PdgRP);
102     cutsPOI[icentr]->SetMinNClustersTPC(70);
103     // cutsPOI->SetMinChi2PerClusterTPC(0.1); //
104     // cutsPOI->SetMaxChi2PerClusterTPC(4.0); //
105     //  cutsPOI->SetRequireITSRefit(kTRUE);
106     //  cutsPOI->SetRequireTPCRefit(kTRUE);
107     //  cutsPOI->SetMinNClustersITS(2);
108     //cutsPOI->SetMaxChi2PerClusterITS(1.e+09);
109     cutsPOI[icentr]->SetMaxDCAToVertexXY(3.0);
110     cutsPOI[icentr]->SetMaxDCAToVertexZ(3.0);
111     //cutsPOI->SetDCAToVertex2D(kTRUE);
112     //cutsPOI->SetMaxNsigmaToVertex(1.e+10);
113     //cutsPOI->SetRequireSigmaToVertex(kFALSE);
114     cutsPOI[icentr]->SetAcceptKinkDaughters(kFALSE);
115     if(isPID) cutsPOI[icentr]->SetPID(particleType, sourcePID);//particleType, sourcePID
116     if (charge!=0) cutsPOI[icentr]->SetCharge(charge);
117     //cutsPOI->SetAllowTOFmismatch(kFALSE);
118     cutsPOI[icentr]->SetRequireStrictTOFTPCagreement(kTRUE);
119     //iexample: francesco's tunig TPC Bethe Bloch for data:
120      cutsPOI[icentr]->SetMinimalTPCdedx(MinTPCdedx);
121     cutsPOI[icentr]->SetAODfilterBit(AODfilterBitPOI);
122     // cutsPOI->SetAODfilterBit(768);
123     cutsPOI[icentr]->SetQA(doQA);
124     cutsPOI[icentr]->SetPriors((centrMin[icentr]+centrMax[icentr])*0.5); // set priors and PID as a function of the centrality
125
126     //=====================================================================
127  
128     suffixName[icentr] = "highharmflow";
129     suffixName[icentr] += Form("%i", centrMin[icentr]);
130     suffixName[icentr] += Form("%i", centrMax[icentr]);
131     
132     for(int harmonic=2;harmonic<6;harmonic++){  //for v2,v3,v4 and v5
133         outputSlotName[icentr][harmonic-2] = "";
134         outputSlotName[icentr][harmonic-2]+=uniqueStr;
135         outputSlotName[icentr][harmonic-2]+=Form("v%i",harmonic);
136         outputSlotName[icentr][harmonic-2]+=cutsRP[icentr]->GetName();
137         outputSlotName[icentr][harmonic-2]+="_";
138         outputSlotName[icentr][harmonic-2]+=cutsPOI[icentr]->GetName();
139         outputSlotName[icentr][harmonic-2]+=Form("_%i-",centrMin[icentr]);
140         outputSlotName[icentr][harmonic-2]+=Form("%i_",centrMax[icentr]);
141         
142         
143         if(isPID){
144             outputSlotName[icentr][harmonic-2]+=AliFlowTrackCuts::PIDsourceName(sourcePID);//sourcePID
145             outputSlotName[icentr][harmonic-2]+="_";
146             outputSlotName[icentr][harmonic-2]+=AliPID::ParticleName(particleType);//particleType
147         }
148         else{
149             outputSlotName[icentr][harmonic-2]+="AllCharged";
150         }
151         if (charge<0) outputSlotName[icentr][harmonic-2]+="-";
152         if (charge>0) outputSlotName[icentr][harmonic-2]+="+";
153             }
154 }
155     
156 TString fileName(fileNameBase);
157 fileName.Append(".root");
158
159  
160     
161 //====================================FLOWPACKAGE TASKS=========================//
162 AliAnalysisDataContainer *cinput1[ncentr];
163 AliAnalysisDataContainer *coutputFE[ncentr];
164 AliAnalysisDataContainer* coutputFEQA[ncentr];
165 AliAnalysisTaskFlowEvent *taskFE[ncentr];
166     
167 AliFlowTrackCuts *QC_POI[ncentr], *SP_POI[ncentr][2], *SP_POI_gap[ncentr][2]; // POIs
168     
169 TString outputQA[ncentr];
170
171 for (int icentr=0; icentr<ncentr; icentr++) {
172         
173     // Get the pointer to the existing analysis manager via the static access method.
174         //==============================================================================
175     AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
176     if (!mgr) {
177         Error("AddTaskFlowEvent", "No analysis manager to connect to.");
178         return NULL;
179     }
180         
181     // Check the analysis type using the event handlers connected to the analysis
182     // manager. The availability of MC handler can also be checked here.
183     //==============================================================================
184     if (!mgr->GetInputEventHandler()) {
185         ::Error("AddTaskFlowEvent", "This task requires an input event handler");
186         return NULL;
187     }
188
189     taskFE[icentr] = new AliAnalysisTaskFlowEvent(Form("TaskFlowEvent_%s",suffixName[icentr].Data()),"",doQA);
190     taskFE[icentr]->SelectCollisionCandidates(triggerSelectionString);
191     taskFE[icentr]->SetSubeventEtaRange(etamin, -0.5*EtaGap, 0.5*EtaGap, etamax);
192     mgr->AddTask(taskFE[icentr]);
193
194     // Pass cuts for RPs and POIs to the task:
195     taskFE[icentr]->SetCutsEvent(cutsEvent[icentr]);
196     taskFE[icentr]->SetCutsRP(cutsRP[icentr]);
197     taskFE[icentr]->SetCutsPOI(cutsPOI[icentr]);
198     if (cutsRP[icentr]->GetParamType()==AliFlowTrackCuts::kVZERO)
199     {
200         //TODO: since this is set in a static object all analyses in an analysis train
201         //will be affected.
202         taskFE[icentr]->SetHistWeightvsPhiMin(0.);
203         taskFE[icentr]->SetHistWeightvsPhiMax(200.);
204     }
205     cinput1[icentr] = mgr->GetCommonInputContainer();
206     
207     coutputFE[icentr] = mgr->CreateContainer(Form("FlowEventSimple_%s_%d",suffixName[icentr].Data(),icentr),AliFlowEventSimple::Class(),AliAnalysisManager::kExchangeContainer);
208     mgr->ConnectInput(taskFE[icentr],0,cinput1[icentr]);
209     mgr->ConnectOutput(taskFE[icentr],1,coutputFE[icentr]);
210
211     if (taskFE[icentr]->GetQAOn()) {
212         outputQA[icentr] = fileName;
213         outputQA[icentr] += ":QA";
214         coutputFEQA[icentr] = mgr->CreateContainer(Form("QA_%s",suffixName[icentr].Data()), TList::Class(),AliAnalysisManager::kOutputContainer,outputQA[icentr]);
215         mgr->ConnectOutput(taskFE[icentr],2,coutputFEQA[icentr]);
216     }
217
218
219     //POIs for SP and QC method
220     //===========================================================================
221  
222     //half window for POIs
223     
224     QC_POI[icentr] = new AliFlowTrackCuts(Form("Filter_%d",icentr));
225     QC_POI[icentr]->SetEtaRange( -0.8,+0.8 );
226     QC_POI[icentr]->GetBayesianResponse()->ForceOldDedx(); // for 2010 data to use old TPC PID Response instead of the official one
227     QC_POI[icentr]->SetParamType(poitype);
228 //    QC_POI[icentr]->SetParamMix(poimix);
229     QC_POI[icentr]->SetPtRange(0.2,5.);//
230     QC_POI[icentr]->SetMinNClustersTPC(70);
231     // SP_POI->SetMinChi2PerClusterTPC(0.1); //
232     // SP_POI->SetMaxChi2PerClusterTPC(4.0); //
233     //  SP_POI->SetRequireITSRefit(kTRUE);
234     //  SP_POI->SetRequireTPCRefit(kTRUE);
235     //  SP_POI->SetMinNClustersITS(2);
236     //  SP_POI->SetMaxChi2PerClusterITS(1.e+09);
237     QC_POI[icentr]->SetMaxDCAToVertexXY(3.0);
238     QC_POI[icentr]->SetMaxDCAToVertexZ(3.0);
239     //SP_POI->SetDCAToVertex2D(kTRUE);
240     //SP_POI->SetMaxNsigmaToVertex(1.e+10);
241     //SP_POI->SetRequireSigmaToVertex(kFALSE);
242     QC_POI[icentr]->SetAcceptKinkDaughters(kFALSE);
243     if(isPID) QC_POI[icentr]->SetPID(particleType, sourcePID);//particleType, sourcePID
244     if (charge!=0) QC_POI[icentr]->SetCharge(charge);
245     //SP_POI->SetAllowTOFmismatch(kFALSE);
246     QC_POI[icentr]->SetRequireStrictTOFTPCagreement(kTRUE);
247     QC_POI[icentr]->SetMinimalTPCdedx(MinTPCdedx);
248     QC_POI[icentr]->SetAODfilterBit(AODfilterBitPOI);
249     QC_POI[icentr]->SetQA(doQA);
250     QC_POI[icentr]->SetPriors((centrMin[icentr]+centrMax[icentr])*0.5);
251
252     if(SP){
253         SP_POI[icentr][0] = new AliFlowTrackCuts(Form("Filterhf0_%d",icentr));
254         SP_POI[icentr][1] = new AliFlowTrackCuts(Form("Filterhf1_%d",icentr));
255         for(int hw=0;hw<2;hw++){
256             SP_POI[icentr][hw]->GetBayesianResponse()->ForceOldDedx(); // for 2010 data to use old TPC PID Response instead of the official one
257             SP_POI[icentr][hw]->SetParamType(poitype);
258             //      SP_POI[icentr][hw]->SetParamMix(poimix);
259             SP_POI[icentr][hw]->SetPtRange(0.2,5.);//
260             SP_POI[icentr][hw]->SetMinNClustersTPC(70);
261             // SP_POI->SetMinChi2PerClusterTPC(0.1); //
262             // SP_POI->SetMaxChi2PerClusterTPC(4.0); //
263             //  SP_POI->SetRequireITSRefit(kTRUE);
264             //  SP_POI->SetRequireTPCRefit(kTRUE);
265             //  SP_POI->SetMinNClustersITS(2);
266             //  SP_POI->SetMaxChi2PerClusterITS(1.e+09);
267             SP_POI[icentr][hw]->SetMaxDCAToVertexXY(3.0);
268             SP_POI[icentr][hw]->SetMaxDCAToVertexZ(3.0);
269             //SP_POI->SetDCAToVertex2D(kTRUE);
270             //SP_POI->SetMaxNsigmaToVertex(1.e+10);
271             //SP_POI->SetRequireSigmaToVertex(kFALSE);
272             SP_POI[icentr][hw]->SetAcceptKinkDaughters(kFALSE);
273             if(isPID) SP_POI[icentr][hw]->SetPID(particleType, sourcePID);//particleType, sourcePID
274             if (charge!=0) SP_POI[icentr][hw]->SetCharge(charge);
275             //SP_POI->SetAllowTOFmismatch(kFALSE);
276             SP_POI[icentr][hw]->SetRequireStrictTOFTPCagreement(kTRUE);
277             SP_POI[icentr][hw]->SetMinimalTPCdedx(MinTPCdedx);
278             SP_POI[icentr][hw]->SetAODfilterBit(AODfilterBitPOI);
279             SP_POI[icentr][hw]->SetQA(doQA);
280             SP_POI[icentr][hw]->SetPriors((centrMin[icentr]+centrMax[icentr])*0.5);
281         }
282     }
283     if(SPSUB){
284         SP_POI_gap[icentr][0] = new AliFlowTrackCuts(Form("Filterhf0_%d",icentr));
285         SP_POI_gap[icentr][1] = new AliFlowTrackCuts(Form("Filterhf1_%d",icentr));
286         for(int hw=0;hw<2;hw++){
287             SP_POI_gap[icentr][hw]->GetBayesianResponse()->ForceOldDedx(); // for 2010 data to use old TPC PID Response instead of the official one
288             SP_POI_gap[icentr][hw]->SetParamType(poitype);
289             //      SP_POI[icentr][hw]->SetParamMix(poimix);
290             SP_POI_gap[icentr][hw]->SetPtRange(0.2,5.);//
291             SP_POI_gap[icentr][hw]->SetMinNClustersTPC(70);
292             // SP_POI_gap->SetMinChi2PerClusterTPC(0.1); //
293             // SP_POI_gap->SetMaxChi2PerClusterTPC(4.0); //
294             //  SP_POI_gap->SetRequireITSRefit(kTRUE);
295             //  SP_POI_gap->SetRequireTPCRefit(kTRUE);
296             //  SP_POI_gap->SetMinNClustersITS(2);
297             //  SP_POI_gap->SetMaxChi2PerClusterITS(1.e+09);
298             SP_POI_gap[icentr][hw]->SetMaxDCAToVertexXY(3.0);
299             SP_POI_gap[icentr][hw]->SetMaxDCAToVertexZ(3.0);
300             //SP_POI_gap->SetDCAToVertex2D(kTRUE);
301             //SP_POI_gap->SetMaxNsigmaToVertex(1.e+10);
302             //SP_POI_gap->SetRequireSigmaToVertex(kFALSE);
303             SP_POI_gap[icentr][hw]->SetAcceptKinkDaughters(kFALSE);
304             if(isPID) SP_POI_gap[icentr][hw]->SetPID(particleType, sourcePID);//particleType, sourcePID
305             if (charge!=0) SP_POI_gap[icentr][hw]->SetCharge(charge);
306             //SP_POI_gap->SetAllowTOFmismatch(kFALSE);
307             SP_POI_gap[icentr][hw]->SetRequireStrictTOFTPCagreement(kTRUE);
308             SP_POI_gap[icentr][hw]->SetMinimalTPCdedx(MinTPCdedx);
309             SP_POI_gap[icentr][hw]->SetAODfilterBit(AODfilterBitPOI);
310             SP_POI_gap[icentr][hw]->SetQA(doQA);
311             SP_POI_gap[icentr][hw]->SetPriors((centrMin[icentr]+centrMax[icentr])*0.5);
312         }
313     }
314
315     
316
317     for(int i=0;i<4;i++){
318         int harm = i+2;
319         if(QC) {
320             AddQCmethod( "QC", fileName, rptypestr, outputSlotName[icentr][i], triggerSelectionString, coutputFE[icentr], NULL, QC_POI[icentr], harm, icentr); // QC TPC
321         }
322         if(SP) {
323
324             AddSPmethod( "SP", fileName, rptypestr, outputSlotName[icentr][i], triggerSelectionString, coutputFE[icentr], NULL, SP_POI[icentr][0], "Qa", harm, icentr, etamin, etamax,0); // SP Qa
325             AddSPmethod( "SP", fileName, rptypestr, outputSlotName[icentr][i], triggerSelectionString, coutputFE[icentr], NULL, SP_POI[icentr][1], "Qb", harm, icentr, etamin, etamax,0); // SP Qb
326         }
327         if(SPSUB && EtaGap!=0){
328             AddSPmethod( "SP", fileName, rptypestr, outputSlotName[icentr][i], triggerSelectionString, coutputFE[icentr], NULL, SP_POI_gap[icentr][0], "Qa", harm, icentr, etamin, etamax, EtaGap); // SP Qa
329             AddSPmethod( "SP", fileName, rptypestr, outputSlotName[icentr][i], triggerSelectionString, coutputFE[icentr], NULL, SP_POI_gap[icentr][1], "Qb", harm, icentr, etamin, etamax, EtaGap); // SP Qb
330         }
331     }
332
333
334 }
335 }
336 //AddSPmthod
337 //AddQCmethod
338 //===========================================================================
339 //QC method
340 void AddQCmethod(char *name="",TString fileName="", TString rptypestr="", TString outputSlotName="", Int_t triggerSelectionString=0,AliAnalysisDataContainer* coutputFE,AliFlowTrackCuts* cutsRP, AliFlowTrackCuts* cutsPOI,Int_t harm=2, Int_t icentr=0) {
341     
342     AliAnalysisDataContainer *coutputQC;
343     AliAnalysisTaskQCumulants *taskQC;
344     
345     int centrMin[9] = {0,5,10,20,30,40,50,60,70};
346     int centrMax[9] = {5,10,20,30,40,50,60,70,80};
347     TString folder = "FlowPID_QC_";
348     TString myFolder = Form("%sv%d_%d%d",folder.Data(),harm,centrMin[icentr],centrMax[icentr]);
349     TString myNameQC = Form("%sv%d%s",name,harm,outputSlotName.Data());
350     AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
351     AliAnalysisDataContainer *flowEvent = mgr->CreateContainer( Form("TPConly_%s",myFolder.Data()),
352                                                                AliFlowEventSimple::Class(),
353                                                                AliAnalysisManager::kExchangeContainer );
354     
355     AliAnalysisDataContainer *flowEvent2 = mgr->CreateContainer( Form("Filter_%s", myNameQC.Data()),
356                                                                 AliFlowEventSimple::Class(),
357                                                                 AliAnalysisManager::kExchangeContainer );
358     AliAnalysisTaskFilterFE *tskFilter = new AliAnalysisTaskFilterFE( Form("TaskFilter_%s",myNameQC.Data()),cutsRP, cutsPOI);
359     mgr->AddTask(tskFilter);
360     mgr->ConnectInput( tskFilter,0,coutputFE);
361     mgr->ConnectOutput(tskFilter,1,flowEvent2);
362     
363     taskQC = new AliAnalysisTaskQCumulants(Form("TaskQCumulants_%s",outputSlotName.Data()));
364     taskQC->SelectCollisionCandidates(triggerSelectionString);
365     taskQC->SetCalculateCumulantsVsM(kFALSE);
366     taskQC->SetnBinsMult(10000);
367     taskQC->SetMinMult(0.);
368     taskQC->SetMaxMult(10000.);
369     taskQC->SetHarmonic(harm);
370     taskQC->SetApplyCorrectionForNUA(kFALSE);
371     taskQC->SetFillMultipleControlHistograms(kFALSE);
372     
373     AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
374
375     TString outputQC = fileName;
376     outputQC += ":outputQCanalysis";
377     outputQC+= rptypestr;
378     
379     coutputQC = mgr->CreateContainer(Form("QC_%s",outputSlotName.Data()),
380                                         TList::Class(),AliAnalysisManager::kOutputContainer,outputQC);
381     mgr->AddTask(taskQC);
382     mgr->ConnectInput(taskQC,0,flowEvent2);
383     mgr->ConnectOutput(taskQC,1,coutputQC);
384 }
385 //SPmethod
386
387 void AddSPmethod(char *name="", TString fileName="", TString rptypestr="", TString outputSlotName="", Int_t triggerSelectionString=0,AliAnalysisDataContainer* coutputFE, AliFlowTrackCuts* cutsRP,AliFlowTrackCuts* cutsPOI, char* Qvector, Int_t harm=2, Int_t icentr=0, Double_t etamin=-0.8, Double_t etamax=0.8, Double_t gap=0.0) {
388  
389     AliAnalysisDataContainer *coutputSP;
390     AliAnalysisTaskScalarProduct *taskSP;
391
392     int centrMin[9] = {0,5,10,20,30,40,50,60,70};
393     int centrMax[9] = {5,10,20,30,40,50,60,70,80};
394     
395     if(Qvector=="Qa"){
396         cutsPOI->SetEtaRange( +0.5*gap, +0.8 );
397     }
398     if(Qvector=="Qb"){
399         cutsPOI->SetEtaRange( -0.8,-0.5*gap );
400     }
401     
402     TString folder = "FlowPID_SP_";
403     TString myFolder = Form("%sv%i_%s_%i-%i_%.f",folder.Data(),harm,Qvector,centrMin[icentr],centrMax[icentr],gap*10);
404     TString myNameSP = Form("%s_v%d_%s_%s_%.f",name,harm,Qvector,outputSlotName.Data(),gap*10);
405     AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
406     
407     AliAnalysisDataContainer *flowEvent = mgr->CreateContainer( Form("TPConly_%s",myFolder.Data()),
408                                                              AliFlowEventSimple::Class(),
409                                                              AliAnalysisManager::kExchangeContainer );
410     
411     AliAnalysisDataContainer *flowEvent2 = mgr->CreateContainer( Form("Filter_%s", myNameSP.Data()),
412                                                                 AliFlowEventSimple::Class(),
413                                                                 AliAnalysisManager::kExchangeContainer );
414     
415     AliAnalysisTaskFilterFE *tskFilter = new AliAnalysisTaskFilterFE( Form("TaskFilter_%s",myNameSP.Data()),
416                                                                      cutsRP, cutsPOI);
417     tskFilter->SetSubeventEtaRange(etamin, -.5*gap, +.5*gap, etamax);
418     mgr->AddTask(tskFilter);
419     mgr->ConnectInput( tskFilter,0,coutputFE);
420     mgr->ConnectOutput(tskFilter,1,flowEvent2);
421
422     
423     taskSP = new AliAnalysisTaskScalarProduct(Form("TaskScalarProduct_%s",outputSlotName.Data()),kFALSE);
424     taskSP->SetHarmonic(harm);
425     taskSP->SelectCollisionCandidates(triggerSelectionString);
426     taskSP->SetRelDiffMsub(1.0);
427     taskSP->SetTotalQvector(Qvector);
428     taskSP->SetApplyCorrectionForNUA(kTRUE);
429     
430     AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
431
432
433     TString outputSP = fileName;
434     outputSP += ":outputSPanalysis";
435     outputSP+= rptypestr;
436     coutputSP = mgr->CreateContainer(Form("SP_%s_%s_%.f",outputSlotName.Data(),Qvector,gap*10),
437                                         TList::Class(),AliAnalysisManager::kOutputContainer,outputSP);
438     mgr->AddTask(taskSP);
439     mgr->ConnectInput(taskSP,0,flowEvent2);
440     mgr->ConnectOutput(taskSP,1,coutputSP);
441 }
442 AliFlowEventCuts* DefinecutsEvent(){
443     AliFlowEventCuts* cutsEvent = new AliFlowEventCuts("eventcuts");
444     return cutsEvent;
445 }
446 AliFlowTrackCuts* DefineRPcuts(){
447     AliFlowTrackCuts* cutsRP = new AliFlowTrackCuts("TPConlyRP");
448     return cutsRP;
449 }
450 AliFlowTrackCuts* DefinePOIcuts(){
451     AliFlowTrackCuts* cutsPOI = new AliFlowTrackCuts("TPConlyPOI");
452     return cutsPOI;
453 }
454
455