Skip to content

Commit 14be999

Browse files
author
Marcello Di Costanzo
committed
Implement CCDB histogram loading
1 parent a76474d commit 14be999

2 files changed

Lines changed: 95 additions & 85 deletions

File tree

‎PWGHF/HFC/TableProducer/correlatorFlowCharmHadronsReduced.cxx‎

Lines changed: 42 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -171,16 +171,16 @@ struct HfCorrelatorFlowCharmHadronsReduced {
171171

172172
switch (histoType) {
173173
case kTH1:
174-
object = ccdb->getForTimeStamp<TH1F>(path, timestampCcdb);
174+
object = ccdb->getForTimeStamp<TH1F>(Form("%s/TH1/", path.c_str()), timestampCcdb);
175175
break;
176176
case kTH2:
177-
object = ccdb->getForTimeStamp<TH2F>(path, timestampCcdb);
177+
object = ccdb->getForTimeStamp<TH2F>(Form("%s/TH2/", path.c_str()), timestampCcdb);
178178
break;
179179
case kTH3:
180-
object = ccdb->getForTimeStamp<TH3F>(path, timestampCcdb);
180+
object = ccdb->getForTimeStamp<TH3F>(Form("%s/TH3/", path.c_str()), timestampCcdb);
181181
break;
182182
case kTHnSparse:
183-
object = ccdb->getForTimeStamp<THnSparseF>(path, timestampCcdb);
183+
object = ccdb->getForTimeStamp<THnSparseF>(Form("%s/THnSparse/", path.c_str()), timestampCcdb);
184184
break;
185185
default:
186186
LOGF(fatal, "Invalid efficiency histogram type: %d", histoType);
@@ -202,14 +202,6 @@ struct HfCorrelatorFlowCharmHadronsReduced {
202202
LOGP(fatal, "You must select events based on either centrality or multiplicity! Please check your configuration!");
203203
}
204204

205-
// Fatal if selCentrality and process functions using multiplicity mixing, or selMultiplicity and process functions using centrality mixing
206-
if (selCentrality && (doprocessSECharmHadWMultMix || doprocessMECharmHadWMultMix || doprocessSEHadHadWMultMix || doprocessMEHadHadWMultMix)) {
207-
LOGP(fatal, "You cannot select events based on centrality and process functions using multiplicity mixing! Please check your configuration!");
208-
}
209-
if (selMultiplicity && (doprocessSECharmHadWCentMix || doprocessMECharmHadWCentMix || doprocessSEHadHadWCentMix || doprocessMEHadHadWCentMix)) {
210-
LOGP(fatal, "You cannot select events based on multiplicity and process functions using centrality mixing! Please check your configuration!");
211-
}
212-
213205
if ((doprocessSECharmHadWCentMix && doprocessMECharmHadWMultMix) ||
214206
(doprocessSECharmHadWMultMix && doprocessMECharmHadWCentMix) ||
215207
(doprocessSEHadHadWCentMix && doprocessMEHadHadWMultMix) ||
@@ -245,13 +237,13 @@ struct HfCorrelatorFlowCharmHadronsReduced {
245237
const AxisSpec axisMlTwo{binsMlTwo, "bdtScore1"};
246238

247239
// Histograms for data analysis
248-
if (doprocessSECharmHadWCentMix || doprocessSEHadHadWCentMix) {
240+
if (doprocessSECharmHadWCentMix || doprocessSECharmHadWCentMixWEffInfo || doprocessSEHadHadWCentMix) {
249241
registry.add("hCentPoolBinSE", "Centrality SE", {HistType::kTH2F, {{axisCent}, {axisPoolBin}}});
250-
} else if (doprocessSECharmHadWMultMix || doprocessSEHadHadWMultMix) {
242+
} else if (doprocessSECharmHadWMultMix || doprocessSECharmHadWMultMixWEffInfo || doprocessSEHadHadWMultMix) {
251243
registry.add("hMultFT0MPoolBinSE", "Multiplicity FT0M SE", {HistType::kTH2F, {{axisMultFT0M}, {axisPoolBin}}});
252-
} else if (doprocessMECharmHadWCentMix || doprocessMEHadHadWCentMix) {
244+
} else if (doprocessMECharmHadWCentMix || doprocessMECharmHadWCentMixWEffInfo || doprocessMEHadHadWCentMix) {
253245
registry.add("hCentPoolBinME", "Centrality ME", {HistType::kTH2F, {{axisCent}, {axisPoolBin}}});
254-
} else if (doprocessMECharmHadWMultMix || doprocessMEHadHadWMultMix) {
246+
} else if (doprocessMECharmHadWMultMix || doprocessMECharmHadWMultMixWEffInfo || doprocessMEHadHadWMultMix) {
255247
registry.add("hMultFT0MPoolBinME", "Multiplicity FT0M ME", {HistType::kTH2F, {{axisMultFT0M}, {axisPoolBin}}});
256248
}
257249
registry.add("hZVtxPoolBinSE", "z vertex SE", {HistType::kTH2F, {{axisPosZ}, {axisPoolBin}}});
@@ -277,24 +269,29 @@ struct HfCorrelatorFlowCharmHadronsReduced {
277269
}
278270
} else {
279271
axes.insert(axes.end(), {axisInvMass, axisMlOne, axisMlTwo});
280-
if (doprocessSECharmHadWCentMix || doprocessSECharmHadWMultMix) {
272+
if (doprocessSECharmHadWCentMix || doprocessSECharmHadWCentMixWEffInfo || doprocessSECharmHadWMultMix || doprocessSECharmHadWMultMixWEffInfo) {
281273
registry.add("hSparseCorrelationsSECharmHad", "THn for SE Charm-Had correlations", HistType::kTHnSparseF, axes);
282274
if (doEfficiencyCorrection) {
283275
registry.get<THnSparse>(HIST("hSparseCorrelationsSECharmHad"))->Sumw2();
284276
}
285-
} else if (doprocessMECharmHadWCentMix || doprocessMECharmHadWMultMix) {
277+
} else if (doprocessMECharmHadWCentMix || doprocessMECharmHadWMultMixWEffInfo || doprocessMECharmHadWMultMix || doprocessMECharmHadWCentMixWEffInfo) {
286278
registry.add("hSparseCorrelationsMECharmHad", "THn for ME Charm-Had correlations", HistType::kTHnSparseF, axes);
287279
if (doEfficiencyCorrection) {
288280
registry.get<THnSparse>(HIST("hSparseCorrelationsMECharmHad"))->Sumw2();
289281
}
290282
}
291-
if (doprocessCharmTriggers) {
283+
if (doprocessCharmTriggers || doprocessCharmTriggersWEffInfo) {
292284
registry.add("hSparseTrigCandsCharm", "THn for Charm trigger candidates", HistType::kTHnSparseF, axesTrigger);
293285
if (doEfficiencyCorrection) {
294286
registry.get<THnSparse>(HIST("hSparseTrigCandsCharm"))->Sumw2();
295287
}
296288
}
297289
}
290+
291+
if (doEfficiencyCorrection) {
292+
hEffPrompt = loadEfficiencyHistogram(promptEffCcdbPath, effHistTypeCharm);
293+
hEffAssoc = loadEfficiencyHistogram(assocEffCcdbPath, effHistTypeAssoc);
294+
}
298295
}
299296

300297
template <bool IsCharm, typename TCand>
@@ -315,17 +312,6 @@ struct HfCorrelatorFlowCharmHadronsReduced {
315312
kineFeatures = {cand.ptAssoc(), cand.etaAssoc(), cand.phiAssoc(), collision.posZ()};
316313
}
317314

318-
// // Charm triggers
319-
// {ptTrig, trigCand.bdtScore0Trig(), trigCand.bdtScore1Trig(), trigCand.etaTrig(), trigCand.phiTrig()}
320-
// {ptTrig, trigCand.bdtScore0Trig(), trigCand.bdtScore1Trig(), getEta(trigCand), getPhi(trigCand)}
321-
// {trigCand.ptTrig(), trigCand.bdtScore0Trig(), trigCand.bdtScore1Trig(), trigCand.etaTrig(), trigCand.phiTrig()}
322-
// // Had triggers
323-
// {ptTrig, trigCand.etaTrig(), trigCand.phiTrig(), collision.posZ()}
324-
// {ptTrig, getEta(trigCand), getPhi(trigCand), trigColl.posZ()}
325-
// // Had associated tracks
326-
// {pair.ptAssoc(), pair.etaAssoc(), pair.phiAssoc(), collision.posZ()}
327-
// {getPt(assocTrack), getEta(assocTrack), getPhi(assocTrack), assocColl.posZ()}
328-
329315
switch (histoType) {
330316

331317
case kTH1: {
@@ -661,7 +647,7 @@ struct HfCorrelatorFlowCharmHadronsReduced {
661647
auto trigCand = pair.template hfcRedTrigCharm_as<TrigCharmCands>();
662648
fillSameEvent<true>(pair, trigCand, binPolicyPosZCent);
663649
}
664-
PROCESS_SWITCH(HfCorrelatorFlowCharmHadronsReduced, processSECharmHadWCentMixWEffInfo, "Process Same Event for Charm-Had with centrality pools", true);
650+
PROCESS_SWITCH(HfCorrelatorFlowCharmHadronsReduced, processSECharmHadWCentMixWEffInfo, "Process Same Event for Charm-Had with centrality pools", false);
665651

666652
void processSEHadHadWCentMix(SameEvtPairsHadHad::iterator const& pair,
667653
aod::HfcRedTrigTracks const&,
@@ -684,9 +670,20 @@ struct HfCorrelatorFlowCharmHadronsReduced {
684670
}
685671
PROCESS_SWITCH(HfCorrelatorFlowCharmHadronsReduced, processMECharmHadWCentMix, "Process Mixed Event for Charm-Had with centrality pools", false);
686672

687-
void processMECharmHadWMultMix(aod::HfcRedCorrColls const& collisions,
673+
void processMECharmHadWCentMixWEffInfo(aod::HfcRedCorrColls const& collisions,
688674
TrigCharmCands const& candidates,
689675
AssocTracks const& tracks)
676+
{
677+
BinningCentPosZ binPolicyPosZCent{{binsZPool, binsCentPool}};
678+
auto pairsTuple = std::make_tuple(candidates, tracks);
679+
Pair<aod::HfcRedCorrColls, TrigCharmCands, AssocTracks, BinningCentPosZ> const pairs{binPolicyPosZCent, numberEventsMixed, -1, collisions, pairsTuple, &cache};
680+
fillMixedEvent<true>(pairs, binPolicyPosZCent);
681+
}
682+
PROCESS_SWITCH(HfCorrelatorFlowCharmHadronsReduced, processMECharmHadWCentMixWEffInfo, "Process Mixed Event for Charm-Had with centrality pools and efficiency information", false);
683+
684+
void processMECharmHadWMultMix(aod::HfcRedCorrColls const& collisions,
685+
TrigCharmCands const& candidates,
686+
AssocTracks const& tracks)
690687
{
691688
BinningMultPosZ binPolicyPosZMult{{binsZPool, binsMultPool}};
692689
auto pairsTuple = std::make_tuple(candidates, tracks);
@@ -695,6 +692,17 @@ struct HfCorrelatorFlowCharmHadronsReduced {
695692
}
696693
PROCESS_SWITCH(HfCorrelatorFlowCharmHadronsReduced, processMECharmHadWMultMix, "Process Mixed Event for Charm-Had with multiplicity pools", false);
697694

695+
void processMECharmHadWMultMixWEffInfo(aod::HfcRedCorrColls const& collisions,
696+
TrigCharmCands const& candidates,
697+
AssocTracks const& tracks)
698+
{
699+
BinningMultPosZ binPolicyPosZMult{{binsZPool, binsMultPool}};
700+
auto pairsTuple = std::make_tuple(candidates, tracks);
701+
Pair<aod::HfcRedCorrColls, TrigCharmCands, AssocTracks, BinningMultPosZ> const pairs{binPolicyPosZMult, numberEventsMixed, -1, collisions, pairsTuple, &cache};
702+
fillMixedEvent<true>(pairs, binPolicyPosZMult);
703+
}
704+
PROCESS_SWITCH(HfCorrelatorFlowCharmHadronsReduced, processMECharmHadWMultMixWEffInfo, "Process Mixed Event for Charm-Had with multiplicity pools and efficiency information", false);
705+
698706
void processMEHadHadWCentMix(aod::HfcRedCorrColls const& collisions,
699707
AssocTracks const& tracks)
700708
{
@@ -728,7 +736,7 @@ struct HfCorrelatorFlowCharmHadronsReduced {
728736
continue;
729737
}
730738

731-
std::vector<double> values = {trigCand.ptTrig(), trigCand.invMassTrig(), trigCand.bdtScore0Trig(), trigCand.bdtScore1Trig()};
739+
std::vector<double> values = {trigCand.invMassTrig(), trigCand.ptTrig(), trigCand.bdtScore0Trig(), trigCand.bdtScore1Trig()};
732740
registry.get<THnSparse>(HIST("hSparseTrigCandsCharm"))->Fill(values.data());
733741
}
734742
}
@@ -752,7 +760,7 @@ struct HfCorrelatorFlowCharmHadronsReduced {
752760
LOGF(warn, "Invalid efficiency value for trigger candidate: effTrig = %f", effTrig);
753761
continue;
754762
}
755-
std::vector<double> values = {trigCand.ptTrig(), trigCand.invMassTrig(), trigCand.bdtScore0Trig(), trigCand.bdtScore1Trig()};
763+
std::vector<double> values = {trigCand.invMassTrig(), trigCand.ptTrig(), trigCand.bdtScore0Trig(), trigCand.bdtScore1Trig()};
756764
double weight = doEfficiencyCorrection ? 1. / effTrig : 1.;
757765
registry.get<THnSparse>(HIST("hSparseTrigCandsCharm"))->Fill(values.data(), weight);
758766
}

0 commit comments

Comments
 (0)