]>
Commit | Line | Data |
---|---|---|
c683985a | 1 | /////////////////////////////////////////////////////////////////// |
2 | // // | |
3 | // AddTaskFlowITSTPCTOFQCSP macro // | |
4 | // Author: Andrea Dubla, Utrecht University, 2012 // | |
5 | // // | |
6 | /////////////////////////////////////////////////////////////////// | |
7 | class AliAnalysisDataContainer; | |
8 | class AliFlowTrackCuts; | |
9 | class AliFlowTrackSimpleCuts; | |
10 | class AliFlowEventCuts; | |
11 | class AliFlowEventSimpleCuts; | |
12 | class AliAnalysisDataContainer; | |
13 | class AliHFEextraCuts; | |
14 | ||
15 | AliAnalysisTaskFlowITSTPCTOFQCSP* AddTaskFlowITSTPCTOFQCSP( | |
16 | TString uniqueID = "", | |
17 | Float_t centrMin , | |
18 | Float_t centrMax , | |
19 | Double_t InvmassCut, | |
20 | Int_t Trigger, | |
21 | Bool_t multCorrcut, | |
22 | Double_t pTCutmin, | |
23 | Double_t pTCutmax, | |
24 | Double_t minTOFnSigma, | |
25 | Double_t maxTOFnSigma, | |
26 | Double_t minITSnsigmaLowpT, | |
27 | Double_t maxITSnsigmaLowpT, | |
28 | Double_t minITSnsigmaHighpT, | |
29 | Double_t maxITSnsigmaHighpT, | |
30 | Double_t minTPCnsigmaLowpT, | |
31 | Double_t maxTPCnsigmaLowpT, | |
32 | Double_t minTPCnsigmaHighpT, | |
33 | Double_t maxTPCnsigmaHighpT, | |
34 | Int_t minTPCCluster, | |
35 | Int_t TPCS, | |
36 | AliHFEextraCuts::ITSPixel_t pixel, | |
7fcd6b0f | 37 | Int_t TPCClusterforAsso = 80, |
38 | Bool_t AssoITSref = kTRUE, | |
164d5623 | 39 | Double_t ptminassocut = 0.25, |
c683985a | 40 | Bool_t PhotonicElectronDCA = kFALSE, |
41 | // Bool_t QaPidSparse = kFALSE, | |
42 | const char *Cent = "V0M", | |
43 | Bool_t QC = kTRUE, // use qc2 and qc4 | |
44 | Bool_t SP_TPC = kTRUE, //use tpc sp method | |
45 | Bool_t VZERO_SP = kFALSE, // use vzero sp method | |
46 | Int_t harmonic = 2, | |
47 | Bool_t shrinkSP = kTRUE, | |
48 | Bool_t debug = kFALSE, | |
49 | Int_t RPFilterBit = 1, | |
50 | Bool_t op_ang = kFALSE, | |
51 | Int_t Vz = 10, | |
52 | Double_t op_angle_cut = 3., | |
53 | TString histoflatname = "alien:///alice/cern.ch/user/a/adubla/CentrDistrBins005.root" | |
54 | ) | |
55 | ||
56 | { | |
57 | ||
58 | ||
59 | ||
60 | if(debug) cout << " === Adding Task ElectFlow === " << endl; | |
61 | TString fileName = AliAnalysisManager::GetCommonFileName(); | |
62 | fileName += ":ElectroID_"; | |
63 | fileName += uniqueID; | |
64 | if(debug) cout << " --> Reconstruction data container: " << fileName << endl; | |
65 | AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); | |
66 | if (!mgr) { | |
67 | if(debug) cout << " Fatal error: no analysis manager found! " << endl; | |
68 | return 0x0; | |
69 | } | |
70 | if (!mgr->GetInputEventHandler()) { | |
71 | if(debug) cout << " Fatal error: no imput event handler found!" << endl; | |
72 | return 0x0; | |
73 | } | |
74 | ||
75 | //create a task | |
76 | AliAnalysisTaskFlowITSTPCTOFQCSP *taskHFE = ConfigHFEStandardCuts(kFALSE, minTPCCluster, pixel); //kTRUE if MC | |
77 | ||
78 | if(debug) cout << " === AliAnalysisTaskFlowITSTPCTOFQCSP === " << taskHFE << endl; | |
79 | if(!taskHFE) { | |
80 | if(debug) cout << " --> Unexpected error occurred: NO TASK WAS CREATED! (could be a library problem!) " << endl; | |
81 | return 0x0; | |
82 | } | |
83 | taskHFE->SetTrigger(Trigger); | |
84 | ||
85 | if(Trigger==0 || Trigger==4){ | |
86 | TFile *fFlat=TFile::Open(histoflatname.Data()); | |
87 | TCanvas *c=fFlat->Get("cintegral"); | |
88 | TH1F *hfl=(TH1F*)c->FindObject("hint"); | |
89 | taskHFE->SetHistoForCentralityFlattening(hfl,centrMin,centrMax,0.,0); | |
90 | } | |
91 | // Set centrality percentiles and method V0M, FMD, TRK, TKL, CL0, CL1, V0MvsFMD, TKLvsV0M, ZEMvsZDC | |
92 | taskHFE->SetCentralityParameters(centrMin, centrMax, Cent); | |
93 | taskHFE->SetInvariantMassCut(InvmassCut); | |
94 | taskHFE->SetpTCuttrack(pTCutmin, pTCutmax); | |
95 | taskHFE->SetTPCS(TPCS); | |
96 | taskHFE->SetVz(Vz); | |
97 | taskHFE->SetIDCuts(minTOFnSigma, maxTOFnSigma, minITSnsigmaLowpT, maxITSnsigmaLowpT, minITSnsigmaHighpT, maxITSnsigmaHighpT, minTPCnsigmaLowpT, maxTPCnsigmaLowpT, minTPCnsigmaHighpT, maxTPCnsigmaHighpT); | |
98 | // taskHFE->SetQAPIDSparse(QaPidSparse); | |
99 | taskHFE->SelectPhotonicElectronMethod(PhotonicElectronDCA); | |
100 | taskHFE->SetOpeningAngleflag(op_ang); | |
101 | taskHFE->SetOpeningAngleCut(op_angle_cut); | |
102 | taskHFE->SetMultCorrelationCut(multCorrcut); | |
164d5623 | 103 | taskHFE->SetPtMinAssoCut(ptminassocut); |
7fcd6b0f | 104 | taskHFE->SetAssoTPCCluster(TPCClusterforAsso); |
105 | taskHFE->SetAssoITSRefit(AssoITSref); | |
c683985a | 106 | //set RP cuts for flow package analysis |
107 | cutsRP = new AliFlowTrackCuts(Form("RFPcuts%s",uniqueID)); | |
108 | if(!cutsRP) { | |
109 | if(debug) cout << " Fatal error: no RP cuts found, could be a library problem! " << endl; | |
110 | return 0x0; | |
111 | } | |
112 | ||
113 | if(!VZERO_SP) { | |
114 | AliFlowTrackCuts::trackParameterType rptype = AliFlowTrackCuts::kGlobal; | |
115 | cutsRP->SetParamType(rptype); | |
116 | cutsRP->SetAODfilterBit(RPFilterBit); | |
117 | cutsRP->SetPtRange(0.2, 5.0); | |
118 | cutsRP->SetEtaRange(-0.8, 0.8); | |
119 | cutsRP->SetMinNClustersTPC(70); | |
120 | cutsRP->SetMinChi2PerClusterTPC(0.1); | |
121 | cutsRP->SetMaxChi2PerClusterTPC(4.0); | |
122 | cutsRP->SetRequireTPCRefit(kTRUE); | |
123 | cutsRP->SetMaxDCAToVertexXY(0.3); | |
124 | cutsRP->SetMaxDCAToVertexZ(0.3); | |
125 | cutsRP->SetAcceptKinkDaughters(kFALSE); | |
126 | cutsRP->SetMinimalTPCdedx(10.); | |
127 | if(debug) cout << " --> kGlobal RP's " << cutsRP << endl; | |
128 | } | |
129 | if(VZERO_SP) { // use vzero sub analysis | |
130 | cutsRP = cutsRP->GetStandardVZEROOnlyTrackCuts(); // select vzero tracks | |
131 | SP_TPC = kFALSE; // disable other methods | |
132 | QC = kFALSE; | |
133 | if(debug) cout << " --> VZERO RP's " << cutsRP << endl; | |
134 | } | |
135 | ||
136 | AliFlowTrackSimpleCuts *POIfilterLeft = new AliFlowTrackSimpleCuts(); | |
137 | AliFlowTrackSimpleCuts *POIfilterRight = new AliFlowTrackSimpleCuts(); | |
138 | if(SP_TPC){ | |
139 | POIfilterLeft->SetEtaMin(-0.8); | |
140 | POIfilterLeft->SetEtaMax(0.0); | |
141 | POIfilterLeft->SetMassMin(263731); POIfilterLeft->SetMassMax(263733); | |
142 | ||
143 | POIfilterRight->SetEtaMin(0.0); | |
144 | POIfilterRight->SetEtaMax(0.8); | |
145 | POIfilterRight->SetMassMin(263731); POIfilterRight->SetMassMax(263733); | |
146 | } | |
147 | ||
148 | ||
149 | AliFlowTrackSimpleCuts *POIfilterVZERO = new AliFlowTrackSimpleCuts(); | |
150 | if(VZERO_SP || QC){ | |
151 | POIfilterVZERO->SetEtaMin(-0.8); | |
152 | POIfilterVZERO->SetEtaMax(0.8); | |
153 | POIfilterVZERO->SetMassMin(263731); POIfilterVZERO->SetMassMax(263733); | |
154 | ||
155 | } | |
156 | ||
157 | ||
158 | AliFlowTrackSimpleCuts *POIfilterLeftH = new AliFlowTrackSimpleCuts(); | |
159 | AliFlowTrackSimpleCuts *POIfilterRightH = new AliFlowTrackSimpleCuts(); | |
160 | if(SP_TPC){ | |
161 | POIfilterLeftH->SetEtaMin(-0.8); | |
162 | POIfilterLeftH->SetEtaMax(0.0); | |
163 | POIfilterLeftH->SetMassMin(2636); POIfilterLeftH->SetMassMax(2638); | |
164 | ||
165 | POIfilterRightH->SetEtaMin(0.0); | |
166 | POIfilterRightH->SetEtaMax(0.8); | |
167 | POIfilterRightH->SetMassMin(2636); POIfilterRightH->SetMassMax(2638); | |
168 | } | |
169 | ||
170 | ||
171 | AliFlowTrackSimpleCuts *POIfilterQCH = new AliFlowTrackSimpleCuts(); | |
172 | if(QC){ | |
173 | POIfilterQCH->SetEtaMin(-0.8); | |
174 | POIfilterQCH->SetEtaMax(0.8); | |
175 | POIfilterQCH->SetMassMin(2636); POIfilterQCH->SetMassMax(2638); | |
176 | ||
177 | } | |
178 | ||
179 | ||
180 | ||
181 | taskHFE->SetRPCuts(cutsRP); | |
182 | ||
183 | ||
184 | AliAnalysisDataContainer *coutput3 = mgr->CreateContainer(Form("ccontainer0_%s",uniqueID.Data()),TList::Class(),AliAnalysisManager::kOutputContainer,fileName); | |
185 | ||
186 | mgr->ConnectInput(taskHFE,0,mgr->GetCommonInputContainer()); | |
187 | mgr->ConnectOutput(taskHFE,1,coutput3); | |
188 | ||
189 | ||
190 | if(debug) cout << " === RECEIVED REQUEST FOR FLOW ANALYSIS === " << endl; | |
191 | AliAnalysisDataContainer *flowEvent = mgr->CreateContainer(Form("FlowContainer_%s",uniqueID.Data()), AliFlowEventSimple::Class(), AliAnalysisManager::kExchangeContainer); | |
192 | mgr->ConnectOutput(taskHFE, 2, flowEvent); | |
193 | if(debug) cout << " --> Created IO containers " << flowEvent << endl; | |
194 | ||
195 | ||
196 | mgr->AddTask(taskHFE); | |
197 | ||
198 | if (QC) { // add qc tasks | |
199 | TPCTOFnew::AddQCmethod(Form("QCTPCin_%s",uniqueID.Data()), harmonic, flowEvent, debug ,uniqueID, -0.8, -0.0, 0.0, 0.8,false,POIfilterVZERO); | |
200 | if(debug) cout << " --> Hanging QC task ...succes! "<< endl; | |
201 | } | |
202 | if (SP_TPC) { // add sp subevent tasks | |
203 | TPCTOFnew::AddSPmethod(Form("SPTPCQa_in_%s", uniqueID.Data()), -0.8, -.0, .0, +0.8, "Qa", harmonic, flowEvent, false, shrinkSP, debug,uniqueID, false, POIfilterRight); | |
204 | if(debug) cout << " --> Hanging SP Qa task ... succes!" << endl; | |
205 | TPCTOFnew::AddSPmethod(Form("SPTPCQb_in_%s", uniqueID.Data()), -0.8, -.0, .0, +0.8, "Qb", harmonic, flowEvent, false, shrinkSP, debug,uniqueID, false, POIfilterLeft); | |
206 | if(debug) cout << " --> Hanging SP Qb task ... succes!"<< endl; | |
207 | } | |
208 | if (VZERO_SP) { // add sp subevent tasks | |
209 | TPCTOFnew::AddSPmethod(Form("SPVZEROQa_in_%s", uniqueID.Data()), -0.8, -.0, .0, +0.8, "Qa", harmonic, flowEvent, false, shrinkSP, debug,uniqueID, true, POIfilterVZERO); | |
210 | if(debug) cout << " --> Hanging SP Qa task ... succes!" << endl; | |
211 | TPCTOFnew::AddSPmethod(Form("SPVZEROQb_in_%s", uniqueID.Data()), -0.8, -.0, .0, +0.8, "Qb", harmonic, flowEvent, false, shrinkSP, debug,uniqueID, true, POIfilterVZERO); | |
212 | if(debug) cout << " --> Hanging SP Qb task ... succes!"<< endl; | |
213 | } | |
214 | ||
215 | ||
216 | return taskHFE; | |
217 | ||
218 | } | |
219 | ||
220 | //_____________________________________________________________________________ | |
221 | //_____________________________________________________________________________ | |
222 | ||
223 | AliAnalysisTaskFlowITSTPCTOFQCSP* ConfigHFEStandardCuts(Bool_t useMC,Int_t minTPCCulster,AliHFEextraCuts::ITSPixel_t pixel){ | |
224 | // | |
225 | // HFE standard task configuration | |
226 | // | |
227 | ||
228 | Bool_t kAnalyseTaggedTracks = kTRUE; | |
229 | ||
230 | AliHFEcuts *hfecuts = new AliHFEcuts("hfeCuts","HFE Standard Cuts"); //TODO....change the cuts values to PbPb | |
231 | // hfecuts->CreateStandardCuts(); | |
232 | hfecuts->SetMinNClustersTPC(minTPCCulster); | |
233 | hfecuts->SetMinNClustersITS(5);//5 for ITS pid.....usually i used 3. | |
234 | hfecuts->SetMinNTrackletsTRD(0); | |
235 | hfecuts->SetMinRatioTPCclusters(0.6); | |
236 | ||
237 | // hfecuts->SetEtaRange(-0.9,0.9); | |
238 | // hfecuts->SetTPCmodes(AliHFEextraCuts::kFound, AliHFEextraCuts::kFoundOverFindable); | |
239 | hfecuts->SetRequireITSPixel(); | |
240 | hfecuts->SetCutITSpixel(pixel);//kAny | |
241 | hfecuts->SetMaxChi2perClusterITS(36); //new from ALberto | |
242 | hfecuts->SetMaxChi2perClusterTPC(3.5); | |
243 | hfecuts->SetCheckITSLayerStatus(kFALSE); // shud be put back | |
244 | // hfecuts->UnsetVertexRequirement(); | |
245 | hfecuts->SetVertexRange(10.); | |
246 | hfecuts->SetRequireSigmaToVertex(); | |
247 | //hfecuts->SetSigmaToVertex(10); | |
248 | hfecuts->SetTOFPIDStep(kFALSE); | |
249 | // hfecuts->SetQAOn(); | |
250 | hfecuts->SetPtRange(0, 5.); | |
251 | ||
252 | AliAnalysisTaskFlowITSTPCTOFQCSP *task = new AliAnalysisTaskFlowITSTPCTOFQCSP("HFE_Flow_TPCTOF"); | |
253 | printf("*************************************************************"); | |
254 | printf("task -------------------------------------------- %p\n ", task); | |
255 | printf("*************************************************************\n"); | |
256 | ||
257 | ||
258 | task->SetHFECuts(hfecuts); | |
259 | ||
260 | // task->SetInvariantMassCut(0.05); | |
261 | // task->SetRejectKinkMother(kTRUE); | |
262 | // task->SetRemovePileUp(kTRUE); | |
263 | ||
264 | // Define PID | |
265 | AliHFEpid *pid = task->GetPID(); | |
266 | if(useMC) pid->SetHasMCData(kTRUE); | |
267 | pid->AddDetector("ITS", 0); | |
268 | pid->AddDetector("TOF", 1); | |
269 | pid->AddDetector("TPC", 2); | |
270 | ||
271 | printf("*************************************\n"); | |
272 | printf("Configuring standard Task:\n"); | |
273 | // task->PrintStatus(); | |
274 | pid->PrintStatus(); | |
275 | printf("*************************************\n"); | |
276 | return task; | |
277 | ||
278 | ||
279 | } | |
280 | ||
281 | //_____________________________________________________________________________ | |
282 | ||
283 | namespace TPCTOFnew{ | |
284 | //_____________________________________________________________________________ | |
285 | void AddSPmethod(char *name, double minEtaA, double maxEtaA, double minEtaB, double maxEtaB, char *Qvector, int harmonic, AliAnalysisDataContainer *flowEvent, bool bEP, bool shrink = false, bool debug, TString uniqueID,Bool_t VZERO_SP = kFALSE, AliFlowTrackSimpleCuts* POIfilter) | |
286 | { | |
287 | // add sp task and invm filter tasks | |
288 | if(debug) (bEP) ? cout << " ****** Reveived request for EP task ****** " << endl : cout << " ******* Switching to SP task ******* " << endl; | |
289 | TString fileName = AliAnalysisManager::GetCommonFileName(); | |
290 | (bEP) ? fileName+=":EP_tpctof" : fileName+=":SP_tpctof"; | |
291 | // if(etagap) { | |
292 | // fileName+="_SUBEVENTS"; | |
293 | // if(debug) cout << " --> Setting up subevent analysis <-- " << endl; | |
294 | // } | |
295 | if(debug) cout << " --> fileName " << fileName << endl; | |
296 | TString myFolder = fileName; | |
297 | if(debug) cout << " --> myFolder " << myFolder << endl; | |
298 | TString myNameSP; | |
299 | (bEP) ? myNameSP = Form("%sEPv%d%s", name, harmonic, Qvector): myNameSP = Form("%sSPv%d%s", name, harmonic, Qvector); | |
300 | if(debug) cout << " myNameSP " << myNameSP << endl; | |
301 | AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); | |
302 | AliAnalysisDataContainer *flowEventOut = mgr->CreateContainer(Form("Filter_%s",myNameSP.Data()),AliFlowEventSimple::Class(),AliAnalysisManager::kExchangeContainer); | |
303 | AliAnalysisTaskFilterFE *tskFilter = new AliAnalysisTaskFilterFE(Form("TaskFilter_%s", myNameSP.Data()), NULL, POIfilter); | |
304 | tskFilter->SetSubeventEtaRange(minEtaA, maxEtaA, minEtaB, maxEtaB); | |
305 | if(VZERO_SP) tskFilter->SetSubeventEtaRange(-10, 0, 0, 10); | |
306 | mgr->AddTask(tskFilter); | |
307 | mgr->ConnectInput(tskFilter, 0, flowEvent); | |
308 | mgr->ConnectOutput(tskFilter, 1, flowEventOut); | |
309 | AliAnalysisDataContainer *outSP = mgr->CreateContainer(myNameSP.Data(), TList::Class(), AliAnalysisManager::kOutputContainer, fileName); | |
310 | AliAnalysisTaskScalarProduct *tskSP = new AliAnalysisTaskScalarProduct(Form("TaskScalarProduct_%s", myNameSP.Data()), kFALSE); | |
311 | tskSP->SetApplyCorrectionForNUA(kTRUE); | |
312 | tskSP->SetHarmonic(harmonic); | |
313 | tskSP->SetTotalQvector(Qvector); | |
314 | if (bEP) tskSP->SetBehaveAsEP(); | |
315 | if (shrink) tskSP->SetBookOnlyBasicCCH(kTRUE); | |
316 | mgr->AddTask(tskSP); | |
317 | mgr->ConnectInput(tskSP, 0, flowEventOut); | |
318 | mgr->ConnectOutput(tskSP, 1, outSP); | |
319 | } | |
320 | //_____________________________________________________________________________ | |
321 | void AddQCmethod(char *name, int harmonic, AliAnalysisDataContainer *flowEvent, Bool_t debug, TString uniqueID,double minEtaA, double maxEtaA, double minEtaB, double maxEtaB,Bool_t VZERO_SP = kFALSE, AliFlowTrackSimpleCuts* POIfilter) | |
322 | { | |
323 | // add qc task and invm filter tasks | |
324 | if(debug) cout << " ****** Received request for QC v" << harmonic << " task " << name << ", IO ****** " << flowEvent << endl; | |
325 | TString fileName = AliAnalysisManager::GetCommonFileName(); | |
326 | fileName+=":QC_tpctof"; | |
327 | if(debug) cout << " --> Common filename: " << fileName << endl; | |
328 | TString myFolder = Form("v%d", harmonic); | |
329 | if(debug) cout << " --> myFolder: " << myFolder << endl; | |
330 | TString myName = Form("%s", name); | |
331 | if(debug) cout << " --> myName: " << myName << endl; | |
332 | AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); | |
333 | AliAnalysisDataContainer *flowEventOut = mgr->CreateContainer(Form("Filter_%s", myName.Data()), AliFlowEventSimple::Class(),AliAnalysisManager::kExchangeContainer); | |
334 | AliAnalysisTaskFilterFE *tskFilter = new AliAnalysisTaskFilterFE(Form("TaskFilter_%s", myName.Data()), NULL, POIfilter); | |
335 | tskFilter->SetSubeventEtaRange(minEtaA, maxEtaA, minEtaB, maxEtaB); | |
336 | // if(VZERO_SP) tskFilter->SetSubeventEtaRange(-10, 0, 0, 10); | |
337 | mgr->AddTask(tskFilter); | |
338 | mgr->ConnectInput(tskFilter, 0, flowEvent); | |
339 | mgr->ConnectOutput(tskFilter, 1, flowEventOut); | |
340 | ||
341 | AliAnalysisDataContainer *outQC = mgr->CreateContainer(myName.Data(), TList::Class(), AliAnalysisManager::kOutputContainer, fileName); | |
342 | AliAnalysisTaskQCumulants *tskQC = new AliAnalysisTaskQCumulants(Form("TaskQCumulants_%s", myName.Data()), kFALSE); | |
343 | tskQC->SetApplyCorrectionForNUA(kTRUE); | |
344 | tskQC->SetHarmonic(harmonic); | |
345 | tskQC->SetBookOnlyBasicCCH(kTRUE); | |
346 | mgr->AddTask(tskQC); | |
347 | mgr->ConnectInput(tskQC, 0, flowEventOut); | |
348 | mgr->ConnectOutput(tskQC, 1, outQC); | |
349 | } | |
350 | //_____________________________________________________________________________ | |
351 | } | |
352 |