17 #include <TClonesArray.h>
18 #include <TDatabasePDG.h>
19 #include <TParticlePDG.h>
21 #include <THnSparse.h>
22 #include <TParticle.h>
24 #include <THashList.h>
30 #include "AliEMCALGeometry.h"
31 #include "AliAnalysisManager.h"
32 #include "AliVEventHandler.h"
68 dphi = TVector2::Phi_mpi_pi(
fMomentum.Phi() - jet.
Phi());;
70 return TMath::Sqrt(dphi*dphi + deta*deta);
81 return GetDistance(jet, deta, dphi);
98 fReconstructed(kFALSE),
111 fDmesonParticle(source.fDmesonParticle),
113 fSoftPionPt(source.fSoftPionPt),
114 fInvMass2Prong(source.fInvMass2Prong),
116 fMCLabel(source.fMCLabel),
117 fReconstructed(source.fReconstructed),
118 fFirstParton(source.fFirstParton),
119 fFirstPartonType(source.fFirstPartonType),
120 fLastParton(source.fLastParton),
121 fLastPartonType(source.fLastPartonType),
122 fSelectionType(source.fSelectionType)
138 fD.SetPtEtaPhiE(0,0,0,0);
143 fReconstructed = kFALSE;
145 fFirstPartonType = 0;
148 for (
auto &jet : fJets) {
149 jet.second.fMomentum.SetPtEtaPhiE(0,0,0,0);
150 jet.second.fNConstituents = 0;
152 jet.second.fMaxChargedPt = 0;
153 jet.second.fMaxNeutralPt = 0;
160 Printf(
"Printing D Meson Jet object.");
161 Printf(
"D Meson: pT = %.3f, eta = %.3f, phi = %.3f, inv. mass = %.3f", fD.Pt(), fD.Eta(), fD.Phi_0_2pi(), fD.M());
162 Printf(
"Soft pion pT: %.3f. 2-Prong Invariant mass = %.3f", fSoftPionPt, fInvMass2Prong);
163 for (
auto &jet : fJets) {
164 Printf(
"Jet %s: pT = %.3f, eta = %.3f, phi = %.3f", jet.first.c_str(), jet.second.Pt(), jet.second.Eta(), jet.second.Phi_0_2pi());
165 Printf(
"Jet N Consituents = %d", jet.second.fNConstituents);
174 std::map<std::string, AliJetInfo>::const_iterator it = fJets.find(n);
175 if (it == fJets.end())
return 0;
179 if ((*it).second.Pt() > 0) {
180 TVector3 dvect = fD.Vect();
181 TVector3 jvect = (*it).second.fMomentum.Vect();
186 ::Error(
"AliAnalysisTaskDmesonJets::AliDmesonJetInfo::GetZ",
"Zero jet momentum!");
190 z = (dvect * jvect) / jetMom;
193 if (z == 1 || (z > 1 && z - 1 < 1e-3)) z = 0.999;
207 std::map<std::string, AliJetInfo>::const_iterator it = fJets.find(n);
208 if (it == fJets.end())
return 0;
210 return GetDistance((*it).second, deta, dphi);
221 return GetDistance(n, deta, dphi);
232 dphi = TVector2::Phi_mpi_pi(fD.Phi() - jet.
Phi());;
233 deta = fD.Eta() - jet.
Eta();
234 return TMath::Sqrt(dphi*dphi + deta*deta);
245 return GetDistance(jet, deta, dphi);
254 std::map<std::string, AliJetInfo>::const_iterator it = fJets.find(n);
255 if (it == fJets.end()) {
256 ::Error(
"AliAnalysisTaskDmesonJets::AliDmesonJetInfo::GetJet",
"Could not find jet info for the jet definition '%s'!",
260 return &((*it).second);
269 std::map<std::string, AliJetInfo>::iterator it = fJets.find(n);
270 if (it == fJets.end()) {
271 ::Error(
"AliAnalysisTaskDmesonJets::AliDmesonJetInfo::GetJet",
"Could not find jet info for the jet definition '%s'!",
275 return &((*it).second);
316 std::map<std::string, AliJetInfo>::const_iterator it = source.
fJets.find(n);
317 if (it == source.
fJets.end())
return;
370 fArea = source.
fArea;
396 fPt = source.
fD.Pt();
397 fEta = source.
fD.Eta();
457 fFirstPartonType = 0,
474 fInvMass(source.fD.M()),
484 fInvMass = source.
fD.M();
508 f2ProngInvMass(source.fInvMass2Prong),
509 fDeltaInvMass(source.fD.M() - source.fInvMass2Prong)
619 fJetType(source.fJetType),
620 fRadius(source.fRadius),
621 fJetAlgo(source.fJetAlgo),
622 fRecoScheme(source.fRecoScheme),
623 fMinJetPt(source.fMinJetPt),
624 fMaxJetPt(source.fMaxJetPt),
625 fMinJetPhi(source.fMinJetPhi),
626 fMaxJetPhi(source.fMaxJetPhi),
627 fMinJetEta(source.fMinJetEta),
628 fMaxJetEta(source.fMaxJetEta),
629 fMinChargedPt(source.fMinChargedPt),
630 fMaxChargedPt(source.fMaxChargedPt),
631 fMinNeutralPt(source.fMinNeutralPt),
632 fMaxNeutralPt(source.fMaxNeutralPt),
633 fRhoName(source.fRhoName),
663 if (fMinJetEta < fMaxJetEta && (jet.
Eta() < fMinJetEta || jet.
Eta() > fMaxJetEta))
return kFALSE;
664 if (fMinJetPhi < fMaxJetPhi && (jet.
Phi() < fMinJetPhi || jet.
Phi() > fMaxJetPhi))
return kFALSE;
665 if (jet.
Pt() > fMaxJetPt || jet.
Pt() < fMinJetPt)
return kFALSE;
679 if (!jet)
return kFALSE;
680 return IsJetInAcceptance((*jet));
752 fCurrentDmesonJetInfo(0),
757 fClusterContainers(),
775 fCandidateType(type),
782 fNMassBins(nMassBins),
796 fCurrentDmesonJetInfo(0),
801 fClusterContainers(),
814 fFirstPartons(source.fFirstPartons),
815 fLastPartons(source.fLastPartons),
816 fCandidateType(source.fCandidateType),
817 fCandidateName(source.fCandidateName),
818 fCandidatePDG(source.fCandidatePDG),
819 fNDaughters(source.fNDaughters),
820 fPDGdaughters(source.fPDGdaughters),
821 fBranchName(source.fBranchName),
822 fMCMode(source.fMCMode),
823 fNMassBins(source.fNMassBins),
824 fMinMass(source.fMinMass),
825 fMaxMass(source.fMaxMass),
827 fRejectedOrigin(source.fRejectedOrigin),
828 fAcceptedDecay(source.fAcceptedDecay),
829 fInhibit(source.fInhibit),
830 fJetDefinitions(source.fJetDefinitions),
831 fPtBinWidth(source.fPtBinWidth),
832 fMaxPt(source.fMaxPt),
833 fRandomGen(source.fRandomGen),
837 fCurrentDmesonJetInfo(0),
839 fCandidateArray(source.fCandidateArray),
841 fTrackContainers(source.fTrackContainers),
842 fClusterContainers(source.fClusterContainers),
870 for (
UInt_t i = 0; i < fJetDefinitions.size(); i++) {
871 if (fJetDefinitions[i].IsJetInAcceptance(dMesonJet, fJetDefinitions[i].GetName()))
return kTRUE;
887 switch (fCandidateType) {
890 fCandidateName =
"D0";
892 fPDGdaughters.Set(fNDaughters);
893 fPDGdaughters.Reset();
894 fPDGdaughters[0] = 211;
895 fPDGdaughters[1] = 321;
896 fBranchName =
"D0toKpi";
901 fCandidateName =
"2ProngLikeSign";
903 fPDGdaughters.Set(fNDaughters);
904 fPDGdaughters.Reset();
905 fPDGdaughters[0] = 211;
906 fPDGdaughters[1] = 321;
907 fBranchName =
"LikeSign2Prong";
911 fCandidateName =
"DStar";
913 fPDGdaughters.Set(fNDaughters);
914 fPDGdaughters.Reset();
915 fPDGdaughters[0] = 211;
916 fPDGdaughters[1] = 211;
917 fPDGdaughters[2] = 321;
918 fBranchName =
"Dstar";
922 ::Error(
"AliAnalysisTaskDmesonJets::AnalysisEngine::SetCandidateProperties",
"Candidate %d unknown!", fCandidateType);
933 if (fRDHFCuts)
delete fRDHFCuts;
943 if (fRDHFCuts)
delete fRDHFCuts;
944 fRDHFCuts =
static_cast<AliRDHFCuts*
>(cuts->Clone());
954 name = TString::Format(
"%s_%s", GetName(), jetDef.
GetName());
966 name = fCandidateName;
969 name +=
"_kBackgroundOnly";
972 name +=
"_kSignalOnly";
995 std::vector<AliHFJetDefinition>::iterator it = FindJetDefinition(def);
997 if (it == fJetDefinitions.end() || *it != def) {
998 fJetDefinitions.push_back(def);
999 ::Info(
"AliAnalysisTaskDmesonJets::AnalysisEngine::AddJetDefinition",
"Jet definition '%s' has been added to analysis engine '%s'."
1000 "Total number of jet definitions is now %lu.",
1001 def.
GetName(), GetName(), fJetDefinitions.size());
1003 if (fMCMode !=
kMCTruth) fJetDefinitions[fJetDefinitions.size()-1].SetChargedPtRange(0., 100.);
1006 ::Warning(
"AliAnalysisTaskDmesonJets::AnalysisEngine::AddJetDefinition",
"The same jet definition '%s' was already added in analysis engine '%s'.", def.
GetName(), GetName());
1026 return AddJetDefinition(def);
1036 std::vector<AliHFJetDefinition>::iterator it = fJetDefinitions.begin();
1037 while (it != fJetDefinitions.end() && (*it) != def) it++;
1078 return ExtractD0Attributes(Dcand, DmesonJet, i);
1081 return ExtractDstarAttributes(static_cast<const AliAODRecoCascadeHF*>(Dcand), DmesonJet, i);
1097 AliDebug(10,
"Checking if D0 meson is selected");
1099 if (isSelected == 0)
return kFALSE;
1101 Int_t MCtruthPdgCode = 0;
1108 Int_t mcLab = Dcand->MatchToMC(fCandidatePDG,
fMCContainer->GetArray(), fNDaughters, fPDGdaughters.GetArray());
1113 AliAODMCParticle* aodMcPart =
static_cast<AliAODMCParticle*
>(
fMCContainer->GetArray()->At(mcLab));
1117 if (fRejectedOrigin) {
1118 auto origin = CheckOrigin(aodMcPart,
fMCContainer->GetArray());
1119 if ((origin.first & fRejectedOrigin) == origin.first)
return kFALSE;
1121 MCtruthPdgCode = aodMcPart->PdgCode();
1126 if (isSelected == 1) {
1127 if (i != 0)
return kFALSE;
1129 if (fMCMode ==
kNoMC ||
1130 (MCtruthPdgCode == fCandidatePDG && fMCMode ==
kSignalOnly) ||
1132 (MCtruthPdgCode == -fCandidatePDG && fMCMode ==
kWrongPID)) {
1134 AliDebug(10,
"Selected as D0");
1141 else if (isSelected == 2) {
1142 if (i != 1)
return kFALSE;
1144 if (fMCMode ==
kNoMC ||
1145 (MCtruthPdgCode == -fCandidatePDG && fMCMode ==
kSignalOnly) ||
1147 (MCtruthPdgCode == fCandidatePDG && fMCMode ==
kWrongPID)) {
1149 AliDebug(10,
"Selected as D0bar");
1156 else if (isSelected == 3) {
1157 AliDebug(10,
"Selected as either D0 or D0bar");
1160 if ((MCtruthPdgCode == fCandidatePDG && fMCMode ==
kSignalOnly) ||
1162 if (i != 0)
return kFALSE;
1163 AliDebug(10,
"MC truth is D0");
1166 else if ((MCtruthPdgCode == -fCandidatePDG && fMCMode ==
kSignalOnly) ||
1168 if (i != 1)
return kFALSE;
1169 AliDebug(10,
"MC truth is D0bar");
1178 AliDebug(10,
"Returning invariant mass with D0 hypothesis");
1182 AliDebug(10,
"Returning invariant mass with D0bar hypothesis");
1194 DmesonJet.
fD.SetPtEtaPhiM(Dcand->Pt(), Dcand->Eta(), Dcand->Phi(), invMassD);
1207 AliDebug(10,
"Checking if D* meson is selected");
1209 if (isSelected == 0)
return kFALSE;
1211 if ((i == 1 && DstarCand->Charge()>0) || (i == 0 && DstarCand->Charge()<0) || i > 1)
return kFALSE;
1213 Int_t MCtruthPdgCode = 0;
1218 Int_t pdgDgDStartoD0pi[2] = { 421, 211 };
1219 Int_t pdgDgD0toKpi[2] = { 321, 211 };
1222 AliDebug(10, Form(
"MC label is %d", mcLab));
1225 AliAODMCParticle* aodMcPart =
static_cast<AliAODMCParticle*
>(
fMCContainer->GetArray()->At(mcLab));
1228 if (fRejectedOrigin) {
1229 auto origin = CheckOrigin(aodMcPart,
fMCContainer->GetArray());
1230 if ((origin.first & fRejectedOrigin) == origin.first)
return kFALSE;
1233 MCtruthPdgCode = aodMcPart->PdgCode();
1234 AliDebug(10, Form(
"MC truth pdg code is %d",MCtruthPdgCode));
1239 Int_t absMCtruthPdgCode = TMath::Abs(MCtruthPdgCode);
1240 if (fMCMode ==
kNoMC ||
1241 (absMCtruthPdgCode == 413 && fMCMode ==
kSignalOnly) ||
1247 DmesonJet.
fD.SetPtEtaPhiM(DstarCand->Pt(), DstarCand->Eta(), DstarCand->Phi(), invMassD);
1268 Int_t absPdgPart = TMath::Abs(part->GetPdgCode());
1270 if (part->GetNDaughters() == 2) {
1272 AliAODMCParticle* d1 =
static_cast<AliAODMCParticle*
>(mcArray->At(part->GetDaughter(0)));
1273 AliAODMCParticle* d2 =
static_cast<AliAODMCParticle*
>(mcArray->At(part->GetDaughter(1)));
1279 Int_t absPdg1 = TMath::Abs(d1->GetPdgCode());
1280 Int_t absPdg2 = TMath::Abs(d2->GetPdgCode());
1282 if (absPdgPart == 421) {
1283 if ((absPdg1 == 211 && absPdg2 == 321) ||
1284 (absPdg1 == 321 && absPdg2 == 211)) {
1289 if (absPdgPart == 413) {
1290 if (absPdg1 == 421 && absPdg2 == 211) {
1291 Int_t D0decay = CheckDecayChannel(d1, mcArray);
1296 else if (absPdg1 == 211 && absPdg2 == 421) {
1297 Int_t D0decay = CheckDecayChannel(d2, mcArray);
1318 std::pair<AliAnalysisTaskDmesonJets::EMesonOrigin_t, AliAODMCParticle*> result(
kUnknownQuark, 0);
1320 if (!part)
return result;
1321 if (!mcArray)
return result;
1323 Int_t mother = part->GetMother();
1324 while (mother >= 0) {
1325 AliAODMCParticle* mcGranma =
static_cast<AliAODMCParticle*
>(mcArray->At(mother));
1327 Int_t abspdgGranma = TMath::Abs(mcGranma->GetPdgCode());
1329 if (abspdgGranma == 1) result = {
kFromDown, mcGranma};
1330 if (abspdgGranma == 2) result = {
kFromUp, mcGranma};
1331 if (abspdgGranma == 3) result = {
kFromStrange, mcGranma};
1332 if (abspdgGranma == 4) result = {
kFromCharm, mcGranma};
1333 if (abspdgGranma == 5) result = {
kFromBottom, mcGranma};
1334 if (abspdgGranma == 6) result = {
kFromTop, mcGranma};
1335 if (abspdgGranma == 9 || abspdgGranma == 21) result = {
kFromGluon, mcGranma};
1338 if (result.first !=
kUnknownQuark && !firstParton)
return result;
1340 mother = mcGranma->GetMother();
1343 ::Error(
"AliAnalysisTaskDmesonJets::AnalysisParams::CheckOrigin",
"Could not retrieve mother particle %d!", mother);
1354 for (
auto& jetDef : fJetDefinitions) {
1355 jetDef.fJets.clear();
1359 RunParticleLevelAnalysis();
1362 RunDetectorLevelAnalysis();
1374 const Int_t nD = fCandidateArray->GetEntriesFast();
1378 Int_t nAccCharm[3] = {0};
1379 for (
Int_t icharm = 0; icharm < nD; icharm++) {
1381 if (!charmCand)
continue;
1385 if (!fRDHFCuts->IsInFiducialAcceptance(charmCand->Pt(), charmCand->Y(fCandidatePDG)))
continue;
1386 Int_t nMassHypo = 0;
1387 for (
Int_t im = 0; im < 2; im++) {
1391 if (ExtractRecoDecayAttributes(charmCand, DmesonJet, im)) {
1392 for (
auto& def : fJetDefinitions) {
1393 if (!FindJet(charmCand, DmesonJet, def)) {
1394 AliWarning(Form(
"Could not find jet '%s' for D meson '%s': pT = %.3f, eta = %.3f, phi = %.3f",
1395 def.GetName(), GetName(), DmesonJet.
fD.Pt(), DmesonJet.
fD.Eta(), DmesonJet.
fD.
Phi_0_2pi()));
1398 fDmesonJets[(icharm+1)*(1-(im*2))] = DmesonJet;
1403 if (nMassHypo == 2) {
1408 if (nMassHypo == 2) {
1409 fDmesonJets[(icharm+1)].fSelectionType = 3;
1410 fDmesonJets[-(icharm+1)].fSelectionType = 3;
1416 hname = TString::Format(
"%s/fHistNTotAcceptedDmesons", GetName());
1421 hname = TString::Format(
"%s/fHistNAcceptedDmesonsVsNtracks", GetName());
1423 for (
auto track_cont : fTrackContainers) ntracks += track_cont->GetNAcceptedTracks();
1426 hname = TString::Format(
"%s/fHistNDmesons", GetName());
1444 if (jetDef.
fRho) rho = jetDef.
fRho->GetVal();
1454 for (
auto track_cont : fTrackContainers) {
1457 hname = TString::Format(
"%s/%s/fHistTrackRejectionReason", GetName(), jetDef.
GetName());
1461 hname = TString::Format(
"%s/%s/fHistDMesonDaughterNotInJet", GetName(), jetDef.
GetName());
1464 for (
Int_t i = 0; i < daughters.GetEntriesFast(); i++) {
1465 AliVParticle* daughter =
static_cast<AliVParticle*
>(daughters.At(i));
1466 if (!hftrack_cont->GetArray()->FindObject(daughter)) histDaughterNotInJet->Fill(daughter->Pt());
1473 for (
auto clus_cont : fClusterContainers) {
1474 hname = TString::Format(
"%s/%s/fHistClusterRejectionReason", GetName(), jetDef.
GetName());
1484 for (
UInt_t ijet = 0; ijet < jets_incl.size(); ++ijet) {
1487 Bool_t isDmesonJet = kFALSE;
1493 for (
UInt_t ic = 0; ic < constituents.size(); ++ic) {
1494 if (constituents[ic].user_index() == 0) {
1495 isDmesonJet = kTRUE;
1497 else if (constituents[ic].user_index() >= 100) {
1498 if (constituents[ic].pt() > maxChPt) maxChPt = constituents[ic].pt();
1500 else if (constituents[ic].user_index() <= -100) {
1501 totalNeutralPt += constituents[ic].pt();
1502 if (constituents[ic].pt() > maxNePt) maxChPt = constituents[ic].pt();
1507 DmesonJet.
fJets[jetDef.
GetName()].fMomentum.SetPxPyPzE(jets_incl[ijet].px(), jets_incl[ijet].py(), jets_incl[ijet].pz(), jets_incl[ijet].E());
1508 DmesonJet.
fJets[jetDef.
GetName()].fNConstituents = constituents.size();
1509 DmesonJet.
fJets[jetDef.
GetName()].fMaxChargedPt = maxChPt;
1510 DmesonJet.
fJets[jetDef.
GetName()].fMaxNeutralPt = maxNePt;
1511 DmesonJet.
fJets[jetDef.
GetName()].fNEF = totalNeutralPt / jets_incl[ijet].pt();
1512 DmesonJet.
fJets[jetDef.
GetName()].fArea = jets_incl[ijet].area();
1513 DmesonJet.
fJets[jetDef.
GetName()].fCorrPt = DmesonJet.
fJets[jetDef.
GetName()].fMomentum.Pt() - jets_incl[ijet].area() * rho;
1528 auto itcont = cont->all_momentum();
1529 for (AliEmcalIterableMomentumContainer::iterator it = itcont.begin(); it != itcont.end(); it++) {
1530 UInt_t rejectionReason = 0;
1531 if (!cont->AcceptObject(it.current_index(), rejectionReason)) {
1532 if (rejectHist) rejectHist->Fill(AliEmcalContainer::GetRejectionReasonBitPosition(rejectionReason), it->first.Pt());
1535 if (fRandomGen && eff > 0 && eff < 1) {
1538 if (rejectHist) rejectHist->Fill(6, it->first.Pt());
1542 Int_t uid = offset >= 0 ? it.current_index() + offset: -it.current_index() - offset;
1558 Int_t nAccCharm[3] = {0};
1560 for (
auto &jetDef : fJetDefinitions) {
1562 if (jetDef.fRho) rho = jetDef.fRho->GetVal();
1563 hname = TString::Format(
"%s/%s/fHistNDmesonsVsNconstituents", GetName(), jetDef.GetName());
1566 switch (jetDef.fJetType) {
1583 hname = TString::Format(
"%s/%s/fHistMCParticleRejectionReason", GetName(), jetDef.GetName());
1590 for (
auto jet : jets_incl) {
1591 Int_t nDmesonsInJet = 0;
1593 for (
auto constituent : jet.constituents()) {
1594 Int_t iPart = constituent.user_index() - 100;
1597 ::Error(
"AliAnalysisTaskDmesonJets::AnalysisEngine::RunParticleLevelAnalysis",
"Could not find jet constituent %d!", iPart);
1600 if (TMath::Abs(part->PdgCode()) == fCandidatePDG) {
1602 std::map<int, AliDmesonJetInfo>::iterator dMesonJetIt = fDmesonJets.find(iPart);
1603 if (dMesonJetIt == fDmesonJets.end()) {
1604 std::pair<int, AliDmesonJetInfo> element;
1605 element.first = iPart;
1606 dMesonJetIt = fDmesonJets.insert(element).first;
1607 (*dMesonJetIt).second.fD.SetPxPyPzE(part->Px(), part->Py(), part->Pz(), part->E());
1608 (*dMesonJetIt).second.fDmesonParticle = part;
1609 (*dMesonJetIt).second.fSelectionType = part->PdgCode() > 0 ? 1 : 2;
1614 auto firstParton = CheckOrigin(part,
fMCContainer->GetArray(), kTRUE);
1616 rs = firstParton.first;
1617 while (rs >>= 1) { p++; }
1618 (*dMesonJetIt).second.fFirstPartonType = p;
1619 (*dMesonJetIt).second.fFirstParton = firstParton.second;
1621 auto lastParton = CheckOrigin(part,
fMCContainer->GetArray(), kFALSE);
1623 rs = lastParton.first;
1624 while (rs >>= 1) { p++; }
1625 (*dMesonJetIt).second.fLastPartonType = p;
1626 (*dMesonJetIt).second.fLastParton = lastParton.second;
1628 if (part->PdgCode() > 0) {
1636 (*dMesonJetIt).second.fJets[jetDef.GetName()].fMomentum.SetPxPyPzE(jet.px(), jet.py(), jet.pz(), jet.E());
1637 (*dMesonJetIt).second.fJets[jetDef.GetName()].fNConstituents = jet.constituents().size();
1638 (*dMesonJetIt).second.fJets[jetDef.GetName()].fArea = jet.area();
1639 (*dMesonJetIt).second.fJets[jetDef.GetName()].fCorrPt = (*dMesonJetIt).second.fJets[jetDef.GetName()].fMomentum.Pt() - jet.area() * rho;
1642 if (nDmesonsInJet > 0) histNDmesonsVsNconstituents->Fill(jet.constituents().size(), nDmesonsInJet);
1646 if (fDmesonJets.size() != nAccCharm[0]+nAccCharm[1]) AliError(Form(
"I found %lu mesons (%d)?", fDmesonJets.size(), nAccCharm[0]+nAccCharm[1]));
1647 hname = TString::Format(
"%s/fHistNTotAcceptedDmesons", GetName());
1652 hname = TString::Format(
"%s/fHistNAcceptedDmesonsVsNtracks", GetName());
1655 hname = TString::Format(
"%s/fHistNDmesons", GetName());
1666 classname =
"AliAnalysisTaskDmesonJets::AliDmesonMCInfoSummary";
1670 switch (fCandidateType) {
1673 classname =
"AliAnalysisTaskDmesonJets::AliD0InfoSummary";
1677 classname =
"AliAnalysisTaskDmesonJets::AliDStarInfoSummary";
1682 TString treeName = TString::Format(
"%s_%s", taskName, GetName());
1683 fTree =
new TTree(treeName, treeName);
1684 fTree->Branch(
"DmesonJet", classname, &fCurrentDmesonJetInfo);
1686 for (
Int_t i = 0; i < fJetDefinitions.size(); i++) {
1687 if (fJetDefinitions[i].fRhoName.IsNull()) {
1689 fTree->Branch(fJetDefinitions[i].GetName(),
"AliAnalysisTaskDmesonJets::AliJetInfoSummary", &fCurrentJetInfo[i]);
1693 fTree->Branch(fJetDefinitions[i].GetName(),
"AliAnalysisTaskDmesonJets::AliJetInfoPbPbSummary", &fCurrentJetInfo[i]);
1709 for (
auto &jetDef : fJetDefinitions) {
1711 AliDebug(2,Form(
"Now working on '%s'", jetDef.GetName()));
1721 title[dim] =
"#it{p}_{T,D} (GeV/#it{c})";
1728 title[dim] =
"#eta_{D}";
1734 title[dim] =
"#phi_{D} (rad)";
1737 max[dim] = TMath::TwoPi();
1742 title[dim] =
"#it{M}_{K#pi#pi} (GeV/#it{c}^{2})";
1743 nbins[dim] = fNMassBins;
1744 min[dim] = fMinMass;
1745 max[dim] = fMaxMass;
1750 title[dim] =
"#it{M}_{K#pi} (GeV/#it{c}^{2})";
1751 nbins[dim] = fNMassBins;
1752 min[dim] = fMinMass;
1753 max[dim] = fMaxMass;
1758 title[dim] =
"#it{M}_{K#pi} (GeV/#it{c}^{2})";
1759 nbins[dim] = fNMassBins;
1765 title[dim] =
"#it{M}_{K#pi#pi} - #it{M}_{K#pi} (GeV/#it{c}^{2})";
1766 nbins[dim] = fNMassBins*6;
1770 Double_t D0mass = TDatabasePDG::Instance()->GetParticle(421)->Mass();
1778 title[dim] =
"#it{p}_{T,#pi} (GeV/#it{c})";
1785 title[dim] =
"#it{z}_{D}";
1791 if ((enabledAxis &
kDeltaR) != 0) {
1792 title[dim] =
"#Delta R_{D-jet}";
1795 max[dim] = radius * 1.5;
1800 title[dim] =
"#eta_{D} - #eta_{jet}";
1802 min[dim] = -radius * 1.2;
1803 max[dim] = radius * 1.2;
1808 title[dim] =
"#phi_{D} - #phi_{jet} (rad)";
1810 min[dim] = -radius * 1.2;
1811 max[dim] = radius * 1.2;
1815 title[dim] =
"#it{p}_{T,jet} (GeV/#it{c})";
1822 title[dim] =
"#eta_{jet}";
1828 title[dim] =
"#phi_{jet} (rad)";
1831 max[dim] = TMath::TwoPi();
1836 title[dim] =
"No. of constituents";
1843 hname = TString::Format(
"%s/%s/fDmesonJets", GetName(), jetDef.GetName());
1845 for (
Int_t j = 0; j < dim; j++) {
1846 h->GetAxis(j)->SetTitle(title[j]);
1857 fFirstPartons.clear();
1858 fLastPartons.clear();
1859 for (
auto& dmeson_pair : fDmesonJets) {
1860 fCurrentDmesonJetInfo->Set(dmeson_pair.second);
1862 for (
UInt_t ij = 0; ij < fJetDefinitions.size(); ij++) {
1863 fCurrentJetInfo[ij]->Reset();
1864 AliJetInfo* jet = dmeson_pair.second.GetJet(fJetDefinitions[ij].GetName());
1866 if (applyKinCuts && !fJetDefinitions[ij].IsJetInAcceptance(*jet)) {
1867 hname = TString::Format(
"%s/%s/fHistRejectedJetPt", GetName(), fJetDefinitions[ij].GetName());
1869 hname = TString::Format(
"%s/%s/fHistRejectedJetPhi", GetName(), fJetDefinitions[ij].GetName());
1871 hname = TString::Format(
"%s/%s/fHistRejectedJetEta", GetName(), fJetDefinitions[ij].GetName());
1875 fCurrentJetInfo[ij]->Set(dmeson_pair.second, fJetDefinitions[ij].GetName());
1879 fFirstPartons[dmeson_pair.second.fFirstParton] = dmeson_pair.second.fFirstPartonType;
1880 fLastPartons[dmeson_pair.second.fLastParton] = dmeson_pair.second.fLastPartonType;
1885 hname = TString::Format(
"%s/fHistRejectedDMesonPt", GetName());
1887 hname = TString::Format(
"%s/fHistRejectedDMesonPhi", GetName());
1889 hname = TString::Format(
"%s/fHistRejectedDMesonEta", GetName());
1893 hname = TString::Format(
"%s/fHistRejectedDMesonInvMass", GetName());
1897 hname = TString::Format(
"%s/fHistRejectedDMeson2ProngInvMass", GetName());
1900 hname = TString::Format(
"%s/fHistRejectedDMesonDeltaInvMass", GetName());
1901 fHistManager->
FillTH1(hname, dmeson_pair.second.fD.M() - dmeson_pair.second.fInvMass2Prong);
1907 hname = TString::Format(
"%s/fHistFirstPartonPt", GetName());
1909 hname = TString::Format(
"%s/fHistFirstPartonEta", GetName());
1911 hname = TString::Format(
"%s/fHistFirstPartonPhi", GetName());
1913 hname = TString::Format(
"%s/fHistFirstPartonType", GetName());
1916 for (
auto parton : fFirstPartons) {
1917 if (!parton.first)
continue;
1918 histFirstPartonPt->Fill(parton.first->Pt());
1919 histFirstPartonEta->Fill(parton.first->Eta());
1920 histFirstPartonPhi->Fill(TVector2::Phi_0_2pi(parton.first->Phi()));
1921 histFirstPartonType->Fill(parton.second);
1924 hname = TString::Format(
"%s/fHistLastPartonPt", GetName());
1926 hname = TString::Format(
"%s/fHistLastPartonEta", GetName());
1928 hname = TString::Format(
"%s/fHistLastPartonPhi", GetName());
1930 hname = TString::Format(
"%s/fHistLastPartonType", GetName());
1933 for (
auto parton : fLastPartons) {
1934 if (!parton.first)
continue;
1935 histLastPartonPt->Fill(parton.first->Pt());
1936 histLastPartonEta->Fill(parton.first->Eta());
1937 histLastPartonPhi->Fill(TVector2::Phi_0_2pi(parton.first->Phi()));
1938 histLastPartonType->Fill(parton.second);
1951 fFirstPartons.clear();
1952 fLastPartons.clear();
1953 for (
auto& dmeson_pair : fDmesonJets) {
1955 for (
UInt_t ij = 0; ij < fJetDefinitions.size(); ij++) {
1956 AliJetInfo* jet = dmeson_pair.second.GetJet(fJetDefinitions[ij].GetName());
1958 if (applyKinCuts && !fJetDefinitions[ij].IsJetInAcceptance(*jet)) {
1959 hname = TString::Format(
"%s/%s/fHistRejectedJetPt", GetName(), fJetDefinitions[ij].GetName());
1961 hname = TString::Format(
"%s/%s/fHistRejectedJetPhi", GetName(), fJetDefinitions[ij].GetName());
1963 hname = TString::Format(
"%s/%s/fHistRejectedJetEta", GetName(), fJetDefinitions[ij].GetName());
1970 fFirstPartons[dmeson_pair.second.fFirstParton] = dmeson_pair.second.fFirstPartonType;
1971 fLastPartons[dmeson_pair.second.fLastParton] = dmeson_pair.second.fLastPartonType;
1974 hname = TString::Format(
"%s/fHistRejectedDMesonPt", GetName());
1976 hname = TString::Format(
"%s/fHistRejectedDMesonPhi", GetName());
1978 hname = TString::Format(
"%s/fHistRejectedDMesonEta", GetName());
1982 hname = TString::Format(
"%s/fHistRejectedDMesonInvMass", GetName());
1986 hname = TString::Format(
"%s/fHistRejectedDMeson2ProngInvMass", GetName());
1989 hname = TString::Format(
"%s/fHistRejectedDMesonDeltaInvMass", GetName());
1990 fHistManager->
FillTH1(hname, dmeson_pair.second.fD.M() - dmeson_pair.second.fInvMass2Prong);
1996 hname = TString::Format(
"%s/fHistFirstPartonPt", GetName());
1998 hname = TString::Format(
"%s/fHistFirstPartonEta", GetName());
2000 hname = TString::Format(
"%s/fHistFirstPartonPhi", GetName());
2002 hname = TString::Format(
"%s/fHistFirstPartonType", GetName());
2005 for (
auto parton : fFirstPartons) {
2006 if (!parton.first)
continue;
2007 histFirstPartonPt->Fill(parton.first->Pt());
2008 histFirstPartonEta->Fill(parton.first->Eta());
2009 histFirstPartonPhi->Fill(TVector2::Phi_0_2pi(parton.first->Phi()));
2010 histFirstPartonType->Fill(parton.second);
2013 hname = TString::Format(
"%s/fHistLastPartonPt", GetName());
2015 hname = TString::Format(
"%s/fHistLastPartonEta", GetName());
2017 hname = TString::Format(
"%s/fHistLastPartonPhi", GetName());
2019 hname = TString::Format(
"%s/fHistLastPartonType", GetName());
2022 for (
auto parton : fLastPartons) {
2023 if (!parton.first)
continue;
2024 histLastPartonPt->Fill(parton.first->Pt());
2025 histLastPartonEta->Fill(parton.first->Eta());
2026 histLastPartonPhi->Fill(TVector2::Phi_0_2pi(parton.first->Phi()));
2027 histLastPartonType->Fill(parton.second);
2040 for (
auto& dmeson_pair : fDmesonJets) {
2041 if (!IsAnyJetInAcceptance(dmeson_pair.second)) {
2042 hname = TString::Format(
"%s/fHistRejectedDMesonPt", GetName());
2044 hname = TString::Format(
"%s/fHistRejectedDMesonPhi", GetName());
2046 hname = TString::Format(
"%s/fHistRejectedDMesonEta", GetName());
2051 for (
auto &jetDef : fJetDefinitions) {
2053 hname = TString::Format(
"%s/%s/fDmesonJets", GetName(), jetDef.GetName());
2056 for (
auto& dmeson_pair : fDmesonJets) {
2057 const AliJetInfo* jet = dmeson_pair.second.GetJet(jetDef.GetName());
2059 if (!jetDef.IsJetInAcceptance(*jet)) {
2060 hname = TString::Format(
"%s/%s/fHistRejectedJetPt", GetName(), jetDef.GetName());
2062 hname = TString::Format(
"%s/%s/fHistRejectedJetPhi", GetName(), jetDef.GetName());
2064 hname = TString::Format(
"%s/%s/fHistRejectedJetEta", GetName(), jetDef.GetName());
2068 FillHnSparse(h, dmeson_pair.second, jetDef.GetName());
2091 std::map<std::string, AliJetInfo>::const_iterator it = DmesonJet.
fJets.find(n);
2092 if (it == DmesonJet.
fJets.end())
return kFALSE;
2094 for (
Int_t i = 0; i < h->GetNdimensions(); i++) {
2096 if (
title==
"#it{p}_{T,D} (GeV/#it{c})") contents[i] = DmesonJet.
fD.Pt();
2097 else if (
title==
"#eta_{D}") contents[i] = DmesonJet.
fD.Eta();
2100 else if (
title==
"#it{M}_{K#pi#pi} (GeV/#it{c}^{2})") contents[i] = DmesonJet.
fD.M();
2101 else if (
title==
"#it{M}_{K#pi#pi} - #it{M}_{K#pi} (GeV/#it{c}^{2})") contents[i] = DmesonJet.
fD.M() - DmesonJet.
fInvMass2Prong;
2102 else if (
title==
"#it{p}_{T,#pi} (GeV/#it{c})") contents[i] = DmesonJet.
fSoftPionPt;
2103 else if (
title==
"#it{z}_{D}") contents[i] = z;
2104 else if (
title==
"#Delta R_{D-jet}") contents[i] = deltaR;
2105 else if (
title==
"#eta_{D} - #eta_{jet}") contents[i] = deltaEta;
2106 else if (
title==
"#phi_{D} - #phi_{jet} (rad)") contents[i] = deltaPhi;
2107 else if (
title==
"#it{p}_{T,jet} (GeV/#it{c})") contents[i] = (*it).second.Pt();
2108 else if (
title==
"#eta_{jet}") contents[i] = (*it).second.Eta();
2109 else if (
title==
"#phi_{jet} (rad)") contents[i] = (*it).second.Phi_0_2pi();
2110 else if (
title==
"No. of constituents") contents[i] = (*it).second.fNConstituents;
2111 else AliWarning(Form(
"Unable to fill dimension '%s'!",
title.Data()));
2148 fEnabledAxis(k2ProngInvMass),
2149 fOutputType(kTreeOutput),
2151 fApplyKinematicCuts(kTRUE),
2152 fNOutputTrees(nOutputTrees),
2153 fTrackEfficiency(0),
2159 for (
Int_t i = 0; i < nOutputTrees; i++){
2160 DefineOutput(2+i, TTree::Class());
2179 TFile* filecuts = TFile::Open(cutfname);
2180 if (!filecuts || filecuts->IsZombie()) {
2181 ::Error(
"AliAnalysisTaskDmesonJets::LoadDMesonCutsFromFile",
"Input file not found: will use std cuts.");
2185 if (filecuts) analysiscuts =
dynamic_cast<AliRDHFCuts*
>(filecuts->Get(cutsname));
2187 if (!analysiscuts) {
2188 ::Error(
"AliAnalysisTaskDmesonJets::LoadDMesonCutsFromFile",
"Could not find analysis cuts '%s' in '%s'.", cutsname.Data(), cutfname.Data());
2194 ::Info(
"AliAnalysisTaskDmesonJets::LoadDMesonCutsFromFile",
"Cuts '%s' loaded from file '%s'", cutsname.Data(), cutfname.Data());
2197 return analysiscuts;
2226 if (!cutfname.IsNull()) {
2232 cutsname =
"D0toKpiCuts";
2235 cutsname =
"DStartoKpipiCuts";
2252 ::Info(
"AliAnalysisTaskDmesonJets::AddAnalysisEngine",
"A new analysis engine '%s' has been added. The total number of analysis engines is %lu.", eng.
GetName(),
fAnalysisEngines.size());
2256 ::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());
2260 if (found_eng->
fRDHFCuts != 0) ::Warning(
"AliAnalysisTaskDmesonJets::AddAnalysisEngine",
"D meson cuts were already defined for this D meson type. They will be overwritten.");
2278 ::Info(
"UserCreateOutputObjects",
"CreateOutputObjects of task %s", GetName());
2290 hname =
"fHistCharmPt";
2291 htitle = hname +
";#it{p}_{T,charm} (GeV/#it{c});counts";
2294 hname =
"fHistCharmEta";
2295 htitle = hname +
";#eta_{charm};counts";
2298 hname =
"fHistCharmPhi";
2299 htitle = hname +
";#phi_{charm};counts";
2302 hname =
"fHistCharmPt_Eta05";
2303 htitle = hname +
";#it{p}_{T,charm} (GeV/#it{c});counts";
2306 hname =
"fHistBottomPt";
2307 htitle = hname +
";#it{p}_{T,bottom} (GeV/#it{c});counts";
2310 hname =
"fHistBottomEta";
2311 htitle = hname +
";#eta_{bottom};counts";
2314 hname =
"fHistBottomPhi";
2315 htitle = hname +
";#phi_{bottom};counts";
2318 hname =
"fHistBottomPt_Eta05";
2319 htitle = hname +
";#it{p}_{T,bottom} (GeV/#it{c});counts";
2322 hname =
"fHistHighestPartonPt";
2323 htitle = hname +
";#it{p}_{T,bottom} (GeV/#it{c});counts";
2326 hname =
"fHistHighestPartonType";
2327 htitle = hname +
";type;counts";
2330 hname =
"fHistNHeavyQuarks";
2331 htitle = hname +
";number of heavy-quarks;counts";
2334 ::Info(
"AliAnalysisTaskDmesonJets::UserCreateOutputObjects",
"Allocating histograms for task '%s' (%lu analysis engines)", GetName(),
fAnalysisEngines.size());
2336 ::Info(
"AliAnalysisTaskDmesonJets::UserCreateOutputObjects",
"Allocating histograms for analysis engine '%s' (%lu jet definitions)", param.GetName(), param.fJetDefinitions.size());
2340 hname = TString::Format(
"%s/fHistNAcceptedDmesonsVsNtracks", param.GetName());
2341 htitle = hname +
";#it{N}_{tracks};#it{N}_{D};events";
2344 hname = TString::Format(
"%s/fHistNTotAcceptedDmesons", param.GetName());
2345 htitle = hname +
";;#it{N}_{D}";
2348 hname = TString::Format(
"%s/fHistNDmesons", param.GetName());
2349 htitle = hname +
";#it{N}_{D};events";
2352 hname = TString::Format(
"%s/fHistNEvents", param.GetName());
2353 htitle = hname +
";Event status;counts";
2355 h->GetXaxis()->SetBinLabel(1,
"Accepted");
2356 h->GetXaxis()->SetBinLabel(2,
"Rejected");
2358 hname = TString::Format(
"%s/fHistEventRejectionReasons", param.GetName());
2359 htitle = hname +
";Rejection reason;counts";
2362 hname = TString::Format(
"%s/fHistRejectedDMesonPt", param.GetName());
2363 htitle = hname +
";#it{p}_{T,D} (GeV/#it{c});counts";
2366 hname = TString::Format(
"%s/fHistRejectedDMesonEta", param.GetName());
2367 htitle = hname +
";#it{#eta}_{D};counts";
2370 hname = TString::Format(
"%s/fHistRejectedDMesonPhi", param.GetName());
2371 htitle = hname +
";#it{#phi}_{D};counts";
2376 hname = TString::Format(
"%s/fHistRejectedDMesonInvMass", param.GetName());
2377 htitle = hname +
";#it{M}_{K#pi} (GeV/#it{c}^{2});counts";
2384 hname = TString::Format(
"%s/fHistRejectedDMeson2ProngInvMass", param.GetName());
2385 htitle = hname +
";#it{M}_{K#pi} (GeV/#it{c}^{2});counts";
2389 Double_t D0mass = TDatabasePDG::Instance()->GetParticle(421)->Mass();
2390 hname = TString::Format(
"%s/fHistRejectedDMesonDeltaInvMass", param.GetName());
2391 htitle = hname +
";#it{M}_{K#pi#pi} - #it{M}_{K#pi} (GeV/#it{c}^{2});counts";
2398 hname = TString::Format(
"%s/fHistFirstPartonPt", param.GetName());
2399 htitle = hname +
";#it{p}_{T,parton} (GeV/#it{c});counts";
2402 hname = TString::Format(
"%s/fHistFirstPartonEta", param.GetName());
2403 htitle = hname +
";#eta_{parton};counts";
2406 hname = TString::Format(
"%s/fHistFirstPartonPhi", param.GetName());
2407 htitle = hname +
";#phi_{parton};counts";
2410 hname = TString::Format(
"%s/fHistFirstPartonType", param.GetName());
2411 htitle = hname +
";type;counts";
2414 hname = TString::Format(
"%s/fHistLastPartonPt", param.GetName());
2415 htitle = hname +
";#it{p}_{T,parton} (GeV/#it{c});counts";
2418 hname = TString::Format(
"%s/fHistLastPartonEta", param.GetName());
2419 htitle = hname +
";#eta_{parton};counts";
2422 hname = TString::Format(
"%s/fHistLastPartonPhi", param.GetName());
2423 htitle = hname +
";#phi_{parton};counts";
2426 hname = TString::Format(
"%s/fHistLastPartonType", param.GetName());
2427 htitle = hname +
";type;counts";
2431 for (
auto& jetDef : param.fJetDefinitions) {
2432 ::Info(
"AliAnalysisTaskDmesonJets::UserCreateOutputObjects",
"Allocating histograms for jet definition '%s'", jetDef.GetName());
2435 hname = TString::Format(
"%s/%s/fHistNDmesonsVsNconstituents", param.GetName(), jetDef.GetName());
2436 htitle = hname +
";#it{N}_{constituents};#it{N}_{D};counts";
2440 hname = TString::Format(
"%s/%s/fHistMCParticleRejectionReason", param.GetName(), jetDef.GetName());
2441 htitle = hname +
";Track rejection reason;#it{p}_{T,track} (GeV/#it{c});counts";
2445 hname = TString::Format(
"%s/%s/fHistTrackRejectionReason", param.GetName(), jetDef.GetName());
2446 htitle = hname +
";Track rejection reason;#it{p}_{T,track} (GeV/#it{c});counts";
2450 hname = TString::Format(
"%s/%s/fHistClusterRejectionReason", param.GetName(), jetDef.GetName());
2451 htitle = hname +
";Cluster rejection reason;#it{p}_{T,cluster} (GeV/#it{c});counts";
2455 hname = TString::Format(
"%s/%s/fHistDMesonDaughterNotInJet", param.GetName(), jetDef.GetName());
2456 htitle = hname +
";#it{p}_{T,track} (GeV/#it{c});counts";
2459 hname = TString::Format(
"%s/%s/fHistRejectedJetPt", param.GetName(), jetDef.GetName());
2460 htitle = hname +
";#it{p}_{T,jet} (GeV/#it{c});counts";
2463 hname = TString::Format(
"%s/%s/fHistRejectedJetEta", param.GetName(), jetDef.GetName());
2464 htitle = hname +
";#it{#eta}_{jet};counts";
2467 hname = TString::Format(
"%s/%s/fHistRejectedJetPhi", param.GetName(), jetDef.GetName());
2468 htitle = hname +
";#it{#phi}_{jet};counts";
2473 param.BuildTree(GetName());
2475 param.AssignDataSlot(treeSlot+2);
2480 AliError(Form(
"Number of data output slots %d not sufficient. Tree of analysis engine %s will not be posted!",
fNOutputTrees, param.GetName()));
2512 AliError(Form(
"This task need an AOD event (Task '%s'). Expect troubles...", GetName()));
2529 params.fRandomGen = rnd;
2531 for (
auto &jetdef: params.fJetDefinitions) {
2532 if (!jetdef.fRhoName.IsNull()) {
2533 jetdef.fRho =
dynamic_cast<AliRhoParameter*
>(fInputEvent->FindListObject(jetdef.fRhoName));
2535 ::Error(
"AliAnalysisTaskDmesonJets::ExecOnce",
2536 "%s: Could not find rho object '%s' for engine '%s'",
2537 jetdef.fRhoName.Data(), GetName(), params.GetName());
2542 if (!params.fRDHFCuts) {
2544 ::Warning(
"AliAnalysisTaskDmesonJets::ExecOnce",
2545 "%s: RDHF cuts not provided for engine '%s'.",
2546 GetName(), params.GetName());
2549 ::Error(
"AliAnalysisTaskDmesonJets::ExecOnce",
2550 "%s: RDHF cuts not provided. Engine '%s' disabled.",
2551 GetName(), params.GetName());
2552 params.fInhibit = kTRUE;
2558 for (
auto cont_it : fParticleCollArray) {
2560 if (track_cont) params.fTrackContainers.push_back(track_cont);
2563 for (
auto cont_it :
fClusterCollArray) params.fClusterContainers.push_back(cont_it.second);
2568 params.fCandidateArray =
dynamic_cast<TClonesArray*
>(
fAodEvent->GetList()->FindObject(params.fBranchName.Data()));
2570 if (params.fCandidateArray) {
2573 className =
"AliAODRecoDecayHF2Prong";
2576 className =
"AliAODRecoCascadeHF";
2578 if (!params.fCandidateArray->GetClass()->InheritsFrom(className)) {
2579 ::Error(
"AliAnalysisTaskDmesonJets::ExecOnce",
2580 "%s: Objects of type %s in %s are not inherited from %s! Task will be disabled!",
2581 GetName(), params.fCandidateArray->GetClass()->GetName(), params.fCandidateArray->GetName(), className.Data());
2582 params.fCandidateArray = 0;
2583 params.fInhibit = kTRUE;
2587 ::Error(
"AliAnalysisTaskDmesonJets::ExecOnce",
2588 "Could not find candidate array '%s', skipping the event. Analysis engine '%s' will be disabled!",
2589 params.fBranchName.Data(), params.GetName());
2590 params.fInhibit = kTRUE;
2594 if (params.fMCMode !=
kNoMC) {
2595 if (!params.fMCContainer) {
2596 ::Error(
"AliAnalysisTaskDmesonJets::ExecOnce",
2597 "No MC particle container was provided. Analysis engine '%s' will be disabled!",
2599 params.fInhibit = kTRUE;
2604 if (params.fTrackContainers.size() == 0 && params.fClusterContainers.size() == 0) {
2605 ::Error(
"AliAnalysisTaskDmesonJets::ExecOnce",
2606 "No track container and no cluster container were provided. Analysis engine '%s' will be disabled!",
2608 params.fInhibit = kTRUE;
2626 if (eng.fInhibit)
continue;
2627 hname = TString::Format(
"%s/fHistEventRejectionReasons", eng.GetName());
2635 if (matchingAODdeltaAODlevel <= 0) {
2638 if (eng.fInhibit)
continue;
2639 hname = TString::Format(
"%s/fHistEventRejectionReasons", eng.GetName());
2647 eng.fDmesonJets.clear();
2648 if (eng.fInhibit)
continue;
2651 hname = TString::Format(
"%s/fHistNEvents", eng.GetName());
2653 Bool_t iseventselected = kTRUE;
2654 if (eng.fRDHFCuts) iseventselected = eng.fRDHFCuts->IsEventSelected(
fAodEvent);
2655 if (!iseventselected) {
2657 hname = TString::Format(
"%s/fHistEventRejectionReasons", eng.GetName());
2658 UInt_t bitmap = eng.fRDHFCuts->GetEventRejectionBitMap();
2662 if (label.IsNull())
break;
2672 AliDebug(2,
"Event selected");
2685 if (param.fInhibit)
continue;
2705 Int_t absPdgHighParton = 0;
2706 for (
auto part : itcont) {
2707 Int_t absPdgCode = TMath::Abs(part.second->GetPdgCode());
2710 if (absPdgCode > 9 && absPdgCode != 21)
continue;
2713 if (highestPartonPt < part.first.Pt()) {
2714 highestPartonPt = part.first.Pt();
2715 absPdgHighParton = absPdgCode;
2731 if (absPdgCode != 4 && absPdgCode != 5)
continue;
2732 Bool_t notLastInPartonShower = kFALSE;
2733 for (
Int_t idaugh = 0; idaugh < 2; idaugh++){
2734 Int_t daughterIndex = part.second->GetDaughter(idaugh);
2735 if (daughterIndex < 0) {
2736 AliDebug(10, Form(
"Could not find daughter of heavy quark (pdg=%d, pt=%.3f)!", absPdgCode, part.first.Pt()));
2741 AliDebug(10, Form(
"Could not find daughter %d of heavy quark (pdg=%d, pt=%.3f)!", daughterIndex, absPdgCode, part.first.Pt()));
2744 Int_t daughterAbsPdgCode = TMath::Abs(daughter->GetPdgCode());
2745 if (daughterAbsPdgCode <= 9 || daughterAbsPdgCode == 21) notLastInPartonShower = kTRUE;
2746 AliDebug(10, Form(
"Found daughter with PDG=%d, pt=%.3f", daughterAbsPdgCode, daughter->Pt()));
2748 if (notLastInPartonShower)
continue;
2750 if (absPdgCode == 4) {
2754 if (TMath::Abs(part.first.Eta()) < 0.5)
fHistManager.
FillTH1(
"fHistCharmPt_Eta05", part.first.Pt());
2756 else if (absPdgCode == 5) {
2760 if (TMath::Abs(part.first.Eta()) < 0.5)
fHistManager.
FillTH1(
"fHistBottomPt_Eta05", part.first.Pt());
2766 Int_t partonType = 0;
2767 if (absPdgHighParton == 9 || absPdgHighParton == 21) {
2771 partonType = absPdgHighParton;
2785 TParticlePDG* part = TDatabasePDG::Instance()->GetParticle(TMath::Abs(pdg));
2790 if (nbins % 2 == 0) {
2791 minMass = mass - range / 2 - range / nbins / 2;
2792 maxMass = mass + range / 2 - range / nbins / 2;
2795 minMass = mass - range / 2;
2796 maxMass = mass + range / 2;
2811 label =
"NotSelTrigger";
2813 return label.Data();
2818 return label.Data();
2821 label =
"TooFewVtxContrib";
2823 return label.Data();
2826 label =
"ZVtxOutFid";
2828 return label.Data();
2833 return label.Data();
2836 label =
"OutsideCentrality";
2838 return label.Data();
2841 label =
"PhysicsSelection";
2843 return label.Data();
2846 label =
"BadSPDVertex";
2848 return label.Data();
2851 label =
"ZVtxSPDOutFid";
2853 return label.Data();
2856 label =
"CentralityFlattening";
2858 return label.Data();
2861 label =
"BadTrackV0Correl";
2863 return label.Data();
2866 return label.Data();
2898 ::Error(
"AddTaskDmesonJets",
"No analysis manager to connect to.");
2903 AliVEventHandler* handler = mgr->GetInputEventHandler();
2905 ::Error(
"AddTaskEmcalJetSpectraQA",
"This task requires an input event handler");
2911 if (handler->InheritsFrom(
"AliESDInputHandler")) {
2914 else if (handler->InheritsFrom(
"AliAODInputHandler")) {
2919 if (ntracks ==
"usedefault") {
2920 if (dataType ==
kESD) {
2923 else if (dataType ==
kAOD) {
2931 if (nclusters ==
"usedefault") {
2932 if (dataType ==
kESD) {
2933 nclusters =
"CaloClusters";
2935 else if (dataType ==
kAOD) {
2936 nclusters =
"caloClusters";
2943 if (nMCpart ==
"usedefault") {
2944 nMCpart =
"mcparticles";
2947 TString name(
"AliAnalysisTaskDmesonJets");
2948 if (strcmp(suffix,
"") != 0) {
2949 name += TString::Format(
"_%s", suffix.Data());
2954 if (!ntracks.IsNull()) {
2959 if (!nMCpart.IsNull()) {
2961 partCont->SetEtaLimits(-1.5, 1.5);
2962 partCont->SetPtLimits(0, 1000);
2969 mgr->AddTask(jetTask);
2972 AliAnalysisDataContainer* cinput1 = mgr->GetCommonInputContainer();
2974 contname1 +=
"_histos";
2975 AliAnalysisDataContainer* coutput1 = mgr->CreateContainer(contname1.Data(),
2976 TList::Class(), AliAnalysisManager::kOutputContainer,
2977 Form(
"%s", AliAnalysisManager::GetCommonFileName()));
2979 mgr->ConnectInput(jetTask, 0, cinput1);
2980 mgr->ConnectOutput(jetTask, 1, coutput1);
2982 for (
Int_t i = 0; i < nMaxTrees; i++) {
2983 TString contname = TString::Format(
"%s_tree_%d", name.Data(), i);
2984 AliAnalysisDataContainer *coutput = mgr->CreateContainer(contname.Data(),
2985 TTree::Class(),AliAnalysisManager::kOutputContainer,
2986 Form(
"%s", AliAnalysisManager::GetCommonFileName()));
2987 mgr->ConnectOutput(jetTask, 2+i, coutput);
Int_t GetNConstituents() const
void SetRejectionReasonLabels(TAxis *axis)
AliClusterContainer * AddClusterContainer(std::string branchName, std::string contName="")
void Print() const
Prints the content of this object in the standard output.
void UserCreateOutputObjects()
std::list< AnalysisEngine > fAnalysisEngines
Array of analysis parameters.
Bool_t FillTree(Bool_t applyKinCuts)
AliEMCALGeometry * fGeom
!emcal geometry
void SetDMesonCandidate(AliAODRecoDecay *c)
Analysis task for D meson jets.
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
AliRDHFCuts * fRDHFCuts
D meson candidates cuts.
virtual void Set(const AliDmesonJetInfo &source)
void RunAnalysis()
Run the analysis.
Lightweight class that encapsulates D meson jets.
Double_t fTrackEfficiency
Artificial tracking inefficiency (0...1)
Bool_t FillHnSparse(Bool_t applyKinCuts)
virtual void Set(const AliDmesonJetInfo &source, std::string n)
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)
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.
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()
Lightweight class that encapsulates D meson jets.
Double_t fInvMass2Prong
! 2-prong mass of the D* candidate (w/o the soft pion)
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.
AliAODMCParticle * fFirstParton
! pointer to the first parton in the shower tree of the D meson (only for particle level D mesons) ...
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 InvMassD0() const
Short_t fLastPartonType
! type of the last parton in the shower tree (only for particle level D mesons)
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.
virtual void Reset()
Reset the current object.
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
static TString GenerateJetName(EJetType_t jetType, EJetAlgo_t jetAlgo, ERecoScheme_t recoScheme, Double_t radius, AliParticleContainer *partCont, AliClusterContainer *clusCont, TString tag)
Select tracks based on specific prescriptions of HF analysis.
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) ...
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)
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.
THashList * GetListOfHistograms() const
Get the list of histograms.
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.
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
Int_t GetDataSlotNumber() const
Double_t fRadius
Jet radius.
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
AliRDHFCuts * LoadDMesonCutsFromFile(TString cutfname, TString cutsname)
AliDmesonJetInfo()
Default constructor.
bool operator<(const AliAnalysisTaskDmesonJets::AliHFJetDefinition &lhs, const AliAnalysisTaskDmesonJets::AliHFJetDefinition &rhs)
std::list< AnalysisEngine >::iterator FindAnalysisEngine(const AnalysisEngine &eng)
std::vector< AliHFJetDefinition > fJetDefinitions
Jet definitions.
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.
void SetRejectedOriginMap(UInt_t m)
Bool_t ExtractDstarAttributes(const AliAODRecoCascadeHF *DstarCand, AliDmesonJetInfo &DmesonJet, UInt_t i)
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
void SetAcceptedDecayMap(UInt_t m)
Short_t fFirstPartonType
! type of the first parton in the shower tree (only for particle level D mesons)
const AliMCParticleIterableMomentumContainer all_momentum() const
virtual ~AliAnalysisTaskDmesonJets()
This is the standard destructor.
Byte_t fSelectionType
! for D0: 0=not selected, 1=D0, 2=D0bar, 3=both
void SetCandidateProperties(Double_t range)
static std::pair< AliAnalysisTaskDmesonJets::EMesonOrigin_t, AliAODMCParticle * > CheckOrigin(const AliAODMCParticle *part, TClonesArray *mcArray, Bool_t firstParton=kFALSE)
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.
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)
std::vector< fastjet::PseudoJet > GetJetConstituents(UInt_t idx) const
static FJJetAlgo ConvertToFJAlgo(EJetAlgo_t algo)
void AdoptRDHFCuts(AliRDHFCuts *cuts)
Class that encapsulates jets.
std::map< std::string, AliJetInfo > fJets
! list of jets
Bool_t IsSpecialPDGFound() const
virtual void PrintAll() const
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
virtual ~AnalysisEngine()
void RunParticleLevelAnalysis()
Run a particle level analysis.
std::map< std::string, AliParticleContainer * > fParticleCollArray
particle/track collection array
Bool_t fApplyKinematicCuts
Apply jet kinematic cuts.
AnalysisEngine * AddAnalysisEngine(ECandidateType_t type, TString cutfname, EMCMode_t bkgMode, EJetType_t jettype, Double_t jetradius, TString rhoName="")
const char * GetName() const
Generate a name for this jet definition.
Bool_t ExtractRecoDecayAttributes(const AliAODRecoDecayHF2Prong *Dcand, AliDmesonJetInfo &DmesonJet, UInt_t i)
Double_t InvMassD0() const
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)
bool operator==(const AliAnalysisTaskDmesonJets::AliHFJetDefinition &lhs, const AliAnalysisTaskDmesonJets::AliHFJetDefinition &rhs)
Double_t InvMassDstarKpipi() 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.
void SetSpecialPDG(Int_t pdg)
AliHFJetDefinition & operator=(const AliHFJetDefinition &source)
Int_t GetNAcceptedParticles() const
void SetAreaType(const fastjet::AreaType &atype)
AliTLorentzVector fMomentum
4-momentum of the jet
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.
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
void AdoptParticleContainer(AliParticleContainer *cont)
void SetCharge(EChargeCut_t c)
Container for jet within the EMCAL jet framework.
AliAODMCParticle * fLastParton
! pointer to the last parton in the shower tree of the D meson (only for particle level D mesons) ...
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)