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"
67 dphi = TVector2::Phi_mpi_pi(
fMomentum.Phi() - jet.
Phi());;
69 return TMath::Sqrt(dphi*dphi + deta*deta);
80 return GetDistance(jet, deta, dphi);
97 fReconstructed(kFALSE),
110 fDmesonParticle(source.fDmesonParticle),
112 fSoftPionPt(source.fSoftPionPt),
113 fInvMass2Prong(source.fInvMass2Prong),
115 fMCLabel(source.fMCLabel),
116 fReconstructed(source.fReconstructed),
117 fFirstParton(source.fFirstParton),
118 fFirstPartonType(source.fFirstPartonType),
119 fLastParton(source.fLastParton),
120 fLastPartonType(source.fLastPartonType),
121 fSelectionType(source.fSelectionType)
137 fD.SetPtEtaPhiE(0,0,0,0);
142 fReconstructed = kFALSE;
144 fFirstPartonType = 0;
147 for (
auto &jet : fJets) {
148 jet.second.fMomentum.SetPtEtaPhiE(0,0,0,0);
149 jet.second.fNConstituents = 0;
151 jet.second.fMaxChargedPt = 0;
152 jet.second.fMaxNeutralPt = 0;
159 Printf(
"Printing D Meson Jet object.");
160 Printf(
"D Meson: pT = %.3f, eta = %.3f, phi = %.3f, inv. mass = %.3f", fD.Pt(), fD.Eta(), fD.Phi_0_2pi(), fD.M());
161 Printf(
"Soft pion pT: %.3f. 2-Prong Invariant mass = %.3f", fSoftPionPt, fInvMass2Prong);
162 for (
auto &jet : fJets) {
163 Printf(
"Jet %s: pT = %.3f, eta = %.3f, phi = %.3f", jet.first.c_str(), jet.second.Pt(), jet.second.Eta(), jet.second.Phi_0_2pi());
164 Printf(
"Jet N Consituents = %d", jet.second.fNConstituents);
173 std::map<std::string, AliJetInfo>::const_iterator it = fJets.find(n);
174 if (it == fJets.end())
return 0;
178 if ((*it).second.Pt() > 0) {
179 TVector3 dvect = fD.Vect();
180 TVector3 jvect = (*it).second.fMomentum.Vect();
185 ::Error(
"AliAnalysisTaskDmesonJets::AliDmesonJetInfo::GetZ",
"Zero jet momentum!");
189 z = (dvect * jvect) / jetMom;
192 if (z == 1 || (z > 1 && z - 1 < 1e-3)) z = 0.999;
206 std::map<std::string, AliJetInfo>::const_iterator it = fJets.find(n);
207 if (it == fJets.end())
return 0;
209 return GetDistance((*it).second, deta, dphi);
220 return GetDistance(n, deta, dphi);
231 dphi = TVector2::Phi_mpi_pi(fD.Phi() - jet.
Phi());;
232 deta = fD.Eta() - jet.
Eta();
233 return TMath::Sqrt(dphi*dphi + deta*deta);
244 return GetDistance(jet, deta, dphi);
253 std::map<std::string, AliJetInfo>::const_iterator it = fJets.find(n);
254 if (it == fJets.end()) {
255 ::Error(
"AliAnalysisTaskDmesonJets::AliDmesonJetInfo::GetJet",
"Could not find jet info for the jet definition '%s'!",
259 return &((*it).second);
268 std::map<std::string, AliJetInfo>::iterator it = fJets.find(n);
269 if (it == fJets.end()) {
270 ::Error(
"AliAnalysisTaskDmesonJets::AliDmesonJetInfo::GetJet",
"Could not find jet info for the jet definition '%s'!",
274 return &((*it).second);
315 std::map<std::string, AliJetInfo>::const_iterator it = source.
fJets.find(n);
316 if (it == source.
fJets.end())
return;
318 fPt = (*it).second.Pt();
319 fEta = (*it).second.Eta();
320 fPhi = (*it).second.Phi_0_2pi();
323 fN = (*it).second.GetNConstituents();
361 fPt = source.
fD.Pt();
362 fEta = source.
fD.Eta();
422 fFirstPartonType = 0,
439 fInvMass(source.fD.M()),
449 fInvMass = source.
fD.M();
473 f2ProngInvMass(source.fInvMass2Prong),
474 fDeltaInvMass(source.fD.M() - source.fInvMass2Prong)
553 fJetType(source.fJetType),
554 fRadius(source.fRadius),
555 fJetAlgo(source.fJetAlgo),
556 fRecoScheme(source.fRecoScheme),
557 fMinJetPt(source.fMinJetPt),
558 fMaxJetPt(source.fMaxJetPt),
559 fMinJetPhi(source.fMinJetPhi),
560 fMaxJetPhi(source.fMaxJetPhi),
561 fMinJetEta(source.fMinJetEta),
562 fMaxJetEta(source.fMaxJetEta),
563 fMinChargedPt(source.fMinChargedPt),
564 fMaxChargedPt(source.fMaxChargedPt),
565 fMinNeutralPt(source.fMinNeutralPt),
566 fMaxNeutralPt(source.fMaxNeutralPt)
595 if (fMinJetEta < fMaxJetEta && (jet.
Eta() < fMinJetEta || jet.
Eta() > fMaxJetEta))
return kFALSE;
596 if (fMinJetPhi < fMaxJetPhi && (jet.
Phi() < fMinJetPhi || jet.
Phi() > fMaxJetPhi))
return kFALSE;
597 if (jet.
Pt() > fMaxJetPt || jet.
Pt() < fMinJetPt)
return kFALSE;
611 if (!jet)
return kFALSE;
612 return IsJetInAcceptance((*jet));
684 fCurrentDmesonJetInfo(0),
689 fClusterContainers(),
707 fCandidateType(type),
714 fNMassBins(nMassBins),
728 fCurrentDmesonJetInfo(0),
733 fClusterContainers(),
746 fFirstPartons(source.fFirstPartons),
747 fLastPartons(source.fLastPartons),
748 fCandidateType(source.fCandidateType),
749 fCandidateName(source.fCandidateName),
750 fCandidatePDG(source.fCandidatePDG),
751 fNDaughters(source.fNDaughters),
752 fPDGdaughters(source.fPDGdaughters),
753 fBranchName(source.fBranchName),
754 fMCMode(source.fMCMode),
755 fNMassBins(source.fNMassBins),
756 fMinMass(source.fMinMass),
757 fMaxMass(source.fMaxMass),
759 fRejectedOrigin(source.fRejectedOrigin),
760 fAcceptedDecay(source.fAcceptedDecay),
761 fInhibit(source.fInhibit),
762 fJetDefinitions(source.fJetDefinitions),
763 fPtBinWidth(source.fPtBinWidth),
764 fMaxPt(source.fMaxPt),
765 fRandomGen(source.fRandomGen),
769 fCurrentDmesonJetInfo(0),
771 fCandidateArray(source.fCandidateArray),
773 fTrackContainers(source.fTrackContainers),
774 fClusterContainers(source.fClusterContainers),
802 for (
UInt_t i = 0; i < fJetDefinitions.size(); i++) {
803 if (fJetDefinitions[i].IsJetInAcceptance(dMesonJet, fJetDefinitions[i].GetName()))
return kTRUE;
819 switch (fCandidateType) {
822 fCandidateName =
"D0";
824 fPDGdaughters.Set(fNDaughters);
825 fPDGdaughters.Reset();
826 fPDGdaughters[0] = 211;
827 fPDGdaughters[1] = 321;
828 fBranchName =
"D0toKpi";
833 fCandidateName =
"2ProngLikeSign";
835 fPDGdaughters.Set(fNDaughters);
836 fPDGdaughters.Reset();
837 fPDGdaughters[0] = 211;
838 fPDGdaughters[1] = 321;
839 fBranchName =
"LikeSign2Prong";
843 fCandidateName =
"DStar";
845 fPDGdaughters.Set(fNDaughters);
846 fPDGdaughters.Reset();
847 fPDGdaughters[0] = 211;
848 fPDGdaughters[1] = 211;
849 fPDGdaughters[2] = 321;
850 fBranchName =
"Dstar";
854 ::Error(
"AliAnalysisTaskDmesonJets::AnalysisEngine::SetCandidateProperties",
"Candidate %d unknown!", fCandidateType);
865 if (fRDHFCuts)
delete fRDHFCuts;
875 if (fRDHFCuts)
delete fRDHFCuts;
876 fRDHFCuts =
static_cast<AliRDHFCuts*
>(cuts->Clone());
886 name = TString::Format(
"%s_%s", GetName(), jetDef.
GetName());
898 name = fCandidateName;
901 name +=
"_kBackgroundOnly";
904 name +=
"_kSignalOnly";
927 std::vector<AliHFJetDefinition>::iterator it = FindJetDefinition(def);
929 if (it == fJetDefinitions.end() || *it != def) {
930 fJetDefinitions.push_back(def);
931 ::Info(
"AliAnalysisTaskDmesonJets::AnalysisEngine::AddJetDefinition",
"Jet definition '%s' has been added to analysis engine '%s'."
932 "Total number of jet definitions is now %lu.",
933 def.
GetName(), GetName(), fJetDefinitions.size());
935 if (fMCMode !=
kMCTruth) fJetDefinitions[fJetDefinitions.size()-1].SetChargedPtRange(0., 100.);
938 ::Warning(
"AliAnalysisTaskDmesonJets::AnalysisEngine::AddJetDefinition",
"The same jet definition '%s' was already added in analysis engine '%s'.", def.
GetName(), GetName());
958 return AddJetDefinition(def);
968 std::vector<AliHFJetDefinition>::iterator it = fJetDefinitions.begin();
969 while (it != fJetDefinitions.end() && (*it) != def) it++;
1010 return ExtractD0Attributes(Dcand, DmesonJet, i);
1013 return ExtractDstarAttributes(static_cast<const AliAODRecoCascadeHF*>(Dcand), DmesonJet, i);
1029 AliDebug(10,
"Checking if D0 meson is selected");
1031 if (isSelected == 0)
return kFALSE;
1033 Int_t MCtruthPdgCode = 0;
1040 Int_t mcLab = Dcand->MatchToMC(fCandidatePDG,
fMCContainer->GetArray(), fNDaughters, fPDGdaughters.GetArray());
1045 AliAODMCParticle* aodMcPart =
static_cast<AliAODMCParticle*
>(
fMCContainer->GetArray()->At(mcLab));
1049 if (fRejectedOrigin) {
1050 auto origin = CheckOrigin(aodMcPart,
fMCContainer->GetArray());
1051 if ((origin.first & fRejectedOrigin) == origin.first)
return kFALSE;
1053 MCtruthPdgCode = aodMcPart->PdgCode();
1058 if (isSelected == 1) {
1059 if (i != 0)
return kFALSE;
1061 if (fMCMode ==
kNoMC ||
1062 (MCtruthPdgCode == fCandidatePDG && fMCMode ==
kSignalOnly) ||
1064 (MCtruthPdgCode == -fCandidatePDG && fMCMode ==
kWrongPID)) {
1066 AliDebug(10,
"Selected as D0");
1073 else if (isSelected == 2) {
1074 if (i != 1)
return kFALSE;
1076 if (fMCMode ==
kNoMC ||
1077 (MCtruthPdgCode == -fCandidatePDG && fMCMode ==
kSignalOnly) ||
1079 (MCtruthPdgCode == fCandidatePDG && fMCMode ==
kWrongPID)) {
1081 AliDebug(10,
"Selected as D0bar");
1088 else if (isSelected == 3) {
1089 AliDebug(10,
"Selected as either D0 or D0bar");
1092 if ((MCtruthPdgCode == fCandidatePDG && fMCMode ==
kSignalOnly) ||
1094 if (i != 0)
return kFALSE;
1095 AliDebug(10,
"MC truth is D0");
1098 else if ((MCtruthPdgCode == -fCandidatePDG && fMCMode ==
kSignalOnly) ||
1100 if (i != 1)
return kFALSE;
1101 AliDebug(10,
"MC truth is D0bar");
1110 AliDebug(10,
"Returning invariant mass with D0 hypothesis");
1114 AliDebug(10,
"Returning invariant mass with D0bar hypothesis");
1126 DmesonJet.
fD.SetPtEtaPhiM(Dcand->Pt(), Dcand->Eta(), Dcand->Phi(), invMassD);
1139 AliDebug(10,
"Checking if D* meson is selected");
1141 if (isSelected == 0)
return kFALSE;
1143 if ((i == 1 && DstarCand->Charge()>0) || (i == 0 && DstarCand->Charge()<0) || i > 1)
return kFALSE;
1145 Int_t MCtruthPdgCode = 0;
1150 Int_t pdgDgDStartoD0pi[2] = { 421, 211 };
1151 Int_t pdgDgD0toKpi[2] = { 321, 211 };
1154 AliDebug(10, Form(
"MC label is %d", mcLab));
1157 AliAODMCParticle* aodMcPart =
static_cast<AliAODMCParticle*
>(
fMCContainer->GetArray()->At(mcLab));
1160 if (fRejectedOrigin) {
1161 auto origin = CheckOrigin(aodMcPart,
fMCContainer->GetArray());
1162 if ((origin.first & fRejectedOrigin) == origin.first)
return kFALSE;
1165 MCtruthPdgCode = aodMcPart->PdgCode();
1166 AliDebug(10, Form(
"MC truth pdg code is %d",MCtruthPdgCode));
1171 Int_t absMCtruthPdgCode = TMath::Abs(MCtruthPdgCode);
1172 if (fMCMode ==
kNoMC ||
1173 (absMCtruthPdgCode == 413 && fMCMode ==
kSignalOnly) ||
1179 DmesonJet.
fD.SetPtEtaPhiM(DstarCand->Pt(), DstarCand->Eta(), DstarCand->Phi(), invMassD);
1200 Int_t absPdgPart = TMath::Abs(part->GetPdgCode());
1202 if (part->GetNDaughters() == 2) {
1204 AliAODMCParticle* d1 =
static_cast<AliAODMCParticle*
>(mcArray->At(part->GetDaughter(0)));
1205 AliAODMCParticle* d2 =
static_cast<AliAODMCParticle*
>(mcArray->At(part->GetDaughter(1)));
1211 Int_t absPdg1 = TMath::Abs(d1->GetPdgCode());
1212 Int_t absPdg2 = TMath::Abs(d2->GetPdgCode());
1214 if (absPdgPart == 421) {
1215 if ((absPdg1 == 211 && absPdg2 == 321) ||
1216 (absPdg1 == 321 && absPdg2 == 211)) {
1221 if (absPdgPart == 413) {
1222 if (absPdg1 == 421 && absPdg2 == 211) {
1223 Int_t D0decay = CheckDecayChannel(d1, mcArray);
1228 else if (absPdg1 == 211 && absPdg2 == 421) {
1229 Int_t D0decay = CheckDecayChannel(d2, mcArray);
1250 std::pair<AliAnalysisTaskDmesonJets::EMesonOrigin_t, AliAODMCParticle*> result(
kUnknownQuark, 0);
1252 if (!part)
return result;
1253 if (!mcArray)
return result;
1255 Int_t mother = part->GetMother();
1256 while (mother >= 0) {
1257 AliAODMCParticle* mcGranma =
static_cast<AliAODMCParticle*
>(mcArray->At(mother));
1259 Int_t abspdgGranma = TMath::Abs(mcGranma->GetPdgCode());
1261 if (abspdgGranma == 1) result = {
kFromDown, mcGranma};
1262 if (abspdgGranma == 2) result = {
kFromUp, mcGranma};
1263 if (abspdgGranma == 3) result = {
kFromStrange, mcGranma};
1264 if (abspdgGranma == 4) result = {
kFromCharm, mcGranma};
1265 if (abspdgGranma == 5) result = {
kFromBottom, mcGranma};
1266 if (abspdgGranma == 6) result = {
kFromTop, mcGranma};
1267 if (abspdgGranma == 9 || abspdgGranma == 21) result = {
kFromGluon, mcGranma};
1270 if (result.first !=
kUnknownQuark && !firstParton)
return result;
1272 mother = mcGranma->GetMother();
1275 ::Error(
"AliAnalysisTaskDmesonJets::AnalysisParams::CheckOrigin",
"Could not retrieve mother particle %d!", mother);
1286 for (
auto& jetDef : fJetDefinitions) {
1287 jetDef.fJets.clear();
1291 RunParticleLevelAnalysis();
1294 RunDetectorLevelAnalysis();
1306 const Int_t nD = fCandidateArray->GetEntriesFast();
1310 Int_t nAccCharm[3] = {0};
1311 for (
Int_t icharm = 0; icharm < nD; icharm++) {
1313 if (!charmCand)
continue;
1317 if (!fRDHFCuts->IsInFiducialAcceptance(charmCand->Pt(), charmCand->Y(fCandidatePDG)))
continue;
1318 Int_t nMassHypo = 0;
1319 for (
Int_t im = 0; im < 2; im++) {
1323 if (ExtractRecoDecayAttributes(charmCand, DmesonJet, im)) {
1324 for (
auto& def : fJetDefinitions) {
1325 if (!FindJet(charmCand, DmesonJet, def)) {
1326 AliWarning(Form(
"Could not find jet '%s' for D meson '%s': pT = %.3f, eta = %.3f, phi = %.3f",
1327 def.GetName(), GetName(), DmesonJet.
fD.Pt(), DmesonJet.
fD.Eta(), DmesonJet.
fD.
Phi_0_2pi()));
1330 fDmesonJets[(icharm+1)*(1-(im*2))] = DmesonJet;
1335 if (nMassHypo == 2) {
1340 if (nMassHypo == 2) {
1341 fDmesonJets[(icharm+1)].fSelectionType = 3;
1342 fDmesonJets[-(icharm+1)].fSelectionType = 3;
1348 hname = TString::Format(
"%s/fHistNTotAcceptedDmesons", GetName());
1353 hname = TString::Format(
"%s/fHistNAcceptedDmesonsVsNtracks", GetName());
1355 for (
auto track_cont : fTrackContainers) ntracks += track_cont->GetNAcceptedTracks();
1358 hname = TString::Format(
"%s/fHistNDmesons", GetName());
1383 for (
auto track_cont : fTrackContainers) {
1386 hname = TString::Format(
"%s/%s/fHistTrackRejectionReason", GetName(), jetDef.
GetName());
1390 hname = TString::Format(
"%s/%s/fHistDMesonDaughterNotInJet", GetName(), jetDef.
GetName());
1393 for (
Int_t i = 0; i < daughters.GetEntriesFast(); i++) {
1394 AliVParticle* daughter =
static_cast<AliVParticle*
>(daughters.At(i));
1395 if (!hftrack_cont->GetArray()->FindObject(daughter)) histDaughterNotInJet->Fill(daughter->Pt());
1402 for (
auto clus_cont : fClusterContainers) {
1403 hname = TString::Format(
"%s/%s/fHistClusterRejectionReason", GetName(), jetDef.
GetName());
1413 for (
UInt_t ijet = 0; ijet < jets_incl.size(); ++ijet) {
1416 Bool_t isDmesonJet = kFALSE;
1422 for (
UInt_t ic = 0; ic < constituents.size(); ++ic) {
1423 if (constituents[ic].user_index() == 0) {
1424 isDmesonJet = kTRUE;
1426 else if (constituents[ic].user_index() >= 100) {
1427 if (constituents[ic].pt() > maxChPt) maxChPt = constituents[ic].pt();
1429 else if (constituents[ic].user_index() <= -100) {
1430 totalNeutralPt += constituents[ic].pt();
1431 if (constituents[ic].pt() > maxNePt) maxChPt = constituents[ic].pt();
1436 DmesonJet.
fJets[jetDef.
GetName()].fMomentum.SetPxPyPzE(jets_incl[ijet].px(), jets_incl[ijet].py(), jets_incl[ijet].pz(), jets_incl[ijet].E());
1437 DmesonJet.
fJets[jetDef.
GetName()].fNConstituents = constituents.size();
1438 DmesonJet.
fJets[jetDef.
GetName()].fMaxChargedPt = maxChPt;
1439 DmesonJet.
fJets[jetDef.
GetName()].fMaxNeutralPt = maxNePt;
1440 DmesonJet.
fJets[jetDef.
GetName()].fNEF = totalNeutralPt / jets_incl[ijet].pt();
1454 auto itcont = cont->all_momentum();
1455 for (AliEmcalIterableMomentumContainer::iterator it = itcont.begin(); it != itcont.end(); it++) {
1456 UInt_t rejectionReason = 0;
1457 if (!cont->AcceptObject(it.current_index(), rejectionReason)) {
1458 if (rejectHist) rejectHist->Fill(AliEmcalContainer::GetRejectionReasonBitPosition(rejectionReason), it->first.Pt());
1461 if (fRandomGen && eff > 0 && eff < 1) {
1464 if (rejectHist) rejectHist->Fill(6, it->first.Pt());
1468 Int_t uid = offset >= 0 ? it.current_index() + offset: -it.current_index() - offset;
1484 Int_t nAccCharm[3] = {0};
1486 for (
auto &jetDef : fJetDefinitions) {
1487 hname = TString::Format(
"%s/%s/fHistNDmesonsVsNconstituents", GetName(), jetDef.GetName());
1490 switch (jetDef.fJetType) {
1507 hname = TString::Format(
"%s/%s/fHistMCParticleRejectionReason", GetName(), jetDef.GetName());
1514 for (
auto jet : jets_incl) {
1515 Int_t nDmesonsInJet = 0;
1517 for (
auto constituent : jet.constituents()) {
1518 Int_t iPart = constituent.user_index() - 100;
1521 ::Error(
"AliAnalysisTaskDmesonJets::AnalysisEngine::RunParticleLevelAnalysis",
"Could not find jet constituent %d!", iPart);
1524 if (TMath::Abs(part->PdgCode()) == fCandidatePDG) {
1526 std::map<int, AliDmesonJetInfo>::iterator dMesonJetIt = fDmesonJets.find(iPart);
1527 if (dMesonJetIt == fDmesonJets.end()) {
1528 std::pair<int, AliDmesonJetInfo> element;
1529 element.first = iPart;
1530 dMesonJetIt = fDmesonJets.insert(element).first;
1531 (*dMesonJetIt).second.fD.SetPxPyPzE(part->Px(), part->Py(), part->Pz(), part->E());
1532 (*dMesonJetIt).second.fDmesonParticle = part;
1533 (*dMesonJetIt).second.fSelectionType = part->PdgCode() > 0 ? 1 : 2;
1538 auto firstParton = CheckOrigin(part,
fMCContainer->GetArray(), kTRUE);
1540 rs = firstParton.first;
1541 while (rs >>= 1) { p++; }
1542 (*dMesonJetIt).second.fFirstPartonType = p;
1543 (*dMesonJetIt).second.fFirstParton = firstParton.second;
1545 auto lastParton = CheckOrigin(part,
fMCContainer->GetArray(), kFALSE);
1547 rs = lastParton.first;
1548 while (rs >>= 1) { p++; }
1549 (*dMesonJetIt).second.fLastPartonType = p;
1550 (*dMesonJetIt).second.fLastParton = lastParton.second;
1552 if (part->PdgCode() > 0) {
1560 (*dMesonJetIt).second.fJets[jetDef.GetName()].fMomentum.SetPxPyPzE(jet.px(), jet.py(), jet.pz(), jet.E());
1561 (*dMesonJetIt).second.fJets[jetDef.GetName()].fNConstituents = jet.constituents().size();
1564 if (nDmesonsInJet > 0) histNDmesonsVsNconstituents->Fill(jet.constituents().size(), nDmesonsInJet);
1568 if (fDmesonJets.size() != nAccCharm[0]+nAccCharm[1]) AliError(Form(
"I found %lu mesons (%d)?", fDmesonJets.size(), nAccCharm[0]+nAccCharm[1]));
1569 hname = TString::Format(
"%s/fHistNTotAcceptedDmesons", GetName());
1574 hname = TString::Format(
"%s/fHistNAcceptedDmesonsVsNtracks", GetName());
1577 hname = TString::Format(
"%s/fHistNDmesons", GetName());
1588 classname =
"AliAnalysisTaskDmesonJets::AliDmesonMCInfoSummary";
1592 switch (fCandidateType) {
1595 classname =
"AliAnalysisTaskDmesonJets::AliD0InfoSummary";
1599 classname =
"AliAnalysisTaskDmesonJets::AliDStarInfoSummary";
1604 TString treeName = TString::Format(
"%s_%s", taskName, GetName());
1605 fTree =
new TTree(treeName, treeName);
1606 fTree->Branch(
"DmesonJet", classname, &fCurrentDmesonJetInfo);
1608 for (
Int_t i = 0; i < fJetDefinitions.size(); i++) {
1610 fTree->Branch(fJetDefinitions[i].GetName(),
"AliAnalysisTaskDmesonJets::AliJetInfoSummary", &fCurrentJetInfo[i]);
1625 for (
auto &jetDef : fJetDefinitions) {
1627 AliDebug(2,Form(
"Now working on '%s'", jetDef.GetName()));
1637 title[dim] =
"#it{p}_{T,D} (GeV/#it{c})";
1644 title[dim] =
"#eta_{D}";
1650 title[dim] =
"#phi_{D} (rad)";
1653 max[dim] = TMath::TwoPi();
1658 title[dim] =
"#it{M}_{K#pi#pi} (GeV/#it{c}^{2})";
1659 nbins[dim] = fNMassBins;
1660 min[dim] = fMinMass;
1661 max[dim] = fMaxMass;
1666 title[dim] =
"#it{M}_{K#pi} (GeV/#it{c}^{2})";
1667 nbins[dim] = fNMassBins;
1668 min[dim] = fMinMass;
1669 max[dim] = fMaxMass;
1674 title[dim] =
"#it{M}_{K#pi} (GeV/#it{c}^{2})";
1675 nbins[dim] = fNMassBins;
1681 title[dim] =
"#it{M}_{K#pi#pi} - #it{M}_{K#pi} (GeV/#it{c}^{2})";
1682 nbins[dim] = fNMassBins*6;
1686 Double_t D0mass = TDatabasePDG::Instance()->GetParticle(421)->Mass();
1694 title[dim] =
"#it{p}_{T,#pi} (GeV/#it{c})";
1701 title[dim] =
"#it{z}_{D}";
1707 if ((enabledAxis &
kDeltaR) != 0) {
1708 title[dim] =
"#Delta R_{D-jet}";
1711 max[dim] = radius * 1.5;
1716 title[dim] =
"#eta_{D} - #eta_{jet}";
1718 min[dim] = -radius * 1.2;
1719 max[dim] = radius * 1.2;
1724 title[dim] =
"#phi_{D} - #phi_{jet} (rad)";
1726 min[dim] = -radius * 1.2;
1727 max[dim] = radius * 1.2;
1731 title[dim] =
"#it{p}_{T,jet} (GeV/#it{c})";
1738 title[dim] =
"#eta_{jet}";
1744 title[dim] =
"#phi_{jet} (rad)";
1747 max[dim] = TMath::TwoPi();
1752 title[dim] =
"No. of constituents";
1759 hname = TString::Format(
"%s/%s/fDmesonJets", GetName(), jetDef.GetName());
1761 for (
Int_t j = 0; j < dim; j++) {
1762 h->GetAxis(j)->SetTitle(title[j]);
1773 fFirstPartons.clear();
1774 fLastPartons.clear();
1775 for (
auto& dmeson_pair : fDmesonJets) {
1776 fCurrentDmesonJetInfo->Set(dmeson_pair.second);
1778 for (
UInt_t ij = 0; ij < fJetDefinitions.size(); ij++) {
1779 fCurrentJetInfo[ij]->Reset();
1780 AliJetInfo* jet = dmeson_pair.second.GetJet(fJetDefinitions[ij].GetName());
1782 if (applyKinCuts && !fJetDefinitions[ij].IsJetInAcceptance(*jet)) {
1783 hname = TString::Format(
"%s/%s/fHistRejectedJetPt", GetName(), fJetDefinitions[ij].GetName());
1785 hname = TString::Format(
"%s/%s/fHistRejectedJetPhi", GetName(), fJetDefinitions[ij].GetName());
1787 hname = TString::Format(
"%s/%s/fHistRejectedJetEta", GetName(), fJetDefinitions[ij].GetName());
1791 fCurrentJetInfo[ij]->Set(dmeson_pair.second, fJetDefinitions[ij].GetName());
1795 fFirstPartons[dmeson_pair.second.fFirstParton] = dmeson_pair.second.fFirstPartonType;
1796 fLastPartons[dmeson_pair.second.fLastParton] = dmeson_pair.second.fLastPartonType;
1801 hname = TString::Format(
"%s/fHistRejectedDMesonPt", GetName());
1803 hname = TString::Format(
"%s/fHistRejectedDMesonPhi", GetName());
1805 hname = TString::Format(
"%s/fHistRejectedDMesonEta", GetName());
1809 hname = TString::Format(
"%s/fHistRejectedDMesonInvMass", GetName());
1813 hname = TString::Format(
"%s/fHistRejectedDMeson2ProngInvMass", GetName());
1816 hname = TString::Format(
"%s/fHistRejectedDMesonDeltaInvMass", GetName());
1817 fHistManager->
FillTH1(hname, dmeson_pair.second.fD.M() - dmeson_pair.second.fInvMass2Prong);
1823 hname = TString::Format(
"%s/fHistFirstPartonPt", GetName());
1825 hname = TString::Format(
"%s/fHistFirstPartonEta", GetName());
1827 hname = TString::Format(
"%s/fHistFirstPartonPhi", GetName());
1829 hname = TString::Format(
"%s/fHistFirstPartonType", GetName());
1832 for (
auto parton : fFirstPartons) {
1833 if (!parton.first)
continue;
1834 histFirstPartonPt->Fill(parton.first->Pt());
1835 histFirstPartonEta->Fill(parton.first->Eta());
1836 histFirstPartonPhi->Fill(TVector2::Phi_0_2pi(parton.first->Phi()));
1837 histFirstPartonType->Fill(parton.second);
1840 hname = TString::Format(
"%s/fHistLastPartonPt", GetName());
1842 hname = TString::Format(
"%s/fHistLastPartonEta", GetName());
1844 hname = TString::Format(
"%s/fHistLastPartonPhi", GetName());
1846 hname = TString::Format(
"%s/fHistLastPartonType", GetName());
1849 for (
auto parton : fLastPartons) {
1850 if (!parton.first)
continue;
1851 histLastPartonPt->Fill(parton.first->Pt());
1852 histLastPartonEta->Fill(parton.first->Eta());
1853 histLastPartonPhi->Fill(TVector2::Phi_0_2pi(parton.first->Phi()));
1854 histLastPartonType->Fill(parton.second);
1867 fFirstPartons.clear();
1868 fLastPartons.clear();
1869 for (
auto& dmeson_pair : fDmesonJets) {
1871 for (
UInt_t ij = 0; ij < fJetDefinitions.size(); ij++) {
1872 AliJetInfo* jet = dmeson_pair.second.GetJet(fJetDefinitions[ij].GetName());
1874 if (applyKinCuts && !fJetDefinitions[ij].IsJetInAcceptance(*jet)) {
1875 hname = TString::Format(
"%s/%s/fHistRejectedJetPt", GetName(), fJetDefinitions[ij].GetName());
1877 hname = TString::Format(
"%s/%s/fHistRejectedJetPhi", GetName(), fJetDefinitions[ij].GetName());
1879 hname = TString::Format(
"%s/%s/fHistRejectedJetEta", GetName(), fJetDefinitions[ij].GetName());
1886 fFirstPartons[dmeson_pair.second.fFirstParton] = dmeson_pair.second.fFirstPartonType;
1887 fLastPartons[dmeson_pair.second.fLastParton] = dmeson_pair.second.fLastPartonType;
1890 hname = TString::Format(
"%s/fHistRejectedDMesonPt", GetName());
1892 hname = TString::Format(
"%s/fHistRejectedDMesonPhi", GetName());
1894 hname = TString::Format(
"%s/fHistRejectedDMesonEta", GetName());
1898 hname = TString::Format(
"%s/fHistRejectedDMesonInvMass", GetName());
1902 hname = TString::Format(
"%s/fHistRejectedDMeson2ProngInvMass", GetName());
1905 hname = TString::Format(
"%s/fHistRejectedDMesonDeltaInvMass", GetName());
1906 fHistManager->
FillTH1(hname, dmeson_pair.second.fD.M() - dmeson_pair.second.fInvMass2Prong);
1912 hname = TString::Format(
"%s/fHistFirstPartonPt", GetName());
1914 hname = TString::Format(
"%s/fHistFirstPartonEta", GetName());
1916 hname = TString::Format(
"%s/fHistFirstPartonPhi", GetName());
1918 hname = TString::Format(
"%s/fHistFirstPartonType", GetName());
1921 for (
auto parton : fFirstPartons) {
1922 if (!parton.first)
continue;
1923 histFirstPartonPt->Fill(parton.first->Pt());
1924 histFirstPartonEta->Fill(parton.first->Eta());
1925 histFirstPartonPhi->Fill(TVector2::Phi_0_2pi(parton.first->Phi()));
1926 histFirstPartonType->Fill(parton.second);
1929 hname = TString::Format(
"%s/fHistLastPartonPt", GetName());
1931 hname = TString::Format(
"%s/fHistLastPartonEta", GetName());
1933 hname = TString::Format(
"%s/fHistLastPartonPhi", GetName());
1935 hname = TString::Format(
"%s/fHistLastPartonType", GetName());
1938 for (
auto parton : fLastPartons) {
1939 if (!parton.first)
continue;
1940 histLastPartonPt->Fill(parton.first->Pt());
1941 histLastPartonEta->Fill(parton.first->Eta());
1942 histLastPartonPhi->Fill(TVector2::Phi_0_2pi(parton.first->Phi()));
1943 histLastPartonType->Fill(parton.second);
1956 for (
auto& dmeson_pair : fDmesonJets) {
1957 if (!IsAnyJetInAcceptance(dmeson_pair.second)) {
1958 hname = TString::Format(
"%s/fHistRejectedDMesonPt", GetName());
1960 hname = TString::Format(
"%s/fHistRejectedDMesonPhi", GetName());
1962 hname = TString::Format(
"%s/fHistRejectedDMesonEta", GetName());
1967 for (
auto &jetDef : fJetDefinitions) {
1969 hname = TString::Format(
"%s/%s/fDmesonJets", GetName(), jetDef.GetName());
1972 for (
auto& dmeson_pair : fDmesonJets) {
1973 const AliJetInfo* jet = dmeson_pair.second.GetJet(jetDef.GetName());
1975 if (!jetDef.IsJetInAcceptance(*jet)) {
1976 hname = TString::Format(
"%s/%s/fHistRejectedJetPt", GetName(), jetDef.GetName());
1978 hname = TString::Format(
"%s/%s/fHistRejectedJetPhi", GetName(), jetDef.GetName());
1980 hname = TString::Format(
"%s/%s/fHistRejectedJetEta", GetName(), jetDef.GetName());
1984 FillHnSparse(h, dmeson_pair.second, jetDef.GetName());
2007 std::map<std::string, AliJetInfo>::const_iterator it = DmesonJet.
fJets.find(n);
2008 if (it == DmesonJet.
fJets.end())
return kFALSE;
2010 for (
Int_t i = 0; i < h->GetNdimensions(); i++) {
2012 if (
title==
"#it{p}_{T,D} (GeV/#it{c})") contents[i] = DmesonJet.
fD.Pt();
2013 else if (
title==
"#eta_{D}") contents[i] = DmesonJet.
fD.Eta();
2016 else if (
title==
"#it{M}_{K#pi#pi} (GeV/#it{c}^{2})") contents[i] = DmesonJet.
fD.M();
2017 else if (
title==
"#it{M}_{K#pi#pi} - #it{M}_{K#pi} (GeV/#it{c}^{2})") contents[i] = DmesonJet.
fD.M() - DmesonJet.
fInvMass2Prong;
2018 else if (
title==
"#it{p}_{T,#pi} (GeV/#it{c})") contents[i] = DmesonJet.
fSoftPionPt;
2019 else if (
title==
"#it{z}_{D}") contents[i] = z;
2020 else if (
title==
"#Delta R_{D-jet}") contents[i] = deltaR;
2021 else if (
title==
"#eta_{D} - #eta_{jet}") contents[i] = deltaEta;
2022 else if (
title==
"#phi_{D} - #phi_{jet} (rad)") contents[i] = deltaPhi;
2023 else if (
title==
"#it{p}_{T,jet} (GeV/#it{c})") contents[i] = (*it).second.Pt();
2024 else if (
title==
"#eta_{jet}") contents[i] = (*it).second.Eta();
2025 else if (
title==
"#phi_{jet} (rad)") contents[i] = (*it).second.Phi_0_2pi();
2026 else if (
title==
"No. of constituents") contents[i] = (*it).second.fNConstituents;
2027 else AliWarning(Form(
"Unable to fill dimension '%s'!",
title.Data()));
2064 fEnabledAxis(k2ProngInvMass),
2065 fOutputType(kTreeOutput),
2067 fApplyKinematicCuts(kTRUE),
2068 fNOutputTrees(nOutputTrees),
2069 fTrackEfficiency(0),
2075 for (
Int_t i = 0; i < nOutputTrees; i++){
2076 DefineOutput(2+i, TTree::Class());
2095 TFile* filecuts = TFile::Open(cutfname);
2096 if (!filecuts || filecuts->IsZombie()) {
2097 ::Error(
"AliAnalysisTaskDmesonJets::LoadDMesonCutsFromFile",
"Input file not found: will use std cuts.");
2101 if (filecuts) analysiscuts =
dynamic_cast<AliRDHFCuts*
>(filecuts->Get(cutsname));
2103 if (!analysiscuts) {
2104 ::Error(
"AliAnalysisTaskDmesonJets::LoadDMesonCutsFromFile",
"Could not find analysis cuts '%s' in '%s'.", cutsname.Data(), cutfname.Data());
2110 ::Info(
"AliAnalysisTaskDmesonJets::LoadDMesonCutsFromFile",
"Cuts '%s' loaded from file '%s'", cutsname.Data(), cutfname.Data());
2113 return analysiscuts;
2142 if (!cutfname.IsNull()) {
2148 cutsname =
"D0toKpiCuts";
2151 cutsname =
"DStartoKpipiCuts";
2168 ::Info(
"AliAnalysisTaskDmesonJets::AddAnalysisEngine",
"A new analysis engine '%s' has been added. The total number of analysis engines is %lu.", eng.
GetName(),
fAnalysisEngines.size());
2172 ::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());
2176 if (found_eng->
fRDHFCuts != 0) ::Warning(
"AliAnalysisTaskDmesonJets::AddAnalysisEngine",
"D meson cuts were already defined for this D meson type. They will be overwritten.");
2194 ::Info(
"UserCreateOutputObjects",
"CreateOutputObjects of task %s", GetName());
2206 hname =
"fHistCharmPt";
2207 htitle = hname +
";#it{p}_{T,charm} (GeV/#it{c});counts";
2210 hname =
"fHistCharmEta";
2211 htitle = hname +
";#eta_{charm};counts";
2214 hname =
"fHistCharmPhi";
2215 htitle = hname +
";#phi_{charm};counts";
2218 hname =
"fHistCharmPt_Eta05";
2219 htitle = hname +
";#it{p}_{T,charm} (GeV/#it{c});counts";
2222 hname =
"fHistBottomPt";
2223 htitle = hname +
";#it{p}_{T,bottom} (GeV/#it{c});counts";
2226 hname =
"fHistBottomEta";
2227 htitle = hname +
";#eta_{bottom};counts";
2230 hname =
"fHistBottomPhi";
2231 htitle = hname +
";#phi_{bottom};counts";
2234 hname =
"fHistBottomPt_Eta05";
2235 htitle = hname +
";#it{p}_{T,bottom} (GeV/#it{c});counts";
2238 hname =
"fHistHighestPartonPt";
2239 htitle = hname +
";#it{p}_{T,bottom} (GeV/#it{c});counts";
2242 hname =
"fHistHighestPartonType";
2243 htitle = hname +
";type;counts";
2246 hname =
"fHistNHeavyQuarks";
2247 htitle = hname +
";number of heavy-quarks;counts";
2250 ::Info(
"AliAnalysisTaskDmesonJets::UserCreateOutputObjects",
"Allocating histograms for task '%s' (%lu analysis engines)", GetName(),
fAnalysisEngines.size());
2252 ::Info(
"AliAnalysisTaskDmesonJets::UserCreateOutputObjects",
"Allocating histograms for analysis engine '%s' (%lu jet definitions)", param.GetName(), param.fJetDefinitions.size());
2256 hname = TString::Format(
"%s/fHistNAcceptedDmesonsVsNtracks", param.GetName());
2257 htitle = hname +
";#it{N}_{tracks};#it{N}_{D};events";
2260 hname = TString::Format(
"%s/fHistNTotAcceptedDmesons", param.GetName());
2261 htitle = hname +
";;#it{N}_{D}";
2264 hname = TString::Format(
"%s/fHistNDmesons", param.GetName());
2265 htitle = hname +
";#it{N}_{D};events";
2268 hname = TString::Format(
"%s/fHistNEvents", param.GetName());
2269 htitle = hname +
";Event status;counts";
2271 h->GetXaxis()->SetBinLabel(1,
"Accepted");
2272 h->GetXaxis()->SetBinLabel(2,
"Rejected");
2274 hname = TString::Format(
"%s/fHistEventRejectionReasons", param.GetName());
2275 htitle = hname +
";Rejection reason;counts";
2278 hname = TString::Format(
"%s/fHistRejectedDMesonPt", param.GetName());
2279 htitle = hname +
";#it{p}_{T,D} (GeV/#it{c});counts";
2282 hname = TString::Format(
"%s/fHistRejectedDMesonEta", param.GetName());
2283 htitle = hname +
";#it{#eta}_{D};counts";
2286 hname = TString::Format(
"%s/fHistRejectedDMesonPhi", param.GetName());
2287 htitle = hname +
";#it{#phi}_{D};counts";
2292 hname = TString::Format(
"%s/fHistRejectedDMesonInvMass", param.GetName());
2293 htitle = hname +
";#it{M}_{K#pi} (GeV/#it{c}^{2});counts";
2300 hname = TString::Format(
"%s/fHistRejectedDMeson2ProngInvMass", param.GetName());
2301 htitle = hname +
";#it{M}_{K#pi} (GeV/#it{c}^{2});counts";
2305 Double_t D0mass = TDatabasePDG::Instance()->GetParticle(421)->Mass();
2306 hname = TString::Format(
"%s/fHistRejectedDMesonDeltaInvMass", param.GetName());
2307 htitle = hname +
";#it{M}_{K#pi#pi} - #it{M}_{K#pi} (GeV/#it{c}^{2});counts";
2314 hname = TString::Format(
"%s/fHistFirstPartonPt", param.GetName());
2315 htitle = hname +
";#it{p}_{T,parton} (GeV/#it{c});counts";
2318 hname = TString::Format(
"%s/fHistFirstPartonEta", param.GetName());
2319 htitle = hname +
";#eta_{parton};counts";
2322 hname = TString::Format(
"%s/fHistFirstPartonPhi", param.GetName());
2323 htitle = hname +
";#phi_{parton};counts";
2326 hname = TString::Format(
"%s/fHistFirstPartonType", param.GetName());
2327 htitle = hname +
";type;counts";
2330 hname = TString::Format(
"%s/fHistLastPartonPt", param.GetName());
2331 htitle = hname +
";#it{p}_{T,parton} (GeV/#it{c});counts";
2334 hname = TString::Format(
"%s/fHistLastPartonEta", param.GetName());
2335 htitle = hname +
";#eta_{parton};counts";
2338 hname = TString::Format(
"%s/fHistLastPartonPhi", param.GetName());
2339 htitle = hname +
";#phi_{parton};counts";
2342 hname = TString::Format(
"%s/fHistLastPartonType", param.GetName());
2343 htitle = hname +
";type;counts";
2347 for (
auto& jetDef : param.fJetDefinitions) {
2348 ::Info(
"AliAnalysisTaskDmesonJets::UserCreateOutputObjects",
"Allocating histograms for jet definition '%s'", jetDef.GetName());
2351 hname = TString::Format(
"%s/%s/fHistNDmesonsVsNconstituents", param.GetName(), jetDef.GetName());
2352 htitle = hname +
";#it{N}_{constituents};#it{N}_{D};counts";
2356 hname = TString::Format(
"%s/%s/fHistMCParticleRejectionReason", param.GetName(), jetDef.GetName());
2357 htitle = hname +
";Track rejection reason;#it{p}_{T,track} (GeV/#it{c});counts";
2361 hname = TString::Format(
"%s/%s/fHistTrackRejectionReason", param.GetName(), jetDef.GetName());
2362 htitle = hname +
";Track rejection reason;#it{p}_{T,track} (GeV/#it{c});counts";
2366 hname = TString::Format(
"%s/%s/fHistClusterRejectionReason", param.GetName(), jetDef.GetName());
2367 htitle = hname +
";Cluster rejection reason;#it{p}_{T,cluster} (GeV/#it{c});counts";
2371 hname = TString::Format(
"%s/%s/fHistDMesonDaughterNotInJet", param.GetName(), jetDef.GetName());
2372 htitle = hname +
";#it{p}_{T,track} (GeV/#it{c});counts";
2375 hname = TString::Format(
"%s/%s/fHistRejectedJetPt", param.GetName(), jetDef.GetName());
2376 htitle = hname +
";#it{p}_{T,jet} (GeV/#it{c});counts";
2379 hname = TString::Format(
"%s/%s/fHistRejectedJetEta", param.GetName(), jetDef.GetName());
2380 htitle = hname +
";#it{#eta}_{jet};counts";
2383 hname = TString::Format(
"%s/%s/fHistRejectedJetPhi", param.GetName(), jetDef.GetName());
2384 htitle = hname +
";#it{#phi}_{jet};counts";
2389 param.BuildTree(GetName());
2391 param.AssignDataSlot(treeSlot+2);
2396 AliError(Form(
"Number of data output slots %d not sufficient. Tree of analysis engine %s will not be posted!",
fNOutputTrees, param.GetName()));
2427 AliError(Form(
"This task need an AOD event (Task '%s'). Expect troubles...", GetName()));
2444 params.fRandomGen = rnd;
2446 if (!params.fRDHFCuts) {
2448 ::Warning(
"AliAnalysisTaskDmesonJets::ExecOnce",
2449 "%s: RDHF cuts not provided for engine '%s'.",
2450 GetName(), params.GetName());
2453 ::Error(
"AliAnalysisTaskDmesonJets::ExecOnce",
2454 "%s: RDHF cuts not provided. Engine '%s' disabled.",
2455 GetName(), params.GetName());
2456 params.fInhibit = kTRUE;
2462 for (
auto cont_it : fParticleCollArray) {
2464 if (track_cont) params.fTrackContainers.push_back(track_cont);
2467 for (
auto cont_it :
fClusterCollArray) params.fClusterContainers.push_back(cont_it.second);
2472 params.fCandidateArray =
dynamic_cast<TClonesArray*
>(
fAodEvent->GetList()->FindObject(params.fBranchName.Data()));
2474 if (params.fCandidateArray) {
2477 className =
"AliAODRecoDecayHF2Prong";
2480 className =
"AliAODRecoCascadeHF";
2482 if (!params.fCandidateArray->GetClass()->InheritsFrom(className)) {
2483 ::Error(
"AliAnalysisTaskDmesonJets::ExecOnce",
2484 "%s: Objects of type %s in %s are not inherited from %s! Task will be disabled!",
2485 GetName(), params.fCandidateArray->GetClass()->GetName(), params.fCandidateArray->GetName(), className.Data());
2486 params.fCandidateArray = 0;
2487 params.fInhibit = kTRUE;
2491 ::Error(
"AliAnalysisTaskDmesonJets::ExecOnce",
2492 "Could not find candidate array '%s', skipping the event. Analysis engine '%s' will be disabled!",
2493 params.fBranchName.Data(), params.GetName());
2494 params.fInhibit = kTRUE;
2498 if (params.fMCMode !=
kNoMC) {
2499 if (!params.fMCContainer) {
2500 ::Error(
"AliAnalysisTaskDmesonJets::ExecOnce",
2501 "No MC particle container was provided. Analysis engine '%s' will be disabled!",
2503 params.fInhibit = kTRUE;
2508 if (params.fTrackContainers.size() == 0 && params.fClusterContainers.size() == 0) {
2509 ::Error(
"AliAnalysisTaskDmesonJets::ExecOnce",
2510 "No track container and no cluster container were provided. Analysis engine '%s' will be disabled!",
2512 params.fInhibit = kTRUE;
2530 if (eng.fInhibit)
continue;
2531 hname = TString::Format(
"%s/fHistEventRejectionReasons", eng.GetName());
2539 if (matchingAODdeltaAODlevel <= 0) {
2542 if (eng.fInhibit)
continue;
2543 hname = TString::Format(
"%s/fHistEventRejectionReasons", eng.GetName());
2551 eng.fDmesonJets.clear();
2552 if (eng.fInhibit)
continue;
2555 hname = TString::Format(
"%s/fHistNEvents", eng.GetName());
2557 Bool_t iseventselected = kTRUE;
2558 if (eng.fRDHFCuts) iseventselected = eng.fRDHFCuts->IsEventSelected(
fAodEvent);
2559 if (!iseventselected) {
2561 hname = TString::Format(
"%s/fHistEventRejectionReasons", eng.GetName());
2562 UInt_t bitmap = eng.fRDHFCuts->GetEventRejectionBitMap();
2566 if (label.IsNull())
break;
2576 AliDebug(2,
"Event selected");
2589 if (param.fInhibit)
continue;
2609 Int_t absPdgHighParton = 0;
2610 for (
auto part : itcont) {
2611 Int_t absPdgCode = TMath::Abs(part.second->GetPdgCode());
2614 if (absPdgCode > 9 && absPdgCode != 21)
continue;
2617 if (highestPartonPt < part.first.Pt()) {
2618 highestPartonPt = part.first.Pt();
2619 absPdgHighParton = absPdgCode;
2635 if (absPdgCode != 4 && absPdgCode != 5)
continue;
2636 Bool_t notLastInPartonShower = kFALSE;
2637 for (
Int_t idaugh = 0; idaugh < 2; idaugh++){
2638 Int_t daughterIndex = part.second->GetDaughter(idaugh);
2639 if (daughterIndex < 0) {
2640 AliDebug(10, Form(
"Could not find daughter of heavy quark (pdg=%d, pt=%.3f)!", absPdgCode, part.first.Pt()));
2645 AliDebug(10, Form(
"Could not find daughter %d of heavy quark (pdg=%d, pt=%.3f)!", daughterIndex, absPdgCode, part.first.Pt()));
2648 Int_t daughterAbsPdgCode = TMath::Abs(daughter->GetPdgCode());
2649 if (daughterAbsPdgCode <= 9 || daughterAbsPdgCode == 21) notLastInPartonShower = kTRUE;
2650 AliDebug(10, Form(
"Found daughter with PDG=%d, pt=%.3f", daughterAbsPdgCode, daughter->Pt()));
2652 if (notLastInPartonShower)
continue;
2654 if (absPdgCode == 4) {
2658 if (TMath::Abs(part.first.Eta()) < 0.5)
fHistManager.
FillTH1(
"fHistCharmPt_Eta05", part.first.Pt());
2660 else if (absPdgCode == 5) {
2664 if (TMath::Abs(part.first.Eta()) < 0.5)
fHistManager.
FillTH1(
"fHistBottomPt_Eta05", part.first.Pt());
2670 Int_t partonType = 0;
2671 if (absPdgHighParton == 9 || absPdgHighParton == 21) {
2675 partonType = absPdgHighParton;
2689 TParticlePDG* part = TDatabasePDG::Instance()->GetParticle(TMath::Abs(pdg));
2694 if (nbins % 2 == 0) {
2695 minMass = mass - range / 2 - range / nbins / 2;
2696 maxMass = mass + range / 2 - range / nbins / 2;
2699 minMass = mass - range / 2;
2700 maxMass = mass + range / 2;
2715 label =
"NotSelTrigger";
2717 return label.Data();
2722 return label.Data();
2725 label =
"TooFewVtxContrib";
2727 return label.Data();
2730 label =
"ZVtxOutFid";
2732 return label.Data();
2737 return label.Data();
2740 label =
"OutsideCentrality";
2742 return label.Data();
2745 label =
"PhysicsSelection";
2747 return label.Data();
2750 label =
"BadSPDVertex";
2752 return label.Data();
2755 label =
"ZVtxSPDOutFid";
2757 return label.Data();
2760 label =
"CentralityFlattening";
2762 return label.Data();
2765 label =
"BadTrackV0Correl";
2767 return label.Data();
2770 return label.Data();
2802 ::Error(
"AddTaskDmesonJets",
"No analysis manager to connect to.");
2807 AliVEventHandler* handler = mgr->GetInputEventHandler();
2809 ::Error(
"AddTaskEmcalJetSpectraQA",
"This task requires an input event handler");
2815 if (handler->InheritsFrom(
"AliESDInputHandler")) {
2818 else if (handler->InheritsFrom(
"AliAODInputHandler")) {
2823 if (ntracks ==
"usedefault") {
2824 if (dataType ==
kESD) {
2827 else if (dataType ==
kAOD) {
2835 if (nclusters ==
"usedefault") {
2836 if (dataType ==
kESD) {
2837 nclusters =
"CaloClusters";
2839 else if (dataType ==
kAOD) {
2840 nclusters =
"caloClusters";
2847 if (nMCpart ==
"usedefault") {
2848 nMCpart =
"mcparticles";
2851 TString name(
"AliAnalysisTaskDmesonJets");
2852 if (strcmp(suffix,
"") != 0) {
2853 name += TString::Format(
"_%s", suffix.Data());
2858 if (!ntracks.IsNull()) {
2863 if (!nMCpart.IsNull()) {
2865 partCont->SetEtaLimits(-1.5, 1.5);
2866 partCont->SetPtLimits(0, 1000);
2873 mgr->AddTask(jetTask);
2876 AliAnalysisDataContainer* cinput1 = mgr->GetCommonInputContainer();
2878 contname1 +=
"_histos";
2879 AliAnalysisDataContainer* coutput1 = mgr->CreateContainer(contname1.Data(),
2880 TList::Class(), AliAnalysisManager::kOutputContainer,
2881 Form(
"%s", AliAnalysisManager::GetCommonFileName()));
2883 mgr->ConnectInput(jetTask, 0, cinput1);
2884 mgr->ConnectOutput(jetTask, 1, coutput1);
2886 for (
Int_t i = 0; i < nMaxTrees; i++) {
2887 TString contname = TString::Format(
"%s_tree_%d", name.Data(), i);
2888 AliAnalysisDataContainer *coutput = mgr->CreateContainer(contname.Data(),
2889 TTree::Class(),AliAnalysisManager::kOutputContainer,
2890 Form(
"%s", AliAnalysisManager::GetCommonFileName()));
2891 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)
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) ...
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.
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)
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.
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
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.
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)