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)}; }