]>
Commit | Line | Data |
---|---|---|
35e49ca5 | 1 | /************************************************************************** |
2 | * Authors : Massimo Venaruzzo (massimo.venaruzzo@ts.infn.it) * | |
7356f978 | 3 | * Enrico Fragiacomo (enrico.fragiacomo@ts.infn.it) * |
35e49ca5 | 4 | * Contributors are mentioned in the code where appropriate. * |
5 | * * | |
6 | * Permission to use, copy, modify and distribute this software and its * | |
7 | * documentation strictly for non-commercial purposes is hereby granted * | |
8 | * without fee, provided that the above copyright notice appears in all * | |
9 | * copies and that both the copyright notice and this permission notice * | |
10 | * appear in the supporting documentation. The authors make no claims * | |
11 | * about the suitability of this software for any purpose. It is * | |
12 | * provided "as is" without express or implied warranty. * | |
13 | **************************************************************************/ | |
14 | ||
15 | //----------------------------------------------------------------- | |
16 | // AliAnalysisTaskSigma1385 class | |
17 | //----------------------------------------------------------------- | |
18 | ||
19 | class TTree; | |
20 | class TParticle; | |
21 | class TVector3; | |
22 | ||
23 | #include "AliAnalysisManager.h" | |
24 | #include <AliMCEventHandler.h> | |
25 | #include <AliMCEvent.h> | |
26 | #include <AliStack.h> | |
27 | ||
28 | class AliESDVertex; | |
29 | class AliESDv0; | |
30 | class AliAODv0; | |
31 | ||
32 | #include <iostream> | |
33 | ||
34 | #include "TList.h" | |
35 | #include "TH1.h" | |
36 | #include "TNtuple.h" | |
37 | #include "TGraph.h" | |
38 | #include "TCanvas.h" | |
39 | #include "TMath.h" | |
40 | #include "TChain.h" | |
41 | #include "AliLog.h" | |
42 | #include "AliESDEvent.h" | |
43 | #include "AliAODEvent.h" | |
44 | #include "AliCascadeVertexer.h" | |
45 | #include "AliESDcascade.h" | |
46 | #include "AliAODcascade.h" | |
47 | #include "AliAnalysisTaskSigma1385.h" | |
48 | #include "AliESDtrackCuts.h" | |
6e92ab0d | 49 | #include "AliESDpid.h" |
50 | #include "AliTOFT0maker.h" | |
51 | #include "AliTOFcalib.h" | |
52 | #include "AliCDBManager.h" | |
53 | #include "AliESDtrackCuts.h" | |
35e49ca5 | 54 | |
55 | ClassImp(AliAnalysisTaskSigma1385) | |
7356f978 | 56 | |
35e49ca5 | 57 | //________________________________________________________________________ |
7356f978 | 58 | AliAnalysisTaskSigma1385::AliAnalysisTaskSigma1385() |
6e92ab0d | 59 | : AliAnalysisTaskSE(), |
60 | ||
7356f978 | 61 | //-------------------------------- For PID |
6e92ab0d | 62 | |
63 | fisMC(0), | |
64 | fIsMC(fisMC), | |
7356f978 | 65 | fCheckITS(kTRUE), |
66 | fCheckTPC(kTRUE), | |
67 | fCheckTOF(kTRUE), | |
68 | fUseGlobal(kTRUE), | |
69 | fUseITSSA(kTRUE), | |
70 | fMaxITSband(3.0), | |
71 | fTPCpLimit(0.35), | |
72 | fMinTPCband(3.0), | |
73 | fMaxTPCband(5.0), | |
74 | fESDpid(0x0), | |
75 | fTOFmaker(0x0), | |
76 | fTOFcalib(0x0), | |
6e92ab0d | 77 | fTOFcalibrateESD(!fisMC), |
7356f978 | 78 | fTOFcorrectTExp(kTRUE), |
79 | fTOFuseT0(kTRUE), | |
6e92ab0d | 80 | fTOFtuneMC(fisMC), |
7356f978 | 81 | fTOFresolution(100.0), |
82 | fMinTOF(-2.5), | |
83 | fMaxTOF(3.5), | |
6e92ab0d | 84 | fLastRun(-1), |
85 | fAnalysisType("ESD"), fCollidingSystems(0), fDataType("REAL"), fListHistCascade(0), | |
86 | fHistEventMultiplicity(0), fHistEventMultiplicityRAVS(0), | |
87 | fNtuple1(0), fNtuple2(0), fNtuple3(0), fNtuple4(0) | |
88 | ||
89 | ||
7356f978 | 90 | |
91 | //-------------------------------- | |
92 | ||
35e49ca5 | 93 | { |
7356f978 | 94 | // Dummy Constructor |
7d460484 | 95 | Int_t i; |
96 | for (i = 0; i < 5; i++) fOkTrack[i] = kFALSE; | |
35e49ca5 | 97 | } |
98 | ||
99 | //________________________________________________________________________ | |
7356f978 | 100 | AliAnalysisTaskSigma1385::AliAnalysisTaskSigma1385(const char *name) |
6e92ab0d | 101 | : AliAnalysisTaskSE(name), |
102 | ||
7356f978 | 103 | |
104 | //-------------------------------- For PID | |
105 | ||
6e92ab0d | 106 | fisMC(0), |
107 | fIsMC(fisMC), | |
7356f978 | 108 | fCheckITS(kTRUE), |
109 | fCheckTPC(kTRUE), | |
110 | fCheckTOF(kTRUE), | |
111 | fUseGlobal(kTRUE), | |
112 | fUseITSSA(kTRUE), | |
113 | fMaxITSband(3.0), | |
114 | fTPCpLimit(0.35), | |
115 | fMinTPCband(3.0), | |
116 | fMaxTPCband(5.0), | |
117 | fESDpid(0x0), | |
118 | fTOFmaker(0x0), | |
119 | fTOFcalib(0x0), | |
6e92ab0d | 120 | fTOFcalibrateESD(!fisMC), |
7356f978 | 121 | fTOFcorrectTExp(kTRUE), |
122 | fTOFuseT0(kTRUE), | |
6e92ab0d | 123 | fTOFtuneMC(fisMC), |
7356f978 | 124 | fTOFresolution(100.0), |
125 | fMinTOF(-2.5), | |
126 | fMaxTOF(3.5), | |
6e92ab0d | 127 | fLastRun(-1), |
128 | fAnalysisType("ESD"), fCollidingSystems(0), fDataType("REAL"), fListHistCascade(0), | |
129 | fHistEventMultiplicity(0), fHistEventMultiplicityRAVS(0), | |
130 | fNtuple1(0), fNtuple2(0), fNtuple3(0), fNtuple4(0) | |
7356f978 | 131 | |
132 | //-------------------------------- | |
35e49ca5 | 133 | { |
134 | ||
7356f978 | 135 | // Output slot #0 writes into a TList container (Cascade) |
136 | DefineOutput(1, TList::Class()); | |
7d460484 | 137 | |
138 | Int_t i; | |
139 | for (i = 0; i < 5; i++) fOkTrack[i] = kFALSE; | |
35e49ca5 | 140 | } |
141 | ||
142 | //________________________________________________________________________ | |
143 | void AliAnalysisTaskSigma1385::UserCreateOutputObjects() | |
144 | { | |
7356f978 | 145 | fListHistCascade = new TList(); |
146 | ||
147 | if (! fHistEventMultiplicity) { | |
148 | fHistEventMultiplicity = new TH1F("fHistEventMultiplicity" , "Nb of Events" , 4, -1.0, 3.0); | |
149 | fListHistCascade->Add(fHistEventMultiplicity); | |
150 | } | |
151 | ||
152 | if (! fHistEventMultiplicityRAVS) { | |
153 | fHistEventMultiplicityRAVS = new TH1F("fHistEventMultiplicityRAVS" , "Nb of Events Rejected After Vertex selection" , 4, -1.0, 3.0); | |
154 | fListHistCascade->Add(fHistEventMultiplicityRAVS); | |
155 | } | |
156 | ||
157 | if (! fNtuple1) { | |
158 | fNtuple1 = new TNtuple("fNtuple1", "Ntuple1", "TrkNmb"); | |
159 | fNtuple1->SetDirectory(0); | |
160 | fListHistCascade->Add(fNtuple1); | |
161 | } | |
162 | ||
163 | if (! fNtuple2) { | |
164 | fNtuple2 = new TNtuple("fNtuple2", "Ntuple2", "s:dcal:lCosPoinAn:lDaugDCA:lambdap:lambdapt:lambdamass"); | |
165 | fNtuple2->SetDirectory(0); | |
166 | fListHistCascade->Add(fNtuple2); | |
167 | } | |
168 | ||
169 | if (! fNtuple3) { | |
170 | fNtuple3 = new TNtuple("fNtuple3", "Ntuple3", "c:dcapi:ppi:ptpi:bachphi:bachtheta:okPiTPC:okPiTOF"); | |
171 | fNtuple3->SetDirectory(0); | |
172 | fListHistCascade->Add(fNtuple3); | |
173 | } | |
174 | ||
175 | if (! fNtuple4) { | |
176 | fNtuple4 = new TNtuple("fNtuple4", "Ntuple4", "dca:mc:phi:theta:eta:y:pt:p:opang:invmass"); | |
177 | fListHistCascade->Add(fNtuple4); | |
178 | } | |
179 | ||
180 | ||
35e49ca5 | 181 | }// end UserCreateOutputObjects |
182 | ||
183 | ||
184 | //________________________________________________________________________ | |
7356f978 | 185 | void AliAnalysisTaskSigma1385::UserExec(Option_t *) |
35e49ca5 | 186 | { |
187 | ||
7356f978 | 188 | // Main loop |
189 | // Called for each event | |
190 | ||
191 | ||
192 | Info("AliAnalysisTaskSigma1385", "Starting UserExec"); | |
193 | ||
194 | AliMCEventHandler* eventHandler; | |
195 | AliMCEvent* mcEvent = 0; | |
196 | ||
197 | if (fDataType == "SIM") { | |
198 | ||
199 | eventHandler = dynamic_cast<AliMCEventHandler*>(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()); | |
200 | if (!eventHandler) { | |
201 | Printf("ERROR: Could not retrieve MC event handler"); | |
202 | return; | |
203 | } | |
204 | ||
205 | mcEvent = eventHandler->MCEvent(); | |
206 | if (!mcEvent) { | |
207 | Printf("ERROR: Could not retrieve MC event"); | |
208 | return; | |
209 | } | |
210 | ||
211 | } | |
212 | ||
213 | AliStack* stack = 0; | |
6e92ab0d | 214 | if (fDataType == "SIM") {stack = mcEvent->Stack(); fIsMC = 1; fisMC = 1;} |
7356f978 | 215 | |
216 | AliESDEvent *lESDevent = 0x0; | |
217 | AliAODEvent *lAODevent = 0x0; | |
218 | ||
219 | ||
220 | // Connect to the InputEvent | |
221 | Int_t ncascades = -1; | |
222 | if (fAnalysisType == "ESD") { | |
223 | lESDevent = dynamic_cast<AliESDEvent*>(InputEvent()); | |
17cba06c | 224 | if (lESDevent) ncascades = lESDevent->GetNumberOfCascades(); |
4d921955 | 225 | } else if (fAnalysisType == "AOD") { |
7356f978 | 226 | lAODevent = dynamic_cast<AliAODEvent*>(InputEvent()); |
17cba06c | 227 | if (lAODevent) ncascades = lAODevent->GetNumberOfCascades(); |
fbd6b79e | 228 | } |
229 | ||
230 | // skip when both sources are unavailable | |
231 | if (!lESDevent && !lAODevent) { | |
4d921955 | 232 | Printf("ERROR: neither lESDevent nor lAODevent are available \n"); |
233 | return; | |
234 | } | |
7356f978 | 235 | |
236 | ||
237 | //------------------------------for PID | |
238 | ||
239 | SetCheckITS(kTRUE); | |
240 | SetCheckTPC(kTRUE); | |
241 | SetCheckTOF(kTRUE); | |
242 | ||
243 | // ----> set TPC range for PID and calibration | |
244 | SetTPCrange(5.0, 3.0); | |
245 | SetTPCpLimit(0.35); | |
246 | ||
247 | // ----> set ITS range for PID | |
248 | SetITSband(4.0); | |
249 | ||
250 | // ----> set TPC calibration | |
251 | if (fDataType == "SIM") SetTPCpar(2.15898 / 50.0, 1.75295E1, 3.40030E-9, 1.96178, 3.91720); | |
252 | else SetTPCpar(1.41543 / 50.0, 2.63394E1, 5.0411E-11, 2.12543, 4.88663); | |
253 | ||
254 | // ----> set the TOF calibration depending on type of input (sim/data) | |
255 | SetTOFcorrectTExp(kTRUE); | |
256 | SetTOFuseT0(kTRUE); | |
257 | SetTOFresolution(100.0); | |
258 | if (fDataType == "SIM") { | |
259 | SetTOFcalibrateESD(kFALSE); | |
260 | SetTOFtuneMC(kTRUE); | |
261 | } else { | |
262 | ||
263 | SetTOFcalibrateESD(kTRUE); | |
264 | SetTOFtuneMC(kFALSE); | |
265 | } | |
266 | ||
267 | ||
268 | if (!fESDpid) { | |
269 | fESDpid = new AliESDpid; | |
270 | fESDpid->GetTPCResponse().SetBetheBlochParameters(fTPCpar[0], fTPCpar[1], fTPCpar[2], fTPCpar[3], fTPCpar[4]); | |
271 | } | |
272 | ||
273 | // initialize DB to current run | |
274 | Int_t run = lESDevent->GetRunNumber(); | |
275 | if (run != fLastRun) { | |
276 | //cout << "Run = " << run << " -- LAST = " << fLastRun << endl; | |
277 | fLastRun = run; | |
278 | ||
279 | // setup TOF maker & calibration | |
280 | if (!fTOFcalib) fTOFcalib = new AliTOFcalib; | |
281 | fTOFcalib->SetCorrectTExp(fTOFcorrectTExp); | |
282 | if (!fTOFmaker) fTOFmaker = new AliTOFT0maker(fESDpid, fTOFcalib); | |
283 | fTOFmaker->SetTimeResolution(fTOFresolution); | |
284 | ||
285 | AliCDBManager *cdb = AliCDBManager::Instance(); | |
286 | cdb->ClearCache(); // suggestion by Annalisa | |
287 | cdb->Clear(); // suggestion by Annalisa | |
288 | cdb->SetDefaultStorage("raw://"); | |
289 | cdb->SetRun(run); | |
290 | fTOFcalib->SetCorrectTExp(fTOFcorrectTExp); | |
291 | fTOFcalib->Init(); | |
292 | } | |
293 | ||
294 | // if required, calibrate the TOF t0 maker with current event | |
295 | if (fTOFcalibrateESD) fTOFcalib->CalibrateESD(lESDevent); | |
296 | if (fTOFtuneMC) fTOFmaker->TuneForMC(lESDevent); | |
297 | if (fTOFuseT0) { | |
298 | fTOFmaker->ComputeT0TOF(lESDevent); | |
299 | fTOFmaker->ApplyT0TOF(lESDevent); | |
300 | fESDpid->MakePID(lESDevent, kFALSE, 0.); | |
301 | } | |
302 | ||
303 | ||
304 | //-------------------------------------------------------- | |
305 | ||
306 | ||
307 | fHistEventMultiplicity->Fill(1); | |
308 | ||
309 | //Some Quantities to characterize the event | |
35e49ca5 | 310 | |
7356f978 | 311 | Double_t b = lESDevent->GetMagneticField(); |
6e92ab0d | 312 | Int_t trackNumber = lESDevent->GetNumberOfTracks(); |
7356f978 | 313 | |
314 | ||
315 | //--------------------------- | |
316 | // new part from AliCascadeVertexer (use vertexer for reconstructing Sigma(1385) | |
317 | // | |
318 | //const AliESDVertex *vtxT3D=lESDevent->GetPrimaryVertex(); | |
319 | const AliESDVertex *vtxT3D = lESDevent->GetPrimaryVertexTracks(); | |
320 | if (vtxT3D->GetNContributors() < 1) { | |
321 | // SPD vertex | |
322 | vtxT3D = lESDevent->GetPrimaryVertexSPD(); | |
323 | if (vtxT3D->GetNContributors() < 1) { | |
324 | ||
325 | ||
326 | fHistEventMultiplicityRAVS->Fill(1); | |
327 | return; | |
35e49ca5 | 328 | } |
7356f978 | 329 | |
330 | ||
331 | } | |
332 | ||
333 | Double_t xPrimaryVertex = vtxT3D->GetXv(); | |
334 | Double_t yPrimaryVertex = vtxT3D->GetYv(); | |
335 | Double_t zPrimaryVertex = vtxT3D->GetZv(); | |
336 | ||
337 | if (zPrimaryVertex > 10 || zPrimaryVertex < -10) return; | |
338 | ||
339 | //------------------------------------------------------- | |
340 | // New Part about tracks global selection criteria | |
341 | //------------------------------------------------------- | |
342 | ||
343 | AliESDtrackCuts* esdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts"); | |
344 | ||
345 | esdTrackCuts->SetAcceptKinkDaughters(0); // 0 = kFalse | |
346 | esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny); | |
347 | esdTrackCuts->SetMaxChi2PerClusterTPC(4); | |
348 | esdTrackCuts->SetMinNClustersTPC(70); | |
349 | ||
350 | ||
351 | //------------------------------------------------------- | |
352 | // loops over V0s | |
353 | //stores relevant V0s in an array | |
354 | Int_t nV0 = (Int_t)lESDevent->GetNumberOfV0s(); | |
355 | ||
356 | TObjArray vtcs(nV0); | |
357 | for (Int_t i = 0; i < nV0; i++) { | |
358 | AliESDv0 *v = lESDevent->GetV0(i); | |
359 | if (v->GetOnFlyStatus()) continue; // if kTRUE, then this V0 is recontructed | |
360 | ||
361 | vtcs.AddLast(v); | |
362 | } | |
363 | nV0 = vtcs.GetEntriesFast(); | |
364 | ||
365 | //------------------------------------------------------- | |
366 | // loops over bachelor tracks | |
367 | // stores relevant tracks in another array | |
368 | ||
369 | Int_t nentr = (Int_t)lESDevent->GetNumberOfTracks(); | |
370 | TArrayI trk(nentr); Int_t ntr = 0; | |
371 | ||
372 | for (Int_t i = 0; i < nentr; i++) { | |
373 | AliESDtrack *esdtr = lESDevent->GetTrack(i); | |
374 | ||
375 | if (!(esdtr->GetStatus() & AliESDtrack::kITSrefit)) continue; | |
376 | if (!(esdtr->GetStatus() & AliESDtrack::kTPCrefit)) continue; | |
377 | ||
378 | ||
379 | if (!(esdTrackCuts->AcceptTrack(esdtr))) continue; | |
380 | ||
381 | trk[ntr++] = i; | |
382 | } | |
383 | ||
384 | ||
385 | ||
386 | //----------------------------------------------------- | |
387 | // nested loops over V0s and bachelors | |
388 | Float_t massLambda = 1.11568; | |
389 | Int_t ncasc = 0; | |
390 | AliCascadeVertexer *cascvert = new AliCascadeVertexer(); | |
391 | for (Int_t i = 0; i < nV0; i++) { //loop on V0s | |
392 | ||
393 | // Lambda | |
394 | AliESDv0 *v = (AliESDv0*)vtcs.UncheckedAt(i); | |
395 | Int_t strness = 0; | |
396 | Double_t lambdaMass = 0; | |
397 | Float_t lambdaP = 0; | |
398 | Float_t lambdaPt = 0; | |
6e92ab0d | 399 | Float_t lambdaDCA = 0; // DCA between Lambda and Primary Vertex |
7356f978 | 400 | Double_t v0cospointangle = 0; |
401 | Float_t v0daughtersDCA = 0; | |
402 | ||
403 | ||
404 | // Lambda quality cuts | |
405 | UInt_t lIdxPosXi = (UInt_t) TMath::Abs(v->GetPindex()); | |
406 | UInt_t lIdxNegXi = (UInt_t) TMath::Abs(v->GetNindex()); | |
407 | ||
408 | AliESDtrack *pTrackXi = lESDevent->GetTrack(lIdxPosXi); | |
409 | AliESDtrack *nTrackXi = lESDevent->GetTrack(lIdxNegXi); | |
410 | ||
411 | // Filter like-sign V0 | |
6e92ab0d | 412 | if ( (TMath::Abs(pTrackXi->GetSign()) - TMath::Abs(nTrackXi->GetSign()) ) < 0.1) continue; |
7356f978 | 413 | |
414 | // WARNING: the following selections cannot be done for AOD yet... | |
415 | ||
416 | ||
417 | v->ChangeMassHypothesis(kLambda0); // the v0 must be Lambda | |
418 | ||
419 | ||
6e92ab0d | 420 | if ((TMath::Abs(v->GetEffMass() - massLambda)) < 0.2) { |
7356f978 | 421 | |
422 | if (!(pTrackXi->GetStatus() & AliESDtrack::kTPCrefit)) continue; | |
423 | if (!(nTrackXi->GetStatus() & AliESDtrack::kTPCrefit)) continue; | |
424 | ||
425 | ||
426 | if ((pTrackXi->GetTPCNcls()) < 70) continue; | |
427 | if ((nTrackXi->GetTPCNcls()) < 70) continue; | |
428 | ||
6e92ab0d | 429 | strness = 1; lambdaMass = v->GetEffMass(); lambdaP = v->P(); lambdaPt = v->Pt(); lambdaDCA = v->GetD(xPrimaryVertex, yPrimaryVertex, zPrimaryVertex); v0cospointangle = v->GetV0CosineOfPointingAngle(); v0daughtersDCA = v->GetDcaV0Daughters(); |
7356f978 | 430 | |
431 | ||
432 | ||
433 | } | |
434 | ||
435 | ||
436 | v->ChangeMassHypothesis(kLambda0Bar); // the v0 must be Anti Lambda | |
437 | ||
438 | ||
439 | ||
6e92ab0d | 440 | if ((TMath::Abs(v->GetEffMass() - massLambda)) < 0.2) { |
7356f978 | 441 | |
442 | if (!(pTrackXi->GetStatus() & AliESDtrack::kTPCrefit)) continue; | |
443 | if (!(nTrackXi->GetStatus() & AliESDtrack::kTPCrefit)) continue; | |
444 | ||
445 | ||
446 | if ((pTrackXi->GetTPCNcls()) < 70) continue; | |
447 | if ((nTrackXi->GetTPCNcls()) < 70) continue; | |
448 | ||
6e92ab0d | 449 | Int_t temp = strness + 1; strness = -1 * temp; lambdaMass = v->GetEffMass(); lambdaP = v->P(); lambdaPt = v->Pt(); lambdaDCA = v->GetD(xPrimaryVertex, yPrimaryVertex, zPrimaryVertex); v0cospointangle = v->GetV0CosineOfPointingAngle(); v0daughtersDCA = v->GetDcaV0Daughters(); |
7356f978 | 450 | |
451 | ||
452 | } | |
453 | ||
454 | if (strness == 0) continue; | |
455 | ||
456 | ||
457 | for (Int_t j = 0; j < ntr; j++) { //loop on tracks | |
458 | ||
459 | // Pion bachelor | |
460 | Int_t bidx = trk[j]; | |
461 | Int_t bachTPCcls = 0; | |
462 | ||
463 | ||
464 | if ((bidx == v->GetIndex(0)) || (bidx == v->GetIndex(1))) continue; // bach and V0's daughter's must be different! | |
465 | ||
466 | AliESDtrack *btrk = lESDevent->GetTrack(bidx); | |
467 | ||
468 | if (!(btrk->GetStatus() & AliESDtrack::kTPCrefit)) continue; | |
469 | ||
470 | if ((bachTPCcls = btrk->GetTPCNcls()) < 70) continue; | |
471 | ||
7d460484 | 472 | //Bool_t *IsOkTrack = IsSelected(btrk); //for Alberto's PID |
7356f978 | 473 | |
7d460484 | 474 | //Bool_t *okTrack = new Bool_t[5]; |
7356f978 | 475 | |
7d460484 | 476 | //for (Int_t k = 0; k < 5; k++) okTrack[k] = IsOkTrack[k]; |
477 | ||
478 | IsSelected(btrk); | |
7356f978 | 479 | |
480 | ||
6e92ab0d | 481 | Int_t bachCharge = btrk->Charge(); |
482 | Float_t pionDCA = TMath::Abs(btrk->GetD(xPrimaryVertex, yPrimaryVertex, b)); // DCA between Bachelor and Primary Vertex | |
7356f978 | 483 | |
484 | Double_t bachphi = btrk->Phi(); | |
485 | Double_t bachtheta = btrk->Theta(); | |
486 | Double_t bachmass = 0.13957; | |
487 | Double_t bachp = btrk->GetP(); | |
488 | Double_t bachpt = btrk->Pt(); | |
489 | ||
490 | ||
491 | // Distance between Lambda and Pion bachelor | |
492 | AliESDv0 v0(*v), *pv0 = &v0; | |
493 | AliExternalTrackParam bt(*btrk), *pbt = &bt; | |
494 | Double_t dca = cascvert->PropagateToDCA(pv0, pbt, b); // distance bwn V0 and bach (in cm) | |
495 | if (dca > 10.0) continue; // Note: was 0.1! Enlarged->further filter in second pass analysis | |
496 | ||
497 | ||
498 | AliESDcascade cascade(*pv0, *pbt, bidx); //constucts a sigma1385 candidate | |
499 | AliESDcascade *xi = &cascade; | |
500 | ||
501 | ||
502 | UInt_t lBachIdx = (UInt_t) TMath::Abs(xi->GetBindex()); | |
503 | AliESDtrack *bachTrackXi = lESDevent->GetTrack(lBachIdx); | |
504 | ||
505 | ||
506 | ||
6e92ab0d | 507 | Short_t mcTrue=0; |
7356f978 | 508 | if (fDataType == "SIM") { |
509 | ||
510 | Int_t pLabel = TMath::Abs(pTrackXi->GetLabel()); | |
511 | Int_t nLabel = TMath::Abs(nTrackXi->GetLabel()); | |
512 | Int_t bachLabel = TMath::Abs(bachTrackXi->GetLabel()); | |
513 | ||
514 | Int_t motherpLabel = stack->Particle(pLabel)->GetFirstMother(); | |
515 | Int_t mothernLabel = stack->Particle(nLabel)->GetFirstMother(); | |
516 | Int_t motherbachLabel = stack->Particle(bachLabel)->GetFirstMother(); | |
517 | ||
518 | ||
519 | //cout<< "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"<<endl; | |
520 | //cout<< "plabel " << pLabel << " nlabel " << nLabel << " mother p " << motherpLabel << " mother n " << mothernLabel << " bachlabel " << bachLabel << " mother bach " << motherbachLabel << endl; | |
521 | //cout<< "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"<<endl; | |
522 | ||
523 | if (motherpLabel > -1 && mothernLabel > -1) { | |
524 | TParticle *plambda = stack->Particle(motherpLabel); | |
525 | Int_t grandmother = plambda->GetFirstMother(); | |
526 | ||
527 | motherpLabel = TMath::Abs(motherpLabel); | |
528 | mothernLabel = TMath::Abs(mothernLabel); | |
529 | //motherbachLabel = TMath::Abs(motherbachLabel); | |
530 | ||
531 | //cout<< "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"<<endl; | |
532 | //cout<< "plabel " << pLabel << " nlabel " << nLabel << " mother p " << motherpLabel << " mother n " << mothernLabel << " mother lambda " << grandmother << " bachlabel " << bachLabel << " mother bach " << motherbachLabel << endl; | |
533 | //cout<< "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"<<endl; | |
534 | ||
535 | if (motherbachLabel > -1) { | |
536 | ||
537 | ||
538 | //cout<< "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"<<endl; | |
539 | //cout<< "mother lambda " << grandmother << " mother bach " << motherbachLabel << " PDG Code "<< stack->Particle(grandmother)->GetPdgCode() << endl; | |
540 | //cout<< "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"<<endl; | |
541 | ||
542 | if ((motherpLabel == mothernLabel) && (grandmother == motherbachLabel) && | |
543 | ((TMath::Abs(stack->Particle(grandmother)->GetPdgCode()) == 3114) || | |
6e92ab0d | 544 | (TMath::Abs(stack->Particle(grandmother)->GetPdgCode()) == 3224))) mcTrue = 1; |
545 | ||
546 | if( (motherpLabel == mothernLabel) && (grandmother == motherbachLabel) && | |
547 | (TMath::Abs(stack->Particle(grandmother)->GetPdgCode())==3312) ) mcTrue = 2; | |
7356f978 | 548 | |
549 | } | |
550 | ||
551 | } | |
552 | ||
553 | } | |
554 | ||
555 | Double_t lBachMomX = 0., lBachMomY = 0., lBachMomZ = 0.; | |
556 | Double_t lPMom[3] = {0., 0., 0.,}; | |
557 | Double_t lNMom[3] = {0., 0., 0.,}; | |
558 | Float_t lLambdaMomX = 0., lLambdaMomY = 0., lLambdaMomZ = 0.; | |
559 | xi->GetBPxPyPz(lBachMomX, lBachMomY, lBachMomZ); | |
560 | xi->GetPPxPyPz(lPMom[0], lPMom[1], lPMom[2]); | |
561 | xi->GetNPxPyPz(lNMom[0], lNMom[1], lNMom[2]); | |
562 | lLambdaMomX = lPMom[0] + lNMom[0]; | |
563 | lLambdaMomY = lPMom[1] + lNMom[1]; | |
564 | lLambdaMomZ = lPMom[2] + lNMom[2]; | |
565 | ||
566 | Float_t lRapXi = xi->RapXi(); | |
567 | Float_t lEta = xi->Eta(); | |
568 | Float_t lTheta = xi->Theta(); | |
569 | Float_t lPhi = xi->Phi(); | |
570 | Float_t lPt = xi->Pt(); | |
571 | Float_t lP = xi->P(); | |
572 | ||
573 | // Support variables for invariant mass calculation | |
6e92ab0d | 574 | TLorentzVector lambda, pion, sigma; |
575 | Double_t eLambda = TMath::Sqrt(lLambdaMomX * lLambdaMomX + lLambdaMomY * lLambdaMomY + lLambdaMomZ * lLambdaMomZ + lambdaMass * lambdaMass); | |
576 | Double_t ePion = TMath::Sqrt(lBachMomX * lBachMomX + lBachMomY * lBachMomY + lBachMomZ * lBachMomZ + bachmass * bachmass) ; | |
7356f978 | 577 | |
6e92ab0d | 578 | lambda.SetPxPyPzE(lLambdaMomX, lLambdaMomY, lLambdaMomZ, eLambda); |
579 | pion.SetPxPyPzE(lBachMomX, lBachMomY, lBachMomZ, ePion); | |
7356f978 | 580 | |
6e92ab0d | 581 | sigma = lambda + pion; |
7356f978 | 582 | |
583 | Double_t openingangle, invmass = 0; | |
584 | ||
585 | openingangle = TMath::ACos((lBachMomX * lLambdaMomX + lBachMomY * lLambdaMomY + lBachMomZ * lLambdaMomZ) / ((TMath::Sqrt(lBachMomX * lBachMomX + lBachMomY * lBachMomY + lBachMomZ * lBachMomZ)) * (TMath::Sqrt(lLambdaMomX * lLambdaMomX + lLambdaMomY * lLambdaMomY + | |
586 | lLambdaMomZ * lLambdaMomZ)))); | |
587 | ||
6e92ab0d | 588 | invmass = sigma.M(); |
7356f978 | 589 | |
590 | ||
6e92ab0d | 591 | fNtuple1->Fill(trackNumber); |
592 | fNtuple2->Fill((1.*strness), lambdaDCA, v0cospointangle, v0daughtersDCA , lambdaP, lambdaPt, lambdaMass); | |
593 | //fNtuple3->Fill((1.*bachCharge), pionDCA, bachp, bachpt, bachphi, bachtheta, okTrack[1], okTrack[2]); | |
594 | fNtuple3->Fill((1.*bachCharge), pionDCA, bachp, bachpt, bachphi, bachtheta, fOkTrack[1], fOkTrack[2]); | |
595 | fNtuple4->Fill(dca, (1.*mcTrue), lPhi, lTheta, lEta, lRapXi, lPt, lP, openingangle, invmass); | |
7356f978 | 596 | |
597 | ncasc++; | |
598 | ||
7d460484 | 599 | //delete IsOkTrack; |
600 | //delete okTrack; | |
7356f978 | 601 | |
602 | ||
603 | } // end loop tracks | |
604 | } // end loop V0s | |
605 | ||
606 | Info("AliAnalysisTaskSigma1385", "Number of reconstructed Sigma(1385): %d", ncasc); | |
607 | ||
608 | ||
609 | // Post output data. | |
610 | PostData(1, fListHistCascade); | |
611 | ||
35e49ca5 | 612 | } |
613 | ||
614 | //________________________________________________________________________ | |
615 | ||
7d460484 | 616 | //Bool_t *AliAnalysisTaskSigma1385::IsSelected(AliESDtrack *track) |
617 | void AliAnalysisTaskSigma1385::IsSelected(AliESDtrack *track) | |
35e49ca5 | 618 | { |
619 | // | |
620 | // | |
7d460484 | 621 | //Bool_t okTrack[5]; |
7356f978 | 622 | |
7d460484 | 623 | //for (Int_t i = 0; i < 5; i++) okTrack[i] = kFALSE; |
624 | for (Int_t i = 0; i < 5; i++) fOkTrack[i] = kFALSE; | |
7356f978 | 625 | |
626 | ||
627 | AliITSPIDResponse itsrsp(fIsMC); | |
628 | ||
629 | ||
630 | ULong_t status; | |
631 | Int_t k, nITS; | |
632 | Double_t times[10], tpcNSigma, tpcMaxNSigma, itsSignal, itsNSigma, mom, tofTime, tofSigma, tofRef, tofRel; | |
633 | Bool_t okTOF = kFALSE; | |
634 | Bool_t okTPC = kFALSE; | |
635 | Bool_t okITS = kFALSE; | |
636 | Bool_t isTPC = kFALSE; | |
637 | Bool_t isITSSA = kFALSE; | |
638 | Bool_t isTOF = kFALSE; | |
639 | UChar_t itsCluMap; | |
640 | ||
641 | // get commonly used variables | |
642 | status = (ULong_t)track->GetStatus(); | |
643 | mom = track->P(); | |
644 | isTPC = ((status & AliESDtrack::kTPCin) != 0); | |
fbd6b79e | 645 | isITSSA = !isTPC && track->IsOn(AliESDtrack::kITSrefit) && !track->IsOn(AliESDtrack::kITSpureSA); //(!isTPC && (status & AliESDtrack::kITSrefit) != 0 && (status & AliESDtrack::kITSpureSA) == 0 && (status & AliESDtrack::kITSpid) != 0); |
7356f978 | 646 | isTOF = (((status & AliESDtrack::kTOFout) != 0) && ((status & AliESDtrack::kTIME) != 0) /* && mom > TMath::Max(b1, b2)*/); |
647 | ||
648 | ||
649 | // check if the track type matches what is required | |
650 | if (!isTPC && !isITSSA) { | |
651 | AliDebug(AliLog::kDebug + 2, "Track is not either a TPC track or a ITS standalone. Rejected"); | |
7d460484 | 652 | //return okTrack; |
653 | return; | |
7356f978 | 654 | |
655 | } else if (isTPC && !fUseGlobal) { | |
656 | AliDebug(AliLog::kDebug + 2, "Global tracks not used. Rejected"); | |
7d460484 | 657 | //return okTrack; |
658 | return; | |
7356f978 | 659 | |
660 | } else if (isITSSA && !fUseITSSA) { | |
661 | AliDebug(AliLog::kDebug + 2, "ITS standalone not used. Rejected"); | |
7d460484 | 662 | //return okTrack; |
663 | return; | |
7356f978 | 664 | } |
665 | ||
666 | // does a preliminary check on TOF values, if necessary | |
667 | // then, if the reference time or TOF signal are meaningless | |
668 | // even if the 'isTOF' flag is true, switch it to false | |
669 | if (isTOF) { | |
670 | track->GetIntegratedTimes(times); | |
671 | tofTime = (Double_t)track->GetTOFsignal(); | |
672 | tofSigma = fTOFmaker->GetExpectedSigma(mom, times[AliPID::kPion], AliPID::ParticleMass(AliPID::kPion)); | |
673 | tofRef = times[AliPID::kPion]; | |
674 | if (tofRef <= 0.0 && tofSigma <= 0.0) isTOF = kFALSE; | |
675 | } | |
676 | ||
677 | ||
678 | ||
679 | // check TPC dE/dx | |
680 | if (isTPC) { // this branch is entered by all global tracks | |
681 | // check TPC dE/dx: | |
682 | if (fCheckTPC) { | |
683 | tpcNSigma = TMath::Abs(fESDpid->NumberOfSigmasTPC(track, AliPID::kPion)); | |
684 | if (track->GetInnerParam()->P() > fTPCpLimit) tpcMaxNSigma = fMinTPCband; else tpcMaxNSigma = fMaxTPCband; | |
685 | okTPC = (tpcNSigma <= tpcMaxNSigma); | |
686 | AliDebug(AliLog::kDebug + 2, Form("TPC nsigma = %f -- max = %f -- cut %s", tpcNSigma, tpcMaxNSigma, (okTPC ? "passed" : "failed"))); | |
687 | } else { | |
688 | // if TPC is not checked, it is as if all tracks do pass the cut | |
689 | okTPC = kTRUE; | |
690 | AliDebug(AliLog::kDebug + 2, "TPC not checked, track accepted"); | |
691 | } | |
692 | ||
693 | // check TOF (only if flags are OK) | |
694 | if (fCheckTOF) { | |
695 | if (isTOF) { | |
696 | // TOF can be checked only when track is matched there | |
697 | track->GetIntegratedTimes(times); | |
698 | tofTime = (Double_t)track->GetTOFsignal(); | |
699 | tofSigma = fTOFmaker->GetExpectedSigma(mom, times[AliPID::kPion], AliPID::ParticleMass(AliPID::kPion)); | |
700 | tofRef = times[AliPID::kPion]; | |
701 | ||
702 | tofRel = (tofTime - tofRef) / tofSigma; | |
703 | okTOF = ((tofRel >= fMinTOF) && (tofRel <= fMaxTOF)); | |
704 | AliDebug(AliLog::kDebug + 2, Form("TOF nsigma = %f -- range = %f %f -- cut %s", tofRel, fMinTOF, fMaxTOF, (okTOF ? "passed" : "failed"))); | |
705 | } else { | |
706 | // if TOF is not matched, the answer depends on TPC: | |
707 | // - if TPC is required, track is checked only there and TOF simply ignored | |
708 | // - if TPC is not required, track is rejected when TOF does not match it, if TOF check is required | |
709 | if (fCheckTPC) okTOF = kTRUE; else okTOF = kFALSE; | |
710 | } | |
711 | } else { | |
712 | okTOF = kTRUE; | |
35e49ca5 | 713 | } |
7356f978 | 714 | |
715 | } else if (isITSSA) { // this branch is entered by all ITS standalone tracks | |
716 | // check dE/dx only if this is required, otherwise ITS standalone are just added but not checked for PID | |
717 | if (fCheckITS) { | |
718 | itsSignal = track->GetITSsignal(); | |
719 | itsCluMap = track->GetITSClusterMap(); | |
720 | nITS = 0; | |
721 | for (k = 2; k < 6; k++) if (itsCluMap & (1 << k)) ++nITS; | |
7d460484 | 722 | //if (nITS < 3) return kFALSE; |
723 | //itsNSigma = itsrsp.GetNumberOfSigmas(mom, itsSignal, AliPID::kPion, nITS, kTRUE); | |
724 | //okITS = ((TMath::Abs(itsNSigma)) <= fMaxITSband); | |
725 | if (nITS < 3) | |
726 | okITS = kFALSE; | |
727 | else { | |
728 | itsNSigma = itsrsp.GetNumberOfSigmas(mom, itsSignal, AliPID::kPion, nITS, kTRUE); | |
729 | okITS = ((TMath::Abs(itsNSigma)) <= fMaxITSband); | |
730 | AliDebug(AliLog::kDebug + 2, Form("ITS nsigma = %f -- max = %f -- cut %s", itsNSigma, fMaxITSband, (okITS ? "passed" : "failed"))); | |
731 | } | |
7356f978 | 732 | } else { |
733 | okITS = kTRUE; | |
35e49ca5 | 734 | } |
7356f978 | 735 | } else { |
736 | // if we are here, the track is surely bad | |
737 | okITS = kFALSE; | |
738 | okTPC = kFALSE; | |
739 | okTOF = kFALSE; | |
35e49ca5 | 740 | } |
7356f978 | 741 | |
742 | ||
7d460484 | 743 | //okTrack[0] = okITS; |
744 | //okTrack[1] = okTPC; | |
745 | //okTrack[2] = okTOF; | |
746 | //okTrack[3] = isTPC; | |
747 | //okTrack[4] = isITSSA; | |
748 | ||
749 | fOkTrack[0] = okITS; | |
750 | fOkTrack[1] = okTPC; | |
751 | fOkTrack[2] = okTOF; | |
752 | fOkTrack[3] = isTPC; | |
753 | fOkTrack[4] = isITSSA; | |
7356f978 | 754 | |
755 | //cout<<"##########################################"<<endl; | |
756 | //cout<<"isITSSA "<<isITSSA<< " isTPC "<<isTPC<<endl; | |
757 | //cout<<"##########################################"<<endl; | |
758 | ||
759 | ||
7d460484 | 760 | //return okTrack; |
35e49ca5 | 761 | } |
762 | ||
763 | ||
764 | ||
765 | ||
766 | ||
767 | ||
768 | ||
769 | ||
770 | ||
771 | ||
772 | ||
773 | //________________________________________________________________________ | |
7356f978 | 774 | void AliAnalysisTaskSigma1385::Terminate(Option_t *) |
35e49ca5 | 775 | { |
7356f978 | 776 | // Draw result to the screen |
777 | // Called once at the end of the query | |
35e49ca5 | 778 | } |
779 | ||
780 | ||
781 |