1 Bool_t ReadContaminationFunctions(TString filename, TF1 **functions, double sigma){
\r
2 TFile *in = TFile::Open(Form("$ALICE_ROOT/PWGHF/hfe/configs/pPb/%s", filename.Data()));
\r
4 int isig = static_cast<int>(sigma * 100.);
\r
5 printf("Getting hadron background for the sigma cut: %d\n", isig);
\r
7 for(int icent = 0; icent < 12; icent++){
\r
8 functions[icent] = dynamic_cast<TF1 *>(in->Get(Form("hback_%d_%d", isig, icent)));
\r
9 if(functions[icent]) printf("Config for centrality class %d found\n", icent);
\r
11 printf("Config for the centrality class %d not found\n", icent);
\r
19 AliAnalysisTaskHFE* ConfigHFEnpepPb(Bool_t isAOD, Bool_t useMC, TString appendix,
\r
20 UChar_t TPCcl=70, UChar_t TPCclPID = 80,
\r
21 UChar_t ITScl=3, Double_t DCAxy=1000., Double_t DCAz=1000.,
\r
22 Double_t* tpcdEdxcutlow=NULL, Double_t* tpcdEdxcuthigh=NULL,
\r
23 Double_t TOFs=3., Int_t TOFmis=0,
\r
24 Int_t itshitpixel = 0, Int_t icent,
\r
25 Double_t assETA=0.8, Int_t assITS=2,
\r
26 Int_t assTPCcl=100, Int_t assTPCPIDcl=80,
\r
27 Double_t assDCAr=1.0, Double_t assDCAz=2.0,
\r
28 Double_t *assTPCSminus=NULL, Double_t *assTPCSplus=NULL)
\r
30 Bool_t kAnalyseTaggedTracks = isAOD ? kFALSE : kTRUE;
\r
32 //***************************************//
\r
33 // Setting up the HFE cuts //
\r
34 //***************************************//
\r
36 AliHFEcuts *hfecuts = new AliHFEcuts(appendix,"HFE cuts pPb");
\r
37 //hfecuts->SetQAOn();
\r
38 hfecuts->CreateStandardCuts();
\r
39 hfecuts->SetMinNClustersTPC(TPCcl);
\r
40 hfecuts->SetMinNClustersTPCPID(TPCclPID);
\r
41 hfecuts->SetMinNClustersITS(ITScl);
\r
42 hfecuts->SetMinRatioTPCclusters(0.6);
\r
43 hfecuts->SetTPCmodes(AliHFEextraCuts::kFound, AliHFEextraCuts::kFoundOverFindable);
\r
44 hfecuts->SetCutITSpixel(itshitpixel);
\r
45 hfecuts->SetCheckITSLayerStatus(kFALSE);
\r
46 hfecuts->SetEtaRange(0.8);
\r
47 hfecuts->SetMaxImpactParam(DCAxy,DCAz);
\r
48 hfecuts->SetUseMixedVertex(kTRUE);
\r
49 hfecuts->SetVertexRange(10.);
\r
50 if(isAOD) hfecuts->SetAODFilterBit(4);
\r
54 Bool_t kTOFmis=kFALSE;
\r
57 printf("CONFIGURATION FILE: TOF is used \n");
\r
58 hfecuts->SetTOFPIDStep(kTRUE);
\r
59 printf("CONFIGURATION FILE: TOF PID step is requested !!!! \n");
\r
62 printf("CONFIGURATION FILE: TOF mismatch rejection is set ON \n");
\r
66 //***************************************//
\r
67 // Setting up the task //
\r
68 //***************************************//
\r
70 AliAnalysisTaskHFE *task = new AliAnalysisTaskHFE(Form("HFEtask%s",appendix.Data()));
\r
71 printf("task %p\n", task);
\r
72 task->SetpPbAnalysis();
\r
73 task->SetHFECuts(hfecuts);
\r
74 task->SetRemovePileUp(kFALSE);
\r
75 if(!isAOD) task->SetRemoveFirstEventInChunk();
\r
76 task->GetPIDQAManager()->SetHighResolutionHistos();
\r
78 // Setttings for pPb
\r
79 task -> SetRemoveFirstEventInChunk();
\r
80 hfecuts -> SetUseCorrelationVertex();
\r
81 hfecuts -> SetSPDVtxResolutionCut();
\r
83 //***************************************//
\r
84 // Variable manager //
\r
85 //***************************************//
\r
88 Double_t ptbinning[36] = {0., 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1., 1.1, 1.2, 1.3, 1.4, 1.5, 1.75, 2., 2.25, 2.5, 2.75, 3., 3.5, 4., 4.5, 5., 5.5, 6., 7., 8., 10., 12., 14., 16., 18., 20.};
\r
89 Double_t etabinning[17] = {-0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0., 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8};
\r
91 Int_t sizept=(sizeof(ptbinning)/sizeof(double))-1;
\r
92 Int_t sizeeta=(sizeof(etabinning)/sizeof(double))-1;
\r
94 AliHFEvarManager *vm = task->GetVarManager();
\r
95 vm->AddVariable("pt", sizept, ptbinning);
\r
96 vm->AddVariable("eta", sizeeta, -0.8,0.8);
\r
97 vm->AddVariable("phi",21, -0, 2*TMath::Pi());
\r
98 vm->AddVariable("charge");
\r
99 vm->AddVariable("source");
\r
100 vm->AddVariable("centrality");
\r
102 // Determine the centrality estimator
\r
103 task->SetCentralityEstimator("V0A");
\r
104 if (icent == 2) task->SetCentralityEstimator("V0M");
\r
105 else if (icent == 3) task->SetCentralityEstimator("CL1");
\r
106 else if (icent == 4) task->SetCentralityEstimator("ZNA");
\r
108 // For the moment, remove the part dedicated to the background subtraction.
\r
109 // It will be implemented in a different way, reading it from a root file.
\r
112 //***************************************//
\r
113 // Configure the PID //
\r
114 //***************************************//
\r
117 AliHFEpid *pid = task->GetPID();
\r
118 if(useMC) pid->SetHasMCData(kTRUE);
\r
121 pid->AddDetector("TOF", 0);
\r
122 pid->AddDetector("TPC", 1);
\r
124 pid->AddDetector("TPC", 0);
\r
127 // Configure TPC PID
\r
129 Double_t paramsTPCdEdxcutlow[12] ={0.0, 0.0, 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0};
\r
130 if(tpcdEdxcutlow) memcpy(paramsTPCdEdxcutlow,tpcdEdxcutlow,sizeof(paramsTPCdEdxcutlow));
\r
132 Double_t paramsTPCdEdxcuthigh[12] ={3.0, 3.0, 3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0};
\r
133 if(tpcdEdxcuthigh) memcpy(paramsTPCdEdxcuthigh,tpcdEdxcuthigh,sizeof(paramsTPCdEdxcuthigh));
\r
138 for(Int_t a=0;a<11;a++)
\r
140 // cout << a << " " << paramsTPCdEdxcut[a] << endl;
\r
141 Double_t tpcparamlow[1]={paramsTPCdEdxcutlow[a]};
\r
142 Float_t tpcparamhigh=paramsTPCdEdxcuthigh[a];
\r
143 pid->ConfigureTPCcentralityCut(a,cutmodel,tpcparamlow,tpcparamhigh);
\r
147 // Configure TOF PID
\r
149 pid->ConfigureTOF(TOFs);
\r
150 AliHFEpidTOF *tofpid = pid->GetDetPID(AliHFEpid::kTOFpid);
\r
152 tofpid->SetRejectTOFmismatch();
\r
156 // To make different upper TOF cut to see contamination effect
\r
157 // The below two lines should be removed after this check
\r
158 //AliHFEpidTOF *tofpid = pid->GetDetPID(AliHFEpid::kTOFpid);
\r
159 //if(TOFs<3.) tofpid->SetTOFnSigmaBand(-3,TOFs); //only to check the assymmetric tof cut
\r
161 // Load hadron background
\r
163 Bool_t status = kTRUE;
\r
164 TF1 *hBackground[12];
\r
165 status = ReadContaminationFunctions("hadronContamination_pPbTPCTOF_forwardEta.root", hBackground, tpcdEdxcutlow[0]);
\r
166 for(Int_t a=0;a<12;a++) {
\r
167 // printf("back %f \n",p0[a]);
\r
168 if(status) task->SetBackGroundFactorsFunction(hBackground[a],a);
\r
169 else printf("not all background functions found\n");
\r
173 //***************************************//
\r
174 // Configure NPE plugin //
\r
175 //***************************************//
\r
177 AliHFENonPhotonicElectron *backe = new AliHFENonPhotonicElectron(Form("HFEBackGroundSubtractionPID2%s",appendix.Data()),"Background subtraction"); //appendix
\r
178 if(isAOD) backe->SetAOD(kTRUE);
\r
179 //Setting the Cuts for the Associated electron-pool
\r
180 AliHFEcuts *hfeBackgroundCuts = new AliHFEcuts(Form("HFEBackSub%s",appendix.Data()),"Background sub Cuts");
\r
181 hfeBackgroundCuts->SetEtaRange(assETA);
\r
182 hfeBackgroundCuts->SetPtRange(0.1,1e10);
\r
184 hfeBackgroundCuts->SetMaxChi2perClusterTPC(4);
\r
185 hfeBackgroundCuts->SetMinNClustersITS(assITS);
\r
186 hfeBackgroundCuts->SetMinNClustersTPC(assTPCcl);
\r
187 hfeBackgroundCuts->SetMinNClustersTPCPID(assTPCPIDcl);
\r
188 if(isAOD) hfeBackgroundCuts->SetAODFilterBit(4);
\r
189 hfeBackgroundCuts->SetQAOn(); // QA
\r
191 AliHFEpid *pidbackground = backe->GetPIDBackground();
\r
192 if(useMC) pidbackground->SetHasMCData(kTRUE);
\r
193 pidbackground->AddDetector("TPC", 0);
\r
194 Double_t paramsTPCdEdxcutlowAssoc[12] ={-3.0,-3.0,-3.0,-3.0,-3.0,-3.0,-3.0,-3.0,-3.0,-3.0,-3.0,-3.0};
\r
195 if(assTPCSminus) memcpy(paramsTPCdEdxcutlowAssoc,assTPCSminus,sizeof(paramsTPCdEdxcutlowAssoc));
\r
197 Double_t paramsTPCdEdxcuthighAssoc[12] ={3.0, 3.0, 3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0};
\r
198 if(assTPCSplus) memcpy(paramsTPCdEdxcuthighAssoc,assTPCSplus,sizeof(paramsTPCdEdxcuthighAssoc));
\r
200 char *cutmodelAssoc;
\r
201 cutmodelAssoc="pol0";
\r
202 for(Int_t a=0;a<11;a++)
\r
204 // cout << a << " " << paramsTPCdEdxcut[a] << endl;
\r
205 Double_t tpcparamlow[1]={paramsTPCdEdxcutlowAssoc[a]};
\r
206 Float_t tpcparamhigh=paramsTPCdEdxcuthighAssoc[a];
\r
207 pidbackground->ConfigureTPCcentralityCut(a,cutmodelAssoc,tpcparamlow,tpcparamhigh);
\r
209 //backe->GetPIDBackgroundQAManager()->SetHighResolutionHistos();
\r
210 backe->SetHFEBackgroundCuts(hfeBackgroundCuts);
\r
212 task->SetHFEBackgroundSubtraction(backe);
\r
214 //***************************************//
\r
215 // V0 tagged tracks //
\r
216 //***************************************//
\r
218 if(kAnalyseTaggedTracks){
\r
219 AliHFEcuts *v0trackCuts = new AliHFEcuts("V0trackCuts", "Track Cuts for tagged track Analysis");
\r
220 v0trackCuts->CreateStandardCuts();
\r
221 v0trackCuts->SetMinNClustersTPC(TPCcl);
\r
222 v0trackCuts->SetMinRatioTPCclusters(0.6);
\r
223 v0trackCuts->SetTPCmodes(AliHFEextraCuts::kFound, AliHFEextraCuts::kFoundOverFindable);
\r
224 v0trackCuts->SetMinNClustersITS(1);
\r
225 v0trackCuts->SetCutITSpixel(AliHFEextraCuts::kFirst);
\r
226 v0trackCuts->SetCheckITSLayerStatus(kFALSE);
\r
227 v0trackCuts->UnsetVertexRequirement();
\r
228 //hfecuts->SetSigmaToVertex(10);
\r
229 v0trackCuts->SetTOFPIDStep(kTRUE);
\r
230 v0trackCuts->SetQAOn();
\r
232 task->SwitchOnPlugin(AliAnalysisTaskHFE::kTaggedTrackAnalysis);
\r
233 task->SetTaggedTrackCuts(v0trackCuts);
\r
234 task->SetCleanTaggedTrack(kTRUE);
\r
238 printf("task %p\n", task);
\r
239 task->SetQAOn(AliAnalysisTaskHFE::kPIDqa);
\r
240 task->SetQAOn(AliAnalysisTaskHFE::kMCqa);
\r
241 task->SwitchOnPlugin(AliAnalysisTaskHFE::kNonPhotonicElectron);
\r
242 task->SwitchOnPlugin(AliAnalysisTaskHFE::kDEstep);
\r
244 printf("*************************************\n");
\r
245 printf("Configuring standard Task:\n");
\r
246 task->PrintStatus();
\r
247 pid->PrintStatus();
\r
248 printf("*************************************\n");
\r