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 +=
"_kBackgroundOnly";
1125 fName +=
"_kSignalOnly";
1128 fName +=
"_MCTruth";
1131 fName +=
"_WrongPID";
1139 return fName.Data();
1154 ::Info(
"AliAnalysisTaskDmesonJets::AnalysisEngine::AddJetDefinition",
"Jet definition '%s' has been added to analysis engine '%s'." 1155 "Total number of jet definitions is now %lu.",
1161 ::Warning(
"AliAnalysisTaskDmesonJets::AnalysisEngine::AddJetDefinition",
"The same jet definition '%s' was already added in analysis engine '%s'.", def.
GetName(),
GetName());
1191 std::vector<AliHFJetDefinition>::iterator it =
fJetDefinitions.begin();
1225 for (
auto &jetdef :
fJetDefinitions) jetdef.SetChargedPtRange(min, max);
1233 for (
auto &jetdef :
fJetDefinitions) jetdef.SetNeutralPtRange(min, max);
1310 AliDebug(10,
"Checking if D0 meson is selected");
1312 if (isSelected == 0)
return kFALSE;
1314 Int_t MCtruthPdgCode = 0;
1326 AliAODMCParticle* aodMcPart =
static_cast<AliAODMCParticle*
>(
fMCContainer->GetArray()->At(mcLab));
1334 MCtruthPdgCode = aodMcPart->PdgCode();
1339 if (isSelected == 1) {
1340 if (i != 0)
return kFALSE;
1347 AliDebug(10,
"Selected as D0");
1354 else if (isSelected == 2) {
1355 if (i != 1)
return kFALSE;
1362 AliDebug(10,
"Selected as D0bar");
1369 else if (isSelected == 3) {
1370 AliDebug(10,
"Selected as either D0 or D0bar");
1375 if (i != 0)
return kFALSE;
1376 AliDebug(10,
"MC truth is D0");
1381 if (i != 1)
return kFALSE;
1382 AliDebug(10,
"MC truth is D0bar");
1391 AliDebug(10,
"Returning invariant mass with D0 hypothesis");
1395 AliDebug(10,
"Returning invariant mass with D0bar hypothesis");
1407 DmesonJet.
fD.SetPtEtaPhiM(Dcand->Pt(), Dcand->Eta(), Dcand->Phi(), invMassD);
1420 AliDebug(10,
"Checking if D* meson is selected");
1422 if (isSelected == 0)
return kFALSE;
1424 if ((i == 1 && DstarCand->Charge()>0) || (i == 0 && DstarCand->Charge()<0) || i > 1)
return kFALSE;
1426 Int_t MCtruthPdgCode = 0;
1431 Int_t pdgDgDStartoD0pi[2] = { 421, 211 };
1432 Int_t pdgDgD0toKpi[2] = { 321, 211 };
1435 AliDebug(10, Form(
"MC label is %d", mcLab));
1438 AliAODMCParticle* aodMcPart =
static_cast<AliAODMCParticle*
>(
fMCContainer->GetArray()->At(mcLab));
1446 MCtruthPdgCode = aodMcPart->PdgCode();
1447 AliDebug(10, Form(
"MC truth pdg code is %d",MCtruthPdgCode));
1452 Int_t absMCtruthPdgCode = TMath::Abs(MCtruthPdgCode);
1460 DmesonJet.
fD.SetPtEtaPhiM(DstarCand->Pt(), DstarCand->Eta(), DstarCand->Phi(), invMassD);
1481 Int_t absPdgPart = TMath::Abs(part->GetPdgCode());
1483 if (part->GetNDaughters() == 2) {
1485 AliAODMCParticle* d1 =
static_cast<AliAODMCParticle*
>(mcArray->At(part->GetDaughter(0)));
1486 AliAODMCParticle* d2 =
static_cast<AliAODMCParticle*
>(mcArray->At(part->GetDaughter(1)));
1492 Int_t absPdg1 = TMath::Abs(d1->GetPdgCode());
1493 Int_t absPdg2 = TMath::Abs(d2->GetPdgCode());
1495 if (absPdgPart == 421) {
1496 if ((absPdg1 == 211 && absPdg2 == 321) ||
1497 (absPdg1 == 321 && absPdg2 == 211)) {
1502 if (absPdgPart == 413) {
1503 if (absPdg1 == 421 && absPdg2 == 211) {
1509 else if (absPdg1 == 211 && absPdg2 == 421) {
1529 std::pair<AliAnalysisTaskDmesonJets::EMesonOrigin_t, AliAODMCParticle*> result(
kUnknownQuark, 0);
1531 if (!part)
return result;
1532 if (!mcArray)
return result;
1534 static std::set<UInt_t> partons = { 4, 5 };
1538 result.second = parton;
1539 UInt_t absPdgParton = TMath::Abs(parton->GetPdgCode());
1540 if (absPdgParton == 4) result.first =
kFromCharm;
1541 else if (absPdgParton == 5) result.first =
kFromBottom;
1557 static std::set<UInt_t> pdgSet;
1573 AliAODMCParticle* result =
nullptr;
1575 Int_t mother = part->GetMother();
1576 while (mother >= 0) {
1577 AliAODMCParticle* mcGranma =
static_cast<AliAODMCParticle*
>(mcArray->At(mother));
1579 UInt_t abspdgGranma = TMath::Abs(mcGranma->GetPdgCode());
1582 if (pdgSet.empty() || pdgSet.count(abspdgGranma) > 0) {
1587 mother = mcGranma->GetMother();
1590 ::Error(
"AliAnalysisTaskDmesonJets::AnalysisParams::FindParticleOrigin",
"Could not retrieve mother particle %d!", mother);
1602 jetDef.fJets.clear();
1626 std::map<AliHFJetDefinition*,Double_t> maxJetPt;
1630 Int_t nAccCharm[3] = {0};
1631 for (
Int_t icharm = 0; icharm < nD; icharm++) {
1633 if (!charmCand)
continue;
1638 Int_t nMassHypo = 0;
1639 if (charmCand->Pt() > maxDPt) maxDPt = charmCand->Pt();
1640 for (
Int_t im = 0; im < 2; im++) {
1645 for (
auto& def : fJetDefinitions) {
1646 if (
FindJet(charmCand, DmesonJet, def)) {
1647 Double_t jetPt = DmesonJet.
fJets[def.GetName()].fMomentum.Pt();
1648 if (jetPt > maxJetPt[&def]) maxJetPt[&def] = jetPt;
1651 AliWarning(Form(
"Could not find jet '%s' for D meson '%s': pT = %.3f, eta = %.3f, phi = %.3f",
1660 if (nMassHypo == 2) {
1665 if (nMassHypo == 2) {
1678 ntracks += track_cont->GetNAcceptEntries();
1681 for (
auto& def : fJetDefinitions) {
1682 if (!def.fRho)
continue;
1683 hname = TString::Format(
"%s/%s/fHistRhoVsLeadJetPt",
GetName(), def.GetName());
1686 hname = TString::Format(
"%s/%s/fHistRhoVsLeadDPt",
GetName(), def.GetName());
1689 hname = TString::Format(
"%s/%s/fHistRhoVsCent",
GetName(), def.GetName());
1692 hname = TString::Format(
"%s/%s/fHistLeadJetPtVsCent",
GetName(), def.GetName());
1695 hname = TString::Format(
"%s/%s/fHistLeadDPtVsCent",
GetName(), def.GetName());
1698 hname = TString::Format(
"%s/%s/fHistRhoVsNTracks",
GetName(), def.GetName());
1701 hname = TString::Format(
"%s/%s/fHistLeadJetPtVsNTracks",
GetName(), def.GetName());
1704 hname = TString::Format(
"%s/%s/fHistLeadDPtVsNTracks",
GetName(), def.GetName());
1708 hname = TString::Format(
"%s/fHistNTotAcceptedDmesons",
GetName());
1713 hname = TString::Format(
"%s/fHistNAcceptedDmesonsVsNtracks",
GetName());
1716 hname = TString::Format(
"%s/fHistNDmesons",
GetName());
1734 if (jetDef.
fRho) rho = jetDef.
fRho->GetVal();
1747 hname = TString::Format(
"%s/%s/fHistTrackRejectionReason",
GetName(), jetDef.
GetName());
1751 hname = TString::Format(
"%s/%s/fHistDMesonDaughterNotInJet",
GetName(), jetDef.
GetName());
1754 for (
Int_t i = 0; i < daughters.GetEntriesFast(); i++) {
1755 AliVParticle* daughter =
static_cast<AliVParticle*
>(daughters.At(i));
1756 if (!hftrack_cont->GetArray()->FindObject(daughter)) histDaughterNotInJet->Fill(daughter->Pt());
1764 hname = TString::Format(
"%s/%s/fHistClusterRejectionReason",
GetName(), jetDef.
GetName());
1774 for (
UInt_t ijet = 0; ijet < jets_incl.size(); ++ijet) {
1777 Bool_t isDmesonJet = kFALSE;
1784 for (
UInt_t ic = 0; ic < constituents.size(); ++ic) {
1785 if (constituents[ic].user_index() == 0) {
1786 isDmesonJet = kTRUE;
1788 else if (constituents[ic].user_index() >= 100) {
1789 if (constituents[ic].pt() > maxChPt) maxChPt = constituents[ic].pt();
1792 else if (constituents[ic].user_index() <= -100) {
1793 totalNeutralPt += constituents[ic].pt();
1794 if (constituents[ic].pt() > maxNePt) maxChPt = constituents[ic].pt();
1800 DmesonJet.
fJets[jetDef.
GetName()].fMomentum.SetPxPyPzE(jets_incl[ijet].px(), jets_incl[ijet].py(), jets_incl[ijet].pz(), jets_incl[ijet].E());
1801 DmesonJet.
fJets[jetDef.
GetName()].fNConstituents = nConst;
1802 DmesonJet.
fJets[jetDef.
GetName()].fMaxChargedPt = maxChPt;
1803 DmesonJet.
fJets[jetDef.
GetName()].fMaxNeutralPt = maxNePt;
1804 DmesonJet.
fJets[jetDef.
GetName()].fNEF = totalNeutralPt / jets_incl[ijet].pt();
1805 DmesonJet.
fJets[jetDef.
GetName()].fArea = jets_incl[ijet].area();
1806 DmesonJet.
fJets[jetDef.
GetName()].fCorrPt = DmesonJet.
fJets[jetDef.
GetName()].fMomentum.Pt() - jets_incl[ijet].area() * rho;
1820 auto itcont = cont->all_momentum();
1821 for (AliEmcalIterableMomentumContainer::iterator it = itcont.begin(); it != itcont.end(); it++) {
1822 UInt_t rejectionReason = 0;
1823 if (!cont->AcceptObject(it.current_index(), rejectionReason)) {
1824 if (rejectHist) rejectHist->Fill(AliEmcalContainer::GetRejectionReasonBitPosition(rejectionReason), it->first.Pt());
1830 if (rejectHist) rejectHist->Fill(6, it->first.Pt());
1834 Int_t uid = offset >= 0 ? it.current_index() + offset: -it.current_index() - offset;
1851 Int_t nAccCharm[3] = {0};
1853 std::map<AliHFJetDefinition*, Double_t> maxJetPt;
1857 maxJetPt[&jetDef] = 0;
1859 if (jetDef.fRho) rho = jetDef.fRho->GetVal();
1860 hname = TString::Format(
"%s/%s/fHistNDmesonsVsNconstituents",
GetName(), jetDef.GetName());
1863 switch (jetDef.fJetType) {
1880 hname = TString::Format(
"%s/%s/fHistMCParticleRejectionReason",
GetName(), jetDef.GetName());
1887 for (
auto jet : jets_incl) {
1888 Int_t nDmesonsInJet = 0;
1890 for (
auto constituent : jet.constituents()) {
1891 Int_t iPart = constituent.user_index() - 100;
1892 if (constituent.perp() < 1e-6)
continue;
1895 ::Error(
"AliAnalysisTaskDmesonJets::AnalysisEngine::RunParticleLevelAnalysis",
"Could not find jet constituent %d!", iPart);
1900 std::map<int, AliDmesonJetInfo>::iterator dMesonJetIt =
fDmesonJets.find(iPart);
1902 if (part->Pt() > maxDPt) maxDPt = part->Pt();
1903 std::pair<int, AliDmesonJetInfo> element;
1904 element.first = iPart;
1906 (*dMesonJetIt).second.fD.SetPxPyPzE(part->Px(), part->Py(), part->Pz(), part->E());
1907 (*dMesonJetIt).second.fDmesonParticle = part;
1908 (*dMesonJetIt).second.fSelectionType = part->PdgCode() > 0 ? 1 : 2;
1916 while (rs >>= 1) { p++; }
1917 (*dMesonJetIt).second.fPartonType = p;
1918 (*dMesonJetIt).second.fParton = origin.second;
1922 if (part->PdgCode() > 0) {
1930 (*dMesonJetIt).second.fJets[jetDef.GetName()].fMomentum.SetPxPyPzE(jet.px(), jet.py(), jet.pz(), jet.E());
1931 (*dMesonJetIt).second.fJets[jetDef.GetName()].fNConstituents = jet.constituents().size();
1932 (*dMesonJetIt).second.fJets[jetDef.GetName()].fArea = jet.area();
1933 (*dMesonJetIt).second.fJets[jetDef.GetName()].fCorrPt = (*dMesonJetIt).second.fJets[jetDef.GetName()].fMomentum.Pt() - jet.area() * rho;
1934 if (jet.perp() > maxJetPt[&jetDef]) maxJetPt[&jetDef] = jet.perp();
1937 if (nDmesonsInJet > 0) histNDmesonsVsNconstituents->Fill(jet.constituents().size(), nDmesonsInJet);
1943 for (
auto& def : fJetDefinitions) {
1944 if (!def.fRho)
continue;
1945 hname = TString::Format(
"%s/%s/fHistRhoVsLeadJetPt",
GetName(), def.GetName());
1948 hname = TString::Format(
"%s/%s/fHistRhoVsLeadDPt",
GetName(), def.GetName());
1951 hname = TString::Format(
"%s/%s/fHistRhoVsCent",
GetName(), def.GetName());
1954 hname = TString::Format(
"%s/%s/fHistLeadJetPtVsCent",
GetName(), def.GetName());
1957 hname = TString::Format(
"%s/%s/fHistLeadDPtVsCent",
GetName(), def.GetName());
1960 hname = TString::Format(
"%s/%s/fHistRhoVsNTracks",
GetName(), def.GetName());
1963 hname = TString::Format(
"%s/%s/fHistLeadJetPtVsNTracks",
GetName(), def.GetName());
1966 hname = TString::Format(
"%s/%s/fHistLeadDPtVsNTracks",
GetName(), def.GetName());
1970 if (
fDmesonJets.size() != nAccCharm[0]+nAccCharm[1]) AliError(Form(
"I found %lu mesons (%d)?",
fDmesonJets.size(), nAccCharm[0]+nAccCharm[1]));
1971 hname = TString::Format(
"%s/fHistNTotAcceptedDmesons",
GetName());
1976 hname = TString::Format(
"%s/fHistNAcceptedDmesonsVsNtracks",
GetName());
1979 hname = TString::Format(
"%s/fHistNDmesons",
GetName());
1990 classname =
"AliAnalysisTaskDmesonJets::AliDmesonMCInfoSummary";
1998 classname =
"AliAnalysisTaskDmesonJets::AliD0ExtendedInfoSummary";
2002 classname =
"AliAnalysisTaskDmesonJets::AliD0InfoSummary";
2007 classname =
"AliAnalysisTaskDmesonJets::AliDStarInfoSummary";
2012 TString treeName = TString::Format(
"%s_%s", taskName,
GetName());
2041 AliDebug(2,Form(
"Now working on '%s'", jetDef.GetName()));
2051 title[dim] =
"#it{p}_{T,D} (GeV/#it{c})";
2058 title[dim] =
"#eta_{D}";
2064 title[dim] =
"#phi_{D} (rad)";
2067 max[dim] = TMath::TwoPi();
2072 title[dim] =
"#it{M}_{K#pi#pi} (GeV/#it{c}^{2})";
2080 title[dim] =
"#it{M}_{K#pi} (GeV/#it{c}^{2})";
2088 title[dim] =
"#it{M}_{K#pi} (GeV/#it{c}^{2})";
2095 title[dim] =
"#it{M}_{K#pi#pi} - #it{M}_{K#pi} (GeV/#it{c}^{2})";
2100 Double_t D0mass = TDatabasePDG::Instance()->GetParticle(421)->Mass();
2108 title[dim] =
"#it{p}_{T,#pi} (GeV/#it{c})";
2115 title[dim] =
"#it{z}_{D}";
2121 if ((enabledAxis &
kDeltaR) != 0) {
2122 title[dim] =
"#Delta R_{D-jet}";
2125 max[dim] = radius * 1.5;
2130 title[dim] =
"#eta_{D} - #eta_{jet}";
2132 min[dim] = -radius * 1.2;
2133 max[dim] = radius * 1.2;
2138 title[dim] =
"#phi_{D} - #phi_{jet} (rad)";
2140 min[dim] = -radius * 1.2;
2141 max[dim] = radius * 1.2;
2145 title[dim] =
"#it{p}_{T,jet} (GeV/#it{c})";
2152 title[dim] =
"#eta_{jet}";
2158 title[dim] =
"#phi_{jet} (rad)";
2161 max[dim] = TMath::TwoPi();
2166 title[dim] =
"No. of constituents";
2173 hname = TString::Format(
"%s/%s/fDmesonJets",
GetName(), jetDef.GetName());
2175 for (
Int_t j = 0; j < dim; j++) {
2176 h->GetAxis(j)->SetTitle(title[j]);
2189 TH1* histAncestor =
nullptr;
2190 TH1* histPrompt =
nullptr;
2193 hname = TString::Format(
"%s/fHistPrompt",
GetName());
2196 hname = TString::Format(
"%s/fHistAncestor",
GetName());
2221 if (dmeson_pair.second.fParton) {
2222 fPartons[dmeson_pair.second.fParton] = dmeson_pair.second.fPartonType;
2223 UInt_t absPdgParton = TMath::Abs(dmeson_pair.second.fParton->GetPdgCode());
2224 if (absPdgParton == 4) {
2225 histPrompt->Fill(
"Prompt", 1);
2227 else if (absPdgParton == 5) {
2228 histPrompt->Fill(
"Non-Prompt", 1);
2231 histPrompt->Fill(
"Unknown", 1);
2235 histPrompt->Fill(
"Unknown", 1);
2240 if (dmeson_pair.second.fAncestor) {
2241 UInt_t absPdgAncestor = TMath::Abs(dmeson_pair.second.fAncestor->GetPdgCode());
2242 if (absPdgAncestor == 4) {
2243 histAncestor->Fill(
"Charm", 1);
2245 else if (absPdgAncestor == 5) {
2246 histAncestor->Fill(
"Bottom", 1);
2248 else if (absPdgAncestor == 2212) {
2249 histAncestor->Fill(
"Proton", 1);
2252 histAncestor->Fill(
"Unknown", 1);
2256 histAncestor->Fill(
"Unknown", 1);
2263 hname = TString::Format(
"%s/fHistRejectedDMesonPt",
GetName());
2265 hname = TString::Format(
"%s/fHistRejectedDMesonPhi",
GetName());
2267 hname = TString::Format(
"%s/fHistRejectedDMesonEta",
GetName());
2271 hname = TString::Format(
"%s/fHistRejectedDMesonInvMass",
GetName());
2275 hname = TString::Format(
"%s/fHistRejectedDMeson2ProngInvMass",
GetName());
2278 hname = TString::Format(
"%s/fHistRejectedDMesonDeltaInvMass",
GetName());
2279 fHistManager->
FillTH1(hname, dmeson_pair.second.fD.M() - dmeson_pair.second.fInvMass2Prong);
2286 hname = TString::Format(
"%s/fHistPartonPt",
GetName());
2288 hname = TString::Format(
"%s/fHistPartonEta",
GetName());
2290 hname = TString::Format(
"%s/fHistPartonPhi",
GetName());
2292 hname = TString::Format(
"%s/fHistPartonType",
GetName());
2296 if (!parton.first)
continue;
2297 histPartonPt->Fill(parton.first->Pt());
2298 histPartonEta->Fill(parton.first->Eta());
2299 histPartonPhi->Fill(TVector2::Phi_0_2pi(parton.first->Phi()));
2300 histPartonType->Fill(parton.second);
2315 TH1* histAncestor =
nullptr;
2316 TH1* histPrompt =
nullptr;
2319 hname = TString::Format(
"%s/fHistPrompt",
GetName());
2322 hname = TString::Format(
"%s/fHistAncestor",
GetName());
2345 if (dmeson_pair.second.fParton) {
2346 fPartons[dmeson_pair.second.fParton] = dmeson_pair.second.fPartonType;
2347 UInt_t absPdgParton = TMath::Abs(dmeson_pair.second.fParton->GetPdgCode());
2348 if (absPdgParton == 4) {
2349 histPrompt->Fill(
"Prompt", 1);
2351 else if (absPdgParton == 5) {
2352 histPrompt->Fill(
"Non-Prompt", 1);
2355 histPrompt->Fill(
"Unknown", 1);
2359 histPrompt->Fill(
"Unknown", 1);
2364 if (dmeson_pair.second.fAncestor) {
2365 UInt_t absPdgAncestor = TMath::Abs(dmeson_pair.second.fAncestor->GetPdgCode());
2366 if (absPdgAncestor == 4) {
2367 histAncestor->Fill(
"Charm", 1);
2369 else if (absPdgAncestor == 5) {
2370 histAncestor->Fill(
"Bottom", 1);
2372 else if (absPdgAncestor == 2212) {
2373 histAncestor->Fill(
"Proton", 1);
2376 histAncestor->Fill(
"Unknown", 1);
2380 histAncestor->Fill(
"Unknown", 1);
2385 hname = TString::Format(
"%s/fHistRejectedDMesonPt",
GetName());
2387 hname = TString::Format(
"%s/fHistRejectedDMesonPhi",
GetName());
2389 hname = TString::Format(
"%s/fHistRejectedDMesonEta",
GetName());
2393 hname = TString::Format(
"%s/fHistRejectedDMesonInvMass",
GetName());
2397 hname = TString::Format(
"%s/fHistRejectedDMeson2ProngInvMass",
GetName());
2400 hname = TString::Format(
"%s/fHistRejectedDMesonDeltaInvMass",
GetName());
2401 fHistManager->
FillTH1(hname, dmeson_pair.second.fD.M() - dmeson_pair.second.fInvMass2Prong);
2408 hname = TString::Format(
"%s/fHistPartonPt",
GetName());
2410 hname = TString::Format(
"%s/fHistPartonEta",
GetName());
2412 hname = TString::Format(
"%s/fHistPartonPhi",
GetName());
2414 hname = TString::Format(
"%s/fHistPartonType",
GetName());
2418 if (!parton.first)
continue;
2419 histPartonPt->Fill(parton.first->Pt());
2420 histPartonEta->Fill(parton.first->Eta());
2421 histPartonPhi->Fill(TVector2::Phi_0_2pi(parton.first->Phi()));
2422 histPartonType->Fill(parton.second);
2438 hname = TString::Format(
"%s/fHistRejectedDMesonPt",
GetName());
2440 hname = TString::Format(
"%s/fHistRejectedDMesonPhi",
GetName());
2442 hname = TString::Format(
"%s/fHistRejectedDMesonEta",
GetName());
2449 hname = TString::Format(
"%s/%s/fDmesonJets",
GetName(), jetDef.GetName());
2452 for (
auto& dmeson_pair : fDmesonJets) {
2453 const AliJetInfo* jet = dmeson_pair.second.GetJet(jetDef.GetName());
2455 if (!jetDef.IsJetInAcceptance(*jet)) {
2456 hname = TString::Format(
"%s/%s/fHistRejectedJetPt",
GetName(), jetDef.GetName());
2458 hname = TString::Format(
"%s/%s/fHistRejectedJetPhi",
GetName(), jetDef.GetName());
2460 hname = TString::Format(
"%s/%s/fHistRejectedJetEta",
GetName(), jetDef.GetName());
2487 std::map<std::string, AliJetInfo>::const_iterator it = DmesonJet.
fJets.find(n);
2488 if (it == DmesonJet.
fJets.end())
return kFALSE;
2490 for (
Int_t i = 0; i < h->GetNdimensions(); i++) {
2492 if (
title==
"#it{p}_{T,D} (GeV/#it{c})") contents[i] = DmesonJet.
fD.Pt();
2493 else if (
title==
"#eta_{D}") contents[i] = DmesonJet.
fD.Eta();
2496 else if (
title==
"#it{M}_{K#pi#pi} (GeV/#it{c}^{2})") contents[i] = DmesonJet.
fD.M();
2497 else if (
title==
"#it{M}_{K#pi#pi} - #it{M}_{K#pi} (GeV/#it{c}^{2})") contents[i] = DmesonJet.
fD.M() - DmesonJet.
fInvMass2Prong;
2498 else if (
title==
"#it{p}_{T,#pi} (GeV/#it{c})") contents[i] = DmesonJet.
fSoftPionPt;
2499 else if (
title==
"#it{z}_{D}") contents[i] = z;
2500 else if (
title==
"#Delta R_{D-jet}") contents[i] = deltaR;
2501 else if (
title==
"#eta_{D} - #eta_{jet}") contents[i] = deltaEta;
2502 else if (
title==
"#phi_{D} - #phi_{jet} (rad)") contents[i] = deltaPhi;
2503 else if (
title==
"#it{p}_{T,jet} (GeV/#it{c})") contents[i] = (*it).second.Pt();
2504 else if (
title==
"#eta_{jet}") contents[i] = (*it).second.Eta();
2505 else if (
title==
"#phi_{jet} (rad)") contents[i] = (*it).second.Phi_0_2pi();
2506 else if (
title==
"No. of constituents") contents[i] = (*it).second.fNConstituents;
2507 else AliWarning(Form(
"Unable to fill dimension '%s'!",
title.Data()));
2561 for (
Int_t i = 0; i < nOutputTrees; i++){
2562 DefineOutput(2+i, TTree::Class());
2581 TFile* filecuts = TFile::Open(cutfname);
2582 if (!filecuts || filecuts->IsZombie()) {
2583 ::Error(
"AliAnalysisTaskDmesonJets::LoadDMesonCutsFromFile",
"Input file not found: will use std cuts.");
2587 if (filecuts) analysiscuts =
dynamic_cast<AliRDHFCuts*
>(filecuts->Get(cutsname));
2589 if (!analysiscuts) {
2590 ::Error(
"AliAnalysisTaskDmesonJets::LoadDMesonCutsFromFile",
"Could not find analysis cuts '%s' in '%s'.", cutsname.Data(), cutfname.Data());
2596 ::Info(
"AliAnalysisTaskDmesonJets::LoadDMesonCutsFromFile",
"Cuts '%s' loaded from file '%s'", cutsname.Data(), cutfname.Data());
2599 return analysiscuts;
2633 if (!cutfname.IsNull()) {
2639 cutsname =
"D0toKpiCuts";
2642 cutsname =
"DStartoKpipiCuts";
2648 if (!cuttype.IsNull()) {
2649 cutsname += TString::Format(
"_%s", cuttype.Data());
2653 if (cuts) cuts->PrintAll();
2663 ::Info(
"AliAnalysisTaskDmesonJets::AddAnalysisEngine",
"A new analysis engine '%s' has been added. The total number of analysis engines is %lu.", eng.
GetName(),
fAnalysisEngines.size());
2667 ::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());
2671 if (found_eng->
fRDHFCuts != 0) ::Warning(
"AliAnalysisTaskDmesonJets::AddAnalysisEngine",
"D meson cuts were already defined for this D meson type. They will be overwritten.");
2689 ::Info(
"UserCreateOutputObjects",
"CreateOutputObjects of task %s", GetName());
2701 Int_t maxTracks = 6000;
2712 hname =
"fHistCharmPt";
2713 htitle = hname +
";#it{p}_{T,charm} (GeV/#it{c});counts";
2716 hname =
"fHistCharmEta";
2717 htitle = hname +
";#eta_{charm};counts";
2720 hname =
"fHistCharmPhi";
2721 htitle = hname +
";#phi_{charm};counts";
2724 hname =
"fHistCharmPt_Eta05";
2725 htitle = hname +
";#it{p}_{T,charm} (GeV/#it{c});counts";
2728 hname =
"fHistBottomPt";
2729 htitle = hname +
";#it{p}_{T,bottom} (GeV/#it{c});counts";
2732 hname =
"fHistBottomEta";
2733 htitle = hname +
";#eta_{bottom};counts";
2736 hname =
"fHistBottomPhi";
2737 htitle = hname +
";#phi_{bottom};counts";
2740 hname =
"fHistBottomPt_Eta05";
2741 htitle = hname +
";#it{p}_{T,bottom} (GeV/#it{c});counts";
2744 hname =
"fHistHighestPartonPt";
2745 htitle = hname +
";#it{p}_{T,bottom} (GeV/#it{c});counts";
2748 hname =
"fHistHighestPartonType";
2749 htitle = hname +
";type;counts";
2752 hname =
"fHistNHeavyQuarks";
2753 htitle = hname +
";number of heavy-quarks;counts";
2756 ::Info(
"AliAnalysisTaskDmesonJets::UserCreateOutputObjects",
"Allocating histograms for task '%s' (%lu analysis engines)", GetName(),
fAnalysisEngines.size());
2758 ::Info(
"AliAnalysisTaskDmesonJets::UserCreateOutputObjects",
"Allocating histograms for analysis engine '%s' (%lu jet definitions)", param.GetName(), param.fJetDefinitions.size());
2762 hname = TString::Format(
"%s/fHistNAcceptedDmesonsVsNtracks", param.GetName());
2763 htitle = hname +
";#it{N}_{tracks};#it{N}_{D};events";
2766 hname = TString::Format(
"%s/fHistNTotAcceptedDmesons", param.GetName());
2767 htitle = hname +
";;#it{N}_{D}";
2770 hname = TString::Format(
"%s/fHistNDmesons", param.GetName());
2771 htitle = hname +
";#it{N}_{D};events";
2774 hname = TString::Format(
"%s/fHistNEvents", param.GetName());
2775 htitle = hname +
";Event status;counts";
2777 h->GetXaxis()->SetBinLabel(1,
"Accepted");
2778 h->GetXaxis()->SetBinLabel(2,
"Rejected");
2780 hname = TString::Format(
"%s/fHistEventRejectionReasons", param.GetName());
2781 htitle = hname +
";Rejection reason;counts";
2784 hname = TString::Format(
"%s/fHistRejectedDMesonPt", param.GetName());
2785 htitle = hname +
";#it{p}_{T,D} (GeV/#it{c});counts";
2788 hname = TString::Format(
"%s/fHistRejectedDMesonEta", param.GetName());
2789 htitle = hname +
";#it{#eta}_{D};counts";
2792 hname = TString::Format(
"%s/fHistRejectedDMesonPhi", param.GetName());
2793 htitle = hname +
";#it{#phi}_{D};counts";
2798 hname = TString::Format(
"%s/fHistRejectedDMesonInvMass", param.GetName());
2799 htitle = hname +
";#it{M}_{K#pi} (GeV/#it{c}^{2});counts";
2806 hname = TString::Format(
"%s/fHistRejectedDMeson2ProngInvMass", param.GetName());
2807 htitle = hname +
";#it{M}_{K#pi} (GeV/#it{c}^{2});counts";
2811 Double_t D0mass = TDatabasePDG::Instance()->GetParticle(421)->Mass();
2812 hname = TString::Format(
"%s/fHistRejectedDMesonDeltaInvMass", param.GetName());
2813 htitle = hname +
";#it{M}_{K#pi#pi} - #it{M}_{K#pi} (GeV/#it{c}^{2});counts";
2820 hname = TString::Format(
"%s/fHistPartonPt", param.GetName());
2821 htitle = hname +
";#it{p}_{T,parton} (GeV/#it{c});counts";
2824 hname = TString::Format(
"%s/fHistPartonEta", param.GetName());
2825 htitle = hname +
";#eta_{parton};counts";
2828 hname = TString::Format(
"%s/fHistPartonPhi", param.GetName());
2829 htitle = hname +
";#phi_{parton};counts";
2832 hname = TString::Format(
"%s/fHistPartonType", param.GetName());
2833 htitle = hname +
";type;counts";
2836 hname = TString::Format(
"%s/fHistPrompt", param.GetName());
2837 htitle = hname +
";Type;counts";
2839 h->GetXaxis()->SetBinLabel(1,
"Unknown");
2840 h->GetXaxis()->SetBinLabel(2,
"Prompt");
2841 h->GetXaxis()->SetBinLabel(3,
"Non-Prompt");
2843 hname = TString::Format(
"%s/fHistAncestor", param.GetName());
2844 htitle = hname +
";Ancestor;counts";
2846 h->GetXaxis()->SetBinLabel(1,
"Unknown");
2847 h->GetXaxis()->SetBinLabel(2,
"Charm");
2848 h->GetXaxis()->SetBinLabel(3,
"Bottom");
2849 h->GetXaxis()->SetBinLabel(4,
"Proton");
2852 for (
auto& jetDef : param.fJetDefinitions) {
2853 ::Info(
"AliAnalysisTaskDmesonJets::UserCreateOutputObjects",
"Allocating histograms for jet definition '%s'", jetDef.GetName());
2856 hname = TString::Format(
"%s/%s/fHistNDmesonsVsNconstituents", param.GetName(), jetDef.GetName());
2857 htitle = hname +
";#it{N}_{constituents};#it{N}_{D};counts";
2861 hname = TString::Format(
"%s/%s/fHistMCParticleRejectionReason", param.GetName(), jetDef.GetName());
2862 htitle = hname +
";Track rejection reason;#it{p}_{T,track} (GeV/#it{c});counts";
2866 hname = TString::Format(
"%s/%s/fHistTrackRejectionReason", param.GetName(), jetDef.GetName());
2867 htitle = hname +
";Track rejection reason;#it{p}_{T,track} (GeV/#it{c});counts";
2871 hname = TString::Format(
"%s/%s/fHistClusterRejectionReason", param.GetName(), jetDef.GetName());
2872 htitle = hname +
";Cluster rejection reason;#it{p}_{T,cluster} (GeV/#it{c});counts";
2876 hname = TString::Format(
"%s/%s/fHistDMesonDaughterNotInJet", param.GetName(), jetDef.GetName());
2877 htitle = hname +
";#it{p}_{T,track} (GeV/#it{c});counts";
2880 hname = TString::Format(
"%s/%s/fHistRejectedJetPt", param.GetName(), jetDef.GetName());
2881 htitle = hname +
";#it{p}_{T,jet} (GeV/#it{c});counts";
2884 hname = TString::Format(
"%s/%s/fHistRejectedJetEta", param.GetName(), jetDef.GetName());
2885 htitle = hname +
";#it{#eta}_{jet};counts";
2888 hname = TString::Format(
"%s/%s/fHistRejectedJetPhi", param.GetName(), jetDef.GetName());
2889 htitle = hname +
";#it{#phi}_{jet};counts";
2892 if (!jetDef.fRhoName.IsNull()) {
2893 hname = TString::Format(
"%s/%s/fHistRhoVsLeadJetPt", param.GetName(), jetDef.GetName());
2894 htitle = hname +
";#it{p}_{T,jet} (GeV/#it{c});#rho (GeV/#it{c} #times rad^{-1});counts";
2897 hname = TString::Format(
"%s/%s/fHistRhoVsLeadDPt", param.GetName(), jetDef.GetName());
2898 htitle = hname +
";#it{p}_{T,D} (GeV/#it{c});#rho (GeV/#it{c} #times rad^{-1});counts";
2901 hname = TString::Format(
"%s/%s/fHistRhoVsCent", param.GetName(), jetDef.GetName());
2902 htitle = hname +
";Centrality (%);#rho (GeV/#it{c} #times rad^{-1});counts";
2905 hname = TString::Format(
"%s/%s/fHistLeadJetPtVsCent", param.GetName(), jetDef.GetName());
2906 htitle = hname +
";Centrality (%);#it{p}_{T,jet} (GeV/#it{c});counts";
2909 hname = TString::Format(
"%s/%s/fHistLeadDPtVsCent", param.GetName(), jetDef.GetName());
2910 htitle = hname +
";Centrality (%);#it{p}_{T,D} (GeV/#it{c});counts";
2913 hname = TString::Format(
"%s/%s/fHistRhoVsNTracks", param.GetName(), jetDef.GetName());
2914 htitle = hname +
";no. of tracks;#rho (GeV/#it{c} #times rad^{-1});counts";
2917 hname = TString::Format(
"%s/%s/fHistLeadJetPtVsNTracks", param.GetName(), jetDef.GetName());
2918 htitle = hname +
";no. of tracks;#it{p}_{T,jet} (GeV/#it{c});counts";
2921 hname = TString::Format(
"%s/%s/fHistLeadDPtVsNTracks", param.GetName(), jetDef.GetName());
2922 htitle = hname +
";no. of tracks;#it{p}_{T,D} (GeV/#it{c});counts";
2928 param.BuildTree(GetName());
2930 param.AssignDataSlot(treeSlot+2);
2935 AliError(Form(
"Number of data output slots %d not sufficient. Tree of analysis engine %s will not be posted!",
fNOutputTrees, param.GetName()));
2966 AliError(Form(
"This task need an AOD event (Task '%s'). Expect troubles...", GetName()));
2984 params.fRandomGen = rnd;
2986 for (
auto &jetdef: params.fJetDefinitions) {
2987 if (!jetdef.fRhoName.IsNull()) {
2988 jetdef.fRho =
dynamic_cast<AliRhoParameter*
>(fInputEvent->FindListObject(jetdef.fRhoName));
2990 ::Error(
"AliAnalysisTaskDmesonJets::ExecOnce",
2991 "%s: Could not find rho object '%s' for engine '%s'",
2992 GetName(), jetdef.fRhoName.Data(), params.GetName());
2997 if (!params.fRDHFCuts) {
2999 ::Warning(
"AliAnalysisTaskDmesonJets::ExecOnce",
3000 "%s: RDHF cuts not provided for engine '%s'.",
3001 GetName(), params.GetName());
3004 ::Error(
"AliAnalysisTaskDmesonJets::ExecOnce",
3005 "%s: RDHF cuts not provided. Engine '%s' disabled.",
3006 GetName(), params.GetName());
3007 params.fInhibit = kTRUE;
3013 for (
auto cont_it : fParticleCollArray) {
3015 if (track_cont) params.fTrackContainers.push_back(track_cont);
3018 for (
auto cont_it :
fClusterCollArray) params.fClusterContainers.push_back(cont_it.second);
3023 params.fCandidateArray =
dynamic_cast<TClonesArray*
>(
fAodEvent->GetList()->FindObject(params.fBranchName.Data()));
3025 if (params.fCandidateArray) {
3028 className =
"AliAODRecoDecayHF2Prong";
3031 className =
"AliAODRecoCascadeHF";
3033 if (!params.fCandidateArray->GetClass()->InheritsFrom(className)) {
3034 ::Error(
"AliAnalysisTaskDmesonJets::ExecOnce",
3035 "%s: Objects of type %s in %s are not inherited from %s! Task will be disabled!",
3036 GetName(), params.fCandidateArray->GetClass()->GetName(), params.fCandidateArray->GetName(), className.Data());
3037 params.fCandidateArray = 0;
3038 params.fInhibit = kTRUE;
3042 ::Error(
"AliAnalysisTaskDmesonJets::ExecOnce",
3043 "Could not find candidate array '%s', skipping the event. Analysis engine '%s' will be disabled!",
3044 params.fBranchName.Data(), params.GetName());
3045 params.fInhibit = kTRUE;
3049 if (params.fMCMode !=
kNoMC) {
3050 if (!params.fMCContainer) {
3051 ::Error(
"AliAnalysisTaskDmesonJets::ExecOnce",
3052 "No MC particle container was provided. Analysis engine '%s' will be disabled!",
3054 params.fInhibit = kTRUE;
3059 if (params.fTrackContainers.size() == 0 && params.fClusterContainers.size() == 0) {
3060 ::Error(
"AliAnalysisTaskDmesonJets::ExecOnce",
3061 "No track container and no cluster container were provided. Analysis engine '%s' will be disabled!",
3063 params.fInhibit = kTRUE;
3081 if (eng.fInhibit)
continue;
3082 hname = TString::Format(
"%s/fHistEventRejectionReasons", eng.GetName());
3090 if (matchingAODdeltaAODlevel <= 0) {
3093 if (eng.fInhibit)
continue;
3094 hname = TString::Format(
"%s/fHistEventRejectionReasons", eng.GetName());
3102 eng.fDmesonJets.clear();
3103 if (eng.fInhibit)
continue;
3108 hname = TString::Format(
"%s/fHistNEvents", eng.GetName());
3110 Bool_t iseventselected = kTRUE;
3111 if (eng.fRDHFCuts) iseventselected = eng.fRDHFCuts->IsEventSelected(
fAodEvent);
3112 if (!iseventselected) {
3114 hname = TString::Format(
"%s/fHistEventRejectionReasons", eng.GetName());
3115 UInt_t bitmap = eng.fRDHFCuts->GetEventRejectionBitMap();
3119 if (label.IsNull())
break;
3129 AliDebug(2,
"Event selected");
3142 if (param.fInhibit)
continue;
3162 Int_t absPdgHighParton = 0;
3163 for (
auto part : itcont) {
3164 Int_t absPdgCode = TMath::Abs(part.second->GetPdgCode());
3167 if (absPdgCode > 9 && absPdgCode != 21)
continue;
3170 if (highestPartonPt < part.first.Pt()) {
3171 highestPartonPt = part.first.Pt();
3172 absPdgHighParton = absPdgCode;
3188 if (absPdgCode != 4 && absPdgCode != 5)
continue;
3189 Bool_t notLastInPartonShower = kFALSE;
3190 for (
Int_t idaugh = 0; idaugh < 2; idaugh++){
3191 Int_t daughterIndex = part.second->GetDaughter(idaugh);
3192 if (daughterIndex < 0) {
3193 AliDebug(10, Form(
"Could not find daughter of heavy quark (pdg=%d, pt=%.3f)!", absPdgCode, part.first.Pt()));
3198 AliDebug(10, Form(
"Could not find daughter %d of heavy quark (pdg=%d, pt=%.3f)!", daughterIndex, absPdgCode, part.first.Pt()));
3201 Int_t daughterAbsPdgCode = TMath::Abs(daughter->GetPdgCode());
3202 if (daughterAbsPdgCode <= 9 || daughterAbsPdgCode == 21) notLastInPartonShower = kTRUE;
3203 AliDebug(10, Form(
"Found daughter with PDG=%d, pt=%.3f", daughterAbsPdgCode, daughter->Pt()));
3205 if (notLastInPartonShower)
continue;
3207 if (absPdgCode == 4) {
3211 if (TMath::Abs(part.first.Eta()) < 0.5)
fHistManager.
FillTH1(
"fHistCharmPt_Eta05", part.first.Pt());
3213 else if (absPdgCode == 5) {
3217 if (TMath::Abs(part.first.Eta()) < 0.5)
fHistManager.
FillTH1(
"fHistBottomPt_Eta05", part.first.Pt());
3223 Int_t partonType = 0;
3224 if (absPdgHighParton == 9 || absPdgHighParton == 21) {
3228 partonType = absPdgHighParton;
3242 TParticlePDG* part = TDatabasePDG::Instance()->GetParticle(TMath::Abs(pdg));
3247 if (nbins % 2 == 0) {
3248 minMass = mass - range / 2 - range / nbins / 2;
3249 maxMass = mass + range / 2 - range / nbins / 2;
3252 minMass = mass - range / 2;
3253 maxMass = mass + range / 2;
3268 label =
"NotSelTrigger";
3270 return label.Data();
3275 return label.Data();
3278 label =
"TooFewVtxContrib";
3280 return label.Data();
3283 label =
"ZVtxOutFid";
3285 return label.Data();
3290 return label.Data();
3293 label =
"OutsideCentrality";
3295 return label.Data();
3298 label =
"PhysicsSelection";
3300 return label.Data();
3303 label =
"BadSPDVertex";
3305 return label.Data();
3308 label =
"ZVtxSPDOutFid";
3310 return label.Data();
3313 label =
"CentralityFlattening";
3315 return label.Data();
3318 label =
"BadTrackV0Correl";
3320 return label.Data();
3323 return label.Data();
3355 ::Error(
"AddTaskDmesonJets",
"No analysis manager to connect to.");
3360 AliVEventHandler* handler = mgr->GetInputEventHandler();
3362 ::Error(
"AddTaskEmcalJetSpectraQA",
"This task requires an input event handler");
3368 if (handler->InheritsFrom(
"AliESDInputHandler")) {
3371 else if (handler->InheritsFrom(
"AliAODInputHandler")) {
3376 if (ntracks ==
"usedefault") {
3377 if (dataType ==
kESD) {
3380 else if (dataType ==
kAOD) {
3388 if (nclusters ==
"usedefault") {
3389 if (dataType ==
kESD) {
3390 nclusters =
"CaloClusters";
3392 else if (dataType ==
kAOD) {
3393 nclusters =
"caloClusters";
3400 if (nMCpart ==
"usedefault") {
3401 nMCpart =
"mcparticles";
3404 TString name(
"AliAnalysisTaskDmesonJets");
3405 if (strcmp(suffix,
"") != 0) {
3406 name += TString::Format(
"_%s", suffix.Data());
3411 if (!ntracks.IsNull()) {
3413 jetTask->AdoptParticleContainer(trackCont);
3416 if (!nMCpart.IsNull()) {
3418 partCont->SetEtaLimits(-1.5, 1.5);
3419 partCont->SetPtLimits(0, 1000);
3420 jetTask->AdoptParticleContainer(partCont);
3423 jetTask->AddClusterContainer(nclusters.Data());
3426 mgr->AddTask(jetTask);
3429 AliAnalysisDataContainer* cinput1 = mgr->GetCommonInputContainer();
3431 contname1 +=
"_histos";
3432 AliAnalysisDataContainer* coutput1 = mgr->CreateContainer(contname1.Data(),
3433 TList::Class(), AliAnalysisManager::kOutputContainer,
3434 Form(
"%s", AliAnalysisManager::GetCommonFileName()));
3436 mgr->ConnectInput(jetTask, 0, cinput1);
3437 mgr->ConnectOutput(jetTask, 1, coutput1);
3439 for (
Int_t i = 0; i < nMaxTrees; i++) {
3440 TString contname = TString::Format(
"%s_tree_%d", name.Data(), i);
3441 AliAnalysisDataContainer *coutput = mgr->CreateContainer(contname.Data(),
3442 TTree::Class(),AliAnalysisManager::kOutputContainer,
3443 Form(
"%s", AliAnalysisManager::GetCommonFileName()));
3444 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.
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.