]>
Commit | Line | Data |
---|---|---|
a0b94e5c | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: Ana Marin, Kathrin Koch, Kenneth Aamodt * | |
5 | * Version 1.0 * | |
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 | //--------------------------------------------- | |
18 | // Class used to do analysis on conversion pairs | |
19 | //--------------------------------------------- | |
20 | //////////////////////////////////////////////// | |
21 | ||
22 | // --- ROOT system --- | |
23 | #include <TMath.h> | |
24 | ||
25 | //---- ANALYSIS system ---- | |
26 | #include "AliV0Reader.h" | |
27 | #include "AliAnalysisManager.h" | |
28 | #include "AliESDInputHandler.h" | |
67381a40 | 29 | #include "AliPID.h" |
a0b94e5c | 30 | #include "AliESDtrack.h" |
31 | #include "AliMCEvent.h" | |
32 | #include "AliKFVertex.h" | |
33 | ||
34 | #include "AliStack.h" | |
35 | #include "AliMCEventHandler.h" | |
10d100d4 | 36 | #include "AliESDpid.h" |
5e55d806 | 37 | #include "AliGammaConversionBGHandler.h" |
037dc2db | 38 | #include "AliESDtrackCuts.h" |
39 | ||
a0b94e5c | 40 | |
41 | class iostream; | |
42 | class AliESDv0; | |
43 | class TFormula; | |
44 | ||
45 | using namespace std; | |
46 | ||
47 | ClassImp(AliV0Reader) | |
48 | ||
49 | ||
9c1cb6f7 | 50 | AliESDpid* AliV0Reader::fgESDpid = 0x0; |
a0b94e5c | 51 | |
52 | AliV0Reader::AliV0Reader() : | |
53 | TObject(), | |
54 | fMCStack(NULL), | |
48682642 | 55 | // fMCTruth(NULL), |
a0b94e5c | 56 | fMCEvent(NULL), // for CF |
57 | fChain(NULL), | |
48682642 | 58 | // fESDHandler(NULL), |
a0b94e5c | 59 | fESDEvent(NULL), |
4a6157dc | 60 | fCFManager(NULL), |
9c1cb6f7 | 61 | //fESDpid(NULL), |
a0b94e5c | 62 | fHistograms(NULL), |
63 | fCurrentV0IndexNumber(0), | |
64 | fCurrentV0(NULL), | |
65 | fCurrentNegativeKFParticle(NULL), | |
66 | fCurrentPositiveKFParticle(NULL), | |
67 | fCurrentMotherKFCandidate(NULL), | |
68 | fCurrentNegativeESDTrack(NULL), | |
69 | fCurrentPositiveESDTrack(NULL), | |
70 | fNegativeTrackLorentzVector(NULL), | |
71 | fPositiveTrackLorentzVector(NULL), | |
72 | fMotherCandidateLorentzVector(NULL), | |
73 | fCurrentXValue(0), | |
74 | fCurrentYValue(0), | |
75 | fCurrentZValue(0), | |
76 | fPositiveTrackPID(0), | |
77 | fNegativeTrackPID(0), | |
78 | fNegativeMCParticle(NULL), | |
79 | fPositiveMCParticle(NULL), | |
80 | fMotherMCParticle(NULL), | |
81 | fMotherCandidateKFMass(0), | |
82 | fMotherCandidateKFWidth(0), | |
83 | fUseKFParticle(kTRUE), | |
84 | fUseESDTrack(kFALSE), | |
85 | fDoMC(kFALSE), | |
10e3319b | 86 | fMaxVertexZ(100.),// 100 cm(from the 0) |
a0b94e5c | 87 | fMaxR(10000),// 100 meter(outside of ALICE) |
bd6d9fa3 | 88 | fMinR(0),// 100 meter(outside of ALICE) |
a0b94e5c | 89 | fEtaCut(0.), |
90 | fPtCut(0.), | |
48682642 | 91 | fSinglePtCut(0.), |
a0b94e5c | 92 | fMaxZ(0.), |
48682642 | 93 | fMinClsTPC(0.), |
bd6d9fa3 | 94 | fMinClsTPCToF(0.), |
a0b94e5c | 95 | fLineCutZRSlope(0.), |
96 | fLineCutZValue(0.), | |
97 | fChi2CutConversion(0.), | |
98 | fChi2CutMeson(0.), | |
9c1cb6f7 | 99 | fAlphaCutMeson(1.), |
67381a40 | 100 | fAlphaMinCutMeson(0.), |
a0b94e5c | 101 | fPIDProbabilityCutNegativeParticle(0), |
102 | fPIDProbabilityCutPositiveParticle(0), | |
9640a3d1 | 103 | fDodEdxSigmaCut(kFALSE), |
104 | fPIDnSigmaAboveElectronLine(100), | |
105 | fPIDnSigmaBelowElectronLine(-100), | |
106 | fPIDnSigmaAbovePionLine(-100), | |
107 | fPIDMinPnSigmaAbovePionLine(100), | |
10e3319b | 108 | fPIDMaxPnSigmaAbovePionLine(100), |
9c1cb6f7 | 109 | fDoKaonRejectionLowP(kFALSE), |
110 | fDoProtonRejectionLowP(kFALSE), | |
111 | fDoPionRejectionLowP(kFALSE), | |
112 | fPIDnSigmaAtLowPAroundKaonLine(0), | |
113 | fPIDnSigmaAtLowPAroundProtonLine(0), | |
114 | fPIDnSigmaAtLowPAroundPionLine(0), | |
115 | fPIDMinPKaonRejectionLowP(0), | |
116 | fPIDMinPProtonRejectionLowP(0), | |
117 | fPIDMinPPionRejectionLowP(0), | |
70ef88b5 | 118 | fDoQtGammaSelection(kFALSE), |
119 | fQtMax(100.), | |
a0b94e5c | 120 | fXVertexCut(0.), |
121 | fYVertexCut(0.), | |
122 | fZVertexCut(0.), | |
123 | fNSigmaMass(0.), | |
124 | fUseImprovedVertex(kFALSE), | |
125 | fUseOwnXYZCalculation(kFALSE), | |
5ce758b0 | 126 | fUseConstructGamma(kFALSE), |
1e7846f4 | 127 | fDoCF(kFALSE), |
77880bd8 | 128 | fUseOnFlyV0Finder(kTRUE), |
cb90a330 | 129 | fUpdateV0AlreadyCalled(kFALSE), |
5e55d806 | 130 | fCurrentEventGoodV0s(NULL), |
7f3c7cc6 | 131 | fV0Pindex(), |
132 | fV0Nindex(), | |
5e55d806 | 133 | // fPreviousEventGoodV0s(), |
87f6de3e | 134 | fCalculateBackground(kFALSE), |
5e55d806 | 135 | fBGEventHandler(NULL), |
037dc2db | 136 | fBGEventInitialized(kFALSE), |
137 | fEsdTrackCuts(NULL), | |
70ef88b5 | 138 | fNumberOfESDTracks(0), |
5ce758b0 | 139 | nEventsForBGCalculation(20), |
140 | fUseChargedTrackMultiplicityForBG(kTRUE), | |
141 | fNumberOfGoodV0s(0) | |
a0b94e5c | 142 | { |
9c1cb6f7 | 143 | //fESDpid = new AliESDpid; |
a0b94e5c | 144 | } |
145 | ||
146 | ||
147 | AliV0Reader::AliV0Reader(const AliV0Reader & original) : | |
148 | TObject(original), | |
149 | fMCStack(original.fMCStack), | |
48682642 | 150 | // fMCTruth(original.fMCTruth), |
a0b94e5c | 151 | fMCEvent(original.fMCEvent), // for CF |
152 | fChain(original.fChain), | |
48682642 | 153 | // fESDHandler(original.fESDHandler), |
a0b94e5c | 154 | fESDEvent(original.fESDEvent), |
4a6157dc | 155 | fCFManager(original.fCFManager), |
9c1cb6f7 | 156 | // fESDpid(original.fESDpid), |
a0b94e5c | 157 | fHistograms(original.fHistograms), |
158 | fCurrentV0IndexNumber(original.fCurrentV0IndexNumber), | |
159 | fCurrentV0(original.fCurrentV0), | |
160 | fCurrentNegativeKFParticle(original.fCurrentNegativeKFParticle), | |
161 | fCurrentPositiveKFParticle(original.fCurrentPositiveKFParticle), | |
162 | fCurrentMotherKFCandidate(original.fCurrentMotherKFCandidate), | |
163 | fCurrentNegativeESDTrack(original.fCurrentNegativeESDTrack), | |
164 | fCurrentPositiveESDTrack(original.fCurrentPositiveESDTrack), | |
165 | fNegativeTrackLorentzVector(original.fNegativeTrackLorentzVector), | |
166 | fPositiveTrackLorentzVector(original.fPositiveTrackLorentzVector), | |
167 | fMotherCandidateLorentzVector(original.fMotherCandidateLorentzVector), | |
168 | fCurrentXValue(original.fCurrentXValue), | |
169 | fCurrentYValue(original.fCurrentYValue), | |
170 | fCurrentZValue(original.fCurrentZValue), | |
171 | fPositiveTrackPID(original.fPositiveTrackPID), | |
172 | fNegativeTrackPID(original.fNegativeTrackPID), | |
173 | fNegativeMCParticle(original.fNegativeMCParticle), | |
174 | fPositiveMCParticle(original.fPositiveMCParticle), | |
175 | fMotherMCParticle(original.fMotherMCParticle), | |
176 | fMotherCandidateKFMass(original.fMotherCandidateKFMass), | |
177 | fMotherCandidateKFWidth(original.fMotherCandidateKFWidth), | |
178 | fUseKFParticle(kTRUE), | |
179 | fUseESDTrack(kFALSE), | |
180 | fDoMC(kFALSE), | |
10e3319b | 181 | fMaxVertexZ(original.fMaxVertexZ), |
a0b94e5c | 182 | fMaxR(original.fMaxR), |
bd6d9fa3 | 183 | fMinR(original.fMinR), |
a0b94e5c | 184 | fEtaCut(original.fEtaCut), |
185 | fPtCut(original.fPtCut), | |
48682642 | 186 | fSinglePtCut(original.fSinglePtCut), |
a0b94e5c | 187 | fMaxZ(original.fMaxZ), |
48682642 | 188 | fMinClsTPC(original.fMinClsTPC), |
bd6d9fa3 | 189 | fMinClsTPCToF(original.fMinClsTPCToF), |
a0b94e5c | 190 | fLineCutZRSlope(original.fLineCutZRSlope), |
191 | fLineCutZValue(original.fLineCutZValue), | |
192 | fChi2CutConversion(original.fChi2CutConversion), | |
193 | fChi2CutMeson(original.fChi2CutMeson), | |
9c1cb6f7 | 194 | fAlphaCutMeson(original.fAlphaCutMeson), |
67381a40 | 195 | fAlphaMinCutMeson(original.fAlphaMinCutMeson), |
a0b94e5c | 196 | fPIDProbabilityCutNegativeParticle(original.fPIDProbabilityCutNegativeParticle), |
197 | fPIDProbabilityCutPositiveParticle(original.fPIDProbabilityCutPositiveParticle), | |
9640a3d1 | 198 | fDodEdxSigmaCut(original.fDodEdxSigmaCut), |
199 | fPIDnSigmaAboveElectronLine(original.fPIDnSigmaAboveElectronLine), | |
200 | fPIDnSigmaBelowElectronLine(original.fPIDnSigmaBelowElectronLine), | |
201 | fPIDnSigmaAbovePionLine(original.fPIDnSigmaAbovePionLine), | |
202 | fPIDMinPnSigmaAbovePionLine(original.fPIDMinPnSigmaAbovePionLine), | |
10e3319b | 203 | fPIDMaxPnSigmaAbovePionLine(original.fPIDMaxPnSigmaAbovePionLine), |
9c1cb6f7 | 204 | fDoKaonRejectionLowP(original.fDoKaonRejectionLowP), |
205 | fDoProtonRejectionLowP(original.fDoProtonRejectionLowP), | |
206 | fDoPionRejectionLowP(original.fDoPionRejectionLowP), | |
207 | fPIDnSigmaAtLowPAroundKaonLine(original.fPIDnSigmaAtLowPAroundKaonLine), | |
208 | fPIDnSigmaAtLowPAroundProtonLine(original.fPIDnSigmaAtLowPAroundProtonLine), | |
209 | fPIDnSigmaAtLowPAroundPionLine(original.fPIDnSigmaAtLowPAroundPionLine), | |
210 | fPIDMinPKaonRejectionLowP(original.fPIDMinPKaonRejectionLowP), | |
211 | fPIDMinPProtonRejectionLowP(original.fPIDMinPProtonRejectionLowP), | |
212 | fPIDMinPPionRejectionLowP(original.fPIDMinPPionRejectionLowP), | |
70ef88b5 | 213 | fDoQtGammaSelection(original.fDoQtGammaSelection), |
214 | fQtMax(original.fQtMax), | |
a0b94e5c | 215 | fXVertexCut(original.fXVertexCut), |
216 | fYVertexCut(original.fYVertexCut), | |
217 | fZVertexCut(original.fZVertexCut), | |
218 | fNSigmaMass(original.fNSigmaMass), | |
219 | fUseImprovedVertex(original.fUseImprovedVertex), | |
220 | fUseOwnXYZCalculation(original.fUseOwnXYZCalculation), | |
5ce758b0 | 221 | fUseConstructGamma(original.fUseConstructGamma), |
1e7846f4 | 222 | fDoCF(original.fDoCF), |
77880bd8 | 223 | fUseOnFlyV0Finder(original.fUseOnFlyV0Finder), |
cb90a330 | 224 | fUpdateV0AlreadyCalled(original.fUpdateV0AlreadyCalled), |
a0b94e5c | 225 | fCurrentEventGoodV0s(original.fCurrentEventGoodV0s), |
7f3c7cc6 | 226 | fV0Pindex(original.fV0Pindex), |
227 | fV0Nindex(original.fV0Nindex), | |
5e55d806 | 228 | // fPreviousEventGoodV0s(original.fPreviousEventGoodV0s), |
87f6de3e | 229 | fCalculateBackground(original.fCalculateBackground), |
5e55d806 | 230 | fBGEventHandler(original.fBGEventHandler), |
037dc2db | 231 | fBGEventInitialized(original.fBGEventInitialized), |
232 | fEsdTrackCuts(original.fEsdTrackCuts), | |
70ef88b5 | 233 | fNumberOfESDTracks(original.fNumberOfESDTracks), |
5ce758b0 | 234 | nEventsForBGCalculation(original.nEventsForBGCalculation), |
235 | fUseChargedTrackMultiplicityForBG(original.fUseChargedTrackMultiplicityForBG), | |
236 | fNumberOfGoodV0s(original.fNumberOfGoodV0s) | |
a0b94e5c | 237 | { |
238 | ||
239 | } | |
240 | ||
241 | ||
242 | AliV0Reader & AliV0Reader::operator = (const AliV0Reader & /*source*/) | |
243 | { | |
244 | // assignment operator | |
245 | return *this; | |
246 | } | |
9640a3d1 | 247 | AliV0Reader::~AliV0Reader() |
248 | { | |
9c1cb6f7 | 249 | // if(fESDpid){ |
250 | // delete fESDpid; | |
251 | //} | |
9640a3d1 | 252 | } |
a0b94e5c | 253 | |
48682642 | 254 | //____________________________________________________________________________ |
255 | void AliV0Reader::SetInputAndMCEvent(AliVEvent* esd, AliMCEvent* mc) { | |
256 | // Connect the data pointers | |
257 | ||
258 | SetInputEvent(esd); | |
259 | SetMC(mc); | |
260 | ||
261 | } | |
262 | ||
263 | ||
a0b94e5c | 264 | void AliV0Reader::Initialize(){ |
265 | //see header file for documentation | |
5e55d806 | 266 | |
cb90a330 | 267 | fUpdateV0AlreadyCalled = kFALSE; |
48682642 | 268 | |
269 | /* | |
a0b94e5c | 270 | // Get the input handler from the manager |
271 | fESDHandler = (AliESDInputHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()); | |
272 | if(fESDHandler == NULL){ | |
273 | //print warning here | |
274 | } | |
48682642 | 275 | |
a0b94e5c | 276 | // Get pointer to esd event from input handler |
277 | fESDEvent = fESDHandler->GetEvent(); | |
278 | if(fESDEvent == NULL){ | |
279 | //print warning here | |
280 | } | |
48682642 | 281 | |
a0b94e5c | 282 | //Get pointer to MCTruth |
283 | fMCTruth = (AliMCEventHandler*)((AliAnalysisManager::GetAnalysisManager())->GetMCtruthEventHandler()); | |
48682642 | 284 | */ |
285 | ||
286 | ||
287 | ||
288 | // fMCTruth = mcH->MCEvent(); | |
289 | // fMC = mcH->MCEvent(); | |
290 | // stack = fMC->Stack(); | |
291 | ||
292 | ||
293 | //if(fMCTruth == NULL){ | |
a0b94e5c | 294 | //print warning here |
48682642 | 295 | // fDoMC = kFALSE; |
296 | //} | |
297 | ||
298 | if(fMCEvent == NULL){ | |
299 | fDoMC = kFALSE; | |
a0b94e5c | 300 | } |
48682642 | 301 | |
a0b94e5c | 302 | //Get pointer to the mc stack |
48682642 | 303 | // if(fMCTruth){ |
304 | if(fMCEvent){ | |
305 | fMCStack = fMCEvent->Stack(); | |
61374d97 | 306 | if(fMCStack == NULL){ |
307 | //print warning here | |
308 | } | |
5e55d806 | 309 | // Better parameters for MonteCarlo from A. Kalweit 2010/01/8 |
9c1cb6f7 | 310 | // fESDpid->GetTPCResponse().SetBetheBlochParameters( 2.15898e+00/50., |
311 | // 1.75295e+01, | |
312 | // 3.40030e-09, | |
313 | // 1.96178e+00, | |
314 | // 3.91720e+00); | |
5e55d806 | 315 | } |
316 | else{ | |
317 | // Better parameters for data from A. Kalweit 2010/01/8 | |
9c1cb6f7 | 318 | // fESDpid->GetTPCResponse().SetBetheBlochParameters(0.0283086, |
319 | // 2.63394e+01, | |
320 | // 5.04114e-11, | |
321 | // 2.12543e+00, | |
322 | // 4.88663e+00); | |
a0b94e5c | 323 | } |
324 | ||
a0b94e5c | 325 | // for CF |
326 | //Get pointer to the mc event | |
b74269dc | 327 | if(fDoCF && fDoMC){ |
48682642 | 328 | //fMCEvent = fMCTruth->MCEvent(); |
1e7846f4 | 329 | if(fMCEvent == NULL){ |
330 | //print warning here | |
331 | fDoCF = kFALSE; | |
332 | } | |
333 | } | |
a0b94e5c | 334 | |
335 | AliKFParticle::SetField(fESDEvent->GetMagneticField()); | |
5e55d806 | 336 | |
337 | // fCurrentEventGoodV0s = new TClonesArray("TClonesArray", 0); | |
63e16c52 | 338 | if(fCurrentEventGoodV0s == NULL){ |
339 | fCurrentEventGoodV0s = new TClonesArray("AliKFParticle", 0); | |
340 | } | |
5e55d806 | 341 | |
7f3c7cc6 | 342 | fV0Pindex.clear(); |
343 | fV0Nindex.clear(); | |
344 | ||
87f6de3e | 345 | if(fCalculateBackground == kTRUE){ |
346 | if(fBGEventInitialized == kFALSE){ | |
037dc2db | 347 | |
87f6de3e | 348 | |
10e3319b | 349 | Double_t *zBinLimitsArray = new Double_t[9]; |
037dc2db | 350 | zBinLimitsArray[0] = -50.00; |
5ce758b0 | 351 | zBinLimitsArray[1] = -3.375; |
352 | zBinLimitsArray[2] = -1.605; | |
353 | zBinLimitsArray[3] = -0.225; | |
354 | zBinLimitsArray[4] = 1.065; | |
355 | zBinLimitsArray[5] = 2.445; | |
356 | zBinLimitsArray[6] = 4.245; | |
037dc2db | 357 | zBinLimitsArray[7] = 50.00; |
10e3319b | 358 | zBinLimitsArray[8] = 1000.00; |
87f6de3e | 359 | |
10e3319b | 360 | Double_t *multiplicityBinLimitsArray= new Double_t[6]; |
5ce758b0 | 361 | if(fUseChargedTrackMultiplicityForBG == kTRUE){ |
362 | multiplicityBinLimitsArray[0] = 0; | |
363 | multiplicityBinLimitsArray[1] = 8.5; | |
364 | multiplicityBinLimitsArray[2] = 16.5; | |
365 | multiplicityBinLimitsArray[3] = 27.5; | |
366 | multiplicityBinLimitsArray[4] = 41.5; | |
367 | multiplicityBinLimitsArray[5] = 100.; | |
368 | ||
369 | fBGEventHandler = new AliGammaConversionBGHandler(9,6,nEventsForBGCalculation); | |
370 | } | |
371 | else{ | |
372 | multiplicityBinLimitsArray[0] = 2; | |
373 | multiplicityBinLimitsArray[1] = 3; | |
374 | multiplicityBinLimitsArray[2] = 4; | |
375 | multiplicityBinLimitsArray[3] = 5; | |
376 | multiplicityBinLimitsArray[4] = 9999; | |
377 | ||
378 | fBGEventHandler = new AliGammaConversionBGHandler(9,5,nEventsForBGCalculation); | |
379 | } | |
380 | ||
381 | ||
87f6de3e | 382 | |
037dc2db | 383 | /* |
384 | // --------------------------------- | |
385 | Double_t *zBinLimitsArray = new Double_t[1]; | |
386 | zBinLimitsArray[0] = 999999.00; | |
387 | ||
388 | Double_t *multiplicityBinLimitsArray= new Double_t[1]; | |
389 | multiplicityBinLimitsArray[0] = 99999999.00; | |
390 | fBGEventHandler = new AliGammaConversionBGHandler(1,1,10); | |
391 | // --------------------------------- | |
392 | */ | |
87f6de3e | 393 | fBGEventHandler->Initialize(zBinLimitsArray, multiplicityBinLimitsArray); |
394 | fBGEventInitialized = kTRUE; | |
395 | } | |
5e55d806 | 396 | } |
a0b94e5c | 397 | } |
398 | ||
399 | AliESDv0* AliV0Reader::GetV0(Int_t index){ | |
400 | //see header file for documentation | |
401 | fCurrentV0 = fESDEvent->GetV0(index); | |
402 | UpdateV0Information(); | |
403 | return fCurrentV0; | |
404 | } | |
405 | ||
c8206114 | 406 | Int_t AliV0Reader::GetNumberOfContributorsVtx(){ |
407 | if(fESDEvent->GetPrimaryVertexTracks()->GetNContributors()>0) { | |
408 | return fESDEvent->GetPrimaryVertexTracks()->GetNContributors(); | |
409 | } | |
410 | ||
411 | if(fESDEvent->GetPrimaryVertexTracks()->GetNContributors()<1) { | |
412 | if(fESDEvent->GetPrimaryVertexSPD()->GetNContributors()>0) { | |
413 | return fESDEvent->GetPrimaryVertexSPD()->GetNContributors(); | |
414 | ||
415 | } | |
416 | if(fESDEvent->GetPrimaryVertexSPD()->GetNContributors()<1) { | |
417 | cout<<"number of contributors from bad vertex type::"<< fESDEvent->GetPrimaryVertex()->GetName() << endl; | |
418 | return 0; | |
419 | } | |
420 | } | |
421 | return 0; | |
422 | } | |
a0b94e5c | 423 | Bool_t AliV0Reader::CheckForPrimaryVertex(){ |
037dc2db | 424 | //see headerfile for documentation |
c8206114 | 425 | |
426 | if(fESDEvent->GetPrimaryVertexTracks()->GetNContributors()>0) { | |
427 | return 1; | |
428 | } | |
429 | ||
430 | if(fESDEvent->GetPrimaryVertexTracks()->GetNContributors()<1) { | |
431 | // SPD vertex | |
432 | if(fESDEvent->GetPrimaryVertexSPD()->GetNContributors()>0) { | |
433 | //cout<<"spd vertex type::"<< fESDEvent->GetPrimaryVertex()->GetName() << endl; | |
434 | return 1; | |
435 | ||
436 | } | |
437 | if(fESDEvent->GetPrimaryVertexSPD()->GetNContributors()<1) { | |
438 | // cout<<"bad vertex type::"<< fESDEvent->GetPrimaryVertex()->GetName() << endl; | |
439 | return 0; | |
440 | } | |
441 | } | |
442 | return 0; | |
443 | // return fESDEvent->GetPrimaryVertex()->GetNContributors()>0; | |
a0b94e5c | 444 | } |
445 | ||
10e3319b | 446 | Bool_t AliV0Reader::CheckForPrimaryVertexZ(){ |
447 | //see headerfile for documentation | |
448 | ||
449 | if(TMath::Abs(fESDEvent->GetPrimaryVertex()->GetZ())<GetMaxVertexZ()){ | |
450 | return kTRUE; | |
451 | }else{ | |
452 | return kFALSE; | |
453 | } | |
454 | return kTRUE; | |
455 | } | |
77880bd8 | 456 | |
457 | Bool_t AliV0Reader::CheckV0FinderStatus(Int_t index){ | |
037dc2db | 458 | // see headerfile for documentation |
77880bd8 | 459 | if(fUseOnFlyV0Finder){ |
77880bd8 | 460 | if(!GetV0(index)->GetOnFlyStatus()){ |
461 | return kFALSE; | |
462 | } | |
463 | } | |
464 | if(!fUseOnFlyV0Finder){ | |
51b95cb0 | 465 | if(GetV0(index)->GetOnFlyStatus()){ |
77880bd8 | 466 | return kFALSE; |
467 | } | |
468 | } | |
77880bd8 | 469 | return kTRUE; |
470 | } | |
471 | ||
472 | ||
473 | ||
a0b94e5c | 474 | Bool_t AliV0Reader::NextV0(){ |
475 | //see header file for documentation | |
037dc2db | 476 | |
a0b94e5c | 477 | Bool_t iResult=kFALSE; |
478 | while(fCurrentV0IndexNumber<fESDEvent->GetNumberOfV0s()){ | |
479 | fCurrentV0 = fESDEvent->GetV0(fCurrentV0IndexNumber); | |
037dc2db | 480 | |
1b832bb9 | 481 | fUpdateV0AlreadyCalled=kFALSE; |
482 | ||
037dc2db | 483 | if(fHistograms != NULL){ |
484 | fHistograms->FillHistogram("ESD_AllV0s_InvMass",GetMotherCandidateMass()); | |
485 | } | |
a0b94e5c | 486 | |
487 | // moved it up here so that the correction framework can access pt and eta information | |
488 | if(UpdateV0Information() == kFALSE){ | |
489 | fCurrentV0IndexNumber++; | |
490 | continue; | |
491 | } | |
cb90a330 | 492 | |
a0b94e5c | 493 | Double_t containerInput[3]; |
1e7846f4 | 494 | if(fDoCF){ |
495 | containerInput[0] = GetMotherCandidatePt(); | |
496 | containerInput[1] = GetMotherCandidateEta(); | |
497 | containerInput[2] = GetMotherCandidateMass(); | |
498 | } | |
ebcfaa7e | 499 | /* |
500 | if(fDoCF){ | |
501 | containerInput[0] = GetMotherCandidatePt(); | |
502 | containerInput[1] = GetMotherCandidateEta(); | |
503 | containerInput[2] = GetMotherCandidateMass(); | |
504 | ||
505 | fCFManager->GetParticleContainer()->Fill(containerInput,kStepLikeSign); // for CF | |
506 | fCFManager->GetParticleContainer()->Fill(containerInput,kStepTPCRefit); // for CF | |
507 | fCFManager->GetParticleContainer()->Fill(containerInput,kStepKinks); // for CF | |
508 | } | |
509 | */ | |
510 | ||
a0b94e5c | 511 | //checks if on the fly mode is set |
48e7eac2 | 512 | if ( !CheckV0FinderStatus(fCurrentV0IndexNumber) ){ |
a0b94e5c | 513 | if(fHistograms != NULL){ |
514 | fHistograms->FillHistogram("ESD_CutGetOnFly_InvMass",GetMotherCandidateMass()); | |
515 | } | |
516 | fCurrentV0IndexNumber++; | |
517 | continue; | |
518 | } | |
1e7846f4 | 519 | if(fDoCF){ |
520 | fCFManager->GetParticleContainer()->Fill(containerInput,kStepGetOnFly); // for CF | |
521 | } | |
ebcfaa7e | 522 | |
523 | if(fHistograms != NULL){ | |
524 | fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_InvMass",GetMotherCandidateMass()); | |
525 | } | |
48682642 | 526 | |
527 | Double_t armenterosQtAlfa[2]; | |
528 | GetArmenterosQtAlfa(GetNegativeKFParticle(), | |
529 | GetPositiveKFParticle(), | |
530 | GetMotherCandidateKFCombination(), | |
531 | armenterosQtAlfa); | |
532 | ||
533 | fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_alfa_qt",armenterosQtAlfa[1],armenterosQtAlfa[0]); | |
534 | ||
535 | ||
ebcfaa7e | 536 | if(fCurrentNegativeESDTrack->GetSign() == fCurrentPositiveESDTrack->GetSign()){ // avoid like sign |
537 | // iResult=kFALSE; | |
538 | if(fHistograms != NULL ){ | |
539 | fHistograms->FillHistogram("ESD_CutLikeSign_InvMass",GetMotherCandidateMass()); | |
540 | // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling | |
541 | // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end | |
542 | // fUpdateV0AlreadyCalled = kTRUE; | |
543 | } | |
544 | fCurrentV0IndexNumber++; | |
545 | continue; | |
546 | } | |
547 | if(fDoCF){ | |
548 | fCFManager->GetParticleContainer()->Fill(containerInput,kStepLikeSign); // for CF | |
549 | } | |
550 | ||
551 | ||
552 | if( !(fCurrentNegativeESDTrack->GetStatus() & AliESDtrack::kTPCrefit) || | |
553 | !(fCurrentPositiveESDTrack->GetStatus() & AliESDtrack::kTPCrefit) ){ | |
554 | // if( !(fCurrentNegativeESDTrack->GetStatus() & AliESDtrack::kITSrefit) || | |
555 | // !(fCurrentPositiveESDTrack->GetStatus() & AliESDtrack::kITSrefit) ){ | |
556 | // iResult=kFALSE; | |
557 | if(fHistograms != NULL){ | |
558 | fHistograms->FillHistogram("ESD_CutRefit_InvMass",GetMotherCandidateMass()); | |
559 | // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling | |
560 | // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end | |
561 | //fUpdateV0AlreadyCalled = kTRUE; | |
562 | } | |
563 | fCurrentV0IndexNumber++; | |
564 | continue; | |
565 | } | |
566 | if(fDoCF){ | |
567 | fCFManager->GetParticleContainer()->Fill(containerInput,kStepTPCRefit); // for CF | |
568 | } | |
569 | ||
570 | ||
571 | ||
572 | if( fCurrentNegativeESDTrack->GetKinkIndex(0) > 0 || | |
573 | fCurrentPositiveESDTrack->GetKinkIndex(0) > 0) { | |
574 | //iResult=kFALSE; | |
575 | if(fHistograms != NULL ){ | |
576 | fHistograms->FillHistogram("ESD_CutKink_InvMass",GetMotherCandidateMass()); | |
577 | // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling | |
578 | // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end | |
579 | //fUpdateV0AlreadyCalled = kTRUE; | |
580 | } | |
581 | fCurrentV0IndexNumber++; | |
582 | continue; | |
583 | } | |
584 | ||
585 | if(fDoCF){ | |
586 | fCFManager->GetParticleContainer()->Fill(containerInput,kStepKinks); // for CF | |
587 | } | |
588 | ||
589 | ||
590 | if(fDodEdxSigmaCut == kTRUE){ | |
9c1cb6f7 | 591 | if( fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kElectron)<fPIDnSigmaBelowElectronLine || |
592 | fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kElectron)>fPIDnSigmaAboveElectronLine || | |
593 | fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kElectron)<fPIDnSigmaBelowElectronLine || | |
594 | fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kElectron)>fPIDnSigmaAboveElectronLine ){ | |
ebcfaa7e | 595 | //iResult=kFALSE; |
596 | if(fHistograms != NULL ){ | |
597 | fHistograms->FillHistogram("ESD_CutdEdxSigmaElectronLine_InvMass",GetMotherCandidateMass()); | |
598 | // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling | |
599 | // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end | |
600 | //fUpdateV0AlreadyCalled = kTRUE; | |
601 | } | |
602 | fCurrentV0IndexNumber++; | |
603 | continue; | |
604 | } | |
605 | if(fDoCF){ | |
606 | fCFManager->GetParticleContainer()->Fill(containerInput,kStepdEdx_electronselection); // for CF | |
607 | } | |
608 | ||
10e3319b | 609 | if( fCurrentPositiveESDTrack->P()>fPIDMinPnSigmaAbovePionLine && fCurrentPositiveESDTrack->P()<fPIDMaxPnSigmaAbovePionLine ){ |
9c1cb6f7 | 610 | if(fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kElectron)>fPIDnSigmaBelowElectronLine && |
611 | fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kElectron)<fPIDnSigmaAboveElectronLine&& | |
612 | fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kPion)<fPIDnSigmaAbovePionLine){ | |
ebcfaa7e | 613 | // iResult=kFALSE; |
614 | if(fHistograms != NULL){ | |
615 | fHistograms->FillHistogram("ESD_CutdEdxSigmaPionLine_InvMass",GetMotherCandidateMass()); | |
616 | // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling | |
617 | // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end | |
618 | //fUpdateV0AlreadyCalled = kTRUE; | |
619 | } | |
620 | fCurrentV0IndexNumber++; | |
621 | continue; | |
622 | } | |
623 | } | |
624 | ||
10e3319b | 625 | if( fCurrentNegativeESDTrack->P()>fPIDMinPnSigmaAbovePionLine && fCurrentNegativeESDTrack->P()<fPIDMaxPnSigmaAbovePionLine){ |
9c1cb6f7 | 626 | if(fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kElectron)>fPIDnSigmaBelowElectronLine && |
627 | fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kElectron)<fPIDnSigmaAboveElectronLine&& | |
628 | fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kPion)<fPIDnSigmaAbovePionLine){ | |
ebcfaa7e | 629 | // iResult=kFALSE; |
630 | if(fHistograms != NULL){ | |
631 | fHistograms->FillHistogram("ESD_CutdEdxSigmaPionLine_InvMass",GetMotherCandidateMass()); | |
632 | // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling | |
633 | // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end | |
634 | //fUpdateV0AlreadyCalled = kTRUE; | |
635 | } | |
636 | fCurrentV0IndexNumber++; | |
637 | continue; | |
638 | } | |
639 | } | |
640 | if(fDoCF){ | |
641 | fCFManager->GetParticleContainer()->Fill(containerInput,kStepdEdx_pionrejection); // for CF | |
642 | } | |
643 | ||
644 | } | |
10e3319b | 645 | |
9c1cb6f7 | 646 | if(fDoKaonRejectionLowP == kTRUE){ |
647 | if( fCurrentNegativeESDTrack->P()<fPIDMinPKaonRejectionLowP ){ | |
648 | if( TMath::Abs(fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kKaon))<fPIDnSigmaAtLowPAroundKaonLine){ | |
649 | if(fHistograms != NULL){ | |
650 | fHistograms->FillHistogram("ESD_CutKaonRejectionLowP_InvMass",GetMotherCandidateMass()); | |
651 | // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling | |
652 | // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end | |
653 | //fUpdateV0AlreadyCalled = kTRUE; | |
654 | } | |
655 | fCurrentV0IndexNumber++; | |
656 | continue; | |
657 | } | |
658 | } | |
659 | if( fCurrentPositiveESDTrack->P()<fPIDMinPKaonRejectionLowP ){ | |
660 | if( TMath::Abs(fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kKaon))<fPIDnSigmaAtLowPAroundKaonLine){ | |
661 | if(fHistograms != NULL){ | |
662 | fHistograms->FillHistogram("ESD_CutKaonRejectionLowP_InvMass",GetMotherCandidateMass()); | |
663 | // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling | |
664 | // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end | |
665 | //fUpdateV0AlreadyCalled = kTRUE; | |
666 | } | |
667 | fCurrentV0IndexNumber++; | |
668 | continue; | |
669 | } | |
670 | } | |
671 | } | |
10e3319b | 672 | |
9c1cb6f7 | 673 | if(fDoProtonRejectionLowP == kTRUE){ |
674 | if( fCurrentNegativeESDTrack->P()<fPIDMinPProtonRejectionLowP){ | |
675 | if( TMath::Abs(fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kProton))<fPIDnSigmaAtLowPAroundProtonLine){ | |
676 | if(fHistograms != NULL){ | |
677 | fHistograms->FillHistogram("ESD_CutProtonRejectionLowP_InvMass",GetMotherCandidateMass()); | |
678 | // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling | |
679 | // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end | |
680 | //fUpdateV0AlreadyCalled = kTRUE; | |
681 | } | |
682 | fCurrentV0IndexNumber++; | |
683 | continue; | |
684 | } | |
685 | } | |
686 | if( fCurrentPositiveESDTrack->P()<fPIDMinPProtonRejectionLowP ){ | |
687 | if( TMath::Abs(fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kProton))<fPIDnSigmaAtLowPAroundProtonLine){ | |
688 | if(fHistograms != NULL){ | |
689 | fHistograms->FillHistogram("ESD_CutProtonRejectionLowP_InvMass",GetMotherCandidateMass()); | |
690 | // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling | |
691 | // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end | |
692 | //fUpdateV0AlreadyCalled = kTRUE; | |
693 | } | |
694 | fCurrentV0IndexNumber++; | |
695 | continue; | |
696 | } | |
697 | } | |
698 | ||
699 | } | |
10e3319b | 700 | |
9c1cb6f7 | 701 | if(fDoPionRejectionLowP == kTRUE){ |
702 | if( fCurrentNegativeESDTrack->P()<fPIDMinPPionRejectionLowP ){ | |
703 | if( TMath::Abs(fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kPion))<fPIDnSigmaAtLowPAroundPionLine){ | |
704 | if(fHistograms != NULL){ | |
705 | fHistograms->FillHistogram("ESD_CutPionRejectionLowP_InvMass",GetMotherCandidateMass()); | |
706 | // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling | |
707 | // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end | |
708 | //fUpdateV0AlreadyCalled = kTRUE; | |
709 | } | |
710 | fCurrentV0IndexNumber++; | |
711 | continue; | |
712 | } | |
713 | } | |
714 | if( fCurrentPositiveESDTrack->P()<fPIDMinPPionRejectionLowP ){ | |
715 | if( TMath::Abs(fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kPion))<fPIDnSigmaAtLowPAroundPionLine){ | |
716 | if(fHistograms != NULL){ | |
717 | fHistograms->FillHistogram("ESD_CutPionRejectionLowP_InvMass",GetMotherCandidateMass()); | |
718 | // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling | |
719 | // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end | |
720 | //fUpdateV0AlreadyCalled = kTRUE; | |
721 | } | |
722 | fCurrentV0IndexNumber++; | |
723 | continue; | |
724 | } | |
725 | } | |
726 | } | |
727 | ||
10e3319b | 728 | |
70ef88b5 | 729 | // Gamma selection based on QT from Armenteros |
730 | if(fDoQtGammaSelection == kTRUE){ | |
731 | if(armenterosQtAlfa[0]>fQtMax){ | |
732 | if(fHistograms != NULL){ | |
733 | fHistograms->FillHistogram("ESD_CutQt_InvMass",GetMotherCandidateMass()); | |
734 | } | |
735 | fCurrentV0IndexNumber++; | |
736 | continue; | |
737 | } | |
738 | } | |
739 | ||
a0b94e5c | 740 | //checks if we have a prim vertex |
c8206114 | 741 | //if(fESDEvent->GetPrimaryVertex()->GetNContributors()<=0) { |
742 | if(GetNumberOfContributorsVtx()<=0) { | |
a0b94e5c | 743 | if(fHistograms != NULL){ |
744 | fHistograms->FillHistogram("ESD_CutNContributors_InvMass",GetMotherCandidateMass()); | |
745 | } | |
746 | fCurrentV0IndexNumber++; | |
747 | continue; | |
748 | } | |
1e7846f4 | 749 | if(fDoCF){ |
750 | fCFManager->GetParticleContainer()->Fill(containerInput,kStepNContributors); // for CF | |
751 | } | |
a0b94e5c | 752 | |
753 | //Check the pid probability | |
754 | if(CheckPIDProbability(fPIDProbabilityCutNegativeParticle,fPIDProbabilityCutPositiveParticle)==kFALSE){ | |
755 | if(fHistograms != NULL){ | |
756 | fHistograms->FillHistogram("ESD_CutPIDProb_InvMass",GetMotherCandidateMass()); | |
757 | } | |
758 | fCurrentV0IndexNumber++; | |
759 | continue; | |
760 | } | |
1e7846f4 | 761 | if(fDoCF){ |
762 | fCFManager->GetParticleContainer()->Fill(containerInput,kStepTPCPID); // for CF | |
763 | } | |
a0b94e5c | 764 | |
a0b94e5c | 765 | if(GetXYRadius()>fMaxR){ // cuts on distance from collision point |
766 | if(fHistograms != NULL){ | |
767 | fHistograms->FillHistogram("ESD_CutR_InvMass",GetMotherCandidateMass()); | |
768 | } | |
769 | fCurrentV0IndexNumber++; | |
770 | continue; | |
1e7846f4 | 771 | } |
772 | if(fDoCF){ | |
773 | fCFManager->GetParticleContainer()->Fill(containerInput,kStepR); // for CF | |
774 | } | |
bd6d9fa3 | 775 | if(GetXYRadius()<fMinR){ // cuts on distance from collision point |
776 | if(fHistograms != NULL){ | |
777 | fHistograms->FillHistogram("ESD_CutMinR_InvMass",GetMotherCandidateMass()); | |
778 | } | |
779 | fCurrentV0IndexNumber++; | |
780 | continue; | |
781 | } | |
a0b94e5c | 782 | |
bd6d9fa3 | 783 | |
a0b94e5c | 784 | |
785 | if((TMath::Abs(fCurrentZValue)*fLineCutZRSlope)-fLineCutZValue > GetXYRadius() ){ // cuts out regions where we do not reconstruct | |
786 | if(fHistograms != NULL){ | |
787 | fHistograms->FillHistogram("ESD_CutLine_InvMass",GetMotherCandidateMass()); | |
788 | } | |
789 | fCurrentV0IndexNumber++; | |
790 | continue; | |
1e7846f4 | 791 | } |
792 | if(fDoCF){ | |
793 | fCFManager->GetParticleContainer()->Fill(containerInput,kStepLine); // for CF | |
794 | } | |
a0b94e5c | 795 | |
796 | if(TMath::Abs(fCurrentZValue) > fMaxZ ){ // cuts out regions where we do not reconstruct | |
797 | if(fHistograms != NULL){ | |
798 | fHistograms->FillHistogram("ESD_CutZ_InvMass",GetMotherCandidateMass()); | |
799 | } | |
800 | fCurrentV0IndexNumber++; | |
801 | continue; | |
1e7846f4 | 802 | } |
803 | if(fDoCF){ | |
804 | fCFManager->GetParticleContainer()->Fill(containerInput,kStepZ); // for CF | |
805 | } | |
a0b94e5c | 806 | |
807 | /* Moved further up so corr framework can work | |
808 | if(UpdateV0Information() == kFALSE){ | |
809 | fCurrentV0IndexNumber++; | |
810 | continue; | |
811 | } | |
812 | */ | |
48682642 | 813 | if(fCurrentNegativeESDTrack->GetNcls(1) < fMinClsTPC || fCurrentPositiveESDTrack->GetNcls(1) < fMinClsTPC ){ |
814 | if(fHistograms != NULL){ | |
815 | fHistograms->FillHistogram("ESD_CutMinNClsTPC_InvMass",GetMotherCandidateMass()); | |
816 | } | |
817 | fCurrentV0IndexNumber++; | |
818 | continue; | |
819 | } | |
820 | if(fDoCF){ | |
821 | fCFManager->GetParticleContainer()->Fill(containerInput,kStepMinClsTPC); // for CF | |
822 | } | |
bd6d9fa3 | 823 | Double_t NegclsToF = 0.; |
824 | if(fCurrentNegativeESDTrack->GetTPCNclsF()!=0 ){ | |
825 | NegclsToF = (Double_t)fCurrentNegativeESDTrack->GetNcls(1)/(Double_t)fCurrentNegativeESDTrack->GetTPCNclsF(); | |
826 | } | |
827 | ||
828 | Double_t PosclsToF = 0.; | |
829 | if(fCurrentPositiveESDTrack->GetTPCNclsF()!=0 ){ | |
830 | PosclsToF = (Double_t)fCurrentPositiveESDTrack->GetNcls(1)/(Double_t)fCurrentPositiveESDTrack->GetTPCNclsF(); | |
831 | } | |
832 | ||
833 | if( NegclsToF < fMinClsTPCToF || PosclsToF < fMinClsTPCToF ){ | |
834 | if(fHistograms != NULL){ | |
835 | fHistograms->FillHistogram("ESD_CutMinNClsTPCToF_InvMass",GetMotherCandidateMass()); | |
836 | } | |
837 | fCurrentV0IndexNumber++; | |
838 | continue; | |
839 | } | |
840 | ||
841 | ||
9640a3d1 | 842 | |
a0b94e5c | 843 | |
844 | if(fUseKFParticle){ | |
48682642 | 845 | |
846 | ||
847 | if( fCurrentNegativeKFParticle->GetPt()< fSinglePtCut || fCurrentPositiveKFParticle->GetPt()< fSinglePtCut){ | |
848 | if(fHistograms != NULL){ | |
849 | fHistograms->FillHistogram("ESD_CutSinglePt_InvMass",GetMotherCandidateMass()); | |
850 | } | |
851 | fCurrentV0IndexNumber++; | |
852 | continue; | |
853 | } | |
854 | if(fDoCF){ | |
855 | fCFManager->GetParticleContainer()->Fill(containerInput,kStepSinglePt); // for CF | |
856 | } | |
857 | ||
858 | ||
a0b94e5c | 859 | if(fCurrentMotherKFCandidate->GetNDF()<=0){ |
860 | if(fHistograms != NULL){ | |
861 | fHistograms->FillHistogram("ESD_CutNDF_InvMass",GetMotherCandidateMass()); | |
862 | } | |
863 | fCurrentV0IndexNumber++; | |
864 | continue; | |
865 | } | |
1e7846f4 | 866 | if(fDoCF){ |
867 | fCFManager->GetParticleContainer()->Fill(containerInput,kStepNDF); // for CF | |
868 | } | |
a0b94e5c | 869 | |
870 | Double_t chi2V0 = fCurrentMotherKFCandidate->GetChi2()/fCurrentMotherKFCandidate->GetNDF(); | |
871 | if(chi2V0 > fChi2CutConversion || chi2V0 <=0){ | |
872 | if(fHistograms != NULL){ | |
873 | fHistograms->FillHistogram("ESD_CutChi2_InvMass",GetMotherCandidateMass()); | |
874 | } | |
875 | fCurrentV0IndexNumber++; | |
876 | continue; | |
877 | } | |
1e7846f4 | 878 | if(fDoCF){ |
879 | fCFManager->GetParticleContainer()->Fill(containerInput,kStepChi2); // for CF | |
880 | } | |
a0b94e5c | 881 | |
882 | if(TMath::Abs(fMotherCandidateLorentzVector->Eta())> fEtaCut){ | |
883 | if(fHistograms != NULL){ | |
884 | fHistograms->FillHistogram("ESD_CutEta_InvMass",GetMotherCandidateMass()); | |
885 | } | |
886 | fCurrentV0IndexNumber++; | |
887 | continue; | |
888 | } | |
10e3319b | 889 | |
890 | if(TMath::Abs(fCurrentNegativeKFParticle->GetEta())> fEtaCut){ | |
891 | if(fHistograms != NULL){ | |
892 | fHistograms->FillHistogram("ESD_CutEta_InvMass",GetMotherCandidateMass()); | |
893 | } | |
894 | fCurrentV0IndexNumber++; | |
895 | continue; | |
896 | } | |
897 | ||
898 | if(TMath::Abs(fCurrentPositiveKFParticle->GetEta())> fEtaCut){ | |
899 | if(fHistograms != NULL){ | |
900 | fHistograms->FillHistogram("ESD_CutEta_InvMass",GetMotherCandidateMass()); | |
901 | } | |
902 | fCurrentV0IndexNumber++; | |
903 | continue; | |
904 | } | |
905 | ||
1e7846f4 | 906 | if(fDoCF){ |
907 | fCFManager->GetParticleContainer()->Fill(containerInput,kStepEta); // for CF | |
908 | } | |
a0b94e5c | 909 | |
910 | if(fMotherCandidateLorentzVector->Pt()<fPtCut){ | |
911 | if(fHistograms != NULL){ | |
912 | fHistograms->FillHistogram("ESD_CutPt_InvMass",GetMotherCandidateMass()); | |
913 | } | |
914 | fCurrentV0IndexNumber++; | |
915 | continue; | |
916 | } | |
1e7846f4 | 917 | if(fDoCF){ |
918 | fCFManager->GetParticleContainer()->Fill(containerInput,kStepPt); // for CF | |
919 | } | |
a0b94e5c | 920 | |
921 | } | |
922 | else if(fUseESDTrack){ | |
923 | //TODO | |
924 | } | |
9640a3d1 | 925 | |
926 | if(fHistograms != NULL){ | |
927 | fHistograms->FillHistogram("ESD_GoodV0s_InvMass",GetMotherCandidateMass()); | |
928 | } | |
929 | ||
5e55d806 | 930 | // fCurrentEventGoodV0s.push_back(*fCurrentMotherKFCandidate); |
931 | ||
932 | new((*fCurrentEventGoodV0s)[fCurrentEventGoodV0s->GetEntriesFast()]) AliKFParticle(*fCurrentMotherKFCandidate); | |
7f3c7cc6 | 933 | fV0Pindex.push_back(fCurrentV0->GetPindex()); |
934 | fV0Nindex.push_back(fCurrentV0->GetNindex()); | |
5e55d806 | 935 | |
a0b94e5c | 936 | iResult=kTRUE;//means we have a v0 who survived all the cuts applied |
937 | ||
5ce758b0 | 938 | fNumberOfGoodV0s++; |
939 | ||
a0b94e5c | 940 | fCurrentV0IndexNumber++; |
941 | ||
942 | break; | |
943 | } | |
944 | return iResult; | |
945 | } | |
946 | ||
947 | Bool_t AliV0Reader::UpdateV0Information(){ | |
948 | //see header file for documentation | |
949 | ||
950 | Bool_t iResult=kTRUE; // for taking out not refitted, kinks and like sign tracks | |
951 | ||
952 | Bool_t switchTracks = kFALSE; | |
953 | ||
954 | fCurrentNegativeESDTrack = fESDEvent->GetTrack(fCurrentV0->GetNindex()); | |
955 | fCurrentPositiveESDTrack = fESDEvent->GetTrack(fCurrentV0->GetPindex()); | |
ebcfaa7e | 956 | |
957 | if(fCurrentPositiveESDTrack->GetSign() == -1 && fCurrentNegativeESDTrack->GetSign() == 1){ // switch wrong signed tracks | |
958 | fCurrentNegativeESDTrack = fESDEvent->GetTrack(fCurrentV0->GetPindex()); | |
959 | fCurrentPositiveESDTrack = fESDEvent->GetTrack(fCurrentV0->GetNindex()); | |
960 | switchTracks = kTRUE; | |
961 | } | |
a0b94e5c | 962 | |
a0b94e5c | 963 | if(fCurrentNegativeKFParticle != NULL){ |
964 | delete fCurrentNegativeKFParticle; | |
965 | } | |
966 | if(switchTracks == kFALSE){ | |
967 | fCurrentNegativeKFParticle = new AliKFParticle(*(fCurrentV0->GetParamN()),fNegativeTrackPID); | |
968 | } | |
969 | else{ | |
970 | fCurrentNegativeKFParticle = new AliKFParticle(*(fCurrentV0->GetParamP()),fNegativeTrackPID); | |
971 | } | |
972 | ||
973 | if(fCurrentPositiveKFParticle != NULL){ | |
974 | delete fCurrentPositiveKFParticle; | |
975 | } | |
976 | if(switchTracks == kFALSE){ | |
977 | fCurrentPositiveKFParticle = new AliKFParticle(*(fCurrentV0->GetParamP()),fPositiveTrackPID); | |
978 | } | |
979 | else{ | |
980 | fCurrentPositiveKFParticle = new AliKFParticle(*(fCurrentV0->GetParamN()),fPositiveTrackPID); | |
981 | } | |
982 | ||
983 | if(fCurrentMotherKFCandidate != NULL){ | |
984 | delete fCurrentMotherKFCandidate; | |
985 | } | |
5ce758b0 | 986 | |
987 | if(fUseConstructGamma==kTRUE){ | |
988 | fCurrentMotherKFCandidate = new AliKFParticle;//(*fCurrentNegativeKFParticle,*fCurrentPositiveKFParticle); | |
989 | fCurrentMotherKFCandidate->ConstructGamma(*fCurrentNegativeKFParticle,*fCurrentPositiveKFParticle); | |
990 | }else{ | |
991 | fCurrentMotherKFCandidate = new AliKFParticle(*fCurrentNegativeKFParticle,*fCurrentPositiveKFParticle); | |
992 | if(fPositiveTrackPID==-11 && fNegativeTrackPID==11){ | |
993 | fCurrentMotherKFCandidate->SetMassConstraint(0,fNSigmaMass); | |
994 | } | |
a0b94e5c | 995 | } |
a0b94e5c | 996 | if(fUseImprovedVertex == kTRUE){ |
997 | AliKFVertex primaryVertexImproved(*GetPrimaryVertex()); | |
998 | primaryVertexImproved+=*fCurrentMotherKFCandidate; | |
999 | fCurrentMotherKFCandidate->SetProductionVertex(primaryVertexImproved); | |
1000 | } | |
1001 | ||
1002 | fCurrentMotherKFCandidate->GetMass(fMotherCandidateKFMass,fMotherCandidateKFWidth); | |
ebcfaa7e | 1003 | |
a0b94e5c | 1004 | if(fNegativeTrackLorentzVector != NULL){ |
1005 | delete fNegativeTrackLorentzVector; | |
1006 | } | |
1007 | if(fUseKFParticle){ | |
1008 | fNegativeTrackLorentzVector = new TLorentzVector(fCurrentNegativeKFParticle->Px(),fCurrentNegativeKFParticle->Py(),fCurrentNegativeKFParticle->Pz()); | |
1009 | } | |
1010 | else if(fUseESDTrack){ | |
1011 | fNegativeTrackLorentzVector = new TLorentzVector(fCurrentNegativeESDTrack->Px(),fCurrentNegativeESDTrack->Py(),fCurrentNegativeESDTrack->Pz()); | |
1012 | } | |
1013 | ||
1014 | if(fPositiveTrackLorentzVector != NULL){ | |
1015 | delete fPositiveTrackLorentzVector; | |
1016 | } | |
1017 | if(fUseKFParticle){ | |
1018 | fPositiveTrackLorentzVector = new TLorentzVector(fCurrentPositiveKFParticle->Px(),fCurrentPositiveKFParticle->Py(),fCurrentPositiveKFParticle->Pz()); | |
1019 | } | |
1020 | else if(fUseESDTrack){ | |
1021 | fPositiveTrackLorentzVector = new TLorentzVector(fCurrentPositiveESDTrack->Px(),fCurrentPositiveESDTrack->Py(),fCurrentPositiveESDTrack->Pz()); | |
1022 | } | |
1023 | ||
1024 | if(fMotherCandidateLorentzVector != NULL){ | |
1025 | delete fMotherCandidateLorentzVector; | |
1026 | } | |
1027 | if(fUseKFParticle){ | |
1028 | fMotherCandidateLorentzVector = new TLorentzVector(*fNegativeTrackLorentzVector + *fPositiveTrackLorentzVector); | |
1029 | } | |
1030 | else if(fUseESDTrack){ | |
1031 | fMotherCandidateLorentzVector = new TLorentzVector(*fNegativeTrackLorentzVector + *fPositiveTrackLorentzVector); | |
1032 | } | |
1033 | ||
1034 | if(fPositiveTrackPID==-11 && fNegativeTrackPID==11){ | |
1035 | fMotherCandidateLorentzVector->SetXYZM(fMotherCandidateLorentzVector->Px() ,fMotherCandidateLorentzVector->Py(),fMotherCandidateLorentzVector->Pz(),0.); | |
1036 | } | |
1037 | ||
1038 | ||
1039 | if(fDoMC == kTRUE){ | |
1040 | fMotherMCParticle= NULL; | |
1041 | fNegativeMCParticle = fMCStack->Particle(TMath::Abs(fESDEvent->GetTrack(fCurrentV0->GetNindex())->GetLabel())); | |
1042 | fPositiveMCParticle = fMCStack->Particle(TMath::Abs(fESDEvent->GetTrack(fCurrentV0->GetPindex())->GetLabel())); | |
1043 | if(fPositiveMCParticle->GetMother(0)>-1){ | |
1044 | fMotherMCParticle = fMCStack->Particle(fPositiveMCParticle->GetMother(0)); | |
1045 | } | |
1046 | } | |
1047 | ||
a0b94e5c | 1048 | |
1049 | // for CF | |
ebcfaa7e | 1050 | // Double_t containerInput[3]; |
1051 | // if(fDoCF){ | |
1052 | // containerInput[0] = GetMotherCandidatePt(); | |
1053 | // containerInput[1] = GetMotherCandidateEta(); | |
1054 | // containerInput[2] = GetMotherCandidateMass(); | |
1e7846f4 | 1055 | |
ebcfaa7e | 1056 | // fCFManager->GetParticleContainer()->Fill(containerInput,kStepLikeSign); // for CF |
1057 | // fCFManager->GetParticleContainer()->Fill(containerInput,kStepTPCRefit); // for CF | |
1058 | // fCFManager->GetParticleContainer()->Fill(containerInput,kStepKinks); // for CF | |
1059 | // } | |
cb90a330 | 1060 | |
1061 | ||
1062 | if(fUseOwnXYZCalculation == kFALSE){ | |
5ce758b0 | 1063 | if(fUseConstructGamma == kFALSE){ |
1064 | fCurrentV0->GetXYZ(fCurrentXValue,fCurrentYValue,fCurrentZValue); | |
1065 | }else{ | |
1066 | fCurrentXValue=GetMotherCandidateKFCombination()->GetX(); | |
1067 | fCurrentYValue=GetMotherCandidateKFCombination()->GetY(); | |
1068 | fCurrentZValue=GetMotherCandidateKFCombination()->GetZ(); | |
1069 | } | |
cb90a330 | 1070 | } |
1071 | else{ | |
1072 | Double_t convpos[2]; | |
1073 | convpos[0]=0; | |
1074 | convpos[1]=0; | |
9c1cb6f7 | 1075 | |
cb90a330 | 1076 | GetConvPosXY(GetPositiveESDTrack(),GetNegativeESDTrack(),GetMagneticField(),convpos); |
1077 | fCurrentXValue = convpos[0]; | |
1078 | fCurrentYValue = convpos[1]; | |
1079 | fCurrentZValue = GetConvPosZ(GetPositiveESDTrack(),GetNegativeESDTrack(),GetMagneticField()); | |
1080 | } | |
ebcfaa7e | 1081 | /* |
51372c5d | 1082 | if(fCurrentNegativeESDTrack->GetSign() == fCurrentPositiveESDTrack->GetSign()){ // avoid like sign |
1083 | iResult=kFALSE; | |
ebcfaa7e | 1084 | if(fHistograms != NULL && fUpdateV0AlreadyCalled == kFALSE && doFillHistos == kTRUE){ |
51372c5d | 1085 | fHistograms->FillHistogram("ESD_CutLikeSign_InvMass",GetMotherCandidateMass()); |
1086 | // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling | |
1087 | // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end | |
1088 | fUpdateV0AlreadyCalled = kTRUE; | |
1089 | } | |
1090 | } | |
1091 | ||
51372c5d | 1092 | if( !(fCurrentNegativeESDTrack->GetStatus() & AliESDtrack::kTPCrefit) || |
1093 | !(fCurrentPositiveESDTrack->GetStatus() & AliESDtrack::kTPCrefit) ){ | |
1094 | // if( !(fCurrentNegativeESDTrack->GetStatus() & AliESDtrack::kITSrefit) || | |
1095 | // !(fCurrentPositiveESDTrack->GetStatus() & AliESDtrack::kITSrefit) ){ | |
1096 | iResult=kFALSE; | |
ebcfaa7e | 1097 | if(fHistograms != NULL && fUpdateV0AlreadyCalled == kFALSE && doFillHistos == kTRUE){ |
51372c5d | 1098 | fHistograms->FillHistogram("ESD_CutRefit_InvMass",GetMotherCandidateMass()); |
1099 | // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling | |
1100 | // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end | |
1101 | fUpdateV0AlreadyCalled = kTRUE; | |
1102 | } | |
1103 | } | |
1104 | ||
1105 | if( fCurrentNegativeESDTrack->GetKinkIndex(0) > 0 || | |
1106 | fCurrentPositiveESDTrack->GetKinkIndex(0) > 0) { | |
1107 | ||
1108 | iResult=kFALSE; | |
ebcfaa7e | 1109 | if(fHistograms != NULL && fUpdateV0AlreadyCalled == kFALSE && doFillHistos == kTRUE ){ |
51372c5d | 1110 | fHistograms->FillHistogram("ESD_CutKink_InvMass",GetMotherCandidateMass()); |
1111 | // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling | |
1112 | // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end | |
1113 | fUpdateV0AlreadyCalled = kTRUE; | |
1114 | } | |
1115 | } | |
1116 | ||
1117 | if(fDodEdxSigmaCut == kTRUE){ | |
cb90a330 | 1118 | |
51372c5d | 1119 | if( fESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kElectron)<fPIDnSigmaBelowElectronLine || |
1120 | fESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kElectron)>fPIDnSigmaAboveElectronLine || | |
1121 | fESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kElectron)<fPIDnSigmaBelowElectronLine || | |
1122 | fESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kElectron)>fPIDnSigmaAboveElectronLine ){ | |
1123 | iResult=kFALSE; | |
ebcfaa7e | 1124 | if(fHistograms != NULL && fUpdateV0AlreadyCalled == kFALSE && doFillHistos == kTRUE){ |
51372c5d | 1125 | fHistograms->FillHistogram("ESD_CutdEdxSigmaElectronLine_InvMass",GetMotherCandidateMass()); |
1126 | // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling | |
1127 | // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end | |
1128 | fUpdateV0AlreadyCalled = kTRUE; | |
1129 | } | |
1130 | } | |
1131 | if( fCurrentPositiveESDTrack->P()>fPIDMinPnSigmaAbovePionLine){ | |
1132 | if(fESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kElectron)>fPIDnSigmaBelowElectronLine && | |
1133 | fESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kElectron)<fPIDnSigmaAboveElectronLine&& | |
1134 | fESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kPion)<fPIDnSigmaAbovePionLine){ | |
1135 | iResult=kFALSE; | |
ebcfaa7e | 1136 | if(fHistograms != NULL && fUpdateV0AlreadyCalled == kFALSE && doFillHistos == kTRUE){ |
51372c5d | 1137 | fHistograms->FillHistogram("ESD_CutdEdxSigmaPionLine_InvMass",GetMotherCandidateMass()); |
1138 | // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling | |
1139 | // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end | |
1140 | fUpdateV0AlreadyCalled = kTRUE; | |
1141 | } | |
1142 | } | |
1143 | } | |
1144 | ||
1145 | if( fCurrentNegativeESDTrack->P()>fPIDMinPnSigmaAbovePionLine){ | |
1146 | if(fESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kElectron)>fPIDnSigmaBelowElectronLine && | |
1147 | fESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kElectron)<fPIDnSigmaAboveElectronLine&& | |
1148 | fESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kPion)<fPIDnSigmaAbovePionLine){ | |
1149 | iResult=kFALSE; | |
ebcfaa7e | 1150 | if(fHistograms != NULL && fUpdateV0AlreadyCalled == kFALSE && doFillHistos == kTRUE ){ |
51372c5d | 1151 | fHistograms->FillHistogram("ESD_CutdEdxSigmaPionLine_InvMass",GetMotherCandidateMass()); |
1152 | // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling | |
1153 | // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end | |
1154 | fUpdateV0AlreadyCalled = kTRUE; | |
1155 | } | |
1156 | } | |
1157 | } | |
1158 | } | |
ebcfaa7e | 1159 | */ |
cb90a330 | 1160 | fUpdateV0AlreadyCalled = kTRUE; |
1161 | ||
a0b94e5c | 1162 | return iResult; |
1163 | } | |
1164 | ||
1165 | ||
1166 | ||
1167 | Bool_t AliV0Reader::HasSameMCMother(){ | |
1168 | //see header file for documentation | |
1169 | ||
1170 | Bool_t iResult = kFALSE; | |
1171 | if(fDoMC == kTRUE){ | |
1172 | if(fNegativeMCParticle != NULL && fPositiveMCParticle != NULL){ | |
1173 | if(fNegativeMCParticle->GetMother(0) == fPositiveMCParticle->GetMother(0)) | |
1174 | if(fMotherMCParticle){ | |
1175 | iResult = kTRUE; | |
1176 | } | |
1177 | } | |
1178 | } | |
1179 | return iResult; | |
1180 | } | |
1181 | ||
1182 | Bool_t AliV0Reader::CheckPIDProbability(Double_t negProbCut, Double_t posProbCut){ | |
1183 | //see header file for documentation | |
1184 | ||
1185 | Bool_t iResult=kFALSE; | |
1186 | ||
9c1cb6f7 | 1187 | // Double_t *posProbArray = new Double_t[10]; |
1188 | // Double_t *negProbArray = new Double_t[10]; | |
1189 | //-AM The TPCpid method expects an array of length kSPECIES that is 5 not 10 | |
1190 | ||
1191 | Double_t *posProbArray = new Double_t[AliPID::kSPECIES]; | |
1192 | Double_t *negProbArray = new Double_t[AliPID::kSPECIES]; | |
1193 | ||
1194 | AliESDtrack* negTrack = GetNegativeESDTrack(); | |
1195 | AliESDtrack* posTrack = GetPositiveESDTrack(); | |
1196 | //fESDEvent->GetTrack(fCurrentV0->GetNindex()); | |
1197 | //fESDEvent->GetTrack(fCurrentV0->GetPindex()); | |
1198 | //-AM for switchtracks==true the above is a bug | |
1199 | ||
a0b94e5c | 1200 | negTrack->GetTPCpid(negProbArray); |
1201 | posTrack->GetTPCpid(posProbArray); | |
1202 | ||
4a6157dc | 1203 | // if(negProbArray != NULL && posProbArray != NULL){ // this is not allowed anymore for some reason(RC19) |
1204 | if(negProbArray && posProbArray){ | |
a0b94e5c | 1205 | if(negProbArray[GetSpeciesIndex(-1)]>=negProbCut && posProbArray[GetSpeciesIndex(1)]>=posProbCut){ |
1206 | iResult=kTRUE; | |
1207 | } | |
1208 | } | |
1209 | delete [] posProbArray; | |
1210 | delete [] negProbArray; | |
1211 | return iResult; | |
1212 | } | |
1213 | ||
1214 | void AliV0Reader::GetPIDProbability(Double_t &negPIDProb,Double_t & posPIDProb){ | |
4a6157dc | 1215 | // see header file for documentation |
1216 | ||
9c1cb6f7 | 1217 | //Double_t *posProbArray = new Double_t[10]; |
1218 | // Double_t *negProbArray = new Double_t[10]; | |
1219 | //-AM The TPCpid method expects an array of length kSPECIES that is 5 not 10 | |
1220 | Double_t *posProbArray = new Double_t[AliPID::kSPECIES]; | |
1221 | Double_t *negProbArray = new Double_t[AliPID::kSPECIES]; | |
1222 | ||
1223 | // AliESDtrack* negTrack = fESDEvent->GetTrack(fCurrentV0->GetNindex()); | |
1224 | // AliESDtrack* posTrack = fESDEvent->GetTrack(fCurrentV0->GetPindex()); | |
1225 | //-AM for switchtracks the above is a bug | |
1226 | AliESDtrack* negTrack = GetNegativeESDTrack(); | |
1227 | AliESDtrack* posTrack = GetPositiveESDTrack(); | |
1228 | ||
1229 | ||
a0b94e5c | 1230 | negTrack->GetTPCpid(negProbArray); |
1231 | posTrack->GetTPCpid(posProbArray); | |
1232 | ||
4a6157dc | 1233 | // if(negProbArray!=NULL && posProbArray!=NULL){ // this is not allowed anymore for some reason(RC19) |
1234 | if(negProbArray && posProbArray){ | |
a0b94e5c | 1235 | negPIDProb = negProbArray[GetSpeciesIndex(-1)]; |
1236 | posPIDProb = posProbArray[GetSpeciesIndex(1)]; | |
1237 | } | |
1238 | delete [] posProbArray; | |
1239 | delete [] negProbArray; | |
1240 | } | |
9c1cb6f7 | 1241 | void AliV0Reader::GetPIDProbabilityMuonPion(Double_t &negPIDProb,Double_t & posPIDProb){ |
1242 | // see header file for documentation | |
1243 | ||
1244 | ||
1245 | Double_t *posProbArray = new Double_t[AliPID::kSPECIES]; | |
1246 | Double_t *negProbArray = new Double_t[AliPID::kSPECIES]; | |
1247 | ||
1248 | // AliESDtrack* negTrack = fESDEvent->GetTrack(fCurrentV0->GetNindex()); | |
1249 | // AliESDtrack* posTrack = fESDEvent->GetTrack(fCurrentV0->GetPindex()); | |
1250 | //-AM for switchtracks the above is a bug | |
1251 | ||
1252 | AliESDtrack* negTrack = GetNegativeESDTrack(); | |
1253 | AliESDtrack* posTrack = GetPositiveESDTrack(); | |
1254 | ||
1255 | negTrack->GetTPCpid(negProbArray); | |
1256 | posTrack->GetTPCpid(posProbArray); | |
1257 | ||
1258 | // if(negProbArray!=NULL && posProbArray!=NULL){ // this is not allowed anymore for some reason(RC19) | |
1259 | if(negProbArray && posProbArray){ | |
1260 | negPIDProb = negProbArray[1]+negProbArray[2]; | |
1261 | posPIDProb = posProbArray[1]+posProbArray[2]; | |
1262 | } | |
1263 | delete [] posProbArray; | |
1264 | delete [] negProbArray; | |
1265 | } | |
a0b94e5c | 1266 | |
1267 | void AliV0Reader::UpdateEventByEventData(){ | |
1268 | //see header file for documentation | |
5e55d806 | 1269 | if(fCurrentEventGoodV0s->GetEntriesFast() >0 ){ |
87f6de3e | 1270 | if(fCalculateBackground){ |
5ce758b0 | 1271 | if(fUseChargedTrackMultiplicityForBG == kTRUE){ |
1272 | fBGEventHandler->AddEvent(fCurrentEventGoodV0s,fESDEvent->GetPrimaryVertex()->GetX(),fESDEvent->GetPrimaryVertex()->GetY(),fESDEvent->GetPrimaryVertex()->GetZ(),CountESDTracks()); | |
1273 | //filling z and multiplicity histograms | |
1274 | fHistograms->FillHistogram("ESD_Z_distribution",fESDEvent->GetPrimaryVertex()->GetZ()); | |
1275 | fHistograms->FillHistogram("ESD_multiplicity_distribution",CountESDTracks()); | |
1276 | fHistograms->FillHistogram("ESD_ZvsMultiplicity",fESDEvent->GetPrimaryVertex()->GetZ(),CountESDTracks()); | |
1277 | } | |
1278 | else{ // means we use #V0s for multiplicity | |
1279 | fBGEventHandler->AddEvent(fCurrentEventGoodV0s,fESDEvent->GetPrimaryVertex()->GetX(),fESDEvent->GetPrimaryVertex()->GetY(),fESDEvent->GetPrimaryVertex()->GetZ(),fNumberOfGoodV0s); | |
1280 | //filling z and multiplicity histograms | |
1281 | fHistograms->FillHistogram("ESD_Z_distribution",fESDEvent->GetPrimaryVertex()->GetZ()); | |
1282 | fHistograms->FillHistogram("ESD_multiplicity_distribution",fNumberOfGoodV0s); | |
1283 | fHistograms->FillHistogram("ESD_ZvsMultiplicity",fESDEvent->GetPrimaryVertex()->GetZ(),fNumberOfGoodV0s); | |
1284 | } | |
87f6de3e | 1285 | } |
a0b94e5c | 1286 | } |
5e55d806 | 1287 | fCurrentEventGoodV0s->Delete(); |
a0b94e5c | 1288 | fCurrentV0IndexNumber=0; |
037dc2db | 1289 | fNumberOfESDTracks=0; |
7f3c7cc6 | 1290 | |
1291 | fV0Pindex.clear(); | |
1292 | fV0Nindex.clear(); | |
1293 | ||
1294 | ||
1295 | ||
26923b22 | 1296 | // fBGEventHandler->PrintBGArray(); // for debugging |
a0b94e5c | 1297 | } |
1298 | ||
1299 | ||
1300 | Double_t AliV0Reader::GetNegativeTrackPhi() const{ | |
1301 | //see header file for documentation | |
1302 | ||
1303 | Double_t offset=0; | |
1304 | if(fNegativeTrackLorentzVector->Phi()> TMath::Pi()){ | |
1305 | offset = -2*TMath::Pi(); | |
1306 | } | |
1307 | return fNegativeTrackLorentzVector->Phi()+offset; | |
1308 | } | |
1309 | ||
1310 | Double_t AliV0Reader::GetPositiveTrackPhi() const{ | |
1311 | //see header file for documentation | |
1312 | ||
1313 | Double_t offset=0; | |
1314 | if(fPositiveTrackLorentzVector->Phi()> TMath::Pi()){ | |
1315 | offset = -2*TMath::Pi(); | |
1316 | } | |
1317 | return fPositiveTrackLorentzVector->Phi()+offset; | |
1318 | } | |
1319 | ||
1320 | Double_t AliV0Reader::GetMotherCandidatePhi() const{ | |
1321 | //see header file for documentation | |
1322 | ||
1323 | Double_t offset=0; | |
1324 | if(fMotherCandidateLorentzVector->Phi()> TMath::Pi()){ | |
1325 | offset = -2*TMath::Pi(); | |
1326 | } | |
1327 | return fMotherCandidateLorentzVector->Phi()+offset; | |
1328 | } | |
1329 | ||
1330 | ||
1331 | Double_t AliV0Reader::GetMotherCandidateRapidity() const{ | |
1332 | //see header file for documentation | |
1333 | ||
1334 | Double_t rapidity=0; | |
1335 | if(fMotherCandidateLorentzVector->Energy() - fMotherCandidateLorentzVector->Pz() == 0 || fMotherCandidateLorentzVector->Energy() + fMotherCandidateLorentzVector->Pz() == 0) rapidity=0; | |
1336 | else rapidity = 0.5*(TMath::Log((fMotherCandidateLorentzVector->Energy() + fMotherCandidateLorentzVector->Pz()) / (fMotherCandidateLorentzVector->Energy()-fMotherCandidateLorentzVector->Pz()))); | |
1337 | return rapidity; | |
1338 | ||
1339 | } | |
1340 | ||
1341 | ||
1342 | ||
1343 | ||
1344 | ||
1345 | Int_t AliV0Reader::GetSpeciesIndex(Int_t chargeOfTrack){ | |
1346 | //see header file for documentation | |
1347 | ||
1348 | Int_t iResult = 10; // Unknown particle | |
1349 | ||
1350 | if(chargeOfTrack==-1){ //negative track | |
1351 | switch(abs(fNegativeTrackPID)){ | |
1352 | case 11: //electron | |
1353 | iResult = 0; | |
1354 | break; | |
1355 | case 13: //muon | |
1356 | iResult = 1; | |
1357 | break; | |
1358 | case 211: //pion | |
1359 | iResult = 2; | |
1360 | break; | |
1361 | case 321: //kaon | |
1362 | iResult = 3; | |
1363 | break; | |
1364 | case 2212: //proton | |
1365 | iResult = 4; | |
1366 | break; | |
1367 | case 22: //photon | |
1368 | iResult = 5; | |
1369 | break; | |
1370 | case 111: //pi0 | |
1371 | iResult = 6; | |
1372 | break; | |
1373 | case 2112: //neutron | |
1374 | iResult = 7; | |
1375 | break; | |
1376 | case 311: //K0 | |
1377 | iResult = 8; | |
1378 | break; | |
1379 | ||
1380 | //Put in here for kSPECIES::kEleCon ???? | |
1381 | } | |
1382 | } | |
1383 | else if(chargeOfTrack==1){ //positive track | |
1384 | switch(abs(fPositiveTrackPID)){ | |
1385 | case 11: //electron | |
1386 | iResult = 0; | |
1387 | break; | |
1388 | case 13: //muon | |
1389 | iResult = 1; | |
1390 | break; | |
1391 | case 211: //pion | |
1392 | iResult = 2; | |
1393 | break; | |
1394 | case 321: //kaon | |
1395 | iResult = 3; | |
1396 | break; | |
1397 | case 2212: //proton | |
1398 | iResult = 4; | |
1399 | break; | |
1400 | case 22: //photon | |
1401 | iResult = 5; | |
1402 | break; | |
1403 | case 111: //pi0 | |
1404 | iResult = 6; | |
1405 | break; | |
1406 | case 2112: //neutron | |
1407 | iResult = 7; | |
1408 | break; | |
1409 | case 311: //K0 | |
1410 | iResult = 8; | |
1411 | break; | |
1412 | ||
1413 | //Put in here for kSPECIES::kEleCon ???? | |
1414 | } | |
1415 | } | |
1416 | else{ | |
1417 | //Wrong parameter.. Print warning | |
1418 | } | |
1419 | return iResult; | |
1420 | } | |
1421 | ||
4a6157dc | 1422 | Bool_t AliV0Reader::GetHelixCenter(AliESDtrack* track, Double_t b,Int_t charge, Double_t center[2]){ |
a0b94e5c | 1423 | // see header file for documentation |
1424 | ||
1425 | Double_t pi = 3.14159265358979323846; | |
1426 | ||
1427 | Double_t helix[6]; | |
1428 | track->GetHelixParameters(helix,b); | |
1429 | ||
1430 | Double_t xpos = helix[5]; | |
1431 | Double_t ypos = helix[0]; | |
1432 | Double_t radius = TMath::Abs(1./helix[4]); | |
1433 | Double_t phi = helix[2]; | |
1434 | ||
1435 | if(phi < 0){ | |
1436 | phi = phi + 2*pi; | |
1437 | } | |
1438 | ||
1439 | phi -= pi/2.; | |
1440 | Double_t xpoint = radius * TMath::Cos(phi); | |
1441 | Double_t ypoint = radius * TMath::Sin(phi); | |
1442 | ||
6272370b | 1443 | if(b<0){ |
1444 | if(charge > 0){ | |
1445 | xpoint = - xpoint; | |
1446 | ypoint = - ypoint; | |
1447 | } | |
1448 | ||
1449 | if(charge < 0){ | |
1450 | xpoint = xpoint; | |
1451 | ypoint = ypoint; | |
1452 | } | |
a0b94e5c | 1453 | } |
6272370b | 1454 | if(b>0){ |
1455 | if(charge > 0){ | |
1456 | xpoint = xpoint; | |
1457 | ypoint = ypoint; | |
1458 | } | |
a0b94e5c | 1459 | |
6272370b | 1460 | if(charge < 0){ |
1461 | xpoint = - xpoint; | |
1462 | ypoint = - ypoint; | |
1463 | } | |
a0b94e5c | 1464 | } |
1465 | center[0] = xpos + xpoint; | |
1466 | center[1] = ypos + ypoint; | |
1467 | ||
1468 | return 1; | |
1469 | } | |
1470 | ||
4a6157dc | 1471 | Bool_t AliV0Reader::GetConvPosXY(AliESDtrack* ptrack, AliESDtrack* ntrack, Double_t b, Double_t convpos[2]){ |
a0b94e5c | 1472 | //see header file for documentation |
1473 | ||
1474 | Double_t helixcenterpos[2]; | |
1475 | GetHelixCenter(ptrack,b,ptrack->Charge(),helixcenterpos); | |
1476 | ||
1477 | Double_t helixcenterneg[2]; | |
1478 | GetHelixCenter(ntrack,b,ntrack->Charge(),helixcenterneg); | |
1479 | ||
1480 | Double_t poshelix[6]; | |
1481 | ptrack->GetHelixParameters(poshelix,b); | |
1482 | Double_t posradius = TMath::Abs(1./poshelix[4]); | |
1483 | ||
1484 | Double_t neghelix[6]; | |
1485 | ntrack->GetHelixParameters(neghelix,b); | |
1486 | Double_t negradius = TMath::Abs(1./neghelix[4]); | |
1487 | ||
1488 | Double_t xpos = helixcenterpos[0]; | |
1489 | Double_t ypos = helixcenterpos[1]; | |
1490 | Double_t xneg = helixcenterneg[0]; | |
1491 | Double_t yneg = helixcenterneg[1]; | |
1492 | ||
1493 | convpos[0] = (xpos*negradius + xneg*posradius)/(negradius+posradius); | |
1494 | convpos[1] = (ypos*negradius+ yneg*posradius)/(negradius+posradius); | |
1495 | ||
1496 | return 1; | |
1497 | } | |
1498 | ||
1499 | ||
1500 | ||
4a6157dc | 1501 | Double_t AliV0Reader::GetConvPosZ(AliESDtrack* ptrack,AliESDtrack* ntrack, Double_t b){ |
a0b94e5c | 1502 | //see header file for documentation |
1503 | ||
1504 | Double_t helixpos[6]; | |
1505 | ptrack->GetHelixParameters(helixpos,b); | |
1506 | ||
1507 | Double_t helixneg[6]; | |
1508 | ntrack->GetHelixParameters(helixneg,b); | |
1509 | ||
1510 | Double_t negtrackradius = TMath::Abs(1./helixneg[4]); | |
1511 | Double_t postrackradius = TMath::Abs(1./helixpos[4]); | |
1512 | ||
1513 | Double_t pi = 3.14159265358979323846; | |
1514 | ||
1515 | Double_t convpos[2]; | |
1516 | GetConvPosXY(ptrack,ntrack,b,convpos); | |
1517 | ||
1518 | Double_t convposx = convpos[0]; | |
1519 | Double_t convposy = convpos[1]; | |
1520 | ||
1521 | Double_t helixcenterpos[2]; | |
1522 | GetHelixCenter(ptrack,b,ptrack->Charge(),helixcenterpos); | |
1523 | ||
1524 | Double_t helixcenterneg[2]; | |
1525 | GetHelixCenter(ntrack,b,ntrack->Charge(),helixcenterneg); | |
1526 | ||
1527 | Double_t xpos = helixcenterpos[0]; | |
1528 | Double_t ypos = helixcenterpos[1]; | |
1529 | Double_t xneg = helixcenterneg[0]; | |
1530 | Double_t yneg = helixcenterneg[1]; | |
1531 | ||
4a6157dc | 1532 | Double_t deltaXPos = convposx - xpos; |
1533 | Double_t deltaYPos = convposy - ypos; | |
a0b94e5c | 1534 | |
4a6157dc | 1535 | Double_t deltaXNeg = convposx - xneg; |
1536 | Double_t deltaYNeg = convposy - yneg; | |
a0b94e5c | 1537 | |
4a6157dc | 1538 | Double_t alphaPos = pi + TMath::ATan2(-deltaYPos,-deltaXPos); |
1539 | Double_t alphaNeg = pi + TMath::ATan2(-deltaYNeg,-deltaXNeg); | |
a0b94e5c | 1540 | |
4a6157dc | 1541 | Double_t vertexXNeg = xneg + TMath::Abs(negtrackradius)* |
1542 | TMath::Cos(alphaNeg); | |
1543 | Double_t vertexYNeg = yneg + TMath::Abs(negtrackradius)* | |
1544 | TMath::Sin(alphaNeg); | |
a0b94e5c | 1545 | |
4a6157dc | 1546 | Double_t vertexXPos = xpos + TMath::Abs(postrackradius)* |
1547 | TMath::Cos(alphaPos); | |
1548 | Double_t vertexYPos = ypos + TMath::Abs(postrackradius)* | |
1549 | TMath::Sin(alphaPos); | |
a0b94e5c | 1550 | |
1551 | Double_t x0neg = helixneg[5]; | |
1552 | Double_t y0neg = helixneg[0]; | |
1553 | ||
1554 | Double_t x0pos = helixpos[5]; | |
1555 | Double_t y0pos = helixpos[0]; | |
1556 | ||
4a6157dc | 1557 | Double_t dNeg = TMath::Sqrt((vertexXNeg - x0neg)*(vertexXNeg - x0neg) |
1558 | +(vertexYNeg - y0neg)*(vertexYNeg - y0neg)); | |
a0b94e5c | 1559 | |
4a6157dc | 1560 | Double_t dPos = TMath::Sqrt((vertexXPos - x0pos)*(vertexXPos - x0pos) |
1561 | +(vertexYPos - y0pos)*(vertexYPos - y0pos)); | |
a0b94e5c | 1562 | |
4a6157dc | 1563 | Double_t rNeg = TMath::Sqrt(negtrackradius*negtrackradius - |
1564 | dNeg*dNeg/4.); | |
a0b94e5c | 1565 | |
4a6157dc | 1566 | Double_t rPos = TMath::Sqrt(postrackradius*postrackradius - |
1567 | dPos*dPos/4.); | |
a0b94e5c | 1568 | |
4a6157dc | 1569 | Double_t deltabetaNeg = 2*(pi + TMath::ATan2(-dNeg/2.,-rNeg)); |
1570 | Double_t deltabetaPos = 2*(pi + TMath::ATan2(-dPos/2.,-rPos)); | |
a0b94e5c | 1571 | |
4a6157dc | 1572 | Double_t deltaUNeg = negtrackradius*deltabetaNeg; |
1573 | Double_t deltaUPos = postrackradius*deltabetaPos; | |
a0b94e5c | 1574 | |
4a6157dc | 1575 | Double_t zphaseNeg = ntrack->GetZ() + deltaUNeg * ntrack->GetTgl(); |
1576 | Double_t zphasePos = ptrack->GetZ() + deltaUPos * ptrack->GetTgl(); | |
a0b94e5c | 1577 | |
87f6de3e | 1578 | Double_t convposz = (zphasePos*negtrackradius+zphaseNeg*postrackradius)/(negtrackradius+postrackradius); |
a0b94e5c | 1579 | |
1580 | return convposz; | |
1581 | } | |
5e55d806 | 1582 | |
5ce758b0 | 1583 | AliGammaConversionKFVector* AliV0Reader::GetBGGoodV0s(Int_t /*event*/){ |
1584 | /* | |
1585 | if(fUseChargedTrackMultiplicityForBG == kTRUE){ | |
1586 | return fBGEventHandler->GetBGGoodV0s(event,fESDEvent->GetPrimaryVertex()->GetZ(),CountESDTracks()); | |
1587 | } | |
1588 | else{ // means we use #v0s as multiplicity | |
1589 | return fBGEventHandler->GetBGGoodV0s(event,fESDEvent->GetPrimaryVertex()->GetZ(),fNumberOfGoodV0s); | |
1590 | } | |
1591 | */ | |
1592 | return NULL; | |
037dc2db | 1593 | } |
1594 | ||
1595 | Int_t AliV0Reader::CountESDTracks(){ | |
1596 | // see header file for documentation | |
1597 | if(fNumberOfESDTracks == 0){ // count the good esd tracks | |
1598 | for(Int_t iTracks = 0; iTracks < fESDEvent->GetNumberOfTracks(); iTracks++){ | |
1599 | AliESDtrack* curTrack = fESDEvent->GetTrack(iTracks); | |
1600 | if(!curTrack){ | |
1601 | continue; | |
1602 | } | |
1603 | if(fEsdTrackCuts->AcceptTrack(curTrack) ){ | |
1604 | fNumberOfESDTracks++; | |
1605 | } | |
1606 | } | |
1607 | } | |
1608 | ||
1609 | return fNumberOfESDTracks; | |
1610 | } | |
1611 | ||
1612 | Bool_t AliV0Reader::CheckIfPi0IsMother(Int_t label){ | |
1613 | // see headerfile for documentation | |
1614 | Bool_t iResult=kFALSE; | |
1615 | // cout<<"Checking particle label, particle is: "<<fMCStack->Particle(TMath::Abs(label))->GetName()<<endl; | |
1616 | if(fMCStack->Particle(TMath::Abs(label))->GetPdgCode() == 111){ | |
1617 | iResult=kTRUE; | |
1618 | } | |
1619 | return iResult; | |
5e55d806 | 1620 | } |
48682642 | 1621 | |
10e3319b | 1622 | Bool_t AliV0Reader::CheckIfEtaIsMother(Int_t label){ |
1623 | // see headerfile for documentation | |
1624 | Bool_t iResult=kFALSE; | |
1625 | // cout<<"Checking particle label, particle is: "<<fMCStack->Particle(TMath::Abs(label))->GetName()<<endl; | |
1626 | if(fMCStack->Particle(TMath::Abs(label))->GetPdgCode() == 221){ | |
1627 | iResult=kTRUE; | |
1628 | } | |
1629 | return iResult; | |
1630 | } | |
1631 | ||
48682642 | 1632 | |
1633 | Bool_t AliV0Reader::GetArmenterosQtAlfa(AliKFParticle* positiveKFParticle, AliKFParticle * negativeKFParticle, AliKFParticle * gammaKFCandidate, Double_t armenterosQtAlfa[2] ){ | |
1634 | //see header file for documentation | |
1635 | ||
1636 | TVector3 momentumVectorPositiveKF(positiveKFParticle->GetPx(),positiveKFParticle->GetPy(),positiveKFParticle->GetPz()); | |
1637 | TVector3 momentumVectorNegativeKF(negativeKFParticle->GetPx(),negativeKFParticle->GetPy(),negativeKFParticle->GetPz()); | |
1638 | TVector3 vecV0(gammaKFCandidate->GetPx(),gammaKFCandidate->GetPy(),gammaKFCandidate->GetPz()); | |
1639 | ||
1640 | Float_t thetaV0pos=TMath::ACos(( momentumVectorPositiveKF* vecV0)/(momentumVectorPositiveKF.Mag() * vecV0.Mag())); | |
1641 | Float_t thetaV0neg=TMath::ACos(( momentumVectorNegativeKF* vecV0)/(momentumVectorNegativeKF.Mag() * vecV0.Mag())); | |
1642 | ||
1643 | Float_t alfa =((momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos)-(momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg))/ | |
1644 | ((momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos)+(momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg)) ; | |
1645 | ||
1646 | ||
1647 | Float_t qt = momentumVectorPositiveKF.Mag()*TMath::Sin(thetaV0pos); | |
1648 | ||
1649 | armenterosQtAlfa[0]=qt; | |
1650 | armenterosQtAlfa[1]=alfa; | |
1651 | ||
1652 | return 1; | |
1653 | ||
1654 | } | |
1655 | ||
1656 |