Skip to content

Commit 3a392aa

Browse files
committed
Add gen jet pt re-weighting
1 parent 15ef1ea commit 3a392aa

1 file changed

Lines changed: 38 additions & 18 deletions

File tree

‎PWGLF/Tasks/Nuspex/antinucleiInJets.cxx‎

Lines changed: 38 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ struct AntinucleiInJets {
213213
TH1F* antideuteronsInsideJets = nullptr;
214214
TH1F* antideuteronsPerpCone = nullptr;
215215
TH1F* recoJetPtReweightingFactor = nullptr;
216+
TH1F* genJetPtReweightingFactor = nullptr;
216217

217218
// CCDB manager service for accessing condition data
218219
Service<o2::ccdb::BasicCCDBManager> ccdb{};
@@ -599,8 +600,9 @@ struct AntinucleiInJets {
599600

600601
// Get reco jet pt reweighting histogram
601602
recoJetPtReweightingFactor = dynamic_cast<TH1F*>(list->FindObject("recoJetPtReweightingFactor"));
602-
if (!recoJetPtReweightingFactor) {
603-
LOGP(fatal, "Missing reco jet pt reweighting histograms in CCDB list");
603+
genJetPtReweightingFactor = dynamic_cast<TH1F*>(list->FindObject("genJetPtReweightingFactor"));
604+
if (!recoJetPtReweightingFactor || !genJetPtReweightingFactor) {
605+
LOGP(fatal, "Missing one of jet pt reweighting histograms in CCDB list");
604606
}
605607

606608
LOGP(info, "Successfully loaded reweighting histograms from CCDB path");
@@ -1918,6 +1920,16 @@ struct AntinucleiInJets {
19181920
auto jetForSub = jet;
19191921
fastjet::PseudoJet jetMinusBkg = backgroundSub.doRhoAreaSub(jetForSub, rhoPerp, rhoMPerp);
19201922

1923+
// Get generated jet pt reweighting factor
1924+
double genJetPtWeight(1.0);
1925+
if (applyReweighting) {
1926+
double jetPt = jetMinusBkg.pt();
1927+
if (jetPt >= genJetPtReweightingFactor->GetXaxis()->GetXmin() && jetPt < genJetPtReweightingFactor->GetXaxis()->GetXmax()) {
1928+
int jetPtBin = genJetPtReweightingFactor->FindBin(jetPt);
1929+
genJetPtWeight = genJetPtReweightingFactor->GetBinContent(jetPtBin);
1930+
}
1931+
}
1932+
19211933
// Fill jet pt distribution
19221934
registryMC.fill(HIST("jetPtMCgenerated"), jetMinusBkg.pt());
19231935

@@ -1952,10 +1964,12 @@ struct AntinucleiInJets {
19521964
registryMC.fill(HIST("antiproton_deltay_deltaphi_jet"), particle.eta() - jet.eta(), getDeltaPhi(particle.phi(), jet.phi()));
19531965

19541966
// Calculate weight
1955-
double weightJet(1.0);
1956-
if (applyReweighting && particle.pt() < antiprotonsInsideJets->GetXaxis()->GetXmax()) {
1957-
int ipt = antiprotonsInsideJets->FindBin(particle.pt());
1958-
weightJet = antiprotonsInsideJets->GetBinContent(ipt);
1967+
double weightJet = genJetPtWeight;
1968+
if (applyReweighting) {
1969+
if (particle.pt() >= antiprotonsInsideJets->GetXaxis()->GetXmin() && particle.pt() < antiprotonsInsideJets->GetXaxis()->GetXmax()) {
1970+
int ipt = antiprotonsInsideJets->FindBin(particle.pt());
1971+
weightJet *= antiprotonsInsideJets->GetBinContent(ipt);
1972+
}
19591973
}
19601974

19611975
// Fill histogram for generated antiprotons
@@ -1974,10 +1988,12 @@ struct AntinucleiInJets {
19741988

19751989
// Fill antideuteron spectra
19761990
if (isAntid) {
1977-
double weightJetAntid(1.0);
1978-
if (applyReweighting && particle.pt() < antideuteronsInsideJets->GetXaxis()->GetXmax()) {
1979-
int ipt = antideuteronsInsideJets->FindBin(particle.pt());
1980-
weightJetAntid = antideuteronsInsideJets->GetBinContent(ipt);
1991+
double weightJetAntid = genJetPtWeight;
1992+
if (applyReweighting) {
1993+
if (particle.pt() >= antideuteronsInsideJets->GetXaxis()->GetXmin() && particle.pt() < antideuteronsInsideJets->GetXaxis()->GetXmax()) {
1994+
int ipt = antideuteronsInsideJets->FindBin(particle.pt());
1995+
weightJetAntid *= antideuteronsInsideJets->GetBinContent(ipt);
1996+
}
19811997
}
19821998

19831999
registryMC.fill(HIST("antideuteron_gen_jet"), particle.pt(), weightJetAntid);
@@ -2013,10 +2029,12 @@ struct AntinucleiInJets {
20132029
registryMC.fill(HIST("antiproton_deltay_deltaphi_ue"), protonVec.Eta() - ueAxis2.Eta(), getDeltaPhi(protonVec.Phi(), ueAxis2.Phi()));
20142030

20152031
// Calculate weight
2016-
double weightUe(1.0);
2017-
if (applyReweighting && protonVec.Pt() < antiprotonsPerpCone->GetXaxis()->GetXmax()) {
2018-
int ipt = antiprotonsPerpCone->FindBin(protonVec.Pt());
2019-
weightUe = antiprotonsPerpCone->GetBinContent(ipt);
2032+
double weightUe = genJetPtWeight;
2033+
if (applyReweighting) {
2034+
if (protonVec.Pt() >= antiprotonsPerpCone->GetXaxis()->GetXmin() && protonVec.Pt() < antiprotonsPerpCone->GetXaxis()->GetXmax()) {
2035+
int ipt = antiprotonsPerpCone->FindBin(protonVec.Pt());
2036+
weightUe *= antiprotonsPerpCone->GetBinContent(ipt);
2037+
}
20202038
}
20212039

20222040
// Fill histogram for antiprotons in the UE
@@ -2049,10 +2067,12 @@ struct AntinucleiInJets {
20492067
continue;
20502068

20512069
// Calculate weight
2052-
double weightUeAntid(1.0);
2053-
if (applyReweighting && deuteronVec.Pt() < antideuteronsPerpCone->GetXaxis()->GetXmax()) {
2054-
int ipt = antideuteronsPerpCone->FindBin(deuteronVec.Pt());
2055-
weightUeAntid = antideuteronsPerpCone->GetBinContent(ipt);
2070+
double weightUeAntid = genJetPtWeight;
2071+
if (applyReweighting) {
2072+
if (deuteronVec.Pt() >= antideuteronsPerpCone->GetXaxis()->GetXmin() && deuteronVec.Pt() < antideuteronsPerpCone->GetXaxis()->GetXmax()) {
2073+
int ipt = antideuteronsPerpCone->FindBin(deuteronVec.Pt());
2074+
weightUeAntid *= antideuteronsPerpCone->GetBinContent(ipt);
2075+
}
20562076
}
20572077

20582078
// Fill histogram for antideuterons in the UE

0 commit comments

Comments
 (0)