]>
Commit | Line | Data |
---|---|---|
896d3200 | 1 | #ifndef __CINT__ |
2 | #include <AliRsnCutTrackQuality.h> | |
3 | #endif | |
4 | Int_t AddRsnDaughterCutsPhiNsigma(AliPID::EParticleType type1,AliPID::EParticleType type2,TString opt,AliRsnInputHandler *rsnIH=0,AliAnalysisTaskSE *task=0) | |
5 | { | |
6 | ||
7 | if (!rsnIH) return 0; | |
8 | ||
9 | Bool_t valid = kTRUE; | |
10 | // Int_t collisionType = AliRsnTrainManager::GetGlobalInt("IsCollisionType",valid); | |
11 | Int_t useCommonQualityCut = AliRsnTrainManager::GetGlobalInt("RsnCommonQualityCut",valid); | |
12 | TString rsnQualityCut = AliRsnTrainManager::GetGlobalStr("RsnQualityCut",valid); | |
13 | Int_t isMC = AliRsnTrainManager::GetGlobalInt("IsMC",valid); | |
14 | Int_t isRsnMini = AliRsnTrainManager::GetGlobalInt("IsRsnMini",valid); | |
15 | Int_t isMixing = AliRsnTrainManager::GetGlobalInt("IsMixing",valid); | |
16 | ||
17 | // experts only (don't touch) | |
18 | Int_t isRsnDev = AliAnalysisManager::GetGlobalInt("rsnUseRSNParDev",valid); | |
19 | ||
20 | // === USER HAS TO SET CORRECT NUMBER OF CUTS SETS ===== | |
21 | Int_t numberOfCuts = 1; | |
22 | ||
23 | //--------------------------------------------- | |
24 | // Define single cuts | |
25 | //--------------------------------------------- | |
26 | ||
27 | Printf("AliRsnCutPIDNSigma Option : %s",opt.Data()); | |
28 | ||
29 | Double_t nSigmaTPC=3.0; | |
30 | Double_t nSigmaTOF=3.0; | |
31 | Double_t etaMin=-0.8; | |
32 | Double_t etaMax=0.8; | |
33 | Double_t trackPtMin=0.; | |
34 | Double_t trackPtMax=1.e10; | |
35 | Int_t NclTPC=70; | |
36 | Char_t DCAxyFormula[100]="0.0182+0.035/pt^1.01"; | |
37 | ||
38 | Bool_t useTPC_K=kFALSE; | |
39 | Bool_t useTOF_K=kFALSE; | |
40 | Bool_t rejectUnmatchedTOF_K=kTRUE; | |
41 | Bool_t useTrackPtCut=kFALSE; | |
42 | ||
43 | if (opt.Contains("qualityonly")) { | |
44 | useTPC_K=kFALSE; | |
45 | useTOF_K=kFALSE; | |
46 | } | |
47 | ||
48 | if (opt.Contains("KTPCnsig")) useTPC_K=kTRUE; | |
49 | if (opt.Contains("KTOFnsig")) useTOF_K=kTRUE; | |
50 | if (opt.Contanns("KTOFacceptUnmatched")) rejectUnmatchedTOF_K=kFALSE; | |
51 | ||
52 | if (opt.Contains("KTPCnsig05")) nSigmaTPC = 0.5; | |
53 | if (opt.Contains("KTPCnsig08")) nSigmaTPC = 0.8; | |
54 | if (opt.Contains("KTPCnsig10")) nSigmaTPC = 1.0; | |
55 | if (opt.Contains("KTPCnsig15")) nSigmaTPC = 1.5; | |
56 | if (opt.Contains("KTPCnsig20")) nSigmaTPC = 2.0; | |
57 | if (opt.Contains("KTPCnsig25")) nSigmaTPC = 2.5; | |
58 | if (opt.Contains("KTPCnsig30")) nSigmaTPC = 3.0; | |
59 | if (opt.Contains("KTPCnsig40")) nSigmaTPC = 4.0; | |
60 | if (opt.Contains("KTPCnsig50")) nSigmaTPC = 5.0; | |
61 | if (opt.Contains("KTPCnsig1000")) nSigmaTPC = 100.0; | |
62 | ||
63 | if (opt.Contains("KTOFnsig10")) nSigmaTOF = 1.0; | |
64 | if (opt.Contains("KTOFnsig15")) nSigmaTOF = 1.5; | |
65 | if (opt.Contains("KTOFnsig20")) nSigmaTOF = 2.0; | |
66 | if (opt.Contains("KTOFnsig25")) nSigmaTOF = 2.5; | |
67 | if (opt.Contains("KTOFnsig30")) nSigmaTOF = 3.0; | |
68 | if (opt.Contains("KTOFnsig40")) nSigmaTOF = 4.0; | |
69 | if (opt.Contains("KTOFnsig50")) nSigmaTOF = 5.0; | |
70 | if (opt.Contains("KTOFnsig1000")) nSigmaTOF = 100.0; | |
71 | ||
72 | if (opt.Contains("trackPt")) { | |
73 | useTrackPtCut = kTRUE; | |
74 | if (opt.Contains("trackPtMin015")) trackPtMin = 0.15; | |
75 | if (opt.Contains("trackPtMin02")) trackPtMin = 0.2; | |
76 | if (opt.Contains("trackPtMin05")) trackPtMin = 0.5; | |
77 | if (opt.Contains("trackPtMin06")) trackPtMin = 0.6; | |
78 | ||
79 | if (opt.Contains("trackPtMax18")) trackPtMax = 1.8; | |
80 | if (opt.Contains("trackPtMax20")) trackPtMax = 2.0; | |
81 | if (opt.Contains("trackPtMax25")) trackPtMax = 2.5; | |
82 | } | |
83 | ||
84 | Bool_t usePDG=kFALSE; | |
85 | if (opt.Contains("pdg")) { | |
86 | Printf("Using PDG"); | |
87 | usePDG = kTRUE; | |
88 | } | |
89 | ||
90 | Bool_t useEta = kFALSE; | |
91 | if (opt.Contains("eta")) { | |
92 | for(int j=1;j<=9;j++) if(opt.Contains(Form("eta0%i",j))){etaMin=-0.1*j; etaMax=0.1*j;} | |
93 | ||
94 | for(int j=1;j<=9;j++) if(opt.Contains(Form("etaMinMinus0%i",j))) etaMin=-0.1*j; | |
95 | if(opt.Contains("etaMin00")) etaMin=0.; | |
96 | for(int j=1;j<=9;j++) if(opt.Contains(Form("etaMinPlus0%i",j))) etaMin=0.1*j; | |
97 | ||
98 | for(int j=1;j<=9;j++) if(opt.Contains(Form("etaMaxMinus0%i",j))) etaMax=-0.1*j; | |
99 | if(opt.Contains("etaMax00")) etaMax=0.; | |
100 | for(int j=1;j<=9;j++) if(opt.Contains(Form("etaMaxPlus0%i",j))) etaMax=0.1*j; | |
101 | ||
102 | Printf("Using ETA range (%.2f,%.2f)",etaMin,etaMax); | |
103 | useEta = kTRUE; | |
104 | } | |
105 | ||
106 | Bool_t useNclTPC = kFALSE; | |
107 | if (opt.Contains("NclTPC")) { | |
108 | if (opt.Contains("NclTPC70")) NclTPC=70; | |
109 | if (opt.Contains("NclTPC75")) NclTPC=75; | |
110 | if (opt.Contains("NclTPC80")) NclTPC=80; | |
111 | if (opt.Contains("NclTPC85")) NclTPC=85; | |
112 | if (opt.Contains("NclTPC90")) NclTPC=90; | |
113 | useNclTPC = kTRUE; | |
114 | } | |
115 | ||
116 | Bool_t useDCAxy = kFALSE; | |
117 | if (opt.Contains("DCAxy")) { | |
118 | if (opt.Contains("DCAxyFormula7s")) sprintf(DCAxyFormula,"0.0182+0.035/pt^1.01"); | |
119 | if (opt.Contains("DCAxyFormula6s")) sprintf(DCAxyFormula,"0.0156+0.03/pt^1.01"); | |
120 | if (opt.Contains("DCAxyFormula5s")) sprintf(DCAxyFormula,"0.013+0.025/pt^1.01"); | |
121 | useDCAxy = kTRUE; | |
122 | } | |
123 | ||
124 | //--------------------------------------------- | |
125 | // Combine cuts | |
126 | //--------------------------------------------- | |
127 | ||
128 | TString cutname = "K_Phi"; | |
129 | if (!opt.IsNull()) cutname += Form("_%s",opt.Data()); | |
130 | AliRsnCutSet *cuts = new AliRsnCutSet(cutname.Data(), AliRsnTarget::kDaughter); | |
131 | ||
132 | TString scheme=""; | |
133 | AliRsnCutTrackQuality *qualityCut = new AliRsnCutTrackQuality("cutQualityK"); | |
134 | if (!rsnQualityCut.IsNull()) { | |
135 | AliESDtrackCuts *esdTK = RsnQualityCut(rsnQualityCut.Data()); | |
136 | if(useDCAxy) esdTK->SetMaxDCAToVertexXYPtDep(DCAxyFormula); | |
137 | qualityCut->SetESDtrackCuts(esdTK); | |
138 | } else { | |
139 | if (useCommonQualityCut>=0) { | |
140 | qualityCut->SetAODTestFilterBit(useCommonQualityCut); | |
141 | if(useDCAxy) {qualityCut->SetCheckOnlyFilterBit(kFALSE); qualityCut->SetDCARPtFormula(DCAxyFormula);} | |
142 | } else { | |
143 | qualityCut->SetDefaults2010(); | |
144 | if(useDCAxy) qualityCut->SetDCARPtFormula(DCAxyFormula); | |
145 | } | |
146 | } | |
147 | ||
148 | cuts->AddCut(qualityCut); | |
149 | if (!scheme.IsNull()) scheme += "&"; | |
150 | scheme += qualityCut->GetName(); | |
151 | ||
152 | ||
153 | if (useTPC_K) { | |
154 | AliRsnCutPIDNSigma *cutKTPC = new AliRsnCutPIDNSigma("cutPIDNSigmaTPCK",AliPID::kKaon,AliRsnCutPIDNSigma::kTPC); | |
155 | cutKTPC->SinglePIDRange(nSigmaTPC); | |
156 | cuts->AddCut(cutKTPC); | |
157 | if (!scheme.IsNull()) scheme += "&"; | |
158 | scheme += cutKTPC->GetName(); | |
159 | } | |
160 | ||
161 | if (useTOF_K) { | |
162 | AliRsnCutPIDNSigma *cutKTOF = new AliRsnCutPIDNSigma("cutPIDNSigmaTOFK",AliPID::kKaon,AliRsnCutPIDNSigma::kTOF); | |
163 | cutKTOF->SinglePIDRange(nSigmaTOF); | |
164 | if(rejectUnmatchedTOF_K){ | |
165 | cuts->AddCut(cutKTOF); | |
166 | if (!scheme.IsNull()) scheme += "&"; | |
167 | scheme += cutKTOF->GetName(); | |
168 | }else{ | |
169 | AliRsnCutTOFMatch *cutTOFMatch = new AliRsnCutTOFMatch("cutTOFMatch"); | |
170 | cuts->AddCut(cutTOFMatch); | |
171 | if (!scheme.IsNull()) scheme += "&"; | |
172 | scheme += Form("(%s|(!%s))",cutKTOF->GetName(),cutTOFMatch->GetName()); | |
173 | } | |
174 | } | |
175 | ||
176 | if (useEta) { | |
177 | Printf("Adding ETA ..."); | |
178 | AliRsnValueDaughter *valEta = new AliRsnValueDaughter(Form("val%sETA%s",AliPID::ParticleName(type1),opt.Data()),AliRsnValueDaughter::kEta); | |
179 | AliRsnCutValue *cutEta = new AliRsnCutValue(Form("cut%sETA%s",AliPID::ParticleName(type1),opt.Data()),etaMin,etaMax); | |
180 | cutEta->SetTargetType(AliRsnTarget::kDaughter); | |
181 | cutEta->SetValueObj(valEta); | |
182 | cuts->AddCut(cutEta); | |
183 | if (!scheme.IsNull()) scheme += "&"; | |
184 | scheme += cutEta->GetName(); | |
185 | } | |
186 | ||
187 | if (useTrackPtCut) { | |
188 | Printf("Adding Pt min=%.3f max=%.3f ...",trackPtMin,trackPtMax); | |
189 | AliRsnValueDaughter *valTrackPt = new AliRsnValueDaughter(Form("val%sTrackPt%s",AliPID::ParticleName(type1),opt.Data()),AliRsnValueDaughter::kPt); | |
190 | ||
191 | AliRsnCutValue *cutTrackPt = new AliRsnCutValue(Form("cut%sTrackPt%s",AliPID::ParticleName(type1),opt.Data()),trackPtMin,trackPtMax); | |
192 | cutTrackPt->SetTargetType(AliRsnTarget::kDaughter); | |
193 | cutTrackPt->SetValueObj(valTrackPt); | |
194 | cuts->AddCut(cutTrackPt); | |
195 | if (!scheme.IsNull()) scheme += "&"; | |
196 | scheme += cutTrackPt->GetName(); | |
197 | } | |
198 | ||
199 | if (useNclTPC) { | |
200 | Printf("Adding NclTPC >= %i",NclTPC); | |
201 | AliRsnValueDaughter *valNclTPC = new AliRsnValueDaughter(Form("val%sNclTPC%s",AliPID::ParticleName(type1),opt.Data()),AliRsnValueDaughter::kNTPCclusters); | |
202 | AliRsnCutValue *cutNclTPC = new AliRsnCutValue(Form("cut%sNclTPC%s",AliPID::ParticleName(type1),opt.Data()),NclTPC-0.1,1000.); | |
203 | cutNclTPC->SetTargetType(AliRsnTarget::kDaughter); | |
204 | cutNclTPC->SetValueObj(valNclTPC); | |
205 | cuts->AddCut(cutNclTPC); | |
206 | if (!scheme.IsNull()) scheme += "&"; | |
207 | scheme += cutNclTPC->GetName(); | |
208 | } | |
209 | ||
210 | if (usePDG) { | |
211 | Printf("Adding PDG ..."); | |
212 | AliRsnCutPID *cutPDG = new AliRsnCutPID(Form("cut%sPDG%s",AliPID::ParticleName(type1),opt.Data()),type1,0.0,kTRUE); | |
213 | cuts->AddCut(cutPDG); | |
214 | if (!scheme.IsNull()) scheme += "&"; | |
215 | scheme += cutPDG->GetName(); | |
216 | } | |
217 | ||
218 | Printf ("CUT Scheme is '%s'",scheme.Data()); | |
219 | cuts->SetCutScheme(scheme.Data()); | |
220 | ||
221 | if (opt.Contains("mon")) { | |
222 | AddMonitorOutput(cuts->GetMonitorOutput(),opt); | |
223 | } | |
224 | if (isRsnMini) { | |
225 | AliRsnMiniAnalysisTask *taskRsnMini = (AliRsnMiniAnalysisTask *)task; | |
226 | if (taskRsnMini) { | |
227 | taskRsnMini->AddTrackCuts(cuts); | |
228 | } | |
229 | } else { | |
230 | AliRsnDaughterSelector *sel = rsnIH->GetSelector(); | |
231 | // sel->SetLabelCheck(kFALSE); | |
232 | sel->Add(cuts, kTRUE); | |
233 | if (isRsnDev>=0 && opt.Contains("pairPID")) { | |
234 | AliRsnActPostDaughterSelection *pairPID = new AliRsnActPostDaughterSelection(); | |
235 | pairPID->SetID(0); | |
236 | ||
237 | const char *fn="rsnRange.txt"; | |
238 | if (!gSystem->AccessPathName(fn)) { | |
239 | TString minStr = gSystem->GetFromPipe(TString::Format("head -n 1 %s").Data()); | |
240 | TString maxStr = gSystem->GetFromPipe(TString::Format("tail -n 1 %s").Data()); | |
241 | pairPID->SetMass(minStr.Atof(),maxStr.Atof()); | |
242 | } else { | |
243 | // pairPID->SetMass(1.01,1.03); | |
244 | pairPID->SetMass(1.015,1.025); | |
245 | pairPID->SetMass(1.019,1.021); | |
246 | pairPID->SetMass(1.0195,1.0205); | |
247 | pairPID->SetMass(1.1000,1.1005); | |
248 | // pairPID->SetMass(1.1005,1.1010); | |
249 | } | |
250 | sel->AddAction(pairPID); | |
251 | } | |
252 | ||
253 | } | |
254 | return numberOfCuts; | |
255 | ||
256 | } |