25 #include "TParticle.h" 26 #include "TClonesArray.h" 27 #include "AliAODMCParticle.h" 33 #include "AliAODMCHeader.h" 34 #include "AliAODEvent.h" 36 #include "AliESDtrackCuts.h" 37 #include "AliESDtrack.h" 46 fmcPartCandidate(0x0),
51 fFillFromGenerated(0),
54 fKeepDfromBOnly(kFALSE),
63 fRejectIfNoQuark(kFALSE),
147 TObject::operator=(c);
283 AliError(Form(
"Dynamic cast failed, fNdaughters will remain set to %d",
fNDaughters));
297 if (mcPart->GetPdgCode() == 4) cquarks++;
298 if (mcPart->GetPdgCode() == -4) cquarks++;
301 AliWarning(
"Particle not found in tree, skipping\n");
317 AliDebug(3, Form(
"pdgGranma = %d", pdgGranma));
319 if (pdgGranma == -99999){
320 AliDebug(2,
"This particle does not have a quark in his genealogy\n");
323 if (pdgGranma == -9999){
324 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");
328 if (pdgGranma == -999){
329 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");
334 AliDebug(3,
"CheckMCDaughters false");
338 AliDebug(3,
"CheckMCChannelDecay false");
355 Int_t abspdgGranma =0;
357 Bool_t isQuarkFound=kFALSE;
360 AliDebug(2,Form(
"mother at step %d = %d", istep, mother));
361 AliAODMCParticle* mcGranma =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(mother));
363 pdgGranma = mcGranma->GetPdgCode();
364 AliDebug(2,Form(
"Pdg mother at step %d = %d", istep, pdgGranma));
365 abspdgGranma = TMath::Abs(pdgGranma);
366 if ((abspdgGranma > 500 && abspdgGranma < 600) || (abspdgGranma > 5000 && abspdgGranma < 6000)){
369 if(abspdgGranma==4 || abspdgGranma==5) isQuarkFound=kTRUE;
370 mother = mcGranma->GetMother();
371 AliDebug(3, Form(
"mother = %d", mother));
373 AliError(
"Failed casting the mother particle!");
401 AliAODMCParticle *mcPartDaughter;
402 Bool_t checkDaughters = kFALSE;
406 AliDebug(3,Form(
"label0 = %d, label1 = %d", label0, label1));
407 if (label1<=0 || label0 <= 0){
408 AliDebug(2, Form(
"The MC particle doesn't have correct daughters, skipping!!"));
409 return checkDaughters;
413 return checkDaughters;
417 AliDebug(3, Form(
"fLabelArray[%d] = %d", iProng,
fLabelArray[iProng]));
419 AliDebug(3, Form(
"Entries in MC array = %d (fast = %d)",
fmcArray->GetEntries(),
fmcArray->GetEntriesFast()));
421 AliDebug(3, Form(
"fLabelArray[%d] = %d", iProng,
fLabelArray[iProng]));
423 if (!mcPartDaughter) {
424 AliWarning(
"At least one Daughter Particle not found in tree, skipping");
425 return checkDaughters;
429 checkDaughters = kTRUE;
430 return checkDaughters;
440 Bool_t mcContainerFilled = kFALSE;
443 for (
Int_t iVar = 0; iVar<
fNVar; iVar++) vectorMC[iVar]= 9999.;
447 containerInputMC[iVar] = vectorMC[iVar];
449 mcContainerFilled = kTRUE;
452 AliDebug(3,
"We could not fill the array for the container");
456 return mcContainerFilled;
466 Bool_t recoContainerFilled = kFALSE;
471 vectorValues[iVar]= 9999.;
472 vectorReco[iVar]=9999.;
479 containerInput[iVar] = vectorValues[iVar];
481 recoContainerFilled = kTRUE;
489 containerInput[iVar] = vectorReco[iVar];
491 recoContainerFilled = kTRUE;
495 delete [] vectorValues;
496 delete [] vectorReco;
500 return recoContainerFilled;
510 Bool_t bMCAccStep = kFALSE;
512 AliAODMCParticle *mcPartDaughter;
515 if (label1<=0 || label0 <= 0){
516 AliDebug(2, Form(
"The MC particle doesn't have correct daughters, skipping!!"));
526 if (!mcPartDaughter) {
527 AliWarning(
"At least one Daughter Particle not found in tree, skipping");
530 Double_t eta = mcPartDaughter->Eta();
536 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]));
550 Bool_t bRefitStep = kFALSE;
555 if (label1<=0 || label0 <= 0){
556 AliDebug(2, Form(
"The MC particle doesn't have correct daughters, skipping!!"));
564 Int_t foundDaughters = 0;
572 for(
Int_t iaod =0; iaod<aodEvent->GetNumberOfTracks(); iaod++){
573 AliAODTrack *track = (AliAODTrack*)aodEvent->GetTrack(iaod);
574 if(track->GetStatus()&AliESDtrack::kITSpureSA)
continue;
575 Bool_t foundTrack = kFALSE;
578 AliDebug(3,Form(
"fLabelArray[%d] = %d, track->GetLabel() = %d",ilabel,
fLabelArray[ilabel],TMath::Abs(track->GetLabel())));
582 if (TMath::Abs(track->GetLabel()) == temp[ilabel]) {
591 AliDebug(4,Form(
"daughter %d \n",foundDaughters));
592 if(trackCuts[prongindex]->GetRequireTPCRefit()){
593 if(track->GetStatus()&AliESDtrack::kTPCrefit) {
597 AliDebug(3,
"Refit cut not passed , missing TPC refit\n");
604 if (trackCuts[prongindex]->GetRequireITSRefit()) {
605 if(track->GetStatus()&AliESDtrack::kITSrefit){
609 AliDebug(3,
"Refit cut not passed , missing ITS refit\n");
616 if (foundDaughters == fProngs){
623 if (foundDaughters== fProngs)
return bRefitStep;
635 Bool_t bRecoStep = kFALSE;
639 AliDebug(2,
"No MC particle found");
645 AliWarning(
"Could not find associated MC in AOD MC tree");
652 if (pdgGranma == -99999){
653 AliDebug(2,
"This particle does not have a quark in his genealogy\n");
656 if (pdgGranma == -9999){
657 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");
661 if (pdgGranma == -999){
662 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");
705 Bool_t bRecoAccStep = kFALSE;
707 Float_t etaCutMin=0, ptCutMin=0, etaCutMax=0, ptCutMax=0;
709 Float_t etaProng=0., ptProng=0.;
713 trackCuts[iProng]->GetEtaRange(etaCutMin, etaCutMax);
714 trackCuts[iProng]->GetPtRange(ptCutMin, ptCutMax);
718 Bool_t acceptanceProng = (etaProng>etaCutMin && etaProng<etaCutMax && ptProng>ptCutMin && ptProng<ptCutMax);
719 if (!acceptanceProng) {
720 AliDebug(2,
"At least one reconstructed prong isn't in the acceptance\n");
760 AliDebug(2,
"No MC particle found");
766 AliWarning(
"Could not find associated MC in AOD MC tree");
773 AliDebug(2,
"candidate is particle, I ask for antiparticle only");
780 AliDebug(2,
"candidate is antiparticle, I ask for particle only");
796 Bool_t bLabelArray = kFALSE;
800 AliAODMCParticle *mcPartDaughter;
803 AliDebug(2, Form(
"label0 = %d, label1 = %d", label0, label1));
804 if (label1<=0 || label0 <= 0){
805 AliDebug(2, Form(
"The MC particle doesn't have correct daughters, skipping!!"));
810 AliAODMCParticle* tmp0 =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(label0));
811 AliAODMCParticle* tmp1 =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(label1));
812 AliDebug(2, Form(
"label0 = %d (pdg = %d), label1 = %d (pdg = %d)", label0, tmp0->GetPdgCode(), label1, tmp1->GetPdgCode()));
814 if (label1 - label0 ==
fProngs-1){
816 mcPartDaughter =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(label0+iProng));
821 AliError(
"Failed casting the daughter particle, returning a NULL label array");
831 AliDebug(3,
"In the resonance decay channel");
833 Int_t foundDaughters = 0;
835 Int_t iLabelDau = labelFirstDau+iDau;
836 AliAODMCParticle* part =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(iLabelDau));
838 AliError(
"Wrong particle type in fmcArray");
843 Int_t pdgCode=TMath::Abs(part->GetPdgCode());
844 AliDebug(3, Form(
"Prong %d had pdg = %d", iDau, pdgCode));
845 if(pdgCode==211 || pdgCode==321 || pdgCode==2212){
848 AliDebug(3, Form(
"part found at %d has label = %d", iLabelDau, part->GetLabel()));
849 AliDebug(3, Form(
"fLabelArray[%d] = %d", foundDaughters,
fLabelArray[foundDaughters]));
853 AliError(
"Error while casting particle! returning a NULL array");
860 else if (pdgCode==311) {
861 AliDebug(3, Form(
"K0S case, foundDaughters = %d", foundDaughters));
862 if (part->GetNDaughters()!=1) {
867 Int_t labelK0Dau = part->GetDaughter(0);
868 AliAODMCParticle* partK0S =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(labelK0Dau));
870 AliError(
"Error while casting particle! returning a NULL array");
875 Int_t nDauRes = partK0S->GetNDaughters();
876 AliDebug(3, Form(
"nDauRes = %d", nDauRes));
877 if (nDauRes!=2 || partK0S->GetPdgCode() != 310) {
878 AliDebug(2,
"No K0S on no 2-body decay");
883 Int_t labelFirstDauRes = partK0S->GetDaughter(0);
884 AliDebug(2, Form(
"Found K0S (%d)", labelK0Dau));
885 for(
Int_t iDauRes=0; iDauRes<nDauRes; iDauRes++){
886 Int_t iLabelDauRes = labelFirstDauRes+iDauRes;
887 AliAODMCParticle* dauRes =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(iLabelDauRes));
888 AliDebug(3, Form(
"daughter = %d, pointer = %p, with label = %d", iLabelDauRes, dauRes, dauRes->GetLabel()));
890 AliDebug(3, Form(
"PDG code = %d", dauRes->GetPdgCode()));
891 if (TMath::Abs(dauRes->GetPdgCode())!=211) {
892 AliDebug(2,
"K0S doesn't decay in 2 charged pions!");
899 AliDebug(3, Form(
"Setting fLabelArray[%d] = %d (before it was %d)", foundDaughters, iLabelDauRes, dauRes->GetLabel()));
904 AliError(
"Error while casting resonant daughter! returning a NULL array");
913 Int_t nDauRes=part->GetNDaughters();
914 AliDebug(3, Form(
"nDauRes = %d", nDauRes));
916 AliDebug(3, Form(
"nDauRes = %d, different from 2", nDauRes));
917 Int_t labelFirstDauResTest = part->GetDaughter(0);
918 for(
Int_t iDauRes=0; iDauRes<nDauRes; iDauRes++){
919 Int_t iLabelDauResTest = labelFirstDauResTest+iDauRes;
920 AliAODMCParticle* dauRes =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(iLabelDauResTest));
922 AliDebug(3, Form(
"pdg of daugh %d = %d", iDauRes, dauRes->GetPdgCode()));
929 Int_t labelFirstDauRes = part->GetDaughter(0);
930 for(
Int_t iDauRes=0; iDauRes<nDauRes; iDauRes++){
931 Int_t iLabelDauRes = labelFirstDauRes+iDauRes;
932 AliAODMCParticle* dauRes =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(iLabelDauRes));
938 AliError(
"Error while casting resonant daughter! returning a NULL array");
946 if (foundDaughters != fProngs){
947 AliDebug(3, Form(
"foundDaughters (%d) != fProngs (%d)", foundDaughters, fProngs));
959 AliDebug(3,
"Setting AccCuts");
1037 AliWarning(
"Track array not found, local multiplicity not computed\n");
1041 AliAODTrack* track=(AliAODTrack*)
fTrackArray->UncheckedAt(it);
1042 if(!track)
continue;
1043 if(!track->TestFilterBit(BIT(8)) && !track->TestFilterBit(BIT(9)))
continue;
1046 if(TMath::Sqrt((eta-etaD)*(eta-etaD)+(phi-phiD)*(phi-phiD))<R) mult++;
Bool_t fFillFromGenerated
MC z primary vertex.
AliCFVertexingHF & operator=(const AliCFVertexingHF &c)
Double_t GetPtCand() const
Bool_t CheckMCDaughters() const
Bool_t FillUnfoldingMatrix(UInt_t pdg, Double_t fill[4]) const
Int_t MCcquarkCounting(AliAODMCParticle *mcPart) const
Int_t ComputeLocalMultiplicity(Double_t etaD, Double_t phiD, Double_t R) const
Bool_t FillRecoContainer(Double_t *containerInput)
virtual void SetPtAccCut(Float_t *ptAccCut)
AliAODMCParticle * fmcPartCandidate
Reconstructed HF candidate.
virtual Bool_t SetLabelArray()
Bool_t fKeepDfromBOnly
flag for the feed down from b quark decay.
virtual ~AliCFVertexingHF()
virtual Bool_t GetRecoValuesFromCandidate(Double_t *) const
Float_t * fPtAccCut
centrality value
virtual Double_t GetPtProng(Int_t iProng) const
virtual Bool_t CheckMCChannelDecay() const
Float_t fFake
fakes selection: 0 –> all, 1 –> non-fake, 2 –> fake
Int_t fConfiguration
array of tracks
UShort_t fOriginDselection
flag to indicate whether data container should be filled
Int_t CheckOrigin() const
void SetDselection(UShort_t originDselection)
TClonesArray * fTrackArray
magnitude of the reduced flow vector (computed using TPC tracks)
virtual Bool_t GetGeneratedValuesFromMCParticle(Double_t *)
Int_t * fLabelArray
n. of prongs
void SetMCCandidateParam(Int_t label)
Bool_t CheckMCPartFamily(AliAODMCParticle *, TClonesArray *) const
AliAODRecoDecayHF * fRecoCandidate
mcArray candidate
Int_t CheckReflexion(Char_t isSign)
Bool_t MCAcceptanceStep() const
Bool_t RecoAcceptStep(AliESDtrackCuts **trackCuts) const
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 fProngs
results of the MatchToMC()
Double_t GetYCand(UInt_t pdg) const
Bool_t MCRefitStep(AliAODEvent *aodEvent, AliESDtrackCuts **trackCuts) const
Double_t fq2
multiplicity of the event
Double_t fzMCVertex
Reco z primary vertex.
Bool_t fKeepDfromB
flag to select D0 origins. 0 Only from charm 1 only from beauty 2 both from charm and beauty ...
Double_t fMultiplicity
flag to remove events not geenrated with PYTHIA
virtual void SetEtaAccCut(Float_t *etaAccCut)
Bool_t FillMCContainer(Double_t *containerInputMC)
Bool_t fRejectIfNoQuark
variable to indicate whether the D0 was a fake or not: 0 –> fake, 1 –> MC, 2 –> non-fake ...
virtual Double_t GetEtaProng(Int_t iProng) const
Class for HF corrections as a function of many variables and step.