@@ -212,6 +212,7 @@ struct AntinucleiInJets {
212212 TH1F * antiprotonsPerpCone = nullptr ;
213213 TH1F * antideuteronsInsideJets = nullptr ;
214214 TH1F * antideuteronsPerpCone = nullptr ;
215+ TH1F * recoJetPtReweightingFactor = nullptr ;
215216
216217 // CCDB manager service for accessing condition data
217218 Service<o2::ccdb::BasicCCDBManager> ccdb{};
@@ -255,7 +256,7 @@ struct AntinucleiInJets {
255256 rng.seed (12345 );
256257
257258 // Load reweighting histograms from CCDB if antinuclei efficiency processing is enabled
258- if (doprocessAntinucleiEfficiency || doprocessJetsMCgen || doprocessJetsMCrec) {
259+ if (applyReweighting && ( doprocessAntinucleiEfficiency || doprocessJetsMCgen || doprocessJetsMCrec) ) {
259260 ccdb->setURL (urlToCcdb.value );
260261 ccdb->setCaching (true );
261262 ccdb->setLocalObjectValidityChecking ();
@@ -567,7 +568,7 @@ struct AntinucleiInJets {
567568 {
568569 TList* list = ccdbObj->get <TList>(filepath.Data ());
569570 if (!list) {
570- LOGP (error , " Could not retrieve the list from CCDB" );
571+ LOGP (fatal , " Could not retrieve the list from CCDB" );
571572 return ;
572573 }
573574
@@ -579,21 +580,27 @@ struct AntinucleiInJets {
579580 primaryAntiOmega = dynamic_cast <TH1F *>(list->FindObject (" weightsOmega" ));
580581
581582 if (!primaryAntiprotons || !primaryAntiSigma || !primaryAntiLambda || !primaryAntiXi || !primaryAntiOmega) {
582- LOGP (error , " Missing one or more reweighting histograms for primary fraction in CCDB list" );
583+ LOGP (fatal , " Missing one or more reweighting histograms for primary fraction in CCDB list" );
583584 }
584585
585586 // Get reweighting histograms for antiproton efficiency
586587 antiprotonsInsideJets = dynamic_cast <TH1F *>(list->FindObject (" weightsJet" ));
587588 antiprotonsPerpCone = dynamic_cast <TH1F *>(list->FindObject (" weightsUe" ));
588589 if (!antiprotonsInsideJets || !antiprotonsPerpCone) {
589- LOGP (error , " Missing one or more reweighting histograms for antiproton efficiency in CCDB list" );
590+ LOGP (fatal , " Missing one or more reweighting histograms for antiproton efficiency in CCDB list" );
590591 }
591592
592593 // Get reweighting histograms for antideuteron efficiency
593594 antideuteronsInsideJets = dynamic_cast <TH1F *>(list->FindObject (" weightsAntidJet" ));
594595 antideuteronsPerpCone = dynamic_cast <TH1F *>(list->FindObject (" weightsAntidUe" ));
595596 if (!antideuteronsInsideJets || !antideuteronsPerpCone) {
596- LOGP (error, " Missing one or more reweighting histograms for antideuteron efficiency in CCDB list" );
597+ LOGP (fatal, " Missing one or more reweighting histograms for antideuteron efficiency in CCDB list" );
598+ }
599+
600+ // Get reco jet pt reweighting histogram
601+ recoJetPtReweightingFactor = dynamic_cast <TH1F *>(list->FindObject (" recoJetPtReweightingFactor" ));
602+ if (!recoJetPtReweightingFactor) {
603+ LOGP (fatal, " Missing reco jet pt reweighting histograms in CCDB list" );
597604 }
598605
599606 LOGP (info, " Successfully loaded reweighting histograms from CCDB path" );
@@ -2202,6 +2209,16 @@ struct AntinucleiInJets {
22022209 auto jetForSub = jet;
22032210 fastjet::PseudoJet jetMinusBkg = backgroundSub.doRhoAreaSub (jetForSub, rhoPerp, rhoMPerp);
22042211
2212+ // Get reconstructed jet pt reweighting factor
2213+ double recoJetPtWeight (1.0 );
2214+ if (applyReweighting) {
2215+ double jetPt = jetMinusBkg.pt ();
2216+ if (jetPt >= recoJetPtReweightingFactor->GetXaxis ()->GetXmin () && jetPt < recoJetPtReweightingFactor->GetXaxis ()->GetXmax ()) {
2217+ int jetPtBin = recoJetPtReweightingFactor->FindBin (jetPt);
2218+ recoJetPtWeight = recoJetPtReweightingFactor->GetBinContent (jetPtBin);
2219+ }
2220+ }
2221+
22052222 // Fill jet pt distribution
22062223 registryMC.fill (HIST (" jetPtMCreconstructed" ), jetMinusBkg.pt ());
22072224
@@ -2289,20 +2306,23 @@ struct AntinucleiInJets {
22892306 }
22902307
22912308 // Fill inclusive antiproton spectrum
2292- registryMC.fill (HIST (" antiproton_incl_jet" ), pt);
2309+ registryMC.fill (HIST (" antiproton_incl_jet" ), pt, recoJetPtWeight );
22932310
22942311 // Select physical primary antiprotons
22952312 if (!mcparticle.isPhysicalPrimary ())
22962313 continue ;
22972314
22982315 // Fill antiproton spectrum for physical primaries
2299- registryMC.fill (HIST (" antiproton_prim_jet" ), pt);
2316+ registryMC.fill (HIST (" antiproton_prim_jet" ), pt, recoJetPtWeight );
23002317
23012318 // Calculate weights
2302- double weightJet (1.0 );
2303- if (applyReweighting && mcparticle.pt () < antiprotonsInsideJets->GetXaxis ()->GetXmax ()) {
2304- int ipt = antiprotonsInsideJets->FindBin (mcparticle.pt ());
2305- weightJet = antiprotonsInsideJets->GetBinContent (ipt);
2319+ double weightJet = recoJetPtWeight;
2320+ if (applyReweighting) {
2321+ double pt = mcparticle.pt ();
2322+ if (pt >= antiprotonsInsideJets->GetXaxis ()->GetXmin () && pt < antiprotonsInsideJets->GetXaxis ()->GetXmax ()) {
2323+ int ipt = antiprotonsInsideJets->FindBin (pt);
2324+ weightJet *= antiprotonsInsideJets->GetBinContent (ipt);
2325+ }
23062326 }
23072327
23082328 // Fill histograms (TPC and TOF) only for selected candidates
@@ -2340,10 +2360,14 @@ struct AntinucleiInJets {
23402360 continue ;
23412361
23422362 // Calculate weight
2343- double weightJetAntid (1.0 );
2344- if (applyReweighting && mcparticle.pt () < antideuteronsInsideJets->GetXaxis ()->GetXmax ()) {
2345- int ipt = antideuteronsInsideJets->FindBin (mcparticle.pt ());
2346- weightJetAntid = antideuteronsInsideJets->GetBinContent (ipt);
2363+ double weightJetAntid = recoJetPtWeight;
2364+
2365+ if (applyReweighting) {
2366+ double pt = mcparticle.pt ();
2367+ if (pt >= antideuteronsInsideJets->GetXaxis ()->GetXmin () && pt < antideuteronsInsideJets->GetXaxis ()->GetXmax ()) {
2368+ int ipt = antideuteronsInsideJets->FindBin (pt);
2369+ weightJetAntid *= antideuteronsInsideJets->GetBinContent (ipt);
2370+ }
23472371 }
23482372
23492373 // Fill histograms (TPC and TOF) only for selected candidates
@@ -2408,20 +2432,23 @@ struct AntinucleiInJets {
24082432 }
24092433
24102434 // Fill inclusive antiproton spectrum
2411- registryMC.fill (HIST (" antiproton_incl_ue" ), pt);
2435+ registryMC.fill (HIST (" antiproton_incl_ue" ), pt, recoJetPtWeight );
24122436
24132437 // Select physical primary antiprotons
24142438 if (!mcparticle.isPhysicalPrimary ())
24152439 continue ;
24162440
24172441 // Fill antiproton spectrum for physical primaries
2418- registryMC.fill (HIST (" antiproton_prim_ue" ), pt);
2442+ registryMC.fill (HIST (" antiproton_prim_ue" ), pt, recoJetPtWeight );
24192443
24202444 // Calculate weights
2421- double weightUe (1.0 );
2422- if (applyReweighting && mcparticle.pt () < antiprotonsPerpCone->GetXaxis ()->GetXmax ()) {
2423- int ipt = antiprotonsPerpCone->FindBin (mcparticle.pt ());
2424- weightUe = antiprotonsPerpCone->GetBinContent (ipt);
2445+ double weightUe = recoJetPtWeight;
2446+ if (applyReweighting) {
2447+ double pt = mcparticle.pt ();
2448+ if (pt >= antiprotonsPerpCone->GetXaxis ()->GetXmin () && pt < antiprotonsPerpCone->GetXaxis ()->GetXmax ()) {
2449+ int ipt = antiprotonsPerpCone->FindBin (pt);
2450+ weightUe *= antiprotonsPerpCone->GetBinContent (ipt);
2451+ }
24252452 }
24262453
24272454 // Fill histograms (TPC and TOF) only for selected candidates
@@ -2490,7 +2517,7 @@ struct AntinucleiInJets {
24902517 double weightUeAntid (1.0 );
24912518 if (applyReweighting && mcparticle.pt () < antideuteronsPerpCone->GetXaxis ()->GetXmax ()) {
24922519 int ipt = antideuteronsPerpCone->FindBin (mcparticle.pt ());
2493- weightUeAntid = antideuteronsPerpCone->GetBinContent (ipt);
2520+ weightUeAntid = antideuteronsPerpCone->GetBinContent (ipt) * recoJetPtWeight ;
24942521 }
24952522
24962523 // Fill histograms (TPC and TOF) only for selected candidates
0 commit comments