1 /**************************************************************************
2 * Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 //-----------------------------------------------------------------------
19 // Class for HF corrections as a function of many variables and step
20 // Author : C. Zampolli, CERN
21 // D. Caffarri, Univ & INFN Padova caffarri@pd.infn.it
22 // Base class for HF Unfolding - agrelli@uu.nl
23 //-----------------------------------------------------------------------
25 #include "TParticle.h"
26 #include "TClonesArray.h"
27 #include "AliAODMCParticle.h"
28 #include "AliAODRecoDecayHF.h"
29 #include "AliAODRecoDecayHF2Prong.h"
30 #include "AliAODRecoDecayHF3Prong.h"
31 #include "AliAODRecoDecayHF4Prong.h"
32 #include "AliAODRecoCascadeHF.h"
33 #include "AliAODMCHeader.h"
34 #include "AliAODEvent.h"
36 #include "AliESDtrackCuts.h"
37 #include "AliESDtrack.h"
38 #include "AliCFTaskVertexingHF.h"
40 #include "AliCFVertexingHF.h"
42 //___________________________________________________________
43 AliCFVertexingHF::AliCFVertexingHF() :
46 fmcPartCandidate(0x0),
51 fFillFromGenerated(0),
54 fKeepDfromBOnly(kFALSE),
62 fFake(1.), // setting to MC value
63 fRejectIfNoQuark(kFALSE),
65 fConfiguration(AliCFTaskVertexingHF::kCheetah) // by default, setting the fast configuration
77 //_____________________________________________________
78 AliCFVertexingHF::AliCFVertexingHF(TClonesArray *mcArray, UShort_t originDselection) :
81 fmcPartCandidate(0x0),
86 fFillFromGenerated(0),
89 fKeepDfromBOnly(kFALSE),
97 fFake(1.), // setting to MC value
98 fRejectIfNoQuark(kFALSE),
100 fConfiguration(AliCFTaskVertexingHF::kCheetah) // by default, setting the fast configuration
103 // constructor with mcArray
106 SetDselection(originDselection);
110 //_______________________________________________________
111 AliCFVertexingHF::~AliCFVertexingHF()
117 if (fmcArray) fmcArray = 0x0;
118 if (fRecoCandidate) fRecoCandidate = 0x0;
119 if (fmcPartCandidate) fmcPartCandidate = 0x0;
121 delete [] fLabelArray;
129 delete [] fEtaAccCut;
134 //_____________________________________________________
135 AliCFVertexingHF& AliCFVertexingHF::operator=(const AliCFVertexingHF& c)
138 // assigment operator
142 TObject::operator=(c);
144 fmcArray = new TClonesArray(*(c.fmcArray));
145 delete fRecoCandidate;
146 fRecoCandidate = new AliAODRecoDecayHF(*(c.fRecoCandidate));
147 delete fmcPartCandidate;
148 fmcPartCandidate = new AliAODMCParticle(*(c.fmcPartCandidate));
149 fNDaughters = c.fNDaughters;
151 fzPrimVertex = c.fzPrimVertex;
152 fzMCVertex = c.fzMCVertex;
153 fFillFromGenerated = c.fFillFromGenerated;
154 fOriginDselection = c.fOriginDselection;
155 fKeepDfromB = c.fKeepDfromB;
156 fKeepDfromBOnly = c.fKeepDfromBOnly;
157 fmcLabel = c.fmcLabel;
159 fCentValue=c.fCentValue;
160 fFakeSelection=c.fFakeSelection;
162 fRejectIfNoQuark=c.fRejectIfNoQuark;
164 delete [] fLabelArray;
166 delete [] fEtaAccCut;
167 fLabelArray = new Int_t[fProngs];
168 fPtAccCut = new Float_t[fProngs];
169 fEtaAccCut = new Float_t[fProngs];
170 for(Int_t iP=0; iP<fProngs; iP++){
171 fLabelArray[iP]=c.fLabelArray[iP];
172 fPtAccCut[iP]=c.fPtAccCut[iP];
173 fEtaAccCut[iP]=c.fEtaAccCut[iP];
176 fMultiplicity=c.fMultiplicity;
177 fConfiguration=c.fConfiguration;
183 //____________________________________________________
184 AliCFVertexingHF::AliCFVertexingHF(const AliCFVertexingHF &c) :
189 fNDaughters(c.fNDaughters),
191 fzPrimVertex(c.fzPrimVertex),
192 fzMCVertex(c.fzMCVertex),
193 fFillFromGenerated(c.fFillFromGenerated),
194 fOriginDselection (c.fOriginDselection),
195 fKeepDfromB (c.fKeepDfromB),
196 fKeepDfromBOnly (c.fKeepDfromBOnly),
197 fmcLabel(c.fmcLabel),
200 fCentValue(c.fCentValue),
203 fFakeSelection(c.fFakeSelection),
205 fRejectIfNoQuark(c.fRejectIfNoQuark),
206 fMultiplicity(c.fMultiplicity),
207 fConfiguration(c.fConfiguration)
213 fmcArray = new TClonesArray(*(c.fmcArray));
214 delete fRecoCandidate;
215 fRecoCandidate = new AliAODRecoDecayHF(*(c.fRecoCandidate));
216 delete fmcPartCandidate;
217 fmcPartCandidate = new AliAODMCParticle(*(c.fmcPartCandidate));
219 delete [] fLabelArray;
221 delete [] fEtaAccCut;
222 fLabelArray = new Int_t[fProngs];
223 fPtAccCut = new Float_t[fProngs];
224 fEtaAccCut = new Float_t[fProngs];
225 if (c.fLabelArray) memcpy(fLabelArray,c.fLabelArray,fProngs*sizeof(Int_t));
226 if (c.fPtAccCut) memcpy(fPtAccCut,c.fPtAccCut,fProngs*sizeof(Int_t));
227 if (c.fEtaAccCut) memcpy(fEtaAccCut,c.fEtaAccCut,fProngs*sizeof(Int_t));
231 //___________________________________________________________
232 void AliCFVertexingHF::SetDselection(UShort_t originDselection)
234 // setting the way the D0 will be selected
235 // 0 --> only from c quarks
236 // 1 --> only from b quarks
237 // 2 --> from both c quarks and b quarks
239 fOriginDselection = originDselection;
241 if (fOriginDselection == 0) {
242 fKeepDfromB = kFALSE;
243 fKeepDfromBOnly = kFALSE;
246 if (fOriginDselection == 1) {
248 fKeepDfromBOnly = kTRUE;
251 if (fOriginDselection == 2) {
253 fKeepDfromBOnly = kFALSE;
259 //______________________________________________________
260 void AliCFVertexingHF::SetMCCandidateParam(Int_t label)
263 // setting the parameters (candidate and n. daughters)
266 fmcPartCandidate = dynamic_cast <AliAODMCParticle*> (fmcArray->At(label));
267 if (fmcPartCandidate){
268 fNDaughters = fmcPartCandidate->GetNDaughters();
271 AliError(Form("Dynamic cast failed, fNdaughters will remain set to %d",fNDaughters));
276 //____________________________________________________________
277 Int_t AliCFVertexingHF::MCcquarkCounting(AliAODMCParticle* mcPart) const
280 // counting the c-quarks
285 if (mcPart->GetPdgCode() == 4) cquarks++;
286 if (mcPart->GetPdgCode() == -4) cquarks++;
289 AliWarning("Particle not found in tree, skipping\n");
296 //________________________________________________________
297 Bool_t AliCFVertexingHF::CheckMCPartFamily(AliAODMCParticle */*mcPart*/, TClonesArray */*mcArray*/) const
300 //checking the family
303 Int_t pdgGranma = CheckOrigin();
305 AliDebug(3, Form("pdgGranma = %d", pdgGranma));
307 if (pdgGranma == -99999){
308 AliDebug(2, "This particle does not have a quark in his genealogy\n");
311 if (pdgGranma == -9999){
312 AliDebug(2,"This particle come from a B decay channel but according to the settings of the task, we keep only the prompt charm particles\n");
316 if (pdgGranma == -999){
317 AliDebug(2,"This particle come from a prompt charm particles but according to the settings of the task, we want only the ones coming from B\n");
321 if (!CheckMCDaughters()) {
322 AliDebug(3, "CheckMCDaughters false");
325 if (!CheckMCChannelDecay()) {
326 AliDebug(3, "CheckMCChannelDecay false");
332 //_________________________________________________________________________________________________
333 Int_t AliCFVertexingHF::CheckOrigin() const
336 // checking whether the mother of the particles come from a charm or a bottom quark
341 mother = fmcPartCandidate->GetMother();
343 Int_t abspdgGranma =0;
344 Bool_t isFromB=kFALSE;
345 Bool_t isQuarkFound=kFALSE;
348 AliDebug(2,Form("mother at step %d = %d", istep, mother));
349 AliAODMCParticle* mcGranma = dynamic_cast<AliAODMCParticle*>(fmcArray->At(mother));
351 pdgGranma = mcGranma->GetPdgCode();
352 AliDebug(2,Form("Pdg mother at step %d = %d", istep, pdgGranma));
353 abspdgGranma = TMath::Abs(pdgGranma);
354 if ((abspdgGranma > 500 && abspdgGranma < 600) || (abspdgGranma > 5000 && abspdgGranma < 6000)){
357 if(abspdgGranma==4 || abspdgGranma==5) isQuarkFound=kTRUE;
358 mother = mcGranma->GetMother();
359 AliDebug(3, Form("mother = %d", mother));
361 AliError("Failed casting the mother particle!");
366 if(fRejectIfNoQuark && !isQuarkFound) {
371 return -9999; //skip particle if come from a B meson.
375 if (fKeepDfromBOnly) {
382 //___________________________________________
383 Bool_t AliCFVertexingHF::CheckMCDaughters()const
386 // checking the daughters
389 AliAODMCParticle *mcPartDaughter;
390 Bool_t checkDaughters = kFALSE;
392 Int_t label0 = fmcPartCandidate->GetDaughter(0);
393 Int_t label1 = fmcPartCandidate->GetDaughter(1);
394 AliDebug(3,Form("label0 = %d, label1 = %d", label0, label1));
395 if (label1<=0 || label0 <= 0){
396 AliDebug(2, Form("The MC particle doesn't have correct daughters, skipping!!"));
397 return checkDaughters;
400 if (fLabelArray == 0x0) {
401 return checkDaughters;
404 for (Int_t iProng = 0; iProng<fProngs; iProng++){
405 AliDebug(3, Form("fLabelArray[%d] = %d", iProng, fLabelArray[iProng]));
407 AliDebug(3, Form("Entries in MC array = %d (fast = %d)", fmcArray->GetEntries(), fmcArray->GetEntriesFast()));
408 for (Int_t iProng = 0; iProng<fProngs; iProng++){
409 AliDebug(3, Form("fLabelArray[%d] = %d", iProng, fLabelArray[iProng]));
410 mcPartDaughter = dynamic_cast<AliAODMCParticle*>(fmcArray->At(fLabelArray[iProng]));
411 if (!mcPartDaughter) {
412 AliWarning("At least one Daughter Particle not found in tree, skipping");
413 return checkDaughters;
417 checkDaughters = kTRUE;
418 return checkDaughters;
421 //______________________________________________________
422 Bool_t AliCFVertexingHF::FillMCContainer(Double_t *containerInputMC)
425 // fill the container for Generator level selection
428 Bool_t mcContainerFilled = kFALSE;
430 Double_t* vectorMC = new Double_t[fNVar];
431 for (Int_t iVar = 0; iVar<fNVar; iVar++) vectorMC[iVar]= 9999.;
433 if (GetGeneratedValuesFromMCParticle(&vectorMC[0])){
434 for (Int_t iVar = 0; iVar<fNVar; iVar++){
435 containerInputMC[iVar] = vectorMC[iVar];
437 mcContainerFilled = kTRUE;
440 AliDebug(3, "We could not fill the array for the container");
444 return mcContainerFilled;
447 //______________________________________________________
448 Bool_t AliCFVertexingHF::FillRecoContainer(Double_t *containerInput)
451 // fill the container for Reconstrucred level selection
454 Bool_t recoContainerFilled = kFALSE;
455 Double_t* vectorValues = new Double_t[fNVar];
456 Double_t* vectorReco = new Double_t[fNVar];
457 for (Int_t iVar = 0; iVar<fNVar; iVar++) {
459 vectorValues[iVar]= 9999.;
460 vectorReco[iVar]=9999.;
463 if(fFillFromGenerated){
464 //filled with MC values
465 if (GetGeneratedValuesFromMCParticle(&vectorValues[0])){
466 for (Int_t iVar = 0; iVar<fNVar; iVar++){
467 containerInput[iVar] = vectorValues[iVar];
469 recoContainerFilled = kTRUE;
473 //filled with Reco values
475 if (GetRecoValuesFromCandidate(&vectorReco[0])){
476 for (Int_t iVar = 0; iVar<fNVar; iVar++){
477 containerInput[iVar] = vectorReco[iVar];
479 recoContainerFilled = kTRUE;
483 delete [] vectorValues;
484 delete [] vectorReco;
488 return recoContainerFilled;
491 //_____________________________________________________
492 Bool_t AliCFVertexingHF::MCAcceptanceStep() const
495 // checking the MC acceptance step
498 Bool_t bMCAccStep = kFALSE;
500 AliAODMCParticle *mcPartDaughter;
501 Int_t label0 = fmcPartCandidate->GetDaughter(0);
502 Int_t label1 = fmcPartCandidate->GetDaughter(1);
503 if (label1<=0 || label0 <= 0){
504 AliDebug(2, Form("The MC particle doesn't have correct daughters, skipping!!"));
508 if (fLabelArray == 0x0) {
512 for (Int_t iProng = 0; iProng<fProngs; iProng++){
513 mcPartDaughter = dynamic_cast<AliAODMCParticle*>(fmcArray->At(fLabelArray[iProng]));
514 if (!mcPartDaughter) {
515 AliWarning("At least one Daughter Particle not found in tree, skipping");
518 Double_t eta = mcPartDaughter->Eta();
519 Double_t pt = mcPartDaughter->Pt();
521 //set values of eta and pt in the constructor.
522 // if (TMath::Abs(eta) > 0.9 || pt < 0.1){
523 if (TMath::Abs(eta) > fEtaAccCut[iProng] || pt < fPtAccCut[iProng]){
524 AliDebug(3,Form("At least one daughter has eta or pt outside the required range (|eta| = %f, pt = %f, should be |eta| < %f, pt > %f \n", TMath::Abs(eta), pt, fEtaAccCut[iProng], fPtAccCut[iProng]));
532 //_____________________________________________________
533 Bool_t AliCFVertexingHF::MCRefitStep(AliAODEvent *aodEvent, AliESDtrackCuts **trackCuts) const
536 // check on the kTPCrefit and kITSrefit conditions of the daughters
538 Bool_t bRefitStep = kFALSE;
540 Int_t label0 = fmcPartCandidate->GetDaughter(0);
541 Int_t label1 = fmcPartCandidate->GetDaughter(1);
543 if (label1<=0 || label0 <= 0){
544 AliDebug(2, Form("The MC particle doesn't have correct daughters, skipping!!"));
548 if (fLabelArray == 0x0) {
552 Int_t foundDaughters = 0;
553 Int_t* temp = new Int_t[fProngs];
554 for (Int_t ilabel = 0; ilabel<fProngs; ilabel++){
555 temp[ilabel] = fLabelArray[ilabel];
558 // if (trackCuts->GetRequireTPCRefit() || trackCuts->GetRequireITSRefit()){
560 for(Int_t iaod =0; iaod<aodEvent->GetNumberOfTracks(); iaod++){
561 AliAODTrack *track = (AliAODTrack*)aodEvent->GetTrack(iaod);
562 if(track->GetStatus()&AliESDtrack::kITSpureSA) continue;
563 Bool_t foundTrack = kFALSE;
565 for (Int_t ilabel = 0; ilabel<fProngs; ilabel++){
566 AliDebug(3,Form("fLabelArray[%d] = %d, track->GetLabel() = %d",ilabel,fLabelArray[ilabel],TMath::Abs(track->GetLabel())));
567 if ((track->GetLabel()<0)&&(fFakeSelection==1)) continue;
568 if ((track->GetLabel()>0)&&(fFakeSelection==2)) continue;
570 if (TMath::Abs(track->GetLabel()) == temp[ilabel]) {
579 AliDebug(4,Form("daughter %d \n",foundDaughters));
580 if(trackCuts[prongindex]->GetRequireTPCRefit()){
581 if(track->GetStatus()&AliESDtrack::kTPCrefit) {
585 AliDebug(3, "Refit cut not passed , missing TPC refit\n");
592 if (trackCuts[prongindex]->GetRequireITSRefit()) {
593 if(track->GetStatus()&AliESDtrack::kITSrefit){
597 AliDebug(3, "Refit cut not passed , missing ITS refit\n");
604 if (foundDaughters == fProngs){
611 if (foundDaughters== fProngs) return bRefitStep;
615 //____________________________________________________________________________
617 Bool_t AliCFVertexingHF::RecoStep()
620 //check also vertex and ITS Refit and TPC Refit
623 Bool_t bRecoStep = kFALSE;
624 Int_t mcLabel = GetMCLabel();
627 AliDebug(2,"No MC particle found");
631 fmcPartCandidate = (AliAODMCParticle*)fmcArray->At(mcLabel);
632 if (!fmcPartCandidate){
633 AliWarning("Could not find associated MC in AOD MC tree");
638 Int_t pdgGranma = CheckOrigin();
640 if (pdgGranma == -99999){
641 AliDebug(2,"This particle does not have a quark in his genealogy\n");
644 if (pdgGranma == -9999){
645 AliDebug(2,"This particle come from a B decay channel but according to the settings of the task, we keep only prompt charm particles\n");
649 if (pdgGranma == -999){
650 AliDebug(2,"This particle come from a prompt charm particle but according to the settings of the task, we want only the ones coming from B\n");
657 //____________________________________________
658 Double_t AliCFVertexingHF::GetEtaProng(Int_t iProng) const
661 // getting eta of the prong
665 Double_t etaProng = fRecoCandidate->EtaProng(iProng);
670 //______________________________________________________
671 Double_t AliCFVertexingHF::GetPtProng(Int_t iProng) const
674 // getting pt of the prong
678 Double_t ptProng = fRecoCandidate->PtProng(iProng);
685 //____________________________________________________________________
687 Bool_t AliCFVertexingHF::RecoAcceptStep(AliESDtrackCuts **trackCuts) const
690 // reco Acceptance step
693 Bool_t bRecoAccStep = kFALSE;
695 Float_t etaCutMin=0, ptCutMin=0, etaCutMax=0, ptCutMax=0;
697 Float_t etaProng=0., ptProng=0.;
699 for (Int_t iProng =0; iProng<fProngs; iProng++){
701 trackCuts[iProng]->GetEtaRange(etaCutMin, etaCutMax);
702 trackCuts[iProng]->GetPtRange(ptCutMin, ptCutMax);
703 etaProng = GetEtaProng(iProng);
704 ptProng = GetPtProng(iProng);
706 Bool_t acceptanceProng = (etaProng>etaCutMin && etaProng<etaCutMax && ptProng>ptCutMin && ptProng<ptCutMax);
707 if (!acceptanceProng) {
708 AliDebug(2,"At least one reconstructed prong isn't in the acceptance\n");
716 //___________________________________________________________
718 Bool_t AliCFVertexingHF::FillUnfoldingMatrix(UInt_t pdg, Double_t fill[4]) const
721 // filling the unfolding matrix
724 if(fmcPartCandidate){
726 fill[0] = GetPtCand();
727 fill[1] = GetYCand(pdg);
729 fill[2] = fmcPartCandidate->Pt();
730 fill[3] = fmcPartCandidate->Y();
737 //___________________________________________________________
739 Int_t AliCFVertexingHF::CheckReflexion(Char_t isSign)
742 // check for reflexion (particle/antiparticle)
745 Int_t mcLabel = GetMCLabel();
748 AliDebug(2,"No MC particle found");
752 fmcPartCandidate = (AliAODMCParticle*)fmcArray->At(mcLabel);
753 if (!fmcPartCandidate){
754 AliWarning("Could not find associated MC in AOD MC tree");
759 if(fmcPartCandidate->GetPdgCode()>0) {
760 if (isSign == 1){ // I ask for antiparticle only
761 AliDebug(2,"candidate is particle, I ask for antiparticle only");
764 return 1; // particle
766 else if(fmcPartCandidate->GetPdgCode()<0) {
767 if (isSign == 0){ // I ask for particle only
768 AliDebug(2,"candidate is antiparticle, I ask for particle only");
771 return 2; // antiparticle
773 else return 0; // ....shouldn't be...
776 //___________________________________________________________
778 Bool_t AliCFVertexingHF::SetLabelArray()
781 // setting the label arrays
784 Bool_t bLabelArray = kFALSE;
786 fLabelArray = new Int_t[fProngs];
788 AliAODMCParticle *mcPartDaughter;
789 Int_t label0 = fmcPartCandidate->GetDaughter(0);
790 Int_t label1 = fmcPartCandidate->GetDaughter(1);
791 AliDebug(2, Form("label0 = %d, label1 = %d", label0, label1));
792 if (label1<=0 || label0 <= 0){
793 AliDebug(2, Form("The MC particle doesn't have correct daughters, skipping!!"));
794 delete [] fLabelArray;
798 AliAODMCParticle* tmp0 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(label0));
799 AliAODMCParticle* tmp1 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(label1));
800 AliDebug(2, Form("label0 = %d (pdg = %d), label1 = %d (pdg = %d)", label0, tmp0->GetPdgCode(), label1, tmp1->GetPdgCode()));
802 if (label1 - label0 == fProngs-1){
803 for (Int_t iProng = 0; iProng<fProngs; iProng++){
804 mcPartDaughter = dynamic_cast<AliAODMCParticle*>(fmcArray->At(label0+iProng));
806 fLabelArray[iProng] = mcPartDaughter->GetLabel();
809 AliError("Failed casting the daughter particle, returning a NULL label array");
810 delete [] fLabelArray;
817 // resonant decay channel
818 else if (label1 - label0 == fProngs-2 && fProngs > 2){
819 AliDebug(3, "In the resonance decay channel");
820 Int_t labelFirstDau = fmcPartCandidate->GetDaughter(0);
821 Int_t foundDaughters = 0;
822 for(Int_t iDau=0; iDau<fProngs-1; iDau++){
823 Int_t iLabelDau = labelFirstDau+iDau;
824 AliAODMCParticle* part = dynamic_cast<AliAODMCParticle*>(fmcArray->At(iLabelDau));
826 AliError("Wrong particle type in fmcArray");
827 delete [] fLabelArray;
831 Int_t pdgCode=TMath::Abs(part->GetPdgCode());
832 AliDebug(3, Form("Prong %d had pdg = %d", iDau, pdgCode));
833 if(pdgCode==211 || pdgCode==321 || pdgCode==2212){
835 fLabelArray[foundDaughters] = part->GetLabel();
836 AliDebug(3, Form("part found at %d has label = %d", iLabelDau, part->GetLabel()));
837 AliDebug(3, Form("fLabelArray[%d] = %d", foundDaughters, fLabelArray[foundDaughters]));
841 AliError("Error while casting particle! returning a NULL array");
842 delete [] fLabelArray;
847 // added K0S case - Start
848 else if (pdgCode==311) {
849 AliDebug(3, Form("K0S case, foundDaughters = %d", foundDaughters));
850 if (part->GetNDaughters()!=1) {
851 delete [] fLabelArray;
855 Int_t labelK0Dau = part->GetDaughter(0);
856 AliAODMCParticle* partK0S = dynamic_cast<AliAODMCParticle*>(fmcArray->At(labelK0Dau));
858 AliError("Error while casting particle! returning a NULL array");
859 delete [] fLabelArray;
863 Int_t nDauRes = partK0S->GetNDaughters();
864 AliDebug(3, Form("nDauRes = %d", nDauRes));
865 if (nDauRes!=2 || partK0S->GetPdgCode() != 310) {
866 AliDebug(2, "No K0S on no 2-body decay");
867 delete [] fLabelArray;
871 Int_t labelFirstDauRes = partK0S->GetDaughter(0);
872 AliDebug(2, Form("Found K0S (%d)", labelK0Dau));
873 for(Int_t iDauRes=0; iDauRes<nDauRes; iDauRes++){
874 Int_t iLabelDauRes = labelFirstDauRes+iDauRes;
875 AliAODMCParticle* dauRes = dynamic_cast<AliAODMCParticle*>(fmcArray->At(iLabelDauRes));
876 AliDebug(3, Form("daughter = %d, pointer = %p, with label = %d", iLabelDauRes, dauRes, dauRes->GetLabel()));
878 AliDebug(3, Form("PDG code = %d", dauRes->GetPdgCode()));
879 if (TMath::Abs(dauRes->GetPdgCode())!=211) {
880 AliDebug(2,"K0S doesn't decay in 2 charged pions!");
881 delete [] fLabelArray;
886 fLabelArray[foundDaughters] = iLabelDauRes; // N.B.: do not use dauRes->GetLabel()!!!! it is wrong!!!
887 AliDebug(3, Form("Setting fLabelArray[%d] = %d (before it was %d)", foundDaughters, iLabelDauRes, dauRes->GetLabel()));
892 AliError("Error while casting resonant daughter! returning a NULL array");
893 delete [] fLabelArray;
899 // added K0S case - End
901 Int_t nDauRes=part->GetNDaughters();
902 AliDebug(3, Form("nDauRes = %d", nDauRes));
904 AliDebug(3, Form("nDauRes = %d, different from 2", nDauRes));
905 Int_t labelFirstDauResTest = part->GetDaughter(0);
906 for(Int_t iDauRes=0; iDauRes<nDauRes; iDauRes++){
907 Int_t iLabelDauResTest = labelFirstDauResTest+iDauRes;
908 AliAODMCParticle* dauRes = dynamic_cast<AliAODMCParticle*>(fmcArray->At(iLabelDauResTest));
910 AliDebug(3, Form("pdg of daugh %d = %d", iDauRes, dauRes->GetPdgCode()));
913 delete [] fLabelArray;
917 Int_t labelFirstDauRes = part->GetDaughter(0);
918 for(Int_t iDauRes=0; iDauRes<nDauRes; iDauRes++){
919 Int_t iLabelDauRes = labelFirstDauRes+iDauRes;
920 AliAODMCParticle* dauRes = dynamic_cast<AliAODMCParticle*>(fmcArray->At(iLabelDauRes));
922 fLabelArray[foundDaughters] = dauRes->GetLabel();
926 AliError("Error while casting resonant daughter! returning a NULL array");
927 delete [] fLabelArray;
934 if (foundDaughters != fProngs){
935 AliDebug(3, Form("foundDaughters (%d) != fProngs (%d)", foundDaughters, fProngs));
936 delete [] fLabelArray;
941 // wrong correspondance label <--> prongs
943 delete [] fLabelArray;
947 AliDebug(3, "Setting AccCuts");
948 SetAccCut(); // setting the pt and eta acceptance cuts
953 //___________________________________________________________
955 void AliCFVertexingHF::SetPtAccCut(Float_t* ptAccCut)
958 // setting the pt cut to be used in the Acceptance steps (MC+Reco)
962 for (Int_t iP=0; iP<fProngs; iP++){
963 fPtAccCut[iP]=ptAccCut[iP];
971 //___________________________________________________________
973 void AliCFVertexingHF::SetEtaAccCut(Float_t* etaAccCut)
976 // setting the eta cut to be used in the Acceptance steps (MC+Reco)
980 for (Int_t iP=0; iP<fProngs; iP++){
981 fEtaAccCut[iP]=etaAccCut[iP];
986 //___________________________________________________________
988 void AliCFVertexingHF::SetAccCut(Float_t* ptAccCut, Float_t* etaAccCut)
991 // setting the pt and eta cut to be used in the Acceptance steps (MC+Reco)
995 for (Int_t iP=0; iP<fProngs; iP++){
996 fPtAccCut[iP]=ptAccCut[iP];
997 fEtaAccCut[iP]=etaAccCut[iP];
1003 //___________________________________________________________
1005 void AliCFVertexingHF::SetAccCut()
1008 // setting the pt and eta cut to be used in the Acceptance steps (MC+Reco)
1012 for (Int_t iP=0; iP<fProngs; iP++){