17 #include <TClonesArray.h>
18 #include <TDatabasePDG.h>
19 #include <TParticlePDG.h>
21 #include <THnSparse.h>
22 #include <TParticle.h>
24 #include <THashList.h>
29 #include "AliEMCALGeometry.h"
30 #include "AliAnalysisManager.h"
31 #include "AliVEventHandler.h"
65 dphi = TVector2::Phi_mpi_pi(
fMomentum.Phi() - jet.
Phi());;
67 return TMath::Sqrt(dphi*dphi + deta*deta);
78 return GetDistance(jet, deta, dphi);
95 fReconstructed(kFALSE),
108 fDmesonParticle(source.fDmesonParticle),
110 fSoftPionPt(source.fSoftPionPt),
111 fInvMass2Prong(source.fInvMass2Prong),
113 fMCLabel(source.fMCLabel),
114 fReconstructed(source.fReconstructed),
115 fFirstParton(source.fFirstParton),
116 fFirstPartonType(source.fFirstPartonType),
117 fLastParton(source.fLastParton),
118 fLastPartonType(source.fLastPartonType),
119 fSelectionType(source.fSelectionType)
135 fD.SetPtEtaPhiE(0,0,0,0);
140 fReconstructed = kFALSE;
142 fFirstPartonType = 0;
145 for (
auto &jet : fJets) {
146 jet.second.fMomentum.SetPtEtaPhiE(0,0,0,0);
147 jet.second.fNConstituents = 0;
149 jet.second.fMaxChargedPt = 0;
150 jet.second.fMaxNeutralPt = 0;
157 Printf(
"Printing D Meson Jet object.");
158 Printf(
"D Meson: pT = %.3f, eta = %.3f, phi = %.3f, inv. mass = %.3f", fD.Pt(), fD.Eta(), fD.Phi_0_2pi(), fD.M());
159 Printf(
"Soft pion pT: %.3f. 2-Prong Invariant mass = %.3f", fSoftPionPt, fInvMass2Prong);
160 for (
auto &jet : fJets) {
161 Printf(
"Jet %s: pT = %.3f, eta = %.3f, phi = %.3f", jet.first.c_str(), jet.second.Pt(), jet.second.Eta(), jet.second.Phi_0_2pi());
162 Printf(
"Jet N Consituents = %d", jet.second.fNConstituents);
171 std::map<std::string, AliJetInfo>::const_iterator it = fJets.find(n);
172 if (it == fJets.end())
return 0;
176 if ((*it).second.Pt() > 0) {
177 TVector3 dvect = fD.Vect();
178 TVector3 jvect = (*it).second.fMomentum.Vect();
183 ::Error(
"AliAnalysisTaskDmesonJets::AliDmesonJetInfo::GetZ",
"Zero jet momentum!");
187 z = (dvect * jvect) / jetMom;
190 if (z == 1 || (z > 1 && z - 1 < 1e-3)) z = 0.999;
204 std::map<std::string, AliJetInfo>::const_iterator it = fJets.find(n);
205 if (it == fJets.end())
return 0;
207 return GetDistance((*it).second, deta, dphi);
218 return GetDistance(n, deta, dphi);
229 dphi = TVector2::Phi_mpi_pi(fD.Phi() - jet.
Phi());;
230 deta = fD.Eta() - jet.
Eta();
231 return TMath::Sqrt(dphi*dphi + deta*deta);
242 return GetDistance(jet, deta, dphi);
251 std::map<std::string, AliJetInfo>::const_iterator it = fJets.find(n);
252 if (it == fJets.end()) {
253 ::Error(
"AliAnalysisTaskDmesonJets::AliDmesonJetInfo::GetJet",
"Could not find jet info for the jet definition '%s'!",
257 return &((*it).second);
266 std::map<std::string, AliJetInfo>::iterator it = fJets.find(n);
267 if (it == fJets.end()) {
268 ::Error(
"AliAnalysisTaskDmesonJets::AliDmesonJetInfo::GetJet",
"Could not find jet info for the jet definition '%s'!",
272 return &((*it).second);
311 std::map<std::string, AliJetInfo>::const_iterator it = source.
fJets.find(n);
312 if (it == source.
fJets.end())
return;
314 fPt = (*it).second.Pt();
315 fEta = (*it).second.Eta();
316 fPhi = (*it).second.Phi_0_2pi();
355 fPt = source.
fD.Pt();
356 fEta = source.
fD.Eta();
416 fFirstPartonType = 0,
433 fInvMass(source.fD.M()),
443 fInvMass = source.
fD.M();
467 f2ProngInvMass(source.fInvMass2Prong),
468 fDeltaInvMass(source.fD.M() - source.fInvMass2Prong)
547 fJetType(source.fJetType),
548 fRadius(source.fRadius),
549 fJetAlgo(source.fJetAlgo),
550 fRecoScheme(source.fRecoScheme),
551 fMinJetPt(source.fMinJetPt),
552 fMaxJetPt(source.fMaxJetPt),
553 fMinJetPhi(source.fMinJetPhi),
554 fMaxJetPhi(source.fMaxJetPhi),
555 fMinJetEta(source.fMinJetEta),
556 fMaxJetEta(source.fMaxJetEta),
557 fMinChargedPt(source.fMinChargedPt),
558 fMaxChargedPt(source.fMaxChargedPt),
559 fMinNeutralPt(source.fMinNeutralPt),
560 fMaxNeutralPt(source.fMaxNeutralPt)
589 if (fMinJetEta < fMaxJetEta && (jet.
Eta() < fMinJetEta || jet.
Eta() > fMaxJetEta))
return kFALSE;
590 if (fMinJetPhi < fMaxJetPhi && (jet.
Phi() < fMinJetPhi || jet.
Phi() > fMaxJetPhi))
return kFALSE;
591 if (jet.
Pt() > fMaxJetPt || jet.
Pt() < fMinJetPt)
return kFALSE;
605 if (!jet)
return kFALSE;
606 return IsJetInAcceptance((*jet));
676 fCurrentDmesonJetInfo(0),
681 fClusterContainer(0),
699 fCandidateType(type),
706 fNMassBins(nMassBins),
718 fCurrentDmesonJetInfo(0),
723 fClusterContainer(0),
736 fFirstPartons(source.fFirstPartons),
737 fLastPartons(source.fLastPartons),
738 fCandidateType(source.fCandidateType),
739 fCandidateName(source.fCandidateName),
740 fCandidatePDG(source.fCandidatePDG),
741 fNDaughters(source.fNDaughters),
742 fPDGdaughters(source.fPDGdaughters),
743 fBranchName(source.fBranchName),
744 fMCMode(source.fMCMode),
745 fNMassBins(source.fNMassBins),
746 fMinMass(source.fMinMass),
747 fMaxMass(source.fMaxMass),
749 fRejectedOrigin(source.fRejectedOrigin),
750 fAcceptedDecay(source.fAcceptedDecay),
751 fInhibit(source.fInhibit),
752 fJetDefinitions(source.fJetDefinitions),
753 fPtBinWidth(source.fPtBinWidth),
754 fMaxPt(source.fMaxPt),
757 fCurrentDmesonJetInfo(0),
759 fCandidateArray(source.fCandidateArray),
761 fTrackContainer(source.fTrackContainer),
762 fClusterContainer(source.fClusterContainer),
790 for (
UInt_t i = 0; i < fJetDefinitions.size(); i++) {
791 if (fJetDefinitions[i].IsJetInAcceptance(dMesonJet, fJetDefinitions[i].GetName()))
return kTRUE;
807 switch (fCandidateType) {
810 fCandidateName =
"D0";
812 fPDGdaughters.Set(fNDaughters);
813 fPDGdaughters.Reset();
814 fPDGdaughters[0] = 211;
815 fPDGdaughters[1] = 321;
816 fBranchName =
"D0toKpi";
820 fRDHFCuts->SetStandardCutsPP2010();
821 fRDHFCuts->SetUsePhysicsSelection(kFALSE);
822 fRDHFCuts->SetTriggerClass(
"",
"");
827 fCandidateName =
"2ProngLikeSign";
829 fPDGdaughters.Set(fNDaughters);
830 fPDGdaughters.Reset();
831 fPDGdaughters[0] = 211;
832 fPDGdaughters[1] = 321;
833 fBranchName =
"LikeSign2Prong";
836 fRDHFCuts->SetStandardCutsPP2010();
837 fRDHFCuts->SetUsePhysicsSelection(kFALSE);
838 fRDHFCuts->SetTriggerClass(
"",
"");
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 fRDHFCuts->SetStandardCutsPP2010();
855 fRDHFCuts->SetUsePhysicsSelection(kFALSE);
856 fRDHFCuts->SetTriggerClass(
"",
"");
860 ::Error(
"AliAnalysisTaskDmesonJets::AnalysisEngine::SetCandidateProperties",
"Candidate %d unknown!", fCandidateType);
871 if (fRDHFCuts)
delete fRDHFCuts;
881 if (fRDHFCuts)
delete fRDHFCuts;
882 fRDHFCuts =
static_cast<AliRDHFCuts*
>(cuts->Clone());
892 name = TString::Format(
"%s_%s", GetName(), jetDef.
GetName());
904 name = fCandidateName;
907 name +=
"_kBackgroundOnly";
910 name +=
"_kSignalOnly";
930 std::vector<AliHFJetDefinition>::iterator it = FindJetDefinition(def);
932 if (it == fJetDefinitions.end() || *it != def) {
933 fJetDefinitions.push_back(def);
934 ::Info(
"AliAnalysisTaskDmesonJets::AnalysisEngine::AddJetDefinition",
"Jet definition '%s' has been added to analysis engine '%s'."
935 "Total number of jet definitions is now %lu.",
936 def.
GetName(), GetName(), fJetDefinitions.size());
938 if (fMCMode !=
kMCTruth) fJetDefinitions[fJetDefinitions.size()-1].SetChargedPtRange(0., 100.);
941 ::Warning(
"AliAnalysisTaskDmesonJets::AnalysisEngine::AddJetDefinition",
"The same jet definition '%s' was already added in analysis engine '%s'.", def.
GetName(), GetName());
961 return AddJetDefinition(def);
971 std::vector<AliHFJetDefinition>::iterator it = fJetDefinitions.begin();
972 while (it != fJetDefinitions.end() && (*it) != def) it++;
1013 return ExtractD0Attributes(Dcand, DmesonJet, i);
1016 return ExtractDstarAttributes(static_cast<const AliAODRecoCascadeHF*>(Dcand), DmesonJet, i);
1032 AliDebug(10,
"Checking if D0 meson is selected");
1034 if (isSelected == 0)
return kFALSE;
1036 Int_t MCtruthPdgCode = 0;
1043 Int_t mcLab = Dcand->MatchToMC(fCandidatePDG,
fMCContainer->GetArray(), fNDaughters, fPDGdaughters.GetArray());
1048 AliAODMCParticle* aodMcPart =
static_cast<AliAODMCParticle*
>(
fMCContainer->GetArray()->At(mcLab));
1052 if (fRejectedOrigin) {
1053 auto origin = CheckOrigin(aodMcPart,
fMCContainer->GetArray());
1054 if ((origin.first & fRejectedOrigin) == origin.first)
return kFALSE;
1056 MCtruthPdgCode = aodMcPart->PdgCode();
1061 if (isSelected == 1) {
1062 if (i != 0)
return kFALSE;
1064 if (fMCMode ==
kNoMC ||
1065 (MCtruthPdgCode == fCandidatePDG && fMCMode ==
kSignalOnly) ||
1068 AliDebug(10,
"Selected as D0");
1075 else if (isSelected == 2) {
1076 if (i != 1)
return kFALSE;
1078 if (fMCMode ==
kNoMC ||
1079 (MCtruthPdgCode == -fCandidatePDG && fMCMode ==
kSignalOnly) ||
1082 AliDebug(10,
"Selected as D0bar");
1089 else if (isSelected == 3) {
1090 AliDebug(10,
"Selected as either D0 or D0bar");
1093 if ((MCtruthPdgCode == fCandidatePDG && fMCMode ==
kSignalOnly) ||
1095 if (i != 0)
return kFALSE;
1096 AliDebug(10,
"MC truth is D0");
1099 else if ((MCtruthPdgCode == -fCandidatePDG && fMCMode ==
kSignalOnly) ||
1101 if (i != 1)
return kFALSE;
1102 AliDebug(10,
"MC truth is D0bar");
1111 AliDebug(10,
"Returning invariant mass with D0 hypothesis");
1115 AliDebug(10,
"Returning invariant mass with D0bar hypothesis");
1127 DmesonJet.
fD.SetPtEtaPhiM(Dcand->Pt(), Dcand->Eta(), Dcand->Phi(), invMassD);
1140 AliDebug(10,
"Checking if D* meson is selected");
1142 if (isSelected == 0)
return kFALSE;
1144 if ((i == 1 && DstarCand->Charge()>0) || (i == 0 && DstarCand->Charge()<0) || i > 1)
return kFALSE;
1146 Int_t MCtruthPdgCode = 0;
1151 Int_t pdgDgDStartoD0pi[2] = { 421, 211 };
1152 Int_t pdgDgD0toKpi[2] = { 321, 211 };
1155 AliDebug(10, Form(
"MC label is %d", mcLab));
1158 AliAODMCParticle* aodMcPart =
static_cast<AliAODMCParticle*
>(
fMCContainer->GetArray()->At(mcLab));
1161 if (fRejectedOrigin) {
1162 auto origin = CheckOrigin(aodMcPart,
fMCContainer->GetArray());
1163 if ((origin.first & fRejectedOrigin) == origin.first)
return kFALSE;
1166 MCtruthPdgCode = aodMcPart->PdgCode();
1167 AliDebug(10, Form(
"MC truth pdg code is %d",MCtruthPdgCode));
1172 Int_t absMCtruthPdgCode = TMath::Abs(MCtruthPdgCode);
1173 if (fMCMode ==
kNoMC ||
1174 (absMCtruthPdgCode == 413 && fMCMode ==
kSignalOnly) ||
1180 DmesonJet.
fD.SetPtEtaPhiM(DstarCand->Pt(), DstarCand->Eta(), DstarCand->Phi(), invMassD);
1201 Int_t absPdgPart = TMath::Abs(part->GetPdgCode());
1203 if (part->GetNDaughters() == 2) {
1205 AliAODMCParticle* d1 =
static_cast<AliAODMCParticle*
>(mcArray->At(part->GetDaughter(0)));
1206 AliAODMCParticle* d2 =
static_cast<AliAODMCParticle*
>(mcArray->At(part->GetDaughter(1)));
1212 Int_t absPdg1 = TMath::Abs(d1->GetPdgCode());
1213 Int_t absPdg2 = TMath::Abs(d2->GetPdgCode());
1215 if (absPdgPart == 421) {
1216 if ((absPdg1 == 211 && absPdg2 == 321) ||
1217 (absPdg1 == 321 && absPdg2 == 211)) {
1222 if (absPdgPart == 413) {
1223 if (absPdg1 == 421 && absPdg2 == 211) {
1224 Int_t D0decay = CheckDecayChannel(d1, mcArray);
1229 else if (absPdg1 == 211 && absPdg2 == 421) {
1230 Int_t D0decay = CheckDecayChannel(d2, mcArray);
1251 std::pair<AliAnalysisTaskDmesonJets::EMesonOrigin_t, AliAODMCParticle*> result(
kUnknownQuark, 0);
1253 if (!part)
return result;
1254 if (!mcArray)
return result;
1256 Int_t mother = part->GetMother();
1257 while (mother >= 0) {
1258 AliAODMCParticle* mcGranma =
static_cast<AliAODMCParticle*
>(mcArray->At(mother));
1260 Int_t abspdgGranma = TMath::Abs(mcGranma->GetPdgCode());
1262 if (abspdgGranma == 1) result = {
kFromDown, mcGranma};
1263 if (abspdgGranma == 2) result = {
kFromUp, mcGranma};
1264 if (abspdgGranma == 3) result = {
kFromStrange, mcGranma};
1265 if (abspdgGranma == 4) result = {
kFromCharm, mcGranma};
1266 if (abspdgGranma == 5) result = {
kFromBottom, mcGranma};
1267 if (abspdgGranma == 6) result = {
kFromTop, mcGranma};
1268 if (abspdgGranma == 9 || abspdgGranma == 21) result = {
kFromGluon, mcGranma};
1271 if (result.first !=
kUnknownQuark && !firstParton)
return result;
1273 mother = mcGranma->GetMother();
1276 ::Error(
"AliAnalysisTaskDmesonJets::AnalysisParams::CheckOrigin",
"Could not retrieve mother particle %d!", mother);
1287 for (
auto& jetDef : fJetDefinitions) {
1288 jetDef.fJets.clear();
1292 RunParticleLevelAnalysis();
1295 RunDetectorLevelAnalysis();
1311 fTrackContainer->SetDMesonCandidate(0);
1312 AddInputVectors(fTrackContainer, 100);
1316 AddInputVectors(fClusterContainer, -100);
1324 for (
UInt_t ijet = 0; ijet < jets_incl.size(); ++ijet) {
1331 for (
UInt_t ic = 0; ic < constituents.size(); ++ic) {
1332 if (constituents[ic].user_index() >= 100) {
1333 if (constituents[ic].pt() > maxChPt) maxChPt = constituents[ic].pt();
1335 else if (constituents[ic].user_index() <= -100) {
1336 totalNeutralPt += constituents[ic].pt();
1337 if (constituents[ic].pt() > maxNePt) maxChPt = constituents[ic].pt();
1341 jetDef.
fJets.push_back(
1342 AliJetInfo(jets_incl[ijet].px(), jets_incl[ijet].py(), jets_incl[ijet].pz(), jets_incl[ijet].E(),
1343 constituents.size(), totalNeutralPt / jets_incl[ijet].pt(), maxChPt, maxNePt)
1357 if (jetDef.
fJets.size() == 0) FindJets(jetDef);
1369 for (
auto& jet : jetDef.
fJets) {
1372 if (d > dMax)
continue;
1373 if (d < d_closest) {
1379 if (jet_closest && applyKinCuts) {
1384 AliDebug(2, Form(
"Found closest jet (pt=%.3f, eta=%.3f, phi=%.3f) to d meson (pt=%.3f, eta=%.3f, phi=%.3f) with d = %.3f",
1396 const Int_t nD = fCandidateArray->GetEntriesFast();
1400 Int_t nAccCharm[3] = {0};
1401 for (
Int_t icharm = 0; icharm < nD; icharm++) {
1403 if (!charmCand)
continue;
1406 if (!fRDHFCuts->IsInFiducialAcceptance(charmCand->Pt(), charmCand->Y(fCandidatePDG)))
continue;
1407 Int_t nMassHypo = 0;
1408 for (
Int_t im = 0; im < 2; im++) {
1412 if (ExtractRecoDecayAttributes(charmCand, DmesonJet, im)) {
1413 for (
auto& def : fJetDefinitions) {
1414 if (!FindJet(charmCand, DmesonJet, def)) {
1415 AliWarning(Form(
"Could not find jet '%s' for D meson '%s': pT = %.3f, eta = %.3f, phi = %.3f",
1416 def.GetName(), GetName(), DmesonJet.
fD.Pt(), DmesonJet.
fD.Eta(), DmesonJet.
fD.
Phi_0_2pi()));
1419 fDmesonJets[(icharm+1)*(1-(im*2))] = DmesonJet;
1424 if (nMassHypo == 2) {
1429 if (nMassHypo == 2) {
1430 fDmesonJets[(icharm+1)].fSelectionType = 3;
1431 fDmesonJets[-(icharm+1)].fSelectionType = 3;
1437 hname = TString::Format(
"%s/fHistNTotAcceptedDmesons", GetName());
1442 hname = TString::Format(
"%s/fHistNAcceptedDmesonsVsNtracks", GetName());
1443 fHistManager->
FillTH2(hname, fTrackContainer->GetNAcceptedTracks(), nAccCharm[0]+nAccCharm[1]+nAccCharm[2]);
1445 hname = TString::Format(
"%s/fHistNDmesons", GetName());
1470 fTrackContainer->SetDMesonCandidate(Dcand);
1471 hname = TString::Format(
"%s/%s/fHistTrackRejectionReason", GetName(), jetDef.
GetName());
1474 hname = TString::Format(
"%s/%s/fHistDMesonDaughterNotInJet", GetName(), jetDef.
GetName());
1476 const TObjArray& daughters = fTrackContainer->GetDaughterList();
1477 for (
Int_t i = 0; i < daughters.GetEntriesFast(); i++) {
1478 AliVParticle* daughter =
static_cast<AliVParticle*
>(daughters.At(i));
1479 if (!fTrackContainer->GetArray()->FindObject(daughter)) histDaughterNotInJet->Fill(daughter->Pt());
1484 hname = TString::Format(
"%s/%s/fHistClusterRejectionReason", GetName(), jetDef.
GetName());
1493 for (
UInt_t ijet = 0; ijet < jets_incl.size(); ++ijet) {
1496 Bool_t isDmesonJet = kFALSE;
1502 for (
UInt_t ic = 0; ic < constituents.size(); ++ic) {
1503 if (constituents[ic].user_index() == 0) {
1504 isDmesonJet = kTRUE;
1506 else if (constituents[ic].user_index() >= 100) {
1507 if (constituents[ic].pt() > maxChPt) maxChPt = constituents[ic].pt();
1509 else if (constituents[ic].user_index() <= -100) {
1510 totalNeutralPt += constituents[ic].pt();
1511 if (constituents[ic].pt() > maxNePt) maxChPt = constituents[ic].pt();
1516 DmesonJet.
fJets[jetDef.
GetName()].fMomentum.SetPxPyPzE(jets_incl[ijet].px(), jets_incl[ijet].py(), jets_incl[ijet].pz(), jets_incl[ijet].E());
1517 DmesonJet.
fJets[jetDef.
GetName()].fNConstituents = constituents.size();
1518 DmesonJet.
fJets[jetDef.
GetName()].fMaxChargedPt = maxChPt;
1519 DmesonJet.
fJets[jetDef.
GetName()].fMaxNeutralPt = maxNePt;
1520 DmesonJet.
fJets[jetDef.
GetName()].fNEF = totalNeutralPt / jets_incl[ijet].pt();
1534 auto itcont = cont->all_momentum();
1535 for (AliEmcalIterableMomentumContainer::iterator it = itcont.begin(); it != itcont.end(); it++) {
1536 UInt_t rejectionReason = 0;
1537 if (!cont->AcceptObject(it.current_index(), rejectionReason)) {
1538 if (rejectHist) rejectHist->Fill(AliEmcalContainer::GetRejectionReasonBitPosition(rejectionReason), it->first.Pt());
1541 Int_t uid = offset >= 0 ? it.current_index() + offset: -it.current_index() - offset;
1557 Int_t nAccCharm[3] = {0};
1559 for (
auto &jetDef : fJetDefinitions) {
1560 hname = TString::Format(
"%s/%s/fHistNDmesonsVsNconstituents", GetName(), jetDef.GetName());
1563 switch (jetDef.fJetType) {
1580 hname = TString::Format(
"%s/%s/fHistMCParticleRejectionReason", GetName(), jetDef.GetName());
1587 for (
auto jet : jets_incl) {
1588 Int_t nDmesonsInJet = 0;
1590 for (
auto constituent : jet.constituents()) {
1591 Int_t iPart = constituent.user_index() - 100;
1594 ::Error(
"AliAnalysisTaskDmesonJets::AnalysisEngine::RunParticleLevelAnalysis",
"Could not find jet constituent %d!", iPart);
1597 if (TMath::Abs(part->PdgCode()) == fCandidatePDG) {
1599 std::map<int, AliDmesonJetInfo>::iterator dMesonJetIt = fDmesonJets.find(iPart);
1600 if (dMesonJetIt == fDmesonJets.end()) {
1601 std::pair<int, AliDmesonJetInfo> element;
1602 element.first = iPart;
1603 dMesonJetIt = fDmesonJets.insert(element).first;
1604 (*dMesonJetIt).second.fD.SetPxPyPzE(part->Px(), part->Py(), part->Pz(), part->E());
1605 (*dMesonJetIt).second.fDmesonParticle = part;
1606 (*dMesonJetIt).second.fSelectionType = part->PdgCode() > 0 ? 1 : 2;
1611 auto firstParton = CheckOrigin(part,
fMCContainer->GetArray(), kTRUE);
1613 rs = firstParton.first;
1614 while (rs >>= 1) { p++; }
1615 (*dMesonJetIt).second.fFirstPartonType = p;
1616 (*dMesonJetIt).second.fFirstParton = firstParton.second;
1618 auto lastParton = CheckOrigin(part,
fMCContainer->GetArray(), kFALSE);
1620 rs = lastParton.first;
1621 while (rs >>= 1) { p++; }
1622 (*dMesonJetIt).second.fLastPartonType = p;
1623 (*dMesonJetIt).second.fLastParton = lastParton.second;
1625 if (part->PdgCode() > 0) {
1633 (*dMesonJetIt).second.fJets[jetDef.GetName()].fMomentum.SetPxPyPzE(jet.px(), jet.py(), jet.pz(), jet.E());
1634 (*dMesonJetIt).second.fJets[jetDef.GetName()].fNConstituents = jet.constituents().size();
1637 if (nDmesonsInJet > 0) histNDmesonsVsNconstituents->Fill(jet.constituents().size(), nDmesonsInJet);
1641 if (fDmesonJets.size() != nAccCharm[0]+nAccCharm[1]) AliError(Form(
"I found %lu mesons (%d)?", fDmesonJets.size(), nAccCharm[0]+nAccCharm[1]));
1642 hname = TString::Format(
"%s/fHistNTotAcceptedDmesons", GetName());
1647 hname = TString::Format(
"%s/fHistNAcceptedDmesonsVsNtracks", GetName());
1650 hname = TString::Format(
"%s/fHistNDmesons", GetName());
1661 classname =
"AliAnalysisTaskDmesonJets::AliDmesonMCInfoSummary";
1665 switch (fCandidateType) {
1668 classname =
"AliAnalysisTaskDmesonJets::AliD0InfoSummary";
1672 classname =
"AliAnalysisTaskDmesonJets::AliDStarInfoSummary";
1677 TString treeName = TString::Format(
"%s_%s", taskName, GetName());
1678 fTree =
new TTree(treeName, treeName);
1679 fTree->Branch(
"DmesonJet", classname, &fCurrentDmesonJetInfo);
1681 for (
Int_t i = 0; i < fJetDefinitions.size(); i++) {
1683 fTree->Branch(fJetDefinitions[i].GetName(),
"AliAnalysisTaskDmesonJets::AliJetInfoSummary", &fCurrentJetInfo[i]);
1698 for (
auto &jetDef : fJetDefinitions) {
1700 AliDebug(2,Form(
"Now working on '%s'", jetDef.GetName()));
1710 title[dim] =
"#it{p}_{T,D} (GeV/#it{c})";
1717 title[dim] =
"#eta_{D}";
1723 title[dim] =
"#phi_{D} (rad)";
1726 max[dim] = TMath::TwoPi();
1731 title[dim] =
"#it{M}_{K#pi#pi} (GeV/#it{c}^{2})";
1732 nbins[dim] = fNMassBins;
1733 min[dim] = fMinMass;
1734 max[dim] = fMaxMass;
1739 title[dim] =
"#it{M}_{K#pi} (GeV/#it{c}^{2})";
1740 nbins[dim] = fNMassBins;
1741 min[dim] = fMinMass;
1742 max[dim] = fMaxMass;
1747 title[dim] =
"#it{M}_{K#pi} (GeV/#it{c}^{2})";
1748 nbins[dim] = fNMassBins;
1754 title[dim] =
"#it{M}_{K#pi#pi} - #it{M}_{K#pi} (GeV/#it{c}^{2})";
1755 nbins[dim] = fNMassBins*6;
1759 Double_t D0mass = TDatabasePDG::Instance()->GetParticle(421)->Mass();
1767 title[dim] =
"#it{p}_{T,#pi} (GeV/#it{c})";
1774 title[dim] =
"#it{z}_{D}";
1780 if ((enabledAxis &
kDeltaR) != 0) {
1781 title[dim] =
"#Delta R_{D-jet}";
1784 max[dim] = radius * 1.5;
1789 title[dim] =
"#eta_{D} - #eta_{jet}";
1791 min[dim] = -radius * 1.2;
1792 max[dim] = radius * 1.2;
1797 title[dim] =
"#phi_{D} - #phi_{jet} (rad)";
1799 min[dim] = -radius * 1.2;
1800 max[dim] = radius * 1.2;
1804 title[dim] =
"#it{p}_{T,jet} (GeV/#it{c})";
1811 title[dim] =
"#eta_{jet}";
1817 title[dim] =
"#phi_{jet} (rad)";
1820 max[dim] = TMath::TwoPi();
1825 title[dim] =
"No. of constituents";
1832 hname = TString::Format(
"%s/%s/fDmesonJets", GetName(), jetDef.GetName());
1834 for (
Int_t j = 0; j < dim; j++) {
1835 h->GetAxis(j)->SetTitle(title[j]);
1846 fFirstPartons.clear();
1847 fLastPartons.clear();
1848 for (
auto& dmeson_pair : fDmesonJets) {
1849 fCurrentDmesonJetInfo->Set(dmeson_pair.second);
1851 for (
UInt_t ij = 0; ij < fJetDefinitions.size(); ij++) {
1852 fCurrentJetInfo[ij]->Reset();
1853 AliJetInfo* jet = dmeson_pair.second.GetJet(fJetDefinitions[ij].GetName());
1855 if (applyKinCuts && !fJetDefinitions[ij].IsJetInAcceptance(*jet)) {
1856 hname = TString::Format(
"%s/%s/fHistRejectedJetPt", GetName(), fJetDefinitions[ij].GetName());
1858 hname = TString::Format(
"%s/%s/fHistRejectedJetPhi", GetName(), fJetDefinitions[ij].GetName());
1860 hname = TString::Format(
"%s/%s/fHistRejectedJetEta", GetName(), fJetDefinitions[ij].GetName());
1864 fCurrentJetInfo[ij]->Set(dmeson_pair.second, fJetDefinitions[ij].GetName());
1868 fFirstPartons[dmeson_pair.second.fFirstParton] = dmeson_pair.second.fFirstPartonType;
1869 fLastPartons[dmeson_pair.second.fLastParton] = dmeson_pair.second.fLastPartonType;
1874 hname = TString::Format(
"%s/fHistRejectedDMesonPt", GetName());
1876 hname = TString::Format(
"%s/fHistRejectedDMesonPhi", GetName());
1878 hname = TString::Format(
"%s/fHistRejectedDMesonEta", GetName());
1882 hname = TString::Format(
"%s/fHistRejectedDMesonInvMass", GetName());
1886 hname = TString::Format(
"%s/fHistRejectedDMeson2ProngInvMass", GetName());
1889 hname = TString::Format(
"%s/fHistRejectedDMesonDeltaInvMass", GetName());
1890 fHistManager->
FillTH1(hname, dmeson_pair.second.fD.M() - dmeson_pair.second.fInvMass2Prong);
1896 hname = TString::Format(
"%s/fHistFirstPartonPt", GetName());
1898 hname = TString::Format(
"%s/fHistFirstPartonEta", GetName());
1900 hname = TString::Format(
"%s/fHistFirstPartonPhi", GetName());
1902 hname = TString::Format(
"%s/fHistFirstPartonType", GetName());
1905 for (
auto parton : fFirstPartons) {
1906 if (!parton.first)
continue;
1907 histFirstPartonPt->Fill(parton.first->Pt());
1908 histFirstPartonEta->Fill(parton.first->Eta());
1909 histFirstPartonPhi->Fill(TVector2::Phi_0_2pi(parton.first->Phi()));
1910 histFirstPartonType->Fill(parton.second);
1913 hname = TString::Format(
"%s/fHistLastPartonPt", GetName());
1915 hname = TString::Format(
"%s/fHistLastPartonEta", GetName());
1917 hname = TString::Format(
"%s/fHistLastPartonPhi", GetName());
1919 hname = TString::Format(
"%s/fHistLastPartonType", GetName());
1922 for (
auto parton : fLastPartons) {
1923 if (!parton.first)
continue;
1924 histLastPartonPt->Fill(parton.first->Pt());
1925 histLastPartonEta->Fill(parton.first->Eta());
1926 histLastPartonPhi->Fill(TVector2::Phi_0_2pi(parton.first->Phi()));
1927 histLastPartonType->Fill(parton.second);
1940 fFirstPartons.clear();
1941 fLastPartons.clear();
1942 for (
auto& dmeson_pair : fDmesonJets) {
1944 for (
UInt_t ij = 0; ij < fJetDefinitions.size(); ij++) {
1945 AliJetInfo* jet = dmeson_pair.second.GetJet(fJetDefinitions[ij].GetName());
1947 if (applyKinCuts && !fJetDefinitions[ij].IsJetInAcceptance(*jet)) {
1948 hname = TString::Format(
"%s/%s/fHistRejectedJetPt", GetName(), fJetDefinitions[ij].GetName());
1950 hname = TString::Format(
"%s/%s/fHistRejectedJetPhi", GetName(), fJetDefinitions[ij].GetName());
1952 hname = TString::Format(
"%s/%s/fHistRejectedJetEta", GetName(), fJetDefinitions[ij].GetName());
1959 fFirstPartons[dmeson_pair.second.fFirstParton] = dmeson_pair.second.fFirstPartonType;
1960 fLastPartons[dmeson_pair.second.fLastParton] = dmeson_pair.second.fLastPartonType;
1963 hname = TString::Format(
"%s/fHistRejectedDMesonPt", GetName());
1965 hname = TString::Format(
"%s/fHistRejectedDMesonPhi", GetName());
1967 hname = TString::Format(
"%s/fHistRejectedDMesonEta", GetName());
1971 hname = TString::Format(
"%s/fHistRejectedDMesonInvMass", GetName());
1975 hname = TString::Format(
"%s/fHistRejectedDMeson2ProngInvMass", GetName());
1978 hname = TString::Format(
"%s/fHistRejectedDMesonDeltaInvMass", GetName());
1979 fHistManager->
FillTH1(hname, dmeson_pair.second.fD.M() - dmeson_pair.second.fInvMass2Prong);
1985 hname = TString::Format(
"%s/fHistFirstPartonPt", GetName());
1987 hname = TString::Format(
"%s/fHistFirstPartonEta", GetName());
1989 hname = TString::Format(
"%s/fHistFirstPartonPhi", GetName());
1991 hname = TString::Format(
"%s/fHistFirstPartonType", GetName());
1994 for (
auto parton : fFirstPartons) {
1995 if (!parton.first)
continue;
1996 histFirstPartonPt->Fill(parton.first->Pt());
1997 histFirstPartonEta->Fill(parton.first->Eta());
1998 histFirstPartonPhi->Fill(TVector2::Phi_0_2pi(parton.first->Phi()));
1999 histFirstPartonType->Fill(parton.second);
2002 hname = TString::Format(
"%s/fHistLastPartonPt", GetName());
2004 hname = TString::Format(
"%s/fHistLastPartonEta", GetName());
2006 hname = TString::Format(
"%s/fHistLastPartonPhi", GetName());
2008 hname = TString::Format(
"%s/fHistLastPartonType", GetName());
2011 for (
auto parton : fLastPartons) {
2012 if (!parton.first)
continue;
2013 histLastPartonPt->Fill(parton.first->Pt());
2014 histLastPartonEta->Fill(parton.first->Eta());
2015 histLastPartonPhi->Fill(TVector2::Phi_0_2pi(parton.first->Phi()));
2016 histLastPartonType->Fill(parton.second);
2029 for (
auto& dmeson_pair : fDmesonJets) {
2030 if (!IsAnyJetInAcceptance(dmeson_pair.second)) {
2031 hname = TString::Format(
"%s/fHistRejectedDMesonPt", GetName());
2033 hname = TString::Format(
"%s/fHistRejectedDMesonPhi", GetName());
2035 hname = TString::Format(
"%s/fHistRejectedDMesonEta", GetName());
2040 for (
auto &jetDef : fJetDefinitions) {
2042 hname = TString::Format(
"%s/%s/fDmesonJets", GetName(), jetDef.GetName());
2045 for (
auto& dmeson_pair : fDmesonJets) {
2046 const AliJetInfo* jet = dmeson_pair.second.GetJet(jetDef.GetName());
2048 if (!jetDef.IsJetInAcceptance(*jet)) {
2049 hname = TString::Format(
"%s/%s/fHistRejectedJetPt", GetName(), jetDef.GetName());
2051 hname = TString::Format(
"%s/%s/fHistRejectedJetPhi", GetName(), jetDef.GetName());
2053 hname = TString::Format(
"%s/%s/fHistRejectedJetEta", GetName(), jetDef.GetName());
2057 FillHnSparse(h, dmeson_pair.second, jetDef.GetName());
2080 std::map<std::string, AliJetInfo>::const_iterator it = DmesonJet.
fJets.find(n);
2081 if (it == DmesonJet.
fJets.end())
return kFALSE;
2083 for (
Int_t i = 0; i < h->GetNdimensions(); i++) {
2085 if (
title==
"#it{p}_{T,D} (GeV/#it{c})") contents[i] = DmesonJet.
fD.Pt();
2086 else if (
title==
"#eta_{D}") contents[i] = DmesonJet.
fD.Eta();
2089 else if (
title==
"#it{M}_{K#pi#pi} (GeV/#it{c}^{2})") contents[i] = DmesonJet.
fD.M();
2090 else if (
title==
"#it{M}_{K#pi#pi} - #it{M}_{K#pi} (GeV/#it{c}^{2})") contents[i] = DmesonJet.
fD.M() - DmesonJet.
fInvMass2Prong;
2091 else if (
title==
"#it{p}_{T,#pi} (GeV/#it{c})") contents[i] = DmesonJet.
fSoftPionPt;
2092 else if (
title==
"#it{z}_{D}") contents[i] = z;
2093 else if (
title==
"#Delta R_{D-jet}") contents[i] = deltaR;
2094 else if (
title==
"#eta_{D} - #eta_{jet}") contents[i] = deltaEta;
2095 else if (
title==
"#phi_{D} - #phi_{jet} (rad)") contents[i] = deltaPhi;
2096 else if (
title==
"#it{p}_{T,jet} (GeV/#it{c})") contents[i] = (*it).second.Pt();
2097 else if (
title==
"#eta_{jet}") contents[i] = (*it).second.Eta();
2098 else if (
title==
"#phi_{jet} (rad)") contents[i] = (*it).second.Phi_0_2pi();
2099 else if (
title==
"No. of constituents") contents[i] = (*it).second.fNConstituents;
2100 else AliWarning(Form(
"Unable to fill dimension '%s'!",
title.Data()));
2136 fEnabledAxis(k2ProngInvMass),
2137 fOutputType(kTreeOutput),
2139 fApplyKinematicCuts(kTRUE),
2140 fNOutputTrees(nOutputTrees),
2146 for (
Int_t i = 0; i < nOutputTrees; i++){
2147 DefineOutput(2+i, TTree::Class());
2166 TFile* filecuts = TFile::Open(cutfname);
2167 if (!filecuts || filecuts->IsZombie()) {
2168 ::Warning(
"AddTaskDmesonJets",
"Input file not found: will use std cuts.");
2173 analysiscuts =
dynamic_cast<AliRDHFCuts*
>(filecuts->Get(cutsname));
2174 if (!analysiscuts) {
2175 ::Warning(
"AddTaskDmesonJetCorr",
"Could not find analysis cuts '%s' in '%s'. Using std cuts.", cutsname.Data(), cutfname.Data());
2179 return analysiscuts;
2208 if (!cutfname.IsNull()) {
2214 cutsname =
"D0toKpiCuts";
2217 cutsname =
"DStartoKpipiCuts";
2233 ::Info(
"AliAnalysisTaskDmesonJets::AddAnalysisEngine",
"A new analysis engine '%s' has been added. The total number of analysis engines is %lu.", eng.
GetName(),
fAnalysisEngines.size());
2237 ::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());
2240 if (cuts && found_eng->
fRDHFCuts != 0) {
2241 ::Warning(
"AliAnalysisTaskDmesonJets::AddAnalysisEngine",
"D meson cuts were already defined for this D meson type. They will be overwritten.");
2259 ::Info(
"UserCreateOutputObjects",
"CreateOutputObjects of task %s", GetName());
2271 hname =
"fHistCharmPt";
2272 htitle = hname +
";#it{p}_{T,charm} (GeV/#it{c});counts";
2275 hname =
"fHistCharmEta";
2276 htitle = hname +
";#eta_{charm};counts";
2279 hname =
"fHistCharmPhi";
2280 htitle = hname +
";#phi_{charm};counts";
2283 hname =
"fHistCharmPt_Eta05";
2284 htitle = hname +
";#it{p}_{T,charm} (GeV/#it{c});counts";
2287 hname =
"fHistBottomPt";
2288 htitle = hname +
";#it{p}_{T,bottom} (GeV/#it{c});counts";
2291 hname =
"fHistBottomEta";
2292 htitle = hname +
";#eta_{bottom};counts";
2295 hname =
"fHistBottomPhi";
2296 htitle = hname +
";#phi_{bottom};counts";
2299 hname =
"fHistBottomPt_Eta05";
2300 htitle = hname +
";#it{p}_{T,bottom} (GeV/#it{c});counts";
2303 hname =
"fHistHighestPartonPt";
2304 htitle = hname +
";#it{p}_{T,bottom} (GeV/#it{c});counts";
2307 hname =
"fHistHighestPartonType";
2308 htitle = hname +
";type;counts";
2311 hname =
"fHistNHeavyQuarks";
2312 htitle = hname +
";number of heavy-quarks;counts";
2315 ::Info(
"AliAnalysisTaskDmesonJets::UserCreateOutputObjects",
"Allocating histograms for task '%s' (%lu analysis engines)", GetName(),
fAnalysisEngines.size());
2317 ::Info(
"AliAnalysisTaskDmesonJets::UserCreateOutputObjects",
"Allocating histograms for analysis engine '%s' (%lu jet definitions)", param.GetName(), param.fJetDefinitions.size());
2321 hname = TString::Format(
"%s/fHistNAcceptedDmesonsVsNtracks", param.GetName());
2322 htitle = hname +
";#it{N}_{tracks};#it{N}_{D};events";
2325 hname = TString::Format(
"%s/fHistNTotAcceptedDmesons", param.GetName());
2326 htitle = hname +
";;#it{N}_{D}";
2329 hname = TString::Format(
"%s/fHistNDmesons", param.GetName());
2330 htitle = hname +
";#it{N}_{D};events";
2333 hname = TString::Format(
"%s/fHistNEvents", param.GetName());
2334 htitle = hname +
";Event status;counts";
2336 h->GetXaxis()->SetBinLabel(1,
"Accepted");
2337 h->GetXaxis()->SetBinLabel(2,
"Rejected");
2339 hname = TString::Format(
"%s/fHistEventRejectionReasons", param.GetName());
2340 htitle = hname +
";Rejection reason;counts";
2343 hname = TString::Format(
"%s/fHistRejectedDMesonPt", param.GetName());
2344 htitle = hname +
";#it{p}_{T,D} (GeV/#it{c});counts";
2347 hname = TString::Format(
"%s/fHistRejectedDMesonEta", param.GetName());
2348 htitle = hname +
";#it{#eta}_{D};counts";
2351 hname = TString::Format(
"%s/fHistRejectedDMesonPhi", param.GetName());
2352 htitle = hname +
";#it{#phi}_{D};counts";
2357 hname = TString::Format(
"%s/fHistRejectedDMesonInvMass", param.GetName());
2358 htitle = hname +
";#it{M}_{K#pi} (GeV/#it{c}^{2});counts";
2365 hname = TString::Format(
"%s/fHistRejectedDMeson2ProngInvMass", param.GetName());
2366 htitle = hname +
";#it{M}_{K#pi} (GeV/#it{c}^{2});counts";
2370 Double_t D0mass = TDatabasePDG::Instance()->GetParticle(421)->Mass();
2371 hname = TString::Format(
"%s/fHistRejectedDMesonDeltaInvMass", param.GetName());
2372 htitle = hname +
";#it{M}_{K#pi#pi} - #it{M}_{K#pi} (GeV/#it{c}^{2});counts";
2379 hname = TString::Format(
"%s/fHistFirstPartonPt", param.GetName());
2380 htitle = hname +
";#it{p}_{T,parton} (GeV/#it{c});counts";
2383 hname = TString::Format(
"%s/fHistFirstPartonEta", param.GetName());
2384 htitle = hname +
";#eta_{parton};counts";
2387 hname = TString::Format(
"%s/fHistFirstPartonPhi", param.GetName());
2388 htitle = hname +
";#phi_{parton};counts";
2391 hname = TString::Format(
"%s/fHistFirstPartonType", param.GetName());
2392 htitle = hname +
";type;counts";
2395 hname = TString::Format(
"%s/fHistLastPartonPt", param.GetName());
2396 htitle = hname +
";#it{p}_{T,parton} (GeV/#it{c});counts";
2399 hname = TString::Format(
"%s/fHistLastPartonEta", param.GetName());
2400 htitle = hname +
";#eta_{parton};counts";
2403 hname = TString::Format(
"%s/fHistLastPartonPhi", param.GetName());
2404 htitle = hname +
";#phi_{parton};counts";
2407 hname = TString::Format(
"%s/fHistLastPartonType", param.GetName());
2408 htitle = hname +
";type;counts";
2412 for (
auto& jetDef : param.fJetDefinitions) {
2413 ::Info(
"AliAnalysisTaskDmesonJets::UserCreateOutputObjects",
"Allocating histograms for jet definition '%s'", jetDef.GetName());
2416 hname = TString::Format(
"%s/%s/fHistNDmesonsVsNconstituents", param.GetName(), jetDef.GetName());
2417 htitle = hname +
";#it{N}_{constituents};#it{N}_{D};counts";
2421 hname = TString::Format(
"%s/%s/fHistMCParticleRejectionReason", param.GetName(), jetDef.GetName());
2422 htitle = hname +
";Track rejection reason;#it{p}_{T,track} (GeV/#it{c});counts";
2426 hname = TString::Format(
"%s/%s/fHistTrackRejectionReason", param.GetName(), jetDef.GetName());
2427 htitle = hname +
";Track rejection reason;#it{p}_{T,track} (GeV/#it{c});counts";
2431 hname = TString::Format(
"%s/%s/fHistClusterRejectionReason", param.GetName(), jetDef.GetName());
2432 htitle = hname +
";Cluster rejection reason;#it{p}_{T,cluster} (GeV/#it{c});counts";
2436 hname = TString::Format(
"%s/%s/fHistDMesonDaughterNotInJet", param.GetName(), jetDef.GetName());
2437 htitle = hname +
";#it{p}_{T,track} (GeV/#it{c});counts";
2440 hname = TString::Format(
"%s/%s/fHistRejectedJetPt", param.GetName(), jetDef.GetName());
2441 htitle = hname +
";#it{p}_{T,jet} (GeV/#it{c});counts";
2444 hname = TString::Format(
"%s/%s/fHistRejectedJetEta", param.GetName(), jetDef.GetName());
2445 htitle = hname +
";#it{#eta}_{jet};counts";
2448 hname = TString::Format(
"%s/%s/fHistRejectedJetPhi", param.GetName(), jetDef.GetName());
2449 htitle = hname +
";#it{#phi}_{jet};counts";
2454 param.BuildTree(GetName());
2456 param.AssignDataSlot(treeSlot+2);
2461 AliError(Form(
"Number of data output slots %d not sufficient. Tree of analysis engine %s will not be posted!",
fNOutputTrees, param.GetName()));
2492 AliError(Form(
"This task need an AOD event (Task '%s'). Expect troubles...", GetName()));
2506 params.fCandidateArray =
dynamic_cast<TClonesArray*
>(
fAodEvent->GetList()->FindObject(params.fBranchName.Data()));
2508 if (params.fCandidateArray) {
2511 className =
"AliAODRecoDecayHF2Prong";
2514 className =
"AliAODRecoCascadeHF";
2516 if (!params.fCandidateArray->GetClass()->InheritsFrom(className)) {
2517 ::Error(
"AliAnalysisTaskDmesonJets::ExecOnce",
2518 "%s: Objects of type %s in %s are not inherited from %s! Task will be disabled!",
2519 GetName(), params.fCandidateArray->GetClass()->GetName(), params.fCandidateArray->GetName(), className.Data());
2520 params.fCandidateArray = 0;
2521 params.fInhibit = kTRUE;
2525 ::Error(
"AliAnalysisTaskDmesonJets::ExecOnce",
2526 "Could not find candidate array '%s', skipping the event. Analysis engine '%s' will be disabled!",
2527 params.fBranchName.Data(), params.GetName());
2528 params.fInhibit = kTRUE;
2532 if (params.fMCMode !=
kNoMC) {
2534 ::Error(
"AliAnalysisTaskDmesonJets::ExecOnce",
2535 "No MC particle container was provided. Analysis engine '%s' will be disabled!",
2537 params.fInhibit = kTRUE;
2548 if (!params.fTrackContainer && !params.fClusterContainer) {
2549 ::Error(
"AliAnalysisTaskDmesonJets::ExecOnce",
2550 "No track container and no cluster container were provided. Analysis engine '%s' will be disabled!",
2552 params.fInhibit = kTRUE;
2570 if (eng.fInhibit)
continue;
2571 hname = TString::Format(
"%s/fHistEventRejectionReasons", eng.GetName());
2578 eng.fDmesonJets.clear();
2579 if (eng.fInhibit)
continue;
2582 hname = TString::Format(
"%s/fHistNEvents", eng.GetName());
2585 if (!iseventselected) {
2587 hname = TString::Format(
"%s/fHistEventRejectionReasons", eng.GetName());
2588 UInt_t bitmap = eng.fRDHFCuts->GetEventRejectionBitMap();
2592 if (label.IsNull())
break;
2602 AliDebug(2,
"Event selected");
2615 if (param.fInhibit)
continue;
2635 Int_t absPdgHighParton = 0;
2636 for (
auto part : itcont) {
2637 Int_t absPdgCode = TMath::Abs(part.second->GetPdgCode());
2640 if (absPdgCode > 9 && absPdgCode != 21)
continue;
2643 if (highestPartonPt < part.first.Pt()) {
2644 highestPartonPt = part.first.Pt();
2645 absPdgHighParton = absPdgCode;
2661 if (absPdgCode != 4 && absPdgCode != 5)
continue;
2662 Bool_t notLastInPartonShower = kFALSE;
2663 for (
Int_t idaugh = 0; idaugh < 2; idaugh++){
2664 Int_t daughterIndex = part.second->GetDaughter(idaugh);
2665 if (daughterIndex < 0) {
2666 AliDebug(10, Form(
"Could not find daughter of heavy quark (pdg=%d, pt=%.3f)!", absPdgCode, part.first.Pt()));
2671 AliDebug(10, Form(
"Could not find daughter %d of heavy quark (pdg=%d, pt=%.3f)!", daughterIndex, absPdgCode, part.first.Pt()));
2674 Int_t daughterAbsPdgCode = TMath::Abs(daughter->GetPdgCode());
2675 if (daughterAbsPdgCode <= 9 || daughterAbsPdgCode == 21) notLastInPartonShower = kTRUE;
2676 AliDebug(10, Form(
"Found daughter with PDG=%d, pt=%.3f", daughterAbsPdgCode, daughter->Pt()));
2678 if (notLastInPartonShower)
continue;
2680 if (absPdgCode == 4) {
2684 if (TMath::Abs(part.first.Eta()) < 0.5)
fHistManager.
FillTH1(
"fHistCharmPt_Eta05", part.first.Pt());
2686 else if (absPdgCode == 5) {
2690 if (TMath::Abs(part.first.Eta()) < 0.5)
fHistManager.
FillTH1(
"fHistBottomPt_Eta05", part.first.Pt());
2696 Int_t partonType = 0;
2697 if (absPdgHighParton == 9 || absPdgHighParton == 21) {
2701 partonType = absPdgHighParton;
2715 TParticlePDG* part = TDatabasePDG::Instance()->GetParticle(TMath::Abs(pdg));
2720 if (nbins % 2 == 0) {
2721 minMass = mass - range / 2 - range / nbins / 2;
2722 maxMass = mass + range / 2 - range / nbins / 2;
2725 minMass = mass - range / 2;
2726 maxMass = mass + range / 2;
2741 label =
"NotSelTrigger";
2743 return label.Data();
2748 return label.Data();
2751 label =
"TooFewVtxContrib";
2753 return label.Data();
2756 label =
"ZVtxOutFid";
2758 return label.Data();
2763 return label.Data();
2766 label =
"OutsideCentrality";
2768 return label.Data();
2771 label =
"PhysicsSelection";
2773 return label.Data();
2776 label =
"BadSPDVertex";
2778 return label.Data();
2781 label =
"ZVtxSPDOutFid";
2783 return label.Data();
2786 label =
"CentralityFlattening";
2788 return label.Data();
2791 label =
"BadTrackV0Correl";
2793 return label.Data();
2796 return label.Data();
2828 ::Error(
"AddTaskDmesonJets",
"No analysis manager to connect to.");
2833 AliVEventHandler* handler = mgr->GetInputEventHandler();
2835 ::Error(
"AddTaskEmcalJetSpectraQA",
"This task requires an input event handler");
2841 if (handler->InheritsFrom(
"AliESDInputHandler")) {
2844 else if (handler->InheritsFrom(
"AliAODInputHandler")) {
2849 if (ntracks ==
"usedefault") {
2850 if (dataType ==
kESD) {
2853 else if (dataType ==
kAOD) {
2861 if (nclusters ==
"usedefault") {
2862 if (dataType ==
kESD) {
2863 nclusters =
"CaloClusters";
2865 else if (dataType ==
kAOD) {
2866 nclusters =
"caloClusters";
2873 if (nMCpart ==
"usedefault") {
2874 nMCpart =
"mcparticles";
2877 TString name(
"AliAnalysisTaskDmesonJets");
2878 if (strcmp(suffix,
"") != 0) {
2879 name += TString::Format(
"_%s", suffix.Data());
2885 if (!ntracks.IsNull()) {
2890 if (!nMCpart.IsNull()) {
2892 partCont->SetEtaLimits(-1.5, 1.5);
2893 partCont->SetPtLimits(0, 1000);
2900 mgr->AddTask(jetTask);
2903 AliAnalysisDataContainer* cinput1 = mgr->GetCommonInputContainer();
2905 contname1 +=
"_histos";
2906 AliAnalysisDataContainer* coutput1 = mgr->CreateContainer(contname1.Data(),
2907 TList::Class(), AliAnalysisManager::kOutputContainer,
2908 Form(
"%s", AliAnalysisManager::GetCommonFileName()));
2910 mgr->ConnectInput(jetTask, 0, cinput1);
2911 mgr->ConnectOutput(jetTask, 1, coutput1);
2913 for (
Int_t i = 0; i < nMaxTrees; i++) {
2914 TString contname = TString::Format(
"%s_tree_%d", name.Data(), i);
2915 AliAnalysisDataContainer *coutput = mgr->CreateContainer(contname.Data(),
2916 TTree::Class(),AliAnalysisManager::kOutputContainer,
2917 Form(
"%s", AliAnalysisManager::GetCommonFileName()));
2918 mgr->ConnectOutput(jetTask, 2+i, coutput);
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.
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)
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
void AddInputVectors(AliEmcalContainer *cont, Int_t offset, TH2 *rejectHist=0)
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.
void SetVzRange(Double_t min, Double_t max)
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)