]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGCF/FLOW/macros/AddTaskPIDFlowQC.C
Removing printout (Davide)
[u/mrichter/AliRoot.git] / PWGCF / FLOW / macros / AddTaskPIDFlowQC.C
1 //AddTask macro for higher harmonic flow analysis with QC method only.
2
3 class AliAnalysisDataContainer;
4 class AliFlowTrackCuts;
5 class AliFlowEventCuts;
6
7
8 void AddTaskPIDFlowQC(Int_t triggerSelectionString=AliVEvent::kMB,
9                                    Float_t etamin=-0.8,
10                                    Float_t etamax=0.8,
11                                    TString fileNameBase="AnalysisResults",
12                                    TString uniqueStr="Pion_02",
13                                    Int_t AODfilterBitRP = 272,
14                                    Int_t AODfilterBitPOI = 272,
15                                    Int_t charge=0,
16                                    Int_t MinTPCdedx = 10,
17                                    Int_t ncentrality = 6,
18                                    Bool_t doQA=kTRUE,
19                                    Bool_t isPID = kTRUE,
20                                    Bool_t is2011 = kFALSE,
21                                    AliPID::EParticleType particleType=AliPID::kPion,
22                                    AliFlowTrackCuts::PIDsource sourcePID=AliFlowTrackCuts::kTOFbayesian) {
23
24 // Define a range of the detector to exclude
25 Bool_t ExcludeRegion = kFALSE;
26 Double_t excludeEtaMin = -0.;
27 Double_t excludeEtaMax = 0.;
28 Double_t excludePhiMin = 0.;
29 Double_t excludePhiMax = 0.;
30     
31 int centrMin[9] = {0,5,10,20,30,40,50,60,70};
32 int centrMax[9] = {5,10,20,30,40,50,60,70,80};
33 const int ncentr = ncentrality;
34     
35     
36 //---------Data selection----------
37 //kMC, kGlobal, kESD_TPConly, kESD_SPDtracklet
38 AliFlowTrackCuts::trackParameterType rptype = AliFlowTrackCuts::kTPCstandalone;
39 AliFlowTrackCuts::trackParameterType poitype = AliFlowTrackCuts::kTPCstandalone;
40     
41 //---------Parameter mixing--------
42 //kPure - no mixing, kTrackWithMCkine, kTrackWithMCPID, kTrackWithMCpt
43 AliFlowTrackCuts::trackParameterMix rpmix = AliFlowTrackCuts::kPure;
44 AliFlowTrackCuts::trackParameterMix poimix = AliFlowTrackCuts::kPure;
45     
46 const char* rptypestr = AliFlowTrackCuts::GetParamTypeName(rptype);
47 const char* poitypestr = AliFlowTrackCuts::GetParamTypeName(poitype);
48
49
50 //===========================================================================
51 // EVENTS CUTS:
52 AliFlowEventCuts* cutsEvent[ncentr];
53 AliFlowTrackCuts* cutsRP[ncentr];
54 AliFlowTrackCuts* cutsPOI[ncentr];
55 TString outputSlotName[ncentr][4];
56 TString suffixName[ncentr];
57     
58 for(int icentr=0;icentr<ncentr;icentr++){
59     cutsEvent[icentr] = new AliFlowEventCuts(Form("eventcuts_%d",icentr));
60     cutsEvent[icentr]->SetLHC11h(is2011);
61     cutsEvent[icentr]->SetCentralityPercentileRange(centrMin[icentr],centrMax[icentr]);
62     cutsEvent[icentr]->SetCentralityPercentileMethod(AliFlowEventCuts::kV0);
63     //  cutsEvent->SetRefMultMethod(AliFlowEventCuts::kVZERO);
64     //cutsEvent->SetCentralityPercentileMethod(AliFlowEventCuts::kSPD1tracklets);
65     //cutsEvent->SetNContributorsRange(2);
66     cutsEvent[icentr]->SetPrimaryVertexZrange(-10.,10.);
67     cutsEvent[icentr]->SetQA(doQA);
68     cutsEvent[icentr]->SetCutTPCmultiplicityOutliers();
69     
70     
71     // RP TRACK CUTS:
72     cutsRP[icentr] = new AliFlowTrackCuts(Form("TPConlyRP_%d",icentr));
73    // cutsRP[icentr]->SetParamType(rptype);
74    // cutsRP[icentr]->SetParamMix(rpmix);
75     cutsRP[icentr]->SetPtRange(0.2,5.);
76     cutsRP[icentr]->SetEtaRange(etamin,etamax);
77     cutsRP[icentr]->SetMinNClustersTPC(70);
78     //  cutsRP->SetMinChi2PerClusterTPC(0.1);//
79     // cutsRP->SetMaxChi2PerClusterTPC(4.0);//
80     cutsRP[icentr]->SetMaxDCAToVertexXY(3.0);
81     cutsRP[icentr]->SetMaxDCAToVertexZ(3.0);
82     cutsRP[icentr]->SetAcceptKinkDaughters(kFALSE);
83     cutsRP[icentr]->SetMinimalTPCdedx(MinTPCdedx);
84     cutsRP[icentr]->SetAODfilterBit(AODfilterBitRP);
85     cutsRP[icentr]->SetQA(doQA);
86
87     
88     //POIs for QC method
89     //===========================================================================
90     AliFlowTrackCuts  *QC_POI[ncentr];
91     //half window for POIs
92     //=======================QC POI Cuts
93     QC_POI[icentr] = DefinePOIcuts(icentr);
94
95     QC_POI[icentr]->GetBayesianResponse()->ForceOldDedx(); // for 2010 data to use old TPC PID Response instead of the official one
96    // QC_POI[icentr]->SetParamType(poitype);
97    // QC_POI[icentr]->SetParamMix(poimix);
98     QC_POI[icentr]->SetPtRange(0.2,5.);//
99     QC_POI[icentr]->SetMinNClustersTPC(70);
100     QC_POI[icentr]->SetEtaRange( etamin,etamax );
101   
102     // QC_POI[icentr]->SetMinChi2PerClusterTPC(0.1); //
103     // QC_POI[icentr]->SetMaxChi2PerClusterTPC(4.0); //
104     //  QC_POI[icentr]->SetRequireITSRefit(kTRUE);
105     //  QC_POI[icentr]->SetRequireTPCRefit(kTRUE);
106     //  QC_POI[icentr]->SetMinNClustersITS(2);
107     //  QC_POI[icentr]->SetMaxChi2PerClusterITS(1.e+09);
108     QC_POI[icentr]->SetMaxDCAToVertexXY(3.0);
109     QC_POI[icentr]->SetMaxDCAToVertexZ(3.0);
110     //QC_POI[icentr]->SetDCAToVertex2D(kTRUE);
111     //QC_POI[icentr]->SetMaxNsigmaToVertex(1.e+10);
112     //QC_POI[icentr]->SetRequireSigmaToVertex(kFALSE);
113     QC_POI[icentr]->SetAcceptKinkDaughters(kFALSE);
114     if(isPID) QC_POI[icentr]->SetPID(particleType, sourcePID);//particleType, sourcePID
115     if (charge!=0) QC_POI[icentr]->SetCharge(charge);
116     //QC_POI[icentr]->SetAllowTOFmismatch(kFALSE);
117     QC_POI[icentr]->SetRequireStrictTOFTPCagreement(kTRUE);
118     QC_POI[icentr]->SetMinimalTPCdedx(MinTPCdedx);
119     QC_POI[icentr]->SetAODfilterBit(AODfilterBitPOI);
120     QC_POI[icentr]->SetQA(doQA);
121     QC_POI[icentr]->SetPriors((centrMin[icentr]+centrMax[icentr])*0.5);
122
123
124
125
126     //=====================================================================
127  
128     suffixName[icentr] = "highharmflow";
129     suffixName[icentr] += Form("%i_", centrMin[icentr]);
130     suffixName[icentr] += Form("%i_", centrMax[icentr]);
131
132     if(isPID){
133         suffixName[icentr]+=AliFlowTrackCuts::PIDsourceName(sourcePID);
134         suffixName[icentr]+="_";
135         suffixName[icentr]+=AliPID::ParticleName(particleType);//particleType
136     }
137     else{
138         suffixName[icentr]+="AllCharged";
139     }
140     if (charge<0) suffixName[icentr]+="-";
141     if (charge>0) suffixName[icentr]+="+";
142
143
144     for(int harmonic=2;harmonic<6;harmonic++){  //for v2,v3,v4 and v5
145         outputSlotName[icentr][harmonic-2] = "";
146         outputSlotName[icentr][harmonic-2]+=uniqueStr;
147         outputSlotName[icentr][harmonic-2]+=Form("_v%i_",harmonic);
148         outputSlotName[icentr][harmonic-2]+=cutsRP[icentr]->GetName();
149         outputSlotName[icentr][harmonic-2]+="_";
150         outputSlotName[icentr][harmonic-2]+=QC_POI[icentr]->GetName();
151         outputSlotName[icentr][harmonic-2]+=Form("_%i-",centrMin[icentr]);
152         outputSlotName[icentr][harmonic-2]+=Form("%i_",centrMax[icentr]);
153         
154         
155         if(isPID){
156             outputSlotName[icentr][harmonic-2]+=AliFlowTrackCuts::PIDsourceName(sourcePID);//sourcePID
157             outputSlotName[icentr][harmonic-2]+="_";
158             outputSlotName[icentr][harmonic-2]+=AliPID::ParticleName(particleType);//particleType
159         }
160         else{
161             outputSlotName[icentr][harmonic-2]+="AllCharged";
162         }
163         if (charge<0) outputSlotName[icentr][harmonic-2]+="-";
164         if (charge>0) outputSlotName[icentr][harmonic-2]+="+";
165     }
166 }
167
168
169 TString fileName(fileNameBase);
170 fileName.Append(".root");
171
172
173     
174 //====================================FLOWPACKAGE TASKS=========================//
175 AliAnalysisDataContainer *cinput1[ncentr];
176 AliAnalysisDataContainer *coutputFE[ncentr];
177 AliAnalysisDataContainer* coutputFEQA[ncentr];
178 AliAnalysisTaskFlowEvent *taskFE[ncentr];
179
180
181 AliAnalysisDataContainer *coutputQC[ncentr][4];
182 AliAnalysisTaskQCumulants *taskQC[ncentr][4];
183
184 TString outputQA[ncentr];
185
186 for (int icentr=0; icentr<ncentr; icentr++) {
187         
188     // Get the pointer to the existing analysis manager via the static access method.
189         //==============================================================================
190     AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
191     if (!mgr) {
192         Error("AddTaskFlowEvent", "No analysis manager to connect to.");
193         return NULL;
194     }
195         
196     // Check the analysis type using the event handlers connected to the analysis
197     // manager. The availability of MC handler can also be checked here.
198     //==============================================================================
199     if (!mgr->GetInputEventHandler()) {
200         ::Error("AddTaskFlowEvent", "This task requires an input event handler");
201         return NULL;
202     }
203
204     taskFE[icentr] = new AliAnalysisTaskFlowEvent(Form("TaskFlowEvent_%s",suffixName[icentr].Data()),"",doQA);
205     taskFE[icentr]->SelectCollisionCandidates(triggerSelectionString);
206     mgr->AddTask(taskFE[icentr]);
207
208     // Pass cuts for RPs and POIs to the task:
209     taskFE[icentr]->SetCutsEvent(cutsEvent[icentr]);
210     taskFE[icentr]->SetCutsRP(cutsRP[icentr]);
211     taskFE[icentr]->SetCutsPOI(QC_POI[icentr]);
212     if (cutsRP[icentr]->GetParamType()==AliFlowTrackCuts::kVZERO)
213     {
214         //TODO: since this is set in a static object all analyses in an analysis train
215         //will be affected.
216         taskFE[icentr]->SetHistWeightvsPhiMin(0.);
217         taskFE[icentr]->SetHistWeightvsPhiMax(200.);
218     }
219     
220     AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
221     
222     cinput1[icentr] = mgr->GetCommonInputContainer();
223     
224     coutputFE[icentr] = mgr->CreateContainer(Form("FlowEvent_%s",suffixName[icentr].Data()),AliFlowEventSimple::Class(),AliAnalysisManager::kExchangeContainer);
225
226     mgr->ConnectInput(taskFE[icentr],0,cinput1[icentr]);
227     mgr->ConnectOutput(taskFE[icentr],1,coutputFE[icentr]);
228     //==========================================================
229
230     for(int harm=2;harm<6;harm++){
231         
232         taskQC[icentr][harm-2] = new AliAnalysisTaskQCumulants(Form("TaskQCumulants_%s",outputSlotName[icentr][harm-2].Data()),kFALSE);
233         taskQC[icentr][harm-2]->SelectCollisionCandidates(triggerSelectionString);
234       //  taskQC[icentr][harm-2]->SetUsePhiWeights(WEIGHTS[0]);
235       //  taskQC[icentr][harm-2]->SetUsePtWeights(WEIGHTS[1]);
236       //  taskQC[icentr][harm-2]->SetUseEtaWeights(WEIGHTS[2]);
237         taskQC[icentr][harm-2]->SetCalculateCumulantsVsM(kFALSE);
238         taskQC[icentr][harm-2]->SetnBinsMult(10000);
239         taskQC[icentr][harm-2]->SetMinMult(0.);
240         taskQC[icentr][harm-2]->SetMaxMult(10000.);
241         taskQC[icentr][harm-2]->SetHarmonic(harm);
242         taskQC[icentr][harm-2]->SetApplyCorrectionForNUA(kFALSE);
243         taskQC[icentr][harm-2]->SetFillMultipleControlHistograms(kFALSE);
244         mgr->AddTask(taskQC[icentr][harm-2]);
245
246         TString outputQC = fileName;
247         outputQC += ":outputQCanalysis";
248         outputQC+= rptypestr;
249         
250         coutputQC[icentr][harm-2] = mgr->CreateContainer(Form("QC_%s",outputSlotName[icentr][harm-2].Data()),
251                                             TList::Class(),AliAnalysisManager::kOutputContainer,outputQC);
252         mgr->ConnectInput(taskQC[icentr][harm-2],0,coutputFE[icentr]);
253         mgr->ConnectOutput(taskQC[icentr][harm-2],1,coutputQC[icentr][harm-2]);
254
255     }
256
257
258     if (taskFE[icentr]->GetQAOn()) {
259         outputQA[icentr] = fileName;
260         outputQA[icentr] += ":QA";
261         coutputFEQA[icentr] = mgr->CreateContainer(Form("QA_%s",suffixName[icentr].Data()), TList::Class(),AliAnalysisManager::kOutputContainer,outputQA[icentr]);
262         mgr->ConnectOutput(taskFE[icentr],2,coutputFEQA[icentr]);
263     }
264
265
266 }
267
268 }
269
270 //===========================================================================
271
272 AliFlowEventCuts* DefinecutsEvent(Int_t icentr){
273     AliFlowEventCuts* cutsEvent = new AliFlowEventCuts(Form("eventcuts_%d",icentr));
274     return cutsEvent;
275 }
276 AliFlowTrackCuts* DefineRPcuts(Int_t icentr){
277     AliFlowTrackCuts* cutsRP = new AliFlowTrackCuts(Form("TPConlyRP_%d",icentr));
278     return cutsRP;
279 }
280 AliFlowTrackCuts* DefinePOIcuts(Int_t icentr){
281     AliFlowTrackCuts* cutsPOI = new AliFlowTrackCuts(Form("TPConlyPOI_%d",icentr));
282     return cutsPOI;
283 }
284
285
286
287
288