]>
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(), | |
fd40e2fe | 48 | fRun(), |
2a14a7b1 | 49 | fVtxZmin(0.), |
50 | fVtxZmax(0.), | |
51 | fRequireVtx(kFALSE), | |
52 | fMinVtxContributors(0), | |
ffbede40 | 53 | fMultITSTPC(kFALSE), |
ba15fdfb | 54 | fCentMin(1.), |
55 | fCentMax(0.), | |
2a14a7b1 | 56 | fVtxType(kVtxTracks), |
b2ad74d0 | 57 | fRequire13sel(kFALSE), |
58 | fUtils(), | |
2a14a7b1 | 59 | fRequireV0and(0), |
60 | fTriggerAnalysis(0x0), | |
d327d9cd | 61 | fkVertex(0x0), |
90c1ae2d | 62 | fkVertexAOD(0x0), |
63 | fparMean(0x0), | |
64 | fparSigma(0x0), | |
6bd73568 | 65 | fcutSigma(3.), |
66 | fparMinVtxContributors(0x0), | |
67 | fparMaxVtxContributors(0x0) | |
2a14a7b1 | 68 | { |
69 | // | |
70 | // Default Constructor | |
71 | // | |
72 | ||
73 | } | |
74 | ||
75 | //______________________________________________ | |
76 | AliDielectronEventCuts::AliDielectronEventCuts(const char* name, const char* title) : | |
77 | AliAnalysisCuts(name, title), | |
fd40e2fe | 78 | fRun(), |
2a14a7b1 | 79 | fVtxZmin(0.), |
80 | fVtxZmax(0.), | |
81 | fRequireVtx(kFALSE), | |
82 | fMinVtxContributors(0), | |
ffbede40 | 83 | fMultITSTPC(kFALSE), |
ba15fdfb | 84 | fCentMin(1.), |
85 | fCentMax(0.), | |
2a14a7b1 | 86 | fVtxType(kVtxTracks), |
b2ad74d0 | 87 | fRequire13sel(kFALSE), |
88 | fUtils(), | |
2a14a7b1 | 89 | fRequireV0and(0), |
90 | fTriggerAnalysis(0x0), | |
d327d9cd | 91 | fkVertex(0x0), |
90c1ae2d | 92 | fkVertexAOD(0x0), |
93 | fparMean(0x0), | |
94 | fparSigma(0x0), | |
6bd73568 | 95 | fcutSigma(3.), |
96 | fparMinVtxContributors(0x0), | |
97 | fparMaxVtxContributors(0x0) | |
2a14a7b1 | 98 | { |
99 | // | |
100 | // Named Constructor | |
101 | // | |
102 | } | |
103 | ||
104 | //______________________________________________ | |
105 | AliDielectronEventCuts::~AliDielectronEventCuts() | |
106 | { | |
107 | // | |
108 | // Default Destructor | |
109 | // | |
110 | if (fTriggerAnalysis) delete fTriggerAnalysis; | |
111 | } | |
112 | ||
113 | //______________________________________________ | |
114 | Bool_t AliDielectronEventCuts::IsSelected(TObject* event) | |
115 | { | |
116 | // | |
117 | // check the cuts | |
118 | // | |
119 | ||
d327d9cd | 120 | if(event->IsA() == AliESDEvent::Class()) return IsSelectedESD(event); |
121 | else if(event->IsA() == AliAODEvent::Class()) return IsSelectedAOD(event); | |
122 | else return kFALSE; | |
123 | } | |
124 | //____________________________________________________________________ | |
125 | Bool_t AliDielectronEventCuts::IsSelectedESD(TObject* event) | |
126 | { | |
127 | // | |
128 | // check the cuts | |
129 | // | |
130 | ||
2a14a7b1 | 131 | AliESDEvent *ev=dynamic_cast<AliESDEvent*>(event); |
132 | if (!ev) return kFALSE; | |
133 | ||
ba15fdfb | 134 | if (fCentMin<fCentMax){ |
135 | AliCentrality *centrality=ev->GetCentrality(); | |
136 | Double_t centralityF=-1; | |
137 | if (centrality) centralityF = centrality->GetCentralityPercentile("V0M"); | |
138 | if (centralityF<fCentMin || centralityF>=fCentMax) return kFALSE; | |
139 | } | |
140 | ||
2a14a7b1 | 141 | fkVertex=0x0; |
5720c765 | 142 | |
2a14a7b1 | 143 | switch(fVtxType){ |
1201a1a9 | 144 | case kVtxTracks: |
145 | case kVtxTracksOrSPD: | |
146 | fkVertex=ev->GetPrimaryVertexTracks(); | |
147 | break; | |
2a14a7b1 | 148 | case kVtxSPD: fkVertex=ev->GetPrimaryVertexSPD(); break; |
149 | case kVtxTPC: fkVertex=ev->GetPrimaryVertexTPC(); break; | |
150 | case kVtxAny: fkVertex=ev->GetPrimaryVertex(); break; | |
151 | } | |
152 | ||
153 | if ((fRequireVtx||fVtxZmin<fVtxZmax||fMinVtxContributors>0)&&!fkVertex) return kFALSE; | |
154 | ||
2a14a7b1 | 155 | |
156 | if (fMinVtxContributors>0){ | |
157 | Int_t nCtrb = fkVertex->GetNContributors(); | |
ba15fdfb | 158 | if (nCtrb<fMinVtxContributors){ |
159 | if (fVtxType==kVtxTracksOrSPD){ | |
160 | fkVertex=ev->GetPrimaryVertexSPD(); | |
161 | nCtrb = fkVertex->GetNContributors(); | |
162 | if (nCtrb<fMinVtxContributors) return kFALSE; | |
163 | } else { | |
164 | return kFALSE; | |
165 | } | |
166 | } | |
2a14a7b1 | 167 | } |
168 | ||
ba15fdfb | 169 | if (fVtxZmin<fVtxZmax){ |
170 | Double_t zvtx=fkVertex->GetZv(); | |
171 | if (zvtx<fVtxZmin||zvtx>fVtxZmax) return kFALSE; | |
172 | } | |
b2ad74d0 | 173 | |
174 | if(fRequire13sel){ | |
175 | if(!fUtils.IsVertexSelected2013pA(ev)) return kFALSE; | |
176 | if(fUtils.IsFirstEventInChunk(ev)) return kFALSE; | |
177 | } | |
178 | ||
2a14a7b1 | 179 | if (fRequireV0and){ |
180 | if (!fTriggerAnalysis) fTriggerAnalysis=new AliTriggerAnalysis; | |
181 | Bool_t v0AND = kFALSE; | |
182 | if (fRequireV0and==1){ | |
183 | Bool_t v0A = fTriggerAnalysis->IsOfflineTriggerFired(ev, AliTriggerAnalysis::kV0A); | |
184 | Bool_t v0C = fTriggerAnalysis->IsOfflineTriggerFired(ev, AliTriggerAnalysis::kV0C); | |
185 | v0AND = v0A && v0C; | |
186 | } | |
187 | ||
188 | if (fRequireV0and==2){ | |
189 | Bool_t v0AHW = (fTriggerAnalysis->V0Trigger(ev, AliTriggerAnalysis::kASide, kTRUE) == AliTriggerAnalysis::kV0BB); | |
190 | Bool_t v0CHW = (fTriggerAnalysis->V0Trigger(ev, AliTriggerAnalysis::kCSide, kTRUE) == AliTriggerAnalysis::kV0BB); | |
191 | v0AND = v0AHW && v0CHW; | |
192 | } | |
193 | ||
194 | if (!v0AND) return kFALSE; | |
195 | } | |
ffbede40 | 196 | |
197 | if (fMultITSTPC){ | |
198 | const AliESDVertex *vtxESDTPC=ev->GetPrimaryVertexTPC(); | |
199 | const AliMultiplicity *multESD = ev->GetMultiplicity(); | |
200 | if ( vtxESDTPC && multESD && vtxESDTPC->GetNContributors() < (-10.+0.25*multESD->GetNumberOfITSClusters(0)) ) | |
201 | return kFALSE; | |
202 | } | |
ba15fdfb | 203 | |
90c1ae2d | 204 | if(fparMean && fparSigma) { |
205 | Double_t nTrks = ev->GetNumberOfTracks(); | |
206 | Double_t multV0 = 0.0; | |
207 | for(Int_t j=0; j<64; j++) multV0 += ev->GetVZEROData()->GetMultiplicity(j); | |
208 | Double_t mV0 = fparMean->Eval(nTrks); | |
209 | Double_t sV0 = fparSigma->Eval(nTrks); | |
77e2c705 | 210 | if(multV0 > mV0+fcutSigma*sV0 || multV0 < mV0-fcutSigma*sV0) return kFALSE; |
90c1ae2d | 211 | } |
212 | ||
6bd73568 | 213 | // cut on the number of vertex contributors using TPC versus global vertex |
214 | if(fparMinVtxContributors && fparMaxVtxContributors) { | |
215 | const AliESDVertex *vtxTPC = ev->GetPrimaryVertexTPC(); | |
216 | const AliESDVertex *vtxGbl = ev->GetPrimaryVertex(); | |
217 | Double_t nContribTPC = (vtxTPC ? vtxTPC->GetNContributors() : 0); | |
218 | Double_t nContribGbl = (vtxGbl ? vtxGbl->GetNContributors() : 0); | |
219 | Double_t minCut = fparMinVtxContributors->Eval(nContribGbl); | |
220 | Double_t maxCut = fparMaxVtxContributors->Eval(nContribGbl); | |
221 | if(nContribTPC > maxCut || nContribTPC < minCut) return kFALSE; | |
222 | } | |
223 | ||
224 | ||
d327d9cd | 225 | return kTRUE; |
226 | } | |
227 | //______________________________________________ | |
228 | Bool_t AliDielectronEventCuts::IsSelectedAOD(TObject* event) | |
229 | { | |
230 | // | |
231 | // check the cuts | |
232 | // | |
233 | ||
234 | AliAODEvent *ev=dynamic_cast<AliAODEvent*>(event); | |
235 | if (!ev) return kFALSE; | |
236 | ||
fd40e2fe JB |
237 | // run rejection |
238 | Int_t run = ev->GetRunNumber(); | |
239 | if(fRun.GetNrows()) { | |
240 | for(Int_t irun=0; irun<fRun.GetNrows(); irun++) { | |
fd40e2fe JB |
241 | if(fRun(irun)==run) return kFALSE; |
242 | } | |
243 | } | |
244 | ||
d327d9cd | 245 | if (fCentMin<fCentMax){ |
246 | AliCentrality *centrality=ev->GetCentrality(); | |
247 | Double_t centralityF=-1; | |
248 | if (centrality) centralityF = centrality->GetCentralityPercentile("V0M"); | |
249 | if (centralityF<fCentMin || centralityF>=fCentMax) return kFALSE; | |
250 | } | |
251 | ||
252 | fkVertexAOD=0x0; | |
253 | ||
254 | switch(fVtxType){ | |
e4339752 | 255 | case kVtxTracks: fkVertexAOD=0x0; break; |
99345a64 | 256 | case kVtxTPC: fkVertexAOD=AliDielectronVarManager::GetVertex(ev, AliAODVertex::kMainTPC); break; |
d327d9cd | 257 | case kVtxSPD: |
e4339752 | 258 | case kVtxTracksOrSPD: fkVertexAOD=ev->GetPrimaryVertexSPD(); break; |
259 | case kVtxAny: fkVertexAOD=ev->GetPrimaryVertex(); break; | |
d327d9cd | 260 | } |
261 | ||
262 | if ((fRequireVtx||fVtxZmin<fVtxZmax||fMinVtxContributors>0)&&!fkVertexAOD) return kFALSE; | |
263 | ||
264 | if (fMinVtxContributors>0){ | |
265 | Int_t nCtrb = fkVertexAOD->GetNContributors(); | |
266 | if (nCtrb<fMinVtxContributors){ | |
a823f01b | 267 | // if (fVtxType==kVtxTracksOrSPD){ |
268 | // fkVertexAOD=ev->GetVertex(AliAODVertex::kPrimary); | |
269 | // nCtrb = fkVertexAOD->GetNContributors(); | |
270 | // if (nCtrb<fMinVtxContributors) return kFALSE; | |
271 | // } else { | |
272 | return kFALSE; | |
273 | //} | |
d327d9cd | 274 | } |
275 | } | |
a823f01b | 276 | |
d327d9cd | 277 | |
278 | if (fVtxZmin<fVtxZmax){ | |
279 | Double_t zvtx=fkVertexAOD->GetZ(); | |
280 | if (zvtx<fVtxZmin||zvtx>fVtxZmax) return kFALSE; | |
281 | } | |
a823f01b | 282 | |
b2ad74d0 | 283 | if(fRequire13sel){ |
284 | if(!fUtils.IsVertexSelected2013pA(ev)) return kFALSE; | |
d4619886 | 285 | // if(fUtils.IsFirstEventInChunk(ev)) return kFALSE; |
b2ad74d0 | 286 | } |
287 | ||
d327d9cd | 288 | /* |
289 | if (fRequireV0and){ | |
290 | // if (!fTriggerAnalysis) fTriggerAnalysis=new AliTriggerAnalysis; | |
291 | Bool_t v0AND = kFALSE; | |
292 | if (fRequireV0and==1){ | |
293 | Bool_t v0A = fTriggerAnalysis->IsOfflineTriggerFired(ev, AliTriggerAnalysis::kV0A); | |
294 | Bool_t v0A = header->GetOfflineTrigger(); //TODO | |
295 | Bool_t v0C = fTriggerAnalysis->IsOfflineTriggerFired(ev, AliTriggerAnalysis::kV0C); | |
296 | v0AND = v0A && v0C; | |
297 | } | |
298 | ||
299 | if (fRequireV0and==2){ | |
300 | Bool_t v0AHW = (fTriggerAnalysis->V0Trigger(ev, AliTriggerAnalysis::kASide, kTRUE) == AliTriggerAnalysis::kV0BB); | |
301 | Bool_t v0CHW = (fTriggerAnalysis->V0Trigger(ev, AliTriggerAnalysis::kCSide, kTRUE) == AliTriggerAnalysis::kV0BB); | |
302 | v0AND = v0AHW && v0CHW; | |
303 | } | |
304 | ||
305 | if (!v0AND) return kFALSE; | |
306 | } | |
307 | */ | |
308 | /* if (fMultITSTPC){ | |
309 | const AliESDVertex *vtxESDTPC=ev->GetPrimaryVertexTPC(); | |
310 | const AliMultiplicity *multESD = ev->GetMultiplicity(); | |
311 | if ( vtxESDTPC && multESD && vtxESDTPC->GetNContributors() < (-10.+0.25*multESD->GetNumberOfITSClusters(0)) ) | |
312 | return kFALSE; | |
313 | } | |
314 | */ | |
6bd73568 | 315 | |
316 | // correlation cut Ntrks vs. multV0 | |
90c1ae2d | 317 | if(fparMean && fparSigma) { |
318 | Double_t nTrks = ev->GetNumberOfTracks(); | |
319 | Double_t multV0 = 0.0; | |
320 | for(Int_t j=0; j<64; j++) multV0 += ev->GetVZEROData()->GetMultiplicity(j); | |
321 | Double_t mV0 = fparMean->Eval(nTrks); | |
322 | Double_t sV0 = fparSigma->Eval(nTrks); | |
323 | if(multV0 > mV0+fcutSigma*sV0 || multV0 < mV0-fcutSigma*sV0) return kFALSE; | |
324 | } | |
325 | ||
6bd73568 | 326 | // cut on the number of vertex contributors using TPC versus global vertex |
327 | if(fparMinVtxContributors && fparMaxVtxContributors) { | |
328 | const AliAODVertex *vtxTPC = ev->GetVertex(AliAODVertex::kMainTPC); | |
329 | const AliAODVertex *vtxGbl = ev->GetPrimaryVertex(); | |
330 | Double_t nContribTPC = (vtxTPC ? vtxTPC->GetNContributors() : 0); | |
331 | Double_t nContribGbl = (vtxGbl ? vtxGbl->GetNContributors() : 0); | |
332 | Double_t minCut = fparMinVtxContributors->Eval(nContribGbl); | |
333 | Double_t maxCut = fparMaxVtxContributors->Eval(nContribGbl); | |
334 | if(nContribTPC > maxCut || nContribTPC < minCut) return kFALSE; | |
335 | } | |
336 | ||
2a14a7b1 | 337 | return kTRUE; |
338 | } | |
339 | ||
1bb1fef1 | 340 | //________________________________________________________________________ |
341 | void AliDielectronEventCuts::Print(const Option_t* /*option*/) const | |
342 | { | |
343 | // | |
344 | // Print cuts and the range | |
345 | // | |
346 | printf("cut ranges for '%s'\n",GetTitle()); | |
347 | printf("All Cuts have to be fulfilled\n"); | |
348 | ||
349 | Int_t iCut=0; | |
350 | if(fRequireVtx) { | |
351 | printf("Cut %02d: vertex required \n",iCut); iCut++; } | |
352 | printf("Cut %02d: vertex type: %s \n", iCut, fgkVtxNames[fVtxType]); iCut++; | |
353 | if(fMinVtxContributors) { | |
354 | printf("Cut %02d: vertex contributors >= %d \n", iCut, fMinVtxContributors); iCut++; } | |
355 | if(fVtxZmin<fVtxZmax) { | |
90c1ae2d | 356 | printf("Cut %02d: %f < %s < %f\n", iCut, fVtxZmin, "Zvtx", fVtxZmax); iCut++; } |
1bb1fef1 | 357 | if(fCentMin<fCentMax) { |
358 | printf("Cut %02d: %f < %s < %f\n", iCut, fCentMin, "V0centrality", fCentMax);iCut++; } | |
359 | if(fMultITSTPC) { | |
360 | printf("Cut %02d: cut on multiplcity ITS vs. TPC \n", iCut); iCut++; } | |
90c1ae2d | 361 | if(fparMean&&fparSigma) { |
362 | printf("Cut %02d: multplicity vs. #tracks correlation +-%.1f sigma inclusion \n", iCut, fcutSigma); iCut++; } | |
b2ad74d0 | 363 | if(fRequire13sel){ |
364 | printf("Cut %02d: vertex and event selection for 2013 pPb data taking required \n",iCut); iCut++; } | |
1bb1fef1 | 365 | if(fRequireV0and) { |
366 | printf("Cut %02d: require V0and type: %c \n", iCut, fRequireV0and); iCut++; } | |
367 | ||
368 | } | |
369 |