AliPhysics  5a28df1 (5a28df1)
AliCFVertexingHFLctoV0bachelor.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-2011, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: The ALICE Off-line Project. *
5  * Contributors are mentioned in the code where appropriate. *
6  * *
7  * Permission to use, copy, modify and distribute this software and its *
8  * documentation strictly for non-commercial purposes is hereby granted *
9  * without fee, provided that the above copyright notice appears in all *
10  * copies and that both the copyright notice and this permission notice *
11  * appear in the supporting documentation. The authors make no claims *
12  * about the suitability of this software for any purpose. It is *
13  * provided "as is" without express or implied warranty. *
14  **************************************************************************/
15 
16 /* $Id$ */
17 
18 //-----------------------------------------------------------------------
19 // Class for HF corrections as a function of many variables and steps
20 // For Lc->V0+bachelor
21 //
22 // - Based on AliCFVertexingHFCascade -
23 //
24 // Contact : A.De Caro - decaro@sa.infn.it
25 // Centro 'E.Fermi' - Rome (Italy)
26 // INFN and University of Salerno (Italy)
27 //
28 //-----------------------------------------------------------------------
29 
30 #include "TDatabasePDG.h"
31 #include "TClonesArray.h"
32 #include "AliAODv0.h"
33 #include "AliAODMCParticle.h"
34 #include "AliAODRecoDecayHF.h"
35 #include "AliAODRecoCascadeHF.h"
36 #include "AliCFTaskVertexingHF.h"
37 #include "AliCFContainer.h"
38 #include "AliCFVertexingHF.h"
40 
41 #include <Riostream.h>
42 
43 using std::cout;
44 using std::endl;
45 
49 
50 //_________________________________________
52 fGenLcOption(0)
53 {
54  // standard constructor
55 }
56 
57 //_____________________________________
58 AliCFVertexingHFLctoV0bachelor::AliCFVertexingHFLctoV0bachelor(TClonesArray *mcArray, UShort_t originDselection, Int_t lcDecay):
59 AliCFVertexingHF(mcArray, originDselection),
60  fGenLcOption(lcDecay)
61 {
62  // standard constructor
63 
64  SetNProngs(3);
67  for(Int_t iP=0; iP<fProngs; iP++){
68  fPtAccCut[iP]=0.1;
69  fEtaAccCut[iP]=0.9;
70  }
71 
72 }
73 
74 
75 //_____________________________________
77 {
78  // operator =
79 
80  if (this != &c) {
82  }
83 
84  return *this;
85 
86 }
87 
88 //__________________________________________
90 {
91  // set the AliAODRecoDecay candidate
92 
93  Bool_t bSignAssoc = kFALSE;
94 
95  fRecoCandidate = recoCand;
96  if (!fRecoCandidate) {
97  AliError("fRecoCandidate not found, problem in assignement\n");
98  return bSignAssoc;
99  }
100 
101  if (fRecoCandidate->GetPrimaryVtx()) AliDebug(4,"fReco Candidate has a pointer to PrimVtx\n");
102 
103  AliAODRecoCascadeHF* lcV0bachelor = dynamic_cast<AliAODRecoCascadeHF*>(fRecoCandidate);
104  if (!lcV0bachelor) {
105  AliDebug(2,"cascade doesn't exist, skipped!");
106  return bSignAssoc;
107  }
108 
109  if (!lcV0bachelor->GetSecondaryVtx()) {
110  AliDebug(2,"No secondary vertex for cascade");
111  return bSignAssoc;
112  }
113 
114  if (lcV0bachelor->GetNDaughters()!=2) {
115  AliDebug(2,Form("No 2 daughters for current cascade (nDaughters=%d)",lcV0bachelor->GetNDaughters()));
116  return bSignAssoc;
117  }
118 
119  AliVTrack *cascTrk0 = dynamic_cast<AliVTrack*>(lcV0bachelor->GetDaughter(0));
120  AliVTrack *cascTrk1 = dynamic_cast<AliVTrack*>(lcV0bachelor->GetDaughter(1));
121  if (!cascTrk0 || !cascTrk1) {
122  AliDebug(2,"At least one of V0daughters doesn't exist");
123  return bSignAssoc;
124  }
125 
126  AliAODv0 * v0part = dynamic_cast<AliAODv0*>(lcV0bachelor->Getv0());
127  AliAODTrack * bachPart = dynamic_cast<AliAODTrack*>(lcV0bachelor->GetBachelor());
128  if (!v0part || !bachPart) {
129  AliDebug(2,"No V0 or no bachelor for current cascade");
130  return bSignAssoc;
131  }
132 
133  if (bachPart->GetID()<0) {
134  AliDebug(2,Form("Bachelor has negative ID %d",bachPart->GetID()));
135  return bSignAssoc;
136  }
137 
138  if (!v0part->GetSecondaryVtx()) {
139  AliDebug(2,"No secondary vertex for V0 by cascade");
140  return bSignAssoc;
141  }
142 
143  if (v0part->GetNDaughters()!=2) {
144  AliDebug(2,Form("No 2 daughters for V0 of current cascade (onTheFly=%d, nDaughters=%d)",v0part->GetOnFlyStatus(),v0part->GetNDaughters()));
145  return bSignAssoc;
146  }
147 
148  AliVTrack *trk0 = dynamic_cast<AliVTrack*>(v0part->GetDaughter(0));
149  AliVTrack *trk1 = dynamic_cast<AliVTrack*>(v0part->GetDaughter(1));
150  if (!trk0 || !trk1) {
151  AliDebug(2,"At least one of V0daughters doesn't exist");
152  return bSignAssoc;
153  }
154 
155  //if (trk0->GetLabel()<0 || trk1->GetLabel()<0) {
156  //AliDebug(2,Form("At least one of V0daughters has label negative (%d %d)",trk0->GetLabel(),trk1->GetLabel()));
157  //return bSignAssoc;
158  //}
159 
160  if (trk0->GetID()<0 || trk1->GetID()<0) {
161  AliDebug(2,Form("At least one of V0 daughters has negative ID %d %d",trk0->GetID(),trk1->GetID()));
162  return bSignAssoc;
163  }
164 
165  Int_t pdgCand = 4122;
166  Int_t mcLabel = -1;
167  Int_t mcLabelK0S = -1;
168  Int_t mcLabelLambda = -1;
169 
170  // Lc->K0S+p and cc
171  Int_t pdgDgLctoV0bachelor[2]={2212,310}; // first bachelor, second V0
172  Int_t pdgDgV0toDaughters[2]={211,211};
173  mcLabelK0S = lcV0bachelor->MatchToMC(pdgCand,pdgDgLctoV0bachelor[1],pdgDgLctoV0bachelor,pdgDgV0toDaughters,fmcArray,kTRUE);
174 
175  // Lc->Lambda+pi and cc
176  pdgDgLctoV0bachelor[0]=211, pdgDgLctoV0bachelor[1]=3122; // first bachelor, second V0
177  pdgDgV0toDaughters[0]=2212, pdgDgV0toDaughters[1]=211;
178  mcLabelLambda = lcV0bachelor->MatchToMC(pdgCand,pdgDgLctoV0bachelor[1],pdgDgLctoV0bachelor,pdgDgV0toDaughters,fmcArray,kTRUE);
179 
180  if (mcLabelK0S!=-1 && mcLabelLambda!=-1)
181  AliDebug(2,"Strange: current Lc->V0+bachelor candidate has two MC different labels!");
182 
183  if (fGenLcOption==kCountK0Sp) {
184  if (mcLabelK0S!=-1) mcLabel=mcLabelK0S;
185  if (mcLabelLambda!=-1) {
186  mcLabel=-1;
187  fFake = 0; // fake candidate
188  if (fFakeSelection==1) return bSignAssoc;
189  }
190  }
191  else if (fGenLcOption==kCountLambdapi) {
192  if (mcLabelLambda!=-1) mcLabel=mcLabelLambda;
193  if (mcLabelK0S!=-1) {
194  mcLabel=-1;
195  fFake = 0; // fake candidate
196  if (fFakeSelection==1) return bSignAssoc;
197  }
198  }
199 
200  if (mcLabel==-1) {
201  AliDebug(4,"No mcLabel found for current candidate");
202  return bSignAssoc;
203  }
204  AliDebug(1,Form("Found mcLabel (%d) for current candidate (onTheFly=%1d)",mcLabel,v0part->GetOnFlyStatus()));
205 
207  fFake = 0; // fake candidate
208  if (fFakeSelection==1) return bSignAssoc;
209  }
211  fFake = 2; // non-fake candidate
212  if (fFakeSelection==2) return bSignAssoc;
213  }
214 
215  SetMCLabel(mcLabel); // fmcLabel=mcLabel
216  fmcPartCandidate = dynamic_cast<AliAODMCParticle*>(fmcArray->At(fmcLabel));
217  if (!fmcPartCandidate){
218  AliDebug(3,"No MC object for current candidate");
219  return bSignAssoc;
220  }
221 
222  bSignAssoc = kTRUE;
223  return bSignAssoc;
224 
225 }
226 
227 //______________________________________________
229 {
230  //
231  // collecting all the necessary info (pt, y, invMassV0, cosPAwrtPVxV0, onTheFlyStatusV0) from MC particle
232  // (additional infos: pTbachelor, pTV0pos, pTV0neg, phi, dcaV0, cTV0, cT, cosPA)
233  //
234 
235  Bool_t bGenValues = kFALSE;
236 
237  if (fmcPartCandidate->GetNDaughters()!=2) {
238  AliDebug(2,"Lc MC particle doesn't decay in 2 daughters");
239  return bGenValues;
240  }
241 
242  Int_t daughter0lc = fmcPartCandidate->GetDaughter(0);
243  Int_t daughter1lc = fmcPartCandidate->GetDaughter(1);
244  if (daughter0lc<=0 || daughter1lc<=0) {
245  AliDebug(2,"Lc daughters are not in MC array");
246  return bGenValues;
247  }
248 
249  AliAODMCParticle* mcPartDaughter0 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter0lc));
250  AliAODMCParticle* mcPartDaughter1 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter1lc));
251  if (!mcPartDaughter0 || !mcPartDaughter1) {
252  AliDebug(2,"Problems in the MC Daughters\n");
253  return bGenValues;
254  }
255 
257  !(TMath::Abs(mcPartDaughter0->GetPdgCode())==3122 &&
258  TMath::Abs(mcPartDaughter1->GetPdgCode())==211) &&
259  !(TMath::Abs(mcPartDaughter1->GetPdgCode())==3122 &&
260  TMath::Abs(mcPartDaughter0->GetPdgCode())==211) ) return bGenValues;
261  if ( fGenLcOption==kCountK0Sp &&
262  !(TMath::Abs(mcPartDaughter0->GetPdgCode())==2212 &&
263  TMath::Abs(mcPartDaughter1->GetPdgCode())==311) &&
264  !(TMath::Abs(mcPartDaughter1->GetPdgCode())==2212 &&
265  TMath::Abs(mcPartDaughter0->GetPdgCode())==311) ) return bGenValues;
266 
267  if ( (TMath::Abs(mcPartDaughter0->GetPdgCode())==311 &&
268  TMath::Abs(mcPartDaughter1->GetPdgCode())==2212) ||
269  (TMath::Abs(mcPartDaughter0->GetPdgCode())==3122 &&
270  TMath::Abs(mcPartDaughter1->GetPdgCode())==211) )
271  bGenValues = FillVectorFromMCarray(mcPartDaughter1,mcPartDaughter0,vectorMC);
272  else if ( (TMath::Abs(mcPartDaughter1->GetPdgCode())==311 &&
273  TMath::Abs(mcPartDaughter0->GetPdgCode())==2212) ||
274  (TMath::Abs(mcPartDaughter1->GetPdgCode())==3122 &&
275  TMath::Abs(mcPartDaughter0->GetPdgCode())==211) )
276  bGenValues = FillVectorFromMCarray(mcPartDaughter0,mcPartDaughter1,vectorMC);
277 
278  if (!bGenValues)
279  AliDebug(2,"There is something wrong in filling MC vector");
280 
281  return bGenValues;
282 
283 }
284 
285 //____________________________________________
287 {
288  // read the variables for the container
289 
290  Bool_t bFillRecoValues = kFALSE;
291 
292  //Get the Lc and the V0 from Lc
293  AliAODRecoCascadeHF* lcV0bachelor = dynamic_cast<AliAODRecoCascadeHF*>(fRecoCandidate);
294 
295  if (!lcV0bachelor) {
296  AliDebug(2,"Current cascade doesn't exist, skipped");
297  return bFillRecoValues;
298  }
299 
300  if (!lcV0bachelor->GetSecondaryVtx()) {
301  AliDebug(2,"No secondary vertex for cascade");
302  return bFillRecoValues;
303  }
304 
305  if (lcV0bachelor->GetNDaughters()!=2) {
306  AliDebug(2,Form("No 2 daughters for current cascade (nDaughters=%d)",lcV0bachelor->GetNDaughters()));
307  return bFillRecoValues;
308  }
309 
310  AliAODTrack* bachelor = dynamic_cast<AliAODTrack*>(lcV0bachelor->GetBachelor());
311  AliAODv0* v0toDaughters = dynamic_cast<AliAODv0*>(lcV0bachelor->Getv0());
312  if (!bachelor || !v0toDaughters) {
313  AliDebug(2,"No V0 or bachelor in this reco candidate, skipping!");
314  return bFillRecoValues;
315  }
316 
317  if (!v0toDaughters->GetSecondaryVtx()) {
318  AliDebug(2,"No secondary vertex for V0 by cascade");
319  return bFillRecoValues;
320  }
321 
322  if (v0toDaughters->GetNDaughters()!=2) {
323  AliDebug(2,Form("current V0 has not 2 daughters (onTheFly=%d, nDaughters=%d)",v0toDaughters->GetOnFlyStatus(),v0toDaughters->GetNDaughters()));
324  return bFillRecoValues;
325  }
326 
327  Bool_t onTheFlyStatus = v0toDaughters->GetOnFlyStatus();
328  AliAODTrack* v0positiveTrack;
329  AliAODTrack* v0negativeTrack;
330  if (onTheFlyStatus) {
331  v0positiveTrack = dynamic_cast<AliAODTrack*>(lcV0bachelor->Getv0NegativeTrack());
332  v0negativeTrack = dynamic_cast<AliAODTrack*>(lcV0bachelor->Getv0PositiveTrack());
333  } else {
334  v0positiveTrack = dynamic_cast<AliAODTrack*>(lcV0bachelor->Getv0PositiveTrack());
335  v0negativeTrack = dynamic_cast<AliAODTrack*>(lcV0bachelor->Getv0NegativeTrack());
336  }
337 
338  if (!v0positiveTrack || !v0negativeTrack) {
339  AliDebug(2,"No V0daughters in this reco candidate, skipping!");
340  return bFillRecoValues;
341  }
342 
343  Double_t pt = lcV0bachelor->Pt();
344  Double_t rapidity = lcV0bachelor->Y(4122);
345 
346  Double_t cosPAwrtPrimVtxV0 = lcV0bachelor->CosV0PointingAngle();
347 
348  //Double_t pTbachelor = bachelor->Pt();
349  Double_t pbachelor = bachelor->P();
350  //Double_t pTV0pos = v0positiveTrack->Pt();
351  //Double_t pTV0neg = v0negativeTrack->Pt();
352  Double_t phi = lcV0bachelor->Phi();
353  Double_t dcaV0 = v0toDaughters->GetDCA();
354  //Double_t cTLc = lcV0bachelor->Ct(4122); // wrt PrimVtx
355  //Double_t dcaLc = lcV0bachelor->GetDCA();
356  Double_t cosPointingAngleLc = lcV0bachelor->CosPointingAngle();
357 
358  /*
359  Double_t cTV0 = 0.;
360  AliAODVertex *vtx0 = (AliAODVertex*)lcV0bachelor->GetPrimaryVtx();
361  if (!vtx0) {
362  AliDebug(2,"Candidate has not primary vtx");
363  } else {
364  Double_t primVtxPos[3] = {0.,0.,0.}; vtx0->GetXYZ(primVtxPos);
365  if (fGenLcOption==kCountK0Sp) {
366  cTV0 = v0toDaughters->Ct(310,primVtxPos);
367  } else if (fGenLcOption==kCountLambdapi) {
368  cTV0 = v0toDaughters->Ct(3122,primVtxPos);
369  }
370  }
371  */
372 
373  Double_t invMassV0 = 0.;
375 
376  Short_t bachelorCharge = bachelor->Charge();
377  if (bachelorCharge==1) {
378  invMassV0 = v0toDaughters->MassLambda();
379  } else if (bachelorCharge==-1) {
380  invMassV0 = v0toDaughters->MassAntiLambda();
381  }
382 
383  } else if (fGenLcOption==kCountK0Sp) {
384 
385  invMassV0 = v0toDaughters->MassK0Short();
386 
387  }
388 
389 
391  vectorReco[0] = pt;
392  vectorReco[1] = rapidity;
393  vectorReco[2] = phi;
394  vectorReco[3] = onTheFlyStatus;
395  vectorReco[4] = fzPrimVertex;
396  vectorReco[5] = fCentValue;
397  vectorReco[6] = fFake; // whether the reconstructed candidate was a fake (fFake = 0) or not (fFake = 2)
398  vectorReco[7] = fMultiplicity;
399  //vectorReco[8] = pTbachelor;
400  vectorReco[8] = pbachelor;
401  vectorReco[9] = v0toDaughters->Pt();
403  vectorReco[10] = v0toDaughters->Y(3122);
404  } else if (fGenLcOption==kCountK0Sp) {
405  vectorReco[10] = v0toDaughters->Y(310);
406  }
407  vectorReco[11] = v0toDaughters->Phi();
408  vectorReco[12] = invMassV0;
409  vectorReco[13] = dcaV0;
410  vectorReco[14] = cosPAwrtPrimVtxV0;
411  vectorReco[15] = cosPointingAngleLc;
412  //vectorReco[16] = cTV0*1.E4; // in micron
413  //vectorReco[17] = cTLc*1.E4; // in micron
414  }
416  vectorReco[0] = pt;
417  vectorReco[1] = rapidity;
418  vectorReco[2] = phi;
419  vectorReco[3] = onTheFlyStatus;
420  vectorReco[4] = fzPrimVertex;
421  vectorReco[5] = fCentValue;
422  vectorReco[6] = fFake; // whether the reconstructed candidate was a fake (fFake = 0) or not (fFake = 2)
423  vectorReco[7] = fMultiplicity;
424  }
426  vectorReco[0] = pt;
427  vectorReco[1] = rapidity;
428  vectorReco[2] = fCentValue;
429  vectorReco[3] = fMultiplicity;
430  }
431 
432  bFillRecoValues = kTRUE;
433 
434  return bFillRecoValues;
435 }
436 
437 //_____________________________________________________________
439 {
440  // check the required decay channel
441 
442  Bool_t checkCD = kFALSE;
443  Double_t sumPxDau=0.;
444  Double_t sumPyDau=0.;
445  Double_t sumPzDau=0.;
446 
447 
448  if (fmcPartCandidate->GetNDaughters()!=2) {
449  AliDebug(2, Form("The MC particle doesn't decay in 2 particles, skipping!!"));
450  return checkCD;
451  }
452 
453  Int_t daughter0 = fmcPartCandidate->GetDaughter(0);
454  Int_t daughter1 = fmcPartCandidate->GetDaughter(1);
455  if (daughter0<=0 || daughter1<=0){
456  AliDebug(2, Form("The MC particle doesn't have correct daughters, skipping!!"));
457  return checkCD;
458  }
459  AliAODMCParticle* mcPartDaughter0 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter0));
460  AliAODMCParticle* mcPartDaughter1 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter1));
461  if (!mcPartDaughter0 || !mcPartDaughter1) {
462  AliDebug(2,"Problems in the MC Daughters\n");
463  return checkCD;
464  }
465 
466  // Lc -> Lambda + pion AND cc
468 
469  if (!(TMath::Abs(mcPartDaughter0->GetPdgCode())==3122 &&
470  TMath::Abs(mcPartDaughter1->GetPdgCode())==211) &&
471  !(TMath::Abs(mcPartDaughter0->GetPdgCode())==211 &&
472  TMath::Abs(mcPartDaughter1->GetPdgCode())==3122)) {
473  AliDebug(2, "The Lc MC doesn't decay in Lambda+pion (or cc), skipping!!");
474  return checkCD;
475  }
476 
477  if (TMath::Abs(mcPartDaughter0->GetPdgCode())==3122) {
478  mcPartDaughter0 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter1)); // the bachelor
479  mcPartDaughter1 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter0)); // the V0
480  }
481  if (!mcPartDaughter0 || !mcPartDaughter1) {
482  AliDebug(2,"Problems in the MC Daughters\n");
483  return checkCD;
484  }
485  // momentum of the bachelor
486  sumPxDau+=mcPartDaughter0->Px();
487  sumPyDau+=mcPartDaughter0->Py();
488  sumPzDau+=mcPartDaughter0->Pz();
489 
490  if (mcPartDaughter1->GetNDaughters()!=2) {
491  AliDebug(2, "The Lambda MC particle doesn't decay in 2 particles, skipping!!");
492  return checkCD;
493  }
494 
495  Int_t daughter1D0 = mcPartDaughter1->GetDaughter(0);
496  Int_t daughter1D1 = mcPartDaughter1->GetDaughter(1);
497  if (daughter1D0<=0 || daughter1D1<=0) {
498  AliDebug(2, Form("The Lambda MC particle doesn't have correct daughters, skipping!!"));
499  return checkCD;
500  }
501 
502  AliAODMCParticle* mcPartDaughter1D0 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter1D0));
503  AliAODMCParticle* mcPartDaughter1D1 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter1D1));
504  if(!mcPartDaughter1D0 || !mcPartDaughter1D1) {
505  AliError("The Lambda daughter particle not found in MC array");
506  return checkCD;
507  }
508 
509  if (!(TMath::Abs(mcPartDaughter1D0->GetPdgCode())==211 &&
510  TMath::Abs(mcPartDaughter1D1->GetPdgCode())==2212) &&
511  !(TMath::Abs(mcPartDaughter1D0->GetPdgCode())==2212 &&
512  TMath::Abs(mcPartDaughter1D1->GetPdgCode())==211)) {
513  AliDebug(2, "The Lambda MC doesn't decay in pi+proton (or cc), skipping!!");
514  return checkCD;
515  }
516 
517  // momentum of the V0 daughters
518  sumPxDau+=mcPartDaughter1D0->Px();
519  sumPyDau+=mcPartDaughter1D0->Py();
520  sumPzDau+=mcPartDaughter1D0->Pz();
521  sumPxDau+=mcPartDaughter1D1->Px();
522  sumPyDau+=mcPartDaughter1D1->Py();
523  sumPzDau+=mcPartDaughter1D1->Pz();
524 
525  } else if (fGenLcOption==kCountK0Sp) { // Lc -> K0bar + proton AND cc
526 
527  if (!(TMath::Abs(mcPartDaughter0->GetPdgCode())==311 &&
528  TMath::Abs(mcPartDaughter1->GetPdgCode())==2212) &&
529  !(TMath::Abs(mcPartDaughter0->GetPdgCode())==2212 &&
530  TMath::Abs(mcPartDaughter1->GetPdgCode())==311)) {
531  AliDebug(2, "The Lc MC doesn't decay in K0+proton (or cc), skipping!!");
532  return checkCD;
533  }
534 
535  if (TMath::Abs(mcPartDaughter0->GetPdgCode())==311) {
536  mcPartDaughter0 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter1)); // the bachelor
537  mcPartDaughter1 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter0)); // the V0
538  }
539  if (!mcPartDaughter0 || !mcPartDaughter1) {
540  AliDebug(2,"Problems in the MC Daughters after swapping V0 and bachelor\n");
541  return checkCD;
542  }
543 
544  // momentum of the bachelor
545  sumPxDau+=mcPartDaughter0->Px();
546  sumPyDau+=mcPartDaughter0->Py();
547  sumPzDau+=mcPartDaughter0->Pz();
548 
549  if (mcPartDaughter1->GetNDaughters()!=1) {
550  AliDebug(2, "The K0/K0bar MC particle doesn't decay in 1 particles, skipping!!");
551  return checkCD;
552  }
553 
554  Int_t daughter = mcPartDaughter1->GetDaughter(0);
555  if (daughter<=0) {
556  AliDebug(2, Form("The K0/K0bar MC particle doesn't have correct daughter, skipping!!"));
557  return checkCD;
558  }
559 
560  AliAODMCParticle* mcPartDaughter = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter));
561  if(!mcPartDaughter){
562  AliError("The K0/K0bar daughter particle not found in MC array");
563  return checkCD;
564  }
565 
566  if (!(TMath::Abs(mcPartDaughter->GetPdgCode())==310)) {
567  AliDebug(2, "The K0/K0bar MC doesn't go in K0S, skipping!!");
568  return checkCD;
569  }
570 
571  if (mcPartDaughter->GetNDaughters()!=2) {
572  AliDebug(2, "The K0S MC doesn't decay in 2 particles, skipping!!");
573  return checkCD;
574  }
575 
576  Int_t daughterD0 = mcPartDaughter->GetDaughter(0);
577  Int_t daughterD1 = mcPartDaughter->GetDaughter(1);
578  if (daughterD0<=0 || daughterD1<=0) {
579  AliDebug(2, Form("The K0S MC particle doesn't have correct daughters, skipping!!"));
580  return checkCD;
581  }
582 
583  AliAODMCParticle* mcPartDaughterD0 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughterD0));
584  AliAODMCParticle* mcPartDaughterD1 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughterD1));
585  if (!mcPartDaughterD0 || !mcPartDaughterD1) {
586  AliError("Daughter particle not found in MC array");
587  return checkCD;
588  }
589 
590  if (! ( TMath::Abs(mcPartDaughterD0->GetPdgCode())==211 &&
591  TMath::Abs(mcPartDaughterD1->GetPdgCode())==211 ) ) {
592  AliDebug(2, "The K0S MC doesn't decay in pi+ pi-, skipping!!");
593  return checkCD;
594  }
595 
596  // momentum of the V0 daughters
597  sumPxDau+=mcPartDaughterD0->Px();
598  sumPyDau+=mcPartDaughterD0->Py();
599  sumPzDau+=mcPartDaughterD0->Pz();
600  sumPxDau+=mcPartDaughterD1->Px();
601  sumPyDau+=mcPartDaughterD1->Py();
602  sumPzDau+=mcPartDaughterD1->Pz();
603 
604  }
605 
606  Double_t pxMother=fmcPartCandidate->Px();
607  Double_t pyMother=fmcPartCandidate->Py();
608  Double_t pzMother=fmcPartCandidate->Pz();
609  if(TMath::Abs(pxMother-sumPxDau)/(TMath::Abs(pxMother)+1.e-13)>0.00001 ||
610  TMath::Abs(pyMother-sumPyDau)/(TMath::Abs(pyMother)+1.e-13)>0.00001 ||
611  TMath::Abs(pzMother-sumPzDau)/(TMath::Abs(pzMother)+1.e-13)>0.00001){
612  AliDebug(2, "Momentum conservation violated, skipping!!");
613  return checkCD;
614  }
615 
616  checkCD = kTRUE;
617  return checkCD;
618 
619 }
620 
621 //_____________________________________________________________
623 {
624  //
625  // getting eta of the prong - overload the mother class method
626  //
627 
628  Double_t etaProng =-9999;
629 
630  if (!fRecoCandidate) {
631  AliDebug(2,"No reco candidate selected");
632  return etaProng;
633  }
634 
636  AliAODTrack* bachelor = (AliAODTrack*)lcV0bachelor->GetBachelor();
637  AliAODTrack* v0Pos = (AliAODTrack*)lcV0bachelor->Getv0PositiveTrack();
638  AliAODTrack* v0Neg = (AliAODTrack*)lcV0bachelor->Getv0NegativeTrack();
639  if (!(lcV0bachelor->Getv0()) || !bachelor || !v0Pos || !v0Neg) {
640  AliDebug(2,"No V0 for this reco candidate selected");
641  return etaProng;
642  }
643 
644  if (iProng==0) etaProng = bachelor->Eta();
645  else if (iProng==1) etaProng = v0Pos->Eta();
646  else if (iProng==2) etaProng = v0Neg->Eta();
647 
648  AliDebug(4,Form("Eta value for prong number %1d = %f",iProng,etaProng));
649 
650  return etaProng;
651 
652 }
653 
654 //_____________________________________________________________
655 
657 {
658  //
659  // getting pt of the prong
660  //
661 
662  Double_t ptProng=-9999.;
663 
664  if (!fRecoCandidate) {
665  AliDebug(2,"No reco candidate selected");
666  return ptProng;
667  }
668 
670  AliAODTrack* bachelor = (AliAODTrack*)lcV0bachelor->GetBachelor();
671  AliAODTrack* v0Pos = (AliAODTrack*)lcV0bachelor->Getv0PositiveTrack();
672  AliAODTrack* v0Neg = (AliAODTrack*)lcV0bachelor->Getv0NegativeTrack();
673  if (!(lcV0bachelor->Getv0()) || !bachelor || !v0Pos || !v0Neg) {
674  AliDebug(2,"No V0 for this reco candidate selected");
675  return ptProng;
676  }
677 
678  if (iProng==0) ptProng = bachelor->Pt();
679  else if (iProng==1) ptProng = v0Pos->Pt();
680  else if (iProng==2) ptProng = v0Neg->Pt();
681 
682  AliDebug(4,Form("Pt value for prong number %1d = %f",iProng,ptProng));
683 
684  return ptProng;
685 
686 }
687 
688 //_____________________________________________________________
689 
690 Double_t AliCFVertexingHFLctoV0bachelor::Ctau(AliAODMCParticle *mcPartCandidate)
691 {
692 
693  Double_t cTau = 999999.;
694 
695  Int_t daughterD0 = mcPartCandidate->GetDaughter(0);
696  Int_t daughterD1 = mcPartCandidate->GetDaughter(1);
697  if (daughterD0<=0 || daughterD1<=0) {
698  AliDebug(2, Form("The Lc MC particle doesn't have correct daughters, skipping!!"));
699  return cTau;
700  }
701 
702  AliAODMCParticle *mcPartDaughter0 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughterD0));
703  AliAODMCParticle *mcPartDaughter1 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughterD1));
704  if (!mcPartDaughter0 || !mcPartDaughter1) {
705  AliDebug(2,"The candidate daughter particles not found in MC array");
706  return cTau;
707  }
708 
709  Double_t vtx1[3] = {0,0,0}; // primary vertex
710  Bool_t hasProdVertex = mcPartCandidate->XvYvZv(vtx1); // cm
711 
712  Double_t vtx1daughter[3] = {0,0,0}; // secondary vertex
713  Bool_t v0Vertex = mcPartDaughter0->XvYvZv(vtx1daughter); //cm
714  Double_t vtx2daughter[3] = {0,0,0}; // secondary vertex
715  Bool_t bachVertex = hasProdVertex && mcPartDaughter1->XvYvZv(vtx2daughter); //cm
716 
717  if (!hasProdVertex || !v0Vertex || !bachVertex) {
718  AliDebug(2,"At least one of Prim.vtx, V0vtx, BachelorVtx doesn't exist!");
719  return cTau;
720  }
721 
722  if (TMath::Abs(vtx1daughter[0]-vtx2daughter[0])>1E-5 ||
723  TMath::Abs(vtx1daughter[1]-vtx2daughter[1])>1E-5 ||
724  TMath::Abs(vtx1daughter[2]-vtx2daughter[2])>1E-5) {
725  AliDebug(2,"Bachelor and V0 haven't common vtx!");
726  return cTau;
727  }
728 
729  Double_t decayLength = 0.;
730  for (Int_t ii=0; ii<3; ii++) decayLength += (vtx1daughter[ii]-vtx1[ii])*(vtx1daughter[ii]-vtx1[ii]);
731  decayLength = TMath::Sqrt(decayLength);
732 
733  cTau = decayLength * mcPartCandidate->M()/mcPartCandidate->P();
734 
735  AliDebug(2,Form(" cTau(4122)=%f",cTau));
736 
737  return cTau;
738 
739 }
740 
741 //------------
743 {
744  //
745  // setting the label arrays
746  //
747 
748  Bool_t checkCD = kFALSE;
749 
750  if (fmcPartCandidate->GetNDaughters()!=2) {
751  AliDebug(2, Form("The MC particle have %d daughters (not 2), skipping!!",fmcPartCandidate->GetNDaughters()));
752  // fmcPartCandidate->Print();
753  return checkCD;
754  }
755 
756  Int_t daughter0 = fmcPartCandidate->GetDaughter(0);
757  Int_t daughter1 = fmcPartCandidate->GetDaughter(1);
758  if (daughter0<=0 || daughter1<=0){
759  AliDebug(2, Form("The MC particle doesn't have correct daughters, skipping!!"));
760  return checkCD;
761  }
762 
763  AliAODMCParticle* mcPartDaughter0 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter0));
764  AliAODMCParticle* mcPartDaughter1 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter1));
765  if (!mcPartDaughter0 || !mcPartDaughter1) {
766  AliDebug(2,"Problems in the MC Daughters\n");
767  return checkCD;
768  }
769 
770 
771  fLabelArray = new Int_t[fProngs];
772 
773  if (fGenLcOption==kCountLambdapi) { // Lc -> Lambda + pion OR cc
774 
775  if (!(TMath::Abs(mcPartDaughter0->GetPdgCode())==3122 &&
776  TMath::Abs(mcPartDaughter1->GetPdgCode())==211) &&
777  !(TMath::Abs(mcPartDaughter0->GetPdgCode())==211 &&
778  TMath::Abs(mcPartDaughter1->GetPdgCode())==3122)) {
779  AliDebug(2, "The Lc MC doesn't decay in Lambda+pion (or cc), skipping!!");
780  delete [] fLabelArray;
781  fLabelArray = 0x0;
782  return checkCD;
783  }
784 
785  // it is Lc -> Lambda + pion OR cc
786  if (TMath::Abs(mcPartDaughter0->GetPdgCode())==3122) {
787  mcPartDaughter0 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter1)); // the bachelor
788  mcPartDaughter1 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter0)); // the V0
789  Int_t daughterTemp = daughter0;
790  daughter0 = daughter1; // the bachelor label
791  daughter1 = daughterTemp; // the V0 label
792  }
793 
794  if (mcPartDaughter1->GetNDaughters()!=2) {
795  AliDebug(2, "The Lambda MC particle doesn't decay in 2 particles, skipping!!");
796  delete [] fLabelArray;
797  fLabelArray = 0x0;
798  return checkCD;
799  }
800 
801  Int_t daughter1D0 = mcPartDaughter1->GetDaughter(0);
802  Int_t daughter1D1 = mcPartDaughter1->GetDaughter(1);
803  if (daughter1D0<=0 || daughter1D1<=0) {
804  AliDebug(2, Form("The Lambda MC particle doesn't have correct daughters, skipping!!"));
805  delete [] fLabelArray;
806  fLabelArray = 0x0;
807  return checkCD;
808  }
809 
810  AliAODMCParticle* mcPartDaughter1D0 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter1D0));
811  AliAODMCParticle* mcPartDaughter1D1 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter1D1));
812  if (!mcPartDaughter1D0 || !mcPartDaughter1D1) {
813  AliError("The Lambda daughter particles not found in MC array");
814  delete [] fLabelArray;
815  fLabelArray = 0x0;
816  return checkCD;
817  }
818 
819  if (!(TMath::Abs(mcPartDaughter1D0->GetPdgCode())==211 &&
820  TMath::Abs(mcPartDaughter1D1->GetPdgCode())==2212) &&
821  !(TMath::Abs(mcPartDaughter1D0->GetPdgCode())==2212 &&
822  TMath::Abs(mcPartDaughter1D1->GetPdgCode())==211)) {
823  AliDebug(2, "The Lambda MC doesn't decay in pi+proton (or cc), skipping!!");
824  delete [] fLabelArray;
825  fLabelArray = 0x0;
826  return checkCD;
827  }
828 
829  // Lambda -> p+pi OR cc
830 
831  fLabelArray[0] = daughter0;//mcPartDaughter0->GetLabel(); // bachelor
832 
833  if (fmcPartCandidate->Charge()>0) {
834 
835  if (mcPartDaughter1D0->GetPdgCode()==2212) {
836  fLabelArray[1] = daughter1D0;//mcPartDaughter1D0->GetLabel(); // proton
837  fLabelArray[2] = daughter1D1;//mcPartDaughter1D1->GetLabel(); // pion
838  } else if (mcPartDaughter1D1->GetPdgCode()==2212) {
839  fLabelArray[1] = daughter1D1;//mcPartDaughter1D1->GetLabel(); // proton
840  fLabelArray[2] = daughter1D0;//mcPartDaughter1D0->GetLabel(); // pion
841  }
842 
843  } else if (fmcPartCandidate->Charge()<0) {
844 
845  if (mcPartDaughter1D0->GetPdgCode()==211) {
846  fLabelArray[1] = daughter1D0;//mcPartDaughter1D0->GetLabel(); // pion
847  fLabelArray[2] = daughter1D1;//mcPartDaughter1D1->GetLabel(); // proton
848  } else if (mcPartDaughter1D1->GetPdgCode()==211) {
849  fLabelArray[1] = daughter1D1;//mcPartDaughter1D1->GetLabel(); // pion
850  fLabelArray[2] = daughter1D0;//mcPartDaughter1D0->GetLabel(); // proton
851  }
852 
853  }
854 
855  } else if (fGenLcOption==kCountK0Sp) { // Lc -> K0bar + proton OR cc
856 
857  if (!(TMath::Abs(mcPartDaughter0->GetPdgCode())==311 &&
858  TMath::Abs(mcPartDaughter1->GetPdgCode())==2212) &&
859  !(TMath::Abs(mcPartDaughter0->GetPdgCode())==2212 &&
860  TMath::Abs(mcPartDaughter1->GetPdgCode())==311)) {
861  AliDebug(2, "The Lc MC doesn't decay in K0bar+proton (or cc), skipping!!");
862  delete [] fLabelArray;
863  fLabelArray = 0x0;
864  return checkCD;
865  }
866 
867  if (TMath::Abs(mcPartDaughter0->GetPdgCode())==311) {
868  mcPartDaughter0 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter1)); // the bachelor
869  mcPartDaughter1 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter0)); // the V0
870  Int_t daughterTemp = daughter0;
871  daughter0 = daughter1; // the bachelor label
872  daughter1 = daughterTemp; // the V0 label
873  }
874 
875  if(!mcPartDaughter1){
876  AliDebug(2, "Null pointer to K0 particle, skipping!!");
877  delete [] fLabelArray;
878  fLabelArray = 0x0;
879  return checkCD;
880  }
881 
882  if (mcPartDaughter1->GetNDaughters()!=1) {
883  AliDebug(2, "The K0/K0bar MC particle doesn't decay in 1 particles, skipping!!");
884  delete [] fLabelArray;
885  fLabelArray = 0x0;
886  return checkCD;
887  }
888 
889  Int_t daughter = mcPartDaughter1->GetDaughter(0);
890  if (daughter<=0) {
891  AliDebug(2, Form("The K0/K0bar MC particle doesn't have correct daughter, skipping!!"));
892  delete [] fLabelArray;
893  fLabelArray = 0x0;
894  return checkCD;
895  }
896 
897  AliAODMCParticle* mcPartDaughter = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter));
898  if (!mcPartDaughter) {
899  AliError("The K0/K0bar daughter particle not found in MC array");
900  delete [] fLabelArray;
901  fLabelArray = 0x0;
902  return checkCD;
903  }
904 
905  if (!(TMath::Abs(mcPartDaughter->GetPdgCode())==310)) {
906  AliDebug(2, "The K0/K0bar MC doesn't go in K0S, skipping!!");
907  delete [] fLabelArray;
908  fLabelArray = 0x0;
909  return checkCD;
910  }
911 
912  if (mcPartDaughter->GetNDaughters()!=2) {
913  AliDebug(2, "The K0S MC doesn't decay in 2 particles, skipping!!");
914  delete [] fLabelArray;
915  fLabelArray = 0x0;
916  return checkCD;
917  }
918 
919  Int_t daughterD0 = mcPartDaughter->GetDaughter(0);
920  Int_t daughterD1 = mcPartDaughter->GetDaughter(1);
921  if (daughterD0<=0 || daughterD1<=0) {
922  AliDebug(2, Form("The K0S MC particle doesn't have correct daughters, skipping!!"));
923  delete [] fLabelArray;
924  fLabelArray = 0x0;
925  return checkCD;
926  }
927 
928  AliAODMCParticle* mcPartDaughterD0 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughterD0));
929  AliAODMCParticle* mcPartDaughterD1 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughterD1));
930  if (!mcPartDaughterD0 || !mcPartDaughterD1) {
931  AliError("The K0S daughter particles not found in MC array");
932  delete [] fLabelArray;
933  fLabelArray = 0x0;
934  return checkCD;
935  }
936 
937  if (! ( TMath::Abs(mcPartDaughterD0->GetPdgCode())==211 &&
938  TMath::Abs(mcPartDaughterD1->GetPdgCode())==211 ) ) {
939  AliDebug(2, "The K0S MC doesn't decay in pi+ pi-, skipping!!");
940  delete [] fLabelArray;
941  fLabelArray = 0x0;
942  return checkCD;
943  }
944 
945  // K0S -> pi+ pi-
946 
947  fLabelArray[0] = daughter0;//mcPartDaughter0->GetLabel(); // bachelor
948 
949  if (mcPartDaughterD0->GetPdgCode()==211) {
950  fLabelArray[1] = daughterD0;//mcPartDaughterD0->GetLabel(); // pi+
951  fLabelArray[2] = daughterD1;//mcPartDaughterD1->GetLabel(); // pi-
952  AliDebug(2,Form(" daughter0=%d ------ daughter1=%d ------ dg0->GetLabel()=%d ------ dg1->GetLabel()=%d ",daughterD0,daughterD1,mcPartDaughterD0->GetLabel(),mcPartDaughterD1->GetLabel()));
953  } else if (mcPartDaughterD1->GetPdgCode()==211) {
954  fLabelArray[1] = daughterD1;//mcPartDaughterD1->GetLabel(); // pi+
955  fLabelArray[2] = daughterD0;//mcPartDaughterD0->GetLabel(); // pi-
956  AliDebug(2,Form(" daughter0=%d ------ daughter1=%d ------ dg0->GetLabel()=%d ------ dg1->GetLabel()=%d ",daughterD1,daughterD0,mcPartDaughterD1->GetLabel(),mcPartDaughterD0->GetLabel()));
957  }
958  }
959 
960  AliDebug(2,Form(" label0=%d, label1=%d, label2=%d",fLabelArray[0],fLabelArray[1],fLabelArray[2]));
961 
962  SetAccCut(); // setting the pt and eta acceptance cuts
963 
964  checkCD = kTRUE;
965  return checkCD;
966 
967 }
968 //____________________________________________
969 Bool_t AliCFVertexingHFLctoV0bachelor::FillVectorFromMCarray(AliAODMCParticle *mcPartDaughterBachelor,
970  AliAODMCParticle *mcPartDaughterK0,
971  Double_t *vectorMC)
972 {
973  // fill the vector
974 
975  Bool_t bGenValues = kFALSE;
976 
977  AliAODMCParticle *mcPartV0DaughterPos = dynamic_cast<AliAODMCParticle*>(fmcArray->At(fLabelArray[1]));
978  AliAODMCParticle *mcPartV0DaughterNeg = dynamic_cast<AliAODMCParticle*>(fmcArray->At(fLabelArray[2]));
979  AliAODMCParticle *mcPartDaughterV0 = 0x0;
980 
981  if(!mcPartV0DaughterPos || !mcPartV0DaughterNeg) return bGenValues;
982 
983  if (TMath::Abs(mcPartDaughterK0->GetPdgCode())==311) {
984  Int_t daughterK0 = mcPartDaughterK0->GetDaughter(0);
985  if (daughterK0<=0) {
986  AliDebug(2, Form("The K0/K0bar particle doesn't have correct daughter, skipping!!"));
987  return bGenValues;
988  }
989  mcPartDaughterV0 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughterK0));
990  if (!mcPartDaughterV0) {
991  AliDebug(2,"The K0/K0bar daughter particle not found in MC array");
992  return bGenValues;
993  }
994  if (TMath::Abs(mcPartDaughterV0->GetPdgCode())!=310) {
995  AliDebug(2,"The K0/K0bar daughter particle is not a K0S");
996  return bGenValues;
997  }
998  } else if (TMath::Abs(mcPartDaughterK0->GetPdgCode())==3122) {
999  mcPartDaughterV0 = dynamic_cast<AliAODMCParticle*>(mcPartDaughterK0);
1000  if (!mcPartDaughterV0) {
1001  AliDebug(2,"The Lambda particle not found in MC array");
1002  return bGenValues;
1003  }
1004  }
1005 
1006  if (!mcPartDaughterV0) {
1007  AliDebug(2,"V0 particle not found in MC array");
1008  return bGenValues;
1009  }
1010 
1011  //Double_t cTLc = Ctau(fmcPartCandidate); // by default wrt Primary Vtx
1012  //Double_t pTbach = mcPartDaughterBachelor->Pt(); // get the bachelor pT
1013  Double_t pbach = mcPartDaughterBachelor->P(); // get the bachelor p
1014 
1015  Double_t vtx1[3] = {0,0,0}; // primary vertex
1016  Bool_t hasPrimVtx = fmcPartCandidate->XvYvZv(vtx1); // cm
1017 
1018  // getting vertex from daughters
1019  Double_t vtx1daughter0[3] = {0,0,0}; // secondary vertex from daughter 0
1020  Bool_t hasSecVtx1 = mcPartDaughterBachelor->XvYvZv(vtx1daughter0); //cm
1021  Double_t vtx1daughter1[3] = {0,0,0}; // secondary vertex from daughter 1
1022  Bool_t hasSecVtx2 = mcPartDaughterV0->XvYvZv(vtx1daughter1); //cm
1023  if (!hasPrimVtx || !hasSecVtx1 || !hasSecVtx2) {
1024  AliDebug(2,"At least one of Prim.vtx, V0vtx, BachelorVtx doesn't exist!");
1025  //return bGenValues;
1026  }
1027 
1028  if (TMath::Abs(vtx1daughter0[0]-vtx1daughter1[0])>1E-5 ||
1029  TMath::Abs(vtx1daughter0[1]-vtx1daughter1[1])>1E-5 ||
1030  TMath::Abs(vtx1daughter0[2]-vtx1daughter1[2])>1E-5) {
1031  AliError("Daughters have different secondary vertex, skipping the track");
1032  //return bGenValues;
1033  }
1034 
1035  // getting the momentum from the daughters
1036  Double_t px1[2] = {mcPartDaughterBachelor->Px(), mcPartDaughterV0->Px()};
1037  Double_t py1[2] = {mcPartDaughterBachelor->Py(), mcPartDaughterV0->Py()};
1038  Double_t pz1[2] = {mcPartDaughterBachelor->Pz(), mcPartDaughterV0->Pz()};
1039 
1040  Int_t nprongs = 2;
1041  Short_t charge = mcPartDaughterBachelor->Charge();
1042  Double_t d0[2] = {0.,0.};
1043  AliAODRecoDecayHF* decayLc = new AliAODRecoDecayHF(vtx1,vtx1daughter0,nprongs,charge,px1,py1,pz1,d0);
1044  Double_t cosPAwrtPrimVtxLc = decayLc->CosPointingAngle();
1045  delete decayLc;
1046 
1047  // getting vertex from daughters
1048  Double_t vtx2daughter0[3] = {0,0,0}; // secondary vertex from daughter 0
1049  Bool_t hasSecVtx3 = mcPartV0DaughterPos->XvYvZv(vtx2daughter0); //cm
1050  Double_t vtx2daughter1[3] = {0,0,0}; // secondary vertex from daughter 1
1051  Bool_t hasSecVtx4 = mcPartV0DaughterNeg->XvYvZv(vtx2daughter1); //cm
1052  if (!hasSecVtx3 || !hasSecVtx4) {
1053  AliDebug(2,"At least one of V0Posvtx, V0Negtx doesn't exist!");
1054  //return bGenValues;
1055  }
1056 
1057  if (TMath::Abs(vtx2daughter0[0]-vtx2daughter1[0])>1E-5 ||
1058  TMath::Abs(vtx2daughter0[1]-vtx2daughter1[1])>1E-5 ||
1059  TMath::Abs(vtx2daughter0[2]-vtx2daughter1[2])>1E-5) {
1060  AliError("Daughters have different secondary vertex, skipping the track");
1061  //return bGenValues;
1062  }
1063 
1064  // getting the momentum from the daughters
1065  Double_t px[2] = {mcPartV0DaughterPos->Px(), mcPartV0DaughterNeg->Px()};
1066  Double_t py[2] = {mcPartV0DaughterPos->Py(), mcPartV0DaughterNeg->Py()};
1067  Double_t pz[2] = {mcPartV0DaughterPos->Pz(), mcPartV0DaughterNeg->Pz()};
1068 
1069  nprongs = 2;
1070  charge = 0;
1071  AliAODRecoDecayHF* decay = new AliAODRecoDecayHF(vtx1,vtx2daughter0,nprongs,charge,px,py,pz,d0);
1072  Double_t cosPAwrtPrimVtxV0 = decay->CosPointingAngle();
1073  /*
1074  Double_t cTV0 = 0.; //ct
1075  if (fGenLcOption==kCountK0Sp) {
1076  cTV0 = decay->Ct(310); // by default wrt Primary Vtx
1077  } else if (fGenLcOption==kCountLambdapi) {
1078  cTV0 = decay->Ct(3122); // by default wrt Primary Vtx
1079  }
1080  */
1081 
1082  Double_t invMass = 0.; //invMass
1083  if (fGenLcOption==kCountK0Sp) {
1084  invMass = decay->InvMass2Prongs(0,1,211,211);
1085  } else if (fGenLcOption==kCountLambdapi) {
1086  if (fmcPartCandidate->GetPdgCode() == 4122)
1087  invMass = decay->InvMass2Prongs(0,1,2212,211);
1088  else if (fmcPartCandidate->GetPdgCode() ==-4122)
1089  invMass = decay->InvMass2Prongs(0,1,211,2212);
1090  }
1091  delete decay;
1092 
1093 
1095  vectorMC[0] = fmcPartCandidate->Pt();
1096  vectorMC[1] = fmcPartCandidate->Y() ;
1097  vectorMC[2] = fmcPartCandidate->Phi();
1098  vectorMC[3] = 0; // dummy value x MC, onTheFlyStatus
1099  vectorMC[4] = fzMCVertex;
1100  vectorMC[5] = fCentValue; // reconstructed centrality
1101  vectorMC[6] = 1; // dummy value x MC, fFake
1102  vectorMC[7] = fMultiplicity; // reconstructed multiplicity
1103  //vectorMC[8] = pTbach;
1104  vectorMC[8] = pbach;
1105  vectorMC[9] = mcPartDaughterV0->Pt();
1106  vectorMC[10] = mcPartDaughterV0->Y();
1107  vectorMC[11] = mcPartDaughterV0->Phi();
1108  vectorMC[12] = invMass;
1109  vectorMC[13] = 0; // dummy value x MC, V0 DCA
1110  vectorMC[14] = cosPAwrtPrimVtxV0;
1111  vectorMC[15] = cosPAwrtPrimVtxLc;
1112  //vectorMC[16] = cTV0*1.E4; // in micron
1113  //vectorMC[17] = cTLc*1.E4; // in micron
1114  }
1116  vectorMC[0] = fmcPartCandidate->Pt();
1117  vectorMC[1] = fmcPartCandidate->Y() ;
1118  vectorMC[2] = fmcPartCandidate->Phi();
1119  vectorMC[3] = 0; // dummy value x MC, onTheFlyStatus
1120  vectorMC[4] = fzMCVertex;
1121  vectorMC[5] = fCentValue; // reconstructed centrality
1122  vectorMC[6] = 1; // dummy value x MC, fFake
1123  vectorMC[7] = fMultiplicity; // reconstructed multiplicity
1124  }
1126  vectorMC[0] = fmcPartCandidate->Pt();
1127  vectorMC[1] = fmcPartCandidate->Y() ;
1128  vectorMC[2] = fCentValue; // reconstructed centrality
1129  vectorMC[3] = fMultiplicity; // reconstructed multiplicity
1130  }
1131 
1132  bGenValues = kTRUE;
1133  return bGenValues;
1134 
1135 }
Int_t charge
AliCFVertexingHF & operator=(const AliCFVertexingHF &c)
double Double_t
Definition: External.C:58
Double_t Ctau(AliAODMCParticle *mcPartCandidate)
Bool_t GetRecoValuesFromCandidate(Double_t *) const
TClonesArray * fmcArray
Int_t MatchToMC(Int_t pdgabs, Int_t pdgabs2prong, Int_t *pdgDg, Int_t *pdgDg2prong, TClonesArray *mcArray, Bool_t isV0=kFALSE) const
AliAODTrack * Getv0NegativeTrack() const
AliAODv0 * Getv0() const
AliAODMCParticle * fmcPartCandidate
Reconstructed HF candidate.
AliCFVertexingHFLctoV0bachelor & operator=(const AliCFVertexingHFLctoV0bachelor &other)
TCanvas * c
Definition: TestFitELoss.C:172
Bool_t FillVectorFromMCarray(AliAODMCParticle *mcPartDaughterBachelor, AliAODMCParticle *mcPartDaughterK0, Double_t *vectorMC)
void SetNProngs(Int_t nProngs)
AliAODTrack * Getv0PositiveTrack() const
Float_t * fPtAccCut
centrality value
Float_t fFake
fakes selection: 0 –> all, 1 –> non-fake, 2 –> fake
Int_t fConfiguration
multiplicity of the event
int Int_t
Definition: External.C:63
float Float_t
Definition: External.C:68
AliAODTrack * GetBachelor() const
rapidity
Definition: HFPtSpectrum.C:47
Double_t CosV0PointingAngle() const
short Short_t
Definition: External.C:23
Int_t * fLabelArray
n. of prongs
AliAODRecoDecayHF * fRecoCandidate
mcArray candidate
decay
Definition: HFPtSpectrum.C:41
Bool_t SetRecoCandidateParam(AliAODRecoDecayHF *recoCand)
Int_t fmcLabel
flag to keep only the charm particles that comes from beauty decays
Double_t fzPrimVertex
get Number of variables for the container from the channel decay
Int_t NumberOfFakeDaughters() const
Int_t fProngs
results of the MatchToMC()
unsigned short UShort_t
Definition: External.C:28
virtual void SetAccCut()
AliAODVertex * GetPrimaryVtx() const
bool Bool_t
Definition: External.C:53
Double_t CosPointingAngle() const
void SetMCLabel(Int_t mcLabel)
slow configuration, all variables
Double_t fzMCVertex
Reco z primary vertex.
Double_t fMultiplicity
flag to remove events not geenrated with PYTHIA
Class for HF corrections as a function of many variables and step.
fast configuration, only a subset of variables