20 #include <TClonesArray.h> 21 #include <TDatabasePDG.h> 22 #include <TParticlePDG.h> 24 #include <THnSparse.h> 25 #include <TParticle.h> 27 #include <THashList.h> 33 #include "AliEMCALGeometry.h" 34 #include "AliAnalysisManager.h" 35 #include "AliVEventHandler.h" 59 fClassName(class_name),
60 fAccessMethodName(method_name)
62 std::stringstream what_str;
63 what_str <<
"ALICE event not found in class '" <<
fClassName <<
"' using method '" << method_name <<
"'.";
64 fWhat = what_str.str();
67 #if !(defined(__CINT__) || defined(__MAKECINT__)) 88 dphi = TVector2::Phi_mpi_pi(fMomentum.Phi() - jet.
Phi());;
89 deta = fMomentum.Eta() - jet.
Eta();
90 return TMath::Sqrt(dphi*dphi + deta*deta);
101 return GetDistance(jet, deta, dphi);
118 fReconstructed(kFALSE),
160 fD.SetPtEtaPhiE(0,0,0,0);
170 for (
auto &jet :
fJets) {
171 jet.second.fMomentum.SetPtEtaPhiE(0,0,0,0);
172 jet.second.fNConstituents = 0;
174 jet.second.fMaxChargedPt = 0;
175 jet.second.fMaxNeutralPt = 0;
182 Printf(
"Printing D Meson Jet object.");
183 Printf(
"D Meson: pT = %.3f, eta = %.3f, phi = %.3f, inv. mass = %.3f",
fD.Pt(),
fD.Eta(),
fD.
Phi_0_2pi(),
fD.M());
185 for (
auto &jet :
fJets) {
186 Printf(
"Jet %s: pT = %.3f, eta = %.3f, phi = %.3f", jet.first.c_str(), jet.second.Pt(), jet.second.Eta(), jet.second.Phi_0_2pi());
187 Printf(
"Jet N Consituents = %d", jet.second.fNConstituents);
196 std::map<std::string, AliJetInfo>::const_iterator it =
fJets.find(n);
197 if (it ==
fJets.end())
return 0;
201 if ((*it).second.Pt() > 0) {
202 TVector3 dvect =
fD.Vect();
203 TVector3 jvect = (*it).second.fMomentum.Vect();
208 ::Error(
"AliAnalysisTaskDmesonJets::AliDmesonJetInfo::GetZ",
"Zero jet momentum!");
212 z = (dvect * jvect) / jetMom;
215 if (z == 1 || (z > 1 && z - 1 < 1e-3)) z = 0.999;
226 std::map<std::string, AliJetInfo>::const_iterator it =
fJets.find(n);
227 if (it ==
fJets.end())
return 0;
231 if ((*it).second.Pt() > 0) {
232 TVector3 dvect =
fD.Vect();
233 TVector3 jvect = (*it).second.fMomentum.Vect();
235 Double_t corrpt = (*it).second.fCorrPt > 0 ? (*it).second.fCorrPt : 0.;
236 jvect.SetPerp(corrpt);
244 z = (dvect * jvect) / jetMom;
259 std::map<std::string, AliJetInfo>::const_iterator it =
fJets.find(n);
260 if (it ==
fJets.end())
return 0;
284 dphi = TVector2::Phi_mpi_pi(
fD.Phi() - jet.
Phi());;
285 deta =
fD.Eta() - jet.
Eta();
286 return TMath::Sqrt(dphi*dphi + deta*deta);
306 std::map<std::string, AliJetInfo>::const_iterator it =
fJets.find(n);
307 if (it ==
fJets.end()) {
308 ::Error(
"AliAnalysisTaskDmesonJets::AliDmesonJetInfo::GetJet",
"Could not find jet info for the jet definition '%s'!",
312 return &((*it).second);
321 std::map<std::string, AliJetInfo>::iterator it =
fJets.find(n);
322 if (it ==
fJets.end()) {
323 ::Error(
"AliAnalysisTaskDmesonJets::AliDmesonJetInfo::GetJet",
"Could not find jet info for the jet definition '%s'!",
327 return &((*it).second);
368 std::map<std::string, AliJetInfo>::const_iterator it = source.
fJets.find(n);
369 if (it == source.
fJets.end())
return;
460 fPt = source.
fD.Pt();
532 fInvMass(source.fD.M()),
586 fDCA = recoDecay->GetDCA();
589 fPtK = recoDecay->PtProng(0);
590 fPtPi = recoDecay->PtProng(1);
591 fd0K = recoDecay->Getd0Prong(0);
592 fd0Pi = recoDecay->Getd0Prong(1);
596 fPtK = recoDecay->PtProng(1);
597 fPtPi = recoDecay->PtProng(0);
598 fd0K = recoDecay->Getd0Prong(1);
599 fd0Pi = recoDecay->Getd0Prong(0);
606 for (
Int_t ipr=0; ipr < 2; ipr++) {
607 Double_t diffIP = 0., errdiffIP = 0.;
610 if (errdiffIP > 0.) {
611 normdd0 = diffIP / errdiffIP;
618 normdd0 = diffIP > 0 ? 9999. : -9999.;
621 if (TMath::Abs(normdd0) > TMath::Abs(
fMaxNormd0)) {
659 f2ProngInvMass(source.fInvMass2Prong),
660 fDeltaInvMass(source.fD.M() - source.fInvMass2Prong)
830 if (!jet)
return kFALSE;
904 fCurrentDmesonJetInfo(0),
909 fClusterContainers(),
1077 ::Error(
"AliAnalysisTaskDmesonJets::AnalysisEngine::SetCandidateProperties",
"Candidate %d unknown!",
fCandidateType);
1122 fName +=
"_BackgroundOnly";
1125 fName +=
"_SignalOnly";
1128 fName +=
"_MCTruth";
1131 fName +=
"_D0Reflection";
1134 fName +=
"_OnlyWrongPIDAccepted";
1142 return fName.Data();
1157 ::Info(
"AliAnalysisTaskDmesonJets::AnalysisEngine::AddJetDefinition",
"Jet definition '%s' has been added to analysis engine '%s'." 1158 "Total number of jet definitions is now %lu.",
1164 ::Warning(
"AliAnalysisTaskDmesonJets::AnalysisEngine::AddJetDefinition",
"The same jet definition '%s' was already added in analysis engine '%s'.", def.
GetName(),
GetName());
1194 std::vector<AliHFJetDefinition>::iterator it =
fJetDefinitions.begin();
1228 for (
auto &jetdef :
fJetDefinitions) jetdef.SetChargedPtRange(min, max);
1236 for (
auto &jetdef :
fJetDefinitions) jetdef.SetNeutralPtRange(min, max);
1313 AliDebug(10,
"Checking if D0 meson is selected");
1315 if (isSelected == 0)
return kFALSE;
1317 Int_t MCtruthPdgCode = 0;
1329 AliAODMCParticle* aodMcPart =
static_cast<AliAODMCParticle*
>(
fMCContainer->GetArray()->At(mcLab));
1337 MCtruthPdgCode = aodMcPart->PdgCode();
1342 if (isSelected == 1) {
1343 if (i != 0)
return kFALSE;
1350 AliDebug(10,
"Selected as D0");
1357 else if (isSelected == 2) {
1358 if (i != 1)
return kFALSE;
1365 AliDebug(10,
"Selected as D0bar");
1372 else if (isSelected == 3) {
1373 AliDebug(10,
"Selected as either D0 or D0bar");
1378 if (i != 0)
return kFALSE;
1379 AliDebug(10,
"MC truth is D0");
1384 if (i != 1)
return kFALSE;
1385 AliDebug(10,
"MC truth is D0bar");
1394 AliDebug(10,
"Returning invariant mass with D0 hypothesis");
1398 AliDebug(10,
"Returning invariant mass with D0bar hypothesis");
1410 DmesonJet.
fD.SetPtEtaPhiM(Dcand->Pt(), Dcand->Eta(), Dcand->Phi(), invMassD);
1423 AliDebug(10,
"Checking if D* meson is selected");
1425 if (isSelected == 0)
return kFALSE;
1427 if ((i == 1 && DstarCand->Charge()>0) || (i == 0 && DstarCand->Charge()<0) || i > 1)
return kFALSE;
1429 Int_t MCtruthPdgCode = 0;
1434 Int_t pdgDgDStartoD0pi[2] = { 421, 211 };
1435 Int_t pdgDgD0toKpi[2] = { 321, 211 };
1438 AliDebug(10, Form(
"MC label is %d", mcLab));
1441 AliAODMCParticle* aodMcPart =
static_cast<AliAODMCParticle*
>(
fMCContainer->GetArray()->At(mcLab));
1449 MCtruthPdgCode = aodMcPart->PdgCode();
1450 AliDebug(10, Form(
"MC truth pdg code is %d",MCtruthPdgCode));
1455 Int_t absMCtruthPdgCode = TMath::Abs(MCtruthPdgCode);
1463 DmesonJet.
fD.SetPtEtaPhiM(DstarCand->Pt(), DstarCand->Eta(), DstarCand->Phi(), invMassD);
1484 Int_t absPdgPart = TMath::Abs(part->GetPdgCode());
1486 if (part->GetNDaughters() == 2) {
1488 AliAODMCParticle* d1 =
static_cast<AliAODMCParticle*
>(mcArray->At(part->GetDaughter(0)));
1489 AliAODMCParticle* d2 =
static_cast<AliAODMCParticle*
>(mcArray->At(part->GetDaughter(1)));
1495 Int_t absPdg1 = TMath::Abs(d1->GetPdgCode());
1496 Int_t absPdg2 = TMath::Abs(d2->GetPdgCode());
1498 if (absPdgPart == 421) {
1499 if ((absPdg1 == 211 && absPdg2 == 321) ||
1500 (absPdg1 == 321 && absPdg2 == 211)) {
1505 if (absPdgPart == 413) {
1506 if (absPdg1 == 421 && absPdg2 == 211) {
1512 else if (absPdg1 == 211 && absPdg2 == 421) {
1532 std::pair<AliAnalysisTaskDmesonJets::EMesonOrigin_t, AliAODMCParticle*> result(
kUnknownQuark, 0);
1534 if (!part)
return result;
1535 if (!mcArray)
return result;
1537 static std::set<UInt_t> partons = { 4, 5 };
1541 result.second = parton;
1542 UInt_t absPdgParton = TMath::Abs(parton->GetPdgCode());
1543 if (absPdgParton == 4) result.first =
kFromCharm;
1544 else if (absPdgParton == 5) result.first =
kFromBottom;
1560 static std::set<UInt_t> pdgSet;
1576 AliAODMCParticle* result =
nullptr;
1578 Int_t mother = part->GetMother();
1579 while (mother >= 0) {
1580 AliAODMCParticle* mcGranma =
static_cast<AliAODMCParticle*
>(mcArray->At(mother));
1582 UInt_t abspdgGranma = TMath::Abs(mcGranma->GetPdgCode());
1585 if (pdgSet.empty() || pdgSet.count(abspdgGranma) > 0) {
1590 if (mother == mcGranma->GetMother()) {
1591 AliWarningClassStream() <<
"Particle " << mother <<
" (PDG=" << mcGranma->PdgCode() <<
") is the mother of itself!?" << std::endl;
1594 mother = mcGranma->GetMother();
1597 AliErrorClassStream() <<
"Could not retrieve mother particle " << mother <<
"!" << std::endl;
1609 jetDef.fJets.clear();
1633 std::map<AliHFJetDefinition*,Double_t> maxJetPt;
1637 Int_t nAccCharm[3] = {0};
1638 for (
Int_t icharm = 0; icharm < nD; icharm++) {
1640 if (!charmCand)
continue;
1645 Int_t nMassHypo = 0;
1646 if (charmCand->Pt() > maxDPt) maxDPt = charmCand->Pt();
1647 for (
Int_t im = 0; im < 2; im++) {
1652 for (
auto& def : fJetDefinitions) {
1653 if (
FindJet(charmCand, DmesonJet, def)) {
1654 Double_t jetPt = DmesonJet.
fJets[def.GetName()].fMomentum.Pt();
1655 if (jetPt > maxJetPt[&def]) maxJetPt[&def] = jetPt;
1658 AliWarning(Form(
"Could not find jet '%s' for D meson '%s': pT = %.3f, eta = %.3f, phi = %.3f",
1667 if (nMassHypo == 2) {
1672 if (nMassHypo == 2) {
1685 ntracks += track_cont->GetNAcceptEntries();
1688 for (
auto& def : fJetDefinitions) {
1689 if (!def.fRho)
continue;
1690 hname = TString::Format(
"%s/%s/fHistRhoVsLeadJetPt",
GetName(), def.GetName());
1693 hname = TString::Format(
"%s/%s/fHistRhoVsLeadDPt",
GetName(), def.GetName());
1696 hname = TString::Format(
"%s/%s/fHistRhoVsCent",
GetName(), def.GetName());
1699 hname = TString::Format(
"%s/%s/fHistLeadJetPtVsCent",
GetName(), def.GetName());
1702 hname = TString::Format(
"%s/%s/fHistLeadDPtVsCent",
GetName(), def.GetName());
1705 hname = TString::Format(
"%s/%s/fHistRhoVsNTracks",
GetName(), def.GetName());
1708 hname = TString::Format(
"%s/%s/fHistLeadJetPtVsNTracks",
GetName(), def.GetName());
1711 hname = TString::Format(
"%s/%s/fHistLeadDPtVsNTracks",
GetName(), def.GetName());
1715 hname = TString::Format(
"%s/fHistNTotAcceptedDmesons",
GetName());
1720 hname = TString::Format(
"%s/fHistNAcceptedDmesonsVsNtracks",
GetName());
1723 hname = TString::Format(
"%s/fHistNDmesons",
GetName());
1741 if (jetDef.
fRho) rho = jetDef.
fRho->GetVal();
1754 hname = TString::Format(
"%s/%s/fHistTrackRejectionReason",
GetName(), jetDef.
GetName());
1758 hname = TString::Format(
"%s/%s/fHistDMesonDaughterNotInJet",
GetName(), jetDef.
GetName());
1761 for (
Int_t i = 0; i < daughters.GetEntriesFast(); i++) {
1762 AliVParticle* daughter =
static_cast<AliVParticle*
>(daughters.At(i));
1763 if (!hftrack_cont->GetArray()->FindObject(daughter)) histDaughterNotInJet->Fill(daughter->Pt());
1771 hname = TString::Format(
"%s/%s/fHistClusterRejectionReason",
GetName(), jetDef.
GetName());
1781 for (
UInt_t ijet = 0; ijet < jets_incl.size(); ++ijet) {
1784 Bool_t isDmesonJet = kFALSE;
1791 for (
UInt_t ic = 0; ic < constituents.size(); ++ic) {
1792 if (constituents[ic].user_index() == 0) {
1793 isDmesonJet = kTRUE;
1795 else if (constituents[ic].user_index() >= 100) {
1796 if (constituents[ic].pt() > maxChPt) maxChPt = constituents[ic].pt();
1799 else if (constituents[ic].user_index() <= -100) {
1800 totalNeutralPt += constituents[ic].pt();
1801 if (constituents[ic].pt() > maxNePt) maxChPt = constituents[ic].pt();
1807 DmesonJet.
fJets[jetDef.
GetName()].fMomentum.SetPxPyPzE(jets_incl[ijet].px(), jets_incl[ijet].py(), jets_incl[ijet].pz(), jets_incl[ijet].E());
1808 DmesonJet.
fJets[jetDef.
GetName()].fNConstituents = nConst;
1809 DmesonJet.
fJets[jetDef.
GetName()].fMaxChargedPt = maxChPt;
1810 DmesonJet.
fJets[jetDef.
GetName()].fMaxNeutralPt = maxNePt;
1811 DmesonJet.
fJets[jetDef.
GetName()].fNEF = totalNeutralPt / jets_incl[ijet].pt();
1812 DmesonJet.
fJets[jetDef.
GetName()].fArea = jets_incl[ijet].area();
1813 DmesonJet.
fJets[jetDef.
GetName()].fCorrPt = DmesonJet.
fJets[jetDef.
GetName()].fMomentum.Pt() - jets_incl[ijet].area() * rho;
1827 auto itcont = cont->all_momentum();
1828 for (AliEmcalIterableMomentumContainer::iterator it = itcont.begin(); it != itcont.end(); it++) {
1829 UInt_t rejectionReason = 0;
1830 if (!cont->AcceptObject(it.current_index(), rejectionReason)) {
1831 if (rejectHist) rejectHist->Fill(AliEmcalContainer::GetRejectionReasonBitPosition(rejectionReason), it->first.Pt());
1837 if (rejectHist) rejectHist->Fill(6, it->first.Pt());
1841 Int_t uid = offset >= 0 ? it.current_index() + offset: -it.current_index() - offset;
1858 Int_t nAccCharm[3] = {0};
1860 std::map<AliHFJetDefinition*, Double_t> maxJetPt;
1864 maxJetPt[&jetDef] = 0;
1866 if (jetDef.fRho) rho = jetDef.fRho->GetVal();
1867 hname = TString::Format(
"%s/%s/fHistNDmesonsVsNconstituents",
GetName(), jetDef.GetName());
1870 switch (jetDef.fJetType) {
1887 hname = TString::Format(
"%s/%s/fHistMCParticleRejectionReason",
GetName(), jetDef.GetName());
1894 for (
auto jet : jets_incl) {
1895 Int_t nDmesonsInJet = 0;
1897 for (
auto constituent : jet.constituents()) {
1898 Int_t iPart = constituent.user_index() - 100;
1899 if (constituent.perp() < 1e-6)
continue;
1902 ::Error(
"AliAnalysisTaskDmesonJets::AnalysisEngine::RunParticleLevelAnalysis",
"Could not find jet constituent %d!", iPart);
1907 std::map<int, AliDmesonJetInfo>::iterator dMesonJetIt =
fDmesonJets.find(iPart);
1909 if (part->Pt() > maxDPt) maxDPt = part->Pt();
1910 std::pair<int, AliDmesonJetInfo> element;
1911 element.first = iPart;
1913 (*dMesonJetIt).second.fD.SetPxPyPzE(part->Px(), part->Py(), part->Pz(), part->E());
1914 (*dMesonJetIt).second.fDmesonParticle =
part;
1915 (*dMesonJetIt).second.fSelectionType = part->PdgCode() > 0 ? 1 : 2;
1923 while (rs >>= 1) { p++; }
1924 (*dMesonJetIt).second.fPartonType = p;
1925 (*dMesonJetIt).second.fParton = origin.second;
1929 if (part->PdgCode() > 0) {
1937 (*dMesonJetIt).second.fJets[jetDef.GetName()].fMomentum.SetPxPyPzE(jet.px(), jet.py(), jet.pz(), jet.E());
1938 (*dMesonJetIt).second.fJets[jetDef.GetName()].fNConstituents = jet.constituents().size();
1939 (*dMesonJetIt).second.fJets[jetDef.GetName()].fArea = jet.area();
1940 (*dMesonJetIt).second.fJets[jetDef.GetName()].fCorrPt = (*dMesonJetIt).second.fJets[jetDef.GetName()].fMomentum.Pt() - jet.area() * rho;
1941 if (jet.perp() > maxJetPt[&jetDef]) maxJetPt[&jetDef] = jet.perp();
1944 if (nDmesonsInJet > 0) histNDmesonsVsNconstituents->Fill(jet.constituents().size(), nDmesonsInJet);
1950 for (
auto& def : fJetDefinitions) {
1951 if (!def.fRho)
continue;
1952 hname = TString::Format(
"%s/%s/fHistRhoVsLeadJetPt",
GetName(), def.GetName());
1955 hname = TString::Format(
"%s/%s/fHistRhoVsLeadDPt",
GetName(), def.GetName());
1958 hname = TString::Format(
"%s/%s/fHistRhoVsCent",
GetName(), def.GetName());
1961 hname = TString::Format(
"%s/%s/fHistLeadJetPtVsCent",
GetName(), def.GetName());
1964 hname = TString::Format(
"%s/%s/fHistLeadDPtVsCent",
GetName(), def.GetName());
1967 hname = TString::Format(
"%s/%s/fHistRhoVsNTracks",
GetName(), def.GetName());
1970 hname = TString::Format(
"%s/%s/fHistLeadJetPtVsNTracks",
GetName(), def.GetName());
1973 hname = TString::Format(
"%s/%s/fHistLeadDPtVsNTracks",
GetName(), def.GetName());
1977 if (
fDmesonJets.size() != nAccCharm[0]+nAccCharm[1]) AliError(Form(
"I found %lu mesons (%d)?",
fDmesonJets.size(), nAccCharm[0]+nAccCharm[1]));
1978 hname = TString::Format(
"%s/fHistNTotAcceptedDmesons",
GetName());
1983 hname = TString::Format(
"%s/fHistNAcceptedDmesonsVsNtracks",
GetName());
1986 hname = TString::Format(
"%s/fHistNDmesons",
GetName());
1997 classname =
"AliAnalysisTaskDmesonJets::AliDmesonMCInfoSummary";
2005 classname =
"AliAnalysisTaskDmesonJets::AliD0ExtendedInfoSummary";
2009 classname =
"AliAnalysisTaskDmesonJets::AliD0InfoSummary";
2014 classname =
"AliAnalysisTaskDmesonJets::AliDStarInfoSummary";
2019 TString treeName = TString::Format(
"%s_%s", taskName,
GetName());
2048 AliDebug(2,Form(
"Now working on '%s'", jetDef.GetName()));
2058 title[dim] =
"#it{p}_{T,D} (GeV/#it{c})";
2065 title[dim] =
"#eta_{D}";
2071 title[dim] =
"#phi_{D} (rad)";
2074 max[dim] = TMath::TwoPi();
2079 title[dim] =
"#it{M}_{K#pi#pi} (GeV/#it{c}^{2})";
2087 title[dim] =
"#it{M}_{K#pi} (GeV/#it{c}^{2})";
2095 title[dim] =
"#it{M}_{K#pi} (GeV/#it{c}^{2})";
2102 title[dim] =
"#it{M}_{K#pi#pi} - #it{M}_{K#pi} (GeV/#it{c}^{2})";
2107 Double_t D0mass = TDatabasePDG::Instance()->GetParticle(421)->Mass();
2115 title[dim] =
"#it{p}_{T,#pi} (GeV/#it{c})";
2122 title[dim] =
"#it{z}_{D}";
2128 if ((enabledAxis &
kDeltaR) != 0) {
2129 title[dim] =
"#Delta R_{D-jet}";
2132 max[dim] = radius * 1.5;
2137 title[dim] =
"#eta_{D} - #eta_{jet}";
2139 min[dim] = -radius * 1.2;
2140 max[dim] = radius * 1.2;
2145 title[dim] =
"#phi_{D} - #phi_{jet} (rad)";
2147 min[dim] = -radius * 1.2;
2148 max[dim] = radius * 1.2;
2152 title[dim] =
"#it{p}_{T,jet} (GeV/#it{c})";
2159 title[dim] =
"#eta_{jet}";
2165 title[dim] =
"#phi_{jet} (rad)";
2168 max[dim] = TMath::TwoPi();
2173 title[dim] =
"No. of constituents";
2180 hname = TString::Format(
"%s/%s/fDmesonJets",
GetName(), jetDef.GetName());
2182 for (
Int_t j = 0; j < dim; j++) {
2183 h->GetAxis(j)->SetTitle(title[j]);
2196 TH1* histAncestor =
nullptr;
2197 TH1* histPrompt =
nullptr;
2200 hname = TString::Format(
"%s/fHistPrompt",
GetName());
2203 hname = TString::Format(
"%s/fHistAncestor",
GetName());
2228 if (dmeson_pair.second.fParton) {
2229 fPartons[dmeson_pair.second.fParton] = dmeson_pair.second.fPartonType;
2230 UInt_t absPdgParton = TMath::Abs(dmeson_pair.second.fParton->GetPdgCode());
2231 if (absPdgParton == 4) {
2232 histPrompt->Fill(
"Prompt", 1);
2234 else if (absPdgParton == 5) {
2235 histPrompt->Fill(
"Non-Prompt", 1);
2238 histPrompt->Fill(
"Unknown", 1);
2242 histPrompt->Fill(
"Unknown", 1);
2247 if (dmeson_pair.second.fAncestor) {
2248 UInt_t absPdgAncestor = TMath::Abs(dmeson_pair.second.fAncestor->GetPdgCode());
2249 if (absPdgAncestor == 4) {
2250 histAncestor->Fill(
"Charm", 1);
2252 else if (absPdgAncestor == 5) {
2253 histAncestor->Fill(
"Bottom", 1);
2255 else if (absPdgAncestor == 2212) {
2256 histAncestor->Fill(
"Proton", 1);
2259 histAncestor->Fill(
"Unknown", 1);
2263 histAncestor->Fill(
"Unknown", 1);
2270 hname = TString::Format(
"%s/fHistRejectedDMesonPt",
GetName());
2272 hname = TString::Format(
"%s/fHistRejectedDMesonPhi",
GetName());
2274 hname = TString::Format(
"%s/fHistRejectedDMesonEta",
GetName());
2278 hname = TString::Format(
"%s/fHistRejectedDMesonInvMass",
GetName());
2282 hname = TString::Format(
"%s/fHistRejectedDMeson2ProngInvMass",
GetName());
2285 hname = TString::Format(
"%s/fHistRejectedDMesonDeltaInvMass",
GetName());
2286 fHistManager->
FillTH1(hname, dmeson_pair.second.fD.M() - dmeson_pair.second.fInvMass2Prong);
2293 hname = TString::Format(
"%s/fHistPartonPt",
GetName());
2295 hname = TString::Format(
"%s/fHistPartonEta",
GetName());
2297 hname = TString::Format(
"%s/fHistPartonPhi",
GetName());
2299 hname = TString::Format(
"%s/fHistPartonType",
GetName());
2303 if (!parton.first)
continue;
2304 histPartonPt->Fill(parton.first->Pt());
2305 histPartonEta->Fill(parton.first->Eta());
2306 histPartonPhi->Fill(TVector2::Phi_0_2pi(parton.first->Phi()));
2307 histPartonType->Fill(parton.second);
2322 TH1* histAncestor =
nullptr;
2323 TH1* histPrompt =
nullptr;
2326 hname = TString::Format(
"%s/fHistPrompt",
GetName());
2329 hname = TString::Format(
"%s/fHistAncestor",
GetName());
2352 if (dmeson_pair.second.fParton) {
2353 fPartons[dmeson_pair.second.fParton] = dmeson_pair.second.fPartonType;
2354 UInt_t absPdgParton = TMath::Abs(dmeson_pair.second.fParton->GetPdgCode());
2355 if (absPdgParton == 4) {
2356 histPrompt->Fill(
"Prompt", 1);
2358 else if (absPdgParton == 5) {
2359 histPrompt->Fill(
"Non-Prompt", 1);
2362 histPrompt->Fill(
"Unknown", 1);
2366 histPrompt->Fill(
"Unknown", 1);
2371 if (dmeson_pair.second.fAncestor) {
2372 UInt_t absPdgAncestor = TMath::Abs(dmeson_pair.second.fAncestor->GetPdgCode());
2373 if (absPdgAncestor == 4) {
2374 histAncestor->Fill(
"Charm", 1);
2376 else if (absPdgAncestor == 5) {
2377 histAncestor->Fill(
"Bottom", 1);
2379 else if (absPdgAncestor == 2212) {
2380 histAncestor->Fill(
"Proton", 1);
2383 histAncestor->Fill(
"Unknown", 1);
2387 histAncestor->Fill(
"Unknown", 1);
2392 hname = TString::Format(
"%s/fHistRejectedDMesonPt",
GetName());
2394 hname = TString::Format(
"%s/fHistRejectedDMesonPhi",
GetName());
2396 hname = TString::Format(
"%s/fHistRejectedDMesonEta",
GetName());
2400 hname = TString::Format(
"%s/fHistRejectedDMesonInvMass",
GetName());
2404 hname = TString::Format(
"%s/fHistRejectedDMeson2ProngInvMass",
GetName());
2407 hname = TString::Format(
"%s/fHistRejectedDMesonDeltaInvMass",
GetName());
2408 fHistManager->
FillTH1(hname, dmeson_pair.second.fD.M() - dmeson_pair.second.fInvMass2Prong);
2415 hname = TString::Format(
"%s/fHistPartonPt",
GetName());
2417 hname = TString::Format(
"%s/fHistPartonEta",
GetName());
2419 hname = TString::Format(
"%s/fHistPartonPhi",
GetName());
2421 hname = TString::Format(
"%s/fHistPartonType",
GetName());
2425 if (!parton.first)
continue;
2426 histPartonPt->Fill(parton.first->Pt());
2427 histPartonEta->Fill(parton.first->Eta());
2428 histPartonPhi->Fill(TVector2::Phi_0_2pi(parton.first->Phi()));
2429 histPartonType->Fill(parton.second);
2445 hname = TString::Format(
"%s/fHistRejectedDMesonPt",
GetName());
2447 hname = TString::Format(
"%s/fHistRejectedDMesonPhi",
GetName());
2449 hname = TString::Format(
"%s/fHistRejectedDMesonEta",
GetName());
2456 hname = TString::Format(
"%s/%s/fDmesonJets",
GetName(), jetDef.GetName());
2459 for (
auto& dmeson_pair : fDmesonJets) {
2460 const AliJetInfo* jet = dmeson_pair.second.GetJet(jetDef.GetName());
2462 if (!jetDef.IsJetInAcceptance(*jet)) {
2463 hname = TString::Format(
"%s/%s/fHistRejectedJetPt",
GetName(), jetDef.GetName());
2465 hname = TString::Format(
"%s/%s/fHistRejectedJetPhi",
GetName(), jetDef.GetName());
2467 hname = TString::Format(
"%s/%s/fHistRejectedJetEta",
GetName(), jetDef.GetName());
2494 std::map<std::string, AliJetInfo>::const_iterator it = DmesonJet.
fJets.find(n);
2495 if (it == DmesonJet.
fJets.end())
return kFALSE;
2497 for (
Int_t i = 0; i < h->GetNdimensions(); i++) {
2499 if (
title==
"#it{p}_{T,D} (GeV/#it{c})") contents[i] = DmesonJet.
fD.Pt();
2500 else if (
title==
"#eta_{D}") contents[i] = DmesonJet.
fD.Eta();
2503 else if (
title==
"#it{M}_{K#pi#pi} (GeV/#it{c}^{2})") contents[i] = DmesonJet.
fD.M();
2504 else if (
title==
"#it{M}_{K#pi#pi} - #it{M}_{K#pi} (GeV/#it{c}^{2})") contents[i] = DmesonJet.
fD.M() - DmesonJet.
fInvMass2Prong;
2505 else if (
title==
"#it{p}_{T,#pi} (GeV/#it{c})") contents[i] = DmesonJet.
fSoftPionPt;
2506 else if (
title==
"#it{z}_{D}") contents[i] = z;
2507 else if (
title==
"#Delta R_{D-jet}") contents[i] = deltaR;
2508 else if (
title==
"#eta_{D} - #eta_{jet}") contents[i] = deltaEta;
2509 else if (
title==
"#phi_{D} - #phi_{jet} (rad)") contents[i] = deltaPhi;
2510 else if (
title==
"#it{p}_{T,jet} (GeV/#it{c})") contents[i] = (*it).second.Pt();
2511 else if (
title==
"#eta_{jet}") contents[i] = (*it).second.Eta();
2512 else if (
title==
"#phi_{jet} (rad)") contents[i] = (*it).second.Phi_0_2pi();
2513 else if (
title==
"No. of constituents") contents[i] = (*it).second.fNConstituents;
2514 else AliWarning(Form(
"Unable to fill dimension '%s'!",
title.Data()));
2568 for (
Int_t i = 0; i < nOutputTrees; i++){
2569 DefineOutput(2+i, TTree::Class());
2588 TFile* filecuts = TFile::Open(cutfname);
2589 if (!filecuts || filecuts->IsZombie()) {
2590 ::Error(
"AliAnalysisTaskDmesonJets::LoadDMesonCutsFromFile",
"Input file not found: will use std cuts.");
2594 if (filecuts) analysiscuts =
dynamic_cast<AliRDHFCuts*
>(filecuts->Get(cutsname));
2596 if (!analysiscuts) {
2597 ::Error(
"AliAnalysisTaskDmesonJets::LoadDMesonCutsFromFile",
"Could not find analysis cuts '%s' in '%s'.", cutsname.Data(), cutfname.Data());
2603 ::Info(
"AliAnalysisTaskDmesonJets::LoadDMesonCutsFromFile",
"Cuts '%s' loaded from file '%s'", cutsname.Data(), cutfname.Data());
2606 return analysiscuts;
2640 if (!cutfname.IsNull()) {
2646 cutsname =
"D0toKpiCuts";
2649 cutsname =
"DStartoKpipiCuts";
2655 if (!cuttype.IsNull()) {
2656 cutsname += TString::Format(
"_%s", cuttype.Data());
2660 if (cuts) cuts->PrintAll();
2670 ::Info(
"AliAnalysisTaskDmesonJets::AddAnalysisEngine",
"A new analysis engine '%s' has been added. The total number of analysis engines is %lu.", eng.
GetName(),
fAnalysisEngines.size());
2674 ::Info(
"AliAnalysisTaskDmesonJets::AddAnalysisEngine",
"An analysis engine '%s' with %lu jet definitions has been found. The total number of analysis engines is %lu. A new jet definition '%s' is being added.", found_eng->
GetName(), found_eng->
fJetDefinitions.size(),
fAnalysisEngines.size(), jetDef.
GetName());
2678 if (found_eng->
fRDHFCuts != 0) ::Warning(
"AliAnalysisTaskDmesonJets::AddAnalysisEngine",
"D meson cuts were already defined for this D meson type. They will be overwritten.");
2696 ::Info(
"UserCreateOutputObjects",
"CreateOutputObjects of task %s", GetName());
2708 Int_t maxTracks = 6000;
2719 hname =
"fHistCharmPt";
2720 htitle = hname +
";#it{p}_{T,charm} (GeV/#it{c});counts";
2723 hname =
"fHistCharmEta";
2724 htitle = hname +
";#eta_{charm};counts";
2727 hname =
"fHistCharmPhi";
2728 htitle = hname +
";#phi_{charm};counts";
2731 hname =
"fHistBottomPt";
2732 htitle = hname +
";#it{p}_{T,bottom} (GeV/#it{c});counts";
2735 hname =
"fHistBottomEta";
2736 htitle = hname +
";#eta_{bottom};counts";
2739 hname =
"fHistBottomPhi";
2740 htitle = hname +
";#phi_{bottom};counts";
2743 hname =
"fHistHighestPartonPt";
2744 htitle = hname +
";#it{p}_{T,bottom} (GeV/#it{c});counts";
2747 hname =
"fHistHighestPartonType";
2748 htitle = hname +
";type;counts";
2751 hname =
"fHistNHeavyQuarks";
2752 htitle = hname +
";number of heavy-quarks;counts";
2755 ::Info(
"AliAnalysisTaskDmesonJets::UserCreateOutputObjects",
"Allocating histograms for task '%s' (%lu analysis engines)", GetName(),
fAnalysisEngines.size());
2757 ::Info(
"AliAnalysisTaskDmesonJets::UserCreateOutputObjects",
"Allocating histograms for analysis engine '%s' (%lu jet definitions)", param.GetName(), param.fJetDefinitions.size());
2761 hname = TString::Format(
"%s/fHistNAcceptedDmesonsVsNtracks", param.GetName());
2762 htitle = hname +
";#it{N}_{tracks};#it{N}_{D};events";
2765 hname = TString::Format(
"%s/fHistNTotAcceptedDmesons", param.GetName());
2766 htitle = hname +
";;#it{N}_{D}";
2769 hname = TString::Format(
"%s/fHistNDmesons", param.GetName());
2770 htitle = hname +
";#it{N}_{D};events";
2773 hname = TString::Format(
"%s/fHistNEvents", param.GetName());
2774 htitle = hname +
";Event status;counts";
2776 h->GetXaxis()->SetBinLabel(1,
"Accepted");
2777 h->GetXaxis()->SetBinLabel(2,
"Rejected");
2779 hname = TString::Format(
"%s/fHistEventRejectionReasons", param.GetName());
2780 htitle = hname +
";Rejection reason;counts";
2783 hname = TString::Format(
"%s/fHistRejectedDMesonPt", param.GetName());
2784 htitle = hname +
";#it{p}_{T,D} (GeV/#it{c});counts";
2787 hname = TString::Format(
"%s/fHistRejectedDMesonEta", param.GetName());
2788 htitle = hname +
";#it{#eta}_{D};counts";
2791 hname = TString::Format(
"%s/fHistRejectedDMesonPhi", param.GetName());
2792 htitle = hname +
";#it{#phi}_{D};counts";
2797 hname = TString::Format(
"%s/fHistRejectedDMesonInvMass", param.GetName());
2798 htitle = hname +
";#it{M}_{K#pi} (GeV/#it{c}^{2});counts";
2805 hname = TString::Format(
"%s/fHistRejectedDMeson2ProngInvMass", param.GetName());
2806 htitle = hname +
";#it{M}_{K#pi} (GeV/#it{c}^{2});counts";
2810 Double_t D0mass = TDatabasePDG::Instance()->GetParticle(421)->Mass();
2811 hname = TString::Format(
"%s/fHistRejectedDMesonDeltaInvMass", param.GetName());
2812 htitle = hname +
";#it{M}_{K#pi#pi} - #it{M}_{K#pi} (GeV/#it{c}^{2});counts";
2819 hname = TString::Format(
"%s/fHistPartonPt", param.GetName());
2820 htitle = hname +
";#it{p}_{T,parton} (GeV/#it{c});counts";
2823 hname = TString::Format(
"%s/fHistPartonEta", param.GetName());
2824 htitle = hname +
";#eta_{parton};counts";
2827 hname = TString::Format(
"%s/fHistPartonPhi", param.GetName());
2828 htitle = hname +
";#phi_{parton};counts";
2831 hname = TString::Format(
"%s/fHistPartonType", param.GetName());
2832 htitle = hname +
";type;counts";
2835 hname = TString::Format(
"%s/fHistPrompt", param.GetName());
2836 htitle = hname +
";Type;counts";
2838 h->GetXaxis()->SetBinLabel(1,
"Unknown");
2839 h->GetXaxis()->SetBinLabel(2,
"Prompt");
2840 h->GetXaxis()->SetBinLabel(3,
"Non-Prompt");
2842 hname = TString::Format(
"%s/fHistAncestor", param.GetName());
2843 htitle = hname +
";Ancestor;counts";
2845 h->GetXaxis()->SetBinLabel(1,
"Unknown");
2846 h->GetXaxis()->SetBinLabel(2,
"Charm");
2847 h->GetXaxis()->SetBinLabel(3,
"Bottom");
2848 h->GetXaxis()->SetBinLabel(4,
"Proton");
2851 for (
auto& jetDef : param.fJetDefinitions) {
2852 ::Info(
"AliAnalysisTaskDmesonJets::UserCreateOutputObjects",
"Allocating histograms for jet definition '%s'", jetDef.GetName());
2855 hname = TString::Format(
"%s/%s/fHistNDmesonsVsNconstituents", param.GetName(), jetDef.GetName());
2856 htitle = hname +
";#it{N}_{constituents};#it{N}_{D};counts";
2860 hname = TString::Format(
"%s/%s/fHistMCParticleRejectionReason", param.GetName(), jetDef.GetName());
2861 htitle = hname +
";Track rejection reason;#it{p}_{T,track} (GeV/#it{c});counts";
2865 hname = TString::Format(
"%s/%s/fHistTrackRejectionReason", param.GetName(), jetDef.GetName());
2866 htitle = hname +
";Track rejection reason;#it{p}_{T,track} (GeV/#it{c});counts";
2870 hname = TString::Format(
"%s/%s/fHistClusterRejectionReason", param.GetName(), jetDef.GetName());
2871 htitle = hname +
";Cluster rejection reason;#it{p}_{T,cluster} (GeV/#it{c});counts";
2875 hname = TString::Format(
"%s/%s/fHistDMesonDaughterNotInJet", param.GetName(), jetDef.GetName());
2876 htitle = hname +
";#it{p}_{T,track} (GeV/#it{c});counts";
2879 hname = TString::Format(
"%s/%s/fHistRejectedJetPt", param.GetName(), jetDef.GetName());
2880 htitle = hname +
";#it{p}_{T,jet} (GeV/#it{c});counts";
2883 hname = TString::Format(
"%s/%s/fHistRejectedJetEta", param.GetName(), jetDef.GetName());
2884 htitle = hname +
";#it{#eta}_{jet};counts";
2887 hname = TString::Format(
"%s/%s/fHistRejectedJetPhi", param.GetName(), jetDef.GetName());
2888 htitle = hname +
";#it{#phi}_{jet};counts";
2891 if (!jetDef.fRhoName.IsNull()) {
2892 hname = TString::Format(
"%s/%s/fHistRhoVsLeadJetPt", param.GetName(), jetDef.GetName());
2893 htitle = hname +
";#it{p}_{T,jet} (GeV/#it{c});#rho (GeV/#it{c} #times rad^{-1});counts";
2896 hname = TString::Format(
"%s/%s/fHistRhoVsLeadDPt", param.GetName(), jetDef.GetName());
2897 htitle = hname +
";#it{p}_{T,D} (GeV/#it{c});#rho (GeV/#it{c} #times rad^{-1});counts";
2900 hname = TString::Format(
"%s/%s/fHistRhoVsCent", param.GetName(), jetDef.GetName());
2901 htitle = hname +
";Centrality (%);#rho (GeV/#it{c} #times rad^{-1});counts";
2904 hname = TString::Format(
"%s/%s/fHistLeadJetPtVsCent", param.GetName(), jetDef.GetName());
2905 htitle = hname +
";Centrality (%);#it{p}_{T,jet} (GeV/#it{c});counts";
2908 hname = TString::Format(
"%s/%s/fHistLeadDPtVsCent", param.GetName(), jetDef.GetName());
2909 htitle = hname +
";Centrality (%);#it{p}_{T,D} (GeV/#it{c});counts";
2912 hname = TString::Format(
"%s/%s/fHistRhoVsNTracks", param.GetName(), jetDef.GetName());
2913 htitle = hname +
";no. of tracks;#rho (GeV/#it{c} #times rad^{-1});counts";
2916 hname = TString::Format(
"%s/%s/fHistLeadJetPtVsNTracks", param.GetName(), jetDef.GetName());
2917 htitle = hname +
";no. of tracks;#it{p}_{T,jet} (GeV/#it{c});counts";
2920 hname = TString::Format(
"%s/%s/fHistLeadDPtVsNTracks", param.GetName(), jetDef.GetName());
2921 htitle = hname +
";no. of tracks;#it{p}_{T,D} (GeV/#it{c});counts";
2927 param.BuildTree(GetName());
2929 param.AssignDataSlot(treeSlot+2);
2934 AliError(Form(
"Number of data output slots %d not sufficient. Tree of analysis engine %s will not be posted!",
fNOutputTrees, param.GetName()));
2965 AliError(Form(
"This task need an AOD event (Task '%s'). Expect troubles...", GetName()));
2983 params.fRandomGen = rnd;
2985 for (
auto &jetdef: params.fJetDefinitions) {
2986 if (!jetdef.fRhoName.IsNull()) {
2987 jetdef.fRho =
dynamic_cast<AliRhoParameter*
>(fInputEvent->FindListObject(jetdef.fRhoName));
2989 ::Error(
"AliAnalysisTaskDmesonJets::ExecOnce",
2990 "%s: Could not find rho object '%s' for engine '%s'",
2991 GetName(), jetdef.fRhoName.Data(), params.GetName());
2996 if (!params.fRDHFCuts) {
2998 ::Warning(
"AliAnalysisTaskDmesonJets::ExecOnce",
2999 "%s: RDHF cuts not provided for engine '%s'.",
3000 GetName(), params.GetName());
3003 ::Error(
"AliAnalysisTaskDmesonJets::ExecOnce",
3004 "%s: RDHF cuts not provided. Engine '%s' disabled.",
3005 GetName(), params.GetName());
3006 params.fInhibit = kTRUE;
3012 for (
auto cont_it : fParticleCollArray) {
3014 if (track_cont) params.fTrackContainers.push_back(track_cont);
3017 for (
auto cont_it :
fClusterCollArray) params.fClusterContainers.push_back(cont_it.second);
3022 params.fCandidateArray =
dynamic_cast<TClonesArray*
>(
fAodEvent->GetList()->FindObject(params.fBranchName.Data()));
3024 if (params.fCandidateArray) {
3027 className =
"AliAODRecoDecayHF2Prong";
3030 className =
"AliAODRecoCascadeHF";
3032 if (!params.fCandidateArray->GetClass()->InheritsFrom(className)) {
3033 ::Error(
"AliAnalysisTaskDmesonJets::ExecOnce",
3034 "%s: Objects of type %s in %s are not inherited from %s! Task will be disabled!",
3035 GetName(), params.fCandidateArray->GetClass()->GetName(), params.fCandidateArray->GetName(), className.Data());
3036 params.fCandidateArray = 0;
3037 params.fInhibit = kTRUE;
3041 ::Error(
"AliAnalysisTaskDmesonJets::ExecOnce",
3042 "Could not find candidate array '%s', skipping the event. Analysis engine '%s' will be disabled!",
3043 params.fBranchName.Data(), params.GetName());
3044 params.fInhibit = kTRUE;
3048 if (params.fMCMode !=
kNoMC) {
3049 if (!params.fMCContainer) {
3050 ::Error(
"AliAnalysisTaskDmesonJets::ExecOnce",
3051 "No MC particle container was provided. Analysis engine '%s' will be disabled!",
3053 params.fInhibit = kTRUE;
3058 if (params.fTrackContainers.size() == 0 && params.fClusterContainers.size() == 0) {
3059 ::Error(
"AliAnalysisTaskDmesonJets::ExecOnce",
3060 "No track container and no cluster container were provided. Analysis engine '%s' will be disabled!",
3062 params.fInhibit = kTRUE;
3080 if (eng.fInhibit)
continue;
3081 hname = TString::Format(
"%s/fHistEventRejectionReasons", eng.GetName());
3089 if (matchingAODdeltaAODlevel <= 0) {
3092 if (eng.fInhibit)
continue;
3093 hname = TString::Format(
"%s/fHistEventRejectionReasons", eng.GetName());
3101 eng.fDmesonJets.clear();
3102 if (eng.fInhibit)
continue;
3107 hname = TString::Format(
"%s/fHistNEvents", eng.GetName());
3109 Bool_t iseventselected = kTRUE;
3110 if (eng.fRDHFCuts) iseventselected = eng.fRDHFCuts->IsEventSelected(
fAodEvent);
3111 if (!iseventselected) {
3113 hname = TString::Format(
"%s/fHistEventRejectionReasons", eng.GetName());
3114 UInt_t bitmap = eng.fRDHFCuts->GetEventRejectionBitMap();
3118 if (label.IsNull())
break;
3128 AliDebug(2,
"Event selected");
3141 if (param.fInhibit)
continue;
3161 Int_t PdgHighParton = 0;
3162 for (
auto it = itcont.begin(); it != itcont.end(); it++) {
3164 if (
part.first.Pt() == 0)
continue;
3166 Int_t PdgCode =
part.second->GetPdgCode();
3169 if ((PdgCode < -9 || PdgCode > 9) && PdgCode != 21 && PdgCode != -21)
continue;
3171 AliDebugStream(5) <<
"Parton " << it.current_index() <<
3172 " with pdg=" << PdgCode <<
3173 ", px=" <<
part.first.Px() <<
3174 ", py=" <<
part.first.Py() <<
3175 ", pz=" <<
part.first.Pz() <<
3176 ", n daughters = " <<
part.second->GetNDaughters() <<
3181 if (
part.second->GetNDaughters() == 0)
continue;
3184 if (highestPartonPt <
part.first.Pt()) {
3185 highestPartonPt =
part.first.Pt();
3186 PdgHighParton = PdgCode;
3190 if (PdgCode != 4 && PdgCode != 5 && PdgCode != -4 && PdgCode != -5)
continue;
3192 Bool_t lastInPartonShower = kTRUE;
3193 Bool_t hadronDaughter = kFALSE;
3194 for (
Int_t daughterIndex =
part.second->GetFirstDaughter(); daughterIndex <=
part.second->GetLastDaughter(); daughterIndex++){
3195 if (daughterIndex < 0) {
3196 AliDebugStream(5) <<
"Could not find daughter index!" << std::endl;
3201 AliDebugStream(5) <<
"Could not find particle with index " << daughterIndex <<
"!" << std::endl;
3204 Int_t daughterPdgCode = daughter->GetPdgCode();
3205 if (daughter->GetMother() != it.current_index()) {
3206 AliDebugStream(5) <<
"Particle " << daughterIndex <<
" with pdg=" << daughterPdgCode <<
3207 ", px=" << daughter->Px() <<
3208 ", py=" << daughter->Py() <<
3209 ", pz=" << daughter->Pz() <<
3210 ", is not a daughter of " << it.current_index() <<
3215 AliDebugStream(5) <<
"Found daughter " << daughterIndex <<
3216 " with pdg=" << daughterPdgCode <<
3217 ", px=" << daughter->Px() <<
3218 ", py=" << daughter->Py() <<
3219 ", pz=" << daughter->Pz() <<
3221 if (daughterPdgCode == PdgCode) lastInPartonShower = kFALSE;
3222 if (TMath::Abs(daughterPdgCode) >= 111) hadronDaughter = kTRUE;
3224 if (hadronDaughter) {
3225 AliDebugStream(5) <<
"This particle has at least a hadron among its daughters!" << std::endl;
3226 if (!lastInPartonShower) AliDebugStream(2) <<
"Odly, quark " << it.current_index() <<
" with PDG " << PdgCode <<
" (pt = " <<
part.first.Pt() <<
", eta = " <<
part.first.Eta() <<
") is not the last in the parton shower but at least a hadron found among its daughters?!" << std::endl;
3229 AliDebugStream(5) <<
"This particle does not have hadrons among its daughters!" << std::endl;
3230 if (lastInPartonShower) AliDebugStream(2) <<
"Odly, quark " << it.current_index() <<
" with PDG " << PdgCode <<
" (pt = " <<
part.first.Pt() <<
", eta = " <<
part.first.Eta() <<
") is the last in the parton shower but no hadron found among its daughters?!" << std::endl;
3234 if (PdgCode == 4 || PdgCode == -4) {
3239 else if (PdgCode == 5 || PdgCode == -5) {
3248 Int_t partonType = 0;
3249 Int_t absPdgHighParton = TMath::Abs(PdgHighParton);
3250 if (absPdgHighParton == 9 || absPdgHighParton == 21) {
3254 partonType = absPdgHighParton;
3268 TParticlePDG*
part = TDatabasePDG::Instance()->GetParticle(TMath::Abs(pdg));
3273 if (nbins % 2 == 0) {
3274 minMass = mass - range / 2 - range / nbins / 2;
3275 maxMass = mass + range / 2 - range / nbins / 2;
3278 minMass = mass - range / 2;
3279 maxMass = mass + range / 2;
3294 label =
"NotSelTrigger";
3296 return label.Data();
3301 return label.Data();
3304 label =
"TooFewVtxContrib";
3306 return label.Data();
3309 label =
"ZVtxOutFid";
3311 return label.Data();
3316 return label.Data();
3319 label =
"OutsideCentrality";
3321 return label.Data();
3324 label =
"PhysicsSelection";
3326 return label.Data();
3329 label =
"BadSPDVertex";
3331 return label.Data();
3334 label =
"ZVtxSPDOutFid";
3336 return label.Data();
3339 label =
"CentralityFlattening";
3341 return label.Data();
3344 label =
"BadTrackV0Correl";
3346 return label.Data();
3349 return label.Data();
3381 ::Error(
"AddTaskDmesonJets",
"No analysis manager to connect to.");
3386 AliVEventHandler* handler = mgr->GetInputEventHandler();
3388 ::Error(
"AddTaskEmcalJetSpectraQA",
"This task requires an input event handler");
3394 if (handler->InheritsFrom(
"AliESDInputHandler")) {
3397 else if (handler->InheritsFrom(
"AliAODInputHandler")) {
3402 if (ntracks ==
"usedefault") {
3403 if (dataType ==
kESD) {
3406 else if (dataType ==
kAOD) {
3414 if (nclusters ==
"usedefault") {
3415 if (dataType ==
kESD) {
3416 nclusters =
"CaloClusters";
3418 else if (dataType ==
kAOD) {
3419 nclusters =
"caloClusters";
3426 if (nMCpart ==
"usedefault") {
3427 nMCpart =
"mcparticles";
3430 TString name(
"AliAnalysisTaskDmesonJets");
3431 if (strcmp(suffix,
"") != 0) {
3432 name += TString::Format(
"_%s", suffix.Data());
3437 if (!ntracks.IsNull()) {
3439 jetTask->AdoptParticleContainer(trackCont);
3442 if (!nMCpart.IsNull()) {
3444 partCont->SetEtaLimits(-1.5, 1.5);
3445 partCont->SetPtLimits(0, 1000);
3446 jetTask->AdoptParticleContainer(partCont);
3449 jetTask->AddClusterContainer(nclusters.Data());
3452 mgr->AddTask(jetTask);
3455 AliAnalysisDataContainer* cinput1 = mgr->GetCommonInputContainer();
3457 contname1 +=
"_histos";
3458 AliAnalysisDataContainer* coutput1 = mgr->CreateContainer(contname1.Data(),
3459 TList::Class(), AliAnalysisManager::kOutputContainer,
3460 Form(
"%s", AliAnalysisManager::GetCommonFileName()));
3462 mgr->ConnectInput(jetTask, 0, cinput1);
3463 mgr->ConnectOutput(jetTask, 1, coutput1);
3465 for (
Int_t i = 0; i < nMaxTrees; i++) {
3466 TString contname = TString::Format(
"%s_tree_%d", name.Data(), i);
3467 AliAnalysisDataContainer *coutput = mgr->CreateContainer(contname.Data(),
3468 TTree::Class(),AliAnalysisManager::kOutputContainer,
3469 Form(
"%s", AliAnalysisManager::GetCommonFileName()));
3470 mgr->ConnectOutput(jetTask, 2+i, coutput);
Int_t GetNConstituents() const
AliD0ExtendedInfoSummary()
Double32_t fCorrZ
Z of the D meson after subtracting average background.
Lightweight class that encapsulates D meson jets.
void SetRejectionReasonLabels(TAxis *axis)
UChar_t fNDaughters
Number of daughters.
Double32_t fZ
Z of the D meson.
void Print() const
Prints the content of this object in the standard output.
void UserCreateOutputObjects()
AliDmesonInfoSummary * fCurrentDmesonJetInfo
! Current D meson jet info
AliAODMCParticle * fParton
! pointer to the parton in the shower tree of the D meson (only for particle level D mesons) ...
std::list< AnalysisEngine > fAnalysisEngines
Array of analysis parameters.
std::string fClassName
Class name where the event was not found.
Bool_t FillTree(Bool_t applyKinCuts)
AliEMCALGeometry * fGeom
!emcal geometry
void SetDMesonCandidate(AliAODRecoDecay *c)
Analysis task for D meson jets.
UInt_t fRejectedOrigin
Bit mask with D meson origins that are rejected (used for MC analysis, i.e. signal-only, background-only and particle-level)
virtual void Set(const AliDmesonJetInfo &source)
Invariant mass of the D0 meson candidate in GeV/c2.
virtual void Reset()
Reset the object.
TList * fOutput
!output list
Bool_t IsJetInAcceptance(const AliJetInfo &jet) const
Double_t fSoftPionPt
! Transverse momentum of the soft pion of the D* candidate
EDataType_t
Switch for the data type.
virtual AliAODMCParticle * GetMCParticle(Int_t i=-1) const
void SetJetPhiRange(Double_t min, Double_t max)
void Getd0MeasMinusExpProng(Int_t ip, Double_t magf, Double_t &d0diff, Double_t &errd0diff) const
AliRDHFCuts * fRDHFCuts
D meson candidates cuts.
virtual void Set(const AliDmesonJetInfo &source)
THistManager * fHistManager
! Histograms
void RunAnalysis()
Run the analysis.
TString fRhoName
Name of the object that holds the average background value.
Lightweight class that encapsulates D meson jets.
std::vector< AliTrackContainer * > fTrackContainers
! Track containers
AnalysisEngine * AddAnalysisEngine(ECandidateType_t type, TString cutfname, TString cuttype, EMCMode_t bkgMode, EJetType_t jettype, Double_t jetradius, TString rhoName="")
Double_t fTrackEfficiency
Artificial tracking inefficiency (0...1)
void SetJetEtaRange(Double_t min, Double_t max)
Bool_t FillHnSparse(Bool_t applyKinCuts)
std::vector< AliClusterContainer * > fClusterContainers
! Cluster containers
Double32_t fPhi
Phi of the D meson.
Int_t MatchToMC(Int_t pdgabs, Int_t pdgabs2prong, Int_t *pdgDg, Int_t *pdgDg2prong, TClonesArray *mcArray, Bool_t isV0=kFALSE) const
AliHFAODMCParticleContainer * fMCContainer
! MC particle container
ERecoScheme_t fRecoScheme
Jet recombination scheme (pt scheme, E scheme, ...)
const TObjArray & GetDaughterList() const
void SetRDHFCuts(AliRDHFCuts *cuts)
const char * what() const noexcept
Double_t fMaxNeutralPt
Transverse momentum of the leading neutral particle (or cluster)
void RunDetectorLevelAnalysis()
Run a detector level analysis.
Container with name, TClonesArray and cuts for particles.
Double32_t fPartonPt
Transverse momentum of the parton.
friend bool operator<(const AnalysisEngine &lhs, const AnalysisEngine &rhs)
Double32_t fArea
Area of the jet.
void FillTH2(const char *hname, double x, double y, double weight=1., Option_t *opt="")
Fill a 2D histogram within the container.
virtual void UserCreateOutputObjects()
Creates the output containers.
void FillPartonLevelHistograms()
Fill histograms with parton-level information.
static Int_t CheckMatchingAODdeltaAODevents()
Double32_t fInvMass
Invariant mass of the D0 meson candidate in GeV/c2.
Lightweight class that encapsulates D meson jets.
Double_t fInvMass2Prong
! 2-prong mass of the D* candidate (w/o the soft pion)
friend bool operator==(const AnalysisEngine &lhs, const AnalysisEngine &rhs)
TString fName
! Name of this object
Double_t fMinChargedPt
Minimum pt of the leading charged particle (or track)
static void CalculateMassLimits(Double_t range, Int_t pdg, Int_t nbins, Double_t &minMass, Double_t &maxMass)
AliAODEvent * fAodEvent
! AOD event
virtual void Reset()
Reset the object.
Bool_t FindJet(AliAODRecoDecayHF2Prong *Dcand, AliDmesonJetInfo &DmesonJet, AliHFJetDefinition &jetDef)
UInt_t fEnabledAxis
Use bit defined in EAxis_t to enable axis in the THnSparse.
Double32_t fPtK
Transverse momentum of the kaon.
TRandom * fRandomGen
! Random number generator
Double32_t fCosPointing
Cosine of the pointing angle.
AliRhoParameter * fRho
Object that holds the average background value.
EMCMode_t fMCMode
MC mode: No MC (data and MC detector level), background-only (MC), signal-only (MC), MC truth (particle level)
Bool_t FillRecoCand(AliVEvent *event, AliAODRecoDecayHF3Prong *rd3)
Double_t fJetGhostArea
Area of the ghost particles.
Double_t InvMassD0() const
void BuildHnSparse(UInt_t enabledAxis)
void SetRecombScheme(const fastjet::RecombinationScheme &scheme)
const char * GetName() const
virtual void Reset()
Reset the object.
AnalysisEngine()
This is the default constructor, used for ROOT I/O purposes.
Double_t Prodd0d0() const
Int_t fDataSlotNumber
! Data slot where the tree output is posted
virtual void Reset()
Reset the current object.
EFindParticleOriginMode_t
Double32_t fPtPi
Transverse momentum of the pion.
void Init(const AliEMCALGeometry *const geom, Int_t runNumber)
Initialize the analysis engine.
static FJRecoScheme ConvertToFJRecoScheme(ERecoScheme_t reco)
AliVParticle * fDmesonParticle
! pointer to the particle object
Double32_t fd0d0
D0K * D0Pi.
TString part
use mixed event to constrain combinatorial background
static TString GenerateJetName(EJetType_t jetType, EJetAlgo_t jetAlgo, ERecoScheme_t recoScheme, Double_t radius, AliParticleContainer *partCont, AliClusterContainer *clusCont, TString tag)
Double_t fMinJetEta
Minimum jet eta.
static std::pair< AliAnalysisTaskDmesonJets::EMesonOrigin_t, AliAODMCParticle * > IsPromptCharm(const AliAODMCParticle *part, TClonesArray *mcArray)
virtual void Set(const AliDmesonJetInfo &source)
AliAODEvent * fAodEvent
! AOD event
Double32_t fN
Number of jet constituents.
Select tracks based on specific prescriptions of HF analysis.
Double32_t fPt
Transverse momentum of the jet in GeV/c.
ECandidateType_t fCandidateType
Candidate type.
Double_t GetDistance(std::string n, Double_t &deta, Double_t &dphi) const
Int_t fMCLabel
! MC label, i.e. index of the generator level D meson (only for detector level D meson candidates) ...
EBeamType_t fForceBeamType
forced beam type
Double32_t fR
Distance between D meson and jet axis.
virtual void Reset()
Reset the object.
virtual void Set(const AliDmesonJetInfo &source)
void AddInputVectors(AliEmcalContainer *cont, Int_t offset, TH2 *rejectHist=0, Double_t eff=0.)
const std::vector< fastjet::PseudoJet > & GetInclusiveJets() const
EJetType_t fJetType
Jet type (charged, full, neutral)
Double32_t fEta
Eta of the D meson.
Double32_t fPt
Transverse momentum of the D meson in GeV/c.
TH2 * CreateTH2(const char *name, const char *title, int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, Option_t *opt="")
Create a new TH2 within the container.
virtual void Set(const AliDmesonJetInfo &source)
AliTLorentzVector fD
! 4-momentum of the D meson candidate
Double_t GetDistance(const AliJetInfo &jet, Double_t &deta, Double_t &dphi) const
TObject * FindObject(const char *name) const
Find an object inside the container.
Lightweight class that encapsulates D0.
Double_t fMinJetPhi
Minimum jet phi.
THashList * GetListOfHistograms() const
Get the list of histograms.
Double_t CosThetaStarD0bar() const
angle of K
UInt_t fCandidatePDG
Candidate PDG.
AliAnalysisTaskDmesonJets()
This is the default constructor, used for ROOT I/O purposes.
virtual void Reset()
Reset the current object.
AnalysisEngine & operator=(const AnalysisEngine &source)
Lightweight class that encapsulates D meson jets for PbPb analysis.
Double_t fMaxJetPt
Maximum jet pT.
Struct that encapsulates analysis parameters.
std::vector< AliHFJetDefinition >::iterator FindJetDefinition(const AliHFJetDefinition &eng)
Base task in the EMCAL framework (lighter version of AliAnalysisTaskEmcal)
Double_t Phi_0_2pi() const
static AliAODMCParticle * FindParticleOrigin(const AliAODMCParticle *part, TClonesArray *mcArray, EFindParticleOriginMode_t mode, const std::set< UInt_t > &pdgSet)
Double_t fMinNeutralPt
Minimum pt of the leading neutral particle (or cluster)
Double32_t fPhi
Phi of the jet.
Bool_t fD0D0bar
! kTRUE if selected both as D0 and D0bar
Int_t GetDataSlotNumber() const
Double_t fRadius
Jet radius.
Double_t fMinJetPt
Minimum jet pT.
TTree * fTree
! Output tree
void SetAlgorithm(const fastjet::JetAlgorithm &algor)
TH1 * CreateTH1(const char *name, const char *title, int nbins, double xmin, double xmax, Option_t *opt="")
Create a new TH1 within the container.
AliAODTrack * GetBachelor() const
Bool_t fD0Extended
Store extended information in the tree (only for D0 mesons)
AliRDHFCuts * LoadDMesonCutsFromFile(TString cutfname, TString cutsname)
AliDmesonJetInfo()
Default constructor.
std::list< AnalysisEngine >::iterator FindAnalysisEngine(const AnalysisEngine &eng)
std::vector< AliHFJetDefinition > fJetDefinitions
Jet definitions.
Double_t fMaxNeutralPt
Maximum pt of the leading neutral particle (or cluster)
Double_t fMaxJetPhi
Maximum jet phi.
Int_t fNMassBins
Mass number of bins.
Double_t fMaxMass
Max mass in histogram axis.
Double_t InvMassD0bar() const
EJetAlgo_t fJetAlgo
Jet algorithm (kt, anti-kt,...)
Double_t GetZ(std::string n) const
static const char * GetHFEventRejectionReasonLabel(UInt_t &bitmap)
Lightweight class that encapsulates D*.
virtual void Clear(const Option_t *="")
virtual void Reset()
Reset the object.
Bool_t fInhibit
Inhibit the task.
friend bool operator<(const AliHFJetDefinition &lhs, const AliHFJetDefinition &rhs)
void SetChargedPtRange(Double_t min, Double_t max)
void SetRejectedOriginMap(UInt_t m)
Bool_t ExtractDstarAttributes(const AliAODRecoCascadeHF *DstarCand, AliDmesonJetInfo &DmesonJet, UInt_t i)
Int_t fJetAreaType
Jet area type.
void FillTH1(const char *hname, double x, double weight=1., Option_t *opt="")
Fill a 1D histogram within the container.
const AliJetInfo * GetJet(std::string n) const
Float_t fPtBinWidth
Histogram pt bin width.
Short_t fPartonType
! type of the parton in the shower tree (only for particle level D mesons)
TClonesArray * fCandidateArray
! D meson candidate array
void SetAcceptedDecayMap(UInt_t m)
const AliMCParticleIterableMomentumContainer all_momentum() const
virtual ~AliAnalysisTaskDmesonJets()
This is the standard destructor.
Byte_t fSelectionType
! for D0: 0=not selected, 1=D0, 2=D0bar
void SetCandidateProperties(Double_t range)
Bool_t ExtractD0Attributes(const AliAODRecoDecayHF2Prong *Dcand, AliDmesonJetInfo &DmesonJet, UInt_t i)
Double_t Phi_0_2pi() const
Select MC particles based on specific prescriptions of HF analysis.
Double32_t fCosThetaStar
Cosine of theta star.
static EMesonDecayChannel_t CheckDecayChannel(const AliAODMCParticle *part, TClonesArray *mcArray)
void SetGhostArea(Double_t gharea)
AliDmesonJetInfo & operator=(const AliDmesonJetInfo &source)
Double_t fMaxChargedPt
Transverse momentum of the leading charged particle (or track)
Double_t GetCorrZ(std::string n) const
Double32_t fCorrPt
Transverse momentum of the jet in GeV/c after subtracting average background.
std::vector< fastjet::PseudoJet > GetJetConstituents(UInt_t idx) const
friend bool operator==(const AliHFJetDefinition &lhs, const AliHFJetDefinition &rhs)
static FJJetAlgo ConvertToFJAlgo(EJetAlgo_t algo)
Double_t fMaxChargedPt
Maximum pt of the leading charged particle (or track)
void AdoptRDHFCuts(AliRDHFCuts *cuts)
Class that encapsulates jets.
std::map< std::string, AliJetInfo > fJets
! list of jets
Look for the very first particle in the fragmentation tree.
AliAODMCParticle * fAncestor
! pointer to the ancestor particle in the shower tree of the D meson (only for particle level D meson...
Double32_t fDeltaInvMass
< Difference between the Kpipi and the Kpi invariant masses in GeV/c2
Bool_t IsSpecialPDGFound() const
std::map< AliAODMCParticle *, Short_t > fPartons
! set of the partons in the shower that produced each D meson
Bool_t fRejectISR
! Reject initial state radiation
virtual ~AnalysisEngine()
void RunParticleLevelAnalysis()
Run a particle level analysis.
std::map< std::string, AliParticleContainer * > fParticleCollArray
particle/track collection array
std::map< int, AliDmesonJetInfo > fDmesonJets
! Array containing the D meson jets
std::string fWhat
Error message.
Double32_t f2ProngInvMass
Double_t fTrackEfficiency
! Artificial tracking inefficiency (0...1) -> set automatically at ExecOnce by AliAnalysisTaskDmesonJ...
void SetJetPtRange(Double_t min, Double_t max)
Bool_t fApplyKinematicCuts
Apply jet kinematic cuts.
Double32_t fSelectionType
Selection type: D0, D0bar, both.
Byte_t GetSelectionTypeSummary() const
Bool_t IsSelected(TObject *obj)
const char * GetName() const
Generate a name for this jet definition.
AliEventNotFound(const std::string &class_name, const std::string &method_name)
UInt_t fAcceptedDecay
Bit mask with D meson decays that are accepted (only used for particle-level analysis) ...
virtual void Set(const AliDmesonJetInfo &source, std::string n)
Bool_t fReconstructed
! Whether this D meson was reconstructed (only for particle level D mesons)
Bool_t ExtractRecoDecayAttributes(const AliAODRecoDecayHF2Prong *Dcand, AliDmesonJetInfo &DmesonJet, UInt_t i)
Double_t InvMassD0() const
Double32_t fEta
Eta of the jet.
Bool_t fRejectISR
Reject initial state radiation.
EOutputType_t fOutputType
Output type: none, TTree or THnSparse.
virtual void AddInputVector(Double_t px, Double_t py, Double_t pz, Double_t E, Int_t index=-99999)
Double_t InvMassDstarKpipi() const
const AliVEvent * fEvent
! pointer to the ESD/AOD event
TArrayI fPDGdaughters
List of the PDG code of the daughters.
void SetNeutralPtRange(Double_t min, Double_t max)
Double32_t fMaxNormd0
max norm d0
TString fBranchName
AOD branch where the D meson candidate are found.
Float_t fMaxPt
Histogram pt limit.
Double_t CosPointingAngle() const
Int_t fNOutputTrees
Maximum number of output trees.
virtual Bool_t FillHistograms()
AliHFJetDefinition()
This is the default constructor, used for ROOT I/O purposes.
Double_t CosThetaStarD0() const
void SetSpecialPDG(Int_t pdg)
AliHFJetDefinition & operator=(const AliHFJetDefinition &source)
Int_t GetNAcceptedParticles() const
Double_t fMaxJetEta
Maximum jet eta.
void SetAreaType(const fastjet::AreaType &atype)
std::map< std::string, AliClusterContainer * > fClusterCollArray
cluster collection array
THnSparse * CreateTHnSparse(const char *name, const char *title, int ndim, const int *nbins, const double *min, const double *max, Option_t *opt="")
Create a new THnSparse within the container.
Double_t fCorrPt
Transverse momentum of the jet after subtracting the average background.
AliHFAODMCParticleContainer * fMCContainer
! MC particle container
TString fCandidateName
Candidate name.
AliJetInfoSummary ** fCurrentJetInfo
! Current jet info
virtual Bool_t IsInFiducialAcceptance(Double_t, Double_t) const
AliFJWrapper * fFastJetWrapper
! Fastjet wrapper
AliHFJetDefinition * AddJetDefinition(EJetType_t type, Double_t r, EJetAlgo_t algo, ERecoScheme_t reco)
Container for MC-true particles within the EMCAL framework.
Lightweight class that encapsulates D0.
void SetMakeGeneralHistograms(Bool_t g)
Bool_t IsAnyJetInAcceptance(const AliDmesonJetInfo &dMesonJet) const
Double_t fCent
! Event centrality
Double_t fCent
!event centrality
void SetCharge(EChargeCut_t c)
Container for jet within the EMCAL jet framework.
void SetRejectISR(Bool_t b)
Double32_t fPartonType
Parton type.
Int_t PostDataFromAnalysisEngine(const AnalysisEngine &eng)
AliFJWrapper * fFastJetWrapper
! Fastjet wrapper
THistManager fHistManager
Histogram manager.
void Reset()
Reset all fields to their default values.
static AliAnalysisTaskDmesonJets * AddTaskDmesonJets(TString ntracks="usedefault", TString nclusters="usedefault", TString nMCpart="", Int_t nMaxTrees=2, TString suffix="")
TTree * BuildTree(const char *taskName)
virtual void Set(const AliDmesonJetInfo &source, std::string n)
Bool_t FillQA(Bool_t applyKinCuts)
Double_t fMinMass
Min mass in histogram axis.
Double32_t fDCA
Distance of closest approach.