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.
fBigOutput(kFALSE),
fMixPrintRefresh(-1),
fMaxNDaughters(-1),
- fCheckP(kFALSE)
+ fCheckP(kFALSE),
+ fCheckFeedDown(kFALSE),
+ fOriginDselection(kFALSE),
+ fKeepDfromB(kFALSE),
+ fKeepDfromBOnly(kFALSE),
+ fRejectIfNoQuark(kFALSE)
{
//
// Default constructor.
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.
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);
}
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());
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());
}
}
}
-
+//___________________________________________________________
+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)
{
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;}
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
};
fSel2(0),
fMaxNSisters(-1),
fCheckP(kFALSE),
+ fCheckFeedDown(kFALSE),
+ fOriginDselection(kFALSE),
+ fKeepDfromB(kFALSE),
+ fKeepDfromBOnly(kFALSE),
+ fRejectIfNoQuark(kFALSE),
fCheckHistRange(kTRUE)
{
//
fSel2(0),
fMaxNSisters(-1),
fCheckP(kFALSE),
+ fCheckFeedDown(kFALSE),
+ fOriginDselection(kFALSE),
+ fKeepDfromB(kFALSE),
+ fKeepDfromBOnly(kFALSE),
+ fRejectIfNoQuark(kFALSE),
fCheckHistRange(kTRUE)
{
//
fSel2(0),
fMaxNSisters(-1),
fCheckP(kFALSE),
+ fCheckFeedDown(kFALSE),
+ fOriginDselection(kFALSE),
+ fKeepDfromB(kFALSE),
+ fKeepDfromBOnly(kFALSE),
+ fRejectIfNoQuark(kFALSE),
fCheckHistRange(kTRUE)
{
//
fSel2(0),
fMaxNSisters(-1),
fCheckP(kFALSE),
+ fCheckFeedDown(kFALSE),
+ fOriginDselection(kFALSE),
+ fKeepDfromB(kFALSE),
+ fKeepDfromBOnly(kFALSE),
+ fRejectIfNoQuark(kFALSE),
fCheckHistRange(copy.fCheckHistRange)
{
//
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);
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) {
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)
{
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);
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
fDCA2 = p2->DCA();
fMother = -1;
+ fIsFromB = kFALSE;
+ fIsQuarkFound = kFALSE;
fPmother[0] = -1.0;
fPmother[1] = -1.0;
fPmother[2] = -1.0;
fPmother[0] = p1->PmotherX();
fPmother[1] = p1->PmotherY();
fPmother[2] = p1->PmotherZ();
+ fIsFromB = p1->IsFromB();
+ fIsQuarkFound = p1->IsQuarkFound();
}
Int_t i;
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];}
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
#include <TParticlePDG.h>
#include "AliAODEvent.h"
+#include "AliMCEvent.h"
#include "AliRsnEvent.h"
#include "AliRsnMiniEvent.h"
#include "AliRsnMiniParticle.h"
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;
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 {
// 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;
+ }
+ }
}
}
}
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;}
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;}
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