]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGHF/hfe/macros/AddTaskFlowITSTPCTOFQCSP.C
Split: fix refs to AddTaskPhysicsSelection.C
[u/mrichter/AliRoot.git] / PWGHF / hfe / macros / AddTaskFlowITSTPCTOFQCSP.C
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                                                      Int_t TPCClusterforAsso = 80,
38                                                      Bool_t AssoITSref = kTRUE,
39                                                      Double_t ptminassocut = 0.0,
40                                                      Bool_t Weight = kFALSE,
41                                                      Bool_t withmultetacorrection=kFALSE,
42                                                      Bool_t PhiCut = kFALSE,
43                                                      Bool_t PhotonicElectronDCA = kFALSE,
44                                                     // Bool_t QaPidSparse = kFALSE,
45                                                      const char *Cent = "V0M",
46                                                      Bool_t QC = kTRUE, // use qc2 and qc4
47                                                      Bool_t SP_TPC = kTRUE, //use tpc sp method
48                                                      Bool_t VZERO_SP = kFALSE, // use vzero sp method
49                                                      Int_t harmonic = 2,
50                                                      Bool_t shrinkSP = kTRUE,
51                                                      Bool_t debug = kFALSE,
52                                                      Int_t RPFilterBit = 1,
53                                                      Bool_t op_ang = kFALSE,
54                                                      Int_t Vz = 10,
55                                                      Double_t op_angle_cut = 3.
56                                                      )
57
58 {
59     
60     
61     
62     if(debug) cout << " === Adding Task ElectFlow === " << endl;
63     TString fileName = AliAnalysisManager::GetCommonFileName();
64     fileName += ":ElectroID_";
65     fileName += uniqueID;
66     if(debug) cout << "    --> Reconstruction data container: " << fileName << endl;
67     AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
68     if (!mgr) {
69         if(debug) cout << " Fatal error: no analysis manager found! " << endl;
70         return 0x0;
71     }
72     if (!mgr->GetInputEventHandler()) {
73         if(debug) cout << " Fatal error: no imput event handler found!" << endl;
74         return 0x0;
75     }
76     
77     //create a task
78     AliAnalysisTaskFlowITSTPCTOFQCSP *taskHFE = ConfigHFEStandardCuts(kFALSE, minTPCCluster, pixel, withmultetacorrection);    //kTRUE if MC
79     
80     if(debug) cout << " === AliAnalysisTaskFlowITSTPCTOFQCSP === " << taskHFE << endl;
81     if(!taskHFE) {
82         if(debug) cout << " --> Unexpected error occurred: NO TASK WAS CREATED! (could be a library problem!) " << endl;
83         return 0x0;
84     }
85     taskHFE->SetTrigger(Trigger);
86     taskHFE->SetEPWeight(Weight);
87
88     
89     TString histoflatname = "alien:///alice/cern.ch/user/a/adubla/CentrDistrBins005.root";
90     if(Trigger==0 || Trigger==4){
91         TFile *fFlat=TFile::Open(histoflatname.Data());
92         TCanvas *c=fFlat->Get("cintegral");
93         TH1F *hfl=(TH1F*)c->FindObject("hint");
94         taskHFE->SetHistoForCentralityFlattening(hfl,centrMin,centrMax,0.,0);
95     }
96     
97     TString histoflatnameEP = "alien:///alice/cern.ch/user/a/adubla/EPVZero010_Smart.root";
98     if(Weight){
99         TFile *fFlatEP=TFile::Open(histoflatnameEP,"READ");
100         TCanvas *cEP=fFlatEP->Get("c1_n7");
101         TH1D *hEPfl=(TH1D*)cEP->FindObject("EPVz");
102         taskHFE->SetHistoForEPFlattWeights(hEPfl);
103     }
104     
105     
106     // Set centrality percentiles and method V0M, FMD, TRK, TKL, CL0, CL1, V0MvsFMD, TKLvsV0M, ZEMvsZDC
107     taskHFE->SetCentralityParameters(centrMin, centrMax, Cent);
108     taskHFE->SetInvariantMassCut(InvmassCut);
109     taskHFE->SetpTCuttrack(pTCutmin, pTCutmax);
110     taskHFE->SetTPCS(TPCS);
111     taskHFE->SetVz(Vz);
112     taskHFE->SetIDCuts(minTOFnSigma, maxTOFnSigma, minITSnsigmaLowpT, maxITSnsigmaLowpT, minITSnsigmaHighpT, maxITSnsigmaHighpT, minTPCnsigmaLowpT, maxTPCnsigmaLowpT, minTPCnsigmaHighpT, maxTPCnsigmaHighpT);
113   //  taskHFE->SetQAPIDSparse(QaPidSparse);
114     taskHFE->SelectPhotonicElectronMethod(PhotonicElectronDCA);
115     taskHFE->SetOpeningAngleflag(op_ang);
116     taskHFE->SetOpeningAngleCut(op_angle_cut);
117     taskHFE->SetMultCorrelationCut(multCorrcut);
118     taskHFE->SetPtMinAssoCut(ptminassocut);
119     taskHFE->SetAssoTPCCluster(TPCClusterforAsso);
120     taskHFE->SetAssoITSRefit(AssoITSref);
121     taskHFE->SetPhiCut(PhiCut);
122
123     
124     
125     
126     //set RP cuts for flow package analysis
127     cutsRP = new AliFlowTrackCuts(Form("RFPcuts%s",uniqueID));
128     if(!cutsRP) {
129         if(debug) cout << " Fatal error: no RP cuts found, could be a library problem! " << endl;
130         return 0x0;
131     }
132     
133     if(!VZERO_SP) {
134         AliFlowTrackCuts::trackParameterType rptype = AliFlowTrackCuts::kGlobal;
135         cutsRP->SetParamType(rptype);
136         cutsRP->SetAODfilterBit(RPFilterBit);
137         cutsRP->SetPtRange(0.2, 5.0);
138         cutsRP->SetEtaRange(-0.8, 0.8);
139         cutsRP->SetMinNClustersTPC(70);
140         cutsRP->SetMinChi2PerClusterTPC(0.1);
141         cutsRP->SetMaxChi2PerClusterTPC(4.0);
142         cutsRP->SetRequireTPCRefit(kTRUE);
143         cutsRP->SetMaxDCAToVertexXY(0.3);
144         cutsRP->SetMaxDCAToVertexZ(0.3);
145         cutsRP->SetAcceptKinkDaughters(kFALSE);
146         cutsRP->SetMinimalTPCdedx(10.);
147         if(debug) cout << "    --> kGlobal RP's " << cutsRP << endl;
148     }
149     if(VZERO_SP) { // use vzero sub analysis
150         cutsRP = cutsRP->GetStandardVZEROOnlyTrackCuts(); // select vzero tracks
151         SP_TPC = kFALSE; // disable other methods
152         QC = kFALSE;
153         if(debug) cout << "    --> VZERO RP's " << cutsRP << endl;
154     }
155     
156     AliFlowTrackSimpleCuts *POIfilterLeft = new AliFlowTrackSimpleCuts();
157     AliFlowTrackSimpleCuts *POIfilterRight = new AliFlowTrackSimpleCuts();
158     if(SP_TPC){
159         POIfilterLeft->SetEtaMin(-0.8);
160         POIfilterLeft->SetEtaMax(0.0);
161         POIfilterLeft->SetMassMin(263731); POIfilterLeft->SetMassMax(263733);
162         
163         POIfilterRight->SetEtaMin(0.0);
164         POIfilterRight->SetEtaMax(0.8);
165         POIfilterRight->SetMassMin(263731); POIfilterRight->SetMassMax(263733);
166     }
167     
168     
169     AliFlowTrackSimpleCuts *POIfilterVZERO = new AliFlowTrackSimpleCuts();
170     if(VZERO_SP || QC){
171         POIfilterVZERO->SetEtaMin(-0.8);
172         POIfilterVZERO->SetEtaMax(0.8);
173         POIfilterVZERO->SetMassMin(263731); POIfilterVZERO->SetMassMax(263733);
174         
175     }
176     
177     
178     AliFlowTrackSimpleCuts *POIfilterLeftH = new AliFlowTrackSimpleCuts();
179     AliFlowTrackSimpleCuts *POIfilterRightH = new AliFlowTrackSimpleCuts();
180     if(SP_TPC){
181         POIfilterLeftH->SetEtaMin(-0.8);
182         POIfilterLeftH->SetEtaMax(0.0);
183         POIfilterLeftH->SetMassMin(2636); POIfilterLeftH->SetMassMax(2638);
184         
185         POIfilterRightH->SetEtaMin(0.0);
186         POIfilterRightH->SetEtaMax(0.8);
187         POIfilterRightH->SetMassMin(2636); POIfilterRightH->SetMassMax(2638);
188     }
189     
190     
191     AliFlowTrackSimpleCuts *POIfilterQCH = new AliFlowTrackSimpleCuts();
192     if(QC){
193         POIfilterQCH->SetEtaMin(-0.8);
194         POIfilterQCH->SetEtaMax(0.8);
195         POIfilterQCH->SetMassMin(2636); POIfilterQCH->SetMassMax(2638);
196         
197     }
198     
199     
200     
201     taskHFE->SetRPCuts(cutsRP);
202     
203     
204     AliAnalysisDataContainer *coutput3 = mgr->CreateContainer(Form("ccontainer0_%s",uniqueID.Data()),TList::Class(),AliAnalysisManager::kOutputContainer,fileName);
205     
206     mgr->ConnectInput(taskHFE,0,mgr->GetCommonInputContainer());
207     mgr->ConnectOutput(taskHFE,1,coutput3);
208     
209     
210     if(debug) cout << " === RECEIVED REQUEST FOR FLOW ANALYSIS === " << endl;
211     AliAnalysisDataContainer *flowEvent = mgr->CreateContainer(Form("FlowContainer_%s",uniqueID.Data()), AliFlowEventSimple::Class(), AliAnalysisManager::kExchangeContainer);
212     mgr->ConnectOutput(taskHFE, 2, flowEvent);
213     if(debug) cout << "    --> Created IO containers " << flowEvent << endl;
214   
215     
216     mgr->AddTask(taskHFE);
217     
218     if (QC) {  // add qc tasks
219         TPCTOFnew::AddQCmethod(Form("QCTPCin_%s",uniqueID.Data()), harmonic, flowEvent,  debug ,uniqueID, -0.8, -0.0, 0.0, 0.8,false,POIfilterVZERO);
220         if(debug) cout << "    --> Hanging QC task ...succes! "<< endl;
221     }
222     if (SP_TPC) {  // add sp subevent tasks
223         TPCTOFnew::AddSPmethod(Form("SPTPCQa_in_%s", uniqueID.Data()), -0.8, -.0, .0, +0.8, "Qa", harmonic, flowEvent, false, shrinkSP, debug,uniqueID, false, POIfilterRight);
224         if(debug) cout << "    --> Hanging SP Qa task ... succes!" << endl;
225         TPCTOFnew::AddSPmethod(Form("SPTPCQb_in_%s", uniqueID.Data()), -0.8, -.0, .0, +0.8, "Qb", harmonic, flowEvent,  false, shrinkSP, debug,uniqueID, false, POIfilterLeft);
226         if(debug) cout << "    --> Hanging SP Qb task ... succes!"<< endl;
227     }
228     if (VZERO_SP) {  // add sp subevent tasks
229         TPCTOFnew::AddSPmethod(Form("SPVZEROQa_in_%s", uniqueID.Data()), -0.8, -.0, .0, +0.8, "Qa", harmonic, flowEvent, false, shrinkSP, debug,uniqueID, true, POIfilterVZERO);
230         if(debug) cout << "    --> Hanging SP Qa task ... succes!" << endl;
231         TPCTOFnew::AddSPmethod(Form("SPVZEROQb_in_%s", uniqueID.Data()), -0.8, -.0, .0, +0.8, "Qb", harmonic, flowEvent, false, shrinkSP, debug,uniqueID, true, POIfilterVZERO);
232         if(debug) cout << "    --> Hanging SP Qb task ... succes!"<< endl;
233     }
234     
235     
236     return taskHFE;
237     
238 }
239
240 //_____________________________________________________________________________
241 //_____________________________________________________________________________
242
243 AliAnalysisTaskFlowITSTPCTOFQCSP* ConfigHFEStandardCuts(Bool_t useMC,Int_t minTPCCulster,AliHFEextraCuts::ITSPixel_t pixel, Bool_t withmultetacorrection1){
244     //
245     // HFE standard task configuration
246     //
247     
248     Bool_t kAnalyseTaggedTracks = kTRUE;
249     
250     AliHFEcuts *hfecuts = new AliHFEcuts("hfeCuts","HFE Standard Cuts");  //TODO....change the cuts values to PbPb
251     //  hfecuts->CreateStandardCuts();
252     hfecuts->SetMinNClustersTPC(minTPCCulster);
253     hfecuts->SetMinNClustersITS(5);//5 for ITS pid.....usually i used 3.
254     hfecuts->SetMinNTrackletsTRD(0);
255     hfecuts->SetMinRatioTPCclusters(0.6);
256     
257     //   hfecuts->SetEtaRange(-0.9,0.9);
258     //   hfecuts->SetTPCmodes(AliHFEextraCuts::kFound, AliHFEextraCuts::kFoundOverFindable);
259     hfecuts->SetRequireITSPixel();
260     hfecuts->SetCutITSpixel(pixel);//kAny
261     hfecuts->SetMaxChi2perClusterITS(36);  //new from ALberto
262     hfecuts->SetMaxChi2perClusterTPC(3.5);
263     hfecuts->SetCheckITSLayerStatus(kFALSE); // shud be put back
264     //  hfecuts->UnsetVertexRequirement();
265     hfecuts->SetVertexRange(10.);
266     hfecuts->SetRequireSigmaToVertex();
267     //hfecuts->SetSigmaToVertex(10);
268     hfecuts->SetTOFPIDStep(kFALSE);
269     //  hfecuts->SetQAOn();
270     hfecuts->SetPtRange(0, 5.);
271     
272     AliAnalysisTaskFlowITSTPCTOFQCSP *task = new AliAnalysisTaskFlowITSTPCTOFQCSP("HFE_Flow_TPCTOF");
273     printf("*************************************************************");
274     printf("task -------------------------------------------- %p\n ", task);
275     printf("*************************************************************\n");
276     
277     
278     task->SetHFECuts(hfecuts);
279     
280     //   task->SetInvariantMassCut(0.05);
281     //  task->SetRejectKinkMother(kTRUE);
282     //  task->SetRemovePileUp(kTRUE);
283     
284     // Define PID
285        AliHFEpid *pid = task->GetPID();
286        if(useMC) pid->SetHasMCData(kTRUE);
287     pid->AddDetector("ITS", 0);
288     pid->AddDetector("TOF", 1);
289     pid->AddDetector("TPC", 2);
290
291     
292     if(withmultetacorrection1) {
293         AliHFEpidTPC *tpcpid = pid->GetDetPID(AliHFEpid::kTPCpid);
294         // Theo
295         //  task->GetPIDQAManager()->SetFillMultiplicity();
296         TF1 *etaCorrMean = GetEtaCorrection("LHC11h_etaCorrMean");
297         TF1 *etaCorrWdth = GetEtaCorrection("LHC11h_etaCorrWidth");
298         if(etaCorrMean && etaCorrWdth && withmultetacorrection1){
299             tpcpid->SetEtaCorrections(etaCorrMean, etaCorrWdth);
300             printf("TPC dE/dx Eta correction %p %p\n",etaCorrMean,etaCorrWdth);
301         }
302         TF1 *centCorrMean = GetCentralityCorrection("LHC11h_multCorrMean");
303         TF1 *centCorrWdth = GetCentralityCorrection("LHC11h_multCorrWidth");
304         if(centCorrMean && centCorrWdth && withmultetacorrection1){
305             tpcpid->SetCentralityCorrections(centCorrMean, centCorrWdth);
306             printf("TPC dE/dx multiplicity correction %p %p\n",centCorrMean,centCorrWdth);
307         }
308         task->SetMultCorrectionTheo(withmultetacorrection1);
309         task->SetTPCPID(tpcpid);
310     }
311
312     
313        printf("*************************************\n");
314        printf("Configuring standard Task:\n");
315     //  task->PrintStatus();
316       pid->PrintStatus();
317       printf("*************************************\n");
318     return task;
319     
320     
321 }
322
323 //_____________________________________________________________________________
324
325 namespace TPCTOFnew{
326     //_____________________________________________________________________________
327     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)
328     {
329         // add sp task and invm filter tasks
330         if(debug) (bEP) ? cout << " ****** Reveived request for EP task ****** " << endl : cout << " ******* Switching to SP task ******* " << endl;
331         TString fileName = AliAnalysisManager::GetCommonFileName();
332         (bEP) ? fileName+=":EP_tpctof" : fileName+=":SP_tpctof";
333         //          if(etagap) {
334         //            fileName+="_SUBEVENTS";
335         //          if(debug) cout << "    --> Setting up subevent analysis <-- " << endl;
336         //    }
337         if(debug) cout << "    --> fileName " << fileName << endl;
338         TString myFolder = fileName;
339         if(debug) cout << "    --> myFolder " << myFolder << endl;
340         TString myNameSP;
341         (bEP) ? myNameSP = Form("%sEPv%d%s", name, harmonic, Qvector): myNameSP = Form("%sSPv%d%s", name, harmonic, Qvector);
342         if(debug) cout << " myNameSP " << myNameSP << endl;
343         AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
344         AliAnalysisDataContainer *flowEventOut = mgr->CreateContainer(Form("Filter_%s",myNameSP.Data()),AliFlowEventSimple::Class(),AliAnalysisManager::kExchangeContainer);
345         AliAnalysisTaskFilterFE *tskFilter = new AliAnalysisTaskFilterFE(Form("TaskFilter_%s", myNameSP.Data()), NULL, POIfilter);
346         tskFilter->SetSubeventEtaRange(minEtaA, maxEtaA, minEtaB, maxEtaB);
347         if(VZERO_SP) tskFilter->SetSubeventEtaRange(-10, 0, 0, 10);
348         mgr->AddTask(tskFilter);
349         mgr->ConnectInput(tskFilter, 0, flowEvent);
350         mgr->ConnectOutput(tskFilter, 1, flowEventOut);
351         AliAnalysisDataContainer *outSP = mgr->CreateContainer(myNameSP.Data(), TList::Class(), AliAnalysisManager::kOutputContainer, fileName);
352         AliAnalysisTaskScalarProduct *tskSP = new AliAnalysisTaskScalarProduct(Form("TaskScalarProduct_%s", myNameSP.Data()), kFALSE);
353         tskSP->SetApplyCorrectionForNUA(kTRUE);
354         tskSP->SetHarmonic(harmonic);
355         tskSP->SetTotalQvector(Qvector);
356         if (bEP) tskSP->SetBehaveAsEP();
357         if (shrink) tskSP->SetBookOnlyBasicCCH(kTRUE);
358         mgr->AddTask(tskSP);
359         mgr->ConnectInput(tskSP, 0, flowEventOut);
360         mgr->ConnectOutput(tskSP, 1, outSP);
361     }
362     //_____________________________________________________________________________
363     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)
364     {
365         // add qc task and invm filter tasks
366         if(debug) cout << " ****** Received request for QC v" << harmonic << " task " << name << ", IO ****** " << flowEvent << endl;
367         TString fileName = AliAnalysisManager::GetCommonFileName();
368         fileName+=":QC_tpctof";
369         if(debug) cout << "    --> Common filename: " << fileName << endl;
370         TString myFolder = Form("v%d", harmonic);
371         if(debug) cout << "    --> myFolder: " << myFolder << endl;
372         TString myName = Form("%s", name);
373         if(debug) cout << "    --> myName: " << myName << endl;
374         AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
375         AliAnalysisDataContainer *flowEventOut = mgr->CreateContainer(Form("Filter_%s", myName.Data()), AliFlowEventSimple::Class(),AliAnalysisManager::kExchangeContainer);
376         AliAnalysisTaskFilterFE *tskFilter = new AliAnalysisTaskFilterFE(Form("TaskFilter_%s", myName.Data()), NULL, POIfilter);
377         tskFilter->SetSubeventEtaRange(minEtaA, maxEtaA, minEtaB, maxEtaB);
378         //    if(VZERO_SP) tskFilter->SetSubeventEtaRange(-10, 0, 0, 10);
379         mgr->AddTask(tskFilter);
380         mgr->ConnectInput(tskFilter, 0, flowEvent);
381         mgr->ConnectOutput(tskFilter, 1, flowEventOut);
382         
383         AliAnalysisDataContainer *outQC = mgr->CreateContainer(myName.Data(), TList::Class(), AliAnalysisManager::kOutputContainer, fileName);
384         AliAnalysisTaskQCumulants *tskQC = new AliAnalysisTaskQCumulants(Form("TaskQCumulants_%s", myName.Data()), kFALSE);
385         tskQC->SetApplyCorrectionForNUA(kTRUE);
386         tskQC->SetHarmonic(harmonic);
387         tskQC->SetBookOnlyBasicCCH(kTRUE);
388         mgr->AddTask(tskQC);
389         mgr->ConnectInput(tskQC, 0, flowEventOut);
390         mgr->ConnectOutput(tskQC, 1, outQC);
391     }
392     //_____________________________________________________________________________
393 }
394 //_____________________________________________________________________________
395 TF1* GetCentralityCorrection(TString listname="LHC11h"){
396     
397     TString etaMap="$ALICE_ROOT/PWGHF/hfe/macros/configs/PbPb/CentCorrMapsTPC.root";
398     
399     if (gSystem->AccessPathName(gSystem->ExpandPathName(etaMap.Data()))){
400         Error("ConfigHFEpbpb","Eta map not found: %s",etaMap.Data());
401         return 0;
402     }
403     
404     TFile f(etaMap.Data());
405     if (!f.IsOpen()) return 0;
406     gROOT->cd();
407     TList *keys=f.GetListOfKeys();
408     
409     for (Int_t i=0; i<keys->GetEntries(); ++i){
410         TString kName=keys->At(i)->GetName();
411         TPRegexp reg(kName);
412         if (reg.MatchB(listname)){
413             printf("Using Eta Correction Function: %s\n",kName.Data());
414             return (TF1*)f.Get(kName.Data());
415         }
416     }
417     return 0;
418 }
419 //_____________________________________________________________________________
420 TF1* GetEtaCorrection(TString listname="LHC11h"){
421     
422     TString etaMap="$ALICE_ROOT/PWGHF/hfe/macros/configs/PbPb/EtaCorrMapsTPC.root";
423     
424     if (gSystem->AccessPathName(gSystem->ExpandPathName(etaMap.Data()))){
425         Error("ConfigHFEpbpb","Eta map not found: %s",etaMap.Data());
426         return 0;
427     }
428     
429     TFile f(etaMap.Data());
430     if (!f.IsOpen()) return 0;
431     gROOT->cd();
432     TList *keys=f.GetListOfKeys();
433     
434     for (Int_t i=0; i<keys->GetEntries(); ++i){
435         TString kName=keys->At(i)->GetName();
436         TPRegexp reg(kName);
437         if (reg.MatchB(listname)){
438             printf("Using Eta Correction Function: %s\n",kName.Data());
439             return (TF1*)f.Get(kName.Data());
440         }
441     }
442     return 0;
443 }
444 //_____________________________________________________________________________