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, ptCutMin, etaCutMax, ptCutMax;
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 AliAODMCParticle* tmp0 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(label0));
793 AliAODMCParticle* tmp1 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(label1));
795 AliDebug(2, Form("label0 = %d (pdg = %d), label1 = %d (pdg = %d)", label0, tmp0->GetPdgCode(), label1, tmp1->GetPdgCode()));
796 if (label1<=0 || label0 <= 0){
797 AliDebug(2, Form("The MC particle doesn't have correct daughters, skipping!!"));
798 delete [] fLabelArray;
803 if (label1 - label0 == fProngs-1){
804 for (Int_t iProng = 0; iProng<fProngs; iProng++){
805 mcPartDaughter = dynamic_cast<AliAODMCParticle*>(fmcArray->At(label0+iProng));
807 fLabelArray[iProng] = mcPartDaughter->GetLabel();
810 AliError("Failed casting the daughter particle, returning a NULL label array");
811 delete [] fLabelArray;
818 // resonant decay channel
819 else if (label1 - label0 == fProngs-2 && fProngs > 2){
820 AliDebug(3, "In the resonance decay channel");
821 Int_t labelFirstDau = fmcPartCandidate->GetDaughter(0);
822 Int_t foundDaughters = 0;
823 for(Int_t iDau=0; iDau<fProngs-1; iDau++){
824 Int_t iLabelDau = labelFirstDau+iDau;
825 AliAODMCParticle* part = dynamic_cast<AliAODMCParticle*>(fmcArray->At(iLabelDau));
827 AliError("Wrong particle type in fmcArray");
828 delete [] fLabelArray;
832 Int_t pdgCode=TMath::Abs(part->GetPdgCode());
833 AliDebug(3, Form("Prong %d had pdg = %d", iDau, pdgCode));
834 if(pdgCode==211 || pdgCode==321 || pdgCode==2212){
836 fLabelArray[foundDaughters] = part->GetLabel();
837 AliDebug(3, Form("part found at %d has label = %d", iLabelDau, part->GetLabel()));
838 AliDebug(3, Form("fLabelArray[%d] = %d", foundDaughters, fLabelArray[foundDaughters]));
842 AliError("Error while casting particle! returning a NULL array");
843 delete [] fLabelArray;
848 // added K0S case - Start
849 else if (pdgCode==311) {
850 AliDebug(3, Form("K0S case, foundDaughters = %d", foundDaughters));
851 if (part->GetNDaughters()!=1) {
852 delete [] fLabelArray;
856 Int_t labelK0Dau = part->GetDaughter(0);
857 AliAODMCParticle* partK0S = dynamic_cast<AliAODMCParticle*>(fmcArray->At(labelK0Dau));
859 AliError("Error while casting particle! returning a NULL array");
860 delete [] fLabelArray;
864 Int_t nDauRes = partK0S->GetNDaughters();
865 AliDebug(3, Form("nDauRes = %d", nDauRes));
866 if (nDauRes!=2 || partK0S->GetPdgCode() != 310) {
867 AliDebug(2, "No K0S on no 2-body decay");
868 delete [] fLabelArray;
872 Int_t labelFirstDauRes = partK0S->GetDaughter(0);
873 AliDebug(2, Form("Found K0S (%d)", labelK0Dau));
874 for(Int_t iDauRes=0; iDauRes<nDauRes; iDauRes++){
875 Int_t iLabelDauRes = labelFirstDauRes+iDauRes;
876 AliAODMCParticle* dauRes = dynamic_cast<AliAODMCParticle*>(fmcArray->At(iLabelDauRes));
877 AliDebug(3, Form("daughter = %d, pointer = %p, with label = %d", iLabelDauRes, dauRes, dauRes->GetLabel()));
879 AliDebug(3, Form("PDG code = %d", dauRes->GetPdgCode()));
880 if (TMath::Abs(dauRes->GetPdgCode())!=211) {
881 AliDebug(2,"K0S doesn't decay in 2 charged pions!");
882 delete [] fLabelArray;
887 fLabelArray[foundDaughters] = iLabelDauRes; // N.B.: do not use dauRes->GetLabel()!!!! it is wrong!!!
888 AliDebug(3, Form("Setting fLabelArray[%d] = %d (before it was %d)", foundDaughters, iLabelDauRes, dauRes->GetLabel()));
893 AliError("Error while casting resonant daughter! returning a NULL array");
894 delete [] fLabelArray;
900 // added K0S case - End
902 Int_t nDauRes=part->GetNDaughters();
903 AliDebug(3, Form("nDauRes = %d", nDauRes));
905 AliDebug(3, Form("nDauRes = %d, different from 2", nDauRes));
906 Int_t labelFirstDauResTest = part->GetDaughter(0);
907 for(Int_t iDauRes=0; iDauRes<nDauRes; iDauRes++){
908 Int_t iLabelDauResTest = labelFirstDauResTest+iDauRes;
909 AliAODMCParticle* dauRes = dynamic_cast<AliAODMCParticle*>(fmcArray->At(iLabelDauResTest));
911 AliDebug(3, Form("pdg of daugh %d = %d", iDauRes, dauRes->GetPdgCode()));
914 delete [] fLabelArray;
918 Int_t labelFirstDauRes = part->GetDaughter(0);
919 for(Int_t iDauRes=0; iDauRes<nDauRes; iDauRes++){
920 Int_t iLabelDauRes = labelFirstDauRes+iDauRes;
921 AliAODMCParticle* dauRes = dynamic_cast<AliAODMCParticle*>(fmcArray->At(iLabelDauRes));
923 fLabelArray[foundDaughters] = dauRes->GetLabel();
927 AliError("Error while casting resonant daughter! returning a NULL array");
928 delete [] fLabelArray;
935 if (foundDaughters != fProngs){
936 AliDebug(3, Form("foundDaughters (%d) != fProngs (%d)", foundDaughters, fProngs));
937 delete [] fLabelArray;
942 // wrong correspondance label <--> prongs
944 delete [] fLabelArray;
948 AliDebug(3, "Setting AccCuts");
949 SetAccCut(); // setting the pt and eta acceptance cuts
954 //___________________________________________________________
956 void AliCFVertexingHF::SetPtAccCut(Float_t* ptAccCut)
959 // setting the pt cut to be used in the Acceptance steps (MC+Reco)
963 for (Int_t iP=0; iP<fProngs; iP++){
964 fPtAccCut[iP]=ptAccCut[iP];
972 //___________________________________________________________
974 void AliCFVertexingHF::SetEtaAccCut(Float_t* etaAccCut)
977 // setting the eta cut to be used in the Acceptance steps (MC+Reco)
981 for (Int_t iP=0; iP<fProngs; iP++){
982 fEtaAccCut[iP]=etaAccCut[iP];
987 //___________________________________________________________
989 void AliCFVertexingHF::SetAccCut(Float_t* ptAccCut, Float_t* etaAccCut)
992 // setting the pt and eta cut to be used in the Acceptance steps (MC+Reco)
996 for (Int_t iP=0; iP<fProngs; iP++){
997 fPtAccCut[iP]=ptAccCut[iP];
998 fEtaAccCut[iP]=etaAccCut[iP];
1004 //___________________________________________________________
1006 void AliCFVertexingHF::SetAccCut()
1009 // setting the pt and eta cut to be used in the Acceptance steps (MC+Reco)
1013 for (Int_t iP=0; iP<fProngs; iP++){