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"
66 dphi = TVector2::Phi_mpi_pi(
fMomentum.Phi() - jet.
Phi());;
68 return TMath::Sqrt(dphi*dphi + deta*deta);
79 return GetDistance(jet, deta, dphi);
96 fReconstructed(kFALSE),
109 fDmesonParticle(source.fDmesonParticle),
111 fSoftPionPt(source.fSoftPionPt),
112 fInvMass2Prong(source.fInvMass2Prong),
114 fMCLabel(source.fMCLabel),
115 fReconstructed(source.fReconstructed),
116 fFirstParton(source.fFirstParton),
117 fFirstPartonType(source.fFirstPartonType),
118 fLastParton(source.fLastParton),
119 fLastPartonType(source.fLastPartonType),
120 fSelectionType(source.fSelectionType)
136 fD.SetPtEtaPhiE(0,0,0,0);
141 fReconstructed = kFALSE;
143 fFirstPartonType = 0;
146 for (
auto &jet : fJets) {
147 jet.second.fMomentum.SetPtEtaPhiE(0,0,0,0);
148 jet.second.fNConstituents = 0;
150 jet.second.fMaxChargedPt = 0;
151 jet.second.fMaxNeutralPt = 0;
158 Printf(
"Printing D Meson Jet object.");
159 Printf(
"D Meson: pT = %.3f, eta = %.3f, phi = %.3f, inv. mass = %.3f", fD.Pt(), fD.Eta(), fD.Phi_0_2pi(), fD.M());
160 Printf(
"Soft pion pT: %.3f. 2-Prong Invariant mass = %.3f", fSoftPionPt, fInvMass2Prong);
161 for (
auto &jet : fJets) {
162 Printf(
"Jet %s: pT = %.3f, eta = %.3f, phi = %.3f", jet.first.c_str(), jet.second.Pt(), jet.second.Eta(), jet.second.Phi_0_2pi());
163 Printf(
"Jet N Consituents = %d", jet.second.fNConstituents);
172 std::map<std::string, AliJetInfo>::const_iterator it = fJets.find(n);
173 if (it == fJets.end())
return 0;
177 if ((*it).second.Pt() > 0) {
178 TVector3 dvect = fD.Vect();
179 TVector3 jvect = (*it).second.fMomentum.Vect();
184 ::Error(
"AliAnalysisTaskDmesonJets::AliDmesonJetInfo::GetZ",
"Zero jet momentum!");
188 z = (dvect * jvect) / jetMom;
191 if (z == 1 || (z > 1 && z - 1 < 1e-3)) z = 0.999;
205 std::map<std::string, AliJetInfo>::const_iterator it = fJets.find(n);
206 if (it == fJets.end())
return 0;
208 return GetDistance((*it).second, deta, dphi);
219 return GetDistance(n, deta, dphi);
230 dphi = TVector2::Phi_mpi_pi(fD.Phi() - jet.
Phi());;
231 deta = fD.Eta() - jet.
Eta();
232 return TMath::Sqrt(dphi*dphi + deta*deta);
243 return GetDistance(jet, deta, dphi);
252 std::map<std::string, AliJetInfo>::const_iterator it = fJets.find(n);
253 if (it == fJets.end()) {
254 ::Error(
"AliAnalysisTaskDmesonJets::AliDmesonJetInfo::GetJet",
"Could not find jet info for the jet definition '%s'!",
258 return &((*it).second);
267 std::map<std::string, AliJetInfo>::iterator it = fJets.find(n);
268 if (it == fJets.end()) {
269 ::Error(
"AliAnalysisTaskDmesonJets::AliDmesonJetInfo::GetJet",
"Could not find jet info for the jet definition '%s'!",
273 return &((*it).second);
314 std::map<std::string, AliJetInfo>::const_iterator it = source.
fJets.find(n);
315 if (it == source.
fJets.end())
return;
317 fPt = (*it).second.Pt();
318 fEta = (*it).second.Eta();
319 fPhi = (*it).second.Phi_0_2pi();
322 fN = (*it).second.GetNConstituents();
360 fPt = source.
fD.Pt();
361 fEta = source.
fD.Eta();
421 fFirstPartonType = 0,
438 fInvMass(source.fD.M()),
448 fInvMass = source.
fD.M();
472 f2ProngInvMass(source.fInvMass2Prong),
473 fDeltaInvMass(source.fD.M() - source.fInvMass2Prong)
552 fJetType(source.fJetType),
553 fRadius(source.fRadius),
554 fJetAlgo(source.fJetAlgo),
555 fRecoScheme(source.fRecoScheme),
556 fMinJetPt(source.fMinJetPt),
557 fMaxJetPt(source.fMaxJetPt),
558 fMinJetPhi(source.fMinJetPhi),
559 fMaxJetPhi(source.fMaxJetPhi),
560 fMinJetEta(source.fMinJetEta),
561 fMaxJetEta(source.fMaxJetEta),
562 fMinChargedPt(source.fMinChargedPt),
563 fMaxChargedPt(source.fMaxChargedPt),
564 fMinNeutralPt(source.fMinNeutralPt),
565 fMaxNeutralPt(source.fMaxNeutralPt)
594 if (fMinJetEta < fMaxJetEta && (jet.
Eta() < fMinJetEta || jet.
Eta() > fMaxJetEta))
return kFALSE;
595 if (fMinJetPhi < fMaxJetPhi && (jet.
Phi() < fMinJetPhi || jet.
Phi() > fMaxJetPhi))
return kFALSE;
596 if (jet.
Pt() > fMaxJetPt || jet.
Pt() < fMinJetPt)
return kFALSE;
610 if (!jet)
return kFALSE;
611 return IsJetInAcceptance((*jet));
683 fCurrentDmesonJetInfo(0),
688 fClusterContainer(0),
706 fCandidateType(type),
713 fNMassBins(nMassBins),
727 fCurrentDmesonJetInfo(0),
732 fClusterContainer(0),
745 fFirstPartons(source.fFirstPartons),
746 fLastPartons(source.fLastPartons),
747 fCandidateType(source.fCandidateType),
748 fCandidateName(source.fCandidateName),
749 fCandidatePDG(source.fCandidatePDG),
750 fNDaughters(source.fNDaughters),
751 fPDGdaughters(source.fPDGdaughters),
752 fBranchName(source.fBranchName),
753 fMCMode(source.fMCMode),
754 fNMassBins(source.fNMassBins),
755 fMinMass(source.fMinMass),
756 fMaxMass(source.fMaxMass),
758 fRejectedOrigin(source.fRejectedOrigin),
759 fAcceptedDecay(source.fAcceptedDecay),
760 fInhibit(source.fInhibit),
761 fJetDefinitions(source.fJetDefinitions),
762 fPtBinWidth(source.fPtBinWidth),
763 fMaxPt(source.fMaxPt),
764 fRandomGen(source.fRandomGen),
768 fCurrentDmesonJetInfo(0),
770 fCandidateArray(source.fCandidateArray),
772 fTrackContainer(source.fTrackContainer),
773 fClusterContainer(source.fClusterContainer),
801 for (
UInt_t i = 0; i < fJetDefinitions.size(); i++) {
802 if (fJetDefinitions[i].IsJetInAcceptance(dMesonJet, fJetDefinitions[i].GetName()))
return kTRUE;
818 switch (fCandidateType) {
821 fCandidateName =
"D0";
823 fPDGdaughters.Set(fNDaughters);
824 fPDGdaughters.Reset();
825 fPDGdaughters[0] = 211;
826 fPDGdaughters[1] = 321;
827 fBranchName =
"D0toKpi";
831 fRDHFCuts->SetStandardCutsPP2010();
832 fRDHFCuts->GetPidHF()->SetOldPid(kFALSE);
833 fRDHFCuts->SetUsePhysicsSelection(kFALSE);
834 fRDHFCuts->SetTriggerClass(
"",
"");
839 fCandidateName =
"2ProngLikeSign";
841 fPDGdaughters.Set(fNDaughters);
842 fPDGdaughters.Reset();
843 fPDGdaughters[0] = 211;
844 fPDGdaughters[1] = 321;
845 fBranchName =
"LikeSign2Prong";
848 fRDHFCuts->SetStandardCutsPP2010();
849 fRDHFCuts->GetPidHF()->SetOldPid(kFALSE);
850 fRDHFCuts->SetUsePhysicsSelection(kFALSE);
851 fRDHFCuts->SetTriggerClass(
"",
"");
856 fCandidateName =
"DStar";
858 fPDGdaughters.Set(fNDaughters);
859 fPDGdaughters.Reset();
860 fPDGdaughters[0] = 211;
861 fPDGdaughters[1] = 211;
862 fPDGdaughters[2] = 321;
863 fBranchName =
"Dstar";
867 fRDHFCuts->SetStandardCutsPP2010();
868 fRDHFCuts->GetPidHF()->SetOldPid(kFALSE);
869 fRDHFCuts->SetUsePhysicsSelection(kFALSE);
870 fRDHFCuts->SetTriggerClass(
"",
"");
874 ::Error(
"AliAnalysisTaskDmesonJets::AnalysisEngine::SetCandidateProperties",
"Candidate %d unknown!", fCandidateType);
885 if (fRDHFCuts)
delete fRDHFCuts;
895 if (fRDHFCuts)
delete fRDHFCuts;
896 fRDHFCuts =
static_cast<AliRDHFCuts*
>(cuts->Clone());
906 name = TString::Format(
"%s_%s", GetName(), jetDef.
GetName());
918 name = fCandidateName;
921 name +=
"_kBackgroundOnly";
924 name +=
"_kSignalOnly";
947 std::vector<AliHFJetDefinition>::iterator it = FindJetDefinition(def);
949 if (it == fJetDefinitions.end() || *it != def) {
950 fJetDefinitions.push_back(def);
951 ::Info(
"AliAnalysisTaskDmesonJets::AnalysisEngine::AddJetDefinition",
"Jet definition '%s' has been added to analysis engine '%s'."
952 "Total number of jet definitions is now %lu.",
953 def.
GetName(), GetName(), fJetDefinitions.size());
955 if (fMCMode !=
kMCTruth) fJetDefinitions[fJetDefinitions.size()-1].SetChargedPtRange(0., 100.);
958 ::Warning(
"AliAnalysisTaskDmesonJets::AnalysisEngine::AddJetDefinition",
"The same jet definition '%s' was already added in analysis engine '%s'.", def.
GetName(), GetName());
978 return AddJetDefinition(def);
988 std::vector<AliHFJetDefinition>::iterator it = fJetDefinitions.begin();
989 while (it != fJetDefinitions.end() && (*it) != def) it++;
1030 return ExtractD0Attributes(Dcand, DmesonJet, i);
1033 return ExtractDstarAttributes(static_cast<const AliAODRecoCascadeHF*>(Dcand), DmesonJet, i);
1049 AliDebug(10,
"Checking if D0 meson is selected");
1051 if (isSelected == 0)
return kFALSE;
1053 Int_t MCtruthPdgCode = 0;
1060 Int_t mcLab = Dcand->MatchToMC(fCandidatePDG,
fMCContainer->GetArray(), fNDaughters, fPDGdaughters.GetArray());
1065 AliAODMCParticle* aodMcPart =
static_cast<AliAODMCParticle*
>(
fMCContainer->GetArray()->At(mcLab));
1069 if (fRejectedOrigin) {
1070 auto origin = CheckOrigin(aodMcPart,
fMCContainer->GetArray());
1071 if ((origin.first & fRejectedOrigin) == origin.first)
return kFALSE;
1073 MCtruthPdgCode = aodMcPart->PdgCode();
1078 if (isSelected == 1) {
1079 if (i != 0)
return kFALSE;
1081 if (fMCMode ==
kNoMC ||
1082 (MCtruthPdgCode == fCandidatePDG && fMCMode ==
kSignalOnly) ||
1084 (MCtruthPdgCode == -fCandidatePDG && fMCMode ==
kWrongPID)) {
1086 AliDebug(10,
"Selected as D0");
1093 else if (isSelected == 2) {
1094 if (i != 1)
return kFALSE;
1096 if (fMCMode ==
kNoMC ||
1097 (MCtruthPdgCode == -fCandidatePDG && fMCMode ==
kSignalOnly) ||
1099 (MCtruthPdgCode == fCandidatePDG && fMCMode ==
kWrongPID)) {
1101 AliDebug(10,
"Selected as D0bar");
1108 else if (isSelected == 3) {
1109 AliDebug(10,
"Selected as either D0 or D0bar");
1112 if ((MCtruthPdgCode == fCandidatePDG && fMCMode ==
kSignalOnly) ||
1114 if (i != 0)
return kFALSE;
1115 AliDebug(10,
"MC truth is D0");
1118 else if ((MCtruthPdgCode == -fCandidatePDG && fMCMode ==
kSignalOnly) ||
1120 if (i != 1)
return kFALSE;
1121 AliDebug(10,
"MC truth is D0bar");
1130 AliDebug(10,
"Returning invariant mass with D0 hypothesis");
1134 AliDebug(10,
"Returning invariant mass with D0bar hypothesis");
1146 DmesonJet.
fD.SetPtEtaPhiM(Dcand->Pt(), Dcand->Eta(), Dcand->Phi(), invMassD);
1159 AliDebug(10,
"Checking if D* meson is selected");
1161 if (isSelected == 0)
return kFALSE;
1163 if ((i == 1 && DstarCand->Charge()>0) || (i == 0 && DstarCand->Charge()<0) || i > 1)
return kFALSE;
1165 Int_t MCtruthPdgCode = 0;
1170 Int_t pdgDgDStartoD0pi[2] = { 421, 211 };
1171 Int_t pdgDgD0toKpi[2] = { 321, 211 };
1174 AliDebug(10, Form(
"MC label is %d", mcLab));
1177 AliAODMCParticle* aodMcPart =
static_cast<AliAODMCParticle*
>(
fMCContainer->GetArray()->At(mcLab));
1180 if (fRejectedOrigin) {
1181 auto origin = CheckOrigin(aodMcPart,
fMCContainer->GetArray());
1182 if ((origin.first & fRejectedOrigin) == origin.first)
return kFALSE;
1185 MCtruthPdgCode = aodMcPart->PdgCode();
1186 AliDebug(10, Form(
"MC truth pdg code is %d",MCtruthPdgCode));
1191 Int_t absMCtruthPdgCode = TMath::Abs(MCtruthPdgCode);
1192 if (fMCMode ==
kNoMC ||
1193 (absMCtruthPdgCode == 413 && fMCMode ==
kSignalOnly) ||
1199 DmesonJet.
fD.SetPtEtaPhiM(DstarCand->Pt(), DstarCand->Eta(), DstarCand->Phi(), invMassD);
1220 Int_t absPdgPart = TMath::Abs(part->GetPdgCode());
1222 if (part->GetNDaughters() == 2) {
1224 AliAODMCParticle* d1 =
static_cast<AliAODMCParticle*
>(mcArray->At(part->GetDaughter(0)));
1225 AliAODMCParticle* d2 =
static_cast<AliAODMCParticle*
>(mcArray->At(part->GetDaughter(1)));
1231 Int_t absPdg1 = TMath::Abs(d1->GetPdgCode());
1232 Int_t absPdg2 = TMath::Abs(d2->GetPdgCode());
1234 if (absPdgPart == 421) {
1235 if ((absPdg1 == 211 && absPdg2 == 321) ||
1236 (absPdg1 == 321 && absPdg2 == 211)) {
1241 if (absPdgPart == 413) {
1242 if (absPdg1 == 421 && absPdg2 == 211) {
1243 Int_t D0decay = CheckDecayChannel(d1, mcArray);
1248 else if (absPdg1 == 211 && absPdg2 == 421) {
1249 Int_t D0decay = CheckDecayChannel(d2, mcArray);
1270 std::pair<AliAnalysisTaskDmesonJets::EMesonOrigin_t, AliAODMCParticle*> result(
kUnknownQuark, 0);
1272 if (!part)
return result;
1273 if (!mcArray)
return result;
1275 Int_t mother = part->GetMother();
1276 while (mother >= 0) {
1277 AliAODMCParticle* mcGranma =
static_cast<AliAODMCParticle*
>(mcArray->At(mother));
1279 Int_t abspdgGranma = TMath::Abs(mcGranma->GetPdgCode());
1281 if (abspdgGranma == 1) result = {
kFromDown, mcGranma};
1282 if (abspdgGranma == 2) result = {
kFromUp, mcGranma};
1283 if (abspdgGranma == 3) result = {
kFromStrange, mcGranma};
1284 if (abspdgGranma == 4) result = {
kFromCharm, mcGranma};
1285 if (abspdgGranma == 5) result = {
kFromBottom, mcGranma};
1286 if (abspdgGranma == 6) result = {
kFromTop, mcGranma};
1287 if (abspdgGranma == 9 || abspdgGranma == 21) result = {
kFromGluon, mcGranma};
1290 if (result.first !=
kUnknownQuark && !firstParton)
return result;
1292 mother = mcGranma->GetMother();
1295 ::Error(
"AliAnalysisTaskDmesonJets::AnalysisParams::CheckOrigin",
"Could not retrieve mother particle %d!", mother);
1306 for (
auto& jetDef : fJetDefinitions) {
1307 jetDef.fJets.clear();
1311 RunParticleLevelAnalysis();
1314 RunDetectorLevelAnalysis();
1330 fTrackContainer->SetDMesonCandidate(0);
1331 AddInputVectors(fTrackContainer, 100);
1335 AddInputVectors(fClusterContainer, -100);
1343 for (
UInt_t ijet = 0; ijet < jets_incl.size(); ++ijet) {
1350 for (
UInt_t ic = 0; ic < constituents.size(); ++ic) {
1351 if (constituents[ic].user_index() >= 100) {
1352 if (constituents[ic].pt() > maxChPt) maxChPt = constituents[ic].pt();
1354 else if (constituents[ic].user_index() <= -100) {
1355 totalNeutralPt += constituents[ic].pt();
1356 if (constituents[ic].pt() > maxNePt) maxChPt = constituents[ic].pt();
1360 jetDef.
fJets.push_back(
1361 AliJetInfo(jets_incl[ijet].px(), jets_incl[ijet].py(), jets_incl[ijet].pz(), jets_incl[ijet].E(),
1362 constituents.size(), totalNeutralPt / jets_incl[ijet].pt(), maxChPt, maxNePt)
1376 if (jetDef.
fJets.size() == 0) FindJets(jetDef);
1388 for (
auto& jet : jetDef.
fJets) {
1391 if (d > dMax)
continue;
1392 if (d < d_closest) {
1398 if (jet_closest && applyKinCuts) {
1403 AliDebug(2, Form(
"Found closest jet (pt=%.3f, eta=%.3f, phi=%.3f) to d meson (pt=%.3f, eta=%.3f, phi=%.3f) with d = %.3f",
1415 const Int_t nD = fCandidateArray->GetEntriesFast();
1419 Int_t nAccCharm[3] = {0};
1420 for (
Int_t icharm = 0; icharm < nD; icharm++) {
1422 if (!charmCand)
continue;
1425 if (!fRDHFCuts->IsInFiducialAcceptance(charmCand->Pt(), charmCand->Y(fCandidatePDG)))
continue;
1426 Int_t nMassHypo = 0;
1427 for (
Int_t im = 0; im < 2; im++) {
1431 if (ExtractRecoDecayAttributes(charmCand, DmesonJet, im)) {
1432 for (
auto& def : fJetDefinitions) {
1433 if (!FindJet(charmCand, DmesonJet, def)) {
1434 AliWarning(Form(
"Could not find jet '%s' for D meson '%s': pT = %.3f, eta = %.3f, phi = %.3f",
1435 def.GetName(), GetName(), DmesonJet.
fD.Pt(), DmesonJet.
fD.Eta(), DmesonJet.
fD.
Phi_0_2pi()));
1438 fDmesonJets[(icharm+1)*(1-(im*2))] = DmesonJet;
1443 if (nMassHypo == 2) {
1448 if (nMassHypo == 2) {
1449 fDmesonJets[(icharm+1)].fSelectionType = 3;
1450 fDmesonJets[-(icharm+1)].fSelectionType = 3;
1456 hname = TString::Format(
"%s/fHistNTotAcceptedDmesons", GetName());
1461 hname = TString::Format(
"%s/fHistNAcceptedDmesonsVsNtracks", GetName());
1462 fHistManager->
FillTH2(hname, fTrackContainer->GetNAcceptedTracks(), nAccCharm[0]+nAccCharm[1]+nAccCharm[2]);
1464 hname = TString::Format(
"%s/fHistNDmesons", GetName());
1489 fTrackContainer->SetDMesonCandidate(Dcand);
1490 hname = TString::Format(
"%s/%s/fHistTrackRejectionReason", GetName(), jetDef.
GetName());
1493 hname = TString::Format(
"%s/%s/fHistDMesonDaughterNotInJet", GetName(), jetDef.
GetName());
1495 const TObjArray& daughters = fTrackContainer->GetDaughterList();
1496 for (
Int_t i = 0; i < daughters.GetEntriesFast(); i++) {
1497 AliVParticle* daughter =
static_cast<AliVParticle*
>(daughters.At(i));
1498 if (!fTrackContainer->GetArray()->FindObject(daughter)) histDaughterNotInJet->Fill(daughter->Pt());
1503 hname = TString::Format(
"%s/%s/fHistClusterRejectionReason", GetName(), jetDef.
GetName());
1512 for (
UInt_t ijet = 0; ijet < jets_incl.size(); ++ijet) {
1515 Bool_t isDmesonJet = kFALSE;
1521 for (
UInt_t ic = 0; ic < constituents.size(); ++ic) {
1522 if (constituents[ic].user_index() == 0) {
1523 isDmesonJet = kTRUE;
1525 else if (constituents[ic].user_index() >= 100) {
1526 if (constituents[ic].pt() > maxChPt) maxChPt = constituents[ic].pt();
1528 else if (constituents[ic].user_index() <= -100) {
1529 totalNeutralPt += constituents[ic].pt();
1530 if (constituents[ic].pt() > maxNePt) maxChPt = constituents[ic].pt();
1535 DmesonJet.
fJets[jetDef.
GetName()].fMomentum.SetPxPyPzE(jets_incl[ijet].px(), jets_incl[ijet].py(), jets_incl[ijet].pz(), jets_incl[ijet].E());
1536 DmesonJet.
fJets[jetDef.
GetName()].fNConstituents = constituents.size();
1537 DmesonJet.
fJets[jetDef.
GetName()].fMaxChargedPt = maxChPt;
1538 DmesonJet.
fJets[jetDef.
GetName()].fMaxNeutralPt = maxNePt;
1539 DmesonJet.
fJets[jetDef.
GetName()].fNEF = totalNeutralPt / jets_incl[ijet].pt();
1553 auto itcont = cont->all_momentum();
1554 for (AliEmcalIterableMomentumContainer::iterator it = itcont.begin(); it != itcont.end(); it++) {
1555 UInt_t rejectionReason = 0;
1556 if (!cont->AcceptObject(it.current_index(), rejectionReason)) {
1557 if (rejectHist) rejectHist->Fill(AliEmcalContainer::GetRejectionReasonBitPosition(rejectionReason), it->first.Pt());
1560 if (fRandomGen && eff > 0 && eff < 1) {
1563 if (rejectHist) rejectHist->Fill(6, it->first.Pt());
1567 Int_t uid = offset >= 0 ? it.current_index() + offset: -it.current_index() - offset;
1583 Int_t nAccCharm[3] = {0};
1585 for (
auto &jetDef : fJetDefinitions) {
1586 hname = TString::Format(
"%s/%s/fHistNDmesonsVsNconstituents", GetName(), jetDef.GetName());
1589 switch (jetDef.fJetType) {
1606 hname = TString::Format(
"%s/%s/fHistMCParticleRejectionReason", GetName(), jetDef.GetName());
1613 for (
auto jet : jets_incl) {
1614 Int_t nDmesonsInJet = 0;
1616 for (
auto constituent : jet.constituents()) {
1617 Int_t iPart = constituent.user_index() - 100;
1620 ::Error(
"AliAnalysisTaskDmesonJets::AnalysisEngine::RunParticleLevelAnalysis",
"Could not find jet constituent %d!", iPart);
1623 if (TMath::Abs(part->PdgCode()) == fCandidatePDG) {
1625 std::map<int, AliDmesonJetInfo>::iterator dMesonJetIt = fDmesonJets.find(iPart);
1626 if (dMesonJetIt == fDmesonJets.end()) {
1627 std::pair<int, AliDmesonJetInfo> element;
1628 element.first = iPart;
1629 dMesonJetIt = fDmesonJets.insert(element).first;
1630 (*dMesonJetIt).second.fD.SetPxPyPzE(part->Px(), part->Py(), part->Pz(), part->E());
1631 (*dMesonJetIt).second.fDmesonParticle = part;
1632 (*dMesonJetIt).second.fSelectionType = part->PdgCode() > 0 ? 1 : 2;
1637 auto firstParton = CheckOrigin(part,
fMCContainer->GetArray(), kTRUE);
1639 rs = firstParton.first;
1640 while (rs >>= 1) { p++; }
1641 (*dMesonJetIt).second.fFirstPartonType = p;
1642 (*dMesonJetIt).second.fFirstParton = firstParton.second;
1644 auto lastParton = CheckOrigin(part,
fMCContainer->GetArray(), kFALSE);
1646 rs = lastParton.first;
1647 while (rs >>= 1) { p++; }
1648 (*dMesonJetIt).second.fLastPartonType = p;
1649 (*dMesonJetIt).second.fLastParton = lastParton.second;
1651 if (part->PdgCode() > 0) {
1659 (*dMesonJetIt).second.fJets[jetDef.GetName()].fMomentum.SetPxPyPzE(jet.px(), jet.py(), jet.pz(), jet.E());
1660 (*dMesonJetIt).second.fJets[jetDef.GetName()].fNConstituents = jet.constituents().size();
1663 if (nDmesonsInJet > 0) histNDmesonsVsNconstituents->Fill(jet.constituents().size(), nDmesonsInJet);
1667 if (fDmesonJets.size() != nAccCharm[0]+nAccCharm[1]) AliError(Form(
"I found %lu mesons (%d)?", fDmesonJets.size(), nAccCharm[0]+nAccCharm[1]));
1668 hname = TString::Format(
"%s/fHistNTotAcceptedDmesons", GetName());
1673 hname = TString::Format(
"%s/fHistNAcceptedDmesonsVsNtracks", GetName());
1676 hname = TString::Format(
"%s/fHistNDmesons", GetName());
1687 classname =
"AliAnalysisTaskDmesonJets::AliDmesonMCInfoSummary";
1691 switch (fCandidateType) {
1694 classname =
"AliAnalysisTaskDmesonJets::AliD0InfoSummary";
1698 classname =
"AliAnalysisTaskDmesonJets::AliDStarInfoSummary";
1703 TString treeName = TString::Format(
"%s_%s", taskName, GetName());
1704 fTree =
new TTree(treeName, treeName);
1705 fTree->Branch(
"DmesonJet", classname, &fCurrentDmesonJetInfo);
1707 for (
Int_t i = 0; i < fJetDefinitions.size(); i++) {
1709 fTree->Branch(fJetDefinitions[i].GetName(),
"AliAnalysisTaskDmesonJets::AliJetInfoSummary", &fCurrentJetInfo[i]);
1724 for (
auto &jetDef : fJetDefinitions) {
1726 AliDebug(2,Form(
"Now working on '%s'", jetDef.GetName()));
1736 title[dim] =
"#it{p}_{T,D} (GeV/#it{c})";
1743 title[dim] =
"#eta_{D}";
1749 title[dim] =
"#phi_{D} (rad)";
1752 max[dim] = TMath::TwoPi();
1757 title[dim] =
"#it{M}_{K#pi#pi} (GeV/#it{c}^{2})";
1758 nbins[dim] = fNMassBins;
1759 min[dim] = fMinMass;
1760 max[dim] = fMaxMass;
1765 title[dim] =
"#it{M}_{K#pi} (GeV/#it{c}^{2})";
1766 nbins[dim] = fNMassBins;
1767 min[dim] = fMinMass;
1768 max[dim] = fMaxMass;
1773 title[dim] =
"#it{M}_{K#pi} (GeV/#it{c}^{2})";
1774 nbins[dim] = fNMassBins;
1780 title[dim] =
"#it{M}_{K#pi#pi} - #it{M}_{K#pi} (GeV/#it{c}^{2})";
1781 nbins[dim] = fNMassBins*6;
1785 Double_t D0mass = TDatabasePDG::Instance()->GetParticle(421)->Mass();
1793 title[dim] =
"#it{p}_{T,#pi} (GeV/#it{c})";
1800 title[dim] =
"#it{z}_{D}";
1806 if ((enabledAxis &
kDeltaR) != 0) {
1807 title[dim] =
"#Delta R_{D-jet}";
1810 max[dim] = radius * 1.5;
1815 title[dim] =
"#eta_{D} - #eta_{jet}";
1817 min[dim] = -radius * 1.2;
1818 max[dim] = radius * 1.2;
1823 title[dim] =
"#phi_{D} - #phi_{jet} (rad)";
1825 min[dim] = -radius * 1.2;
1826 max[dim] = radius * 1.2;
1830 title[dim] =
"#it{p}_{T,jet} (GeV/#it{c})";
1837 title[dim] =
"#eta_{jet}";
1843 title[dim] =
"#phi_{jet} (rad)";
1846 max[dim] = TMath::TwoPi();
1851 title[dim] =
"No. of constituents";
1858 hname = TString::Format(
"%s/%s/fDmesonJets", GetName(), jetDef.GetName());
1860 for (
Int_t j = 0; j < dim; j++) {
1861 h->GetAxis(j)->SetTitle(title[j]);
1872 fFirstPartons.clear();
1873 fLastPartons.clear();
1874 for (
auto& dmeson_pair : fDmesonJets) {
1875 fCurrentDmesonJetInfo->Set(dmeson_pair.second);
1877 for (
UInt_t ij = 0; ij < fJetDefinitions.size(); ij++) {
1878 fCurrentJetInfo[ij]->Reset();
1879 AliJetInfo* jet = dmeson_pair.second.GetJet(fJetDefinitions[ij].GetName());
1881 if (applyKinCuts && !fJetDefinitions[ij].IsJetInAcceptance(*jet)) {
1882 hname = TString::Format(
"%s/%s/fHistRejectedJetPt", GetName(), fJetDefinitions[ij].GetName());
1884 hname = TString::Format(
"%s/%s/fHistRejectedJetPhi", GetName(), fJetDefinitions[ij].GetName());
1886 hname = TString::Format(
"%s/%s/fHistRejectedJetEta", GetName(), fJetDefinitions[ij].GetName());
1890 fCurrentJetInfo[ij]->Set(dmeson_pair.second, fJetDefinitions[ij].GetName());
1894 fFirstPartons[dmeson_pair.second.fFirstParton] = dmeson_pair.second.fFirstPartonType;
1895 fLastPartons[dmeson_pair.second.fLastParton] = dmeson_pair.second.fLastPartonType;
1900 hname = TString::Format(
"%s/fHistRejectedDMesonPt", GetName());
1902 hname = TString::Format(
"%s/fHistRejectedDMesonPhi", GetName());
1904 hname = TString::Format(
"%s/fHistRejectedDMesonEta", GetName());
1908 hname = TString::Format(
"%s/fHistRejectedDMesonInvMass", GetName());
1912 hname = TString::Format(
"%s/fHistRejectedDMeson2ProngInvMass", GetName());
1915 hname = TString::Format(
"%s/fHistRejectedDMesonDeltaInvMass", GetName());
1916 fHistManager->
FillTH1(hname, dmeson_pair.second.fD.M() - dmeson_pair.second.fInvMass2Prong);
1922 hname = TString::Format(
"%s/fHistFirstPartonPt", GetName());
1924 hname = TString::Format(
"%s/fHistFirstPartonEta", GetName());
1926 hname = TString::Format(
"%s/fHistFirstPartonPhi", GetName());
1928 hname = TString::Format(
"%s/fHistFirstPartonType", GetName());
1931 for (
auto parton : fFirstPartons) {
1932 if (!parton.first)
continue;
1933 histFirstPartonPt->Fill(parton.first->Pt());
1934 histFirstPartonEta->Fill(parton.first->Eta());
1935 histFirstPartonPhi->Fill(TVector2::Phi_0_2pi(parton.first->Phi()));
1936 histFirstPartonType->Fill(parton.second);
1939 hname = TString::Format(
"%s/fHistLastPartonPt", GetName());
1941 hname = TString::Format(
"%s/fHistLastPartonEta", GetName());
1943 hname = TString::Format(
"%s/fHistLastPartonPhi", GetName());
1945 hname = TString::Format(
"%s/fHistLastPartonType", GetName());
1948 for (
auto parton : fLastPartons) {
1949 if (!parton.first)
continue;
1950 histLastPartonPt->Fill(parton.first->Pt());
1951 histLastPartonEta->Fill(parton.first->Eta());
1952 histLastPartonPhi->Fill(TVector2::Phi_0_2pi(parton.first->Phi()));
1953 histLastPartonType->Fill(parton.second);
1966 fFirstPartons.clear();
1967 fLastPartons.clear();
1968 for (
auto& dmeson_pair : fDmesonJets) {
1970 for (
UInt_t ij = 0; ij < fJetDefinitions.size(); ij++) {
1971 AliJetInfo* jet = dmeson_pair.second.GetJet(fJetDefinitions[ij].GetName());
1973 if (applyKinCuts && !fJetDefinitions[ij].IsJetInAcceptance(*jet)) {
1974 hname = TString::Format(
"%s/%s/fHistRejectedJetPt", GetName(), fJetDefinitions[ij].GetName());
1976 hname = TString::Format(
"%s/%s/fHistRejectedJetPhi", GetName(), fJetDefinitions[ij].GetName());
1978 hname = TString::Format(
"%s/%s/fHistRejectedJetEta", GetName(), fJetDefinitions[ij].GetName());
1985 fFirstPartons[dmeson_pair.second.fFirstParton] = dmeson_pair.second.fFirstPartonType;
1986 fLastPartons[dmeson_pair.second.fLastParton] = dmeson_pair.second.fLastPartonType;
1989 hname = TString::Format(
"%s/fHistRejectedDMesonPt", GetName());
1991 hname = TString::Format(
"%s/fHistRejectedDMesonPhi", GetName());
1993 hname = TString::Format(
"%s/fHistRejectedDMesonEta", GetName());
1997 hname = TString::Format(
"%s/fHistRejectedDMesonInvMass", GetName());
2001 hname = TString::Format(
"%s/fHistRejectedDMeson2ProngInvMass", GetName());
2004 hname = TString::Format(
"%s/fHistRejectedDMesonDeltaInvMass", GetName());
2005 fHistManager->
FillTH1(hname, dmeson_pair.second.fD.M() - dmeson_pair.second.fInvMass2Prong);
2011 hname = TString::Format(
"%s/fHistFirstPartonPt", GetName());
2013 hname = TString::Format(
"%s/fHistFirstPartonEta", GetName());
2015 hname = TString::Format(
"%s/fHistFirstPartonPhi", GetName());
2017 hname = TString::Format(
"%s/fHistFirstPartonType", GetName());
2020 for (
auto parton : fFirstPartons) {
2021 if (!parton.first)
continue;
2022 histFirstPartonPt->Fill(parton.first->Pt());
2023 histFirstPartonEta->Fill(parton.first->Eta());
2024 histFirstPartonPhi->Fill(TVector2::Phi_0_2pi(parton.first->Phi()));
2025 histFirstPartonType->Fill(parton.second);
2028 hname = TString::Format(
"%s/fHistLastPartonPt", GetName());
2030 hname = TString::Format(
"%s/fHistLastPartonEta", GetName());
2032 hname = TString::Format(
"%s/fHistLastPartonPhi", GetName());
2034 hname = TString::Format(
"%s/fHistLastPartonType", GetName());
2037 for (
auto parton : fLastPartons) {
2038 if (!parton.first)
continue;
2039 histLastPartonPt->Fill(parton.first->Pt());
2040 histLastPartonEta->Fill(parton.first->Eta());
2041 histLastPartonPhi->Fill(TVector2::Phi_0_2pi(parton.first->Phi()));
2042 histLastPartonType->Fill(parton.second);
2055 for (
auto& dmeson_pair : fDmesonJets) {
2056 if (!IsAnyJetInAcceptance(dmeson_pair.second)) {
2057 hname = TString::Format(
"%s/fHistRejectedDMesonPt", GetName());
2059 hname = TString::Format(
"%s/fHistRejectedDMesonPhi", GetName());
2061 hname = TString::Format(
"%s/fHistRejectedDMesonEta", GetName());
2066 for (
auto &jetDef : fJetDefinitions) {
2068 hname = TString::Format(
"%s/%s/fDmesonJets", GetName(), jetDef.GetName());
2071 for (
auto& dmeson_pair : fDmesonJets) {
2072 const AliJetInfo* jet = dmeson_pair.second.GetJet(jetDef.GetName());
2074 if (!jetDef.IsJetInAcceptance(*jet)) {
2075 hname = TString::Format(
"%s/%s/fHistRejectedJetPt", GetName(), jetDef.GetName());
2077 hname = TString::Format(
"%s/%s/fHistRejectedJetPhi", GetName(), jetDef.GetName());
2079 hname = TString::Format(
"%s/%s/fHistRejectedJetEta", GetName(), jetDef.GetName());
2083 FillHnSparse(h, dmeson_pair.second, jetDef.GetName());
2106 std::map<std::string, AliJetInfo>::const_iterator it = DmesonJet.
fJets.find(n);
2107 if (it == DmesonJet.
fJets.end())
return kFALSE;
2109 for (
Int_t i = 0; i < h->GetNdimensions(); i++) {
2111 if (
title==
"#it{p}_{T,D} (GeV/#it{c})") contents[i] = DmesonJet.
fD.Pt();
2112 else if (
title==
"#eta_{D}") contents[i] = DmesonJet.
fD.Eta();
2115 else if (
title==
"#it{M}_{K#pi#pi} (GeV/#it{c}^{2})") contents[i] = DmesonJet.
fD.M();
2116 else if (
title==
"#it{M}_{K#pi#pi} - #it{M}_{K#pi} (GeV/#it{c}^{2})") contents[i] = DmesonJet.
fD.M() - DmesonJet.
fInvMass2Prong;
2117 else if (
title==
"#it{p}_{T,#pi} (GeV/#it{c})") contents[i] = DmesonJet.
fSoftPionPt;
2118 else if (
title==
"#it{z}_{D}") contents[i] = z;
2119 else if (
title==
"#Delta R_{D-jet}") contents[i] = deltaR;
2120 else if (
title==
"#eta_{D} - #eta_{jet}") contents[i] = deltaEta;
2121 else if (
title==
"#phi_{D} - #phi_{jet} (rad)") contents[i] = deltaPhi;
2122 else if (
title==
"#it{p}_{T,jet} (GeV/#it{c})") contents[i] = (*it).second.Pt();
2123 else if (
title==
"#eta_{jet}") contents[i] = (*it).second.Eta();
2124 else if (
title==
"#phi_{jet} (rad)") contents[i] = (*it).second.Phi_0_2pi();
2125 else if (
title==
"No. of constituents") contents[i] = (*it).second.fNConstituents;
2126 else AliWarning(Form(
"Unable to fill dimension '%s'!",
title.Data()));
2163 fEnabledAxis(k2ProngInvMass),
2164 fOutputType(kTreeOutput),
2166 fApplyKinematicCuts(kTRUE),
2167 fNOutputTrees(nOutputTrees),
2168 fTrackEfficiency(0),
2174 for (
Int_t i = 0; i < nOutputTrees; i++){
2175 DefineOutput(2+i, TTree::Class());
2194 TFile* filecuts = TFile::Open(cutfname);
2195 if (!filecuts || filecuts->IsZombie()) {
2196 ::Warning(
"AddTaskDmesonJets",
"Input file not found: will use std cuts.");
2201 analysiscuts =
dynamic_cast<AliRDHFCuts*
>(filecuts->Get(cutsname));
2202 if (!analysiscuts) {
2203 ::Warning(
"AddTaskDmesonJetCorr",
"Could not find analysis cuts '%s' in '%s'. Using std cuts.", cutsname.Data(), cutfname.Data());
2207 return analysiscuts;
2236 if (!cutfname.IsNull()) {
2242 cutsname =
"D0toKpiCuts";
2245 cutsname =
"DStartoKpipiCuts";
2261 ::Info(
"AliAnalysisTaskDmesonJets::AddAnalysisEngine",
"A new analysis engine '%s' has been added. The total number of analysis engines is %lu.", eng.
GetName(),
fAnalysisEngines.size());
2265 ::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());
2269 if (found_eng->
fRDHFCuts != 0) ::Warning(
"AliAnalysisTaskDmesonJets::AddAnalysisEngine",
"D meson cuts were already defined for this D meson type. They will be overwritten.");
2287 ::Info(
"UserCreateOutputObjects",
"CreateOutputObjects of task %s", GetName());
2299 hname =
"fHistCharmPt";
2300 htitle = hname +
";#it{p}_{T,charm} (GeV/#it{c});counts";
2303 hname =
"fHistCharmEta";
2304 htitle = hname +
";#eta_{charm};counts";
2307 hname =
"fHistCharmPhi";
2308 htitle = hname +
";#phi_{charm};counts";
2311 hname =
"fHistCharmPt_Eta05";
2312 htitle = hname +
";#it{p}_{T,charm} (GeV/#it{c});counts";
2315 hname =
"fHistBottomPt";
2316 htitle = hname +
";#it{p}_{T,bottom} (GeV/#it{c});counts";
2319 hname =
"fHistBottomEta";
2320 htitle = hname +
";#eta_{bottom};counts";
2323 hname =
"fHistBottomPhi";
2324 htitle = hname +
";#phi_{bottom};counts";
2327 hname =
"fHistBottomPt_Eta05";
2328 htitle = hname +
";#it{p}_{T,bottom} (GeV/#it{c});counts";
2331 hname =
"fHistHighestPartonPt";
2332 htitle = hname +
";#it{p}_{T,bottom} (GeV/#it{c});counts";
2335 hname =
"fHistHighestPartonType";
2336 htitle = hname +
";type;counts";
2339 hname =
"fHistNHeavyQuarks";
2340 htitle = hname +
";number of heavy-quarks;counts";
2343 ::Info(
"AliAnalysisTaskDmesonJets::UserCreateOutputObjects",
"Allocating histograms for task '%s' (%lu analysis engines)", GetName(),
fAnalysisEngines.size());
2345 ::Info(
"AliAnalysisTaskDmesonJets::UserCreateOutputObjects",
"Allocating histograms for analysis engine '%s' (%lu jet definitions)", param.GetName(), param.fJetDefinitions.size());
2349 hname = TString::Format(
"%s/fHistNAcceptedDmesonsVsNtracks", param.GetName());
2350 htitle = hname +
";#it{N}_{tracks};#it{N}_{D};events";
2353 hname = TString::Format(
"%s/fHistNTotAcceptedDmesons", param.GetName());
2354 htitle = hname +
";;#it{N}_{D}";
2357 hname = TString::Format(
"%s/fHistNDmesons", param.GetName());
2358 htitle = hname +
";#it{N}_{D};events";
2361 hname = TString::Format(
"%s/fHistNEvents", param.GetName());
2362 htitle = hname +
";Event status;counts";
2364 h->GetXaxis()->SetBinLabel(1,
"Accepted");
2365 h->GetXaxis()->SetBinLabel(2,
"Rejected");
2367 hname = TString::Format(
"%s/fHistEventRejectionReasons", param.GetName());
2368 htitle = hname +
";Rejection reason;counts";
2371 hname = TString::Format(
"%s/fHistRejectedDMesonPt", param.GetName());
2372 htitle = hname +
";#it{p}_{T,D} (GeV/#it{c});counts";
2375 hname = TString::Format(
"%s/fHistRejectedDMesonEta", param.GetName());
2376 htitle = hname +
";#it{#eta}_{D};counts";
2379 hname = TString::Format(
"%s/fHistRejectedDMesonPhi", param.GetName());
2380 htitle = hname +
";#it{#phi}_{D};counts";
2385 hname = TString::Format(
"%s/fHistRejectedDMesonInvMass", param.GetName());
2386 htitle = hname +
";#it{M}_{K#pi} (GeV/#it{c}^{2});counts";
2393 hname = TString::Format(
"%s/fHistRejectedDMeson2ProngInvMass", param.GetName());
2394 htitle = hname +
";#it{M}_{K#pi} (GeV/#it{c}^{2});counts";
2398 Double_t D0mass = TDatabasePDG::Instance()->GetParticle(421)->Mass();
2399 hname = TString::Format(
"%s/fHistRejectedDMesonDeltaInvMass", param.GetName());
2400 htitle = hname +
";#it{M}_{K#pi#pi} - #it{M}_{K#pi} (GeV/#it{c}^{2});counts";
2407 hname = TString::Format(
"%s/fHistFirstPartonPt", param.GetName());
2408 htitle = hname +
";#it{p}_{T,parton} (GeV/#it{c});counts";
2411 hname = TString::Format(
"%s/fHistFirstPartonEta", param.GetName());
2412 htitle = hname +
";#eta_{parton};counts";
2415 hname = TString::Format(
"%s/fHistFirstPartonPhi", param.GetName());
2416 htitle = hname +
";#phi_{parton};counts";
2419 hname = TString::Format(
"%s/fHistFirstPartonType", param.GetName());
2420 htitle = hname +
";type;counts";
2423 hname = TString::Format(
"%s/fHistLastPartonPt", param.GetName());
2424 htitle = hname +
";#it{p}_{T,parton} (GeV/#it{c});counts";
2427 hname = TString::Format(
"%s/fHistLastPartonEta", param.GetName());
2428 htitle = hname +
";#eta_{parton};counts";
2431 hname = TString::Format(
"%s/fHistLastPartonPhi", param.GetName());
2432 htitle = hname +
";#phi_{parton};counts";
2435 hname = TString::Format(
"%s/fHistLastPartonType", param.GetName());
2436 htitle = hname +
";type;counts";
2440 for (
auto& jetDef : param.fJetDefinitions) {
2441 ::Info(
"AliAnalysisTaskDmesonJets::UserCreateOutputObjects",
"Allocating histograms for jet definition '%s'", jetDef.GetName());
2444 hname = TString::Format(
"%s/%s/fHistNDmesonsVsNconstituents", param.GetName(), jetDef.GetName());
2445 htitle = hname +
";#it{N}_{constituents};#it{N}_{D};counts";
2449 hname = TString::Format(
"%s/%s/fHistMCParticleRejectionReason", param.GetName(), jetDef.GetName());
2450 htitle = hname +
";Track rejection reason;#it{p}_{T,track} (GeV/#it{c});counts";
2454 hname = TString::Format(
"%s/%s/fHistTrackRejectionReason", param.GetName(), jetDef.GetName());
2455 htitle = hname +
";Track rejection reason;#it{p}_{T,track} (GeV/#it{c});counts";
2459 hname = TString::Format(
"%s/%s/fHistClusterRejectionReason", param.GetName(), jetDef.GetName());
2460 htitle = hname +
";Cluster rejection reason;#it{p}_{T,cluster} (GeV/#it{c});counts";
2464 hname = TString::Format(
"%s/%s/fHistDMesonDaughterNotInJet", param.GetName(), jetDef.GetName());
2465 htitle = hname +
";#it{p}_{T,track} (GeV/#it{c});counts";
2468 hname = TString::Format(
"%s/%s/fHistRejectedJetPt", param.GetName(), jetDef.GetName());
2469 htitle = hname +
";#it{p}_{T,jet} (GeV/#it{c});counts";
2472 hname = TString::Format(
"%s/%s/fHistRejectedJetEta", param.GetName(), jetDef.GetName());
2473 htitle = hname +
";#it{#eta}_{jet};counts";
2476 hname = TString::Format(
"%s/%s/fHistRejectedJetPhi", param.GetName(), jetDef.GetName());
2477 htitle = hname +
";#it{#phi}_{jet};counts";
2482 param.BuildTree(GetName());
2484 param.AssignDataSlot(treeSlot+2);
2489 AliError(Form(
"Number of data output slots %d not sufficient. Tree of analysis engine %s will not be posted!",
fNOutputTrees, param.GetName()));
2520 AliError(Form(
"This task need an AOD event (Task '%s'). Expect troubles...", GetName()));
2535 params.fRandomGen = rnd;
2540 params.fCandidateArray =
dynamic_cast<TClonesArray*
>(
fAodEvent->GetList()->FindObject(params.fBranchName.Data()));
2542 if (params.fCandidateArray) {
2545 className =
"AliAODRecoDecayHF2Prong";
2548 className =
"AliAODRecoCascadeHF";
2550 if (!params.fCandidateArray->GetClass()->InheritsFrom(className)) {
2551 ::Error(
"AliAnalysisTaskDmesonJets::ExecOnce",
2552 "%s: Objects of type %s in %s are not inherited from %s! Task will be disabled!",
2553 GetName(), params.fCandidateArray->GetClass()->GetName(), params.fCandidateArray->GetName(), className.Data());
2554 params.fCandidateArray = 0;
2555 params.fInhibit = kTRUE;
2559 ::Error(
"AliAnalysisTaskDmesonJets::ExecOnce",
2560 "Could not find candidate array '%s', skipping the event. Analysis engine '%s' will be disabled!",
2561 params.fBranchName.Data(), params.GetName());
2562 params.fInhibit = kTRUE;
2566 if (params.fMCMode !=
kNoMC) {
2568 ::Error(
"AliAnalysisTaskDmesonJets::ExecOnce",
2569 "No MC particle container was provided. Analysis engine '%s' will be disabled!",
2571 params.fInhibit = kTRUE;
2582 if (!params.fTrackContainer && !params.fClusterContainer) {
2583 ::Error(
"AliAnalysisTaskDmesonJets::ExecOnce",
2584 "No track container and no cluster container were provided. Analysis engine '%s' will be disabled!",
2586 params.fInhibit = kTRUE;
2604 if (eng.fInhibit)
continue;
2605 hname = TString::Format(
"%s/fHistEventRejectionReasons", eng.GetName());
2612 eng.fDmesonJets.clear();
2613 if (eng.fInhibit)
continue;
2616 hname = TString::Format(
"%s/fHistNEvents", eng.GetName());
2619 if (!iseventselected) {
2621 hname = TString::Format(
"%s/fHistEventRejectionReasons", eng.GetName());
2622 UInt_t bitmap = eng.fRDHFCuts->GetEventRejectionBitMap();
2626 if (label.IsNull())
break;
2636 AliDebug(2,
"Event selected");
2649 if (param.fInhibit)
continue;
2669 Int_t absPdgHighParton = 0;
2670 for (
auto part : itcont) {
2671 Int_t absPdgCode = TMath::Abs(part.second->GetPdgCode());
2674 if (absPdgCode > 9 && absPdgCode != 21)
continue;
2677 if (highestPartonPt < part.first.Pt()) {
2678 highestPartonPt = part.first.Pt();
2679 absPdgHighParton = absPdgCode;
2695 if (absPdgCode != 4 && absPdgCode != 5)
continue;
2696 Bool_t notLastInPartonShower = kFALSE;
2697 for (
Int_t idaugh = 0; idaugh < 2; idaugh++){
2698 Int_t daughterIndex = part.second->GetDaughter(idaugh);
2699 if (daughterIndex < 0) {
2700 AliDebug(10, Form(
"Could not find daughter of heavy quark (pdg=%d, pt=%.3f)!", absPdgCode, part.first.Pt()));
2705 AliDebug(10, Form(
"Could not find daughter %d of heavy quark (pdg=%d, pt=%.3f)!", daughterIndex, absPdgCode, part.first.Pt()));
2708 Int_t daughterAbsPdgCode = TMath::Abs(daughter->GetPdgCode());
2709 if (daughterAbsPdgCode <= 9 || daughterAbsPdgCode == 21) notLastInPartonShower = kTRUE;
2710 AliDebug(10, Form(
"Found daughter with PDG=%d, pt=%.3f", daughterAbsPdgCode, daughter->Pt()));
2712 if (notLastInPartonShower)
continue;
2714 if (absPdgCode == 4) {
2718 if (TMath::Abs(part.first.Eta()) < 0.5)
fHistManager.
FillTH1(
"fHistCharmPt_Eta05", part.first.Pt());
2720 else if (absPdgCode == 5) {
2724 if (TMath::Abs(part.first.Eta()) < 0.5)
fHistManager.
FillTH1(
"fHistBottomPt_Eta05", part.first.Pt());
2730 Int_t partonType = 0;
2731 if (absPdgHighParton == 9 || absPdgHighParton == 21) {
2735 partonType = absPdgHighParton;
2749 TParticlePDG* part = TDatabasePDG::Instance()->GetParticle(TMath::Abs(pdg));
2754 if (nbins % 2 == 0) {
2755 minMass = mass - range / 2 - range / nbins / 2;
2756 maxMass = mass + range / 2 - range / nbins / 2;
2759 minMass = mass - range / 2;
2760 maxMass = mass + range / 2;
2775 label =
"NotSelTrigger";
2777 return label.Data();
2782 return label.Data();
2785 label =
"TooFewVtxContrib";
2787 return label.Data();
2790 label =
"ZVtxOutFid";
2792 return label.Data();
2797 return label.Data();
2800 label =
"OutsideCentrality";
2802 return label.Data();
2805 label =
"PhysicsSelection";
2807 return label.Data();
2810 label =
"BadSPDVertex";
2812 return label.Data();
2815 label =
"ZVtxSPDOutFid";
2817 return label.Data();
2820 label =
"CentralityFlattening";
2822 return label.Data();
2825 label =
"BadTrackV0Correl";
2827 return label.Data();
2830 return label.Data();
2862 ::Error(
"AddTaskDmesonJets",
"No analysis manager to connect to.");
2867 AliVEventHandler* handler = mgr->GetInputEventHandler();
2869 ::Error(
"AddTaskEmcalJetSpectraQA",
"This task requires an input event handler");
2875 if (handler->InheritsFrom(
"AliESDInputHandler")) {
2878 else if (handler->InheritsFrom(
"AliAODInputHandler")) {
2883 if (ntracks ==
"usedefault") {
2884 if (dataType ==
kESD) {
2887 else if (dataType ==
kAOD) {
2895 if (nclusters ==
"usedefault") {
2896 if (dataType ==
kESD) {
2897 nclusters =
"CaloClusters";
2899 else if (dataType ==
kAOD) {
2900 nclusters =
"caloClusters";
2907 if (nMCpart ==
"usedefault") {
2908 nMCpart =
"mcparticles";
2911 TString name(
"AliAnalysisTaskDmesonJets");
2912 if (strcmp(suffix,
"") != 0) {
2913 name += TString::Format(
"_%s", suffix.Data());
2918 if (!ntracks.IsNull()) {
2923 if (!nMCpart.IsNull()) {
2925 partCont->SetEtaLimits(-1.5, 1.5);
2926 partCont->SetPtLimits(0, 1000);
2933 mgr->AddTask(jetTask);
2936 AliAnalysisDataContainer* cinput1 = mgr->GetCommonInputContainer();
2938 contname1 +=
"_histos";
2939 AliAnalysisDataContainer* coutput1 = mgr->CreateContainer(contname1.Data(),
2940 TList::Class(), AliAnalysisManager::kOutputContainer,
2941 Form(
"%s", AliAnalysisManager::GetCommonFileName()));
2943 mgr->ConnectInput(jetTask, 0, cinput1);
2944 mgr->ConnectOutput(jetTask, 1, coutput1);
2946 for (
Int_t i = 0; i < nMaxTrees; i++) {
2947 TString contname = TString::Format(
"%s_tree_%d", name.Data(), i);
2948 AliAnalysisDataContainer *coutput = mgr->CreateContainer(contname.Data(),
2949 TTree::Class(),AliAnalysisManager::kOutputContainer,
2950 Form(
"%s", AliAnalysisManager::GetCommonFileName()));
2951 mgr->ConnectOutput(jetTask, 2+i, coutput);
Int_t GetNConstituents() const
void SetRejectionReasonLabels(TAxis *axis)
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
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)
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, ...)
void SetRDHFCuts(AliRDHFCuts *cuts)
Double_t fMaxNeutralPt
Transverse momentum of the leading neutral particle (or cluster)
void RunDetectorLevelAnalysis()
Run a detector level analysis.
jet_distance_pair FindJetMacthedToGeneratedDMeson(const AliDmesonJetInfo &dmeson, AliHFJetDefinition &jetDef, Double_t dMax, Bool_t applyKinCuts)
void FillTH2(const char *hname, double x, double y, double weight=1., Option_t *opt="")
virtual void UserCreateOutputObjects()
Creates the output containers.
void FillPartonLevelHistograms()
Fill histograms with parton-level information.
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) ...
EMCMode_t fMCMode
MC mode: No MC (data and MC detector level), background-only (MC), signal-only (MC), MC truth (particle level)
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.
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
AliClusterContainer * AddClusterContainer(const char *n)
EJetType_t fJetType
Jet type (charged, full, neutral)
std::pair< AliJetInfo *, Double_t > jet_distance_pair
TH2 * CreateTH2(const char *name, const char *title, int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, Option_t *opt="")
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
THashList * GetListOfHistograms() const
AliAnalysisTaskDmesonJets()
This is the default constructor, used for ROOT I/O purposes.
virtual void Reset()
Reset the current object.
AnalysisEngine & operator=(const AnalysisEngine &source)
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="")
AliClusterContainer * GetClusterContainer(Int_t i=0) const
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="")
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)
std::vector< AliJetInfo > fJets
! Inclusive jets reconstructed in the current event (includes D meson candidate daughters, if any)
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
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
AliParticleContainer * GetParticleContainer(Int_t i=0) const
virtual ~AnalysisEngine()
void RunParticleLevelAnalysis()
Run a particle level analysis.
void FindJets(AliHFJetDefinition &jetDef)
Bool_t fApplyKinematicCuts
Apply jet kinematic cuts.
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
AnalysisEngine * AddAnalysisEngine(ECandidateType_t type, EMCMode_t bkgMode, EJetType_t jettype, Double_t jetradius, TString cutfname="")
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
THnSparse * CreateTHnSparse(const char *name, const char *title, int ndim, const int *nbins, const double *min, const double *max, Option_t *opt="")
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)