AliPhysics  96f6795 (96f6795)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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  vectorReco[0] = pt;
390  vectorReco[1] = rapidity;
391  vectorReco[2] = phi;
392  vectorReco[3] = onTheFlyStatus;
393  vectorReco[4] = fzPrimVertex;
394  vectorReco[5] = fCentValue;
395  vectorReco[6] = fFake; // whether the reconstructed candidate was a fake (fFake = 0) or not (fFake = 2)
396  vectorReco[7] = fMultiplicity;
397 
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  }
415 
416  bFillRecoValues = kTRUE;
417 
418  return bFillRecoValues;
419 }
420 
421 //_____________________________________________________________
423 {
424  // check the required decay channel
425 
426  Bool_t checkCD = kFALSE;
427  Double_t sumPxDau=0.;
428  Double_t sumPyDau=0.;
429  Double_t sumPzDau=0.;
430 
431 
432  if (fmcPartCandidate->GetNDaughters()!=2) {
433  AliDebug(2, Form("The MC particle doesn't decay in 2 particles, skipping!!"));
434  return checkCD;
435  }
436 
437  Int_t daughter0 = fmcPartCandidate->GetDaughter(0);
438  Int_t daughter1 = fmcPartCandidate->GetDaughter(1);
439  if (daughter0<=0 || daughter1<=0){
440  AliDebug(2, Form("The MC particle doesn't have correct daughters, skipping!!"));
441  return checkCD;
442  }
443  AliAODMCParticle* mcPartDaughter0 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter0));
444  AliAODMCParticle* mcPartDaughter1 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter1));
445  if (!mcPartDaughter0 || !mcPartDaughter1) {
446  AliDebug(2,"Problems in the MC Daughters\n");
447  return checkCD;
448  }
449 
450  // Lc -> Lambda + pion AND cc
452 
453  if (!(TMath::Abs(mcPartDaughter0->GetPdgCode())==3122 &&
454  TMath::Abs(mcPartDaughter1->GetPdgCode())==211) &&
455  !(TMath::Abs(mcPartDaughter0->GetPdgCode())==211 &&
456  TMath::Abs(mcPartDaughter1->GetPdgCode())==3122)) {
457  AliDebug(2, "The Lc MC doesn't decay in Lambda+pion (or cc), skipping!!");
458  return checkCD;
459  }
460 
461  if (TMath::Abs(mcPartDaughter0->GetPdgCode())==3122) {
462  mcPartDaughter0 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter1)); // the bachelor
463  mcPartDaughter1 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter0)); // the V0
464  }
465  if (!mcPartDaughter0 || !mcPartDaughter1) {
466  AliDebug(2,"Problems in the MC Daughters\n");
467  return checkCD;
468  }
469  // momentum of the bachelor
470  sumPxDau+=mcPartDaughter0->Px();
471  sumPyDau+=mcPartDaughter0->Py();
472  sumPzDau+=mcPartDaughter0->Pz();
473 
474  if (mcPartDaughter1->GetNDaughters()!=2) {
475  AliDebug(2, "The Lambda MC particle doesn't decay in 2 particles, skipping!!");
476  return checkCD;
477  }
478 
479  Int_t daughter1D0 = mcPartDaughter1->GetDaughter(0);
480  Int_t daughter1D1 = mcPartDaughter1->GetDaughter(1);
481  if (daughter1D0<=0 || daughter1D1<=0) {
482  AliDebug(2, Form("The Lambda MC particle doesn't have correct daughters, skipping!!"));
483  return checkCD;
484  }
485 
486  AliAODMCParticle* mcPartDaughter1D0 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter1D0));
487  AliAODMCParticle* mcPartDaughter1D1 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter1D1));
488  if(!mcPartDaughter1D0 || !mcPartDaughter1D1) {
489  AliError("The Lambda daughter particle not found in MC array");
490  return checkCD;
491  }
492 
493  if (!(TMath::Abs(mcPartDaughter1D0->GetPdgCode())==211 &&
494  TMath::Abs(mcPartDaughter1D1->GetPdgCode())==2212) &&
495  !(TMath::Abs(mcPartDaughter1D0->GetPdgCode())==2212 &&
496  TMath::Abs(mcPartDaughter1D1->GetPdgCode())==211)) {
497  AliDebug(2, "The Lambda MC doesn't decay in pi+proton (or cc), skipping!!");
498  return checkCD;
499  }
500 
501  // momentum of the V0 daughters
502  sumPxDau+=mcPartDaughter1D0->Px();
503  sumPyDau+=mcPartDaughter1D0->Py();
504  sumPzDau+=mcPartDaughter1D0->Pz();
505  sumPxDau+=mcPartDaughter1D1->Px();
506  sumPyDau+=mcPartDaughter1D1->Py();
507  sumPzDau+=mcPartDaughter1D1->Pz();
508 
509  } else if (fGenLcOption==kCountK0Sp) { // Lc -> K0bar + proton AND cc
510 
511  if (!(TMath::Abs(mcPartDaughter0->GetPdgCode())==311 &&
512  TMath::Abs(mcPartDaughter1->GetPdgCode())==2212) &&
513  !(TMath::Abs(mcPartDaughter0->GetPdgCode())==2212 &&
514  TMath::Abs(mcPartDaughter1->GetPdgCode())==311)) {
515  AliDebug(2, "The Lc MC doesn't decay in K0+proton (or cc), skipping!!");
516  return checkCD;
517  }
518 
519  if (TMath::Abs(mcPartDaughter0->GetPdgCode())==311) {
520  mcPartDaughter0 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter1)); // the bachelor
521  mcPartDaughter1 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter0)); // the V0
522  }
523  if (!mcPartDaughter0 || !mcPartDaughter1) {
524  AliDebug(2,"Problems in the MC Daughters after swapping V0 and bachelor\n");
525  return checkCD;
526  }
527 
528  // momentum of the bachelor
529  sumPxDau+=mcPartDaughter0->Px();
530  sumPyDau+=mcPartDaughter0->Py();
531  sumPzDau+=mcPartDaughter0->Pz();
532 
533  if (mcPartDaughter1->GetNDaughters()!=1) {
534  AliDebug(2, "The K0/K0bar MC particle doesn't decay in 1 particles, skipping!!");
535  return checkCD;
536  }
537 
538  Int_t daughter = mcPartDaughter1->GetDaughter(0);
539  if (daughter<=0) {
540  AliDebug(2, Form("The K0/K0bar MC particle doesn't have correct daughter, skipping!!"));
541  return checkCD;
542  }
543 
544  AliAODMCParticle* mcPartDaughter = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter));
545  if(!mcPartDaughter){
546  AliError("The K0/K0bar daughter particle not found in MC array");
547  return checkCD;
548  }
549 
550  if (!(TMath::Abs(mcPartDaughter->GetPdgCode())==310)) {
551  AliDebug(2, "The K0/K0bar MC doesn't go in K0S, skipping!!");
552  return checkCD;
553  }
554 
555  if (mcPartDaughter->GetNDaughters()!=2) {
556  AliDebug(2, "The K0S MC doesn't decay in 2 particles, skipping!!");
557  return checkCD;
558  }
559 
560  Int_t daughterD0 = mcPartDaughter->GetDaughter(0);
561  Int_t daughterD1 = mcPartDaughter->GetDaughter(1);
562  if (daughterD0<=0 || daughterD1<=0) {
563  AliDebug(2, Form("The K0S MC particle doesn't have correct daughters, skipping!!"));
564  return checkCD;
565  }
566 
567  AliAODMCParticle* mcPartDaughterD0 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughterD0));
568  AliAODMCParticle* mcPartDaughterD1 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughterD1));
569  if (!mcPartDaughterD0 || !mcPartDaughterD1) {
570  AliError("Daughter particle not found in MC array");
571  return checkCD;
572  }
573 
574  if (! ( TMath::Abs(mcPartDaughterD0->GetPdgCode())==211 &&
575  TMath::Abs(mcPartDaughterD1->GetPdgCode())==211 ) ) {
576  AliDebug(2, "The K0S MC doesn't decay in pi+ pi-, skipping!!");
577  return checkCD;
578  }
579 
580  // momentum of the V0 daughters
581  sumPxDau+=mcPartDaughterD0->Px();
582  sumPyDau+=mcPartDaughterD0->Py();
583  sumPzDau+=mcPartDaughterD0->Pz();
584  sumPxDau+=mcPartDaughterD1->Px();
585  sumPyDau+=mcPartDaughterD1->Py();
586  sumPzDau+=mcPartDaughterD1->Pz();
587 
588  }
589 
590  Double_t pxMother=fmcPartCandidate->Px();
591  Double_t pyMother=fmcPartCandidate->Py();
592  Double_t pzMother=fmcPartCandidate->Pz();
593  if(TMath::Abs(pxMother-sumPxDau)/(TMath::Abs(pxMother)+1.e-13)>0.00001 ||
594  TMath::Abs(pyMother-sumPyDau)/(TMath::Abs(pyMother)+1.e-13)>0.00001 ||
595  TMath::Abs(pzMother-sumPzDau)/(TMath::Abs(pzMother)+1.e-13)>0.00001){
596  AliDebug(2, "Momentum conservation violated, skipping!!");
597  return checkCD;
598  }
599 
600  checkCD = kTRUE;
601  return checkCD;
602 
603 }
604 
605 //_____________________________________________________________
607 {
608  //
609  // getting eta of the prong - overload the mother class method
610  //
611 
612  Double_t etaProng =-9999;
613 
614  if (!fRecoCandidate) {
615  AliDebug(2,"No reco candidate selected");
616  return etaProng;
617  }
618 
620  AliAODTrack* bachelor = (AliAODTrack*)lcV0bachelor->GetBachelor();
621  AliAODTrack* v0Pos = (AliAODTrack*)lcV0bachelor->Getv0PositiveTrack();
622  AliAODTrack* v0Neg = (AliAODTrack*)lcV0bachelor->Getv0NegativeTrack();
623  if (!(lcV0bachelor->Getv0()) || !bachelor || !v0Pos || !v0Neg) {
624  AliDebug(2,"No V0 for this reco candidate selected");
625  return etaProng;
626  }
627 
628  if (iProng==0) etaProng = bachelor->Eta();
629  else if (iProng==1) etaProng = v0Pos->Eta();
630  else if (iProng==2) etaProng = v0Neg->Eta();
631 
632  AliDebug(4,Form("Eta value for prong number %1d = %f",iProng,etaProng));
633 
634  return etaProng;
635 
636 }
637 
638 //_____________________________________________________________
639 
641 {
642  //
643  // getting pt of the prong
644  //
645 
646  Double_t ptProng=-9999.;
647 
648  if (!fRecoCandidate) {
649  AliDebug(2,"No reco candidate selected");
650  return ptProng;
651  }
652 
654  AliAODTrack* bachelor = (AliAODTrack*)lcV0bachelor->GetBachelor();
655  AliAODTrack* v0Pos = (AliAODTrack*)lcV0bachelor->Getv0PositiveTrack();
656  AliAODTrack* v0Neg = (AliAODTrack*)lcV0bachelor->Getv0NegativeTrack();
657  if (!(lcV0bachelor->Getv0()) || !bachelor || !v0Pos || !v0Neg) {
658  AliDebug(2,"No V0 for this reco candidate selected");
659  return ptProng;
660  }
661 
662  if (iProng==0) ptProng = bachelor->Pt();
663  else if (iProng==1) ptProng = v0Pos->Pt();
664  else if (iProng==2) ptProng = v0Neg->Pt();
665 
666  AliDebug(4,Form("Pt value for prong number %1d = %f",iProng,ptProng));
667 
668  return ptProng;
669 
670 }
671 
672 //_____________________________________________________________
673 
674 Double_t AliCFVertexingHFLctoV0bachelor::Ctau(AliAODMCParticle *mcPartCandidate)
675 {
676 
677  Double_t cTau = 999999.;
678 
679  Int_t daughterD0 = mcPartCandidate->GetDaughter(0);
680  Int_t daughterD1 = mcPartCandidate->GetDaughter(1);
681  if (daughterD0<=0 || daughterD1<=0) {
682  AliDebug(2, Form("The Lc MC particle doesn't have correct daughters, skipping!!"));
683  return cTau;
684  }
685 
686  AliAODMCParticle *mcPartDaughter0 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughterD0));
687  AliAODMCParticle *mcPartDaughter1 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughterD1));
688  if (!mcPartDaughter0 || !mcPartDaughter1) {
689  AliDebug(2,"The candidate daughter particles not found in MC array");
690  return cTau;
691  }
692 
693  Double_t vtx1[3] = {0,0,0}; // primary vertex
694  Bool_t hasProdVertex = mcPartCandidate->XvYvZv(vtx1); // cm
695 
696  Double_t vtx1daughter[3] = {0,0,0}; // secondary vertex
697  Bool_t v0Vertex = mcPartDaughter0->XvYvZv(vtx1daughter); //cm
698  Double_t vtx2daughter[3] = {0,0,0}; // secondary vertex
699  Bool_t bachVertex = hasProdVertex && mcPartDaughter1->XvYvZv(vtx2daughter); //cm
700 
701  if (!hasProdVertex || !v0Vertex || !bachVertex) {
702  AliDebug(2,"At least one of Prim.vtx, V0vtx, BachelorVtx doesn't exist!");
703  return cTau;
704  }
705 
706  if (TMath::Abs(vtx1daughter[0]-vtx2daughter[0])>1E-5 ||
707  TMath::Abs(vtx1daughter[1]-vtx2daughter[1])>1E-5 ||
708  TMath::Abs(vtx1daughter[2]-vtx2daughter[2])>1E-5) {
709  AliDebug(2,"Bachelor and V0 haven't common vtx!");
710  return cTau;
711  }
712 
713  Double_t decayLength = 0.;
714  for (Int_t ii=0; ii<3; ii++) decayLength += (vtx1daughter[ii]-vtx1[ii])*(vtx1daughter[ii]-vtx1[ii]);
715  decayLength = TMath::Sqrt(decayLength);
716 
717  cTau = decayLength * mcPartCandidate->M()/mcPartCandidate->P();
718 
719  AliDebug(2,Form(" cTau(4122)=%f",cTau));
720 
721  return cTau;
722 
723 }
724 
725 //------------
727 {
728  //
729  // setting the label arrays
730  //
731 
732  Bool_t checkCD = kFALSE;
733 
734  if (fmcPartCandidate->GetNDaughters()!=2) {
735  AliDebug(2, Form("The MC particle have %d daughters (not 2), skipping!!",fmcPartCandidate->GetNDaughters()));
736  // fmcPartCandidate->Print();
737  return checkCD;
738  }
739 
740  Int_t daughter0 = fmcPartCandidate->GetDaughter(0);
741  Int_t daughter1 = fmcPartCandidate->GetDaughter(1);
742  if (daughter0<=0 || daughter1<=0){
743  AliDebug(2, Form("The MC particle doesn't have correct daughters, skipping!!"));
744  return checkCD;
745  }
746 
747  AliAODMCParticle* mcPartDaughter0 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter0));
748  AliAODMCParticle* mcPartDaughter1 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter1));
749  if (!mcPartDaughter0 || !mcPartDaughter1) {
750  AliDebug(2,"Problems in the MC Daughters\n");
751  return checkCD;
752  }
753 
754 
755  fLabelArray = new Int_t[fProngs];
756 
757  if (fGenLcOption==kCountLambdapi) { // Lc -> Lambda + pion OR cc
758 
759  if (!(TMath::Abs(mcPartDaughter0->GetPdgCode())==3122 &&
760  TMath::Abs(mcPartDaughter1->GetPdgCode())==211) &&
761  !(TMath::Abs(mcPartDaughter0->GetPdgCode())==211 &&
762  TMath::Abs(mcPartDaughter1->GetPdgCode())==3122)) {
763  AliDebug(2, "The Lc MC doesn't decay in Lambda+pion (or cc), skipping!!");
764  delete [] fLabelArray;
765  fLabelArray = 0x0;
766  return checkCD;
767  }
768 
769  // it is Lc -> Lambda + pion OR cc
770  if (TMath::Abs(mcPartDaughter0->GetPdgCode())==3122) {
771  mcPartDaughter0 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter1)); // the bachelor
772  mcPartDaughter1 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter0)); // the V0
773  Int_t daughterTemp = daughter0;
774  daughter0 = daughter1; // the bachelor label
775  daughter1 = daughterTemp; // the V0 label
776  }
777 
778  if (mcPartDaughter1->GetNDaughters()!=2) {
779  AliDebug(2, "The Lambda MC particle doesn't decay in 2 particles, skipping!!");
780  delete [] fLabelArray;
781  fLabelArray = 0x0;
782  return checkCD;
783  }
784 
785  Int_t daughter1D0 = mcPartDaughter1->GetDaughter(0);
786  Int_t daughter1D1 = mcPartDaughter1->GetDaughter(1);
787  if (daughter1D0<=0 || daughter1D1<=0) {
788  AliDebug(2, Form("The Lambda MC particle doesn't have correct daughters, skipping!!"));
789  delete [] fLabelArray;
790  fLabelArray = 0x0;
791  return checkCD;
792  }
793 
794  AliAODMCParticle* mcPartDaughter1D0 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter1D0));
795  AliAODMCParticle* mcPartDaughter1D1 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter1D1));
796  if (!mcPartDaughter1D0 || !mcPartDaughter1D1) {
797  AliError("The Lambda daughter particles not found in MC array");
798  delete [] fLabelArray;
799  fLabelArray = 0x0;
800  return checkCD;
801  }
802 
803  if (!(TMath::Abs(mcPartDaughter1D0->GetPdgCode())==211 &&
804  TMath::Abs(mcPartDaughter1D1->GetPdgCode())==2212) &&
805  !(TMath::Abs(mcPartDaughter1D0->GetPdgCode())==2212 &&
806  TMath::Abs(mcPartDaughter1D1->GetPdgCode())==211)) {
807  AliDebug(2, "The Lambda MC doesn't decay in pi+proton (or cc), skipping!!");
808  delete [] fLabelArray;
809  fLabelArray = 0x0;
810  return checkCD;
811  }
812 
813  // Lambda -> p+pi OR cc
814 
815  fLabelArray[0] = daughter0;//mcPartDaughter0->GetLabel(); // bachelor
816 
817  if (fmcPartCandidate->Charge()>0) {
818 
819  if (mcPartDaughter1D0->GetPdgCode()==2212) {
820  fLabelArray[1] = daughter1D0;//mcPartDaughter1D0->GetLabel(); // proton
821  fLabelArray[2] = daughter1D1;//mcPartDaughter1D1->GetLabel(); // pion
822  } else if (mcPartDaughter1D1->GetPdgCode()==2212) {
823  fLabelArray[1] = daughter1D1;//mcPartDaughter1D1->GetLabel(); // proton
824  fLabelArray[2] = daughter1D0;//mcPartDaughter1D0->GetLabel(); // pion
825  }
826 
827  } else if (fmcPartCandidate->Charge()<0) {
828 
829  if (mcPartDaughter1D0->GetPdgCode()==211) {
830  fLabelArray[1] = daughter1D0;//mcPartDaughter1D0->GetLabel(); // pion
831  fLabelArray[2] = daughter1D1;//mcPartDaughter1D1->GetLabel(); // proton
832  } else if (mcPartDaughter1D1->GetPdgCode()==211) {
833  fLabelArray[1] = daughter1D1;//mcPartDaughter1D1->GetLabel(); // pion
834  fLabelArray[2] = daughter1D0;//mcPartDaughter1D0->GetLabel(); // proton
835  }
836 
837  }
838 
839  } else if (fGenLcOption==kCountK0Sp) { // Lc -> K0bar + proton OR cc
840 
841  if (!(TMath::Abs(mcPartDaughter0->GetPdgCode())==311 &&
842  TMath::Abs(mcPartDaughter1->GetPdgCode())==2212) &&
843  !(TMath::Abs(mcPartDaughter0->GetPdgCode())==2212 &&
844  TMath::Abs(mcPartDaughter1->GetPdgCode())==311)) {
845  AliDebug(2, "The Lc MC doesn't decay in K0bar+proton (or cc), skipping!!");
846  delete [] fLabelArray;
847  fLabelArray = 0x0;
848  return checkCD;
849  }
850 
851  if (TMath::Abs(mcPartDaughter0->GetPdgCode())==311) {
852  mcPartDaughter0 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter1)); // the bachelor
853  mcPartDaughter1 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter0)); // the V0
854  Int_t daughterTemp = daughter0;
855  daughter0 = daughter1; // the bachelor label
856  daughter1 = daughterTemp; // the V0 label
857  }
858 
859  if(!mcPartDaughter1){
860  AliDebug(2, "Null pointer to K0 particle, skipping!!");
861  delete [] fLabelArray;
862  fLabelArray = 0x0;
863  return checkCD;
864  }
865 
866  if (mcPartDaughter1->GetNDaughters()!=1) {
867  AliDebug(2, "The K0/K0bar MC particle doesn't decay in 1 particles, skipping!!");
868  delete [] fLabelArray;
869  fLabelArray = 0x0;
870  return checkCD;
871  }
872 
873  Int_t daughter = mcPartDaughter1->GetDaughter(0);
874  if (daughter<=0) {
875  AliDebug(2, Form("The K0/K0bar MC particle doesn't have correct daughter, skipping!!"));
876  delete [] fLabelArray;
877  fLabelArray = 0x0;
878  return checkCD;
879  }
880 
881  AliAODMCParticle* mcPartDaughter = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter));
882  if (!mcPartDaughter) {
883  AliError("The K0/K0bar daughter particle not found in MC array");
884  delete [] fLabelArray;
885  fLabelArray = 0x0;
886  return checkCD;
887  }
888 
889  if (!(TMath::Abs(mcPartDaughter->GetPdgCode())==310)) {
890  AliDebug(2, "The K0/K0bar MC doesn't go in K0S, skipping!!");
891  delete [] fLabelArray;
892  fLabelArray = 0x0;
893  return checkCD;
894  }
895 
896  if (mcPartDaughter->GetNDaughters()!=2) {
897  AliDebug(2, "The K0S MC doesn't decay in 2 particles, skipping!!");
898  delete [] fLabelArray;
899  fLabelArray = 0x0;
900  return checkCD;
901  }
902 
903  Int_t daughterD0 = mcPartDaughter->GetDaughter(0);
904  Int_t daughterD1 = mcPartDaughter->GetDaughter(1);
905  if (daughterD0<=0 || daughterD1<=0) {
906  AliDebug(2, Form("The K0S MC particle doesn't have correct daughters, skipping!!"));
907  delete [] fLabelArray;
908  fLabelArray = 0x0;
909  return checkCD;
910  }
911 
912  AliAODMCParticle* mcPartDaughterD0 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughterD0));
913  AliAODMCParticle* mcPartDaughterD1 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughterD1));
914  if (!mcPartDaughterD0 || !mcPartDaughterD1) {
915  AliError("The K0S daughter particles not found in MC array");
916  delete [] fLabelArray;
917  fLabelArray = 0x0;
918  return checkCD;
919  }
920 
921  if (! ( TMath::Abs(mcPartDaughterD0->GetPdgCode())==211 &&
922  TMath::Abs(mcPartDaughterD1->GetPdgCode())==211 ) ) {
923  AliDebug(2, "The K0S MC doesn't decay in pi+ pi-, skipping!!");
924  delete [] fLabelArray;
925  fLabelArray = 0x0;
926  return checkCD;
927  }
928 
929  // K0S -> pi+ pi-
930 
931  fLabelArray[0] = daughter0;//mcPartDaughter0->GetLabel(); // bachelor
932 
933  if (mcPartDaughterD0->GetPdgCode()==211) {
934  fLabelArray[1] = daughterD0;//mcPartDaughterD0->GetLabel(); // pi+
935  fLabelArray[2] = daughterD1;//mcPartDaughterD1->GetLabel(); // pi-
936  AliDebug(2,Form(" daughter0=%d ------ daughter1=%d ------ dg0->GetLabel()=%d ------ dg1->GetLabel()=%d ",daughterD0,daughterD1,mcPartDaughterD0->GetLabel(),mcPartDaughterD1->GetLabel()));
937  } else if (mcPartDaughterD1->GetPdgCode()==211) {
938  fLabelArray[1] = daughterD1;//mcPartDaughterD1->GetLabel(); // pi+
939  fLabelArray[2] = daughterD0;//mcPartDaughterD0->GetLabel(); // pi-
940  AliDebug(2,Form(" daughter0=%d ------ daughter1=%d ------ dg0->GetLabel()=%d ------ dg1->GetLabel()=%d ",daughterD1,daughterD0,mcPartDaughterD1->GetLabel(),mcPartDaughterD0->GetLabel()));
941  }
942  }
943 
944  AliDebug(2,Form(" label0=%d, label1=%d, label2=%d",fLabelArray[0],fLabelArray[1],fLabelArray[2]));
945 
946  SetAccCut(); // setting the pt and eta acceptance cuts
947 
948  checkCD = kTRUE;
949  return checkCD;
950 
951 }
952 //____________________________________________
953 Bool_t AliCFVertexingHFLctoV0bachelor::FillVectorFromMCarray(AliAODMCParticle *mcPartDaughterBachelor,
954  AliAODMCParticle *mcPartDaughterK0,
955  Double_t *vectorMC)
956 {
957  // fill the vector
958 
959  Bool_t bGenValues = kFALSE;
960 
961  AliAODMCParticle *mcPartV0DaughterPos = dynamic_cast<AliAODMCParticle*>(fmcArray->At(fLabelArray[1]));
962  AliAODMCParticle *mcPartV0DaughterNeg = dynamic_cast<AliAODMCParticle*>(fmcArray->At(fLabelArray[2]));
963  AliAODMCParticle *mcPartDaughterV0 = 0x0;
964 
965  if(!mcPartV0DaughterPos || !mcPartV0DaughterNeg) return bGenValues;
966 
967  if (TMath::Abs(mcPartDaughterK0->GetPdgCode())==311) {
968  Int_t daughterK0 = mcPartDaughterK0->GetDaughter(0);
969  if (daughterK0<=0) {
970  AliDebug(2, Form("The K0/K0bar particle doesn't have correct daughter, skipping!!"));
971  return bGenValues;
972  }
973  mcPartDaughterV0 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughterK0));
974  if (!mcPartDaughterV0) {
975  AliDebug(2,"The K0/K0bar daughter particle not found in MC array");
976  return bGenValues;
977  }
978  if (TMath::Abs(mcPartDaughterV0->GetPdgCode())!=310) {
979  AliDebug(2,"The K0/K0bar daughter particle is not a K0S");
980  return bGenValues;
981  }
982  } else if (TMath::Abs(mcPartDaughterK0->GetPdgCode())==3122) {
983  mcPartDaughterV0 = dynamic_cast<AliAODMCParticle*>(mcPartDaughterK0);
984  if (!mcPartDaughterV0) {
985  AliDebug(2,"The Lambda particle not found in MC array");
986  return bGenValues;
987  }
988  }
989 
990  if (!mcPartDaughterV0) {
991  AliDebug(2,"V0 particle not found in MC array");
992  return bGenValues;
993  }
994 
995  //Double_t cTLc = Ctau(fmcPartCandidate); // by default wrt Primary Vtx
996  //Double_t pTbach = mcPartDaughterBachelor->Pt(); // get the bachelor pT
997  Double_t pbach = mcPartDaughterBachelor->P(); // get the bachelor p
998 
999  Double_t vtx1[3] = {0,0,0}; // primary vertex
1000  Bool_t hasPrimVtx = fmcPartCandidate->XvYvZv(vtx1); // cm
1001 
1002  // getting vertex from daughters
1003  Double_t vtx1daughter0[3] = {0,0,0}; // secondary vertex from daughter 0
1004  Bool_t hasSecVtx1 = mcPartDaughterBachelor->XvYvZv(vtx1daughter0); //cm
1005  Double_t vtx1daughter1[3] = {0,0,0}; // secondary vertex from daughter 1
1006  Bool_t hasSecVtx2 = mcPartDaughterV0->XvYvZv(vtx1daughter1); //cm
1007  if (!hasPrimVtx || !hasSecVtx1 || !hasSecVtx2) {
1008  AliDebug(2,"At least one of Prim.vtx, V0vtx, BachelorVtx doesn't exist!");
1009  //return bGenValues;
1010  }
1011 
1012  if (TMath::Abs(vtx1daughter0[0]-vtx1daughter1[0])>1E-5 ||
1013  TMath::Abs(vtx1daughter0[1]-vtx1daughter1[1])>1E-5 ||
1014  TMath::Abs(vtx1daughter0[2]-vtx1daughter1[2])>1E-5) {
1015  AliError("Daughters have different secondary vertex, skipping the track");
1016  //return bGenValues;
1017  }
1018 
1019  // getting the momentum from the daughters
1020  Double_t px1[2] = {mcPartDaughterBachelor->Px(), mcPartDaughterV0->Px()};
1021  Double_t py1[2] = {mcPartDaughterBachelor->Py(), mcPartDaughterV0->Py()};
1022  Double_t pz1[2] = {mcPartDaughterBachelor->Pz(), mcPartDaughterV0->Pz()};
1023 
1024  Int_t nprongs = 2;
1025  Short_t charge = mcPartDaughterBachelor->Charge();
1026  Double_t d0[2] = {0.,0.};
1027  AliAODRecoDecayHF* decayLc = new AliAODRecoDecayHF(vtx1,vtx1daughter0,nprongs,charge,px1,py1,pz1,d0);
1028  Double_t cosPAwrtPrimVtxLc = decayLc->CosPointingAngle();
1029  delete decayLc;
1030 
1031  // getting vertex from daughters
1032  Double_t vtx2daughter0[3] = {0,0,0}; // secondary vertex from daughter 0
1033  Bool_t hasSecVtx3 = mcPartV0DaughterPos->XvYvZv(vtx2daughter0); //cm
1034  Double_t vtx2daughter1[3] = {0,0,0}; // secondary vertex from daughter 1
1035  Bool_t hasSecVtx4 = mcPartV0DaughterNeg->XvYvZv(vtx2daughter1); //cm
1036  if (!hasSecVtx3 || !hasSecVtx4) {
1037  AliDebug(2,"At least one of V0Posvtx, V0Negtx doesn't exist!");
1038  //return bGenValues;
1039  }
1040 
1041  if (TMath::Abs(vtx2daughter0[0]-vtx2daughter1[0])>1E-5 ||
1042  TMath::Abs(vtx2daughter0[1]-vtx2daughter1[1])>1E-5 ||
1043  TMath::Abs(vtx2daughter0[2]-vtx2daughter1[2])>1E-5) {
1044  AliError("Daughters have different secondary vertex, skipping the track");
1045  //return bGenValues;
1046  }
1047 
1048  // getting the momentum from the daughters
1049  Double_t px[2] = {mcPartV0DaughterPos->Px(), mcPartV0DaughterNeg->Px()};
1050  Double_t py[2] = {mcPartV0DaughterPos->Py(), mcPartV0DaughterNeg->Py()};
1051  Double_t pz[2] = {mcPartV0DaughterPos->Pz(), mcPartV0DaughterNeg->Pz()};
1052 
1053  nprongs = 2;
1054  charge = 0;
1055  AliAODRecoDecayHF* decay = new AliAODRecoDecayHF(vtx1,vtx2daughter0,nprongs,charge,px,py,pz,d0);
1056  Double_t cosPAwrtPrimVtxV0 = decay->CosPointingAngle();
1057  /*
1058  Double_t cTV0 = 0.; //ct
1059  if (fGenLcOption==kCountK0Sp) {
1060  cTV0 = decay->Ct(310); // by default wrt Primary Vtx
1061  } else if (fGenLcOption==kCountLambdapi) {
1062  cTV0 = decay->Ct(3122); // by default wrt Primary Vtx
1063  }
1064  */
1065 
1066  Double_t invMass = 0.; //invMass
1067  if (fGenLcOption==kCountK0Sp) {
1068  invMass = decay->InvMass2Prongs(0,1,211,211);
1069  } else if (fGenLcOption==kCountLambdapi) {
1070  if (fmcPartCandidate->GetPdgCode() == 4122)
1071  invMass = decay->InvMass2Prongs(0,1,2212,211);
1072  else if (fmcPartCandidate->GetPdgCode() ==-4122)
1073  invMass = decay->InvMass2Prongs(0,1,211,2212);
1074  }
1075  delete decay;
1076 
1077  vectorMC[0] = fmcPartCandidate->Pt();
1078  vectorMC[1] = fmcPartCandidate->Y() ;
1079  vectorMC[2] = fmcPartCandidate->Phi();
1080  vectorMC[3] = 0; // dummy value x MC, onTheFlyStatus
1081  vectorMC[4] = fzMCVertex;
1082  vectorMC[5] = fCentValue; // reconstructed centrality
1083  vectorMC[6] = 1; // dummy value x MC, fFake
1084  vectorMC[7] = fMultiplicity; // reconstructed multiplicity
1085 
1087  //vectorMC[8] = pTbach;
1088  vectorMC[8] = pbach;
1089  vectorMC[9] = mcPartDaughterV0->Pt();
1090  vectorMC[10] = mcPartDaughterV0->Y();
1091  vectorMC[11] = mcPartDaughterV0->Phi();
1092  vectorMC[12] = invMass;
1093  vectorMC[13] = 0; // dummy value x MC, V0 DCA
1094  vectorMC[14] = cosPAwrtPrimVtxV0;
1095  vectorMC[15] = cosPAwrtPrimVtxLc;
1096  //vectorMC[16] = cTV0*1.E4; // in micron
1097  //vectorMC[17] = cTLc*1.E4; // in micron
1098  }
1099 
1100  bGenValues = kTRUE;
1101  return bGenValues;
1102 
1103 }
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
ClassImp(AliAnalysisTaskDeltaPt) AliAnalysisTaskDeltaPt
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)
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.