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