Skip to content

Commit 432433f

Browse files
committed
[PWGLF] Add re-weighting for antideuteron efficiency
1 parent 1fbe0d1 commit 432433f

1 file changed

Lines changed: 53 additions & 15 deletions

File tree

PWGLF/Tasks/Nuspex/antinucleiInJets.cxx

Lines changed: 53 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -205,14 +205,16 @@ struct AntinucleiInJets {
205205
// Configuration parameters for CCDB access and reweighting input files
206206
Configurable<bool> applyReweighting{"applyReweighting", true, "enable reweighting for efficiency"};
207207
Configurable<std::string> urlToCcdb{"urlToCcdb", "http://alice-ccdb.cern.ch/", "url of the personal ccdb"};
208-
Configurable<std::string> pathToFile{"pathToFile", "Users/a/alcaliva/reweightingHistogramsAnalysis/", "path to file"};
208+
Configurable<std::string> pathToFile{"pathToFile", "Users/a/alcaliva/reweightingHistogramsAntinucleiInJets/", "path to file"};
209209
Configurable<std::string> weightsProton{"weightsProton", "weightsProton", "weightsProton"};
210210
Configurable<std::string> weightsLambda{"weightsLambda", "weightsLambda", "weightsLambda"};
211211
Configurable<std::string> weightsSigma{"weightsSigma", "weightsSigma", "weightsSigma"};
212212
Configurable<std::string> weightsXi{"weightsXi", "weightsXi", "weightsXi"};
213213
Configurable<std::string> weightsOmega{"weightsOmega", "weightsOmega", "weightsOmega"};
214214
Configurable<std::string> weightsJet{"weightsJet", "weightsJet", "weightsJet"};
215215
Configurable<std::string> weightsUe{"weightsUe", "weightsUe", "weightsUe"};
216+
Configurable<std::string> weightsAntidJet{"weightsAntidJet", "weightsAntidJet", "weightsAntidJet"};
217+
Configurable<std::string> weightsAntidUe{"weightsAntidUe", "weightsAntidUe", "weightsAntidUe"};
216218

217219
// Number of events
218220
Configurable<int> shrinkInterval{"shrinkInterval", 1000, "variable that controls how often shrinking happens"};
@@ -232,6 +234,8 @@ struct AntinucleiInJets {
232234
TH1F* primaryAntiOmega;
233235
TH1F* antiprotonsInsideJets;
234236
TH1F* antiprotonsPerpCone;
237+
TH1F* antideuteronsInsideJets;
238+
TH1F* antideuteronsPerpCone;
235239

236240
// CCDB manager service for accessing condition data
237241
Service<o2::ccdb::BasicCCDBManager> ccdb;
@@ -284,7 +288,7 @@ struct AntinucleiInJets {
284288
ccdb->setLocalObjectValidityChecking();
285289
ccdb->setCreatedNotAfter(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count());
286290
ccdb->setFatalWhenNull(false);
287-
getReweightingHistograms(ccdb, TString(pathToFile), TString(weightsProton), TString(weightsLambda), TString(weightsSigma), TString(weightsXi), TString(weightsOmega), TString(weightsJet), TString(weightsUe));
291+
getReweightingHistograms(ccdb, TString(pathToFile), TString(weightsProton), TString(weightsLambda), TString(weightsSigma), TString(weightsXi), TString(weightsOmega), TString(weightsJet), TString(weightsUe), TString(weightsAntidJet), TString(weightsAntidUe));
288292
}
289293

290294
// Binning
@@ -686,7 +690,7 @@ struct AntinucleiInJets {
686690
}
687691
}
688692

689-
void getReweightingHistograms(o2::framework::Service<o2::ccdb::BasicCCDBManager> const& ccdbObj, TString filepath, TString antip, TString antilambda, TString antisigma, TString antixi, TString antiomega, TString jet, TString ue)
693+
void getReweightingHistograms(o2::framework::Service<o2::ccdb::BasicCCDBManager> const& ccdbObj, TString filepath, TString antip, TString antilambda, TString antisigma, TString antixi, TString antiomega, TString jet, TString ue, TString antidJet, TString antidUe)
690694
{
691695
TList* list = ccdbObj->get<TList>(filepath.Data());
692696
if (!list) {
@@ -705,11 +709,18 @@ struct AntinucleiInJets {
705709
LOGP(error, "Missing one or more reweighting histograms for primary fraction in CCDB list");
706710
}
707711

708-
// Get reweighting histograms for efficiency
712+
// Get reweighting histograms for antiproton efficiency
709713
antiprotonsInsideJets = static_cast<TH1F*>(list->FindObject(jet));
710714
antiprotonsPerpCone = static_cast<TH1F*>(list->FindObject(ue));
711715
if (!antiprotonsInsideJets || !antiprotonsPerpCone) {
712-
LOGP(error, "Missing one or more reweighting histograms for efficiency in CCDB list");
716+
LOGP(error, "Missing one or more reweighting histograms for antiproton efficiency in CCDB list");
717+
}
718+
719+
// Get reweighting histograms for antideuteron efficiency
720+
antideuteronsInsideJets = static_cast<TH1F*>(list->FindObject(antidJet));
721+
antideuteronsPerpCone = static_cast<TH1F*>(list->FindObject(antidUe));
722+
if (!antideuteronsInsideJets || !antideuteronsPerpCone) {
723+
LOGP(error, "Missing one or more reweighting histograms for antideuteron efficiency in CCDB list");
713724
}
714725

715726
LOGP(info, "Successfully loaded reweighting histograms from CCDB path");
@@ -2188,7 +2199,13 @@ struct AntinucleiInJets {
21882199

21892200
// Fill antideuteron spectra
21902201
if (isAntid) {
2191-
registryMC.fill(HIST("antideuteron_gen_jet"), particle.pt());
2202+
double weightJetAntid(1.0);
2203+
if (applyReweighting && particle.pt() < antideuteronsInsideJets->GetXaxis()->GetXmax()) {
2204+
int ipt = antideuteronsInsideJets->FindBin(particle.pt());
2205+
weightJetAntid = antideuteronsInsideJets->GetBinContent(ipt);
2206+
}
2207+
2208+
registryMC.fill(HIST("antideuteron_gen_jet"), particle.pt(), weightJetAntid);
21922209
}
21932210
}
21942211

@@ -2255,8 +2272,15 @@ struct AntinucleiInJets {
22552272
if (deltaRUe1 > rJet && deltaRUe2 > rJet)
22562273
continue;
22572274

2275+
// Calculate weight
2276+
double weightUeAntid(1.0);
2277+
if (applyReweighting && deuteronVec.Pt() < antideuteronsPerpCone->GetXaxis()->GetXmax()) {
2278+
int ipt = antideuteronsPerpCone->FindBin(deuteronVec.Pt());
2279+
weightUeAntid = antideuteronsPerpCone->GetBinContent(ipt);
2280+
}
2281+
22582282
// Fill histogram for antideuterons in the UE
2259-
registryMC.fill(HIST("antideuteron_gen_ue"), deuteronVec.Pt());
2283+
registryMC.fill(HIST("antideuteron_gen_ue"), deuteronVec.Pt(), weightUeAntid);
22602284
}
22612285
}
22622286
if (isAtLeastOneJetSelected) {
@@ -2512,7 +2536,7 @@ struct AntinucleiInJets {
25122536
// Fill antiproton spectrum for physical primaries
25132537
registryMC.fill(HIST("antiproton_prim_jet"), pt);
25142538

2515-
// Calculate weight
2539+
// Calculate weights
25162540
double weightJet(1.0);
25172541
if (applyReweighting && mcparticle.pt() < antiprotonsInsideJets->GetXaxis()->GetXmax()) {
25182542
int ipt = antiprotonsInsideJets->FindBin(mcparticle.pt());
@@ -2549,16 +2573,23 @@ struct AntinucleiInJets {
25492573
if (std::fabs(dcaxy) > maxDcaxy || std::fabs(dcaz) > maxDcaz)
25502574
continue;
25512575

2552-
// Select physical primary antiprotons
2576+
// Select physical primary antideuterons
25532577
if (!mcparticle.isPhysicalPrimary())
25542578
continue;
25552579

2580+
// Calculate weight
2581+
double weightJetAntid(1.0);
2582+
if (applyReweighting && mcparticle.pt() < antideuteronsInsideJets->GetXaxis()->GetXmax()) {
2583+
int ipt = antideuteronsInsideJets->FindBin(mcparticle.pt());
2584+
weightJetAntid = antideuteronsInsideJets->GetBinContent(ipt);
2585+
}
2586+
25562587
// Fill histograms (TPC and TOF) only for selected candidates
25572588
if (nsigmaTPCDe > minNsigmaTpc && nsigmaTPCDe < maxNsigmaTpc) {
2558-
registryMC.fill(HIST("antideuteron_rec_tpc_jet"), pt);
2589+
registryMC.fill(HIST("antideuteron_rec_tpc_jet"), pt, weightJetAntid);
25592590

25602591
if (track.hasTOF() && nsigmaTOFDe > minNsigmaTof && nsigmaTOFDe < maxNsigmaTof) {
2561-
registryMC.fill(HIST("antideuteron_rec_tof_jet"), pt);
2592+
registryMC.fill(HIST("antideuteron_rec_tof_jet"), pt, weightJetAntid);
25622593
}
25632594
}
25642595
} // end of isAntid
@@ -2624,7 +2655,7 @@ struct AntinucleiInJets {
26242655
// Fill antiproton spectrum for physical primaries
26252656
registryMC.fill(HIST("antiproton_prim_ue"), pt);
26262657

2627-
// Calculate weight
2658+
// Calculate weights
26282659
double weightUe(1.0);
26292660
if (applyReweighting && mcparticle.pt() < antiprotonsPerpCone->GetXaxis()->GetXmax()) {
26302661
int ipt = antiprotonsPerpCone->FindBin(mcparticle.pt());
@@ -2689,16 +2720,23 @@ struct AntinucleiInJets {
26892720
if (deltaRUe1 > rJet && deltaRUe2 > rJet)
26902721
continue;
26912722

2692-
// Select physical primary antiprotons
2723+
// Select physical primary antideuterons
26932724
if (!mcparticle.isPhysicalPrimary())
26942725
continue;
26952726

2727+
// Calculate weight
2728+
double weightUeAntid(1.0);
2729+
if (applyReweighting && mcparticle.pt() < antideuteronsPerpCone->GetXaxis()->GetXmax()) {
2730+
int ipt = antideuteronsPerpCone->FindBin(mcparticle.pt());
2731+
weightUeAntid = antideuteronsPerpCone->GetBinContent(ipt);
2732+
}
2733+
26962734
// Fill histograms (TPC and TOF) only for selected candidates
26972735
if (nsigmaTPCDe > minNsigmaTpc && nsigmaTPCDe < maxNsigmaTpc) {
2698-
registryMC.fill(HIST("antideuteron_rec_tpc_ue"), pt);
2736+
registryMC.fill(HIST("antideuteron_rec_tpc_ue"), pt, weightUeAntid);
26992737

27002738
if (track.hasTOF() && nsigmaTOFDe > minNsigmaTof && nsigmaTOFDe < maxNsigmaTof) {
2701-
registryMC.fill(HIST("antideuteron_rec_tof_ue"), pt);
2739+
registryMC.fill(HIST("antideuteron_rec_tof_ue"), pt, weightUeAntid);
27022740
}
27032741
}
27042742
}

0 commit comments

Comments
 (0)