From 6fa3e584b2a4baaa8c90806efdc80fe5772efb52 Mon Sep 17 00:00:00 2001 From: nidamalikk Date: Sun, 28 Sep 2025 18:02:10 +0530 Subject: [PATCH 01/11] added histograms for multiplicity correlation plots --- .../Tasks/netchargeFluctuations.cxx | 288 ++++++++++++++---- 1 file changed, 229 insertions(+), 59 deletions(-) diff --git a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx index 8ce63ab6cf8..a2d95bd72df 100644 --- a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx @@ -40,12 +40,13 @@ #include "Framework/RunningWorkflowInfo.h" #include "Framework/runDataProcessing.h" +#include "TF1.h" #include "TProfile.h" #include "TProfile2D.h" #include "TRandom3.h" #include -#include // Include for std::vector +#include using namespace o2; using namespace o2::framework; @@ -53,34 +54,14 @@ using namespace o2::framework::expressions; using namespace std; using namespace o2::constants::physics; -namespace o2 -{ -namespace aod -{ -using MyCollisionsRun2 = soa::Join; -using MyCollisionRun2 = MyCollisionsRun2::iterator; -using MyCollisionsRun3 = soa::Join; -using MyCollisionRun3 = MyCollisionsRun3::iterator; -using MyTracks = soa::Join; -using MyTrack = MyTracks::iterator; - -using MyMCCollisionsRun2 = soa::Join; -using MyMCCollisionRun2 = MyMCCollisionsRun2::iterator; - -using MyMCCollisionsRun3 = soa::Join; -using MyMCCollisionRun3 = MyMCCollisionsRun3::iterator; - -using MyMCTracks = soa::Join; -using MyMCTrack = MyMCTracks::iterator; -} // namespace aod -} // namespace o2 - enum RunType { kRun3 = 0, kRun2 }; struct NetchargeFluctuations { +#define O2_DEFINE_CONFIGURABLE(NAME, TYPE, DEFAULT, HELP) Configurable NAME{#NAME, DEFAULT, HELP}; + Service pdgService; Service ccdb; TRandom3* fRndm = new TRandom3(0); @@ -96,11 +77,11 @@ struct NetchargeFluctuations { Configurable etaCut{"etaCut", 0.8f, "Eta cut"}; Configurable ptMinCut{"ptMinCut", 0.2, "Pt min cut"}; Configurable ptMaxCut{"ptMaxCut", 5.0, "Pt max cut"}; - Configurable dcaXYCut{"dcaXYCut", 0.12, "DCA XY cut"}; - Configurable dcaZCut{"dcaZCut", 0.3, "DCA Z cut"}; - Configurable tpcCrossCut{"tpcCrossCut", 70, "TPC crossrows cut"}; - Configurable itsChiCut{"itsChiCut", 70, "ITS chi2 cluster cut"}; - Configurable tpcChiCut{"tpcChiCut", 70, "TPC chi2 cluster cut"}; + Configurable dcaXYCut{"dcaXYCut", 0.2, "DCA XY cut"}; + Configurable dcaZCut{"dcaZCut", 2.0, "DCA Z cut"}; + Configurable tpcCrossCut{"tpcCrossCut", 70., "TPC crossrows cut"}; + Configurable itsChiCut{"itsChiCut", 36., "ITS chi2 cluster cut"}; + Configurable tpcChiCut{"tpcChiCut", 4., "TPC chi2 cluster cut"}; Configurable centMin{"centMin", 0.0f, "cenrality min for delta eta"}; Configurable centMax{"centMax", 10.0f, "cenrality max for delta eta"}; Configurable cfgNSubsample{"cfgNSubsample", 30, "Number of subsamples for Error"}; @@ -108,33 +89,87 @@ struct NetchargeFluctuations { Configurable threshold{"threshold", 1e-6, "Delta eta bin count"}; // Event selections - Configurable cSel8Trig{"cSel8Trig", true, "Sel8 (T0A + T0C) Selection Run3"}; // sel8 - Configurable cInt7Trig{"cInt7Trig", true, "kINT7 MB Trigger"}; // kINT7 - Configurable cSel7Trig{"cSel7Trig", true, "Sel7 (V0A + V0C) Selection Run2"}; // sel7 - Configurable cPileupReject{"cPileupReject", false, "Pileup rejection"}; // pileup - Configurable cfgUseGoodItsLayerAllCut{"cfgUseGoodItsLayerAllCut", false, "Good ITS Layers All"}; // pileup - Configurable cDcaXy{"cDcaXy", false, "Dca XY cut"}; - Configurable cDcaZ{"cDcaZ", false, "Dca Z cut"}; - Configurable cTpcCr{"cTpcCr", false, "tpc crossrows"}; - Configurable cItsChi{"cItsChi", false, "ITS chi"}; - Configurable cTpcChi{"cTpcChi", false, "TPC chi"}; + Configurable cSel8Trig{"cSel8Trig", true, "Sel8 (T0A + T0C) Selection Run3"}; // sel8 + Configurable cInt7Trig{"cInt7Trig", true, "kINT7 MB Trigger"}; // kINT7 + Configurable cSel7Trig{"cSel7Trig", true, "Sel7 (V0A + V0C) Selection Run2"}; // sel7 + Configurable cDcaXy{"cDcaXy", true, "Dca XY cut"}; + Configurable cDcaZ{"cDcaZ", true, "Dca Z cut"}; + Configurable cTpcCr{"cTpcCr", true, "tpc crossrows"}; + Configurable cItsChi{"cItsChi", true, "ITS chi"}; + Configurable cTpcChi{"cTpcChi", true, "TPC chi"}; Configurable cFT0C{"cFT0C", true, "cent FT0C"}; Configurable cFT0M{"cFT0M", false, "cent FT0M"}; ConfigurableAxis centBining{"centBining", {0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100}, "Centrality/Multiplicity percentile bining"}; - Configurable cTFBorder{"cTFBorder", false, "Timeframe Border Selection"}; // pileup - Configurable cNoItsROBorder{"cNoItsROBorder", false, "No ITSRO Border Cut"}; // pileup - Configurable cItsTpcVtx{"cItsTpcVtx", false, "ITS+TPC Vertex Selection"}; // pileup - Configurable cZVtxTimeDiff{"cZVtxTimeDiff", false, "z-vtx time diff selection"}; // pileup + Configurable cPileupReject{"cPileupReject", true, "Pileup rejection"}; // pileup + Configurable cfgUseGoodItsLayerAllCut{"cfgUseGoodItsLayerAllCut", true, "Good ITS Layers All"}; // pileup + Configurable cTFBorder{"cTFBorder", false, "Timeframe Border Selection"}; // pileup + Configurable cNoItsROBorder{"cNoItsROBorder", false, "No ITSRO Border Cut"}; // pileup + Configurable cItsTpcVtx{"cItsTpcVtx", true, "ITS+TPC Vertex Selection"}; // pileup + Configurable cZVtxTimeDiff{"cZVtxTimeDiff", false, "z-vtx time diff selection"}; // pileup + Configurable cPVcont{"cPVcont", true, "primary vertex contributor"}; + + O2_DEFINE_CONFIGURABLE(cfgEvSelMultCorrelation, bool, true, "Multiplicity correlation cut") + struct : ConfigurableGroup { + + O2_DEFINE_CONFIGURABLE(cfgMultPVT0CCutEnabled, bool, true, "Enable PV multiplicity vs T0C centrality cut") + O2_DEFINE_CONFIGURABLE(cfgMultGlobalFT0CCutEnabled, bool, true, "Enable globalTracks vs FT0C multiplicity cut") + O2_DEFINE_CONFIGURABLE(cfgMultGlobalPVCutEnabled, bool, false, "Enable globalTracks vs PV multiplicity cut") + + Configurable> cfgMultPVT0CCutPars{"cfgMultPVT0CCutPars", + std::vector{187.621, -5.14575, 0.0716601, -0.000586642, 2.02818e-06, 51.2929, -1.66644, 0.0354762, -0.000389809, 1.55365e-06}, + "PV multiplicity vs T0C centrality cut parameter values"}; + + Configurable> cfgMultGlobalFT0CCutPars{"cfgMultGlobalFT0CCutPars", + std::vector{135.561, -3.7818, 0.0536562, -0.000445155, 1.55429e-06, 38.2336, -1.2568, 0.0270932, -0.000301034, 1.21234e-06}, + "globalTracks vs FT0C cut parameter values"}; + + Configurable> cfgMultGlobalPVCutPars{"cfgMultGlobalPVCutPars", + std::vector{100., -2., 0.05, -0.0003, 1e-06, 30., -1.0, 0.02, -0.0002, 8e-07}, + "globalTracks vs PV cut parameter values"}; + + std::vector multPVT0CCutPars; + std::vector multGlobalFT0CPars; + std::vector multGlobalPVCutPars; + + TF1* fMultPVT0CCutLow = nullptr; + TF1* fMultPVT0CCutHigh = nullptr; + TF1* fMultGlobalFT0CCutLow = nullptr; + TF1* fMultGlobalFT0CCutHigh = nullptr; + TF1* fMultGlobalPVCutLow = nullptr; + TF1* fMultGlobalPVCutHigh = nullptr; + + } cfgFunCoeff; // CCDB efficiency histograms TH1D* efficiency = nullptr; - // Initialization + Filter collisionFilter = nabs(aod::collision::posZ) <= vertexZcut; + Filter trackFilter = (nabs(aod::track::eta) < etaCut) && (aod::track::pt > ptMinCut) && (aod::track::pt < ptMaxCut) && (requireGlobalTrackInFilter()); + + using MyCollisionsRun2 = soa::Filtered>; + using MyCollisionRun2 = MyCollisionsRun2::iterator; + + using MyCollisionsRun3 = soa::Filtered>; + using MyCollisionRun3 = MyCollisionsRun3::iterator; + + using MyTracks = soa::Filtered>; + using MyTrack = MyTracks::iterator; + + using MyMCCollisionsRun2 = soa::Filtered>; + using MyMCCollisionRun2 = MyMCCollisionsRun2::iterator; + + using MyMCCollisionsRun3 = soa::Filtered>; + using MyMCCollisionRun3 = MyMCCollisionsRun3::iterator; + + using MyMCTracks = soa::Filtered>; + using MyMCTrack = MyMCTracks::iterator; + void init(o2::framework::InitContext&) { const AxisSpec vtxzAxis = {800, -20, 20, "V_{Z} (cm)"}; const AxisSpec dcaAxis = {1000, -0.5, 0.5, "DCA_{xy} (cm)"}; const AxisSpec dcazAxis = {600, -3, 3, "DCA_{z} (cm)"}; + const AxisSpec phiAxis = {70, 0, 7, "#phi "}; const AxisSpec ptAxis = {70, 0.0, 7.0, "#it{p}_{T} (GeV/#it{c})"}; const AxisSpec etaAxis = {20, -1., 1., "#eta"}; const AxisSpec deltaEtaAxis = {9, 0, 1.8, "#eta"}; @@ -156,6 +191,7 @@ struct NetchargeFluctuations { histogramRegistry.add("QA/hVtxZ_before", "", kTH1F, {vtxzAxis}); histogramRegistry.add("QA/hDcaXY_before", "", kTH1F, {dcaAxis}); + histogramRegistry.add("QA/hphi", "", kTH1F, {phiAxis}); histogramRegistry.add("QA/hDcaZ_before", "", kTH1F, {dcazAxis}); histogramRegistry.add("QA/hTPCchi2perCluster_before", "", kTH1D, {tpcChiAxis}); histogramRegistry.add("QA/hITSchi2perCluster_before", "", kTH1D, {itsChiAxis}); @@ -276,6 +312,58 @@ struct NetchargeFluctuations { histogramRegistry.add("subsample/delta_eta/gen/neg_sq", "", kTProfile2D, {deltaEtaAxis, subsampleAxis}); histogramRegistry.add("subsample/delta_eta/gen/posneg", "", kTProfile2D, {deltaEtaAxis, subsampleAxis}); + histogramRegistry.add("QA/hCentFT0C", "", kTH1F, {centAxis}); + histogramRegistry.add("QA/hNchGlobal", "", kTH1F, {nchAxis}); + histogramRegistry.add("QA/hNchPV", "", kTH1F, {nchAxis}); + + histogramRegistry.add("MultCorrelationPlots/globalTracks_PV_bef", "", {HistType::kTH2D, {nchAxis, nchAxis}}); + histogramRegistry.add("MultCorrelationPlots/globalTracks_FT0C_bef", "", {HistType::kTH2D, {centAxis, nchAxis}}); + histogramRegistry.add("MultCorrelationPlots/PV_FT0C_bef", "", {HistType::kTH2D, {centAxis, nchAxis}}); + + histogramRegistry.add("MultCorrelationPlots/globalTracks_PV_aft", "", {HistType::kTH2D, {nchAxis, nchAxis}}); + histogramRegistry.add("MultCorrelationPlots/globalTracks_FT0C_aft", "", {HistType::kTH2D, {centAxis, nchAxis}}); + histogramRegistry.add("MultCorrelationPlots/PV_FT0C_aft", "", {HistType::kTH2D, {centAxis, nchAxis}}); + + cfgFunCoeff.multPVT0CCutPars = cfgFunCoeff.cfgMultPVT0CCutPars; + cfgFunCoeff.multGlobalFT0CPars = cfgFunCoeff.cfgMultGlobalFT0CCutPars; + cfgFunCoeff.multGlobalPVCutPars = cfgFunCoeff.cfgMultGlobalPVCutPars; + + cfgFunCoeff.fMultPVT0CCutLow = + new TF1("fMultPVT0CCutLow", + "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x - 2.0*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", + 0, 100); + cfgFunCoeff.fMultPVT0CCutLow->SetParameters(&(cfgFunCoeff.multPVT0CCutPars[0])); + + cfgFunCoeff.fMultPVT0CCutHigh = + new TF1("fMultPVT0CCutHigh", + "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x + 2.*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", + 0, 100); + cfgFunCoeff.fMultPVT0CCutHigh->SetParameters(&(cfgFunCoeff.multPVT0CCutPars[0])); + + cfgFunCoeff.fMultGlobalFT0CCutLow = + new TF1("fMultGlobalFT0CCutLow", + "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x - 2.*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", + 0, 100); + cfgFunCoeff.fMultGlobalFT0CCutLow->SetParameters(&(cfgFunCoeff.multGlobalFT0CPars[0])); + + cfgFunCoeff.fMultGlobalFT0CCutHigh = + new TF1("fMultGlobalFT0CCutHigh", + "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x + 2.*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", + 0, 100); + cfgFunCoeff.fMultGlobalFT0CCutHigh->SetParameters(&(cfgFunCoeff.multGlobalFT0CPars[0])); + + cfgFunCoeff.fMultGlobalPVCutLow = + new TF1("fMultGlobalPVCutLow", + "[0] + [1]*x - 5.*([2] + [3]*x)", + 0, 100); + cfgFunCoeff.fMultGlobalPVCutLow->SetParameters(&(cfgFunCoeff.multGlobalPVCutPars[0])); + + cfgFunCoeff.fMultGlobalPVCutHigh = + new TF1("fMultGlobalPVCutHigh", + "[0] + [1]*x + 5.*([2] + [3]*x)", + 0, 100); + cfgFunCoeff.fMultGlobalPVCutHigh->SetParameters(&(cfgFunCoeff.multGlobalPVCutPars[0])); + if (cfgLoadEff) { ccdb->setURL(cfgUrlCCDB.value); ccdb->setCaching(true); @@ -289,16 +377,45 @@ struct NetchargeFluctuations { } } + bool eventSelected(const float& globalNch, const float& pvTrack, const float& centrality) + { + if (cfgFunCoeff.cfgMultPVT0CCutEnabled) { + + if (pvTrack < cfgFunCoeff.fMultPVT0CCutLow->Eval(centrality)) + return false; + if (pvTrack > cfgFunCoeff.fMultPVT0CCutHigh->Eval(centrality)) + return false; + } + + if (cfgFunCoeff.cfgMultGlobalFT0CCutEnabled) { + + if (globalNch < cfgFunCoeff.fMultGlobalFT0CCutLow->Eval(centrality)) + return false; + if (globalNch > cfgFunCoeff.fMultGlobalFT0CCutHigh->Eval(centrality)) + return false; + } + + if (cfgFunCoeff.cfgMultGlobalPVCutEnabled) { + + if (globalNch < cfgFunCoeff.fMultGlobalPVCutLow->Eval(pvTrack)) + return false; + if (globalNch > cfgFunCoeff.fMultGlobalPVCutHigh->Eval(pvTrack)) + return false; + } + + return true; + } + template bool selCollision(C const& coll, float& cent, float& mult) { - if (std::abs(coll.posZ()) > vertexZcut) + if (std::abs(coll.posZ()) >= vertexZcut) return false; if constexpr (run == kRun3) { if (cSel8Trig && !coll.sel8()) { return false; - } // require min bias trigger + } if (cFT0M) { cent = coll.centFT0M(); // centrality for run3 using FT0M mult = coll.multFT0M(); @@ -349,6 +466,7 @@ struct NetchargeFluctuations { template void fillAfterQA(T const& track) { + histogramRegistry.fill(HIST("QA/hphi"), track.phi()); histogramRegistry.fill(HIST("QA/hDcaXY_after"), track.dcaXY()); histogramRegistry.fill(HIST("QA/hDcaZ_after"), track.dcaZ()); histogramRegistry.fill(HIST("QA/hPt"), track.pt()); @@ -366,21 +484,23 @@ struct NetchargeFluctuations { { if (!track.isGlobalTrack()) return false; + if (cPVcont && !track.isPVContributor()) + return false; if (std::fabs(track.eta()) >= etaCut) return false; if (track.pt() <= ptMinCut || track.pt() >= ptMaxCut) return false; if (track.sign() == 0) return false; - if (cDcaXy && std::fabs(track.dcaXY()) > dcaXYCut) + if (cDcaXy && std::fabs(track.dcaXY()) >= dcaXYCut) return false; - if (cDcaZ && std::fabs(track.dcaZ()) > dcaZCut) + if (cDcaZ && std::fabs(track.dcaZ()) >= dcaZCut) return false; - if (cTpcCr && track.tpcNClsCrossedRows() < tpcCrossCut) + if (cTpcCr && track.tpcNClsCrossedRows() <= tpcCrossCut) return false; - if (cItsChi && track.itsChi2NCl() > itsChiCut) + if (cItsChi && track.itsChi2NCl() >= itsChiCut) return false; - if (cTpcChi && track.tpcChi2NCl() > tpcChiCut) + if (cTpcChi && track.tpcChi2NCl() >= tpcChiCut) return false; return true; @@ -438,6 +558,24 @@ struct NetchargeFluctuations { if (!selCollision(coll, cent, mult)) { return; } + + float globalNch = tracks.size(); + float pvTrack = coll.multNTracksPV(); + + histogramRegistry.fill(HIST("QA/hCentFT0C"), cent); + histogramRegistry.fill(HIST("QA/hNchGlobal"), globalNch); + histogramRegistry.fill(HIST("QA/hNchPV"), pvTrack); + + histogramRegistry.fill(HIST("MultCorrelationPlots/globalTracks_PV_bef"), pvTrack, globalNch); + histogramRegistry.fill(HIST("MultCorrelationPlots/globalTracks_FT0C_bef"), cent, globalNch); + histogramRegistry.fill(HIST("MultCorrelationPlots/PV_FT0C_bef"), cent, pvTrack); + + if (cfgEvSelMultCorrelation && !eventSelected(globalNch, pvTrack, cent)) { + return; + } + histogramRegistry.fill(HIST("MultCorrelationPlots/globalTracks_PV_aft"), pvTrack, globalNch); + histogramRegistry.fill(HIST("MultCorrelationPlots/globalTracks_FT0C_aft"), cent, globalNch); + histogramRegistry.fill(HIST("MultCorrelationPlots/PV_FT0C_aft"), cent, pvTrack); histogramRegistry.fill(HIST("QA/hVtxZ_after"), coll.posZ()); histogramRegistry.fill(HIST("QA/hCentrality"), cent); histogramRegistry.fill(HIST("QA/hMultiplicity"), mult); @@ -477,6 +615,7 @@ struct NetchargeFluctuations { termp = fpos * (fpos - 1); termn = fneg * (fneg - 1); posneg = fpos * fneg; + histogramRegistry.fill(HIST("data/cent_nchTotal"), cent, nchTotal); histogramRegistry.fill(HIST("data/cent_nchTotalCor"), cent, nchTotalCor); histogramRegistry.fill(HIST("data/nch_nchCor"), nch, nchCor); @@ -500,6 +639,25 @@ struct NetchargeFluctuations { if (!selCollision(coll, cent, mult)) { return; } + + int globalNch = inputTracks.size(); + int pvTrack = coll.multNTracksPV(); + + histogramRegistry.fill(HIST("QA/hCentFT0C"), cent); + histogramRegistry.fill(HIST("QA/hNchGlobal"), globalNch); + histogramRegistry.fill(HIST("QA/hNchPV"), pvTrack); + + histogramRegistry.fill(HIST("MultCorrelationPlots/globalTracks_PV_bef"), pvTrack, globalNch); + histogramRegistry.fill(HIST("MultCorrelationPlots/globalTracks_FT0C_bef"), cent, globalNch); + histogramRegistry.fill(HIST("MultCorrelationPlots/PV_FT0C_bef"), cent, pvTrack); + + if (cfgEvSelMultCorrelation && !eventSelected(globalNch, pvTrack, cent)) { + return; + } + histogramRegistry.fill(HIST("MultCorrelationPlots/globalTracks_PV_aft"), pvTrack, globalNch); + histogramRegistry.fill(HIST("MultCorrelationPlots/globalTracks_FT0C_aft"), cent, globalNch); + histogramRegistry.fill(HIST("MultCorrelationPlots/PV_FT0C_aft"), cent, pvTrack); + histogramRegistry.fill(HIST("QA/hVtxZ_after"), coll.posZ()); histogramRegistry.fill(HIST("QA/hCentrality"), cent); histogramRegistry.fill(HIST("QA/hMultiplicity"), mult); @@ -547,7 +705,7 @@ struct NetchargeFluctuations { int posGen = 0, negGen = 0, posNegGen = 0, termNGen = 0, termPGen = 0, nchGen = 0; const auto& mccolgen = coll.template mcCollision_as(); - if (std::abs(mccolgen.posZ()) > vertexZcut) + if (std::abs(mccolgen.posZ()) >= vertexZcut) return; const auto& mcpartgen = mcParticles.sliceByCached(aod::mcparticle::mcCollisionId, mccolgen.globalIndex(), cache); histogramRegistry.fill(HIST("gen/hVtxZ_after"), mccolgen.posZ()); @@ -620,6 +778,12 @@ struct NetchargeFluctuations { float cent = -1, mult = -1; if (!selCollision(coll, cent, mult)) return; + + int globalNch = tracks.size(); + int pvTrack = coll.multNTracksPV(); + if (cfgEvSelMultCorrelation && !eventSelected(globalNch, pvTrack, cent)) + return; + if (!(cent >= centMin && cent < centMax)) return; histogramRegistry.fill(HIST("data/delta_eta_cent"), cent); @@ -692,6 +856,12 @@ struct NetchargeFluctuations { float cent = -1, mult = -1; if (!selCollision(coll, cent, mult)) return; + + int globalNch = inputTracks.size(); + int pvTrack = coll.multNTracksPV(); + if (cfgEvSelMultCorrelation && !eventSelected(globalNch, pvTrack, cent)) + return; + if (!(cent >= centMin && cent < centMax)) return; histogramRegistry.fill(HIST("data/delta_eta_cent"), cent); @@ -745,7 +915,7 @@ struct NetchargeFluctuations { const auto& mccolgen = coll.template mcCollision_as(); - if (std::abs(mccolgen.posZ()) > vertexZcut) + if (std::abs(mccolgen.posZ()) >= vertexZcut) return; const auto& mcpartgen = mcParticles.sliceByCached(aod::mcparticle::mcCollisionId, mccolgen.globalIndex(), cache); @@ -817,10 +987,10 @@ struct NetchargeFluctuations { } // void SliceCache cache; - Preslice mcTrack = o2::aod::mcparticle::mcCollisionId; + Preslice mcTrack = aod::mcparticle::mcCollisionId; // process function for Data Run3 - void processDataRun3(aod::MyCollisionRun3 const& coll, aod::MyTracks const& tracks) + void processDataRun3(MyCollisionRun3 const& coll, MyTracks const& tracks) { calculationData(coll, tracks); for (int ii = 0; ii < deltaEta; ii++) { @@ -831,10 +1001,10 @@ struct NetchargeFluctuations { } } - PROCESS_SWITCH(NetchargeFluctuations, processDataRun3, "Process for Run3 DATA", false); + PROCESS_SWITCH(NetchargeFluctuations, processDataRun3, "Process for Run3 DATA", true); // process function for Data Run2 - void processDataRun2(aod::MyCollisionRun2 const& coll, aod::MyTracks const& tracks) + void processDataRun2(MyCollisionRun2 const& coll, MyTracks const& tracks) { calculationData(coll, tracks); for (int ii = 0; ii < deltaEta; ii++) { @@ -849,7 +1019,7 @@ struct NetchargeFluctuations { // process function for MC Run3 - void processMcRun3(aod::MyMCCollisionRun3 const& coll, aod::MyMCTracks const& inputTracks, + void processMcRun3(MyMCCollisionRun3 const& coll, MyMCTracks const& inputTracks, aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles) { calculationMc(coll, inputTracks, mcCollisions, mcParticles); @@ -859,11 +1029,11 @@ struct NetchargeFluctuations { calculationMcDeltaEta(coll, inputTracks, mcCollisions, mcParticles, etaMin, etaMax); } } - PROCESS_SWITCH(NetchargeFluctuations, processMcRun3, "Process reconstructed", true); + PROCESS_SWITCH(NetchargeFluctuations, processMcRun3, "Process reconstructed", false); // process function for MC Run2 - void processMcRun2(aod::MyMCCollisionRun2 const& coll, aod::MyMCTracks const& inputTracks, + void processMcRun2(MyMCCollisionRun2 const& coll, MyMCTracks const& inputTracks, aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles) { calculationMc(coll, inputTracks, mcCollisions, mcParticles); From 4fda1aa1c00039d1952d358968bfad363e968d4a Mon Sep 17 00:00:00 2001 From: nidamalikk Date: Wed, 1 Oct 2025 15:15:30 +0530 Subject: [PATCH 02/11] use different polynomial for fitting multiplicity correlation plots --- .../EbyEFluctuations/Tasks/netchargeFluctuations.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx index a2d95bd72df..6414df12727 100644 --- a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx @@ -113,18 +113,18 @@ struct NetchargeFluctuations { O2_DEFINE_CONFIGURABLE(cfgMultPVT0CCutEnabled, bool, true, "Enable PV multiplicity vs T0C centrality cut") O2_DEFINE_CONFIGURABLE(cfgMultGlobalFT0CCutEnabled, bool, true, "Enable globalTracks vs FT0C multiplicity cut") - O2_DEFINE_CONFIGURABLE(cfgMultGlobalPVCutEnabled, bool, false, "Enable globalTracks vs PV multiplicity cut") + O2_DEFINE_CONFIGURABLE(cfgMultGlobalPVCutEnabled, bool, true, "Enable globalTracks vs PV multiplicity cut") Configurable> cfgMultPVT0CCutPars{"cfgMultPVT0CCutPars", - std::vector{187.621, -5.14575, 0.0716601, -0.000586642, 2.02818e-06, 51.2929, -1.66644, 0.0354762, -0.000389809, 1.55365e-06}, + std::vector{30.434, -0.917137, 0.0185032, -0.000198425, 7.94381e-07, 13.7406, -0.282656, 0.00556147, -6.32766e-05, 2.51648e-07}, "PV multiplicity vs T0C centrality cut parameter values"}; Configurable> cfgMultGlobalFT0CCutPars{"cfgMultGlobalFT0CCutPars", - std::vector{135.561, -3.7818, 0.0536562, -0.000445155, 1.55429e-06, 38.2336, -1.2568, 0.0270932, -0.000301034, 1.21234e-06}, + std::vector{18.9628, -0.576466, 0.0117324, -0.000126086, 5.05365e-07, 8.99921, -0.188022, 0.0037089, -4.20275e-05, 1.68234e-07}, "globalTracks vs FT0C cut parameter values"}; Configurable> cfgMultGlobalPVCutPars{"cfgMultGlobalPVCutPars", - std::vector{100., -2., 0.05, -0.0003, 1e-06, 30., -1.0, 0.02, -0.0002, 8e-07}, + std::vector{0.148031, 0.616699, 0.603083, 0.112751, -0.0013846, 8.38211e-06}, "globalTracks vs PV cut parameter values"}; std::vector multPVT0CCutPars; @@ -354,13 +354,13 @@ struct NetchargeFluctuations { cfgFunCoeff.fMultGlobalPVCutLow = new TF1("fMultGlobalPVCutLow", - "[0] + [1]*x - 5.*([2] + [3]*x)", + "[0]+[1]*x - 3.5*([2]+[3]*x+[4]*x*x+[5]*x*x*x)", 0, 100); cfgFunCoeff.fMultGlobalPVCutLow->SetParameters(&(cfgFunCoeff.multGlobalPVCutPars[0])); cfgFunCoeff.fMultGlobalPVCutHigh = new TF1("fMultGlobalPVCutHigh", - "[0] + [1]*x + 5.*([2] + [3]*x)", + "[0]+[1]*x + 3.5*([2]+[3]*x+[4]*x*x+[5]*x*x*x)", 0, 100); cfgFunCoeff.fMultGlobalPVCutHigh->SetParameters(&(cfgFunCoeff.multGlobalPVCutPars[0])); From 128f5021379175c7f509116bc8ee3f7ab3e7ed00 Mon Sep 17 00:00:00 2001 From: nidamalikk Date: Fri, 3 Oct 2025 14:56:30 +0530 Subject: [PATCH 03/11] PWGCF-removal of outliers --- .../Tasks/netchargeFluctuations.cxx | 80 ++++++++++++++----- 1 file changed, 62 insertions(+), 18 deletions(-) diff --git a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx index 6414df12727..401833b75b5 100644 --- a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx @@ -59,20 +59,33 @@ enum RunType { kRun2 }; +// Structure to handle net charge fluctuation analysis struct NetchargeFluctuations { + + // Macro to define configurable parameters with default values and help text + #define O2_DEFINE_CONFIGURABLE(NAME, TYPE, DEFAULT, HELP) Configurable NAME{#NAME, DEFAULT, HELP}; - Service pdgService; - Service ccdb; + // Services for PDG and CCDB (Calibration and Condition Database) + Service pdgService; // Particle data group service + Service ccdb; // CCDB manager service + + // Random number generator for statistical fluctuations, initialized with seed 0 TRandom3* fRndm = new TRandom3(0); + + // Registry for histograms used in analysis HistogramRegistry histogramRegistry{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; - // Configurables + // ------------------- + // Configurable parameters + // ------------------- + // CCDB related configurations Configurable ccdbNoLaterThan{"ccdbNoLaterThan", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; Configurable cfgUrlCCDB{"cfgUrlCCDB", "http://alice-ccdb.cern.ch", "url of ccdb"}; Configurable cfgPathCCDB{"cfgPathCCDB", "Users/n/nimalik/netcharge/p/Run3/LHC24f3d", "Path for ccdb-object"}; Configurable cfgLoadEff{"cfgLoadEff", true, "Load efficiency"}; + // Track and event selection cuts Configurable vertexZcut{"vertexZcut", 10.f, "Vertex Z"}; Configurable etaCut{"etaCut", 0.8f, "Eta cut"}; Configurable ptMinCut{"ptMinCut", 0.2, "Pt min cut"}; @@ -99,38 +112,49 @@ struct NetchargeFluctuations { Configurable cTpcChi{"cTpcChi", true, "TPC chi"}; Configurable cFT0C{"cFT0C", true, "cent FT0C"}; Configurable cFT0M{"cFT0M", false, "cent FT0M"}; - ConfigurableAxis centBining{"centBining", {0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100}, "Centrality/Multiplicity percentile bining"}; - Configurable cPileupReject{"cPileupReject", true, "Pileup rejection"}; // pileup - Configurable cfgUseGoodItsLayerAllCut{"cfgUseGoodItsLayerAllCut", true, "Good ITS Layers All"}; // pileup - Configurable cTFBorder{"cTFBorder", false, "Timeframe Border Selection"}; // pileup - Configurable cNoItsROBorder{"cNoItsROBorder", false, "No ITSRO Border Cut"}; // pileup - Configurable cItsTpcVtx{"cItsTpcVtx", true, "ITS+TPC Vertex Selection"}; // pileup - Configurable cZVtxTimeDiff{"cZVtxTimeDiff", false, "z-vtx time diff selection"}; // pileup - Configurable cPVcont{"cPVcont", true, "primary vertex contributor"}; + // Centrality binning configuration + ConfigurableAxis centBining{"centBining", {0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100}, "Centrality/Multiplicity percentile bining"}; + Configurable cPileupReject{"cPileupReject", false, "Pileup rejection"}; // pileup + Configurable cfgUseGoodItsLayerAllCut{"cfgUseGoodItsLayerAllCut", false, "Good ITS Layers All"}; // pileup + Configurable cTFBorder{"cTFBorder", false, "Timeframe Border Selection"}; // pileup + Configurable cNoItsROBorder{"cNoItsROBorder", false, "No ITSRO Border Cut"}; // pileup + Configurable cItsTpcVtx{"cItsTpcVtx", false, "ITS+TPC Vertex Selection"}; // pileup + Configurable cZVtxTimeDiff{"cZVtxTimeDiff", false, "z-vtx time diff selection"}; // pileup + Configurable cPVcont{"cPVcont", false, "primary vertex contributor"}; + + // Configurable to enable multiplicity correlation cuts O2_DEFINE_CONFIGURABLE(cfgEvSelMultCorrelation, bool, true, "Multiplicity correlation cut") + + // Struct grouping multiplicity vs centrality/vertex cuts and related parameters struct : ConfigurableGroup { + // Flags to enable specific multiplicity correlation cuts O2_DEFINE_CONFIGURABLE(cfgMultPVT0CCutEnabled, bool, true, "Enable PV multiplicity vs T0C centrality cut") O2_DEFINE_CONFIGURABLE(cfgMultGlobalFT0CCutEnabled, bool, true, "Enable globalTracks vs FT0C multiplicity cut") O2_DEFINE_CONFIGURABLE(cfgMultGlobalPVCutEnabled, bool, true, "Enable globalTracks vs PV multiplicity cut") + // Parameter values for PV multiplicity vs FT0C centrality cut (polynomial coefficients, etc.) Configurable> cfgMultPVT0CCutPars{"cfgMultPVT0CCutPars", std::vector{30.434, -0.917137, 0.0185032, -0.000198425, 7.94381e-07, 13.7406, -0.282656, 0.00556147, -6.32766e-05, 2.51648e-07}, "PV multiplicity vs T0C centrality cut parameter values"}; + // Parameter values for globalTracks vs FT0C multiplicity cut Configurable> cfgMultGlobalFT0CCutPars{"cfgMultGlobalFT0CCutPars", std::vector{18.9628, -0.576466, 0.0117324, -0.000126086, 5.05365e-07, 8.99921, -0.188022, 0.0037089, -4.20275e-05, 1.68234e-07}, "globalTracks vs FT0C cut parameter values"}; + // Parameter values for globalTracks vs PV multiplicity cut Configurable> cfgMultGlobalPVCutPars{"cfgMultGlobalPVCutPars", std::vector{0.148031, 0.616699, 0.603083, 0.112751, -0.0013846, 8.38211e-06}, "globalTracks vs PV cut parameter values"}; + // Local vectors to store the above parameters std::vector multPVT0CCutPars; std::vector multGlobalFT0CPars; std::vector multGlobalPVCutPars; + // TF1 objects to represent low/high cut functions for the above correlations TF1* fMultPVT0CCutLow = nullptr; TF1* fMultPVT0CCutHigh = nullptr; TF1* fMultGlobalFT0CCutLow = nullptr; @@ -140,9 +164,10 @@ struct NetchargeFluctuations { } cfgFunCoeff; - // CCDB efficiency histograms + // Histogram pointer for CCDB efficiency TH1D* efficiency = nullptr; + // Filters for selecting collisions and tracks Filter collisionFilter = nabs(aod::collision::posZ) <= vertexZcut; Filter trackFilter = (nabs(aod::track::eta) < etaCut) && (aod::track::pt > ptMinCut) && (aod::track::pt < ptMaxCut) && (requireGlobalTrackInFilter()); @@ -166,6 +191,9 @@ struct NetchargeFluctuations { void init(o2::framework::InitContext&) { + // ------------------------------- + // Define histogram axes specifications + // ------------------------------- const AxisSpec vtxzAxis = {800, -20, 20, "V_{Z} (cm)"}; const AxisSpec dcaAxis = {1000, -0.5, 0.5, "DCA_{xy} (cm)"}; const AxisSpec dcazAxis = {600, -3, 3, "DCA_{z} (cm)"}; @@ -185,10 +213,12 @@ struct NetchargeFluctuations { const AxisSpec nchpAxis = {50000, 0, 50000, "Nch"}; const AxisSpec cent1Axis{centBining, "Multiplicity percentile from FT0M (%)"}; + // Subsample axis (used for error estimation from subsamples) auto noSubsample = static_cast(cfgNSubsample); float maxSubsample = 1.0 * noSubsample; AxisSpec subsampleAxis = {noSubsample, 0.0, maxSubsample, "subsample no."}; + // Add QA histograms histogramRegistry.add("QA/hVtxZ_before", "", kTH1F, {vtxzAxis}); histogramRegistry.add("QA/hDcaXY_before", "", kTH1F, {dcaAxis}); histogramRegistry.add("QA/hphi", "", kTH1F, {phiAxis}); @@ -316,6 +346,7 @@ struct NetchargeFluctuations { histogramRegistry.add("QA/hNchGlobal", "", kTH1F, {nchAxis}); histogramRegistry.add("QA/hNchPV", "", kTH1F, {nchAxis}); + // QA histograms for multiplicity correlations histogramRegistry.add("MultCorrelationPlots/globalTracks_PV_bef", "", {HistType::kTH2D, {nchAxis, nchAxis}}); histogramRegistry.add("MultCorrelationPlots/globalTracks_FT0C_bef", "", {HistType::kTH2D, {centAxis, nchAxis}}); histogramRegistry.add("MultCorrelationPlots/PV_FT0C_bef", "", {HistType::kTH2D, {centAxis, nchAxis}}); @@ -328,42 +359,54 @@ struct NetchargeFluctuations { cfgFunCoeff.multGlobalFT0CPars = cfgFunCoeff.cfgMultGlobalFT0CCutPars; cfgFunCoeff.multGlobalPVCutPars = cfgFunCoeff.cfgMultGlobalPVCutPars; + // --- Initialize PV vs FT0C multiplicity cut functions --- + // Lower cut function: 4th-order polynomial minus 3.5 sigma deviation + cfgFunCoeff.fMultPVT0CCutLow = new TF1("fMultPVT0CCutLow", - "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x - 2.0*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", + "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x - 3.5*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", 0, 100); cfgFunCoeff.fMultPVT0CCutLow->SetParameters(&(cfgFunCoeff.multPVT0CCutPars[0])); + // Upper cut function: 4th-order polynomial plus 3.5 sigma deviation cfgFunCoeff.fMultPVT0CCutHigh = new TF1("fMultPVT0CCutHigh", - "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x + 2.*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", + "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x + 3.5*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", 0, 100); cfgFunCoeff.fMultPVT0CCutHigh->SetParameters(&(cfgFunCoeff.multPVT0CCutPars[0])); + // --- Initialize globalTracks vs FT0C multiplicity cut functions --- + // Lower cut function cfgFunCoeff.fMultGlobalFT0CCutLow = new TF1("fMultGlobalFT0CCutLow", - "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x - 2.*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", + "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x - 3.5*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", 0, 100); cfgFunCoeff.fMultGlobalFT0CCutLow->SetParameters(&(cfgFunCoeff.multGlobalFT0CPars[0])); + // Upper cut function cfgFunCoeff.fMultGlobalFT0CCutHigh = new TF1("fMultGlobalFT0CCutHigh", - "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x + 2.*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", + "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x + 3.5*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", 0, 100); cfgFunCoeff.fMultGlobalFT0CCutHigh->SetParameters(&(cfgFunCoeff.multGlobalFT0CPars[0])); + // --- Initialize globalTracks vs PV multiplicity cut functions --- + // Lower cut: linear + cubic term minus 3.5 sigma + cfgFunCoeff.fMultGlobalPVCutLow = new TF1("fMultGlobalPVCutLow", "[0]+[1]*x - 3.5*([2]+[3]*x+[4]*x*x+[5]*x*x*x)", 0, 100); cfgFunCoeff.fMultGlobalPVCutLow->SetParameters(&(cfgFunCoeff.multGlobalPVCutPars[0])); + // Upper cut: linear + cubic term plus 3.5 sigma cfgFunCoeff.fMultGlobalPVCutHigh = new TF1("fMultGlobalPVCutHigh", "[0]+[1]*x + 3.5*([2]+[3]*x+[4]*x*x+[5]*x*x*x)", 0, 100); cfgFunCoeff.fMultGlobalPVCutHigh->SetParameters(&(cfgFunCoeff.multGlobalPVCutPars[0])); + // --- Load efficiency histogram from CCDB if (cfgLoadEff) { ccdb->setURL(cfgUrlCCDB.value); ccdb->setCaching(true); @@ -371,6 +414,7 @@ struct NetchargeFluctuations { TList* list = ccdb->getForTimeStamp(cfgPathCCDB.value, -1); efficiency = reinterpret_cast(list->FindObject("efficiency_Run3")); + // Log fatal error if efficiency histogram is not found if (!efficiency) { LOGF(info, "FATAL!! Could not find required histograms in CCDB"); } @@ -1001,7 +1045,7 @@ struct NetchargeFluctuations { } } - PROCESS_SWITCH(NetchargeFluctuations, processDataRun3, "Process for Run3 DATA", true); + PROCESS_SWITCH(NetchargeFluctuations, processDataRun3, "Process for Run3 DATA", false); // process function for Data Run2 void processDataRun2(MyCollisionRun2 const& coll, MyTracks const& tracks) @@ -1015,7 +1059,7 @@ struct NetchargeFluctuations { } } - PROCESS_SWITCH(NetchargeFluctuations, processDataRun2, "Process for Run2 DATA", false); + PROCESS_SWITCH(NetchargeFluctuations, processDataRun2, "Process for Run2 DATA", true); // process function for MC Run3 From 457c3d0a514e576ed7f79c7696da8c2deed7c145 Mon Sep 17 00:00:00 2001 From: nidamalikk Date: Sat, 31 Jan 2026 16:58:35 +0530 Subject: [PATCH 04/11] Net charge --- .../Tasks/netchargeFluctuations.cxx | 304 ++++++++++++------ 1 file changed, 214 insertions(+), 90 deletions(-) diff --git a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx index 401833b75b5..9f0cce7c78a 100644 --- a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx @@ -26,7 +26,6 @@ #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/FT0Corrected.h" #include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/PIDResponse.h" #include "Common/DataModel/TrackSelectionTables.h" #include "CCDB/BasicCCDBManager.h" @@ -82,8 +81,9 @@ struct NetchargeFluctuations { // CCDB related configurations Configurable ccdbNoLaterThan{"ccdbNoLaterThan", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; Configurable cfgUrlCCDB{"cfgUrlCCDB", "http://alice-ccdb.cern.ch", "url of ccdb"}; - Configurable cfgPathCCDB{"cfgPathCCDB", "Users/n/nimalik/netcharge/p/Run3/LHC24f3d", "Path for ccdb-object"}; + Configurable cfgPathCCDB{"cfgPathCCDB", "Users/n/nimalik/My/Object/pn", "Path for ccdb-object"}; Configurable cfgLoadEff{"cfgLoadEff", true, "Load efficiency"}; + Configurable cfgEffNue{"cfgEffNue", false, "efficiency correction to nu_dyn"}; // Track and event selection cuts Configurable vertexZcut{"vertexZcut", 10.f, "Vertex Z"}; @@ -124,7 +124,7 @@ struct NetchargeFluctuations { Configurable cPVcont{"cPVcont", false, "primary vertex contributor"}; // Configurable to enable multiplicity correlation cuts - O2_DEFINE_CONFIGURABLE(cfgEvSelMultCorrelation, bool, true, "Multiplicity correlation cut") + O2_DEFINE_CONFIGURABLE(cfgEvSelMultCorrelation, bool, false, "Multiplicity correlation cut") // Struct grouping multiplicity vs centrality/vertex cuts and related parameters struct : ConfigurableGroup { @@ -165,7 +165,10 @@ struct NetchargeFluctuations { } cfgFunCoeff; // Histogram pointer for CCDB efficiency - TH1D* efficiency = nullptr; + // TH1D* efficiency = nullptr; + + TH1D* efficiencyPos = nullptr; + TH1D* efficiencyNeg = nullptr; // Filters for selecting collisions and tracks Filter collisionFilter = nabs(aod::collision::posZ) <= vertexZcut; @@ -288,8 +291,6 @@ struct NetchargeFluctuations { histogramRegistry.add("data/cent_posneg", "cent vs fpos*fneg", kTProfile, {cent1Axis}); histogramRegistry.add("data/hPt_cor", "", kTH1F, {ptAxis}); histogramRegistry.add("data/hEta_cor", "", kTH1F, {etaAxis}); - histogramRegistry.add("data/cent_nchTotal", "cent vs nchTotal", kTProfile, {cent1Axis}); - histogramRegistry.add("data/cent_nchTotalCor", "cent vs nchTotalCor", kTProfile, {cent1Axis}); histogramRegistry.add("data/nch_nchCor", "", kTProfile, {nchAxis}); histogramRegistry.add("data/nchCor", "", kTH1F, {nchAxis}); histogramRegistry.add("data/cent_nchCor", "", kTProfile, {cent1Axis}); @@ -346,6 +347,12 @@ struct NetchargeFluctuations { histogramRegistry.add("QA/hNchGlobal", "", kTH1F, {nchAxis}); histogramRegistry.add("QA/hNchPV", "", kTH1F, {nchAxis}); + + histogramRegistry.add("eff/hPt_np_gen", "", kTH1F, {ptAxis}); + histogramRegistry.add("eff/hPt_nm_gen", "", kTH1F, {ptAxis}); + histogramRegistry.add("eff/hPt_np", "", kTH1F, {ptAxis}); + histogramRegistry.add("eff/hPt_nm", "", kTH1F, {ptAxis}); + // QA histograms for multiplicity correlations histogramRegistry.add("MultCorrelationPlots/globalTracks_PV_bef", "", {HistType::kTH2D, {nchAxis, nchAxis}}); histogramRegistry.add("MultCorrelationPlots/globalTracks_FT0C_bef", "", {HistType::kTH2D, {centAxis, nchAxis}}); @@ -413,9 +420,10 @@ struct NetchargeFluctuations { ccdb->setLocalObjectValidityChecking(); TList* list = ccdb->getForTimeStamp(cfgPathCCDB.value, -1); - efficiency = reinterpret_cast(list->FindObject("efficiency_Run3")); + efficiencyPos = reinterpret_cast(list->FindObject("efficiency_Pos_Run3")); + efficiencyNeg = reinterpret_cast(list->FindObject("efficiency_Neg_Run3")); // Log fatal error if efficiency histogram is not found - if (!efficiency) { + if (!efficiencyPos || !efficiencyNeg) { LOGF(info, "FATAL!! Could not find required histograms in CCDB"); } } @@ -550,8 +558,16 @@ struct NetchargeFluctuations { return true; } - double getEfficiency(float pt, TH1D* hEff) + double getEfficiency(float pt, int sign) { + TH1D* hEff = nullptr; + + if (sign > 0) { + hEff = efficiencyPos; + } else if (sign < 0) { + hEff = efficiencyNeg; + } + if (!hEff) { return 1e-6; } @@ -625,20 +641,23 @@ struct NetchargeFluctuations { histogramRegistry.fill(HIST("QA/hMultiplicity"), mult); int fpos = 0, fneg = 0, posneg = 0, termn = 0, termp = 0; + double fposW = 0, fnegW = 0,fposW2 = 0.0, fnegW2 = 0.0; + double posnegW = 0.0, termnW = 0.0, termpW = 0.0; int nch = 0, nchTotal = 0; - double posWeight = 0, negWeight = 0, nchCor = 0, nchTotalCor = 0; + double nchCor = 0; for (const auto& track : tracks) { - double eff = getEfficiency(track.pt(), efficiency); - if (eff < threshold) - continue; - double weight = 1.0 / eff; - fillBeforeQA(track); nchTotal += 1; - nchTotalCor += weight; if (!selTrack(track)) continue; + + double eff = getEfficiency(track.pt(), track.sign()); + if (eff < threshold){ + continue; + } + double weight = 1.0 / eff; + nch += 1; fillAfterQA(track); histogramRegistry.fill(HIST("QA/cent_hEta"), cent, track.eta()); @@ -646,28 +665,45 @@ struct NetchargeFluctuations { histogramRegistry.fill(HIST("data/hPt_cor"), track.pt(), weight); histogramRegistry.fill(HIST("data/hEta_cor"), track.eta(), weight); +if (track.sign() ==1){ +histogramRegistry.fill(HIST("eff/hPt_np"), track.pt()); +}else if (track.sign() == -1){ +histogramRegistry.fill(HIST("eff/hPt_nm"), track.pt()); +} + nchCor += weight; if (track.sign() == 1) { fpos += 1; - posWeight += weight; - } else if (track.sign() == -1) { - fneg += 1; - negWeight += weight; - } - + fposW += weight; + fposW2 += weight * weight; + } + else if (track.sign() == -1) { + fneg +=1; + fnegW += weight; + fnegW2 += weight * weight; + } } // track termp = fpos * (fpos - 1); termn = fneg * (fneg - 1); posneg = fpos * fneg; - histogramRegistry.fill(HIST("data/cent_nchTotal"), cent, nchTotal); - histogramRegistry.fill(HIST("data/cent_nchTotalCor"), cent, nchTotalCor); + termpW = fposW * fposW - fposW2; + termnW = fnegW * fnegW - fnegW2; + posnegW = fposW * fnegW; + histogramRegistry.fill(HIST("data/nch_nchCor"), nch, nchCor); histogramRegistry.fill(HIST("data/nchCor"), nchCor); histogramRegistry.fill(HIST("data/cent_nchCor"), cent, nchCor); - histogramRegistry.fill(HIST("data/cent_pos_cor"), cent, posWeight); - histogramRegistry.fill(HIST("data/cent_neg_cor"), cent, negWeight); + histogramRegistry.fill(HIST("data/cent_nch"), cent, nch); + histogramRegistry.fill(HIST("data/cent_pos_cor"), cent, fposW); + histogramRegistry.fill(HIST("data/cent_neg_cor"), cent, fnegW); + + + if (cfgEffNue) { + fillHistograms(nchCor, cent, fposW, fnegW, posnegW, termpW, termnW); + } else { fillHistograms(nch, cent, fpos, fneg, posneg, termp, termn); + } } template @@ -707,8 +743,10 @@ struct NetchargeFluctuations { histogramRegistry.fill(HIST("QA/hMultiplicity"), mult); int fpos = 0, fneg = 0, posneg = 0, termn = 0, termp = 0; - int nch = 0, nchCor = 0; - double posRecWeight = 0, negRecWeight = 0; + double fposW = 0.0, fnegW = 0.0,fposW2 = 0.0, fnegW2 = 0.0; + double posnegW = 0.0, termnW = 0.0, termpW = 0.0; + int nch = 0; + double nchCor = 0.0; for (const auto& track : inputTracks) { fillBeforeQA(track); @@ -716,35 +754,55 @@ struct NetchargeFluctuations { continue; nch += 1; fillAfterQA(track); + + if (track.sign() ==1){ + histogramRegistry.fill(HIST("eff/hPt_np"), track.pt()); + }else if (track.sign() == -1){ + histogramRegistry.fill(HIST("eff/hPt_nm"), track.pt()); + } + histogramRegistry.fill(HIST("QA/cent_hEta"), cent, track.eta()); histogramRegistry.fill(HIST("QA/cent_hPt"), cent, track.pt()); - double eff = getEfficiency(track.pt(), efficiency); + double eff = getEfficiency(track.pt(), track.sign()); if (eff < threshold) continue; double weight = 1.0 / eff; histogramRegistry.fill(HIST("data/hPt_cor"), track.pt(), weight); histogramRegistry.fill(HIST("data/hEta_cor"), track.eta(), weight); - if (track.sign() == 1) { + if (track.sign() == 1) { fpos += 1; - posRecWeight += weight; - } else if (track.sign() == -1) { - fneg += 1; - negRecWeight += weight; - } - nchCor = posRecWeight + negRecWeight; + fposW += weight; + fposW2 += weight * weight; + } + else if (track.sign() == -1) { + fneg +=1; + fnegW += weight; + fnegW2 += weight * weight; + } + nchCor += weight ; } // track termp = fpos * (fpos - 1); termn = fneg * (fneg - 1); posneg = fpos * fneg; - histogramRegistry.fill(HIST("data/nch_nchCor"), nch, nchCor); - histogramRegistry.fill(HIST("data/nchCor"), nchCor); - histogramRegistry.fill(HIST("data/cent_nchCor"), cent, nchCor); - histogramRegistry.fill(HIST("data/cent_pos_cor"), cent, posRecWeight); - histogramRegistry.fill(HIST("data/cent_neg_cor"), cent, negRecWeight); + termpW = fposW * fposW - fposW2; + termnW = fnegW * fnegW - fnegW2; + posnegW = fposW * fnegW; + + histogramRegistry.fill(HIST("data/nch_nchCor"), nch, nchCor); + histogramRegistry.fill(HIST("data/nchCor"), nchCor); + histogramRegistry.fill(HIST("data/cent_nchCor"), cent, nchCor); + histogramRegistry.fill(HIST("data/cent_nch"), cent, nch); + histogramRegistry.fill(HIST("data/cent_pos_cor"), cent, fposW); + histogramRegistry.fill(HIST("data/cent_neg_cor"), cent, fnegW); + + if (cfgEffNue) { + fillHistograms(nchCor, cent, fposW, fnegW, posnegW, termpW, termnW); + } else { fillHistograms(nch, cent, fpos, fneg, posneg, termp, termn); + } int posGen = 0, negGen = 0, posNegGen = 0, termNGen = 0, termPGen = 0, nchGen = 0; @@ -774,8 +832,15 @@ struct NetchargeFluctuations { continue; if (std::fabs(mcpart.eta()) >= etaCut) continue; - if ((mcpart.pt() <= ptMinCut) || (mcpart.pt() >= ptMaxCut)) + if ((mcpart.pt() <= ptMinCut) || (mcpart.pt() >= ptMaxCut)){ continue; + } + if (sign ==1){ + histogramRegistry.fill(HIST("eff/hPt_np_gen"), mcpart.pt()); + }else if (sign == -1){ + histogramRegistry.fill(HIST("eff/hPt_nm_gen"), mcpart.pt()); + } + histogramRegistry.fill(HIST("gen/hPt"), mcpart.pt()); histogramRegistry.fill(HIST("gen/cent_hPt"), cent, mcpart.pt()); histogramRegistry.fill(HIST("gen/hEta"), mcpart.eta()); @@ -789,7 +854,7 @@ struct NetchargeFluctuations { if (sign == -1) { negGen += 1; } - } + } termPGen = posGen * (posGen - 1); termNGen = negGen * (negGen - 1); posNegGen = posGen * negGen; @@ -832,54 +897,93 @@ struct NetchargeFluctuations { return; histogramRegistry.fill(HIST("data/delta_eta_cent"), cent); - int fpos = 0, fneg = 0, posneg = 0, termn = 0, termp = 0, nch = 0, nchTotal = 0; - double nchCor = 0, posWeight = 0, negWeight = 0; - for (const auto& track : tracks) { - nchTotal += 1; - if (!selTrack(track)) - continue; - nch += 1; - double eff = getEfficiency(track.pt(), efficiency); - if (eff < threshold) - continue; - double weight = 1.0 / eff; - nchCor += weight; - double eta = track.eta(); - if (eta < deta1 || eta > deta2) - continue; + int fpos = 0, fneg = 0, termp = 0, termn = 0, posneg = 0; + double fposW = 0.0, fnegW = 0.0; + double fposW2 = 0.0, fnegW2 = 0.0; + double termpW = 0.0, termnW = 0.0, posnegW = 0.0; - histogramRegistry.fill(HIST("data/delta_eta_eta"), eta); + int nch = 0, nchTotal = 0; + double nchCor = 0.0; - if (track.sign() == 1) { - fpos++; - posWeight += weight; - } else if (track.sign() == -1) { - fneg++; - negWeight += weight; - } - } - termp = fpos * (fpos - 1); - termn = fneg * (fneg - 1); - posneg = fpos * fneg; +for (const auto& track : tracks) { + + nchTotal += 1; + if (!selTrack(track)) + continue; + + double eta = track.eta(); + if (eta < deta1 || eta > deta2) + continue; + + double eff = getEfficiency(track.pt(), track.sign()); + if (eff < threshold) + continue; + + double weight = 1.0 / eff; + + nch += 1; + nchCor += weight; + + histogramRegistry.fill(HIST("data/delta_eta_eta"), eta); + + if (track.sign() == 1) { + fpos += 1; + fposW += weight; + fposW2 += weight * weight; + } else if (track.sign() == -1) { + fneg += 1; + fnegW += weight; + fnegW2 += weight * weight; + } +} + + termp = fpos * (fpos - 1); + termn = fneg * (fneg - 1); + posneg = fpos * fneg; + + termpW = fposW * fposW - fposW2; + termnW = fnegW * fnegW - fnegW2; + posnegW = fposW * fnegW; float deltaEtaWidth = deta2 - deta1 + 1e-5f; - histogramRegistry.fill(HIST("data/delta_eta_nchTotal"), deltaEtaWidth, nchTotal); histogramRegistry.fill(HIST("data/delta_eta_nch"), deltaEtaWidth, nch); histogramRegistry.fill(HIST("data/delta_eta_nchCor"), deltaEtaWidth, nchCor); + histogramRegistry.fill(HIST("data/delta_eta_pos_cor"), deltaEtaWidth, fposW); + histogramRegistry.fill(HIST("data/delta_eta_neg_cor"), deltaEtaWidth, fnegW); + + + if (cfgEffNue) { + histogramRegistry.fill(HIST("data/delta_eta_pos"), deltaEtaWidth, fposW); + histogramRegistry.fill(HIST("data/delta_eta_neg"), deltaEtaWidth, fnegW); + histogramRegistry.fill(HIST("data/delta_eta_termp"), deltaEtaWidth, termpW); + histogramRegistry.fill(HIST("data/delta_eta_termn"), deltaEtaWidth, termnW); + histogramRegistry.fill(HIST("data/delta_eta_pos_sq"), deltaEtaWidth, fposW * fposW); + histogramRegistry.fill(HIST("data/delta_eta_neg_sq"), deltaEtaWidth, fnegW * fnegW); + histogramRegistry.fill(HIST("data/delta_eta_posneg"), deltaEtaWidth, posnegW); +} else { + histogramRegistry.fill(HIST("data/delta_eta_pos"), deltaEtaWidth, fpos); - histogramRegistry.fill(HIST("data/delta_eta_pos_cor"), deltaEtaWidth, posWeight); histogramRegistry.fill(HIST("data/delta_eta_neg"), deltaEtaWidth, fneg); - histogramRegistry.fill(HIST("data/delta_eta_neg_cor"), deltaEtaWidth, negWeight); histogramRegistry.fill(HIST("data/delta_eta_termp"), deltaEtaWidth, termp); histogramRegistry.fill(HIST("data/delta_eta_termn"), deltaEtaWidth, termn); histogramRegistry.fill(HIST("data/delta_eta_pos_sq"), deltaEtaWidth, fpos * fpos); histogramRegistry.fill(HIST("data/delta_eta_neg_sq"), deltaEtaWidth, fneg * fneg); histogramRegistry.fill(HIST("data/delta_eta_posneg"), deltaEtaWidth, posneg); - +} float lRandom = fRndm->Rndm(); int sampleIndex = static_cast(cfgNSubsample * lRandom); + + if (cfgEffNue) { + histogramRegistry.fill(HIST("subsample/delta_eta/pos"), deltaEtaWidth, sampleIndex, fposW); + histogramRegistry.fill(HIST("subsample/delta_eta/neg"), deltaEtaWidth, sampleIndex, fnegW); + histogramRegistry.fill(HIST("subsample/delta_eta/termp"), deltaEtaWidth, sampleIndex, termpW); + histogramRegistry.fill(HIST("subsample/delta_eta/termn"), deltaEtaWidth, sampleIndex, termnW); + histogramRegistry.fill(HIST("subsample/delta_eta/pos_sq"), deltaEtaWidth, sampleIndex, fposW * fposW); + histogramRegistry.fill(HIST("subsample/delta_eta/neg_sq"), deltaEtaWidth, sampleIndex, fnegW * fnegW); + histogramRegistry.fill(HIST("subsample/delta_eta/posneg"), deltaEtaWidth, sampleIndex, posnegW); + } else { histogramRegistry.fill(HIST("subsample/delta_eta/pos"), deltaEtaWidth, sampleIndex, fpos); histogramRegistry.fill(HIST("subsample/delta_eta/neg"), deltaEtaWidth, sampleIndex, fneg); histogramRegistry.fill(HIST("subsample/delta_eta/termp"), deltaEtaWidth, sampleIndex, termp); @@ -887,6 +991,7 @@ struct NetchargeFluctuations { histogramRegistry.fill(HIST("subsample/delta_eta/pos_sq"), deltaEtaWidth, sampleIndex, fpos * fpos); histogramRegistry.fill(HIST("subsample/delta_eta/neg_sq"), deltaEtaWidth, sampleIndex, fneg * fneg); histogramRegistry.fill(HIST("subsample/delta_eta/posneg"), deltaEtaWidth, sampleIndex, posneg); + } } template @@ -914,7 +1019,9 @@ struct NetchargeFluctuations { int fpos = 0, fneg = 0, posneg = 0, termn = 0, termp = 0; int nch = 0, nchTotal = 0; - double nchCor = 0, posRecWeight = 0, negRecWeight = 0; + double fposW = 0.0, fnegW = 0.0; + double fposW2 = 0.0, fnegW2 = 0.0; + double nchCor = 0.0, termpW = 0.0, termnW = 0.0, posnegW = 0.0; for (const auto& track : inputTracks) { nchTotal += 1; @@ -925,38 +1032,55 @@ struct NetchargeFluctuations { continue; histogramRegistry.fill(HIST("data/delta_eta_eta"), eta); - double eff = getEfficiency(track.pt(), efficiency); + double eff = getEfficiency(track.pt(), track.sign()); if (eff < threshold) continue; double weight = 1.0 / eff; nch += 1; nchCor += weight; - if (track.sign() == 1) { - fpos += 1; - posRecWeight += weight; - } else if (track.sign() == -1) { - fneg += 1; - negRecWeight += weight; - } - } // tracks + if (track.sign() == 1) { + fpos += 1; + fposW += weight; + fposW2 += weight * weight; +} else if (track.sign() == -1) { + fneg += 1; + fnegW += weight; + fnegW2 += weight * weight; +} } // tracks termp = fpos * (fpos - 1); termn = fneg * (fneg - 1); posneg = fpos * fneg; - histogramRegistry.fill(HIST("data/delta_eta_nchTotal"), deltaEtaWidth, nchTotal); + termpW = fposW * fposW - fposW2; + termnW = fnegW * fnegW - fnegW2; + posnegW = fposW * fnegW; + + histogramRegistry.fill(HIST("data/delta_eta_nch"), deltaEtaWidth, nch); histogramRegistry.fill(HIST("data/delta_eta_nchCor"), deltaEtaWidth, nchCor); + histogramRegistry.fill(HIST("data/delta_eta_pos_cor"), deltaEtaWidth, fposW); + histogramRegistry.fill(HIST("data/delta_eta_neg_cor"), deltaEtaWidth, fnegW); + + if (cfgEffNue) { + histogramRegistry.fill(HIST("data/delta_eta_pos"), deltaEtaWidth, fposW); + histogramRegistry.fill(HIST("data/delta_eta_neg"), deltaEtaWidth, fnegW); + histogramRegistry.fill(HIST("data/delta_eta_termp"), deltaEtaWidth, termpW); + histogramRegistry.fill(HIST("data/delta_eta_termn"), deltaEtaWidth, termnW); + histogramRegistry.fill(HIST("data/delta_eta_pos_sq"), deltaEtaWidth, fposW * fposW); + histogramRegistry.fill(HIST("data/delta_eta_neg_sq"), deltaEtaWidth, fnegW * fnegW); + histogramRegistry.fill(HIST("data/delta_eta_posneg"), deltaEtaWidth, posnegW); +} else { + histogramRegistry.fill(HIST("data/delta_eta_pos"), deltaEtaWidth, fpos); - histogramRegistry.fill(HIST("data/delta_eta_pos_cor"), deltaEtaWidth, posRecWeight); histogramRegistry.fill(HIST("data/delta_eta_neg"), deltaEtaWidth, fneg); - histogramRegistry.fill(HIST("data/delta_eta_neg_cor"), deltaEtaWidth, negRecWeight); histogramRegistry.fill(HIST("data/delta_eta_termp"), deltaEtaWidth, termp); histogramRegistry.fill(HIST("data/delta_eta_termn"), deltaEtaWidth, termn); histogramRegistry.fill(HIST("data/delta_eta_pos_sq"), deltaEtaWidth, fpos * fpos); histogramRegistry.fill(HIST("data/delta_eta_neg_sq"), deltaEtaWidth, fneg * fneg); histogramRegistry.fill(HIST("data/delta_eta_posneg"), deltaEtaWidth, posneg); - +} + const auto& mccolgen = coll.template mcCollision_as(); if (std::abs(mccolgen.posZ()) >= vertexZcut) @@ -1059,7 +1183,7 @@ struct NetchargeFluctuations { } } - PROCESS_SWITCH(NetchargeFluctuations, processDataRun2, "Process for Run2 DATA", true); + PROCESS_SWITCH(NetchargeFluctuations, processDataRun2, "Process for Run2 DATA", false); // process function for MC Run3 @@ -1073,7 +1197,7 @@ struct NetchargeFluctuations { calculationMcDeltaEta(coll, inputTracks, mcCollisions, mcParticles, etaMin, etaMax); } } - PROCESS_SWITCH(NetchargeFluctuations, processMcRun3, "Process reconstructed", false); + PROCESS_SWITCH(NetchargeFluctuations, processMcRun3, "Process reconstructed", true); // process function for MC Run2 From 0cedf7784c92bdc97364dce56e2820786d191872 Mon Sep 17 00:00:00 2001 From: nidamalikk Date: Sat, 31 Jan 2026 17:05:32 +0530 Subject: [PATCH 05/11] Net charge --- .../Tasks/netchargeFluctuations.cxx | 332 +++++++++--------- 1 file changed, 163 insertions(+), 169 deletions(-) diff --git a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx index 9f0cce7c78a..45b052ba328 100644 --- a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx @@ -165,8 +165,8 @@ struct NetchargeFluctuations { } cfgFunCoeff; // Histogram pointer for CCDB efficiency - // TH1D* efficiency = nullptr; - + // TH1D* efficiency = nullptr; + TH1D* efficiencyPos = nullptr; TH1D* efficiencyNeg = nullptr; @@ -347,7 +347,6 @@ struct NetchargeFluctuations { histogramRegistry.add("QA/hNchGlobal", "", kTH1F, {nchAxis}); histogramRegistry.add("QA/hNchPV", "", kTH1F, {nchAxis}); - histogramRegistry.add("eff/hPt_np_gen", "", kTH1F, {ptAxis}); histogramRegistry.add("eff/hPt_nm_gen", "", kTH1F, {ptAxis}); histogramRegistry.add("eff/hPt_np", "", kTH1F, {ptAxis}); @@ -560,13 +559,13 @@ struct NetchargeFluctuations { double getEfficiency(float pt, int sign) { - TH1D* hEff = nullptr; - - if (sign > 0) { - hEff = efficiencyPos; - } else if (sign < 0) { - hEff = efficiencyNeg; - } + TH1D* hEff = nullptr; + + if (sign > 0) { + hEff = efficiencyPos; + } else if (sign < 0) { + hEff = efficiencyNeg; + } if (!hEff) { return 1e-6; @@ -641,19 +640,19 @@ struct NetchargeFluctuations { histogramRegistry.fill(HIST("QA/hMultiplicity"), mult); int fpos = 0, fneg = 0, posneg = 0, termn = 0, termp = 0; - double fposW = 0, fnegW = 0,fposW2 = 0.0, fnegW2 = 0.0; + double fposW = 0, fnegW = 0, fposW2 = 0.0, fnegW2 = 0.0; double posnegW = 0.0, termnW = 0.0, termpW = 0.0; int nch = 0, nchTotal = 0; - double nchCor = 0; + double nchCor = 0; for (const auto& track : tracks) { fillBeforeQA(track); nchTotal += 1; if (!selTrack(track)) continue; - - double eff = getEfficiency(track.pt(), track.sign()); - if (eff < threshold){ + + double eff = getEfficiency(track.pt(), track.sign()); + if (eff < threshold) { continue; } double weight = 1.0 / eff; @@ -665,31 +664,30 @@ struct NetchargeFluctuations { histogramRegistry.fill(HIST("data/hPt_cor"), track.pt(), weight); histogramRegistry.fill(HIST("data/hEta_cor"), track.eta(), weight); -if (track.sign() ==1){ -histogramRegistry.fill(HIST("eff/hPt_np"), track.pt()); -}else if (track.sign() == -1){ -histogramRegistry.fill(HIST("eff/hPt_nm"), track.pt()); -} + if (track.sign() == 1) { + histogramRegistry.fill(HIST("eff/hPt_np"), track.pt()); + } else if (track.sign() == -1) { + histogramRegistry.fill(HIST("eff/hPt_nm"), track.pt()); + } nchCor += weight; if (track.sign() == 1) { fpos += 1; - fposW += weight; + fposW += weight; fposW2 += weight * weight; - } - else if (track.sign() == -1) { - fneg +=1; - fnegW += weight; - fnegW2 += weight * weight; - } + } else if (track.sign() == -1) { + fneg += 1; + fnegW += weight; + fnegW2 += weight * weight; + } } // track termp = fpos * (fpos - 1); termn = fneg * (fneg - 1); posneg = fpos * fneg; - termpW = fposW * fposW - fposW2; - termnW = fnegW * fnegW - fnegW2; - posnegW = fposW * fnegW; + termpW = fposW * fposW - fposW2; + termnW = fnegW * fnegW - fnegW2; + posnegW = fposW * fnegW; histogramRegistry.fill(HIST("data/nch_nchCor"), nch, nchCor); histogramRegistry.fill(HIST("data/nchCor"), nchCor); @@ -697,12 +695,11 @@ histogramRegistry.fill(HIST("eff/hPt_nm"), track.pt()); histogramRegistry.fill(HIST("data/cent_nch"), cent, nch); histogramRegistry.fill(HIST("data/cent_pos_cor"), cent, fposW); histogramRegistry.fill(HIST("data/cent_neg_cor"), cent, fnegW); - - - if (cfgEffNue) { - fillHistograms(nchCor, cent, fposW, fnegW, posnegW, termpW, termnW); + + if (cfgEffNue) { + fillHistograms(nchCor, cent, fposW, fnegW, posnegW, termpW, termnW); } else { - fillHistograms(nch, cent, fpos, fneg, posneg, termp, termn); + fillHistograms(nch, cent, fpos, fneg, posneg, termp, termn); } } @@ -743,10 +740,10 @@ histogramRegistry.fill(HIST("eff/hPt_nm"), track.pt()); histogramRegistry.fill(HIST("QA/hMultiplicity"), mult); int fpos = 0, fneg = 0, posneg = 0, termn = 0, termp = 0; - double fposW = 0.0, fnegW = 0.0,fposW2 = 0.0, fnegW2 = 0.0; + double fposW = 0.0, fnegW = 0.0, fposW2 = 0.0, fnegW2 = 0.0; double posnegW = 0.0, termnW = 0.0, termpW = 0.0; int nch = 0; - double nchCor = 0.0; + double nchCor = 0.0; for (const auto& track : inputTracks) { fillBeforeQA(track); @@ -755,11 +752,11 @@ histogramRegistry.fill(HIST("eff/hPt_nm"), track.pt()); nch += 1; fillAfterQA(track); - if (track.sign() ==1){ - histogramRegistry.fill(HIST("eff/hPt_np"), track.pt()); - }else if (track.sign() == -1){ - histogramRegistry.fill(HIST("eff/hPt_nm"), track.pt()); - } + if (track.sign() == 1) { + histogramRegistry.fill(HIST("eff/hPt_np"), track.pt()); + } else if (track.sign() == -1) { + histogramRegistry.fill(HIST("eff/hPt_nm"), track.pt()); + } histogramRegistry.fill(HIST("QA/cent_hEta"), cent, track.eta()); histogramRegistry.fill(HIST("QA/cent_hPt"), cent, track.pt()); @@ -771,37 +768,36 @@ histogramRegistry.fill(HIST("eff/hPt_nm"), track.pt()); histogramRegistry.fill(HIST("data/hPt_cor"), track.pt(), weight); histogramRegistry.fill(HIST("data/hEta_cor"), track.eta(), weight); - if (track.sign() == 1) { + if (track.sign() == 1) { fpos += 1; - fposW += weight; + fposW += weight; fposW2 += weight * weight; - } - else if (track.sign() == -1) { - fneg +=1; - fnegW += weight; - fnegW2 += weight * weight; - } - nchCor += weight ; + } else if (track.sign() == -1) { + fneg += 1; + fnegW += weight; + fnegW2 += weight * weight; + } + nchCor += weight; } // track termp = fpos * (fpos - 1); termn = fneg * (fneg - 1); posneg = fpos * fneg; - termpW = fposW * fposW - fposW2; - termnW = fnegW * fnegW - fnegW2; - posnegW = fposW * fnegW; + termpW = fposW * fposW - fposW2; + termnW = fnegW * fnegW - fnegW2; + posnegW = fposW * fnegW; - histogramRegistry.fill(HIST("data/nch_nchCor"), nch, nchCor); - histogramRegistry.fill(HIST("data/nchCor"), nchCor); - histogramRegistry.fill(HIST("data/cent_nchCor"), cent, nchCor); - histogramRegistry.fill(HIST("data/cent_nch"), cent, nch); - histogramRegistry.fill(HIST("data/cent_pos_cor"), cent, fposW); - histogramRegistry.fill(HIST("data/cent_neg_cor"), cent, fnegW); + histogramRegistry.fill(HIST("data/nch_nchCor"), nch, nchCor); + histogramRegistry.fill(HIST("data/nchCor"), nchCor); + histogramRegistry.fill(HIST("data/cent_nchCor"), cent, nchCor); + histogramRegistry.fill(HIST("data/cent_nch"), cent, nch); + histogramRegistry.fill(HIST("data/cent_pos_cor"), cent, fposW); + histogramRegistry.fill(HIST("data/cent_neg_cor"), cent, fnegW); - if (cfgEffNue) { - fillHistograms(nchCor, cent, fposW, fnegW, posnegW, termpW, termnW); + if (cfgEffNue) { + fillHistograms(nchCor, cent, fposW, fnegW, posnegW, termpW, termnW); } else { - fillHistograms(nch, cent, fpos, fneg, posneg, termp, termn); + fillHistograms(nch, cent, fpos, fneg, posneg, termp, termn); } int posGen = 0, negGen = 0, posNegGen = 0, termNGen = 0, termPGen = 0, nchGen = 0; @@ -832,14 +828,14 @@ histogramRegistry.fill(HIST("eff/hPt_nm"), track.pt()); continue; if (std::fabs(mcpart.eta()) >= etaCut) continue; - if ((mcpart.pt() <= ptMinCut) || (mcpart.pt() >= ptMaxCut)){ + if ((mcpart.pt() <= ptMinCut) || (mcpart.pt() >= ptMaxCut)) { continue; } - if (sign ==1){ - histogramRegistry.fill(HIST("eff/hPt_np_gen"), mcpart.pt()); - }else if (sign == -1){ - histogramRegistry.fill(HIST("eff/hPt_nm_gen"), mcpart.pt()); - } + if (sign == 1) { + histogramRegistry.fill(HIST("eff/hPt_np_gen"), mcpart.pt()); + } else if (sign == -1) { + histogramRegistry.fill(HIST("eff/hPt_nm_gen"), mcpart.pt()); + } histogramRegistry.fill(HIST("gen/hPt"), mcpart.pt()); histogramRegistry.fill(HIST("gen/cent_hPt"), cent, mcpart.pt()); @@ -854,7 +850,7 @@ histogramRegistry.fill(HIST("eff/hPt_nm"), track.pt()); if (sign == -1) { negGen += 1; } - } + } termPGen = posGen * (posGen - 1); termNGen = negGen * (negGen - 1); posNegGen = posGen * negGen; @@ -898,52 +894,52 @@ histogramRegistry.fill(HIST("eff/hPt_nm"), track.pt()); histogramRegistry.fill(HIST("data/delta_eta_cent"), cent); int fpos = 0, fneg = 0, termp = 0, termn = 0, posneg = 0; - double fposW = 0.0, fnegW = 0.0; - double fposW2 = 0.0, fnegW2 = 0.0; - double termpW = 0.0, termnW = 0.0, posnegW = 0.0; + double fposW = 0.0, fnegW = 0.0; + double fposW2 = 0.0, fnegW2 = 0.0; + double termpW = 0.0, termnW = 0.0, posnegW = 0.0; - int nch = 0, nchTotal = 0; - double nchCor = 0.0; + int nch = 0, nchTotal = 0; + double nchCor = 0.0; -for (const auto& track : tracks) { + for (const auto& track : tracks) { - nchTotal += 1; - if (!selTrack(track)) - continue; + nchTotal += 1; + if (!selTrack(track)) + continue; - double eta = track.eta(); - if (eta < deta1 || eta > deta2) - continue; + double eta = track.eta(); + if (eta < deta1 || eta > deta2) + continue; - double eff = getEfficiency(track.pt(), track.sign()); - if (eff < threshold) - continue; + double eff = getEfficiency(track.pt(), track.sign()); + if (eff < threshold) + continue; - double weight = 1.0 / eff; + double weight = 1.0 / eff; - nch += 1; - nchCor += weight; + nch += 1; + nchCor += weight; - histogramRegistry.fill(HIST("data/delta_eta_eta"), eta); + histogramRegistry.fill(HIST("data/delta_eta_eta"), eta); - if (track.sign() == 1) { - fpos += 1; - fposW += weight; - fposW2 += weight * weight; - } else if (track.sign() == -1) { - fneg += 1; - fnegW += weight; - fnegW2 += weight * weight; - } -} + if (track.sign() == 1) { + fpos += 1; + fposW += weight; + fposW2 += weight * weight; + } else if (track.sign() == -1) { + fneg += 1; + fnegW += weight; + fnegW2 += weight * weight; + } + } - termp = fpos * (fpos - 1); - termn = fneg * (fneg - 1); - posneg = fpos * fneg; + termp = fpos * (fpos - 1); + termn = fneg * (fneg - 1); + posneg = fpos * fneg; - termpW = fposW * fposW - fposW2; - termnW = fnegW * fnegW - fnegW2; - posnegW = fposW * fnegW; + termpW = fposW * fposW - fposW2; + termnW = fnegW * fnegW - fnegW2; + posnegW = fposW * fnegW; float deltaEtaWidth = deta2 - deta1 + 1e-5f; @@ -952,45 +948,43 @@ for (const auto& track : tracks) { histogramRegistry.fill(HIST("data/delta_eta_pos_cor"), deltaEtaWidth, fposW); histogramRegistry.fill(HIST("data/delta_eta_neg_cor"), deltaEtaWidth, fnegW); - if (cfgEffNue) { - histogramRegistry.fill(HIST("data/delta_eta_pos"), deltaEtaWidth, fposW); - histogramRegistry.fill(HIST("data/delta_eta_neg"), deltaEtaWidth, fnegW); - histogramRegistry.fill(HIST("data/delta_eta_termp"), deltaEtaWidth, termpW); - histogramRegistry.fill(HIST("data/delta_eta_termn"), deltaEtaWidth, termnW); - histogramRegistry.fill(HIST("data/delta_eta_pos_sq"), deltaEtaWidth, fposW * fposW); - histogramRegistry.fill(HIST("data/delta_eta_neg_sq"), deltaEtaWidth, fnegW * fnegW); - histogramRegistry.fill(HIST("data/delta_eta_posneg"), deltaEtaWidth, posnegW); -} else { - - histogramRegistry.fill(HIST("data/delta_eta_pos"), deltaEtaWidth, fpos); - histogramRegistry.fill(HIST("data/delta_eta_neg"), deltaEtaWidth, fneg); - histogramRegistry.fill(HIST("data/delta_eta_termp"), deltaEtaWidth, termp); - histogramRegistry.fill(HIST("data/delta_eta_termn"), deltaEtaWidth, termn); - histogramRegistry.fill(HIST("data/delta_eta_pos_sq"), deltaEtaWidth, fpos * fpos); - histogramRegistry.fill(HIST("data/delta_eta_neg_sq"), deltaEtaWidth, fneg * fneg); - histogramRegistry.fill(HIST("data/delta_eta_posneg"), deltaEtaWidth, posneg); -} + histogramRegistry.fill(HIST("data/delta_eta_pos"), deltaEtaWidth, fposW); + histogramRegistry.fill(HIST("data/delta_eta_neg"), deltaEtaWidth, fnegW); + histogramRegistry.fill(HIST("data/delta_eta_termp"), deltaEtaWidth, termpW); + histogramRegistry.fill(HIST("data/delta_eta_termn"), deltaEtaWidth, termnW); + histogramRegistry.fill(HIST("data/delta_eta_pos_sq"), deltaEtaWidth, fposW * fposW); + histogramRegistry.fill(HIST("data/delta_eta_neg_sq"), deltaEtaWidth, fnegW * fnegW); + histogramRegistry.fill(HIST("data/delta_eta_posneg"), deltaEtaWidth, posnegW); + } else { + + histogramRegistry.fill(HIST("data/delta_eta_pos"), deltaEtaWidth, fpos); + histogramRegistry.fill(HIST("data/delta_eta_neg"), deltaEtaWidth, fneg); + histogramRegistry.fill(HIST("data/delta_eta_termp"), deltaEtaWidth, termp); + histogramRegistry.fill(HIST("data/delta_eta_termn"), deltaEtaWidth, termn); + histogramRegistry.fill(HIST("data/delta_eta_pos_sq"), deltaEtaWidth, fpos * fpos); + histogramRegistry.fill(HIST("data/delta_eta_neg_sq"), deltaEtaWidth, fneg * fneg); + histogramRegistry.fill(HIST("data/delta_eta_posneg"), deltaEtaWidth, posneg); + } float lRandom = fRndm->Rndm(); int sampleIndex = static_cast(cfgNSubsample * lRandom); - - if (cfgEffNue) { - histogramRegistry.fill(HIST("subsample/delta_eta/pos"), deltaEtaWidth, sampleIndex, fposW); - histogramRegistry.fill(HIST("subsample/delta_eta/neg"), deltaEtaWidth, sampleIndex, fnegW); - histogramRegistry.fill(HIST("subsample/delta_eta/termp"), deltaEtaWidth, sampleIndex, termpW); - histogramRegistry.fill(HIST("subsample/delta_eta/termn"), deltaEtaWidth, sampleIndex, termnW); - histogramRegistry.fill(HIST("subsample/delta_eta/pos_sq"), deltaEtaWidth, sampleIndex, fposW * fposW); - histogramRegistry.fill(HIST("subsample/delta_eta/neg_sq"), deltaEtaWidth, sampleIndex, fnegW * fnegW); - histogramRegistry.fill(HIST("subsample/delta_eta/posneg"), deltaEtaWidth, sampleIndex, posnegW); + if (cfgEffNue) { + histogramRegistry.fill(HIST("subsample/delta_eta/pos"), deltaEtaWidth, sampleIndex, fposW); + histogramRegistry.fill(HIST("subsample/delta_eta/neg"), deltaEtaWidth, sampleIndex, fnegW); + histogramRegistry.fill(HIST("subsample/delta_eta/termp"), deltaEtaWidth, sampleIndex, termpW); + histogramRegistry.fill(HIST("subsample/delta_eta/termn"), deltaEtaWidth, sampleIndex, termnW); + histogramRegistry.fill(HIST("subsample/delta_eta/pos_sq"), deltaEtaWidth, sampleIndex, fposW * fposW); + histogramRegistry.fill(HIST("subsample/delta_eta/neg_sq"), deltaEtaWidth, sampleIndex, fnegW * fnegW); + histogramRegistry.fill(HIST("subsample/delta_eta/posneg"), deltaEtaWidth, sampleIndex, posnegW); } else { - histogramRegistry.fill(HIST("subsample/delta_eta/pos"), deltaEtaWidth, sampleIndex, fpos); - histogramRegistry.fill(HIST("subsample/delta_eta/neg"), deltaEtaWidth, sampleIndex, fneg); - histogramRegistry.fill(HIST("subsample/delta_eta/termp"), deltaEtaWidth, sampleIndex, termp); - histogramRegistry.fill(HIST("subsample/delta_eta/termn"), deltaEtaWidth, sampleIndex, termn); - histogramRegistry.fill(HIST("subsample/delta_eta/pos_sq"), deltaEtaWidth, sampleIndex, fpos * fpos); - histogramRegistry.fill(HIST("subsample/delta_eta/neg_sq"), deltaEtaWidth, sampleIndex, fneg * fneg); - histogramRegistry.fill(HIST("subsample/delta_eta/posneg"), deltaEtaWidth, sampleIndex, posneg); + histogramRegistry.fill(HIST("subsample/delta_eta/pos"), deltaEtaWidth, sampleIndex, fpos); + histogramRegistry.fill(HIST("subsample/delta_eta/neg"), deltaEtaWidth, sampleIndex, fneg); + histogramRegistry.fill(HIST("subsample/delta_eta/termp"), deltaEtaWidth, sampleIndex, termp); + histogramRegistry.fill(HIST("subsample/delta_eta/termn"), deltaEtaWidth, sampleIndex, termn); + histogramRegistry.fill(HIST("subsample/delta_eta/pos_sq"), deltaEtaWidth, sampleIndex, fpos * fpos); + histogramRegistry.fill(HIST("subsample/delta_eta/neg_sq"), deltaEtaWidth, sampleIndex, fneg * fneg); + histogramRegistry.fill(HIST("subsample/delta_eta/posneg"), deltaEtaWidth, sampleIndex, posneg); } } @@ -1038,49 +1032,49 @@ for (const auto& track : tracks) { double weight = 1.0 / eff; nch += 1; nchCor += weight; - if (track.sign() == 1) { - fpos += 1; - fposW += weight; - fposW2 += weight * weight; -} else if (track.sign() == -1) { - fneg += 1; - fnegW += weight; - fnegW2 += weight * weight; -} } // tracks + if (track.sign() == 1) { + fpos += 1; + fposW += weight; + fposW2 += weight * weight; + } else if (track.sign() == -1) { + fneg += 1; + fnegW += weight; + fnegW2 += weight * weight; + } + } // tracks termp = fpos * (fpos - 1); termn = fneg * (fneg - 1); posneg = fpos * fneg; - termpW = fposW * fposW - fposW2; - termnW = fnegW * fnegW - fnegW2; + termpW = fposW * fposW - fposW2; + termnW = fnegW * fnegW - fnegW2; posnegW = fposW * fnegW; - histogramRegistry.fill(HIST("data/delta_eta_nch"), deltaEtaWidth, nch); histogramRegistry.fill(HIST("data/delta_eta_nchCor"), deltaEtaWidth, nchCor); histogramRegistry.fill(HIST("data/delta_eta_pos_cor"), deltaEtaWidth, fposW); histogramRegistry.fill(HIST("data/delta_eta_neg_cor"), deltaEtaWidth, fnegW); if (cfgEffNue) { - histogramRegistry.fill(HIST("data/delta_eta_pos"), deltaEtaWidth, fposW); - histogramRegistry.fill(HIST("data/delta_eta_neg"), deltaEtaWidth, fnegW); - histogramRegistry.fill(HIST("data/delta_eta_termp"), deltaEtaWidth, termpW); - histogramRegistry.fill(HIST("data/delta_eta_termn"), deltaEtaWidth, termnW); - histogramRegistry.fill(HIST("data/delta_eta_pos_sq"), deltaEtaWidth, fposW * fposW); - histogramRegistry.fill(HIST("data/delta_eta_neg_sq"), deltaEtaWidth, fnegW * fnegW); - histogramRegistry.fill(HIST("data/delta_eta_posneg"), deltaEtaWidth, posnegW); -} else { - - histogramRegistry.fill(HIST("data/delta_eta_pos"), deltaEtaWidth, fpos); - histogramRegistry.fill(HIST("data/delta_eta_neg"), deltaEtaWidth, fneg); - histogramRegistry.fill(HIST("data/delta_eta_termp"), deltaEtaWidth, termp); - histogramRegistry.fill(HIST("data/delta_eta_termn"), deltaEtaWidth, termn); - histogramRegistry.fill(HIST("data/delta_eta_pos_sq"), deltaEtaWidth, fpos * fpos); - histogramRegistry.fill(HIST("data/delta_eta_neg_sq"), deltaEtaWidth, fneg * fneg); - histogramRegistry.fill(HIST("data/delta_eta_posneg"), deltaEtaWidth, posneg); -} - + histogramRegistry.fill(HIST("data/delta_eta_pos"), deltaEtaWidth, fposW); + histogramRegistry.fill(HIST("data/delta_eta_neg"), deltaEtaWidth, fnegW); + histogramRegistry.fill(HIST("data/delta_eta_termp"), deltaEtaWidth, termpW); + histogramRegistry.fill(HIST("data/delta_eta_termn"), deltaEtaWidth, termnW); + histogramRegistry.fill(HIST("data/delta_eta_pos_sq"), deltaEtaWidth, fposW * fposW); + histogramRegistry.fill(HIST("data/delta_eta_neg_sq"), deltaEtaWidth, fnegW * fnegW); + histogramRegistry.fill(HIST("data/delta_eta_posneg"), deltaEtaWidth, posnegW); + } else { + + histogramRegistry.fill(HIST("data/delta_eta_pos"), deltaEtaWidth, fpos); + histogramRegistry.fill(HIST("data/delta_eta_neg"), deltaEtaWidth, fneg); + histogramRegistry.fill(HIST("data/delta_eta_termp"), deltaEtaWidth, termp); + histogramRegistry.fill(HIST("data/delta_eta_termn"), deltaEtaWidth, termn); + histogramRegistry.fill(HIST("data/delta_eta_pos_sq"), deltaEtaWidth, fpos * fpos); + histogramRegistry.fill(HIST("data/delta_eta_neg_sq"), deltaEtaWidth, fneg * fneg); + histogramRegistry.fill(HIST("data/delta_eta_posneg"), deltaEtaWidth, posneg); + } + const auto& mccolgen = coll.template mcCollision_as(); if (std::abs(mccolgen.posZ()) >= vertexZcut) From b392003293aa8213a297e4240c10cfb06d1911c4 Mon Sep 17 00:00:00 2001 From: nidamalikk Date: Sat, 31 Jan 2026 17:12:21 +0530 Subject: [PATCH 06/11] Net charge --- .../Tasks/netchargeFluctuations.cxx | 342 +++++++++--------- 1 file changed, 171 insertions(+), 171 deletions(-) diff --git a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx index c3201de6c49..9f0cce7c78a 100644 --- a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx @@ -124,10 +124,8 @@ struct NetchargeFluctuations { Configurable cPVcont{"cPVcont", false, "primary vertex contributor"}; // Configurable to enable multiplicity correlation cuts - O2_DEFINE_CONFIGURABLE(cfgEvSelMultCorrelation, bool, false, "Multiplicity correlation cut") - // Struct grouping multiplicity vs centrality/vertex cuts and related parameters struct : ConfigurableGroup { @@ -167,12 +165,11 @@ struct NetchargeFluctuations { } cfgFunCoeff; // Histogram pointer for CCDB efficiency - - + // TH1D* efficiency = nullptr; + TH1D* efficiencyPos = nullptr; TH1D* efficiencyNeg = nullptr; - // Filters for selecting collisions and tracks Filter collisionFilter = nabs(aod::collision::posZ) <= vertexZcut; Filter trackFilter = (nabs(aod::track::eta) < etaCut) && (aod::track::pt > ptMinCut) && (aod::track::pt < ptMaxCut) && (requireGlobalTrackInFilter()); @@ -423,14 +420,12 @@ struct NetchargeFluctuations { ccdb->setLocalObjectValidityChecking(); TList* list = ccdb->getForTimeStamp(cfgPathCCDB.value, -1); - efficiencyPos = reinterpret_cast(list->FindObject("efficiency_Pos_Run3")); efficiencyNeg = reinterpret_cast(list->FindObject("efficiency_Neg_Run3")); // Log fatal error if efficiency histogram is not found if (!efficiencyPos || !efficiencyNeg) { - - // Log fatal error if efficiency histogram is not found - + LOGF(info, "FATAL!! Could not find required histograms in CCDB"); + } } } @@ -565,13 +560,13 @@ struct NetchargeFluctuations { double getEfficiency(float pt, int sign) { - TH1D* hEff = nullptr; - - if (sign > 0) { - hEff = efficiencyPos; - } else if (sign < 0) { - hEff = efficiencyNeg; - } + TH1D* hEff = nullptr; + + if (sign > 0) { + hEff = efficiencyPos; + } else if (sign < 0) { + hEff = efficiencyNeg; + } if (!hEff) { return 1e-6; @@ -646,19 +641,19 @@ struct NetchargeFluctuations { histogramRegistry.fill(HIST("QA/hMultiplicity"), mult); int fpos = 0, fneg = 0, posneg = 0, termn = 0, termp = 0; - double fposW = 0, fnegW = 0, fposW2 = 0.0, fnegW2 = 0.0; + double fposW = 0, fnegW = 0,fposW2 = 0.0, fnegW2 = 0.0; double posnegW = 0.0, termnW = 0.0, termpW = 0.0; int nch = 0, nchTotal = 0; - double nchCor = 0; + double nchCor = 0; for (const auto& track : tracks) { fillBeforeQA(track); nchTotal += 1; if (!selTrack(track)) continue; - - double eff = getEfficiency(track.pt(), track.sign()); - if (eff < threshold) { + + double eff = getEfficiency(track.pt(), track.sign()); + if (eff < threshold){ continue; } double weight = 1.0 / eff; @@ -670,30 +665,31 @@ struct NetchargeFluctuations { histogramRegistry.fill(HIST("data/hPt_cor"), track.pt(), weight); histogramRegistry.fill(HIST("data/hEta_cor"), track.eta(), weight); - if (track.sign() == 1) { - histogramRegistry.fill(HIST("eff/hPt_np"), track.pt()); - } else if (track.sign() == -1) { - histogramRegistry.fill(HIST("eff/hPt_nm"), track.pt()); - } +if (track.sign() ==1){ +histogramRegistry.fill(HIST("eff/hPt_np"), track.pt()); +}else if (track.sign() == -1){ +histogramRegistry.fill(HIST("eff/hPt_nm"), track.pt()); +} nchCor += weight; if (track.sign() == 1) { fpos += 1; - fposW += weight; + fposW += weight; fposW2 += weight * weight; - } else if (track.sign() == -1) { - fneg += 1; - fnegW += weight; - fnegW2 += weight * weight; - } + } + else if (track.sign() == -1) { + fneg +=1; + fnegW += weight; + fnegW2 += weight * weight; + } } // track termp = fpos * (fpos - 1); termn = fneg * (fneg - 1); posneg = fpos * fneg; - termpW = fposW * fposW - fposW2; - termnW = fnegW * fnegW - fnegW2; - posnegW = fposW * fnegW; + termpW = fposW * fposW - fposW2; + termnW = fnegW * fnegW - fnegW2; + posnegW = fposW * fnegW; histogramRegistry.fill(HIST("data/nch_nchCor"), nch, nchCor); histogramRegistry.fill(HIST("data/nchCor"), nchCor); @@ -701,11 +697,12 @@ struct NetchargeFluctuations { histogramRegistry.fill(HIST("data/cent_nch"), cent, nch); histogramRegistry.fill(HIST("data/cent_pos_cor"), cent, fposW); histogramRegistry.fill(HIST("data/cent_neg_cor"), cent, fnegW); - - if (cfgEffNue) { - fillHistograms(nchCor, cent, fposW, fnegW, posnegW, termpW, termnW); + + + if (cfgEffNue) { + fillHistograms(nchCor, cent, fposW, fnegW, posnegW, termpW, termnW); } else { - fillHistograms(nch, cent, fpos, fneg, posneg, termp, termn); + fillHistograms(nch, cent, fpos, fneg, posneg, termp, termn); } } @@ -746,10 +743,10 @@ struct NetchargeFluctuations { histogramRegistry.fill(HIST("QA/hMultiplicity"), mult); int fpos = 0, fneg = 0, posneg = 0, termn = 0, termp = 0; - double fposW = 0.0, fnegW = 0.0, fposW2 = 0.0, fnegW2 = 0.0; + double fposW = 0.0, fnegW = 0.0,fposW2 = 0.0, fnegW2 = 0.0; double posnegW = 0.0, termnW = 0.0, termpW = 0.0; int nch = 0; - double nchCor = 0.0; + double nchCor = 0.0; for (const auto& track : inputTracks) { fillBeforeQA(track); @@ -758,11 +755,11 @@ struct NetchargeFluctuations { nch += 1; fillAfterQA(track); - if (track.sign() == 1) { - histogramRegistry.fill(HIST("eff/hPt_np"), track.pt()); - } else if (track.sign() == -1) { - histogramRegistry.fill(HIST("eff/hPt_nm"), track.pt()); - } + if (track.sign() ==1){ + histogramRegistry.fill(HIST("eff/hPt_np"), track.pt()); + }else if (track.sign() == -1){ + histogramRegistry.fill(HIST("eff/hPt_nm"), track.pt()); + } histogramRegistry.fill(HIST("QA/cent_hEta"), cent, track.eta()); histogramRegistry.fill(HIST("QA/cent_hPt"), cent, track.pt()); @@ -774,36 +771,37 @@ struct NetchargeFluctuations { histogramRegistry.fill(HIST("data/hPt_cor"), track.pt(), weight); histogramRegistry.fill(HIST("data/hEta_cor"), track.eta(), weight); - if (track.sign() == 1) { + if (track.sign() == 1) { fpos += 1; - fposW += weight; + fposW += weight; fposW2 += weight * weight; - } else if (track.sign() == -1) { - fneg += 1; - fnegW += weight; - fnegW2 += weight * weight; - } - nchCor += weight; + } + else if (track.sign() == -1) { + fneg +=1; + fnegW += weight; + fnegW2 += weight * weight; + } + nchCor += weight ; } // track termp = fpos * (fpos - 1); termn = fneg * (fneg - 1); posneg = fpos * fneg; - termpW = fposW * fposW - fposW2; - termnW = fnegW * fnegW - fnegW2; - posnegW = fposW * fnegW; + termpW = fposW * fposW - fposW2; + termnW = fnegW * fnegW - fnegW2; + posnegW = fposW * fnegW; - histogramRegistry.fill(HIST("data/nch_nchCor"), nch, nchCor); - histogramRegistry.fill(HIST("data/nchCor"), nchCor); - histogramRegistry.fill(HIST("data/cent_nchCor"), cent, nchCor); - histogramRegistry.fill(HIST("data/cent_nch"), cent, nch); - histogramRegistry.fill(HIST("data/cent_pos_cor"), cent, fposW); - histogramRegistry.fill(HIST("data/cent_neg_cor"), cent, fnegW); + histogramRegistry.fill(HIST("data/nch_nchCor"), nch, nchCor); + histogramRegistry.fill(HIST("data/nchCor"), nchCor); + histogramRegistry.fill(HIST("data/cent_nchCor"), cent, nchCor); + histogramRegistry.fill(HIST("data/cent_nch"), cent, nch); + histogramRegistry.fill(HIST("data/cent_pos_cor"), cent, fposW); + histogramRegistry.fill(HIST("data/cent_neg_cor"), cent, fnegW); - if (cfgEffNue) { - fillHistograms(nchCor, cent, fposW, fnegW, posnegW, termpW, termnW); + if (cfgEffNue) { + fillHistograms(nchCor, cent, fposW, fnegW, posnegW, termpW, termnW); } else { - fillHistograms(nch, cent, fpos, fneg, posneg, termp, termn); + fillHistograms(nch, cent, fpos, fneg, posneg, termp, termn); } int posGen = 0, negGen = 0, posNegGen = 0, termNGen = 0, termPGen = 0, nchGen = 0; @@ -834,14 +832,14 @@ struct NetchargeFluctuations { continue; if (std::fabs(mcpart.eta()) >= etaCut) continue; - if ((mcpart.pt() <= ptMinCut) || (mcpart.pt() >= ptMaxCut)) { + if ((mcpart.pt() <= ptMinCut) || (mcpart.pt() >= ptMaxCut)){ continue; } - if (sign == 1) { - histogramRegistry.fill(HIST("eff/hPt_np_gen"), mcpart.pt()); - } else if (sign == -1) { - histogramRegistry.fill(HIST("eff/hPt_nm_gen"), mcpart.pt()); - } + if (sign ==1){ + histogramRegistry.fill(HIST("eff/hPt_np_gen"), mcpart.pt()); + }else if (sign == -1){ + histogramRegistry.fill(HIST("eff/hPt_nm_gen"), mcpart.pt()); + } histogramRegistry.fill(HIST("gen/hPt"), mcpart.pt()); histogramRegistry.fill(HIST("gen/cent_hPt"), cent, mcpart.pt()); @@ -856,7 +854,7 @@ struct NetchargeFluctuations { if (sign == -1) { negGen += 1; } - } + } termPGen = posGen * (posGen - 1); termNGen = negGen * (negGen - 1); posNegGen = posGen * negGen; @@ -900,52 +898,52 @@ struct NetchargeFluctuations { histogramRegistry.fill(HIST("data/delta_eta_cent"), cent); int fpos = 0, fneg = 0, termp = 0, termn = 0, posneg = 0; - double fposW = 0.0, fnegW = 0.0; - double fposW2 = 0.0, fnegW2 = 0.0; - double termpW = 0.0, termnW = 0.0, posnegW = 0.0; + double fposW = 0.0, fnegW = 0.0; + double fposW2 = 0.0, fnegW2 = 0.0; + double termpW = 0.0, termnW = 0.0, posnegW = 0.0; - int nch = 0, nchTotal = 0; - double nchCor = 0.0; + int nch = 0, nchTotal = 0; + double nchCor = 0.0; - for (const auto& track : tracks) { +for (const auto& track : tracks) { - nchTotal += 1; - if (!selTrack(track)) - continue; + nchTotal += 1; + if (!selTrack(track)) + continue; - double eta = track.eta(); - if (eta < deta1 || eta > deta2) - continue; + double eta = track.eta(); + if (eta < deta1 || eta > deta2) + continue; - double eff = getEfficiency(track.pt(), track.sign()); - if (eff < threshold) - continue; + double eff = getEfficiency(track.pt(), track.sign()); + if (eff < threshold) + continue; - double weight = 1.0 / eff; + double weight = 1.0 / eff; - nch += 1; - nchCor += weight; + nch += 1; + nchCor += weight; - histogramRegistry.fill(HIST("data/delta_eta_eta"), eta); + histogramRegistry.fill(HIST("data/delta_eta_eta"), eta); - if (track.sign() == 1) { - fpos += 1; - fposW += weight; - fposW2 += weight * weight; - } else if (track.sign() == -1) { - fneg += 1; - fnegW += weight; - fnegW2 += weight * weight; - } - } + if (track.sign() == 1) { + fpos += 1; + fposW += weight; + fposW2 += weight * weight; + } else if (track.sign() == -1) { + fneg += 1; + fnegW += weight; + fnegW2 += weight * weight; + } +} - termp = fpos * (fpos - 1); - termn = fneg * (fneg - 1); - posneg = fpos * fneg; + termp = fpos * (fpos - 1); + termn = fneg * (fneg - 1); + posneg = fpos * fneg; - termpW = fposW * fposW - fposW2; - termnW = fnegW * fnegW - fnegW2; - posnegW = fposW * fnegW; + termpW = fposW * fposW - fposW2; + termnW = fnegW * fnegW - fnegW2; + posnegW = fposW * fnegW; float deltaEtaWidth = deta2 - deta1 + 1e-5f; @@ -954,43 +952,45 @@ struct NetchargeFluctuations { histogramRegistry.fill(HIST("data/delta_eta_pos_cor"), deltaEtaWidth, fposW); histogramRegistry.fill(HIST("data/delta_eta_neg_cor"), deltaEtaWidth, fnegW); - if (cfgEffNue) { - histogramRegistry.fill(HIST("data/delta_eta_pos"), deltaEtaWidth, fposW); - histogramRegistry.fill(HIST("data/delta_eta_neg"), deltaEtaWidth, fnegW); - histogramRegistry.fill(HIST("data/delta_eta_termp"), deltaEtaWidth, termpW); - histogramRegistry.fill(HIST("data/delta_eta_termn"), deltaEtaWidth, termnW); - histogramRegistry.fill(HIST("data/delta_eta_pos_sq"), deltaEtaWidth, fposW * fposW); - histogramRegistry.fill(HIST("data/delta_eta_neg_sq"), deltaEtaWidth, fnegW * fnegW); - histogramRegistry.fill(HIST("data/delta_eta_posneg"), deltaEtaWidth, posnegW); - } else { - histogramRegistry.fill(HIST("data/delta_eta_pos"), deltaEtaWidth, fpos); - histogramRegistry.fill(HIST("data/delta_eta_neg"), deltaEtaWidth, fneg); - histogramRegistry.fill(HIST("data/delta_eta_termp"), deltaEtaWidth, termp); - histogramRegistry.fill(HIST("data/delta_eta_termn"), deltaEtaWidth, termn); - histogramRegistry.fill(HIST("data/delta_eta_pos_sq"), deltaEtaWidth, fpos * fpos); - histogramRegistry.fill(HIST("data/delta_eta_neg_sq"), deltaEtaWidth, fneg * fneg); - histogramRegistry.fill(HIST("data/delta_eta_posneg"), deltaEtaWidth, posneg); - } + if (cfgEffNue) { + histogramRegistry.fill(HIST("data/delta_eta_pos"), deltaEtaWidth, fposW); + histogramRegistry.fill(HIST("data/delta_eta_neg"), deltaEtaWidth, fnegW); + histogramRegistry.fill(HIST("data/delta_eta_termp"), deltaEtaWidth, termpW); + histogramRegistry.fill(HIST("data/delta_eta_termn"), deltaEtaWidth, termnW); + histogramRegistry.fill(HIST("data/delta_eta_pos_sq"), deltaEtaWidth, fposW * fposW); + histogramRegistry.fill(HIST("data/delta_eta_neg_sq"), deltaEtaWidth, fnegW * fnegW); + histogramRegistry.fill(HIST("data/delta_eta_posneg"), deltaEtaWidth, posnegW); +} else { + + histogramRegistry.fill(HIST("data/delta_eta_pos"), deltaEtaWidth, fpos); + histogramRegistry.fill(HIST("data/delta_eta_neg"), deltaEtaWidth, fneg); + histogramRegistry.fill(HIST("data/delta_eta_termp"), deltaEtaWidth, termp); + histogramRegistry.fill(HIST("data/delta_eta_termn"), deltaEtaWidth, termn); + histogramRegistry.fill(HIST("data/delta_eta_pos_sq"), deltaEtaWidth, fpos * fpos); + histogramRegistry.fill(HIST("data/delta_eta_neg_sq"), deltaEtaWidth, fneg * fneg); + histogramRegistry.fill(HIST("data/delta_eta_posneg"), deltaEtaWidth, posneg); +} float lRandom = fRndm->Rndm(); int sampleIndex = static_cast(cfgNSubsample * lRandom); - if (cfgEffNue) { - histogramRegistry.fill(HIST("subsample/delta_eta/pos"), deltaEtaWidth, sampleIndex, fposW); - histogramRegistry.fill(HIST("subsample/delta_eta/neg"), deltaEtaWidth, sampleIndex, fnegW); - histogramRegistry.fill(HIST("subsample/delta_eta/termp"), deltaEtaWidth, sampleIndex, termpW); - histogramRegistry.fill(HIST("subsample/delta_eta/termn"), deltaEtaWidth, sampleIndex, termnW); - histogramRegistry.fill(HIST("subsample/delta_eta/pos_sq"), deltaEtaWidth, sampleIndex, fposW * fposW); - histogramRegistry.fill(HIST("subsample/delta_eta/neg_sq"), deltaEtaWidth, sampleIndex, fnegW * fnegW); - histogramRegistry.fill(HIST("subsample/delta_eta/posneg"), deltaEtaWidth, sampleIndex, posnegW); + + if (cfgEffNue) { + histogramRegistry.fill(HIST("subsample/delta_eta/pos"), deltaEtaWidth, sampleIndex, fposW); + histogramRegistry.fill(HIST("subsample/delta_eta/neg"), deltaEtaWidth, sampleIndex, fnegW); + histogramRegistry.fill(HIST("subsample/delta_eta/termp"), deltaEtaWidth, sampleIndex, termpW); + histogramRegistry.fill(HIST("subsample/delta_eta/termn"), deltaEtaWidth, sampleIndex, termnW); + histogramRegistry.fill(HIST("subsample/delta_eta/pos_sq"), deltaEtaWidth, sampleIndex, fposW * fposW); + histogramRegistry.fill(HIST("subsample/delta_eta/neg_sq"), deltaEtaWidth, sampleIndex, fnegW * fnegW); + histogramRegistry.fill(HIST("subsample/delta_eta/posneg"), deltaEtaWidth, sampleIndex, posnegW); } else { - histogramRegistry.fill(HIST("subsample/delta_eta/pos"), deltaEtaWidth, sampleIndex, fpos); - histogramRegistry.fill(HIST("subsample/delta_eta/neg"), deltaEtaWidth, sampleIndex, fneg); - histogramRegistry.fill(HIST("subsample/delta_eta/termp"), deltaEtaWidth, sampleIndex, termp); - histogramRegistry.fill(HIST("subsample/delta_eta/termn"), deltaEtaWidth, sampleIndex, termn); - histogramRegistry.fill(HIST("subsample/delta_eta/pos_sq"), deltaEtaWidth, sampleIndex, fpos * fpos); - histogramRegistry.fill(HIST("subsample/delta_eta/neg_sq"), deltaEtaWidth, sampleIndex, fneg * fneg); - histogramRegistry.fill(HIST("subsample/delta_eta/posneg"), deltaEtaWidth, sampleIndex, posneg); + histogramRegistry.fill(HIST("subsample/delta_eta/pos"), deltaEtaWidth, sampleIndex, fpos); + histogramRegistry.fill(HIST("subsample/delta_eta/neg"), deltaEtaWidth, sampleIndex, fneg); + histogramRegistry.fill(HIST("subsample/delta_eta/termp"), deltaEtaWidth, sampleIndex, termp); + histogramRegistry.fill(HIST("subsample/delta_eta/termn"), deltaEtaWidth, sampleIndex, termn); + histogramRegistry.fill(HIST("subsample/delta_eta/pos_sq"), deltaEtaWidth, sampleIndex, fpos * fpos); + histogramRegistry.fill(HIST("subsample/delta_eta/neg_sq"), deltaEtaWidth, sampleIndex, fneg * fneg); + histogramRegistry.fill(HIST("subsample/delta_eta/posneg"), deltaEtaWidth, sampleIndex, posneg); } } @@ -1038,49 +1038,49 @@ struct NetchargeFluctuations { double weight = 1.0 / eff; nch += 1; nchCor += weight; - if (track.sign() == 1) { - fpos += 1; - fposW += weight; - fposW2 += weight * weight; - } else if (track.sign() == -1) { - fneg += 1; - fnegW += weight; - fnegW2 += weight * weight; - } - } // tracks + if (track.sign() == 1) { + fpos += 1; + fposW += weight; + fposW2 += weight * weight; +} else if (track.sign() == -1) { + fneg += 1; + fnegW += weight; + fnegW2 += weight * weight; +} } // tracks termp = fpos * (fpos - 1); termn = fneg * (fneg - 1); posneg = fpos * fneg; - termpW = fposW * fposW - fposW2; - termnW = fnegW * fnegW - fnegW2; + termpW = fposW * fposW - fposW2; + termnW = fnegW * fnegW - fnegW2; posnegW = fposW * fnegW; + histogramRegistry.fill(HIST("data/delta_eta_nch"), deltaEtaWidth, nch); histogramRegistry.fill(HIST("data/delta_eta_nchCor"), deltaEtaWidth, nchCor); histogramRegistry.fill(HIST("data/delta_eta_pos_cor"), deltaEtaWidth, fposW); histogramRegistry.fill(HIST("data/delta_eta_neg_cor"), deltaEtaWidth, fnegW); if (cfgEffNue) { - histogramRegistry.fill(HIST("data/delta_eta_pos"), deltaEtaWidth, fposW); - histogramRegistry.fill(HIST("data/delta_eta_neg"), deltaEtaWidth, fnegW); - histogramRegistry.fill(HIST("data/delta_eta_termp"), deltaEtaWidth, termpW); - histogramRegistry.fill(HIST("data/delta_eta_termn"), deltaEtaWidth, termnW); - histogramRegistry.fill(HIST("data/delta_eta_pos_sq"), deltaEtaWidth, fposW * fposW); - histogramRegistry.fill(HIST("data/delta_eta_neg_sq"), deltaEtaWidth, fnegW * fnegW); - histogramRegistry.fill(HIST("data/delta_eta_posneg"), deltaEtaWidth, posnegW); - } else { - - histogramRegistry.fill(HIST("data/delta_eta_pos"), deltaEtaWidth, fpos); - histogramRegistry.fill(HIST("data/delta_eta_neg"), deltaEtaWidth, fneg); - histogramRegistry.fill(HIST("data/delta_eta_termp"), deltaEtaWidth, termp); - histogramRegistry.fill(HIST("data/delta_eta_termn"), deltaEtaWidth, termn); - histogramRegistry.fill(HIST("data/delta_eta_pos_sq"), deltaEtaWidth, fpos * fpos); - histogramRegistry.fill(HIST("data/delta_eta_neg_sq"), deltaEtaWidth, fneg * fneg); - histogramRegistry.fill(HIST("data/delta_eta_posneg"), deltaEtaWidth, posneg); - } - + histogramRegistry.fill(HIST("data/delta_eta_pos"), deltaEtaWidth, fposW); + histogramRegistry.fill(HIST("data/delta_eta_neg"), deltaEtaWidth, fnegW); + histogramRegistry.fill(HIST("data/delta_eta_termp"), deltaEtaWidth, termpW); + histogramRegistry.fill(HIST("data/delta_eta_termn"), deltaEtaWidth, termnW); + histogramRegistry.fill(HIST("data/delta_eta_pos_sq"), deltaEtaWidth, fposW * fposW); + histogramRegistry.fill(HIST("data/delta_eta_neg_sq"), deltaEtaWidth, fnegW * fnegW); + histogramRegistry.fill(HIST("data/delta_eta_posneg"), deltaEtaWidth, posnegW); +} else { + + histogramRegistry.fill(HIST("data/delta_eta_pos"), deltaEtaWidth, fpos); + histogramRegistry.fill(HIST("data/delta_eta_neg"), deltaEtaWidth, fneg); + histogramRegistry.fill(HIST("data/delta_eta_termp"), deltaEtaWidth, termp); + histogramRegistry.fill(HIST("data/delta_eta_termn"), deltaEtaWidth, termn); + histogramRegistry.fill(HIST("data/delta_eta_pos_sq"), deltaEtaWidth, fpos * fpos); + histogramRegistry.fill(HIST("data/delta_eta_neg_sq"), deltaEtaWidth, fneg * fneg); + histogramRegistry.fill(HIST("data/delta_eta_posneg"), deltaEtaWidth, posneg); +} + const auto& mccolgen = coll.template mcCollision_as(); if (std::abs(mccolgen.posZ()) >= vertexZcut) @@ -1183,7 +1183,7 @@ struct NetchargeFluctuations { } } - PROCESS_SWITCH(NetchargeFluctuations, processDataRun2, "Process for Run2 DATA", true); + PROCESS_SWITCH(NetchargeFluctuations, processDataRun2, "Process for Run2 DATA", false); // process function for MC Run3 From 408485cd953de371d7fa1fd596980e5b14742271 Mon Sep 17 00:00:00 2001 From: nidamalikk Date: Sat, 31 Jan 2026 17:13:27 +0530 Subject: [PATCH 07/11] Net charge --- .../Tasks/netchargeFluctuations.cxx | 332 +++++++++--------- 1 file changed, 163 insertions(+), 169 deletions(-) diff --git a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx index 9f0cce7c78a..45b052ba328 100644 --- a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx @@ -165,8 +165,8 @@ struct NetchargeFluctuations { } cfgFunCoeff; // Histogram pointer for CCDB efficiency - // TH1D* efficiency = nullptr; - + // TH1D* efficiency = nullptr; + TH1D* efficiencyPos = nullptr; TH1D* efficiencyNeg = nullptr; @@ -347,7 +347,6 @@ struct NetchargeFluctuations { histogramRegistry.add("QA/hNchGlobal", "", kTH1F, {nchAxis}); histogramRegistry.add("QA/hNchPV", "", kTH1F, {nchAxis}); - histogramRegistry.add("eff/hPt_np_gen", "", kTH1F, {ptAxis}); histogramRegistry.add("eff/hPt_nm_gen", "", kTH1F, {ptAxis}); histogramRegistry.add("eff/hPt_np", "", kTH1F, {ptAxis}); @@ -560,13 +559,13 @@ struct NetchargeFluctuations { double getEfficiency(float pt, int sign) { - TH1D* hEff = nullptr; - - if (sign > 0) { - hEff = efficiencyPos; - } else if (sign < 0) { - hEff = efficiencyNeg; - } + TH1D* hEff = nullptr; + + if (sign > 0) { + hEff = efficiencyPos; + } else if (sign < 0) { + hEff = efficiencyNeg; + } if (!hEff) { return 1e-6; @@ -641,19 +640,19 @@ struct NetchargeFluctuations { histogramRegistry.fill(HIST("QA/hMultiplicity"), mult); int fpos = 0, fneg = 0, posneg = 0, termn = 0, termp = 0; - double fposW = 0, fnegW = 0,fposW2 = 0.0, fnegW2 = 0.0; + double fposW = 0, fnegW = 0, fposW2 = 0.0, fnegW2 = 0.0; double posnegW = 0.0, termnW = 0.0, termpW = 0.0; int nch = 0, nchTotal = 0; - double nchCor = 0; + double nchCor = 0; for (const auto& track : tracks) { fillBeforeQA(track); nchTotal += 1; if (!selTrack(track)) continue; - - double eff = getEfficiency(track.pt(), track.sign()); - if (eff < threshold){ + + double eff = getEfficiency(track.pt(), track.sign()); + if (eff < threshold) { continue; } double weight = 1.0 / eff; @@ -665,31 +664,30 @@ struct NetchargeFluctuations { histogramRegistry.fill(HIST("data/hPt_cor"), track.pt(), weight); histogramRegistry.fill(HIST("data/hEta_cor"), track.eta(), weight); -if (track.sign() ==1){ -histogramRegistry.fill(HIST("eff/hPt_np"), track.pt()); -}else if (track.sign() == -1){ -histogramRegistry.fill(HIST("eff/hPt_nm"), track.pt()); -} + if (track.sign() == 1) { + histogramRegistry.fill(HIST("eff/hPt_np"), track.pt()); + } else if (track.sign() == -1) { + histogramRegistry.fill(HIST("eff/hPt_nm"), track.pt()); + } nchCor += weight; if (track.sign() == 1) { fpos += 1; - fposW += weight; + fposW += weight; fposW2 += weight * weight; - } - else if (track.sign() == -1) { - fneg +=1; - fnegW += weight; - fnegW2 += weight * weight; - } + } else if (track.sign() == -1) { + fneg += 1; + fnegW += weight; + fnegW2 += weight * weight; + } } // track termp = fpos * (fpos - 1); termn = fneg * (fneg - 1); posneg = fpos * fneg; - termpW = fposW * fposW - fposW2; - termnW = fnegW * fnegW - fnegW2; - posnegW = fposW * fnegW; + termpW = fposW * fposW - fposW2; + termnW = fnegW * fnegW - fnegW2; + posnegW = fposW * fnegW; histogramRegistry.fill(HIST("data/nch_nchCor"), nch, nchCor); histogramRegistry.fill(HIST("data/nchCor"), nchCor); @@ -697,12 +695,11 @@ histogramRegistry.fill(HIST("eff/hPt_nm"), track.pt()); histogramRegistry.fill(HIST("data/cent_nch"), cent, nch); histogramRegistry.fill(HIST("data/cent_pos_cor"), cent, fposW); histogramRegistry.fill(HIST("data/cent_neg_cor"), cent, fnegW); - - - if (cfgEffNue) { - fillHistograms(nchCor, cent, fposW, fnegW, posnegW, termpW, termnW); + + if (cfgEffNue) { + fillHistograms(nchCor, cent, fposW, fnegW, posnegW, termpW, termnW); } else { - fillHistograms(nch, cent, fpos, fneg, posneg, termp, termn); + fillHistograms(nch, cent, fpos, fneg, posneg, termp, termn); } } @@ -743,10 +740,10 @@ histogramRegistry.fill(HIST("eff/hPt_nm"), track.pt()); histogramRegistry.fill(HIST("QA/hMultiplicity"), mult); int fpos = 0, fneg = 0, posneg = 0, termn = 0, termp = 0; - double fposW = 0.0, fnegW = 0.0,fposW2 = 0.0, fnegW2 = 0.0; + double fposW = 0.0, fnegW = 0.0, fposW2 = 0.0, fnegW2 = 0.0; double posnegW = 0.0, termnW = 0.0, termpW = 0.0; int nch = 0; - double nchCor = 0.0; + double nchCor = 0.0; for (const auto& track : inputTracks) { fillBeforeQA(track); @@ -755,11 +752,11 @@ histogramRegistry.fill(HIST("eff/hPt_nm"), track.pt()); nch += 1; fillAfterQA(track); - if (track.sign() ==1){ - histogramRegistry.fill(HIST("eff/hPt_np"), track.pt()); - }else if (track.sign() == -1){ - histogramRegistry.fill(HIST("eff/hPt_nm"), track.pt()); - } + if (track.sign() == 1) { + histogramRegistry.fill(HIST("eff/hPt_np"), track.pt()); + } else if (track.sign() == -1) { + histogramRegistry.fill(HIST("eff/hPt_nm"), track.pt()); + } histogramRegistry.fill(HIST("QA/cent_hEta"), cent, track.eta()); histogramRegistry.fill(HIST("QA/cent_hPt"), cent, track.pt()); @@ -771,37 +768,36 @@ histogramRegistry.fill(HIST("eff/hPt_nm"), track.pt()); histogramRegistry.fill(HIST("data/hPt_cor"), track.pt(), weight); histogramRegistry.fill(HIST("data/hEta_cor"), track.eta(), weight); - if (track.sign() == 1) { + if (track.sign() == 1) { fpos += 1; - fposW += weight; + fposW += weight; fposW2 += weight * weight; - } - else if (track.sign() == -1) { - fneg +=1; - fnegW += weight; - fnegW2 += weight * weight; - } - nchCor += weight ; + } else if (track.sign() == -1) { + fneg += 1; + fnegW += weight; + fnegW2 += weight * weight; + } + nchCor += weight; } // track termp = fpos * (fpos - 1); termn = fneg * (fneg - 1); posneg = fpos * fneg; - termpW = fposW * fposW - fposW2; - termnW = fnegW * fnegW - fnegW2; - posnegW = fposW * fnegW; + termpW = fposW * fposW - fposW2; + termnW = fnegW * fnegW - fnegW2; + posnegW = fposW * fnegW; - histogramRegistry.fill(HIST("data/nch_nchCor"), nch, nchCor); - histogramRegistry.fill(HIST("data/nchCor"), nchCor); - histogramRegistry.fill(HIST("data/cent_nchCor"), cent, nchCor); - histogramRegistry.fill(HIST("data/cent_nch"), cent, nch); - histogramRegistry.fill(HIST("data/cent_pos_cor"), cent, fposW); - histogramRegistry.fill(HIST("data/cent_neg_cor"), cent, fnegW); + histogramRegistry.fill(HIST("data/nch_nchCor"), nch, nchCor); + histogramRegistry.fill(HIST("data/nchCor"), nchCor); + histogramRegistry.fill(HIST("data/cent_nchCor"), cent, nchCor); + histogramRegistry.fill(HIST("data/cent_nch"), cent, nch); + histogramRegistry.fill(HIST("data/cent_pos_cor"), cent, fposW); + histogramRegistry.fill(HIST("data/cent_neg_cor"), cent, fnegW); - if (cfgEffNue) { - fillHistograms(nchCor, cent, fposW, fnegW, posnegW, termpW, termnW); + if (cfgEffNue) { + fillHistograms(nchCor, cent, fposW, fnegW, posnegW, termpW, termnW); } else { - fillHistograms(nch, cent, fpos, fneg, posneg, termp, termn); + fillHistograms(nch, cent, fpos, fneg, posneg, termp, termn); } int posGen = 0, negGen = 0, posNegGen = 0, termNGen = 0, termPGen = 0, nchGen = 0; @@ -832,14 +828,14 @@ histogramRegistry.fill(HIST("eff/hPt_nm"), track.pt()); continue; if (std::fabs(mcpart.eta()) >= etaCut) continue; - if ((mcpart.pt() <= ptMinCut) || (mcpart.pt() >= ptMaxCut)){ + if ((mcpart.pt() <= ptMinCut) || (mcpart.pt() >= ptMaxCut)) { continue; } - if (sign ==1){ - histogramRegistry.fill(HIST("eff/hPt_np_gen"), mcpart.pt()); - }else if (sign == -1){ - histogramRegistry.fill(HIST("eff/hPt_nm_gen"), mcpart.pt()); - } + if (sign == 1) { + histogramRegistry.fill(HIST("eff/hPt_np_gen"), mcpart.pt()); + } else if (sign == -1) { + histogramRegistry.fill(HIST("eff/hPt_nm_gen"), mcpart.pt()); + } histogramRegistry.fill(HIST("gen/hPt"), mcpart.pt()); histogramRegistry.fill(HIST("gen/cent_hPt"), cent, mcpart.pt()); @@ -854,7 +850,7 @@ histogramRegistry.fill(HIST("eff/hPt_nm"), track.pt()); if (sign == -1) { negGen += 1; } - } + } termPGen = posGen * (posGen - 1); termNGen = negGen * (negGen - 1); posNegGen = posGen * negGen; @@ -898,52 +894,52 @@ histogramRegistry.fill(HIST("eff/hPt_nm"), track.pt()); histogramRegistry.fill(HIST("data/delta_eta_cent"), cent); int fpos = 0, fneg = 0, termp = 0, termn = 0, posneg = 0; - double fposW = 0.0, fnegW = 0.0; - double fposW2 = 0.0, fnegW2 = 0.0; - double termpW = 0.0, termnW = 0.0, posnegW = 0.0; + double fposW = 0.0, fnegW = 0.0; + double fposW2 = 0.0, fnegW2 = 0.0; + double termpW = 0.0, termnW = 0.0, posnegW = 0.0; - int nch = 0, nchTotal = 0; - double nchCor = 0.0; + int nch = 0, nchTotal = 0; + double nchCor = 0.0; -for (const auto& track : tracks) { + for (const auto& track : tracks) { - nchTotal += 1; - if (!selTrack(track)) - continue; + nchTotal += 1; + if (!selTrack(track)) + continue; - double eta = track.eta(); - if (eta < deta1 || eta > deta2) - continue; + double eta = track.eta(); + if (eta < deta1 || eta > deta2) + continue; - double eff = getEfficiency(track.pt(), track.sign()); - if (eff < threshold) - continue; + double eff = getEfficiency(track.pt(), track.sign()); + if (eff < threshold) + continue; - double weight = 1.0 / eff; + double weight = 1.0 / eff; - nch += 1; - nchCor += weight; + nch += 1; + nchCor += weight; - histogramRegistry.fill(HIST("data/delta_eta_eta"), eta); + histogramRegistry.fill(HIST("data/delta_eta_eta"), eta); - if (track.sign() == 1) { - fpos += 1; - fposW += weight; - fposW2 += weight * weight; - } else if (track.sign() == -1) { - fneg += 1; - fnegW += weight; - fnegW2 += weight * weight; - } -} + if (track.sign() == 1) { + fpos += 1; + fposW += weight; + fposW2 += weight * weight; + } else if (track.sign() == -1) { + fneg += 1; + fnegW += weight; + fnegW2 += weight * weight; + } + } - termp = fpos * (fpos - 1); - termn = fneg * (fneg - 1); - posneg = fpos * fneg; + termp = fpos * (fpos - 1); + termn = fneg * (fneg - 1); + posneg = fpos * fneg; - termpW = fposW * fposW - fposW2; - termnW = fnegW * fnegW - fnegW2; - posnegW = fposW * fnegW; + termpW = fposW * fposW - fposW2; + termnW = fnegW * fnegW - fnegW2; + posnegW = fposW * fnegW; float deltaEtaWidth = deta2 - deta1 + 1e-5f; @@ -952,45 +948,43 @@ for (const auto& track : tracks) { histogramRegistry.fill(HIST("data/delta_eta_pos_cor"), deltaEtaWidth, fposW); histogramRegistry.fill(HIST("data/delta_eta_neg_cor"), deltaEtaWidth, fnegW); - if (cfgEffNue) { - histogramRegistry.fill(HIST("data/delta_eta_pos"), deltaEtaWidth, fposW); - histogramRegistry.fill(HIST("data/delta_eta_neg"), deltaEtaWidth, fnegW); - histogramRegistry.fill(HIST("data/delta_eta_termp"), deltaEtaWidth, termpW); - histogramRegistry.fill(HIST("data/delta_eta_termn"), deltaEtaWidth, termnW); - histogramRegistry.fill(HIST("data/delta_eta_pos_sq"), deltaEtaWidth, fposW * fposW); - histogramRegistry.fill(HIST("data/delta_eta_neg_sq"), deltaEtaWidth, fnegW * fnegW); - histogramRegistry.fill(HIST("data/delta_eta_posneg"), deltaEtaWidth, posnegW); -} else { - - histogramRegistry.fill(HIST("data/delta_eta_pos"), deltaEtaWidth, fpos); - histogramRegistry.fill(HIST("data/delta_eta_neg"), deltaEtaWidth, fneg); - histogramRegistry.fill(HIST("data/delta_eta_termp"), deltaEtaWidth, termp); - histogramRegistry.fill(HIST("data/delta_eta_termn"), deltaEtaWidth, termn); - histogramRegistry.fill(HIST("data/delta_eta_pos_sq"), deltaEtaWidth, fpos * fpos); - histogramRegistry.fill(HIST("data/delta_eta_neg_sq"), deltaEtaWidth, fneg * fneg); - histogramRegistry.fill(HIST("data/delta_eta_posneg"), deltaEtaWidth, posneg); -} + histogramRegistry.fill(HIST("data/delta_eta_pos"), deltaEtaWidth, fposW); + histogramRegistry.fill(HIST("data/delta_eta_neg"), deltaEtaWidth, fnegW); + histogramRegistry.fill(HIST("data/delta_eta_termp"), deltaEtaWidth, termpW); + histogramRegistry.fill(HIST("data/delta_eta_termn"), deltaEtaWidth, termnW); + histogramRegistry.fill(HIST("data/delta_eta_pos_sq"), deltaEtaWidth, fposW * fposW); + histogramRegistry.fill(HIST("data/delta_eta_neg_sq"), deltaEtaWidth, fnegW * fnegW); + histogramRegistry.fill(HIST("data/delta_eta_posneg"), deltaEtaWidth, posnegW); + } else { + + histogramRegistry.fill(HIST("data/delta_eta_pos"), deltaEtaWidth, fpos); + histogramRegistry.fill(HIST("data/delta_eta_neg"), deltaEtaWidth, fneg); + histogramRegistry.fill(HIST("data/delta_eta_termp"), deltaEtaWidth, termp); + histogramRegistry.fill(HIST("data/delta_eta_termn"), deltaEtaWidth, termn); + histogramRegistry.fill(HIST("data/delta_eta_pos_sq"), deltaEtaWidth, fpos * fpos); + histogramRegistry.fill(HIST("data/delta_eta_neg_sq"), deltaEtaWidth, fneg * fneg); + histogramRegistry.fill(HIST("data/delta_eta_posneg"), deltaEtaWidth, posneg); + } float lRandom = fRndm->Rndm(); int sampleIndex = static_cast(cfgNSubsample * lRandom); - - if (cfgEffNue) { - histogramRegistry.fill(HIST("subsample/delta_eta/pos"), deltaEtaWidth, sampleIndex, fposW); - histogramRegistry.fill(HIST("subsample/delta_eta/neg"), deltaEtaWidth, sampleIndex, fnegW); - histogramRegistry.fill(HIST("subsample/delta_eta/termp"), deltaEtaWidth, sampleIndex, termpW); - histogramRegistry.fill(HIST("subsample/delta_eta/termn"), deltaEtaWidth, sampleIndex, termnW); - histogramRegistry.fill(HIST("subsample/delta_eta/pos_sq"), deltaEtaWidth, sampleIndex, fposW * fposW); - histogramRegistry.fill(HIST("subsample/delta_eta/neg_sq"), deltaEtaWidth, sampleIndex, fnegW * fnegW); - histogramRegistry.fill(HIST("subsample/delta_eta/posneg"), deltaEtaWidth, sampleIndex, posnegW); + if (cfgEffNue) { + histogramRegistry.fill(HIST("subsample/delta_eta/pos"), deltaEtaWidth, sampleIndex, fposW); + histogramRegistry.fill(HIST("subsample/delta_eta/neg"), deltaEtaWidth, sampleIndex, fnegW); + histogramRegistry.fill(HIST("subsample/delta_eta/termp"), deltaEtaWidth, sampleIndex, termpW); + histogramRegistry.fill(HIST("subsample/delta_eta/termn"), deltaEtaWidth, sampleIndex, termnW); + histogramRegistry.fill(HIST("subsample/delta_eta/pos_sq"), deltaEtaWidth, sampleIndex, fposW * fposW); + histogramRegistry.fill(HIST("subsample/delta_eta/neg_sq"), deltaEtaWidth, sampleIndex, fnegW * fnegW); + histogramRegistry.fill(HIST("subsample/delta_eta/posneg"), deltaEtaWidth, sampleIndex, posnegW); } else { - histogramRegistry.fill(HIST("subsample/delta_eta/pos"), deltaEtaWidth, sampleIndex, fpos); - histogramRegistry.fill(HIST("subsample/delta_eta/neg"), deltaEtaWidth, sampleIndex, fneg); - histogramRegistry.fill(HIST("subsample/delta_eta/termp"), deltaEtaWidth, sampleIndex, termp); - histogramRegistry.fill(HIST("subsample/delta_eta/termn"), deltaEtaWidth, sampleIndex, termn); - histogramRegistry.fill(HIST("subsample/delta_eta/pos_sq"), deltaEtaWidth, sampleIndex, fpos * fpos); - histogramRegistry.fill(HIST("subsample/delta_eta/neg_sq"), deltaEtaWidth, sampleIndex, fneg * fneg); - histogramRegistry.fill(HIST("subsample/delta_eta/posneg"), deltaEtaWidth, sampleIndex, posneg); + histogramRegistry.fill(HIST("subsample/delta_eta/pos"), deltaEtaWidth, sampleIndex, fpos); + histogramRegistry.fill(HIST("subsample/delta_eta/neg"), deltaEtaWidth, sampleIndex, fneg); + histogramRegistry.fill(HIST("subsample/delta_eta/termp"), deltaEtaWidth, sampleIndex, termp); + histogramRegistry.fill(HIST("subsample/delta_eta/termn"), deltaEtaWidth, sampleIndex, termn); + histogramRegistry.fill(HIST("subsample/delta_eta/pos_sq"), deltaEtaWidth, sampleIndex, fpos * fpos); + histogramRegistry.fill(HIST("subsample/delta_eta/neg_sq"), deltaEtaWidth, sampleIndex, fneg * fneg); + histogramRegistry.fill(HIST("subsample/delta_eta/posneg"), deltaEtaWidth, sampleIndex, posneg); } } @@ -1038,49 +1032,49 @@ for (const auto& track : tracks) { double weight = 1.0 / eff; nch += 1; nchCor += weight; - if (track.sign() == 1) { - fpos += 1; - fposW += weight; - fposW2 += weight * weight; -} else if (track.sign() == -1) { - fneg += 1; - fnegW += weight; - fnegW2 += weight * weight; -} } // tracks + if (track.sign() == 1) { + fpos += 1; + fposW += weight; + fposW2 += weight * weight; + } else if (track.sign() == -1) { + fneg += 1; + fnegW += weight; + fnegW2 += weight * weight; + } + } // tracks termp = fpos * (fpos - 1); termn = fneg * (fneg - 1); posneg = fpos * fneg; - termpW = fposW * fposW - fposW2; - termnW = fnegW * fnegW - fnegW2; + termpW = fposW * fposW - fposW2; + termnW = fnegW * fnegW - fnegW2; posnegW = fposW * fnegW; - histogramRegistry.fill(HIST("data/delta_eta_nch"), deltaEtaWidth, nch); histogramRegistry.fill(HIST("data/delta_eta_nchCor"), deltaEtaWidth, nchCor); histogramRegistry.fill(HIST("data/delta_eta_pos_cor"), deltaEtaWidth, fposW); histogramRegistry.fill(HIST("data/delta_eta_neg_cor"), deltaEtaWidth, fnegW); if (cfgEffNue) { - histogramRegistry.fill(HIST("data/delta_eta_pos"), deltaEtaWidth, fposW); - histogramRegistry.fill(HIST("data/delta_eta_neg"), deltaEtaWidth, fnegW); - histogramRegistry.fill(HIST("data/delta_eta_termp"), deltaEtaWidth, termpW); - histogramRegistry.fill(HIST("data/delta_eta_termn"), deltaEtaWidth, termnW); - histogramRegistry.fill(HIST("data/delta_eta_pos_sq"), deltaEtaWidth, fposW * fposW); - histogramRegistry.fill(HIST("data/delta_eta_neg_sq"), deltaEtaWidth, fnegW * fnegW); - histogramRegistry.fill(HIST("data/delta_eta_posneg"), deltaEtaWidth, posnegW); -} else { - - histogramRegistry.fill(HIST("data/delta_eta_pos"), deltaEtaWidth, fpos); - histogramRegistry.fill(HIST("data/delta_eta_neg"), deltaEtaWidth, fneg); - histogramRegistry.fill(HIST("data/delta_eta_termp"), deltaEtaWidth, termp); - histogramRegistry.fill(HIST("data/delta_eta_termn"), deltaEtaWidth, termn); - histogramRegistry.fill(HIST("data/delta_eta_pos_sq"), deltaEtaWidth, fpos * fpos); - histogramRegistry.fill(HIST("data/delta_eta_neg_sq"), deltaEtaWidth, fneg * fneg); - histogramRegistry.fill(HIST("data/delta_eta_posneg"), deltaEtaWidth, posneg); -} - + histogramRegistry.fill(HIST("data/delta_eta_pos"), deltaEtaWidth, fposW); + histogramRegistry.fill(HIST("data/delta_eta_neg"), deltaEtaWidth, fnegW); + histogramRegistry.fill(HIST("data/delta_eta_termp"), deltaEtaWidth, termpW); + histogramRegistry.fill(HIST("data/delta_eta_termn"), deltaEtaWidth, termnW); + histogramRegistry.fill(HIST("data/delta_eta_pos_sq"), deltaEtaWidth, fposW * fposW); + histogramRegistry.fill(HIST("data/delta_eta_neg_sq"), deltaEtaWidth, fnegW * fnegW); + histogramRegistry.fill(HIST("data/delta_eta_posneg"), deltaEtaWidth, posnegW); + } else { + + histogramRegistry.fill(HIST("data/delta_eta_pos"), deltaEtaWidth, fpos); + histogramRegistry.fill(HIST("data/delta_eta_neg"), deltaEtaWidth, fneg); + histogramRegistry.fill(HIST("data/delta_eta_termp"), deltaEtaWidth, termp); + histogramRegistry.fill(HIST("data/delta_eta_termn"), deltaEtaWidth, termn); + histogramRegistry.fill(HIST("data/delta_eta_pos_sq"), deltaEtaWidth, fpos * fpos); + histogramRegistry.fill(HIST("data/delta_eta_neg_sq"), deltaEtaWidth, fneg * fneg); + histogramRegistry.fill(HIST("data/delta_eta_posneg"), deltaEtaWidth, posneg); + } + const auto& mccolgen = coll.template mcCollision_as(); if (std::abs(mccolgen.posZ()) >= vertexZcut) From 3bd049938011616edf642bcd35f37e1f101a42f3 Mon Sep 17 00:00:00 2001 From: nidamalikk Date: Sat, 31 Jan 2026 17:33:09 +0530 Subject: [PATCH 08/11] Net charge --- PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx index 45b052ba328..b1aa2b74a9c 100644 --- a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx @@ -642,7 +642,7 @@ struct NetchargeFluctuations { int fpos = 0, fneg = 0, posneg = 0, termn = 0, termp = 0; double fposW = 0, fnegW = 0, fposW2 = 0.0, fnegW2 = 0.0; double posnegW = 0.0, termnW = 0.0, termpW = 0.0; - int nch = 0, nchTotal = 0; + int nch = 0; double nchCor = 0; for (const auto& track : tracks) { @@ -898,7 +898,7 @@ struct NetchargeFluctuations { double fposW2 = 0.0, fnegW2 = 0.0; double termpW = 0.0, termnW = 0.0, posnegW = 0.0; - int nch = 0, nchTotal = 0; + int nch = 0; double nchCor = 0.0; for (const auto& track : tracks) { @@ -1012,7 +1012,7 @@ struct NetchargeFluctuations { float deltaEtaWidth = deta2 - deta1 + 1e-5f; int fpos = 0, fneg = 0, posneg = 0, termn = 0, termp = 0; - int nch = 0, nchTotal = 0; + int nch = 0; double fposW = 0.0, fnegW = 0.0; double fposW2 = 0.0, fnegW2 = 0.0; double nchCor = 0.0, termpW = 0.0, termnW = 0.0, posnegW = 0.0; From 5ece44661d3ae7c0670fca90af96efb01733c1ec Mon Sep 17 00:00:00 2001 From: nidamalikk Date: Sat, 31 Jan 2026 17:36:29 +0530 Subject: [PATCH 09/11] Net charge --- .../Tasks/netchargeFluctuations.cxx | 332 +++++++++--------- 1 file changed, 169 insertions(+), 163 deletions(-) diff --git a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx index b1aa2b74a9c..d7c13960fca 100644 --- a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx @@ -165,8 +165,8 @@ struct NetchargeFluctuations { } cfgFunCoeff; // Histogram pointer for CCDB efficiency - // TH1D* efficiency = nullptr; - + // TH1D* efficiency = nullptr; + TH1D* efficiencyPos = nullptr; TH1D* efficiencyNeg = nullptr; @@ -347,6 +347,7 @@ struct NetchargeFluctuations { histogramRegistry.add("QA/hNchGlobal", "", kTH1F, {nchAxis}); histogramRegistry.add("QA/hNchPV", "", kTH1F, {nchAxis}); + histogramRegistry.add("eff/hPt_np_gen", "", kTH1F, {ptAxis}); histogramRegistry.add("eff/hPt_nm_gen", "", kTH1F, {ptAxis}); histogramRegistry.add("eff/hPt_np", "", kTH1F, {ptAxis}); @@ -559,13 +560,13 @@ struct NetchargeFluctuations { double getEfficiency(float pt, int sign) { - TH1D* hEff = nullptr; - - if (sign > 0) { - hEff = efficiencyPos; - } else if (sign < 0) { - hEff = efficiencyNeg; - } + TH1D* hEff = nullptr; + + if (sign > 0) { + hEff = efficiencyPos; + } else if (sign < 0) { + hEff = efficiencyNeg; + } if (!hEff) { return 1e-6; @@ -640,19 +641,19 @@ struct NetchargeFluctuations { histogramRegistry.fill(HIST("QA/hMultiplicity"), mult); int fpos = 0, fneg = 0, posneg = 0, termn = 0, termp = 0; - double fposW = 0, fnegW = 0, fposW2 = 0.0, fnegW2 = 0.0; + double fposW = 0, fnegW = 0,fposW2 = 0.0, fnegW2 = 0.0; double posnegW = 0.0, termnW = 0.0, termpW = 0.0; int nch = 0; - double nchCor = 0; + double nchCor = 0; for (const auto& track : tracks) { fillBeforeQA(track); nchTotal += 1; if (!selTrack(track)) continue; - - double eff = getEfficiency(track.pt(), track.sign()); - if (eff < threshold) { + + double eff = getEfficiency(track.pt(), track.sign()); + if (eff < threshold){ continue; } double weight = 1.0 / eff; @@ -664,30 +665,31 @@ struct NetchargeFluctuations { histogramRegistry.fill(HIST("data/hPt_cor"), track.pt(), weight); histogramRegistry.fill(HIST("data/hEta_cor"), track.eta(), weight); - if (track.sign() == 1) { - histogramRegistry.fill(HIST("eff/hPt_np"), track.pt()); - } else if (track.sign() == -1) { - histogramRegistry.fill(HIST("eff/hPt_nm"), track.pt()); - } +if (track.sign() ==1){ +histogramRegistry.fill(HIST("eff/hPt_np"), track.pt()); +}else if (track.sign() == -1){ +histogramRegistry.fill(HIST("eff/hPt_nm"), track.pt()); +} nchCor += weight; if (track.sign() == 1) { fpos += 1; - fposW += weight; + fposW += weight; fposW2 += weight * weight; - } else if (track.sign() == -1) { - fneg += 1; - fnegW += weight; - fnegW2 += weight * weight; - } + } + else if (track.sign() == -1) { + fneg +=1; + fnegW += weight; + fnegW2 += weight * weight; + } } // track termp = fpos * (fpos - 1); termn = fneg * (fneg - 1); posneg = fpos * fneg; - termpW = fposW * fposW - fposW2; - termnW = fnegW * fnegW - fnegW2; - posnegW = fposW * fnegW; + termpW = fposW * fposW - fposW2; + termnW = fnegW * fnegW - fnegW2; + posnegW = fposW * fnegW; histogramRegistry.fill(HIST("data/nch_nchCor"), nch, nchCor); histogramRegistry.fill(HIST("data/nchCor"), nchCor); @@ -695,11 +697,12 @@ struct NetchargeFluctuations { histogramRegistry.fill(HIST("data/cent_nch"), cent, nch); histogramRegistry.fill(HIST("data/cent_pos_cor"), cent, fposW); histogramRegistry.fill(HIST("data/cent_neg_cor"), cent, fnegW); - - if (cfgEffNue) { - fillHistograms(nchCor, cent, fposW, fnegW, posnegW, termpW, termnW); + + + if (cfgEffNue) { + fillHistograms(nchCor, cent, fposW, fnegW, posnegW, termpW, termnW); } else { - fillHistograms(nch, cent, fpos, fneg, posneg, termp, termn); + fillHistograms(nch, cent, fpos, fneg, posneg, termp, termn); } } @@ -740,10 +743,10 @@ struct NetchargeFluctuations { histogramRegistry.fill(HIST("QA/hMultiplicity"), mult); int fpos = 0, fneg = 0, posneg = 0, termn = 0, termp = 0; - double fposW = 0.0, fnegW = 0.0, fposW2 = 0.0, fnegW2 = 0.0; + double fposW = 0.0, fnegW = 0.0,fposW2 = 0.0, fnegW2 = 0.0; double posnegW = 0.0, termnW = 0.0, termpW = 0.0; int nch = 0; - double nchCor = 0.0; + double nchCor = 0.0; for (const auto& track : inputTracks) { fillBeforeQA(track); @@ -752,11 +755,11 @@ struct NetchargeFluctuations { nch += 1; fillAfterQA(track); - if (track.sign() == 1) { - histogramRegistry.fill(HIST("eff/hPt_np"), track.pt()); - } else if (track.sign() == -1) { - histogramRegistry.fill(HIST("eff/hPt_nm"), track.pt()); - } + if (track.sign() ==1){ + histogramRegistry.fill(HIST("eff/hPt_np"), track.pt()); + }else if (track.sign() == -1){ + histogramRegistry.fill(HIST("eff/hPt_nm"), track.pt()); + } histogramRegistry.fill(HIST("QA/cent_hEta"), cent, track.eta()); histogramRegistry.fill(HIST("QA/cent_hPt"), cent, track.pt()); @@ -768,36 +771,37 @@ struct NetchargeFluctuations { histogramRegistry.fill(HIST("data/hPt_cor"), track.pt(), weight); histogramRegistry.fill(HIST("data/hEta_cor"), track.eta(), weight); - if (track.sign() == 1) { + if (track.sign() == 1) { fpos += 1; - fposW += weight; + fposW += weight; fposW2 += weight * weight; - } else if (track.sign() == -1) { - fneg += 1; - fnegW += weight; - fnegW2 += weight * weight; - } - nchCor += weight; + } + else if (track.sign() == -1) { + fneg +=1; + fnegW += weight; + fnegW2 += weight * weight; + } + nchCor += weight ; } // track termp = fpos * (fpos - 1); termn = fneg * (fneg - 1); posneg = fpos * fneg; - termpW = fposW * fposW - fposW2; - termnW = fnegW * fnegW - fnegW2; - posnegW = fposW * fnegW; + termpW = fposW * fposW - fposW2; + termnW = fnegW * fnegW - fnegW2; + posnegW = fposW * fnegW; - histogramRegistry.fill(HIST("data/nch_nchCor"), nch, nchCor); - histogramRegistry.fill(HIST("data/nchCor"), nchCor); - histogramRegistry.fill(HIST("data/cent_nchCor"), cent, nchCor); - histogramRegistry.fill(HIST("data/cent_nch"), cent, nch); - histogramRegistry.fill(HIST("data/cent_pos_cor"), cent, fposW); - histogramRegistry.fill(HIST("data/cent_neg_cor"), cent, fnegW); + histogramRegistry.fill(HIST("data/nch_nchCor"), nch, nchCor); + histogramRegistry.fill(HIST("data/nchCor"), nchCor); + histogramRegistry.fill(HIST("data/cent_nchCor"), cent, nchCor); + histogramRegistry.fill(HIST("data/cent_nch"), cent, nch); + histogramRegistry.fill(HIST("data/cent_pos_cor"), cent, fposW); + histogramRegistry.fill(HIST("data/cent_neg_cor"), cent, fnegW); - if (cfgEffNue) { - fillHistograms(nchCor, cent, fposW, fnegW, posnegW, termpW, termnW); + if (cfgEffNue) { + fillHistograms(nchCor, cent, fposW, fnegW, posnegW, termpW, termnW); } else { - fillHistograms(nch, cent, fpos, fneg, posneg, termp, termn); + fillHistograms(nch, cent, fpos, fneg, posneg, termp, termn); } int posGen = 0, negGen = 0, posNegGen = 0, termNGen = 0, termPGen = 0, nchGen = 0; @@ -828,14 +832,14 @@ struct NetchargeFluctuations { continue; if (std::fabs(mcpart.eta()) >= etaCut) continue; - if ((mcpart.pt() <= ptMinCut) || (mcpart.pt() >= ptMaxCut)) { + if ((mcpart.pt() <= ptMinCut) || (mcpart.pt() >= ptMaxCut)){ continue; } - if (sign == 1) { - histogramRegistry.fill(HIST("eff/hPt_np_gen"), mcpart.pt()); - } else if (sign == -1) { - histogramRegistry.fill(HIST("eff/hPt_nm_gen"), mcpart.pt()); - } + if (sign ==1){ + histogramRegistry.fill(HIST("eff/hPt_np_gen"), mcpart.pt()); + }else if (sign == -1){ + histogramRegistry.fill(HIST("eff/hPt_nm_gen"), mcpart.pt()); + } histogramRegistry.fill(HIST("gen/hPt"), mcpart.pt()); histogramRegistry.fill(HIST("gen/cent_hPt"), cent, mcpart.pt()); @@ -850,7 +854,7 @@ struct NetchargeFluctuations { if (sign == -1) { negGen += 1; } - } + } termPGen = posGen * (posGen - 1); termNGen = negGen * (negGen - 1); posNegGen = posGen * negGen; @@ -894,52 +898,52 @@ struct NetchargeFluctuations { histogramRegistry.fill(HIST("data/delta_eta_cent"), cent); int fpos = 0, fneg = 0, termp = 0, termn = 0, posneg = 0; - double fposW = 0.0, fnegW = 0.0; - double fposW2 = 0.0, fnegW2 = 0.0; - double termpW = 0.0, termnW = 0.0, posnegW = 0.0; + double fposW = 0.0, fnegW = 0.0; + double fposW2 = 0.0, fnegW2 = 0.0; + double termpW = 0.0, termnW = 0.0, posnegW = 0.0; - int nch = 0; - double nchCor = 0.0; + int nch = 0; + double nchCor = 0.0; - for (const auto& track : tracks) { +for (const auto& track : tracks) { - nchTotal += 1; - if (!selTrack(track)) - continue; + nchTotal += 1; + if (!selTrack(track)) + continue; - double eta = track.eta(); - if (eta < deta1 || eta > deta2) - continue; + double eta = track.eta(); + if (eta < deta1 || eta > deta2) + continue; - double eff = getEfficiency(track.pt(), track.sign()); - if (eff < threshold) - continue; + double eff = getEfficiency(track.pt(), track.sign()); + if (eff < threshold) + continue; - double weight = 1.0 / eff; + double weight = 1.0 / eff; - nch += 1; - nchCor += weight; + nch += 1; + nchCor += weight; - histogramRegistry.fill(HIST("data/delta_eta_eta"), eta); + histogramRegistry.fill(HIST("data/delta_eta_eta"), eta); - if (track.sign() == 1) { - fpos += 1; - fposW += weight; - fposW2 += weight * weight; - } else if (track.sign() == -1) { - fneg += 1; - fnegW += weight; - fnegW2 += weight * weight; - } - } + if (track.sign() == 1) { + fpos += 1; + fposW += weight; + fposW2 += weight * weight; + } else if (track.sign() == -1) { + fneg += 1; + fnegW += weight; + fnegW2 += weight * weight; + } +} - termp = fpos * (fpos - 1); - termn = fneg * (fneg - 1); - posneg = fpos * fneg; + termp = fpos * (fpos - 1); + termn = fneg * (fneg - 1); + posneg = fpos * fneg; - termpW = fposW * fposW - fposW2; - termnW = fnegW * fnegW - fnegW2; - posnegW = fposW * fnegW; + termpW = fposW * fposW - fposW2; + termnW = fnegW * fnegW - fnegW2; + posnegW = fposW * fnegW; float deltaEtaWidth = deta2 - deta1 + 1e-5f; @@ -948,43 +952,45 @@ struct NetchargeFluctuations { histogramRegistry.fill(HIST("data/delta_eta_pos_cor"), deltaEtaWidth, fposW); histogramRegistry.fill(HIST("data/delta_eta_neg_cor"), deltaEtaWidth, fnegW); - if (cfgEffNue) { - histogramRegistry.fill(HIST("data/delta_eta_pos"), deltaEtaWidth, fposW); - histogramRegistry.fill(HIST("data/delta_eta_neg"), deltaEtaWidth, fnegW); - histogramRegistry.fill(HIST("data/delta_eta_termp"), deltaEtaWidth, termpW); - histogramRegistry.fill(HIST("data/delta_eta_termn"), deltaEtaWidth, termnW); - histogramRegistry.fill(HIST("data/delta_eta_pos_sq"), deltaEtaWidth, fposW * fposW); - histogramRegistry.fill(HIST("data/delta_eta_neg_sq"), deltaEtaWidth, fnegW * fnegW); - histogramRegistry.fill(HIST("data/delta_eta_posneg"), deltaEtaWidth, posnegW); - } else { - histogramRegistry.fill(HIST("data/delta_eta_pos"), deltaEtaWidth, fpos); - histogramRegistry.fill(HIST("data/delta_eta_neg"), deltaEtaWidth, fneg); - histogramRegistry.fill(HIST("data/delta_eta_termp"), deltaEtaWidth, termp); - histogramRegistry.fill(HIST("data/delta_eta_termn"), deltaEtaWidth, termn); - histogramRegistry.fill(HIST("data/delta_eta_pos_sq"), deltaEtaWidth, fpos * fpos); - histogramRegistry.fill(HIST("data/delta_eta_neg_sq"), deltaEtaWidth, fneg * fneg); - histogramRegistry.fill(HIST("data/delta_eta_posneg"), deltaEtaWidth, posneg); - } + if (cfgEffNue) { + histogramRegistry.fill(HIST("data/delta_eta_pos"), deltaEtaWidth, fposW); + histogramRegistry.fill(HIST("data/delta_eta_neg"), deltaEtaWidth, fnegW); + histogramRegistry.fill(HIST("data/delta_eta_termp"), deltaEtaWidth, termpW); + histogramRegistry.fill(HIST("data/delta_eta_termn"), deltaEtaWidth, termnW); + histogramRegistry.fill(HIST("data/delta_eta_pos_sq"), deltaEtaWidth, fposW * fposW); + histogramRegistry.fill(HIST("data/delta_eta_neg_sq"), deltaEtaWidth, fnegW * fnegW); + histogramRegistry.fill(HIST("data/delta_eta_posneg"), deltaEtaWidth, posnegW); +} else { + + histogramRegistry.fill(HIST("data/delta_eta_pos"), deltaEtaWidth, fpos); + histogramRegistry.fill(HIST("data/delta_eta_neg"), deltaEtaWidth, fneg); + histogramRegistry.fill(HIST("data/delta_eta_termp"), deltaEtaWidth, termp); + histogramRegistry.fill(HIST("data/delta_eta_termn"), deltaEtaWidth, termn); + histogramRegistry.fill(HIST("data/delta_eta_pos_sq"), deltaEtaWidth, fpos * fpos); + histogramRegistry.fill(HIST("data/delta_eta_neg_sq"), deltaEtaWidth, fneg * fneg); + histogramRegistry.fill(HIST("data/delta_eta_posneg"), deltaEtaWidth, posneg); +} float lRandom = fRndm->Rndm(); int sampleIndex = static_cast(cfgNSubsample * lRandom); - if (cfgEffNue) { - histogramRegistry.fill(HIST("subsample/delta_eta/pos"), deltaEtaWidth, sampleIndex, fposW); - histogramRegistry.fill(HIST("subsample/delta_eta/neg"), deltaEtaWidth, sampleIndex, fnegW); - histogramRegistry.fill(HIST("subsample/delta_eta/termp"), deltaEtaWidth, sampleIndex, termpW); - histogramRegistry.fill(HIST("subsample/delta_eta/termn"), deltaEtaWidth, sampleIndex, termnW); - histogramRegistry.fill(HIST("subsample/delta_eta/pos_sq"), deltaEtaWidth, sampleIndex, fposW * fposW); - histogramRegistry.fill(HIST("subsample/delta_eta/neg_sq"), deltaEtaWidth, sampleIndex, fnegW * fnegW); - histogramRegistry.fill(HIST("subsample/delta_eta/posneg"), deltaEtaWidth, sampleIndex, posnegW); + + if (cfgEffNue) { + histogramRegistry.fill(HIST("subsample/delta_eta/pos"), deltaEtaWidth, sampleIndex, fposW); + histogramRegistry.fill(HIST("subsample/delta_eta/neg"), deltaEtaWidth, sampleIndex, fnegW); + histogramRegistry.fill(HIST("subsample/delta_eta/termp"), deltaEtaWidth, sampleIndex, termpW); + histogramRegistry.fill(HIST("subsample/delta_eta/termn"), deltaEtaWidth, sampleIndex, termnW); + histogramRegistry.fill(HIST("subsample/delta_eta/pos_sq"), deltaEtaWidth, sampleIndex, fposW * fposW); + histogramRegistry.fill(HIST("subsample/delta_eta/neg_sq"), deltaEtaWidth, sampleIndex, fnegW * fnegW); + histogramRegistry.fill(HIST("subsample/delta_eta/posneg"), deltaEtaWidth, sampleIndex, posnegW); } else { - histogramRegistry.fill(HIST("subsample/delta_eta/pos"), deltaEtaWidth, sampleIndex, fpos); - histogramRegistry.fill(HIST("subsample/delta_eta/neg"), deltaEtaWidth, sampleIndex, fneg); - histogramRegistry.fill(HIST("subsample/delta_eta/termp"), deltaEtaWidth, sampleIndex, termp); - histogramRegistry.fill(HIST("subsample/delta_eta/termn"), deltaEtaWidth, sampleIndex, termn); - histogramRegistry.fill(HIST("subsample/delta_eta/pos_sq"), deltaEtaWidth, sampleIndex, fpos * fpos); - histogramRegistry.fill(HIST("subsample/delta_eta/neg_sq"), deltaEtaWidth, sampleIndex, fneg * fneg); - histogramRegistry.fill(HIST("subsample/delta_eta/posneg"), deltaEtaWidth, sampleIndex, posneg); + histogramRegistry.fill(HIST("subsample/delta_eta/pos"), deltaEtaWidth, sampleIndex, fpos); + histogramRegistry.fill(HIST("subsample/delta_eta/neg"), deltaEtaWidth, sampleIndex, fneg); + histogramRegistry.fill(HIST("subsample/delta_eta/termp"), deltaEtaWidth, sampleIndex, termp); + histogramRegistry.fill(HIST("subsample/delta_eta/termn"), deltaEtaWidth, sampleIndex, termn); + histogramRegistry.fill(HIST("subsample/delta_eta/pos_sq"), deltaEtaWidth, sampleIndex, fpos * fpos); + histogramRegistry.fill(HIST("subsample/delta_eta/neg_sq"), deltaEtaWidth, sampleIndex, fneg * fneg); + histogramRegistry.fill(HIST("subsample/delta_eta/posneg"), deltaEtaWidth, sampleIndex, posneg); } } @@ -1032,49 +1038,49 @@ struct NetchargeFluctuations { double weight = 1.0 / eff; nch += 1; nchCor += weight; - if (track.sign() == 1) { - fpos += 1; - fposW += weight; - fposW2 += weight * weight; - } else if (track.sign() == -1) { - fneg += 1; - fnegW += weight; - fnegW2 += weight * weight; - } - } // tracks + if (track.sign() == 1) { + fpos += 1; + fposW += weight; + fposW2 += weight * weight; +} else if (track.sign() == -1) { + fneg += 1; + fnegW += weight; + fnegW2 += weight * weight; +} } // tracks termp = fpos * (fpos - 1); termn = fneg * (fneg - 1); posneg = fpos * fneg; - termpW = fposW * fposW - fposW2; - termnW = fnegW * fnegW - fnegW2; + termpW = fposW * fposW - fposW2; + termnW = fnegW * fnegW - fnegW2; posnegW = fposW * fnegW; + histogramRegistry.fill(HIST("data/delta_eta_nch"), deltaEtaWidth, nch); histogramRegistry.fill(HIST("data/delta_eta_nchCor"), deltaEtaWidth, nchCor); histogramRegistry.fill(HIST("data/delta_eta_pos_cor"), deltaEtaWidth, fposW); histogramRegistry.fill(HIST("data/delta_eta_neg_cor"), deltaEtaWidth, fnegW); if (cfgEffNue) { - histogramRegistry.fill(HIST("data/delta_eta_pos"), deltaEtaWidth, fposW); - histogramRegistry.fill(HIST("data/delta_eta_neg"), deltaEtaWidth, fnegW); - histogramRegistry.fill(HIST("data/delta_eta_termp"), deltaEtaWidth, termpW); - histogramRegistry.fill(HIST("data/delta_eta_termn"), deltaEtaWidth, termnW); - histogramRegistry.fill(HIST("data/delta_eta_pos_sq"), deltaEtaWidth, fposW * fposW); - histogramRegistry.fill(HIST("data/delta_eta_neg_sq"), deltaEtaWidth, fnegW * fnegW); - histogramRegistry.fill(HIST("data/delta_eta_posneg"), deltaEtaWidth, posnegW); - } else { - - histogramRegistry.fill(HIST("data/delta_eta_pos"), deltaEtaWidth, fpos); - histogramRegistry.fill(HIST("data/delta_eta_neg"), deltaEtaWidth, fneg); - histogramRegistry.fill(HIST("data/delta_eta_termp"), deltaEtaWidth, termp); - histogramRegistry.fill(HIST("data/delta_eta_termn"), deltaEtaWidth, termn); - histogramRegistry.fill(HIST("data/delta_eta_pos_sq"), deltaEtaWidth, fpos * fpos); - histogramRegistry.fill(HIST("data/delta_eta_neg_sq"), deltaEtaWidth, fneg * fneg); - histogramRegistry.fill(HIST("data/delta_eta_posneg"), deltaEtaWidth, posneg); - } - + histogramRegistry.fill(HIST("data/delta_eta_pos"), deltaEtaWidth, fposW); + histogramRegistry.fill(HIST("data/delta_eta_neg"), deltaEtaWidth, fnegW); + histogramRegistry.fill(HIST("data/delta_eta_termp"), deltaEtaWidth, termpW); + histogramRegistry.fill(HIST("data/delta_eta_termn"), deltaEtaWidth, termnW); + histogramRegistry.fill(HIST("data/delta_eta_pos_sq"), deltaEtaWidth, fposW * fposW); + histogramRegistry.fill(HIST("data/delta_eta_neg_sq"), deltaEtaWidth, fnegW * fnegW); + histogramRegistry.fill(HIST("data/delta_eta_posneg"), deltaEtaWidth, posnegW); +} else { + + histogramRegistry.fill(HIST("data/delta_eta_pos"), deltaEtaWidth, fpos); + histogramRegistry.fill(HIST("data/delta_eta_neg"), deltaEtaWidth, fneg); + histogramRegistry.fill(HIST("data/delta_eta_termp"), deltaEtaWidth, termp); + histogramRegistry.fill(HIST("data/delta_eta_termn"), deltaEtaWidth, termn); + histogramRegistry.fill(HIST("data/delta_eta_pos_sq"), deltaEtaWidth, fpos * fpos); + histogramRegistry.fill(HIST("data/delta_eta_neg_sq"), deltaEtaWidth, fneg * fneg); + histogramRegistry.fill(HIST("data/delta_eta_posneg"), deltaEtaWidth, posneg); +} + const auto& mccolgen = coll.template mcCollision_as(); if (std::abs(mccolgen.posZ()) >= vertexZcut) From f00c89e4d8f8bf44a3e15fe865d7701bc2ae8366 Mon Sep 17 00:00:00 2001 From: nidamalikk Date: Sat, 31 Jan 2026 17:36:59 +0530 Subject: [PATCH 10/11] Net charge --- .../Tasks/netchargeFluctuations.cxx | 332 +++++++++--------- 1 file changed, 163 insertions(+), 169 deletions(-) diff --git a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx index d7c13960fca..b1aa2b74a9c 100644 --- a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx @@ -165,8 +165,8 @@ struct NetchargeFluctuations { } cfgFunCoeff; // Histogram pointer for CCDB efficiency - // TH1D* efficiency = nullptr; - + // TH1D* efficiency = nullptr; + TH1D* efficiencyPos = nullptr; TH1D* efficiencyNeg = nullptr; @@ -347,7 +347,6 @@ struct NetchargeFluctuations { histogramRegistry.add("QA/hNchGlobal", "", kTH1F, {nchAxis}); histogramRegistry.add("QA/hNchPV", "", kTH1F, {nchAxis}); - histogramRegistry.add("eff/hPt_np_gen", "", kTH1F, {ptAxis}); histogramRegistry.add("eff/hPt_nm_gen", "", kTH1F, {ptAxis}); histogramRegistry.add("eff/hPt_np", "", kTH1F, {ptAxis}); @@ -560,13 +559,13 @@ struct NetchargeFluctuations { double getEfficiency(float pt, int sign) { - TH1D* hEff = nullptr; - - if (sign > 0) { - hEff = efficiencyPos; - } else if (sign < 0) { - hEff = efficiencyNeg; - } + TH1D* hEff = nullptr; + + if (sign > 0) { + hEff = efficiencyPos; + } else if (sign < 0) { + hEff = efficiencyNeg; + } if (!hEff) { return 1e-6; @@ -641,19 +640,19 @@ struct NetchargeFluctuations { histogramRegistry.fill(HIST("QA/hMultiplicity"), mult); int fpos = 0, fneg = 0, posneg = 0, termn = 0, termp = 0; - double fposW = 0, fnegW = 0,fposW2 = 0.0, fnegW2 = 0.0; + double fposW = 0, fnegW = 0, fposW2 = 0.0, fnegW2 = 0.0; double posnegW = 0.0, termnW = 0.0, termpW = 0.0; int nch = 0; - double nchCor = 0; + double nchCor = 0; for (const auto& track : tracks) { fillBeforeQA(track); nchTotal += 1; if (!selTrack(track)) continue; - - double eff = getEfficiency(track.pt(), track.sign()); - if (eff < threshold){ + + double eff = getEfficiency(track.pt(), track.sign()); + if (eff < threshold) { continue; } double weight = 1.0 / eff; @@ -665,31 +664,30 @@ struct NetchargeFluctuations { histogramRegistry.fill(HIST("data/hPt_cor"), track.pt(), weight); histogramRegistry.fill(HIST("data/hEta_cor"), track.eta(), weight); -if (track.sign() ==1){ -histogramRegistry.fill(HIST("eff/hPt_np"), track.pt()); -}else if (track.sign() == -1){ -histogramRegistry.fill(HIST("eff/hPt_nm"), track.pt()); -} + if (track.sign() == 1) { + histogramRegistry.fill(HIST("eff/hPt_np"), track.pt()); + } else if (track.sign() == -1) { + histogramRegistry.fill(HIST("eff/hPt_nm"), track.pt()); + } nchCor += weight; if (track.sign() == 1) { fpos += 1; - fposW += weight; + fposW += weight; fposW2 += weight * weight; - } - else if (track.sign() == -1) { - fneg +=1; - fnegW += weight; - fnegW2 += weight * weight; - } + } else if (track.sign() == -1) { + fneg += 1; + fnegW += weight; + fnegW2 += weight * weight; + } } // track termp = fpos * (fpos - 1); termn = fneg * (fneg - 1); posneg = fpos * fneg; - termpW = fposW * fposW - fposW2; - termnW = fnegW * fnegW - fnegW2; - posnegW = fposW * fnegW; + termpW = fposW * fposW - fposW2; + termnW = fnegW * fnegW - fnegW2; + posnegW = fposW * fnegW; histogramRegistry.fill(HIST("data/nch_nchCor"), nch, nchCor); histogramRegistry.fill(HIST("data/nchCor"), nchCor); @@ -697,12 +695,11 @@ histogramRegistry.fill(HIST("eff/hPt_nm"), track.pt()); histogramRegistry.fill(HIST("data/cent_nch"), cent, nch); histogramRegistry.fill(HIST("data/cent_pos_cor"), cent, fposW); histogramRegistry.fill(HIST("data/cent_neg_cor"), cent, fnegW); - - - if (cfgEffNue) { - fillHistograms(nchCor, cent, fposW, fnegW, posnegW, termpW, termnW); + + if (cfgEffNue) { + fillHistograms(nchCor, cent, fposW, fnegW, posnegW, termpW, termnW); } else { - fillHistograms(nch, cent, fpos, fneg, posneg, termp, termn); + fillHistograms(nch, cent, fpos, fneg, posneg, termp, termn); } } @@ -743,10 +740,10 @@ histogramRegistry.fill(HIST("eff/hPt_nm"), track.pt()); histogramRegistry.fill(HIST("QA/hMultiplicity"), mult); int fpos = 0, fneg = 0, posneg = 0, termn = 0, termp = 0; - double fposW = 0.0, fnegW = 0.0,fposW2 = 0.0, fnegW2 = 0.0; + double fposW = 0.0, fnegW = 0.0, fposW2 = 0.0, fnegW2 = 0.0; double posnegW = 0.0, termnW = 0.0, termpW = 0.0; int nch = 0; - double nchCor = 0.0; + double nchCor = 0.0; for (const auto& track : inputTracks) { fillBeforeQA(track); @@ -755,11 +752,11 @@ histogramRegistry.fill(HIST("eff/hPt_nm"), track.pt()); nch += 1; fillAfterQA(track); - if (track.sign() ==1){ - histogramRegistry.fill(HIST("eff/hPt_np"), track.pt()); - }else if (track.sign() == -1){ - histogramRegistry.fill(HIST("eff/hPt_nm"), track.pt()); - } + if (track.sign() == 1) { + histogramRegistry.fill(HIST("eff/hPt_np"), track.pt()); + } else if (track.sign() == -1) { + histogramRegistry.fill(HIST("eff/hPt_nm"), track.pt()); + } histogramRegistry.fill(HIST("QA/cent_hEta"), cent, track.eta()); histogramRegistry.fill(HIST("QA/cent_hPt"), cent, track.pt()); @@ -771,37 +768,36 @@ histogramRegistry.fill(HIST("eff/hPt_nm"), track.pt()); histogramRegistry.fill(HIST("data/hPt_cor"), track.pt(), weight); histogramRegistry.fill(HIST("data/hEta_cor"), track.eta(), weight); - if (track.sign() == 1) { + if (track.sign() == 1) { fpos += 1; - fposW += weight; + fposW += weight; fposW2 += weight * weight; - } - else if (track.sign() == -1) { - fneg +=1; - fnegW += weight; - fnegW2 += weight * weight; - } - nchCor += weight ; + } else if (track.sign() == -1) { + fneg += 1; + fnegW += weight; + fnegW2 += weight * weight; + } + nchCor += weight; } // track termp = fpos * (fpos - 1); termn = fneg * (fneg - 1); posneg = fpos * fneg; - termpW = fposW * fposW - fposW2; - termnW = fnegW * fnegW - fnegW2; - posnegW = fposW * fnegW; + termpW = fposW * fposW - fposW2; + termnW = fnegW * fnegW - fnegW2; + posnegW = fposW * fnegW; - histogramRegistry.fill(HIST("data/nch_nchCor"), nch, nchCor); - histogramRegistry.fill(HIST("data/nchCor"), nchCor); - histogramRegistry.fill(HIST("data/cent_nchCor"), cent, nchCor); - histogramRegistry.fill(HIST("data/cent_nch"), cent, nch); - histogramRegistry.fill(HIST("data/cent_pos_cor"), cent, fposW); - histogramRegistry.fill(HIST("data/cent_neg_cor"), cent, fnegW); + histogramRegistry.fill(HIST("data/nch_nchCor"), nch, nchCor); + histogramRegistry.fill(HIST("data/nchCor"), nchCor); + histogramRegistry.fill(HIST("data/cent_nchCor"), cent, nchCor); + histogramRegistry.fill(HIST("data/cent_nch"), cent, nch); + histogramRegistry.fill(HIST("data/cent_pos_cor"), cent, fposW); + histogramRegistry.fill(HIST("data/cent_neg_cor"), cent, fnegW); - if (cfgEffNue) { - fillHistograms(nchCor, cent, fposW, fnegW, posnegW, termpW, termnW); + if (cfgEffNue) { + fillHistograms(nchCor, cent, fposW, fnegW, posnegW, termpW, termnW); } else { - fillHistograms(nch, cent, fpos, fneg, posneg, termp, termn); + fillHistograms(nch, cent, fpos, fneg, posneg, termp, termn); } int posGen = 0, negGen = 0, posNegGen = 0, termNGen = 0, termPGen = 0, nchGen = 0; @@ -832,14 +828,14 @@ histogramRegistry.fill(HIST("eff/hPt_nm"), track.pt()); continue; if (std::fabs(mcpart.eta()) >= etaCut) continue; - if ((mcpart.pt() <= ptMinCut) || (mcpart.pt() >= ptMaxCut)){ + if ((mcpart.pt() <= ptMinCut) || (mcpart.pt() >= ptMaxCut)) { continue; } - if (sign ==1){ - histogramRegistry.fill(HIST("eff/hPt_np_gen"), mcpart.pt()); - }else if (sign == -1){ - histogramRegistry.fill(HIST("eff/hPt_nm_gen"), mcpart.pt()); - } + if (sign == 1) { + histogramRegistry.fill(HIST("eff/hPt_np_gen"), mcpart.pt()); + } else if (sign == -1) { + histogramRegistry.fill(HIST("eff/hPt_nm_gen"), mcpart.pt()); + } histogramRegistry.fill(HIST("gen/hPt"), mcpart.pt()); histogramRegistry.fill(HIST("gen/cent_hPt"), cent, mcpart.pt()); @@ -854,7 +850,7 @@ histogramRegistry.fill(HIST("eff/hPt_nm"), track.pt()); if (sign == -1) { negGen += 1; } - } + } termPGen = posGen * (posGen - 1); termNGen = negGen * (negGen - 1); posNegGen = posGen * negGen; @@ -898,52 +894,52 @@ histogramRegistry.fill(HIST("eff/hPt_nm"), track.pt()); histogramRegistry.fill(HIST("data/delta_eta_cent"), cent); int fpos = 0, fneg = 0, termp = 0, termn = 0, posneg = 0; - double fposW = 0.0, fnegW = 0.0; - double fposW2 = 0.0, fnegW2 = 0.0; - double termpW = 0.0, termnW = 0.0, posnegW = 0.0; + double fposW = 0.0, fnegW = 0.0; + double fposW2 = 0.0, fnegW2 = 0.0; + double termpW = 0.0, termnW = 0.0, posnegW = 0.0; - int nch = 0; - double nchCor = 0.0; + int nch = 0; + double nchCor = 0.0; -for (const auto& track : tracks) { + for (const auto& track : tracks) { - nchTotal += 1; - if (!selTrack(track)) - continue; + nchTotal += 1; + if (!selTrack(track)) + continue; - double eta = track.eta(); - if (eta < deta1 || eta > deta2) - continue; + double eta = track.eta(); + if (eta < deta1 || eta > deta2) + continue; - double eff = getEfficiency(track.pt(), track.sign()); - if (eff < threshold) - continue; + double eff = getEfficiency(track.pt(), track.sign()); + if (eff < threshold) + continue; - double weight = 1.0 / eff; + double weight = 1.0 / eff; - nch += 1; - nchCor += weight; + nch += 1; + nchCor += weight; - histogramRegistry.fill(HIST("data/delta_eta_eta"), eta); + histogramRegistry.fill(HIST("data/delta_eta_eta"), eta); - if (track.sign() == 1) { - fpos += 1; - fposW += weight; - fposW2 += weight * weight; - } else if (track.sign() == -1) { - fneg += 1; - fnegW += weight; - fnegW2 += weight * weight; - } -} + if (track.sign() == 1) { + fpos += 1; + fposW += weight; + fposW2 += weight * weight; + } else if (track.sign() == -1) { + fneg += 1; + fnegW += weight; + fnegW2 += weight * weight; + } + } - termp = fpos * (fpos - 1); - termn = fneg * (fneg - 1); - posneg = fpos * fneg; + termp = fpos * (fpos - 1); + termn = fneg * (fneg - 1); + posneg = fpos * fneg; - termpW = fposW * fposW - fposW2; - termnW = fnegW * fnegW - fnegW2; - posnegW = fposW * fnegW; + termpW = fposW * fposW - fposW2; + termnW = fnegW * fnegW - fnegW2; + posnegW = fposW * fnegW; float deltaEtaWidth = deta2 - deta1 + 1e-5f; @@ -952,45 +948,43 @@ for (const auto& track : tracks) { histogramRegistry.fill(HIST("data/delta_eta_pos_cor"), deltaEtaWidth, fposW); histogramRegistry.fill(HIST("data/delta_eta_neg_cor"), deltaEtaWidth, fnegW); - if (cfgEffNue) { - histogramRegistry.fill(HIST("data/delta_eta_pos"), deltaEtaWidth, fposW); - histogramRegistry.fill(HIST("data/delta_eta_neg"), deltaEtaWidth, fnegW); - histogramRegistry.fill(HIST("data/delta_eta_termp"), deltaEtaWidth, termpW); - histogramRegistry.fill(HIST("data/delta_eta_termn"), deltaEtaWidth, termnW); - histogramRegistry.fill(HIST("data/delta_eta_pos_sq"), deltaEtaWidth, fposW * fposW); - histogramRegistry.fill(HIST("data/delta_eta_neg_sq"), deltaEtaWidth, fnegW * fnegW); - histogramRegistry.fill(HIST("data/delta_eta_posneg"), deltaEtaWidth, posnegW); -} else { - - histogramRegistry.fill(HIST("data/delta_eta_pos"), deltaEtaWidth, fpos); - histogramRegistry.fill(HIST("data/delta_eta_neg"), deltaEtaWidth, fneg); - histogramRegistry.fill(HIST("data/delta_eta_termp"), deltaEtaWidth, termp); - histogramRegistry.fill(HIST("data/delta_eta_termn"), deltaEtaWidth, termn); - histogramRegistry.fill(HIST("data/delta_eta_pos_sq"), deltaEtaWidth, fpos * fpos); - histogramRegistry.fill(HIST("data/delta_eta_neg_sq"), deltaEtaWidth, fneg * fneg); - histogramRegistry.fill(HIST("data/delta_eta_posneg"), deltaEtaWidth, posneg); -} + histogramRegistry.fill(HIST("data/delta_eta_pos"), deltaEtaWidth, fposW); + histogramRegistry.fill(HIST("data/delta_eta_neg"), deltaEtaWidth, fnegW); + histogramRegistry.fill(HIST("data/delta_eta_termp"), deltaEtaWidth, termpW); + histogramRegistry.fill(HIST("data/delta_eta_termn"), deltaEtaWidth, termnW); + histogramRegistry.fill(HIST("data/delta_eta_pos_sq"), deltaEtaWidth, fposW * fposW); + histogramRegistry.fill(HIST("data/delta_eta_neg_sq"), deltaEtaWidth, fnegW * fnegW); + histogramRegistry.fill(HIST("data/delta_eta_posneg"), deltaEtaWidth, posnegW); + } else { + + histogramRegistry.fill(HIST("data/delta_eta_pos"), deltaEtaWidth, fpos); + histogramRegistry.fill(HIST("data/delta_eta_neg"), deltaEtaWidth, fneg); + histogramRegistry.fill(HIST("data/delta_eta_termp"), deltaEtaWidth, termp); + histogramRegistry.fill(HIST("data/delta_eta_termn"), deltaEtaWidth, termn); + histogramRegistry.fill(HIST("data/delta_eta_pos_sq"), deltaEtaWidth, fpos * fpos); + histogramRegistry.fill(HIST("data/delta_eta_neg_sq"), deltaEtaWidth, fneg * fneg); + histogramRegistry.fill(HIST("data/delta_eta_posneg"), deltaEtaWidth, posneg); + } float lRandom = fRndm->Rndm(); int sampleIndex = static_cast(cfgNSubsample * lRandom); - - if (cfgEffNue) { - histogramRegistry.fill(HIST("subsample/delta_eta/pos"), deltaEtaWidth, sampleIndex, fposW); - histogramRegistry.fill(HIST("subsample/delta_eta/neg"), deltaEtaWidth, sampleIndex, fnegW); - histogramRegistry.fill(HIST("subsample/delta_eta/termp"), deltaEtaWidth, sampleIndex, termpW); - histogramRegistry.fill(HIST("subsample/delta_eta/termn"), deltaEtaWidth, sampleIndex, termnW); - histogramRegistry.fill(HIST("subsample/delta_eta/pos_sq"), deltaEtaWidth, sampleIndex, fposW * fposW); - histogramRegistry.fill(HIST("subsample/delta_eta/neg_sq"), deltaEtaWidth, sampleIndex, fnegW * fnegW); - histogramRegistry.fill(HIST("subsample/delta_eta/posneg"), deltaEtaWidth, sampleIndex, posnegW); + if (cfgEffNue) { + histogramRegistry.fill(HIST("subsample/delta_eta/pos"), deltaEtaWidth, sampleIndex, fposW); + histogramRegistry.fill(HIST("subsample/delta_eta/neg"), deltaEtaWidth, sampleIndex, fnegW); + histogramRegistry.fill(HIST("subsample/delta_eta/termp"), deltaEtaWidth, sampleIndex, termpW); + histogramRegistry.fill(HIST("subsample/delta_eta/termn"), deltaEtaWidth, sampleIndex, termnW); + histogramRegistry.fill(HIST("subsample/delta_eta/pos_sq"), deltaEtaWidth, sampleIndex, fposW * fposW); + histogramRegistry.fill(HIST("subsample/delta_eta/neg_sq"), deltaEtaWidth, sampleIndex, fnegW * fnegW); + histogramRegistry.fill(HIST("subsample/delta_eta/posneg"), deltaEtaWidth, sampleIndex, posnegW); } else { - histogramRegistry.fill(HIST("subsample/delta_eta/pos"), deltaEtaWidth, sampleIndex, fpos); - histogramRegistry.fill(HIST("subsample/delta_eta/neg"), deltaEtaWidth, sampleIndex, fneg); - histogramRegistry.fill(HIST("subsample/delta_eta/termp"), deltaEtaWidth, sampleIndex, termp); - histogramRegistry.fill(HIST("subsample/delta_eta/termn"), deltaEtaWidth, sampleIndex, termn); - histogramRegistry.fill(HIST("subsample/delta_eta/pos_sq"), deltaEtaWidth, sampleIndex, fpos * fpos); - histogramRegistry.fill(HIST("subsample/delta_eta/neg_sq"), deltaEtaWidth, sampleIndex, fneg * fneg); - histogramRegistry.fill(HIST("subsample/delta_eta/posneg"), deltaEtaWidth, sampleIndex, posneg); + histogramRegistry.fill(HIST("subsample/delta_eta/pos"), deltaEtaWidth, sampleIndex, fpos); + histogramRegistry.fill(HIST("subsample/delta_eta/neg"), deltaEtaWidth, sampleIndex, fneg); + histogramRegistry.fill(HIST("subsample/delta_eta/termp"), deltaEtaWidth, sampleIndex, termp); + histogramRegistry.fill(HIST("subsample/delta_eta/termn"), deltaEtaWidth, sampleIndex, termn); + histogramRegistry.fill(HIST("subsample/delta_eta/pos_sq"), deltaEtaWidth, sampleIndex, fpos * fpos); + histogramRegistry.fill(HIST("subsample/delta_eta/neg_sq"), deltaEtaWidth, sampleIndex, fneg * fneg); + histogramRegistry.fill(HIST("subsample/delta_eta/posneg"), deltaEtaWidth, sampleIndex, posneg); } } @@ -1038,49 +1032,49 @@ for (const auto& track : tracks) { double weight = 1.0 / eff; nch += 1; nchCor += weight; - if (track.sign() == 1) { - fpos += 1; - fposW += weight; - fposW2 += weight * weight; -} else if (track.sign() == -1) { - fneg += 1; - fnegW += weight; - fnegW2 += weight * weight; -} } // tracks + if (track.sign() == 1) { + fpos += 1; + fposW += weight; + fposW2 += weight * weight; + } else if (track.sign() == -1) { + fneg += 1; + fnegW += weight; + fnegW2 += weight * weight; + } + } // tracks termp = fpos * (fpos - 1); termn = fneg * (fneg - 1); posneg = fpos * fneg; - termpW = fposW * fposW - fposW2; - termnW = fnegW * fnegW - fnegW2; + termpW = fposW * fposW - fposW2; + termnW = fnegW * fnegW - fnegW2; posnegW = fposW * fnegW; - histogramRegistry.fill(HIST("data/delta_eta_nch"), deltaEtaWidth, nch); histogramRegistry.fill(HIST("data/delta_eta_nchCor"), deltaEtaWidth, nchCor); histogramRegistry.fill(HIST("data/delta_eta_pos_cor"), deltaEtaWidth, fposW); histogramRegistry.fill(HIST("data/delta_eta_neg_cor"), deltaEtaWidth, fnegW); if (cfgEffNue) { - histogramRegistry.fill(HIST("data/delta_eta_pos"), deltaEtaWidth, fposW); - histogramRegistry.fill(HIST("data/delta_eta_neg"), deltaEtaWidth, fnegW); - histogramRegistry.fill(HIST("data/delta_eta_termp"), deltaEtaWidth, termpW); - histogramRegistry.fill(HIST("data/delta_eta_termn"), deltaEtaWidth, termnW); - histogramRegistry.fill(HIST("data/delta_eta_pos_sq"), deltaEtaWidth, fposW * fposW); - histogramRegistry.fill(HIST("data/delta_eta_neg_sq"), deltaEtaWidth, fnegW * fnegW); - histogramRegistry.fill(HIST("data/delta_eta_posneg"), deltaEtaWidth, posnegW); -} else { - - histogramRegistry.fill(HIST("data/delta_eta_pos"), deltaEtaWidth, fpos); - histogramRegistry.fill(HIST("data/delta_eta_neg"), deltaEtaWidth, fneg); - histogramRegistry.fill(HIST("data/delta_eta_termp"), deltaEtaWidth, termp); - histogramRegistry.fill(HIST("data/delta_eta_termn"), deltaEtaWidth, termn); - histogramRegistry.fill(HIST("data/delta_eta_pos_sq"), deltaEtaWidth, fpos * fpos); - histogramRegistry.fill(HIST("data/delta_eta_neg_sq"), deltaEtaWidth, fneg * fneg); - histogramRegistry.fill(HIST("data/delta_eta_posneg"), deltaEtaWidth, posneg); -} - + histogramRegistry.fill(HIST("data/delta_eta_pos"), deltaEtaWidth, fposW); + histogramRegistry.fill(HIST("data/delta_eta_neg"), deltaEtaWidth, fnegW); + histogramRegistry.fill(HIST("data/delta_eta_termp"), deltaEtaWidth, termpW); + histogramRegistry.fill(HIST("data/delta_eta_termn"), deltaEtaWidth, termnW); + histogramRegistry.fill(HIST("data/delta_eta_pos_sq"), deltaEtaWidth, fposW * fposW); + histogramRegistry.fill(HIST("data/delta_eta_neg_sq"), deltaEtaWidth, fnegW * fnegW); + histogramRegistry.fill(HIST("data/delta_eta_posneg"), deltaEtaWidth, posnegW); + } else { + + histogramRegistry.fill(HIST("data/delta_eta_pos"), deltaEtaWidth, fpos); + histogramRegistry.fill(HIST("data/delta_eta_neg"), deltaEtaWidth, fneg); + histogramRegistry.fill(HIST("data/delta_eta_termp"), deltaEtaWidth, termp); + histogramRegistry.fill(HIST("data/delta_eta_termn"), deltaEtaWidth, termn); + histogramRegistry.fill(HIST("data/delta_eta_pos_sq"), deltaEtaWidth, fpos * fpos); + histogramRegistry.fill(HIST("data/delta_eta_neg_sq"), deltaEtaWidth, fneg * fneg); + histogramRegistry.fill(HIST("data/delta_eta_posneg"), deltaEtaWidth, posneg); + } + const auto& mccolgen = coll.template mcCollision_as(); if (std::abs(mccolgen.posZ()) >= vertexZcut) From 0e27b591078b4723e01d2cd8db56abe51f75da57 Mon Sep 17 00:00:00 2001 From: nidamalikk Date: Sat, 31 Jan 2026 18:14:38 +0530 Subject: [PATCH 11/11] Net charge --- PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx | 3 --- 1 file changed, 3 deletions(-) diff --git a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx index b1aa2b74a9c..77f8c37a625 100644 --- a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx @@ -647,7 +647,6 @@ struct NetchargeFluctuations { for (const auto& track : tracks) { fillBeforeQA(track); - nchTotal += 1; if (!selTrack(track)) continue; @@ -903,7 +902,6 @@ struct NetchargeFluctuations { for (const auto& track : tracks) { - nchTotal += 1; if (!selTrack(track)) continue; @@ -1018,7 +1016,6 @@ struct NetchargeFluctuations { double nchCor = 0.0, termpW = 0.0, termnW = 0.0, posnegW = 0.0; for (const auto& track : inputTracks) { - nchTotal += 1; if (!selTrack(track)) continue; double eta = track.eta();