]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGLF/STRANGENESS/Correlations/AliAnalysisTaskV0ChCorrelations.cxx
Fixing coverity bugs, first check with online finder
[u/mrichter/AliRoot.git] / PWGLF / STRANGENESS / Correlations / AliAnalysisTaskV0ChCorrelations.cxx
CommitLineData
59bd5476 1/**************************************************************************
85c11f5a 2 * Copyright(c) 1998-2013, ALICE Experiment at CERN, All rights reserved. *
59bd5476 3 * *
4 * Author: Marek Bombara *
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/* The task selects candidates for K0s, Lambdas and AntiLambdas (trigger particles)
17 * and calculates correlations with charged unidentified particles (associated particles) in phi and eta.
74754736 18 * The task works with AOD (with or without MC info) events only and containes also mixing for acceptance corrections.
19 * Last update edited by Marek Bombara, March 2013, Marek.Bombara@cern.ch
59bd5476 20 */
21
22#include <TCanvas.h>
23#include <TList.h>
24#include <TH1.h>
25#include <TH2.h>
26#include <TH3.h>
27#include <THnSparse.h>
28
29#include "AliLog.h"
30#include "AliAnalysisManager.h"
31#include "AliAODTrack.h"
32#include "AliAODEvent.h"
33#include "AliAODv0.h"
34#include "AliAODcascade.h"
35#include "AliAODVertex.h"
36
74754736 37#include "AliMCEvent.h"
38#include "AliMCVertex.h"
39#include "AliAODMCHeader.h"
40#include "AliAODMCParticle.h"
41
59bd5476 42#include "AliAODPid.h"
43#include "AliPIDResponse.h"
44#include "AliEventPoolManager.h"
45#include "AliCentrality.h"
46
47#include "AliAnalysisTaskV0ChCorrelations.h"
48#include "AliPhysicsSelectionTask.h"
49
50#include <AliMultiInputEventHandler.h>
51#include <AliMixInputEventHandler.h>
52
53ClassImp(AliAnalysisTaskV0ChCorrelations)
54ClassImp(AliV0ChBasicParticle)
55
59bd5476 56//________________________________________________________________________
57AliAnalysisTaskV0ChCorrelations::AliAnalysisTaskV0ChCorrelations(const char *name) // All data members should be initialised here
58 : AliAnalysisTaskSE(name),
74754736 59 fAnalysisMC(kFALSE),
59bd5476 60 fFillMixed(kTRUE),
61 fMixingTracks(500),
62 fPoolMgr(0x0),
63
74754736 64 fDcaDToPV(0.5),
65 fDcaV0D(0.1),
66 fWithChCh(kFALSE),
67 fOStatus(1),
85c11f5a 68
59bd5476 69 fOutput(0),
70 fPIDResponse(0),
71 fHistCentVtx(0),
72 fHistMultiMain(0),
73 fHistMassK0(0),
74 fHistMassLambda(0),
75 fHistMassAntiLambda(0),
76
77 fHistdPhidEtaSib(0),
78 fHistdPhidEtaMix(0),
82bd566c 79 fHistNTrigSib(0),
74754736 80
81 fHistMCPtCentTrig(0),
82 fHistRCPtCentTrig(0),
83 fHistMCPtCentAs(0),
84 fHistRCPtCentAs(0),
59bd5476 85
74754736 86 fHistTemp(0),
87 fHistTemp2(0)// The last in the above list should not have a comma after it
59bd5476 88{
89 // Constructor
90 // Define input and output slots here (never in the dummy constructor)
91 // Input slot #0 works with a TChain - it is connected to the default input container
92 // Output slot #1 writes into a TH1 container
93 DefineOutput(1, TList::Class()); // for output list
94}
95
96//________________________________________________________________________
97AliAnalysisTaskV0ChCorrelations::~AliAnalysisTaskV0ChCorrelations()
98{
99 // Destructor. Clean-up the output list, but not the histograms that are put inside
100 // (the list is owner and will clean-up these histograms). Protect in PROOF case.
101 if (fOutput && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()) {
102 delete fOutput;
103 }
104}
105
106//________________________________________________________________________
107void AliAnalysisTaskV0ChCorrelations::UserCreateOutputObjects()
108{
109 // Create histograms
110
111 fOutput = new TList();
112 fOutput->SetOwner(); // IMPORTANT!
113 // defining bins for centrality
114 Int_t nCentralityBins = 9;
115 Double_t centBins[] = {0.,10.,20.,30.,40.,50.,60.,70.,80.,90.};
116 const Double_t* centralityBins = centBins;
117 // defining bins for Z vertex
118 Int_t nZvtxBins = 20;
119 Double_t vertexBins[] = {-10.,-9.,-8.,-7.,-6.,-5.,-4.,-3.,-2.,-1.,0.,1.,2.,3.,4.,5.,6.,7.,8.,9.,10.};
120 const Double_t* zvtxBins = vertexBins;
121 // pt bins of associated particles for the analysis
85c11f5a 122 Int_t nPtBins = 6;
123 const Double_t PtBins[7] = {3.0,4.0,5.0,6.0,7.0,8.0,9.0};
124 //Int_t nPtBins = 1;
125 //const Double_t PtBins[2] = {3.0,15.0};
59bd5476 126 // pt bins of trigger particles for the analysis
70840314 127 Int_t nPtBinsV0 = 9;
128 //const Double_t PtBinsV0[2] = {6.0,15.0};
129 const Double_t PtBinsV0[10] = {6.0,7.0,8.0,9.0,10.0,11.0,12.0,13.0,14.0,15.0};
59bd5476 130 // V0 candidate: 1 - K0sig, 2 - Lamsig, 3 - Alamsig, 4 - K0bg, 5 - Lambg, 6 - Alambg
82bd566c 131 Int_t nTrigC = 7;
132 const Double_t TrigC[8] = {0.5,1.5,2.5,3.5,4.5,5.5,6.5,7.5};
59bd5476 133
134 // Create general histograms
135 fHistCentVtx = new TH2F("fHistCentVtx", "Centrality vs. Z vertex", nCentralityBins, centralityBins, nZvtxBins, zvtxBins);
136 fHistMultiMain = new TH1F("fHistMultiMain", "Multiplicity of main events", 2000, 0, 2000);
137
74754736 138 const Int_t mrBins[3] = {nPtBinsV0, nCentralityBins, nTrigC};
139 const Double_t mrMin[3] = {PtBinsV0[0], centralityBins[0], TrigC[0]};
140 const Double_t mrMax[3] = {PtBinsV0[9], centralityBins[9], TrigC[6]};
141
142 // Create histograms for reconstruction track and V0 efficiency
143 fHistMCPtCentTrig = new THnSparseF("fHistMCPtCentTrig", "MC Pt vs. Cent. Trig", 3, mrBins, mrMin, mrMax);
144 fHistRCPtCentTrig = new THnSparseF("fHistRCPtCentTrig", "Rec Pt vs. Cent. Trig", 3, mrBins, mrMin, mrMax);
145
146 // pt bins of associated particles for the efficiency
147 Int_t nPtBinsAs = 12;
148 const Double_t PtBinsAs[13] = {3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0,11.0,12.0,13.0,14.0,15.0};
149
150 fHistMCPtCentAs = new TH2D("fHistMCPtCentAs", "MC Pt vs. Cent. Assoc", nPtBinsAs, PtBinsAs[0], PtBinsAs[12], nCentralityBins, centBins[0], centBins[9]);
151 fHistRCPtCentAs = new TH2D("fHistRCPtCentAs", "Rec Pt vs. Cent. Assoc", nPtBinsAs, PtBinsAs[0], PtBinsAs[12], nCentralityBins, centBins[0], centBins[9]);
152
59bd5476 153 // defining bins for mass distributions
154 Int_t nBins = 200;
155 Double_t mk0Min = 0.40;
156 Double_t mk0Max = 0.60;
157 Double_t mlaMin = 1.07;
158 Double_t mlaMax = 1.17;
159 Double_t malMin = 1.07;
160 Double_t malMax = 1.17;
161
85c11f5a 162 const Int_t spBins[3] = {nBins, nPtBinsV0, nCentralityBins};
163 const Double_t spMinK0[3] = {mk0Min, PtBinsV0[0], centralityBins[0]};
164 const Double_t spMaxK0[3] = {mk0Max, PtBinsV0[9], centralityBins[9]};
165 const Double_t spMinLa[3] = {mlaMin, PtBinsV0[0], centralityBins[0]};
166 const Double_t spMaxLa[3] = {mlaMax, PtBinsV0[9], centralityBins[9]};
167 const Double_t spMinAl[3] = {malMin, PtBinsV0[0], centralityBins[0]};
168 const Double_t spMaxAl[3] = {malMax, PtBinsV0[9], centralityBins[9]};
59bd5476 169 // Create mass histograms
85c11f5a 170 fHistMassK0 = new THnSparseF("fHistMassK0","V0 mass for K0 hypothesis", 3, spBins, spMinK0, spMaxK0);
171 fHistMassLambda = new THnSparseF("fHistMassLambda","V0 mass for Lambda hypothesis", 3, spBins, spMinLa, spMaxLa);
172 fHistMassAntiLambda = new THnSparseF("fHistMassAntiLambda","V0 mass for AntiLambda hypothesis", 3, spBins, spMinAl, spMaxAl);
59bd5476 173
174 // defining bins for dPhi distributions
175 const Int_t nbPhiBins = 144;
176 const Double_t kPi = TMath::Pi();
177 Double_t PhiMin = -kPi/2.;
178 Double_t PhiMax = -kPi/2. + 2*kPi;
179 Double_t PhiBins[nbPhiBins+1] = {0.};
180 PhiBins[0] = PhiMin;
181 for (Int_t i=0; i<nbPhiBins; i++) { PhiBins[i+1] = PhiBins[i] + (PhiMax - PhiMin)/nbPhiBins; }
182
183 // defining bins for dEta distributions
184 const Int_t nbEtaBins = 72;
185 Double_t EtaMin = -1.8;
186 Double_t EtaMax = 1.8;
187 Double_t EtaBins[nbEtaBins+1] = {0.};
188 EtaBins[0] = EtaMin;
189 for (Int_t i=0; i<nbEtaBins; i++) { EtaBins[i+1] = EtaBins[i] + (EtaMax - EtaMin)/nbEtaBins; }
190
191 const Int_t corBins[7] = {nbPhiBins, nbEtaBins, nPtBinsV0, nPtBins, nCentralityBins, nZvtxBins, nTrigC};
192 const Double_t corMin[7] = {PhiBins[0], EtaBins[0], PtBinsV0[0], PtBins[0], centralityBins[0], zvtxBins[0], TrigC[0]};
82bd566c 193 const Double_t corMax[7] = {PhiBins[144], EtaBins[72], PtBinsV0[9], PtBins[6], centralityBins[9], zvtxBins[20], TrigC[7]};
59bd5476 194 // Create correlation histograms
195 fHistdPhidEtaSib = new THnSparseF("fHistdPhidEtaSib","dPhi vs. dEta siblings", 7, corBins, corMin, corMax);
196 fHistdPhidEtaMix = new THnSparseF("fHistdPhidEtaMix","dPhi vs. dEta mixed", 7, corBins, corMin, corMax);
197
82bd566c 198 // Create histograms for counting the numbers of trigger particles
199 const Int_t corNTrigBins[5] = {nPtBinsV0, nCentralityBins, nZvtxBins, nTrigC};
200 const Double_t corNTrigMin[5] = {PtBinsV0[0], centBins[0], vertexBins[0], TrigC[0]};
201 const Double_t corNTrigMax[5] = {PtBinsV0[9], centBins[9], vertexBins[20], TrigC[7]};
74754736 202 fHistNTrigSib = new THnSparseF("fHistNTrigSib","Number trigger sib", 4, corNTrigBins, corNTrigMin, corNTrigMax);
203
70840314 204 // Histograms for debugging
74754736 205 fHistTemp = new TH1D("fHistTemp", "Temporary", 100, -10., 10.);
206 fHistTemp2 = new TH1D("fHistTemp2", "Temporary2", 100, -10., 10.);
59bd5476 207
208 fOutput->Add(fHistCentVtx);
209
210 fOutput->Add(fHistMultiMain);
211 fOutput->Add(fHistMassK0);
212 fOutput->Add(fHistMassLambda);
213 fOutput->Add(fHistMassAntiLambda);
214
215 fOutput->Add(fHistdPhidEtaSib);
216 fOutput->Add(fHistdPhidEtaMix);
82bd566c 217 fOutput->Add(fHistNTrigSib);
74754736 218
219 fOutput->Add(fHistMCPtCentTrig);
220 fOutput->Add(fHistRCPtCentTrig);
221 fOutput->Add(fHistMCPtCentAs);
222 fOutput->Add(fHistRCPtCentAs);
59bd5476 223
224 fOutput->Add(fHistTemp);
74754736 225 fOutput->Add(fHistTemp2);
59bd5476 226
227 PostData(1, fOutput); // Post data for ALL output slots >0 here, to get at least an empty histogram
228
229 // Settings for event mixing -------------------------------------
230 Int_t trackDepth = fMixingTracks;
231 Int_t poolSize = 200; // Maximum number of events, ignored in the present implemented of AliEventPoolManager
232
233 fPoolMgr = new AliEventPoolManager(poolSize, trackDepth, nCentralityBins, centBins, nZvtxBins, vertexBins);
234 //----------------------------------------------
235}
236
237//________________________________________________________________________
238void AliAnalysisTaskV0ChCorrelations::Terminate(Option_t *)
239{
240 // Draw result to screen, or perform fitting, normalizations
241 // Called once at the end of the query
242
243 fOutput = dynamic_cast<TList*>(GetOutputData(1));
244 if (!fOutput) { AliError("Could not retrieve TList fOutput"); return; }
245
246 // NEW HISTO should be retrieved from the TList container in the above way,
247 // so it is available to draw on a canvas such as below
248}
249
250//_________________________________________________________________________
251void AliAnalysisTaskV0ChCorrelations::UserExec(Option_t *)
252{
253 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
74754736 254 AliInputEventHandler *inEvMain = (AliInputEventHandler*)mgr->GetInputEventHandler();
59bd5476 255
256 // physics selection
257 UInt_t maskIsSelected = inEvMain->IsEventSelected();
258 // 2010 data trigger selection
259 //Bool_t isSelected = (maskIsSelected & AliVEvent::kMB);
260 // 2011 data trigger selection
261 Bool_t isSelected = ((maskIsSelected & AliVEvent::kMB) || (maskIsSelected & AliVEvent::kCentral) || (maskIsSelected & AliVEvent::kSemiCentral));
262 if (!isSelected) return;
74754736 263 // calculating the event types
82bd566c 264 if (maskIsSelected & AliVEvent::kMB) fHistTemp->Fill(2);
265 if (maskIsSelected & AliVEvent::kCentral) fHistTemp->Fill(4);
266 if (maskIsSelected & AliVEvent::kSemiCentral) fHistTemp->Fill(6);
59bd5476 267
74754736 268 AliAODEvent* aod = (AliAODEvent*)inEvMain->GetEvent();
59bd5476 269 fPIDResponse = inEvMain->GetPIDResponse();
270
74754736 271 // pt intervals for trigger particles
272 const Double_t kPi = TMath::Pi();
273 Double_t PtTrigMin = 6.0;
274 Double_t PtTrigMax = 15.0;
275 // pt interval for associated particles
276 Double_t PtAssocMin = 3.0;
277 fHistMultiMain->Fill(aod->GetNumberOfTracks());
278
279 // Vertex cut
280 Double_t cutPrimVertex = 10.0;
281 AliAODVertex *myPrimVertex = aod->GetPrimaryVertex();
282 if (!myPrimVertex) return;
283 if ( ( TMath::Abs(myPrimVertex->GetZ()) ) >= cutPrimVertex) return ;
284 Double_t lPVx = myPrimVertex->GetX();
285 Double_t lPVy = myPrimVertex->GetY();
286 Double_t lPVz = myPrimVertex->GetZ();
287
288 if (TMath::Abs(lPVx)<10e-5 && TMath::Abs(lPVy)<10e-5 && TMath::Abs(lPVz)<10e-5) return;
289
290 // Centrality definition
291 Double_t lCent = 0.0;
292 AliCentrality *centralityObj = 0;
293 centralityObj = aod->GetHeader()->GetCentralityP();
294 lCent = centralityObj->GetCentralityPercentile("CL1");
295 if ((lCent < 0.)||(lCent > 90.)) return;
296 fHistCentVtx->Fill(lCent,lPVz);
297
298//=========== MC loop ===============================
299 if (fAnalysisMC)
300 {
301 AliAODMCHeader *aodMCheader = (AliAODMCHeader*)aod->FindListObject(AliAODMCHeader::StdBranchName());
302 Float_t vzMC = aodMCheader->GetVtxZ();
303 if (TMath::Abs(vzMC) >= 10.) return;
304 //retreive MC particles from event
305 TClonesArray *mcArray = (TClonesArray*)aod->FindListObject(AliAODMCParticle::StdBranchName());
306 if(!mcArray){
307 Printf("No MC particle branch found");
308 return;
309 }
310
311 Int_t nMCTracks = mcArray->GetEntriesFast();
312 //cout << "number of MC tracks = " << nMCTracks << endl;
313 for (Int_t iMC = 0; iMC<nMCTracks; iMC++)
314 {
315 AliAODMCParticle *mcTrack = (AliAODMCParticle*)mcArray->At(iMC);
316 if (!mcTrack) {
317 Error("ReadEventAODMC", "Could not receive particle %d", iMC);
318 continue;
319 }
320 // track part
321 Double_t mcTrackEta = mcTrack->Eta();
322 Double_t mcTrackPt = mcTrack->Pt();
323 Bool_t TrIsPrim = mcTrack->IsPhysicalPrimary();
324 Bool_t TrEtaMax = TMath::Abs(mcTrackEta)<0.8;
325 Bool_t TrPtMin = mcTrackPt>PtAssocMin;
326 Bool_t TrCharge = (mcTrack->Charge())!=0;
327 if (TrIsPrim && TrEtaMax && TrPtMin && TrCharge) fHistMCPtCentAs->Fill(mcTrackPt,lCent);
328 // V0 part
329 Int_t mcMotherPdg = 0;
330 Int_t mcPartPdg = mcTrack->GetPdgCode();
331
332 // Keep only K0s, Lambda and AntiLambda
333 if ((mcPartPdg != 310) && (mcPartPdg != 3122) && (mcPartPdg != (-3122))) continue;
334
335 //cout << " mc pdg is " << mcPartPdg << endl;
336
337 Bool_t IsK0 = mcPartPdg==310;
338 Bool_t IsLambda = mcPartPdg==3122;
339 Bool_t IsAntiLambda = mcPartPdg==-3122;
340 Bool_t IsSigma = kFALSE;
341 Int_t mcMotherLabel = mcTrack->GetMother();
342 AliAODMCParticle *mcMother = (AliAODMCParticle*)mcArray->At(mcMotherLabel);
343 if (mcMotherLabel < 0) {mcMotherPdg = 0;} else {mcMotherPdg = mcMother->GetPdgCode();}
344 //if ((mcMotherLabel >= 0) && mcMother)
345 //if ((mcMotherLabel >= 0) && mcMother)
346 //{
347 // Bool_t IsFromCascade = ((mcMotherPdg==3312)||(mcMotherPdg==-3312)||(mcMotherPdg==3334)||(mcMotherPdg==-3334));
348 Bool_t IsFromSigma = ((mcMotherPdg==3212)||(mcMotherPdg==-3212));
349 IsFromSigma = IsFromSigma || ((mcMotherPdg==3224)||(mcMotherPdg==-3224));
350 IsFromSigma = IsFromSigma || ((mcMotherPdg==3214)||(mcMotherPdg==-3214));
351 IsFromSigma = IsFromSigma || ((mcMotherPdg==3114)||(mcMotherPdg==-3114));
352 if ((IsFromSigma) && (mcMother->IsPhysicalPrimary()) && (IsLambda || IsAntiLambda)) IsSigma = kTRUE;
353 Double_t mcRapidity = mcTrack->Y();
354 Bool_t V0RapMax = TMath::Abs(mcRapidity)<0.75;
355 Bool_t PtInterval = ((mcTrackPt>PtTrigMin)&&(mcTrackPt<PtTrigMax));
356 //Bool_t PtInterval = kTRUE;
357 IsK0 = IsK0 && (mcTrack->IsPhysicalPrimary());
358 IsLambda = IsLambda && (mcTrack->IsPhysicalPrimary() || IsSigma);
359 IsAntiLambda = IsAntiLambda && (mcTrack->IsPhysicalPrimary() || IsSigma);
360 Double_t mcK0[3] = {mcTrackPt, lCent, 1};
361 Double_t mcLa[3] = {mcTrackPt, lCent, 2};
362 Double_t mcAl[3] = {mcTrackPt, lCent, 3};
363 if (IsK0 && V0RapMax && PtInterval) fHistMCPtCentTrig->Fill(mcK0);
364 if (IsLambda && V0RapMax && PtInterval) fHistMCPtCentTrig->Fill(mcLa);
365 if (IsAntiLambda && V0RapMax && PtInterval) fHistMCPtCentTrig->Fill(mcAl);
366 //}
367 }
368 // ------- access the real data -----------
369 Int_t nRecTracks = aod->GetNumberOfTracks();
370 for (Int_t i = 0; i < nRecTracks; i++)
371 {
372 AliAODTrack* tras = aod->GetTrack(i);
373 if ((tras->Pt())<PtAssocMin) continue;
374 if (!(IsMyGoodPrimaryTrack(tras))) continue;
375 Int_t AssocLabel = tras->GetLabel();
376 if (AssocLabel<=0) continue;
377 if(!(static_cast<AliAODMCParticle*>(mcArray->At(tras->GetLabel()))->IsPhysicalPrimary())) continue;
378 Double_t trPt = tras->Pt();
379 fHistRCPtCentAs->Fill(trPt,lCent);
380 }
381 // ------- end of real data access, for V0s see the main V0 loop --------
382 }
383//============= End of MC loop ======================
59bd5476 384
385 // Track selection loop
386 //--------------------------------
387 Int_t nTracks = aod->GetNumberOfTracks();
388 // new tracks array
389 TObjArray * selectedTracks = new TObjArray;
390 selectedTracks->SetOwner(kTRUE);
74754736 391
392 Bool_t ChChWith = GetWithChCh();
393 TObjArray * selectedChargedTriggers = new TObjArray;
394 selectedChargedTriggers->SetOwner(kTRUE);
395 for (Int_t i = 0; i < nTracks; i++)
396 {
397 AliAODTrack* tr = aod->GetTrack(i);
398 if ((tr->Pt())<PtAssocMin) continue;
399 if (!(IsMyGoodPrimaryTrack(tr))) continue;
400 selectedTracks->Add(tr);
401 // saving the Charged trigger particles
402 if ((tr->Pt()>6.)&&(tr->Pt()<15.))
403 {
404 selectedChargedTriggers->Add(new AliV0ChBasicParticle(tr->Eta(), tr->Phi(), tr->Pt(), 7));
405 }
406 }
407
59bd5476 408 //---------------------------------
409
410 // V0 loop for reconstructed event
411 TObjArray * selectedV0s = new TObjArray;
412 selectedV0s->SetOwner(kTRUE);
413
414 Int_t nV0s = aod->GetNumberOfV0s();
415
416 for (Int_t i = 0; i < nV0s; i++)
417 { // start of V0 slection loop
418 AliAODv0* aodV0 = dynamic_cast<AliAODv0 *>(aod->GetV0(i));
419 if (!aodV0) {
420 AliError(Form("ERROR: Could not retrieve aodv0 %d", i));
421 continue;
422 }
74754736 423 //cout << "pt of v0: " << aodV0->Pt() << endl;
59bd5476 424 if (((aodV0->Pt())<PtTrigMin)||((aodV0->Pt())>PtTrigMax)) continue;
425 // get daughters
74754736 426 const AliAODTrack *myTrackPos;
427 const AliAODTrack *myTrackNeg;
59bd5476 428 AliAODTrack *myTrackNegTest=dynamic_cast<AliAODTrack *>(aodV0->GetDaughter(1));
429 AliAODTrack *myTrackPosTest=dynamic_cast<AliAODTrack *>(aodV0->GetDaughter(0));
430
431 if (!myTrackPosTest || !myTrackNegTest) {
432 Printf("strange analysis::UserExec:: Error:Could not retreive one of the daughter track\n");
433 continue;
434 }
435
436 if( myTrackPosTest->Charge() ==1){
437 myTrackPos = myTrackPosTest;
438 myTrackNeg = myTrackNegTest;
439 }
440
441 if( myTrackPosTest->Charge() ==-1){
442 myTrackPos = myTrackNegTest;
443 myTrackNeg = myTrackPosTest;
444 }
445
59bd5476 446 // effective mass calculations for each hypothesis
447 Double_t lInvMassK0 = aodV0->MassK0Short();
448 Double_t lInvMassAntiLambda = aodV0->MassAntiLambda();
449 Double_t lInvMassLambda = aodV0->MassLambda();
450
451 // calculations for c*tau cut--------------------------------------
74754736 452 // Double_t lDVx = aodV0->GetSecVtxX();
453 // Double_t lDVy = aodV0->GetSecVtxY();
454 // Double_t lDVz = aodV0->GetSecVtxZ();
455 // const Double_t kLambdaMass = 1.115683;
456 // const Double_t kK0Mass = 0.497648;
457 // Double_t cutcTauLam = 3*7.89;
458 // Double_t cutcTauK0 = 3*2.68;
459 // Double_t lV0DecayLength = TMath::Sqrt(TMath::Power(lDVx - lPVx,2) + TMath::Power(lDVy- lPVy,2) + TMath::Power(lDVz - lPVz,2 ));
460 // Double_t lPV0 = TMath::Sqrt((aodV0->Pt())*(aodV0->Pt())+(aodV0->Pz())*(aodV0->Pz()));
461 // Double_t lcTauLam = (lV0DecayLength*kLambdaMass)/lPV0;
462 // Double_t lcTauK0 = (lV0DecayLength*kK0Mass)/lPV0;
59bd5476 463 // sc - standard cuts
74754736 464 //Bool_t cutK0sc = (lcTauK0<cutcTauK0);
465 //Bool_t cutLambdasc = (lcTauLam<cutcTauLam);
466 //Bool_t cutAntiLambdasc = (lcTauLam<cutcTauLam);
467 Bool_t cutK0sc = kTRUE;
468 Bool_t cutLambdasc = kTRUE;
469 Bool_t cutAntiLambdasc = kTRUE;
59bd5476 470
471 //------------------------------------------------
472
473 // preparations for daughter's PID cut------------------------------
474 Float_t nSigmaPosPion = 0.;
475 Float_t nSigmaNegPion = 0.;
476 Float_t nSigmaPosProton = 0.;
477 Float_t nSigmaNegProton = 0.;
478
479 const AliAODPid *pPid = myTrackPos->GetDetPid();
480 const AliAODPid *nPid = myTrackNeg->GetDetPid();
481
482 if (pPid)
483 {
484 Double_t pdMom = pPid->GetTPCmomentum();
485 if (pdMom<1.)
486 {
487 nSigmaPosPion = fPIDResponse->NumberOfSigmasTPC(myTrackPos, AliPID::kPion);
488 nSigmaPosProton = fPIDResponse->NumberOfSigmasTPC(myTrackPos, AliPID::kProton);
489 }
490 }
491
492 if (nPid)
493 {
494 Double_t ndMom = nPid->GetTPCmomentum();
495 if (ndMom<1.)
496 {
497 nSigmaNegPion = fPIDResponse->NumberOfSigmasTPC(myTrackPos, AliPID::kPion);
498 nSigmaNegProton = fPIDResponse->NumberOfSigmasTPC(myTrackPos, AliPID::kProton);
499 }
500 }
501 Bool_t bpPion = TMath::Abs(nSigmaPosPion) <= 3.;
502 Bool_t bpProton = TMath::Abs(nSigmaPosProton) <= 3.;
503 Bool_t bnPion = TMath::Abs(nSigmaNegPion) <= 3.;
504 Bool_t bnProton = TMath::Abs(nSigmaNegProton) <= 3.;
505
506 Bool_t cutK0Pid = (bpPion && bnPion);
507 Bool_t cutLambdaPid = (bpProton && bnPion);
508 Bool_t cutAntiLambdaPid = (bpPion && bnProton);
509 //--------------------------------------------------
510 // mass cuts
511 Bool_t cutMassLambda = ((lInvMassLambda>1.10) && (lInvMassLambda<1.13));
512 Bool_t cutMassAntiLambda = ((lInvMassAntiLambda>1.10) && (lInvMassAntiLambda<1.13));
513 Bool_t cutMassK0 = (lInvMassK0>0.47) && (lInvMassK0<0.53);
514
515 cutK0sc = cutK0Pid && (!cutMassLambda) && (!cutMassAntiLambda);
516 cutLambdasc = cutLambdaPid && (!cutMassK0);
517 cutAntiLambdasc = cutAntiLambdaPid && (!cutMassK0);
518 // special cut related to AP diagram for K0s
74754736 519 Bool_t k0APcut = (aodV0->PtArmV0()>(TMath::Abs(0.2*aodV0->AlphaV0())));
59bd5476 520 cutK0sc = cutK0sc && k0APcut;
70840314 521 // fill the mass histograms
74754736 522
523 Int_t oStatus = GetOStatus();
524
525 if (!IsMyGoodV0(aod,aodV0,myTrackPos,myTrackNeg,oStatus)) continue;
85c11f5a 526 Double_t spK0[3] = {lInvMassK0, aodV0->Pt(), lCent};
527 Double_t spLa[3] = {lInvMassLambda, aodV0->Pt(), lCent};
528 Double_t spAl[3] = {lInvMassAntiLambda, aodV0->Pt(), lCent};
529 if (cutK0sc) fHistMassK0->Fill(spK0);
530 if (cutLambdasc) fHistMassLambda->Fill(spLa);
531 if (cutAntiLambdasc) fHistMassAntiLambda->Fill(spAl);
59bd5476 532 // select final V0s for correlation, selected background to study its contribution to correlation function
533 // the values for signal might change in the future ...
70840314 534 Bool_t K0Signal = (lInvMassK0>0.48)&&(lInvMassK0<0.52);
535 Bool_t K0Bckg = ((lInvMassK0>0.40)&&(lInvMassK0<0.44)) || ((lInvMassK0>0.56)&&(lInvMassK0<0.60));
59bd5476 536
70840314 537 Bool_t LamSignal = (lInvMassLambda>1.108)&&(lInvMassLambda<1.125);
538 Bool_t LamBckg = ((lInvMassLambda>1.090)&&(lInvMassLambda<1.100)) || ((lInvMassLambda>1.135)&&(lInvMassLambda<1.145));
59bd5476 539
70840314 540 Bool_t ALamSignal = (lInvMassAntiLambda>1.108)&&(lInvMassAntiLambda<1.125);
541 Bool_t ALamBckg = ((lInvMassAntiLambda>1.090)&&(lInvMassAntiLambda<1.100)) || ((lInvMassAntiLambda>1.135)&&(lInvMassAntiLambda<1.145));
59bd5476 542
543 // Fill selected V0 particle array
74754736 544 if ((cutK0sc)&&(K0Signal))
545 {
546 selectedV0s->Add(new AliV0ChBasicParticle(aodV0->Eta(), aodV0->Phi(), aodV0->Pt(), 1.));
547 Double_t nTrigK0Sig[4] = {aodV0->Pt(), lCent, lPVz, 1.};
548 fHistNTrigSib->Fill(nTrigK0Sig);
549 }
550 if ((cutK0sc)&&(K0Bckg))
551 {
552 selectedV0s->Add(new AliV0ChBasicParticle(aodV0->Eta(), aodV0->Phi(), aodV0->Pt(), 4.));
553 Double_t nTrigK0Bkg[4] = {aodV0->Pt(), lCent, lPVz, 4.};
554 fHistNTrigSib->Fill(nTrigK0Bkg);
555 }
556 if ((cutLambdasc)&&(LamSignal))
557 {
558 selectedV0s->Add(new AliV0ChBasicParticle(aodV0->Eta(), aodV0->Phi(), aodV0->Pt(), 2.));
559 Double_t nTrigLaSig[4] = {aodV0->Pt(), lCent, lPVz, 2.};
560 fHistNTrigSib->Fill(nTrigLaSig);
561 }
562 if ((cutLambdasc)&&(LamBckg))
563 {
564 selectedV0s->Add(new AliV0ChBasicParticle(aodV0->Eta(), aodV0->Phi(), aodV0->Pt(), 5.));
565 Double_t nTrigLaBkg[4] = {aodV0->Pt(), lCent, lPVz, 5.};
566 fHistNTrigSib->Fill(nTrigLaBkg);
567 }
568 if ((cutAntiLambdasc)&&(ALamSignal))
569 {
570 selectedV0s->Add(new AliV0ChBasicParticle(aodV0->Eta(), aodV0->Phi(), aodV0->Pt(), 3.));
571 Double_t nTrigAlSig[4] = {aodV0->Pt(), lCent, lPVz, 3.};
572 fHistNTrigSib->Fill(nTrigAlSig);
573 }
574 if ((cutAntiLambdasc)&&(ALamBckg))
575 {
576 selectedV0s->Add(new AliV0ChBasicParticle(aodV0->Eta(), aodV0->Phi(), aodV0->Pt(), 6.));
577 Double_t nTrigAlBkg[4] = {aodV0->Pt(), lCent, lPVz, 6.};
578 fHistNTrigSib->Fill(nTrigAlBkg);
579 }
580
581
582 //===== MC part for V0 reconstruction efficiency ==============
583 if (fAnalysisMC)
584 {
585 TClonesArray *mcArray = (TClonesArray*)aod->FindListObject(AliAODMCParticle::StdBranchName());
586 if(!mcArray){
587 Printf("No MC particle branch found");
588 return;
589 }
590
591 Int_t MotherOfMotherPdg = 0;
592
593 Int_t myTrackPosLabel = TMath::Abs(myTrackPos->GetLabel());
594 Int_t myTrackNegLabel = TMath::Abs(myTrackNeg->GetLabel());
595 AliAODMCParticle *mcPosTrack = (AliAODMCParticle*)mcArray->At(myTrackPosLabel);
596 if (!mcPosTrack) continue;
597 AliAODMCParticle *mcNegTrack = (AliAODMCParticle*)mcArray->At(myTrackNegLabel);
598 if (!mcNegTrack) continue;
599
600 Int_t PosTrackPdg = mcPosTrack->GetPdgCode();
601 Int_t NegTrackPdg = mcNegTrack->GetPdgCode();
602 //if (!mcPosTrack->IsPrimary()) continue;
603 //if (!mcNegTrack->IsPrimary()) continue;
604
605 Int_t myTrackPosMotherLabel = mcPosTrack->GetMother();
606 Int_t myTrackNegMotherLabel = mcNegTrack->GetMother();
607
608 if ((myTrackPosMotherLabel==-1)||(myTrackNegMotherLabel==-1)) continue;
609
610 AliAODMCParticle *mcPosMother = (AliAODMCParticle*)mcArray->At(myTrackPosMotherLabel);
611 if (!mcPosMother) continue;
612 Int_t MotherPdg = mcPosMother->GetPdgCode();
613 Int_t MotherOfMother = mcPosMother->GetMother();
614 //if (MotherOfMother == -1) MotherOfMotherPdg = 0;
615
616 if (myTrackPosMotherLabel!=myTrackNegMotherLabel) continue;
617 //if (!mcPosMother->IsPrimary()) continue;
618 Bool_t IsK0FromMC = (mcPosMother->IsPhysicalPrimary())&&(MotherPdg==310)&&(PosTrackPdg==211)&&(NegTrackPdg==-211);
619 Bool_t IsLambdaFromMC = (mcPosMother->IsPhysicalPrimary())&&(MotherPdg==3122)&&(PosTrackPdg==2212)&&(NegTrackPdg==-211);
620 Bool_t IsAntiLambdaFromMC = (mcPosMother->IsPhysicalPrimary())&&(MotherPdg==-3122)&&(PosTrackPdg==211)&&(NegTrackPdg==-2212);
621
622 Bool_t ComeFromSigma = kFALSE;
623 Bool_t ComeFromSigmaLa = kFALSE;
624 Bool_t ComeFromSigmaAl = kFALSE;
625
626 if (MotherOfMother != -1)
627 {
628 AliAODMCParticle *mcPosMotherOfMother = (AliAODMCParticle*)mcArray->At(MotherOfMother);
629 MotherOfMotherPdg = mcPosMotherOfMother->GetPdgCode();
630 Int_t MoMPdg = TMath::Abs(MotherOfMotherPdg);
631 ComeFromSigma = (mcPosMotherOfMother->IsPhysicalPrimary())&&((MoMPdg==3212)||(MoMPdg==3224)||(MoMPdg==3214)||(MoMPdg==3114));
632 ComeFromSigmaLa = ComeFromSigma && (MotherPdg==3122)&&(PosTrackPdg==2212)&&(NegTrackPdg==-211);
633 ComeFromSigmaAl = ComeFromSigma && (MotherPdg==-3122)&&(PosTrackPdg==211)&&(NegTrackPdg==-2212);
634 }
635
636 IsLambdaFromMC = IsLambdaFromMC || ComeFromSigmaLa;
637 IsAntiLambdaFromMC = IsAntiLambdaFromMC || ComeFromSigmaAl;
638
639 Double_t RecMotherPt = aodV0->Pt();
640 //cout << "Pt of rec v0 = " << RecMotherPt << " nMC = " << mcArray->GetEntries() << endl;
641 //cout << "Pos Label = " << myTrackPosLabel << " Neg Label = " << myTrackNegLabel << endl;
642 Double_t rcK0[3] = {RecMotherPt, lCent, 1};
643 Double_t rcLa[3] = {RecMotherPt, lCent, 2};
644 Double_t rcAl[3] = {RecMotherPt, lCent, 3};
645 if ((cutK0sc)&&(K0Signal)&&(IsK0FromMC)) fHistRCPtCentTrig->Fill(rcK0);
646 if ((cutLambdasc)&&(LamSignal)&&(IsLambdaFromMC)) fHistRCPtCentTrig->Fill(rcLa);
647 if ((cutAntiLambdasc)&&(ALamSignal)&&(IsAntiLambdaFromMC)) fHistRCPtCentTrig->Fill(rcAl);
648
649 }
650
651 //===== End of the MC part for V0 reconstruction efficiency ===
85c11f5a 652
59bd5476 653 Int_t nSelectedTracks = selectedTracks->GetEntries();
654 // Correlation part
655 //===================================
656 for (Int_t j = 0; j < nSelectedTracks; j++)
657 {
59bd5476 658 AliAODTrack* atr = (AliAODTrack*) selectedTracks->At(j);
59bd5476 659 if ((atr->Pt())>=(aodV0->Pt())) continue;
660 Double_t dEta = atr->Eta() - aodV0->Eta();
661 Double_t dPhi = atr->Phi() - aodV0->Phi();
662 if (dPhi > (1.5*kPi)) dPhi -= 2.0*kPi;
663 if (dPhi < (-0.5*kPi)) dPhi += 2.0*kPi;
664 // removing autocorrelations
665 //----------------------------------
666 Int_t negID = myTrackNeg->GetID();
667 Int_t posID = myTrackPos->GetID();
668 Int_t atrID = atr->GetID();
669
670 if ((TMath::Abs(negID)+1)==(TMath::Abs(atrID))) continue;
671 if ((TMath::Abs(posID)+1)==(TMath::Abs(atrID))) continue;
672 //----------------------------------
673
74754736 674 fHistNTrigSib->Sumw2();
59bd5476 675 fHistdPhidEtaSib->Sumw2();
85c11f5a 676 // Filling correlation histograms and histograms for triggers counting
677 //----------------- K0 ---------------------
59bd5476 678 if ((cutK0sc)&&(K0Signal))
679 {
59bd5476 680 Double_t spK0Sig[7] = {dPhi, dEta, aodV0->Pt(), atr->Pt(), lCent, lPVz, 1.};
681 fHistdPhidEtaSib->Fill(spK0Sig);
682 }
85c11f5a 683
59bd5476 684 if ((cutK0sc)&&(K0Bckg))
685 {
59bd5476 686 Double_t spK0Bkg[7] = {dPhi, dEta, aodV0->Pt(), atr->Pt(), lCent, lPVz, 4.};
687 fHistdPhidEtaSib->Fill(spK0Bkg);
688 }
85c11f5a 689 //---------------- Lambda -------------------
59bd5476 690 if ((cutLambdasc)&&(LamSignal))
691 {
59bd5476 692 Double_t spLaSig[7] = {dPhi, dEta, aodV0->Pt(), atr->Pt(), lCent, lPVz, 2.};
693 fHistdPhidEtaSib->Fill(spLaSig);
694 }
85c11f5a 695
59bd5476 696 if ((cutLambdasc)&&(LamBckg))
697 {
59bd5476 698 Double_t spLaBkg[7] = {dPhi, dEta, aodV0->Pt(), atr->Pt(), lCent, lPVz, 5.};
699 fHistdPhidEtaSib->Fill(spLaBkg);
700 }
85c11f5a 701 //------------- AntiLambda -------------------
59bd5476 702 if ((cutAntiLambdasc)&&(ALamSignal))
703 {
59bd5476 704 Double_t spAlSig[7] = {dPhi, dEta, aodV0->Pt(), atr->Pt(), lCent, lPVz, 3.};
705 fHistdPhidEtaSib->Fill(spAlSig);
706 }
85c11f5a 707
59bd5476 708 if ((cutAntiLambdasc)&&(ALamBckg))
709 {
59bd5476 710 Double_t spAlBkg[7] = {dPhi, dEta, aodV0->Pt(), atr->Pt(), lCent, lPVz, 6.};
711 fHistdPhidEtaSib->Fill(spAlBkg);
712 }
713
714 } // end of correlation loop
715 //===================================
74754736 716
59bd5476 717
718 } // end of V0 selection loop
719
82bd566c 720 // ===========================================
74754736 721 // Ch-Ch correlation part
82bd566c 722
74754736 723 if (ChChWith)
724 {
725 Int_t nSelectedChargedTriggers = selectedChargedTriggers->GetEntries();
726 for (Int_t i = 0; i < nSelectedChargedTriggers; i++)
727 {
728 AliV0ChBasicParticle* chTrig = (AliV0ChBasicParticle*) selectedChargedTriggers->At(i);
729 Double_t chTrigPhi = chTrig->Phi();
730 Double_t chTrigEta = chTrig->Eta();
731 Double_t chTrigPt = chTrig->Pt();
732
733 Double_t nTrigChSig[4] = {chTrigPt, lCent, lPVz, 7.};
734 fHistNTrigSib->Fill(nTrigChSig);
735
736 Int_t nSelectedTracks = selectedTracks->GetEntries();
737 for (Int_t j = 0; j < nSelectedTracks; j++)
738 {
739 AliAODTrack* atr = (AliAODTrack*) selectedTracks->At(j);
740 if ((atr->Pt())>=chTrigPt) continue;
741 Double_t dEta = atr->Eta() - chTrigEta;
742 Double_t dPhi = atr->Phi() - chTrigPhi;
743 if (dPhi > (1.5*kPi)) dPhi -= 2.0*kPi;
744 if (dPhi < (-0.5*kPi)) dPhi += 2.0*kPi;
745
746 Double_t spCh[7] = {dPhi, dEta, chTrigPt, atr->Pt(), lCent, lPVz, 7.};
747 fHistdPhidEtaSib->Fill(spCh);
748 }
749 }
750 }
751 // end of Ch-Ch correlation part
82bd566c 752
59bd5476 753 // Mixing ==============================================
754
59bd5476 755 fHistdPhidEtaMix->Sumw2();
756 AliEventPool* pool = fPoolMgr->GetEventPool(lCent, lPVz);
757 if (!pool) AliFatal(Form("No pool found for centrality = %f, zVtx = %f", lCent, lPVz));
758 //pool->SetDebug(1);
759 if (pool->IsReady() || pool->NTracksInPool() > fMixingTracks / 10 || pool->GetCurrentNEvents() >= 5)
760 {
761 Int_t nMix = pool->GetCurrentNEvents();
762 for (Int_t jMix=0; jMix<nMix; jMix++)
763 {// loop through mixing events
764 TObjArray* bgTracks = pool->GetEvent(jMix);
765 for (Int_t i=0; i<selectedV0s->GetEntriesFast(); i++)
766 {// loop through selected V0 particles
767 AliV0ChBasicParticle* trig = (AliV0ChBasicParticle*) selectedV0s->At(i);
768 Double_t trigPhi = trig->Phi();
769 Double_t trigEta = trig->Eta();
770 Double_t trigPt = trig->Pt();
771 Short_t trigC = trig->WhichCandidate();
772 for (Int_t j=0; j<bgTracks->GetEntriesFast(); j++)
773 { // mixing tracks loop
774 AliVParticle* assoc = (AliVParticle*) bgTracks->At(j);
775 // be careful tracks may have bigger pt than v0s.
776 if ( ( (assoc->Pt())>=trigPt )||( (assoc->Pt())<PtAssocMin ) ) continue;
777 Double_t dEtaMix = assoc->Eta() - trigEta;
778 Double_t dPhiMix = assoc->Phi() - trigPhi;
779 if (dPhiMix > (1.5*kPi)) dPhiMix -= 2.0*kPi;
780 if (dPhiMix < (-0.5*kPi)) dPhiMix += 2.0*kPi;
781
59bd5476 782 Double_t spMix[7] = {dPhiMix, dEtaMix, trigPt, assoc->Pt(), lCent, lPVz, trigC};
783 fHistdPhidEtaMix->Fill(spMix);
784
785 } // end of mixing track loop
786 }// end of loop through selected V0 particles
82bd566c 787 if (ChChWith)
74754736 788 {
789 for (Int_t i=0; i<selectedChargedTriggers->GetEntriesFast(); i++)
790 {// loop through selected charged trigger particles
791 AliV0ChBasicParticle* trig = (AliV0ChBasicParticle*) selectedChargedTriggers->At(i);
792 Double_t trigPhi = trig->Phi();
793 Double_t trigEta = trig->Eta();
794 Double_t trigPt = trig->Pt();
795 Short_t trigC = trig->WhichCandidate();
796 for (Int_t j=0; j<bgTracks->GetEntriesFast(); j++)
797 { // mixing tracks loop
798 AliVParticle* assoc = (AliVParticle*) bgTracks->At(j);
799 // be careful tracks may have bigger pt than v0s.
800 if ( ( (assoc->Pt())>=trigPt )||( (assoc->Pt())<PtAssocMin ) ) continue;
801
802 Double_t dEtaMix = assoc->Eta() - trigEta;
803 Double_t dPhiMix = assoc->Phi() - trigPhi;
804 if (dPhiMix > (1.5*kPi)) dPhiMix -= 2.0*kPi;
805 if (dPhiMix < (-0.5*kPi)) dPhiMix += 2.0*kPi;
806
807 Double_t spMix[7] = {dPhiMix, dEtaMix, trigPt, assoc->Pt(), lCent, lPVz, trigC};
808 fHistdPhidEtaMix->Fill(spMix);
809
810 } // end of mixing track loop
811 }// end of loop through selected Ch particles
812 } // end of ChCh mixing
813
59bd5476 814 }// end of loop of mixing events
815 }
816
817 TObjArray* tracksClone = (TObjArray*) selectedTracks->Clone();
818 tracksClone->SetOwner(kTRUE);
819 pool->UpdatePool(tracksClone);
820 //delete selectedtracks;
821
74754736 822 PostData(1, fOutput);
59bd5476 823
824}
825//___________________________________________
826Bool_t AliAnalysisTaskV0ChCorrelations::IsMyGoodPrimaryTrack(const AliAODTrack *t)
827{
828 // Pseudorapidity cut
829 if (TMath::Abs(t->Eta())>0.8) return kFALSE;
830 // Should correspond to set of cuts suitable for correlation analysis
831 if (!t->TestFilterBit(1<<7)) return kFALSE;
832
833 return kTRUE;
834}
835//_____________________________________________
836Bool_t AliAnalysisTaskV0ChCorrelations::IsMyGoodDaughterTrack(const AliAODTrack *t)
837{
838 // TPC refit
839 if (!t->IsOn(AliAODTrack::kTPCrefit)) return kFALSE;
840 // Minimum number of clusters
841 Float_t nCrossedRowsTPC = t->GetTPCClusterInfo(2,1);
842 if (nCrossedRowsTPC < 70) return kFALSE;
843 Int_t findable=t->GetTPCNclsF();
844 if (findable <= 0) return kFALSE;
845 if (nCrossedRowsTPC/findable < 0.8) return kFALSE;
846
847 return kTRUE;
848}
849//______________________________________________
74754736 850Bool_t AliAnalysisTaskV0ChCorrelations::IsMyGoodV0(const AliAODEvent* aod, const AliAODv0* aodV0, const AliAODTrack* myTrackPos, const AliAODTrack* myTrackNeg, Int_t oSta)
59bd5476 851{
852 if (!aodV0) {
853 AliError(Form("ERROR: Could not retrieve aodV0"));
854 return kFALSE;
855 }
856
59bd5476 857 // Offline reconstructed V0 only
74754736 858 if (oSta==1) {if (aodV0->GetOnFlyStatus()) return kFALSE;}
859 if (oSta==3) {if (!aodV0->GetOnFlyStatus()) return kFALSE;}
860
861 if (oSta==2) {if (aodV0->GetOnFlyStatus()) return kTRUE;}
862 if (oSta==4) {if (!aodV0->GetOnFlyStatus()) return kTRUE;}
863
864 // Get daughters and check them
865 AliAODTrack *myTrackNegTest=dynamic_cast<AliAODTrack *>(aodV0->GetDaughter(1));
866 AliAODTrack *myTrackPosTest=dynamic_cast<AliAODTrack *>(aodV0->GetDaughter(0));
867
868 if (!myTrackPosTest || !myTrackNegTest) {
869 Printf("strange analysis::UserExec:: Error:Could not retreive one of the daughter track\n");
870 return kFALSE;
871 }
872
873 if( myTrackPosTest->Charge() ==1){
874 myTrackPos = myTrackPosTest;
875 myTrackNeg = myTrackNegTest;
876 }
877
878 if( myTrackPosTest->Charge() ==-1){
879 myTrackPos = myTrackNegTest;
880 myTrackNeg = myTrackPosTest;
881 }
882
883 // Track cuts for daughter tracks
884 if ( !(IsMyGoodDaughterTrack(myTrackPos)) || !(IsMyGoodDaughterTrack(myTrackNeg)) ) return kFALSE;
885
886 // Unlike signs of daughters
887 if (myTrackNegTest->Charge() == myTrackPosTest->Charge()) return kFALSE;
59bd5476 888
74754736 889 // Rapidity cut
890 //Double_t lCutRap = 0.75;
891 //Double_t lRapK0s = aodV0->Y(310);
892 //Double_t lRapLambda = aodV0->Y(3122);
893 //Double_t lRapAntiLambda = aodV0->Y(-3122);
894
895 // Pseudorapidity cut - there are high pt V0
896 Double_t lCutEta = 0.75;
897 Double_t lEtaV0 = aodV0->Eta();
898 if (TMath::Abs(lEtaV0)>=lCutEta) return kFALSE;
899 //if (TMath::Abs(lRapK0s)>=lCutRap) return kFALSE;
900 //if (TMath::Abs(lRapLambda)>=lCutRap) return kFALSE;
901 //if (TMath::Abs(lRapAntiLambda)>=lCutRap) return kFALSE;
902
85c11f5a 903 // getting global variables
904 Float_t dcaDaughtersToPrimVtx = GetDcaDToPV();
905 Float_t dcaBetweenDaughters = GetDcaV0D();
70840314 906
907 // DCA of daughter track to Primary Vertex
908 Float_t xyn=aodV0->DcaNegToPrimVertex();
85c11f5a 909 if (TMath::Abs(xyn)<dcaDaughtersToPrimVtx) return kFALSE;
70840314 910 Float_t xyp=aodV0->DcaPosToPrimVertex();
85c11f5a 911 if (TMath::Abs(xyp)<dcaDaughtersToPrimVtx) return kFALSE;
70840314 912
913 // DCA of daughter tracks
914 Double_t dca=aodV0->DcaV0Daughters();
85c11f5a 915 if (dca>dcaBetweenDaughters) return kFALSE;
70840314 916
917 // Cosinus of pointing angle
918 Double_t cpa=aodV0->CosPointingAngle(aod->GetPrimaryVertex());
919 if (cpa<0.998) return kFALSE;
920
921 // Fiducial volume cut
922 Double_t xyz[3]; aodV0->GetSecondaryVtx(xyz);
923 Double_t r2=xyz[0]*xyz[0] + xyz[1]*xyz[1];
924 if (r2<0.9*0.9) return kFALSE;
925 if (r2>100*100) return kFALSE;
926
927 // c*tau cut - in main V0 loop - depends on particle hypothesis
928
59bd5476 929 // Minimum pt of daughters
930 Double_t lMomPos[3] = {999,999,999};
931 Double_t lMomNeg[3] = {999,999,999};
932
933 lMomPos[0] = aodV0->MomPosX();
934 lMomPos[1] = aodV0->MomPosY();
935 lMomPos[2] = aodV0->MomPosZ();
936
937 lMomNeg[0] = aodV0->MomNegX();
938 lMomNeg[1] = aodV0->MomNegY();
939 lMomNeg[2] = aodV0->MomNegZ();
940
941 Double_t lPtPos = TMath::Sqrt(lMomPos[0]*lMomPos[0] + lMomPos[1]*lMomPos[1]);
942 Double_t lPtNeg = TMath::Sqrt(lMomNeg[0]*lMomNeg[0] + lMomNeg[1]*lMomNeg[1]);
943
944 Double_t cutMinPtDaughter = 0.160;
945 if (lPtPos<cutMinPtDaughter || lPtNeg<cutMinPtDaughter) return kFALSE;
946
947 // Daughter PID cut - in main V0 loop - depends on particle hypothesis
948
949 return kTRUE;
950}
951