]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGHF/hfe/macros/configs/pPb/ConfigHFEpPbTRD.C
update of TRD stuff
[u/mrichter/AliRoot.git] / PWGHF / hfe / macros / configs / pPb / ConfigHFEpPbTRD.C
CommitLineData
7a35b7aa 1Bool_t ReadContaminationFunctions(TString filename, TF1 **functions, double sigma){
2 TFile *in = TFile::Open(Form("$ALICE_ROOT/PWGHF/hfe/macros/configs/pPb/%s", filename.Data()));
3 gROOT->cd();
4 int isig = static_cast<int>(sigma * 100.);
5 printf("Getting hadron background for the sigma cut: %d\n", isig);
6 bool status = kTRUE;
7 for(int icent = 0; icent < 12; icent++){
8 functions[icent] = dynamic_cast<TF1 *>(in->Get(Form("hback_%d_%d", isig, icent)));
9 if(functions[icent])
10 {
11// new TCanvas;
12// functions[0]->Draw();
13 printf("Config for centrality class %d found\n", icent);
14 }
15 else{
16 printf("Config for the centrality class %d not found\n", icent);
17 status = kFALSE;
18 }
19 }
20 delete in;
21 return status;
22}
23
24AliAnalysisTaskHFE* ConfigHFEpPbTRD(Bool_t useMC, Bool_t isAOD, TString appendix,
25 UChar_t TPCcl=70, UChar_t TPCclPID = 80,
26 UChar_t ITScl=3, Double_t DCAxy=1000., Double_t DCAz=1000.,
27 Double_t* tpcdEdxcutlow=NULL,Double_t* tpcdEdxcuthigh=NULL,
28 Double_t TOFs=3., Int_t TOFmis=0,
29 Int_t itshitpixel = 0, Int_t icent=1,
30 Double_t etami=-0.8, Double_t etama=0.8,
31 Int_t TRDtrigger=1, Int_t TRDtl=6, Int_t TRDeff=4,
32 TString detector){
33
34 Bool_t kAnalyseTaggedTracks = kFALSE;
35
36 // TRD settings
37 Float_t eeff[6] = {0.7, 0.75, 0.8, 0.85, 0.9, 0.95};
38 Int_t eeffint[6] = {70, 75, 80, 85, 90, 95};
39 // if(TRDeff >= 6 || TRDtl < 4 || TRDtl > 6) return NULL;
40 if(TRDeff >= 6 || TRDtl > 6) return NULL;
41 printf("TRD settings: %i %f \n",TRDtl, eeff[TRDeff]);
42
43 //***************************************//
44 // Setting up the HFE cuts //
45 //***************************************//
46
47 AliHFEcuts *hfecuts = new AliHFEcuts(appendix,"HFE cuts for pPb with TRD");
48
49 // hfecuts->SetQAOn();
50 hfecuts->CreateStandardCuts();
51 hfecuts->SetMinNClustersTPC(TPCcl);
52 hfecuts->SetMinNClustersTPCPID(TPCclPID);
53 hfecuts->SetMinNClustersITS(ITScl);
54 hfecuts->SetMinRatioTPCclusters(0.6);
55 hfecuts->SetTPCmodes(AliHFEextraCuts::kFound, AliHFEextraCuts::kFoundOverFindable);
56 hfecuts->SetCutITSpixel(itshitpixel);
57 hfecuts->SetCheckITSLayerStatus(kFALSE);
58// hfecuts->SetEtaRange(etami,etama);
59 if(TRDtl>0) hfecuts->SetMinNTrackletsTRD(TRDtl, kTRUE); // number of trd tracklets
60 if(isAOD) hfecuts->SetAODFilterBit(4);
61
62 //if((iPixelAny==AliHFEextraCuts::kAny) || (iPixelAny==AliHFEextraCuts::kSecond))
63 //hfecuts->SetProductionVertex(0,7,0,7);
64
65 hfecuts->SetMaxImpactParam(DCAxy,DCAz);
66 hfecuts->SetUseMixedVertex(kTRUE);
67 hfecuts->SetVertexRange(10.);
68 // New pPb cuts (February 2013)
69 hfecuts->SetUseCorrelationVertex();
70 hfecuts->SetSPDVtxResolutionCut();
71 hfecuts->SetpApileupCut();
72
73 // TOF settings:
74 Int_t usetof=0;
75 Bool_t kTOFmis=kFALSE;
76 if (TOFs>0.){
77 usetof = 1;
78 printf("CONFIGURATION FILE: TOF is used \n");
79 hfecuts->SetTOFPIDStep(kTRUE);
80 printf("CONFIGURATION FILE: TOF PID step is requested !!!! \n");
81 if (TOFmis>0){
82 kTOFmis = kTRUE;
83 printf("CONFIGURATION FILE: TOF mismatch rejection is set ON \n");
84 }
85 }
86
87 //***************************************//
88 // Setting up the task //
89 //***************************************//
90
91 AliAnalysisTaskHFE *task = new AliAnalysisTaskHFE(appendix);
92 printf("task %p\n", task);
93 task->SetpPbAnalysis();
94 if(!isAOD) task->SetRemoveFirstEventInChunk();
95 task->SetRemovePileUp(kFALSE);
96 task->SetHFECuts(hfecuts);
97 task->GetPIDQAManager()->SetHighResolutionHistos();
98
99 // Determine the centrality estimator
100 task->SetCentralityEstimator("V0A");
101 if (icent == 2) task->SetCentralityEstimator("V0M");
102 else if (icent == 3) task->SetCentralityEstimator("CL1");
103 else if (icent == 4) task->SetCentralityEstimator("ZNA");
104
105 Bool_t activateTRDTrigger=kFALSE;
106 if(TRDtrigger>0) activateTRDTrigger=kTRUE;
107 task->SetTRDTrigger(activateTRDTrigger,TRDtrigger);
108
109 //***************************************//
110 // Variable manager //
111 //***************************************//
112 // Define Variables
113 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.};
114 //Double_t ptbinning[53] = {0., 0.1, 0.2, 0.22, 0.24, 0.26, 0.28, 0.3, 0.32, 0.34, 0.36, 0.38, 0.4, 0.42, 0.44, 0.46, 0.48, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 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.};
115
116 //Double_t etabinning[9] = {-0.8, -0.6, -0.4, -0.2, 0., 0.2, 0.4, 0.6, 0.8};
117 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};
118 //Double_t etabinning[33] = {-0.8,-0.75,-0.7,-0.65,-0.6,-0.55,-0.5,-0.45,-0.4,-0.35,-0.3,-0.25,-0.2,-0.15,-0.1,-0.05,
119 //0.,0.05,0.1,0.15,0.2,0.25,0.3,0.35,0.4,0.45,0.5,0.55,0.6,0.65,0.7,0.75,0.8};
120
121 Int_t sizept=(sizeof(ptbinning)/sizeof(double))-1;
122 Int_t sizeeta=(sizeof(etabinning)/sizeof(double))-1;
123
124 AliHFEvarManager *vm = task->GetVarManager();
125 vm->AddVariable("pt", sizept, ptbinning);
126 vm->AddVariable("eta", sizeeta, -0.8,0.8);
127 vm->AddVariable("phi",21, -0, 2*TMath::Pi());
128 vm->AddVariable("charge");
129 vm->AddVariable("source");
130 vm->AddVariable("centrality");
131
132 // For the moment, remove the part dedicated to the background subtraction.
133 // It will be implemented in a different way, reading it from a root file.
134
135 //***************************************//
136 // Configure the PID //
137 //***************************************//
138
139 // Define PID
140 AliHFEpid *pid = task->GetPID();
141 if(useMC) pid->SetHasMCData(kTRUE);
142 pid->SetDetectorsForAnalysis(detector);
143
144 // Configure TPC PID
145 // do the identical thing in data and MC
146 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};
147 if(tpcdEdxcutlow) memcpy(paramsTPCdEdxcutlow,tpcdEdxcutlow,sizeof(paramsTPCdEdxcutlow));
148
149 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};
150 if(tpcdEdxcuthigh) memcpy(paramsTPCdEdxcuthigh,tpcdEdxcuthigh,sizeof(paramsTPCdEdxcuthigh));
151
152 char *cutmodel;
153 cutmodel="pol0";
154
155 for(Int_t a=0;a<11;a++)
156 {
157 // cout << a << " " << paramsTPCdEdxcut[a] << endl;
158 Double_t tpcparamlow[1]={paramsTPCdEdxcutlow[a]};
159 Float_t tpcparamhigh=paramsTPCdEdxcuthigh[a];
160 pid->ConfigureTPCcentralityCut(a,cutmodel,tpcparamlow,tpcparamhigh);
161 }
162 pid->ConfigureTPCdefaultCut(cutmodel,paramsTPCdEdxcutlow,paramsTPCdEdxcuthigh[0]);
163
164
165
166 // Apply eta correction
167 AliHFEpidTPC *tpcpid = pid->GetDetPID(AliHFEpid::kTPCpid);
168 // Setting to cut on absolute dEdx (not sigma)
169 //tpcpid->UsedEdx();
170 //TF1 *etacorrection = GetEtaCorrection();
171 //if(etacorrection) tpcpid->SetEtaCorrection(etacorrection);
172
173 // Configure TOF PID
174 if (usetof){
175 pid->ConfigureTOF(TOFs);
176 AliHFEpidTOF *tofpid = pid->GetDetPID(AliHFEpid::kTOFpid);
177 if (kTOFmis){
178 tofpid->SetRejectTOFmismatch();
179 }
180 }
181
182 // To make different upper TOF cut to see contamination effect
183 // The below two lines should be removed after this check
184 //AliHFEpidTOF *tofpid = pid->GetDetPID(AliHFEpid::kTOFpid);
185 //if(TOFs<3.) tofpid->SetTOFnSigmaBand(-3,TOFs); //only to check the assymmetric tof cut
186
187 if(TRDtl>0){
188 AliHFEpidTRD *trdpid = pid->GetDetPID(AliHFEpid::kTRDpid);
189 trdpid->SetTRD2DPID();
190 trdpid->SetElectronEfficiency(eeff[TRDeff]); // efficiency
191 trdpid->SetNTracklets(TRDtl); // ntracklets threshold
192 trdpid->SetCutNTracklets(TRDtl, kTRUE);
193 }
194
195
196 // Load hadron background
197 if(!useMC){
198 Bool_t status = kTRUE;
199 TF1 *hBackground[12];
200 //status = ReadContaminationFunctions("hadronContamination_pPbTPCTOF_forwardEta.root", hBackground, tpcdEdxcutlow[0]);
201 //status = ReadContaminationFunctions("hadronContamination_pPbTPCTOF_eta66.root", hBackground, tpcdEdxcutlow[0]);
202 if(TRDtl==5){
203 status = ReadContaminationFunctions("hadroncontamination_TRDTPC_pPb_eta06_5tracklets.root", hBackground, tpcdEdxcutlow[0]);
204 printf("hadroncont5tracklets \n");
205 }
206 if(TRDtl==6)
207 {
208 status = ReadContaminationFunctions("hadroncontamination_TRDTPC_pPb_eta06_6tracklets.root", hBackground, tpcdEdxcutlow[0]);
209 printf("hadroncont6tracklets \n");
210 }
211 for(Int_t a=0;a<12;a++) {
212 //printf("back %f \n",hBackground[a]);
213 if(status) task->SetBackGroundFactorsFunction(hBackground[a],a);
214 else printf("not all background functions found\n");
215 }
216 }
217
218 //***************************************//
219 // V0 tagged tracks //
220 //***************************************//
221 if(kAnalyseTaggedTracks){
222 AliHFEcuts *v0trackCuts = new AliHFEcuts("V0trackCuts", "Track Cuts for tagged track Analysis");
223 v0trackCuts->CreateStandardCuts();
224 v0trackCuts->SetMinNClustersTPC(TPCcl);
225 v0trackCuts->SetMinNClustersTPCPID(TPCclPID);
226 v0trackCuts->SetMinRatioTPCclusters(0.6);
227 v0trackCuts->SetTPCmodes(AliHFEextraCuts::kFound, AliHFEextraCuts::kFoundOverFindable);
228 v0trackCuts->SetMinNClustersITS(1);
229 v0trackCuts->SetCutITSpixel(AliHFEextraCuts::kFirst);
230 v0trackCuts->SetCheckITSLayerStatus(kFALSE);
231 v0trackCuts->UnsetVertexRequirement();
232 //hfecuts->SetSigmaToVertex(10);
233 if(usetof) v0trackCuts->SetTOFPIDStep(kTRUE);
234 if(TRDtl>0)v0trackCuts->SetMinNTrackletsTRD(TRDtl,kTRUE); // condition for TRD tracklets
235 v0trackCuts->SetQAOn();
236
237 task->SwitchOnPlugin(AliAnalysisTaskHFE::kTaggedTrackAnalysis);
238 task->SetTaggedTrackCuts(v0trackCuts);
239 task->SetCleanTaggedTrack(kTRUE);
240 }
241
242 // QA
243 printf("task %p\n", task);
244 task->SetQAOn(AliAnalysisTaskHFE::kPIDqa);
245 task->SetQAOn(AliAnalysisTaskHFE::kMCqa);
246 task->SwitchOnPlugin(AliAnalysisTaskHFE::kDEstep);
247
248 printf("*************************************\n");
249 printf("Configuring standard Task:\n");
250 task->PrintStatus();
251 pid->PrintStatus();
252 printf("*************************************\n");
253 return task;
254}