]>
Commit | Line | Data |
---|---|---|
2a14a7b1 | 1 | /************************************************************************* |
2 | * Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | /////////////////////////////////////////////////////////////////////////// | |
17 | // Dielectron EventCuts // | |
18 | // // | |
19 | // // | |
20 | /* | |
21 | Detailed description | |
22 | ||
23 | ||
24 | */ | |
25 | // // | |
26 | /////////////////////////////////////////////////////////////////////////// | |
27 | ||
5720c765 | 28 | |
2a14a7b1 | 29 | #include <AliTriggerAnalysis.h> |
30 | #include <AliESDVertex.h> | |
d327d9cd | 31 | #include <AliAODVertex.h> |
2a14a7b1 | 32 | #include <AliESDEvent.h> |
d327d9cd | 33 | #include <AliAODEvent.h> |
ffbede40 | 34 | #include <AliMultiplicity.h> |
ba15fdfb | 35 | #include <AliCentrality.h> |
90c1ae2d | 36 | #include <AliESDVZERO.h> |
37 | #include <AliAODVZERO.h> | |
2a14a7b1 | 38 | |
99345a64 | 39 | #include "AliDielectronVarManager.h" |
2a14a7b1 | 40 | #include "AliDielectronEventCuts.h" |
41 | ||
42 | ClassImp(AliDielectronEventCuts) | |
43 | ||
1bb1fef1 | 44 | const char* AliDielectronEventCuts::fgkVtxNames[AliDielectronEventCuts::kVtxTracksOrSPD+1] = {"Tracks", "SPD", "TPC", "Any", "TracksOrSPD"}; |
45 | ||
2a14a7b1 | 46 | AliDielectronEventCuts::AliDielectronEventCuts() : |
47 | AliAnalysisCuts(), | |
48 | fVtxZmin(0.), | |
49 | fVtxZmax(0.), | |
50 | fRequireVtx(kFALSE), | |
51 | fMinVtxContributors(0), | |
ffbede40 | 52 | fMultITSTPC(kFALSE), |
ba15fdfb | 53 | fCentMin(1.), |
54 | fCentMax(0.), | |
2a14a7b1 | 55 | fVtxType(kVtxTracks), |
56 | fRequireV0and(0), | |
57 | fTriggerAnalysis(0x0), | |
d327d9cd | 58 | fkVertex(0x0), |
90c1ae2d | 59 | fkVertexAOD(0x0), |
60 | fparMean(0x0), | |
61 | fparSigma(0x0), | |
6bd73568 | 62 | fcutSigma(3.), |
63 | fparMinVtxContributors(0x0), | |
64 | fparMaxVtxContributors(0x0) | |
2a14a7b1 | 65 | { |
66 | // | |
67 | // Default Constructor | |
68 | // | |
69 | ||
70 | } | |
71 | ||
72 | //______________________________________________ | |
73 | AliDielectronEventCuts::AliDielectronEventCuts(const char* name, const char* title) : | |
74 | AliAnalysisCuts(name, title), | |
75 | fVtxZmin(0.), | |
76 | fVtxZmax(0.), | |
77 | fRequireVtx(kFALSE), | |
78 | fMinVtxContributors(0), | |
ffbede40 | 79 | fMultITSTPC(kFALSE), |
ba15fdfb | 80 | fCentMin(1.), |
81 | fCentMax(0.), | |
2a14a7b1 | 82 | fVtxType(kVtxTracks), |
83 | fRequireV0and(0), | |
84 | fTriggerAnalysis(0x0), | |
d327d9cd | 85 | fkVertex(0x0), |
90c1ae2d | 86 | fkVertexAOD(0x0), |
87 | fparMean(0x0), | |
88 | fparSigma(0x0), | |
6bd73568 | 89 | fcutSigma(3.), |
90 | fparMinVtxContributors(0x0), | |
91 | fparMaxVtxContributors(0x0) | |
2a14a7b1 | 92 | { |
93 | // | |
94 | // Named Constructor | |
95 | // | |
96 | } | |
97 | ||
98 | //______________________________________________ | |
99 | AliDielectronEventCuts::~AliDielectronEventCuts() | |
100 | { | |
101 | // | |
102 | // Default Destructor | |
103 | // | |
104 | if (fTriggerAnalysis) delete fTriggerAnalysis; | |
105 | } | |
106 | ||
107 | //______________________________________________ | |
108 | Bool_t AliDielectronEventCuts::IsSelected(TObject* event) | |
109 | { | |
110 | // | |
111 | // check the cuts | |
112 | // | |
113 | ||
d327d9cd | 114 | if(event->IsA() == AliESDEvent::Class()) return IsSelectedESD(event); |
115 | else if(event->IsA() == AliAODEvent::Class()) return IsSelectedAOD(event); | |
116 | else return kFALSE; | |
117 | } | |
118 | //____________________________________________________________________ | |
119 | Bool_t AliDielectronEventCuts::IsSelectedESD(TObject* event) | |
120 | { | |
121 | // | |
122 | // check the cuts | |
123 | // | |
124 | ||
2a14a7b1 | 125 | AliESDEvent *ev=dynamic_cast<AliESDEvent*>(event); |
126 | if (!ev) return kFALSE; | |
127 | ||
ba15fdfb | 128 | if (fCentMin<fCentMax){ |
129 | AliCentrality *centrality=ev->GetCentrality(); | |
130 | Double_t centralityF=-1; | |
131 | if (centrality) centralityF = centrality->GetCentralityPercentile("V0M"); | |
132 | if (centralityF<fCentMin || centralityF>=fCentMax) return kFALSE; | |
133 | } | |
134 | ||
2a14a7b1 | 135 | fkVertex=0x0; |
5720c765 | 136 | |
2a14a7b1 | 137 | switch(fVtxType){ |
1201a1a9 | 138 | case kVtxTracks: |
139 | case kVtxTracksOrSPD: | |
140 | fkVertex=ev->GetPrimaryVertexTracks(); | |
141 | break; | |
2a14a7b1 | 142 | case kVtxSPD: fkVertex=ev->GetPrimaryVertexSPD(); break; |
143 | case kVtxTPC: fkVertex=ev->GetPrimaryVertexTPC(); break; | |
144 | case kVtxAny: fkVertex=ev->GetPrimaryVertex(); break; | |
145 | } | |
146 | ||
147 | if ((fRequireVtx||fVtxZmin<fVtxZmax||fMinVtxContributors>0)&&!fkVertex) return kFALSE; | |
148 | ||
2a14a7b1 | 149 | |
150 | if (fMinVtxContributors>0){ | |
151 | Int_t nCtrb = fkVertex->GetNContributors(); | |
ba15fdfb | 152 | if (nCtrb<fMinVtxContributors){ |
153 | if (fVtxType==kVtxTracksOrSPD){ | |
154 | fkVertex=ev->GetPrimaryVertexSPD(); | |
155 | nCtrb = fkVertex->GetNContributors(); | |
156 | if (nCtrb<fMinVtxContributors) return kFALSE; | |
157 | } else { | |
158 | return kFALSE; | |
159 | } | |
160 | } | |
2a14a7b1 | 161 | } |
162 | ||
ba15fdfb | 163 | if (fVtxZmin<fVtxZmax){ |
164 | Double_t zvtx=fkVertex->GetZv(); | |
165 | if (zvtx<fVtxZmin||zvtx>fVtxZmax) return kFALSE; | |
166 | } | |
167 | ||
2a14a7b1 | 168 | if (fRequireV0and){ |
169 | if (!fTriggerAnalysis) fTriggerAnalysis=new AliTriggerAnalysis; | |
170 | Bool_t v0AND = kFALSE; | |
171 | if (fRequireV0and==1){ | |
172 | Bool_t v0A = fTriggerAnalysis->IsOfflineTriggerFired(ev, AliTriggerAnalysis::kV0A); | |
173 | Bool_t v0C = fTriggerAnalysis->IsOfflineTriggerFired(ev, AliTriggerAnalysis::kV0C); | |
174 | v0AND = v0A && v0C; | |
175 | } | |
176 | ||
177 | if (fRequireV0and==2){ | |
178 | Bool_t v0AHW = (fTriggerAnalysis->V0Trigger(ev, AliTriggerAnalysis::kASide, kTRUE) == AliTriggerAnalysis::kV0BB); | |
179 | Bool_t v0CHW = (fTriggerAnalysis->V0Trigger(ev, AliTriggerAnalysis::kCSide, kTRUE) == AliTriggerAnalysis::kV0BB); | |
180 | v0AND = v0AHW && v0CHW; | |
181 | } | |
182 | ||
183 | if (!v0AND) return kFALSE; | |
184 | } | |
ffbede40 | 185 | |
186 | if (fMultITSTPC){ | |
187 | const AliESDVertex *vtxESDTPC=ev->GetPrimaryVertexTPC(); | |
188 | const AliMultiplicity *multESD = ev->GetMultiplicity(); | |
189 | if ( vtxESDTPC && multESD && vtxESDTPC->GetNContributors() < (-10.+0.25*multESD->GetNumberOfITSClusters(0)) ) | |
190 | return kFALSE; | |
191 | } | |
ba15fdfb | 192 | |
90c1ae2d | 193 | if(fparMean && fparSigma) { |
194 | Double_t nTrks = ev->GetNumberOfTracks(); | |
195 | Double_t multV0 = 0.0; | |
196 | for(Int_t j=0; j<64; j++) multV0 += ev->GetVZEROData()->GetMultiplicity(j); | |
197 | Double_t mV0 = fparMean->Eval(nTrks); | |
198 | Double_t sV0 = fparSigma->Eval(nTrks); | |
77e2c705 | 199 | if(multV0 > mV0+fcutSigma*sV0 || multV0 < mV0-fcutSigma*sV0) return kFALSE; |
90c1ae2d | 200 | } |
201 | ||
6bd73568 | 202 | // cut on the number of vertex contributors using TPC versus global vertex |
203 | if(fparMinVtxContributors && fparMaxVtxContributors) { | |
204 | const AliESDVertex *vtxTPC = ev->GetPrimaryVertexTPC(); | |
205 | const AliESDVertex *vtxGbl = ev->GetPrimaryVertex(); | |
206 | Double_t nContribTPC = (vtxTPC ? vtxTPC->GetNContributors() : 0); | |
207 | Double_t nContribGbl = (vtxGbl ? vtxGbl->GetNContributors() : 0); | |
208 | Double_t minCut = fparMinVtxContributors->Eval(nContribGbl); | |
209 | Double_t maxCut = fparMaxVtxContributors->Eval(nContribGbl); | |
210 | if(nContribTPC > maxCut || nContribTPC < minCut) return kFALSE; | |
211 | } | |
212 | ||
213 | ||
d327d9cd | 214 | return kTRUE; |
215 | } | |
216 | //______________________________________________ | |
217 | Bool_t AliDielectronEventCuts::IsSelectedAOD(TObject* event) | |
218 | { | |
219 | // | |
220 | // check the cuts | |
221 | // | |
222 | ||
223 | AliAODEvent *ev=dynamic_cast<AliAODEvent*>(event); | |
224 | if (!ev) return kFALSE; | |
225 | ||
226 | if (fCentMin<fCentMax){ | |
227 | AliCentrality *centrality=ev->GetCentrality(); | |
228 | Double_t centralityF=-1; | |
229 | if (centrality) centralityF = centrality->GetCentralityPercentile("V0M"); | |
230 | if (centralityF<fCentMin || centralityF>=fCentMax) return kFALSE; | |
231 | } | |
232 | ||
233 | fkVertexAOD=0x0; | |
234 | ||
235 | switch(fVtxType){ | |
e4339752 | 236 | case kVtxTracks: fkVertexAOD=0x0; break; |
99345a64 | 237 | case kVtxTPC: fkVertexAOD=AliDielectronVarManager::GetVertex(ev, AliAODVertex::kMainTPC); break; |
d327d9cd | 238 | case kVtxSPD: |
e4339752 | 239 | case kVtxTracksOrSPD: fkVertexAOD=ev->GetPrimaryVertexSPD(); break; |
240 | case kVtxAny: fkVertexAOD=ev->GetPrimaryVertex(); break; | |
d327d9cd | 241 | } |
242 | ||
243 | if ((fRequireVtx||fVtxZmin<fVtxZmax||fMinVtxContributors>0)&&!fkVertexAOD) return kFALSE; | |
244 | ||
245 | if (fMinVtxContributors>0){ | |
246 | Int_t nCtrb = fkVertexAOD->GetNContributors(); | |
247 | if (nCtrb<fMinVtxContributors){ | |
a823f01b | 248 | // if (fVtxType==kVtxTracksOrSPD){ |
249 | // fkVertexAOD=ev->GetVertex(AliAODVertex::kPrimary); | |
250 | // nCtrb = fkVertexAOD->GetNContributors(); | |
251 | // if (nCtrb<fMinVtxContributors) return kFALSE; | |
252 | // } else { | |
253 | return kFALSE; | |
254 | //} | |
d327d9cd | 255 | } |
256 | } | |
a823f01b | 257 | |
d327d9cd | 258 | |
259 | if (fVtxZmin<fVtxZmax){ | |
260 | Double_t zvtx=fkVertexAOD->GetZ(); | |
261 | if (zvtx<fVtxZmin||zvtx>fVtxZmax) return kFALSE; | |
262 | } | |
a823f01b | 263 | |
d327d9cd | 264 | /* |
265 | if (fRequireV0and){ | |
266 | // if (!fTriggerAnalysis) fTriggerAnalysis=new AliTriggerAnalysis; | |
267 | Bool_t v0AND = kFALSE; | |
268 | if (fRequireV0and==1){ | |
269 | Bool_t v0A = fTriggerAnalysis->IsOfflineTriggerFired(ev, AliTriggerAnalysis::kV0A); | |
270 | Bool_t v0A = header->GetOfflineTrigger(); //TODO | |
271 | Bool_t v0C = fTriggerAnalysis->IsOfflineTriggerFired(ev, AliTriggerAnalysis::kV0C); | |
272 | v0AND = v0A && v0C; | |
273 | } | |
274 | ||
275 | if (fRequireV0and==2){ | |
276 | Bool_t v0AHW = (fTriggerAnalysis->V0Trigger(ev, AliTriggerAnalysis::kASide, kTRUE) == AliTriggerAnalysis::kV0BB); | |
277 | Bool_t v0CHW = (fTriggerAnalysis->V0Trigger(ev, AliTriggerAnalysis::kCSide, kTRUE) == AliTriggerAnalysis::kV0BB); | |
278 | v0AND = v0AHW && v0CHW; | |
279 | } | |
280 | ||
281 | if (!v0AND) return kFALSE; | |
282 | } | |
283 | */ | |
284 | /* if (fMultITSTPC){ | |
285 | const AliESDVertex *vtxESDTPC=ev->GetPrimaryVertexTPC(); | |
286 | const AliMultiplicity *multESD = ev->GetMultiplicity(); | |
287 | if ( vtxESDTPC && multESD && vtxESDTPC->GetNContributors() < (-10.+0.25*multESD->GetNumberOfITSClusters(0)) ) | |
288 | return kFALSE; | |
289 | } | |
290 | */ | |
6bd73568 | 291 | |
292 | // correlation cut Ntrks vs. multV0 | |
90c1ae2d | 293 | if(fparMean && fparSigma) { |
294 | Double_t nTrks = ev->GetNumberOfTracks(); | |
295 | Double_t multV0 = 0.0; | |
296 | for(Int_t j=0; j<64; j++) multV0 += ev->GetVZEROData()->GetMultiplicity(j); | |
297 | Double_t mV0 = fparMean->Eval(nTrks); | |
298 | Double_t sV0 = fparSigma->Eval(nTrks); | |
299 | if(multV0 > mV0+fcutSigma*sV0 || multV0 < mV0-fcutSigma*sV0) return kFALSE; | |
300 | } | |
301 | ||
6bd73568 | 302 | // cut on the number of vertex contributors using TPC versus global vertex |
303 | if(fparMinVtxContributors && fparMaxVtxContributors) { | |
304 | const AliAODVertex *vtxTPC = ev->GetVertex(AliAODVertex::kMainTPC); | |
305 | const AliAODVertex *vtxGbl = ev->GetPrimaryVertex(); | |
306 | Double_t nContribTPC = (vtxTPC ? vtxTPC->GetNContributors() : 0); | |
307 | Double_t nContribGbl = (vtxGbl ? vtxGbl->GetNContributors() : 0); | |
308 | Double_t minCut = fparMinVtxContributors->Eval(nContribGbl); | |
309 | Double_t maxCut = fparMaxVtxContributors->Eval(nContribGbl); | |
310 | if(nContribTPC > maxCut || nContribTPC < minCut) return kFALSE; | |
311 | } | |
312 | ||
2a14a7b1 | 313 | return kTRUE; |
314 | } | |
315 | ||
1bb1fef1 | 316 | //________________________________________________________________________ |
317 | void AliDielectronEventCuts::Print(const Option_t* /*option*/) const | |
318 | { | |
319 | // | |
320 | // Print cuts and the range | |
321 | // | |
322 | printf("cut ranges for '%s'\n",GetTitle()); | |
323 | printf("All Cuts have to be fulfilled\n"); | |
324 | ||
325 | Int_t iCut=0; | |
326 | if(fRequireVtx) { | |
327 | printf("Cut %02d: vertex required \n",iCut); iCut++; } | |
328 | printf("Cut %02d: vertex type: %s \n", iCut, fgkVtxNames[fVtxType]); iCut++; | |
329 | if(fMinVtxContributors) { | |
330 | printf("Cut %02d: vertex contributors >= %d \n", iCut, fMinVtxContributors); iCut++; } | |
331 | if(fVtxZmin<fVtxZmax) { | |
90c1ae2d | 332 | printf("Cut %02d: %f < %s < %f\n", iCut, fVtxZmin, "Zvtx", fVtxZmax); iCut++; } |
1bb1fef1 | 333 | if(fCentMin<fCentMax) { |
334 | printf("Cut %02d: %f < %s < %f\n", iCut, fCentMin, "V0centrality", fCentMax);iCut++; } | |
335 | if(fMultITSTPC) { | |
336 | printf("Cut %02d: cut on multiplcity ITS vs. TPC \n", iCut); iCut++; } | |
90c1ae2d | 337 | if(fparMean&&fparSigma) { |
338 | printf("Cut %02d: multplicity vs. #tracks correlation +-%.1f sigma inclusion \n", iCut, fcutSigma); iCut++; } | |
1bb1fef1 | 339 | if(fRequireV0and) { |
340 | printf("Cut %02d: require V0and type: %c \n", iCut, fRequireV0and); iCut++; } | |
341 | ||
342 | } | |
343 |