From Massimo:added check on feed-down for MC for low-pT D0 (only b->c feeddown so...
authorfbellini <fbellini@cern.ch>
Thu, 1 May 2014 06:44:04 +0000 (08:44 +0200)
committerfbellini <fbellini@cern.ch>
Thu, 1 May 2014 06:44:04 +0000 (08:44 +0200)
PWGLF/RESONANCES/AliRsnMiniAnalysisTask.cxx
PWGLF/RESONANCES/AliRsnMiniAnalysisTask.h
PWGLF/RESONANCES/AliRsnMiniOutput.cxx
PWGLF/RESONANCES/AliRsnMiniOutput.h
PWGLF/RESONANCES/AliRsnMiniPair.cxx
PWGLF/RESONANCES/AliRsnMiniPair.h
PWGLF/RESONANCES/AliRsnMiniParticle.cxx
PWGLF/RESONANCES/AliRsnMiniParticle.h

index 7deee6b..471deb3 100644 (file)
@@ -72,7 +72,12 @@ AliRsnMiniAnalysisTask::AliRsnMiniAnalysisTask() :
    fBigOutput(kFALSE),
    fMixPrintRefresh(-1),
    fMaxNDaughters(-1),
-   fCheckP(kFALSE)
+   fCheckP(kFALSE),
+   fCheckFeedDown(kFALSE),   
+   fOriginDselection(kFALSE),
+   fKeepDfromB(kFALSE),
+   fKeepDfromBOnly(kFALSE),
+   fRejectIfNoQuark(kFALSE)
 {
 //
 // Dummy constructor ALWAYS needed for I/O.
@@ -111,7 +116,12 @@ AliRsnMiniAnalysisTask::AliRsnMiniAnalysisTask(const char *name, Bool_t useMC) :
    fBigOutput(kFALSE),
    fMixPrintRefresh(-1),
    fMaxNDaughters(-1),
-   fCheckP(kFALSE)
+   fCheckP(kFALSE),
+   fCheckFeedDown(kFALSE),   
+   fOriginDselection(kFALSE),
+   fKeepDfromB(kFALSE),
+   fKeepDfromBOnly(kFALSE),
+   fRejectIfNoQuark(kFALSE)
 {
 //
 // Default constructor.
@@ -155,7 +165,12 @@ AliRsnMiniAnalysisTask::AliRsnMiniAnalysisTask(const AliRsnMiniAnalysisTask &cop
    fBigOutput(copy.fBigOutput),
    fMixPrintRefresh(copy.fMixPrintRefresh),
    fMaxNDaughters(copy.fMaxNDaughters),
-   fCheckP(copy.fCheckP)
+   fCheckP(copy.fCheckP),
+   fCheckFeedDown(copy.fCheckFeedDown),   
+   fOriginDselection(copy.fOriginDselection),
+   fKeepDfromB(copy.fOriginDselection),
+   fKeepDfromBOnly(copy.fKeepDfromBOnly),
+   fRejectIfNoQuark(copy.fRejectIfNoQuark)
 {
 //
 // Copy constructor.
@@ -202,6 +217,11 @@ AliRsnMiniAnalysisTask &AliRsnMiniAnalysisTask::operator=(const AliRsnMiniAnalys
    fMixPrintRefresh = copy.fMixPrintRefresh;
    fMaxNDaughters = copy.fMaxNDaughters;
    fCheckP = copy.fCheckP;
+   fCheckFeedDown = copy.fCheckFeedDown;
+   fOriginDselection = copy.fOriginDselection;
+   fKeepDfromB = copy.fOriginDselection;
+   fKeepDfromBOnly = copy.fKeepDfromBOnly;
+   fRejectIfNoQuark = copy.fRejectIfNoQuark;
    return (*this);
 }
 
@@ -937,6 +957,55 @@ void AliRsnMiniAnalysisTask::FillTrueMotherESD(AliRsnMiniEvent *miniEvent)
         if(fCheckP && (TMath::Abs(part->Px()-(daughter1->Px()+daughter2->Px()))/(TMath::Abs(part->Px())+1.e-13)) > 0.00001 &&   
                                (TMath::Abs(part->Py()-(daughter1->Py()+daughter2->Py()))/(TMath::Abs(part->Py())+1.e-13)) > 0.00001 &&
                                (TMath::Abs(part->Pz()-(daughter1->Pz()+daughter2->Pz()))/(TMath::Abs(part->Pz())+1.e-13)) > 0.00001 ) continue;
+        if(fCheckFeedDown){
+               Int_t pdgGranma = 0;
+               Int_t mother = 0;
+               mother = part->GetMother();
+               Int_t istep = 0;
+               Int_t abspdgGranma =0;
+               Bool_t isFromB=kFALSE;
+               Bool_t isQuarkFound=kFALSE;
+               while (mother >=0 ){
+                       istep++;
+                       AliDebug(2,Form("mother at step %d = %d", istep, mother));
+                       AliMCParticle* mcGranma = dynamic_cast<AliMCParticle*>(fMCEvent->GetTrack(mother));
+                       if (mcGranma){
+                               pdgGranma = mcGranma->PdgCode();
+                               AliDebug(2,Form("Pdg mother at step %d = %d", istep, pdgGranma));
+                               abspdgGranma = TMath::Abs(pdgGranma);
+                               if ((abspdgGranma > 500 && abspdgGranma < 600) || (abspdgGranma > 5000 && abspdgGranma < 6000)){
+                                 isFromB=kTRUE;
+                               }
+                               if(abspdgGranma==4 || abspdgGranma==5) isQuarkFound=kTRUE;
+                               mother = mcGranma->GetMother();
+                       }else{
+                               AliError("Failed casting the mother particle!");
+                               break;
+                       }
+               }
+               if(fRejectIfNoQuark && !isQuarkFound) pdgGranma = -99999;
+               if(isFromB){
+                 if (!fKeepDfromB) pdgGranma = -9999; //skip particle if come from a B meson.
+               }
+               else{ 
+                 if (fKeepDfromBOnly) pdgGranma = -999;
+                 
+               if (pdgGranma == -99999){
+                       AliDebug(2,"This particle does not have a quark in his genealogy\n");
+                       continue;
+               }
+               if (pdgGranma == -9999){
+                       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");   
+                       continue;
+               }       
+               
+               if (pdgGranma == -999){
+                       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");  
+                       continue;
+               }       
+
+             }
+        }
          // assign momenta to computation object
          miniPair.Sum(0) = miniPair.Sum(1) = (p1 + p2);
          miniPair.FillRef(def->GetMotherMass());
@@ -989,8 +1058,55 @@ void AliRsnMiniAnalysisTask::FillTrueMotherAOD(AliRsnMiniEvent *miniEvent)
          if (!okMatch) continue;
         if(fCheckP && (TMath::Abs(part->Px()-(daughter1->Px()+daughter2->Px()))/(TMath::Abs(part->Px())+1.e-13)) > 0.00001 &&   
                                (TMath::Abs(part->Py()-(daughter1->Py()+daughter2->Py()))/(TMath::Abs(part->Py())+1.e-13)) > 0.00001 &&
-                               (TMath::Abs(part->Pz()-(daughter1->Pz()+daughter2->Pz()))/(TMath::Abs(part->Pz())+1.e-13)) > 0.00001 ) continue; 
-        
+                               (TMath::Abs(part->Pz()-(daughter1->Pz()+daughter2->Pz()))/(TMath::Abs(part->Pz())+1.e-13)) > 0.00001 ) continue;
+        if(fCheckFeedDown){
+               Int_t pdgGranma = 0;
+               Int_t mother = 0;
+               mother = part->GetMother();
+               Int_t istep = 0;
+               Int_t abspdgGranma =0;
+               Bool_t isFromB=kFALSE;
+               Bool_t isQuarkFound=kFALSE;
+               while (mother >=0 ){
+                       istep++;
+                       AliDebug(2,Form("mother at step %d = %d", istep, mother));
+                       AliAODMCParticle* mcGranma = dynamic_cast<AliAODMCParticle*>(list->At(mother));
+                       if (mcGranma){
+                               pdgGranma = mcGranma->GetPdgCode();
+                               AliDebug(2,Form("Pdg mother at step %d = %d", istep, pdgGranma));
+                               abspdgGranma = TMath::Abs(pdgGranma);
+                               if ((abspdgGranma > 500 && abspdgGranma < 600) || (abspdgGranma > 5000 && abspdgGranma < 6000)){
+                                 isFromB=kTRUE;
+                               }
+                               if(abspdgGranma==4 || abspdgGranma==5) isQuarkFound=kTRUE;
+                               mother = mcGranma->GetMother();
+                       }else{
+                               AliError("Failed casting the mother particle!");
+                               break;
+                       }
+               }
+               if(fRejectIfNoQuark && !isQuarkFound) pdgGranma = -99999;
+               if(isFromB){
+                 if (!fKeepDfromB) pdgGranma = -9999; //skip particle if come from a B meson.
+               }
+               else{ 
+                 if (fKeepDfromBOnly) pdgGranma = -999;
+                 }
+                 
+               if (pdgGranma == -99999){
+                       AliDebug(2,"This particle does not have a quark in his genealogy\n");
+                       continue;
+               }
+               if (pdgGranma == -9999){
+                       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");   
+                       continue;
+               }       
+               
+               if (pdgGranma == -999){
+                       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");  
+                       continue;
+               }       
+        } 
         // assign momenta to computation object
          miniPair.Sum(0) = miniPair.Sum(1) = (p1 + p2);
          miniPair.FillRef(def->GetMotherMass());
@@ -999,7 +1115,33 @@ void AliRsnMiniAnalysisTask::FillTrueMotherAOD(AliRsnMiniEvent *miniEvent)
       }
    }
 }
-
+//___________________________________________________________
+void AliRsnMiniAnalysisTask::SetDselection(UShort_t originDselection)
+{
+       // setting the way the D0 will be selected
+       // 0 --> only from c quarks
+       // 1 --> only from b quarks
+       // 2 --> from both c quarks and b quarks
+               
+       fOriginDselection = originDselection;
+       
+       if (fOriginDselection == 0) {
+               fKeepDfromB = kFALSE;
+               fKeepDfromBOnly = kFALSE;
+       }
+       
+       if (fOriginDselection == 1) {
+               fKeepDfromB = kTRUE;
+               fKeepDfromBOnly = kTRUE;
+       }
+       
+       if (fOriginDselection == 2) {
+               fKeepDfromB = kTRUE;
+               fKeepDfromBOnly = kFALSE;
+       }
+       
+       return; 
+}
 //__________________________________________________________________________________________________
 Bool_t AliRsnMiniAnalysisTask::EventsMatch(AliRsnMiniEvent *event1, AliRsnMiniEvent *event2)
 {
index 9a84cde..69970e0 100644 (file)
@@ -50,6 +50,9 @@ public:
    void                SetMixPrintRefresh(Int_t n)        {fMixPrintRefresh = n;}
    void                SetMaxNDaughters(Short_t n)        {fMaxNDaughters = n;}
    void                SetCheckMomentumConservation(Bool_t checkP) {fCheckP = checkP;}
+   void                SetCheckFeedDown(Bool_t checkFeedDown)      {fCheckFeedDown = checkFeedDown;}
+   void                SetDselection(UShort_t originDselection);
+   void               SetRejectCandidateIfNotFromQuark(Bool_t opt){fRejectIfNoQuark=opt;}
    Int_t               AddTrackCuts(AliRsnCutSet *cuts);
    TClonesArray       *Outputs()                          {return &fHistograms;}
    TClonesArray       *Values()                           {return &fValues;}
@@ -113,8 +116,14 @@ private:
    Int_t                fMixPrintRefresh; // how often info in mixing part is printed
    Short_t              fMaxNDaughters;   // maximum number of allowed mother's daughter
    Bool_t               fCheckP;          // flag to set in order to check the momentum conservation for mothers
-
-   ClassDef(AliRsnMiniAnalysisTask, 7);   // AliRsnMiniAnalysisTask
+   
+   Bool_t               fCheckFeedDown;      // flag to set in order to check the particle feed down (specific for D meson analysis)
+   UShort_t            fOriginDselection;   // flag to select D0 origins. 0 Only from charm 1 only from beauty 2 both from charm and beauty (specific for D meson analysis)
+   Bool_t              fKeepDfromB;         // flag for the feed down from b quark decay (specific for D meson analysis)                       
+   Bool_t              fKeepDfromBOnly;     // flag to keep only the charm particles that comes from beauty decays (specific for D meson analysis)
+   Bool_t              fRejectIfNoQuark;    // flag to remove events not generated with PYTHIA
+
+   ClassDef(AliRsnMiniAnalysisTask, 8);   // AliRsnMiniAnalysisTask
 };
 
 
index 8034351..d6bfe5c 100644 (file)
@@ -48,6 +48,11 @@ AliRsnMiniOutput::AliRsnMiniOutput() :
    fSel2(0),
    fMaxNSisters(-1),
    fCheckP(kFALSE),
+   fCheckFeedDown(kFALSE),   
+   fOriginDselection(kFALSE),
+   fKeepDfromB(kFALSE),
+   fKeepDfromBOnly(kFALSE),
+   fRejectIfNoQuark(kFALSE),
    fCheckHistRange(kTRUE)
 {
 //
@@ -76,6 +81,11 @@ AliRsnMiniOutput::AliRsnMiniOutput(const char *name, EOutputType type, EComputat
    fSel2(0),
    fMaxNSisters(-1),
    fCheckP(kFALSE),
+   fCheckFeedDown(kFALSE),   
+   fOriginDselection(kFALSE),
+   fKeepDfromB(kFALSE),
+   fKeepDfromBOnly(kFALSE),
+   fRejectIfNoQuark(kFALSE),
    fCheckHistRange(kTRUE)
 {
 //
@@ -104,6 +114,11 @@ AliRsnMiniOutput::AliRsnMiniOutput(const char *name, const char *outType, const
    fSel2(0),
    fMaxNSisters(-1),
    fCheckP(kFALSE),
+   fCheckFeedDown(kFALSE),   
+   fOriginDselection(kFALSE),
+   fKeepDfromB(kFALSE),
+   fKeepDfromBOnly(kFALSE),
+   fRejectIfNoQuark(kFALSE),
    fCheckHistRange(kTRUE)
 {
 //
@@ -178,6 +193,11 @@ AliRsnMiniOutput::AliRsnMiniOutput(const AliRsnMiniOutput &copy) :
    fSel2(0),
    fMaxNSisters(-1),
    fCheckP(kFALSE),
+   fCheckFeedDown(kFALSE),   
+   fOriginDselection(kFALSE),
+   fKeepDfromB(kFALSE),
+   fKeepDfromBOnly(kFALSE),
+   fRejectIfNoQuark(kFALSE),
    fCheckHistRange(copy.fCheckHistRange)
 {
 //
@@ -221,6 +241,11 @@ AliRsnMiniOutput &AliRsnMiniOutput::operator=(const AliRsnMiniOutput &copy)
    fSel2.Set(0);
    fMaxNSisters = copy.fMaxNSisters;
    fCheckP = copy.fCheckP;
+   fCheckFeedDown = copy.fCheckFeedDown;
+   fOriginDselection = copy.fOriginDselection;
+   fKeepDfromB = copy.fOriginDselection;
+   fKeepDfromBOnly = copy.fKeepDfromBOnly;
+   fRejectIfNoQuark = copy.fRejectIfNoQuark;
    fCheckHistRange = copy.fCheckHistRange;
 
    return (*this);
@@ -511,6 +536,34 @@ Int_t AliRsnMiniOutput::FillPair(AliRsnMiniEvent *event1, AliRsnMiniEvent *event
            if ( fCheckP &&(TMath::Abs(fPair.PmotherX()-(p1->Px(1)+p2->Px(1)))/(TMath::Abs(fPair.PmotherX())+1.e-13)) > 0.00001 &&        
                          (TMath::Abs(fPair.PmotherY()-(p1->Py(1)+p2->Py(1)))/(TMath::Abs(fPair.PmotherY())+1.e-13)) > 0.00001 &&
                          (TMath::Abs(fPair.PmotherZ()-(p1->Pz(1)+p2->Pz(1)))/(TMath::Abs(fPair.PmotherZ())+1.e-13)) > 0.00001 ) continue;
+           if ( fCheckFeedDown ){
+                       Int_t pdgGranma = 0;
+                       Bool_t isFromB=kFALSE;
+                       Bool_t isQuarkFound=kFALSE;
+                       
+                       if(fPair.IsFromB() == kTRUE) isFromB = kTRUE;
+                       if(fPair.IsQuarkFound() == kTRUE) isQuarkFound = kTRUE;
+                       if(fRejectIfNoQuark && !isQuarkFound) pdgGranma = -99999;
+                       if(isFromB){
+                         if (!fKeepDfromB) pdgGranma = -9999; //skip particle if come from a B meson.
+                       }
+                       else{ 
+                         if (fKeepDfromBOnly) pdgGranma = -999;
+                         } 
+                       if (pdgGranma == -99999){
+                               AliDebug(2,"This particle does not have a quark in his genealogy\n");
+                               continue;
+                       }
+                       if (pdgGranma == -9999){
+                               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");   
+                               continue;
+                       }       
+        
+                       if (pdgGranma == -999){
+                               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");  
+                               continue;
+                       }       
+                   }
          }
          // check pair against cuts
          if (fPairCuts) {
@@ -526,7 +579,33 @@ Int_t AliRsnMiniOutput::FillPair(AliRsnMiniEvent *event1, AliRsnMiniEvent *event
    AliDebugClass(1, Form("Pairs added in total = %4d", nadded));
    return nadded;
 }
-
+//___________________________________________________________
+void AliRsnMiniOutput::SetDselection(UShort_t originDselection)
+{
+       // setting the way the D0 will be selected
+       // 0 --> only from c quarks
+       // 1 --> only from b quarks
+       // 2 --> from both c quarks and b quarks
+               
+       fOriginDselection = originDselection;
+       
+       if (fOriginDselection == 0) {
+               fKeepDfromB = kFALSE;
+               fKeepDfromBOnly = kFALSE;
+       }
+       
+       if (fOriginDselection == 1) {
+               fKeepDfromB = kTRUE;
+               fKeepDfromBOnly = kTRUE;
+       }
+       
+       if (fOriginDselection == 2) {
+               fKeepDfromB = kTRUE;
+               fKeepDfromBOnly = kFALSE;
+       }
+       
+       return; 
+}
 //________________________________________________________________________________________
 void AliRsnMiniOutput::ComputeValues(AliRsnMiniEvent *event, TClonesArray *valueList)
 {
index a801a9b..3046746 100644 (file)
@@ -87,6 +87,9 @@ public:
    void            SetFillHistogramOnlyInRange(Bool_t fillInRangeOnly) { fCheckHistRange = fillInRangeOnly; }
    void            SetMaxNSisters(Short_t n)          {fMaxNSisters = n;}
    void            SetCheckMomentumConservation(Bool_t checkP) {fCheckP = checkP;}
+   void            SetCheckFeedDown(Bool_t checkFeedDown)      {fCheckFeedDown = checkFeedDown;}
+   void            SetDselection(UShort_t originDselection);
+   void           SetRejectCandidateIfNotFromQuark(Bool_t opt){fRejectIfNoQuark=opt;}
 
    void            AddAxis(Int_t id, Int_t nbins, Double_t min, Double_t max);
    void            AddAxis(Int_t id, Double_t min, Double_t max, Double_t step);
@@ -125,9 +128,14 @@ private:
    TArrayI          fSel2;             //! list of selected particles for definition 2
    Short_t          fMaxNSisters;      // maximum number of allowed mother's daughter
    Bool_t           fCheckP;           // flag to set in order to check the momentum conservation for daughters
+   Bool_t           fCheckFeedDown;    // flag to set in order to check the particle feed down (specific for D meson analysis)
+   UShort_t        fOriginDselection; // flag to select D0 origins. 0 Only from charm 1 only from beauty 2 both from charm and beauty (specific for D meson analysis)
+   Bool_t          fKeepDfromB;       // flag for the feed down from b quark decay (specific for D meson analysis)                       
+   Bool_t          fKeepDfromBOnly;   // flag to keep only the charm particles that comes from beauty decays (specific for D meson analysis)
+   Bool_t          fRejectIfNoQuark;  // flag to remove events not generated with PYTHIA
    Bool_t           fCheckHistRange;   //  check if values is in histogram range
 
-   ClassDef(AliRsnMiniOutput, 3)  // AliRsnMiniOutput class
+   ClassDef(AliRsnMiniOutput, 4)  // AliRsnMiniOutput class
 };
 
 #endif
index 2fa782c..c20bca5 100644 (file)
@@ -20,6 +20,8 @@ void AliRsnMiniPair::Fill
    fDCA2 = p2->DCA();  
 
    fMother = -1;
+   fIsFromB = kFALSE;
+   fIsQuarkFound = kFALSE;
    fPmother[0] = -1.0;
    fPmother[1] = -1.0;
    fPmother[2] = -1.0;
@@ -29,6 +31,8 @@ void AliRsnMiniPair::Fill
       fPmother[0] = p1->PmotherX();
       fPmother[1] = p1->PmotherY();
       fPmother[2] = p1->PmotherZ();
+      fIsFromB = p1->IsFromB();
+      fIsQuarkFound = p1->IsQuarkFound();
    }
 
    Int_t i;
index 4837f94..846eb09 100644 (file)
@@ -18,10 +18,12 @@ class AliRsnMiniParticle;
 class AliRsnMiniPair : public TObject {
 public:
 
-   AliRsnMiniPair() : fDCA1(0), fDCA2(0), fMother(-1), fMotherPDG(0), fNSisters(-1) {Int_t i = 3; while (i--) fPmother[i] = 0.0;}
+   AliRsnMiniPair() : fDCA1(0), fDCA2(0), fMother(-1), fMotherPDG(0), fNSisters(-1), fIsFromB(kFALSE), fIsQuarkFound(kFALSE) {Int_t i = 3; while (i--) fPmother[i] = 0.0;}
   
    Int_t          &Mother()    {return fMother;}
    Int_t          &MotherPDG() {return fMotherPDG;}
+   Bool_t         &IsFromB()      {return fIsFromB;}
+   Bool_t         &IsQuarkFound() {return fIsQuarkFound;}
    Float_t        &PmotherX()  {return fPmother[0];}
    Float_t        &PmotherY()  {return fPmother[1];}
    Float_t        &PmotherZ()  {return fPmother[2];} 
@@ -66,9 +68,11 @@ public:
    Int_t          fMother;    // label of mothers (when common)
    Int_t          fMotherPDG; // PDG code of mother (when common)
    Short_t        fNSisters;  // total number of mother's daughters in the MC stack
+   Bool_t         fIsFromB;          // is the particle from B meson flag      
+   Bool_t         fIsQuarkFound;      // is the particle from a quark flag (used to reject or accept Hijing event)
    Float_t        fPmother[3];// MC momentum of the pair corresponding mother
    
-   ClassDef(AliRsnMiniPair,3)
+   ClassDef(AliRsnMiniPair,4)
      };
 
 #endif
index 81579c9..9345a3f 100644 (file)
@@ -10,6 +10,7 @@
 #include <TParticlePDG.h>
 
 #include "AliAODEvent.h"
+#include "AliMCEvent.h"
 #include "AliRsnEvent.h"
 #include "AliRsnMiniEvent.h"
 #include "AliRsnMiniParticle.h"
@@ -29,6 +30,8 @@ void AliRsnMiniParticle::CopyDaughter(AliRsnDaughter *daughter)
    fMother = -1;
    fMotherPDG = 0;
    fNTotSisters = -1;
+   fIsFromB = kFALSE;
+   fIsQuarkFound = kFALSE;
    fCutBits = 0x0;
    fPsim[0] = fPrec[0] = fPmother[0] = fPsim[1] = fPrec[1] = fPmother[1] = fPsim[2] = fPrec[2] = fPmother[2] = 0.0;
 
@@ -85,6 +88,28 @@ void AliRsnMiniParticle::CopyDaughter(AliRsnDaughter *daughter)
         fPmother[0]  = part->Px();
         fPmother[1]  = part->Py();
         fPmother[2]  = part->Pz();
+        Int_t istep = 0;
+        Int_t pdgGranma = 0;
+        Int_t abspdgGranma =0;
+        Int_t mother_temp = daughter->GetMother();
+        while (mother_temp >=0 ){
+              istep++;
+              AliDebug(2,Form("mother at step %d = %d", istep, mother_temp));
+              AliAODMCParticle* mcGranma = dynamic_cast<AliAODMCParticle*>(list->At(mother_temp));
+              if (mcGranma){
+                      pdgGranma = mcGranma->GetPdgCode();
+                      AliDebug(2,Form("Pdg mother at step %d = %d", istep, pdgGranma));
+                      abspdgGranma = TMath::Abs(pdgGranma);
+                      if ((abspdgGranma > 500 && abspdgGranma < 600) || (abspdgGranma > 5000 && abspdgGranma < 6000)){
+                        fIsFromB=kTRUE;
+                      }
+                      if(abspdgGranma==4 || abspdgGranma==5) fIsQuarkFound=kTRUE;
+                      mother_temp = mcGranma->GetMother();
+              }else{
+                      AliError("Failed casting the mother particle!");
+                      break;
+              }
+        }
        }
      }
    } else {
@@ -105,11 +130,34 @@ void AliRsnMiniParticle::CopyDaughter(AliRsnDaughter *daughter)
        // Number of Daughters from MC and Momentum of the Mother
        if (event->GetRefMC()) {
         AliMCParticle *part = (AliMCParticle *)event->GetRefMC()->GetTrack(fMother);
+        AliMCEvent * MCEvent = event->GetRefMCESD();
         if(part){
           fNTotSisters = part->Particle()->GetNDaughters();
           fPmother[0]  = part->Px();
           fPmother[1]  = part->Py();
           fPmother[2]  = part->Pz();
+          Int_t istep = 0;
+          Int_t pdgGranma = 0;
+          Int_t abspdgGranma =0;
+          Int_t mother_temp = daughter->GetMother();
+          while (mother_temp >=0 ){
+                istep++;
+                AliDebug(2,Form("mother at step %d = %d", istep, mother_temp));
+                AliMCParticle* mcGranma = dynamic_cast<AliMCParticle*>(MCEvent->GetTrack(mother_temp));
+                if (mcGranma){
+                        pdgGranma = mcGranma->PdgCode();
+                        AliDebug(2,Form("Pdg mother at step %d = %d", istep, pdgGranma));
+                        abspdgGranma = TMath::Abs(pdgGranma);
+                        if ((abspdgGranma > 500 && abspdgGranma < 600) || (abspdgGranma > 5000 && abspdgGranma < 6000)){
+                          fIsFromB=kTRUE;
+                        }
+                        if(abspdgGranma==4 || abspdgGranma==5) fIsQuarkFound=kTRUE;
+                        mother_temp = mcGranma->GetMother();
+                }else{
+                        AliError("Failed casting the mother particle!");
+                        break;
+                }
+          }
         }
        }
      }
index f66ff12..40b13a9 100644 (file)
@@ -16,7 +16,7 @@ class AliRsnDaughter;
 class AliRsnMiniParticle : public TObject {
 public:
 
-   AliRsnMiniParticle() : fIndex(-1), fCharge(0), fPDG(0), fMother(0), fMotherPDG(0), fDCA(0), fNTotSisters(0), fCutBits(0x0) {Int_t i = 3; while (i--) fPsim[i] = fPrec[i] = fPmother[i] = 0.0;}
+   AliRsnMiniParticle() : fIndex(-1), fCharge(0), fPDG(0), fMother(0), fMotherPDG(0), fDCA(0), fNTotSisters(0), fIsFromB(kFALSE), fIsQuarkFound(kFALSE), fCutBits(0x0) {Int_t i = 3; while (i--) fPsim[i] = fPrec[i] = fPmother[i] = 0.0;}
 
    Int_t         &Index()                    {return fIndex;}
    Char_t        &Charge()                   {return fCharge;}
@@ -37,6 +37,8 @@ public:
    Double_t       Mass();
    Int_t         &Mother()                   {return fMother;}
    Short_t       &MotherPDG()                {return fMotherPDG;}
+   Bool_t        &IsFromB()                  {return fIsFromB;}
+   Bool_t        &IsQuarkFound()             {return fIsQuarkFound;}
    UShort_t      &CutBits()                  {return fCutBits;}
    Double_t       DCA()                      {return fDCA;}
    Short_t        NTotSisters()              {return fNTotSisters;}
@@ -59,9 +61,11 @@ private:
    Short_t   fMotherPDG;    // PDG code of mother
    Double_t  fDCA;          // DCA of the particle
    Short_t   fNTotSisters;  // number of  daughters of the particle
+   Bool_t    fIsFromB;     // is the particle from B meson flag        
+   Bool_t    fIsQuarkFound; // is the particle from a quark flag (used to reject or accept Hijing event)
    UShort_t  fCutBits;      // list of bits used to know what cuts were passed by this track
 
-   ClassDef(AliRsnMiniParticle,5)
+   ClassDef(AliRsnMiniParticle,6)
 };
 
 #endif