]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGHF/vertexingHF/AliAODRecoCascadeHF.cxx
Adding libGui needed by libCDB
[u/mrichter/AliRoot.git] / PWGHF / vertexingHF / AliAODRecoCascadeHF.cxx
CommitLineData
05d80dd6 1/**************************************************************************
2 * Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
27de2dfb 16/* $Id$ */
17
05d80dd6 18/////////////////////////////////////////////////////////////
19//
20// Class for AOD reconstructed heavy-flavour cascades
21//
c3fe1eed 22// Author: X-M. Zhang, zhangxm@iopp.ccnu.edu.cn
05d80dd6 23/////////////////////////////////////////////////////////////
24
25#include <TVector3.h>
26#include <TDatabasePDG.h>
b3999999 27#include <TClonesArray.h>
28#include "AliAODMCParticle.h"
05d80dd6 29#include "AliAODRecoDecay.h"
30#include "AliAODVertex.h"
31#include "AliAODRecoDecayHF2Prong.h"
32#include "AliAODRecoCascadeHF.h"
33
34ClassImp(AliAODRecoCascadeHF)
35//-----------------------------------------------------------------------------
36
37AliAODRecoCascadeHF::AliAODRecoCascadeHF() :
dcfa35b3 38 AliAODRecoDecayHF2Prong()
05d80dd6 39{
40 //
41 // Default Constructor
42 //
43}
44//-----------------------------------------------------------------------------
45AliAODRecoCascadeHF::AliAODRecoCascadeHF(AliAODVertex *vtx2, Short_t charge,
46 Double_t *px, Double_t *py, Double_t *pz,
47 Double_t *d0, Double_t *d0err, Double_t dca) :
dcfa35b3 48 AliAODRecoDecayHF2Prong(vtx2, px, py, pz, d0, d0err, dca)
05d80dd6 49{
50 //
51 // Constructor with AliAODVertex for decay vertex
52 //
53 SetCharge(charge);
54}
55//-----------------------------------------------------------------------------
56AliAODRecoCascadeHF::AliAODRecoCascadeHF(AliAODVertex *vtx2, Short_t charge,
57 Double_t *d0, Double_t *d0err, Double_t dca) :
dcfa35b3 58 AliAODRecoDecayHF2Prong(vtx2, d0, d0err, dca)
05d80dd6 59{
60 //
61 // Constructor with decay vertex and without prongs momenta
62 //
63 SetCharge(charge);
64}
65//-----------------------------------------------------------------------------
66AliAODRecoCascadeHF::AliAODRecoCascadeHF(const AliAODRecoCascadeHF &source) :
dcfa35b3 67 AliAODRecoDecayHF2Prong(source)
05d80dd6 68{
69 //
70 // Copy constructor
71 //
72}
73//-----------------------------------------------------------------------------
74AliAODRecoCascadeHF &AliAODRecoCascadeHF::operator=(const AliAODRecoCascadeHF &source)
75{
76 //
77 // assignment operator
78 //
79 if(&source == this) return *this;
80
81 AliAODRecoDecayHF2Prong::operator=(source);
82
05d80dd6 83 return *this;
84}
85//-----------------------------------------------------------------------------
86AliAODRecoCascadeHF::~AliAODRecoCascadeHF()
87{
88 //
89 // Default Destructor
90 //
91}
92//-----------------------------------------------------------------------------
93Double_t AliAODRecoCascadeHF::InvMassDstarKpipi() const
94{
95 //
96 // 3 prong invariant mass of the D0 daughters and the soft pion
97 //
78489ccc 98 Double_t e[3];
99 if (Charge()>0){
100 e[0]=Get2Prong()->EProng(0,211);
101 e[1]=Get2Prong()->EProng(1,321);
102 }else{
103 e[0]=Get2Prong()->EProng(0,321);
104 e[1]=Get2Prong()->EProng(1,211);
105 }
106 e[2]=EProng(0,211);
05d80dd6 107
78489ccc 108 Double_t esum = e[0]+e[1]+e[2];
109 Double_t minv = TMath::Sqrt(esum*esum-P()*P());
05d80dd6 110
78489ccc 111 return minv;
05d80dd6 112}
b3999999 113//----------------------------------------------------------------------------
114Int_t AliAODRecoCascadeHF::MatchToMC(Int_t pdgabs,Int_t pdgabs2prong,
383937f0 115 Int_t *pdgDg,Int_t *pdgDg2prong,
36462b08 116 TClonesArray *mcArray, Bool_t isV0) const
b3999999 117{
118 //
119 // Check if this candidate is matched to a MC signal
120 // If no, return -1
121 // If yes, return label (>=0) of the AliAODMCParticle
122 //
123
8862e6bf 124 Int_t ndg=GetNDaughters();
125 if(!ndg) {
b3999999 126 AliError("No daughters available");
127 return -1;
128 }
e7af8919 129
85036182 130 if ( isV0 &&
131 ( (pdgDg[1]==2212 && pdgDg[0]==310) ||
132 (pdgDg[1]==211 && pdgDg[0]==3122) ) ) {
133 AliWarning("Please, pay attention: first element in AliAODRecoCascadeHF object must be the bachelor and second one V0. Skipping!");
134 return -1;
135 }
136
36462b08 137 Int_t lab2Prong = -1;
138
139 if (!isV0) {
140 AliAODRecoDecayHF2Prong *the2Prong = Get2Prong();
141 lab2Prong = the2Prong->MatchToMC(pdgabs2prong,mcArray,2,pdgDg2prong);
142 } else {
ff12b981 143 AliAODv0 *theV0 = dynamic_cast<AliAODv0*>(Getv0());
36462b08 144 lab2Prong = theV0->MatchToMC(pdgabs2prong,mcArray,2,pdgDg2prong);
145 }
b3999999 146
147 if(lab2Prong<0) return -1;
148
e11ae259 149 Int_t dgLabels[10]={0,0,0,0,0,0,0,0,0,0};
b3999999 150
151 // loop on daughters and write labels
8862e6bf 152 for(Int_t i=0; i<ndg; i++) {
ff12b981 153 AliVTrack *trk = dynamic_cast<AliVTrack*>(GetDaughter(i));
4184976e 154 if(!trk) continue;
b3999999 155 Int_t lab = trk->GetLabel();
156 if(lab==-1) { // this daughter is the 2prong
157 lab=lab2Prong;
8cb66396 158 } else if(lab<-1) continue;
b3999999 159 dgLabels[i] = lab;
160 }
161
e7af8919 162 Int_t finalLabel = AliAODRecoDecay::MatchToMC(pdgabs,mcArray,dgLabels,2,2,pdgDg);
9ff3fa8f 163
164 if (finalLabel>=0){
165 // debug printouts for Lc->V0 bachelor case
166
167 if ( isV0 && (dgLabels[0]!=-1 && dgLabels[1]!=-1) ) {
ff12b981 168 AliAODv0 *theV0 = dynamic_cast<AliAODv0*>(Getv0());
9ff3fa8f 169 Bool_t onTheFly = theV0->GetOnFlyStatus();
9ff3fa8f 170 if (pdgDg[0]==2212 && pdgDg[1]==310) {
ff12b981 171 AliAODMCParticle*k0s = dynamic_cast<AliAODMCParticle*>(mcArray->At(lab2Prong));
4184976e 172 if(k0s){
173 Int_t labK0 = k0s->GetMother();
174 AliAODMCParticle*k0bar = dynamic_cast<AliAODMCParticle*>(mcArray->At(labK0));
175 if(k0bar){
176 AliDebug(1,Form(" (onTheFly=%1d) LabelV0=%d (%d) -> LabelK0S=%d (%d -> %d %d)",onTheFly,labK0,k0bar->GetPdgCode(),lab2Prong,pdgabs2prong,pdgDg2prong[0],pdgDg2prong[1]));
177 AliDebug(1,Form(" LabelLc=%d (%d) -> LabelBachelor=%d (%d) LabelV0=%d (%d)",
178 finalLabel,pdgabs,
179 dgLabels[0],pdgDg[0],dgLabels[1],pdgDg[1]));
180 }
181 }
9ff3fa8f 182 } else if (pdgDg[0]==211 && pdgDg[1]==3122) {
183 AliDebug(1,Form(" (onTheFly=%1d) LabelV0=%d (%d -> %d %d)",onTheFly,lab2Prong,pdgabs2prong,pdgDg2prong[0],pdgDg2prong[1]));
184 AliDebug(1,Form(" LabelLc=%d (%d) -> LabelBachelor=%d (%d) LabelV0=%d (%d)",
185 finalLabel,pdgabs,
e7af8919 186 dgLabels[0],pdgDg[0],dgLabels[1],pdgDg[1]));
9ff3fa8f 187 }
188
e7af8919 189 }
190 }
191
192 return finalLabel;
193
b3999999 194}
05d80dd6 195//-----------------------------------------------------------------------------
196Bool_t AliAODRecoCascadeHF::SelectDstar(const Double_t *cutsDstar,
197 const Double_t *cutsD0,
198 Bool_t testD0) const
199{
200 //
201 // cutsDstar[0] = inv. mass half width of D* [GeV]
202 // cutsDstar[1] = half width of (M_Kpipi-M_D0) [GeV]
203 // cutsDstar[2] = PtMin of pi_s [GeV/c]
204 // cutsDstar[3] = PtMax of pi_s [GeV/c]
205 // cutsDstar[4] = theta, angle between the pi_s and decay plane of the D0 [rad]
206 //
207 // cutsD0[0] = inv. mass half width [GeV]
208 // cutsD0[1] = dca [cm]
209 // cutsD0[2] = cosThetaStar
210 // cutsD0[3] = pTK [GeV/c]
211 // cutsD0[4] = pTPi [GeV/c]
212 // cutsD0[5] = d0K [cm] upper limit!
213 // cutsD0[6] = d0Pi [cm] upper limit!
214 // cutsD0[7] = d0d0 [cm^2]
215 // cutsD0[8] = cosThetaPoint
216
217
218 // check that the D0 passes the cuts
219 // (if we have a D*+, it has to pass as D0,
220 // if we have a D*-, it has to pass as D0bar)
221
222 if(testD0) {
223 Int_t okD0=0,okD0bar=0;
224 Get2Prong()->SelectD0(cutsD0,okD0,okD0bar);
225 if((Charge()==+1 && !okD0) || (Charge()==-1 && !okD0bar)) return kFALSE;
226 }
227
228 if( (PtProng(0)<cutsDstar[2]) || (PtProng(0)>cutsDstar[3]) ) return kFALSE;
229
230 Double_t mDstar = TDatabasePDG::Instance()->GetParticle(413)->Mass();
231 Double_t invmDstar = InvMassDstarKpipi();
232 if(TMath::Abs(mDstar-invmDstar)>cutsDstar[0]) return kFALSE;
233
234 Double_t mD0 = TDatabasePDG::Instance()->GetParticle(421)->Mass();
235 if(TMath::Abs((mDstar-mD0)-DeltaInvMass())>cutsDstar[1]) return kFALSE;
236
3f6adfc9 237 Double_t theta = AngleD0dkpPisoft();
05d80dd6 238 if(theta>cutsDstar[4]) return kFALSE;
05d80dd6 239
240 return kTRUE;
241}
a07ad8e0 242//-----------------------------------------------------------------------------
243Bool_t AliAODRecoCascadeHF::SelectLctoV0(const Double_t *cutsLctoV0,
9ff3fa8f 244 Bool_t okLck0sp, Bool_t okLcLpi, Bool_t okLcLbarpi) const
a07ad8e0 245{
246 // cuts on Lambdac candidates to V0+bachelor
247 // (to be passed to AliAODRecoDecayHF3Prong::SelectLctoV0())
248 // 0 = inv. mass half width in K0s hypothesis [GeV]
249 // 1 = inv. mass half width in Lambda hypothesis [GeV]
250 // 2 = inv. mass V0 in K0s hypothesis half width [GeV]
251 // 3 = inv. mass V0 in Lambda hypothesis half width [GeV]
252 // 4 = pT min Bachelor track [GeV/c]
253 // 5 = pT min V0-Positive track [GeV/c]
254 // 6 = pT min V0-Negative track [GeV/c]
9ff3fa8f 255 // 7 = dca cut on the cascade (cm)
256 // 8 = dca cut on the V0 (cm)
a07ad8e0 257
9ff3fa8f 258 // if ( !Getv0() || !Getv0PositiveTrack() || !Getv0NegativeTrack() )
259 // { AliInfo(Form("Not adapted for ESDv0s, return true...")); return false; }
a07ad8e0 260
261 Double_t mLck0sp,mLcLpi;
9ff3fa8f 262 okLck0sp=1; okLcLpi=1; okLcLbarpi=1;
a07ad8e0 263
264 Double_t mLcPDG = TDatabasePDG::Instance()->GetParticle(4122)->Mass();
265 Double_t mk0sPDG = TDatabasePDG::Instance()->GetParticle(310)->Mass();
266 Double_t mLPDG = TDatabasePDG::Instance()->GetParticle(3122)->Mass();
267
268 // k0s + p
269 double mk0s = Getv0()->MassK0Short();
270 mLck0sp = InvMassLctoK0sP();
271
272 // lambda + pi
273 double mlambda = Getv0()->MassLambda();
274 double malambda = Getv0()->MassAntiLambda();
275 mLcLpi = InvMassLctoLambdaPi();
276
277 // cut on Lc mass
278 // with k0s p hypothesis
279 if(TMath::Abs(mLck0sp-mLcPDG)>cutsLctoV0[0]) okLck0sp = 0;
280 // with Lambda pi hypothesis
281 if(TMath::Abs(mLcLpi-mLcPDG)>cutsLctoV0[1]) okLcLpi = 0;
9ff3fa8f 282 okLcLbarpi = okLcLpi;
283
a07ad8e0 284 // cuts on the v0 mass
9ff3fa8f 285 if( TMath::Abs(mk0s-mk0sPDG)>cutsLctoV0[2]) okLck0sp = 0;
286 //if( TMath::Abs(mlambda-mLPDG)>cutsLctoV0[3] &&
287 //TMath::Abs(malambda-mLPDG)>cutsLctoV0[3] ) okLcLpi = 0;
288 if( !(GetBachelor()->Charge()==+1 && TMath::Abs(mlambda-mLPDG)<=cutsLctoV0[3]) ) okLcLpi = 0;
289 if( !(GetBachelor()->Charge()==-1 && TMath::Abs(malambda-mLPDG)<=cutsLctoV0[3]) ) okLcLbarpi = 0;
a07ad8e0 290
9ff3fa8f 291 if(!okLck0sp && !okLcLpi && !okLcLbarpi) return 0;
a07ad8e0 292
293 // cuts on the minimum pt of the tracks
294 if(TMath::Abs(GetBachelor()->Pt()) < cutsLctoV0[4]) return 0;
295 if(TMath::Abs(Getv0PositiveTrack()->Pt()) < cutsLctoV0[5]) return 0;
296 if(TMath::Abs(Getv0NegativeTrack()->Pt()) < cutsLctoV0[6]) return 0;
297
a07ad8e0 298 // cut on the cascade dca
9ff3fa8f 299 if( TMath::Abs(GetDCA(0))>cutsLctoV0[7] //||
300 //TMath::Abs(Getv0()->DcaPosToPrimVertex())>cutsLctoV0[7] ||
301 //TMath::Abs(Getv0()->DcaNegToPrimVertex())>cutsLctoV0[7]
302 ) return 0;
303
304 // cut on the v0 dca
305 if(TMath::Abs(Getv0()->DcaV0Daughters()) > cutsLctoV0[8]) return 0;
306
307 // cut on V0 cosine of pointing angle wrt PV
308 if (CosV0PointingAngle() < cutsLctoV0[9]) { // cosine of V0 pointing angle wrt primary vertex
309 AliDebug(4,Form(" V0 cosine of pointing angle doesn't pass the cut"));
310 return 0;
311 }
312
313 // cut on bachelor transverse impact parameter wrt PV
314 if (TMath::Abs(Getd0Prong(0)) > cutsLctoV0[10]) { // bachelor transverse impact parameter wrt PV
315 AliDebug(4,Form(" bachelor transverse impact parameter doesn't pass the cut"));
316 return 0;
317 }
318
319 // cut on V0 transverse impact parameter wrt PV
320 if (TMath::Abs(Getd0Prong(1)) > cutsLctoV0[11]) { // V0 transverse impact parameter wrt PV
321 AliDebug(4,Form(" V0 transverse impact parameter doesn't pass the cut"));
322 return 0;
323 }
324
325 // cut on K0S invariant mass veto
326 if (TMath::Abs(Getv0()->MassK0Short()-mk0sPDG) < cutsLctoV0[12]) { // K0S invariant mass veto
327 AliDebug(4,Form(" veto on K0S invariant mass doesn't pass the cut"));
328 return 0;
329 }
330
331 // cut on Lambda/LambdaBar invariant mass veto
332 if (TMath::Abs(Getv0()->MassLambda()-mLPDG) < cutsLctoV0[13] ||
333 TMath::Abs(Getv0()->MassAntiLambda()-mLPDG) < cutsLctoV0[13] ) { // Lambda/LambdaBar invariant mass veto
334 AliDebug(4,Form(" veto on K0S invariant mass doesn't pass the cut"));
335 return 0;
336 }
337
338 // cut on gamma invariant mass veto
339 if (Getv0()->InvMass2Prongs(0,1,11,11) < cutsLctoV0[14]) { // K0S invariant mass veto
340 AliDebug(4,Form(" veto on gamma invariant mass doesn't pass the cut"));
341 return 0;
342 }
343
344 // cut on V0 pT min
345 if (Getv0()->Pt() < cutsLctoV0[15]) { // V0 pT min
346 AliDebug(4,Form(" V0 track Pt=%2.2e > %2.2e",Getv0()->Pt(),cutsLctoV0[15]));
347 return 0;
348 }
a07ad8e0 349
350 return true;
351
352}
353//-----------------------------------------------------------------------------
3f6adfc9 354Double_t AliAODRecoCascadeHF::AngleD0dkpPisoft() const {
355 //
356 // Angle of soft pion to D0 decay plane
357 //
358
359 TVector3 p3Trk0(Get2Prong()->PxProng(0),Get2Prong()->PyProng(0),Get2Prong()->PzProng(0)); // from D0
360 TVector3 p3Trk1(Get2Prong()->PxProng(1),Get2Prong()->PyProng(1),Get2Prong()->PzProng(1)); // from D0
361 TVector3 p3Trk2(PxProng(0),PyProng(0),PzProng(0)); // pi_s
362
363 TVector3 perp = p3Trk0.Cross(p3Trk1);
364 Double_t theta = p3Trk2.Angle(perp);
365 if(theta>(TMath::Pi()-theta)) theta = TMath::Pi() - theta;
366 theta = TMath::Pi()/2. - theta;
367
368 return theta;
369}
ccfae9f3 370//-----------------------------------------------------------------------------
371Bool_t AliAODRecoCascadeHF::TrigonometricalCut() const {
372 //
373 // Trigonometrical constraint
374 //
375 TVector3 p3Trk0(Get2Prong()->PxProng(0),Get2Prong()->PyProng(0),Get2Prong()->PzProng(0)); // from D0
376 TVector3 p3Trk1(Get2Prong()->PxProng(1),Get2Prong()->PyProng(1),Get2Prong()->PzProng(1)); // from D0
377 TVector3 p3Trk2(PxProng(0),PyProng(0),PzProng(0)); // pi_s
378
379 Double_t alpha = p3Trk0.Angle(p3Trk2);
380 Double_t beta = p3Trk1.Angle(p3Trk2);
381
382 Double_t cosphi01 = TMath::Cos(alpha) / TMath::Cos(AngleD0dkpPisoft());
383 Double_t cosphi02 = TMath::Cos(beta) / TMath::Cos(AngleD0dkpPisoft());
384
385 Double_t phi01 = TMath::ACos(cosphi01);
386 Double_t phi02 = TMath::ACos(cosphi02);
387 Double_t phi00 = p3Trk0.Angle(p3Trk1);
388
389 if((phi01>phi00) || (phi02>phi00)) return kFALSE;
390 return kTRUE;
391}
8cb66396 392
c9283e92 393//-----------------------------------------------------------------------------
394Double_t AliAODRecoCascadeHF::DecayLengthV0() const
395{
396 //
397 // Returns V0 decay length wrt primary vertex
398 //
399
400 AliAODv0 *v0 = (AliAODv0*)Getv0();
401
402 if (!v0)
403 return -1.;
404 AliAODVertex *vtxPrimary = GetPrimaryVtx();
405 Double_t posVtx[3] = {0.,0.,0.};
406 vtxPrimary->GetXYZ(posVtx);
407 return v0->DecayLengthV0(posVtx);
408
409}
9ff3fa8f 410//-----------------------------------------------------------------------------
411Double_t AliAODRecoCascadeHF::DecayLengthXYV0() const
412{
413 //
414 // Returns transverse V0 decay length wrt primary vertex
415 //
416 AliAODv0 *v0 = (AliAODv0*)Getv0();
417
418 if (!v0)
419 return -1.;
420 AliAODVertex *vtxPrimary = GetPrimaryVtx();
421 Double_t posVtx[3] = {0.,0.,0.};
422 vtxPrimary->GetXYZ(posVtx);
423 return v0->DecayLengthXY(posVtx);
424
425}
426//-----------------------------------------------------------------------------
427Double_t AliAODRecoCascadeHF::CosV0PointingAngle() const
428{
429 //
430 // Returns cosine of V0 pointing angle wrt primary vertex
431 //
432
433 AliAODv0 *v0 = (AliAODv0*)Getv0();
434
435 if (!v0)
436 return -999.;
437
438 AliAODVertex *vtxPrimary = GetPrimaryVtx();
439 Double_t posVtx[3] = {0.,0.,0.};
440 vtxPrimary->GetXYZ(posVtx);
441 return v0->CosPointingAngle(posVtx);
442
443}
ff12b981 444//-----------------------------------------------------------------------------
445Double_t AliAODRecoCascadeHF::CosV0PointingAngleXY() const
446{
447 //
448 // Returns XY cosine of V0 pointing angle wrt primary vertex
449 //
450
451 AliAODv0 *v0 = (AliAODv0*)Getv0();
452
453 if (!v0)
454 return -999.;
455
456 AliAODVertex *vtxPrimary = GetPrimaryVtx();
457 Double_t posVtx[3] = {0.,0.,0.};
458 vtxPrimary->GetXYZ(posVtx);
459 return v0->CosPointingAngleXY(posVtx);
460
461}
462//-----------------------------------------------------------------------------
463Double_t AliAODRecoCascadeHF::NormalizedV0DecayLength() const
464{
465 //
466 // Returns V0 normalized decay length wrt primary vertex
467 //
468
469 AliAODv0 *v0 = (AliAODv0*)Getv0();
470
471 if (!v0)
472 return -1.;
473 //AliAODVertex *vtxPrimary = GetPrimaryVtx();
474 //Double_t posVtx[3] = {0.,0.,0.};
475 //vtxPrimary->GetXYZ(posVtx);
476 //return v0->NormalizedDecayLength(posVtx);
477 return v0->NormalizedDecayLength(GetPrimaryVtx());
478
479}
480//-----------------------------------------------------------------------------
481Double_t AliAODRecoCascadeHF::NormalizedV0DecayLengthXY() const
482{
483 //
484 // Returns transverse V0 normalized decay length wrt primary vertex
485 //
486 AliAODv0 *v0 = (AliAODv0*)Getv0();
487
488 if (!v0)
489 return -1.;
490 //AliAODVertex *vtxPrimary = GetPrimaryVtx();
491 //Double_t posVtx[3] = {0.,0.,0.};
492 //vtxPrimary->GetXYZ(posVtx);
493 //return v0->NormalizedDecayLengthXY(posVtx);
494 return v0->NormalizedDecayLengthXY(GetPrimaryVtx());
495
496}