|
32 | 32 |
|
33 | 33 | #include <TPDGCode.h> |
34 | 34 |
|
| 35 | +#include <memory> |
35 | 36 | #include <set> |
| 37 | +#include <string> |
36 | 38 | #include <vector> |
37 | 39 |
|
38 | 40 | using namespace o2; |
@@ -104,6 +106,9 @@ struct femtoUniversePairTaskTrackCascadeExtended { |
104 | 106 | ConfigurableAxis confTrkTempFitVarBins{"confTrkTempFitVarBins", {300, -0.15, 0.15}, "binning of the TempFitVar in the pT vs. TempFitVar plot"}; |
105 | 107 | Configurable<int> confNEventsMix{"confNEventsMix", 5, "Number of events for mixing"}; |
106 | 108 |
|
| 109 | + // Efficiency |
| 110 | + Configurable<std::string> confLocalEfficiency{"confLocalEfficiency", "", "Local path to efficiency .root file"}; |
| 111 | + |
107 | 112 | Filter collisionFilter = (nabs(aod::collision::posZ) < confZVertexCut); |
108 | 113 | using FilteredFDCollisions = soa::Filtered<o2::aod::FdCollisions>; |
109 | 114 | using FilteredFDCollision = FilteredFDCollisions::iterator; |
@@ -152,6 +157,10 @@ struct femtoUniversePairTaskTrackCascadeExtended { |
152 | 157 |
|
153 | 158 | std::set<int> cascDuplicates; |
154 | 159 |
|
| 160 | + std::unique_ptr<TFile> plocalEffFile; |
| 161 | + std::unique_ptr<TH1> plocalEffp1; |
| 162 | + std::unique_ptr<TH1> plocalEffp2; |
| 163 | + |
155 | 164 | // Table to select cascade daughters |
156 | 165 | // Charges: = +--, +--, +-+, +-+ |
157 | 166 | static constexpr unsigned int CascChildTable[][3] = {{0, 1, 2}, {0, 1, 1}, {1, 0, 2}, {1, 0, 1}}; |
@@ -314,6 +323,21 @@ struct femtoUniversePairTaskTrackCascadeExtended { |
314 | 323 | if (doprocessSameEventCasc || doprocessSameEventCascBitmask || doprocessMixedEventCasc || doprocessMixedEventCascBitmask) |
315 | 324 | pairCloseRejectionCasc.init(&resultRegistry, &qaRegistry, confCPRdeltaPhiCutMin.value, confCPRdeltaPhiCutMax.value, confCPRdeltaEtaCutMin.value, confCPRdeltaEtaCutMax.value, confCPRChosenRadii.value, confCPRPlotPerRadii.value, 0, 0, confIsSameSignCPR.value); |
316 | 325 | } |
| 326 | + |
| 327 | + if (!confLocalEfficiency.value.empty()) { |
| 328 | + plocalEffFile = std::unique_ptr<TFile>(TFile::Open(confLocalEfficiency.value.c_str(), "read")); |
| 329 | + if (!plocalEffFile || plocalEffFile.get()->IsZombie()) |
| 330 | + LOGF(fatal, "Could not load efficiency histogram from %s", confLocalEfficiency.value.c_str()); |
| 331 | + if (doprocessSameEvent || doprocessSameEventBitmask || doprocessMixedEvent || doprocessMixedEventBitmask) { |
| 332 | + plocalEffp1 = (confChargePart1 > 0) ? std::unique_ptr<TH1>(plocalEffFile.get()->Get<TH1>("PrPlus")) : std::unique_ptr<TH1>(plocalEffFile.get()->Get<TH1>("PrMinus")); // note: works only for protons for now |
| 333 | + plocalEffp2 = (confCascType1 == 0 || confCascType1 == 1) ? std::unique_ptr<TH1>(plocalEffFile.get()->Get<TH1>("Cascade")) : std::unique_ptr<TH1>(plocalEffFile.get()->Get<TH1>("AntiCascade")); |
| 334 | + LOGF(info, "Loaded efficiency histograms for track-Cascade."); |
| 335 | + } else if (doprocessSameEventCasc || doprocessSameEventCascBitmask || doprocessMixedEventCasc || doprocessMixedEventCascBitmask) { |
| 336 | + plocalEffp1 = (confCascType1 == 0 || confCascType1 == 1) ? std::unique_ptr<TH1>(plocalEffFile.get()->Get<TH1>("Cascade")) : std::unique_ptr<TH1>(plocalEffFile.get()->Get<TH1>("AntiCascade")); |
| 337 | + plocalEffp2 = (confCascType2 == 0 || confCascType2 == 1) ? std::unique_ptr<TH1>(plocalEffFile.get()->Get<TH1>("Cascade")) : std::unique_ptr<TH1>(plocalEffFile.get()->Get<TH1>("AntiCascade")); |
| 338 | + LOGF(info, "Loaded efficiency histograms for Cascade-Cascade."); |
| 339 | + } |
| 340 | + } |
317 | 341 | } |
318 | 342 |
|
319 | 343 | void processCascadeQA([[maybe_unused]] const FilteredFDCollision& col, const FemtoFullParticles& parts, const aod::FDCascParticles& fdcascs) |
@@ -484,7 +508,10 @@ struct femtoUniversePairTaskTrackCascadeExtended { |
484 | 508 | if ((!confCheckTOFBachelorOnly && ((posChild.pidCut() & (8u << CascChildTable[confCascType1][0])) == 0 || (negChild.pidCut() & (8u << CascChildTable[confCascType1][1])) == 0)) || (bachelor.pidCut() & (8u << CascChildTable[confCascType1][2])) == 0) |
485 | 509 | continue; |
486 | 510 | } |
487 | | - sameEventCont.setPair<false>(p1, p2, multCol, confUse3D, 1.0f); |
| 511 | + float weight = 1.0f; |
| 512 | + if (plocalEffp1) |
| 513 | + weight = plocalEffp1.get()->GetBinContent(plocalEffp1->FindBin(p1.pt(), p1.eta())) * plocalEffp2.get()->GetBinContent(plocalEffp2->FindBin(p2.pt(), p2.eta())); |
| 514 | + sameEventCont.setPair<false>(p1, p2, multCol, confUse3D, weight); |
488 | 515 | } |
489 | 516 | } |
490 | 517 |
|
@@ -606,7 +633,10 @@ struct femtoUniversePairTaskTrackCascadeExtended { |
606 | 633 | return; |
607 | 634 | } |
608 | 635 |
|
609 | | - sameEventCont.setPair<false>(p1, p2, multCol, confUse3D, 1.0f); |
| 636 | + float weight = 1.0f; |
| 637 | + if (plocalEffp1) |
| 638 | + weight = plocalEffp1.get()->GetBinContent(plocalEffp1->FindBin(p1.pt(), p1.eta())) * plocalEffp2.get()->GetBinContent(plocalEffp2->FindBin(p2.pt(), p2.eta())); |
| 639 | + sameEventCont.setPair<false>(p1, p2, multCol, confUse3D, weight); |
610 | 640 | }; |
611 | 641 | cascDuplicates.clear(); |
612 | 642 | if (confCascType1 == confCascType2) { |
@@ -698,7 +728,10 @@ struct femtoUniversePairTaskTrackCascadeExtended { |
698 | 728 | } |
699 | 729 | } |
700 | 730 |
|
701 | | - mixedEventCont.setPair<false>(p1, p2, multCol, confUse3D, 1.0f); |
| 731 | + float weight = 1.0f; |
| 732 | + if (plocalEffp1) |
| 733 | + weight = plocalEffp1.get()->GetBinContent(plocalEffp1->FindBin(p1.pt(), p1.eta())) * plocalEffp2.get()->GetBinContent(plocalEffp2->FindBin(p2.pt(), p2.eta())); |
| 734 | + mixedEventCont.setPair<false>(p1, p2, multCol, confUse3D, weight); |
702 | 735 | } |
703 | 736 | }; |
704 | 737 |
|
@@ -794,7 +827,10 @@ struct femtoUniversePairTaskTrackCascadeExtended { |
794 | 827 | } |
795 | 828 | } |
796 | 829 |
|
797 | | - mixedEventCont.setPair<false>(p1, p2, multCol, confUse3D, 1.0f); |
| 830 | + float weight = 1.0f; |
| 831 | + if (plocalEffp1) |
| 832 | + weight = plocalEffp1.get()->GetBinContent(plocalEffp1->FindBin(p1.pt(), p1.eta())) * plocalEffp2.get()->GetBinContent(plocalEffp2->FindBin(p2.pt(), p2.eta())); |
| 833 | + mixedEventCont.setPair<false>(p1, p2, multCol, confUse3D, weight); |
798 | 834 | } |
799 | 835 | } |
800 | 836 | } |
|
0 commit comments