|
64 | 64 | #include <Math/Vector4Dfwd.h> |
65 | 65 | #include <TH1.h> |
66 | 66 | #include <TH2.h> |
| 67 | +#include <TH3.h> |
67 | 68 | #include <TList.h> |
68 | 69 | #include <TRandom3.h> |
69 | 70 | #include <TString.h> |
@@ -323,6 +324,15 @@ struct Dilepton { |
323 | 324 | o2::framework::Configurable<uint64_t> bcMarginForSoftwareTrigger{"bcMarginForSoftwareTrigger", 100, "Number of BCs of margin for software triggers"}; |
324 | 325 | } zorroGroup; |
325 | 326 |
|
| 327 | + struct : o2::framework::ConfigurableGroup { |
| 328 | + std::string prefix = "flowcorrection_group"; |
| 329 | + o2::framework::Configurable<bool> cfgApplyWeightNUA{"cfgApplyWeightNUA", false, "flag to apply q-vector Non-uniform acceptance weighting"}; |
| 330 | + o2::framework::Configurable<std::string> nuaPath{"nuaPath", "Users/o/omassen/Dielectron/NUAWeights/LHC23_PbPb_pass5", "Path to NUA-weights file"}; |
| 331 | + o2::framework::ConfigurableAxis ConfNUAPhiBins{"ConfNUAPhiBins", {60, -M_PI, M_PI}, "NUA histogram bins - phi-angle"}; |
| 332 | + o2::framework::ConfigurableAxis ConfNUAEtaBins{"ConfNUAEtaBins", {40, -1., +1.}, "NUA histogram bins - eta"}; |
| 333 | + o2::framework::ConfigurableAxis ConfNUAZVtxBins{"ConfNUAZVtxBins", {40, -10., 10.}, "NUA histogram bins - z-vtx"}; |
| 334 | + } flowcorrectionGroup; |
| 335 | + |
326 | 336 | Zorro zorro; |
327 | 337 | int mToIidx = 0; |
328 | 338 | int mTOICounter = 0; |
@@ -355,6 +365,7 @@ struct Dilepton { |
355 | 365 | float beamP1 = 0.f; // beam momentum |
356 | 366 | float beamP2 = 0.f; // beam momentum |
357 | 367 | TH2D* h2sp_resolution = nullptr; |
| 368 | + std::vector<TH3D*> h3nua_weights; |
358 | 369 |
|
359 | 370 | void init(o2::framework::InitContext& /*context*/) |
360 | 371 | { |
@@ -558,6 +569,16 @@ struct Dilepton { |
558 | 569 | h2sp_resolution = reinterpret_cast<TH2D*>(list->FindObject(spresoHistName.value.data())); |
559 | 570 | LOGF(info, "h2sp_resolution.GetBinContent(40, 1) = %f", h2sp_resolution->GetBinContent(40, 1)); |
560 | 571 | } |
| 572 | + |
| 573 | + if (flowcorrectionGroup.cfgApplyWeightNUA) { |
| 574 | + auto list_nua = ccdb->getForTimeStamp<TList>(flowcorrectionGroup.nuaPath, collision.timestamp()); |
| 575 | + h3nua_weights.push_back(reinterpret_cast<TH3D*>(list_nua->FindObject("weights_uls_NUA"))); |
| 576 | + LOGF(info, "h3nua_weights.at(0)->GetBinContent(5, 5, 5) = %f", h3nua_weights.at(0)->GetBinContent(5, 5, 5)); |
| 577 | + h3nua_weights.push_back(reinterpret_cast<TH3D*>(list_nua->FindObject("weights_lspp_NUA"))); |
| 578 | + LOGF(info, "h3nua_weights.at(1)->GetBinContent(5, 5, 5) = %f", h3nua_weights.at(1)->GetBinContent(5, 5, 5)); |
| 579 | + h3nua_weights.push_back(reinterpret_cast<TH3D*>(list_nua->FindObject("weights_lsmm_NUA"))); |
| 580 | + LOGF(info, "h3nua_weights.at(2)->GetBinContent(5, 5, 5) = %f", h3nua_weights.at(2)->GetBinContent(5, 5, 5)); |
| 581 | + } |
561 | 582 | } |
562 | 583 |
|
563 | 584 | ~Dilepton() |
@@ -648,6 +669,7 @@ struct Dilepton { |
648 | 669 | const o2::framework::AxisSpec axis_sp{ConfSPBins, Form("#vec{u}_{%d,ll} #upoint #vec{Q}_{%d}^{%s}", nmod, nmod, qvec_det_names[cfgQvecEstimator].data())}; |
649 | 670 |
|
650 | 671 | fRegistry.add("Pair/same/uls/hs", "dilepton", o2::framework::HistType::kTHnSparseD, {axis_mass, axis_pt, axis_dca, axis_y, axis_sp}, true); |
| 672 | + fRegistry.add("Pair/same/uls/hNUA", "NUA Histogram;#phi (rad.);#eta;VtxZ;", o2::framework::HistType::kTH3D, {flowcorrectionGroup.ConfNUAPhiBins, flowcorrectionGroup.ConfNUAEtaBins, flowcorrectionGroup.ConfNUAZVtxBins}, true); |
651 | 673 | fRegistry.addClone("Pair/same/uls/", "Pair/same/lspp/"); |
652 | 674 | fRegistry.addClone("Pair/same/uls/", "Pair/same/lsmm/"); |
653 | 675 |
|
@@ -880,8 +902,24 @@ struct Dilepton { |
880 | 902 | } |
881 | 903 | } |
882 | 904 |
|
| 905 | + float getNUAweight(const int type_int, const float phi, const float eta, const float zVtx) |
| 906 | + { |
| 907 | + if (h3nua_weights.at(type_int) == nullptr) { |
| 908 | + return 1.f; |
| 909 | + } |
| 910 | + int binId_phi = h3nua_weights.at(type_int)->GetXaxis()->FindBin(phi); |
| 911 | + int binId_eta = h3nua_weights.at(type_int)->GetYaxis()->FindBin(eta); |
| 912 | + int binId_zVtx = h3nua_weights.at(type_int)->GetZaxis()->FindBin(zVtx); |
| 913 | + float nuaWeight = h3nua_weights.at(type_int)->GetBinContent(binId_phi, binId_eta, binId_zVtx); |
| 914 | + |
| 915 | + if (nuaWeight == 0 || std::isnan(nuaWeight) || std::isinf(nuaWeight)) { |
| 916 | + nuaWeight = 1.f; |
| 917 | + } |
| 918 | + return nuaWeight; |
| 919 | + } |
| 920 | + |
883 | 921 | template <int ev_id, typename TCollision, typename TTrack1, typename TTrack2, typename TCut, typename TAllTracks> |
884 | | - bool fillPairInfo(TCollision const& collision, TTrack1 const& t1, TTrack2 const& t2, TCut const& cut, TAllTracks const&, const std::vector<float> weightvector) |
| 922 | + bool fillPairInfo(TCollision const& collision, TTrack1 const& t1, TTrack2 const& t2, TCut const& cut, TAllTracks const&, const std::vector<float>& weightvector) |
885 | 923 | { |
886 | 924 | if constexpr (ev_id == 0) { |
887 | 925 | if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { |
@@ -1054,14 +1092,20 @@ struct Dilepton { |
1054 | 1092 |
|
1055 | 1093 | if constexpr (ev_id == 0) { |
1056 | 1094 | // LOGF(info, "collision.centFT0C() = %f, collision.trackOccupancyInTimeRange() = %d, getSPresolution = %f", collision.centFT0C(), collision.trackOccupancyInTimeRange(), getSPresolution(collision.centFT0C(), collision.trackOccupancyInTimeRange())); |
| 1095 | + if (flowcorrectionGroup.cfgApplyWeightNUA) { |
| 1096 | + weight *= 1. / getNUAweight(t1.sign() * t2.sign() < 0 ? 0 : (t1.sign() > 0 && t2.sign() > 0 ? 1 : 2), v12.Phi(), v12.Eta(), collision.posZ()); |
| 1097 | + } |
1057 | 1098 |
|
1058 | 1099 | float sp = RecoDecay::dotProd(std::array<float, 2>{static_cast<float>(std::cos(nmod * v12.Phi())), static_cast<float>(std::sin(nmod * v12.Phi()))}, qvectors[nmod][cfgQvecEstimator]) / getSPresolution(collision.centFT0C(), collision.trackOccupancyInTimeRange()); |
1059 | 1100 | if (t1.sign() * t2.sign() < 0) { // ULS |
1060 | 1101 | fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), sp, weight); |
| 1102 | + fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hNUA"), v12.Phi(), v12.Eta(), collision.posZ(), weight); |
1061 | 1103 | } else if (t1.sign() > 0 && t2.sign() > 0) { // LS++ |
1062 | 1104 | fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), sp, weight); |
| 1105 | + fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hNUA"), v12.Phi(), v12.Eta(), collision.posZ(), weight); |
1063 | 1106 | } else if (t1.sign() < 0 && t2.sign() < 0) { // LS-- |
1064 | 1107 | fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), sp, weight); |
| 1108 | + fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hNUA"), v12.Phi(), v12.Eta(), collision.posZ(), weight); |
1065 | 1109 | } |
1066 | 1110 | } else if constexpr (ev_id == 1) { |
1067 | 1111 | if (t1.sign() * t2.sign() < 0) { // ULS |
|
0 commit comments