From ce8b2901584b4fcd85762b5f77ecc84ad35b6cf9 Mon Sep 17 00:00:00 2001 From: joachimckh Date: Mon, 3 Nov 2025 20:15:52 +0100 Subject: [PATCH 1/6] mean-pt shape selection tables --- Common/Core/FFitWeights.cxx | 138 +++++++++++++++++++--- Common/Core/FFitWeights.h | 22 +++- Common/DataModel/EseTable.h | 17 ++- Common/TableProducer/eseTableProducer.cxx | 121 ++++++++++++++++--- 4 files changed, 259 insertions(+), 39 deletions(-) diff --git a/Common/Core/FFitWeights.cxx b/Common/Core/FFitWeights.cxx index bc2623e7be9..866832050fb 100644 --- a/Common/Core/FFitWeights.cxx +++ b/Common/Core/FFitWeights.cxx @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -35,18 +36,22 @@ ClassImp(FFitWeights) FFitWeights::FFitWeights() : TNamed("", ""), fW_data{nullptr}, - CentBin{100}, + centBin{100}, qAxis{nullptr}, nResolution{3000}, + ptBin{100}, + ptAxis{nullptr}, qnTYPE{0} { } FFitWeights::FFitWeights(const char* name) : TNamed(name, name), fW_data{nullptr}, - CentBin{100}, + centBin{100}, qAxis{nullptr}, nResolution{3000}, + ptBin{100}, + ptAxis{nullptr}, qnTYPE{0} {} FFitWeights::~FFitWeights() @@ -54,6 +59,8 @@ FFitWeights::~FFitWeights() delete fW_data; if (qAxis) delete qAxis; + if (ptAxis) + delete ptAxis; }; void FFitWeights::init() @@ -65,8 +72,14 @@ void FFitWeights::init() if (!qAxis) this->setBinAxis(500, 0, 25); for (const auto& qn : qnTYPE) { - fW_data->Add(new TH2D(this->getQName(qn.first, qn.second.c_str()), this->getAxisName(qn.first, qn.second.c_str()), CentBin, 0, CentBin, qAxis->GetNbins(), qAxis->GetXmin(), qAxis->GetXmax())); + fW_data->Add(new TH2D(this->getQName(qn.first, qn.second.c_str()), this->getAxisName(qn.first, qn.second.c_str()), centBin, 0, centBin, qAxis->GetNbins(), qAxis->GetXmin(), qAxis->GetXmax())); } + + if (!ptAxis) + this->setPtAxis(3000, -3, 3); + //fW_data->Add(new TH2D("hPtWeight", "", centBin, 0, centBin, ptBin, ptAxis->GetXmin(), ptAxis->GetXmax())); + fW_data->Add(new TProfile("pMeanPt","", centBin, 0, centBin)); + fW_data->Add(new TH2D("hPtWeight", "", centBin, 0, centBin, ptBin, ptAxis->GetXmin(), ptAxis->GetXmax())); }; void FFitWeights::fillWeights(float centrality, float qn, int nh, const char* pf) @@ -79,11 +92,47 @@ void FFitWeights::fillWeights(float centrality, float qn, int nh, const char* pf TH2D* th2 = reinterpret_cast(tar->FindObject(this->getQName(nh, pf))); if (!th2) { - tar->Add(new TH2D(this->getQName(nh, pf), this->getAxisName(nh, pf), CentBin, 0, CentBin, qAxis->GetNbins(), qAxis->GetXmin(), qAxis->GetXmax())); + tar->Add(new TH2D(this->getQName(nh, pf), this->getAxisName(nh, pf), centBin, 0, centBin, qAxis->GetNbins(), qAxis->GetXmin(), qAxis->GetXmax())); th2 = reinterpret_cast(tar->At(tar->GetEntries() - 1)); } th2->Fill(centrality, qn); }; +void FFitWeights::fillPt(float centrality, float pt, bool first) +{ + TObjArray* tar{nullptr}; + tar = fW_data; + if (!tar) + return; + if (first) { + auto tp = reinterpret_cast(tar->FindObject("pMeanPt")); + if (!tp) { + tar->Add(new TProfile("pMeanPt", "", centBin, 0, centBin)); + tp = reinterpret_cast(tar->At(tar->GetEntries() - 1)); + } + tp->Fill(centrality, pt); + } + else { + auto th2 = reinterpret_cast(tar->FindObject("hPtWeight")); + if (!th2) { + tar->Add(new TH2D("hPtWeight", "", centBin, 0, centBin, ptBin, ptAxis->GetXmin(), ptAxis->GetXmax())); + th2 = reinterpret_cast(tar->At(tar->GetEntries() - 1)); + } + th2->Fill(centrality, pt); + } +}; +float FFitWeights::getPtMult(float centrality) +{ + TObjArray* tar{nullptr}; + tar = fW_data; + if (!tar) + return -1; + + auto tp = reinterpret_cast(tar->FindObject("pMeanPt")); + if (!tp) { + return -1; + } + return tp->GetBinContent(tp->FindBin(centrality)); +}; Long64_t FFitWeights::Merge(TCollection* collist) { @@ -93,10 +142,10 @@ Long64_t FFitWeights::Merge(TCollection* collist) fW_data->SetName("FFitWeights_Data"); fW_data->SetOwner(kTRUE); } - FFitWeights* l_w = 0; - TIter all_w(collist); - while ((l_w = (reinterpret_cast(all_w())))) { - addArray(fW_data, l_w->getDataArray()); + FFitWeights* lW= 0; + TIter allW(collist); + while ((lW= (reinterpret_cast(allW())))) { + addArray(fW_data, lW->getDataArray()); nmerged++; } return nmerged; @@ -104,7 +153,8 @@ Long64_t FFitWeights::Merge(TCollection* collist) void FFitWeights::addArray(TObjArray* targ, TObjArray* sour) { if (!sour) { - printf("Source array does not exist!\n"); + // printf("Source array does not exist!\n"); + //LOGF(info, "FFitWeights source array does not exist!"); return; } for (int i = 0; i < sour->GetEntries(); i++) { @@ -120,6 +170,34 @@ void FFitWeights::addArray(TObjArray* targ, TObjArray* sour) } }; +void FFitWeights::mptSel() +{ + TObjArray* tar{nullptr}; + tar = fW_data; + if (!tar) + return; + + TH2D* th2 = reinterpret_cast(tar->FindObject("hPtWeight")); + if (!th2) { + return; + } + + TH1D* tmp{nullptr}; + TGraph* tmpgr{nullptr}; + for (int iSP{0}; iSP < NumberSp; iSP++) { + tmp = th2->ProjectionY(Form("mpt_%i_%i", iSP, iSP + 1), iSP + 1, iSP + 1); + std::vector xq(nResolution); + std::vector yq(nResolution); + for (int i{0}; i < nResolution; i++) + xq[i] = static_cast(i + 1) / static_cast(nResolution); + tmp->GetQuantiles(nResolution, yq.data(), xq.data()); + tmpgr = new TGraph(nResolution, yq.data(), xq.data()); + tmpgr->SetName(Form("sp_mpt_%i", iSP)); + fW_data->Add(tmpgr); + } + +} + void FFitWeights::qSelection(const std::vector& nhv, const std::vector& stv) /* only execute OFFLINE */ { TObjArray* tar{nullptr}; @@ -132,14 +210,15 @@ void FFitWeights::qSelection(const std::vector& nhv, const std::vector(tar->FindObject(this->getQName(nh, pf.c_str())))}; if (!th2) { - printf("qh not found!\n"); + //printf("qh not found!\n"); + //LOGF(info, "FFitWeights qh not found!"); return; } TH1D* tmp{nullptr}; TGraph* tmpgr{nullptr}; // TSpline3* spline = nullptr; - for (int iSP{0}; iSP < 90; iSP++) { + for (int iSP{0}; iSP < NumberSp; iSP++) { tmp = th2->ProjectionY(Form("q%i_%i_%i", nh, iSP, iSP + 1), iSP + 1, iSP + 1); std::vector xq(nResolution); std::vector yq(nResolution); @@ -161,11 +240,12 @@ float FFitWeights::eval(float centr, const float& dqn, const int nh, const char* TObjArray* tar{nullptr}; tar = fW_data; - if (!tar) + if (!tar) { return -1; + } int isp{static_cast(centr)}; - if (isp < 0 || isp > 90) { + if (isp < 0 || isp > NumberSp) { return -1; } @@ -175,10 +255,36 @@ float FFitWeights::eval(float centr, const float& dqn, const int nh, const char* return -1; } - float qn_val{static_cast(100. * spline->Eval(dqn))}; - if (qn_val < 0 || qn_val > 100.05) { + float qnVal{static_cast(100. * spline->Eval(dqn))}; + if (qnVal < 0 || qnVal > MaxTol) { return -1; } - return qn_val; + return qnVal; }; + +float FFitWeights::evalPt(float centr, const float& mpt) +{ + TObjArray* tar{nullptr}; + tar = fW_data; + if (!tar) { + return -1; + } + + int isp{static_cast(centr)}; + if (isp < 0 || isp > NumberSp) { + return -1; + } + + TGraph* spline{nullptr}; + spline = reinterpret_cast(tar->FindObject(Form("sp_mpt_%i", isp))); + if (!spline) { + return -1; + } + float ptVal{static_cast(100. * spline->Eval(mpt))}; + if (ptVal < 0 || ptVal > MaxTol) { + return -1; + } + return ptVal; +}; + diff --git a/Common/Core/FFitWeights.h b/Common/Core/FFitWeights.h index 155fd9af97f..5fd454b490d 100644 --- a/Common/Core/FFitWeights.h +++ b/Common/Core/FFitWeights.h @@ -39,28 +39,43 @@ class FFitWeights : public TNamed void init(); void fillWeights(float centrality, float qn, int nh, const char* pf = ""); + void fillPt(float centrality, float pt, bool first); + float getPtMult(float centrality); TObjArray* getDataArray() { return fW_data; } - void setCentBin(int bin) { CentBin = bin; } + void setCentBin(int bin) { centBin = bin; } void setBinAxis(int bin, float min, float max) { qAxis = new TAxis(bin, min, max); } TAxis* getqVecAx() { return qAxis; } + void setPtBin(int bin) { ptBin = bin; } + void setPtAxis(int bin, float min, float max) + { + ptAxis = new TAxis(bin, min, max); + } + TAxis* getPtAx() { return ptAxis; } + Long64_t Merge(TCollection* collist); void qSelection(const std::vector& nhv, const std::vector& stv); float eval(float centr, const float& dqn, const int nh, const char* pf = ""); + float evalPt(float centr, const float& mpt); void setResolution(int res) { nResolution = res; } int getResolution() const { return nResolution; } void setQnType(const std::vector>& qninp) { qnTYPE = qninp; } + void mptSel(); + + private: TObjArray* fW_data; - int CentBin; + int centBin; TAxis* qAxis; //! int nResolution; + int ptBin; + TAxis* ptAxis; //! std::vector> qnTYPE; @@ -74,6 +89,9 @@ class FFitWeights : public TNamed }; void addArray(TObjArray* targ, TObjArray* sour); + static constexpr int NumberSp = 90; + static constexpr float MaxTol = 100.05; + ClassDef(FFitWeights, 1); // calibration class }; #endif // COMMON_CORE_FFITWEIGHTS_H_ diff --git a/Common/DataModel/EseTable.h b/Common/DataModel/EseTable.h index 8463848312f..6fd18b1bde5 100644 --- a/Common/DataModel/EseTable.h +++ b/Common/DataModel/EseTable.h @@ -9,9 +9,10 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -// q vector framework with ESE (20/08/2024) -// -/// \author Joachim Hansen +/// \file EseTable.h +/// \brief ESE Framework (20/08/2024) +/// \author Joachim C. K. B. Hansen, Lund University, joachim.hansen@cern.ch + // #ifndef COMMON_DATAMODEL_ESETABLE_H_ @@ -46,6 +47,16 @@ using QPercentileTPCall = QPercentileTPCalls::iterator; using QPercentileTPCneg = QPercentileTPCnegs::iterator; using QPercentileTPCpos = QPercentileTPCposs::iterator; +namespace meanptshape +{ +DECLARE_SOA_COLUMN(FMEANPT, fMEANPT, std::vector); +DECLARE_SOA_COLUMN(FMEANPTSHAPE, fMEANPTSHAPE, std::vector); +} +DECLARE_SOA_TABLE(MeanPts, "AOD", "MEANPT", meanptshape::FMEANPT); +DECLARE_SOA_TABLE(MeanPtShapes, "AOD", "MEANPTSHAPE", meanptshape::FMEANPTSHAPE); +using MeanPt = MeanPts::iterator; +using MeanPtShape = MeanPtShapes::iterator; + } // namespace o2::aod #endif // COMMON_DATAMODEL_ESETABLE_H_ diff --git a/Common/TableProducer/eseTableProducer.cxx b/Common/TableProducer/eseTableProducer.cxx index 877815873e8..0f47e360093 100644 --- a/Common/TableProducer/eseTableProducer.cxx +++ b/Common/TableProducer/eseTableProducer.cxx @@ -22,6 +22,9 @@ #include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/Qvectors.h" +#include "Common/Core/TrackSelection.h" +#include "Common/DataModel/TrackSelectionTables.h" + #include #include #include @@ -58,10 +61,15 @@ struct EseTableProducer { Produces qPercsTPCneg; Produces qPercsTPCpos; - OutputObj FFitObj{FFitWeights("weights")}; + Produces meanPts; + Produces meanPtShapes; + + + OutputObj weightsFFit{FFitWeights("weights")}; HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; Configurable cfgESE{"cfgESE", 1, "ese activation step: false = no ese, true = evaluate qSelection and fill table"}; + Configurable cfgMeanPt{"cfgMeanPt", 0, "lvl, 0: First profile, 1: Second profile, 2: fill table"}; Configurable cfgEsePath{"cfgEsePath", "Users/j/joachiha/ESE/local/ffitsplines", "CCDB path for ese splines"}; Configurable> cfgDetectors{"cfgDetectors", {"FT0C"}, "detectors to loop over: ['FT0C', 'FT0A', 'FV0A', 'TPCall', 'TPCneg', 'TPCpos']"}; Configurable> cfgLoopHarmonics{"cfgLoopHarmonics", {2, 3}, "Harmonics to loop over when filling and evaluating q-Selection"}; @@ -74,6 +82,11 @@ struct EseTableProducer { int runNumber{-1}; + static constexpr float ThresholdAmplitude{1e-8f}; + static constexpr int Step1{1}; + static constexpr int Step2{2}; + + enum class DetID { FT0C, FT0A, FT0M, @@ -91,10 +104,26 @@ struct EseTableProducer { {"TPCneg", DetID::TPCneg}, {"TPCall", DetID::TPCall}}; - FFitWeights* qSelection{nullptr}; + FFitWeights* eventShape{nullptr}; Service ccdb; + + Configurable cfgVtxZ{"cfgVtxZ", 10.0f, "max z vertex position"}; + Configurable cfgEta{"cfgEta", 0.8f, "max eta"}; + Configurable cfgPtmin{"cfgPtmin", 0.2f, "min pt"}; + Configurable cfgPtmax{"cfgPtmax", 5.0f, "max pt"}; + Configurable cfgChi2PrITSCls{"cfgChi2PrITSCls", 4.0f, "max chi2 per ITS cluster"}; + Configurable cfgChi2PrTPCCls{"cfgChi2PrTPCCls", 2.5f, "max chi2 per TPC cluster"}; + Configurable cfgDCAz{"cfgDCAz", 2.0f, "max DCAz cut"}; + + o2::framework::expressions::Filter collisionFilter = nabs(aod::collision::posZ) < cfgVtxZ; + o2::framework::expressions::Filter trackFilter = nabs(aod::track::eta) < cfgEta && aod::track::pt > cfgPtmin&& aod::track::pt < cfgPtmax && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == static_cast(true))) && (aod::track::itsChi2NCl < cfgChi2PrITSCls) && (aod::track::tpcChi2NCl < cfgChi2PrTPCCls) && nabs(aod::track::dcaZ) < cfgDCAz; + + Preslice perCollision = aod::track::collisionId; + using GFWTracks = soa::Filtered>; + + void init(o2::framework::InitContext&) { @@ -102,6 +131,7 @@ struct EseTableProducer { registry.add("hEventCounter", "event status;event status;entries", {HistType::kTH1F, {{4, 0.0, 4.0}}}); registry.add("hESEstat", "ese status;ese status;entries", {HistType::kTH1F, {{4, 0.0, 4.0}}}); + registry.add("hMeanPtStat", "", {HistType::kTH1F, {{4, 0.0, 4.0}}}); ccdb->setURL("http://alice-ccdb.cern.ch"); ccdb->setCaching(true); @@ -116,10 +146,10 @@ struct EseTableProducer { veccfg.push_back({cfgLoopHarmonics->at(i), cfgDetectors->at(j)}); } } - FFitObj->setBinAxis(cfgaxisqn->at(0), cfgaxisqn->at(1), cfgaxisqn->at(2)); - FFitObj->setResolution(cfgnResolution); - FFitObj->setQnType(veccfg); - FFitObj->init(); + weightsFFit->setBinAxis(cfgaxisqn->at(0), cfgaxisqn->at(1), cfgaxisqn->at(2)); + weightsFFit->setResolution(cfgnResolution); + weightsFFit->setQnType(veccfg); + weightsFFit->init(); } void initCCDB(aod::BCsWithTimestamps::iterator const& bc) @@ -128,20 +158,20 @@ struct EseTableProducer { auto timestamp = bc.timestamp(); if (cfgESE) { - qSelection = ccdb->getForTimeStamp(cfgEsePath, timestamp); - if (!qSelection) + eventShape = ccdb->getForTimeStamp(cfgEsePath, timestamp); + if (!eventShape) LOGF(fatal, "failed loading qSelection with ese flag"); LOGF(info, "successfully loaded qSelection"); } } - float Calcqn(const float& Qx, const float& Qy, const float& Mult) + float calcRedqn(const float& Qx, const float& Qy, const float& Mult) { float dqn{0.0f}; float qn{0.0f}; dqn = Qx * Qx + Qy * Qy; - qn = TMath::Sqrt(dqn) / TMath::Sqrt(Mult); + qn = std::sqrt(dqn) / std::sqrt(Mult); return qn; } @@ -168,11 +198,11 @@ struct EseTableProducer { void doSpline(float& splineVal, const float& centr, const float& nHarm, const char* pf, const auto& QX, const auto& QY, const auto& sumAmpl) { - if (sumAmpl > 1e-8) { - float qnval = Calcqn(QX * sumAmpl, QY * sumAmpl, sumAmpl); - FFitObj->fillWeights(centr, qnval, nHarm, pf); + if (sumAmpl > ThresholdAmplitude) { + float qnval = calcRedqn(QX * sumAmpl, QY * sumAmpl, sumAmpl); + weightsFFit->fillWeights(centr, qnval, nHarm, pf); if (cfgESE) { - splineVal = qSelection->eval(centr, qnval, nHarm, pf); + splineVal = eventShape->eval(centr, qnval, nHarm, pf); } } } @@ -182,10 +212,10 @@ struct EseTableProducer { { const int detId = detIDN(id); const int detInd{detId * 4 + cfgnTotalSystem * 4 * (nHarm - 2)}; - const auto Qx{col.qvecRe()[detInd + cfgnCorrLevel]}; - const auto Qy{col.qvecIm()[detInd + cfgnCorrLevel]}; + const auto fQx{col.qvecRe()[detInd + cfgnCorrLevel]}; + const auto fQy{col.qvecIm()[detInd + cfgnCorrLevel]}; const auto sumAmpl{col.qvecAmp()[detId]}; - return {Qx, Qy, sumAmpl}; + return {fQx, fQy, sumAmpl}; } template @@ -230,6 +260,21 @@ struct EseTableProducer { } }; + + template + double calculateMeanPt(TTracks const& tracks, Cent const& centrality) + { + std::vector meanPtEvent; + for (const auto& track : tracks) + { + meanPtEvent.push_back(track.pt()); + weightsFFit->fillPt(centrality, track.pt(), true); + } + if (meanPtEvent.empty()) return 0.0; + auto mean = std::accumulate(meanPtEvent.begin(), meanPtEvent.end(), 0.0) / meanPtEvent.size(); + return mean; + } + void processESE(CollWithMults::iterator const& collision, aod::BCsWithTimestamps const&, aod::FV0As const&, aod::FT0s const&) { float counter{0.5}; @@ -259,6 +304,46 @@ struct EseTableProducer { qPercsTPCpos(qnpTPCpos); registry.fill(HIST("hEventCounter"), counter++); } - PROCESS_SWITCH(EseTableProducer, processESE, "proccess q vectors to calculate reduced q-vector", true); + PROCESS_SWITCH(EseTableProducer, processESE, "process q vectors to calculate reduced q-vector", true); + + void processMeanPt(soa::Filtered>::iterator const& collision, aod::BCsWithTimestamps const&, GFWTracks const& tracks) { + + std::vector meanPt{ -1 }; + std::vector meanPtShape{ -1 }; + + registry.fill(HIST("hMeanPtStat"), 0.5); + const auto centrality = collision.centFT0C(); + const auto mean = calculateMeanPt(tracks, centrality); + + if (cfgMeanPt == 0) { + registry.fill(HIST("hMeanPtStat"), 1.5); + } + else { + const auto avgpt = eventShape->getPtMult(centrality); + if (mean == 0.0) { + registry.fill(HIST("hMeanPtStat"), cfgMeanPt == Step1 ? 2.5 : 3.5); + } + else { + const auto binval = (mean - avgpt) / avgpt; + weightsFFit->fillPt(centrality, binval, false); + meanPt[0] = binval; + + if (cfgMeanPt == Step1) { + registry.fill(HIST("hMeanPtStat"), 2.5); + } + else if (cfgMeanPt == Step2) { + registry.fill(HIST("hMeanPtStat"), 3.5); + const auto value = eventShape->evalPt(centrality, binval); + meanPtShape[0] = value; + } + } + } + + meanPts(meanPt); + meanPtShapes(meanPtShape); + + } + PROCESS_SWITCH(EseTableProducer, processMeanPt, "process mean pt selection", false); + }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc)}; } From fa620caf6516c4b6ca4ebc9ff4cd99382405f047 Mon Sep 17 00:00:00 2001 From: joachimckh Date: Mon, 3 Nov 2025 20:17:53 +0100 Subject: [PATCH 2/6] format --- Common/Core/FFitWeights.cxx | 21 +++--- Common/Core/FFitWeights.h | 1 - Common/DataModel/EseTable.h | 4 +- Common/TableProducer/eseTableProducer.cxx | 78 ++++++++++------------- 4 files changed, 45 insertions(+), 59 deletions(-) diff --git a/Common/Core/FFitWeights.cxx b/Common/Core/FFitWeights.cxx index 866832050fb..ad5757f6f81 100644 --- a/Common/Core/FFitWeights.cxx +++ b/Common/Core/FFitWeights.cxx @@ -19,9 +19,9 @@ #include #include #include -#include #include #include +#include #include #include @@ -77,8 +77,8 @@ void FFitWeights::init() if (!ptAxis) this->setPtAxis(3000, -3, 3); - //fW_data->Add(new TH2D("hPtWeight", "", centBin, 0, centBin, ptBin, ptAxis->GetXmin(), ptAxis->GetXmax())); - fW_data->Add(new TProfile("pMeanPt","", centBin, 0, centBin)); + // fW_data->Add(new TH2D("hPtWeight", "", centBin, 0, centBin, ptBin, ptAxis->GetXmin(), ptAxis->GetXmax())); + fW_data->Add(new TProfile("pMeanPt", "", centBin, 0, centBin)); fW_data->Add(new TH2D("hPtWeight", "", centBin, 0, centBin, ptBin, ptAxis->GetXmin(), ptAxis->GetXmax())); }; @@ -110,8 +110,7 @@ void FFitWeights::fillPt(float centrality, float pt, bool first) tp = reinterpret_cast(tar->At(tar->GetEntries() - 1)); } tp->Fill(centrality, pt); - } - else { + } else { auto th2 = reinterpret_cast(tar->FindObject("hPtWeight")); if (!th2) { tar->Add(new TH2D("hPtWeight", "", centBin, 0, centBin, ptBin, ptAxis->GetXmin(), ptAxis->GetXmax())); @@ -142,9 +141,9 @@ Long64_t FFitWeights::Merge(TCollection* collist) fW_data->SetName("FFitWeights_Data"); fW_data->SetOwner(kTRUE); } - FFitWeights* lW= 0; + FFitWeights* lW = 0; TIter allW(collist); - while ((lW= (reinterpret_cast(allW())))) { + while ((lW = (reinterpret_cast(allW())))) { addArray(fW_data, lW->getDataArray()); nmerged++; } @@ -154,7 +153,7 @@ void FFitWeights::addArray(TObjArray* targ, TObjArray* sour) { if (!sour) { // printf("Source array does not exist!\n"); - //LOGF(info, "FFitWeights source array does not exist!"); + // LOGF(info, "FFitWeights source array does not exist!"); return; } for (int i = 0; i < sour->GetEntries(); i++) { @@ -195,7 +194,6 @@ void FFitWeights::mptSel() tmpgr->SetName(Form("sp_mpt_%i", iSP)); fW_data->Add(tmpgr); } - } void FFitWeights::qSelection(const std::vector& nhv, const std::vector& stv) /* only execute OFFLINE */ @@ -210,8 +208,8 @@ void FFitWeights::qSelection(const std::vector& nhv, const std::vector(tar->FindObject(this->getQName(nh, pf.c_str())))}; if (!th2) { - //printf("qh not found!\n"); - //LOGF(info, "FFitWeights qh not found!"); + // printf("qh not found!\n"); + // LOGF(info, "FFitWeights qh not found!"); return; } @@ -287,4 +285,3 @@ float FFitWeights::evalPt(float centr, const float& mpt) } return ptVal; }; - diff --git a/Common/Core/FFitWeights.h b/Common/Core/FFitWeights.h index 5fd454b490d..aa5a22609c5 100644 --- a/Common/Core/FFitWeights.h +++ b/Common/Core/FFitWeights.h @@ -67,7 +67,6 @@ class FFitWeights : public TNamed void mptSel(); - private: TObjArray* fW_data; diff --git a/Common/DataModel/EseTable.h b/Common/DataModel/EseTable.h index 6fd18b1bde5..d78c783e12a 100644 --- a/Common/DataModel/EseTable.h +++ b/Common/DataModel/EseTable.h @@ -10,7 +10,7 @@ // or submit itself to any jurisdiction. /// \file EseTable.h -/// \brief ESE Framework (20/08/2024) +/// \brief ESE Framework (20/08/2024) /// \author Joachim C. K. B. Hansen, Lund University, joachim.hansen@cern.ch // @@ -51,7 +51,7 @@ namespace meanptshape { DECLARE_SOA_COLUMN(FMEANPT, fMEANPT, std::vector); DECLARE_SOA_COLUMN(FMEANPTSHAPE, fMEANPTSHAPE, std::vector); -} +} // namespace meanptshape DECLARE_SOA_TABLE(MeanPts, "AOD", "MEANPT", meanptshape::FMEANPT); DECLARE_SOA_TABLE(MeanPtShapes, "AOD", "MEANPTSHAPE", meanptshape::FMEANPTSHAPE); using MeanPt = MeanPts::iterator; diff --git a/Common/TableProducer/eseTableProducer.cxx b/Common/TableProducer/eseTableProducer.cxx index 0f47e360093..bc863b71aa7 100644 --- a/Common/TableProducer/eseTableProducer.cxx +++ b/Common/TableProducer/eseTableProducer.cxx @@ -16,13 +16,12 @@ #include "FFitWeights.h" +#include "Common/Core/TrackSelection.h" #include "Common/DataModel/Centrality.h" #include "Common/DataModel/EseTable.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/Qvectors.h" - -#include "Common/Core/TrackSelection.h" #include "Common/DataModel/TrackSelectionTables.h" #include @@ -64,7 +63,6 @@ struct EseTableProducer { Produces meanPts; Produces meanPtShapes; - OutputObj weightsFFit{FFitWeights("weights")}; HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; @@ -86,7 +84,6 @@ struct EseTableProducer { static constexpr int Step1{1}; static constexpr int Step2{2}; - enum class DetID { FT0C, FT0A, FT0M, @@ -108,7 +105,6 @@ struct EseTableProducer { Service ccdb; - Configurable cfgVtxZ{"cfgVtxZ", 10.0f, "max z vertex position"}; Configurable cfgEta{"cfgEta", 0.8f, "max eta"}; Configurable cfgPtmin{"cfgPtmin", 0.2f, "min pt"}; @@ -119,11 +115,10 @@ struct EseTableProducer { o2::framework::expressions::Filter collisionFilter = nabs(aod::collision::posZ) < cfgVtxZ; o2::framework::expressions::Filter trackFilter = nabs(aod::track::eta) < cfgEta && aod::track::pt > cfgPtmin&& aod::track::pt < cfgPtmax && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == static_cast(true))) && (aod::track::itsChi2NCl < cfgChi2PrITSCls) && (aod::track::tpcChi2NCl < cfgChi2PrTPCCls) && nabs(aod::track::dcaZ) < cfgDCAz; - + Preslice perCollision = aod::track::collisionId; using GFWTracks = soa::Filtered>; - void init(o2::framework::InitContext&) { @@ -260,17 +255,16 @@ struct EseTableProducer { } }; - template double calculateMeanPt(TTracks const& tracks, Cent const& centrality) { std::vector meanPtEvent; - for (const auto& track : tracks) - { + for (const auto& track : tracks) { meanPtEvent.push_back(track.pt()); weightsFFit->fillPt(centrality, track.pt(), true); } - if (meanPtEvent.empty()) return 0.0; + if (meanPtEvent.empty()) + return 0.0; auto mean = std::accumulate(meanPtEvent.begin(), meanPtEvent.end(), 0.0) / meanPtEvent.size(); return mean; } @@ -306,44 +300,40 @@ struct EseTableProducer { } PROCESS_SWITCH(EseTableProducer, processESE, "process q vectors to calculate reduced q-vector", true); - void processMeanPt(soa::Filtered>::iterator const& collision, aod::BCsWithTimestamps const&, GFWTracks const& tracks) { - - std::vector meanPt{ -1 }; - std::vector meanPtShape{ -1 }; - - registry.fill(HIST("hMeanPtStat"), 0.5); - const auto centrality = collision.centFT0C(); - const auto mean = calculateMeanPt(tracks, centrality); - - if (cfgMeanPt == 0) { - registry.fill(HIST("hMeanPtStat"), 1.5); - } - else { - const auto avgpt = eventShape->getPtMult(centrality); - if (mean == 0.0) { - registry.fill(HIST("hMeanPtStat"), cfgMeanPt == Step1 ? 2.5 : 3.5); - } - else { - const auto binval = (mean - avgpt) / avgpt; - weightsFFit->fillPt(centrality, binval, false); - meanPt[0] = binval; + void processMeanPt(soa::Filtered>::iterator const& collision, aod::BCsWithTimestamps const&, GFWTracks const& tracks) + { - if (cfgMeanPt == Step1) { - registry.fill(HIST("hMeanPtStat"), 2.5); - } - else if (cfgMeanPt == Step2) { - registry.fill(HIST("hMeanPtStat"), 3.5); - const auto value = eventShape->evalPt(centrality, binval); - meanPtShape[0] = value; + std::vector meanPt{-1}; + std::vector meanPtShape{-1}; + + registry.fill(HIST("hMeanPtStat"), 0.5); + const auto centrality = collision.centFT0C(); + const auto mean = calculateMeanPt(tracks, centrality); + + if (cfgMeanPt == 0) { + registry.fill(HIST("hMeanPtStat"), 1.5); + } else { + const auto avgpt = eventShape->getPtMult(centrality); + if (mean == 0.0) { + registry.fill(HIST("hMeanPtStat"), cfgMeanPt == Step1 ? 2.5 : 3.5); + } else { + const auto binval = (mean - avgpt) / avgpt; + weightsFFit->fillPt(centrality, binval, false); + meanPt[0] = binval; + + if (cfgMeanPt == Step1) { + registry.fill(HIST("hMeanPtStat"), 2.5); + } else if (cfgMeanPt == Step2) { + registry.fill(HIST("hMeanPtStat"), 3.5); + const auto value = eventShape->evalPt(centrality, binval); + meanPtShape[0] = value; + } } } - } - - meanPts(meanPt); - meanPtShapes(meanPtShape); + meanPts(meanPt); + meanPtShapes(meanPtShape); } PROCESS_SWITCH(EseTableProducer, processMeanPt, "process mean pt selection", false); - }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc)}; } From 909cb6f259ca451c77983b9d983cbb39c3dd9a18 Mon Sep 17 00:00:00 2001 From: joachimckh Date: Wed, 5 Nov 2025 09:43:06 +0100 Subject: [PATCH 3/6] Update eseTable to be joinable with centrality --- Common/TableProducer/eseTableProducer.cxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Common/TableProducer/eseTableProducer.cxx b/Common/TableProducer/eseTableProducer.cxx index bc863b71aa7..edde600771c 100644 --- a/Common/TableProducer/eseTableProducer.cxx +++ b/Common/TableProducer/eseTableProducer.cxx @@ -113,7 +113,7 @@ struct EseTableProducer { Configurable cfgChi2PrTPCCls{"cfgChi2PrTPCCls", 2.5f, "max chi2 per TPC cluster"}; Configurable cfgDCAz{"cfgDCAz", 2.0f, "max DCAz cut"}; - o2::framework::expressions::Filter collisionFilter = nabs(aod::collision::posZ) < cfgVtxZ; + // o2::framework::expressions::Filter collisionFilter = nabs(aod::collision::posZ) < cfgVtxZ; o2::framework::expressions::Filter trackFilter = nabs(aod::track::eta) < cfgEta && aod::track::pt > cfgPtmin&& aod::track::pt < cfgPtmax && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == static_cast(true))) && (aod::track::itsChi2NCl < cfgChi2PrITSCls) && (aod::track::tpcChi2NCl < cfgChi2PrTPCCls) && nabs(aod::track::dcaZ) < cfgDCAz; Preslice perCollision = aod::track::collisionId; @@ -300,11 +300,16 @@ struct EseTableProducer { } PROCESS_SWITCH(EseTableProducer, processESE, "process q vectors to calculate reduced q-vector", true); - void processMeanPt(soa::Filtered>::iterator const& collision, aod::BCsWithTimestamps const&, GFWTracks const& tracks) + void processMeanPt(soa::Join::iterator const& collision, aod::BCsWithTimestamps const&, GFWTracks const& tracks) { std::vector meanPt{-1}; std::vector meanPtShape{-1}; + if (collision.posZ() < -cfgVtxZ || collision.posZ() > cfgVtxZ) { + meanPts(meanPt); + meanPtShapes(meanPtShape); + return; + } registry.fill(HIST("hMeanPtStat"), 0.5); const auto centrality = collision.centFT0C(); From 87a59ef0c1e51a7fd272494b8170a5335fcb22c4 Mon Sep 17 00:00:00 2001 From: joachimckh Date: Fri, 7 Nov 2025 20:26:57 +0100 Subject: [PATCH 4/6] address comments, do tests and fix TMerge for TProfile --- Common/Core/FFitWeights.cxx | 124 ++++++++-------------- Common/Core/FFitWeights.h | 6 ++ Common/TableProducer/eseTableProducer.cxx | 1 - 3 files changed, 49 insertions(+), 82 deletions(-) diff --git a/Common/Core/FFitWeights.cxx b/Common/Core/FFitWeights.cxx index ad5757f6f81..45136149827 100644 --- a/Common/Core/FFitWeights.cxx +++ b/Common/Core/FFitWeights.cxx @@ -16,12 +16,12 @@ #include "FFitWeights.h" +#include "Framework/Logger.h" + #include #include -#include #include #include -#include #include #include @@ -36,6 +36,8 @@ ClassImp(FFitWeights) FFitWeights::FFitWeights() : TNamed("", ""), fW_data{nullptr}, + ptProfCent{nullptr}, + h2ptCent{nullptr}, centBin{100}, qAxis{nullptr}, nResolution{3000}, @@ -47,6 +49,8 @@ ClassImp(FFitWeights) FFitWeights::FFitWeights(const char* name) : TNamed(name, name), fW_data{nullptr}, + ptProfCent{nullptr}, + h2ptCent{nullptr}, centBin{100}, qAxis{nullptr}, nResolution{3000}, @@ -77,9 +81,11 @@ void FFitWeights::init() if (!ptAxis) this->setPtAxis(3000, -3, 3); - // fW_data->Add(new TH2D("hPtWeight", "", centBin, 0, centBin, ptBin, ptAxis->GetXmin(), ptAxis->GetXmax())); fW_data->Add(new TProfile("pMeanPt", "", centBin, 0, centBin)); fW_data->Add(new TH2D("hPtWeight", "", centBin, 0, centBin, ptBin, ptAxis->GetXmin(), ptAxis->GetXmax())); + + ptProfCent = reinterpret_cast(fW_data->FindObject("pMeanPt")); + h2ptCent = reinterpret_cast(fW_data->FindObject("hPtWeight")); }; void FFitWeights::fillWeights(float centrality, float qn, int nh, const char* pf) @@ -97,40 +103,21 @@ void FFitWeights::fillWeights(float centrality, float qn, int nh, const char* pf } th2->Fill(centrality, qn); }; + void FFitWeights::fillPt(float centrality, float pt, bool first) { - TObjArray* tar{nullptr}; - tar = fW_data; - if (!tar) - return; if (first) { - auto tp = reinterpret_cast(tar->FindObject("pMeanPt")); - if (!tp) { - tar->Add(new TProfile("pMeanPt", "", centBin, 0, centBin)); - tp = reinterpret_cast(tar->At(tar->GetEntries() - 1)); - } - tp->Fill(centrality, pt); + ptProfCent->Fill(centrality, pt); } else { - auto th2 = reinterpret_cast(tar->FindObject("hPtWeight")); - if (!th2) { - tar->Add(new TH2D("hPtWeight", "", centBin, 0, centBin, ptBin, ptAxis->GetXmin(), ptAxis->GetXmax())); - th2 = reinterpret_cast(tar->At(tar->GetEntries() - 1)); - } - th2->Fill(centrality, pt); + h2ptCent->Fill(centrality, pt); } }; float FFitWeights::getPtMult(float centrality) { - TObjArray* tar{nullptr}; - tar = fW_data; - if (!tar) - return -1; - - auto tp = reinterpret_cast(tar->FindObject("pMeanPt")); - if (!tp) { - return -1; + if (!ptProfCent) { + ptProfCent = reinterpret_cast(fW_data->FindObject("pMeanPt")); } - return tp->GetBinContent(tp->FindBin(centrality)); + return ptProfCent->GetBinContent(ptProfCent->FindBin(centrality)); }; Long64_t FFitWeights::Merge(TCollection* collist) @@ -151,23 +138,26 @@ Long64_t FFitWeights::Merge(TCollection* collist) }; void FFitWeights::addArray(TObjArray* targ, TObjArray* sour) { - if (!sour) { - // printf("Source array does not exist!\n"); - // LOGF(info, "FFitWeights source array does not exist!"); + if (!sour) return; - } + for (int i = 0; i < sour->GetEntries(); i++) { - TH2D* sourh = reinterpret_cast(sour->At(i)); - TH2D* targh = reinterpret_cast(targ->FindObject(sourh->GetName())); - if (!targh) { - targh = reinterpret_cast(sourh->Clone(sourh->GetName())); - targh->SetDirectory(0); - targ->Add(targh); - } else { - targh->Add(sourh); + auto* obj = sour->At(i); + if (!obj) + continue; + + auto* tObj = targ->FindObject(obj->GetName()); + if (!tObj) { + auto* clone = static_cast(obj->Clone(obj->GetName())); + if (auto* h = dynamic_cast(clone)) + h->SetDirectory(0); + targ->Add(clone); + } else if (auto* h1 = dynamic_cast(tObj)) { + if (auto* h2 = dynamic_cast(obj)) + h1->Add(h2); } } -}; +} void FFitWeights::mptSel() { @@ -208,8 +198,7 @@ void FFitWeights::qSelection(const std::vector& nhv, const std::vector(tar->FindObject(this->getQName(nh, pf.c_str())))}; if (!th2) { - // printf("qh not found!\n"); - // LOGF(info, "FFitWeights qh not found!"); + LOGF(info, "FFitWeights qh not found!"); return; } @@ -225,63 +214,36 @@ void FFitWeights::qSelection(const std::vector& nhv, const std::vectorGetQuantiles(nResolution, yq.data(), xq.data()); tmpgr = new TGraph(nResolution, yq.data(), xq.data()); tmpgr->SetName(Form("sp_q%i%s_%i", nh, pf.c_str(), iSP)); - // spline = new TSpline3(Form("sp_q%i%s_%i", nh, pf.c_str(), iSP), tmpgr); - // spline->SetName(Form("sp_q%i%s_%i", nh, pf.c_str(), iSP)); fW_data->Add(tmpgr); } } } }; - -float FFitWeights::eval(float centr, const float& dqn, const int nh, const char* pf) +float FFitWeights::internalEval(float centr, const float& val, const char* name) { - TObjArray* tar{nullptr}; - - tar = fW_data; - if (!tar) { + if (!fW_data) { return -1; } - - int isp{static_cast(centr)}; + int isp = static_cast(centr); if (isp < 0 || isp > NumberSp) { return -1; } - TGraph* spline{nullptr}; - spline = reinterpret_cast(tar->FindObject(Form("sp_q%i%s_%i", nh, pf, isp))); + auto* spline = dynamic_cast(fW_data->FindObject(Form(name, isp))); if (!spline) { return -1; } - float qnVal{static_cast(100. * spline->Eval(dqn))}; - if (qnVal < 0 || qnVal > MaxTol) { - return -1; - } + float perc = 100.f * spline->Eval(val); + return (perc < 0 || perc > MaxTol) ? -1 : perc; +}; - return qnVal; +float FFitWeights::eval(float centr, const float& dqn, int nh, const char* pf) +{ + return internalEval(centr, dqn, Form("sp_q%i%s_%%i", nh, pf)); }; float FFitWeights::evalPt(float centr, const float& mpt) { - TObjArray* tar{nullptr}; - tar = fW_data; - if (!tar) { - return -1; - } - - int isp{static_cast(centr)}; - if (isp < 0 || isp > NumberSp) { - return -1; - } - - TGraph* spline{nullptr}; - spline = reinterpret_cast(tar->FindObject(Form("sp_mpt_%i", isp))); - if (!spline) { - return -1; - } - float ptVal{static_cast(100. * spline->Eval(mpt))}; - if (ptVal < 0 || ptVal > MaxTol) { - return -1; - } - return ptVal; + return internalEval(centr, mpt, "sp_mpt_%i"); }; diff --git a/Common/Core/FFitWeights.h b/Common/Core/FFitWeights.h index aa5a22609c5..992c6af3d4d 100644 --- a/Common/Core/FFitWeights.h +++ b/Common/Core/FFitWeights.h @@ -19,8 +19,10 @@ #include #include +#include #include #include +#include #include #include @@ -69,6 +71,8 @@ class FFitWeights : public TNamed private: TObjArray* fW_data; + TProfile* ptProfCent; //! + TH2D* h2ptCent; //! int centBin; TAxis* qAxis; //! @@ -91,6 +95,8 @@ class FFitWeights : public TNamed static constexpr int NumberSp = 90; static constexpr float MaxTol = 100.05; + float internalEval(float centr, const float& val, const char* name); + ClassDef(FFitWeights, 1); // calibration class }; #endif // COMMON_CORE_FFITWEIGHTS_H_ diff --git a/Common/TableProducer/eseTableProducer.cxx b/Common/TableProducer/eseTableProducer.cxx index edde600771c..c37279d43b4 100644 --- a/Common/TableProducer/eseTableProducer.cxx +++ b/Common/TableProducer/eseTableProducer.cxx @@ -325,7 +325,6 @@ struct EseTableProducer { const auto binval = (mean - avgpt) / avgpt; weightsFFit->fillPt(centrality, binval, false); meanPt[0] = binval; - if (cfgMeanPt == Step1) { registry.fill(HIST("hMeanPtStat"), 2.5); } else if (cfgMeanPt == Step2) { From 0e41522035d7e2cd725cb8b60210856a2e6e9717 Mon Sep 17 00:00:00 2001 From: joachimckh Date: Mon, 17 Nov 2025 08:57:53 +0100 Subject: [PATCH 5/6] use mpt tables, change process to either use q2/mpt add secondary process for some very simple parsing of mean-pt/q2 histograms --- PWGCF/Flow/Tasks/flowGfwEse.cxx | 51 ++++++++++++++++++++++++++------- 1 file changed, 40 insertions(+), 11 deletions(-) diff --git a/PWGCF/Flow/Tasks/flowGfwEse.cxx b/PWGCF/Flow/Tasks/flowGfwEse.cxx index fc4e06240f1..d31be8b873e 100644 --- a/PWGCF/Flow/Tasks/flowGfwEse.cxx +++ b/PWGCF/Flow/Tasks/flowGfwEse.cxx @@ -240,6 +240,9 @@ struct FlowGfwEse { int density; DensityCorr() : psi2Est(0.), psi3Est(0.), psi4Est(0.), v2(0.), v3(0.), v4(0.), density(0) {} }; + + O2_DEFINE_CONFIGURABLE(cfgAnalysisType, bool, true, "true for ese, false for mean-pT"); + const std::string shapesel = cfgAnalysisType ? "ese" : "mpt"; static constexpr int EseBins = 100; // region indices for consistency flag @@ -367,6 +370,12 @@ struct FlowGfwEse { int ptbins = o2::analysis::gfwflowese::ptbinning.size() - 1; fSecondAxis = (cfgTimeDependent) ? new TAxis(timeAxis.binEdges.size() - 1, &(timeAxis.binEdges[0])) : new TAxis(ptbins, &o2::analysis::gfwflowese::ptbinning[0]); + if (doprocessMptq2) { + registry.add("mptcorr/eventcounter", "", HistType::kTH1F, {{3, 0, 3}}); + registry.add("mptcorr/h3_cent_q2_meanptperc", ";Centrality;#it{q}_{2};mean-#it{p}_{T}", HistType::kTH3D, {{100, 0, 100}, {100, 0, 100}, {100, 0, 100}}); + registry.add("mptcorr/h3_cent_q2_mptvalue", ";Centrality;#it{q}_{2};mean-#it{p}_{T}", HistType::kTH3D, {{100, 0, 100}, {100, 0, 100}, {200, -1, 1}}); + } + if (doprocessData) { registry.add("trackQA/before/phi_eta_vtxZ", "", {HistType::kTH3D, {phiAxis, etaAxis, vtxAxis}}); registry.add("trackQA/before/pt_dcaXY_dcaZ", "", {HistType::kTH3D, {ptAxis, dcaXYAXis, dcaZAXis}}); @@ -541,12 +550,12 @@ struct FlowGfwEse { for (int jese = 0; jese < EseBins; ++jese) { if (it->pTDif) { for (int i = 0; i < fSecondAxis->GetNbins(); ++i) { - std::string name = Form("ese_%d_%s_pt_%d", jese, it->Head.c_str(), i + 1); + std::string name = Form("%s_%d_%s_pt_%d",shapesel.c_str(), jese, it->Head.c_str(), i + 1); std::string title = it->Head + std::string("_ptDiff"); oba->Add(new TNamed(name.c_str(), title.c_str())); } } else { - std::string name = Form("ese_%d_%s", jese, it->Head.c_str()); + std::string name = Form("%s_%d_%s",shapesel.c_str(), jese, it->Head.c_str()); std::string title = it->Head + std::string("_ese"); oba->Add(new TNamed(name.c_str(), title.c_str())); } @@ -773,12 +782,12 @@ struct FlowGfwEse { } template - void fillOutputContainers(const float& centmult, const double& rndm, const int& run = 0, const float& qPerc = -1.0f) + void fillOutputContainers(const float& centmult, const double& rndm, const int& run = 0, const float& fPerc = -1.0f) { (dt == kGen) ? fFCptgen->calculateCorrelations() : fFCpt->calculateCorrelations(); (dt == kGen) ? fFCptgen->fillPtProfiles(centmult, rndm) : fFCpt->fillPtProfiles(centmult, rndm); (dt == kGen) ? fFCptgen->fillCMProfiles(centmult, rndm) : fFCpt->fillCMProfiles(centmult, rndm); - int qPtmp = static_cast(qPerc); + int qPtmp = static_cast(fPerc); for (uint l_ind = 0; l_ind < corrconfigs.size(); ++l_ind) { if (!corrconfigs.at(l_ind).pTDif) { auto dnx = fGFW->Calculate(corrconfigs.at(l_ind), 0, kTRUE).real(); @@ -786,7 +795,7 @@ struct FlowGfwEse { continue; auto val = fGFW->Calculate(corrconfigs.at(l_ind), 0, kFALSE).real() / dnx; if (std::abs(val) < 1) { - (dt == kGen) ? fFCgen->FillProfile(corrconfigs.at(l_ind).Head.c_str(), centmult, val, (cfgUseMultiplicityFlowWeights) ? dnx : 1.0, rndm) : fFC->FillProfile(Form("ese_%i_%s", qPtmp, corrconfigs.at(l_ind).Head.c_str()), centmult, val, (cfgUseMultiplicityFlowWeights) ? dnx : 1.0, rndm); + (dt == kGen) ? fFCgen->FillProfile(corrconfigs.at(l_ind).Head.c_str(), centmult, val, (cfgUseMultiplicityFlowWeights) ? dnx : 1.0, rndm) : fFC->FillProfile(Form("%s_%i_%s",shapesel.c_str(), qPtmp, corrconfigs.at(l_ind).Head.c_str()), centmult, val, (cfgUseMultiplicityFlowWeights) ? dnx : 1.0, rndm); (dt == kGen) ? fFCptgen->fillVnPtProfiles(centmult, val, (cfgUseMultiplicityFlowWeights) ? dnx : 1.0, rndm, o2::analysis::gfwflowese::configs.GetpTCorrMasks()[l_ind]) : fFCpt->fillVnPtProfiles(centmult, val, (cfgUseMultiplicityFlowWeights) ? dnx : 1.0, rndm, o2::analysis::gfwflowese::configs.GetpTCorrMasks()[l_ind]); if (cfgRunByRun && cfgFillFlowRunByRun && dt != kGen && l_ind == 0) { tpfsList[run][pfCorr22]->Fill(centmult, val, (cfgUseMultiplicityFlowWeights) ? dnx : 1.0); @@ -800,7 +809,7 @@ struct FlowGfwEse { continue; auto val = fGFW->Calculate(corrconfigs.at(l_ind), i - 1, kFALSE).real() / dnx; if (std::abs(val) < 1) - (dt == kGen) ? fFCgen->FillProfile(Form("%s_pt_%i", corrconfigs.at(l_ind).Head.c_str(), i), centmult, val, (cfgUseMultiplicityFlowWeights) ? dnx : 1.0, rndm) : fFC->FillProfile(Form("ese_%i_%s_pt_%i", qPtmp, corrconfigs.at(l_ind).Head.c_str(), i), centmult, val, (cfgUseMultiplicityFlowWeights) ? dnx : 1.0, rndm); + (dt == kGen) ? fFCgen->FillProfile(Form("%s_pt_%i", corrconfigs.at(l_ind).Head.c_str(), i), centmult, val, (cfgUseMultiplicityFlowWeights) ? dnx : 1.0, rndm) : fFC->FillProfile(Form("%s_%i_%s_pt_%i", shapesel.c_str(), qPtmp, corrconfigs.at(l_ind).Head.c_str(), i), centmult, val, (cfgUseMultiplicityFlowWeights) ? dnx : 1.0, rndm); // (dt == kGen) ? fFCgen->FillProfile(Form("%s_pt_%i", corrconfigs.at(l_ind).Head.c_str(), i), centmult, val, (cfgUseMultiplicityFlowWeights) ? dnx : 1.0, rndm) : fFC->FillProfile(Form("%s_pt_%i", corrconfigs.at(l_ind).Head.c_str(), i), centmult, val, (cfgUseMultiplicityFlowWeights) ? dnx : 1.0, rndm); } } @@ -898,11 +907,11 @@ struct FlowGfwEse { if (acceptedTracks.nPos < 2 || acceptedTracks.nMid < 2 || acceptedTracks.nNeg < 2) // o2-linter: disable=magic-number (at least two tracks in all three subevents) return; } - const auto qPerc{collision.qPERCFT0C()}; + const auto fPerc = cfgAnalysisType ? collision.qPERCFT0C() : collision.fMEANPTSHAPE(); if (!cfgFillWeights) fillOutputContainers
((cfgTimeDependent) ? xaxis.time : (cfgUseNch) ? xaxis.multiplicity : xaxis.centrality, - lRandom, run, qPerc[0]); + lRandom, run, fPerc[0]); } bool isStable(int pdg) @@ -1134,7 +1143,7 @@ struct FlowGfwEse { return static_cast(diff) / 3600000.0; } - void processData(soa::Filtered>::iterator const& collision, aod::BCsWithTimestamps const&, GFWTracks const& tracks) + void processData(soa::Filtered>::iterator const& collision, aod::BCsWithTimestamps const&, GFWTracks const& tracks) { auto bc = collision.bc_as(); int run = bc.runNumber(); @@ -1168,8 +1177,8 @@ struct FlowGfwEse { if (occupancy < 0 || occupancy > cfgOccupancySelection) return; } - const auto qPerc{collision.qPERCFT0C()}; - if (qPerc[0] < 0) + const auto fPerc = cfgAnalysisType ? collision.qPERCFT0C() : collision.fMEANPTSHAPE(); + if (fPerc[0] < 0) return; registry.fill(HIST("eventQA/eventSel"), kOccupancy); if (cfgRunByRun) @@ -1190,6 +1199,26 @@ struct FlowGfwEse { processCollision(collision, tracks, xaxis, run); } PROCESS_SWITCH(FlowGfwEse, processData, "Process analysis for non-derived data", true); + + //void processMptq2(soa::Filtered::iterator const& collision, aod::BCsWithTimestamps const&, GFWTracks const& tracks) + + void processMptq2(soa::Filtered>::iterator const& collision, aod::BCsWithTimestamps const&/*, GFWTracks const& tracks*/) + { + float count{0.5}; + registry.fill(HIST("mptcorr/eventcounter"),count++); + const auto centr = collision.centFT0C(); + const auto qPerc = collision.qPERCFT0C(); + const auto mPt = collision.fMEANPTSHAPE(); + const auto mPtv = collision.fMEANPT(); + if (qPerc[0] < 0 || mPt[0] < 0) + return; + registry.fill(HIST("mptcorr/eventcounter"),count++); + registry.fill(HIST("mptcorr/h3_cent_q2_meanptperc"), centr, qPerc[0], mPt[0]); + registry.fill(HIST("mptcorr/h3_cent_q2_mptvalue"), centr, qPerc[0], mPtv[0]); + + } + PROCESS_SWITCH(FlowGfwEse, processMptq2, "Process analysis for mpt-q2 correlation", false); + }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From d86f01da41bc36cb6fa1418edc5cb56c4172acef Mon Sep 17 00:00:00 2001 From: joachimckh Date: Mon, 17 Nov 2025 08:58:28 +0100 Subject: [PATCH 6/6] clang-format --- PWGCF/Flow/Tasks/flowGfwEse.cxx | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/PWGCF/Flow/Tasks/flowGfwEse.cxx b/PWGCF/Flow/Tasks/flowGfwEse.cxx index d31be8b873e..633fb6ff332 100644 --- a/PWGCF/Flow/Tasks/flowGfwEse.cxx +++ b/PWGCF/Flow/Tasks/flowGfwEse.cxx @@ -242,7 +242,7 @@ struct FlowGfwEse { }; O2_DEFINE_CONFIGURABLE(cfgAnalysisType, bool, true, "true for ese, false for mean-pT"); - const std::string shapesel = cfgAnalysisType ? "ese" : "mpt"; + const std::string shapesel = cfgAnalysisType ? "ese" : "mpt"; static constexpr int EseBins = 100; // region indices for consistency flag @@ -550,12 +550,12 @@ struct FlowGfwEse { for (int jese = 0; jese < EseBins; ++jese) { if (it->pTDif) { for (int i = 0; i < fSecondAxis->GetNbins(); ++i) { - std::string name = Form("%s_%d_%s_pt_%d",shapesel.c_str(), jese, it->Head.c_str(), i + 1); + std::string name = Form("%s_%d_%s_pt_%d", shapesel.c_str(), jese, it->Head.c_str(), i + 1); std::string title = it->Head + std::string("_ptDiff"); oba->Add(new TNamed(name.c_str(), title.c_str())); } } else { - std::string name = Form("%s_%d_%s",shapesel.c_str(), jese, it->Head.c_str()); + std::string name = Form("%s_%d_%s", shapesel.c_str(), jese, it->Head.c_str()); std::string title = it->Head + std::string("_ese"); oba->Add(new TNamed(name.c_str(), title.c_str())); } @@ -795,7 +795,7 @@ struct FlowGfwEse { continue; auto val = fGFW->Calculate(corrconfigs.at(l_ind), 0, kFALSE).real() / dnx; if (std::abs(val) < 1) { - (dt == kGen) ? fFCgen->FillProfile(corrconfigs.at(l_ind).Head.c_str(), centmult, val, (cfgUseMultiplicityFlowWeights) ? dnx : 1.0, rndm) : fFC->FillProfile(Form("%s_%i_%s",shapesel.c_str(), qPtmp, corrconfigs.at(l_ind).Head.c_str()), centmult, val, (cfgUseMultiplicityFlowWeights) ? dnx : 1.0, rndm); + (dt == kGen) ? fFCgen->FillProfile(corrconfigs.at(l_ind).Head.c_str(), centmult, val, (cfgUseMultiplicityFlowWeights) ? dnx : 1.0, rndm) : fFC->FillProfile(Form("%s_%i_%s", shapesel.c_str(), qPtmp, corrconfigs.at(l_ind).Head.c_str()), centmult, val, (cfgUseMultiplicityFlowWeights) ? dnx : 1.0, rndm); (dt == kGen) ? fFCptgen->fillVnPtProfiles(centmult, val, (cfgUseMultiplicityFlowWeights) ? dnx : 1.0, rndm, o2::analysis::gfwflowese::configs.GetpTCorrMasks()[l_ind]) : fFCpt->fillVnPtProfiles(centmult, val, (cfgUseMultiplicityFlowWeights) ? dnx : 1.0, rndm, o2::analysis::gfwflowese::configs.GetpTCorrMasks()[l_ind]); if (cfgRunByRun && cfgFillFlowRunByRun && dt != kGen && l_ind == 0) { tpfsList[run][pfCorr22]->Fill(centmult, val, (cfgUseMultiplicityFlowWeights) ? dnx : 1.0); @@ -1200,25 +1200,23 @@ struct FlowGfwEse { } PROCESS_SWITCH(FlowGfwEse, processData, "Process analysis for non-derived data", true); - //void processMptq2(soa::Filtered::iterator const& collision, aod::BCsWithTimestamps const&, GFWTracks const& tracks) + // void processMptq2(soa::Filtered::iterator const& collision, aod::BCsWithTimestamps const&, GFWTracks const& tracks) - void processMptq2(soa::Filtered>::iterator const& collision, aod::BCsWithTimestamps const&/*, GFWTracks const& tracks*/) + void processMptq2(soa::Filtered>::iterator const& collision, aod::BCsWithTimestamps const& /*, GFWTracks const& tracks*/) { float count{0.5}; - registry.fill(HIST("mptcorr/eventcounter"),count++); + registry.fill(HIST("mptcorr/eventcounter"), count++); const auto centr = collision.centFT0C(); const auto qPerc = collision.qPERCFT0C(); const auto mPt = collision.fMEANPTSHAPE(); const auto mPtv = collision.fMEANPT(); if (qPerc[0] < 0 || mPt[0] < 0) return; - registry.fill(HIST("mptcorr/eventcounter"),count++); + registry.fill(HIST("mptcorr/eventcounter"), count++); registry.fill(HIST("mptcorr/h3_cent_q2_meanptperc"), centr, qPerc[0], mPt[0]); - registry.fill(HIST("mptcorr/h3_cent_q2_mptvalue"), centr, qPerc[0], mPtv[0]); - + registry.fill(HIST("mptcorr/h3_cent_q2_mptvalue"), centr, qPerc[0], mPtv[0]); } PROCESS_SWITCH(FlowGfwEse, processMptq2, "Process analysis for mpt-q2 correlation", false); - }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)