|
45 | 45 | #include <TRandom3.h> |
46 | 46 |
|
47 | 47 | #include <cmath> |
| 48 | +#include <map> |
48 | 49 | #include <memory> |
49 | 50 | #include <string> |
50 | 51 | #include <unordered_map> |
| 52 | +#include <utility> |
51 | 53 | #include <vector> |
52 | 54 |
|
53 | 55 | using namespace o2; |
@@ -100,6 +102,7 @@ struct FlowTask { |
100 | 102 | O2_DEFINE_CONFIGURABLE(cfgNbootstrap, int, 30, "Number of subsamples") |
101 | 103 | O2_DEFINE_CONFIGURABLE(cfgOutputNUAWeights, bool, false, "Fill and output NUA weights") |
102 | 104 | O2_DEFINE_CONFIGURABLE(cfgOutputNUAWeightsRefPt, bool, false, "NUA weights are filled in ref pt bins") |
| 105 | + O2_DEFINE_CONFIGURABLE(cfgOutputNUAWeightsRunbyRun, bool, false, "NUA weights are filled run-by-run") |
103 | 106 | O2_DEFINE_CONFIGURABLE(cfgEfficiency, std::string, "", "CCDB path to efficiency object") |
104 | 107 | O2_DEFINE_CONFIGURABLE(cfgAcceptance, std::string, "", "CCDB path to acceptance object") |
105 | 108 | O2_DEFINE_CONFIGURABLE(cfgUseSmallMemory, bool, false, "Use small memory mode") |
@@ -198,6 +201,9 @@ struct FlowTask { |
198 | 201 | std::vector<GFW::CorrConfig> corrconfigsPtVn; |
199 | 202 | TAxis* fPtAxis; |
200 | 203 | TRandom3* fRndm = new TRandom3(0); |
| 204 | + int lastRunNumber = -1; |
| 205 | + std::vector<int> runNumbers; |
| 206 | + std::map<int, std::shared_ptr<TH3>> th3sPerRun; // map of TH3 histograms for all runs |
201 | 207 | enum CentEstimators { |
202 | 208 | kCentFT0C = 0, |
203 | 209 | kCentFT0CVariant1, |
@@ -478,7 +484,7 @@ struct FlowTask { |
478 | 484 | gfwConfigs.SetCorrs(cfgUserPtVnCorrConfig->GetCorrs()); |
479 | 485 | gfwConfigs.SetHeads(cfgUserPtVnCorrConfig->GetHeads()); |
480 | 486 | gfwConfigs.SetpTDifs(cfgUserPtVnCorrConfig->GetpTDifs()); |
481 | | - // Mask 1: vn-[pT], 2: vn-[pT^2], 4: vn-[pT^3] |
| 487 | + // Mask 1: vn-[pT], 3: vn-[pT^2], 7: vn-[pT^3], 15: vn-[pT^4] |
482 | 488 | gfwConfigs.SetpTCorrMasks(cfgUserPtVnCorrConfig->GetpTCorrMasks()); |
483 | 489 | gfwConfigs.Print(); |
484 | 490 | fFCpt->setUseCentralMoments(cfgUseCentralMoments); |
@@ -545,6 +551,13 @@ struct FlowTask { |
545 | 551 | } |
546 | 552 | } |
547 | 553 |
|
| 554 | + void createOutputObjectsForRun(int runNumber) |
| 555 | + { |
| 556 | + const AxisSpec axisPhi{60, 0.0, constants::math::TwoPI, "#varphi"}; |
| 557 | + std::shared_ptr<TH3> histPhiEtaVtxz = registry.add<TH3>(Form("%d/hPhiEtaVtxz", runNumber), ";#varphi;#eta;v_{z}", {HistType::kTH3D, {axisPhi, {64, -1.6, 1.6}, {40, -10, 10}}}); |
| 558 | + th3sPerRun.insert(std::make_pair(runNumber, histPhiEtaVtxz)); |
| 559 | + } |
| 560 | + |
548 | 561 | template <char... chars> |
549 | 562 | void fillProfile(const GFW::CorrConfig& corrconf, const ConstStr<chars...>& tarName, const double& cent) |
550 | 563 | { |
@@ -874,6 +887,20 @@ struct FlowTask { |
874 | 887 | return; |
875 | 888 | } |
876 | 889 | } |
| 890 | + if (cfgOutputNUAWeightsRunbyRun && currentRunNumber != lastRunNumber) { |
| 891 | + lastRunNumber = currentRunNumber; |
| 892 | + if (std::find(runNumbers.begin(), runNumbers.end(), currentRunNumber) == runNumbers.end()) { |
| 893 | + // if run number is not in the preconfigured list, create new output histograms for this run |
| 894 | + createOutputObjectsForRun(currentRunNumber); |
| 895 | + runNumbers.push_back(currentRunNumber); |
| 896 | + } |
| 897 | + |
| 898 | + if (th3sPerRun.find(currentRunNumber) == th3sPerRun.end()) { |
| 899 | + LOGF(fatal, "RunNumber %d not found in th3sPerRun", currentRunNumber); |
| 900 | + return; |
| 901 | + } |
| 902 | + } |
| 903 | + |
877 | 904 | registry.fill(HIST("hEventCount"), 2.5); |
878 | 905 | if (!cfgUseSmallMemory) { |
879 | 906 | registry.fill(HIST("BeforeCut_globalTracks_centT0C"), collision.centFT0C(), tracks.size()); |
@@ -975,10 +1002,15 @@ struct FlowTask { |
975 | 1002 | bool withinEtaGap08 = (std::abs(track.eta()) < cfgEtaPtPt); |
976 | 1003 | if (cfgOutputNUAWeights) { |
977 | 1004 | if (cfgOutputNUAWeightsRefPt) { |
978 | | - if (withinPtRef) |
| 1005 | + if (withinPtRef) { |
979 | 1006 | fWeights->fill(track.phi(), track.eta(), vtxz, track.pt(), cent, 0); |
| 1007 | + if (cfgOutputNUAWeightsRunbyRun) |
| 1008 | + th3sPerRun[currentRunNumber]->Fill(track.phi(), track.eta(), collision.posZ()); |
| 1009 | + } |
980 | 1010 | } else { |
981 | 1011 | fWeights->fill(track.phi(), track.eta(), vtxz, track.pt(), cent, 0); |
| 1012 | + if (cfgOutputNUAWeightsRunbyRun) |
| 1013 | + th3sPerRun[currentRunNumber]->Fill(track.phi(), track.eta(), collision.posZ()); |
982 | 1014 | } |
983 | 1015 | } |
984 | 1016 | if (!setCurrentParticleWeights(weff, wacc, track.phi(), track.eta(), track.pt(), vtxz)) |
|
0 commit comments